(function () {
-var version = "4.11.0";
+var version = "4.12.2";
-var d3_ascending = function(a, b) {
+function d3_ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
-};
+}
-var d3_bisector = function(compare) {
+function d3_bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
return lo;
}
};
-};
+}
function ascendingComparator(f) {
return function(d, x) {
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
-var pairs = function(array, f) {
+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];
}
-var cross = function(values0, values1, reduce) {
+function cross(values0, values1, reduce) {
var n0 = values0.length,
n1 = values1.length,
values = new Array(n0 * n1),
}
return values;
-};
+}
-var d3_descending = function(a, b) {
+function d3_descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
-};
+}
-var number = function(x) {
+function number(x) {
return x === null ? NaN : +x;
-};
+}
-var variance = function(values, valueof) {
+function variance(values, valueof) {
var n = values.length,
m = 0,
i = -1,
}
if (m > 1) return sum / (m - 1);
-};
+}
-var deviation = function(array, f) {
+function deviation(array, f) {
var v = variance(array, f);
return v ? Math.sqrt(v) : v;
-};
+}
-var extent = function(values, valueof) {
+function extent(values, valueof) {
var n = values.length,
i = -1,
value,
}
return [min, max];
-};
+}
var array = Array.prototype;
var slice = array.slice;
var map = array.map;
-var constant = function(x) {
+function constant(x) {
return function() {
return x;
};
-};
+}
-var identity = function(x) {
+function identity(x) {
return x;
-};
+}
-var d3_range = function(start, stop, step) {
+function d3_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,
}
return range;
-};
+}
var e10 = Math.sqrt(50);
var e5 = Math.sqrt(10);
var e2 = Math.sqrt(2);
-var ticks = function(start, stop, count) {
+function ticks(start, stop, count) {
var reverse,
i = -1,
n,
if (reverse) ticks.reverse();
return ticks;
-};
+}
function tickIncrement(start, stop, count) {
var step = (stop - start) / Math.max(0, count),
return stop < start ? -step1 : step1;
}
-var sturges = function(values) {
+function sturges(values) {
return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
-};
+}
-var histogram = function() {
+function histogram() {
var value = identity,
domain = extent,
threshold = sturges;
};
return histogram;
-};
+}
-var threshold = function(values, p, valueof) {
+function threshold(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);
value0 = +valueof(values[i0], i0, values),
value1 = +valueof(values[i0 + 1], i0 + 1, values);
return value0 + (value1 - value0) * (i - i0);
-};
+}
-var freedmanDiaconis = function(values, min, max) {
+function freedmanDiaconis(values, min, max) {
values = map.call(values, number).sort(d3_ascending);
return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3)));
-};
+}
-var scott = function(values, min, max) {
+function scott(values, min, max) {
return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
-};
+}
-var max = function(values, valueof) {
+function max(values, valueof) {
var n = values.length,
i = -1,
value,
}
return max;
-};
+}
-var mean = function(values, valueof) {
+function mean(values, valueof) {
var n = values.length,
m = n,
i = -1,
}
if (m) return sum / m;
-};
+}
-var d3_median = function(values, valueof) {
+function d3_median(values, valueof) {
var n = values.length,
i = -1,
value,
}
return threshold(numbers.sort(d3_ascending), 0.5);
-};
+}
-var merge = function(arrays) {
+function merge(arrays) {
var n = arrays.length,
m,
i = -1,
}
return merged;
-};
+}
-var min = function(values, valueof) {
+function min(values, valueof) {
var n = values.length,
i = -1,
value,
}
return min;
-};
+}
-var permute = function(array, indexes) {
+function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
-};
+}
-var scan = function(values, compare) {
+function scan(values, compare) {
if (!(n = values.length)) return;
var n,
i = 0,
}
if (compare(xj, xj) === 0) return j;
-};
+}
-var shuffle = function(array, i0, i1) {
+function shuffle(array, i0, i1) {
var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
t,
i;
}
return array;
-};
+}
-var sum = function(values, valueof) {
+function sum(values, valueof) {
var n = values.length,
i = -1,
value,
}
return sum;
-};
+}
-var transpose = function(matrix) {
+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;) {
}
}
return transpose;
-};
+}
function length(d) {
return d.length;
}
-var zip = function() {
+function zip() {
return transpose(arguments);
-};
+}
var slice$1 = Array.prototype.slice;
-var identity$1 = function(x) {
+function identity$1(x) {
return x;
-};
+}
var top = 1;
var right = 2;
xmlns: "http://www.w3.org/2000/xmlns/"
};
-var namespace = function(name) {
+function namespace(name) {
var prefix = name += "", i = prefix.indexOf(":");
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;
-};
+}
function creatorInherit(name) {
return function() {
};
}
-var creator = function(name) {
+function creator(name) {
var fullname = namespace(name);
return (fullname.local
? creatorFixed
: creatorInherit)(fullname);
-};
+}
var nextId = 0;
-function local$1() {
+function local() {
return new Local;
}
this._ = "@" + (++nextId).toString(36);
}
-Local.prototype = local$1.prototype = {
+Local.prototype = local.prototype = {
constructor: Local,
get: function(node) {
var id = this._;
};
}
-var selection_on = function(typename, value, capture) {
+function selection_on(typename, value, capture) {
var typenames = parseTypenames$1(typename + ""), i, n = typenames.length, t;
if (arguments.length < 2) {
if (capture == null) capture = false;
for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
return this;
-};
+}
function customEvent(event1, listener, that, args) {
var event0 = event;
}
}
-var sourceEvent = function() {
+function sourceEvent() {
var current = event, source;
while (source = current.sourceEvent) current = source;
return current;
-};
+}
-var point = function(node, event) {
+function point(node, event) {
var svg = node.ownerSVGElement || node;
if (svg.createSVGPoint) {
var rect = node.getBoundingClientRect();
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
-};
+}
-var d3_mouse = function(node) {
+function d3_mouse(node) {
var event = sourceEvent();
if (event.changedTouches) event = event.changedTouches[0];
return point(node, event);
-};
+}
function none() {}
-var selector = function(selector) {
+function selector(selector) {
return selector == null ? none : function() {
return this.querySelector(selector);
};
-};
+}
-var selection_select = function(select) {
+function selection_select(select) {
if (typeof select !== "function") select = selector(select);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
}
return new Selection(subgroups, this._parents);
-};
+}
-function empty$1() {
+function empty() {
return [];
}
-var selectorAll = function(selector) {
- return selector == null ? empty$1 : function() {
+function selectorAll(selector) {
+ return selector == null ? empty : function() {
return this.querySelectorAll(selector);
};
-};
+}
-var selection_selectAll = function(select) {
+function selection_selectAll(select) {
if (typeof select !== "function") select = selectorAll(select);
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
}
return new Selection(subgroups, parents);
-};
+}
-var selection_filter = function(match) {
+function selection_filter(match) {
if (typeof match !== "function") match = matcher$1(match);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
}
return new Selection(subgroups, this._parents);
-};
+}
-var sparse = function(update) {
+function sparse(update) {
return new Array(update.length);
-};
+}
-var selection_enter = function() {
+function selection_enter() {
return new Selection(this._enter || this._groups.map(sparse), this._parents);
-};
+}
function EnterNode(parent, datum) {
this.ownerDocument = parent.ownerDocument;
querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
};
-var constant$1 = function(x) {
+function constant$1(x) {
return function() {
return x;
};
-};
+}
var keyPrefix = "$"; // Protect against keys like “__proto__”.
}
}
-var selection_data = function(value, key) {
+function selection_data(value, key) {
if (!value) {
data = new Array(this.size()), j = -1;
this.each(function(d) { data[++j] = d; });
update._enter = enter;
update._exit = exit;
return update;
-};
+}
-var selection_exit = function() {
+function selection_exit() {
return new Selection(this._exit || this._groups.map(sparse), this._parents);
-};
+}
-var selection_merge = function(selection$$1) {
+function selection_merge(selection$$1) {
for (var groups0 = this._groups, groups1 = selection$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
}
return new Selection(merges, this._parents);
-};
+}
-var selection_order = function() {
+function selection_order() {
for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
}
return this;
-};
+}
-var selection_sort = function(compare) {
+function selection_sort(compare) {
if (!compare) compare = ascending;
function compareNode(a, b) {
}
return new Selection(sortgroups, this._parents).order();
-};
+}
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
-var selection_call = function() {
+function selection_call() {
var callback = arguments[0];
arguments[0] = this;
callback.apply(null, arguments);
return this;
-};
+}
-var selection_nodes = function() {
+function selection_nodes() {
var nodes = new Array(this.size()), i = -1;
this.each(function() { nodes[++i] = this; });
return nodes;
-};
+}
-var selection_node = function() {
+function selection_node() {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
}
return null;
-};
+}
-var selection_size = function() {
+function selection_size() {
var size = 0;
this.each(function() { ++size; });
return size;
-};
+}
-var selection_empty = function() {
+function selection_empty() {
return !this.node();
-};
+}
-var selection_each = function(callback) {
+function selection_each(callback) {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
}
return this;
-};
+}
function attrRemove(name) {
return function() {
};
}
-var selection_attr = function(name, value) {
+function selection_attr(name, value) {
var fullname = namespace(name);
if (arguments.length < 2) {
? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
? (fullname.local ? attrFunctionNS : attrFunction)
: (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
-};
+}
-var defaultView = function(node) {
+function defaultView(node) {
return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|| (node.document && node) // node is a Window
|| node.defaultView; // node is a Document
-};
+}
function styleRemove(name) {
return function() {
};
}
-var selection_style = function(name, value, priority) {
+function selection_style(name, value, priority) {
return arguments.length > 1
? this.each((value == null
? styleRemove : typeof value === "function"
? styleFunction
: styleConstant)(name, value, priority == null ? "" : priority))
: styleValue(this.node(), name);
-};
+}
function styleValue(node, name) {
return node.style.getPropertyValue(name)
};
}
-var selection_property = function(name, value) {
+function selection_property(name, value) {
return arguments.length > 1
? this.each((value == null
? propertyRemove : typeof value === "function"
? propertyFunction
: propertyConstant)(name, value))
: this.node()[name];
-};
+}
function classArray(string) {
return string.trim().split(/^|\s+/);
};
}
-var selection_classed = function(name, value) {
+function selection_classed(name, value) {
var names = classArray(name + "");
if (arguments.length < 2) {
? classedFunction : value
? classedTrue
: classedFalse)(names, value));
-};
+}
function textRemove() {
this.textContent = "";
};
}
-var selection_text = function(value) {
+function selection_text(value) {
return arguments.length
? this.each(value == null
? textRemove : (typeof value === "function"
? textFunction
: textConstant)(value))
: this.node().textContent;
-};
+}
function htmlRemove() {
this.innerHTML = "";
};
}
-var selection_html = function(value) {
+function selection_html(value) {
return arguments.length
? this.each(value == null
? htmlRemove : (typeof value === "function"
? htmlFunction
: htmlConstant)(value))
: this.node().innerHTML;
-};
+}
function raise() {
if (this.nextSibling) this.parentNode.appendChild(this);
}
-var selection_raise = function() {
+function selection_raise() {
return this.each(raise);
-};
+}
function lower() {
if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
-var selection_lower = function() {
+function selection_lower() {
return this.each(lower);
-};
+}
-var selection_append = function(name) {
+function selection_append(name) {
var create = typeof name === "function" ? name : creator(name);
return this.select(function() {
return this.appendChild(create.apply(this, arguments));
});
-};
+}
function constantNull() {
return null;
}
-var selection_insert = function(name, before) {
+function selection_insert(name, before) {
var create = typeof name === "function" ? name : creator(name),
select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
return this.select(function() {
return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
});
-};
+}
function remove() {
var parent = this.parentNode;
if (parent) parent.removeChild(this);
}
-var selection_remove = function() {
+function selection_remove() {
return this.each(remove);
-};
+}
-var selection_datum = function(value) {
+function selection_datum(value) {
return arguments.length
? this.property("__data__", value)
: this.node().__data__;
-};
+}
function dispatchEvent(node, type, params) {
var window = defaultView(node),
};
}
-var selection_dispatch = function(type, params) {
+function selection_dispatch(type, params) {
return this.each((typeof params === "function"
? dispatchFunction
: dispatchConstant)(type, params));
-};
+}
var root = [null];
dispatch: selection_dispatch
};
-var d3_select = function(selector) {
+function d3_select(selector) {
return typeof selector === "string"
? new Selection([[document.querySelector(selector)]], [document.documentElement])
: new Selection([[selector]], root);
-};
+}
-var d3_selectAll = function(selector) {
+function d3_selectAll(selector) {
return typeof selector === "string"
? new Selection([document.querySelectorAll(selector)], [document.documentElement])
: new Selection([selector == null ? [] : selector], root);
-};
+}
-var touch = function(node, touches, identifier) {
+function touch(node, touches, identifier) {
if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
}
return null;
-};
+}
-var d3_touches = function(node, touches) {
+function d3_touches(node, touches) {
if (touches == null) touches = sourceEvent().touches;
for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {
}
return points;
-};
+}
function nopropagation() {
event.stopImmediatePropagation();
}
-var noevent = function() {
+function noevent() {
event.preventDefault();
event.stopImmediatePropagation();
-};
+}
-var dragDisable = function(view) {
+function dragDisable(view) {
var root = view.document.documentElement,
selection = d3_select(view).on("dragstart.drag", noevent, true);
if ("onselectstart" in root) {
root.__noselect = root.style.MozUserSelect;
root.style.MozUserSelect = "none";
}
-};
+}
function yesdrag(view, noclick) {
var root = view.document.documentElement,
}
}
-var constant$2 = function(x) {
+function constant$2(x) {
return function() {
return x;
};
-};
+}
function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {
this.target = target;
};
// Ignore right-click, since that should open the context menu.
-function defaultFilter$1() {
+function defaultFilter() {
return !event.button;
}
return "ontouchstart" in this;
}
-var drag = function() {
- var filter = defaultFilter$1,
+function drag() {
+ var filter = defaultFilter,
container = defaultContainer,
subject = defaultSubject,
touchable = defaultTouchable,
};
return drag;
-};
+}
-var define = function(constructor, factory, prototype) {
+function define(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
-};
+}
function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
+ t3 * v3) / 6;
}
-var basis$1 = function(values) {
+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),
v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
return basis((t - i / n) * n, v0, v1, v2, v3);
};
-};
+}
-var basisClosed = function(values) {
+function basisClosed(values) {
var n = values.length;
return function(t) {
var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
v3 = values[(i + 2) % n];
return basis((t - i / n) * n, v0, v1, v2, v3);
};
-};
+}
-var constant$3 = function(x) {
+function constant$3(x) {
return function() {
return x;
};
-};
+}
function linear(a, d) {
return function(t) {
var rgbBasis = rgbSpline(basis$1);
var rgbBasisClosed = rgbSpline(basisClosed);
-var array$1 = function(a, b) {
+function array$1(a, b) {
var nb = b ? b.length : 0,
na = a ? Math.min(nb, a.length) : 0,
- x = new Array(nb),
+ x = new Array(na),
c = new Array(nb),
i;
for (i = 0; i < na; ++i) c[i] = x[i](t);
return c;
};
-};
+}
-var date = function(a, b) {
+function date(a, b) {
var d = new Date;
return a = +a, b -= a, function(t) {
return d.setTime(a + b * t), d;
};
-};
+}
-var d3_interpolateNumber = function(a, b) {
+function d3_interpolateNumber(a, b) {
return a = +a, b -= a, function(t) {
return a + b * t;
};
-};
+}
-var object = function(a, b) {
+function object(a, b) {
var i = {},
c = {},
k;
for (k in i) c[k] = i[k](t);
return c;
};
-};
+}
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var reB = new RegExp(reA.source, "g");
};
}
-var interpolateString = function(a, b) {
+function interpolateString(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
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
});
-};
+}
-var d3_interpolate = function(a, b) {
+function d3_interpolate(a, b) {
var t = typeof b, c;
return b == null || t === "boolean" ? constant$3(b)
: (t === "number" ? d3_interpolateNumber
: Array.isArray(b) ? array$1
: typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
: d3_interpolateNumber)(a, b);
-};
+}
-var interpolateRound = function(a, b) {
+function interpolateRound(a, b) {
return a = +a, b -= a, function(t) {
return Math.round(a + b * t);
};
-};
+}
var degrees = 180 / Math.PI;
scaleY: 1
};
-var decompose = function(a, b, c, d, e, f) {
+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;
scaleX: scaleX,
scaleY: scaleY
};
-};
+}
var cssNode;
var cssRoot;
// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
-var interpolateZoom = function(p0, p1) {
+function interpolateZoom(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
dx = ux1 - ux0,
i.duration = S * 1000;
return i;
-};
+}
function hsl$1(hue$$1) {
return function(start, end) {
var cubehelix$2 = cubehelix$1(hue);
var cubehelixLong = cubehelix$1(nogamma);
-var d3_quantize = function(interpolator, n) {
+function d3_quantize(interpolator, n) {
var samples = new Array(n);
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
return samples;
-};
+}
var frame = 0;
var timeout = 0;
}
}
-var d3_timeout = function(callback, delay, time) {
+function d3_timeout(callback, delay, time) {
var t = new Timer;
delay = delay == null ? 0 : +delay;
t.restart(function(elapsed) {
callback(elapsed + delay);
}, delay, time);
return t;
-};
+}
-var interval$1 = function(callback, delay, time) {
+function interval$1(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;
callback(elapsed);
}, delay, time);
return t;
-};
+}
var emptyOn = dispatch("start", "end", "interrupt");
var emptyTween = [];
var ENDING = 5;
var ENDED = 6;
-var schedule = function(node, name, id, index, group, timing) {
+function schedule(node, name, id, index, group, timing) {
var schedules = node.__transition;
if (!schedules) node.__transition = {};
else if (id in schedules) return;
timer: null,
state: CREATED
});
-};
+}
function init(node, id) {
- var schedule = node.__transition;
- if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error("too late");
+ var schedule = get$1(node, id);
+ if (schedule.state > CREATED) throw new Error("too late; already scheduled");
return schedule;
}
function set$1(node, id) {
- var schedule = node.__transition;
- if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error("too late");
+ var schedule = get$1(node, id);
+ if (schedule.state > STARTING) throw new Error("too late; already started");
return schedule;
}
function get$1(node, id) {
var schedule = node.__transition;
- if (!schedule || !(schedule = schedule[id])) throw new Error("too late");
+ if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
return schedule;
}
}
}
-var interrupt = function(node, name) {
+function interrupt(node, name) {
var schedules = node.__transition,
schedule$$1,
active,
}
if (empty) delete node.__transition;
-};
+}
-var selection_interrupt = function(name) {
+function selection_interrupt(name) {
return this.each(function() {
interrupt(this, name);
});
-};
+}
function tweenRemove(id, name) {
var tween0, tween1;
};
}
-var transition_tween = function(name, value) {
+function transition_tween(name, value) {
var id = this._id;
name += "";
}
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
-};
+}
function tweenValue(transition, name, value) {
var id = transition._id;
};
}
-var interpolate = function(a, b) {
+function interpolate(a, b) {
var c;
return (typeof b === "number" ? d3_interpolateNumber
: b instanceof color ? d3_interpolateRgb
: (c = color(b)) ? (b = c, d3_interpolateRgb)
: interpolateString)(a, b);
-};
+}
function attrRemove$1(name) {
return function() {
};
}
-var transition_attr = function(name, value) {
+function transition_attr(name, value) {
var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate;
return this.attrTween(name, typeof value === "function"
? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value))
: value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname)
: (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value + ""));
-};
+}
function attrTweenNS(fullname, value) {
function tween() {
return tween;
}
-var transition_attrTween = function(name, value) {
+function transition_attrTween(name, value) {
var key = "attr." + name;
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
var fullname = namespace(name);
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
-};
+}
function delayFunction(id, value) {
return function() {
};
}
-var transition_delay = function(value) {
+function transition_delay(value) {
var id = this._id;
return arguments.length
? delayFunction
: delayConstant)(id, value))
: get$1(this.node(), id).delay;
-};
+}
function durationFunction(id, value) {
return function() {
};
}
-var transition_duration = function(value) {
+function transition_duration(value) {
var id = this._id;
return arguments.length
? durationFunction
: durationConstant)(id, value))
: get$1(this.node(), id).duration;
-};
+}
function easeConstant(id, value) {
if (typeof value !== "function") throw new Error;
};
}
-var transition_ease = function(value) {
+function transition_ease(value) {
var id = this._id;
return arguments.length
? this.each(easeConstant(id, value))
: get$1(this.node(), id).ease;
-};
+}
-var transition_filter = function(match) {
+function transition_filter(match) {
if (typeof match !== "function") match = matcher$1(match);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
}
return new Transition(subgroups, this._parents, this._name, this._id);
-};
+}
-var transition_merge = function(transition$$1) {
+function transition_merge(transition$$1) {
if (transition$$1._id !== this._id) throw new Error;
for (var groups0 = this._groups, groups1 = transition$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
}
return new Transition(merges, this._parents, this._name, this._id);
-};
+}
function start(name) {
return (name + "").trim().split(/^|\s+/).every(function(t) {
};
}
-var transition_on = function(name, listener) {
+function transition_on(name, listener) {
var id = this._id;
return arguments.length < 2
? get$1(this.node(), id).on.on(name)
: this.each(onFunction(id, name, listener));
-};
+}
function removeFunction(id) {
return function() {
};
}
-var transition_remove = function() {
+function transition_remove() {
return this.on("end.remove", removeFunction(this._id));
-};
+}
-var transition_select = function(select) {
+function transition_select(select) {
var name = this._name,
id = this._id;
}
return new Transition(subgroups, this._parents, name, id);
-};
+}
-var transition_selectAll = function(select) {
+function transition_selectAll(select) {
var name = this._name,
id = this._id;
}
return new Transition(subgroups, parents, name, id);
-};
+}
var Selection$1 = selection.prototype.constructor;
-var transition_selection = function() {
+function transition_selection() {
return new Selection$1(this._groups, this._parents);
-};
+}
function styleRemove$1(name, interpolate$$1) {
var value00,
};
}
-var transition_style = function(name, value, priority) {
+function transition_style(name, value, priority) {
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
return value == null ? this
.styleTween(name, styleRemove$1(name, i))
: this.styleTween(name, typeof value === "function"
? styleFunction$1(name, i, tweenValue(this, "style." + name, value))
: styleConstant$1(name, i, value + ""), priority);
-};
+}
function styleTween(name, value, priority) {
function tween() {
return tween;
}
-var transition_styleTween = function(name, value, priority) {
+function transition_styleTween(name, value, priority) {
var key = "style." + (name += "");
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
-};
+}
function textConstant$1(value) {
return function() {
};
}
-var transition_text = function(value) {
+function transition_text(value) {
return this.tween("text", typeof value === "function"
? textFunction$1(tweenValue(this, "text", value))
: textConstant$1(value == null ? "" : value + ""));
-};
+}
-var transition_transition = function() {
+function transition_transition() {
var name = this._name,
id0 = this._id,
id1 = newId();
}
return new Transition(groups, this._parents, name, id1);
-};
+}
var id = 0;
return timing;
}
-var selection_transition = function(name) {
+function selection_transition(name) {
var id,
timing;
}
return new Transition(groups, this._parents, name, id);
-};
+}
selection.prototype.interrupt = selection_interrupt;
selection.prototype.transition = selection_transition;
var root$1 = [null];
-var active = function(node, name) {
+function active(node, name) {
var schedules = node.__transition,
schedule$$1,
i;
}
return null;
-};
+}
-var constant$4 = function(x) {
+function constant$4(x) {
return function() {
return x;
};
-};
+}
-var BrushEvent = function(target, type, selection) {
+function BrushEvent(target, type, selection) {
this.target = target;
this.type = type;
this.selection = selection;
-};
+}
function nopropagation$1() {
event.stopImmediatePropagation();
}
-var noevent$1 = function() {
+function noevent$1() {
event.preventDefault();
event.stopImmediatePropagation();
-};
+}
var MODE_DRAG = {name: "drag"};
var MODE_SPACE = {name: "space"};
}
// Ignore right-click, since that should open the context menu.
-function defaultFilter() {
+function defaultFilter$1() {
return !event.button;
}
}
// Like d3.local, but with the name “__brush” rather than auto-generated.
-function local(node) {
+function local$1(node) {
while (!node.__brush) if (!(node = node.parentNode)) return;
return node.__brush;
}
-function empty(extent) {
+function empty$1(extent) {
return extent[0][0] === extent[1][0]
|| extent[0][1] === extent[1][1];
}
return brush$1(Y);
}
-var brush = function() {
+function brush() {
return brush$1(XY);
-};
+}
function brush$1(dim) {
var extent = defaultExtent,
- filter = defaultFilter,
+ filter = defaultFilter$1,
listeners = dispatch(brush, "start", "brush", "end"),
handleSize = 6,
touchending;
.attr("cursor", cursors.overlay)
.merge(overlay)
.each(function() {
- var extent = local(this).extent;
+ var extent = local$1(this).extent;
d3_select(this)
.attr("x", extent[0][0])
.attr("y", extent[0][1])
i = d3_interpolate(selection0, selection1);
function tween(t) {
- state.selection = t === 1 && empty(selection1) ? null : i(t);
+ state.selection = t === 1 && empty$1(selection1) ? null : i(t);
redraw.call(that);
emit.brush();
}
emit = emitter(that, args).beforestart();
interrupt(that);
- state.selection = selection1 == null || empty(selection1) ? null : selection1;
+ state.selection = selection1 == null || empty$1(selection1) ? null : selection1;
redraw.call(that);
emit.start().brush().end();
});
function redraw() {
var group = d3_select(this),
- selection = local(this).selection;
+ selection = local$1(this).selection;
if (selection) {
group.selectAll(".selection")
mode = (event.metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (event.altKey ? MODE_CENTER : MODE_HANDLE),
signX = dim === Y ? null : signsX[type],
signY = dim === X ? null : signsY[type],
- state = local(that),
+ state = local$1(that),
extent = state.extent,
selection = state.selection,
W = extent[0][0], w0, w1,
group.attr("pointer-events", "all");
overlay.attr("cursor", cursors.overlay);
if (state.selection) selection = state.selection; // May be set by brush.move (on start)!
- if (empty(selection)) state.selection = null, redraw.call(that);
+ if (empty$1(selection)) state.selection = null, redraw.call(that);
emit.end();
}
};
}
-var chord = function() {
+function chord() {
var padAngle = 0,
sortGroups = null,
sortSubgroups = null,
};
return chord;
-};
+}
var slice$2 = Array.prototype.slice;
-var constant$5 = function(x) {
+function constant$5(x) {
return function() {
return x;
};
-};
+}
var pi$2 = Math.PI;
var tau$2 = 2 * pi$2;
return d.endAngle;
}
-var ribbon = function() {
+function ribbon() {
var source = defaultSource,
target = defaultTarget,
radius = defaultRadius,
};
return ribbon;
-};
+}
var prefix = "$";
return map;
}
-var nest = function() {
+function nest() {
var keys = [],
sortKeys = [],
sortValues,
sortValues: function(order) { sortValues = order; return nest; },
rollup: function(f) { rollup = f; return nest; }
};
-};
+}
function createObject() {
return {};
return set;
}
-var keys = function(map) {
+function keys(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
-};
+}
-var values = function(map) {
+function values(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
-};
+}
-var entries = function(map) {
+function entries(map) {
var entries = [];
for (var key in map) entries.push({key: key, value: map[key]});
return entries;
-};
+}
var EOL = {};
var EOF = {};
return columns;
}
-var dsv = function(delimiter) {
+function dsv(delimiter) {
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
DELIMITER = delimiter.charCodeAt(0);
if (convert) return convert(row, i - 1);
columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
});
- rows.columns = columns;
+ rows.columns = columns || [];
return rows;
}
format: format,
formatRows: formatRows
};
-};
+}
var csv = dsv(",");
var tsvFormat = tsv.format;
var tsvFormatRows = tsv.formatRows;
-var center$1 = function(x, y) {
+function center$1(x, y) {
var nodes;
if (x == null) x = 0;
};
return force;
-};
+}
-var constant$6 = function(x) {
+function constant$6(x) {
return function() {
return x;
};
-};
+}
-var jiggle = function() {
+function jiggle() {
return (Math.random() - 0.5) * 1e-6;
-};
+}
-var tree_add = function(d) {
+function tree_add(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
return this;
}
-var tree_cover = function(x, y) {
+function tree_cover(x, y) {
if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points
var x0 = this._x0,
this._x1 = x1;
this._y1 = y1;
return this;
-};
+}
-var tree_data = function() {
+function tree_data() {
var data = [];
this.visit(function(node) {
if (!node.length) do data.push(node.data); while (node = node.next)
});
return data;
-};
+}
-var tree_extent = function(_) {
+function tree_extent(_) {
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) {
+function Quad(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) {
+function tree_find(x, y, radius) {
var data,
x0 = this._x0,
y0 = this._y0,
}
return data;
-};
+}
-var tree_remove = function(d) {
+function tree_remove(d) {
if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points
var parent,
}
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() {
+function tree_root() {
return this._root;
-};
+}
-var tree_size = function() {
+function tree_size() {
var size = 0;
this.visit(function(node) {
if (!node.length) do ++size; while (node = node.next)
});
return size;
-};
+}
-var tree_visit = function(callback) {
+function tree_visit(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()) {
}
}
return this;
-};
+}
-var tree_visitAfter = function(callback) {
+function tree_visitAfter(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()) {
callback(q.node, q.x0, q.y0, q.x1, q.y1);
}
return this;
-};
+}
function defaultX(d) {
return d[0];
}
-var tree_x = function(_) {
+function tree_x(_) {
return arguments.length ? (this._x = _, this) : this._x;
-};
+}
function defaultY(d) {
return d[1];
}
-var tree_y = function(_) {
+function tree_y(_) {
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 d.y + d.vy;
}
-var collide = function(radius) {
+function collide(radius) {
var nodes,
radii,
strength = 1,
};
return force;
-};
+}
-function index$1(d) {
+function index(d) {
return d.index;
}
return node;
}
-var link = function(links) {
- var id = index$1,
+function link(links) {
+ var id = index,
strength = defaultStrength,
strengths,
distance = constant$6(30),
};
return force;
-};
+}
function x$1(d) {
return d.x;
var initialRadius = 10;
var initialAngle = Math.PI * (3 - Math.sqrt(5));
-var simulation = function(nodes) {
+function simulation(nodes) {
var simulation,
alpha = 1,
alphaMin = 0.001,
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
}
};
-};
+}
-var manyBody = function() {
+function manyBody() {
var nodes,
node,
alpha,
};
return force;
-};
+}
-var radial = function(radius, x, y) {
+function radial(radius, x, y) {
var nodes,
strength = constant$6(0.1),
strengths,
};
return force;
-};
+}
-var x$2 = function(x) {
+function x$2(x) {
var strength = constant$6(0.1),
nodes,
strengths,
};
return force;
-};
+}
-var y$2 = function(y) {
+function y$2(y) {
var strength = constant$6(0.1),
nodes,
strengths,
};
return force;
-};
+}
// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimal(1.23) returns ["123", 0].
-var formatDecimal = function(x, p) {
+function formatDecimal(x, p) {
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
var i, coefficient = x.slice(0, i);
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x.slice(i + 1)
];
-};
+}
-var exponent$1 = function(x) {
+function exponent$1(x) {
return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
-};
+}
-var formatGroup = function(grouping, thousands) {
+function formatGroup(grouping, thousands) {
return function(value, width) {
var i = value.length,
t = [],
return t.reverse().join(thousands);
};
-};
+}
-var formatNumerals = function(numerals) {
+function formatNumerals(numerals) {
return function(value) {
return value.replace(/[0-9]/g, function(i) {
return numerals[+i];
});
};
-};
+}
-var formatDefault = function(x, p) {
+function formatDefault(x, p) {
x = x.toPrecision(p);
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {
}
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
-};
+}
var prefixExponent;
-var formatPrefixAuto = function(x, p) {
+function formatPrefixAuto(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
: i > n ? coefficient + new Array(i - n + 1).join("0")
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
: "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!
-};
+}
-var formatRounded = function(x, p) {
+function formatRounded(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
-};
+}
var formatTypes = {
"": formatDefault,
+ this.type;
};
-var identity$3 = function(x) {
+function identity$3(x) {
return x;
-};
+}
var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
-var formatLocale = function(locale) {
+function formatLocale(locale) {
var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity$3,
currency = locale.currency,
decimal = locale.decimal,
format: newFormat,
formatPrefix: formatPrefix
};
-};
+}
var locale;
var format;
return locale;
}
-var precisionFixed = function(step) {
+function precisionFixed(step) {
return Math.max(0, -exponent$1(Math.abs(step)));
-};
+}
-var precisionPrefix = function(step, value) {
+function precisionPrefix(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3 - exponent$1(Math.abs(step)));
-};
+}
-var precisionRound = function(step, max) {
+function precisionRound(step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent$1(max) - exponent$1(step)) + 1;
-};
+}
// Adds floating point numbers with twice the normal precision.
// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and
// Code adapted from GeographicLib by Charles F. F. Karney,
// http://geographiclib.sourceforge.net/
-var adder = function() {
+function adder() {
return new Adder;
-};
+}
function Adder() {
this.reset();
stream.polygonEnd();
}
-var d3_geoStream = function(object, stream) {
+function d3_geoStream(object, stream) {
if (object && streamObjectType.hasOwnProperty(object.type)) {
streamObjectType[object.type](object, stream);
} else {
streamGeometry(object, stream);
}
-};
+}
var areaRingSum = adder();
lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
}
-var d3_geoArea = function(object) {
+function d3_geoArea(object) {
areaSum.reset();
d3_geoStream(object, areaStream);
return areaSum * 2;
-};
+}
function spherical(cartesian) {
return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];
return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
}
-var d3_geoBounds = function(feature) {
+function d3_geoBounds(feature) {
var i, n, a, b, merged, deltaMax, delta;
phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);
return lambda0$1 === Infinity || phi0 === Infinity
? [[NaN, NaN], [NaN, NaN]]
: [[lambda0$1, phi0], [lambda1, phi1]];
-};
+}
var W0;
var W1;
centroidPointCartesian(x0, y0, z0);
}
-var d3_geoCentroid = function(object) {
+function d3_geoCentroid(object) {
W0 = W1 =
X0 = Y0 = Z0 =
X1 = Y1 = Z1 =
}
return [atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1];
-};
+}
-var constant$7 = function(x) {
+function constant$7(x) {
return function() {
return x;
};
-};
+}
-var compose = function(a, b) {
+function compose(a, b) {
function compose(x, y) {
return x = a(x, y), b(x[0], x[1]);
};
return compose;
-};
+}
function rotationIdentity(lambda, phi) {
return [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi];
return rotation;
}
-var rotation = function(rotate) {
+function rotation(rotate) {
rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
function forward(coordinates) {
};
return forward;
-};
+}
// Generates a circle centered at [0°, 0°], with a given radius and precision.
function circleStream(stream, radius, delta, direction, t0, t1) {
return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3;
}
-var circle = function() {
+function circle() {
var center = constant$7([0, 0]),
radius = constant$7(90),
precision = constant$7(6),
};
return circle;
-};
+}
-var clipBuffer = function() {
+function clipBuffer() {
var lines = [],
line;
return {
return result;
}
};
-};
+}
-var pointEqual = function(a, b) {
+function pointEqual(a, b) {
return abs(a[0] - b[0]) < epsilon$2 && abs(a[1] - b[1]) < epsilon$2;
-};
+}
function Intersection(point, points, other, entry) {
this.x = point;
// A generalized polygon clipping algorithm: given a polygon that has been cut
// into its visible line segments, and rejoins the segments by interpolating
// along the clip edge.
-var clipRejoin = function(segments, compareIntersection, startInside, interpolate, stream) {
+function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {
var subject = [],
clip = [],
i,
} while (!current.v);
stream.lineEnd();
}
-};
+}
function link$1(array) {
if (!(n = array.length)) return;
var sum$1 = adder();
-var polygonContains = function(polygon, point) {
+function polygonContains(polygon, point) {
var lambda = point[0],
phi = point[1],
normal = [sin$1(lambda), -cos$1(lambda), 0],
// same side as the South pole.
return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ (winding & 1);
-};
+}
-var clip = function(pointVisible, clipLine, interpolate, start) {
+function clip(pointVisible, clipLine, interpolate, start) {
return function(sink) {
var line = clipLine(sink),
ringBuffer = clipBuffer(),
return clip;
};
-};
+}
function validSegment(segment) {
return segment.length > 1;
}
}
-var clipCircle = function(radius) {
+function clipCircle(radius) {
var cr = cos$1(radius),
delta = 6 * radians,
smallRadius = cr > 0,
}
return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]);
-};
+}
-var clipLine = function(a, b, x0, y0, x1, y1) {
+function clipLine(a, b, x0, y0, x1, y1) {
var ax = a[0],
ay = a[1],
bx = b[0],
if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
return true;
-};
+}
var clipMax = 1e9;
var clipMin = -clipMax;
};
}
-var extent$1 = function() {
+function extent$1() {
var x0 = 0,
y0 = 0,
x1 = 960,
return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]];
}
};
-};
+}
var lengthSum = adder();
var lambda0$2;
lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi;
}
-var d3_geoLength = function(object) {
+function d3_geoLength(object) {
lengthSum.reset();
d3_geoStream(object, lengthStream);
return +lengthSum;
-};
+}
var coordinates = [null, null];
var object$1 = {type: "LineString", coordinates: coordinates};
-var distance = function(a, b) {
+function distance(a, b) {
coordinates[0] = a;
coordinates[1] = b;
return d3_geoLength(object$1);
-};
+}
var containsObjectType = {
Feature: function(object, point) {
return [point[0] * radians, point[1] * radians];
}
-var contains = function(object, point) {
+function contains(object, point) {
return (object && containsObjectType.hasOwnProperty(object.type)
? containsObjectType[object.type]
: containsGeometry)(object, point);
-};
+}
function graticuleX(y0, y1, dy) {
var y = d3_range(y0, y1 - epsilon$2, dy).concat(y1);
return graticule()();
}
-var interpolate$1 = function(a, b) {
+function interpolate$1(a, b) {
var x0 = a[0] * radians,
y0 = a[1] * radians,
x1 = b[0] * radians,
interpolate.distance = d;
return interpolate;
-};
+}
-var identity$4 = function(x) {
+function identity$4(x) {
return x;
-};
+}
var areaSum$1 = adder();
var areaRingSum$1 = adder();
+ "z";
}
-var d3_geoPath = function(projection, context) {
+function d3_geoPath(projection, context) {
var pointRadius = 4.5,
projectionStream,
contextStream;
};
return path.projection(projection).context(context);
-};
+}
-var d3_geoTransform = function(methods) {
+function d3_geoTransform(methods) {
return {
stream: transformer(methods)
};
-};
+}
function transformer(methods) {
return function(stream) {
polygonEnd: function() { this.stream.polygonEnd(); }
};
-function fitExtent(projection, extent, object) {
- var w = extent[1][0] - extent[0][0],
- h = extent[1][1] - extent[0][1],
- clip = projection.clipExtent && projection.clipExtent();
-
- projection
- .scale(150)
- .translate([0, 0]);
-
+function fit(projection, fitBounds, object) {
+ var clip = projection.clipExtent && projection.clipExtent();
+ projection.scale(150).translate([0, 0]);
if (clip != null) projection.clipExtent(null);
-
d3_geoStream(object, projection.stream(boundsStream$1));
-
- var b = boundsStream$1.result(),
- k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),
- x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,
- y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
-
+ fitBounds(boundsStream$1.result());
if (clip != null) projection.clipExtent(clip);
+ return projection;
+}
- return projection
- .scale(k * 150)
- .translate([x, y]);
+function fitExtent(projection, extent, object) {
+ return fit(projection, function(b) {
+ var w = extent[1][0] - extent[0][0],
+ h = extent[1][1] - extent[0][1],
+ k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),
+ x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,
+ y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
+ projection.scale(150 * k).translate([x, y]);
+ }, object);
}
function fitSize(projection, size, object) {
return fitExtent(projection, [[0, 0], size], object);
}
+function fitWidth(projection, width, object) {
+ return fit(projection, function(b) {
+ var w = +width,
+ k = w / (b[1][0] - b[0][0]),
+ x = (w - k * (b[1][0] + b[0][0])) / 2,
+ y = -k * b[0][1];
+ projection.scale(150 * k).translate([x, y]);
+ }, object);
+}
+
+function fitHeight(projection, height, object) {
+ return fit(projection, function(b) {
+ var h = +height,
+ k = h / (b[1][1] - b[0][1]),
+ x = -k * b[0][0],
+ y = (h - k * (b[1][1] + b[0][1])) / 2;
+ projection.scale(150 * k).translate([x, y]);
+ }, object);
+}
+
var maxDepth = 16;
var cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance)
-var resample = function(project, delta2) {
+function resample(project, delta2) {
return +delta2 ? resample$1(project, delta2) : resampleNone(project);
-};
+}
function resampleNone(project) {
return transformer({
return fitSize(projection, size, object);
};
+ projection.fitWidth = function(width, object) {
+ return fitWidth(projection, width, object);
+ };
+
+ projection.fitHeight = function(height, object) {
+ return fitHeight(projection, height, object);
+ };
+
function recenter() {
projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project);
var center = project(lambda, phi);
return project;
}
-var conicEqualArea = function() {
+function conicEqualArea() {
return conicProjection(conicEqualAreaRaw)
.scale(155.424)
.center([0, 33.6442]);
-};
+}
-var albers = function() {
+function albers() {
return conicEqualArea()
.parallels([29.5, 45.5])
.scale(1070)
.translate([480, 250])
.rotate([96, 0])
.center([-0.6, 38.7]);
-};
+}
// The projections must have mutually exclusive clip regions on the sphere,
// as this will avoid emitting interleaving lines and polygons.
// scale to 1285 and adjust the translate accordingly. The set of standard
// parallels for each region comes from USGS, which is published here:
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
-var albersUsa = function() {
+function albersUsa() {
var cache,
cacheStream,
lower48 = albers(), lower48Point,
return fitSize(albersUsa, size, object);
};
+ albersUsa.fitWidth = function(width, object) {
+ return fitWidth(albersUsa, width, object);
+ };
+
+ albersUsa.fitHeight = function(height, object) {
+ return fitHeight(albersUsa, height, object);
+ };
+
function reset() {
cache = cacheStream = null;
return albersUsa;
}
return albersUsa.scale(1070);
-};
+}
function azimuthalRaw(scale) {
return function(x, y) {
return 2 * asin(z / 2);
});
-var azimuthalEqualArea = function() {
+function azimuthalEqualArea() {
return projection(azimuthalEqualAreaRaw)
.scale(124.75)
.clipAngle(180 - 1e-3);
-};
+}
var azimuthalEquidistantRaw = azimuthalRaw(function(c) {
return (c = acos(c)) && c / sin$1(c);
return z;
});
-var azimuthalEquidistant = function() {
+function azimuthalEquidistant() {
return projection(azimuthalEquidistantRaw)
.scale(79.4188)
.clipAngle(180 - 1e-3);
-};
+}
function mercatorRaw(lambda, phi) {
return [lambda, log(tan((halfPi$2 + phi) / 2))];
return [x, 2 * atan(exp(y)) - halfPi$2];
};
-var mercator = function() {
+function mercator() {
return mercatorProjection(mercatorRaw)
.scale(961 / tau$3);
-};
+}
function mercatorProjection(project) {
var m = projection(project),
return project;
}
-var conicConformal = function() {
+function conicConformal() {
return conicProjection(conicConformalRaw)
.scale(109.5)
.parallels([30, 30]);
-};
+}
function equirectangularRaw(lambda, phi) {
return [lambda, phi];
equirectangularRaw.invert = equirectangularRaw;
-var equirectangular = function() {
+function equirectangular() {
return projection(equirectangularRaw)
.scale(152.63);
-};
+}
function conicEquidistantRaw(y0, y1) {
var cy0 = cos$1(y0),
return project;
}
-var conicEquidistant = function() {
+function conicEquidistant() {
return conicProjection(conicEquidistantRaw)
.scale(131.154)
.center([0, 13.9389]);
-};
+}
function gnomonicRaw(x, y) {
var cy = cos$1(y), k = cos$1(x) * cy;
gnomonicRaw.invert = azimuthalInvert(atan);
-var gnomonic = function() {
+function gnomonic() {
return projection(gnomonicRaw)
.scale(144.049)
.clipAngle(60);
-};
+}
function scaleTranslate(kx, ky, tx, ty) {
return kx === 1 && ky === 1 && tx === 0 && ty === 0 ? identity$4 : transformer({
});
}
-var d3_geoIdentity = function() {
+function d3_geoIdentity() {
var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform = identity$4, // scale, translate and reflect
x0 = null, y0, x1, y1, // clip extent
postclip = identity$4,
},
fitSize: function(size, object) {
return fitSize(projection, size, object);
+ },
+ fitWidth: function(width, object) {
+ return fitWidth(projection, width, object);
+ },
+ fitHeight: function(height, object) {
+ return fitHeight(projection, height, object);
}
};
-};
+}
function naturalEarth1Raw(lambda, phi) {
var phi2 = phi * phi, phi4 = phi2 * phi2;
];
};
-var naturalEarth1 = function() {
+function naturalEarth1() {
return projection(naturalEarth1Raw)
.scale(175.295);
-};
+}
function orthographicRaw(x, y) {
return [cos$1(y) * sin$1(x), sin$1(y)];
orthographicRaw.invert = azimuthalInvert(asin);
-var orthographic = function() {
+function orthographic() {
return projection(orthographicRaw)
.scale(249.5)
.clipAngle(90 + epsilon$2);
-};
+}
function stereographicRaw(x, y) {
var cy = cos$1(y), k = 1 + cos$1(x) * cy;
return 2 * atan(z);
});
-var stereographic = function() {
+function stereographic() {
return projection(stereographicRaw)
.scale(250)
.clipAngle(142);
-};
+}
function transverseMercatorRaw(lambda, phi) {
return [log(tan((halfPi$2 + phi) / 2)), -lambda];
return [-y, 2 * atan(exp(x)) - halfPi$2];
};
-var transverseMercator = function() {
+function transverseMercator() {
var m = mercatorProjection(transverseMercatorRaw),
center = m.center,
rotate = m.rotate;
return rotate([0, 0, 90])
.scale(159.155);
-};
+}
function defaultSeparation(a, b) {
return a.parent === b.parent ? 1 : 2;
return node;
}
-var cluster = function() {
+function cluster() {
var separation = defaultSeparation,
dx = 1,
dy = 1,
};
return cluster;
-};
+}
function count(node) {
var sum = 0,
node.value = sum;
}
-var node_count = function() {
+function node_count() {
return this.eachAfter(count);
-};
+}
-var node_each = function(callback) {
+function node_each(callback) {
var node = this, current, next = [node], children, i, n;
do {
current = next.reverse(), next = [];
}
} while (next.length);
return this;
-};
+}
-var node_eachBefore = function(callback) {
+function node_eachBefore(callback) {
var node = this, nodes = [node], children, i;
while (node = nodes.pop()) {
callback(node), children = node.children;
}
}
return this;
-};
+}
-var node_eachAfter = function(callback) {
+function node_eachAfter(callback) {
var node = this, nodes = [node], next = [], children, i, n;
while (node = nodes.pop()) {
next.push(node), children = node.children;
callback(node);
}
return this;
-};
+}
-var node_sum = function(value) {
+function node_sum(value) {
return this.eachAfter(function(node) {
var sum = +value(node.data) || 0,
children = node.children,
while (--i >= 0) sum += children[i].value;
node.value = sum;
});
-};
+}
-var node_sort = function(compare) {
+function node_sort(compare) {
return this.eachBefore(function(node) {
if (node.children) {
node.children.sort(compare);
}
});
-};
+}
-var node_path = function(end) {
+function node_path(end) {
var start = this,
ancestor = leastCommonAncestor(start, end),
nodes = [start];
end = end.parent;
}
return nodes;
-};
+}
function leastCommonAncestor(a, b) {
if (a === b) return a;
return c;
}
-var node_ancestors = function() {
+function node_ancestors() {
var node = this, nodes = [node];
while (node = node.parent) {
nodes.push(node);
}
return nodes;
-};
+}
-var node_descendants = function() {
+function node_descendants() {
var nodes = [];
this.each(function(node) {
nodes.push(node);
});
return nodes;
-};
+}
-var node_leaves = function() {
+function node_leaves() {
var leaves = [];
this.eachBefore(function(node) {
if (!node.children) {
}
});
return leaves;
-};
+}
-var node_links = function() {
+function node_links() {
var root = this, links = [];
root.each(function(node) {
if (node !== root) { // Don’t include the root’s parent, if any.
}
});
return links;
-};
+}
function hierarchy(data, children) {
var root = new Node(data),
return array;
}
-var enclose = function(circles) {
+function enclose(circles) {
var i = 0, n = (circles = shuffle$1(slice$3.call(circles))).length, B = [], p, e;
while (i < n) {
}
return e;
-};
+}
function extendBasis(B, p) {
var i, j;
return c.r;
}
-var siblings = function(circles) {
+function siblings(circles) {
packEnclose(circles);
return circles;
-};
+}
function optional(f) {
return f == null ? null : required(f);
return 0;
}
-var constant$8 = function(x) {
+function constant$8(x) {
return function() {
return x;
};
-};
+}
function defaultRadius$1(d) {
return Math.sqrt(d.value);
}
-var index$2 = function() {
+function index$1() {
var radius = null,
dx = 1,
dy = 1,
};
return pack;
-};
+}
function radiusLeaf(radius) {
return function(node) {
};
}
-var roundNode = function(node) {
+function roundNode(node) {
node.x0 = Math.round(node.x0);
node.y0 = Math.round(node.y0);
node.x1 = Math.round(node.x1);
node.y1 = Math.round(node.y1);
-};
+}
-var treemapDice = function(parent, x0, y0, x1, y1) {
+function treemapDice(parent, x0, y0, x1, y1) {
var nodes = parent.children,
node,
i = -1,
node = nodes[i], node.y0 = y0, node.y1 = y1;
node.x0 = x0, node.x1 = x0 += node.value * k;
}
-};
+}
-var partition = function() {
+function partition() {
var dx = 1,
dy = 1,
padding = 0,
};
return partition;
-};
+}
var keyPrefix$1 = "$";
var preroot = {depth: -1};
return d.parentId;
}
-var stratify = function() {
+function stratify() {
var id = defaultId,
parentId = defaultParentId;
};
return stratify;
-};
+}
function defaultSeparation$1(a, b) {
return a.parent === b.parent ? 1 : 2;
}
// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
-var tree = function() {
+function tree() {
var separation = defaultSeparation$1,
dx = 1,
dy = 1,
};
return tree;
-};
+}
-var treemapSlice = function(parent, x0, y0, x1, y1) {
+function treemapSlice(parent, x0, y0, x1, y1) {
var nodes = parent.children,
node,
i = -1,
node = nodes[i], node.x0 = x0, node.x1 = x1;
node.y0 = y0, node.y1 = y0 += node.value * k;
}
-};
+}
var phi = (1 + Math.sqrt(5)) / 2;
return squarify;
})(phi);
-var index$3 = function() {
+function index$2() {
var tile = squarify,
round = false,
dx = 1,
};
return treemap;
-};
+}
-var binary = function(parent, x0, y0, x1, y1) {
+function binary(parent, x0, y0, x1, y1) {
var nodes = parent.children,
i, n = nodes.length,
sum, sums = new Array(n + 1);
partition(k, j, valueRight, x0, yk, x1, y1);
}
}
-};
+}
-var sliceDice = function(parent, x0, y0, x1, y1) {
+function sliceDice(parent, x0, y0, x1, y1) {
(parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1);
-};
+}
var resquarify = (function custom(ratio) {
return resquarify;
})(phi);
-var d3_polygonArea = function(polygon) {
+function d3_polygonArea(polygon) {
var i = -1,
n = polygon.length,
a,
}
return area / 2;
-};
+}
-var d3_polygonCentroid = function(polygon) {
+function d3_polygonCentroid(polygon) {
var i = -1,
n = polygon.length,
x = 0,
}
return k *= 3, [x / k, y / k];
-};
+}
// Returns the 2D cross product of AB and AC vectors, i.e., the z-component of
// the 3D cross product in a quadrant I Cartesian coordinate system (+x is
// right, +y is up). Returns a positive value if ABC is counter-clockwise,
// negative if clockwise, and zero if the points are collinear.
-var cross$1 = function(a, b, c) {
+function cross$1(a, b, c) {
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
-};
+}
function lexicographicOrder(a, b) {
return a[0] - b[0] || a[1] - b[1];
return indexes.slice(0, size); // remove popped points
}
-var d3_polygonHull = function(points) {
+function d3_polygonHull(points) {
if ((n = points.length) < 3) return null;
var i,
for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]);
return hull;
-};
+}
-var contains$1 = function(polygon, point) {
+function contains$1(polygon, point) {
var n = polygon.length,
p = polygon[n - 1],
x = point[0], y = point[1],
}
return inside;
-};
+}
-var length$1 = function(polygon) {
+function length$1(polygon) {
var i = -1,
n = polygon.length,
b = polygon[n - 1],
}
return perimeter;
-};
+}
var slice$4 = [].slice;
return new Queue(concurrency);
}
-var defaultSource$1 = function() {
+function defaultSource$1() {
return Math.random();
-};
+}
var uniform = (function sourceRandomUniform(source) {
function randomUniform(min, max) {
return randomExponential;
})(defaultSource$1);
-var d3_request = function(url, callback) {
+function d3_request(url, callback) {
var request,
event = dispatch("beforesend", "progress", "load", "error"),
mimeType,
}
return request;
-};
+}
function fixCallback(callback) {
return function(error, xhr) {
: xhr.responseText; // "" on error
}
-var type$1 = function(defaultMimeType, response) {
+function type$1(defaultMimeType, response) {
return function(url, callback) {
var r = d3_request(url).mimeType(defaultMimeType).response(response);
if (callback != null) {
}
return r;
};
-};
+}
var html = type$1("text/html", function(xhr) {
return document.createRange().createContextualFragment(xhr.responseText);
return xml;
});
-var dsv$1 = function(defaultMimeType, parse) {
+function dsv$1(defaultMimeType, parse) {
return function(url, row, callback) {
if (arguments.length < 3) callback = row, row = null;
var r = d3_request(url).mimeType(defaultMimeType);
r.row(row);
return callback ? r.get(callback) : r;
};
-};
+}
function responseOf(parse, row) {
return function(request) {
return pointish(band().paddingInner(1));
}
-var constant$9 = function(x) {
+function constant$9(x) {
return function() {
return x;
};
-};
+}
-var number$2 = function(x) {
+function number$2(x) {
return +x;
-};
+}
var unit = [0, 1];
return rescale();
}
-var tickFormat = function(domain, count, specifier) {
+function tickFormat(domain, count, specifier) {
var start = domain[0],
stop = domain[domain.length - 1],
step = tickStep(start, stop, count == null ? 10 : count),
}
}
return format(specifier);
-};
+}
function linearish(scale) {
var domain = scale.domain;
return linearish(scale);
}
-var nice = function(domain, interval) {
+function nice(domain, interval) {
domain = domain.slice();
var i0 = 0,
domain[i0] = interval.floor(x0);
domain[i1] = interval.ceil(x1);
return domain;
-};
+}
function deinterpolate(a, b) {
return (b = Math.log(b / a))
};
interval.range = function(start, stop, step) {
- var range = [];
+ var range = [], previous;
start = interval.ceil(start);
step = step == null ? 1 : Math.floor(step);
if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
- do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop)
+ do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
+ while (previous < start && start < stop);
return range;
};
var milliseconds = millisecond.range;
-var durationSecond$1 = 1e3;
-var durationMinute$1 = 6e4;
-var durationHour$1 = 36e5;
-var durationDay$1 = 864e5;
-var durationWeek$1 = 6048e5;
+var durationSecond = 1e3;
+var durationMinute = 6e4;
+var durationHour = 36e5;
+var durationDay = 864e5;
+var durationWeek = 6048e5;
var second = newInterval(function(date) {
- date.setTime(Math.floor(date / durationSecond$1) * durationSecond$1);
+ date.setTime(Math.floor(date / durationSecond) * durationSecond);
}, function(date, step) {
- date.setTime(+date + step * durationSecond$1);
+ date.setTime(+date + step * durationSecond);
}, function(start, end) {
- return (end - start) / durationSecond$1;
+ return (end - start) / durationSecond;
}, function(date) {
return date.getUTCSeconds();
});
var seconds = second.range;
var minute = newInterval(function(date) {
- date.setTime(Math.floor(date / durationMinute$1) * durationMinute$1);
+ date.setTime(Math.floor(date / durationMinute) * durationMinute);
}, function(date, step) {
- date.setTime(+date + step * durationMinute$1);
+ date.setTime(+date + step * durationMinute);
}, function(start, end) {
- return (end - start) / durationMinute$1;
+ return (end - start) / durationMinute;
}, function(date) {
return date.getMinutes();
});
var minutes = minute.range;
var hour = newInterval(function(date) {
- var offset = date.getTimezoneOffset() * durationMinute$1 % durationHour$1;
- if (offset < 0) offset += durationHour$1;
- date.setTime(Math.floor((+date - offset) / durationHour$1) * durationHour$1 + offset);
+ var offset = date.getTimezoneOffset() * durationMinute % durationHour;
+ if (offset < 0) offset += durationHour;
+ date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset);
}, function(date, step) {
- date.setTime(+date + step * durationHour$1);
+ date.setTime(+date + step * durationHour);
}, function(start, end) {
- return (end - start) / durationHour$1;
+ return (end - start) / durationHour;
}, function(date) {
return date.getHours();
});
}, function(date, step) {
date.setDate(date.getDate() + step);
}, function(start, end) {
- return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1;
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;
}, function(date) {
return date.getDate() - 1;
});
}, function(date, step) {
date.setDate(date.getDate() + step * 7);
}, function(start, end) {
- return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
});
}
var utcMinute = newInterval(function(date) {
date.setUTCSeconds(0, 0);
}, function(date, step) {
- date.setTime(+date + step * durationMinute$1);
+ date.setTime(+date + step * durationMinute);
}, function(start, end) {
- return (end - start) / durationMinute$1;
+ return (end - start) / durationMinute;
}, function(date) {
return date.getUTCMinutes();
});
var utcHour = newInterval(function(date) {
date.setUTCMinutes(0, 0, 0);
}, function(date, step) {
- date.setTime(+date + step * durationHour$1);
+ date.setTime(+date + step * durationHour);
}, function(start, end) {
- return (end - start) / durationHour$1;
+ return (end - start) / durationHour;
}, function(date) {
return date.getUTCHours();
});
}, function(date, step) {
date.setUTCDate(date.getUTCDate() + step);
}, function(start, end) {
- return (end - start) / durationDay$1;
+ return (end - start) / durationDay;
}, function(date) {
return date.getUTCDate() - 1;
});
}, function(date, step) {
date.setUTCDate(date.getUTCDate() + step * 7);
}, function(start, end) {
- return (end - start) / durationWeek$1;
+ return (end - start) / durationWeek;
});
}
"c": null,
"d": formatDayOfMonth,
"e": formatDayOfMonth,
+ "f": formatMicroseconds,
"H": formatHour24,
"I": formatHour12,
"j": formatDayOfYear,
"m": formatMonthNumber,
"M": formatMinutes,
"p": formatPeriod,
+ "Q": formatUnixTimestamp,
+ "s": formatUnixTimestampSeconds,
"S": formatSeconds,
+ "u": formatWeekdayNumberMonday,
"U": formatWeekNumberSunday,
- "w": formatWeekdayNumber,
+ "V": formatWeekNumberISO,
+ "w": formatWeekdayNumberSunday,
"W": formatWeekNumberMonday,
"x": null,
"X": null,
"c": null,
"d": formatUTCDayOfMonth,
"e": formatUTCDayOfMonth,
+ "f": formatUTCMicroseconds,
"H": formatUTCHour24,
"I": formatUTCHour12,
"j": formatUTCDayOfYear,
"m": formatUTCMonthNumber,
"M": formatUTCMinutes,
"p": formatUTCPeriod,
+ "Q": formatUnixTimestamp,
+ "s": formatUnixTimestampSeconds,
"S": formatUTCSeconds,
+ "u": formatUTCWeekdayNumberMonday,
"U": formatUTCWeekNumberSunday,
- "w": formatUTCWeekdayNumber,
+ "V": formatUTCWeekNumberISO,
+ "w": formatUTCWeekdayNumberSunday,
"W": formatUTCWeekNumberMonday,
"x": null,
"X": null,
"c": parseLocaleDateTime,
"d": parseDayOfMonth,
"e": parseDayOfMonth,
+ "f": parseMicroseconds,
"H": parseHour24,
"I": parseHour24,
"j": parseDayOfYear,
"m": parseMonthNumber,
"M": parseMinutes,
"p": parsePeriod,
+ "Q": parseUnixTimestamp,
+ "s": parseUnixTimestampSeconds,
"S": parseSeconds,
+ "u": parseWeekdayNumberMonday,
"U": parseWeekNumberSunday,
- "w": parseWeekdayNumber,
+ "V": parseWeekNumberISO,
+ "w": parseWeekdayNumberSunday,
"W": parseWeekNumberMonday,
"x": parseLocaleDate,
"X": parseLocaleTime,
function newParse(specifier, newDate) {
return function(string) {
var d = newYear(1900),
- i = parseSpecifier(d, specifier, string += "", 0);
+ i = parseSpecifier(d, specifier, string += "", 0),
+ week, day$$1;
if (i != string.length) return null;
+ // If a UNIX timestamp is specified, return it.
+ if ("Q" in d) return new Date(d.Q);
+
// The am-pm flag is 0 for AM, and 1 for PM.
if ("p" in d) d.H = d.H % 12 + d.p * 12;
// Convert day-of-week and week-of-year to day-of-year.
- if ("W" in d || "U" in d) {
- if (!("w" in d)) d.w = "W" in d ? 1 : 0;
- var day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
+ if ("V" in d) {
+ if (d.V < 1 || d.V > 53) return null;
+ if (!("w" in d)) d.w = 1;
+ if ("Z" in d) {
+ week = utcDate(newYear(d.y)), day$$1 = week.getUTCDay();
+ week = day$$1 > 4 || day$$1 === 0 ? utcMonday.ceil(week) : utcMonday(week);
+ week = utcDay.offset(week, (d.V - 1) * 7);
+ d.y = week.getUTCFullYear();
+ d.m = week.getUTCMonth();
+ d.d = week.getUTCDate() + (d.w + 6) % 7;
+ } else {
+ week = newDate(newYear(d.y)), day$$1 = week.getDay();
+ week = day$$1 > 4 || day$$1 === 0 ? monday.ceil(week) : monday(week);
+ week = day.offset(week, (d.V - 1) * 7);
+ d.y = week.getFullYear();
+ d.m = week.getMonth();
+ d.d = week.getDate() + (d.w + 6) % 7;
+ }
+ } else if ("W" in d || "U" in d) {
+ if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
+ day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
d.m = 0;
d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w + d.U * 7 - (day$$1 + 6) % 7;
}
var pads = {"-": "", "_": " ", "0": "0"};
var numberRe = /^\s*\d+/;
var percentRe = /^%/;
-var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+var requoteRe = /[\\^$*+?|[\]().{}]/g;
function pad(value, fill, width) {
var sign = value < 0 ? "-" : "",
return map;
}
-function parseWeekdayNumber(d, string, i) {
+function parseWeekdayNumberSunday(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 1));
return n ? (d.w = +n[0], i + n[0].length) : -1;
}
+function parseWeekdayNumberMonday(d, string, i) {
+ var n = numberRe.exec(string.slice(i, i + 1));
+ return n ? (d.u = +n[0], i + n[0].length) : -1;
+}
+
function parseWeekNumberSunday(d, string, i) {
- var n = numberRe.exec(string.slice(i));
+ var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.U = +n[0], i + n[0].length) : -1;
}
+function parseWeekNumberISO(d, string, i) {
+ var n = numberRe.exec(string.slice(i, i + 2));
+ return n ? (d.V = +n[0], i + n[0].length) : -1;
+}
+
function parseWeekNumberMonday(d, string, i) {
- var n = numberRe.exec(string.slice(i));
+ var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.W = +n[0], i + n[0].length) : -1;
}
}
function parseZone(d, string, i) {
- var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6));
+ var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
}
return n ? (d.L = +n[0], i + n[0].length) : -1;
}
+function parseMicroseconds(d, string, i) {
+ var n = numberRe.exec(string.slice(i, i + 6));
+ return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
+}
+
function parseLiteralPercent(d, string, i) {
var n = percentRe.exec(string.slice(i, i + 1));
return n ? i + n[0].length : -1;
}
+function parseUnixTimestamp(d, string, i) {
+ var n = numberRe.exec(string.slice(i));
+ return n ? (d.Q = +n[0], i + n[0].length) : -1;
+}
+
+function parseUnixTimestampSeconds(d, string, i) {
+ var n = numberRe.exec(string.slice(i));
+ return n ? (d.Q = (+n[0]) * 1000, i + n[0].length) : -1;
+}
+
function formatDayOfMonth(d, p) {
return pad(d.getDate(), p, 2);
}
return pad(d.getMilliseconds(), p, 3);
}
+function formatMicroseconds(d, p) {
+ return formatMilliseconds(d, p) + "000";
+}
+
function formatMonthNumber(d, p) {
return pad(d.getMonth() + 1, p, 2);
}
return pad(d.getSeconds(), p, 2);
}
+function formatWeekdayNumberMonday(d) {
+ var day$$1 = d.getDay();
+ return day$$1 === 0 ? 7 : day$$1;
+}
+
function formatWeekNumberSunday(d, p) {
return pad(sunday.count(year(d), d), p, 2);
}
-function formatWeekdayNumber(d) {
+function formatWeekNumberISO(d, p) {
+ var day$$1 = d.getDay();
+ d = (day$$1 >= 4 || day$$1 === 0) ? thursday(d) : thursday.ceil(d);
+ return pad(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
+}
+
+function formatWeekdayNumberSunday(d) {
return d.getDay();
}
return pad(d.getUTCMilliseconds(), p, 3);
}
+function formatUTCMicroseconds(d, p) {
+ return formatUTCMilliseconds(d, p) + "000";
+}
+
function formatUTCMonthNumber(d, p) {
return pad(d.getUTCMonth() + 1, p, 2);
}
return pad(d.getUTCSeconds(), p, 2);
}
+function formatUTCWeekdayNumberMonday(d) {
+ var dow = d.getUTCDay();
+ return dow === 0 ? 7 : dow;
+}
+
function formatUTCWeekNumberSunday(d, p) {
return pad(utcSunday.count(utcYear(d), d), p, 2);
}
-function formatUTCWeekdayNumber(d) {
+function formatUTCWeekNumberISO(d, p) {
+ var day$$1 = d.getUTCDay();
+ d = (day$$1 >= 4 || day$$1 === 0) ? utcThursday(d) : utcThursday.ceil(d);
+ return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
+}
+
+function formatUTCWeekdayNumberSunday(d) {
return d.getUTCDay();
}
return "%";
}
+function formatUnixTimestamp(d) {
+ return +d;
+}
+
+function formatUnixTimestampSeconds(d) {
+ return Math.floor(+d / 1000);
+}
+
var locale$1;
var timeFormat;
var timeParse;
? parseIsoNative
: utcParse(isoSpecifier);
-var durationSecond = 1000;
-var durationMinute = durationSecond * 60;
-var durationHour = durationMinute * 60;
-var durationDay = durationHour * 24;
-var durationWeek = durationDay * 7;
-var durationMonth = durationDay * 30;
-var durationYear = durationDay * 365;
+var durationSecond$1 = 1000;
+var durationMinute$1 = durationSecond$1 * 60;
+var durationHour$1 = durationMinute$1 * 60;
+var durationDay$1 = durationHour$1 * 24;
+var durationWeek$1 = durationDay$1 * 7;
+var durationMonth = durationDay$1 * 30;
+var durationYear = durationDay$1 * 365;
function date$1(t) {
return new Date(t);
formatYear = format("%Y");
var tickIntervals = [
- [second$$1, 1, durationSecond],
- [second$$1, 5, 5 * durationSecond],
- [second$$1, 15, 15 * durationSecond],
- [second$$1, 30, 30 * durationSecond],
- [minute$$1, 1, durationMinute],
- [minute$$1, 5, 5 * durationMinute],
- [minute$$1, 15, 15 * durationMinute],
- [minute$$1, 30, 30 * durationMinute],
- [ hour$$1, 1, durationHour ],
- [ hour$$1, 3, 3 * durationHour ],
- [ hour$$1, 6, 6 * durationHour ],
- [ hour$$1, 12, 12 * durationHour ],
- [ day$$1, 1, durationDay ],
- [ day$$1, 2, 2 * durationDay ],
- [ week, 1, durationWeek ],
+ [second$$1, 1, durationSecond$1],
+ [second$$1, 5, 5 * durationSecond$1],
+ [second$$1, 15, 15 * durationSecond$1],
+ [second$$1, 30, 30 * durationSecond$1],
+ [minute$$1, 1, durationMinute$1],
+ [minute$$1, 5, 5 * durationMinute$1],
+ [minute$$1, 15, 15 * durationMinute$1],
+ [minute$$1, 30, 30 * durationMinute$1],
+ [ hour$$1, 1, durationHour$1 ],
+ [ hour$$1, 3, 3 * durationHour$1 ],
+ [ hour$$1, 6, 6 * durationHour$1 ],
+ [ hour$$1, 12, 12 * durationHour$1 ],
+ [ day$$1, 1, durationDay$1 ],
+ [ day$$1, 2, 2 * durationDay$1 ],
+ [ week, 1, durationWeek$1 ],
[ month$$1, 1, durationMonth ],
[ month$$1, 3, 3 * durationMonth ],
[ year$$1, 1, durationYear ]
step = i[1];
interval = i[0];
} else {
- step = tickStep(start, stop, interval);
+ step = Math.max(tickStep(start, stop, interval), 1);
interval = millisecond$$1;
}
}
return scale;
}
-var time = function() {
+function time() {
return calendar(year, month, sunday, day, hour, minute, second, millisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);
-};
+}
-var utcTime = function() {
+function utcTime() {
return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);
-};
+}
-var colors = function(s) {
+function colors(s) {
return s.match(/.{6}/g).map(function(x) {
return "#" + x;
});
-};
+}
var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
var rainbow = cubehelix();
-var rainbow$1 = function(t) {
+function rainbow$1(t) {
if (t < 0 || t > 1) t -= Math.floor(t);
var ts = Math.abs(t - 0.5);
rainbow.h = 360 * t - 100;
rainbow.s = 1.5 - 1.5 * ts;
rainbow.l = 0.8 - 0.9 * ts;
return rainbow + "";
-};
+}
function ramp(range) {
var n = range.length;
return linearish(scale);
}
-var constant$10 = function(x) {
+function constant$10(x) {
return function constant() {
return x;
};
-};
+}
var abs$1 = Math.abs;
var atan2$1 = Math.atan2;
};
}
-var arc = function() {
+function arc() {
var innerRadius = arcInnerRadius,
outerRadius = arcOuterRadius,
cornerRadius = constant$10(0),
};
return arc;
-};
+}
function Linear(context) {
this._context = context;
}
};
-var curveLinear = function(context) {
+function curveLinear(context) {
return new Linear(context);
-};
+}
function x$3(p) {
return p[0];
return p[1];
}
-var line = function() {
+function line() {
var x$$1 = x$3,
y$$1 = y$3,
defined = constant$10(true),
};
return line;
-};
+}
-var area = function() {
+function area() {
var x0 = x$3,
x1 = null,
y0 = constant$10(0),
};
return area;
-};
+}
-var descending = function(a, b) {
+function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
-};
+}
-var identity$6 = function(d) {
+function identity$6(d) {
return d;
-};
+}
-var pie = function() {
+function pie() {
var value = identity$6,
sortValues = descending,
sort = null,
};
return pie;
-};
+}
var curveRadialLinear = curveRadial(curveLinear);
return l;
}
-var lineRadial$1 = function() {
+function lineRadial$1() {
return lineRadial(line().curve(curveRadialLinear));
-};
+}
-var areaRadial = function() {
+function areaRadial() {
var a = area().curve(curveRadialLinear),
c = a.curve,
x0 = a.lineX0,
};
return a;
-};
+}
-var pointRadial = function(x, y) {
+function pointRadial(x, y) {
return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
-};
+}
var slice$6 = Array.prototype.slice;
wye
];
-var symbol = function() {
+function symbol() {
var type = constant$10(circle$2),
size = constant$10(64),
context = null;
};
return symbol;
-};
+}
-var noop$2 = function() {};
+function noop$2() {}
function point$2(that, x, y) {
that._context.bezierCurveTo(
}
};
-var basis$2 = function(context) {
+function basis$2(context) {
return new Basis(context);
-};
+}
function BasisClosed(context) {
this._context = context;
}
};
-var basisClosed$1 = function(context) {
+function basisClosed$1(context) {
return new BasisClosed(context);
-};
+}
function BasisOpen(context) {
this._context = context;
}
};
-var basisOpen = function(context) {
+function basisOpen(context) {
return new BasisOpen(context);
-};
+}
function Bundle(context, beta) {
this._basis = new Basis(context);
}
};
-var linearClosed = function(context) {
+function linearClosed(context) {
return new LinearClosed(context);
-};
+}
function sign$1(x) {
return x < 0 ? -1 : 1;
return [a, b];
}
-var natural = function(context) {
+function natural(context) {
return new Natural(context);
-};
+}
function Step(context, t) {
this._context = context;
}
};
-var step = function(context) {
+function step(context) {
return new Step(context, 0.5);
-};
+}
function stepBefore(context) {
return new Step(context, 0);
return new Step(context, 1);
}
-var none$1 = function(series, order) {
+function none$1(series, order) {
if (!((n = series.length) > 1)) return;
for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
s0 = s1, s1 = series[order[i]];
s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
}
}
-};
+}
-var none$2 = function(series) {
+function none$2(series) {
var n = series.length, o = new Array(n);
while (--n >= 0) o[n] = n;
return o;
-};
+}
function stackValue(d, key) {
return d[key];
}
-var stack = function() {
+function stack() {
var keys = constant$10([]),
order = none$2,
offset = none$1,
};
return stack;
-};
+}
-var expand = function(series, order) {
+function expand(series, order) {
if (!((n = series.length) > 0)) return;
for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {
for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;
if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
}
none$1(series, order);
-};
+}
-var diverging = function(series, order) {
+function diverging(series, order) {
if (!((n = series.length) > 1)) return;
for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {
for (yp = yn = 0, i = 0; i < n; ++i) {
}
}
}
-};
+}
-var silhouette = function(series, order) {
+function silhouette(series, order) {
if (!((n = series.length) > 0)) return;
for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {
for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;
s0[j][1] += s0[j][0] = -y / 2;
}
none$1(series, order);
-};
+}
-var wiggle = function(series, order) {
+function wiggle(series, order) {
if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;
for (var y = 0, j = 1, s0, m, n; j < m; ++j) {
for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
}
s0[j - 1][1] += s0[j - 1][0] = y;
none$1(series, order);
-};
+}
-var ascending$1 = function(series) {
+function ascending$1(series) {
var sums = series.map(sum$2);
return none$2(series).sort(function(a, b) { return sums[a] - sums[b]; });
-};
+}
function sum$2(series) {
var s = 0, i = -1, n = series.length, v;
return s;
}
-var descending$1 = function(series) {
+function descending$1(series) {
return ascending$1(series).reverse();
-};
+}
-var insideOut = function(series) {
+function insideOut(series) {
var n = series.length,
i,
j,
}
return bottoms.reverse().concat(tops);
-};
+}
-var reverse = function(series) {
+function reverse(series) {
return none$2(series).reverse();
-};
+}
-var constant$11 = function(x) {
+function constant$11(x) {
return function() {
return x;
};
-};
+}
function x$4(d) {
return d[0];
}
};
-var voronoi = function() {
+function voronoi() {
var x$$1 = x$4,
y$$1 = y$4,
extent = null;
};
return voronoi;
-};
+}
-var constant$12 = function(x) {
+function constant$12(x) {
return function() {
return x;
};
-};
+}
function ZoomEvent(target, type, transform) {
this.target = target;
event.stopImmediatePropagation();
}
-var noevent$2 = function() {
+function noevent$2() {
event.preventDefault();
event.stopImmediatePropagation();
-};
+}
// Ignore right-click, since that should open the context menu.
function defaultFilter$2() {
return "ontouchstart" in this;
}
-var d3_zoom = function() {
+function defaultConstrain(transform$$1, extent, translateExtent) {
+ var dx0 = transform$$1.invertX(extent[0][0]) - translateExtent[0][0],
+ dx1 = transform$$1.invertX(extent[1][0]) - translateExtent[1][0],
+ dy0 = transform$$1.invertY(extent[0][1]) - translateExtent[0][1],
+ dy1 = transform$$1.invertY(extent[1][1]) - translateExtent[1][1];
+ return transform$$1.translate(
+ dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
+ dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
+ );
+}
+
+function d3_zoom() {
var filter = defaultFilter$2,
extent = defaultExtent$1,
+ constrain = defaultConstrain,
wheelDelta = defaultWheelDelta,
touchable = defaultTouchable$1,
- k0 = 0,
- k1 = Infinity,
- x0 = -k1,
- x1 = k1,
- y0 = x0,
- y1 = x1,
+ scaleExtent = [0, Infinity],
+ translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],
duration = 250,
interpolate = interpolateZoom,
gestures = [],
p0 = centroid(e),
p1 = t0.invert(p0),
k1 = typeof k === "function" ? k.apply(this, arguments) : k;
- return constrain(translate(scale(t0, k1), p0, p1), e);
+ return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
});
};
return constrain(this.__zoom.translate(
typeof x === "function" ? x.apply(this, arguments) : x,
typeof y === "function" ? y.apply(this, arguments) : y
- ), extent.apply(this, arguments));
+ ), extent.apply(this, arguments), translateExtent);
});
};
return constrain(identity$7.translate(p[0], p[1]).scale(t.k).translate(
typeof x === "function" ? -x.apply(this, arguments) : -x,
typeof y === "function" ? -y.apply(this, arguments) : -y
- ), e);
+ ), e, translateExtent);
});
};
function scale(transform$$1, k) {
- k = Math.max(k0, Math.min(k1, k));
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
return k === transform$$1.k ? transform$$1 : new Transform(k, transform$$1.x, transform$$1.y);
}
return x === transform$$1.x && y === transform$$1.y ? transform$$1 : new Transform(transform$$1.k, x, y);
}
- function constrain(transform$$1, extent) {
- var dx0 = transform$$1.invertX(extent[0][0]) - x0,
- dx1 = transform$$1.invertX(extent[1][0]) - x1,
- dy0 = transform$$1.invertY(extent[0][1]) - y0,
- dy1 = transform$$1.invertY(extent[1][1]) - y1;
- return transform$$1.translate(
- dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
- dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
- );
- }
-
function centroid(extent) {
return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
}
if (!filter.apply(this, arguments)) return;
var g = gesture(this, arguments),
t = this.__zoom,
- k = Math.max(k0, Math.min(k1, t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
p = d3_mouse(this);
// If the mouse is in the same location as before, reuse it.
noevent$2();
g.wheel = setTimeout(wheelidled, wheelDelay);
- g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent));
+ g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
function wheelidled() {
g.wheel = null;
var dx = event.clientX - x0, dy = event.clientY - y0;
g.moved = dx * dx + dy * dy > clickDistance2;
}
- g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = d3_mouse(g.that), g.mouse[1]), g.extent));
+ g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = d3_mouse(g.that), g.mouse[1]), g.extent, translateExtent));
}
function mouseupped() {
p0 = d3_mouse(this),
p1 = t0.invert(p0),
k1 = t0.k * (event.shiftKey ? 0.5 : 2),
- t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments));
+ t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
noevent$2();
if (duration > 0) d3_select(this).transition().duration(duration).call(schedule, t1, p0);
}
else if (g.touch0) p = g.touch0[0], l = g.touch0[1];
else return;
- g.zoom("touch", constrain(translate(t, p, l), g.extent));
+ g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
}
function touchended() {
};
zoom.scaleExtent = function(_) {
- return arguments.length ? (k0 = +_[0], k1 = +_[1], zoom) : [k0, k1];
+ return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
};
zoom.translateExtent = function(_) {
- return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], zoom) : [[x0, y0], [x1, y1]];
+ return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
+ };
+
+ zoom.constrain = function(_) {
+ return arguments.length ? (constrain = _, zoom) : constrain;
};
zoom.duration = function(_) {
};
return zoom;
-};
+}
-var index = Object.freeze({
+var index$3 = Object.freeze({
version: version,
bisect: bisectRight,
bisectRight: bisectRight,
geoTransform: d3_geoTransform,
cluster: cluster,
hierarchy: hierarchy,
- pack: index$2,
+ pack: index$1,
packSiblings: siblings,
packEnclose: enclose,
partition: partition,
stratify: stratify,
tree: tree,
- treemap: index$3,
+ treemap: index$2,
treemapBinary: binary,
treemapDice: treemapDice,
treemapSlice: treemapSlice,
interpolatePlasma: plasma,
scaleSequential: sequential,
creator: creator,
- local: local$1,
+ local: local,
matcher: matcher$1,
mouse: d3_mouse,
namespace: namespace,
namespaces: namespaces,
+ clientPoint: point,
select: d3_select,
selectAll: d3_selectAll,
selection: selection,
}
/**
- * Creates an array with all falsey values removed. The values `false`, `null`,
- * `0`, `""`, `undefined`, and `NaN` are falsey.
+ * Removes all key-value entries from the list cache.
+ *
+ * @private
+ * @name clear
+ * @memberOf ListCache
+ */
+function listCacheClear() {
+ this.__data__ = [];
+ this.size = 0;
+}
+
+/**
+ * Performs a
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
- * @since 0.1.0
- * @category Array
- * @param {Array} array The array to compact.
- * @returns {Array} Returns the new array of filtered values.
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
- * _.compact([0, 1, false, 2, '', 3]);
- * // => [1, 2, 3]
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
+ *
+ * _.eq(object, object);
+ * // => true
+ *
+ * _.eq(object, other);
+ * // => false
+ *
+ * _.eq('a', 'a');
+ * // => true
+ *
+ * _.eq('a', Object('a'));
+ * // => false
+ *
+ * _.eq(NaN, NaN);
+ * // => true
*/
-function compact(array) {
+function eq(value, other) {
+ return value === other || (value !== value && other !== other);
+}
+
+/**
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} key The key to search for.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+function assocIndexOf(array, key) {
+ var length = array.length;
+ while (length--) {
+ if (eq(array[length][0], key)) {
+ return length;
+ }
+ }
+ return -1;
+}
+
+/** Used for built-in method references. */
+var arrayProto = Array.prototype;
+
+/** Built-in value references. */
+var splice = arrayProto.splice;
+
+/**
+ * Removes `key` and its value from the list cache.
+ *
+ * @private
+ * @name delete
+ * @memberOf ListCache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+function listCacheDelete(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ return false;
+ }
+ var lastIndex = data.length - 1;
+ if (index == lastIndex) {
+ data.pop();
+ } else {
+ splice.call(data, index, 1);
+ }
+ --this.size;
+ return true;
+}
+
+/**
+ * Gets the list cache value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf ListCache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+function listCacheGet(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ return index < 0 ? undefined : data[index][1];
+}
+
+/**
+ * Checks if a list cache value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf ListCache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+function listCacheHas(key) {
+ return assocIndexOf(this.__data__, key) > -1;
+}
+
+/**
+ * Sets the list cache `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf ListCache
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the list cache instance.
+ */
+function listCacheSet(key, value) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ ++this.size;
+ data.push([key, value]);
+ } else {
+ data[index][1] = value;
+ }
+ return this;
+}
+
+/**
+ * Creates an list cache object.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+function ListCache(entries) {
var index = -1,
- length = array == null ? 0 : array.length,
- resIndex = 0,
- result = [];
+ length = entries == null ? 0 : entries.length;
+ this.clear();
while (++index < length) {
- var value = array[index];
- if (value) {
- result[resIndex++] = value;
- }
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
}
+}
+
+// Add methods to `ListCache`.
+ListCache.prototype.clear = listCacheClear;
+ListCache.prototype['delete'] = listCacheDelete;
+ListCache.prototype.get = listCacheGet;
+ListCache.prototype.has = listCacheHas;
+ListCache.prototype.set = listCacheSet;
+
+/**
+ * Removes all key-value entries from the stack.
+ *
+ * @private
+ * @name clear
+ * @memberOf Stack
+ */
+function stackClear() {
+ this.__data__ = new ListCache;
+ this.size = 0;
+}
+
+/**
+ * Removes `key` and its value from the stack.
+ *
+ * @private
+ * @name delete
+ * @memberOf Stack
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+function stackDelete(key) {
+ var data = this.__data__,
+ result = data['delete'](key);
+
+ this.size = data.size;
return result;
}
+/**
+ * Gets the stack value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf Stack
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+function stackGet(key) {
+ return this.__data__.get(key);
+}
+
+/**
+ * Checks if a stack value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf Stack
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+function stackHas(key) {
+ return this.__data__.has(key);
+}
+
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
var Symbol = root$2.Symbol;
/** Used for built-in method references. */
-var objectProto$2 = Object.prototype;
+var objectProto = Object.prototype;
/** Used to check objects for own properties. */
-var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
+var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
-var nativeObjectToString = objectProto$2.toString;
+var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
-var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
+var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
- var isOwn = hasOwnProperty$2.call(value, symToStringTag$1),
- tag = value[symToStringTag$1];
+ var isOwn = hasOwnProperty.call(value, symToStringTag),
+ tag = value[symToStringTag];
try {
- value[symToStringTag$1] = undefined;
+ value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
- value[symToStringTag$1] = tag;
+ value[symToStringTag] = tag;
} else {
- delete value[symToStringTag$1];
+ delete value[symToStringTag];
}
}
return result;
}
/** Used for built-in method references. */
-var objectProto$3 = Object.prototype;
+var objectProto$1 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
-var nativeObjectToString$1 = objectProto$3.toString;
+var nativeObjectToString$1 = objectProto$1.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
var undefinedTag = '[object Undefined]';
/** Built-in value references. */
-var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
+var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
- return (symToStringTag && symToStringTag in Object(value))
+ return (symToStringTag$1 && symToStringTag$1 in Object(value))
? getRawTag(value)
: objectToString(value);
}
}
/** Used for built-in method references. */
-var funcProto$1 = Function.prototype;
+var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
-var funcToString$1 = funcProto$1.toString;
+var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
function toSource(func) {
if (func != null) {
try {
- return funcToString$1.call(func);
+ return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
-var funcProto = Function.prototype;
-var objectProto$1 = Object.prototype;
+var funcProto$1 = Function.prototype;
+var objectProto$2 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
-var funcToString = funcProto.toString;
+var funcToString$1 = funcProto$1.toString;
/** Used to check objects for own properties. */
-var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
+var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
- funcToString.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
+ funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
return baseIsNative(value) ? value : undefined;
}
+/* Built-in method references that are verified to be native. */
+var Map$1 = getNative(root$2, 'Map');
+
+/* Built-in method references that are verified to be native. */
+var nativeCreate = getNative(Object, 'create');
+
+/**
+ * Removes all key-value entries from the hash.
+ *
+ * @private
+ * @name clear
+ * @memberOf Hash
+ */
+function hashClear() {
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
+ this.size = 0;
+}
+
+/**
+ * Removes `key` and its value from the hash.
+ *
+ * @private
+ * @name delete
+ * @memberOf Hash
+ * @param {Object} hash The hash to modify.
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+function hashDelete(key) {
+ var result = this.has(key) && delete this.__data__[key];
+ this.size -= result ? 1 : 0;
+ return result;
+}
+
+/** Used to stand-in for `undefined` hash values. */
+var HASH_UNDEFINED = '__lodash_hash_undefined__';
+
+/** Used for built-in method references. */
+var objectProto$3 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
+
+/**
+ * Gets the hash value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf Hash
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+function hashGet(key) {
+ var data = this.__data__;
+ if (nativeCreate) {
+ var result = data[key];
+ return result === HASH_UNDEFINED ? undefined : result;
+ }
+ return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
+}
+
+/** Used for built-in method references. */
+var objectProto$4 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
+
+/**
+ * Checks if a hash value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf Hash
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+function hashHas(key) {
+ var data = this.__data__;
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
+}
+
+/** Used to stand-in for `undefined` hash values. */
+var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
+
+/**
+ * Sets the hash `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf Hash
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the hash instance.
+ */
+function hashSet(key, value) {
+ var data = this.__data__;
+ this.size += this.has(key) ? 0 : 1;
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
+ return this;
+}
+
+/**
+ * Creates a hash object.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+function Hash(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+}
+
+// Add methods to `Hash`.
+Hash.prototype.clear = hashClear;
+Hash.prototype['delete'] = hashDelete;
+Hash.prototype.get = hashGet;
+Hash.prototype.has = hashHas;
+Hash.prototype.set = hashSet;
+
+/**
+ * Removes all key-value entries from the map.
+ *
+ * @private
+ * @name clear
+ * @memberOf MapCache
+ */
+function mapCacheClear() {
+ this.size = 0;
+ this.__data__ = {
+ 'hash': new Hash,
+ 'map': new (Map$1 || ListCache),
+ 'string': new Hash
+ };
+}
+
+/**
+ * Checks if `value` is suitable for use as unique object key.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
+ */
+function isKeyable(value) {
+ var type = typeof value;
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
+ ? (value !== '__proto__')
+ : (value === null);
+}
+
+/**
+ * Gets the data for `map`.
+ *
+ * @private
+ * @param {Object} map The map to query.
+ * @param {string} key The reference key.
+ * @returns {*} Returns the map data.
+ */
+function getMapData(map, key) {
+ var data = map.__data__;
+ return isKeyable(key)
+ ? data[typeof key == 'string' ? 'string' : 'hash']
+ : data.map;
+}
+
+/**
+ * Removes `key` and its value from the map.
+ *
+ * @private
+ * @name delete
+ * @memberOf MapCache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+function mapCacheDelete(key) {
+ var result = getMapData(this, key)['delete'](key);
+ this.size -= result ? 1 : 0;
+ return result;
+}
+
+/**
+ * Gets the map value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf MapCache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+function mapCacheGet(key) {
+ return getMapData(this, key).get(key);
+}
+
+/**
+ * Checks if a map value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf MapCache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+function mapCacheHas(key) {
+ return getMapData(this, key).has(key);
+}
+
+/**
+ * Sets the map `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf MapCache
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the map cache instance.
+ */
+function mapCacheSet(key, value) {
+ var data = getMapData(this, key),
+ size = data.size;
+
+ data.set(key, value);
+ this.size += data.size == size ? 0 : 1;
+ return this;
+}
+
+/**
+ * Creates a map cache object to store key-value pairs.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+function MapCache(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+}
+
+// Add methods to `MapCache`.
+MapCache.prototype.clear = mapCacheClear;
+MapCache.prototype['delete'] = mapCacheDelete;
+MapCache.prototype.get = mapCacheGet;
+MapCache.prototype.has = mapCacheHas;
+MapCache.prototype.set = mapCacheSet;
+
+/** Used as the size to enable large array optimizations. */
+var LARGE_ARRAY_SIZE = 200;
+
+/**
+ * Sets the stack `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf Stack
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the stack cache instance.
+ */
+function stackSet(key, value) {
+ var data = this.__data__;
+ if (data instanceof ListCache) {
+ var pairs = data.__data__;
+ if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
+ pairs.push([key, value]);
+ this.size = ++data.size;
+ return this;
+ }
+ data = this.__data__ = new MapCache(pairs);
+ }
+ data.set(key, value);
+ this.size = data.size;
+ return this;
+}
+
+/**
+ * Creates a stack cache object to store key-value pairs.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+function Stack(entries) {
+ var data = this.__data__ = new ListCache(entries);
+ this.size = data.size;
+}
+
+// Add methods to `Stack`.
+Stack.prototype.clear = stackClear;
+Stack.prototype['delete'] = stackDelete;
+Stack.prototype.get = stackGet;
+Stack.prototype.has = stackHas;
+Stack.prototype.set = stackSet;
+
+/**
+ * A specialized version of `_.forEach` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+function arrayEach(array, iteratee) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (iteratee(array[index], index, array) === false) {
+ break;
+ }
+ }
+ return array;
+}
+
var defineProperty = (function() {
try {
var func = getNative(Object, 'defineProperty');
}
}
-/**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */
-function eq(value, other) {
- return value === other || (value !== value && other !== other);
-}
-
/** Used for built-in method references. */
-var objectProto = Object.prototype;
+var objectProto$5 = Object.prototype;
/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
+var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
*/
function assignValue(object, key, value) {
var objValue = object[key];
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
+ if (!(hasOwnProperty$4.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
/**
- * This method returns the first argument it receives.
+ * The base implementation of `_.times` without support for iteratee shorthands
+ * or max array length checks.
+ *
+ * @private
+ * @param {number} n The number of times to invoke `iteratee`.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the array of results.
+ */
+function baseTimes(n, iteratee) {
+ var index = -1,
+ result = Array(n);
+
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
*
* @static
- * @since 0.1.0
* @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
- * var object = { 'a': 1 };
+ * _.isObjectLike({});
+ * // => true
*
- * console.log(_.identity(object) === object);
+ * _.isObjectLike([1, 2, 3]);
* // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
*/
-function identity$8(value) {
- return value;
+function isObjectLike(value) {
+ return value != null && typeof value == 'object';
}
+/** `Object#toString` result references. */
+var argsTag = '[object Arguments]';
+
/**
- * A faster alternative to `Function#apply`, this function invokes `func`
- * with the `this` binding of `thisArg` and the arguments of `args`.
+ * The base implementation of `_.isArguments`.
*
* @private
- * @param {Function} func The function to invoke.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {Array} args The arguments to invoke `func` with.
- * @returns {*} Returns the result of `func`.
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
-function apply(func, thisArg, args) {
- switch (args.length) {
- case 0: return func.call(thisArg);
- case 1: return func.call(thisArg, args[0]);
- case 2: return func.call(thisArg, args[0], args[1]);
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
- }
- return func.apply(thisArg, args);
+function baseIsArguments(value) {
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
}
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeMax = Math.max;
+/** Used for built-in method references. */
+var objectProto$6 = Object.prototype;
-/**
- * A specialized version of `baseRest` which transforms the rest array.
- *
- * @private
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @param {Function} transform The rest array transform.
- * @returns {Function} Returns the new function.
- */
-function overRest(func, start, transform) {
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- array = Array(length);
+/** Used to check objects for own properties. */
+var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
- while (++index < length) {
- array[index] = args[start + index];
- }
- index = -1;
- var otherArgs = Array(start + 1);
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = transform(array);
- return apply(func, this, otherArgs);
- };
-}
+/** Built-in value references. */
+var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
/**
- * Creates a function that returns `value`.
+ * Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
- * @since 2.4.0
- * @category Util
- * @param {*} value The value to return from the new function.
- * @returns {Function} Returns the new constant function.
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+ * else `false`.
* @example
*
- * var objects = _.times(2, _.constant({ 'a': 1 }));
- *
- * console.log(objects);
- * // => [{ 'a': 1 }, { 'a': 1 }]
- *
- * console.log(objects[0] === objects[1]);
+ * _.isArguments(function() { return arguments; }());
* // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
*/
-function constant$13(value) {
- return function() {
- return value;
- };
-}
+var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
+ return isObjectLike(value) && hasOwnProperty$5.call(value, 'callee') &&
+ !propertyIsEnumerable.call(value, 'callee');
+};
/**
- * The base implementation of `setToString` without support for hot loop shorting.
- *
- * @private
- * @param {Function} func The function to modify.
- * @param {Function} string The `toString` result.
- * @returns {Function} Returns `func`.
- */
-var baseSetToString = !defineProperty ? identity$8 : function(func, string) {
- return defineProperty(func, 'toString', {
- 'configurable': true,
- 'enumerable': false,
- 'value': constant$13(string),
- 'writable': true
- });
-};
-
-/** Used to detect hot functions by number of calls within a span of milliseconds. */
-var HOT_COUNT = 800;
-var HOT_SPAN = 16;
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeNow = Date.now;
-
-/**
- * Creates a function that'll short out and invoke `identity` instead
- * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
- * milliseconds.
- *
- * @private
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new shortable function.
- */
-function shortOut(func) {
- var count = 0,
- lastCalled = 0;
-
- return function() {
- var stamp = nativeNow(),
- remaining = HOT_SPAN - (stamp - lastCalled);
-
- lastCalled = stamp;
- if (remaining > 0) {
- if (++count >= HOT_COUNT) {
- return arguments[0];
- }
- } else {
- count = 0;
- }
- return func.apply(undefined, arguments);
- };
-}
-
-/**
- * Sets the `toString` method of `func` to return `string`.
- *
- * @private
- * @param {Function} func The function to modify.
- * @param {Function} string The `toString` result.
- * @returns {Function} Returns `func`.
- */
-var setToString = shortOut(baseSetToString);
-
-/**
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
- *
- * @private
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- */
-function baseRest(func, start) {
- return setToString(overRest(func, start, identity$8), func + '');
-}
-
-/** Used as references for various `Number` constants. */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
-function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
-}
-
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
-function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
-}
-
-/** Used as references for various `Number` constants. */
-var MAX_SAFE_INTEGER$1 = 9007199254740991;
-
-/** Used to detect unsigned integer values. */
-var reIsUint = /^(?:0|[1-9]\d*)$/;
-
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
-function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
- return !!length &&
- (typeof value == 'number' || reIsUint.test(value)) &&
- (value > -1 && value % 1 == 0 && value < length);
-}
-
-/**
- * Checks if the given arguments are from an iteratee call.
- *
- * @private
- * @param {*} value The potential iteratee value argument.
- * @param {*} index The potential iteratee index or key argument.
- * @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
- * else `false`.
- */
-function isIterateeCall(value, index, object) {
- if (!isObject(object)) {
- return false;
- }
- var type = typeof index;
- if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)
- ) {
- return eq(object[index], value);
- }
- return false;
-}
-
-/**
- * Creates a function like `_.assign`.
- *
- * @private
- * @param {Function} assigner The function to assign values.
- * @returns {Function} Returns the new assigner function.
- */
-function createAssigner(assigner) {
- return baseRest(function(object, sources) {
- var index = -1,
- length = sources.length,
- customizer = length > 1 ? sources[length - 1] : undefined,
- guard = length > 2 ? sources[2] : undefined;
-
- customizer = (assigner.length > 3 && typeof customizer == 'function')
- ? (length--, customizer)
- : undefined;
-
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
- customizer = length < 3 ? undefined : customizer;
- length = 1;
- }
- object = Object(object);
- while (++index < length) {
- var source = sources[index];
- if (source) {
- assigner(object, source, index, customizer);
- }
- }
- return object;
- });
-}
-
-/**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
-function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
-
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
-}
-
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
-function isObjectLike(value) {
- return value != null && typeof value == 'object';
-}
-
-/** `Object#toString` result references. */
-var argsTag = '[object Arguments]';
-
-/**
- * The base implementation of `_.isArguments`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- */
-function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag;
-}
-
-/** Used for built-in method references. */
-var objectProto$5 = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
-
-/** Built-in value references. */
-var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
-
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
-var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') &&
- !propertyIsEnumerable.call(value, 'callee');
-};
-
-/**
- * Checks if `value` is classified as an `Array` object.
+ * Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
*/
var isBuffer = nativeIsBuffer || stubFalse;
+/** Used as references for various `Number` constants. */
+var MAX_SAFE_INTEGER = 9007199254740991;
+
+/** Used to detect unsigned integer values. */
+var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+/**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+function isIndex(value, length) {
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return !!length &&
+ (typeof value == 'number' || reIsUint.test(value)) &&
+ (value > -1 && value % 1 == 0 && value < length);
+}
+
+/** Used as references for various `Number` constants. */
+var MAX_SAFE_INTEGER$1 = 9007199254740991;
+
+/**
+ * Checks if `value` is a valid array-like length.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ * @example
+ *
+ * _.isLength(3);
+ * // => true
+ *
+ * _.isLength(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isLength(Infinity);
+ * // => false
+ *
+ * _.isLength('3');
+ * // => false
+ */
+function isLength(value) {
+ return typeof value == 'number' &&
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
+}
+
/** `Object#toString` result references. */
var argsTag$1 = '[object Arguments]';
var arrayTag = '[object Array]';
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/** Used for built-in method references. */
-var objectProto$4 = Object.prototype;
+var objectProto$7 = Object.prototype;
/** Used to check objects for own properties. */
-var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
+var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
length = result.length;
for (var key in value) {
- if ((inherited || hasOwnProperty$3.call(value, key)) &&
+ if ((inherited || hasOwnProperty$6.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
}
/** Used for built-in method references. */
-var objectProto$7 = Object.prototype;
+var objectProto$8 = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$7;
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
return value === proto;
}
+/**
+ * Creates a unary function that invokes `func` with its argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+}
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeKeys = overArg(Object.keys, Object);
+
+/** Used for built-in method references. */
+var objectProto$9 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
+
+/**
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+function baseKeys(object) {
+ if (!isPrototype(object)) {
+ return nativeKeys(object);
+ }
+ var result = [];
+ for (var key in Object(object)) {
+ if (hasOwnProperty$7.call(object, key) && key != 'constructor') {
+ result.push(key);
+ }
+ }
+ return result;
+}
+
+/**
+ * Checks if `value` is array-like. A value is considered array-like if it's
+ * not a function and has a `value.length` that's an integer greater than or
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+ * @example
+ *
+ * _.isArrayLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLike(document.body.children);
+ * // => true
+ *
+ * _.isArrayLike('abc');
+ * // => true
+ *
+ * _.isArrayLike(_.noop);
+ * // => false
+ */
+function isArrayLike(value) {
+ return value != null && isLength(value.length) && !isFunction(value);
+}
+
+/**
+ * Creates an array of the own enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects. See the
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+ * for more details.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keys(new Foo);
+ * // => ['a', 'b'] (iteration order is not guaranteed)
+ *
+ * _.keys('hi');
+ * // => ['0', '1']
+ */
+function keys$1(object) {
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
+}
+
+/**
+ * The base implementation of `_.assign` without support for multiple sources
+ * or `customizer` functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @returns {Object} Returns `object`.
+ */
+function baseAssign(object, source) {
+ return object && copyObject(source, keys$1(source), object);
+}
+
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
}
/** Used for built-in method references. */
-var objectProto$6 = Object.prototype;
+var objectProto$10 = Object.prototype;
/** Used to check objects for own properties. */
-var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
+var hasOwnProperty$8 = objectProto$10.hasOwnProperty;
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
result = [];
for (var key in object) {
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$5.call(object, key)))) {
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty$8.call(object, key)))) {
result.push(key);
}
}
}
/**
- * This method is like `_.assign` except that it iterates over own and
- * inherited source properties.
- *
- * **Note:** This method mutates `object`.
+ * The base implementation of `_.assignIn` without support for multiple sources
+ * or `customizer` functions.
*
- * @static
- * @memberOf _
- * @since 4.0.0
- * @alias extend
- * @category Object
+ * @private
* @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
+ * @param {Object} source The source object.
* @returns {Object} Returns `object`.
- * @see _.assign
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * }
- *
- * function Bar() {
- * this.c = 3;
- * }
- *
- * Foo.prototype.b = 2;
- * Bar.prototype.d = 4;
- *
- * _.assignIn({ 'a': 0 }, new Foo, new Bar);
- * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
-var assignIn = createAssigner(function(object, source) {
- copyObject(source, keysIn$1(source), object);
-});
+function baseAssignIn(object, source) {
+ return object && copyObject(source, keysIn$1(source), object);
+}
+
+/** Detect free variable `exports`. */
+var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
+
+/** Detect free variable `module`. */
+var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
+
+/** Detect the popular CommonJS extension `module.exports`. */
+var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
+
+/** Built-in value references. */
+var Buffer$1 = moduleExports$2 ? root$2.Buffer : undefined;
+var allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : undefined;
+
+/**
+ * Creates a clone of `buffer`.
+ *
+ * @private
+ * @param {Buffer} buffer The buffer to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Buffer} Returns the cloned buffer.
+ */
+function cloneBuffer(buffer, isDeep) {
+ if (isDeep) {
+ return buffer.slice();
+ }
+ var length = buffer.length,
+ result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
+
+ buffer.copy(result);
+ return result;
+}
+
+/**
+ * Copies the values of `source` to `array`.
+ *
+ * @private
+ * @param {Array} source The array to copy values from.
+ * @param {Array} [array=[]] The array to copy values to.
+ * @returns {Array} Returns `array`.
+ */
+function copyArray(source, array) {
+ var index = -1,
+ length = source.length;
+
+ array || (array = Array(length));
+ while (++index < length) {
+ array[index] = source[index];
+ }
+ return array;
+}
/**
* A specialized version of `_.filter` for arrays without support for
}
/**
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
+ * This method returns a new empty array.
*
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
+ * @static
+ * @memberOf _
+ * @since 4.13.0
+ * @category Util
+ * @returns {Array} Returns the new empty array.
+ * @example
+ *
+ * var arrays = _.times(2, _.stubArray);
+ *
+ * console.log(arrays);
+ * // => [[], []]
+ *
+ * console.log(arrays[0] === arrays[1]);
+ * // => false
*/
-function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var index = -1,
- iterable = Object(object),
- props = keysFunc(object),
- length = props.length;
-
- while (length--) {
- var key = props[fromRight ? length : ++index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
- }
- }
- return object;
- };
+function stubArray() {
+ return [];
}
+/** Used for built-in method references. */
+var objectProto$11 = Object.prototype;
+
+/** Built-in value references. */
+var propertyIsEnumerable$1 = objectProto$11.propertyIsEnumerable;
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeGetSymbols = Object.getOwnPropertySymbols;
+
/**
- * The base implementation of `baseForOwn` which iterates over `object`
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
- * Iteratee functions may exit iteration early by explicitly returning `false`.
+ * Creates an array of the own enumerable symbols of `object`.
*
* @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of symbols.
*/
-var baseFor = createBaseFor();
+var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
+ if (object == null) {
+ return [];
+ }
+ object = Object(object);
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
+ return propertyIsEnumerable$1.call(object, symbol);
+ });
+};
/**
- * Creates a unary function that invokes `func` with its argument transformed.
+ * Copies own symbols of `source` to `object`.
*
* @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
+ * @param {Object} source The object to copy symbols from.
+ * @param {Object} [object={}] The object to copy symbols to.
+ * @returns {Object} Returns `object`.
*/
-function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
+function copySymbols(source, object) {
+ return copyObject(source, getSymbols(source), object);
}
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeKeys = overArg(Object.keys, Object);
-
-/** Used for built-in method references. */
-var objectProto$8 = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
-
/**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
+ * Appends the elements of `values` to `array`.
*
* @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to append.
+ * @returns {Array} Returns `array`.
*/
-function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty$6.call(object, key) && key != 'constructor') {
- result.push(key);
- }
+function arrayPush(array, values) {
+ var index = -1,
+ length = values.length,
+ offset = array.length;
+
+ while (++index < length) {
+ array[offset + index] = values[index];
}
- return result;
+ return array;
}
+/** Built-in value references. */
+var getPrototype = overArg(Object.getPrototypeOf, Object);
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
+
/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
+ * Creates an array of the own and inherited enumerable symbols of `object`.
*
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
+ * @private
* @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
+ * @returns {Array} Returns the array of symbols.
*/
-function keys$1(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
-}
+var getSymbolsIn = !nativeGetSymbols$1 ? stubArray : function(object) {
+ var result = [];
+ while (object) {
+ arrayPush(result, getSymbols(object));
+ object = getPrototype(object);
+ }
+ return result;
+};
/**
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
+ * Copies own and inherited symbols of `source` to `object`.
*
* @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
+ * @param {Object} source The object to copy symbols from.
+ * @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
-function baseForOwn(object, iteratee) {
- return object && baseFor(object, iteratee, keys$1);
+function copySymbolsIn(source, object) {
+ return copyObject(source, getSymbolsIn(source), object);
}
/**
- * Creates a `baseEach` or `baseEachRight` function.
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
+ * symbols of `object`.
*
* @private
- * @param {Function} eachFunc The function to iterate over a collection.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
+ * @param {Object} object The object to query.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
+ * @returns {Array} Returns the array of property names and symbols.
*/
-function createBaseEach(eachFunc, fromRight) {
- return function(collection, iteratee) {
- if (collection == null) {
- return collection;
- }
- if (!isArrayLike(collection)) {
- return eachFunc(collection, iteratee);
- }
- var length = collection.length,
- index = fromRight ? length : -1,
- iterable = Object(collection);
-
- while ((fromRight ? index-- : ++index < length)) {
- if (iteratee(iterable[index], index, iterable) === false) {
- break;
- }
- }
- return collection;
- };
+function baseGetAllKeys(object, keysFunc, symbolsFunc) {
+ var result = keysFunc(object);
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
- * The base implementation of `_.forEach` without support for iteratee shorthands.
+ * Creates an array of own enumerable property names and symbols of `object`.
*
* @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array|Object} Returns `collection`.
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
*/
-var baseEach = createBaseEach(baseForOwn);
+function getAllKeys(object) {
+ return baseGetAllKeys(object, keys$1, getSymbols);
+}
/**
- * The base implementation of `_.filter` without support for iteratee shorthands.
+ * Creates an array of own and inherited enumerable property names and
+ * symbols of `object`.
*
* @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
*/
-function baseFilter(collection, predicate) {
- var result = [];
- baseEach(collection, function(value, index, collection) {
- if (predicate(value, index, collection)) {
- result.push(value);
- }
- });
- return result;
+function getAllKeysIn(object) {
+ return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
}
+/* Built-in method references that are verified to be native. */
+var DataView = getNative(root$2, 'DataView');
+
+/* Built-in method references that are verified to be native. */
+var Promise = getNative(root$2, 'Promise');
+
+/* Built-in method references that are verified to be native. */
+var Set$1 = getNative(root$2, 'Set');
+
+/* Built-in method references that are verified to be native. */
+var WeakMap = getNative(root$2, 'WeakMap');
+
+/** `Object#toString` result references. */
+var mapTag$1 = '[object Map]';
+var objectTag$1 = '[object Object]';
+var promiseTag = '[object Promise]';
+var setTag$1 = '[object Set]';
+var weakMapTag$1 = '[object WeakMap]';
+
+var dataViewTag$1 = '[object DataView]';
+
+/** Used to detect maps, sets, and weakmaps. */
+var dataViewCtorString = toSource(DataView);
+var mapCtorString = toSource(Map$1);
+var promiseCtorString = toSource(Promise);
+var setCtorString = toSource(Set$1);
+var weakMapCtorString = toSource(WeakMap);
+
/**
- * Removes all key-value entries from the list cache.
+ * Gets the `toStringTag` of `value`.
*
* @private
- * @name clear
- * @memberOf ListCache
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
*/
-function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
+var getTag = baseGetTag;
+
+// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
+if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
+ (Map$1 && getTag(new Map$1) != mapTag$1) ||
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
+ (Set$1 && getTag(new Set$1) != setTag$1) ||
+ (WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
+ getTag = function(value) {
+ var result = baseGetTag(value),
+ Ctor = result == objectTag$1 ? value.constructor : undefined,
+ ctorString = Ctor ? toSource(Ctor) : '';
+
+ if (ctorString) {
+ switch (ctorString) {
+ case dataViewCtorString: return dataViewTag$1;
+ case mapCtorString: return mapTag$1;
+ case promiseCtorString: return promiseTag;
+ case setCtorString: return setTag$1;
+ case weakMapCtorString: return weakMapTag$1;
+ }
+ }
+ return result;
+ };
}
+var getTag$1 = getTag;
+
+/** Used for built-in method references. */
+var objectProto$12 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$9 = objectProto$12.hasOwnProperty;
+
/**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
+ * Initializes an array clone.
*
* @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
+ * @param {Array} array The array to clone.
+ * @returns {Array} Returns the initialized clone.
*/
-function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq(array[length][0], key)) {
- return length;
- }
+function initCloneArray(array) {
+ var length = array.length,
+ result = array.constructor(length);
+
+ // Add properties assigned by `RegExp#exec`.
+ if (length && typeof array[0] == 'string' && hasOwnProperty$9.call(array, 'index')) {
+ result.index = array.index;
+ result.input = array.input;
}
- return -1;
+ return result;
}
-/** Used for built-in method references. */
-var arrayProto = Array.prototype;
-
/** Built-in value references. */
-var splice = arrayProto.splice;
+var Uint8Array = root$2.Uint8Array;
/**
- * Removes `key` and its value from the list cache.
+ * Creates a clone of `arrayBuffer`.
*
* @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
*/
-function listCacheDelete(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
-
- if (index < 0) {
- return false;
- }
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
- } else {
- splice.call(data, index, 1);
- }
- --this.size;
- return true;
+function cloneArrayBuffer(arrayBuffer) {
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
+ return result;
}
/**
- * Gets the list cache value for `key`.
+ * Creates a clone of `dataView`.
*
* @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
+ * @param {Object} dataView The data view to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned data view.
*/
-function listCacheGet(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
-
- return index < 0 ? undefined : data[index][1];
+function cloneDataView(dataView, isDeep) {
+ var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
/**
- * Checks if a list cache value for `key` exists.
+ * Adds the key-value `pair` to `map`.
*
* @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ * @param {Object} map The map to modify.
+ * @param {Array} pair The key-value pair to add.
+ * @returns {Object} Returns `map`.
*/
-function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
+function addMapEntry(map, pair) {
+ // Don't return `map.set` because it's not chainable in IE 11.
+ map.set(pair[0], pair[1]);
+ return map;
}
/**
- * Sets the list cache `key` to `value`.
+ * A specialized version of `_.reduce` for arrays without support for
+ * iteratee shorthands.
*
* @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
+ * the initial value.
+ * @returns {*} Returns the accumulated value.
*/
-function listCacheSet(key, value) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
+function arrayReduce(array, iteratee, accumulator, initAccum) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
- if (index < 0) {
- ++this.size;
- data.push([key, value]);
- } else {
- data[index][1] = value;
+ if (initAccum && length) {
+ accumulator = array[++index];
}
- return this;
+ while (++index < length) {
+ accumulator = iteratee(accumulator, array[index], index, array);
+ }
+ return accumulator;
}
/**
- * Creates an list cache object.
+ * Converts `map` to its key-value pairs.
*
* @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
+ * @param {Object} map The map to convert.
+ * @returns {Array} Returns the key-value pairs.
*/
-function ListCache(entries) {
+function mapToArray(map) {
var index = -1,
- length = entries == null ? 0 : entries.length;
+ result = Array(map.size);
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
+ map.forEach(function(value, key) {
+ result[++index] = [key, value];
+ });
+ return result;
}
-// Add methods to `ListCache`.
-ListCache.prototype.clear = listCacheClear;
-ListCache.prototype['delete'] = listCacheDelete;
-ListCache.prototype.get = listCacheGet;
-ListCache.prototype.has = listCacheHas;
-ListCache.prototype.set = listCacheSet;
+/** Used to compose bitmasks for cloning. */
+var CLONE_DEEP_FLAG = 1;
/**
- * Removes all key-value entries from the stack.
+ * Creates a clone of `map`.
*
* @private
- * @name clear
- * @memberOf Stack
+ * @param {Object} map The map to clone.
+ * @param {Function} cloneFunc The function to clone values.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned map.
*/
-function stackClear() {
- this.__data__ = new ListCache;
- this.size = 0;
+function cloneMap(map, isDeep, cloneFunc) {
+ var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
+ return arrayReduce(array, addMapEntry, new map.constructor);
}
+/** Used to match `RegExp` flags from their coerced string values. */
+var reFlags = /\w*$/;
+
/**
- * Removes `key` and its value from the stack.
+ * Creates a clone of `regexp`.
*
* @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ * @param {Object} regexp The regexp to clone.
+ * @returns {Object} Returns the cloned regexp.
*/
-function stackDelete(key) {
- var data = this.__data__,
- result = data['delete'](key);
-
- this.size = data.size;
+function cloneRegExp(regexp) {
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
+ result.lastIndex = regexp.lastIndex;
return result;
}
/**
- * Gets the stack value for `key`.
+ * Adds `value` to `set`.
*
* @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
+ * @param {Object} set The set to modify.
+ * @param {*} value The value to add.
+ * @returns {Object} Returns `set`.
*/
-function stackGet(key) {
- return this.__data__.get(key);
+function addSetEntry(set, value) {
+ // Don't return `set.add` because it's not chainable in IE 11.
+ set.add(value);
+ return set;
}
/**
- * Checks if a stack value for `key` exists.
+ * Converts `set` to an array of its values.
*
* @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ * @param {Object} set The set to convert.
+ * @returns {Array} Returns the values.
*/
-function stackHas(key) {
- return this.__data__.has(key);
-}
+function setToArray(set) {
+ var index = -1,
+ result = Array(set.size);
-/* Built-in method references that are verified to be native. */
-var Map$1 = getNative(root$2, 'Map');
+ set.forEach(function(value) {
+ result[++index] = value;
+ });
+ return result;
+}
-/* Built-in method references that are verified to be native. */
-var nativeCreate = getNative(Object, 'create');
+/** Used to compose bitmasks for cloning. */
+var CLONE_DEEP_FLAG$1 = 1;
/**
- * Removes all key-value entries from the hash.
+ * Creates a clone of `set`.
*
* @private
- * @name clear
- * @memberOf Hash
+ * @param {Object} set The set to clone.
+ * @param {Function} cloneFunc The function to clone values.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned set.
*/
-function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
- this.size = 0;
+function cloneSet(set, isDeep, cloneFunc) {
+ var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG$1) : setToArray(set);
+ return arrayReduce(array, addSetEntry, new set.constructor);
}
+/** Used to convert symbols to primitives and strings. */
+var symbolProto = Symbol ? Symbol.prototype : undefined;
+var symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
+
/**
- * Removes `key` and its value from the hash.
+ * Creates a clone of the `symbol` object.
*
* @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ * @param {Object} symbol The symbol object to clone.
+ * @returns {Object} Returns the cloned symbol object.
*/
-function hashDelete(key) {
- var result = this.has(key) && delete this.__data__[key];
- this.size -= result ? 1 : 0;
- return result;
+function cloneSymbol(symbol) {
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}
-/** Used to stand-in for `undefined` hash values. */
-var HASH_UNDEFINED = '__lodash_hash_undefined__';
-
-/** Used for built-in method references. */
-var objectProto$9 = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
-
/**
- * Gets the hash value for `key`.
+ * Creates a clone of `typedArray`.
*
* @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
+ * @param {Object} typedArray The typed array to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned typed array.
*/
-function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
- }
- return hasOwnProperty$7.call(data, key) ? data[key] : undefined;
+function cloneTypedArray(typedArray, isDeep) {
+ var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
-/** Used for built-in method references. */
-var objectProto$10 = Object.prototype;
+/** `Object#toString` result references. */
+var boolTag$1 = '[object Boolean]';
+var dateTag$1 = '[object Date]';
+var mapTag$2 = '[object Map]';
+var numberTag$1 = '[object Number]';
+var regexpTag$1 = '[object RegExp]';
+var setTag$2 = '[object Set]';
+var stringTag$1 = '[object String]';
+var symbolTag = '[object Symbol]';
-/** Used to check objects for own properties. */
-var hasOwnProperty$8 = objectProto$10.hasOwnProperty;
+var arrayBufferTag$1 = '[object ArrayBuffer]';
+var dataViewTag$2 = '[object DataView]';
+var float32Tag$1 = '[object Float32Array]';
+var float64Tag$1 = '[object Float64Array]';
+var int8Tag$1 = '[object Int8Array]';
+var int16Tag$1 = '[object Int16Array]';
+var int32Tag$1 = '[object Int32Array]';
+var uint8Tag$1 = '[object Uint8Array]';
+var uint8ClampedTag$1 = '[object Uint8ClampedArray]';
+var uint16Tag$1 = '[object Uint16Array]';
+var uint32Tag$1 = '[object Uint32Array]';
/**
- * Checks if a hash value for `key` exists.
+ * Initializes an object clone based on its `toStringTag`.
+ *
+ * **Note:** This function only supports cloning values with tags of
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ * @param {Object} object The object to clone.
+ * @param {string} tag The `toStringTag` of the object to clone.
+ * @param {Function} cloneFunc The function to clone values.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the initialized clone.
*/
-function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$8.call(data, key);
+function initCloneByTag(object, tag, cloneFunc, isDeep) {
+ var Ctor = object.constructor;
+ switch (tag) {
+ case arrayBufferTag$1:
+ return cloneArrayBuffer(object);
+
+ case boolTag$1:
+ case dateTag$1:
+ return new Ctor(+object);
+
+ case dataViewTag$2:
+ return cloneDataView(object, isDeep);
+
+ case float32Tag$1: case float64Tag$1:
+ case int8Tag$1: case int16Tag$1: case int32Tag$1:
+ case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
+ return cloneTypedArray(object, isDeep);
+
+ case mapTag$2:
+ return cloneMap(object, isDeep, cloneFunc);
+
+ case numberTag$1:
+ case stringTag$1:
+ return new Ctor(object);
+
+ case regexpTag$1:
+ return cloneRegExp(object);
+
+ case setTag$2:
+ return cloneSet(object, isDeep, cloneFunc);
+
+ case symbolTag:
+ return cloneSymbol(object);
+ }
}
-/** Used to stand-in for `undefined` hash values. */
-var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
+/** Built-in value references. */
+var objectCreate = Object.create;
/**
- * Sets the hash `key` to `value`.
+ * The base implementation of `_.create` without support for assigning
+ * properties to the created object.
*
* @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
+ * @param {Object} proto The object to inherit from.
+ * @returns {Object} Returns the new object.
*/
-function hashSet(key, value) {
- var data = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
- return this;
-}
+var baseCreate = (function() {
+ function object() {}
+ return function(proto) {
+ if (!isObject(proto)) {
+ return {};
+ }
+ if (objectCreate) {
+ return objectCreate(proto);
+ }
+ object.prototype = proto;
+ var result = new object;
+ object.prototype = undefined;
+ return result;
+ };
+}());
/**
- * Creates a hash object.
+ * Initializes an object clone.
*
* @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
+ * @param {Object} object The object to clone.
+ * @returns {Object} Returns the initialized clone.
*/
-function Hash(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
+function initCloneObject(object) {
+ return (typeof object.constructor == 'function' && !isPrototype(object))
+ ? baseCreate(getPrototype(object))
+ : {};
}
-// Add methods to `Hash`.
-Hash.prototype.clear = hashClear;
-Hash.prototype['delete'] = hashDelete;
-Hash.prototype.get = hashGet;
-Hash.prototype.has = hashHas;
-Hash.prototype.set = hashSet;
+/** Used to compose bitmasks for cloning. */
+var CLONE_DEEP_FLAG$2 = 1;
+var CLONE_FLAT_FLAG = 2;
+var CLONE_SYMBOLS_FLAG = 4;
+
+/** `Object#toString` result references. */
+var argsTag$2 = '[object Arguments]';
+var arrayTag$1 = '[object Array]';
+var boolTag$2 = '[object Boolean]';
+var dateTag$2 = '[object Date]';
+var errorTag$1 = '[object Error]';
+var funcTag$2 = '[object Function]';
+var genTag$1 = '[object GeneratorFunction]';
+var mapTag$3 = '[object Map]';
+var numberTag$2 = '[object Number]';
+var objectTag$2 = '[object Object]';
+var regexpTag$2 = '[object RegExp]';
+var setTag$3 = '[object Set]';
+var stringTag$2 = '[object String]';
+var symbolTag$1 = '[object Symbol]';
+var weakMapTag$2 = '[object WeakMap]';
+
+var arrayBufferTag$2 = '[object ArrayBuffer]';
+var dataViewTag$3 = '[object DataView]';
+var float32Tag$2 = '[object Float32Array]';
+var float64Tag$2 = '[object Float64Array]';
+var int8Tag$2 = '[object Int8Array]';
+var int16Tag$2 = '[object Int16Array]';
+var int32Tag$2 = '[object Int32Array]';
+var uint8Tag$2 = '[object Uint8Array]';
+var uint8ClampedTag$2 = '[object Uint8ClampedArray]';
+var uint16Tag$2 = '[object Uint16Array]';
+var uint32Tag$2 = '[object Uint32Array]';
+
+/** Used to identify `toStringTag` values supported by `_.clone`. */
+var cloneableTags = {};
+cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] =
+cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] =
+cloneableTags[boolTag$2] = cloneableTags[dateTag$2] =
+cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
+cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
+cloneableTags[int32Tag$2] = cloneableTags[mapTag$3] =
+cloneableTags[numberTag$2] = cloneableTags[objectTag$2] =
+cloneableTags[regexpTag$2] = cloneableTags[setTag$3] =
+cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] =
+cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
+cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
+cloneableTags[errorTag$1] = cloneableTags[funcTag$2] =
+cloneableTags[weakMapTag$2] = false;
/**
- * Removes all key-value entries from the map.
+ * The base implementation of `_.clone` and `_.cloneDeep` which tracks
+ * traversed objects.
*
* @private
- * @name clear
- * @memberOf MapCache
+ * @param {*} value The value to clone.
+ * @param {boolean} bitmask The bitmask flags.
+ * 1 - Deep clone
+ * 2 - Flatten inherited properties
+ * 4 - Clone symbols
+ * @param {Function} [customizer] The function to customize cloning.
+ * @param {string} [key] The key of `value`.
+ * @param {Object} [object] The parent object of `value`.
+ * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
+ * @returns {*} Returns the cloned value.
*/
-function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- 'hash': new Hash,
- 'map': new (Map$1 || ListCache),
- 'string': new Hash
- };
+function baseClone(value, bitmask, customizer, key, object, stack) {
+ var result,
+ isDeep = bitmask & CLONE_DEEP_FLAG$2,
+ isFlat = bitmask & CLONE_FLAT_FLAG,
+ isFull = bitmask & CLONE_SYMBOLS_FLAG;
+
+ if (customizer) {
+ result = object ? customizer(value, key, object, stack) : customizer(value);
+ }
+ if (result !== undefined) {
+ return result;
+ }
+ if (!isObject(value)) {
+ return value;
+ }
+ var isArr = isArray(value);
+ if (isArr) {
+ result = initCloneArray(value);
+ if (!isDeep) {
+ return copyArray(value, result);
+ }
+ } else {
+ var tag = getTag$1(value),
+ isFunc = tag == funcTag$2 || tag == genTag$1;
+
+ if (isBuffer(value)) {
+ return cloneBuffer(value, isDeep);
+ }
+ if (tag == objectTag$2 || tag == argsTag$2 || (isFunc && !object)) {
+ result = (isFlat || isFunc) ? {} : initCloneObject(value);
+ if (!isDeep) {
+ return isFlat
+ ? copySymbolsIn(value, baseAssignIn(result, value))
+ : copySymbols(value, baseAssign(result, value));
+ }
+ } else {
+ if (!cloneableTags[tag]) {
+ return object ? value : {};
+ }
+ result = initCloneByTag(value, tag, baseClone, isDeep);
+ }
+ }
+ // Check for circular references and return its corresponding clone.
+ stack || (stack = new Stack);
+ var stacked = stack.get(value);
+ if (stacked) {
+ return stacked;
+ }
+ stack.set(value, result);
+
+ var keysFunc = isFull
+ ? (isFlat ? getAllKeysIn : getAllKeys)
+ : (isFlat ? keysIn : keys$1);
+
+ var props = isArr ? undefined : keysFunc(value);
+ arrayEach(props || value, function(subValue, key) {
+ if (props) {
+ key = subValue;
+ subValue = value[key];
+ }
+ // Recursively populate clone (susceptible to call stack limits).
+ assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
+ });
+ return result;
}
+/** Used to compose bitmasks for cloning. */
+var CLONE_SYMBOLS_FLAG$1 = 4;
+
/**
- * Checks if `value` is suitable for use as unique object key.
+ * Creates a shallow clone of `value`.
*
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
+ * **Note:** This method is loosely based on the
+ * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
+ * and supports cloning arrays, array buffers, booleans, date objects, maps,
+ * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
+ * arrays. The own enumerable properties of `arguments` objects are cloned
+ * as plain objects. An empty object is returned for uncloneable values such
+ * as error objects, functions, DOM nodes, and WeakMaps.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to clone.
+ * @returns {*} Returns the cloned value.
+ * @see _.cloneDeep
+ * @example
+ *
+ * var objects = [{ 'a': 1 }, { 'b': 2 }];
+ *
+ * var shallow = _.clone(objects);
+ * console.log(shallow[0] === objects[0]);
+ * // => true
*/
-function isKeyable(value) {
- var type = typeof value;
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
- ? (value !== '__proto__')
- : (value === null);
+function clone(value) {
+ return baseClone(value, CLONE_SYMBOLS_FLAG$1);
}
/**
- * Gets the data for `map`.
+ * A specialized version of `baseAggregator` for arrays.
*
* @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} setter The function to set `accumulator` values.
+ * @param {Function} iteratee The iteratee to transform keys.
+ * @param {Object} accumulator The initial aggregated object.
+ * @returns {Function} Returns `accumulator`.
*/
-function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key)
- ? data[typeof key == 'string' ? 'string' : 'hash']
- : data.map;
+function arrayAggregator(array, setter, iteratee, accumulator) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ var value = array[index];
+ setter(accumulator, value, iteratee(value), array);
+ }
+ return accumulator;
}
/**
- * Removes `key` and its value from the map.
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
*/
-function mapCacheDelete(key) {
- var result = getMapData(this, key)['delete'](key);
- this.size -= result ? 1 : 0;
- return result;
+function createBaseFor(fromRight) {
+ return function(object, iteratee, keysFunc) {
+ var index = -1,
+ iterable = Object(object),
+ props = keysFunc(object),
+ length = props.length;
+
+ while (length--) {
+ var key = props[fromRight ? length : ++index];
+ if (iteratee(iterable[key], key, iterable) === false) {
+ break;
+ }
+ }
+ return object;
+ };
}
/**
- * Gets the map value for `key`.
+ * The base implementation of `baseForOwn` which iterates over `object`
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
*/
-function mapCacheGet(key) {
- return getMapData(this, key).get(key);
-}
+var baseFor = createBaseFor();
/**
- * Checks if a map value for `key` exists.
+ * The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
*/
-function mapCacheHas(key) {
- return getMapData(this, key).has(key);
+function baseForOwn(object, iteratee) {
+ return object && baseFor(object, iteratee, keys$1);
}
/**
- * Sets the map `key` to `value`.
+ * Creates a `baseEach` or `baseEachRight` function.
*
* @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
+ * @param {Function} eachFunc The function to iterate over a collection.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
*/
-function mapCacheSet(key, value) {
- var data = getMapData(this, key),
- size = data.size;
+function createBaseEach(eachFunc, fromRight) {
+ return function(collection, iteratee) {
+ if (collection == null) {
+ return collection;
+ }
+ if (!isArrayLike(collection)) {
+ return eachFunc(collection, iteratee);
+ }
+ var length = collection.length,
+ index = fromRight ? length : -1,
+ iterable = Object(collection);
- data.set(key, value);
- this.size += data.size == size ? 0 : 1;
- return this;
+ while ((fromRight ? index-- : ++index < length)) {
+ if (iteratee(iterable[index], index, iterable) === false) {
+ break;
+ }
+ }
+ return collection;
+ };
}
/**
- * Creates a map cache object to store key-value pairs.
+ * The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
-function MapCache(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
-
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
-}
-
-// Add methods to `MapCache`.
-MapCache.prototype.clear = mapCacheClear;
-MapCache.prototype['delete'] = mapCacheDelete;
-MapCache.prototype.get = mapCacheGet;
-MapCache.prototype.has = mapCacheHas;
-MapCache.prototype.set = mapCacheSet;
-
-/** Used as the size to enable large array optimizations. */
-var LARGE_ARRAY_SIZE = 200;
-
-/**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array|Object} Returns `collection`.
*/
-function stackSet(key, value) {
- var data = this.__data__;
- if (data instanceof ListCache) {
- var pairs = data.__data__;
- if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
- pairs.push([key, value]);
- this.size = ++data.size;
- return this;
- }
- data = this.__data__ = new MapCache(pairs);
- }
- data.set(key, value);
- this.size = data.size;
- return this;
-}
+var baseEach = createBaseEach(baseForOwn);
/**
- * Creates a stack cache object to store key-value pairs.
+ * Aggregates elements of `collection` on `accumulator` with keys transformed
+ * by `iteratee` and values set by `setter`.
*
* @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} setter The function to set `accumulator` values.
+ * @param {Function} iteratee The iteratee to transform keys.
+ * @param {Object} accumulator The initial aggregated object.
+ * @returns {Function} Returns `accumulator`.
*/
-function Stack(entries) {
- var data = this.__data__ = new ListCache(entries);
- this.size = data.size;
+function baseAggregator(collection, setter, iteratee, accumulator) {
+ baseEach(collection, function(value, key, collection) {
+ setter(accumulator, value, iteratee(value), collection);
+ });
+ return accumulator;
}
-// Add methods to `Stack`.
-Stack.prototype.clear = stackClear;
-Stack.prototype['delete'] = stackDelete;
-Stack.prototype.get = stackGet;
-Stack.prototype.has = stackHas;
-Stack.prototype.set = stackSet;
-
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
}
/** Used to compose bitmasks for value comparisons. */
-var COMPARE_PARTIAL_FLAG$2 = 1;
-var COMPARE_UNORDERED_FLAG$1 = 2;
+var COMPARE_PARTIAL_FLAG = 1;
+var COMPARE_UNORDERED_FLAG = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2,
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
}
var index = -1,
result = true,
- seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
+ seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
return result;
}
-/** Built-in value references. */
-var Uint8Array = root$2.Uint8Array;
-
-/**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */
-function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
-
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
-}
-
-/**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */
-function setToArray(set) {
- var index = -1,
- result = Array(set.size);
-
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
-}
-
/** Used to compose bitmasks for value comparisons. */
-var COMPARE_PARTIAL_FLAG$3 = 1;
-var COMPARE_UNORDERED_FLAG$2 = 2;
+var COMPARE_PARTIAL_FLAG$1 = 1;
+var COMPARE_UNORDERED_FLAG$1 = 2;
/** `Object#toString` result references. */
-var boolTag$1 = '[object Boolean]';
-var dateTag$1 = '[object Date]';
-var errorTag$1 = '[object Error]';
-var mapTag$1 = '[object Map]';
-var numberTag$1 = '[object Number]';
-var regexpTag$1 = '[object RegExp]';
-var setTag$1 = '[object Set]';
-var stringTag$1 = '[object String]';
-var symbolTag = '[object Symbol]';
+var boolTag$3 = '[object Boolean]';
+var dateTag$3 = '[object Date]';
+var errorTag$2 = '[object Error]';
+var mapTag$4 = '[object Map]';
+var numberTag$3 = '[object Number]';
+var regexpTag$3 = '[object RegExp]';
+var setTag$4 = '[object Set]';
+var stringTag$3 = '[object String]';
+var symbolTag$2 = '[object Symbol]';
-var arrayBufferTag$1 = '[object ArrayBuffer]';
-var dataViewTag$1 = '[object DataView]';
+var arrayBufferTag$3 = '[object ArrayBuffer]';
+var dataViewTag$4 = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
-var symbolProto = Symbol ? Symbol.prototype : undefined;
-var symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
+var symbolProto$1 = Symbol ? Symbol.prototype : undefined;
+var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined;
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
- case dataViewTag$1:
+ case dataViewTag$4:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
object = object.buffer;
other = other.buffer;
- case arrayBufferTag$1:
+ case arrayBufferTag$3:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
- case boolTag$1:
- case dateTag$1:
- case numberTag$1:
+ case boolTag$3:
+ case dateTag$3:
+ case numberTag$3:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
- case errorTag$1:
+ case errorTag$2:
return object.name == other.name && object.message == other.message;
- case regexpTag$1:
- case stringTag$1:
+ case regexpTag$3:
+ case stringTag$3:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
- case mapTag$1:
+ case mapTag$4:
var convert = mapToArray;
- case setTag$1:
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3;
+ case setTag$4:
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
if (stacked) {
return stacked == other;
}
- bitmask |= COMPARE_UNORDERED_FLAG$2;
+ bitmask |= COMPARE_UNORDERED_FLAG$1;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
stack['delete'](object);
return result;
- case symbolTag:
- if (symbolValueOf) {
- return symbolValueOf.call(object) == symbolValueOf.call(other);
+ case symbolTag$2:
+ if (symbolValueOf$1) {
+ return symbolValueOf$1.call(object) == symbolValueOf$1.call(other);
}
}
return false;
}
-/**
- * Appends the elements of `values` to `array`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to append.
- * @returns {Array} Returns `array`.
- */
-function arrayPush(array, values) {
- var index = -1,
- length = values.length,
- offset = array.length;
-
- while (++index < length) {
- array[offset + index] = values[index];
- }
- return array;
-}
-
-/**
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
- * symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
- * @returns {Array} Returns the array of property names and symbols.
- */
-function baseGetAllKeys(object, keysFunc, symbolsFunc) {
- var result = keysFunc(object);
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
-}
-
-/**
- * This method returns a new empty array.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {Array} Returns the new empty array.
- * @example
- *
- * var arrays = _.times(2, _.stubArray);
- *
- * console.log(arrays);
- * // => [[], []]
- *
- * console.log(arrays[0] === arrays[1]);
- * // => false
- */
-function stubArray() {
- return [];
-}
-
-/** Used for built-in method references. */
-var objectProto$13 = Object.prototype;
-
-/** Built-in value references. */
-var propertyIsEnumerable$1 = objectProto$13.propertyIsEnumerable;
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeGetSymbols = Object.getOwnPropertySymbols;
-
-/**
- * Creates an array of the own enumerable symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
- */
-var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
- if (object == null) {
- return [];
- }
- object = Object(object);
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
- return propertyIsEnumerable$1.call(object, symbol);
- });
-};
-
-/**
- * Creates an array of own enumerable property names and symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names and symbols.
- */
-function getAllKeys(object) {
- return baseGetAllKeys(object, keys$1, getSymbols);
-}
-
/** Used to compose bitmasks for value comparisons. */
-var COMPARE_PARTIAL_FLAG$4 = 1;
+var COMPARE_PARTIAL_FLAG$2 = 1;
/** Used for built-in method references. */
-var objectProto$12 = Object.prototype;
+var objectProto$13 = Object.prototype;
/** Used to check objects for own properties. */
-var hasOwnProperty$10 = objectProto$12.hasOwnProperty;
+var hasOwnProperty$10 = objectProto$13.hasOwnProperty;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4,
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
return result;
}
-/* Built-in method references that are verified to be native. */
-var DataView = getNative(root$2, 'DataView');
-
-/* Built-in method references that are verified to be native. */
-var Promise = getNative(root$2, 'Promise');
-
-/* Built-in method references that are verified to be native. */
-var Set$1 = getNative(root$2, 'Set');
-
-/* Built-in method references that are verified to be native. */
-var WeakMap = getNative(root$2, 'WeakMap');
-
-/** `Object#toString` result references. */
-var mapTag$2 = '[object Map]';
-var objectTag$2 = '[object Object]';
-var promiseTag = '[object Promise]';
-var setTag$2 = '[object Set]';
-var weakMapTag$1 = '[object WeakMap]';
-
-var dataViewTag$2 = '[object DataView]';
-
-/** Used to detect maps, sets, and weakmaps. */
-var dataViewCtorString = toSource(DataView);
-var mapCtorString = toSource(Map$1);
-var promiseCtorString = toSource(Promise);
-var setCtorString = toSource(Set$1);
-var weakMapCtorString = toSource(WeakMap);
-
-/**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
-var getTag = baseGetTag;
-
-// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
-if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
- (Map$1 && getTag(new Map$1) != mapTag$2) ||
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
- (Set$1 && getTag(new Set$1) != setTag$2) ||
- (WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
- getTag = function(value) {
- var result = baseGetTag(value),
- Ctor = result == objectTag$2 ? value.constructor : undefined,
- ctorString = Ctor ? toSource(Ctor) : '';
-
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString: return dataViewTag$2;
- case mapCtorString: return mapTag$2;
- case promiseCtorString: return promiseTag;
- case setCtorString: return setTag$2;
- case weakMapCtorString: return weakMapTag$1;
- }
- }
- return result;
- };
-}
-
-var getTag$1 = getTag;
-
/** Used to compose bitmasks for value comparisons. */
-var COMPARE_PARTIAL_FLAG$1 = 1;
+var COMPARE_PARTIAL_FLAG$3 = 1;
/** `Object#toString` result references. */
-var argsTag$2 = '[object Arguments]';
-var arrayTag$1 = '[object Array]';
-var objectTag$1 = '[object Object]';
+var argsTag$3 = '[object Arguments]';
+var arrayTag$2 = '[object Array]';
+var objectTag$3 = '[object Object]';
/** Used for built-in method references. */
-var objectProto$11 = Object.prototype;
+var objectProto$14 = Object.prototype;
/** Used to check objects for own properties. */
-var hasOwnProperty$9 = objectProto$11.hasOwnProperty;
+var hasOwnProperty$11 = objectProto$14.hasOwnProperty;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
- objTag = objIsArr ? arrayTag$1 : getTag$1(object),
- othTag = othIsArr ? arrayTag$1 : getTag$1(other);
+ objTag = objIsArr ? arrayTag$2 : getTag$1(object),
+ othTag = othIsArr ? arrayTag$2 : getTag$1(other);
- objTag = objTag == argsTag$2 ? objectTag$1 : objTag;
- othTag = othTag == argsTag$2 ? objectTag$1 : othTag;
+ objTag = objTag == argsTag$3 ? objectTag$3 : objTag;
+ othTag = othTag == argsTag$3 ? objectTag$3 : othTag;
- var objIsObj = objTag == objectTag$1,
- othIsObj = othTag == objectTag$1,
+ var objIsObj = objTag == objectTag$3,
+ othIsObj = othTag == objectTag$3,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
- if (!(bitmask & COMPARE_PARTIAL_FLAG$1)) {
- var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, '__wrapped__'),
- othIsWrapped = othIsObj && hasOwnProperty$9.call(other, '__wrapped__');
+ if (!(bitmask & COMPARE_PARTIAL_FLAG$3)) {
+ var objIsWrapped = objIsObj && hasOwnProperty$11.call(object, '__wrapped__'),
+ othIsWrapped = othIsObj && hasOwnProperty$11.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
}
/** Used to compose bitmasks for value comparisons. */
-var COMPARE_PARTIAL_FLAG = 1;
-var COMPARE_UNORDERED_FLAG = 2;
+var COMPARE_PARTIAL_FLAG$4 = 1;
+var COMPARE_UNORDERED_FLAG$2 = 2;
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
- ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
+ ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$4 | COMPARE_UNORDERED_FLAG$2, customizer, stack)
: result
)) {
return false;
}
/** `Object#toString` result references. */
-var symbolTag$1 = '[object Symbol]';
+var symbolTag$3 = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
- (isObjectLike(value) && baseGetTag(value) == symbolTag$1);
+ (isObjectLike(value) && baseGetTag(value) == symbolTag$3);
}
/** Used to match property names within property paths. */
var INFINITY = 1 / 0;
/** Used to convert symbols to primitives and strings. */
-var symbolProto$1 = Symbol ? Symbol.prototype : undefined;
-var symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
+var symbolProto$2 = Symbol ? Symbol.prototype : undefined;
+var symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
};
}
+/**
+ * This method returns the first argument it receives.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Util
+ * @param {*} value Any value.
+ * @returns {*} Returns `value`.
+ * @example
+ *
+ * var object = { 'a': 1 };
+ *
+ * console.log(_.identity(object) === object);
+ * // => true
+ */
+function identity$8(value) {
+ return value;
+}
+
/**
* The base implementation of `_.property` without support for deep paths.
*
}
/**
- * Iterates over elements of `collection`, returning an array of all elements
- * `predicate` returns truthy for. The predicate is invoked with three
- * arguments: (value, index|key, collection).
+ * Creates a function like `_.groupBy`.
*
- * **Note:** Unlike `_.remove`, this method returns a new array.
+ * @private
+ * @param {Function} setter The function to set accumulator values.
+ * @param {Function} [initializer] The accumulator object initializer.
+ * @returns {Function} Returns the new aggregator function.
+ */
+function createAggregator(setter, initializer) {
+ return function(collection, iteratee) {
+ var func = isArray(collection) ? arrayAggregator : baseAggregator,
+ accumulator = initializer ? initializer() : {};
+
+ return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
+ };
+}
+
+/** Used for built-in method references. */
+var objectProto$15 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$12 = objectProto$15.hasOwnProperty;
+
+/**
+ * Creates an object composed of keys generated from the results of running
+ * each element of `collection` thru `iteratee`. The order of grouped values
+ * is determined by the order they occur in `collection`. The corresponding
+ * value of each key is an array of elements responsible for generating the
+ * key. The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
- * @see _.reject
+ * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
+ * @returns {Object} Returns the composed aggregate object.
* @example
*
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false }
- * ];
- *
- * _.filter(users, function(o) { return !o.active; });
- * // => objects for ['fred']
+ * _.groupBy([6.1, 4.2, 6.3], Math.floor);
+ * // => { '4': [4.2], '6': [6.1, 6.3] }
*
- * // The `_.matches` iteratee shorthand.
- * _.filter(users, { 'age': 36, 'active': true });
- * // => objects for ['barney']
+ * // The `_.property` iteratee shorthand.
+ * _.groupBy(['one', 'two', 'three'], 'length');
+ * // => { '3': ['one', 'two'], '5': ['three'] }
+ */
+var groupBy = createAggregator(function(result, value, key) {
+ if (hasOwnProperty$12.call(result, key)) {
+ result[key].push(value);
+ } else {
+ baseAssignValue(result, key, [value]);
+ }
+});
+
+/**
+ * Gets the last element of `array`.
*
- * // The `_.matchesProperty` iteratee shorthand.
- * _.filter(users, ['active', false]);
- * // => objects for ['fred']
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {*} Returns the last element of `array`.
+ * @example
*
- * // The `_.property` iteratee shorthand.
- * _.filter(users, 'active');
- * // => objects for ['barney']
+ * _.last([1, 2, 3]);
+ * // => 3
*/
-function filter(collection, predicate) {
- var func = isArray(collection) ? arrayFilter : baseFilter;
- return func(collection, baseIteratee(predicate, 3));
+function last(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? array[length - 1] : undefined;
}
/**
- * Creates a `_.find` or `_.findLast` function.
+ * The base implementation of `_.slice` without an iteratee call guard.
*
* @private
- * @param {Function} findIndexFunc The function to find the collection index.
- * @returns {Function} Returns the new find function.
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
*/
-function createFind(findIndexFunc) {
- return function(collection, predicate, fromIndex) {
- var iterable = Object(collection);
- if (!isArrayLike(collection)) {
- var iteratee = baseIteratee(predicate, 3);
- collection = keys$1(collection);
- predicate = function(key) { return iteratee(iterable[key], key, iterable); };
- }
- var index = findIndexFunc(collection, predicate, fromIndex);
- return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
- };
+function baseSlice(array, start, end) {
+ var index = -1,
+ length = array.length;
+
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = end > length ? length : end;
+ if (end < 0) {
+ end += length;
+ }
+ length = start > end ? 0 : ((end - start) >>> 0);
+ start >>>= 0;
+
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = array[index + start];
+ }
+ return result;
}
/**
- * The base implementation of `_.findIndex` and `_.findLastIndex` without
- * support for iteratee shorthands.
+ * Gets the parent value at `path` of `object`.
*
* @private
- * @param {Array} array The array to inspect.
- * @param {Function} predicate The function invoked per iteration.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched value, else `-1`.
+ * @param {Object} object The object to query.
+ * @param {Array} path The path to get the parent value of.
+ * @returns {*} Returns the parent value.
*/
-function baseFindIndex(array, predicate, fromIndex, fromRight) {
- var length = array.length,
- index = fromIndex + (fromRight ? 1 : -1);
-
- while ((fromRight ? index-- : ++index < length)) {
- if (predicate(array[index], index, array)) {
- return index;
- }
- }
- return -1;
+function parent(object, path) {
+ return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
-/** Used as references for various `Number` constants. */
-var NAN = 0 / 0;
+/**
+ * The base implementation of `_.unset`.
+ *
+ * @private
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The property path to unset.
+ * @returns {boolean} Returns `true` if the property is deleted, else `false`.
+ */
+function baseUnset(object, path) {
+ path = castPath(path, object);
+ object = parent(object, path);
+ return object == null || delete object[toKey(last(path))];
+}
-/** Used to match leading and trailing whitespace. */
-var reTrim = /^\s+|\s+$/g;
+/** `Object#toString` result references. */
+var objectTag$4 = '[object Object]';
-/** Used to detect bad signed hexadecimal string values. */
-var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+/** Used for built-in method references. */
+var funcProto$2 = Function.prototype;
+var objectProto$16 = Object.prototype;
-/** Used to detect binary string values. */
-var reIsBinary = /^0b[01]+$/i;
+/** Used to resolve the decompiled source of functions. */
+var funcToString$2 = funcProto$2.toString;
-/** Used to detect octal string values. */
-var reIsOctal = /^0o[0-7]+$/i;
+/** Used to check objects for own properties. */
+var hasOwnProperty$13 = objectProto$16.hasOwnProperty;
-/** Built-in method references without a dependency on `root`. */
-var freeParseInt = parseInt;
+/** Used to infer the `Object` constructor. */
+var objectCtorString = funcToString$2.call(Object);
/**
- * Converts `value` to a number.
+ * Checks if `value` is a plain object, that is, an object created by the
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
- * @since 4.0.0
+ * @since 0.8.0
* @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
- * _.toNumber(3.2);
- * // => 3.2
+ * function Foo() {
+ * this.a = 1;
+ * }
*
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
+ * _.isPlainObject(new Foo);
+ * // => false
*
- * _.toNumber(Infinity);
- * // => Infinity
+ * _.isPlainObject([1, 2, 3]);
+ * // => false
*
- * _.toNumber('3.2');
- * // => 3.2
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
+ * // => true
+ *
+ * _.isPlainObject(Object.create(null));
+ * // => true
*/
-function toNumber(value) {
- if (typeof value == 'number') {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
- value = isObject(other) ? (other + '') : other;
+function isPlainObject(value) {
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag$4) {
+ return false;
}
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
+ var proto = getPrototype(value);
+ if (proto === null) {
+ return true;
}
- value = value.replace(reTrim, '');
- var isBinary = reIsBinary.test(value);
- return (isBinary || reIsOctal.test(value))
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex.test(value) ? NAN : +value);
+ var Ctor = hasOwnProperty$13.call(proto, 'constructor') && proto.constructor;
+ return typeof Ctor == 'function' && Ctor instanceof Ctor &&
+ funcToString$2.call(Ctor) == objectCtorString;
}
-/** Used as references for various `Number` constants. */
-var INFINITY$2 = 1 / 0;
-var MAX_INTEGER = 1.7976931348623157e+308;
-
/**
- * Converts `value` to a finite number.
- *
- * @static
- * @memberOf _
- * @since 4.12.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted number.
- * @example
- *
- * _.toFinite(3.2);
- * // => 3.2
+ * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
+ * objects.
*
- * _.toFinite(Number.MIN_VALUE);
- * // => 5e-324
+ * @private
+ * @param {*} value The value to inspect.
+ * @param {string} key The key of the property to inspect.
+ * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
+ */
+function customOmitClone(value) {
+ return isPlainObject(value) ? undefined : value;
+}
+
+/** Built-in value references. */
+var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
+
+/**
+ * Checks if `value` is a flattenable `arguments` object or array.
*
- * _.toFinite(Infinity);
- * // => 1.7976931348623157e+308
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+ */
+function isFlattenable(value) {
+ return isArray(value) || isArguments(value) ||
+ !!(spreadableSymbol && value && value[spreadableSymbol]);
+}
+
+/**
+ * The base implementation of `_.flatten` with support for restricting flattening.
*
- * _.toFinite('3.2');
- * // => 3.2
+ * @private
+ * @param {Array} array The array to flatten.
+ * @param {number} depth The maximum recursion depth.
+ * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
+ * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
+ * @param {Array} [result=[]] The initial result value.
+ * @returns {Array} Returns the new flattened array.
*/
-function toFinite(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY$2 || value === -INFINITY$2) {
- var sign = (value < 0 ? -1 : 1);
- return sign * MAX_INTEGER;
+function baseFlatten(array, depth, predicate, isStrict, result) {
+ var index = -1,
+ length = array.length;
+
+ predicate || (predicate = isFlattenable);
+ result || (result = []);
+
+ while (++index < length) {
+ var value = array[index];
+ if (depth > 0 && predicate(value)) {
+ if (depth > 1) {
+ // Recursively flatten arrays (susceptible to call stack limits).
+ baseFlatten(value, depth - 1, predicate, isStrict, result);
+ } else {
+ arrayPush(result, value);
+ }
+ } else if (!isStrict) {
+ result[result.length] = value;
+ }
}
- return value === value ? value : 0;
+ return result;
}
/**
- * Converts `value` to an integer.
- *
- * **Note:** This method is loosely based on
- * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
+ * Flattens `array` a single level deep.
*
* @static
* @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to flatten.
+ * @returns {Array} Returns the new flattened array.
* @example
*
- * _.toInteger(3.2);
- * // => 3
- *
- * _.toInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toInteger(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toInteger('3.2');
- * // => 3
+ * _.flatten([1, [2, [3, [4]], 5]]);
+ * // => [1, 2, [3, [4]], 5]
*/
-function toInteger(value) {
- var result = toFinite(value),
- remainder = result % 1;
+function flatten(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? baseFlatten(array, 1) : [];
+}
- return result === result ? (remainder ? result - remainder : result) : 0;
+/**
+ * A faster alternative to `Function#apply`, this function invokes `func`
+ * with the `this` binding of `thisArg` and the arguments of `args`.
+ *
+ * @private
+ * @param {Function} func The function to invoke.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {Array} args The arguments to invoke `func` with.
+ * @returns {*} Returns the result of `func`.
+ */
+function apply(func, thisArg, args) {
+ switch (args.length) {
+ case 0: return func.call(thisArg);
+ case 1: return func.call(thisArg, args[0]);
+ case 2: return func.call(thisArg, args[0], args[1]);
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
+ }
+ return func.apply(thisArg, args);
}
/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeMax$1 = Math.max;
+var nativeMax = Math.max;
/**
- * This method is like `_.find` except that it returns the index of the first
- * element `predicate` returns truthy for instead of the element itself.
- *
- * @static
- * @memberOf _
- * @since 1.1.0
- * @category Array
- * @param {Array} array The array to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {number} Returns the index of the found element, else `-1`.
- * @example
- *
- * var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false },
- * { 'user': 'pebbles', 'active': true }
- * ];
- *
- * _.findIndex(users, function(o) { return o.user == 'barney'; });
- * // => 0
- *
- * // The `_.matches` iteratee shorthand.
- * _.findIndex(users, { 'user': 'fred', 'active': false });
- * // => 1
- *
- * // The `_.matchesProperty` iteratee shorthand.
- * _.findIndex(users, ['active', false]);
- * // => 0
+ * A specialized version of `baseRest` which transforms the rest array.
*
- * // The `_.property` iteratee shorthand.
- * _.findIndex(users, 'active');
- * // => 2
+ * @private
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @param {Function} transform The rest array transform.
+ * @returns {Function} Returns the new function.
*/
-function findIndex(array, predicate, fromIndex) {
- var length = array == null ? 0 : array.length;
- if (!length) {
- return -1;
- }
- var index = fromIndex == null ? 0 : toInteger(fromIndex);
- if (index < 0) {
- index = nativeMax$1(length + index, 0);
- }
- return baseFindIndex(array, baseIteratee(predicate, 3), index);
+function overRest(func, start, transform) {
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ array = Array(length);
+
+ while (++index < length) {
+ array[index] = args[start + index];
+ }
+ index = -1;
+ var otherArgs = Array(start + 1);
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = transform(array);
+ return apply(func, this, otherArgs);
+ };
}
/**
- * Iterates over elements of `collection`, returning the first element
- * `predicate` returns truthy for. The predicate is invoked with three
- * arguments: (value, index|key, collection).
+ * Creates a function that returns `value`.
*
* @static
* @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to inspect.
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {*} Returns the matched element, else `undefined`.
+ * @since 2.4.0
+ * @category Util
+ * @param {*} value The value to return from the new function.
+ * @returns {Function} Returns the new constant function.
* @example
*
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false },
- * { 'user': 'pebbles', 'age': 1, 'active': true }
- * ];
- *
- * _.find(users, function(o) { return o.age < 40; });
- * // => object for 'barney'
- *
- * // The `_.matches` iteratee shorthand.
- * _.find(users, { 'age': 1, 'active': true });
- * // => object for 'pebbles'
+ * var objects = _.times(2, _.constant({ 'a': 1 }));
*
- * // The `_.matchesProperty` iteratee shorthand.
- * _.find(users, ['active', false]);
- * // => object for 'fred'
+ * console.log(objects);
+ * // => [{ 'a': 1 }, { 'a': 1 }]
*
- * // The `_.property` iteratee shorthand.
- * _.find(users, 'active');
- * // => object for 'barney'
+ * console.log(objects[0] === objects[1]);
+ * // => true
*/
-var find$1 = createFind(findIndex);
+function constant$13(value) {
+ return function() {
+ return value;
+ };
+}
/**
- * The base implementation of `_.map` without support for iteratee shorthands.
+ * The base implementation of `setToString` without support for hot loop shorting.
*
* @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
-function baseMap(collection, iteratee) {
- var index = -1,
- result = isArrayLike(collection) ? Array(collection.length) : [];
-
- baseEach(collection, function(value, key, collection) {
- result[++index] = iteratee(value, key, collection);
+ * @param {Function} func The function to modify.
+ * @param {Function} string The `toString` result.
+ * @returns {Function} Returns `func`.
+ */
+var baseSetToString = !defineProperty ? identity$8 : function(func, string) {
+ return defineProperty(func, 'toString', {
+ 'configurable': true,
+ 'enumerable': false,
+ 'value': constant$13(string),
+ 'writable': true
});
- return result;
-}
+};
+
+/** Used to detect hot functions by number of calls within a span of milliseconds. */
+var HOT_COUNT = 800;
+var HOT_SPAN = 16;
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeNow = Date.now;
/**
- * Creates an array of values by running each element in `collection` thru
- * `iteratee`. The iteratee is invoked with three arguments:
- * (value, index|key, collection).
- *
- * Many lodash methods are guarded to work as iteratees for methods like
- * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
- *
- * The guarded methods are:
- * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
- * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
- * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
- * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- * @example
- *
- * function square(n) {
- * return n * n;
- * }
- *
- * _.map([4, 8], square);
- * // => [16, 64]
- *
- * _.map({ 'a': 4, 'b': 8 }, square);
- * // => [16, 64] (iteration order is not guaranteed)
- *
- * var users = [
- * { 'user': 'barney' },
- * { 'user': 'fred' }
- * ];
+ * Creates a function that'll short out and invoke `identity` instead
+ * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
+ * milliseconds.
*
- * // The `_.property` iteratee shorthand.
- * _.map(users, 'user');
- * // => ['barney', 'fred']
+ * @private
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new shortable function.
*/
-function map$4(collection, iteratee) {
- var func = isArray(collection) ? arrayMap : baseMap;
- return func(collection, baseIteratee(iteratee, 3));
+function shortOut(func) {
+ var count = 0,
+ lastCalled = 0;
+
+ return function() {
+ var stamp = nativeNow(),
+ remaining = HOT_SPAN - (stamp - lastCalled);
+
+ lastCalled = stamp;
+ if (remaining > 0) {
+ if (++count >= HOT_COUNT) {
+ return arguments[0];
+ }
+ } else {
+ count = 0;
+ }
+ return func.apply(undefined, arguments);
+ };
}
/**
- * The base implementation of `_.values` and `_.valuesIn` which creates an
- * array of `object` property values corresponding to the property names
- * of `props`.
+ * Sets the `toString` method of `func` to return `string`.
*
* @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the array of property values.
+ * @param {Function} func The function to modify.
+ * @param {Function} string The `toString` result.
+ * @returns {Function} Returns `func`.
*/
-function baseValues(object, props) {
- return arrayMap(props, function(key) {
- return object[key];
- });
+var setToString = shortOut(baseSetToString);
+
+/**
+ * A specialized version of `baseRest` which flattens the rest array.
+ *
+ * @private
+ * @param {Function} func The function to apply a rest parameter to.
+ * @returns {Function} Returns the new function.
+ */
+function flatRest(func) {
+ return setToString(overRest(func, undefined, flatten), func + '');
}
+/** Used to compose bitmasks for cloning. */
+var CLONE_DEEP_FLAG$3 = 1;
+var CLONE_FLAT_FLAG$1 = 2;
+var CLONE_SYMBOLS_FLAG$2 = 4;
+
/**
- * Creates an array of the own enumerable string keyed property values of `object`.
+ * The opposite of `_.pick`; this method creates an object composed of the
+ * own and inherited enumerable property paths of `object` that are not omitted.
*
- * **Note:** Non-object values are coerced to objects.
+ * **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property values.
+ * @param {Object} object The source object.
+ * @param {...(string|string[])} [paths] The property paths to omit.
+ * @returns {Object} Returns the new object.
* @example
*
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.values(new Foo);
- * // => [1, 2] (iteration order is not guaranteed)
+ * var object = { 'a': 1, 'b': '2', 'c': 3 };
*
- * _.values('hi');
- * // => ['h', 'i']
+ * _.omit(object, ['a', 'c']);
+ * // => { 'b': '2' }
*/
-function values$1(object) {
- return object == null ? [] : baseValues(object, keys$1(object));
-}
+var omit = flatRest(function(object, paths) {
+ var result = {};
+ if (object == null) {
+ return result;
+ }
+ var isDeep = false;
+ paths = arrayMap(paths, function(path) {
+ path = castPath(path, object);
+ isDeep || (isDeep = path.length > 1);
+ return path;
+ });
+ copyObject(object, getAllKeysIn(object), result);
+ if (isDeep) {
+ result = baseClone(result, CLONE_DEEP_FLAG$3 | CLONE_FLAT_FLAG$1 | CLONE_SYMBOLS_FLAG$2, customOmitClone);
+ }
+ var length = paths.length;
+ while (length--) {
+ baseUnset(result, paths[length]);
+ }
+ return result;
+});
/**
- * A specialized version of `_.forEach` for arrays without support for
- * iteratee shorthands.
+ * Creates an array with all falsey values removed. The values `false`, `null`,
+ * `0`, `""`, `undefined`, and `NaN` are falsey.
*
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to compact.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.compact([0, 1, false, 2, '', 3]);
+ * // => [1, 2, 3]
*/
-function arrayEach(array, iteratee) {
+function compact(array) {
var index = -1,
- length = array == null ? 0 : array.length;
+ length = array == null ? 0 : array.length,
+ resIndex = 0,
+ result = [];
while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
+ var value = array[index];
+ if (value) {
+ result[resIndex++] = value;
}
}
- return array;
-}
-
-/**
- * The base implementation of `_.assign` without support for multiple sources
- * or `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */
-function baseAssign(object, source) {
- return object && copyObject(source, keys$1(source), object);
+ return result;
}
/**
- * The base implementation of `_.assignIn` without support for multiple sources
- * or `customizer` functions.
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
*/
-function baseAssignIn(object, source) {
- return object && copyObject(source, keysIn$1(source), object);
+function baseRest(func, start) {
+ return setToString(overRest(func, start, identity$8), func + '');
}
-/** Detect free variable `exports`. */
-var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
-
-/** Detect free variable `module`. */
-var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
-
-/** Detect the popular CommonJS extension `module.exports`. */
-var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
-
-/** Built-in value references. */
-var Buffer$1 = moduleExports$2 ? root$2.Buffer : undefined;
-var allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : undefined;
-
/**
- * Creates a clone of `buffer`.
+ * Checks if the given arguments are from an iteratee call.
*
* @private
- * @param {Buffer} buffer The buffer to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Buffer} Returns the cloned buffer.
+ * @param {*} value The potential iteratee value argument.
+ * @param {*} index The potential iteratee index or key argument.
+ * @param {*} object The potential iteratee object argument.
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
+ * else `false`.
*/
-function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
+function isIterateeCall(value, index, object) {
+ if (!isObject(object)) {
+ return false;
}
- var length = buffer.length,
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
-
- buffer.copy(result);
- return result;
+ var type = typeof index;
+ if (type == 'number'
+ ? (isArrayLike(object) && isIndex(index, object.length))
+ : (type == 'string' && index in object)
+ ) {
+ return eq(object[index], value);
+ }
+ return false;
}
/**
- * Copies the values of `source` to `array`.
+ * Creates a function like `_.assign`.
*
* @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
+ * @param {Function} assigner The function to assign values.
+ * @returns {Function} Returns the new assigner function.
*/
-function copyArray(source, array) {
- var index = -1,
- length = source.length;
+function createAssigner(assigner) {
+ return baseRest(function(object, sources) {
+ var index = -1,
+ length = sources.length,
+ customizer = length > 1 ? sources[length - 1] : undefined,
+ guard = length > 2 ? sources[2] : undefined;
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
+ customizer = (assigner.length > 3 && typeof customizer == 'function')
+ ? (length--, customizer)
+ : undefined;
+
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+ customizer = length < 3 ? undefined : customizer;
+ length = 1;
+ }
+ object = Object(object);
+ while (++index < length) {
+ var source = sources[index];
+ if (source) {
+ assigner(object, source, index, customizer);
+ }
+ }
+ return object;
+ });
}
/**
- * Copies own symbols of `source` to `object`.
+ * This method is like `_.assign` except that it iterates over own and
+ * inherited source properties.
*
- * @private
- * @param {Object} source The object to copy symbols from.
- * @param {Object} [object={}] The object to copy symbols to.
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @alias extend
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
+ * @see _.assign
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * function Bar() {
+ * this.c = 3;
+ * }
+ *
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
+ *
+ * _.assignIn({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
-function copySymbols(source, object) {
- return copyObject(source, getSymbols(source), object);
-}
-
-/** Built-in value references. */
-var getPrototype = overArg(Object.getPrototypeOf, Object);
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
+var assignIn = createAssigner(function(object, source) {
+ copyObject(source, keysIn$1(source), object);
+});
/**
- * Creates an array of the own and inherited enumerable symbols of `object`.
+ * The base implementation of `_.filter` without support for iteratee shorthands.
*
* @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
+ * @para