Skip to content

Instantly share code, notes, and snippets.

@justinobney
Created June 17, 2019 15:00
Show Gist options
  • Save justinobney/cb402d480092e97ef1c2de568b116ef6 to your computer and use it in GitHub Desktop.
Save justinobney/cb402d480092e97ef1c2de568b116ef6 to your computer and use it in GitHub Desktop.
(function e(t, n, r) {
function s(o, u) {
if (!n[o]) {
if (!t[o]) {
var a = typeof require == "function" && require;
if (!u && a) return a(o, !0);
if (i) return i(o, !0);
throw new Error("Cannot find module '" + o + "'");
}
var f = (n[o] = { exports: {} });
t[o][0].call(
f.exports,
function(e) {
var n = t[o][1][e];
return s(n ? n : e);
},
f,
f.exports,
e,
t,
n,
r
);
}
return n[o].exports;
}
var i = typeof require == "function" && require;
for (var o = 0; o < r.length; o++) s(r[o]);
return s;
})(
{
1: [
function(require, module, exports) {
var lookup =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
(function(exports) {
"use strict";
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
var PLUS = "+".charCodeAt(0);
var SLASH = "/".charCodeAt(0);
var NUMBER = "0".charCodeAt(0);
var LOWER = "a".charCodeAt(0);
var UPPER = "A".charCodeAt(0);
var PLUS_URL_SAFE = "-".charCodeAt(0);
var SLASH_URL_SAFE = "_".charCodeAt(0);
function decode(elt) {
var code = elt.charCodeAt(0);
if (code === PLUS || code === PLUS_URL_SAFE) return 62;
if (code === SLASH || code === SLASH_URL_SAFE) return 63;
if (code < NUMBER) return -1;
if (code < NUMBER + 10) return code - NUMBER + 26 + 26;
if (code < UPPER + 26) return code - UPPER;
if (code < LOWER + 26) return code - LOWER + 26;
}
function b64ToByteArray(b64) {
var i, j, l, tmp, placeHolders, arr;
if (b64.length % 4 > 0) {
throw new Error("Invalid string. Length must be a multiple of 4");
}
var len = b64.length;
placeHolders =
"=" === b64.charAt(len - 2)
? 2
: "=" === b64.charAt(len - 1)
? 1
: 0;
arr = new Arr((b64.length * 3) / 4 - placeHolders);
l = placeHolders > 0 ? b64.length - 4 : b64.length;
var L = 0;
function push(v) {
arr[L++] = v;
}
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp =
(decode(b64.charAt(i)) << 18) |
(decode(b64.charAt(i + 1)) << 12) |
(decode(b64.charAt(i + 2)) << 6) |
decode(b64.charAt(i + 3));
push((tmp & 16711680) >> 16);
push((tmp & 65280) >> 8);
push(tmp & 255);
}
if (placeHolders === 2) {
tmp =
(decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4);
push(tmp & 255);
} else if (placeHolders === 1) {
tmp =
(decode(b64.charAt(i)) << 10) |
(decode(b64.charAt(i + 1)) << 4) |
(decode(b64.charAt(i + 2)) >> 2);
push((tmp >> 8) & 255);
push(tmp & 255);
}
return arr;
}
function uint8ToBase64(uint8) {
var i,
extraBytes = uint8.length % 3,
output = "",
temp,
length;
function encode(num) {
return lookup.charAt(num);
}
function tripletToBase64(num) {
return (
encode((num >> 18) & 63) +
encode((num >> 12) & 63) +
encode((num >> 6) & 63) +
encode(num & 63)
);
}
for (
i = 0, length = uint8.length - extraBytes;
i < length;
i += 3
) {
temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
output += tripletToBase64(temp);
}
switch (extraBytes) {
case 1:
temp = uint8[uint8.length - 1];
output += encode(temp >> 2);
output += encode((temp << 4) & 63);
output += "==";
break;
case 2:
temp = (uint8[uint8.length - 2] << 8) + uint8[uint8.length - 1];
output += encode(temp >> 10);
output += encode((temp >> 4) & 63);
output += encode((temp << 2) & 63);
output += "=";
break;
}
return output;
}
exports.toByteArray = b64ToByteArray;
exports.fromByteArray = uint8ToBase64;
})(typeof exports === "undefined" ? (this.base64js = {}) : exports);
},
{}
],
2: [
function(require, module, exports) {
var base64 = require("base64-js");
var ieee754 = require("ieee754");
exports.Buffer = Buffer;
exports.SlowBuffer = Buffer;
exports.INSPECT_MAX_BYTES = 50;
Buffer.poolSize = 8192;
Buffer._useTypedArrays = (function() {
try {
var buf = new ArrayBuffer(0);
var arr = new Uint8Array(buf);
arr.foo = function() {
return 42;
};
return 42 === arr.foo() && typeof arr.subarray === "function";
} catch (e) {
return false;
}
})();
function Buffer(subject, encoding, noZero) {
if (!(this instanceof Buffer))
return new Buffer(subject, encoding, noZero);
var type = typeof subject;
if (encoding === "base64" && type === "string") {
subject = stringtrim(subject);
while (subject.length % 4 !== 0) {
subject = subject + "=";
}
}
var length;
if (type === "number") length = coerce(subject);
else if (type === "string")
length = Buffer.byteLength(subject, encoding);
else if (type === "object") length = coerce(subject.length);
else
throw new Error(
"First argument needs to be a number, array or string."
);
var buf;
if (Buffer._useTypedArrays) {
buf = Buffer._augment(new Uint8Array(length));
} else {
buf = this;
buf.length = length;
buf._isBuffer = true;
}
var i;
if (
Buffer._useTypedArrays &&
typeof subject.byteLength === "number"
) {
buf._set(subject);
} else if (isArrayish(subject)) {
for (i = 0; i < length; i++) {
if (Buffer.isBuffer(subject)) buf[i] = subject.readUInt8(i);
else buf[i] = subject[i];
}
} else if (type === "string") {
buf.write(subject, 0, encoding);
} else if (type === "number" && !Buffer._useTypedArrays && !noZero) {
for (i = 0; i < length; i++) {
buf[i] = 0;
}
}
return buf;
}
Buffer.isEncoding = function(encoding) {
switch (String(encoding).toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "binary":
case "base64":
case "raw":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return true;
default:
return false;
}
};
Buffer.isBuffer = function(b) {
return !!(b !== null && b !== undefined && b._isBuffer);
};
Buffer.byteLength = function(str, encoding) {
var ret;
str = str + "";
switch (encoding || "utf8") {
case "hex":
ret = str.length / 2;
break;
case "utf8":
case "utf-8":
ret = utf8ToBytes(str).length;
break;
case "ascii":
case "binary":
case "raw":
ret = str.length;
break;
case "base64":
ret = base64ToBytes(str).length;
break;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
ret = str.length * 2;
break;
default:
throw new Error("Unknown encoding");
}
return ret;
};
Buffer.concat = function(list, totalLength) {
assert(
isArray(list),
"Usage: Buffer.concat(list, [totalLength])\n" +
"list should be an Array."
);
if (list.length === 0) {
return new Buffer(0);
} else if (list.length === 1) {
return list[0];
}
var i;
if (typeof totalLength !== "number") {
totalLength = 0;
for (i = 0; i < list.length; i++) {
totalLength += list[i].length;
}
}
var buf = new Buffer(totalLength);
var pos = 0;
for (i = 0; i < list.length; i++) {
var item = list[i];
item.copy(buf, pos);
pos += item.length;
}
return buf;
};
function _hexWrite(buf, string, offset, length) {
offset = Number(offset) || 0;
var remaining = buf.length - offset;
if (!length) {
length = remaining;
} else {
length = Number(length);
if (length > remaining) {
length = remaining;
}
}
var strLen = string.length;
assert(strLen % 2 === 0, "Invalid hex string");
if (length > strLen / 2) {
length = strLen / 2;
}
for (var i = 0; i < length; i++) {
var byte = parseInt(string.substr(i * 2, 2), 16);
assert(!isNaN(byte), "Invalid hex string");
buf[offset + i] = byte;
}
Buffer._charsWritten = i * 2;
return i;
}
function _utf8Write(buf, string, offset, length) {
var charsWritten = (Buffer._charsWritten = blitBuffer(
utf8ToBytes(string),
buf,
offset,
length
));
return charsWritten;
}
function _asciiWrite(buf, string, offset, length) {
var charsWritten = (Buffer._charsWritten = blitBuffer(
asciiToBytes(string),
buf,
offset,
length
));
return charsWritten;
}
function _binaryWrite(buf, string, offset, length) {
return _asciiWrite(buf, string, offset, length);
}
function _base64Write(buf, string, offset, length) {
var charsWritten = (Buffer._charsWritten = blitBuffer(
base64ToBytes(string),
buf,
offset,
length
));
return charsWritten;
}
function _utf16leWrite(buf, string, offset, length) {
var charsWritten = (Buffer._charsWritten = blitBuffer(
utf16leToBytes(string),
buf,
offset,
length
));
return charsWritten;
}
Buffer.prototype.write = function(string, offset, length, encoding) {
if (isFinite(offset)) {
if (!isFinite(length)) {
encoding = length;
length = undefined;
}
} else {
var swap = encoding;
encoding = offset;
offset = length;
length = swap;
}
offset = Number(offset) || 0;
var remaining = this.length - offset;
if (!length) {
length = remaining;
} else {
length = Number(length);
if (length > remaining) {
length = remaining;
}
}
encoding = String(encoding || "utf8").toLowerCase();
var ret;
switch (encoding) {
case "hex":
ret = _hexWrite(this, string, offset, length);
break;
case "utf8":
case "utf-8":
ret = _utf8Write(this, string, offset, length);
break;
case "ascii":
ret = _asciiWrite(this, string, offset, length);
break;
case "binary":
ret = _binaryWrite(this, string, offset, length);
break;
case "base64":
ret = _base64Write(this, string, offset, length);
break;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
ret = _utf16leWrite(this, string, offset, length);
break;
default:
throw new Error("Unknown encoding");
}
return ret;
};
Buffer.prototype.toString = function(encoding, start, end) {
var self = this;
encoding = String(encoding || "utf8").toLowerCase();
start = Number(start) || 0;
end = end !== undefined ? Number(end) : (end = self.length);
if (end === start) return "";
var ret;
switch (encoding) {
case "hex":
ret = _hexSlice(self, start, end);
break;
case "utf8":
case "utf-8":
ret = _utf8Slice(self, start, end);
break;
case "ascii":
ret = _asciiSlice(self, start, end);
break;
case "binary":
ret = _binarySlice(self, start, end);
break;
case "base64":
ret = _base64Slice(self, start, end);
break;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
ret = _utf16leSlice(self, start, end);
break;
default:
throw new Error("Unknown encoding");
}
return ret;
};
Buffer.prototype.toJSON = function() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
};
};
Buffer.prototype.copy = function(target, target_start, start, end) {
var source = this;
if (!start) start = 0;
if (!end && end !== 0) end = this.length;
if (!target_start) target_start = 0;
if (end === start) return;
if (target.length === 0 || source.length === 0) return;
assert(end >= start, "sourceEnd < sourceStart");
assert(
target_start >= 0 && target_start < target.length,
"targetStart out of bounds"
);
assert(
start >= 0 && start < source.length,
"sourceStart out of bounds"
);
assert(end >= 0 && end <= source.length, "sourceEnd out of bounds");
if (end > this.length) end = this.length;
if (target.length - target_start < end - start)
end = target.length - target_start + start;
var len = end - start;
if (len < 100 || !Buffer._useTypedArrays) {
for (var i = 0; i < len; i++)
target[i + target_start] = this[i + start];
} else {
target._set(this.subarray(start, start + len), target_start);
}
};
function _base64Slice(buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf);
} else {
return base64.fromByteArray(buf.slice(start, end));
}
}
function _utf8Slice(buf, start, end) {
var res = "";
var tmp = "";
end = Math.min(buf.length, end);
for (var i = start; i < end; i++) {
if (buf[i] <= 127) {
res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]);
tmp = "";
} else {
tmp += "%" + buf[i].toString(16);
}
}
return res + decodeUtf8Char(tmp);
}
function _asciiSlice(buf, start, end) {
var ret = "";
end = Math.min(buf.length, end);
for (var i = start; i < end; i++) ret += String.fromCharCode(buf[i]);
return ret;
}
function _binarySlice(buf, start, end) {
return _asciiSlice(buf, start, end);
}
function _hexSlice(buf, start, end) {
var len = buf.length;
if (!start || start < 0) start = 0;
if (!end || end < 0 || end > len) end = len;
var out = "";
for (var i = start; i < end; i++) {
out += toHex(buf[i]);
}
return out;
}
function _utf16leSlice(buf, start, end) {
var bytes = buf.slice(start, end);
var res = "";
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
}
return res;
}
Buffer.prototype.slice = function(start, end) {
var len = this.length;
start = clamp(start, len, 0);
end = clamp(end, len, len);
if (Buffer._useTypedArrays) {
return Buffer._augment(this.subarray(start, end));
} else {
var sliceLen = end - start;
var newBuf = new Buffer(sliceLen, undefined, true);
for (var i = 0; i < sliceLen; i++) {
newBuf[i] = this[i + start];
}
return newBuf;
}
};
Buffer.prototype.get = function(offset) {
console.log(
".get() is deprecated. Access using array indexes instead."
);
return this.readUInt8(offset);
};
Buffer.prototype.set = function(v, offset) {
console.log(
".set() is deprecated. Access using array indexes instead."
);
return this.writeUInt8(v, offset);
};
Buffer.prototype.readUInt8 = function(offset, noAssert) {
if (!noAssert) {
assert(offset !== undefined && offset !== null, "missing offset");
assert(offset < this.length, "Trying to read beyond buffer length");
}
if (offset >= this.length) return;
return this[offset];
};
function _readUInt16(buf, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 1 < buf.length,
"Trying to read beyond buffer length"
);
}
var len = buf.length;
if (offset >= len) return;
var val;
if (littleEndian) {
val = buf[offset];
if (offset + 1 < len) val |= buf[offset + 1] << 8;
} else {
val = buf[offset] << 8;
if (offset + 1 < len) val |= buf[offset + 1];
}
return val;
}
Buffer.prototype.readUInt16LE = function(offset, noAssert) {
return _readUInt16(this, offset, true, noAssert);
};
Buffer.prototype.readUInt16BE = function(offset, noAssert) {
return _readUInt16(this, offset, false, noAssert);
};
function _readUInt32(buf, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 3 < buf.length,
"Trying to read beyond buffer length"
);
}
var len = buf.length;
if (offset >= len) return;
var val;
if (littleEndian) {
if (offset + 2 < len) val = buf[offset + 2] << 16;
if (offset + 1 < len) val |= buf[offset + 1] << 8;
val |= buf[offset];
if (offset + 3 < len) val = val + ((buf[offset + 3] << 24) >>> 0);
} else {
if (offset + 1 < len) val = buf[offset + 1] << 16;
if (offset + 2 < len) val |= buf[offset + 2] << 8;
if (offset + 3 < len) val |= buf[offset + 3];
val = val + ((buf[offset] << 24) >>> 0);
}
return val;
}
Buffer.prototype.readUInt32LE = function(offset, noAssert) {
return _readUInt32(this, offset, true, noAssert);
};
Buffer.prototype.readUInt32BE = function(offset, noAssert) {
return _readUInt32(this, offset, false, noAssert);
};
Buffer.prototype.readInt8 = function(offset, noAssert) {
if (!noAssert) {
assert(offset !== undefined && offset !== null, "missing offset");
assert(offset < this.length, "Trying to read beyond buffer length");
}
if (offset >= this.length) return;
var neg = this[offset] & 128;
if (neg) return (255 - this[offset] + 1) * -1;
else return this[offset];
};
function _readInt16(buf, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 1 < buf.length,
"Trying to read beyond buffer length"
);
}
var len = buf.length;
if (offset >= len) return;
var val = _readUInt16(buf, offset, littleEndian, true);
var neg = val & 32768;
if (neg) return (65535 - val + 1) * -1;
else return val;
}
Buffer.prototype.readInt16LE = function(offset, noAssert) {
return _readInt16(this, offset, true, noAssert);
};
Buffer.prototype.readInt16BE = function(offset, noAssert) {
return _readInt16(this, offset, false, noAssert);
};
function _readInt32(buf, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 3 < buf.length,
"Trying to read beyond buffer length"
);
}
var len = buf.length;
if (offset >= len) return;
var val = _readUInt32(buf, offset, littleEndian, true);
var neg = val & 2147483648;
if (neg) return (4294967295 - val + 1) * -1;
else return val;
}
Buffer.prototype.readInt32LE = function(offset, noAssert) {
return _readInt32(this, offset, true, noAssert);
};
Buffer.prototype.readInt32BE = function(offset, noAssert) {
return _readInt32(this, offset, false, noAssert);
};
function _readFloat(buf, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(
offset + 3 < buf.length,
"Trying to read beyond buffer length"
);
}
return ieee754.read(buf, offset, littleEndian, 23, 4);
}
Buffer.prototype.readFloatLE = function(offset, noAssert) {
return _readFloat(this, offset, true, noAssert);
};
Buffer.prototype.readFloatBE = function(offset, noAssert) {
return _readFloat(this, offset, false, noAssert);
};
function _readDouble(buf, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(
offset + 7 < buf.length,
"Trying to read beyond buffer length"
);
}
return ieee754.read(buf, offset, littleEndian, 52, 8);
}
Buffer.prototype.readDoubleLE = function(offset, noAssert) {
return _readDouble(this, offset, true, noAssert);
};
Buffer.prototype.readDoubleBE = function(offset, noAssert) {
return _readDouble(this, offset, false, noAssert);
};
Buffer.prototype.writeUInt8 = function(value, offset, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset < this.length,
"trying to write beyond buffer length"
);
verifuint(value, 255);
}
if (offset >= this.length) return;
this[offset] = value;
};
function _writeUInt16(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 1 < buf.length,
"trying to write beyond buffer length"
);
verifuint(value, 65535);
}
var len = buf.length;
if (offset >= len) return;
for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {
buf[offset + i] =
(value & (255 << (8 * (littleEndian ? i : 1 - i)))) >>>
((littleEndian ? i : 1 - i) * 8);
}
}
Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) {
_writeUInt16(this, value, offset, true, noAssert);
};
Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) {
_writeUInt16(this, value, offset, false, noAssert);
};
function _writeUInt32(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 3 < buf.length,
"trying to write beyond buffer length"
);
verifuint(value, 4294967295);
}
var len = buf.length;
if (offset >= len) return;
for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {
buf[offset + i] =
(value >>> ((littleEndian ? i : 3 - i) * 8)) & 255;
}
}
Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) {
_writeUInt32(this, value, offset, true, noAssert);
};
Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) {
_writeUInt32(this, value, offset, false, noAssert);
};
Buffer.prototype.writeInt8 = function(value, offset, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset < this.length,
"Trying to write beyond buffer length"
);
verifsint(value, 127, -128);
}
if (offset >= this.length) return;
if (value >= 0) this.writeUInt8(value, offset, noAssert);
else this.writeUInt8(255 + value + 1, offset, noAssert);
};
function _writeInt16(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 1 < buf.length,
"Trying to write beyond buffer length"
);
verifsint(value, 32767, -32768);
}
var len = buf.length;
if (offset >= len) return;
if (value >= 0)
_writeUInt16(buf, value, offset, littleEndian, noAssert);
else
_writeUInt16(
buf,
65535 + value + 1,
offset,
littleEndian,
noAssert
);
}
Buffer.prototype.writeInt16LE = function(value, offset, noAssert) {
_writeInt16(this, value, offset, true, noAssert);
};
Buffer.prototype.writeInt16BE = function(value, offset, noAssert) {
_writeInt16(this, value, offset, false, noAssert);
};
function _writeInt32(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 3 < buf.length,
"Trying to write beyond buffer length"
);
verifsint(value, 2147483647, -2147483648);
}
var len = buf.length;
if (offset >= len) return;
if (value >= 0)
_writeUInt32(buf, value, offset, littleEndian, noAssert);
else
_writeUInt32(
buf,
4294967295 + value + 1,
offset,
littleEndian,
noAssert
);
}
Buffer.prototype.writeInt32LE = function(value, offset, noAssert) {
_writeInt32(this, value, offset, true, noAssert);
};
Buffer.prototype.writeInt32BE = function(value, offset, noAssert) {
_writeInt32(this, value, offset, false, noAssert);
};
function _writeFloat(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 3 < buf.length,
"Trying to write beyond buffer length"
);
verifIEEE754(value, 3.4028234663852886e38, -3.4028234663852886e38);
}
var len = buf.length;
if (offset >= len) return;
ieee754.write(buf, value, offset, littleEndian, 23, 4);
}
Buffer.prototype.writeFloatLE = function(value, offset, noAssert) {
_writeFloat(this, value, offset, true, noAssert);
};
Buffer.prototype.writeFloatBE = function(value, offset, noAssert) {
_writeFloat(this, value, offset, false, noAssert);
};
function _writeDouble(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
assert(value !== undefined && value !== null, "missing value");
assert(
typeof littleEndian === "boolean",
"missing or invalid endian"
);
assert(offset !== undefined && offset !== null, "missing offset");
assert(
offset + 7 < buf.length,
"Trying to write beyond buffer length"
);
verifIEEE754(
value,
1.7976931348623157e308,
-1.7976931348623157e308
);
}
var len = buf.length;
if (offset >= len) return;
ieee754.write(buf, value, offset, littleEndian, 52, 8);
}
Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) {
_writeDouble(this, value, offset, true, noAssert);
};
Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) {
_writeDouble(this, value, offset, false, noAssert);
};
Buffer.prototype.fill = function(value, start, end) {
if (!value) value = 0;
if (!start) start = 0;
if (!end) end = this.length;
if (typeof value === "string") {
value = value.charCodeAt(0);
}
assert(
typeof value === "number" && !isNaN(value),
"value is not a number"
);
assert(end >= start, "end < start");
if (end === start) return;
if (this.length === 0) return;
assert(start >= 0 && start < this.length, "start out of bounds");
assert(end >= 0 && end <= this.length, "end out of bounds");
for (var i = start; i < end; i++) {
this[i] = value;
}
};
Buffer.prototype.inspect = function() {
var out = [];
var len = this.length;
for (var i = 0; i < len; i++) {
out[i] = toHex(this[i]);
if (i === exports.INSPECT_MAX_BYTES) {
out[i + 1] = "...";
break;
}
}
return "<Buffer " + out.join(" ") + ">";
};
Buffer.prototype.toArrayBuffer = function() {
if (typeof Uint8Array !== "undefined") {
if (Buffer._useTypedArrays) {
return new Buffer(this).buffer;
} else {
var buf = new Uint8Array(this.length);
for (var i = 0, len = buf.length; i < len; i += 1)
buf[i] = this[i];
return buf.buffer;
}
} else {
throw new Error(
"Buffer.toArrayBuffer not supported in this browser"
);
}
};
function stringtrim(str) {
if (str.trim) return str.trim();
return str.replace(/^\s+|\s+$/g, "");
}
var BP = Buffer.prototype;
Buffer._augment = function(arr) {
arr._isBuffer = true;
arr._get = arr.get;
arr._set = arr.set;
arr.get = BP.get;
arr.set = BP.set;
arr.write = BP.write;
arr.toString = BP.toString;
arr.toLocaleString = BP.toString;
arr.toJSON = BP.toJSON;
arr.copy = BP.copy;
arr.slice = BP.slice;
arr.readUInt8 = BP.readUInt8;
arr.readUInt16LE = BP.readUInt16LE;
arr.readUInt16BE = BP.readUInt16BE;
arr.readUInt32LE = BP.readUInt32LE;
arr.readUInt32BE = BP.readUInt32BE;
arr.readInt8 = BP.readInt8;
arr.readInt16LE = BP.readInt16LE;
arr.readInt16BE = BP.readInt16BE;
arr.readInt32LE = BP.readInt32LE;
arr.readInt32BE = BP.readInt32BE;
arr.readFloatLE = BP.readFloatLE;
arr.readFloatBE = BP.readFloatBE;
arr.readDoubleLE = BP.readDoubleLE;
arr.readDoubleBE = BP.readDoubleBE;
arr.writeUInt8 = BP.writeUInt8;
arr.writeUInt16LE = BP.writeUInt16LE;
arr.writeUInt16BE = BP.writeUInt16BE;
arr.writeUInt32LE = BP.writeUInt32LE;
arr.writeUInt32BE = BP.writeUInt32BE;
arr.writeInt8 = BP.writeInt8;
arr.writeInt16LE = BP.writeInt16LE;
arr.writeInt16BE = BP.writeInt16BE;
arr.writeInt32LE = BP.writeInt32LE;
arr.writeInt32BE = BP.writeInt32BE;
arr.writeFloatLE = BP.writeFloatLE;
arr.writeFloatBE = BP.writeFloatBE;
arr.writeDoubleLE = BP.writeDoubleLE;
arr.writeDoubleBE = BP.writeDoubleBE;
arr.fill = BP.fill;
arr.inspect = BP.inspect;
arr.toArrayBuffer = BP.toArrayBuffer;
return arr;
};
function clamp(index, len, defaultValue) {
if (typeof index !== "number") return defaultValue;
index = ~~index;
if (index >= len) return len;
if (index >= 0) return index;
index += len;
if (index >= 0) return index;
return 0;
}
function coerce(length) {
length = ~~Math.ceil(+length);
return length < 0 ? 0 : length;
}
function isArray(subject) {
return (Array.isArray ||
function(subject) {
return (
Object.prototype.toString.call(subject) === "[object Array]"
);
})(subject);
}
function isArrayish(subject) {
return (
isArray(subject) ||
Buffer.isBuffer(subject) ||
(subject &&
typeof subject === "object" &&
typeof subject.length === "number")
);
}
function toHex(n) {
if (n < 16) return "0" + n.toString(16);
return n.toString(16);
}
function utf8ToBytes(str) {
var byteArray = [];
for (var i = 0; i < str.length; i++) {
var b = str.charCodeAt(i);
if (b <= 127) byteArray.push(str.charCodeAt(i));
else {
var start = i;
if (b >= 55296 && b <= 57343) i++;
var h = encodeURIComponent(str.slice(start, i + 1))
.substr(1)
.split("%");
for (var j = 0; j < h.length; j++)
byteArray.push(parseInt(h[j], 16));
}
}
return byteArray;
}
function asciiToBytes(str) {
var byteArray = [];
for (var i = 0; i < str.length; i++) {
byteArray.push(str.charCodeAt(i) & 255);
}
return byteArray;
}
function utf16leToBytes(str) {
var c, hi, lo;
var byteArray = [];
for (var i = 0; i < str.length; i++) {
c = str.charCodeAt(i);
hi = c >> 8;
lo = c % 256;
byteArray.push(lo);
byteArray.push(hi);
}
return byteArray;
}
function base64ToBytes(str) {
return base64.toByteArray(str);
}
function blitBuffer(src, dst, offset, length) {
var pos;
for (var i = 0; i < length; i++) {
if (i + offset >= dst.length || i >= src.length) break;
dst[i + offset] = src[i];
}
return i;
}
function decodeUtf8Char(str) {
try {
return decodeURIComponent(str);
} catch (err) {
return String.fromCharCode(65533);
}
}
function verifuint(value, max) {
assert(
typeof value === "number",
"cannot write a non-number as a number"
);
assert(
value >= 0,
"specified a negative value for writing an unsigned value"
);
assert(value <= max, "value is larger than maximum value for type");
assert(
Math.floor(value) === value,
"value has a fractional component"
);
}
function verifsint(value, max, min) {
assert(
typeof value === "number",
"cannot write a non-number as a number"
);
assert(value <= max, "value larger than maximum allowed value");
assert(value >= min, "value smaller than minimum allowed value");
assert(
Math.floor(value) === value,
"value has a fractional component"
);
}
function verifIEEE754(value, max, min) {
assert(
typeof value === "number",
"cannot write a non-number as a number"
);
assert(value <= max, "value larger than maximum allowed value");
assert(value >= min, "value smaller than minimum allowed value");
}
function assert(test, message) {
if (!test) throw new Error(message || "Failed assertion");
}
},
{ "base64-js": 1, ieee754: 10 }
],
3: [
function(require, module, exports) {
var Buffer = require("buffer").Buffer;
var intSize = 4;
var zeroBuffer = new Buffer(intSize);
zeroBuffer.fill(0);
var chrsz = 8;
function toArray(buf, bigEndian) {
if (buf.length % intSize !== 0) {
var len = buf.length + (intSize - (buf.length % intSize));
buf = Buffer.concat([buf, zeroBuffer], len);
}
var arr = [];
var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
for (var i = 0; i < buf.length; i += intSize) {
arr.push(fn.call(buf, i));
}
return arr;
}
function toBuffer(arr, size, bigEndian) {
var buf = new Buffer(size);
var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
for (var i = 0; i < arr.length; i++) {
fn.call(buf, arr[i], i * 4, true);
}
return buf;
}
function hash(buf, fn, hashSize, bigEndian) {
if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);
var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
return toBuffer(arr, hashSize, bigEndian);
}
module.exports = { hash: hash };
},
{ buffer: 2 }
],
4: [
function(require, module, exports) {
var Buffer = require("buffer").Buffer;
var sha = require("./sha");
var sha256 = require("./sha256");
var rng = require("./rng");
var md5 = require("./md5");
var algorithms = { sha1: sha, sha256: sha256, md5: md5 };
var blocksize = 64;
var zeroBuffer = new Buffer(blocksize);
zeroBuffer.fill(0);
function hmac(fn, key, data) {
if (!Buffer.isBuffer(key)) key = new Buffer(key);
if (!Buffer.isBuffer(data)) data = new Buffer(data);
if (key.length > blocksize) {
key = fn(key);
} else if (key.length < blocksize) {
key = Buffer.concat([key, zeroBuffer], blocksize);
}
var ipad = new Buffer(blocksize),
opad = new Buffer(blocksize);
for (var i = 0; i < blocksize; i++) {
ipad[i] = key[i] ^ 54;
opad[i] = key[i] ^ 92;
}
var hash = fn(Buffer.concat([ipad, data]));
return fn(Buffer.concat([opad, hash]));
}
function hash(alg, key) {
alg = alg || "sha1";
var fn = algorithms[alg];
var bufs = [];
var length = 0;
if (!fn) error("algorithm:", alg, "is not yet supported");
return {
update: function(data) {
if (!Buffer.isBuffer(data)) data = new Buffer(data);
bufs.push(data);
length += data.length;
return this;
},
digest: function(enc) {
var buf = Buffer.concat(bufs);
var r = key ? hmac(fn, key, buf) : fn(buf);
bufs = null;
return enc ? r.toString(enc) : r;
}
};
}
function error() {
var m = [].slice.call(arguments).join(" ");
throw new Error(
[
m,
"we accept pull requests",
"http://github.com/dominictarr/crypto-browserify"
].join("\n")
);
}
exports.createHash = function(alg) {
return hash(alg);
};
exports.createHmac = function(alg, key) {
return hash(alg, key);
};
exports.randomBytes = function(size, callback) {
if (callback && callback.call) {
try {
callback.call(this, undefined, new Buffer(rng(size)));
} catch (err) {
callback(err);
}
} else {
return new Buffer(rng(size));
}
};
function each(a, f) {
for (var i in a) f(a[i], i);
}
each(
[
"createCredentials",
"createCipher",
"createCipheriv",
"createDecipher",
"createDecipheriv",
"createSign",
"createVerify",
"createDiffieHellman",
"pbkdf2"
],
function(name) {
exports[name] = function() {
error("sorry,", name, "is not implemented yet");
};
}
);
},
{ "./md5": 5, "./rng": 6, "./sha": 7, "./sha256": 8, buffer: 2 }
],
5: [
function(require, module, exports) {
var helpers = require("./helpers");
function md5_vm_test() {
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}
function core_md5(x, len) {
x[len >> 5] |= 128 << len % 32;
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for (var i = 0; i < x.length; i += 16) {
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return Array(a, b, c, d);
}
function md5_cmn(q, a, b, x, s, t) {
return safe_add(
bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),
b
);
}
function md5_ff(a, b, c, d, x, s, t) {
return md5_cmn((b & c) | (~b & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t) {
return md5_cmn((b & d) | (c & ~d), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t) {
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t) {
return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
}
function safe_add(x, y) {
var lsw = (x & 65535) + (y & 65535);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 65535);
}
function bit_rol(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
module.exports = function md5(buf) {
return helpers.hash(buf, core_md5, 16);
};
},
{ "./helpers": 3 }
],
6: [
function(require, module, exports) {
(function() {
var _global = this;
var mathRNG, whatwgRNG;
mathRNG = function(size) {
var bytes = new Array(size);
var r;
for (var i = 0, r; i < size; i++) {
if ((i & 3) == 0) r = Math.random() * 4294967296;
bytes[i] = (r >>> ((i & 3) << 3)) & 255;
}
return bytes;
};
if (_global.crypto && crypto.getRandomValues) {
whatwgRNG = function(size) {
var bytes = new Uint8Array(size);
crypto.getRandomValues(bytes);
return bytes;
};
}
module.exports = whatwgRNG || mathRNG;
})();
},
{}
],
7: [
function(require, module, exports) {
var helpers = require("./helpers");
function core_sha1(x, len) {
x[len >> 5] |= 128 << (24 - (len % 32));
x[(((len + 64) >> 9) << 4) + 15] = len;
var w = Array(80);
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
var e = -1009589776;
for (var i = 0; i < x.length; i += 16) {
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
var olde = e;
for (var j = 0; j < 80; j++) {
if (j < 16) w[j] = x[i + j];
else w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
var t = safe_add(
safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
safe_add(safe_add(e, w[j]), sha1_kt(j))
);
e = d;
d = c;
c = rol(b, 30);
b = a;
a = t;
}
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
e = safe_add(e, olde);
}
return Array(a, b, c, d, e);
}
function sha1_ft(t, b, c, d) {
if (t < 20) return (b & c) | (~b & d);
if (t < 40) return b ^ c ^ d;
if (t < 60) return (b & c) | (b & d) | (c & d);
return b ^ c ^ d;
}
function sha1_kt(t) {
return t < 20
? 1518500249
: t < 40
? 1859775393
: t < 60
? -1894007588
: -899497514;
}
function safe_add(x, y) {
var lsw = (x & 65535) + (y & 65535);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 65535);
}
function rol(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
module.exports = function sha1(buf) {
return helpers.hash(buf, core_sha1, 20, true);
};
},
{ "./helpers": 3 }
],
8: [
function(require, module, exports) {
var helpers = require("./helpers");
var safe_add = function(x, y) {
var lsw = (x & 65535) + (y & 65535);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 65535);
};
var S = function(X, n) {
return (X >>> n) | (X << (32 - n));
};
var R = function(X, n) {
return X >>> n;
};
var Ch = function(x, y, z) {
return (x & y) ^ (~x & z);
};
var Maj = function(x, y, z) {
return (x & y) ^ (x & z) ^ (y & z);
};
var Sigma0256 = function(x) {
return S(x, 2) ^ S(x, 13) ^ S(x, 22);
};
var Sigma1256 = function(x) {
return S(x, 6) ^ S(x, 11) ^ S(x, 25);
};
var Gamma0256 = function(x) {
return S(x, 7) ^ S(x, 18) ^ R(x, 3);
};
var Gamma1256 = function(x) {
return S(x, 17) ^ S(x, 19) ^ R(x, 10);
};
var core_sha256 = function(m, l) {
var K = new Array(
1116352408,
1899447441,
3049323471,
3921009573,
961987163,
1508970993,
2453635748,
2870763221,
3624381080,
310598401,
607225278,
1426881987,
1925078388,
2162078206,
2614888103,
3248222580,
3835390401,
4022224774,
264347078,
604807628,
770255983,
1249150122,
1555081692,
1996064986,
2554220882,
2821834349,
2952996808,
3210313671,
3336571891,
3584528711,
113926993,
338241895,
666307205,
773529912,
1294757372,
1396182291,
1695183700,
1986661051,
2177026350,
2456956037,
2730485921,
2820302411,
3259730800,
3345764771,
3516065817,
3600352804,
4094571909,
275423344,
430227734,
506948616,
659060556,
883997877,
958139571,
1322822218,
1537002063,
1747873779,
1955562222,
2024104815,
2227730452,
2361852424,
2428436474,
2756734187,
3204031479,
3329325298
);
var HASH = new Array(
1779033703,
3144134277,
1013904242,
2773480762,
1359893119,
2600822924,
528734635,
1541459225
);
var W = new Array(64);
var a, b, c, d, e, f, g, h, i, j;
var T1, T2;
m[l >> 5] |= 128 << (24 - (l % 32));
m[(((l + 64) >> 9) << 4) + 15] = l;
for (var i = 0; i < m.length; i += 16) {
a = HASH[0];
b = HASH[1];
c = HASH[2];
d = HASH[3];
e = HASH[4];
f = HASH[5];
g = HASH[6];
h = HASH[7];
for (var j = 0; j < 64; j++) {
if (j < 16) {
W[j] = m[j + i];
} else {
W[j] = safe_add(
safe_add(
safe_add(Gamma1256(W[j - 2]), W[j - 7]),
Gamma0256(W[j - 15])
),
W[j - 16]
);
}
T1 = safe_add(
safe_add(
safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)),
K[j]
),
W[j]
);
T2 = safe_add(Sigma0256(a), Maj(a, b, c));
h = g;
g = f;
f = e;
e = safe_add(d, T1);
d = c;
c = b;
b = a;
a = safe_add(T1, T2);
}
HASH[0] = safe_add(a, HASH[0]);
HASH[1] = safe_add(b, HASH[1]);
HASH[2] = safe_add(c, HASH[2]);
HASH[3] = safe_add(d, HASH[3]);
HASH[4] = safe_add(e, HASH[4]);
HASH[5] = safe_add(f, HASH[5]);
HASH[6] = safe_add(g, HASH[6]);
HASH[7] = safe_add(h, HASH[7]);
}
return HASH;
};
module.exports = function sha256(buf) {
return helpers.hash(buf, core_sha256, 32, true);
};
},
{ "./helpers": 3 }
],
9: [
function(require, module, exports) {
(function(window, document, exportName, undefined) {
"use strict";
var VENDOR_PREFIXES = ["", "webkit", "Moz", "MS", "ms", "o"];
var TEST_ELEMENT = document.createElement("div");
var TYPE_FUNCTION = "function";
var round = Math.round;
var abs = Math.abs;
var now = Date.now;
function setTimeoutContext(fn, timeout, context) {
return setTimeout(bindFn(fn, context), timeout);
}
function invokeArrayArg(arg, fn, context) {
if (Array.isArray(arg)) {
each(arg, context[fn], context);
return true;
}
return false;
}
function each(obj, iterator, context) {
var i;
if (!obj) {
return;
}
if (obj.forEach) {
obj.forEach(iterator, context);
} else if (obj.length !== undefined) {
i = 0;
while (i < obj.length) {
iterator.call(context, obj[i], i, obj);
i++;
}
} else {
for (i in obj) {
obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
}
}
}
function deprecate(method, name, message) {
var deprecationMessage =
"DEPRECATED METHOD: " + name + "\n" + message + " AT \n";
return function() {
var e = new Error("get-stack-trace");
var stack =
e && e.stack
? e.stack
.replace(/^[^\(]+?[\n$]/gm, "")
.replace(/^\s+at\s+/gm, "")
.replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@")
: "Unknown Stack Trace";
var log =
window.console && (window.console.warn || window.console.log);
if (log) {
log.call(window.console, deprecationMessage, stack);
}
return method.apply(this, arguments);
};
}
var assign;
if (typeof Object.assign !== "function") {
assign = function assign(target) {
if (target === undefined || target === null) {
throw new TypeError(
"Cannot convert undefined or null to object"
);
}
var output = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
if (source.hasOwnProperty(nextKey)) {
output[nextKey] = source[nextKey];
}
}
}
}
return output;
};
} else {
assign = Object.assign;
}
var extend = deprecate(
function extend(dest, src, merge) {
var keys = Object.keys(src);
var i = 0;
while (i < keys.length) {
if (!merge || (merge && dest[keys[i]] === undefined)) {
dest[keys[i]] = src[keys[i]];
}
i++;
}
return dest;
},
"extend",
"Use `assign`."
);
var merge = deprecate(
function merge(dest, src) {
return extend(dest, src, true);
},
"merge",
"Use `assign`."
);
function inherit(child, base, properties) {
var baseP = base.prototype,
childP;
childP = child.prototype = Object.create(baseP);
childP.constructor = child;
childP._super = baseP;
if (properties) {
assign(childP, properties);
}
}
function bindFn(fn, context) {
return function boundFn() {
return fn.apply(context, arguments);
};
}
function boolOrFn(val, args) {
if (typeof val == TYPE_FUNCTION) {
return val.apply(args ? args[0] || undefined : undefined, args);
}
return val;
}
function ifUndefined(val1, val2) {
return val1 === undefined ? val2 : val1;
}
function addEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.addEventListener(type, handler, false);
});
}
function removeEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.removeEventListener(type, handler, false);
});
}
function hasParent(node, parent) {
while (node) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
}
function inStr(str, find) {
return str.indexOf(find) > -1;
}
function splitStr(str) {
return str.trim().split(/\s+/g);
}
function inArray(src, find, findByKey) {
if (src.indexOf && !findByKey) {
return src.indexOf(find);
} else {
var i = 0;
while (i < src.length) {
if (
(findByKey && src[i][findByKey] == find) ||
(!findByKey && src[i] === find)
) {
return i;
}
i++;
}
return -1;
}
}
function toArray(obj) {
return Array.prototype.slice.call(obj, 0);
}
function uniqueArray(src, key, sort) {
var results = [];
var values = [];
var i = 0;
while (i < src.length) {
var val = key ? src[i][key] : src[i];
if (inArray(values, val) < 0) {
results.push(src[i]);
}
values[i] = val;
i++;
}
if (sort) {
if (!key) {
results = results.sort();
} else {
results = results.sort(function sortUniqueArray(a, b) {
return a[key] > b[key];
});
}
}
return results;
}
function prefixed(obj, property) {
var prefix, prop;
var camelProp = property[0].toUpperCase() + property.slice(1);
var i = 0;
while (i < VENDOR_PREFIXES.length) {
prefix = VENDOR_PREFIXES[i];
prop = prefix ? prefix + camelProp : property;
if (prop in obj) {
return prop;
}
i++;
}
return undefined;
}
var _uniqueId = 1;
function uniqueId() {
return _uniqueId++;
}
function getWindowForElement(element) {
var doc = element.ownerDocument || element;
return doc.defaultView || doc.parentWindow || window;
}
var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
var SUPPORT_TOUCH = "ontouchstart" in window;
var SUPPORT_POINTER_EVENTS =
prefixed(window, "PointerEvent") !== undefined;
var SUPPORT_ONLY_TOUCH =
SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
var INPUT_TYPE_TOUCH = "touch";
var INPUT_TYPE_PEN = "pen";
var INPUT_TYPE_MOUSE = "mouse";
var INPUT_TYPE_KINECT = "kinect";
var COMPUTE_INTERVAL = 25;
var INPUT_START = 1;
var INPUT_MOVE = 2;
var INPUT_END = 4;
var INPUT_CANCEL = 8;
var DIRECTION_NONE = 1;
var DIRECTION_LEFT = 2;
var DIRECTION_RIGHT = 4;
var DIRECTION_UP = 8;
var DIRECTION_DOWN = 16;
var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
var PROPS_XY = ["x", "y"];
var PROPS_CLIENT_XY = ["clientX", "clientY"];
function Input(manager, callback) {
var self = this;
this.manager = manager;
this.callback = callback;
this.element = manager.element;
this.target = manager.options.inputTarget;
this.domHandler = function(ev) {
if (boolOrFn(manager.options.enable, [manager])) {
self.handler(ev);
}
};
this.init();
}
Input.prototype = {
handler: function() {},
init: function() {
this.evEl &&
addEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget &&
addEventListeners(this.target, this.evTarget, this.domHandler);
this.evWin &&
addEventListeners(
getWindowForElement(this.element),
this.evWin,
this.domHandler
);
},
destroy: function() {
this.evEl &&
removeEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget &&
removeEventListeners(
this.target,
this.evTarget,
this.domHandler
);
this.evWin &&
removeEventListeners(
getWindowForElement(this.element),
this.evWin,
this.domHandler
);
}
};
function createInputInstance(manager) {
var Type;
var inputClass = manager.options.inputClass;
if (inputClass) {
Type = inputClass;
} else if (SUPPORT_POINTER_EVENTS) {
Type = PointerEventInput;
} else if (SUPPORT_ONLY_TOUCH) {
Type = TouchInput;
} else if (!SUPPORT_TOUCH) {
Type = MouseInput;
} else {
Type = TouchMouseInput;
}
return new Type(manager, inputHandler);
}
function inputHandler(manager, eventType, input) {
var pointersLen = input.pointers.length;
var changedPointersLen = input.changedPointers.length;
var isFirst =
eventType & INPUT_START && pointersLen - changedPointersLen === 0;
var isFinal =
eventType & (INPUT_END | INPUT_CANCEL) &&
pointersLen - changedPointersLen === 0;
input.isFirst = !!isFirst;
input.isFinal = !!isFinal;
if (isFirst) {
manager.session = {};
}
input.eventType = eventType;
computeInputData(manager, input);
manager.emit("hammer.input", input);
manager.recognize(input);
manager.session.prevInput = input;
}
function computeInputData(manager, input) {
var session = manager.session;
var pointers = input.pointers;
var pointersLength = pointers.length;
if (!session.firstInput) {
session.firstInput = simpleCloneInputData(input);
}
if (pointersLength > 1 && !session.firstMultiple) {
session.firstMultiple = simpleCloneInputData(input);
} else if (pointersLength === 1) {
session.firstMultiple = false;
}
var firstInput = session.firstInput;
var firstMultiple = session.firstMultiple;
var offsetCenter = firstMultiple
? firstMultiple.center
: firstInput.center;
var center = (input.center = getCenter(pointers));
input.timeStamp = now();
input.deltaTime = input.timeStamp - firstInput.timeStamp;
input.angle = getAngle(offsetCenter, center);
input.distance = getDistance(offsetCenter, center);
computeDeltaXY(session, input);
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
var overallVelocity = getVelocity(
input.deltaTime,
input.deltaX,
input.deltaY
);
input.overallVelocityX = overallVelocity.x;
input.overallVelocityY = overallVelocity.y;
input.overallVelocity =
abs(overallVelocity.x) > abs(overallVelocity.y)
? overallVelocity.x
: overallVelocity.y;
input.scale = firstMultiple
? getScale(firstMultiple.pointers, pointers)
: 1;
input.rotation = firstMultiple
? getRotation(firstMultiple.pointers, pointers)
: 0;
input.maxPointers = !session.prevInput
? input.pointers.length
: input.pointers.length > session.prevInput.maxPointers
? input.pointers.length
: session.prevInput.maxPointers;
computeIntervalInputData(session, input);
var target = manager.element;
if (hasParent(input.srcEvent.target, target)) {
target = input.srcEvent.target;
}
input.target = target;
}
function computeDeltaXY(session, input) {
var center = input.center;
var offset = session.offsetDelta || {};
var prevDelta = session.prevDelta || {};
var prevInput = session.prevInput || {};
if (
input.eventType === INPUT_START ||
prevInput.eventType === INPUT_END
) {
prevDelta = session.prevDelta = {
x: prevInput.deltaX || 0,
y: prevInput.deltaY || 0
};
offset = session.offsetDelta = { x: center.x, y: center.y };
}
input.deltaX = prevDelta.x + (center.x - offset.x);
input.deltaY = prevDelta.y + (center.y - offset.y);
}
function computeIntervalInputData(session, input) {
var last = session.lastInterval || input,
deltaTime = input.timeStamp - last.timeStamp,
velocity,
velocityX,
velocityY,
direction;
if (
input.eventType != INPUT_CANCEL &&
(deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)
) {
var deltaX = input.deltaX - last.deltaX;
var deltaY = input.deltaY - last.deltaY;
var v = getVelocity(deltaTime, deltaX, deltaY);
velocityX = v.x;
velocityY = v.y;
velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
direction = getDirection(deltaX, deltaY);
session.lastInterval = input;
} else {
velocity = last.velocity;
velocityX = last.velocityX;
velocityY = last.velocityY;
direction = last.direction;
}
input.velocity = velocity;
input.velocityX = velocityX;
input.velocityY = velocityY;
input.direction = direction;
}
function simpleCloneInputData(input) {
var pointers = [];
var i = 0;
while (i < input.pointers.length) {
pointers[i] = {
clientX: round(input.pointers[i].clientX),
clientY: round(input.pointers[i].clientY)
};
i++;
}
return {
timeStamp: now(),
pointers: pointers,
center: getCenter(pointers),
deltaX: input.deltaX,
deltaY: input.deltaY
};
}
function getCenter(pointers) {
var pointersLength = pointers.length;
if (pointersLength === 1) {
return {
x: round(pointers[0].clientX),
y: round(pointers[0].clientY)
};
}
var x = 0,
y = 0,
i = 0;
while (i < pointersLength) {
x += pointers[i].clientX;
y += pointers[i].clientY;
i++;
}
return {
x: round(x / pointersLength),
y: round(y / pointersLength)
};
}
function getVelocity(deltaTime, x, y) {
return { x: x / deltaTime || 0, y: y / deltaTime || 0 };
}
function getDirection(x, y) {
if (x === y) {
return DIRECTION_NONE;
}
if (abs(x) >= abs(y)) {
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
}
function getDistance(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return Math.sqrt(x * x + y * y);
}
function getAngle(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return (Math.atan2(y, x) * 180) / Math.PI;
}
function getRotation(start, end) {
return (
getAngle(end[1], end[0], PROPS_CLIENT_XY) +
getAngle(start[1], start[0], PROPS_CLIENT_XY)
);
}
function getScale(start, end) {
return (
getDistance(end[0], end[1], PROPS_CLIENT_XY) /
getDistance(start[0], start[1], PROPS_CLIENT_XY)
);
}
var MOUSE_INPUT_MAP = {
mousedown: INPUT_START,
mousemove: INPUT_MOVE,
mouseup: INPUT_END
};
var MOUSE_ELEMENT_EVENTS = "mousedown";
var MOUSE_WINDOW_EVENTS = "mousemove mouseup";
function MouseInput() {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.pressed = false;
Input.apply(this, arguments);
}
inherit(MouseInput, Input, {
handler: function MEhandler(ev) {
var eventType = MOUSE_INPUT_MAP[ev.type];
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}
if (eventType & INPUT_MOVE && ev.which !== 1) {
eventType = INPUT_END;
}
if (!this.pressed) {
return;
}
if (eventType & INPUT_END) {
this.pressed = false;
}
this.callback(this.manager, eventType, {
pointers: [ev],
changedPointers: [ev],
pointerType: INPUT_TYPE_MOUSE,
srcEvent: ev
});
}
});
var POINTER_INPUT_MAP = {
pointerdown: INPUT_START,
pointermove: INPUT_MOVE,
pointerup: INPUT_END,
pointercancel: INPUT_CANCEL,
pointerout: INPUT_CANCEL
};
var IE10_POINTER_TYPE_ENUM = {
2: INPUT_TYPE_TOUCH,
3: INPUT_TYPE_PEN,
4: INPUT_TYPE_MOUSE,
5: INPUT_TYPE_KINECT
};
var POINTER_ELEMENT_EVENTS = "pointerdown";
var POINTER_WINDOW_EVENTS = "pointermove pointerup pointercancel";
if (window.MSPointerEvent && !window.PointerEvent) {
POINTER_ELEMENT_EVENTS = "MSPointerDown";
POINTER_WINDOW_EVENTS = "MSPointerMove MSPointerUp MSPointerCancel";
}
function PointerEventInput() {
this.evEl = POINTER_ELEMENT_EVENTS;
this.evWin = POINTER_WINDOW_EVENTS;
Input.apply(this, arguments);
this.store = this.manager.session.pointerEvents = [];
}
inherit(PointerEventInput, Input, {
handler: function PEhandler(ev) {
var store = this.store;
var removePointer = false;
var eventTypeNormalized = ev.type.toLowerCase().replace("ms", "");
var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
var pointerType =
IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
var isTouch = pointerType == INPUT_TYPE_TOUCH;
var storeIndex = inArray(store, ev.pointerId, "pointerId");
if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
if (storeIndex < 0) {
store.push(ev);
storeIndex = store.length - 1;
}
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
removePointer = true;
}
if (storeIndex < 0) {
return;
}
store[storeIndex] = ev;
this.callback(this.manager, eventType, {
pointers: store,
changedPointers: [ev],
pointerType: pointerType,
srcEvent: ev
});
if (removePointer) {
store.splice(storeIndex, 1);
}
}
});
var SINGLE_TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
var SINGLE_TOUCH_TARGET_EVENTS = "touchstart";
var SINGLE_TOUCH_WINDOW_EVENTS =
"touchstart touchmove touchend touchcancel";
function SingleTouchInput() {
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
this.started = false;
Input.apply(this, arguments);
}
inherit(SingleTouchInput, Input, {
handler: function TEhandler(ev) {
var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
if (type === INPUT_START) {
this.started = true;
}
if (!this.started) {
return;
}
var touches = normalizeSingleTouches.call(this, ev, type);
if (
type & (INPUT_END | INPUT_CANCEL) &&
touches[0].length - touches[1].length === 0
) {
this.started = false;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});
function normalizeSingleTouches(ev, type) {
var all = toArray(ev.touches);
var changed = toArray(ev.changedTouches);
if (type & (INPUT_END | INPUT_CANCEL)) {
all = uniqueArray(all.concat(changed), "identifier", true);
}
return [all, changed];
}
var TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
var TOUCH_TARGET_EVENTS = "touchstart touchmove touchend touchcancel";
function TouchInput() {
this.evTarget = TOUCH_TARGET_EVENTS;
this.targetIds = {};
Input.apply(this, arguments);
}
inherit(TouchInput, Input, {
handler: function MTEhandler(ev) {
var type = TOUCH_INPUT_MAP[ev.type];
var touches = getTouches.call(this, ev, type);
if (!touches) {
return;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});
function getTouches(ev, type) {
var allTouches = toArray(ev.touches);
var targetIds = this.targetIds;
if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
targetIds[allTouches[0].identifier] = true;
return [allTouches, allTouches];
}
var i,
targetTouches,
changedTouches = toArray(ev.changedTouches),
changedTargetTouches = [],
target = this.target;
targetTouches = allTouches.filter(function(touch) {
return hasParent(touch.target, target);
});
if (type === INPUT_START) {
i = 0;
while (i < targetTouches.length) {
targetIds[targetTouches[i].identifier] = true;
i++;
}
}
i = 0;
while (i < changedTouches.length) {
if (targetIds[changedTouches[i].identifier]) {
changedTargetTouches.push(changedTouches[i]);
}
if (type & (INPUT_END | INPUT_CANCEL)) {
delete targetIds[changedTouches[i].identifier];
}
i++;
}
if (!changedTargetTouches.length) {
return;
}
return [
uniqueArray(
targetTouches.concat(changedTargetTouches),
"identifier",
true
),
changedTargetTouches
];
}
var DEDUP_TIMEOUT = 2500;
var DEDUP_DISTANCE = 25;
function TouchMouseInput() {
Input.apply(this, arguments);
var handler = bindFn(this.handler, this);
this.touch = new TouchInput(this.manager, handler);
this.mouse = new MouseInput(this.manager, handler);
this.primaryTouch = null;
this.lastTouches = [];
}
inherit(TouchMouseInput, Input, {
handler: function TMEhandler(manager, inputEvent, inputData) {
var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,
isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;
if (
isMouse &&
inputData.sourceCapabilities &&
inputData.sourceCapabilities.firesTouchEvents
) {
return;
}
if (isTouch) {
recordTouches.call(this, inputEvent, inputData);
} else if (isMouse && isSyntheticEvent.call(this, inputData)) {
return;
}
this.callback(manager, inputEvent, inputData);
},
destroy: function destroy() {
this.touch.destroy();
this.mouse.destroy();
}
});
function recordTouches(eventType, eventData) {
if (eventType & INPUT_START) {
this.primaryTouch = eventData.changedPointers[0].identifier;
setLastTouch.call(this, eventData);
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
setLastTouch.call(this, eventData);
}
}
function setLastTouch(eventData) {
var touch = eventData.changedPointers[0];
if (touch.identifier === this.primaryTouch) {
var lastTouch = { x: touch.clientX, y: touch.clientY };
this.lastTouches.push(lastTouch);
var lts = this.lastTouches;
var removeLastTouch = function() {
var i = lts.indexOf(lastTouch);
if (i > -1) {
lts.splice(i, 1);
}
};
setTimeout(removeLastTouch, DEDUP_TIMEOUT);
}
}
function isSyntheticEvent(eventData) {
var x = eventData.srcEvent.clientX,
y = eventData.srcEvent.clientY;
for (var i = 0; i < this.lastTouches.length; i++) {
var t = this.lastTouches[i];
var dx = Math.abs(x - t.x),
dy = Math.abs(y - t.y);
if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
return true;
}
}
return false;
}
var PREFIXED_TOUCH_ACTION = prefixed(
TEST_ELEMENT.style,
"touchAction"
);
var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
var TOUCH_ACTION_COMPUTE = "compute";
var TOUCH_ACTION_AUTO = "auto";
var TOUCH_ACTION_MANIPULATION = "manipulation";
var TOUCH_ACTION_NONE = "none";
var TOUCH_ACTION_PAN_X = "pan-x";
var TOUCH_ACTION_PAN_Y = "pan-y";
var TOUCH_ACTION_MAP = getTouchActionProps();
function TouchAction(manager, value) {
this.manager = manager;
this.set(value);
}
TouchAction.prototype = {
set: function(value) {
if (value == TOUCH_ACTION_COMPUTE) {
value = this.compute();
}
if (
NATIVE_TOUCH_ACTION &&
this.manager.element.style &&
TOUCH_ACTION_MAP[value]
) {
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
}
this.actions = value.toLowerCase().trim();
},
update: function() {
this.set(this.manager.options.touchAction);
},
compute: function() {
var actions = [];
each(this.manager.recognizers, function(recognizer) {
if (boolOrFn(recognizer.options.enable, [recognizer])) {
actions = actions.concat(recognizer.getTouchAction());
}
});
return cleanTouchActions(actions.join(" "));
},
preventDefaults: function(input) {
var srcEvent = input.srcEvent;
var direction = input.offsetDirection;
if (this.manager.session.prevented) {
srcEvent.preventDefault();
return;
}
var actions = this.actions;
var hasNone =
inStr(actions, TOUCH_ACTION_NONE) &&
!TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
var hasPanY =
inStr(actions, TOUCH_ACTION_PAN_Y) &&
!TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
var hasPanX =
inStr(actions, TOUCH_ACTION_PAN_X) &&
!TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
if (hasNone) {
var isTapPointer = input.pointers.length === 1;
var isTapMovement = input.distance < 2;
var isTapTouchTime = input.deltaTime < 250;
if (isTapPointer && isTapMovement && isTapTouchTime) {
return;
}
}
if (hasPanX && hasPanY) {
return;
}
if (
hasNone ||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
(hasPanX && direction & DIRECTION_VERTICAL)
) {
return this.preventSrc(srcEvent);
}
},
preventSrc: function(srcEvent) {
this.manager.session.prevented = true;
srcEvent.preventDefault();
}
};
function cleanTouchActions(actions) {
if (inStr(actions, TOUCH_ACTION_NONE)) {
return TOUCH_ACTION_NONE;
}
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
if (hasPanX && hasPanY) {
return TOUCH_ACTION_NONE;
}
if (hasPanX || hasPanY) {
return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
}
if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
return TOUCH_ACTION_MANIPULATION;
}
return TOUCH_ACTION_AUTO;
}
function getTouchActionProps() {
if (!NATIVE_TOUCH_ACTION) {
return false;
}
var touchMap = {};
var cssSupports = window.CSS && window.CSS.supports;
[
"auto",
"manipulation",
"pan-y",
"pan-x",
"pan-x pan-y",
"none"
].forEach(function(val) {
touchMap[val] = cssSupports
? window.CSS.supports("touch-action", val)
: true;
});
return touchMap;
}
var STATE_POSSIBLE = 1;
var STATE_BEGAN = 2;
var STATE_CHANGED = 4;
var STATE_ENDED = 8;
var STATE_RECOGNIZED = STATE_ENDED;
var STATE_CANCELLED = 16;
var STATE_FAILED = 32;
function Recognizer(options) {
this.options = assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
this.options.enable = ifUndefined(this.options.enable, true);
this.state = STATE_POSSIBLE;
this.simultaneous = {};
this.requireFail = [];
}
Recognizer.prototype = {
defaults: {},
set: function(options) {
assign(this.options, options);
this.manager && this.manager.touchAction.update();
return this;
},
recognizeWith: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, "recognizeWith", this)) {
return this;
}
var simultaneous = this.simultaneous;
otherRecognizer = getRecognizerByNameIfManager(
otherRecognizer,
this
);
if (!simultaneous[otherRecognizer.id]) {
simultaneous[otherRecognizer.id] = otherRecognizer;
otherRecognizer.recognizeWith(this);
}
return this;
},
dropRecognizeWith: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, "dropRecognizeWith", this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(
otherRecognizer,
this
);
delete this.simultaneous[otherRecognizer.id];
return this;
},
requireFailure: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, "requireFailure", this)) {
return this;
}
var requireFail = this.requireFail;
otherRecognizer = getRecognizerByNameIfManager(
otherRecognizer,
this
);
if (inArray(requireFail, otherRecognizer) === -1) {
requireFail.push(otherRecognizer);
otherRecognizer.requireFailure(this);
}
return this;
},
dropRequireFailure: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, "dropRequireFailure", this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(
otherRecognizer,
this
);
var index = inArray(this.requireFail, otherRecognizer);
if (index > -1) {
this.requireFail.splice(index, 1);
}
return this;
},
hasRequireFailures: function() {
return this.requireFail.length > 0;
},
canRecognizeWith: function(otherRecognizer) {
return !!this.simultaneous[otherRecognizer.id];
},
emit: function(input) {
var self = this;
var state = this.state;
function emit(event) {
self.manager.emit(event, input);
}
if (state < STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
emit(self.options.event);
if (input.additionalEvent) {
emit(input.additionalEvent);
}
if (state >= STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
},
tryEmit: function(input) {
if (this.canEmit()) {
return this.emit(input);
}
this.state = STATE_FAILED;
},
canEmit: function() {
var i = 0;
while (i < this.requireFail.length) {
if (
!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))
) {
return false;
}
i++;
}
return true;
},
recognize: function(inputData) {
var inputDataClone = assign({}, inputData);
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
this.reset();
this.state = STATE_FAILED;
return;
}
if (
this.state &
(STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)
) {
this.state = STATE_POSSIBLE;
}
this.state = this.process(inputDataClone);
if (
this.state &
(STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)
) {
this.tryEmit(inputDataClone);
}
},
process: function(inputData) {},
getTouchAction: function() {},
reset: function() {}
};
function stateStr(state) {
if (state & STATE_CANCELLED) {
return "cancel";
} else if (state & STATE_ENDED) {
return "end";
} else if (state & STATE_CHANGED) {
return "move";
} else if (state & STATE_BEGAN) {
return "start";
}
return "";
}
function directionStr(direction) {
if (direction == DIRECTION_DOWN) {
return "down";
} else if (direction == DIRECTION_UP) {
return "up";
} else if (direction == DIRECTION_LEFT) {
return "left";
} else if (direction == DIRECTION_RIGHT) {
return "right";
}
return "";
}
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
var manager = recognizer.manager;
if (manager) {
return manager.get(otherRecognizer);
}
return otherRecognizer;
}
function AttrRecognizer() {
Recognizer.apply(this, arguments);
}
inherit(AttrRecognizer, Recognizer, {
defaults: { pointers: 1 },
attrTest: function(input) {
var optionPointers = this.options.pointers;
return (
optionPointers === 0 || input.pointers.length === optionPointers
);
},
process: function(input) {
var state = this.state;
var eventType = input.eventType;
var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
var isValid = this.attrTest(input);
if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
return state | STATE_CANCELLED;
} else if (isRecognized || isValid) {
if (eventType & INPUT_END) {
return state | STATE_ENDED;
} else if (!(state & STATE_BEGAN)) {
return STATE_BEGAN;
}
return state | STATE_CHANGED;
}
return STATE_FAILED;
}
});
function PanRecognizer() {
AttrRecognizer.apply(this, arguments);
this.pX = null;
this.pY = null;
}
inherit(PanRecognizer, AttrRecognizer, {
defaults: {
event: "pan",
threshold: 10,
pointers: 1,
direction: DIRECTION_ALL
},
getTouchAction: function() {
var direction = this.options.direction;
var actions = [];
if (direction & DIRECTION_HORIZONTAL) {
actions.push(TOUCH_ACTION_PAN_Y);
}
if (direction & DIRECTION_VERTICAL) {
actions.push(TOUCH_ACTION_PAN_X);
}
return actions;
},
directionTest: function(input) {
var options = this.options;
var hasMoved = true;
var distance = input.distance;
var direction = input.direction;
var x = input.deltaX;
var y = input.deltaY;
if (!(direction & options.direction)) {
if (options.direction & DIRECTION_HORIZONTAL) {
direction =
x === 0
? DIRECTION_NONE
: x < 0
? DIRECTION_LEFT
: DIRECTION_RIGHT;
hasMoved = x != this.pX;
distance = Math.abs(input.deltaX);
} else {
direction =
y === 0
? DIRECTION_NONE
: y < 0
? DIRECTION_UP
: DIRECTION_DOWN;
hasMoved = y != this.pY;
distance = Math.abs(input.deltaY);
}
}
input.direction = direction;
return (
hasMoved &&
distance > options.threshold &&
direction & options.direction
);
},
attrTest: function(input) {
return (
AttrRecognizer.prototype.attrTest.call(this, input) &&
(this.state & STATE_BEGAN ||
(!(this.state & STATE_BEGAN) && this.directionTest(input)))
);
},
emit: function(input) {
this.pX = input.deltaX;
this.pY = input.deltaY;
var direction = directionStr(input.direction);
if (direction) {
input.additionalEvent = this.options.event + direction;
}
this._super.emit.call(this, input);
}
});
function PinchRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(PinchRecognizer, AttrRecognizer, {
defaults: { event: "pinch", threshold: 0, pointers: 2 },
getTouchAction: function() {
return [TOUCH_ACTION_NONE];
},
attrTest: function(input) {
return (
this._super.attrTest.call(this, input) &&
(Math.abs(input.scale - 1) > this.options.threshold ||
this.state & STATE_BEGAN)
);
},
emit: function(input) {
if (input.scale !== 1) {
var inOut = input.scale < 1 ? "in" : "out";
input.additionalEvent = this.options.event + inOut;
}
this._super.emit.call(this, input);
}
});
function PressRecognizer() {
Recognizer.apply(this, arguments);
this._timer = null;
this._input = null;
}
inherit(PressRecognizer, Recognizer, {
defaults: { event: "press", pointers: 1, time: 251, threshold: 9 },
getTouchAction: function() {
return [TOUCH_ACTION_AUTO];
},
process: function(input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTime = input.deltaTime > options.time;
this._input = input;
if (
!validMovement ||
!validPointers ||
(input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)
) {
this.reset();
} else if (input.eventType & INPUT_START) {
this.reset();
this._timer = setTimeoutContext(
function() {
this.state = STATE_RECOGNIZED;
this.tryEmit();
},
options.time,
this
);
} else if (input.eventType & INPUT_END) {
return STATE_RECOGNIZED;
}
return STATE_FAILED;
},
reset: function() {
clearTimeout(this._timer);
},
emit: function(input) {
if (this.state !== STATE_RECOGNIZED) {
return;
}
if (input && input.eventType & INPUT_END) {
this.manager.emit(this.options.event + "up", input);
} else {
this._input.timeStamp = now();
this.manager.emit(this.options.event, this._input);
}
}
});
function RotateRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(RotateRecognizer, AttrRecognizer, {
defaults: { event: "rotate", threshold: 0, pointers: 2 },
getTouchAction: function() {
return [TOUCH_ACTION_NONE];
},
attrTest: function(input) {
return (
this._super.attrTest.call(this, input) &&
(Math.abs(input.rotation) > this.options.threshold ||
this.state & STATE_BEGAN)
);
}
});
function SwipeRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(SwipeRecognizer, AttrRecognizer, {
defaults: {
event: "swipe",
threshold: 10,
velocity: 0.3,
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
pointers: 1
},
getTouchAction: function() {
return PanRecognizer.prototype.getTouchAction.call(this);
},
attrTest: function(input) {
var direction = this.options.direction;
var velocity;
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
velocity = input.overallVelocity;
} else if (direction & DIRECTION_HORIZONTAL) {
velocity = input.overallVelocityX;
} else if (direction & DIRECTION_VERTICAL) {
velocity = input.overallVelocityY;
}
return (
this._super.attrTest.call(this, input) &&
direction & input.offsetDirection &&
input.distance > this.options.threshold &&
input.maxPointers == this.options.pointers &&
abs(velocity) > this.options.velocity &&
input.eventType & INPUT_END
);
},
emit: function(input) {
var direction = directionStr(input.offsetDirection);
if (direction) {
this.manager.emit(this.options.event + direction, input);
}
this.manager.emit(this.options.event, input);
}
});
function TapRecognizer() {
Recognizer.apply(this, arguments);
this.pTime = false;
this.pCenter = false;
this._timer = null;
this._input = null;
this.count = 0;
}
inherit(TapRecognizer, Recognizer, {
defaults: {
event: "tap",
pointers: 1,
taps: 1,
interval: 300,
time: 250,
threshold: 9,
posThreshold: 10
},
getTouchAction: function() {
return [TOUCH_ACTION_MANIPULATION];
},
process: function(input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTouchTime = input.deltaTime < options.time;
this.reset();
if (input.eventType & INPUT_START && this.count === 0) {
return this.failTimeout();
}
if (validMovement && validTouchTime && validPointers) {
if (input.eventType != INPUT_END) {
return this.failTimeout();
}
var validInterval = this.pTime
? input.timeStamp - this.pTime < options.interval
: true;
var validMultiTap =
!this.pCenter ||
getDistance(this.pCenter, input.center) <
options.posThreshold;
this.pTime = input.timeStamp;
this.pCenter = input.center;
if (!validMultiTap || !validInterval) {
this.count = 1;
} else {
this.count += 1;
}
this._input = input;
var tapCount = this.count % options.taps;
if (tapCount === 0) {
if (!this.hasRequireFailures()) {
return STATE_RECOGNIZED;
} else {
this._timer = setTimeoutContext(
function() {
this.state = STATE_RECOGNIZED;
this.tryEmit();
},
options.interval,
this
);
return STATE_BEGAN;
}
}
}
return STATE_FAILED;
},
failTimeout: function() {
this._timer = setTimeoutContext(
function() {
this.state = STATE_FAILED;
},
this.options.interval,
this
);
return STATE_FAILED;
},
reset: function() {
clearTimeout(this._timer);
},
emit: function() {
if (this.state == STATE_RECOGNIZED) {
this._input.tapCount = this.count;
this.manager.emit(this.options.event, this._input);
}
}
});
function Hammer(element, options) {
options = options || {};
options.recognizers = ifUndefined(
options.recognizers,
Hammer.defaults.preset
);
return new Manager(element, options);
}
Hammer.VERSION = "2.0.7";
Hammer.defaults = {
domEvents: false,
touchAction: TOUCH_ACTION_COMPUTE,
enable: true,
inputTarget: null,
inputClass: null,
preset: [
[RotateRecognizer, { enable: false }],
[PinchRecognizer, { enable: false }, ["rotate"]],
[SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],
[PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ["swipe"]],
[TapRecognizer],
[TapRecognizer, { event: "doubletap", taps: 2 }, ["tap"]],
[PressRecognizer]
],
cssProps: {
userSelect: "none",
touchSelect: "none",
touchCallout: "none",
contentZooming: "none",
userDrag: "none",
tapHighlightColor: "rgba(0,0,0,0)"
}
};
var STOP = 1;
var FORCED_STOP = 2;
function Manager(element, options) {
this.options = assign({}, Hammer.defaults, options || {});
this.options.inputTarget = this.options.inputTarget || element;
this.handlers = {};
this.session = {};
this.recognizers = [];
this.oldCssProps = {};
this.element = element;
this.input = createInputInstance(this);
this.touchAction = new TouchAction(this, this.options.touchAction);
toggleCssProps(this, true);
each(
this.options.recognizers,
function(item) {
var recognizer = this.add(new item[0](item[1]));
item[2] && recognizer.recognizeWith(item[2]);
item[3] && recognizer.requireFailure(item[3]);
},
this
);
}
Manager.prototype = {
set: function(options) {
assign(this.options, options);
if (options.touchAction) {
this.touchAction.update();
}
if (options.inputTarget) {
this.input.destroy();
this.input.target = options.inputTarget;
this.input.init();
}
return this;
},
stop: function(force) {
this.session.stopped = force ? FORCED_STOP : STOP;
},
recognize: function(inputData) {
var session = this.session;
if (session.stopped) {
return;
}
this.touchAction.preventDefaults(inputData);
var recognizer;
var recognizers = this.recognizers;
var curRecognizer = session.curRecognizer;
if (
!curRecognizer ||
(curRecognizer && curRecognizer.state & STATE_RECOGNIZED)
) {
curRecognizer = session.curRecognizer = null;
}
var i = 0;
while (i < recognizers.length) {
recognizer = recognizers[i];
if (
session.stopped !== FORCED_STOP &&
(!curRecognizer ||
recognizer == curRecognizer ||
recognizer.canRecognizeWith(curRecognizer))
) {
recognizer.recognize(inputData);
} else {
recognizer.reset();
}
if (
!curRecognizer &&
recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)
) {
curRecognizer = session.curRecognizer = recognizer;
}
i++;
}
},
get: function(recognizer) {
if (recognizer instanceof Recognizer) {
return recognizer;
}
var recognizers = this.recognizers;
for (var i = 0; i < recognizers.length; i++) {
if (recognizers[i].options.event == recognizer) {
return recognizers[i];
}
}
return null;
},
add: function(recognizer) {
if (invokeArrayArg(recognizer, "add", this)) {
return this;
}
var existing = this.get(recognizer.options.event);
if (existing) {
this.remove(existing);
}
this.recognizers.push(recognizer);
recognizer.manager = this;
this.touchAction.update();
return recognizer;
},
remove: function(recognizer) {
if (invokeArrayArg(recognizer, "remove", this)) {
return this;
}
recognizer = this.get(recognizer);
if (recognizer) {
var recognizers = this.recognizers;
var index = inArray(recognizers, recognizer);
if (index !== -1) {
recognizers.splice(index, 1);
this.touchAction.update();
}
}
return this;
},
on: function(events, handler) {
if (events === undefined) {
return;
}
if (handler === undefined) {
return;
}
var handlers = this.handlers;
each(splitStr(events), function(event) {
handlers[event] = handlers[event] || [];
handlers[event].push(handler);
});
return this;
},
off: function(events, handler) {
if (events === undefined) {
return;
}
var handlers = this.handlers;
each(splitStr(events), function(event) {
if (!handler) {
delete handlers[event];
} else {
handlers[event] &&
handlers[event].splice(
inArray(handlers[event], handler),
1
);
}
});
return this;
},
emit: function(event, data) {
if (this.options.domEvents) {
triggerDomEvent(event, data);
}
var handlers =
this.handlers[event] && this.handlers[event].slice();
if (!handlers || !handlers.length) {
return;
}
data.type = event;
data.preventDefault = function() {
data.srcEvent.preventDefault();
};
var i = 0;
while (i < handlers.length) {
handlers[i](data);
i++;
}
},
destroy: function() {
this.element && toggleCssProps(this, false);
this.handlers = {};
this.session = {};
this.input.destroy();
this.element = null;
}
};
function toggleCssProps(manager, add) {
var element = manager.element;
if (!element.style) {
return;
}
var prop;
each(manager.options.cssProps, function(value, name) {
prop = prefixed(element.style, name);
if (add) {
manager.oldCssProps[prop] = element.style[prop];
element.style[prop] = value;
} else {
element.style[prop] = manager.oldCssProps[prop] || "";
}
});
if (!add) {
manager.oldCssProps = {};
}
}
function triggerDomEvent(event, data) {
var gestureEvent = document.createEvent("Event");
gestureEvent.initEvent(event, true, true);
gestureEvent.gesture = data;
data.target.dispatchEvent(gestureEvent);
}
assign(Hammer, {
INPUT_START: INPUT_START,
INPUT_MOVE: INPUT_MOVE,
INPUT_END: INPUT_END,
INPUT_CANCEL: INPUT_CANCEL,
STATE_POSSIBLE: STATE_POSSIBLE,
STATE_BEGAN: STATE_BEGAN,
STATE_CHANGED: STATE_CHANGED,
STATE_ENDED: STATE_ENDED,
STATE_RECOGNIZED: STATE_RECOGNIZED,
STATE_CANCELLED: STATE_CANCELLED,
STATE_FAILED: STATE_FAILED,
DIRECTION_NONE: DIRECTION_NONE,
DIRECTION_LEFT: DIRECTION_LEFT,
DIRECTION_RIGHT: DIRECTION_RIGHT,
DIRECTION_UP: DIRECTION_UP,
DIRECTION_DOWN: DIRECTION_DOWN,
DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: DIRECTION_VERTICAL,
DIRECTION_ALL: DIRECTION_ALL,
Manager: Manager,
Input: Input,
TouchAction: TouchAction,
TouchInput: TouchInput,
MouseInput: MouseInput,
PointerEventInput: PointerEventInput,
TouchMouseInput: TouchMouseInput,
SingleTouchInput: SingleTouchInput,
Recognizer: Recognizer,
AttrRecognizer: AttrRecognizer,
Tap: TapRecognizer,
Pan: PanRecognizer,
Swipe: SwipeRecognizer,
Pinch: PinchRecognizer,
Rotate: RotateRecognizer,
Press: PressRecognizer,
on: addEventListeners,
off: removeEventListeners,
each: each,
merge: merge,
extend: extend,
assign: assign,
inherit: inherit,
bindFn: bindFn,
prefixed: prefixed
});
var freeGlobal =
typeof window !== "undefined"
? window
: typeof self !== "undefined"
? self
: {};
freeGlobal.Hammer = Hammer;
if (typeof define === "function" && define.amd) {
define(function() {
return Hammer;
});
} else if (typeof module != "undefined" && module.exports) {
module.exports = Hammer;
} else {
window[exportName] = Hammer;
}
})(window, document, "Hammer");
},
{}
],
10: [
function(require, module, exports) {
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
var e, m;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var nBits = -7;
var i = isLE ? nBytes - 1 : 0;
var d = isLE ? -1 : 1;
var s = buffer[offset + i];
i += d;
e = s & ((1 << -nBits) - 1);
s >>= -nBits;
nBits += eLen;
for (
;
nBits > 0;
e = e * 256 + buffer[offset + i], i += d, nBits -= 8
) {}
m = e & ((1 << -nBits) - 1);
e >>= -nBits;
nBits += mLen;
for (
;
nBits > 0;
m = m * 256 + buffer[offset + i], i += d, nBits -= 8
) {}
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : (s ? -1 : 1) * Infinity;
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
};
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
var i = isLE ? 0 : nBytes - 1;
var d = isLE ? 1 : -1;
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
value = Math.abs(value);
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log(value) / Math.LN2);
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
}
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
for (
;
mLen >= 8;
buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8
) {}
e = (e << mLen) | m;
eLen += mLen;
for (
;
eLen > 0;
buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8
) {}
buffer[offset + i - d] |= s * 128;
};
},
{}
],
11: [
function(require, module, exports) {
(function(global) {
(function() {
var undefined;
var VERSION = "4.17.11";
var LARGE_ARRAY_SIZE = 200;
var CORE_ERROR_TEXT =
"Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",
FUNC_ERROR_TEXT = "Expected a function";
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var MAX_MEMOIZE_SIZE = 500;
var PLACEHOLDER = "__lodash_placeholder__";
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_BOUND_FLAG = 4,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_PARTIAL_FLAG = 32,
WRAP_PARTIAL_RIGHT_FLAG = 64,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256,
WRAP_FLIP_FLAG = 512;
var DEFAULT_TRUNC_LENGTH = 30,
DEFAULT_TRUNC_OMISSION = "...";
var HOT_COUNT = 800,
HOT_SPAN = 16;
var LAZY_FILTER_FLAG = 1,
LAZY_MAP_FLAG = 2,
LAZY_WHILE_FLAG = 3;
var INFINITY = 1 / 0,
MAX_SAFE_INTEGER = 9007199254740991,
MAX_INTEGER = 1.7976931348623157e308,
NAN = 0 / 0;
var MAX_ARRAY_LENGTH = 4294967295,
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
var wrapFlags = [
["ary", WRAP_ARY_FLAG],
["bind", WRAP_BIND_FLAG],
["bindKey", WRAP_BIND_KEY_FLAG],
["curry", WRAP_CURRY_FLAG],
["curryRight", WRAP_CURRY_RIGHT_FLAG],
["flip", WRAP_FLIP_FLAG],
["partial", WRAP_PARTIAL_FLAG],
["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
["rearg", WRAP_REARG_FLAG]
];
var argsTag = "[object Arguments]",
arrayTag = "[object Array]",
asyncTag = "[object AsyncFunction]",
boolTag = "[object Boolean]",
dateTag = "[object Date]",
domExcTag = "[object DOMException]",
errorTag = "[object Error]",
funcTag = "[object Function]",
genTag = "[object GeneratorFunction]",
mapTag = "[object Map]",
numberTag = "[object Number]",
nullTag = "[object Null]",
objectTag = "[object Object]",
promiseTag = "[object Promise]",
proxyTag = "[object Proxy]",
regexpTag = "[object RegExp]",
setTag = "[object Set]",
stringTag = "[object String]",
symbolTag = "[object Symbol]",
undefinedTag = "[object Undefined]",
weakMapTag = "[object WeakMap]",
weakSetTag = "[object WeakSet]";
var arrayBufferTag = "[object ArrayBuffer]",
dataViewTag = "[object DataView]",
float32Tag = "[object Float32Array]",
float64Tag = "[object Float64Array]",
int8Tag = "[object Int8Array]",
int16Tag = "[object Int16Array]",
int32Tag = "[object Int32Array]",
uint8Tag = "[object Uint8Array]",
uint8ClampedTag = "[object Uint8ClampedArray]",
uint16Tag = "[object Uint16Array]",
uint32Tag = "[object Uint32Array]";
var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
reUnescapedHtml = /[&<>"']/g,
reHasEscapedHtml = RegExp(reEscapedHtml.source),
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
var reEscape = /<%-([\s\S]+?)%>/g,
reEvaluate = /<%([\s\S]+?)%>/g,
reInterpolate = /<%=([\s\S]+?)%>/g;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
var reTrim = /^\s+|\s+$/g,
reTrimStart = /^\s+/,
reTrimEnd = /\s+$/;
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
reSplitDetails = /,? & /;
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
var reEscapeChar = /\\(\\)?/g;
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
var reFlags = /\w*$/;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var reIsOctal = /^0o[0-7]+$/i;
var reIsUint = /^(?:0|[1-9]\d*)$/;
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
var reNoMatch = /($^)/;
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
var rsAstralRange = "\\ud800-\\udfff",
rsComboMarksRange = "\\u0300-\\u036f",
reComboHalfMarksRange = "\\ufe20-\\ufe2f",
rsComboSymbolsRange = "\\u20d0-\\u20ff",
rsComboRange =
rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsDingbatRange = "\\u2700-\\u27bf",
rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff",
rsMathOpRange = "\\xac\\xb1\\xd7\\xf7",
rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",
rsPunctuationRange = "\\u2000-\\u206f",
rsSpaceRange =
" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",
rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde",
rsVarRange = "\\ufe0e\\ufe0f",
rsBreakRange =
rsMathOpRange +
rsNonCharRange +
rsPunctuationRange +
rsSpaceRange;
var rsApos = "['’]",
rsAstral = "[" + rsAstralRange + "]",
rsBreak = "[" + rsBreakRange + "]",
rsCombo = "[" + rsComboRange + "]",
rsDigits = "\\d+",
rsDingbat = "[" + rsDingbatRange + "]",
rsLower = "[" + rsLowerRange + "]",
rsMisc =
"[^" +
rsAstralRange +
rsBreakRange +
rsDigits +
rsDingbatRange +
rsLowerRange +
rsUpperRange +
"]",
rsFitz = "\\ud83c[\\udffb-\\udfff]",
rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")",
rsNonAstral = "[^" + rsAstralRange + "]",
rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}",
rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]",
rsUpper = "[" + rsUpperRange + "]",
rsZWJ = "\\u200d";
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")",
rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")",
rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?",
rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?",
reOptMod = rsModifier + "?",
rsOptVar = "[" + rsVarRange + "]?",
rsOptJoin =
"(?:" +
rsZWJ +
"(?:" +
[rsNonAstral, rsRegional, rsSurrPair].join("|") +
")" +
rsOptVar +
reOptMod +
")*",
rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",
rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsEmoji =
"(?:" +
[rsDingbat, rsRegional, rsSurrPair].join("|") +
")" +
rsSeq,
rsSymbol =
"(?:" +
[
rsNonAstral + rsCombo + "?",
rsCombo,
rsRegional,
rsSurrPair,
rsAstral
].join("|") +
")";
var reApos = RegExp(rsApos, "g");
var reComboMark = RegExp(rsCombo, "g");
var reUnicode = RegExp(
rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq,
"g"
);
var reUnicodeWord = RegExp(
[
rsUpper +
"?" +
rsLower +
"+" +
rsOptContrLower +
"(?=" +
[rsBreak, rsUpper, "$"].join("|") +
")",
rsMiscUpper +
"+" +
rsOptContrUpper +
"(?=" +
[rsBreak, rsUpper + rsMiscLower, "$"].join("|") +
")",
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
rsUpper + "+" + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join("|"),
"g"
);
var reHasUnicode = RegExp(
"[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"
);
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
var contextProps = [
"Array",
"Buffer",
"DataView",
"Date",
"Error",
"Float32Array",
"Float64Array",
"Function",
"Int8Array",
"Int16Array",
"Int32Array",
"Map",
"Math",
"Object",
"Promise",
"RegExp",
"Set",
"String",
"Symbol",
"TypeError",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"WeakMap",
"_",
"clearTimeout",
"isFinite",
"parseInt",
"setTimeout"
];
var templateCounter = -1;
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[
float64Tag
] = typedArrayTags[int8Tag] = typedArrayTags[
int16Tag
] = typedArrayTags[int32Tag] = typedArrayTags[
uint8Tag
] = typedArrayTags[uint8ClampedTag] = typedArrayTags[
uint16Tag
] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[
arrayBufferTag
] = typedArrayTags[boolTag] = typedArrayTags[
dataViewTag
] = typedArrayTags[dateTag] = typedArrayTags[
errorTag
] = typedArrayTags[funcTag] = typedArrayTags[
mapTag
] = typedArrayTags[numberTag] = typedArrayTags[
objectTag
] = typedArrayTags[regexpTag] = typedArrayTags[
setTag
] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[
arrayBufferTag
] = cloneableTags[dataViewTag] = cloneableTags[
boolTag
] = cloneableTags[dateTag] = cloneableTags[
float32Tag
] = cloneableTags[float64Tag] = cloneableTags[
int8Tag
] = cloneableTags[int16Tag] = cloneableTags[
int32Tag
] = cloneableTags[mapTag] = cloneableTags[
numberTag
] = cloneableTags[objectTag] = cloneableTags[
regexpTag
] = cloneableTags[setTag] = cloneableTags[
stringTag
] = cloneableTags[symbolTag] = cloneableTags[
uint8Tag
] = cloneableTags[uint8ClampedTag] = cloneableTags[
uint16Tag
] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[
weakMapTag
] = false;
var deburredLetters = {
À: "A",
Á: "A",
Â: "A",
Ã: "A",
Ä: "A",
Å: "A",
à: "a",
á: "a",
â: "a",
ã: "a",
ä: "a",
å: "a",
Ç: "C",
ç: "c",
Ð: "D",
ð: "d",
È: "E",
É: "E",
Ê: "E",
Ë: "E",
è: "e",
é: "e",
ê: "e",
ë: "e",
Ì: "I",
Í: "I",
Î: "I",
Ï: "I",
ì: "i",
í: "i",
î: "i",
ï: "i",
Ñ: "N",
ñ: "n",
Ò: "O",
Ó: "O",
Ô: "O",
Õ: "O",
Ö: "O",
Ø: "O",
ò: "o",
ó: "o",
ô: "o",
õ: "o",
ö: "o",
ø: "o",
Ù: "U",
Ú: "U",
Û: "U",
Ü: "U",
ù: "u",
ú: "u",
û: "u",
ü: "u",
Ý: "Y",
ý: "y",
ÿ: "y",
Æ: "Ae",
æ: "ae",
Þ: "Th",
þ: "th",
ß: "ss",
Ā: "A",
Ă: "A",
Ą: "A",
ā: "a",
ă: "a",
ą: "a",
Ć: "C",
Ĉ: "C",
Ċ: "C",
Č: "C",
ć: "c",
ĉ: "c",
ċ: "c",
č: "c",
Ď: "D",
Đ: "D",
ď: "d",
đ: "d",
Ē: "E",
Ĕ: "E",
Ė: "E",
Ę: "E",
Ě: "E",
ē: "e",
ĕ: "e",
ė: "e",
ę: "e",
ě: "e",
Ĝ: "G",
Ğ: "G",
Ġ: "G",
Ģ: "G",
ĝ: "g",
ğ: "g",
ġ: "g",
ģ: "g",
Ĥ: "H",
Ħ: "H",
ĥ: "h",
ħ: "h",
Ĩ: "I",
Ī: "I",
Ĭ: "I",
Į: "I",
İ: "I",
ĩ: "i",
ī: "i",
ĭ: "i",
į: "i",
ı: "i",
Ĵ: "J",
ĵ: "j",
Ķ: "K",
ķ: "k",
ĸ: "k",
Ĺ: "L",
Ļ: "L",
Ľ: "L",
Ŀ: "L",
Ł: "L",
ĺ: "l",
ļ: "l",
ľ: "l",
ŀ: "l",
ł: "l",
Ń: "N",
Ņ: "N",
Ň: "N",
Ŋ: "N",
ń: "n",
ņ: "n",
ň: "n",
ŋ: "n",
Ō: "O",
Ŏ: "O",
Ő: "O",
ō: "o",
ŏ: "o",
ő: "o",
Ŕ: "R",
Ŗ: "R",
Ř: "R",
ŕ: "r",
ŗ: "r",
ř: "r",
Ś: "S",
Ŝ: "S",
Ş: "S",
Š: "S",
ś: "s",
ŝ: "s",
ş: "s",
š: "s",
Ţ: "T",
Ť: "T",
Ŧ: "T",
ţ: "t",
ť: "t",
ŧ: "t",
Ũ: "U",
Ū: "U",
Ŭ: "U",
Ů: "U",
Ű: "U",
Ų: "U",
ũ: "u",
ū: "u",
ŭ: "u",
ů: "u",
ű: "u",
ų: "u",
Ŵ: "W",
ŵ: "w",
Ŷ: "Y",
ŷ: "y",
Ÿ: "Y",
Ź: "Z",
Ż: "Z",
Ž: "Z",
ź: "z",
ż: "z",
ž: "z",
IJ: "IJ",
ij: "ij",
Œ: "Oe",
œ: "oe",
ʼn: "'n",
ſ: "s"
};
var htmlEscapes = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;"
};
var htmlUnescapes = {
"&amp;": "&",
"&lt;": "<",
"&gt;": ">",
"&quot;": '"',
"&#39;": "'"
};
var stringEscapes = {
"\\": "\\",
"'": "'",
"\n": "n",
"\r": "r",
"\u2028": "u2028",
"\u2029": "u2029"
};
var freeParseFloat = parseFloat,
freeParseInt = parseInt;
var freeGlobal =
typeof global == "object" &&
global &&
global.Object === Object &&
global;
var freeSelf =
typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
var freeExports =
typeof exports == "object" &&
exports &&
!exports.nodeType &&
exports;
var freeModule =
freeExports &&
typeof module == "object" &&
module &&
!module.nodeType &&
module;
var moduleExports =
freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal.process;
var nodeUtil = (function() {
try {
var types =
freeModule &&
freeModule.require &&
freeModule.require("util").types;
if (types) {
return types;
}
return (
freeProcess &&
freeProcess.binding &&
freeProcess.binding("util")
);
} catch (e) {}
})();
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
nodeIsDate = nodeUtil && nodeUtil.isDate,
nodeIsMap = nodeUtil && nodeUtil.isMap,
nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
nodeIsSet = nodeUtil && nodeUtil.isSet,
nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
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 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;
}
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;
}
function arrayEachRight(array, iteratee) {
var length = array == null ? 0 : array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
}
function arrayEvery(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
}
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[--length];
}
while (length--) {
accumulator = iteratee(
accumulator,
array[length],
length,
array
);
}
return accumulator;
}
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
var asciiSize = baseProperty("length");
function asciiToArray(string) {
return string.split("");
}
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}
function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) {
result = key;
return false;
}
});
return result;
}
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 baseIndexOf(array, value, fromIndex) {
return value === value
? strictIndexOf(array, value, fromIndex)
: baseFindIndex(array, baseIsNaN, fromIndex);
}
function baseIndexOfWith(array, value, fromIndex, comparator) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (comparator(array[index], value)) {
return index;
}
}
return -1;
}
function baseIsNaN(value) {
return value !== value;
}
function baseMean(array, iteratee) {
var length = array == null ? 0 : array.length;
return length ? baseSum(array, iteratee) / length : NAN;
}
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined : object[key];
};
}
function baseReduce(
collection,
iteratee,
accumulator,
initAccum,
eachFunc
) {
eachFunc(collection, function(value, index, collection) {
accumulator = initAccum
? ((initAccum = false), value)
: iteratee(accumulator, value, index, collection);
});
return accumulator;
}
function baseSortBy(array, comparer) {
var length = array.length;
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
function baseSum(array, iteratee) {
var result,
index = -1,
length = array.length;
while (++index < length) {
var current = iteratee(array[index]);
if (current !== undefined) {
result = result === undefined ? current : result + current;
}
}
return result;
}
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
function baseToPairs(object, props) {
return arrayMap(props, function(key) {
return [key, object[key]];
});
}
function baseUnary(func) {
return function(value) {
return func(value);
};
}
function baseValues(object, props) {
return arrayMap(props, function(key) {
return object[key];
});
}
function cacheHas(cache, key) {
return cache.has(key);
}
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (
++index < length &&
baseIndexOf(chrSymbols, strSymbols[index], 0) > -1
) {}
return index;
}
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (
index-- &&
baseIndexOf(chrSymbols, strSymbols[index], 0) > -1
) {}
return index;
}
function countHolders(array, placeholder) {
var length = array.length,
result = 0;
while (length--) {
if (array[length] === placeholder) {
++result;
}
}
return result;
}
var deburrLetter = basePropertyOf(deburredLetters);
var escapeHtmlChar = basePropertyOf(htmlEscapes);
function escapeStringChar(chr) {
return "\\" + stringEscapes[chr];
}
function getValue(object, key) {
return object == null ? undefined : object[key];
}
function hasUnicode(string) {
return reHasUnicode.test(string);
}
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}
function iteratorToArray(iterator) {
var data,
result = [];
while (!(data = iterator.next()).done) {
result.push(data.value);
}
return result;
}
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
result[resIndex++] = index;
}
}
return result;
}
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
function setToPairs(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = [value, value];
});
return result;
}
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
function strictLastIndexOf(array, value, fromIndex) {
var index = fromIndex + 1;
while (index--) {
if (array[index] === value) {
return index;
}
}
return index;
}
function stringSize(string) {
return hasUnicode(string)
? unicodeSize(string)
: asciiSize(string);
}
function stringToArray(string) {
return hasUnicode(string)
? unicodeToArray(string)
: asciiToArray(string);
}
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
function unicodeSize(string) {
var result = (reUnicode.lastIndex = 0);
while (reUnicode.test(string)) {
++result;
}
return result;
}
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
var runInContext = function runInContext(context) {
context =
context == null
? root
: _.defaults(
root.Object(),
context,
_.pick(root, contextProps)
);
var Array = context.Array,
Date = context.Date,
Error = context.Error,
Function = context.Function,
Math = context.Math,
Object = context.Object,
RegExp = context.RegExp,
String = context.String,
TypeError = context.TypeError;
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
var coreJsData = context["__core-js_shared__"];
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var idCounter = 0;
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(
(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO) ||
""
);
return uid ? "Symbol(src)_1." + uid : "";
})();
var nativeObjectToString = objectProto.toString;
var objectCtorString = funcToString.call(Object);
var oldDash = root._;
var reIsNative = RegExp(
"^" +
funcToString
.call(hasOwnProperty)
.replace(reRegExpChar, "\\$&")
.replace(
/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,
"$1.*?"
) +
"$"
);
var Buffer = moduleExports ? context.Buffer : undefined,
Symbol = context.Symbol,
Uint8Array = context.Uint8Array,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
getPrototype = overArg(Object.getPrototypeOf, Object),
objectCreate = Object.create,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice,
spreadableSymbol = Symbol
? Symbol.isConcatSpreadable
: undefined,
symIterator = Symbol ? Symbol.iterator : undefined,
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
var defineProperty = (function() {
try {
var func = getNative(Object, "defineProperty");
func({}, "", {});
return func;
} catch (e) {}
})();
var ctxClearTimeout =
context.clearTimeout !== root.clearTimeout &&
context.clearTimeout,
ctxNow = Date && Date.now !== root.Date.now && Date.now,
ctxSetTimeout =
context.setTimeout !== root.setTimeout && context.setTimeout;
var nativeCeil = Math.ceil,
nativeFloor = Math.floor,
nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = context.isFinite,
nativeJoin = arrayProto.join,
nativeKeys = overArg(Object.keys, Object),
nativeMax = Math.max,
nativeMin = Math.min,
nativeNow = Date.now,
nativeParseInt = context.parseInt,
nativeRandom = Math.random,
nativeReverse = arrayProto.reverse;
var DataView = getNative(context, "DataView"),
Map = getNative(context, "Map"),
Promise = getNative(context, "Promise"),
Set = getNative(context, "Set"),
WeakMap = getNative(context, "WeakMap"),
nativeCreate = getNative(Object, "create");
var metaMap = WeakMap && new WeakMap();
var realNames = {};
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
function lodash(value) {
if (
isObjectLike(value) &&
!isArray(value) &&
!(value instanceof LazyWrapper)
) {
if (value instanceof LodashWrapper) {
return value;
}
if (hasOwnProperty.call(value, "__wrapped__")) {
return wrapperClone(value);
}
}
return new LodashWrapper(value);
}
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;
};
})();
function baseLodash() {}
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined;
}
lodash.templateSettings = {
escape: reEscape,
evaluate: reEvaluate,
interpolate: reInterpolate,
variable: "",
imports: { _: lodash }
};
lodash.prototype = baseLodash.prototype;
lodash.prototype.constructor = lodash;
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
function lazyClone() {
var result = new LazyWrapper(this.__wrapped__);
result.__actions__ = copyArray(this.__actions__);
result.__dir__ = this.__dir__;
result.__filtered__ = this.__filtered__;
result.__iteratees__ = copyArray(this.__iteratees__);
result.__takeCount__ = this.__takeCount__;
result.__views__ = copyArray(this.__views__);
return result;
}
function lazyReverse() {
if (this.__filtered__) {
var result = new LazyWrapper(this);
result.__dir__ = -1;
result.__filtered__ = true;
} else {
result = this.clone();
result.__dir__ *= -1;
}
return result;
}
function lazyValue() {
var array = this.__wrapped__.value(),
dir = this.__dir__,
isArr = isArray(array),
isRight = dir < 0,
arrLength = isArr ? array.length : 0,
view = getView(0, arrLength, this.__views__),
start = view.start,
end = view.end,
length = end - start,
index = isRight ? end : start - 1,
iteratees = this.__iteratees__,
iterLength = iteratees.length,
resIndex = 0,
takeCount = nativeMin(length, this.__takeCount__);
if (
!isArr ||
(!isRight && arrLength == length && takeCount == length)
) {
return baseWrapperValue(array, this.__actions__);
}
var result = [];
outer: while (length-- && resIndex < takeCount) {
index += dir;
var iterIndex = -1,
value = array[index];
while (++iterIndex < iterLength) {
var data = iteratees[iterIndex],
iteratee = data.iteratee,
type = data.type,
computed = iteratee(value);
if (type == LAZY_MAP_FLAG) {
value = computed;
} else if (!computed) {
if (type == LAZY_FILTER_FLAG) {
continue outer;
} else {
break outer;
}
}
}
result[resIndex++] = value;
}
return result;
}
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
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 hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
function hashHas(key) {
var data = this.__data__;
return nativeCreate
? data[key] !== undefined
: hasOwnProperty.call(data, key);
}
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] =
nativeCreate && value === undefined ? HASH_UNDEFINED : value;
return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(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 listCacheClear() {
this.__data__ = [];
this.size = 0;
}
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 listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
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;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
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]);
}
}
function mapCacheClear() {
this.size = 0;
this.__data__ = {
hash: new Hash(),
map: new (Map || ListCache)(),
string: new Hash()
};
}
function mapCacheDelete(key) {
var result = getMapData(this, key)["delete"](key);
this.size -= result ? 1 : 0;
return result;
}
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
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;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new MapCache();
while (++index < length) {
this.add(values[index]);
}
}
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
function setCacheHas(value) {
return this.__data__.has(value);
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function Stack(entries) {
var data = (this.__data__ = new ListCache(entries));
this.size = data.size;
}
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
function stackDelete(key) {
var data = this.__data__,
result = data["delete"](key);
this.size = data.size;
return result;
}
function stackGet(key) {
return this.__data__.get(key);
}
function stackHas(key) {
return this.__data__.has(key);
}
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map || 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;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if (
(inherited || hasOwnProperty.call(value, key)) &&
!(
skipIndexes &&
(key == "length" ||
(isBuff && (key == "offset" || key == "parent")) ||
(isType &&
(key == "buffer" ||
key == "byteLength" ||
key == "byteOffset")) ||
isIndex(key, length))
)
) {
result.push(key);
}
}
return result;
}
function arraySample(array) {
var length = array.length;
return length ? array[baseRandom(0, length - 1)] : undefined;
}
function arraySampleSize(array, n) {
return shuffleSelf(
copyArray(array),
baseClamp(n, 0, array.length)
);
}
function arrayShuffle(array) {
return shuffleSelf(copyArray(array));
}
function assignMergeValue(object, key, value) {
if (
(value !== undefined && !eq(object[key], value)) ||
(value === undefined && !(key in object))
) {
baseAssignValue(object, key, value);
}
}
function assignValue(object, key, value) {
var objValue = object[key];
if (
!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))
) {
baseAssignValue(object, key, value);
}
}
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
function baseAggregator(
collection,
setter,
iteratee,
accumulator
) {
baseEach(collection, function(value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
}
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
function baseAssignValue(object, key, value) {
if (key == "__proto__" && defineProperty) {
defineProperty(object, key, {
configurable: true,
enumerable: true,
value: value,
writable: true
});
} else {
object[key] = value;
}
}
function baseAt(object, paths) {
var index = -1,
length = paths.length,
result = Array(length),
skip = object == null;
while (++index < length) {
result[index] = skip ? undefined : get(object, paths[index]);
}
return result;
}
function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined) {
number = number <= upper ? number : upper;
}
if (lower !== undefined) {
number = number >= lower ? number : lower;
}
}
return number;
}
function baseClone(
value,
bitmask,
customizer,
key,
object,
stack
) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
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(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (
tag == objectTag ||
tag == argsTag ||
(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, isDeep);
}
}
stack || (stack = new Stack());
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (isSet(value)) {
value.forEach(function(subValue) {
result.add(
baseClone(
subValue,
bitmask,
customizer,
subValue,
value,
stack
)
);
});
return result;
}
if (isMap(value)) {
value.forEach(function(subValue, key) {
result.set(
key,
baseClone(
subValue,
bitmask,
customizer,
key,
value,
stack
)
);
});
return result;
}
var keysFunc = isFull
? isFlat
? getAllKeysIn
: getAllKeys
: isFlat
? keysIn
: keys;
var props = isArr ? undefined : keysFunc(value);
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
assignValue(
result,
key,
baseClone(subValue, bitmask, customizer, key, value, stack)
);
});
return result;
}
function baseConforms(source) {
var props = keys(source);
return function(object) {
return baseConformsTo(object, source, props);
};
}
function baseConformsTo(object, source, props) {
var length = props.length;
if (object == null) {
return !length;
}
object = Object(object);
while (length--) {
var key = props[length],
predicate = source[key],
value = object[key];
if (
(value === undefined && !(key in object)) ||
!predicate(value)
) {
return false;
}
}
return true;
}
function baseDelay(func, wait, args) {
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
return setTimeout(function() {
func.apply(undefined, args);
}, wait);
}
function baseDifference(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap(values, baseUnary(iteratee));
}
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
} else if (values.length >= LARGE_ARRAY_SIZE) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
}
outer: while (++index < length) {
var value = array[index],
computed = iteratee == null ? value : iteratee(value);
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
}
}
result.push(value);
} else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
return result;
}
var baseEach = createBaseEach(baseForOwn);
var baseEachRight = createBaseEach(baseForOwnRight, true);
function baseEvery(collection, predicate) {
var result = true;
baseEach(collection, function(value, index, collection) {
result = !!predicate(value, index, collection);
return result;
});
return result;
}
function baseExtremum(array, iteratee, comparator) {
var index = -1,
length = array.length;
while (++index < length) {
var value = array[index],
current = iteratee(value);
if (
current != null &&
(computed === undefined
? current === current && !isSymbol(current)
: comparator(current, computed))
) {
var computed = current,
result = value;
}
}
return result;
}
function baseFill(array, value, start, end) {
var length = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end =
end === undefined || end > length ? length : toInteger(end);
if (end < 0) {
end += length;
}
end = start > end ? 0 : toLength(end);
while (start < end) {
array[start++] = value;
}
return array;
}
function baseFilter(collection, predicate) {
var result = [];
baseEach(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result.push(value);
}
});
return result;
}
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) {
baseFlatten(
value,
depth - 1,
predicate,
isStrict,
result
);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
var baseFor = createBaseFor();
var baseForRight = createBaseFor(true);
function baseForOwn(object, iteratee) {
return object && baseFor(object, iteratee, keys);
}
function baseForOwnRight(object, iteratee) {
return object && baseForRight(object, iteratee, keys);
}
function baseFunctions(object, props) {
return arrayFilter(props, function(key) {
return isFunction(object[key]);
});
}
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return index && index == length ? object : undefined;
}
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object)
? result
: arrayPush(result, symbolsFunc(object));
}
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value)
? getRawTag(value)
: objectToString(value);
}
function baseGt(value, other) {
return value > other;
}
function baseHas(object, key) {
return object != null && hasOwnProperty.call(object, key);
}
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
function baseInRange(number, start, end) {
return (
number >= nativeMin(start, end) &&
number < nativeMax(start, end)
);
}
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? arrayIncludesWith : arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee) {
array = arrayMap(array, baseUnary(iteratee));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] =
!comparator &&
(iteratee || (length >= 120 && array.length >= 120))
? new SetCache(othIndex && array)
: undefined;
}
array = arrays[0];
var index = -1,
seen = caches[0];
outer: while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = comparator || value !== 0 ? value : 0;
if (
!(seen
? cacheHas(seen, computed)
: includes(result, computed, comparator))
) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (
!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))
) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
function baseInverter(object, setter, iteratee, accumulator) {
baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
}
function baseInvoke(object, path, args) {
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last(path))];
return func == null ? undefined : apply(func, object, args);
}
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
function baseIsArrayBuffer(value) {
return (
isObjectLike(value) && baseGetTag(value) == arrayBufferTag
);
}
function baseIsDate(value) {
return isObjectLike(value) && baseGetTag(value) == dateTag;
}
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (
value == null ||
other == null ||
(!isObjectLike(value) && !isObjectLike(other))
) {
return value !== value && other !== other;
}
return baseIsEqualDeep(
value,
other,
bitmask,
customizer,
baseIsEqual,
stack
);
}
function baseIsEqualDeep(
object,
other,
bitmask,
customizer,
equalFunc,
stack
) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = objIsArr ? arrayTag : getTag(object),
othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack());
return objIsArr || isTypedArray(object)
? equalArrays(
object,
other,
bitmask,
customizer,
equalFunc,
stack
)
: equalByTag(
object,
other,
objTag,
bitmask,
customizer,
equalFunc,
stack
);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped =
objIsObj && hasOwnProperty.call(object, "__wrapped__"),
othIsWrapped =
othIsObj && hasOwnProperty.call(other, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack());
return equalFunc(
objUnwrapped,
othUnwrapped,
bitmask,
customizer,
stack
);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack());
return equalObjects(
object,
other,
bitmask,
customizer,
equalFunc,
stack
);
}
function baseIsMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if (
noCustomizer && data[2]
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack();
if (customizer) {
var result = customizer(
objValue,
srcValue,
key,
object,
source,
stack
);
}
if (
!(result === undefined
? baseIsEqual(
srcValue,
objValue,
COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG,
customizer,
stack
)
: result)
) {
return false;
}
}
}
return true;
}
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
function baseIsRegExp(value) {
return isObjectLike(value) && baseGetTag(value) == regexpTag;
}
function baseIsSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
function baseIsTypedArray(value) {
return (
isObjectLike(value) &&
isLength(value.length) &&
!!typedArrayTags[baseGetTag(value)]
);
}
function baseIteratee(value) {
if (typeof value == "function") {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == "object") {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (
hasOwnProperty.call(object, key) &&
key != "constructor"
) {
result.push(key);
}
}
return result;
}
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (
!(
key == "constructor" &&
(isProto || !hasOwnProperty.call(object, key))
)
) {
result.push(key);
}
}
return result;
}
function baseLt(value, other) {
return value < other;
}
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);
});
return result;
}
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(
matchData[0][0],
matchData[0][1]
);
}
return function(object) {
return (
object === source || baseIsMatch(object, source, matchData)
);
};
}
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return objValue === undefined && objValue === srcValue
? hasIn(object, path)
: baseIsEqual(
srcValue,
objValue,
COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG
);
};
}
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(
source,
function(srcValue, key) {
if (isObject(srcValue)) {
stack || (stack = new Stack());
baseMergeDeep(
object,
source,
key,
srcIndex,
baseMerge,
customizer,
stack
);
} else {
var newValue = customizer
? customizer(
safeGet(object, key),
srcValue,
key + "",
object,
source,
stack
)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
},
keysIn
);
}
function baseMergeDeep(
object,
source,
key,
srcIndex,
mergeFunc,
customizer,
stack
) {
var objValue = safeGet(object, key),
srcValue = safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(
objValue,
srcValue,
key + "",
object,
source,
stack
)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray(srcValue),
isBuff = !isArr && isBuffer(srcValue),
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray(objValue)) {
newValue = objValue;
} else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
} else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
} else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
} else {
newValue = [];
}
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
} else if (!isObject(objValue) || isFunction(objValue)) {
newValue = initCloneObject(srcValue);
}
} else {
isCommon = false;
}
}
if (isCommon) {
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack["delete"](srcValue);
}
assignMergeValue(object, key, newValue);
}
function baseNth(array, n) {
var length = array.length;
if (!length) {
return;
}
n += n < 0 ? length : 0;
return isIndex(n, length) ? array[n] : undefined;
}
function baseOrderBy(collection, iteratees, orders) {
var index = -1;
iteratees = arrayMap(
iteratees.length ? iteratees : [identity],
baseUnary(getIteratee())
);
var result = baseMap(collection, function(
value,
key,
collection
) {
var criteria = arrayMap(iteratees, function(iteratee) {
return iteratee(value);
});
return { criteria: criteria, index: ++index, value: value };
});
return baseSortBy(result, function(object, other) {
return compareMultiple(object, other, orders);
});
}
function basePick(object, paths) {
return basePickBy(object, paths, function(value, path) {
return hasIn(object, path);
});
}
function basePickBy(object, paths, predicate) {
var index = -1,
length = paths.length,
result = {};
while (++index < length) {
var path = paths[index],
value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
}
}
return result;
}
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
function basePullAll(array, values, iteratee, comparator) {
var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
index = -1,
length = values.length,
seen = array;
if (array === values) {
values = copyArray(values);
}
if (iteratee) {
seen = arrayMap(array, baseUnary(iteratee));
}
while (++index < length) {
var fromIndex = 0,
value = values[index],
computed = iteratee ? iteratee(value) : value;
while (
(fromIndex = indexOf(
seen,
computed,
fromIndex,
comparator
)) > -1
) {
if (seen !== array) {
splice.call(seen, fromIndex, 1);
}
splice.call(array, fromIndex, 1);
}
}
return array;
}
function basePullAt(array, indexes) {
var length = array ? indexes.length : 0,
lastIndex = length - 1;
while (length--) {
var index = indexes[length];
if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splice.call(array, index, 1);
} else {
baseUnset(array, index);
}
}
}
return array;
}
function baseRandom(lower, upper) {
return (
lower + nativeFloor(nativeRandom() * (upper - lower + 1))
);
}
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(
nativeCeil((end - start) / (step || 1)),
0
),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
function baseRepeat(string, n) {
var result = "";
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result;
}
do {
if (n % 2) {
result += string;
}
n = nativeFloor(n / 2);
if (n) {
string += string;
}
} while (n);
return result;
}
function baseRest(func, start) {
return setToString(overRest(func, start, identity), func + "");
}
function baseSample(collection) {
return arraySample(values(collection));
}
function baseSampleSize(collection, n) {
var array = values(collection);
return shuffleSelf(array, baseClamp(n, 0, array.length));
}
function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = castPath(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = toKey(path[index]),
newValue = value;
if (index != lastIndex) {
var objValue = nested[key];
newValue = customizer
? customizer(objValue, key, nested)
: undefined;
if (newValue === undefined) {
newValue = isObject(objValue)
? objValue
: isIndex(path[index + 1])
? []
: {};
}
}
assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}
var baseSetData = !metaMap
? identity
: function(func, data) {
metaMap.set(func, data);
return func;
};
var baseSetToString = !defineProperty
? identity
: function(func, string) {
return defineProperty(func, "toString", {
configurable: true,
enumerable: false,
value: constant(string),
writable: true
});
};
function baseShuffle(collection) {
return shuffleSelf(values(collection));
}
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;
}
function baseSome(collection, predicate) {
var result;
baseEach(collection, function(value, index, collection) {
result = predicate(value, index, collection);
return !result;
});
return !!result;
}
function baseSortedIndex(array, value, retHighest) {
var low = 0,
high = array == null ? low : array.length;
if (
typeof value == "number" &&
value === value &&
high <= HALF_MAX_ARRAY_LENGTH
) {
while (low < high) {
var mid = (low + high) >>> 1,
computed = array[mid];
if (
computed !== null &&
!isSymbol(computed) &&
(retHighest ? computed <= value : computed < value)
) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
return baseSortedIndexBy(array, value, identity, retHighest);
}
function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
var low = 0,
high = array == null ? 0 : array.length,
valIsNaN = value !== value,
valIsNull = value === null,
valIsSymbol = isSymbol(value),
valIsUndefined = value === undefined;
while (low < high) {
var mid = nativeFloor((low + high) / 2),
computed = iteratee(array[mid]),
othIsDefined = computed !== undefined,
othIsNull = computed === null,
othIsReflexive = computed === computed,
othIsSymbol = isSymbol(computed);
if (valIsNaN) {
var setLow = retHighest || othIsReflexive;
} else if (valIsUndefined) {
setLow = othIsReflexive && (retHighest || othIsDefined);
} else if (valIsNull) {
setLow =
othIsReflexive &&
othIsDefined &&
(retHighest || !othIsNull);
} else if (valIsSymbol) {
setLow =
othIsReflexive &&
othIsDefined &&
!othIsNull &&
(retHighest || !othIsSymbol);
} else if (othIsNull || othIsSymbol) {
setLow = false;
} else {
setLow = retHighest ? computed <= value : computed < value;
}
if (setLow) {
low = mid + 1;
} else {
high = mid;
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
}
function baseSortedUniq(array, iteratee) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
if (!index || !eq(computed, seen)) {
var seen = computed;
result[resIndex++] = value === 0 ? 0 : value;
}
}
return result;
}
function baseToNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
return +value;
}
function baseToString(value) {
if (typeof value == "string") {
return value;
}
if (isArray(value)) {
return arrayMap(value, baseToString) + "";
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : "";
}
var result = value + "";
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
} else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
}
isCommon = false;
includes = cacheHas;
seen = new SetCache();
} else {
seen = iteratee ? [] : result;
}
outer: while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
} else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
function baseUpdate(object, path, updater, customizer) {
return baseSet(
object,
path,
updater(baseGet(object, path)),
customizer
);
}
function baseWhile(array, predicate, isDrop, fromRight) {
var length = array.length,
index = fromRight ? length : -1;
while (
(fromRight ? index-- : ++index < length) &&
predicate(array[index], index, array)
) {}
return isDrop
? baseSlice(
array,
fromRight ? 0 : index,
fromRight ? index + 1 : length
)
: baseSlice(
array,
fromRight ? index + 1 : 0,
fromRight ? length : index
);
}
function baseWrapperValue(value, actions) {
var result = value;
if (result instanceof LazyWrapper) {
result = result.value();
}
return arrayReduce(
actions,
function(result, action) {
return action.func.apply(
action.thisArg,
arrayPush([result], action.args)
);
},
result
);
}
function baseXor(arrays, iteratee, comparator) {
var length = arrays.length;
if (length < 2) {
return length ? baseUniq(arrays[0]) : [];
}
var index = -1,
result = Array(length);
while (++index < length) {
var array = arrays[index],
othIndex = -1;
while (++othIndex < length) {
if (othIndex != index) {
result[index] = baseDifference(
result[index] || array,
arrays[othIndex],
iteratee,
comparator
);
}
}
}
return baseUniq(baseFlatten(result, 1), iteratee, comparator);
}
function baseZipObject(props, values, assignFunc) {
var index = -1,
length = props.length,
valsLength = values.length,
result = {};
while (++index < length) {
var value = index < valsLength ? values[index] : undefined;
assignFunc(result, props[index], value);
}
return result;
}
function castArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
}
function castFunction(value) {
return typeof value == "function" ? value : identity;
}
function castPath(value, object) {
if (isArray(value)) {
return value;
}
return isKey(value, object)
? [value]
: stringToPath(toString(value));
}
var castRest = baseRest;
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return !start && end >= length
? array
: baseSlice(array, start, end);
}
var clearTimeout =
ctxClearTimeout ||
function(id) {
return root.clearTimeout(id);
};
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;
}
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(
arrayBuffer.byteLength
);
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
return result;
}
function cloneDataView(dataView, isDeep) {
var buffer = isDeep
? cloneArrayBuffer(dataView.buffer)
: dataView.buffer;
return new dataView.constructor(
buffer,
dataView.byteOffset,
dataView.byteLength
);
}
function cloneRegExp(regexp) {
var result = new regexp.constructor(
regexp.source,
reFlags.exec(regexp)
);
result.lastIndex = regexp.lastIndex;
return result;
}
function cloneSymbol(symbol) {
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep
? cloneArrayBuffer(typedArray.buffer)
: typedArray.buffer;
return new typedArray.constructor(
buffer,
typedArray.byteOffset,
typedArray.length
);
}
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined,
valIsNull = value === null,
valIsReflexive = value === value,
valIsSymbol = isSymbol(value);
var othIsDefined = other !== undefined,
othIsNull = other === null,
othIsReflexive = other === other,
othIsSymbol = isSymbol(other);
if (
(!othIsNull &&
!othIsSymbol &&
!valIsSymbol &&
value > other) ||
(valIsSymbol &&
othIsDefined &&
othIsReflexive &&
!othIsNull &&
!othIsSymbol) ||
(valIsNull && othIsDefined && othIsReflexive) ||
(!valIsDefined && othIsReflexive) ||
!valIsReflexive
) {
return 1;
}
if (
(!valIsNull &&
!valIsSymbol &&
!othIsSymbol &&
value < other) ||
(othIsSymbol &&
valIsDefined &&
valIsReflexive &&
!valIsNull &&
!valIsSymbol) ||
(othIsNull && valIsDefined && valIsReflexive) ||
(!othIsDefined && valIsReflexive) ||
!othIsReflexive
) {
return -1;
}
}
return 0;
}
function compareMultiple(object, other, orders) {
var index = -1,
objCriteria = object.criteria,
othCriteria = other.criteria,
length = objCriteria.length,
ordersLength = orders.length;
while (++index < length) {
var result = compareAscending(
objCriteria[index],
othCriteria[index]
);
if (result) {
if (index >= ordersLength) {
return result;
}
var order = orders[index];
return result * (order == "desc" ? -1 : 1);
}
}
return object.index - other.index;
}
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersLength = holders.length,
leftIndex = -1,
leftLength = partials.length,
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(leftLength + rangeLength),
isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[holders[argsIndex]] = args[argsIndex];
}
}
while (rangeLength--) {
result[leftIndex++] = args[argsIndex++];
}
return result;
}
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersIndex = -1,
holdersLength = holders.length,
rightIndex = -1,
rightLength = partials.length,
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(rangeLength + rightLength),
isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[offset + holders[holdersIndex]] = args[argsIndex++];
}
}
return result;
}
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
if (newValue === undefined) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
}
function copySymbols(source, object) {
return copyObject(source, getSymbols(source), object);
}
function copySymbolsIn(source, object) {
return copyObject(source, getSymbolsIn(source), object);
}
function createAggregator(setter, initializer) {
return function(collection, iteratee) {
var func = isArray(collection)
? arrayAggregator
: baseAggregator,
accumulator = initializer ? initializer() : {};
return func(
collection,
setter,
getIteratee(iteratee, 2),
accumulator
);
};
}
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;
});
}
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 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 createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
function wrapper() {
var fn =
this && this !== root && this instanceof wrapper
? Ctor
: func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = hasUnicode(string)
? stringToArray(string)
: undefined;
var chr = strSymbols ? strSymbols[0] : string.charAt(0);
var trailing = strSymbols
? castSlice(strSymbols, 1).join("")
: string.slice(1);
return chr[methodName]() + trailing;
};
}
function createCompounder(callback) {
return function(string) {
return arrayReduce(
words(deburr(string).replace(reApos, "")),
callback,
""
);
};
}
function createCtor(Ctor) {
return function() {
var args = arguments;
switch (args.length) {
case 0:
return new Ctor();
case 1:
return new Ctor(args[0]);
case 2:
return new Ctor(args[0], args[1]);
case 3:
return new Ctor(args[0], args[1], args[2]);
case 4:
return new Ctor(args[0], args[1], args[2], args[3]);
case 5:
return new Ctor(
args[0],
args[1],
args[2],
args[3],
args[4]
);
case 6:
return new Ctor(
args[0],
args[1],
args[2],
args[3],
args[4],
args[5]
);
case 7:
return new Ctor(
args[0],
args[1],
args[2],
args[3],
args[4],
args[5],
args[6]
);
}
var thisBinding = baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
return isObject(result) ? result : thisBinding;
};
}
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length,
placeholder = getHolder(wrapper);
while (index--) {
args[index] = arguments[index];
}
var holders =
length < 3 &&
args[0] !== placeholder &&
args[length - 1] !== placeholder
? []
: replaceHolders(args, placeholder);
length -= holders.length;
if (length < arity) {
return createRecurry(
func,
bitmask,
createHybrid,
wrapper.placeholder,
undefined,
args,
holders,
undefined,
undefined,
arity - length
);
}
var fn =
this && this !== root && this instanceof wrapper
? Ctor
: func;
return apply(fn, this, args);
}
return wrapper;
}
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
if (!isArrayLike(collection)) {
var iteratee = getIteratee(predicate, 3);
collection = keys(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 createFlow(fromRight) {
return flatRest(function(funcs) {
var length = funcs.length,
index = length,
prereq = LodashWrapper.prototype.thru;
if (fromRight) {
funcs.reverse();
}
while (index--) {
var func = funcs[index];
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (prereq && !wrapper && getFuncName(func) == "wrapper") {
var wrapper = new LodashWrapper([], true);
}
}
index = wrapper ? index : length;
while (++index < length) {
func = funcs[index];
var funcName = getFuncName(func),
data = funcName == "wrapper" ? getData(func) : undefined;
if (
data &&
isLaziable(data[0]) &&
data[1] ==
(WRAP_ARY_FLAG |
WRAP_CURRY_FLAG |
WRAP_PARTIAL_FLAG |
WRAP_REARG_FLAG) &&
!data[4].length &&
data[9] == 1
) {
wrapper = wrapper[getFuncName(data[0])].apply(
wrapper,
data[3]
);
} else {
wrapper =
func.length == 1 && isLaziable(func)
? wrapper[funcName]()
: wrapper.thru(func);
}
}
return function() {
var args = arguments,
value = args[0];
if (wrapper && args.length == 1 && isArray(value)) {
return wrapper.plant(value).value();
}
var index = 0,
result = length ? funcs[index].apply(this, args) : value;
while (++index < length) {
result = funcs[index].call(this, result);
}
return result;
};
});
}
function createHybrid(
func,
bitmask,
thisArg,
partials,
holders,
partialsRight,
holdersRight,
argPos,
ary,
arity
) {
var isAry = bitmask & WRAP_ARY_FLAG,
isBind = bitmask & WRAP_BIND_FLAG,
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
isCurried =
bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
isFlip = bitmask & WRAP_FLIP_FLAG,
Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper),
holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(
args,
partialsRight,
holdersRight,
isCurried
);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(
func,
bitmask,
createHybrid,
wrapper.placeholder,
thisArg,
args,
newHolders,
argPos,
ary,
arity - length
);
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary < length) {
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
function createInverter(setter, toIteratee) {
return function(object, iteratee) {
return baseInverter(object, setter, toIteratee(iteratee), {});
};
}
function createMathOperation(operator, defaultValue) {
return function(value, other) {
var result;
if (value === undefined && other === undefined) {
return defaultValue;
}
if (value !== undefined) {
result = value;
}
if (other !== undefined) {
if (result === undefined) {
return other;
}
if (typeof value == "string" || typeof other == "string") {
value = baseToString(value);
other = baseToString(other);
} else {
value = baseToNumber(value);
other = baseToNumber(other);
}
result = operator(value, other);
}
return result;
};
}
function createOver(arrayFunc) {
return flatRest(function(iteratees) {
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee) {
return apply(iteratee, thisArg, args);
});
});
});
}
function createPadding(length, chars) {
chars = chars === undefined ? " " : baseToString(chars);
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length) : chars;
}
var result = baseRepeat(
chars,
nativeCeil(length / stringSize(chars))
);
return hasUnicode(chars)
? castSlice(stringToArray(result), 0, length).join("")
: result.slice(0, length);
}
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
leftLength = partials.length,
args = Array(leftLength + argsLength),
fn =
this && this !== root && this instanceof wrapper
? Ctor
: func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}
function createRange(fromRight) {
return function(start, end, step) {
if (
step &&
typeof step != "number" &&
isIterateeCall(start, end, step)
) {
end = step = undefined;
}
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step =
step === undefined
? start < end
? 1
: -1
: toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
function createRelationalOperation(operator) {
return function(value, other) {
if (!(typeof value == "string" && typeof other == "string")) {
value = toNumber(value);
other = toNumber(other);
}
return operator(value, other);
};
}
function createRecurry(
func,
bitmask,
wrapFunc,
placeholder,
thisArg,
partials,
holders,
argPos,
ary,
arity
) {
var isCurry = bitmask & WRAP_CURRY_FLAG,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
newPartials = isCurry ? partials : undefined,
newPartialsRight = isCurry ? undefined : partials;
bitmask |= isCurry
? WRAP_PARTIAL_FLAG
: WRAP_PARTIAL_RIGHT_FLAG;
bitmask &= ~(isCurry
? WRAP_PARTIAL_RIGHT_FLAG
: WRAP_PARTIAL_FLAG);
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
}
var newData = [
func,
bitmask,
thisArg,
newPartials,
newHolders,
newPartialsRight,
newHoldersRight,
argPos,
ary,
arity
];
var result = wrapFunc.apply(undefined, newData);
if (isLaziable(func)) {
setData(result, newData);
}
result.placeholder = placeholder;
return setWrapToString(result, func, bitmask);
}
function createRound(methodName) {
var func = Math[methodName];
return function(number, precision) {
number = toNumber(number);
precision =
precision == null
? 0
: nativeMin(toInteger(precision), 292);
if (precision) {
var pair = (toString(number) + "e").split("e"),
value = func(pair[0] + "e" + (+pair[1] + precision));
pair = (toString(value) + "e").split("e");
return +(pair[0] + "e" + (+pair[1] - precision));
}
return func(number);
};
}
var createSet = !(
Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY
)
? noop
: function(values) {
return new Set(values);
};
function createToPairs(keysFunc) {
return function(object) {
var tag = getTag(object);
if (tag == mapTag) {
return mapToArray(object);
}
if (tag == setTag) {
return setToPairs(object);
}
return baseToPairs(object, keysFunc(object));
};
}
function createWrap(
func,
bitmask,
thisArg,
partials,
holders,
argPos,
ary,
arity
) {
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
if (!isBindKey && typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
partials = holders = undefined;
}
ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
arity = arity === undefined ? arity : toInteger(arity);
length -= holders ? holders.length : 0;
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
var partialsRight = partials,
holdersRight = holders;
partials = holders = undefined;
}
var data = isBindKey ? undefined : getData(func);
var newData = [
func,
bitmask,
thisArg,
partials,
holders,
partialsRight,
holdersRight,
argPos,
ary,
arity
];
if (data) {
mergeData(newData, data);
}
func = newData[0];
bitmask = newData[1];
thisArg = newData[2];
partials = newData[3];
holders = newData[4];
arity = newData[9] =
newData[9] === undefined
? isBindKey
? 0
: func.length
: nativeMax(newData[9] - length, 0);
if (
!arity &&
bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)
) {
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
var result = createBind(func, bitmask, thisArg);
} else if (
bitmask == WRAP_CURRY_FLAG ||
bitmask == WRAP_CURRY_RIGHT_FLAG
) {
result = createCurry(func, bitmask, arity);
} else if (
(bitmask == WRAP_PARTIAL_FLAG ||
bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) &&
!holders.length
) {
result = createPartial(func, bitmask, thisArg, partials);
} else {
result = createHybrid.apply(undefined, newData);
}
var setter = data ? baseSetData : setData;
return setWrapToString(setter(result, newData), func, bitmask);
}
function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (
objValue === undefined ||
(eq(objValue, objectProto[key]) &&
!hasOwnProperty.call(object, key))
) {
return srcValue;
}
return objValue;
}
function customDefaultsMerge(
objValue,
srcValue,
key,
object,
source,
stack
) {
if (isObject(objValue) && isObject(srcValue)) {
stack.set(srcValue, objValue);
baseMerge(
objValue,
srcValue,
undefined,
customDefaultsMerge,
stack
);
stack["delete"](srcValue);
}
return objValue;
}
function customOmitClone(value) {
return isPlainObject(value) ? undefined : value;
}
function equalArrays(
array,
other,
bitmask,
customizer,
equalFunc,
stack
) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
if (
arrLength != othLength &&
!(isPartial && othLength > arrLength)
) {
return false;
}
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen =
bitmask & COMPARE_UNORDERED_FLAG
? new SetCache()
: undefined;
stack.set(array, other);
stack.set(other, array);
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(
othValue,
arrValue,
index,
other,
array,
stack
)
: customizer(
arrValue,
othValue,
index,
array,
other,
stack
);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
if (seen) {
if (
!arraySome(other, function(othValue, othIndex) {
if (
!cacheHas(seen, othIndex) &&
(arrValue === othValue ||
equalFunc(
arrValue,
othValue,
bitmask,
customizer,
stack
))
) {
return seen.push(othIndex);
}
})
) {
result = false;
break;
}
} else if (
!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)
) {
result = false;
break;
}
}
stack["delete"](array);
stack["delete"](other);
return result;
}
function equalByTag(
object,
other,
tag,
bitmask,
customizer,
equalFunc,
stack
) {
switch (tag) {
case dataViewTag:
if (
object.byteLength != other.byteLength ||
object.byteOffset != other.byteOffset
) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if (
object.byteLength != other.byteLength ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))
) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
return eq(+object, +other);
case errorTag:
return (
object.name == other.name &&
object.message == other.message
);
case regexpTag:
case stringTag:
return object == other + "";
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object, other);
var result = equalArrays(
convert(object),
convert(other),
bitmask,
customizer,
equalFunc,
stack
);
stack["delete"](object);
return result;
case symbolTag:
if (symbolValueOf) {
return (
symbolValueOf.call(object) == symbolValueOf.call(other)
);
}
}
return false;
}
function equalObjects(
object,
other,
bitmask,
customizer,
equalFunc,
stack
) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (
!(isPartial
? key in other
: hasOwnProperty.call(other, key))
) {
return false;
}
}
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(
othValue,
objValue,
key,
other,
object,
stack
)
: customizer(
objValue,
othValue,
key,
object,
other,
stack
);
}
if (
!(compared === undefined
? objValue === othValue ||
equalFunc(
objValue,
othValue,
bitmask,
customizer,
stack
)
: compared)
) {
result = false;
break;
}
skipCtor || (skipCtor = key == "constructor");
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
if (
objCtor != othCtor &&
("constructor" in object && "constructor" in other) &&
!(
typeof objCtor == "function" &&
objCtor instanceof objCtor &&
typeof othCtor == "function" &&
othCtor instanceof othCtor
)
) {
result = false;
}
}
stack["delete"](object);
stack["delete"](other);
return result;
}
function flatRest(func) {
return setToString(
overRest(func, undefined, flatten),
func + ""
);
}
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
}
var getData = !metaMap
? noop
: function(func) {
return metaMap.get(func);
};
function getFuncName(func) {
var result = func.name + "",
array = realNames[result],
length = hasOwnProperty.call(realNames, result)
? array.length
: 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result;
}
function getHolder(func) {
var object = hasOwnProperty.call(lodash, "placeholder")
? lodash
: func;
return object.placeholder;
}
function getIteratee() {
var result = lodash.iteratee || iteratee;
result = result === iteratee ? baseIteratee : result;
return arguments.length
? result(arguments[0], arguments[1])
: result;
}
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == "string" ? "string" : "hash"]
: data.map;
}
function getMatchData(object) {
var result = keys(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;
}
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
var getSymbols = !nativeGetSymbols
? stubArray
: function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(
symbol
) {
return propertyIsEnumerable.call(object, symbol);
});
};
var getSymbolsIn = !nativeGetSymbols
? stubArray
: function(object) {
var result = [];
while (object) {
arrayPush(result, getSymbols(object));
object = getPrototype(object);
}
return result;
};
var getTag = baseGetTag;
if (
(DataView &&
getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map()) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set()) != setTag) ||
(WeakMap && getTag(new WeakMap()) != weakMapTag)
) {
getTag = function(value) {
var result = baseGetTag(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : "";
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag;
case mapCtorString:
return mapTag;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag;
case weakMapCtorString:
return weakMapTag;
}
}
return result;
};
}
function getView(start, end, transforms) {
var index = -1,
length = transforms.length;
while (++index < length) {
var data = transforms[index],
size = data.size;
switch (data.type) {
case "drop":
start += size;
break;
case "dropRight":
end -= size;
break;
case "take":
end = nativeMin(end, start + size);
break;
case "takeRight":
start = nativeMax(start, end - size);
break;
}
}
return { start: start, end: end };
}
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object == null ? 0 : object.length;
return (
!!length &&
isLength(length) &&
isIndex(key, length) &&
(isArray(object) || isArguments(object))
);
}
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
if (
length &&
typeof array[0] == "string" &&
hasOwnProperty.call(array, "index")
) {
result.index = array.index;
result.input = array.input;
}
return result;
}
function initCloneObject(object) {
return typeof object.constructor == "function" &&
!isPrototype(object)
? baseCreate(getPrototype(object))
: {};
}
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag:
case float64Tag:
case int8Tag:
case int16Tag:
case int32Tag:
case uint8Tag:
case uint8ClampedTag:
case uint16Tag:
case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
return new Ctor();
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
return cloneRegExp(object);
case setTag:
return new Ctor();
case symbolTag:
return cloneSymbol(object);
}
}
function insertWrapDetails(source, details) {
var length = details.length;
if (!length) {
return source;
}
var lastIndex = length - 1;
details[lastIndex] =
(length > 1 ? "& " : "") + details[lastIndex];
details = details.join(length > 2 ? ", " : " ");
return source.replace(
reWrapComment,
"{\n/* [wrapped with " + details + "] */\n"
);
}
function isFlattenable(value) {
return (
isArray(value) ||
isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol])
);
}
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return (
!!length &&
(type == "number" ||
(type != "symbol" && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length)
);
}
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;
}
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (
type == "number" ||
type == "symbol" ||
type == "boolean" ||
value == null ||
isSymbol(value)
) {
return true;
}
return (
reIsPlainProp.test(value) ||
!reIsDeepProp.test(value) ||
(object != null && value in Object(object))
);
}
function isKeyable(value) {
var type = typeof value;
return type == "string" ||
type == "number" ||
type == "symbol" ||
type == "boolean"
? value !== "__proto__"
: value === null;
}
function isLaziable(func) {
var funcName = getFuncName(func),
other = lodash[funcName];
if (
typeof other != "function" ||
!(funcName in LazyWrapper.prototype)
) {
return false;
}
if (func === other) {
return true;
}
var data = getData(other);
return !!data && func === data[0];
}
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
var isMaskable = coreJsData ? isFunction : stubFalse;
function isPrototype(value) {
var Ctor = value && value.constructor,
proto =
(typeof Ctor == "function" && Ctor.prototype) ||
objectProto;
return value === proto;
}
function isStrictComparable(value) {
return value === value && !isObject(value);
}
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return (
object[key] === srcValue &&
(srcValue !== undefined || key in Object(object))
);
};
}
function memoizeCapped(func) {
var result = memoize(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}
function mergeData(data, source) {
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon =
newBitmask <
(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
var isCombo =
(srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG) ||
(srcBitmask == WRAP_ARY_FLAG &&
bitmask == WRAP_REARG_FLAG &&
data[7].length <= source[8]) ||
(srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) &&
source[7].length <= source[8] &&
bitmask == WRAP_CURRY_FLAG);
if (!(isCommon || isCombo)) {
return data;
}
if (srcBitmask & WRAP_BIND_FLAG) {
data[2] = source[2];
newBitmask |=
bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials
? composeArgs(partials, value, source[4])
: value;
data[4] = partials
? replaceHolders(data[3], PLACEHOLDER)
: source[4];
}
value = source[5];
if (value) {
partials = data[5];
data[5] = partials
? composeArgsRight(partials, value, source[6])
: value;
data[6] = partials
? replaceHolders(data[5], PLACEHOLDER)
: source[6];
}
value = source[7];
if (value) {
data[7] = value;
}
if (srcBitmask & WRAP_ARY_FLAG) {
data[8] =
data[8] == null ? source[8] : nativeMin(data[8], source[8]);
}
if (data[9] == null) {
data[9] = source[9];
}
data[0] = source[0];
data[1] = newBitmask;
return data;
}
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
function objectToString(value) {
return nativeObjectToString.call(value);
}
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);
};
}
function parent(object, path) {
return path.length < 2
? object
: baseGet(object, baseSlice(path, 0, -1));
}
function reorder(array, indexes) {
var arrLength = array.length,
length = nativeMin(indexes.length, arrLength),
oldArray = copyArray(array);
while (length--) {
var index = indexes[length];
array[length] = isIndex(index, arrLength)
? oldArray[index]
: undefined;
}
return array;
}
function safeGet(object, key) {
if (key == "__proto__") {
return;
}
return object[key];
}
var setData = shortOut(baseSetData);
var setTimeout =
ctxSetTimeout ||
function(func, wait) {
return root.setTimeout(func, wait);
};
var setToString = shortOut(baseSetToString);
function setWrapToString(wrapper, reference, bitmask) {
var source = reference + "";
return setToString(
wrapper,
insertWrapDetails(
source,
updateWrapDetails(getWrapDetails(source), bitmask)
)
);
}
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);
};
}
function shuffleSelf(array, size) {
var index = -1,
length = array.length,
lastIndex = length - 1;
size = size === undefined ? length : size;
while (++index < size) {
var rand = baseRandom(index, lastIndex),
value = array[rand];
array[rand] = array[index];
array[index] = value;
}
array.length = size;
return array;
}
var stringToPath = memoizeCapped(function(string) {
var result = [];
if (string.charCodeAt(0) === 46) {
result.push("");
}
string.replace(rePropName, function(
match,
number,
quote,
subString
) {
result.push(
quote
? subString.replace(reEscapeChar, "$1")
: number || match
);
});
return result;
});
function toKey(value) {
if (typeof value == "string" || isSymbol(value)) {
return value;
}
var result = value + "";
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return func + "";
} catch (e) {}
}
return "";
}
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, function(pair) {
var value = "_." + pair[0];
if (bitmask & pair[1] && !arrayIncludes(details, value)) {
details.push(value);
}
});
return details.sort();
}
function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result = new LodashWrapper(
wrapper.__wrapped__,
wrapper.__chain__
);
result.__actions__ = copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values__ = wrapper.__values__;
return result;
}
function chunk(array, size, guard) {
if (
guard
? isIterateeCall(array, size, guard)
: size === undefined
) {
size = 1;
} else {
size = nativeMax(toInteger(size), 0);
}
var length = array == null ? 0 : array.length;
if (!length || size < 1) {
return [];
}
var index = 0,
resIndex = 0,
result = Array(nativeCeil(length / size));
while (index < length) {
result[resIndex++] = baseSlice(array, index, (index += size));
}
return result;
}
function compact(array) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[resIndex++] = value;
}
}
return result;
}
function concat() {
var length = arguments.length;
if (!length) {
return [];
}
var args = Array(length - 1),
array = arguments[0],
index = length;
while (index--) {
args[index - 1] = arguments[index];
}
return arrayPush(
isArray(array) ? copyArray(array) : [array],
baseFlatten(args, 1)
);
}
var difference = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(
array,
baseFlatten(values, 1, isArrayLikeObject, true)
)
: [];
});
var differenceBy = baseRest(function(array, values) {
var iteratee = last(values);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
return isArrayLikeObject(array)
? baseDifference(
array,
baseFlatten(values, 1, isArrayLikeObject, true),
getIteratee(iteratee, 2)
)
: [];
});
var differenceWith = baseRest(function(array, values) {
var comparator = last(values);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
}
return isArrayLikeObject(array)
? baseDifference(
array,
baseFlatten(values, 1, isArrayLikeObject, true),
undefined,
comparator
)
: [];
});
function drop(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined ? 1 : toInteger(n);
return baseSlice(array, n < 0 ? 0 : n, length);
}
function dropRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
}
function dropRightWhile(array, predicate) {
return array && array.length
? baseWhile(array, getIteratee(predicate, 3), true, true)
: [];
}
function dropWhile(array, predicate) {
return array && array.length
? baseWhile(array, getIteratee(predicate, 3), true)
: [];
}
function fill(array, value, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (
start &&
typeof start != "number" &&
isIterateeCall(array, value, start)
) {
start = 0;
end = length;
}
return baseFill(array, value, start, end);
}
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(length + index, 0);
}
return baseFindIndex(array, getIteratee(predicate, 3), index);
}
function findLastIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length - 1;
if (fromIndex !== undefined) {
index = toInteger(fromIndex);
index =
fromIndex < 0
? nativeMax(length + index, 0)
: nativeMin(index, length - 1);
}
return baseFindIndex(
array,
getIteratee(predicate, 3),
index,
true
);
}
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
function flattenDeep(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
}
function flattenDepth(array, depth) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
depth = depth === undefined ? 1 : toInteger(depth);
return baseFlatten(array, depth);
}
function fromPairs(pairs) {
var index = -1,
length = pairs == null ? 0 : pairs.length,
result = {};
while (++index < length) {
var pair = pairs[index];
result[pair[0]] = pair[1];
}
return result;
}
function head(array) {
return array && array.length ? array[0] : undefined;
}
function indexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseIndexOf(array, value, index);
}
function initial(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 0, -1) : [];
}
var intersection = baseRest(function(arrays) {
var mapped = arrayMap(arrays, castArrayLikeObject);
return mapped.length && mapped[0] === arrays[0]
? baseIntersection(mapped)
: [];
});
var intersectionBy = baseRest(function(arrays) {
var iteratee = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
if (iteratee === last(mapped)) {
iteratee = undefined;
} else {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0]
? baseIntersection(mapped, getIteratee(iteratee, 2))
: [];
});
var intersectionWith = baseRest(function(arrays) {
var comparator = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
comparator =
typeof comparator == "function" ? comparator : undefined;
if (comparator) {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0]
? baseIntersection(mapped, undefined, comparator)
: [];
});
function join(array, separator) {
return array == null ? "" : nativeJoin.call(array, separator);
}
function last(array) {
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}
function lastIndexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length;
if (fromIndex !== undefined) {
index = toInteger(fromIndex);
index =
index < 0
? nativeMax(length + index, 0)
: nativeMin(index, length - 1);
}
return value === value
? strictLastIndexOf(array, value, index)
: baseFindIndex(array, baseIsNaN, index, true);
}
function nth(array, n) {
return array && array.length
? baseNth(array, toInteger(n))
: undefined;
}
var pull = baseRest(pullAll);
function pullAll(array, values) {
return array && array.length && values && values.length
? basePullAll(array, values)
: array;
}
function pullAllBy(array, values, iteratee) {
return array && array.length && values && values.length
? basePullAll(array, values, getIteratee(iteratee, 2))
: array;
}
function pullAllWith(array, values, comparator) {
return array && array.length && values && values.length
? basePullAll(array, values, undefined, comparator)
: array;
}
var pullAt = flatRest(function(array, indexes) {
var length = array == null ? 0 : array.length,
result = baseAt(array, indexes);
basePullAt(
array,
arrayMap(indexes, function(index) {
return isIndex(index, length) ? +index : index;
}).sort(compareAscending)
);
return result;
});
function remove(array, predicate) {
var result = [];
if (!(array && array.length)) {
return result;
}
var index = -1,
indexes = [],
length = array.length;
predicate = getIteratee(predicate, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result.push(value);
indexes.push(index);
}
}
basePullAt(array, indexes);
return result;
}
function reverse(array) {
return array == null ? array : nativeReverse.call(array);
}
function slice(array, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (
end &&
typeof end != "number" &&
isIterateeCall(array, start, end)
) {
start = 0;
end = length;
} else {
start = start == null ? 0 : toInteger(start);
end = end === undefined ? length : toInteger(end);
}
return baseSlice(array, start, end);
}
function sortedIndex(array, value) {
return baseSortedIndex(array, value);
}
function sortedIndexBy(array, value, iteratee) {
return baseSortedIndexBy(
array,
value,
getIteratee(iteratee, 2)
);
}
function sortedIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
return index;
}
}
return -1;
}
function sortedLastIndex(array, value) {
return baseSortedIndex(array, value, true);
}
function sortedLastIndexBy(array, value, iteratee) {
return baseSortedIndexBy(
array,
value,
getIteratee(iteratee, 2),
true
);
}
function sortedLastIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value, true) - 1;
if (eq(array[index], value)) {
return index;
}
}
return -1;
}
function sortedUniq(array) {
return array && array.length ? baseSortedUniq(array) : [];
}
function sortedUniqBy(array, iteratee) {
return array && array.length
? baseSortedUniq(array, getIteratee(iteratee, 2))
: [];
}
function tail(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 1, length) : [];
}
function take(array, n, guard) {
if (!(array && array.length)) {
return [];
}
n = guard || n === undefined ? 1 : toInteger(n);
return baseSlice(array, 0, n < 0 ? 0 : n);
}
function takeRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, n < 0 ? 0 : n, length);
}
function takeRightWhile(array, predicate) {
return array && array.length
? baseWhile(array, getIteratee(predicate, 3), false, true)
: [];
}
function takeWhile(array, predicate) {
return array && array.length
? baseWhile(array, getIteratee(predicate, 3))
: [];
}
var union = baseRest(function(arrays) {
return baseUniq(
baseFlatten(arrays, 1, isArrayLikeObject, true)
);
});
var unionBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
return baseUniq(
baseFlatten(arrays, 1, isArrayLikeObject, true),
getIteratee(iteratee, 2)
);
});
var unionWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator =
typeof comparator == "function" ? comparator : undefined;
return baseUniq(
baseFlatten(arrays, 1, isArrayLikeObject, true),
undefined,
comparator
);
});
function uniq(array) {
return array && array.length ? baseUniq(array) : [];
}
function uniqBy(array, iteratee) {
return array && array.length
? baseUniq(array, getIteratee(iteratee, 2))
: [];
}
function uniqWith(array, comparator) {
comparator =
typeof comparator == "function" ? comparator : undefined;
return array && array.length
? baseUniq(array, undefined, comparator)
: [];
}
function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLikeObject(group)) {
length = nativeMax(group.length, length);
return true;
}
});
return baseTimes(length, function(index) {
return arrayMap(array, baseProperty(index));
});
}
function unzipWith(array, iteratee) {
if (!(array && array.length)) {
return [];
}
var result = unzip(array);
if (iteratee == null) {
return result;
}
return arrayMap(result, function(group) {
return apply(iteratee, undefined, group);
});
}
var without = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, values)
: [];
});
var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
var xorBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
return baseXor(
arrayFilter(arrays, isArrayLikeObject),
getIteratee(iteratee, 2)
);
});
var xorWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator =
typeof comparator == "function" ? comparator : undefined;
return baseXor(
arrayFilter(arrays, isArrayLikeObject),
undefined,
comparator
);
});
var zip = baseRest(unzip);
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
function zipObjectDeep(props, values) {
return baseZipObject(props || [], values || [], baseSet);
}
var zipWith = baseRest(function(arrays) {
var length = arrays.length,
iteratee = length > 1 ? arrays[length - 1] : undefined;
iteratee =
typeof iteratee == "function"
? (arrays.pop(), iteratee)
: undefined;
return unzipWith(arrays, iteratee);
});
function chain(value) {
var result = lodash(value);
result.__chain__ = true;
return result;
}
function tap(value, interceptor) {
interceptor(value);
return value;
}
function thru(value, interceptor) {
return interceptor(value);
}
var wrapperAt = flatRest(function(paths) {
var length = paths.length,
start = length ? paths[0] : 0,
value = this.__wrapped__,
interceptor = function(object) {
return baseAt(object, paths);
};
if (
length > 1 ||
this.__actions__.length ||
!(value instanceof LazyWrapper) ||
!isIndex(start)
) {
return this.thru(interceptor);
}
value = value.slice(start, +start + (length ? 1 : 0));
value.__actions__.push({
func: thru,
args: [interceptor],
thisArg: undefined
});
return new LodashWrapper(value, this.__chain__).thru(function(
array
) {
if (length && !array.length) {
array.push(undefined);
}
return array;
});
});
function wrapperChain() {
return chain(this);
}
function wrapperCommit() {
return new LodashWrapper(this.value(), this.__chain__);
}
function wrapperNext() {
if (this.__values__ === undefined) {
this.__values__ = toArray(this.value());
}
var done = this.__index__ >= this.__values__.length,
value = done ? undefined : this.__values__[this.__index__++];
return { done: done, value: value };
}
function wrapperToIterator() {
return this;
}
function wrapperPlant(value) {
var result,
parent = this;
while (parent instanceof baseLodash) {
var clone = wrapperClone(parent);
clone.__index__ = 0;
clone.__values__ = undefined;
if (result) {
previous.__wrapped__ = clone;
} else {
result = clone;
}
var previous = clone;
parent = parent.__wrapped__;
}
previous.__wrapped__ = value;
return result;
}
function wrapperReverse() {
var value = this.__wrapped__;
if (value instanceof LazyWrapper) {
var wrapped = value;
if (this.__actions__.length) {
wrapped = new LazyWrapper(this);
}
wrapped = wrapped.reverse();
wrapped.__actions__.push({
func: thru,
args: [reverse],
thisArg: undefined
});
return new LodashWrapper(wrapped, this.__chain__);
}
return this.thru(reverse);
}
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
var countBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
++result[key];
} else {
baseAssignValue(result, key, 1);
}
});
function every(collection, predicate, guard) {
var func = isArray(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}
return func(collection, getIteratee(predicate, 3));
}
function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, getIteratee(predicate, 3));
}
var find = createFind(findIndex);
var findLast = createFind(findLastIndex);
function flatMap(collection, iteratee) {
return baseFlatten(map(collection, iteratee), 1);
}
function flatMapDeep(collection, iteratee) {
return baseFlatten(map(collection, iteratee), INFINITY);
}
function flatMapDepth(collection, iteratee, depth) {
depth = depth === undefined ? 1 : toInteger(depth);
return baseFlatten(map(collection, iteratee), depth);
}
function forEach(collection, iteratee) {
var func = isArray(collection) ? arrayEach : baseEach;
return func(collection, getIteratee(iteratee, 3));
}
function forEachRight(collection, iteratee) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee, 3));
}
var groupBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
result[key].push(value);
} else {
baseAssignValue(result, key, [value]);
}
});
function includes(collection, value, fromIndex, guard) {
collection = isArrayLike(collection)
? collection
: values(collection);
fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
var length = collection.length;
if (fromIndex < 0) {
fromIndex = nativeMax(length + fromIndex, 0);
}
return isString(collection)
? fromIndex <= length &&
collection.indexOf(value, fromIndex) > -1
: !!length && baseIndexOf(collection, value, fromIndex) > -1;
}
var invokeMap = baseRest(function(collection, path, args) {
var index = -1,
isFunc = typeof path == "function",
result = isArrayLike(collection)
? Array(collection.length)
: [];
baseEach(collection, function(value) {
result[++index] = isFunc
? apply(path, value, args)
: baseInvoke(value, path, args);
});
return result;
});
var keyBy = createAggregator(function(result, value, key) {
baseAssignValue(result, key, value);
});
function map(collection, iteratee) {
var func = isArray(collection) ? arrayMap : baseMap;
return func(collection, getIteratee(iteratee, 3));
}
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
return [];
}
if (!isArray(iteratees)) {
iteratees = iteratees == null ? [] : [iteratees];
}
orders = guard ? undefined : orders;
if (!isArray(orders)) {
orders = orders == null ? [] : [orders];
}
return baseOrderBy(collection, iteratees, orders);
}
var partition = createAggregator(
function(result, value, key) {
result[key ? 0 : 1].push(value);
},
function() {
return [[], []];
}
);
function reduce(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduce : baseReduce,
initAccum = arguments.length < 3;
return func(
collection,
getIteratee(iteratee, 4),
accumulator,
initAccum,
baseEach
);
}
function reduceRight(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduceRight : baseReduce,
initAccum = arguments.length < 3;
return func(
collection,
getIteratee(iteratee, 4),
accumulator,
initAccum,
baseEachRight
);
}
function reject(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, negate(getIteratee(predicate, 3)));
}
function sample(collection) {
var func = isArray(collection) ? arraySample : baseSample;
return func(collection);
}
function sampleSize(collection, n, guard) {
if (
guard ? isIterateeCall(collection, n, guard) : n === undefined
) {
n = 1;
} else {
n = toInteger(n);
}
var func = isArray(collection)
? arraySampleSize
: baseSampleSize;
return func(collection, n);
}
function shuffle(collection) {
var func = isArray(collection) ? arrayShuffle : baseShuffle;
return func(collection);
}
function size(collection) {
if (collection == null) {
return 0;
}
if (isArrayLike(collection)) {
return isString(collection)
? stringSize(collection)
: collection.length;
}
var tag = getTag(collection);
if (tag == mapTag || tag == setTag) {
return collection.size;
}
return baseKeys(collection).length;
}
function some(collection, predicate, guard) {
var func = isArray(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}
return func(collection, getIteratee(predicate, 3));
}
var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
var length = iteratees.length;
if (
length > 1 &&
isIterateeCall(collection, iteratees[0], iteratees[1])
) {
iteratees = [];
} else if (
length > 2 &&
isIterateeCall(iteratees[0], iteratees[1], iteratees[2])
) {
iteratees = [iteratees[0]];
}
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
var now =
ctxNow ||
function() {
return root.Date.now();
};
function after(n, func) {
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
}
function ary(func, n, guard) {
n = guard ? undefined : n;
n = func && n == null ? func.length : n;
return createWrap(
func,
WRAP_ARY_FLAG,
undefined,
undefined,
undefined,
undefined,
n
);
}
function before(n, func) {
var result;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n > 0) {
result = func.apply(this, arguments);
}
if (n <= 1) {
func = undefined;
}
return result;
};
}
var bind = baseRest(function(func, thisArg, partials) {
var bitmask = WRAP_BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(func, bitmask, thisArg, partials, holders);
});
var bindKey = baseRest(function(object, key, partials) {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(key, bitmask, object, partials, holders);
});
function curry(func, arity, guard) {
arity = guard ? undefined : arity;
var result = createWrap(
func,
WRAP_CURRY_FLAG,
undefined,
undefined,
undefined,
undefined,
undefined,
arity
);
result.placeholder = curry.placeholder;
return result;
}
function curryRight(func, arity, guard) {
arity = guard ? undefined : arity;
var result = createWrap(
func,
WRAP_CURRY_RIGHT_FLAG,
undefined,
undefined,
undefined,
undefined,
undefined,
arity
);
result.placeholder = curryRight.placeholder;
return result;
}
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing
? nativeMax(toNumber(options.maxWait) || 0, wait)
: maxWait;
trailing =
"trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout(timerExpired, wait);
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
timeWaiting = wait - timeSinceLastCall;
return maxing
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
: timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
return (
lastCallTime === undefined ||
timeSinceLastCall >= wait ||
timeSinceLastCall < 0 ||
(maxing && timeSinceLastInvoke >= maxWait)
);
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined;
return result;
}
function cancel() {
if (timerId !== undefined) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
function flush() {
return timerId === undefined ? result : trailingEdge(now());
}
function debounced() {
var time = now(),
isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined) {
return leadingEdge(lastCallTime);
}
if (maxing) {
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
function flip(func) {
return createWrap(func, WRAP_FLIP_FLAG);
}
function memoize(func, resolver) {
if (
typeof func != "function" ||
(resolver != null && typeof resolver != "function")
) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
}
memoize.Cache = MapCache;
function negate(predicate) {
if (typeof predicate != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
var args = arguments;
switch (args.length) {
case 0:
return !predicate.call(this);
case 1:
return !predicate.call(this, args[0]);
case 2:
return !predicate.call(this, args[0], args[1]);
case 3:
return !predicate.call(this, args[0], args[1], args[2]);
}
return !predicate.apply(this, args);
};
}
function once(func) {
return before(2, func);
}
var overArgs = castRest(function(func, transforms) {
transforms =
transforms.length == 1 && isArray(transforms[0])
? arrayMap(transforms[0], baseUnary(getIteratee()))
: arrayMap(
baseFlatten(transforms, 1),
baseUnary(getIteratee())
);
var funcsLength = transforms.length;
return baseRest(function(args) {
var index = -1,
length = nativeMin(args.length, funcsLength);
while (++index < length) {
args[index] = transforms[index].call(this, args[index]);
}
return apply(func, this, args);
});
});
var partial = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partial));
return createWrap(
func,
WRAP_PARTIAL_FLAG,
undefined,
partials,
holders
);
});
var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
return createWrap(
func,
WRAP_PARTIAL_RIGHT_FLAG,
undefined,
partials,
holders
);
});
var rearg = flatRest(function(func, indexes) {
return createWrap(
func,
WRAP_REARG_FLAG,
undefined,
undefined,
undefined,
indexes
);
});
function rest(func, start) {
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start === undefined ? start : toInteger(start);
return baseRest(func, start);
}
function spread(func, start) {
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) {
var array = args[start],
otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing =
"trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
leading: leading,
maxWait: wait,
trailing: trailing
});
}
function unary(func) {
return ary(func, 1);
}
function wrap(value, wrapper) {
return partial(castFunction(wrapper), value);
}
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray(value) ? value : [value];
}
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
}
function cloneWith(value, customizer) {
customizer =
typeof customizer == "function" ? customizer : undefined;
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
}
function cloneDeep(value) {
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
function cloneDeepWith(value, customizer) {
customizer =
typeof customizer == "function" ? customizer : undefined;
return baseClone(
value,
CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG,
customizer
);
}
function conformsTo(object, source) {
return (
source == null || baseConformsTo(object, source, keys(source))
);
}
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
var gt = createRelationalOperation(baseGt);
var gte = createRelationalOperation(function(value, other) {
return value >= other;
});
var isArguments = baseIsArguments(
(function() {
return arguments;
})()
)
? baseIsArguments
: function(value) {
return (
isObjectLike(value) &&
hasOwnProperty.call(value, "callee") &&
!propertyIsEnumerable.call(value, "callee")
);
};
var isArray = Array.isArray;
var isArrayBuffer = nodeIsArrayBuffer
? baseUnary(nodeIsArrayBuffer)
: baseIsArrayBuffer;
function isArrayLike(value) {
return (
value != null && isLength(value.length) && !isFunction(value)
);
}
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
function isBoolean(value) {
return (
value === true ||
value === false ||
(isObjectLike(value) && baseGetTag(value) == boolTag)
);
}
var isBuffer = nativeIsBuffer || stubFalse;
var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
function isElement(value) {
return (
isObjectLike(value) &&
value.nodeType === 1 &&
!isPlainObject(value)
);
}
function isEmpty(value) {
if (value == null) {
return true;
}
if (
isArrayLike(value) &&
(isArray(value) ||
typeof value == "string" ||
typeof value.splice == "function" ||
isBuffer(value) ||
isTypedArray(value) ||
isArguments(value))
) {
return !value.length;
}
var tag = getTag(value);
if (tag == mapTag || tag == setTag) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
return true;
}
function isEqual(value, other) {
return baseIsEqual(value, other);
}
function isEqualWith(value, other, customizer) {
customizer =
typeof customizer == "function" ? customizer : undefined;
var result = customizer ? customizer(value, other) : undefined;
return result === undefined
? baseIsEqual(value, other, undefined, customizer)
: !!result;
}
function isError(value) {
if (!isObjectLike(value)) {
return false;
}
var tag = baseGetTag(value);
return (
tag == errorTag ||
tag == domExcTag ||
(typeof value.message == "string" &&
typeof value.name == "string" &&
!isPlainObject(value))
);
}
function isFinite(value) {
return typeof value == "number" && nativeIsFinite(value);
}
function isFunction(value) {
if (!isObject(value)) {
return false;
}
var tag = baseGetTag(value);
return (
tag == funcTag ||
tag == genTag ||
tag == asyncTag ||
tag == proxyTag
);
}
function isInteger(value) {
return typeof value == "number" && value == toInteger(value);
}
function isLength(value) {
return (
typeof value == "number" &&
value > -1 &&
value % 1 == 0 &&
value <= MAX_SAFE_INTEGER
);
}
function isObject(value) {
var type = typeof value;
return (
value != null && (type == "object" || type == "function")
);
}
function isObjectLike(value) {
return value != null && typeof value == "object";
}
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
function isMatch(object, source) {
return (
object === source ||
baseIsMatch(object, source, getMatchData(source))
);
}
function isMatchWith(object, source, customizer) {
customizer =
typeof customizer == "function" ? customizer : undefined;
return baseIsMatch(
object,
source,
getMatchData(source),
customizer
);
}
function isNaN(value) {
return isNumber(value) && value != +value;
}
function isNative(value) {
if (isMaskable(value)) {
throw new Error(CORE_ERROR_TEXT);
}
return baseIsNative(value);
}
function isNull(value) {
return value === null;
}
function isNil(value) {
return value == null;
}
function isNumber(value) {
return (
typeof value == "number" ||
(isObjectLike(value) && baseGetTag(value) == numberTag)
);
}
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor =
hasOwnProperty.call(proto, "constructor") &&
proto.constructor;
return (
typeof Ctor == "function" &&
Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString
);
}
var isRegExp = nodeIsRegExp
? baseUnary(nodeIsRegExp)
: baseIsRegExp;
function isSafeInteger(value) {
return (
isInteger(value) &&
value >= -MAX_SAFE_INTEGER &&
value <= MAX_SAFE_INTEGER
);
}
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
function isString(value) {
return (
typeof value == "string" ||
(!isArray(value) &&
isObjectLike(value) &&
baseGetTag(value) == stringTag)
);
}
function isSymbol(value) {
return (
typeof value == "symbol" ||
(isObjectLike(value) && baseGetTag(value) == symbolTag)
);
}
var isTypedArray = nodeIsTypedArray
? baseUnary(nodeIsTypedArray)
: baseIsTypedArray;
function isUndefined(value) {
return value === undefined;
}
function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == weakMapTag;
}
function isWeakSet(value) {
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
}
var lt = createRelationalOperation(baseLt);
var lte = createRelationalOperation(function(value, other) {
return value <= other;
});
function toArray(value) {
if (!value) {
return [];
}
if (isArrayLike(value)) {
return isString(value)
? stringToArray(value)
: copyArray(value);
}
if (symIterator && value[symIterator]) {
return iteratorToArray(value[symIterator]());
}
var tag = getTag(value),
func =
tag == mapTag
? mapToArray
: tag == setTag
? setToArray
: values;
return func(value);
}
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = value < 0 ? -1 : 1;
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
function toInteger(value) {
var result = toFinite(value),
remainder = result % 1;
return result === result
? remainder
? result - remainder
: result
: 0;
}
function toLength(value) {
return value
? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH)
: 0;
}
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;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
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;
}
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
function toSafeInteger(value) {
return value
? baseClamp(
toInteger(value),
-MAX_SAFE_INTEGER,
MAX_SAFE_INTEGER
)
: value === 0
? value
: 0;
}
function toString(value) {
return value == null ? "" : baseToString(value);
}
var assign = createAssigner(function(object, source) {
if (isPrototype(source) || isArrayLike(source)) {
copyObject(source, keys(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
var assignIn = createAssigner(function(object, source) {
copyObject(source, keysIn(source), object);
});
var assignInWith = createAssigner(function(
object,
source,
srcIndex,
customizer
) {
copyObject(source, keysIn(source), object, customizer);
});
var assignWith = createAssigner(function(
object,
source,
srcIndex,
customizer
) {
copyObject(source, keys(source), object, customizer);
});
var at = flatRest(baseAt);
function create(prototype, properties) {
var result = baseCreate(prototype);
return properties == null
? result
: baseAssign(result, properties);
}
var defaults = baseRest(function(object, sources) {
object = Object(object);
var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
while (++index < length) {
var source = sources[index];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];
if (
value === undefined ||
(eq(value, objectProto[key]) &&
!hasOwnProperty.call(object, key))
) {
object[key] = source[key];
}
}
}
return object;
});
var defaultsDeep = baseRest(function(args) {
args.push(undefined, customDefaultsMerge);
return apply(mergeWith, undefined, args);
});
function findKey(object, predicate) {
return baseFindKey(
object,
getIteratee(predicate, 3),
baseForOwn
);
}
function findLastKey(object, predicate) {
return baseFindKey(
object,
getIteratee(predicate, 3),
baseForOwnRight
);
}
function forIn(object, iteratee) {
return object == null
? object
: baseFor(object, getIteratee(iteratee, 3), keysIn);
}
function forInRight(object, iteratee) {
return object == null
? object
: baseForRight(object, getIteratee(iteratee, 3), keysIn);
}
function forOwn(object, iteratee) {
return object && baseForOwn(object, getIteratee(iteratee, 3));
}
function forOwnRight(object, iteratee) {
return (
object && baseForOwnRight(object, getIteratee(iteratee, 3))
);
}
function functions(object) {
return object == null
? []
: baseFunctions(object, keys(object));
}
function functionsIn(object) {
return object == null
? []
: baseFunctions(object, keysIn(object));
}
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
function has(object, path) {
return object != null && hasPath(object, path, baseHas);
}
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
var invert = createInverter(function(result, value, key) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
result[value] = key;
}, constant(identity));
var invertBy = createInverter(function(result, value, key) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}, getIteratee);
var invoke = baseRest(baseInvoke);
function keys(object) {
return isArrayLike(object)
? arrayLikeKeys(object)
: baseKeys(object);
}
function keysIn(object) {
return isArrayLike(object)
? arrayLikeKeys(object, true)
: baseKeysIn(object);
}
function mapKeys(object, iteratee) {
var result = {};
iteratee = getIteratee(iteratee, 3);
baseForOwn(object, function(value, key, object) {
baseAssignValue(result, iteratee(value, key, object), value);
});
return result;
}
function mapValues(object, iteratee) {
var result = {};
iteratee = getIteratee(iteratee, 3);
baseForOwn(object, function(value, key, object) {
baseAssignValue(result, key, iteratee(value, key, object));
});
return result;
}
var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
});
var mergeWith = createAssigner(function(
object,
source,
srcIndex,
customizer
) {
baseMerge(object, source, srcIndex, customizer);
});
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 | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG,
customOmitClone
);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
function omitBy(object, predicate) {
return pickBy(object, negate(getIteratee(predicate)));
}
var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, paths);
});
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = getIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
function result(object, path, defaultValue) {
path = castPath(path, object);
var index = -1,
length = path.length;
if (!length) {
length = 1;
object = undefined;
}
while (++index < length) {
var value =
object == null ? undefined : object[toKey(path[index])];
if (value === undefined) {
index = length;
value = defaultValue;
}
object = isFunction(value) ? value.call(object) : value;
}
return object;
}
function set(object, path, value) {
return object == null ? object : baseSet(object, path, value);
}
function setWith(object, path, value, customizer) {
customizer =
typeof customizer == "function" ? customizer : undefined;
return object == null
? object
: baseSet(object, path, value, customizer);
}
var toPairs = createToPairs(keys);
var toPairsIn = createToPairs(keysIn);
function transform(object, iteratee, accumulator) {
var isArr = isArray(object),
isArrLike = isArr || isBuffer(object) || isTypedArray(object);
iteratee = getIteratee(iteratee, 4);
if (accumulator == null) {
var Ctor = object && object.constructor;
if (isArrLike) {
accumulator = isArr ? new Ctor() : [];
} else if (isObject(object)) {
accumulator = isFunction(Ctor)
? baseCreate(getPrototype(object))
: {};
} else {
accumulator = {};
}
}
(isArrLike ? arrayEach : baseForOwn)(object, function(
value,
index,
object
) {
return iteratee(accumulator, value, index, object);
});
return accumulator;
}
function unset(object, path) {
return object == null ? true : baseUnset(object, path);
}
function update(object, path, updater) {
return object == null
? object
: baseUpdate(object, path, castFunction(updater));
}
function updateWith(object, path, updater, customizer) {
customizer =
typeof customizer == "function" ? customizer : undefined;
return object == null
? object
: baseUpdate(object, path, castFunction(updater), customizer);
}
function values(object) {
return object == null ? [] : baseValues(object, keys(object));
}
function valuesIn(object) {
return object == null ? [] : baseValues(object, keysIn(object));
}
function clamp(number, lower, upper) {
if (upper === undefined) {
upper = lower;
lower = undefined;
}
if (upper !== undefined) {
upper = toNumber(upper);
upper = upper === upper ? upper : 0;
}
if (lower !== undefined) {
lower = toNumber(lower);
lower = lower === lower ? lower : 0;
}
return baseClamp(toNumber(number), lower, upper);
}
function inRange(number, start, end) {
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
number = toNumber(number);
return baseInRange(number, start, end);
}
function random(lower, upper, floating) {
if (
floating &&
typeof floating != "boolean" &&
isIterateeCall(lower, upper, floating)
) {
upper = floating = undefined;
}
if (floating === undefined) {
if (typeof upper == "boolean") {
floating = upper;
upper = undefined;
} else if (typeof lower == "boolean") {
floating = lower;
lower = undefined;
}
}
if (lower === undefined && upper === undefined) {
lower = 0;
upper = 1;
} else {
lower = toFinite(lower);
if (upper === undefined) {
upper = lower;
lower = 0;
} else {
upper = toFinite(upper);
}
}
if (lower > upper) {
var temp = lower;
lower = upper;
upper = temp;
}
if (floating || lower % 1 || upper % 1) {
var rand = nativeRandom();
return nativeMin(
lower +
rand *
(upper -
lower +
freeParseFloat("1e-" + ((rand + "").length - 1))),
upper
);
}
return baseRandom(lower, upper);
}
var camelCase = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return result + (index ? capitalize(word) : word);
});
function capitalize(string) {
return upperFirst(toString(string).toLowerCase());
}
function deburr(string) {
string = toString(string);
return (
string &&
string.replace(reLatin, deburrLetter).replace(reComboMark, "")
);
}
function endsWith(string, target, position) {
string = toString(string);
target = baseToString(target);
var length = string.length;
position =
position === undefined
? length
: baseClamp(toInteger(position), 0, length);
var end = position;
position -= target.length;
return position >= 0 && string.slice(position, end) == target;
}
function escape(string) {
string = toString(string);
return string && reHasUnescapedHtml.test(string)
? string.replace(reUnescapedHtml, escapeHtmlChar)
: string;
}
function escapeRegExp(string) {
string = toString(string);
return string && reHasRegExpChar.test(string)
? string.replace(reRegExpChar, "\\$&")
: string;
}
var kebabCase = createCompounder(function(result, word, index) {
return result + (index ? "-" : "") + word.toLowerCase();
});
var lowerCase = createCompounder(function(result, word, index) {
return result + (index ? " " : "") + word.toLowerCase();
});
var lowerFirst = createCaseFirst("toLowerCase");
function pad(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
if (!length || strLength >= length) {
return string;
}
var mid = (length - strLength) / 2;
return (
createPadding(nativeFloor(mid), chars) +
string +
createPadding(nativeCeil(mid), chars)
);
}
function padEnd(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return length && strLength < length
? string + createPadding(length - strLength, chars)
: string;
}
function padStart(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return length && strLength < length
? createPadding(length - strLength, chars) + string
: string;
}
function parseInt(string, radix, guard) {
if (guard || radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
return nativeParseInt(
toString(string).replace(reTrimStart, ""),
radix || 0
);
}
function repeat(string, n, guard) {
if (
guard ? isIterateeCall(string, n, guard) : n === undefined
) {
n = 1;
} else {
n = toInteger(n);
}
return baseRepeat(toString(string), n);
}
function replace() {
var args = arguments,
string = toString(args[0]);
return args.length < 3
? string
: string.replace(args[1], args[2]);
}
var snakeCase = createCompounder(function(result, word, index) {
return result + (index ? "_" : "") + word.toLowerCase();
});
function split(string, separator, limit) {
if (
limit &&
typeof limit != "number" &&
isIterateeCall(string, separator, limit)
) {
separator = limit = undefined;
}
limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
if (!limit) {
return [];
}
string = toString(string);
if (
string &&
(typeof separator == "string" ||
(separator != null && !isRegExp(separator)))
) {
separator = baseToString(separator);
if (!separator && hasUnicode(string)) {
return castSlice(stringToArray(string), 0, limit);
}
}
return string.split(separator, limit);
}
var startCase = createCompounder(function(result, word, index) {
return result + (index ? " " : "") + upperFirst(word);
});
function startsWith(string, target, position) {
string = toString(string);
position =
position == null
? 0
: baseClamp(toInteger(position), 0, string.length);
target = baseToString(target);
return (
string.slice(position, position + target.length) == target
);
}
function template(string, options, guard) {
var settings = lodash.templateSettings;
if (guard && isIterateeCall(string, options, guard)) {
options = undefined;
}
string = toString(string);
options = assignInWith(
{},
options,
settings,
customDefaultsAssignIn
);
var imports = assignInWith(
{},
options.imports,
settings.imports,
customDefaultsAssignIn
),
importsKeys = keys(imports),
importsValues = baseValues(imports, importsKeys);
var isEscaping,
isEvaluating,
index = 0,
interpolate = options.interpolate || reNoMatch,
source = "__p += '";
var reDelimiters = RegExp(
(options.escape || reNoMatch).source +
"|" +
interpolate.source +
"|" +
(interpolate === reInterpolate ? reEsTemplate : reNoMatch)
.source +
"|" +
(options.evaluate || reNoMatch).source +
"|$",
"g"
);
var sourceURL =
"//# sourceURL=" +
("sourceURL" in options
? options.sourceURL
: "lodash.templateSources[" + ++templateCounter + "]") +
"\n";
string.replace(reDelimiters, function(
match,
escapeValue,
interpolateValue,
esTemplateValue,
evaluateValue,
offset
) {
interpolateValue || (interpolateValue = esTemplateValue);
source += string
.slice(index, offset)
.replace(reUnescapedString, escapeStringChar);
if (escapeValue) {
isEscaping = true;
source += "' +\n__e(" + escapeValue + ") +\n'";
}
if (evaluateValue) {
isEvaluating = true;
source += "';\n" + evaluateValue + ";\n__p += '";
}
if (interpolateValue) {
source +=
"' +\n((__t = (" +
interpolateValue +
")) == null ? '' : __t) +\n'";
}
index = offset + match.length;
return match;
});
source += "';\n";
var variable = options.variable;
if (!variable) {
source = "with (obj) {\n" + source + "\n}\n";
}
source = (isEvaluating
? source.replace(reEmptyStringLeading, "")
: source
)
.replace(reEmptyStringMiddle, "$1")
.replace(reEmptyStringTrailing, "$1;");
source =
"function(" +
(variable || "obj") +
") {\n" +
(variable ? "" : "obj || (obj = {});\n") +
"var __t, __p = ''" +
(isEscaping ? ", __e = _.escape" : "") +
(isEvaluating
? ", __j = Array.prototype.join;\n" +
"function print() { __p += __j.call(arguments, '') }\n"
: ";\n") +
source +
"return __p\n}";
var result = attempt(function() {
return Function(
importsKeys,
sourceURL + "return " + source
).apply(undefined, importsValues);
});
result.source = source;
if (isError(result)) {
throw result;
}
return result;
}
function toLower(value) {
return toString(value).toLowerCase();
}
function toUpper(value) {
return toString(value).toUpperCase();
}
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrim, "");
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars),
start = charsStartIndex(strSymbols, chrSymbols),
end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join("");
}
function trimEnd(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrimEnd, "");
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
return castSlice(strSymbols, 0, end).join("");
}
function trimStart(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrimStart, "");
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),
start = charsStartIndex(strSymbols, stringToArray(chars));
return castSlice(strSymbols, start).join("");
}
function truncate(string, options) {
var length = DEFAULT_TRUNC_LENGTH,
omission = DEFAULT_TRUNC_OMISSION;
if (isObject(options)) {
var separator =
"separator" in options ? options.separator : separator;
length =
"length" in options ? toInteger(options.length) : length;
omission =
"omission" in options
? baseToString(options.omission)
: omission;
}
string = toString(string);
var strLength = string.length;
if (hasUnicode(string)) {
var strSymbols = stringToArray(string);
strLength = strSymbols.length;
}
if (length >= strLength) {
return string;
}
var end = length - stringSize(omission);
if (end < 1) {
return omission;
}
var result = strSymbols
? castSlice(strSymbols, 0, end).join("")
: string.slice(0, end);
if (separator === undefined) {
return result + omission;
}
if (strSymbols) {
end += result.length - end;
}
if (isRegExp(separator)) {
if (string.slice(end).search(separator)) {
var match,
substring = result;
if (!separator.global) {
separator = RegExp(
separator.source,
toString(reFlags.exec(separator)) + "g"
);
}
separator.lastIndex = 0;
while ((match = separator.exec(substring))) {
var newEnd = match.index;
}
result = result.slice(
0,
newEnd === undefined ? end : newEnd
);
}
} else if (
string.indexOf(baseToString(separator), end) != end
) {
var index = result.lastIndexOf(separator);
if (index > -1) {
result = result.slice(0, index);
}
}
return result + omission;
}
function unescape(string) {
string = toString(string);
return string && reHasEscapedHtml.test(string)
? string.replace(reEscapedHtml, unescapeHtmlChar)
: string;
}
var upperCase = createCompounder(function(result, word, index) {
return result + (index ? " " : "") + word.toUpperCase();
});
var upperFirst = createCaseFirst("toUpperCase");
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined : pattern;
if (pattern === undefined) {
return hasUnicodeWord(string)
? unicodeWords(string)
: asciiWords(string);
}
return string.match(pattern) || [];
}
var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined, args);
} catch (e) {
return isError(e) ? e : new Error(e);
}
});
var bindAll = flatRest(function(object, methodNames) {
arrayEach(methodNames, function(key) {
key = toKey(key);
baseAssignValue(object, key, bind(object[key], object));
});
return object;
});
function cond(pairs) {
var length = pairs == null ? 0 : pairs.length,
toIteratee = getIteratee();
pairs = !length
? []
: arrayMap(pairs, function(pair) {
if (typeof pair[1] != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair[1]];
});
return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];
if (apply(pair[0], this, args)) {
return apply(pair[1], this, args);
}
}
});
}
function conforms(source) {
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
}
function constant(value) {
return function() {
return value;
};
}
function defaultTo(value, defaultValue) {
return value == null || value !== value ? defaultValue : value;
}
var flow = createFlow();
var flowRight = createFlow(true);
function identity(value) {
return value;
}
function iteratee(func) {
return baseIteratee(
typeof func == "function"
? func
: baseClone(func, CLONE_DEEP_FLAG)
);
}
function matches(source) {
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
}
function matchesProperty(path, srcValue) {
return baseMatchesProperty(
path,
baseClone(srcValue, CLONE_DEEP_FLAG)
);
}
var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
});
var methodOf = baseRest(function(object, args) {
return function(path) {
return baseInvoke(object, path, args);
};
});
function mixin(object, source, options) {
var props = keys(source),
methodNames = baseFunctions(source, props);
if (
options == null &&
!(isObject(source) && (methodNames.length || !props.length))
) {
options = source;
source = object;
object = this;
methodNames = baseFunctions(source, keys(source));
}
var chain =
!(isObject(options) && "chain" in options) ||
!!options.chain,
isFunc = isFunction(object);
arrayEach(methodNames, function(methodName) {
var func = source[methodName];
object[methodName] = func;
if (isFunc) {
object.prototype[methodName] = function() {
var chainAll = this.__chain__;
if (chain || chainAll) {
var result = object(this.__wrapped__),
actions = (result.__actions__ = copyArray(
this.__actions__
));
actions.push({
func: func,
args: arguments,
thisArg: object
});
result.__chain__ = chainAll;
return result;
}
return func.apply(
object,
arrayPush([this.value()], arguments)
);
};
}
});
return object;
}
function noConflict() {
if (root._ === this) {
root._ = oldDash;
}
return this;
}
function noop() {}
function nthArg(n) {
n = toInteger(n);
return baseRest(function(args) {
return baseNth(args, n);
});
}
var over = createOver(arrayMap);
var overEvery = createOver(arrayEvery);
var overSome = createOver(arraySome);
function property(path) {
return isKey(path)
? baseProperty(toKey(path))
: basePropertyDeep(path);
}
function propertyOf(object) {
return function(path) {
return object == null ? undefined : baseGet(object, path);
};
}
var range = createRange();
var rangeRight = createRange(true);
function stubArray() {
return [];
}
function stubFalse() {
return false;
}
function stubObject() {
return {};
}
function stubString() {
return "";
}
function stubTrue() {
return true;
}
function times(n, iteratee) {
n = toInteger(n);
if (n < 1 || n > MAX_SAFE_INTEGER) {
return [];
}
var index = MAX_ARRAY_LENGTH,
length = nativeMin(n, MAX_ARRAY_LENGTH);
iteratee = getIteratee(iteratee);
n -= MAX_ARRAY_LENGTH;
var result = baseTimes(length, iteratee);
while (++index < n) {
iteratee(index);
}
return result;
}
function toPath(value) {
if (isArray(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value)
? [value]
: copyArray(stringToPath(toString(value)));
}
function uniqueId(prefix) {
var id = ++idCounter;
return toString(prefix) + id;
}
var add = createMathOperation(function(augend, addend) {
return augend + addend;
}, 0);
var ceil = createRound("ceil");
var divide = createMathOperation(function(dividend, divisor) {
return dividend / divisor;
}, 1);
var floor = createRound("floor");
function max(array) {
return array && array.length
? baseExtremum(array, identity, baseGt)
: undefined;
}
function maxBy(array, iteratee) {
return array && array.length
? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
: undefined;
}
function mean(array) {
return baseMean(array, identity);
}
function meanBy(array, iteratee) {
return baseMean(array, getIteratee(iteratee, 2));
}
function min(array) {
return array && array.length
? baseExtremum(array, identity, baseLt)
: undefined;
}
function minBy(array, iteratee) {
return array && array.length
? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
: undefined;
}
var multiply = createMathOperation(function(
multiplier,
multiplicand
) {
return multiplier * multiplicand;
},
1);
var round = createRound("round");
var subtract = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
}, 0);
function sum(array) {
return array && array.length ? baseSum(array, identity) : 0;
}
function sumBy(array, iteratee) {
return array && array.length
? baseSum(array, getIteratee(iteratee, 2))
: 0;
}
lodash.after = after;
lodash.ary = ary;
lodash.assign = assign;
lodash.assignIn = assignIn;
lodash.assignInWith = assignInWith;
lodash.assignWith = assignWith;
lodash.at = at;
lodash.before = before;
lodash.bind = bind;
lodash.bindAll = bindAll;
lodash.bindKey = bindKey;
lodash.castArray = castArray;
lodash.chain = chain;
lodash.chunk = chunk;
lodash.compact = compact;
lodash.concat = concat;
lodash.cond = cond;
lodash.conforms = conforms;
lodash.constant = constant;
lodash.countBy = countBy;
lodash.create = create;
lodash.curry = curry;
lodash.curryRight = curryRight;
lodash.debounce = debounce;
lodash.defaults = defaults;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer;
lodash.delay = delay;
lodash.difference = difference;
lodash.differenceBy = differenceBy;
lodash.differenceWith = differenceWith;
lodash.drop = drop;
lodash.dropRight = dropRight;
lodash.dropRightWhile = dropRightWhile;
lodash.dropWhile = dropWhile;
lodash.fill = fill;
lodash.filter = filter;
lodash.flatMap = flatMap;
lodash.flatMapDeep = flatMapDeep;
lodash.flatMapDepth = flatMapDepth;
lodash.flatten = flatten;
lodash.flattenDeep = flattenDeep;
lodash.flattenDepth = flattenDepth;
lodash.flip = flip;
lodash.flow = flow;
lodash.flowRight = flowRight;
lodash.fromPairs = fromPairs;
lodash.functions = functions;
lodash.functionsIn = functionsIn;
lodash.groupBy = groupBy;
lodash.initial = initial;
lodash.intersection = intersection;
lodash.intersectionBy = intersectionBy;
lodash.intersectionWith = intersectionWith;
lodash.invert = invert;
lodash.invertBy = invertBy;
lodash.invokeMap = invokeMap;
lodash.iteratee = iteratee;
lodash.keyBy = keyBy;
lodash.keys = keys;
lodash.keysIn = keysIn;
lodash.map = map;
lodash.mapKeys = mapKeys;
lodash.mapValues = mapValues;
lodash.matches = matches;
lodash.matchesProperty = matchesProperty;
lodash.memoize = memoize;
lodash.merge = merge;
lodash.mergeWith = mergeWith;
lodash.method = method;
lodash.methodOf = methodOf;
lodash.mixin = mixin;
lodash.negate = negate;
lodash.nthArg = nthArg;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once;
lodash.orderBy = orderBy;
lodash.over = over;
lodash.overArgs = overArgs;
lodash.overEvery = overEvery;
lodash.overSome = overSome;
lodash.partial = partial;
lodash.partialRight = partialRight;
lodash.partition = partition;
lodash.pick = pick;
lodash.pickBy = pickBy;
lodash.property = property;
lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAll = pullAll;
lodash.pullAllBy = pullAllBy;
lodash.pullAllWith = pullAllWith;
lodash.pullAt = pullAt;
lodash.range = range;
lodash.rangeRight = rangeRight;
lodash.rearg = rearg;
lodash.reject = reject;
lodash.remove = remove;
lodash.rest = rest;
lodash.reverse = reverse;
lodash.sampleSize = sampleSize;
lodash.set = set;
lodash.setWith = setWith;
lodash.shuffle = shuffle;
lodash.slice = slice;
lodash.sortBy = sortBy;
lodash.sortedUniq = sortedUniq;
lodash.sortedUniqBy = sortedUniqBy;
lodash.split = split;
lodash.spread = spread;
lodash.tail = tail;
lodash.take = take;
lodash.takeRight = takeRight;
lodash.takeRightWhile = takeRightWhile;
lodash.takeWhile = takeWhile;
lodash.tap = tap;
lodash.throttle = throttle;
lodash.thru = thru;
lodash.toArray = toArray;
lodash.toPairs = toPairs;
lodash.toPairsIn = toPairsIn;
lodash.toPath = toPath;
lodash.toPlainObject = toPlainObject;
lodash.transform = transform;
lodash.unary = unary;
lodash.union = union;
lodash.unionBy = unionBy;
lodash.unionWith = unionWith;
lodash.uniq = uniq;
lodash.uniqBy = uniqBy;
lodash.uniqWith = uniqWith;
lodash.unset = unset;
lodash.unzip = unzip;
lodash.unzipWith = unzipWith;
lodash.update = update;
lodash.updateWith = updateWith;
lodash.values = values;
lodash.valuesIn = valuesIn;
lodash.without = without;
lodash.words = words;
lodash.wrap = wrap;
lodash.xor = xor;
lodash.xorBy = xorBy;
lodash.xorWith = xorWith;
lodash.zip = zip;
lodash.zipObject = zipObject;
lodash.zipObjectDeep = zipObjectDeep;
lodash.zipWith = zipWith;
lodash.entries = toPairs;
lodash.entriesIn = toPairsIn;
lodash.extend = assignIn;
lodash.extendWith = assignInWith;
mixin(lodash, lodash);
lodash.add = add;
lodash.attempt = attempt;
lodash.camelCase = camelCase;
lodash.capitalize = capitalize;
lodash.ceil = ceil;
lodash.clamp = clamp;
lodash.clone = clone;
lodash.cloneDeep = cloneDeep;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
lodash.conformsTo = conformsTo;
lodash.deburr = deburr;
lodash.defaultTo = defaultTo;
lodash.divide = divide;
lodash.endsWith = endsWith;
lodash.eq = eq;
lodash.escape = escape;
lodash.escapeRegExp = escapeRegExp;
lodash.every = every;
lodash.find = find;
lodash.findIndex = findIndex;
lodash.findKey = findKey;
lodash.findLast = findLast;
lodash.findLastIndex = findLastIndex;
lodash.findLastKey = findLastKey;
lodash.floor = floor;
lodash.forEach = forEach;
lodash.forEachRight = forEachRight;
lodash.forIn = forIn;
lodash.forInRight = forInRight;
lodash.forOwn = forOwn;
lodash.forOwnRight = forOwnRight;
lodash.get = get;
lodash.gt = gt;
lodash.gte = gte;
lodash.has = has;
lodash.hasIn = hasIn;
lodash.head = head;
lodash.identity = identity;
lodash.includes = includes;
lodash.indexOf = indexOf;
lodash.inRange = inRange;
lodash.invoke = invoke;
lodash.isArguments = isArguments;
lodash.isArray = isArray;
lodash.isArrayBuffer = isArrayBuffer;
lodash.isArrayLike = isArrayLike;
lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean;
lodash.isBuffer = isBuffer;
lodash.isDate = isDate;
lodash.isElement = isElement;
lodash.isEmpty = isEmpty;
lodash.isEqual = isEqual;
lodash.isEqualWith = isEqualWith;
lodash.isError = isError;
lodash.isFinite = isFinite;
lodash.isFunction = isFunction;
lodash.isInteger = isInteger;
lodash.isLength = isLength;
lodash.isMap = isMap;
lodash.isMatch = isMatch;
lodash.isMatchWith = isMatchWith;
lodash.isNaN = isNaN;
lodash.isNative = isNative;
lodash.isNil = isNil;
lodash.isNull = isNull;
lodash.isNumber = isNumber;
lodash.isObject = isObject;
lodash.isObjectLike = isObjectLike;
lodash.isPlainObject = isPlainObject;
lodash.isRegExp = isRegExp;
lodash.isSafeInteger = isSafeInteger;
lodash.isSet = isSet;
lodash.isString = isString;
lodash.isSymbol = isSymbol;
lodash.isTypedArray = isTypedArray;
lodash.isUndefined = isUndefined;
lodash.isWeakMap = isWeakMap;
lodash.isWeakSet = isWeakSet;
lodash.join = join;
lodash.kebabCase = kebabCase;
lodash.last = last;
lodash.lastIndexOf = lastIndexOf;
lodash.lowerCase = lowerCase;
lodash.lowerFirst = lowerFirst;
lodash.lt = lt;
lodash.lte = lte;
lodash.max = max;
lodash.maxBy = maxBy;
lodash.mean = mean;
lodash.meanBy = meanBy;
lodash.min = min;
lodash.minBy = minBy;
lodash.stubArray = stubArray;
lodash.stubFalse = stubFalse;
lodash.stubObject = stubObject;
lodash.stubString = stubString;
lodash.stubTrue = stubTrue;
lodash.multiply = multiply;
lodash.nth = nth;
lodash.noConflict = noConflict;
lodash.noop = noop;
lodash.now = now;
lodash.pad = pad;
lodash.padEnd = padEnd;
lodash.padStart = padStart;
lodash.parseInt = parseInt;
lodash.random = random;
lodash.reduce = reduce;
lodash.reduceRight = reduceRight;
lodash.repeat = repeat;
lodash.replace = replace;
lodash.result = result;
lodash.round = round;
lodash.runInContext = runInContext;
lodash.sample = sample;
lodash.size = size;
lodash.snakeCase = snakeCase;
lodash.some = some;
lodash.sortedIndex = sortedIndex;
lodash.sortedIndexBy = sortedIndexBy;
lodash.sortedIndexOf = sortedIndexOf;
lodash.sortedLastIndex = sortedLastIndex;
lodash.sortedLastIndexBy = sortedLastIndexBy;
lodash.sortedLastIndexOf = sortedLastIndexOf;
lodash.startCase = startCase;
lodash.startsWith = startsWith;
lodash.subtract = subtract;
lodash.sum = sum;
lodash.sumBy = sumBy;
lodash.template = template;
lodash.times = times;
lodash.toFinite = toFinite;
lodash.toInteger = toInteger;
lodash.toLength = toLength;
lodash.toLower = toLower;
lodash.toNumber = toNumber;
lodash.toSafeInteger = toSafeInteger;
lodash.toString = toString;
lodash.toUpper = toUpper;
lodash.trim = trim;
lodash.trimEnd = trimEnd;
lodash.trimStart = trimStart;
lodash.truncate = truncate;
lodash.unescape = unescape;
lodash.uniqueId = uniqueId;
lodash.upperCase = upperCase;
lodash.upperFirst = upperFirst;
lodash.each = forEach;
lodash.eachRight = forEachRight;
lodash.first = head;
mixin(
lodash,
(function() {
var source = {};
baseForOwn(lodash, function(func, methodName) {
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
source[methodName] = func;
}
});
return source;
})(),
{ chain: false }
);
lodash.VERSION = VERSION;
arrayEach(
[
"bind",
"bindKey",
"curry",
"curryRight",
"partial",
"partialRight"
],
function(methodName) {
lodash[methodName].placeholder = lodash;
}
);
arrayEach(["drop", "take"], function(methodName, index) {
LazyWrapper.prototype[methodName] = function(n) {
n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
var result =
this.__filtered__ && !index
? new LazyWrapper(this)
: this.clone();
if (result.__filtered__) {
result.__takeCount__ = nativeMin(n, result.__takeCount__);
} else {
result.__views__.push({
size: nativeMin(n, MAX_ARRAY_LENGTH),
type: methodName + (result.__dir__ < 0 ? "Right" : "")
});
}
return result;
};
LazyWrapper.prototype[methodName + "Right"] = function(n) {
return this.reverse()
[methodName](n)
.reverse();
};
});
arrayEach(["filter", "map", "takeWhile"], function(
methodName,
index
) {
var type = index + 1,
isFilter =
type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee) {
var result = this.clone();
result.__iteratees__.push({
iteratee: getIteratee(iteratee, 3),
type: type
});
result.__filtered__ = result.__filtered__ || isFilter;
return result;
};
});
arrayEach(["head", "last"], function(methodName, index) {
var takeName = "take" + (index ? "Right" : "");
LazyWrapper.prototype[methodName] = function() {
return this[takeName](1).value()[0];
};
});
arrayEach(["initial", "tail"], function(methodName, index) {
var dropName = "drop" + (index ? "" : "Right");
LazyWrapper.prototype[methodName] = function() {
return this.__filtered__
? new LazyWrapper(this)
: this[dropName](1);
};
});
LazyWrapper.prototype.compact = function() {
return this.filter(identity);
};
LazyWrapper.prototype.find = function(predicate) {
return this.filter(predicate).head();
};
LazyWrapper.prototype.findLast = function(predicate) {
return this.reverse().find(predicate);
};
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == "function") {
return new LazyWrapper(this);
}
return this.map(function(value) {
return baseInvoke(value, path, args);
});
});
LazyWrapper.prototype.reject = function(predicate) {
return this.filter(negate(getIteratee(predicate)));
};
LazyWrapper.prototype.slice = function(start, end) {
start = toInteger(start);
var result = this;
if (result.__filtered__ && (start > 0 || end < 0)) {
return new LazyWrapper(result);
}
if (start < 0) {
result = result.takeRight(-start);
} else if (start) {
result = result.drop(start);
}
if (end !== undefined) {
end = toInteger(end);
result =
end < 0 ? result.dropRight(-end) : result.take(end - start);
}
return result;
};
LazyWrapper.prototype.takeRightWhile = function(predicate) {
return this.reverse()
.takeWhile(predicate)
.reverse();
};
LazyWrapper.prototype.toArray = function() {
return this.take(MAX_ARRAY_LENGTH);
};
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(
methodName
),
isTaker = /^(?:head|last)$/.test(methodName),
lodashFunc =
lodash[
isTaker
? "take" + (methodName == "last" ? "Right" : "")
: methodName
],
retUnwrapped = isTaker || /^find/.test(methodName);
if (!lodashFunc) {
return;
}
lodash.prototype[methodName] = function() {
var value = this.__wrapped__,
args = isTaker ? [1] : arguments,
isLazy = value instanceof LazyWrapper,
iteratee = args[0],
useLazy = isLazy || isArray(value);
var interceptor = function(value) {
var result = lodashFunc.apply(
lodash,
arrayPush([value], args)
);
return isTaker && chainAll ? result[0] : result;
};
if (
useLazy &&
checkIteratee &&
typeof iteratee == "function" &&
iteratee.length != 1
) {
isLazy = useLazy = false;
}
var chainAll = this.__chain__,
isHybrid = !!this.__actions__.length,
isUnwrapped = retUnwrapped && !chainAll,
onlyLazy = isLazy && !isHybrid;
if (!retUnwrapped && useLazy) {
value = onlyLazy ? value : new LazyWrapper(this);
var result = func.apply(value, args);
result.__actions__.push({
func: thru,
args: [interceptor],
thisArg: undefined
});
return new LodashWrapper(result, chainAll);
}
if (isUnwrapped && onlyLazy) {
return func.apply(this, args);
}
result = this.thru(interceptor);
return isUnwrapped
? isTaker
? result.value()[0]
: result.value()
: result;
};
});
arrayEach(
["pop", "push", "shift", "sort", "splice", "unshift"],
function(methodName) {
var func = arrayProto[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName)
? "tap"
: "thru",
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
var value = this.value();
return func.apply(isArray(value) ? value : [], args);
}
return this[chainName](function(value) {
return func.apply(isArray(value) ? value : [], args);
});
};
}
);
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
var key = lodashFunc.name + "",
names = realNames[key] || (realNames[key] = []);
names.push({ name: methodName, func: lodashFunc });
}
});
realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [
{ name: "wrapper", func: undefined }
];
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
lodash.prototype.at = wrapperAt;
lodash.prototype.chain = wrapperChain;
lodash.prototype.commit = wrapperCommit;
lodash.prototype.next = wrapperNext;
lodash.prototype.plant = wrapperPlant;
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
lodash.prototype.first = lodash.prototype.head;
if (symIterator) {
lodash.prototype[symIterator] = wrapperToIterator;
}
return lodash;
};
var _ = runInContext();
if (
typeof define == "function" &&
typeof define.amd == "object" &&
define.amd
) {
root._ = _;
define(function() {
return _;
});
} else if (freeModule) {
(freeModule.exports = _)._ = _;
freeExports._ = _;
} else {
root._ = _;
}
}.call(this));
}.call(
this,
typeof self !== "undefined"
? self
: typeof window !== "undefined"
? window
: {}
));
},
{}
],
12: [
function(require, module, exports) {
(function(Buffer) {
(function(_window) {
"use strict";
var _rng, _mathRNG, _nodeRNG, _whatwgRNG, _previousRoot;
function setupBrowser() {
var _crypto = _window.crypto || _window.msCrypto;
if (!_rng && _crypto && _crypto.getRandomValues) {
try {
var _rnds8 = new Uint8Array(16);
_whatwgRNG = _rng = function whatwgRNG() {
_crypto.getRandomValues(_rnds8);
return _rnds8;
};
_rng();
} catch (e) {}
}
if (!_rng) {
var _rnds = new Array(16);
_mathRNG = _rng = function() {
for (var i = 0, r; i < 16; i++) {
if ((i & 3) === 0) {
r = Math.random() * 4294967296;
}
_rnds[i] = (r >>> ((i & 3) << 3)) & 255;
}
return _rnds;
};
if ("undefined" !== typeof console && console.warn) {
console.warn(
"[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()"
);
}
}
}
function setupNode() {
if ("function" === typeof require) {
try {
var _rb = require("crypto").randomBytes;
_nodeRNG = _rng =
_rb &&
function() {
return _rb(16);
};
_rng();
} catch (e) {}
}
}
if (_window) {
setupBrowser();
} else {
setupNode();
}
var BufferClass = "function" === typeof Buffer ? Buffer : Array;
var _byteToHex = [];
var _hexToByte = {};
for (var i = 0; i < 256; i++) {
_byteToHex[i] = (i + 256).toString(16).substr(1);
_hexToByte[_byteToHex[i]] = i;
}
function parse(s, buf, offset) {
var i = (buf && offset) || 0,
ii = 0;
buf = buf || [];
s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {
if (ii < 16) {
buf[i + ii++] = _hexToByte[oct];
}
});
while (ii < 16) {
buf[i + ii++] = 0;
}
return buf;
}
function unparse(buf, offset) {
var i = offset || 0,
bth = _byteToHex;
return (
bth[buf[i++]] +
bth[buf[i++]] +
bth[buf[i++]] +
bth[buf[i++]] +
"-" +
bth[buf[i++]] +
bth[buf[i++]] +
"-" +
bth[buf[i++]] +
bth[buf[i++]] +
"-" +
bth[buf[i++]] +
bth[buf[i++]] +
"-" +
bth[buf[i++]] +
bth[buf[i++]] +
bth[buf[i++]] +
bth[buf[i++]] +
bth[buf[i++]] +
bth[buf[i++]]
);
}
var _seedBytes = _rng();
var _nodeId = [
_seedBytes[0] | 1,
_seedBytes[1],
_seedBytes[2],
_seedBytes[3],
_seedBytes[4],
_seedBytes[5]
];
var _clockseq = ((_seedBytes[6] << 8) | _seedBytes[7]) & 16383;
var _lastMSecs = 0,
_lastNSecs = 0;
function v1(options, buf, offset) {
var i = (buf && offset) || 0;
var b = buf || [];
options = options || {};
var clockseq =
options.clockseq != null ? options.clockseq : _clockseq;
var msecs =
options.msecs != null ? options.msecs : new Date().getTime();
var nsecs =
options.nsecs != null ? options.nsecs : _lastNSecs + 1;
var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4;
if (dt < 0 && options.clockseq == null) {
clockseq = (clockseq + 1) & 16383;
}
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) {
nsecs = 0;
}
if (nsecs >= 1e4) {
throw new Error(
"uuid.v1(): Can't create more than 10M uuids/sec"
);
}
_lastMSecs = msecs;
_lastNSecs = nsecs;
_clockseq = clockseq;
msecs += 122192928e5;
var tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
b[i++] = (tl >>> 24) & 255;
b[i++] = (tl >>> 16) & 255;
b[i++] = (tl >>> 8) & 255;
b[i++] = tl & 255;
var tmh = ((msecs / 4294967296) * 1e4) & 268435455;
b[i++] = (tmh >>> 8) & 255;
b[i++] = tmh & 255;
b[i++] = ((tmh >>> 24) & 15) | 16;
b[i++] = (tmh >>> 16) & 255;
b[i++] = (clockseq >>> 8) | 128;
b[i++] = clockseq & 255;
var node = options.node || _nodeId;
for (var n = 0; n < 6; n++) {
b[i + n] = node[n];
}
return buf ? buf : unparse(b);
}
function v4(options, buf, offset) {
var i = (buf && offset) || 0;
if (typeof options === "string") {
buf = options === "binary" ? new BufferClass(16) : null;
options = null;
}
options = options || {};
var rnds = options.random || (options.rng || _rng)();
rnds[6] = (rnds[6] & 15) | 64;
rnds[8] = (rnds[8] & 63) | 128;
if (buf) {
for (var ii = 0; ii < 16; ii++) {
buf[i + ii] = rnds[ii];
}
}
return buf || unparse(rnds);
}
var uuid = v4;
uuid.v1 = v1;
uuid.v4 = v4;
uuid.parse = parse;
uuid.unparse = unparse;
uuid.BufferClass = BufferClass;
uuid._rng = _rng;
uuid._mathRNG = _mathRNG;
uuid._nodeRNG = _nodeRNG;
uuid._whatwgRNG = _whatwgRNG;
if ("undefined" !== typeof module && module.exports) {
module.exports = uuid;
} else if (typeof define === "function" && define.amd) {
define(function() {
return uuid;
});
} else {
_previousRoot = _window.uuid;
uuid.noConflict = function() {
_window.uuid = _previousRoot;
return uuid;
};
_window.uuid = uuid;
}
})("undefined" !== typeof window ? window : null);
}.call(this, require("buffer").Buffer));
},
{ buffer: 2, crypto: 4 }
],
13: [
function(require, module, exports) {
module.exports = {
LOG: "LOG",
IMAGE_TAPPED: "IMAGE_TAPPED",
ANCHOR_TAPPED: "ANCHOR_TAPPED",
INIT_COMPLETE: "INIT_COMPLETE",
DOM_LOADED: "DOM_LOADED",
RENDERING_PASS: "RENDERING_PASS",
RENDERING_ENDED: "RENDERING_ENDED",
MENTION_TAPPED: "MENTION_TAPPED"
};
},
{}
],
14: [
function(require, module, exports) {
var CentralDispatcher = require("../dispatchers/centralDispatcher");
var ActionConstants = require("./actionConstants");
function createLog(message) {
CentralDispatcher.dispatch({
type: ActionConstants.LOG,
message: message
});
}
function createImageTapAction(ID, src) {
CentralDispatcher.dispatch({
type: ActionConstants.IMAGE_TAPPED,
imageID: ID,
imageSrc: src
});
}
function createAnchorTapAction(anchor) {
CentralDispatcher.dispatch({
type: ActionConstants.ANCHOR_TAPPED,
anchor: anchor
});
}
function createInitCompleteAction() {
CentralDispatcher.dispatch({ type: ActionConstants.INIT_COMPLETE });
}
function createDomLoadedAction() {
CentralDispatcher.dispatch({ type: ActionConstants.DOM_LOADED });
}
function createRenderingPassAction() {
CentralDispatcher.dispatch({ type: ActionConstants.RENDERING_PASS });
}
function createRenderingEndedAction(timedOut) {
CentralDispatcher.dispatch({ type: ActionConstants.RENDERING_ENDED });
}
function createMentionTappedAction(email) {
CentralDispatcher.dispatch({
type: ActionConstants.MENTION_TAPPED,
email: email
});
}
module.exports = {
createLog: createLog,
createImageTapAction: createImageTapAction,
createAnchorTapAction: createAnchorTapAction,
createInitCompleteAction: createInitCompleteAction,
createDomLoadedAction: createDomLoadedAction,
createRenderingPassAction: createRenderingPassAction,
createRenderingEndedAction: createRenderingEndedAction,
createMentionTappedAction: createMentionTappedAction
};
},
{ "../dispatchers/centralDispatcher": 20, "./actionConstants": 13 }
],
15: [
function(require, module, exports) {
var _ = require("lodash");
var Config = require("../config");
var ActionConstants = require("../actions/actionConstants");
var Constants = require("../constants");
var CentralDispatcher = require("../dispatchers/centralDispatcher");
var FeatureFlagManager = require("../managers/featureFlagManager");
var FeatureFlags = FeatureFlagManager.flags;
function _handleLog(action) {
var flag = FeatureFlags.LOG_TO_NATIVE;
if (
FeatureFlagManager.isEnabled(flag) &&
FeatureFlagManager.valueForFlag(flag)
) {
_notifyHost("log://" + encodeURIComponent(action.message));
}
}
function _handleImageTapped(action) {
_notifyHost(
"image-tapped://id/" +
encodeURIComponent(action.imageID) +
"?src=" +
encodeURIComponent(action.imageSrc)
);
}
function _handleAnchorTapped(action) {
var anchor = action.anchor;
var href = (function() {
var dataDetectorType = anchor.getAttribute(
"x-apple-data-detectors-type"
);
if (!dataDetectorType || dataDetectorType === "link") {
return "anchortap://src/" + encodeURIComponent(anchor.href);
} else if (dataDetectorType === "calendar-event") {
var queryItems = _getCalendarEventQueryItems(anchor).join("&");
var query =
queryItems && queryItems.length ? "?" + queryItems : "";
return (
"anchortap://calendar-event/" +
encodeURIComponent(anchor.innerText) +
query
);
}
})();
_notifyHost(href);
}
function _getCalendarEventQueryItems(anchor) {
var timeElement = anchor.parentElement;
if (timeElement && _.toLower(timeElement.tagName) === "time") {
var itemscopeElement = timeElement;
while ((itemscopeElement = itemscopeElement.parentElement)) {
if (itemscopeElement.hasAttribute("itemscope")) {
break;
}
}
var itemtype =
itemscopeElement && itemscopeElement.getAttribute("itemtype");
if (itemtype && _.toLower(itemtype) === "http://schema.org/event") {
var startDateElement = itemscopeElement.querySelector(
'[itemprop="startDate"]'
);
var startDate =
startDateElement && startDateElement.getAttribute("datetime");
var endDateElement = itemscopeElement.querySelector(
'[itemprop="endDate"]'
);
var endDate =
endDateElement && endDateElement.getAttribute("datetime");
if (startDate && endDate) {
return [
"startDate=" + encodeURIComponent(startDate),
"endDate=" + encodeURIComponent(endDate)
];
}
}
var datetime = timeElement.getAttribute("datetime");
if (datetime) {
return ["datetime=" + encodeURIComponent(datetime)];
}
return [];
} else {
return [];
}
}
function _handleDomLoaded(action) {
_notifyHost("dom-loaded://");
}
function _handleRenderingPass(action) {
_notifyHost("rendering-pass://");
}
function _handleRenderingEnded(action) {
_notifyHost("rendering-ended://");
}
function _handleMentionTapped(action) {
_notifyHost("mention-tapped://" + encodeURIComponent(action.email));
}
function _handleAction(action) {
if (action.type !== ActionConstants.LOG) {
log.info("iosAPI > Handle " + action.type);
}
switch (action.type) {
case ActionConstants.LOG:
_handleLog(action);
break;
case ActionConstants.IMAGE_TAPPED:
_handleImageTapped(action);
break;
case ActionConstants.ANCHOR_TAPPED:
_handleAnchorTapped(action);
break;
case ActionConstants.DOM_LOADED:
_handleDomLoaded(action);
break;
case ActionConstants.RENDERING_PASS:
_handleRenderingPass(action);
break;
case ActionConstants.RENDERING_ENDED:
_handleRenderingEnded(action);
break;
case ActionConstants.MENTION_TAPPED:
_handleMentionTapped(action);
break;
default:
log.warn("iosAPI > Non handled action: " + action.type);
}
}
function _notifyHost(url) {
if (Config.uuid) {
url += "?uuid=" + encodeURIComponent(Config.uuid);
}
var document = window.document;
var frame = document.createElement("iframe");
frame.className = Constants.BRIDGE_IFRAME_CLASS;
frame.style.position = "absolute";
frame.style.width = "1px";
frame.style.height = "1px";
frame.style.left = "-100px";
frame.style.top = "-100px";
frame.setAttribute("src", url);
document.body.appendChild(frame);
if (frame.parentNode) {
frame.parentNode.removeChild(frame);
}
frame = null;
}
function _onRenderingResultReady(height, html) {}
function init() {
CentralDispatcher.register(_handleAction);
}
module.exports = {
init: init,
onRenderingResultReady: _onRenderingResultReady
};
},
{
"../actions/actionConstants": 13,
"../config": 18,
"../constants": 19,
"../dispatchers/centralDispatcher": 20,
"../managers/featureFlagManager": 31,
lodash: 11
}
],
16: [
function(require, module, exports) {
var _ = require("lodash");
var FeatureFlagManager = require("../managers/featureFlagManager");
var StyleManager = require("../managers/styleManager");
var InteractionManager = require("../managers/interactionManager");
var ElementManager = require("../managers/elementManager");
var LayoutManager = require("../managers/layoutManager");
var DomHelper = require("../lib/domHelper");
var Config = require("../config");
var ActionCreator = require("../actions/actionCreator");
var NativeAPI = require("./nativeAPI");
function configureEmail(config, flags) {
_.assign(Config, config || {});
for (var key in flags) {
FeatureFlagManager.setFlag(key, flags[key]);
}
var renderedCallback = function() {
ActionCreator.createLog(log.columnSeparatedHistory());
ActionCreator.createRenderingEndedAction();
};
var start = function() {
StyleManager.style();
InteractionManager.configureInteractions();
LayoutManager.layout(function(timedOut) {
log.info("jsAPI > Render done.");
renderedCallback(timedOut);
});
};
DomHelper.executeOnDomReadyState(
DomHelper.domStatuses.INTERACTIVE,
function() {
log.info("jsAPI > DOMLoaded");
ActionCreator.createDomLoadedAction();
start();
}
);
}
var hideElementWithID = function(ID) {
var element = ElementManager.getElementWithID(ID);
if (_.isNil(element)) {
return;
}
ElementManager.hideElement(element);
};
var restoreElementVisibilityWithID = function(ID) {
var element = ElementManager.getElementWithID(ID);
if (_.isNil(element)) {
return;
}
ElementManager.restoreElementVisibility(element);
};
var getSourceOfImageWithID = function(ID) {
var element = ElementManager.getElementWithID(ID);
if (_.isNil(element)) {
return null;
}
if (_.toLower(element.tagName) !== "img") {
log.warn("getSourceOfImageWithID > element is not an image");
return null;
}
if (_.isNil(element.src)) {
log.warn("getSourceOfImageWithID > element source not found");
return null;
}
return element.src;
};
var getContentBoundsOfElementWithID = function(ID) {
var element = ElementManager.getElementWithID(ID);
if (_.isNil(element)) {
return null;
}
var bounds = ElementManager.getAbsoluteBoundsOfElement(element)
.content;
var scale =
DomHelper.getUserZoomLevel() * DomHelper.getViewportScaleLevel();
for (var key in bounds) {
bounds[key] = bounds[key] * scale;
}
return JSON.stringify(bounds);
};
var setUUID = function(uuid) {
Config.uuid = uuid;
var script = document.getElementById("olm-uuid-script");
if (!_.isNil(_.get(script, "parentNode"))) {
script.parentNode.removeChild(script);
}
};
var requestRenderingResult = function() {
log.info("jsAPI > requestRenderingResult");
document.body.getBoundingClientRect();
setTimeout(function() {
var height = DomHelper.getHeight();
var html = DomHelper.getHTML();
log.info(
"jsAPI > requestRenderingResult calling native, height=" +
height +
"px"
);
NativeAPI.onRenderingResultReady(height, html);
}, 250);
};
module.exports = {
configureMessage: configureEmail,
adjustViewport: StyleManager.adjustViewport,
hideElementWithID: hideElementWithID,
restoreElementVisibilityWithID: restoreElementVisibilityWithID,
getSourceOfImageWithID: getSourceOfImageWithID,
getContentBoundsOfElementWithID: getContentBoundsOfElementWithID,
getHTML: DomHelper.getHTML,
getHeight: DomHelper.getHeight,
setUUID: setUUID,
requestRenderingResult: requestRenderingResult
};
},
{
"../actions/actionCreator": 14,
"../config": 18,
"../lib/domHelper": 22,
"../managers/elementManager": 30,
"../managers/featureFlagManager": 31,
"../managers/interactionManager": 32,
"../managers/layoutManager": 34,
"../managers/styleManager": 35,
"./nativeAPI": 17,
lodash: 11
}
],
17: [
function(require, module, exports) {
module.exports = (function() {
return require("./iosAPI");
})();
},
{ "./iosAPI": 15 }
],
18: [
function(require, module, exports) {
module.exports = {
screenWidth: 0,
paddingHorizontal: 0,
paddingVertical: 0,
textZoom: 0,
userScalable: false,
interceptLinkLongTap: true,
selectionEnabled: true,
minimumScale: 1,
maximumScale: 5,
uuid: null,
scheme: "ms-outlook",
isActionableMessage: false,
amContainerDivId: "",
imageAltString: "Image"
};
},
{}
],
19: [
function(require, module, exports) {
exports.BRIDGE_IFRAME_CLASS = "outlook_bridge";
},
{}
],
20: [
function(require, module, exports) {
var Dispatcher = require("./dispatcher");
module.exports = new Dispatcher();
},
{ "./dispatcher": 21 }
],
21: [
function(require, module, exports) {
var EventEmitter = require("../lib/eventEmitter");
function Dispatcher() {
this._eventEmitter = new EventEmitter();
}
Dispatcher.prototype.register = function(callback) {
this._eventEmitter.on("action", callback);
};
Dispatcher.prototype.dispatch = function(action) {
this._eventEmitter.trigger("action", action);
};
module.exports = Dispatcher;
},
{ "../lib/eventEmitter": 24 }
],
22: [
function(require, module, exports) {
var _ = require("lodash");
var Constants = require("../constants");
var Config = require("../config");
var DomWalker = require("./domWalker");
var ElementManager = require("../managers/elementManager");
var DOM_STATUSES = {
LOADING: "loading",
INTERACTIVE: "interactive",
COMPLETE: "complete"
};
var _domReadyStateCallbacks = {
loading: [],
interactive: [],
complete: []
};
var _allSizedImagesLoaded = false;
var _domStatus = DOM_STATUSES.LOADING;
function _removeBridgeFrames() {
var frames = document.querySelectorAll(
"iframe." + Constants.BRIDGE_IFRAME_CLASS
);
_.forEach(frames, function(frame) {
if (!_.isNil(frame.parentNode)) {
frame.parentNode.removeChild(frame);
}
});
}
function _getDoctype() {
var doctype = document.doctype;
if (_.isNil(doctype)) {
return null;
}
var args = [
doctype.name,
!_.isNil(doctype.publicId)
? 'PUBLIC "' + doctype.publicId + '"'
: null,
_.isNil(doctype.publicId) && !_.isNil(doctype.systemId)
? "SYSTEM"
: null,
!_.isNil(doctype.systemId) ? '"' + doctype.systemId + '"' : null
];
args = _.filter(args, function(arg) {
return arg !== null;
});
return "<!DOCTYPE " + _.join(args, " ") + ">";
}
function _getDocumentHTML() {
var documentElement = document.documentElement;
if (_.isNil(documentElement)) {
return null;
}
return documentElement.outerHTML;
}
function _executeReadyStateCallbacksIfNeeded() {
_.forOwn(_domReadyStateCallbacks, function(callbacks, state) {
for (var i = callbacks.length - 1; i >= 0; i--) {
var callback = callbacks[i];
executeOnDomReadyState(state, callback);
}
});
}
function _setupNonSizedImagesLoadEvent() {
var nonSizedImages = getNonSizedImageElements();
if (_.isEmpty(nonSizedImages)) {
_allSizedImagesLoaded = true;
if (document.readyState === DOM_STATUSES.COMPLETE) {
_domStatus = DOM_STATUSES.COMPLETE;
_executeReadyStateCallbacksIfNeeded();
}
return;
}
var loadInfo = { count: 0 };
var callCompleteCallbackIfNeeded = function() {
loadInfo.count--;
if (loadInfo.count <= 0) {
setTimeout(function() {
_allSizedImagesLoaded = true;
if (document.readyState === DOM_STATUSES.COMPLETE) {
_domStatus = DOM_STATUSES.COMPLETE;
_executeReadyStateCallbacksIfNeeded();
}
});
}
};
_.forEach(nonSizedImages, function(image) {
loadInfo.count++;
image.addEventListener("load", callCompleteCallbackIfNeeded);
image.addEventListener("error", callCompleteCallbackIfNeeded);
});
}
function _init() {
document.onreadystatechange = function() {
if (document.readyState === DOM_STATUSES.COMPLETE) {
if (_allSizedImagesLoaded) {
_domStatus = DOM_STATUSES.COMPLETE;
_executeReadyStateCallbacksIfNeeded();
}
} else {
_domStatus = document.readyState;
_executeReadyStateCallbacksIfNeeded();
}
};
executeOnDomReadyState(DOM_STATUSES.INTERACTIVE, function() {
_setupNonSizedImagesLoadEvent();
});
}
function getOrCreateHeadForDocument(doc) {
var heads = doc.getElementsByTagName("head");
if (_.isEmpty(heads)) {
var head = doc.createElement("head");
doc.body.insertBefore(head);
return head;
}
return _.first(heads);
}
function executeOnDomReadyState(state, callback) {
var priority = {};
priority[DOM_STATUSES.LOADING] = 0;
priority[DOM_STATUSES.INTERACTIVE] = 1;
priority[DOM_STATUSES.COMPLETE] = 2;
if (priority[domStatus()] >= priority[state]) {
callback();
_.pull(_domReadyStateCallbacks[state], callback);
return;
}
if (!_.includes(_domReadyStateCallbacks[state], callback)) {
_domReadyStateCallbacks[state].push(callback);
}
}
function getUserZoomLevel() {
var documentWidthMax = Config.screenWidth / Config.minimumScale;
var documentWidthMin = Config.screenWidth / Config.maximumScale;
var documentWidth = Math.max(
documentWidthMin,
Math.min(documentWidthMax, Config.screenWidth)
);
var zoomLevel = documentWidth / window.innerWidth;
if (_.isNaN(zoomLevel)) {
return 1;
}
return zoomLevel;
}
function getViewportScaleLevel() {
var documentWidth = Config.screenWidth;
if (documentWidth === 0) {
return 1;
}
return Math.max(
Config.minimumScale,
Math.min(Config.maximumScale, Config.screenWidth / documentWidth)
);
}
function getHTML() {
_removeBridgeFrames();
var html = _.filter([_getDoctype(), _getDocumentHTML()], function(
element
) {
return !_.isNil(element);
});
return _.join(html, "\n");
}
function getHeight() {
var bodyStyle = window.getComputedStyle(document.body);
var bodyPaddingTop = parseFloat(bodyStyle.paddingTop);
bodyPaddingTop = _.isNaN(bodyPaddingTop) ? 0 : bodyPaddingTop;
var bodyPaddingBottom = parseFloat(bodyStyle.paddingBottom);
bodyPaddingBottom = _.isNaN(bodyPaddingBottom)
? 0
: bodyPaddingBottom;
var maxY = bodyPaddingTop;
DomWalker.breadthFirst(document.body, function(element) {
if (element === document.body) {
if (_.isNil(document.createRange)) {
return true;
}
var range = document.createRange();
if (_.isNil(range.getBoundingClientRect)) {
return true;
}
if (element.hasChildNodes()) {
var textNodes = _.filter(element.childNodes, function(node) {
return node.nodeType === Node.TEXT_NODE;
});
_.forEach(textNodes, function(textNode) {
range.selectNodeContents(textNode);
maxY = Math.max(maxY, range.getBoundingClientRect().bottom);
});
}
return true;
}
var elementStyle = window.getComputedStyle(element);
if (elementStyle.display === "none") {
return false;
}
if (elementStyle.visibility === "hidden") {
return false;
}
var elementBounds = ElementManager.getAbsoluteBoundsOfElement(
element
);
maxY = Math.max(maxY, elementBounds.outer.bottom);
if (
elementStyle.overflowY === "hidden" ||
elementStyle.overflowY === "scroll"
) {
return false;
}
return true;
});
maxY += bodyPaddingBottom;
return maxY;
}
function domStatus() {
return _domStatus;
}
function getNonLinkifiedTextNodes(elem) {
var results = [];
if (
_.isNil(_.get(elem, "childNodes")) ||
_.isEmpty(elem.childNodes)
) {
return results;
}
return _.reduce(
elem.childNodes,
function(result, child) {
if (child.nodeType === Node.TEXT_NODE) {
result.push(child);
} else if (
child.nodeType === Node.ELEMENT_NODE &&
_.toLower(child.tagName) !== "a" &&
_.toLower(child.tagName) !== "style"
) {
result = _.concat(result, getNonLinkifiedTextNodes(child));
}
return result;
},
[]
);
}
function getNonSizedImageElements() {
var images = document.getElementsByTagName("img");
return _.reduce(
images,
function(result, image) {
if (!ElementManager.isImageElementSized(image)) {
result.push(image);
}
return result;
},
[]
);
}
_init();
module.exports = {
getOrCreateHeadForDocument: getOrCreateHeadForDocument,
executeOnDomReadyState: executeOnDomReadyState,
getUserZoomLevel: getUserZoomLevel,
getViewportScaleLevel: getViewportScaleLevel,
getHTML: getHTML,
getHeight: getHeight,
domStatus: domStatus,
domStatuses: DOM_STATUSES,
getNonLinkifiedTextNodes: getNonLinkifiedTextNodes,
getNonSizedImageElements: getNonSizedImageElements
};
},
{
"../config": 18,
"../constants": 19,
"../managers/elementManager": 30,
"./domWalker": 23,
lodash: 11
}
],
23: [
function(require, module, exports) {
var _ = require("lodash");
function breadthFirst(rootElement, callback) {
var queue = [rootElement];
while (!_.isEmpty(queue)) {
var element = queue.shift();
if (!(element instanceof Element)) {
continue;
}
if (callback(element) && !_.isNil(element.children)) {
queue = _.concat(queue, _.slice(element.children));
}
}
}
module.exports = { breadthFirst: breadthFirst };
},
{ lodash: 11 }
],
24: [
function(require, module, exports) {
var _ = require("lodash");
function EventEmitter() {
this._listenersMap = {};
}
EventEmitter.prototype.on = function(eventName, callback) {
var callbacks = this._listenersMap[eventName];
if (_.isNil(callbacks)) {
callbacks = [];
this._listenersMap[eventName] = callbacks;
}
callbacks.push(callback);
};
EventEmitter.prototype.off = function(eventName, callback) {
var callbacks = this._listenersMap[eventName];
if (!_.isNil(callbacks)) {
_.pull(callbacks, callback);
}
};
EventEmitter.prototype.trigger = function(eventName) {
var callbacks = this._listenersMap[eventName];
if (!_.isNil(callbacks)) {
var argumentsArray = _.slice(arguments, 1);
_.forEach(callbacks, function(callback) {
callback.apply(window, argumentsArray);
});
}
};
module.exports = EventEmitter;
},
{ lodash: 11 }
],
25: [
function(require, module, exports) {
var ExceptionCatcher = {
init: function() {
window.onerror = function() {
log.error.apply(log, arguments);
};
}
};
module.exports = ExceptionCatcher;
},
{}
],
26: [
function(require, module, exports) {
var _ = require("lodash");
var levels = { INFO: 1, WARN: 2, ERROR: 3 };
var _historyMax = 5e3;
var _historyHeadNode = null;
var _filteredLevels = null;
clearLevelsFilter();
var _ListNode = function(args, level) {
this.args = args;
this.level = level;
this.id = null;
this.next = null;
this.previous = null;
};
_ListNode.prototype.logMessage = function() {
if ((_filteredLevels & this.level) > 0) {
switch (this.level) {
case levels.INFO:
console.log.apply(console, this.args);
break;
case levels.WARN:
console.warn.apply(console, this.args);
break;
case levels.ERROR:
console.error.apply(console, this.args);
break;
}
}
};
function _attachMessageToHistory(level, args) {
var node = new _ListNode(args, level);
if (_.isNil(_historyHeadNode)) {
node.id = 0;
node.next = node;
node.previous = node;
_historyHeadNode = node;
} else if (_historyHeadNode.previous.id >= _historyMax - 1) {
node.id = _historyHeadNode.previous.id + 1;
node.next = _historyHeadNode.next;
node.previous = _historyHeadNode.previous;
node.next.previous = node;
node.previous.next = node;
_historyHeadNode = node.next;
} else {
node.id = _historyHeadNode.previous.id + 1;
node.next = _historyHeadNode;
node.previous = _historyHeadNode.previous;
node.previous.next = node;
_historyHeadNode.previous = node;
}
return node;
}
function _logAndStoreMessage(level, args) {
var node = _attachMessageToHistory(level, args);
node.logMessage();
}
function filterLevels(levels) {
_filteredLevels = levels;
}
function clearLevelsFilter() {
_filteredLevels = levels.INFO | levels.WARN | levels.ERROR;
}
function info() {
_logAndStoreMessage(levels.INFO, arguments);
}
function warn() {
_logAndStoreMessage(levels.WARN, arguments);
}
function error() {
_logAndStoreMessage(levels.ERROR, arguments);
}
function printHistory() {
if (_.isNil(_historyHeadNode)) {
return;
}
var currentNode = _historyHeadNode.previous;
do {
currentNode.logMessage();
currentNode = currentNode.previous;
} while (currentNode !== _historyHeadNode.previous);
}
function columnSeparatedHistory() {
if (_.isNil(_historyHeadNode)) {
return "";
}
var messages = [];
var currentNode = _historyHeadNode;
do {
messages.push(_.join(currentNode.args, ", "));
currentNode = currentNode.next;
} while (currentNode !== _historyHeadNode);
return messages.join(";");
}
module.exports = {
levels: levels,
filterLevels: filterLevels,
clearLevelsFilter: clearLevelsFilter,
info: info,
warn: warn,
error: error,
printHistory: printHistory,
columnSeparatedHistory: columnSeparatedHistory
};
},
{ lodash: 11 }
],
27: [
function(require, module, exports) {
var _ = require("lodash");
var DomHelper = require("./domHelper");
function _parsedBlock(selector, block) {
if (_.isEmpty(block)) {
return "";
}
var parsedRules = [];
for (var rule in block) {
parsedRules.push(rule + ": " + block[rule] + ";");
}
return selector + " {\n" + _.join(parsedRules, "\n") + "\n}";
}
function _parsedBlocks(blocks) {
var parsedBlocks = [];
for (var block in blocks) {
parsedBlocks.push(_parsedBlock(block, blocks[block]));
}
return _.join(parsedBlocks, "\n\n");
}
function insertStyles(styles) {
var css = _parsedBlocks(styles);
var id = "outlook-inserted-style-sheets";
var styleElement = document.getElementById(id);
if (_.isNil(styleElement)) {
styleElement = document.createElement("style");
styleElement.setAttribute("id", id);
styleElement.setAttribute("type", "text/css");
var headElement = DomHelper.getOrCreateHeadForDocument(document);
headElement.appendChild(styleElement);
}
styleElement.appendChild(document.createTextNode(css));
}
module.exports = { insertStyles: insertStyles };
},
{ "./domHelper": 22, lodash: 11 }
],
28: [
function(require, module, exports) {
var _ = require("lodash");
var jsAPI = require("./api/jsAPI");
var nativeAPI = require("./api/nativeAPI");
var Logger = require("./lib/logger");
var ExceptionCatcher = require("./lib/exceptionCatcher");
var ActionCreator = require("./actions/actionCreator");
window.log = Logger;
ExceptionCatcher.init();
_.forOwn(jsAPI, function(value, key) {
window[key] = value;
});
nativeAPI.init();
ActionCreator.createInitCompleteAction();
},
{
"./actions/actionCreator": 14,
"./api/jsAPI": 16,
"./api/nativeAPI": 17,
"./lib/exceptionCatcher": 25,
"./lib/logger": 26,
lodash: 11
}
],
29: [
function(require, module, exports) {
var _ = require("lodash");
var ATTRIBUTE = "data-outlook-cycle";
var STEPS = {
INSERT_STYLES: "INSERT_STYLES",
FIRST_LAYOUT_PASS: "FIRST_LAYOUT_PASS"
};
function _getCycle() {
var cycle = document.body.getAttribute(ATTRIBUTE);
if (_.isNil(cycle)) {
return {};
}
try {
return JSON.parse(cycle);
} catch (e) {
log.error("Couldn't parse cycle object");
return {};
}
}
function _setCycle(cycle) {
var stringifiedCycle = (function() {
try {
return JSON.stringify(cycle);
} catch (e) {
log.error("Couldn't stringify cycle object");
return {};
}
})();
document.body.setAttribute(ATTRIBUTE, stringifiedCycle);
}
function setStep(step) {
var cycle = _getCycle();
cycle[step] = true;
_setCycle(cycle);
}
function alreadyDidStep(step) {
var cycle = _getCycle();
return cycle[step] === true;
}
module.exports = {
steps: STEPS,
setStep: setStep,
alreadyDidStep: alreadyDidStep
};
},
{ lodash: 11 }
],
30: [
function(require, module, exports) {
var _ = require("lodash");
var UUID = require("node-uuid");
var DIRECTION = { RTL: "RTL", LTR: "LTR" };
var MAIL_TO_IDENTIFIER = "mailto:";
var MENTION_ID_START = "OWAAM";
var _IDAttributeName = "data-outlook-id";
var _elementVisibilityById = {};
function _getPaddingsOfElement(
element,
horizontalScale,
verticalScale,
computedStyle
) {
computedStyle = computedStyle || window.getComputedStyle(element);
var top = parseFloat(computedStyle.getPropertyValue("padding-top"));
var right = parseFloat(
computedStyle.getPropertyValue("padding-right")
);
var bottom = parseFloat(
computedStyle.getPropertyValue("padding-bottom")
);
var left = parseFloat(computedStyle.getPropertyValue("padding-left"));
return {
top: _.isNaN(top) ? 0 : top * verticalScale,
right: _.isNaN(right) ? 0 : right * horizontalScale,
bottom: _.isNaN(bottom) ? 0 : bottom * verticalScale,
left: _.isNaN(left) ? 0 : left * horizontalScale
};
}
function _getBorderWidthsOfElement(
element,
horizontalScale,
verticalScale,
computedStyle
) {
computedStyle = computedStyle || window.getComputedStyle(element);
var top = parseFloat(
computedStyle.getPropertyValue("border-top-width")
);
var right = parseFloat(
computedStyle.getPropertyValue("border-right-width")
);
var bottom = parseFloat(
computedStyle.getPropertyValue("border-bottom-width")
);
var left = parseFloat(
computedStyle.getPropertyValue("border-left-width")
);
return {
top: _.isNaN(top) ? 0 : top * verticalScale,
right: _.isNaN(right) ? 0 : right * horizontalScale,
bottom: _.isNaN(bottom) ? 0 : bottom * verticalScale,
left: _.isNaN(left) ? 0 : left * horizontalScale
};
}
function _getMarginsOfElement(
element,
horizontalScale,
verticalScale,
computedStyle
) {
computedStyle = computedStyle || window.getComputedStyle(element);
var top = parseFloat(computedStyle.getPropertyValue("margin-top"));
var right = parseFloat(
computedStyle.getPropertyValue("margin-right")
);
var bottom = parseFloat(
computedStyle.getPropertyValue("margin-bottom")
);
var left = parseFloat(computedStyle.getPropertyValue("margin-left"));
return {
top: _.isNaN(top) ? 0 : top * verticalScale,
right: _.isNaN(right) ? 0 : right * horizontalScale,
bottom: _.isNaN(bottom) ? 0 : bottom * verticalScale,
left: _.isNaN(left) ? 0 : left * horizontalScale
};
}
function _getDirectionFromDir(dir) {
if (dir === "rtl") {
return DIRECTION.RTL;
} else if (dir === "ltr") {
return DIRECTION.LTR;
} else if (!_.isNil(document.dir)) {
return document.dir === "ltr" ? DIRECTION.LTR : DIRECTION.RTL;
}
return DIRECTION.LTR;
}
function _getScaleOfElement(element, horizontalScale, verticalScale) {
if (_.isNil(horizontalScale)) {
horizontalScale = 1;
}
if (_.isNil(verticalScale)) {
verticalScale = 1;
}
var transform = window.getComputedStyle(element).transform;
if (!_.isNil(transform)) {
var regex = /(\d+(?:\.\d+)?)/g;
if (_.startsWith(transform, "matrix(")) {
var values = transform.match(regex);
if (values.length === 6) {
horizontalScale *= parseFloat(values[0]);
verticalScale *= parseFloat(values[3]);
}
}
}
if (
!_.isNil(element.parentNode) &&
element.parentNode instanceof Element
) {
var parentScale = _getScaleOfElement(
element.parentNode,
horizontalScale,
verticalScale
);
horizontalScale = parentScale.horizontalScale;
verticalScale = parentScale.verticalScale;
}
return {
horizontalScale: horizontalScale,
verticalScale: verticalScale
};
}
function getAbsoluteBoundsOfElement(element, computedStyle) {
computedStyle = computedStyle || window.getComputedStyle(element);
var boundingRect = element.getBoundingClientRect();
var elementScale = !_.isNil(element.parentNode)
? _getScaleOfElement(element.parentNode)
: 1;
var borders = _getBorderWidthsOfElement(
element,
elementScale.horizontalScale,
elementScale.verticalScale,
computedStyle
);
var paddings = _getPaddingsOfElement(
element,
elementScale.horizontalScale,
elementScale.verticalScale,
computedStyle
);
var contentBounds = {
left: boundingRect.left + borders.left + paddings.left,
right: boundingRect.right - borders.right - paddings.right,
top: boundingRect.top + borders.top + paddings.top,
bottom: boundingRect.bottom - borders.bottom - paddings.bottom
};
contentBounds.width = contentBounds.right - contentBounds.left;
contentBounds.height = contentBounds.bottom - contentBounds.top;
var innerBounds = {
left: boundingRect.left + borders.left,
right: boundingRect.right - borders.right,
top: boundingRect.top + borders.top,
bottom: boundingRect.bottom - borders.bottom
};
innerBounds.width = innerBounds.right - innerBounds.left;
innerBounds.height = innerBounds.bottom - innerBounds.top;
var borderBounds = {};
for (var key in boundingRect) {
borderBounds[key] = boundingRect[key];
}
var margins = _getMarginsOfElement(
element,
elementScale.horizontalScale,
elementScale.verticalScale,
computedStyle
);
var outerBounds = {
left: boundingRect.left - Math.max(margins.left, 0),
right: boundingRect.right + Math.max(margins.right, 0),
top: boundingRect.top - Math.max(margins.top, 0),
bottom: boundingRect.bottom + Math.max(margins.bottom, 0)
};
outerBounds.width = outerBounds.right - outerBounds.left;
outerBounds.height = outerBounds.bottom - outerBounds.top;
return {
content: contentBounds,
inner: innerBounds,
border: borderBounds,
outer: outerBounds
};
}
function hideElement(element) {
var visibility = window.getComputedStyle(element).visibility;
if (visibility === "hidden") {
return;
}
var ID = configureIDForElement(element);
_elementVisibilityById[ID] = visibility;
element.style.visibility = "hidden";
}
function restoreElementVisibility(element) {
var ID = configureIDForElement(element);
if (_.isNil(_elementVisibilityById[ID])) {
log.warn(
"restoreElementVisibility > element visibility to restore not found > did you hide the element before?"
);
return;
}
element.style.visibility = _elementVisibilityById[ID];
delete _elementVisibilityById[ID];
}
function configureIDForElement(element) {
var ID = element.getAttribute(_IDAttributeName);
if (_.isNil(ID)) {
ID = UUID.v4();
element.setAttribute(_IDAttributeName, ID);
log.info("Add ID on element: " + ID);
}
return ID;
}
function getElementWithID(ID) {
var elements = document.querySelectorAll(
"[" + [_IDAttributeName, '"' + ID + '"'].join("=") + "]"
);
if (_.isEmpty(elements)) {
log.warn("Element with ID not found: " + ID);
return null;
} else if (elements.length > 1) {
log.warn("More than one element found with ID: " + ID);
}
return _.first(elements);
}
function isElementDescendantOfElementWithTag(element, tag) {
var parentNode = element.parentNode;
if (_.isNil(parentNode)) {
return false;
}
var parentTagName = parentNode.tagName;
if (_.isNil(parentTagName)) {
return false;
}
if (_.toLower(parentNode.tagName) === _.toLower(tag)) {
return true;
}
return isElementDescendantOfElementWithTag(parentNode, tag);
}
function getMentionElements() {
var linkElements = document.querySelectorAll(
'a[id^="' + MENTION_ID_START + '"]'
);
var mentionElements = _.filter(linkElements, function(element) {
var href = _.toLower(element.getAttribute("href"));
return _.startsWith(href, MAIL_TO_IDENTIFIER);
});
return mentionElements;
}
function getDirectionOfElement(element) {
if (element.getAttribute("dir") || element.style.direction) {
if (
!_.isNil(element.parentNode) &&
element.parentNode instanceof Element
) {
return _getDirectionFromDir(
window.getComputedStyle(element.parentNode).direction
);
}
return _getDirectionFromDir(document.dir);
}
return _getDirectionFromDir(
window.getComputedStyle(element).direction
);
}
function isImageElementSized(image) {
if (image.complete) {
return true;
}
if (image.clientWidth > 0 && image.clientHeight > 0) {
return true;
}
var widthAttribute = image.getAttribute("width");
var heightAttribute = image.getAttribute("height");
return (
!_.isNaN(parseFloat(widthAttribute)) &&
!_.isNaN(parseFloat(heightAttribute))
);
}
module.exports = {
getAbsoluteBoundsOfElement: getAbsoluteBoundsOfElement,
hideElement: hideElement,
restoreElementVisibility: restoreElementVisibility,
configureIDForElement: configureIDForElement,
getElementWithID: getElementWithID,
isElementDescendantOfElementWithTag: isElementDescendantOfElementWithTag,
getMentionElements: getMentionElements,
getDirectionOfElement: getDirectionOfElement,
DIRECTION: DIRECTION,
isImageElementSized: isImageElementSized
};
},
{ lodash: 11, "node-uuid": 12 }
],
31: [
function(require, module, exports) {
var FLAGS = {
RESTRICT_LAYOUT_INTERVAL: "RESTRICT_LAYOUT_INTERVAL",
LOG_TO_NATIVE: "LOG_TO_NATIVE",
LINKIFY_PHONE_NUMBER_COUNTRY: "LINKIFY_PHONE_NUMBER_COUNTRY",
REMOVE_MIN_HEIGHT_100_PERCENT: "REMOVE_MIN_HEIGHT_100_PERCENT"
};
var _flagToValues = {};
function setFlag(flag, value) {
_flagToValues[flag] = value;
}
function isEnabled(flag) {
return _flagToValues[flag] !== undefined;
}
function valueForFlag(flag) {
return _flagToValues[flag];
}
module.exports = {
flags: FLAGS,
setFlag: setFlag,
isEnabled: isEnabled,
valueForFlag: valueForFlag
};
},
{}
],
32: [
function(require, module, exports) {
var _ = require("lodash");
var ActionCreator = require("../actions/actionCreator");
var ElementManager = require("./elementManager");
var Config = require("../config");
var Hammer = require("hammerjs");
function _handleImageTap(img) {
if (
img.complete !== true ||
ElementManager.isElementDescendantOfElementWithTag(img, "a")
) {
log.info(
"interactionManager > Image is in link or not loaded. Do not create image tap action"
);
return;
}
if (_.isNil(img.src)) {
log.warn("interactionManager > Image is missing src");
return;
}
log.info("interactionManager > Create image tap action");
var ID = ElementManager.configureIDForElement(img);
ActionCreator.createImageTapAction(ID, img.src);
}
function _handleAnchorTap(a) {
var detectorType = a.getAttribute("x-apple-data-detectors-type");
switch (detectorType) {
case "calendar-event":
log.info(
"interactionManager > Calendar event. Create anchor tap action"
);
ActionCreator.createAnchorTapAction(a);
break;
case "link":
if (Config.interceptLinkLongTap) {
log.info(
"interactionManager > Calendar event. Create link tap action"
);
ActionCreator.createAnchorTapAction(a);
}
break;
}
}
function _handleBodyTap(e) {
var node = e.target;
var nodeName = _.toLower(node.tagName);
switch (nodeName) {
case "img":
_handleImageTap(node);
break;
case "a":
_handleAnchorTap(node);
break;
}
}
function _disableCalloutOfElementIfNeeded(element) {
var tagName = _.toLower(element.tagName);
if (tagName !== "a") {
return;
}
var detectorType = element.getAttribute(
"x-apple-data-detectors-type"
);
if (detectorType === "calendar-event" && !_.isNil(element.href)) {
log.info("interactionManager > Disable callout for calendar event");
element.style.webkitTouchCallout = "none";
element.href = _.replace(
element.href,
/^.*?:/,
"outlook-data-detector:"
);
}
}
function configureInteractions() {
log.info("interactionManager > configureInteractions");
var all = document.querySelectorAll("a");
_.forEach(all, function(a) {
_disableCalloutOfElementIfNeeded(a);
});
var observer = new MutationObserver(function(records) {
_.forEach(records, function(record) {
_.forEach(record.addedNodes, function(node) {
_disableCalloutOfElementIfNeeded(node);
});
});
});
observer.observe(document.body, { childList: true, subtree: true });
var manager = new Hammer.Manager(document.body, {
cssProps: { touchCallout: "inherit" }
});
var tap = new Hammer.Tap({ time: Number.MAX_VALUE });
manager.add([tap]);
manager.on("tap", _handleBodyTap);
var mentionElements = ElementManager.getMentionElements();
_.forEach(mentionElements, function(mention) {
mention.addEventListener("click", function(event) {
event.preventDefault();
var email = mention.getAttribute("href").slice("mailto:".length);
ActionCreator.createMentionTappedAction(email);
return false;
});
});
}
module.exports = { configureInteractions: configureInteractions };
},
{
"../actions/actionCreator": 14,
"../config": 18,
"./elementManager": 30,
hammerjs: 9,
lodash: 11
}
],
33: [
function(require, module, exports) {
var _ = require("lodash");
var Config = require("../config");
var FeatureFlagManager = require("./featureFlagManager");
var FeatureFlags = FeatureFlagManager.flags;
function _removeHiddenOafwindowsizediv() {
var element = document.getElementById("oafwindowsizediv");
if (_.isNil(element)) {
return;
}
if (
!_.isNil(element.parentNode) &&
(element.style.visibility === "hidden" ||
element.style.height === "100%")
) {
element.parentNode.removeChild(element);
}
}
function _transformOutlookMeetingsToDeepLinks() {
var meetingLinks = document.querySelectorAll(
'a[itemtype="microsoft.graph.event"]'
);
_.forEach(meetingLinks, function(link) {
var instanceID = link.getAttribute("itemid");
if (instanceID) {
link.setAttribute(
"href",
Config.scheme +
"://events/?instanceID=" +
encodeURIComponent(instanceID)
);
log.info(link.getAttribute("href"));
}
});
}
function _removeMinHeight100PercentStyle() {
var count = 0;
var allElements = document.querySelectorAll("*");
_.forEach(allElements, function(element) {
if (element.style.minHeight === "100%") {
element.style.minHeight = null;
count++;
}
});
log.info(
"customRules > Removed min-height:100% from " + count + " elements"
);
}
function applyCustomRules() {
_removeHiddenOafwindowsizediv();
var flag = FeatureFlags.REMOVE_MIN_HEIGHT_100_PERCENT;
if (
FeatureFlagManager.isEnabled(flag) &&
FeatureFlagManager.valueForFlag(flag)
) {
log.info(
"customRules > Removing min-height of 100% from all elements"
);
_removeMinHeight100PercentStyle();
}
_transformOutlookMeetingsToDeepLinks();
}
module.exports = { applyCustomRules: applyCustomRules };
},
{ "../config": 18, "./featureFlagManager": 31, lodash: 11 }
],
34: [
function(require, module, exports) {
var _ = require("lodash");
var Config = require("../config");
var DomHelper = require("../lib/domHelper");
var DomWalker = require("../lib/domWalker");
var FeatureFlagManager = require("./featureFlagManager");
var FeatureFlags = FeatureFlagManager.flags;
var CycleManager = require("../managers/cycleManager");
var CycleSteps = CycleManager.steps;
var ElementManager = require("./elementManager");
var LayoutCustomRulesManager = require("./layoutCustomRulesManager");
var ActionCreator = require("../actions/actionCreator");
var OVERFLOW_ELEMENT_CLASS = "outlook-overflow-scaling";
var OVERFLOW_ELEMENT_SCALE_ATTRIBUTE = "data-outlook-overflow-scale";
var _horizontalBounds;
var _lastLayoutDate;
var _nextLayoutTimeoutID;
function _prepareLayout() {
document.body.removeAttribute("width");
document.body.style.setProperty("width", "auto", "important");
document.body.removeAttribute("height");
document.body.style.setProperty("height", "auto", "important");
document.body.style.setProperty("min-height", "auto", "important");
document.body.style.setProperty("max-height", "auto", "important");
var bodyStyles = window.getComputedStyle(document.body);
var bodyPaddingLeft = parseFloat(bodyStyles.paddingLeft);
bodyPaddingLeft = _.isNaN(bodyPaddingLeft)
? Config.paddingHorizontal
: bodyPaddingLeft;
var bodyPaddingRight = parseFloat(bodyStyles.paddingRight);
bodyPaddingRight = _.isNaN(bodyPaddingRight)
? Config.paddingHorizontal
: bodyPaddingRight;
_horizontalBounds = {
left: bodyPaddingLeft,
right: Config.screenWidth - bodyPaddingRight
};
log.info(
"layoutManager > Set _horizontalBounds to:",
_horizontalBounds
);
_setViewport(Config.screenWidth, Config.userScalable);
}
function _layoutIfNeeded() {
log.info("layoutManager > _layoutIfNeeded");
if (!_.isNil(_nextLayoutTimeoutID)) {
clearTimeout(_nextLayoutTimeoutID);
_nextLayoutTimeoutID = null;
_lastLayoutDate = new Date();
_layout();
}
}
function _setNeedsLayout() {
log.info("layoutManager > _setNeedsLayout");
if (
FeatureFlagManager.isEnabled(FeatureFlags.RESTRICT_LAYOUT_INTERVAL)
) {
var minLayoutInterval = FeatureFlagManager.valueForFlag(
FeatureFlags.RESTRICT_LAYOUT_INTERVAL
);
if (!_.isNil(_nextLayoutTimeoutID)) {
return;
}
var intervalSinceLastLayout = _.isNil(_lastLayoutDate)
? Number.MAX_VALUE
: new Date() - _lastLayoutDate;
if (intervalSinceLastLayout >= minLayoutInterval) {
_lastLayoutDate = new Date();
_layout();
return;
}
_nextLayoutTimeoutID = setTimeout(function() {
_nextLayoutTimeoutID = null;
_lastLayoutDate = new Date();
_layout();
}, minLayoutInterval - intervalSinceLastLayout);
} else {
_layout();
}
}
function _layout() {
log.info("layoutManager > layout");
_adjustScaledElements();
var outOfBoundsRootElements = _getOutOfBoundsRootElements();
var responsibleElements = _.map(outOfBoundsRootElements, function(
element
) {
return _getResponsibleElementsForOutOfBoundsElement(element);
});
_.forEach(responsibleElements, function(elements) {
_.forEach(elements, function(element) {
_scaleElementsToFit(element);
});
});
CycleManager.setStep(CycleSteps.FIRST_LAYOUT_PASS);
document.body.offsetHeight;
ActionCreator.createRenderingPassAction();
}
function _getOutOfBoundsRootElements() {
var result = [];
DomWalker.breadthFirst(document.body, function(element) {
if (
_canElementBeResponsibleOfOutOfBounds(element) &&
!_elementFitsInHorizontalBounds(element)
) {
result.push(element);
return false;
}
return _canElementChildrenBeResponsibleOfOutOfBounds(element);
});
return result;
}
function _getResponsibleElementsForOutOfBoundsElement(rootElement) {
var result = [];
DomWalker.breadthFirst(rootElement, function(element) {
if (
_canElementBeResponsibleOfOutOfBounds(element) &&
_isElementWidthSet(element) &&
!_elementFitsInHorizontalBounds(element)
) {
result.push(element);
return false;
}
return _canElementChildrenBeResponsibleOfOutOfBounds(element);
});
if (_.isEmpty(result)) {
result = [rootElement];
}
return result;
}
function _canElementBeResponsibleOfOutOfBounds(element) {
if (!(element instanceof Element)) {
return false;
}
if (element === document.body) {
return false;
}
var computedStyle = window.getComputedStyle(element);
var tagName = _.toLower(element.tagName);
if (computedStyle.display === "none") {
return false;
}
var sizeableInlineElementTags = ["img"];
if (
computedStyle.display === "inline" &&
!_.includes(sizeableInlineElementTags, tagName)
) {
return false;
}
var ignoreElementTags = [
"base",
"head",
"link",
"meta",
"style",
"title",
"caption",
"col",
"colgroup",
"tbody",
"td",
"tfoot",
"th",
"thead",
"tr",
"script",
"noscript"
];
if (_.includes(ignoreElementTags, tagName)) {
return false;
}
return true;
}
function _canElementChildrenBeResponsibleOfOutOfBounds(element) {
if (!(element instanceof Element)) {
return false;
}
var xOverflow = window.getComputedStyle(element).overflowX;
if (xOverflow !== "auto" && xOverflow !== "visible") {
return false;
}
return true;
}
function _scaleElementsToFit(elementToScale) {
if (!(elementToScale instanceof Element)) {
return;
}
log.info(
"layoutManager > scaleElement: " +
_elementTagsFromElements([elementToScale])
);
var elementToScaleTotalBounds = _elementAndChildrenMaxBounds(
elementToScale
);
if (_.isNil(elementToScaleTotalBounds)) {
log.warn(
"layoutManager > Did not scale the element because couldn't compute bounds"
);
return;
}
if (_boundsFitInHorizontalBounds(elementToScaleTotalBounds)) {
log.warn(
"layoutManager > Did not scale the element because it is small enough already"
);
return;
}
var elementToScaleTotalWidth =
elementToScaleTotalBounds.right - elementToScaleTotalBounds.left;
var elementToScaleTotalHeight =
elementToScaleTotalBounds.bottom - elementToScaleTotalBounds.top;
if (elementToScaleTotalWidth === 0) {
log.warn(
"layoutManager > Did not scale the element because width is 0"
);
}
var elementToScaleBounds = ElementManager.getAbsoluteBoundsOfElement(
elementToScale
);
var wrapperElementWidth = Math.max(
_horizontalBounds.right -
Math.max(elementToScaleBounds.outer.left, _horizontalBounds.left),
0
);
var scale = wrapperElementWidth / elementToScaleTotalWidth;
var wrapperElementHeight = _.ceil(elementToScaleTotalHeight * scale);
log.info("layoutManager > element scale: " + scale);
log.info(
"layoutManager > element size: (" +
elementToScaleTotalWidth +
", " +
elementToScaleTotalHeight +
")"
);
log.info(
"layoutManager > wrapper size: (" +
wrapperElementWidth +
", " +
wrapperElementHeight +
")"
);
if (_.isNaN(scale) || scale <= 0 || scale >= 1) {
log.error(
"layoutManager > Could not scale element with scale: " + scale
);
return;
}
var wrapperElement = document.createElement("span");
wrapperElement.style.display = "block";
wrapperElement.style.overflow = "hidden";
wrapperElement.style.width = wrapperElementWidth + "px";
wrapperElement.style.height = wrapperElementHeight + "px";
wrapperElement.style.setProperty("margin", "0", "!important");
wrapperElement.style.setProperty("padding", "0", "!important");
wrapperElement.className = OVERFLOW_ELEMENT_CLASS;
wrapperElement.setAttribute(OVERFLOW_ELEMENT_SCALE_ATTRIBUTE, scale);
elementToScale.style.webkitTransform = "scale(" + scale + ")";
var originLeft =
elementToScaleBounds.outer.left - elementToScaleBounds.border.left;
var originTop =
elementToScaleBounds.outer.top - elementToScaleBounds.border.top;
if (
ElementManager.getDirectionOfElement(elementToScale) ===
ElementManager.DIRECTION.LTR
) {
elementToScale.style.webkitTransformOrigin =
originLeft + "px " + originTop + "px";
var offsetLeft = Math.min(
elementToScaleTotalBounds.left - _horizontalBounds.left,
0
);
if (offsetLeft < 0) {
wrapperElement.style.paddingLeft = -offsetLeft + "px";
}
} else {
var originRight =
elementToScaleBounds.outer.right -
elementToScaleBounds.border.right;
elementToScale.style.webkitTransformOrigin =
elementToScaleBounds.outer.width +
originLeft -
originRight +
"px " +
originTop +
"px";
var offsetRight = Math.max(
elementToScaleTotalBounds.right - _horizontalBounds.right,
0
);
if (offsetRight > 0) {
wrapperElement.style.paddingRight = offsetRight + "px";
}
}
elementToScale.parentNode.replaceChild(
wrapperElement,
elementToScale
);
wrapperElement.appendChild(elementToScale);
}
function _adjustScaledElements() {
var wrapperElements = document.querySelectorAll(
"." + OVERFLOW_ELEMENT_CLASS
);
_.forEach(wrapperElements, function(wrapperElement) {
var wrapperElementWidth = parseFloat(wrapperElement.style.width);
if (_.isNaN(wrapperElementWidth)) {
log.error(
"layoutManager > Wrapper element should have a set width"
);
return;
}
var childElementScale = parseFloat(
wrapperElement.getAttribute(OVERFLOW_ELEMENT_SCALE_ATTRIBUTE)
);
if (
_.isNaN(childElementScale) ||
childElementScale <= 0 ||
childElementScale >= 1
) {
log.error(
"layoutManager > Scale should be between 0 and 1: " +
childElementScale
);
return;
}
if (
_.isNil(wrapperElement.hasChildNodes) ||
wrapperElement.childNodes.length !== 1
) {
log.error(
"layoutManager > Wrapper element should have exactly one child"
);
return;
}
var childElement = _.first(wrapperElement.childNodes);
var childElementBounds = _elementAndChildrenMaxBounds(childElement);
if (_.isNil(childElementBounds)) {
log.warn(
"layoutManager > Did not adjust scaled element because couldn't compute bounds"
);
return;
}
var childElementScaledWidth =
childElementBounds.right - childElementBounds.left;
var childElementUnscaledHeight = _.ceil(
(childElementBounds.bottom - childElementBounds.top) /
childElementScale
);
if (childElementScaledWidth > wrapperElementWidth) {
var childElementUnscaledWidth = _.ceil(
childElementScaledWidth / childElementScale
);
childElementScale =
wrapperElementWidth / childElementUnscaledWidth;
if (!_.isNaN(childElementScale) && childElementScale > 0) {
childElement.style.webkitTransform =
"scale(" + childElementScale + ")";
wrapperElement.setAttribute(
OVERFLOW_ELEMENT_SCALE_ATTRIBUTE,
childElementScale
);
}
}
var childElementScaledHeight =
childElementUnscaledHeight * childElementScale;
wrapperElement.style.height =
_.ceil(childElementScaledHeight) + "px";
});
}
function _elementAndChildrenMaxBounds(rootElement) {
if (!(rootElement instanceof Element)) {
return null;
}
var maxInfo = {
left: Number.MAX_VALUE,
top: Number.MAX_VALUE,
right: -Number.MAX_VALUE,
bottom: -Number.MAX_VALUE
};
DomWalker.breadthFirst(rootElement, function(element) {
if (_canElementBeResponsibleOfOutOfBounds(element)) {
var elementBounds = ElementManager.getAbsoluteBoundsOfElement(
element
);
maxInfo = {
left: Math.min(maxInfo.left, elementBounds.outer.left),
top: Math.min(maxInfo.top, elementBounds.outer.top),
right: Math.max(maxInfo.right, elementBounds.outer.right),
bottom: Math.max(maxInfo.bottom, elementBounds.outer.bottom)
};
}
return _canElementChildrenBeResponsibleOfOutOfBounds(element);
});
return maxInfo;
}
function _isElementWidthSet(element) {
if (!(element instanceof Element)) {
return false;
}
var tagName = _.toLower(element.tagName);
if (tagName === "table") {
var tds = element.querySelectorAll("tr > td");
_.forEach(tds, function(td) {
if (_isElementWidthSet(td)) {
return true;
}
});
}
return (
!_.isNaN(parseFloat(element.getAttribute("width"))) ||
!_.isNaN(parseFloat(element.style.width)) ||
!_.isNaN(parseFloat(element.style.minWidth))
);
}
function _elementTagsFromElements(elements) {
return _.map(elements, function(element) {
if (!(element instanceof Element)) {
return "NO TAG";
}
return _.toUpper(element.tagName);
});
}
function _linkifyPhoneNumbers() {
var VALID_PUNCTUATION =
"-‐-―−ー--/  ­​⁠ " + "()()[].\\[\\]/~⁓∼~";
var nodes = DomHelper.getNonLinkifiedTextNodes(document.body);
var numberPattern =
"[" +
PhoneNumber.PhoneNumberUtil.PLUS_CHARS_ +
"]*(?:[" +
VALID_PUNCTUATION +
PhoneNumber.PhoneNumberUtil.STAR_SIGN_ +
"]*[" +
PhoneNumber.PhoneNumberUtil.VALID_DIGITS_ +
"]){3,}[" +
VALID_PUNCTUATION +
PhoneNumber.PhoneNumberUtil.STAR_SIGN_ +
PhoneNumber.PhoneNumberUtil.VALID_DIGITS_ +
"]*";
var CAPTURING_EXTN_DIGITS =
"([" + PhoneNumber.PhoneNumberUtil.VALID_DIGITS_ + "]{1,})";
var extensionPattern =
"(?:" +
PhoneNumber.PhoneNumberUtil.RFC3966_EXTN_PREFIX_ +
CAPTURING_EXTN_DIGITS +
"|" +
"([  \\t,]*)" +
"(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|" +
"([;,xx##~~])" +
"|int|anexo|int)" +
"[:\\..]?[  \\t,-]*" +
CAPTURING_EXTN_DIGITS +
"(#?)|" +
"[- ]+([" +
PhoneNumber.PhoneNumberUtil.VALID_DIGITS_ +
"]{1,5})(#)" +
")?";
var regex = new RegExp(numberPattern + extensionPattern, "ig");
var count = 0;
function replacer(s, p1, p2, p3, p4, p5) {
var countryCode = FeatureFlagManager.valueForFlag(
FeatureFlags.LINKIFY_PHONE_NUMBER_COUNTRY
);
if (_.isNil(countryCode)) {
countryCode = "ZZ";
}
var number;
try {
number = PhoneUtil.parse(s, countryCode);
} catch (err) {
log.error(
"layoutManager > _linkifyPhoneNumbers > [" + s + "] " + err
);
var matches = s.match(numberPattern);
if (_.isNil(matches) || matches.length < 1) {
log.error(
"layoutManager > _linkifyPhoneNumbers > [" +
s +
"] is not a phone number."
);
return s;
}
try {
number = PhoneUtil.parse(matches[0], countryCode);
if (!_.isNil(p4)) {
number.setExtension(p4);
}
} catch (err) {
log.error(
"layoutManager > _linkifyPhoneNumbers > [" +
matches[0] +
"] " +
err
);
return s;
}
}
var isValidCountryPhoneNumber = PhoneUtil.isValidNumberForRegion(
number,
countryCode
);
if (
isValidCountryPhoneNumber ||
PhoneUtil.isPossibleNumber(number)
) {
var link = PhoneUtil.format(number, PhoneNumberFormat.E164);
if (number.hasExtension()) {
var wait = "";
if (!_.isNil(p2)) {
wait += p2;
}
if (!_.isNil(p3) && (p3 === "," || p3 === ";")) {
wait += p3;
}
if (wait === "") {
wait = ",";
}
link += wait + number.getExtension();
if (!_.isNil(p5)) {
link += p5;
}
}
count++;
var anchor = "";
if (s.startsWith(" ")) {
anchor += " ";
}
anchor += '<a href="tel:' + link + '">' + s.trim() + "</a>";
if (s.endsWith(" ")) {
anchor += " ";
}
return anchor;
}
return s;
}
_.forEach(nodes, function(node) {
count = 0;
var linkifiedText = _.replace(node.textContent, regex, replacer);
if (count > 0) {
var replacementNode = document.createElement("span");
replacementNode.innerHTML = linkifiedText;
if (!_.isNil(node.parentNode)) {
node.parentNode.replaceChild(replacementNode, node);
}
}
});
}
function _linkifyUrls() {
var options = {
className: function(href, type) {
return "";
},
target: function(href, type) {
return "";
},
ignoreTags: ["script", "style"],
validate: {
url: function(value) {
if (value.indexOf("//") === 0) {
return false;
}
return true;
}
}
};
LinkifyElement(document.body, options);
}
function _fixEmptyImageAlts() {
var imageTags = document.querySelectorAll("img");
_.forEach(imageTags, function(imageTag) {
if (!imageTag.hasAttribute("alt")) {
imageTag.alt = Config.imageAltString;
}
});
}
function _fixEmptyHrefs() {
var links = document.querySelectorAll('[href=""]');
_.forEach(links, function(link) {
link.removeAttribute("href");
link.style.pointerEvents = "none";
});
}
function _elementFitsInHorizontalBounds(element) {
if (!(element instanceof Element)) {
return true;
}
var bounds = ElementManager.getAbsoluteBoundsOfElement(element);
return _boundsFitInHorizontalBounds(bounds.outer);
}
function _boundsFitInHorizontalBounds(bounds) {
return (
bounds.left >= _horizontalBounds.left &&
bounds.right <= _horizontalBounds.right
);
}
function _setViewport(viewportWidth, userScalable) {
var viewportContentWidth = "width=" + viewportWidth;
var viewportMinimumScale = "minimum-scale=" + Config.minimumScale;
var viewportMaximumScale = "maximum-scale=" + Config.maximumScale;
var viewportUserScalable = (function() {
if (_.isNil(userScalable)) {
return null;
}
return userScalable ? "user-scalable=yes" : "user-scalable=no";
})();
var viewportAttribute = _.join(
_.filter(
[
viewportContentWidth,
viewportMinimumScale,
viewportMaximumScale,
viewportUserScalable
],
function(a) {
return a !== null;
}
),
", "
);
var head = DomHelper.getOrCreateHeadForDocument(document);
var viewport = document.querySelector("meta[name=viewport]");
log.info("layoutManager > Set viewport to: " + viewportAttribute);
if (viewport) {
viewport.setAttribute("content", viewportAttribute);
} else {
var meta = document.createElement("meta");
meta.setAttribute("name", "viewport");
meta.setAttribute("content", viewportAttribute);
head.appendChild(meta);
}
}
function layout(callback) {
_prepareLayout();
_fixEmptyHrefs();
_fixEmptyImageAlts();
LayoutCustomRulesManager.applyCustomRules();
var nonSizedImages = DomHelper.getNonSizedImageElements();
var sizeImageAndLayout = function(e) {
var image = e.target;
if (image.clientWidth > 0 && image.clientHeight > 0) {
image.width = image.clientWidth;
image.height = image.clientHeight;
}
_setNeedsLayout();
};
_.forEach(nonSizedImages, function(image) {
image.addEventListener("load", sizeImageAndLayout);
image.addEventListener("error", _setNeedsLayout);
});
_setNeedsLayout();
_layoutIfNeeded();
DomHelper.executeOnDomReadyState(
DomHelper.domStatuses.COMPLETE,
function() {
log.info(
"layoutManager > DOM completely loaded: all images have loaded as well"
);
_setNeedsLayout();
_layoutIfNeeded();
document.body.offsetHeight;
callback();
}
);
}
module.exports = { layout: layout };
},
{
"../actions/actionCreator": 14,
"../config": 18,
"../lib/domHelper": 22,
"../lib/domWalker": 23,
"../managers/cycleManager": 29,
"./elementManager": 30,
"./featureFlagManager": 31,
"./layoutCustomRulesManager": 33,
lodash: 11
}
],
35: [
function(require, module, exports) {
var _ = require("lodash");
var Config = require("../config");
var CycleManager = require("../managers/cycleManager");
var ElementManager = require("../managers/elementManager");
var CycleSteps = CycleManager.steps;
var StyleSheet = require("../lib/stylesheet");
var COLOR_MENTIONED_DEFAULT = "#212121";
var COLOR_MENTIONED_ME = "#0072C6";
var BACKGROUND_COLOR_MENTIONED_DEFAULT = "#F1F1F1";
var BACKGROUND_COLOR_MENTIONED_ME = "#E9F3FB";
var CORNER_RADIUS_MENTION = "4px";
var PADDING_MENTION = "0 2px 0 2px";
var LINE_HEIGHT = "150%";
function _improveHTML() {
log.info("styleManager > _improveHTML");
var amContainerDiv = null;
if (Config.isActionableMessage && Config.amContainerDivId) {
amContainerDiv = document.getElementById(Config.amContainerDivId);
if (!_.isNil(amContainerDiv)) {
amContainerDiv.parentNode.removeChild(amContainerDiv);
}
}
var bodyClone = document.body.cloneNode(true);
var scriptInnerHTMLs = _.map(
bodyClone.querySelectorAll("script"),
function(script) {
return script.innerHTML;
}
);
bodyClone.innerHTML = _.replace(
bodyClone.innerHTML,
/(&nbsp;)(?!\s*<\/)/g,
" "
);
_.forEach(bodyClone.querySelectorAll("script"), function(
script,
index
) {
script.innerHTML = scriptInnerHTMLs[index];
});
if (document.body.innerHTML !== bodyClone.innerHTML) {
document.body.innerHTML = bodyClone.innerHTML;
}
if (!_.isNil(amContainerDiv)) {
document.body.prepend(amContainerDiv);
}
}
function _highlightMentions() {
log.info("styleManager > _highlightMentions");
var mentionElements = ElementManager.getMentionElements();
var userEmailAddresses = _.map(Config.userEmailAddresses, function(
email
) {
return _.toLower(email);
});
_.forEach(mentionElements, function(element) {
var mailTo = _.toLower(element.getAttribute("href")).slice(
"mailto:".length
);
var mentionMe = _.includes(userEmailAddresses, mailTo);
if (mentionMe) {
element.style.color = COLOR_MENTIONED_ME;
element.style.backgroundColor = BACKGROUND_COLOR_MENTIONED_ME;
} else {
element.style.color = COLOR_MENTIONED_DEFAULT;
element.style.backgroundColor = BACKGROUND_COLOR_MENTIONED_DEFAULT;
}
element.style.textDecoration = "none";
element.style.borderRadius = CORNER_RADIUS_MENTION;
element.style.padding = PADDING_MENTION;
});
}
function _insertStyles() {
log.info("styleManager > _insertStyles");
StyleSheet.insertStyles({
body: {
padding:
Config.paddingVertical +
"px " +
Config.paddingHorizontal +
"px !important",
"box-sizing": "border-box",
margin: "0",
color: "#212121",
"font-family": "'-apple-system', 'HelveticaNeue'",
"font-size": "12pt",
"word-wrap": "break-word",
"-webkit-text-size-adjust": Config.textZoom + "%",
"-webkit-touch-callout": Config.selectionEnabled
? "default"
: "none",
"-webkit-user-select": Config.selectionEnabled ? "text" : "none"
},
pre: { "white-space": "pre-wrap" },
"a[href], a[href]:active": { color: "#0072C6" },
"[x-apple-data-detectors=true]": { color: "#0072C6" },
'[x-apple-data-detectors-type="calendar-event"]': {
color: "#0072C6 !important",
"-webkit-text-decoration-color": "#0072C6 !important"
},
hr: { width: "100% !important" },
blockquote: { margin: "0px 10px !important" }
});
if (Config.hideHtmlBlob) {
StyleSheet.insertStyles({
"#OwaReferenceAttachments": { display: "none" }
});
}
if (Config.canAcceptSharedCalendar) {
StyleSheet.insertStyles({
"#SharingAcceptButtonRow.OLK-Hidden": { display: "none" }
});
}
}
function _insertLineHeights() {
document.body.style.lineHeight = LINE_HEIGHT;
var elementsWithFonts = document.querySelectorAll(
"[style*='font-size']:not([style*='line-height']), font:not([style*='line-height'])"
);
_.forEach(elementsWithFonts, function(element) {
element.style.lineHeight = LINE_HEIGHT;
});
}
function style() {
if (CycleManager.alreadyDidStep(CycleSteps.INSERT_STYLES)) {
return;
}
_improveHTML();
_insertStyles();
_insertLineHeights();
if (Config.mentionsUIEnabled) {
_highlightMentions();
}
CycleManager.setStep(CycleSteps.INSERT_STYLES);
}
module.exports = { style: style };
},
{
"../config": 18,
"../lib/stylesheet": 27,
"../managers/cycleManager": 29,
"../managers/elementManager": 30,
lodash: 11
}
]
},
{},
[28]
);
configureMessage({
screenWidth: 343,
paddingHorizontal: 0,
paddingVertical: 0,
textZoom: 100,
userScalable: false,
interceptLinkLongTap: false,
selectionEnabled: false,
mentionsUIEnabled: false,
canAcceptSharedCalendar: false,
hideHtmlBlob: false
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment