diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index 5a566cd311..e209aacaed 100644 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -25455,7353 +25455,14651 @@ module.exports = Array.isArray || function (arr) { exports["jsQR"] = factory(); else root["jsQR"] = factory(); -})(this, function() { +})(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; - +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { - +/******/ /******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) +/******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; - +/******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} /******/ }; - +/******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - +/******/ /******/ // Flag the module as loaded -/******/ module.loaded = true; - +/******/ module.l = true; +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } - - +/******/ +/******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; - +/******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; - +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; - +/******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(0); +/******/ return __webpack_require__(__webpack_require__.s = 3); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /// - var binarizer_1 = __webpack_require__(1); - var locator_1 = __webpack_require__(3); - var extractor_1 = __webpack_require__(4); - var decoder_1 = __webpack_require__(9); - var bitmatrix_1 = __webpack_require__(2); - var binarizeImage = binarizer_1.binarize; - exports.binarizeImage = binarizeImage; - var locateQRInBinaryImage = locator_1.locate; - exports.locateQRInBinaryImage = locateQRInBinaryImage; - var extractQRFromBinaryImage = extractor_1.extract; - exports.extractQRFromBinaryImage = extractQRFromBinaryImage; - function decodeQR(matrix) { - return byteArrayToString(decoder_1.decode(matrix)); - } - exports.decodeQR = decodeQR; - // return bytes.reduce((p, b) => p + String.fromCharCode(b), ""); - function byteArrayToString(bytes) { - var str = ""; - if (bytes != null && bytes != undefined) { - for (var i = 0; i < bytes.length; i++) { - str += String.fromCharCode(bytes[i]); - } - } - return str; - } - function createBitMatrix(data, width) { - return new bitmatrix_1.BitMatrix(data, width); - } - exports.createBitMatrix = createBitMatrix; - function decodeQRFromImage(data, width, height) { - return byteArrayToString(decodeQRFromImageAsByteArray(data, width, height)); - } - exports.decodeQRFromImage = decodeQRFromImage; - function decodeQRFromImageAsByteArray(data, width, height) { - var binarizedImage = binarizeImage(data, width, height); - var location = locator_1.locate(binarizedImage); - if (!location) { - return null; - } - var rawQR = extractor_1.extract(binarizedImage, location); - if (!rawQR) { - return null; - } - return decoder_1.decode(rawQR); - } - exports.decodeQRFromImageAsByteArray = decodeQRFromImageAsByteArray; - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var bitmatrix_1 = __webpack_require__(2); - // Magic Constants - var BLOCK_SIZE_POWER = 3; - var BLOCK_SIZE = 1 << BLOCK_SIZE_POWER; - var BLOCK_SIZE_MASK = BLOCK_SIZE - 1; - var MIN_DYNAMIC_RANGE = 24; - function calculateBlackPoints(luminances, subWidth, subHeight, width, height) { - var blackPoints = new Array(subHeight); - for (var i = 0; i < subHeight; i++) { - blackPoints[i] = new Array(subWidth); - } - for (var y = 0; y < subHeight; y++) { - var yoffset = y << BLOCK_SIZE_POWER; - var maxYOffset = height - BLOCK_SIZE; - if (yoffset > maxYOffset) { - yoffset = maxYOffset; - } - for (var x = 0; x < subWidth; x++) { - var xoffset = x << BLOCK_SIZE_POWER; - var maxXOffset = width - BLOCK_SIZE; - if (xoffset > maxXOffset) { - xoffset = maxXOffset; - } - var sum = 0; - var min = 0xFF; - var max = 0; - for (var yy = 0, offset = yoffset * width + xoffset; yy < BLOCK_SIZE; yy++, offset += width) { - for (var xx = 0; xx < BLOCK_SIZE; xx++) { - var pixel = luminances[offset + xx] & 0xFF; - // still looking for good contrast - sum += pixel; - if (pixel < min) { - min = pixel; - } - if (pixel > max) { - max = pixel; - } - } - // short-circuit min/max tests once dynamic range is met - if (max - min > MIN_DYNAMIC_RANGE) { - // finish the rest of the rows quickly - for (yy++, offset += width; yy < BLOCK_SIZE; yy++, offset += width) { - for (var xx = 0; xx < BLOCK_SIZE; xx++) { - sum += luminances[offset + xx] & 0xFF; - } - } - } - } - // The default estimate is the average of the values in the block. - var average = sum >> (BLOCK_SIZE_POWER * 2); - if (max - min <= MIN_DYNAMIC_RANGE) { - // If variation within the block is low, assume this is a block with only light or only - // dark pixels. In that case we do not want to use the average, as it would divide this - // low contrast area into black and white pixels, essentially creating data out of noise. - // - // The default assumption is that the block is light/background. Since no estimate for - // the level of dark pixels exists locally, use half the min for the block. - average = min >> 1; - if (y > 0 && x > 0) { - // Correct the "white background" assumption for blocks that have neighbors by comparing - // the pixels in this block to the previously calculated black points. This is based on - // the fact that dark barcode symbology is always surrounded by some amount of light - // background for which reasonable black point estimates were made. The bp estimated at - // the boundaries is used for the interior. - // The (min < bp) is arbitrary but works better than other heuristics that were tried. - var averageNeighborBlackPoint = (blackPoints[y - 1][x] + (2 * blackPoints[y][x - 1]) + blackPoints[y - 1][x - 1]) >> 2; - if (min < averageNeighborBlackPoint) { - average = averageNeighborBlackPoint; - } - } - } - blackPoints[y][x] = average; - } - } - return blackPoints; - } - function calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints) { - function cap(value, min, max) { - return value < min ? min : value > max ? max : value; - } - // var outArray = new Array(width * height); - var outMatrix = bitmatrix_1.BitMatrix.createEmpty(width, height); - function thresholdBlock(luminances, xoffset, yoffset, threshold, stride) { - var offset = (yoffset * stride) + xoffset; - for (var y = 0; y < BLOCK_SIZE; y++, offset += stride) { - for (var x = 0; x < BLOCK_SIZE; x++) { - var pixel = luminances[offset + x] & 0xff; - // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0. - outMatrix.set(xoffset + x, yoffset + y, pixel <= threshold); - } - } - } - for (var y = 0; y < subHeight; y++) { - var yoffset = y << BLOCK_SIZE_POWER; - var maxYOffset = height - BLOCK_SIZE; - if (yoffset > maxYOffset) { - yoffset = maxYOffset; - } - for (var x = 0; x < subWidth; x++) { - var xoffset = x << BLOCK_SIZE_POWER; - var maxXOffset = width - BLOCK_SIZE; - if (xoffset > maxXOffset) { - xoffset = maxXOffset; - } - var left = cap(x, 2, subWidth - 3); - var top = cap(y, 2, subHeight - 3); - var sum = 0; - for (var z = -2; z <= 2; z++) { - var blackRow = blackPoints[top + z]; - sum += blackRow[left - 2]; - sum += blackRow[left - 1]; - sum += blackRow[left]; - sum += blackRow[left + 1]; - sum += blackRow[left + 2]; - } - var average = sum / 25; - thresholdBlock(luminances, xoffset, yoffset, average, width); - } - } - return outMatrix; - } - function binarize(data, width, height) { - if (data.length !== width * height * 4) { - throw new Error("Binarizer data.length != width * height * 4"); - } - var gsArray = new Array(width * height); - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var startIndex = (y * width + x) * 4; - var r = data[startIndex]; - var g = data[startIndex + 1]; - var b = data[startIndex + 2]; - // Magic lumosity constants - var lum = 0.2126 * r + 0.7152 * g + 0.0722 * b; - gsArray[y * width + x] = lum; - } - } - var subWidth = width >> BLOCK_SIZE_POWER; - if ((width & BLOCK_SIZE_MASK) != 0) { - subWidth++; - } - var subHeight = height >> BLOCK_SIZE_POWER; - if ((height & BLOCK_SIZE_MASK) != 0) { - subHeight++; - } - var blackPoints = calculateBlackPoints(gsArray, subWidth, subHeight, width, height); - return calculateThresholdForBlock(gsArray, subWidth, subHeight, width, height, blackPoints); - } - exports.binarize = binarize; - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - "use strict"; - var BitMatrix = (function () { - function BitMatrix(data, width) { - this.width = width; - this.height = data.length / width; - this.data = data; - } - BitMatrix.createEmpty = function (width, height) { - var data = new Array(width * height); - for (var i = 0; i < data.length; i++) { - data[i] = false; - } - return new BitMatrix(data, width); - }; - BitMatrix.prototype.get = function (x, y) { - return this.data[y * this.width + x]; - }; - BitMatrix.prototype.set = function (x, y, v) { - this.data[y * this.width + x] = v; - }; - BitMatrix.prototype.copyBit = function (x, y, versionBits) { - return this.get(x, y) ? (versionBits << 1) | 0x1 : versionBits << 1; - }; - BitMatrix.prototype.setRegion = function (left, top, width, height) { - var right = left + width; - var bottom = top + height; - for (var y = top; y < bottom; y++) { - for (var x = left; x < right; x++) { - this.set(x, y, true); - } - } - }; - BitMatrix.prototype.mirror = function () { - for (var x = 0; x < this.width; x++) { - for (var y = x + 1; y < this.height; y++) { - if (this.get(x, y) != this.get(y, x)) { - this.set(x, y, !this.get(x, y)); - this.set(y, x, !this.get(y, x)); - } - } - } - }; - return BitMatrix; - }()); - exports.BitMatrix = BitMatrix; - - -/***/ }, -/* 3 */ -/***/ function(module, exports) { - - "use strict"; - var CENTER_QUORUM = 2; - var MIN_SKIP = 3; - var MAX_MODULES = 57; - var INTEGER_MATH_SHIFT = 8; - var FinderPattern = (function () { - function FinderPattern(x, y, estimatedModuleSize, count) { - this.x = x; - this.y = y; - this.estimatedModuleSize = estimatedModuleSize; - if (count == null) { - this.count = 1; - } - else { - this.count = count; - } - } - FinderPattern.prototype.aboutEquals = function (moduleSize, i, j) { - if (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize) { - var moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize); - return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this.estimatedModuleSize; - } - return false; - }; - FinderPattern.prototype.combineEstimate = function (i, j, newModuleSize) { - var combinedCount = this.count + 1; - var combinedX = (this.count * this.x + j) / combinedCount; - var combinedY = (this.count * this.y + i) / combinedCount; - var combinedModuleSize = (this.count * this.estimatedModuleSize + newModuleSize) / combinedCount; - return new FinderPattern(combinedX, combinedY, combinedModuleSize, combinedCount); - }; - return FinderPattern; - }()); - function foundPatternCross(stateCount) { - var totalModuleSize = 0; - for (var i = 0; i < 5; i++) { - var count = stateCount[i]; - if (count === 0) - return false; - totalModuleSize += count; - } - if (totalModuleSize < 7) - return false; - var moduleSize = (totalModuleSize << INTEGER_MATH_SHIFT) / 7; - var maxVariance = moduleSize / 2; - // Allow less than 50% variance from 1-1-3-1-1 proportions - return Math.abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance && - Math.abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance && - Math.abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance && - Math.abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance && - Math.abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance; - } - function centerFromEnd(stateCount, end) { - var result = (end - stateCount[4] - stateCount[3]) - stateCount[2] / 2; - // Fix this. - if (result !== result) { - return null; - } - return result; - } - function distance(pattern1, pattern2) { - var a = pattern1.x - pattern2.x; - var b = pattern1.y - pattern2.y; - return Math.sqrt(a * a + b * b); - } - function crossProductZ(pointA, pointB, pointC) { - var bX = pointB.x; - var bY = pointB.y; - return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX)); - } - function ReorderFinderPattern(patterns) { - // Find distances between pattern centers - var zeroOneDistance = distance(patterns[0], patterns[1]); - var oneTwoDistance = distance(patterns[1], patterns[2]); - var zeroTwoDistance = distance(patterns[0], patterns[2]); - var pointA, pointB, pointC; - // Assume one closest to other two is B; A and C will just be guesses at first - if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) { - pointB = patterns[0]; - pointA = patterns[1]; - pointC = patterns[2]; - } - else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) { - pointB = patterns[1]; - pointA = patterns[0]; - pointC = patterns[2]; - } - else { - pointB = patterns[2]; - pointA = patterns[0]; - pointC = patterns[1]; - } - // Use cross product to figure out whether A and C are correct or flipped. - // This asks whether BC x BA has a positive z component, which is the arrangement - // we want for A, B, C. If it's negative, then we've got it flipped around and - // should swap A and C. - if (crossProductZ(pointA, pointB, pointC) < 0) { - var temp = pointA; - pointA = pointC; - pointC = temp; - } - return { - bottomLeft: { x: pointA.x, y: pointA.y }, - topLeft: { x: pointB.x, y: pointB.y }, - topRight: { x: pointC.x, y: pointC.y } - }; - } - function locate(matrix) { - // Global state :( - var possibleCenters = []; - var hasSkipped = false; - function get(x, y) { - x = Math.floor(x); - y = Math.floor(y); - return matrix.get(x, y); - } - // Methods - function crossCheckDiagonal(startI, centerJ, maxCount, originalStateCountTotal) { - var maxI = matrix.height; - var maxJ = matrix.width; - var stateCount = [0, 0, 0, 0, 0]; - // Start counting up, left from center finding black center mass - var i = 0; - while (startI - i >= 0 && get(centerJ - i, startI - i)) { - stateCount[2]++; - i++; - } - if ((startI - i < 0) || (centerJ - i < 0)) { - return false; - } - // Continue up, left finding white space - while ((startI - i >= 0) && (centerJ - i >= 0) && !get(centerJ - i, startI - i) && stateCount[1] <= maxCount) { - stateCount[1]++; - i++; - } - // If already too many modules in this state or ran off the edge: - if ((startI - i < 0) || (centerJ - i < 0) || stateCount[1] > maxCount) { - return false; - } - // Continue up, left finding black border - while ((startI - i >= 0) && (centerJ - i >= 0) && get(centerJ - i, startI - i) && stateCount[0] <= maxCount) { - stateCount[0]++; - i++; - } - if (stateCount[0] > maxCount) { - return false; - } - // Now also count down, right from center - i = 1; - while ((startI + i < maxI) && (centerJ + i < maxJ) && get(centerJ + i, startI + i)) { - stateCount[2]++; - i++; - } - // Ran off the edge? - if ((startI + i >= maxI) || (centerJ + i >= maxJ)) { - return false; - } - while ((startI + i < maxI) && (centerJ + i < maxJ) && !get(centerJ + i, startI + i) && stateCount[3] < maxCount) { - stateCount[3]++; - i++; - } - if ((startI + i >= maxI) || (centerJ + i >= maxJ) || stateCount[3] >= maxCount) { - return false; - } - while ((startI + i < maxI) && (centerJ + i < maxJ) && get(centerJ + i, startI + i) && stateCount[4] < maxCount) { - stateCount[4]++; - i++; - } - if (stateCount[4] >= maxCount) { - return false; - } - // If we found a finder-pattern-like section, but its size is more than 100% different than - // the original, assume it's a false positive - var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; - return Math.abs(stateCountTotal - originalStateCountTotal) < 2 * originalStateCountTotal && - foundPatternCross(stateCount); - } - function crossCheckVertical(startI, centerJ, maxCount, originalStateCountTotal) { - var maxI = matrix.height; - var stateCount = [0, 0, 0, 0, 0]; - // Start counting up from center - var i = startI; - while (i >= 0 && get(centerJ, i)) { - stateCount[2]++; - i--; - } - if (i < 0) { - return null; - } - while (i >= 0 && !get(centerJ, i) && stateCount[1] <= maxCount) { - stateCount[1]++; - i--; - } - // If already too many modules in this state or ran off the edge: - if (i < 0 || stateCount[1] > maxCount) { - return null; - } - while (i >= 0 && get(centerJ, i) && stateCount[0] <= maxCount) { - stateCount[0]++; - i--; - } - if (stateCount[0] > maxCount) { - return null; - } - // Now also count down from center - i = startI + 1; - while (i < maxI && get(centerJ, i)) { - stateCount[2]++; - i++; - } - if (i == maxI) { - return null; - } - while (i < maxI && !get(centerJ, i) && stateCount[3] < maxCount) { - stateCount[3]++; - i++; - } - if (i == maxI || stateCount[3] >= maxCount) { - return null; - } - while (i < maxI && get(centerJ, i) && stateCount[4] < maxCount) { - stateCount[4]++; - i++; - } - if (stateCount[4] >= maxCount) { - return null; - } - // If we found a finder-pattern-like section, but its size is more than 40% different than - // the original, assume it's a false positive - var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; - if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) { - return null; - } - return foundPatternCross(stateCount) ? centerFromEnd(stateCount, i) : null; - } - function haveMultiplyConfirmedCenters() { - var confirmedCount = 0; - var totalModuleSize = 0; - var max = possibleCenters.length; - possibleCenters.forEach(function (pattern) { - if (pattern.count >= CENTER_QUORUM) { - confirmedCount++; - totalModuleSize += pattern.estimatedModuleSize; - } - }); - if (confirmedCount < 3) { - return false; - } - // OK, we have at least 3 confirmed centers, but, it's possible that one is a "false positive" - // and that we need to keep looking. We detect this by asking if the estimated module sizes - // vary too much. We arbitrarily say that when the total deviation from average exceeds - // 5% of the total module size estimates, it's too much. - var average = totalModuleSize / max; - var totalDeviation = 0; - for (var i = 0; i < max; i++) { - var pattern = possibleCenters[i]; - totalDeviation += Math.abs(pattern.estimatedModuleSize - average); - } - return totalDeviation <= 0.05 * totalModuleSize; - } - function crossCheckHorizontal(startJ, centerI, maxCount, originalStateCountTotal) { - var maxJ = matrix.width; - var stateCount = [0, 0, 0, 0, 0]; - var j = startJ; - while (j >= 0 && get(j, centerI)) { - stateCount[2]++; - j--; - } - if (j < 0) { - return null; - } - while (j >= 0 && !get(j, centerI) && stateCount[1] <= maxCount) { - stateCount[1]++; - j--; - } - if (j < 0 || stateCount[1] > maxCount) { - return null; - } - while (j >= 0 && get(j, centerI) && stateCount[0] <= maxCount) { - stateCount[0]++; - j--; - } - if (stateCount[0] > maxCount) { - return null; - } - j = startJ + 1; - while (j < maxJ && get(j, centerI)) { - stateCount[2]++; - j++; - } - if (j == maxJ) { - return null; - } - while (j < maxJ && !get(j, centerI) && stateCount[3] < maxCount) { - stateCount[3]++; - j++; - } - if (j == maxJ || stateCount[3] >= maxCount) { - return null; - } - while (j < maxJ && get(j, centerI) && stateCount[4] < maxCount) { - stateCount[4]++; - j++; - } - if (stateCount[4] >= maxCount) { - return null; - } - // If we found a finder-pattern-like section, but its size is significantly different than - // the original, assume it's a false positive - var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; - if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) { - return null; - } - return foundPatternCross(stateCount) ? centerFromEnd(stateCount, j) : null; - } - function handlePossibleCenter(stateCount, i, j, pureBarcode) { - var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; - var centerJ = centerFromEnd(stateCount, j); - if (centerJ == null) - return false; - var centerI = crossCheckVertical(i, Math.floor(centerJ), stateCount[2], stateCountTotal); - if (centerI != null) { - // Re-cross check - centerJ = crossCheckHorizontal(Math.floor(centerJ), Math.floor(centerI), stateCount[2], stateCountTotal); - if (centerJ != null && (!pureBarcode || crossCheckDiagonal(Math.floor(centerI), Math.floor(centerJ), stateCount[2], stateCountTotal))) { - var estimatedModuleSize = stateCountTotal / 7; - var found = false; - for (var index = 0; index < possibleCenters.length; index++) { - var center = possibleCenters[index]; - // Look for about the same center and module size: - if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) { - possibleCenters.splice(index, 1, center.combineEstimate(centerI, centerJ, estimatedModuleSize)); - found = true; - break; - } - } - if (!found) { - // var point = new FinderPattern(centerJ.Value, centerI.Value, estimatedModuleSize); - var point = new FinderPattern(centerJ, centerI, estimatedModuleSize); - possibleCenters.push(point); - } - return true; - } - } - return false; - } - function findRowSkip() { - var max = possibleCenters.length; - if (max <= 1) { - return 0; - } - var firstConfirmedCenter = null; - possibleCenters.forEach(function (center) { - if (center.count >= CENTER_QUORUM) { - if (firstConfirmedCenter == null) { - firstConfirmedCenter = center; - } - else { - // We have two confirmed centers - // How far down can we skip before resuming looking for the next - // pattern? In the worst case, only the difference between the - // difference in the x / y coordinates of the two centers. - // This is the case where you find top left last. - hasSkipped = true; - //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" - return Math.floor(Math.abs(firstConfirmedCenter.x - center.x) - Math.abs(firstConfirmedCenter.y - center.y)) / 2; - } - } - }); - return 0; - } - function selectBestPatterns() { - var startSize = possibleCenters.length; - if (startSize < 3) { - // Couldn't find enough finder patterns - return null; - } - // Filter outlier possibilities whose module size is too different - if (startSize > 3) { - // But we can only afford to do so if we have at least 4 possibilities to choose from - var totalModuleSize = 0; - var square = 0; - possibleCenters.forEach(function (center) { - var size = center.estimatedModuleSize; - totalModuleSize += size; - square += size * size; - }); - var average = totalModuleSize / startSize; - var stdDev = Math.sqrt(square / startSize - average * average); - //possibleCenters.Sort(new FurthestFromAverageComparator(average)); - possibleCenters.sort(function (x, y) { - var dA = Math.abs(y.estimatedModuleSize - average); - var dB = Math.abs(x.estimatedModuleSize - average); - return dA < dB ? -1 : dA == dB ? 0 : 1; - }); - var limit = Math.max(0.2 * average, stdDev); - for (var i = 0; i < possibleCenters.length && possibleCenters.length > 3; i++) { - var pattern = possibleCenters[i]; - if (Math.abs(pattern.estimatedModuleSize - average) > limit) { - possibleCenters.splice(i, 1); - ///possibleCenters.RemoveAt(i); - i--; - } - } - } - if (possibleCenters.length > 3) { - // Throw away all but those first size candidate points we found. - var totalModuleSize = 0; - possibleCenters.forEach(function (possibleCenter) { - totalModuleSize += possibleCenter.estimatedModuleSize; - }); - var average = totalModuleSize / possibleCenters.length; - // possibleCenters.Sort(new CenterComparator(average)); - possibleCenters.sort(function (x, y) { - if (y.count === x.count) { - var dA = Math.abs(y.estimatedModuleSize - average); - var dB = Math.abs(x.estimatedModuleSize - average); - return dA < dB ? 1 : dA == dB ? 0 : -1; - } - return y.count - x.count; - }); - //possibleCenters.subList(3, possibleCenters.Count).clear(); - ///possibleCenters = possibleCenters.GetRange(0, 3); - possibleCenters = possibleCenters.slice(0, 3); - } - return [possibleCenters[0], possibleCenters[1], possibleCenters[2]]; - } - var pureBarcode = false; - var maxI = matrix.height; - var maxJ = matrix.width; - var iSkip = Math.floor((3 * maxI) / (4 * MAX_MODULES)); - if (iSkip < MIN_SKIP || false) { - iSkip = MIN_SKIP; - } - var done = false; - var stateCount = [0, 0, 0, 0, 0]; - for (var i = iSkip - 1; i < maxI && !done; i += iSkip) { - stateCount = [0, 0, 0, 0, 0]; - var currentState = 0; - for (var j = 0; j < maxJ; j++) { - if (get(j, i)) { - // Black pixel - if ((currentState & 1) === 1) { - currentState++; - } - stateCount[currentState]++; - } - else { - // White pixel - if ((currentState & 1) === 0) { - // Counting black pixels - if (currentState === 4) { - // A winner? - if (foundPatternCross(stateCount)) { - // Yes - var confirmed = handlePossibleCenter(stateCount, i, j, pureBarcode); - if (confirmed) { - // Start examining every other line. Checking each line turned out to be too - // expensive and didn't improve performance. - iSkip = 2; - if (hasSkipped) { - done = haveMultiplyConfirmedCenters(); - } - else { - var rowSkip = findRowSkip(); - if (rowSkip > stateCount[2]) { - // Skip rows between row of lower confirmed center - // and top of presumed third confirmed center - // but back up a bit to get a full chance of detecting - // it, entire width of center of finder pattern - // Skip by rowSkip, but back off by stateCount[2] (size of last center - // of pattern we saw) to be conservative, and also back off by iSkip which - // is about to be re-added - i += rowSkip - stateCount[2] - iSkip; - j = maxJ - 1; - } - } - } - else { - stateCount = [stateCount[2], stateCount[3], stateCount[4], 1, 0]; - currentState = 3; - continue; - } - // Clear state to start looking again - stateCount = [0, 0, 0, 0, 0]; - currentState = 0; - } - else { - stateCount = [stateCount[2], stateCount[3], stateCount[4], 1, 0]; - currentState = 3; - } - } - else { - // Should I really have copy/pasted this fuckery? - stateCount[++currentState]++; - } - } - else { - // Counting the white pixels - stateCount[currentState]++; - } - } - } - if (foundPatternCross(stateCount)) { - var confirmed = handlePossibleCenter(stateCount, i, maxJ, pureBarcode); - if (confirmed) { - iSkip = stateCount[0]; - if (hasSkipped) { - // Found a third one - done = haveMultiplyConfirmedCenters(); - } - } - } - } - var patternInfo = selectBestPatterns(); - if (!patternInfo) - return null; - return ReorderFinderPattern(patternInfo); - } - exports.locate = locate; - - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /// - var alignment_finder_1 = __webpack_require__(5); - var perspective_transform_1 = __webpack_require__(7); - var version_1 = __webpack_require__(8); - var bitmatrix_1 = __webpack_require__(2); - var helpers_1 = __webpack_require__(6); - function checkAndNudgePoints(width, height, points) { - // Check and nudge points from start until we see some that are OK: - var nudged = true; - for (var offset = 0; offset < points.length && nudged; offset += 2) { - var x = Math.floor(points[offset]); - var y = Math.floor(points[offset + 1]); - if (x < -1 || x > width || y < -1 || y > height) { - throw new Error(); - } - nudged = false; - if (x == -1) { - points[offset] = 0; - nudged = true; - } - else if (x == width) { - points[offset] = width - 1; - nudged = true; - } - if (y == -1) { - points[offset + 1] = 0; - nudged = true; - } - else if (y == height) { - points[offset + 1] = height - 1; - nudged = true; - } - } - // Check and nudge points from end: - nudged = true; - for (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2) { - var x = Math.floor(points[offset]); - var y = Math.floor(points[offset + 1]); - if (x < -1 || x > width || y < -1 || y > height) { - throw new Error(); - } - nudged = false; - if (x == -1) { - points[offset] = 0; - nudged = true; - } - else if (x == width) { - points[offset] = width - 1; - nudged = true; - } - if (y == -1) { - points[offset + 1] = 0; - nudged = true; - } - else if (y == height) { - points[offset + 1] = height - 1; - nudged = true; - } - } - return points; - } - function bitArrayFromImage(image, dimension, transform) { - if (dimension <= 0) { - return null; - } - var bits = bitmatrix_1.BitMatrix.createEmpty(dimension, dimension); - var points = new Array(dimension << 1); - for (var y = 0; y < dimension; y++) { - var max = points.length; - var iValue = y + 0.5; - for (var x = 0; x < max; x += 2) { - points[x] = (x >> 1) + 0.5; - points[x + 1] = iValue; - } - points = perspective_transform_1.transformPoints(transform, points); - // Quick check to see if points transformed to something inside the image; - // sufficient to check the endpoints - try { - var nudgedPoints = checkAndNudgePoints(image.width, image.height, points); - } - catch (e) { - return null; - } - // try { - for (var x = 0; x < max; x += 2) { - bits.set(x >> 1, y, image.get(Math.floor(nudgedPoints[x]), Math.floor(nudgedPoints[x + 1]))); - } - } - return bits; - } - function createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension) { - var dimMinusThree = dimension - 3.5; - var bottomRightX; - var bottomRightY; - var sourceBottomRightX; - var sourceBottomRightY; - if (alignmentPattern != null) { - bottomRightX = alignmentPattern.x; - bottomRightY = alignmentPattern.y; - sourceBottomRightX = sourceBottomRightY = dimMinusThree - 3; - } - else { - // Don't have an alignment pattern, just make up the bottom-right point - bottomRightX = (topRight.x - topLeft.x) + bottomLeft.x; - bottomRightY = (topRight.y - topLeft.y) + bottomLeft.y; - sourceBottomRightX = sourceBottomRightY = dimMinusThree; - } - return perspective_transform_1.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.x, topLeft.y, topRight.x, topRight.y, bottomRightX, bottomRightY, bottomLeft.x, bottomLeft.y); - } - // Taken from 6th grade algebra - function distance(x1, y1, x2, y2) { - return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); - } - // Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it. - // overallEstModuleSize - estimated module size so far - // estAlignmentX - coordinate of center of area probably containing alignment pattern - // estAlignmentY - y coordinate of above - // allowanceFactor - number of pixels in all directions to search from the center - function findAlignmentInRegion(overallEstModuleSize, estAlignmentX, estAlignmentY, allowanceFactor, image) { - estAlignmentX = Math.floor(estAlignmentX); - estAlignmentY = Math.floor(estAlignmentY); - // Look for an alignment pattern (3 modules in size) around where it should be - var allowance = Math.floor(allowanceFactor * overallEstModuleSize); - var alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance); - var alignmentAreaRightX = Math.min(image.width, estAlignmentX + allowance); - if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { - return null; - } - var alignmentAreaTopY = Math.max(0, estAlignmentY - allowance); - var alignmentAreaBottomY = Math.min(image.height - 1, estAlignmentY + allowance); - return alignment_finder_1.findAlignment(alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, image); - } - // Computes the dimension (number of modules on a size) of the QR Code based on the position of the finder - // patterns and estimated module size. - function computeDimension(topLeft, topRight, bottomLeft, moduleSize) { - var tltrCentersDimension = Math.round(distance(topLeft.x, topLeft.y, topRight.x, topRight.y) / moduleSize); - var tlblCentersDimension = Math.round(distance(topLeft.x, topLeft.y, bottomLeft.x, bottomLeft.y) / moduleSize); - var dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7; - switch (dimension & 0x03) { - // mod 4 - case 0: - dimension++; - break; - // 1? do nothing - case 2: - dimension--; - break; - } - return dimension; - } - // Deduces version information purely from QR Code dimensions. - // http://chan.catiewayne.com/z/src/131044167276.jpg - function getProvisionalVersionForDimension(dimension) { - if (dimension % 4 != 1) { - return null; - } - var versionNumber = (dimension - 17) >> 2; - if (versionNumber < 1 || versionNumber > 40) { - return null; - } - return version_1.getVersionForNumber(versionNumber); - } - // This method traces a line from a point in the image, in the direction towards another point. - // It begins in a black region, and keeps going until it finds white, then black, then white again. - // It reports the distance from the start to this point.

- // - // This is used when figuring out how wide a finder pattern is, when the finder pattern - // may be skewed or rotated. - function sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY, image) { - fromX = Math.floor(fromX); - fromY = Math.floor(fromY); - toX = Math.floor(toX); - toY = Math.floor(toY); - // Mild variant of Bresenham's algorithm; - // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm - var steep = Math.abs(toY - fromY) > Math.abs(toX - fromX); - if (steep) { - var temp = fromX; - fromX = fromY; - fromY = temp; - temp = toX; - toX = toY; - toY = temp; - } - var dx = Math.abs(toX - fromX); - var dy = Math.abs(toY - fromY); - var error = -dx >> 1; - var xstep = fromX < toX ? 1 : -1; - var ystep = fromY < toY ? 1 : -1; - // In black pixels, looking for white, first or second time. - var state = 0; - // Loop up until x == toX, but not beyond - var xLimit = toX + xstep; - for (var x = fromX, y = fromY; x != xLimit; x += xstep) { - var realX = steep ? y : x; - var realY = steep ? x : y; - // Does current pixel mean we have moved white to black or vice versa? - // Scanning black in state 0,2 and white in state 1, so if we find the wrong - // color, advance to next state or end if we are in state 2 already - if ((state == 1) === image.get(realX, realY)) { - if (state == 2) { - return distance(x, y, fromX, fromY); - } - state++; - } - error += dy; - if (error > 0) { - if (y == toY) { - break; - } - y += ystep; - error -= dx; - } - } - // Found black-white-black; give the benefit of the doubt that the next pixel outside the image - // is "white" so this last point at (toX+xStep,toY) is the right ending. This is really a - // small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this. - if (state == 2) { - return distance(toX + xstep, toY, fromX, fromY); - } - // else we didn't find even black-white-black; no estimate is really possible - return NaN; - } - // Computes the total width of a finder pattern by looking for a black-white-black run from the center - // in the direction of another point (another finder pattern center), and in the opposite direction too. - function sizeOfBlackWhiteBlackRunBothWays(fromX, fromY, toX, toY, image) { - var result = sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY, image); - // Now count other way -- don't run off image though of course - var scale = 1; - var otherToX = fromX - (toX - fromX); - if (otherToX < 0) { - scale = fromX / (fromX - otherToX); - otherToX = 0; - } - else if (otherToX >= image.width) { - scale = (image.width - 1 - fromX) / (otherToX - fromX); - otherToX = image.width - 1; - } - var otherToY = (fromY - (toY - fromY) * scale); - scale = 1; - if (otherToY < 0) { - scale = fromY / (fromY - otherToY); - otherToY = 0; - } - else if (otherToY >= image.height) { - scale = (image.height - 1 - fromY) / (otherToY - fromY); - otherToY = image.height - 1; - } - otherToX = (fromX + (otherToX - fromX) * scale); - result += sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY, image); - return result - 1; // -1 because we counted the middle pixel twice - } - function calculateModuleSizeOneWay(pattern, otherPattern, image) { - var moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays(pattern.x, pattern.y, otherPattern.x, otherPattern.y, image); - var moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays(otherPattern.x, otherPattern.y, pattern.x, pattern.y, image); - if (helpers_1.isNaN(moduleSizeEst1)) { - return moduleSizeEst2 / 7; - } - if (helpers_1.isNaN(moduleSizeEst2)) { - return moduleSizeEst1 / 7; - } - // Average them, and divide by 7 since we've counted the width of 3 black modules, - // and 1 white and 1 black module on either side. Ergo, divide sum by 14. - return (moduleSizeEst1 + moduleSizeEst2) / 14; - } - // Computes an average estimated module size based on estimated derived from the positions of the three finder patterns. - function calculateModuleSize(topLeft, topRight, bottomLeft, image) { - return (calculateModuleSizeOneWay(topLeft, topRight, image) + calculateModuleSizeOneWay(topLeft, bottomLeft, image)) / 2; - } - function extract(image, location) { - var moduleSize = calculateModuleSize(location.topLeft, location.topRight, location.bottomLeft, image); - if (moduleSize < 1) { - return null; - } - var dimension = computeDimension(location.topLeft, location.topRight, location.bottomLeft, moduleSize); - if (!dimension) { - return null; - } - var provisionalVersion = getProvisionalVersionForDimension(dimension); - if (provisionalVersion == null) { - return null; - } - var modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7; - var alignmentPattern = null; - // Anything above version 1 has an alignment pattern - if (provisionalVersion.alignmentPatternCenters.length > 0) { - // Guess where a "bottom right" finder pattern would have been - var bottomRightX = location.topRight.x - location.topLeft.x + location.bottomLeft.x; - var bottomRightY = location.topRight.y - location.topLeft.y + location.bottomLeft.y; - // Estimate that alignment pattern is closer by 3 modules - // from "bottom right" to known top left location - var correctionToTopLeft = 1 - 3 / modulesBetweenFPCenters; - var estAlignmentX = location.topLeft.x + correctionToTopLeft * (bottomRightX - location.topLeft.x); - var estAlignmentY = location.topLeft.y + correctionToTopLeft * (bottomRightY - location.topLeft.y); - // Kind of arbitrary -- expand search radius before giving up - for (var i = 4; i <= 16; i <<= 1) { - alignmentPattern = findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i, image); - if (!alignmentPattern) { - continue; - } - break; - } - } - var transform = createTransform(location.topLeft, location.topRight, location.bottomLeft, alignmentPattern, dimension); - return bitArrayFromImage(image, dimension, transform); - } - exports.extract = extract; - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var helpers_1 = __webpack_require__(6); - function aboutEquals(center, moduleSize, i, j) { - if (Math.abs(i - center.y) <= moduleSize && Math.abs(j - center.x) <= moduleSize) { - var moduleSizeDiff = Math.abs(moduleSize - center.estimatedModuleSize); - return moduleSizeDiff <= 1 || moduleSizeDiff <= center.estimatedModuleSize; - } - return false; - } - function combineEstimate(center, i, j, newModuleSize) { - var combinedX = (center.x + j) / 2; - var combinedY = (center.y + i) / 2; - var combinedModuleSize = (center.estimatedModuleSize + newModuleSize) / 2; - return { x: combinedX, y: combinedY, estimatedModuleSize: combinedModuleSize }; - } - // returns true if the proportions of the counts is close enough to the 1/1/1 ratios used by alignment - // patterns to be considered a match - function foundPatternCross(stateCount, moduleSize) { - var maxVariance = moduleSize / 2; - for (var i = 0; i < 3; i++) { - if (Math.abs(moduleSize - stateCount[i]) >= maxVariance) { - return false; - } - } - return true; - } - // Given a count of black/white/black pixels just seen and an end position, - // figures the location of the center of this black/white/black run. - function centerFromEnd(stateCount, end) { - var result = (end - stateCount[2]) - stateCount[1] / 2; - if (helpers_1.isNaN(result)) { - return null; - } - return result; - } - // After a horizontal scan finds a potential alignment pattern, this method - // "cross-checks" by scanning down vertically through the center of the possible - // alignment pattern to see if the same proportion is detected.

- // - // startI - row where an alignment pattern was detected - // centerJ - center of the section that appears to cross an alignment pattern - // maxCount - maximum reasonable number of modules that should be observed in any reading state, based - // on the results of the horizontal scan - // originalStateCountTotal - The original state count total - function crossCheckVertical(startI, centerJ, maxCount, originalStateCountTotal, moduleSize, image) { - var maxI = image.height; - var stateCount = [0, 0, 0]; - // Start counting up from center - var i = startI; - while (i >= 0 && image.get(centerJ, i) && stateCount[1] <= maxCount) { - stateCount[1]++; - i--; - } - // If already too many modules in this state or ran off the edge: - if (i < 0 || stateCount[1] > maxCount) { - return null; - } - while (i >= 0 && !image.get(centerJ, i) && stateCount[0] <= maxCount) { - stateCount[0]++; - i--; - } - if (stateCount[0] > maxCount) { - return null; - } - // Now also count down from center - i = startI + 1; - while (i < maxI && image.get(centerJ, i) && stateCount[1] <= maxCount) { - stateCount[1]++; - i++; - } - if (i == maxI || stateCount[1] > maxCount) { - return null; - } - while (i < maxI && !image.get(centerJ, i) && stateCount[2] <= maxCount) { - stateCount[2]++; - i++; - } - if (stateCount[2] > maxCount) { - return null; - } - var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; - if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) { - return null; - } - return foundPatternCross(stateCount, moduleSize) ? centerFromEnd(stateCount, i) : null; - } - function findAlignment(startX, startY, width, height, moduleSize, image) { - // Global State :( - var possibleCenters = []; - // This is called when a horizontal scan finds a possible alignment pattern. It will - // cross check with a vertical scan, and if successful, will see if this pattern had been - // found on a previous horizontal scan. If so, we consider it confirmed and conclude we have - // found the alignment pattern.

- // - // stateCount - reading state module counts from horizontal scan - // i - where alignment pattern may be found - // j - end of possible alignment pattern in row - function handlePossibleCenter(stateCount, i, j, moduleSize) { - var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; - var centerJ = centerFromEnd(stateCount, j); - if (centerJ == null) { - return null; - } - var centerI = crossCheckVertical(i, Math.floor(centerJ), 2 * stateCount[1], stateCountTotal, moduleSize, image); - if (centerI != null) { - var estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3; - for (var i2 in possibleCenters) { - var center = possibleCenters[i2]; - // Look for about the same center and module size: - if (aboutEquals(center, estimatedModuleSize, centerI, centerJ)) { - return combineEstimate(center, centerI, centerJ, estimatedModuleSize); - } - } - // Hadn't found this before; save it - var point = { x: centerJ, y: centerI, estimatedModuleSize: estimatedModuleSize }; - possibleCenters.push(point); - } - return null; - } - var maxJ = startX + width; - var middleI = startY + (height >> 1); - // We are looking for black/white/black modules in 1:1:1 ratio; - // this tracks the number of black/white/black modules seen so far - var stateCount = [0, 0, 0]; // WTF - for (var iGen = 0; iGen < height; iGen++) { - // Search from middle outwards - var i = middleI + ((iGen & 0x01) == 0 ? ((iGen + 1) >> 1) : -((iGen + 1) >> 1)); - stateCount[0] = 0; - stateCount[1] = 0; - stateCount[2] = 0; - var j = startX; - // Burn off leading white pixels before anything else; if we start in the middle of - // a white run, it doesn't make sense to count its length, since we don't know if the - // white run continued to the left of the start point - while (j < maxJ && !image.get(j, i)) { - j++; - } - var currentState = 0; - while (j < maxJ) { - if (image.get(j, i)) { - // Black pixel - if (currentState == 1) { - // Counting black pixels - stateCount[currentState]++; - } - else { - // Counting white pixels - if (currentState == 2) { - // A winner? - if (foundPatternCross(stateCount, moduleSize)) { - // Yes - confirmed = handlePossibleCenter(stateCount, i, j, moduleSize); - if (confirmed != null) { - return confirmed; - } - } - stateCount[0] = stateCount[2]; - stateCount[1] = 1; - stateCount[2] = 0; - currentState = 1; - } - else { - stateCount[++currentState]++; - } - } - } - else { - // White pixel - if (currentState == 1) { - // Counting black pixels - currentState++; - } - stateCount[currentState]++; - } - j++; - } - if (foundPatternCross(stateCount, moduleSize)) { - var confirmed = handlePossibleCenter(stateCount, i, moduleSize, maxJ); - if (confirmed != null) { - return confirmed; - } - } - } - // Hmm, nothing we saw was observed and confirmed twice. If we had - // any guess at all, return it. - if (possibleCenters.length != 0) { - return possibleCenters[0]; - } - return null; - } - exports.findAlignment = findAlignment; - - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - "use strict"; - var BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4]; - function numBitsDiffering(a, b) { - a ^= b; // a now has a 1 bit exactly where its bit differs with b's - // Count bits set quickly with a series of lookups: - return BITS_SET_IN_HALF_BYTE[a & 0x0F] + - BITS_SET_IN_HALF_BYTE[((a >> 4) & 0x0F)] + - BITS_SET_IN_HALF_BYTE[((a >> 8) & 0x0F)] + - BITS_SET_IN_HALF_BYTE[((a >> 12) & 0x0F)] + - BITS_SET_IN_HALF_BYTE[((a >> 16) & 0x0F)] + - BITS_SET_IN_HALF_BYTE[((a >> 20) & 0x0F)] + - BITS_SET_IN_HALF_BYTE[((a >> 24) & 0x0F)] + - BITS_SET_IN_HALF_BYTE[((a >> 28) & 0x0F)]; - } - exports.numBitsDiffering = numBitsDiffering; - // Taken from underscore JS - function isNaN(obj) { - return Object.prototype.toString.call(obj) === '[object Number]' && obj !== +obj; - } - exports.isNaN = isNaN; - - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - /// - "use strict"; - function squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3) { - var dx3 = x0 - x1 + x2 - x3; - var dy3 = y0 - y1 + y2 - y3; - if (dx3 == 0 && dy3 == 0) { - // Affine - return { - a11: x1 - x0, - a21: x2 - x1, - a31: x0, - a12: y1 - y0, - a22: y2 - y1, - a32: y0, - a13: 0, - a23: 0, - a33: 1 - }; - } - else { - var dx1 = x1 - x2; - var dx2 = x3 - x2; - var dy1 = y1 - y2; - var dy2 = y3 - y2; - var denominator = dx1 * dy2 - dx2 * dy1; - var a13 = (dx3 * dy2 - dx2 * dy3) / denominator; - var a23 = (dx1 * dy3 - dx3 * dy1) / denominator; - return { - a11: x1 - x0 + a13 * x1, - a21: x3 - x0 + a23 * x3, - a31: x0, - a12: y1 - y0 + a13 * y1, - a22: y3 - y0 + a23 * y3, - a32: y0, - a13: a13, - a23: a23, - a33: 1 - }; - } - } - function buildAdjoint(i) { - return { - a11: i.a22 * i.a33 - i.a23 * i.a32, - a21: i.a23 * i.a31 - i.a21 * i.a33, - a31: i.a21 * i.a32 - i.a22 * i.a31, - a12: i.a13 * i.a32 - i.a12 * i.a33, - a22: i.a11 * i.a33 - i.a13 * i.a31, - a32: i.a12 * i.a31 - i.a11 * i.a32, - a13: i.a12 * i.a23 - i.a13 * i.a22, - a23: i.a13 * i.a21 - i.a11 * i.a23, - a33: i.a11 * i.a22 - i.a12 * i.a21 - }; - } - function times(a, b) { - return { - a11: a.a11 * b.a11 + a.a21 * b.a12 + a.a31 * b.a13, - a21: a.a11 * b.a21 + a.a21 * b.a22 + a.a31 * b.a23, - a31: a.a11 * b.a31 + a.a21 * b.a32 + a.a31 * b.a33, - a12: a.a12 * b.a11 + a.a22 * b.a12 + a.a32 * b.a13, - a22: a.a12 * b.a21 + a.a22 * b.a22 + a.a32 * b.a23, - a32: a.a12 * b.a31 + a.a22 * b.a32 + a.a32 * b.a33, - a13: a.a13 * b.a11 + a.a23 * b.a12 + a.a33 * b.a13, - a23: a.a13 * b.a21 + a.a23 * b.a22 + a.a33 * b.a23, - a33: a.a13 * b.a31 + a.a23 * b.a32 + a.a33 * b.a33 - }; - } - function quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3) { - // Here, the adjoint serves as the inverse: - return buildAdjoint(squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3)); - } - function transformPoints(transform, points) { - var max = points.length; - var a11 = transform.a11; - var a12 = transform.a12; - var a13 = transform.a13; - var a21 = transform.a21; - var a22 = transform.a22; - var a23 = transform.a23; - var a31 = transform.a31; - var a32 = transform.a32; - var a33 = transform.a33; - for (var i = 0; i < max; i += 2) { - var x = points[i]; - var y = points[i + 1]; - var denominator = a13 * x + a23 * y + a33; - points[i] = (a11 * x + a21 * y + a31) / denominator; - points[i + 1] = (a12 * x + a22 * y + a32) / denominator; - } - return points; - } - exports.transformPoints = transformPoints; - function quadrilateralToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p) { - var qToS = quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3); - var sToQ = squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p); - return times(sToQ, qToS); - } - exports.quadrilateralToQuadrilateral = quadrilateralToQuadrilateral; - - -/***/ }, -/* 8 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var helpers_1 = __webpack_require__(6); - var VERSION_DECODE_INFO = [ - 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, - 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, - 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, - 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, - 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, - 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, - 0x2542E, 0x26A64, 0x27541, 0x28C69, - ]; - var ECB = (function () { - function ECB(_count, _dataCodewords) { - this.count = _count; - this.dataCodewords = _dataCodewords; - } - return ECB; - }()); - var ECBlocks = (function () { - function ECBlocks(_ecCodewordsPerBlock) { - var _ecBlocks = []; - for (var _i = 1; _i < arguments.length; _i++) { - _ecBlocks[_i - 1] = arguments[_i]; - } - this.ecCodewordsPerBlock = _ecCodewordsPerBlock; - this.ecBlocks = _ecBlocks; - } - ECBlocks.prototype.getNumBlocks = function () { - return this.ecBlocks.reduce(function (a, b) { return (a + b.count); }, 0); - }; - ECBlocks.prototype.getTotalECCodewords = function () { - return this.ecCodewordsPerBlock * this.getNumBlocks(); - }; - return ECBlocks; - }()); - var Version = (function () { - function Version(_versionNumber, _alignmentPatternCenters) { - var _ecBlocks = []; - for (var _i = 2; _i < arguments.length; _i++) { - _ecBlocks[_i - 2] = arguments[_i]; - } - this.versionNumber = _versionNumber; - this.alignmentPatternCenters = _alignmentPatternCenters; - this.ecBlocks = _ecBlocks; - var total = 0; - var ecCodewords = this.ecBlocks[0].ecCodewordsPerBlock; - var ecbArray = this.ecBlocks[0].ecBlocks; - ecbArray.forEach(function (ecBlock) { - total += ecBlock.count * (ecBlock.dataCodewords + ecCodewords); - }); - this.totalCodewords = total; - } - Version.prototype.getDimensionForVersion = function () { - return 17 + 4 * this.versionNumber; - }; - Version.prototype.getECBlocksForLevel = function (ecLevel) { - return this.ecBlocks[ecLevel.ordinal]; - }; - Version.decodeVersionInformation = function (versionBits) { - var bestDifference = Infinity; - var bestVersion = 0; - for (var i = 0; i < VERSION_DECODE_INFO.length; i++) { - var targetVersion = VERSION_DECODE_INFO[i]; - // Do the version info bits match exactly? done. - if (targetVersion == versionBits) { - return getVersionForNumber(i + 7); - } - // Otherwise see if this is the closest to a real version info bit string - // we have seen so far - var bitsDifference = helpers_1.numBitsDiffering(versionBits, targetVersion); - if (bitsDifference < bestDifference) { - bestVersion = i + 7; - bestDifference = bitsDifference; - } - } - // We can tolerate up to 3 bits of error since no two version info codewords will - // differ in less than 8 bits. - if (bestDifference <= 3) { - return getVersionForNumber(bestVersion); - } - // If we didn't find a close enough match, fail - return null; - }; - return Version; - }()); - exports.Version = Version; - var VERSIONS = [ - new Version(1, [], new ECBlocks(7, new ECB(1, 19)), new ECBlocks(10, new ECB(1, 16)), new ECBlocks(13, new ECB(1, 13)), new ECBlocks(17, new ECB(1, 9))), - new Version(2, [6, 18], new ECBlocks(10, new ECB(1, 34)), new ECBlocks(16, new ECB(1, 28)), new ECBlocks(22, new ECB(1, 22)), new ECBlocks(28, new ECB(1, 16))), - new Version(3, [6, 22], new ECBlocks(15, new ECB(1, 55)), new ECBlocks(26, new ECB(1, 44)), new ECBlocks(18, new ECB(2, 17)), new ECBlocks(22, new ECB(2, 13))), - new Version(4, [6, 26], new ECBlocks(20, new ECB(1, 80)), new ECBlocks(18, new ECB(2, 32)), new ECBlocks(26, new ECB(2, 24)), new ECBlocks(16, new ECB(4, 9))), - new Version(5, [6, 30], new ECBlocks(26, new ECB(1, 108)), new ECBlocks(24, new ECB(2, 43)), new ECBlocks(18, new ECB(2, 15), new ECB(2, 16)), new ECBlocks(22, new ECB(2, 11), new ECB(2, 12))), - new Version(6, [6, 34], new ECBlocks(18, new ECB(2, 68)), new ECBlocks(16, new ECB(4, 27)), new ECBlocks(24, new ECB(4, 19)), new ECBlocks(28, new ECB(4, 15))), - new Version(7, [6, 22, 38], new ECBlocks(20, new ECB(2, 78)), new ECBlocks(18, new ECB(4, 31)), new ECBlocks(18, new ECB(2, 14), new ECB(4, 15)), new ECBlocks(26, new ECB(4, 13), new ECB(1, 14))), - new Version(8, [6, 24, 42], new ECBlocks(24, new ECB(2, 97)), new ECBlocks(22, new ECB(2, 38), new ECB(2, 39)), new ECBlocks(22, new ECB(4, 18), new ECB(2, 19)), new ECBlocks(26, new ECB(4, 14), new ECB(2, 15))), - new Version(9, [6, 26, 46], new ECBlocks(30, new ECB(2, 116)), new ECBlocks(22, new ECB(3, 36), new ECB(2, 37)), new ECBlocks(20, new ECB(4, 16), new ECB(4, 17)), new ECBlocks(24, new ECB(4, 12), new ECB(4, 13))), - new Version(10, [6, 28, 50], new ECBlocks(18, new ECB(2, 68), new ECB(2, 69)), new ECBlocks(26, new ECB(4, 43), new ECB(1, 44)), new ECBlocks(24, new ECB(6, 19), new ECB(2, 20)), new ECBlocks(28, new ECB(6, 15), new ECB(2, 16))), - new Version(11, [6, 30, 54], new ECBlocks(20, new ECB(4, 81)), new ECBlocks(30, new ECB(1, 50), new ECB(4, 51)), new ECBlocks(28, new ECB(4, 22), new ECB(4, 23)), new ECBlocks(24, new ECB(3, 12), new ECB(8, 13))), - new Version(12, [6, 32, 58], new ECBlocks(24, new ECB(2, 92), new ECB(2, 93)), new ECBlocks(22, new ECB(6, 36), new ECB(2, 37)), new ECBlocks(26, new ECB(4, 20), new ECB(6, 21)), new ECBlocks(28, new ECB(7, 14), new ECB(4, 15))), - new Version(13, [6, 34, 62], new ECBlocks(26, new ECB(4, 107)), new ECBlocks(22, new ECB(8, 37), new ECB(1, 38)), new ECBlocks(24, new ECB(8, 20), new ECB(4, 21)), new ECBlocks(22, new ECB(12, 11), new ECB(4, 12))), - new Version(14, [6, 26, 46, 66], new ECBlocks(30, new ECB(3, 115), new ECB(1, 116)), new ECBlocks(24, new ECB(4, 40), new ECB(5, 41)), new ECBlocks(20, new ECB(11, 16), new ECB(5, 17)), new ECBlocks(24, new ECB(11, 12), new ECB(5, 13))), - new Version(15, [6, 26, 48, 70], new ECBlocks(22, new ECB(5, 87), new ECB(1, 88)), new ECBlocks(24, new ECB(5, 41), new ECB(5, 42)), new ECBlocks(30, new ECB(5, 24), new ECB(7, 25)), new ECBlocks(24, new ECB(11, 12), new ECB(7, 13))), - new Version(16, [6, 26, 50, 74], new ECBlocks(24, new ECB(5, 98), new ECB(1, 99)), new ECBlocks(28, new ECB(7, 45), new ECB(3, 46)), new ECBlocks(24, new ECB(15, 19), new ECB(2, 20)), new ECBlocks(30, new ECB(3, 15), new ECB(13, 16))), - new Version(17, [6, 30, 54, 78], new ECBlocks(28, new ECB(1, 107), new ECB(5, 108)), new ECBlocks(28, new ECB(10, 46), new ECB(1, 47)), new ECBlocks(28, new ECB(1, 22), new ECB(15, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(17, 15))), - new Version(18, [6, 30, 56, 82], new ECBlocks(30, new ECB(5, 120), new ECB(1, 121)), new ECBlocks(26, new ECB(9, 43), new ECB(4, 44)), new ECBlocks(28, new ECB(17, 22), new ECB(1, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(19, 15))), - new Version(19, [6, 30, 58, 86], new ECBlocks(28, new ECB(3, 113), new ECB(4, 114)), new ECBlocks(26, new ECB(3, 44), new ECB(11, 45)), new ECBlocks(26, new ECB(17, 21), new ECB(4, 22)), new ECBlocks(26, new ECB(9, 13), new ECB(16, 14))), - new Version(20, [6, 34, 62, 90], new ECBlocks(28, new ECB(3, 107), new ECB(5, 108)), new ECBlocks(26, new ECB(3, 41), new ECB(13, 42)), new ECBlocks(30, new ECB(15, 24), new ECB(5, 25)), new ECBlocks(28, new ECB(15, 15), new ECB(10, 16))), - new Version(21, [6, 28, 50, 72, 94], new ECBlocks(28, new ECB(4, 116), new ECB(4, 117)), new ECBlocks(26, new ECB(17, 42)), new ECBlocks(28, new ECB(17, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(19, 16), new ECB(6, 17))), - new Version(22, [6, 26, 50, 74, 98], new ECBlocks(28, new ECB(2, 111), new ECB(7, 112)), new ECBlocks(28, new ECB(17, 46)), new ECBlocks(30, new ECB(7, 24), new ECB(16, 25)), new ECBlocks(24, new ECB(34, 13))), - new Version(23, [6, 30, 54, 74, 102], new ECBlocks(30, new ECB(4, 121), new ECB(5, 122)), new ECBlocks(28, new ECB(4, 47), new ECB(14, 48)), new ECBlocks(30, new ECB(11, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(16, 15), new ECB(14, 16))), - new Version(24, [6, 28, 54, 80, 106], new ECBlocks(30, new ECB(6, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(6, 45), new ECB(14, 46)), new ECBlocks(30, new ECB(11, 24), new ECB(16, 25)), new ECBlocks(30, new ECB(30, 16), new ECB(2, 17))), - new Version(25, [6, 32, 58, 84, 110], new ECBlocks(26, new ECB(8, 106), new ECB(4, 107)), new ECBlocks(28, new ECB(8, 47), new ECB(13, 48)), new ECBlocks(30, new ECB(7, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(22, 15), new ECB(13, 16))), - new Version(26, [6, 30, 58, 86, 114], new ECBlocks(28, new ECB(10, 114), new ECB(2, 115)), new ECBlocks(28, new ECB(19, 46), new ECB(4, 47)), new ECBlocks(28, new ECB(28, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(33, 16), new ECB(4, 17))), - new Version(27, [6, 34, 62, 90, 118], new ECBlocks(30, new ECB(8, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(22, 45), new ECB(3, 46)), new ECBlocks(30, new ECB(8, 23), new ECB(26, 24)), new ECBlocks(30, new ECB(12, 15), new ECB(28, 16))), - new Version(28, [6, 26, 50, 74, 98, 122], new ECBlocks(30, new ECB(3, 117), new ECB(10, 118)), new ECBlocks(28, new ECB(3, 45), new ECB(23, 46)), new ECBlocks(30, new ECB(4, 24), new ECB(31, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(31, 16))), - new Version(29, [6, 30, 54, 78, 102, 126], new ECBlocks(30, new ECB(7, 116), new ECB(7, 117)), new ECBlocks(28, new ECB(21, 45), new ECB(7, 46)), new ECBlocks(30, new ECB(1, 23), new ECB(37, 24)), new ECBlocks(30, new ECB(19, 15), new ECB(26, 16))), - new Version(30, [6, 26, 52, 78, 104, 130], new ECBlocks(30, new ECB(5, 115), new ECB(10, 116)), new ECBlocks(28, new ECB(19, 47), new ECB(10, 48)), new ECBlocks(30, new ECB(15, 24), new ECB(25, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(25, 16))), - new Version(31, [6, 30, 56, 82, 108, 134], new ECBlocks(30, new ECB(13, 115), new ECB(3, 116)), new ECBlocks(28, new ECB(2, 46), new ECB(29, 47)), new ECBlocks(30, new ECB(42, 24), new ECB(1, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(28, 16))), - new Version(32, [6, 34, 60, 86, 112, 138], new ECBlocks(30, new ECB(17, 115)), new ECBlocks(28, new ECB(10, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(10, 24), new ECB(35, 25)), new ECBlocks(30, new ECB(19, 15), new ECB(35, 16))), - new Version(33, [6, 30, 58, 86, 114, 142], new ECBlocks(30, new ECB(17, 115), new ECB(1, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(21, 47)), new ECBlocks(30, new ECB(29, 24), new ECB(19, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(46, 16))), - new Version(34, [6, 34, 62, 90, 118, 146], new ECBlocks(30, new ECB(13, 115), new ECB(6, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(44, 24), new ECB(7, 25)), new ECBlocks(30, new ECB(59, 16), new ECB(1, 17))), - new Version(35, [6, 30, 54, 78, 102, 126, 150], new ECBlocks(30, new ECB(12, 121), new ECB(7, 122)), new ECBlocks(28, new ECB(12, 47), new ECB(26, 48)), new ECBlocks(30, new ECB(39, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(22, 15), new ECB(41, 16))), - new Version(36, [6, 24, 50, 76, 102, 128, 154], new ECBlocks(30, new ECB(6, 121), new ECB(14, 122)), new ECBlocks(28, new ECB(6, 47), new ECB(34, 48)), new ECBlocks(30, new ECB(46, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(2, 15), new ECB(64, 16))), - new Version(37, [6, 28, 54, 80, 106, 132, 158], new ECBlocks(30, new ECB(17, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(29, 46), new ECB(14, 47)), new ECBlocks(30, new ECB(49, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(24, 15), new ECB(46, 16))), - new Version(38, [6, 32, 58, 84, 110, 136, 162], new ECBlocks(30, new ECB(4, 122), new ECB(18, 123)), new ECBlocks(28, new ECB(13, 46), new ECB(32, 47)), new ECBlocks(30, new ECB(48, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(42, 15), new ECB(32, 16))), - new Version(39, [6, 26, 54, 82, 110, 138, 166], new ECBlocks(30, new ECB(20, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(40, 47), new ECB(7, 48)), new ECBlocks(30, new ECB(43, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(10, 15), new ECB(67, 16))), - new Version(40, [6, 30, 58, 86, 114, 142, 170], new ECBlocks(30, new ECB(19, 118), new ECB(6, 119)), new ECBlocks(28, new ECB(18, 47), new ECB(31, 48)), new ECBlocks(30, new ECB(34, 24), new ECB(34, 25)), new ECBlocks(30, new ECB(20, 15), new ECB(61, 16))), - ]; - function getVersionForNumber(versionNumber) { - if (versionNumber < 1 || versionNumber > 40) { - throw new Error("Invalid version number " + versionNumber); - } - return VERSIONS[versionNumber - 1]; - } - exports.getVersionForNumber = getVersionForNumber; - - -/***/ }, -/* 9 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var bitmatrix_1 = __webpack_require__(2); - var decodeqrdata_1 = __webpack_require__(10); - var helpers_1 = __webpack_require__(6); - var reedsolomon_1 = __webpack_require__(12); - var version_1 = __webpack_require__(8); - var FORMAT_INFO_MASK_QR = 0x5412; - var FORMAT_INFO_DECODE_LOOKUP = [ - [0x5412, 0x00], - [0x5125, 0x01], - [0x5E7C, 0x02], - [0x5B4B, 0x03], - [0x45F9, 0x04], - [0x40CE, 0x05], - [0x4F97, 0x06], - [0x4AA0, 0x07], - [0x77C4, 0x08], - [0x72F3, 0x09], - [0x7DAA, 0x0A], - [0x789D, 0x0B], - [0x662F, 0x0C], - [0x6318, 0x0D], - [0x6C41, 0x0E], - [0x6976, 0x0F], - [0x1689, 0x10], - [0x13BE, 0x11], - [0x1CE7, 0x12], - [0x19D0, 0x13], - [0x0762, 0x14], - [0x0255, 0x15], - [0x0D0C, 0x16], - [0x083B, 0x17], - [0x355F, 0x18], - [0x3068, 0x19], - [0x3F31, 0x1A], - [0x3A06, 0x1B], - [0x24B4, 0x1C], - [0x2183, 0x1D], - [0x2EDA, 0x1E], - [0x2BED, 0x1F], - ]; - var DATA_MASKS = [ - function (i, j) { return ((i + j) & 0x01) === 0; }, - function (i, j) { return (i & 0x01) === 0; }, - function (i, j) { return j % 3 == 0; }, - function (i, j) { return (i + j) % 3 === 0; }, - function (i, j) { return (((i >> 1) + (j / 3)) & 0x01) === 0; }, - function (i, j) { return ((i * j) & 0x01) + ((i * j) % 3) === 0; }, - function (i, j) { return ((((i * j) & 0x01) + ((i * j) % 3)) & 0x01) === 0; }, - function (i, j) { return ((((i + j) & 0x01) + ((i * j) % 3)) & 0x01) === 0; }, - ]; - var ERROR_CORRECTION_LEVELS = [ - { ordinal: 1, bits: 0x00, name: "M" }, - { ordinal: 0, bits: 0x01, name: "L" }, - { ordinal: 3, bits: 0x02, name: "H" }, - { ordinal: 2, bits: 0x03, name: "Q" }, - ]; - function buildFunctionPattern(version) { - var dimension = version.getDimensionForVersion(); - var emptyArray = new Array(dimension * dimension); - for (var i = 0; i < emptyArray.length; i++) { - emptyArray[i] = false; - } - var bitMatrix = new bitmatrix_1.BitMatrix(emptyArray, dimension); - ///BitMatrix bitMatrix = new BitMatrix(dimension); - // Top left finder pattern + separator + format - bitMatrix.setRegion(0, 0, 9, 9); - // Top right finder pattern + separator + format - bitMatrix.setRegion(dimension - 8, 0, 8, 9); - // Bottom left finder pattern + separator + format - bitMatrix.setRegion(0, dimension - 8, 9, 8); - // Alignment patterns - var max = version.alignmentPatternCenters.length; - for (var x = 0; x < max; x++) { - var i = version.alignmentPatternCenters[x] - 2; - for (var y = 0; y < max; y++) { - if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) { - // No alignment patterns near the three finder paterns - continue; - } - bitMatrix.setRegion(version.alignmentPatternCenters[y] - 2, i, 5, 5); - } - } - // Vertical timing pattern - bitMatrix.setRegion(6, 9, 1, dimension - 17); - // Horizontal timing pattern - bitMatrix.setRegion(9, 6, dimension - 17, 1); - if (version.versionNumber > 6) { - // Version info, top right - bitMatrix.setRegion(dimension - 11, 0, 3, 6); - // Version info, bottom left - bitMatrix.setRegion(0, dimension - 11, 6, 3); - } - return bitMatrix; - } - function readCodewords(matrix, version, formatInfo) { - // Get the data mask for the format used in this QR Code. This will exclude - // some bits from reading as we wind through the bit matrix. - var dataMask = DATA_MASKS[formatInfo.dataMask]; - var dimension = matrix.height; - var funcPattern = buildFunctionPattern(version); - var readingUp = true; - var result = []; - var resultOffset = 0; - var currentByte = 0; - var bitsRead = 0; - // Read columns in pairs, from right to left - for (var j = dimension - 1; j > 0; j -= 2) { - if (j == 6) { - // Skip whole column with vertical alignment pattern; - // saves time and makes the other code proceed more cleanly - j--; - } - // Read alternatingly from bottom to top then top to bottom - for (var count = 0; count < dimension; count++) { - var i = readingUp ? dimension - 1 - count : count; - for (var col = 0; col < 2; col++) { - // Ignore bits covered by the function pattern - if (!funcPattern.get(j - col, i)) { - // Read a bit - bitsRead++; - currentByte <<= 1; - if (matrix.get(j - col, i) !== dataMask(i, j - col)) { - currentByte |= 1; - } - // If we've made a whole byte, save it off - if (bitsRead == 8) { - result[resultOffset++] = currentByte & 0xFF; - bitsRead = 0; - currentByte = 0; - } - } - } - } - readingUp = !readingUp; // switch directions - } - if (resultOffset != version.totalCodewords) { - return null; - } - return result; - } - function readVersion(matrix) { - var dimension = matrix.height; - var provisionalVersion = (dimension - 17) >> 2; - if (provisionalVersion <= 6) { - return version_1.getVersionForNumber(provisionalVersion); - } - // Read top-right version info: 3 wide by 6 tall - var versionBits = 0; - var ijMin = dimension - 11; - for (var j = 5; j >= 0; j--) { - for (var i = dimension - 9; i >= ijMin; i--) { - versionBits = matrix.copyBit(i, j, versionBits); - } - } - var parsedVersion = version_1.Version.decodeVersionInformation(versionBits); - if (parsedVersion != null && parsedVersion.getDimensionForVersion() == dimension) { - return parsedVersion; - } - // Hmm, failed. Try bottom left: 6 wide by 3 tall - versionBits = 0; - for (var i = 5; i >= 0; i--) { - for (var j = dimension - 9; j >= ijMin; j--) { - versionBits = matrix.copyBit(i, j, versionBits); - } - } - parsedVersion = version_1.Version.decodeVersionInformation(versionBits); - if (parsedVersion != null && parsedVersion.getDimensionForVersion() == dimension) { - return parsedVersion; - } - return null; - } - function newFormatInformation(formatInfo) { - return { - errorCorrectionLevel: ERROR_CORRECTION_LEVELS[(formatInfo >> 3) & 0x03], - dataMask: formatInfo & 0x07 - }; - } - function doDecodeFormatInformation(maskedFormatInfo1, maskedFormatInfo2) { - // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing - var bestDifference = Infinity; - var bestFormatInfo = 0; - for (var i = 0; i < FORMAT_INFO_DECODE_LOOKUP.length; i++) { - var decodeInfo = FORMAT_INFO_DECODE_LOOKUP[i]; - var targetInfo = decodeInfo[0]; - if (targetInfo == maskedFormatInfo1 || targetInfo == maskedFormatInfo2) { - // Found an exact match - return newFormatInformation(decodeInfo[1]); - } - var bitsDifference = helpers_1.numBitsDiffering(maskedFormatInfo1, targetInfo); - if (bitsDifference < bestDifference) { - bestFormatInfo = decodeInfo[1]; - bestDifference = bitsDifference; - } - if (maskedFormatInfo1 != maskedFormatInfo2) { - // also try the other option - bitsDifference = helpers_1.numBitsDiffering(maskedFormatInfo2, targetInfo); - if (bitsDifference < bestDifference) { - bestFormatInfo = decodeInfo[1]; - bestDifference = bitsDifference; - } - } - } - // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits - // differing means we found a match - if (bestDifference <= 3) - return newFormatInformation(bestFormatInfo); - return null; - } - function decodeFormatInformation(maskedFormatInfo1, maskedFormatInfo2) { - var formatInfo = doDecodeFormatInformation(maskedFormatInfo1, maskedFormatInfo2); - if (formatInfo) { - return formatInfo; - } - // Should return null, but, some QR codes apparently - // do not mask this info. Try again by actually masking the pattern - // first - return doDecodeFormatInformation(maskedFormatInfo1 ^ FORMAT_INFO_MASK_QR, maskedFormatInfo2 ^ FORMAT_INFO_MASK_QR); - } - function readFormatInformation(matrix) { - // Read top-left format info bits - var formatInfoBits1 = 0; - for (var i = 0; i < 6; i++) { - formatInfoBits1 = matrix.copyBit(i, 8, formatInfoBits1); - } - // .. and skip a bit in the timing pattern ... - formatInfoBits1 = matrix.copyBit(7, 8, formatInfoBits1); - formatInfoBits1 = matrix.copyBit(8, 8, formatInfoBits1); - formatInfoBits1 = matrix.copyBit(8, 7, formatInfoBits1); - // .. and skip a bit in the timing pattern ... - for (var j = 5; j >= 0; j--) { - formatInfoBits1 = matrix.copyBit(8, j, formatInfoBits1); - } - // Read the top-right/bottom-left pattern too - var dimension = matrix.height; - var formatInfoBits2 = 0; - var jMin = dimension - 7; - for (var j = dimension - 1; j >= jMin; j--) { - formatInfoBits2 = matrix.copyBit(8, j, formatInfoBits2); - } - for (var i = dimension - 8; i < dimension; i++) { - formatInfoBits2 = matrix.copyBit(i, 8, formatInfoBits2); - } - // parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits1, formatInfoBits2); - var parsedFormatInfo = decodeFormatInformation(formatInfoBits1, formatInfoBits2); - if (parsedFormatInfo != null) { - return parsedFormatInfo; - } - return null; - } - function getDataBlocks(rawCodewords, version, ecLevel) { - if (rawCodewords.length != version.totalCodewords) { - throw new Error("Invalid number of codewords for version; got " + rawCodewords.length + " expected " + version.totalCodewords); - } - // Figure out the number and size of data blocks used by this version and - // error correction level - var ecBlocks = version.getECBlocksForLevel(ecLevel); - // First count the total number of data blocks - var totalBlocks = 0; - var ecBlockArray = ecBlocks.ecBlocks; - ecBlockArray.forEach(function (ecBlock) { - totalBlocks += ecBlock.count; - }); - // Now establish DataBlocks of the appropriate size and number of data codewords - var result = new Array(totalBlocks); - var numResultBlocks = 0; - ecBlockArray.forEach(function (ecBlock) { - for (var i = 0; i < ecBlock.count; i++) { - var numDataCodewords = ecBlock.dataCodewords; - var numBlockCodewords = ecBlocks.ecCodewordsPerBlock + numDataCodewords; - result[numResultBlocks++] = { numDataCodewords: numDataCodewords, codewords: new Array(numBlockCodewords) }; - } - }); - // All blocks have the same amount of data, except that the last n - // (where n may be 0) have 1 more byte. Figure out where these start. - var shorterBlocksTotalCodewords = result[0].codewords.length; - var longerBlocksStartAt = result.length - 1; - while (longerBlocksStartAt >= 0) { - var numCodewords = result[longerBlocksStartAt].codewords.length; - if (numCodewords == shorterBlocksTotalCodewords) { - break; - } - longerBlocksStartAt--; - } - longerBlocksStartAt++; - var shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.ecCodewordsPerBlock; - // The last elements of result may be 1 element longer; - // first fill out as many elements as all of them have - var rawCodewordsOffset = 0; - for (var i = 0; i < shorterBlocksNumDataCodewords; i++) { - for (var j = 0; j < numResultBlocks; j++) { - result[j].codewords[i] = rawCodewords[rawCodewordsOffset++]; - } - } - // Fill out the last data block in the longer ones - for (var j = longerBlocksStartAt; j < numResultBlocks; j++) { - result[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++]; - } - // Now add in error correction blocks - var max = result[0].codewords.length; - for (var i = shorterBlocksNumDataCodewords; i < max; i++) { - for (var j = 0; j < numResultBlocks; j++) { - var iOffset = j < longerBlocksStartAt ? i : i + 1; - result[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++]; - } - } - return result; - } - function correctErrors(codewordBytes, numDataCodewords) { - var rsDecoder = new reedsolomon_1.ReedSolomonDecoder(); - var numCodewords = codewordBytes.length; - // First read into an array of ints - var codewordsInts = new Array(numCodewords); - for (var i = 0; i < numCodewords; i++) { - codewordsInts[i] = codewordBytes[i] & 0xFF; - } - var numECCodewords = codewordBytes.length - numDataCodewords; - if (!rsDecoder.decode(codewordsInts, numECCodewords)) - return false; - // Copy back into array of bytes -- only need to worry about the bytes that were data - // We don't care about errors in the error-correction codewords - for (var i = 0; i < numDataCodewords; i++) { - codewordBytes[i] = codewordsInts[i]; - } - return true; - } - function decodeMatrix(matrix) { - var version = readVersion(matrix); - if (!version) { - return null; - } - var formatInfo = readFormatInformation(matrix); - if (!formatInfo) { - return null; - } - var ecLevel = formatInfo.errorCorrectionLevel; - // Read codewords - var codewords = readCodewords(matrix, version, formatInfo); - if (!codewords) { - return null; - } - // Separate into data blocks - var dataBlocks = getDataBlocks(codewords, version, ecLevel); - // Count total number of data bytes - var totalBytes = 0; - dataBlocks.forEach(function (dataBlock) { - totalBytes += dataBlock.numDataCodewords; - }); - var resultBytes = new Array(totalBytes); - var resultOffset = 0; - // Error-correct and copy data blocks together into a stream of bytes - for (var _i = 0, dataBlocks_1 = dataBlocks; _i < dataBlocks_1.length; _i++) { - var dataBlock = dataBlocks_1[_i]; - var codewordBytes = dataBlock.codewords; - var numDataCodewords = dataBlock.numDataCodewords; - if (!correctErrors(codewordBytes, numDataCodewords)) - return null; - for (var i = 0; i < numDataCodewords; i++) { - resultBytes[resultOffset++] = codewordBytes[i]; - } - } - return decodeqrdata_1.decodeQRdata(resultBytes, version.versionNumber, ecLevel.name); - } - function decode(matrix) { - if (matrix == null) { - return null; - } - var result = decodeMatrix(matrix); - if (result) { - return result; - } - // Decoding didn't work, try mirroring the QR - matrix.mirror(); - return decodeMatrix(matrix); - } - exports.decode = decode; - - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var bitstream_1 = __webpack_require__(11); - function toAlphaNumericByte(value) { - var ALPHANUMERIC_CHARS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - ' ', '$', '%', '*', '+', '-', '.', '/', ':']; - if (value >= ALPHANUMERIC_CHARS.length) { - throw new Error("Could not decode alphanumeric char"); - } - return ALPHANUMERIC_CHARS[value].charCodeAt(0); - } - var Mode = (function () { - function Mode(characterCountBitsForVersions, bits) { - this.characterCountBitsForVersions = characterCountBitsForVersions; - this.bits = bits; - } - Mode.prototype.getCharacterCountBits = function (version) { - if (this.characterCountBitsForVersions == null) { - throw new Error("Character count doesn't apply to this mode"); - } - var offset; - if (version <= 9) { - offset = 0; - } - else if (version <= 26) { - offset = 1; - } - else { - offset = 2; - } - return this.characterCountBitsForVersions[offset]; - }; - return Mode; - }()); - var TERMINATOR_MODE = new Mode([0, 0, 0], 0x00); // Not really a mod... - var NUMERIC_MODE = new Mode([10, 12, 14], 0x01); - var ALPHANUMERIC_MODE = new Mode([9, 11, 13], 0x02); - var STRUCTURED_APPEND_MODE = new Mode([0, 0, 0], 0x03); // Not supported - var BYTE_MODE = new Mode([8, 16, 16], 0x04); - var ECI_MODE = new Mode(null, 0x07); // character counts don't apply - var KANJI_MODE = new Mode([8, 10, 12], 0x08); - var FNC1_FIRST_POSITION_MODE = new Mode(null, 0x05); - var FNC1_SECOND_POSITION_MODE = new Mode(null, 0x09); - var HANZI_MODE = new Mode([8, 10, 12], 0x0D); - function modeForBits(bits) { - switch (bits) { - case 0x0: - return TERMINATOR_MODE; - case 0x1: - return NUMERIC_MODE; - case 0x2: - return ALPHANUMERIC_MODE; - case 0x3: - return STRUCTURED_APPEND_MODE; - case 0x4: - return BYTE_MODE; - case 0x5: - return FNC1_FIRST_POSITION_MODE; - case 0x7: - return ECI_MODE; - case 0x8: - return KANJI_MODE; - case 0x9: - return FNC1_SECOND_POSITION_MODE; - case 0xD: - // 0xD is defined in GBT 18284-2000, may not be supported in foreign country - return HANZI_MODE; - default: - throw new Error("Couldn't decode mode from byte array"); - } - } - function parseECIValue(bits) { - var firstByte = bits.readBits(8); - if ((firstByte & 0x80) == 0) { - // just one byte - return firstByte & 0x7F; - } - if ((firstByte & 0xC0) == 0x80) { - // two bytes - var secondByte = bits.readBits(8); - return ((firstByte & 0x3F) << 8) | secondByte; - } - if ((firstByte & 0xE0) == 0xC0) { - // three bytes - var secondThirdBytes = bits.readBits(16); - return ((firstByte & 0x1F) << 16) | secondThirdBytes; - } - throw new Error("Bad ECI bits starting with byte " + firstByte); - } - function decodeHanziSegment(bits, result, count) { - // Don't crash trying to read more bits than we have available. - if (count * 13 > bits.available()) { - return false; - } - // Each character will require 2 bytes. Read the characters as 2-byte pairs - // and decode as GB2312 afterwards - var buffer = new Array(2 * count); - var offset = 0; - while (count > 0) { - // Each 13 bits encodes a 2-byte character - var twoBytes = bits.readBits(13); - var assembledTwoBytes = (Math.floor(twoBytes / 0x060) << 8) | (twoBytes % 0x060); - if (assembledTwoBytes < 0x003BF) { - // In the 0xA1A1 to 0xAAFE range - assembledTwoBytes += 0x0A1A1; - } - else { - // In the 0xB0A1 to 0xFAFE range - assembledTwoBytes += 0x0A6A1; - } - buffer[offset] = ((assembledTwoBytes >> 8) & 0xFF); - buffer[offset + 1] = (assembledTwoBytes & 0xFF); - offset += 2; - count--; - } - result.val = buffer; - return true; - } - function decodeNumericSegment(bits, result, count) { - // Read three digits at a time - while (count >= 3) { - // Each 10 bits encodes three digits - if (bits.available() < 10) { - return false; - } - var threeDigitsBits = bits.readBits(10); - if (threeDigitsBits >= 1000) { - return false; - } - result.val.push(toAlphaNumericByte(Math.floor(threeDigitsBits / 100))); - result.val.push(toAlphaNumericByte(Math.floor(threeDigitsBits / 10) % 10)); - result.val.push(toAlphaNumericByte(threeDigitsBits % 10)); - count -= 3; - } - if (count == 2) { - // Two digits left over to read, encoded in 7 bits - if (bits.available() < 7) { - return false; - } - var twoDigitsBits = bits.readBits(7); - if (twoDigitsBits >= 100) { - return false; - } - result.val.push(toAlphaNumericByte(Math.floor(twoDigitsBits / 10))); - result.val.push(toAlphaNumericByte(twoDigitsBits % 10)); - } - else if (count == 1) { - // One digit left over to read - if (bits.available() < 4) { - return false; - } - var digitBits = bits.readBits(4); - if (digitBits >= 10) { - return false; - } - result.val.push(toAlphaNumericByte(digitBits)); - } - return true; - } - function decodeAlphanumericSegment(bits, result, count, fc1InEffect) { - // Read two characters at a time - var start = result.val.length; - while (count > 1) { - if (bits.available() < 11) { - return false; - } - var nextTwoCharsBits = bits.readBits(11); - result.val.push(toAlphaNumericByte(Math.floor(nextTwoCharsBits / 45))); - result.val.push(toAlphaNumericByte(nextTwoCharsBits % 45)); - count -= 2; - } - if (count == 1) { - // special case: one character left - if (bits.available() < 6) { - return false; - } - result.val.push(toAlphaNumericByte(bits.readBits(6))); - } - // See section 6.4.8.1, 6.4.8.2 - if (fc1InEffect) { - // We need to massage the result a bit if in an FNC1 mode: - for (var i = start; i < result.val.length; i++) { - if (result.val[i] == '%'.charCodeAt(0)) { - if (i < result.val.length - 1 && result.val[i + 1] == '%'.charCodeAt(0)) { - // %% is rendered as % - result.val = result.val.slice(0, i + 1).concat(result.val.slice(i + 2)); - } - else { - // In alpha mode, % should be converted to FNC1 separator 0x1D - // THIS IS ALMOST CERTAINLY INVALID - result.val[i] = 0x1D; - } - } - } - } - return true; - } - function decodeByteSegment(bits, result, count) { - // Don't crash trying to read more bits than we have available. - if (count << 3 > bits.available()) { - return false; - } - var readBytes = new Array(count); - for (var i = 0; i < count; i++) { - readBytes[i] = bits.readBits(8); - } - Array.prototype.push.apply(result.val, readBytes); - return true; - } - var GB2312_SUBSET = 1; - // Takes in a byte array, a qr version number and an error correction level. - // Returns decoded data. - function decodeQRdata(data, version, ecl) { - var symbolSequence = -1; - var parityData = -1; - var bits = new bitstream_1.BitStream(data); - var result = { val: [] }; // Have to pass this around so functions can share a reference to a number[] - var fc1InEffect = false; - var mode; - while (mode != TERMINATOR_MODE) { - // While still another segment to read... - if (bits.available() < 4) { - // OK, assume we're done. Really, a TERMINATOR mode should have been recorded here - mode = TERMINATOR_MODE; - } - else { - mode = modeForBits(bits.readBits(4)); // mode is encoded by 4 bits - } - if (mode != TERMINATOR_MODE) { - if (mode == FNC1_FIRST_POSITION_MODE || mode == FNC1_SECOND_POSITION_MODE) { - // We do little with FNC1 except alter the parsed result a bit according to the spec - fc1InEffect = true; - } - else if (mode == STRUCTURED_APPEND_MODE) { - if (bits.available() < 16) { - return null; - } - // not really supported; but sequence number and parity is added later to the result metadata - // Read next 8 bits (symbol sequence #) and 8 bits (parity data), then continue - symbolSequence = bits.readBits(8); - parityData = bits.readBits(8); - } - else if (mode == ECI_MODE) { - // Ignore since we don't do character encoding in JS - var value = parseECIValue(bits); - if (value < 0 || value > 30) { - return null; - } - } - else { - // First handle Hanzi mode which does not start with character count - if (mode == HANZI_MODE) { - //chinese mode contains a sub set indicator right after mode indicator - var subset = bits.readBits(4); - var countHanzi = bits.readBits(mode.getCharacterCountBits(version)); - if (subset == GB2312_SUBSET) { - if (!decodeHanziSegment(bits, result, countHanzi)) { - return null; - } - } - } - else { - // "Normal" QR code modes: - // How many characters will follow, encoded in this mode? - var count = bits.readBits(mode.getCharacterCountBits(version)); - if (mode == NUMERIC_MODE) { - if (!decodeNumericSegment(bits, result, count)) { - return null; - } - } - else if (mode == ALPHANUMERIC_MODE) { - if (!decodeAlphanumericSegment(bits, result, count, fc1InEffect)) { - return null; - } - } - else if (mode == BYTE_MODE) { - if (!decodeByteSegment(bits, result, count)) { - return null; - } - } - else if (mode == KANJI_MODE) { - } - else { - return null; - } - } - } - } - } - return result.val; - } - exports.decodeQRdata = decodeQRdata; - - -/***/ }, -/* 11 */ -/***/ function(module, exports) { - - "use strict"; - var BitStream = (function () { - function BitStream(bytes) { - this.byteOffset = 0; - this.bitOffset = 0; - this.bytes = bytes; - } - BitStream.prototype.readBits = function (numBits) { - if (numBits < 1 || numBits > 32 || numBits > this.available()) { - throw new Error("Cannot read " + numBits.toString() + " bits"); - } - var result = 0; - // First, read remainder from current byte - if (this.bitOffset > 0) { - var bitsLeft = 8 - this.bitOffset; - var toRead = numBits < bitsLeft ? numBits : bitsLeft; - var bitsToNotRead = bitsLeft - toRead; - var mask = (0xFF >> (8 - toRead)) << bitsToNotRead; - result = (this.bytes[this.byteOffset] & mask) >> bitsToNotRead; - numBits -= toRead; - this.bitOffset += toRead; - if (this.bitOffset == 8) { - this.bitOffset = 0; - this.byteOffset++; - } - } - // Next read whole bytes - if (numBits > 0) { - while (numBits >= 8) { - result = (result << 8) | (this.bytes[this.byteOffset] & 0xFF); - this.byteOffset++; - numBits -= 8; - } - // Finally read a partial byte - if (numBits > 0) { - var bitsToNotRead = 8 - numBits; - var mask = (0xFF >> bitsToNotRead) << bitsToNotRead; - result = (result << numBits) | ((this.bytes[this.byteOffset] & mask) >> bitsToNotRead); - this.bitOffset += numBits; - } - } - return result; - }; - BitStream.prototype.available = function () { - return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset; - }; - return BitStream; - }()); - exports.BitStream = BitStream; - - -/***/ }, -/* 12 */ -/***/ function(module, exports) { - - "use strict"; - var ReedSolomonDecoder = (function () { - function ReedSolomonDecoder() { - this.field = new GenericGF(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1 - } - ReedSolomonDecoder.prototype.decode = function (received, twoS) { - var poly = new GenericGFPoly(this.field, received); - var syndromeCoefficients = new Array(twoS); - var noError = true; - for (var i = 0; i < twoS; i++) { - var evaluation = poly.evaluateAt(this.field.exp(i + this.field.generatorBase)); - syndromeCoefficients[syndromeCoefficients.length - 1 - i] = evaluation; - if (evaluation != 0) { - noError = false; - } - } - if (noError) { - return true; - } - var syndrome = new GenericGFPoly(this.field, syndromeCoefficients); - var sigmaOmega = this.runEuclideanAlgorithm(this.field.buildMonomial(twoS, 1), syndrome, twoS); - if (sigmaOmega == null) - return false; - var sigma = sigmaOmega[0]; - var errorLocations = this.findErrorLocations(sigma); - if (errorLocations == null) - return false; - var omega = sigmaOmega[1]; - var errorMagnitudes = this.findErrorMagnitudes(omega, errorLocations); - for (var i = 0; i < errorLocations.length; i++) { - var position = received.length - 1 - this.field.log(errorLocations[i]); - if (position < 0) { - // throw new ReedSolomonException("Bad error location"); - return false; - } - received[position] = GenericGF.addOrSubtract(received[position], errorMagnitudes[i]); - } - return true; - }; - ReedSolomonDecoder.prototype.runEuclideanAlgorithm = function (a, b, R) { - // Assume a's degree is >= b's - if (a.degree() < b.degree()) { - var temp = a; - a = b; - b = temp; - } - var rLast = a; - var r = b; - var tLast = this.field.zero; - var t = this.field.one; - // Run Euclidean algorithm until r's degree is less than R/2 - while (r.degree() >= R / 2) { - var rLastLast = rLast; - var tLastLast = tLast; - rLast = r; - tLast = t; - // Divide rLastLast by rLast, with quotient in q and remainder in r - if (rLast.isZero()) { - // Oops, Euclidean algorithm already terminated? - // throw new ReedSolomonException("r_{i-1} was zero"); - return null; - } - r = rLastLast; - var q = this.field.zero; - var denominatorLeadingTerm = rLast.getCoefficient(rLast.degree()); - var dltInverse = this.field.inverse(denominatorLeadingTerm); - while (r.degree() >= rLast.degree() && !r.isZero()) { - var degreeDiff = r.degree() - rLast.degree(); - var scale = this.field.multiply(r.getCoefficient(r.degree()), dltInverse); - q = q.addOrSubtract(this.field.buildMonomial(degreeDiff, scale)); - r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale)); - } - t = q.multiplyPoly(tLast).addOrSubtract(tLastLast); - if (r.degree() >= rLast.degree()) { - // throw new IllegalStateException("Division algorithm failed to reduce polynomial?"); - return null; - } - } - var sigmaTildeAtZero = t.getCoefficient(0); - if (sigmaTildeAtZero == 0) { - // throw new ReedSolomonException("sigmaTilde(0) was zero"); - return null; - } - var inverse = this.field.inverse(sigmaTildeAtZero); - var sigma = t.multiply(inverse); - var omega = r.multiply(inverse); - return [sigma, omega]; - }; - ReedSolomonDecoder.prototype.findErrorLocations = function (errorLocator) { - // This is a direct application of Chien's search - var numErrors = errorLocator.degree(); - if (numErrors == 1) { - // shortcut - return [errorLocator.getCoefficient(1)]; - } - var result = new Array(numErrors); - var e = 0; - for (var i = 1; i < this.field.size && e < numErrors; i++) { - if (errorLocator.evaluateAt(i) == 0) { - result[e] = this.field.inverse(i); - e++; - } - } - if (e != numErrors) { - // throw new ReedSolomonException("Error locator degree does not match number of roots"); - return null; - } - return result; - }; - ReedSolomonDecoder.prototype.findErrorMagnitudes = function (errorEvaluator, errorLocations) { - // This is directly applying Forney's Formula - var s = errorLocations.length; - var result = new Array(s); - for (var i = 0; i < s; i++) { - var xiInverse = this.field.inverse(errorLocations[i]); - var denominator = 1; - for (var j = 0; j < s; j++) { - if (i != j) { - //denominator = field.multiply(denominator, - // GenericGF.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse))); - // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug. - // Below is a funny-looking workaround from Steven Parkes - var term = this.field.multiply(errorLocations[j], xiInverse); - var termPlus1 = (term & 0x1) == 0 ? term | 1 : term & ~1; - denominator = this.field.multiply(denominator, termPlus1); - } - } - result[i] = this.field.multiply(errorEvaluator.evaluateAt(xiInverse), this.field.inverse(denominator)); - if (this.field.generatorBase != 0) { - result[i] = this.field.multiply(result[i], xiInverse); - } - } - return result; - }; - return ReedSolomonDecoder; - }()); - exports.ReedSolomonDecoder = ReedSolomonDecoder; - var GenericGFPoly = (function () { - function GenericGFPoly(field, coefficients) { - if (coefficients.length == 0) { - throw new Error("No coefficients."); - } - this.field = field; - var coefficientsLength = coefficients.length; - if (coefficientsLength > 1 && coefficients[0] == 0) { - // Leading term must be non-zero for anything except the constant polynomial "0" - var firstNonZero = 1; - while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0) { - firstNonZero++; - } - if (firstNonZero == coefficientsLength) { - this.coefficients = field.zero.coefficients; - } - else { - this.coefficients = new Array(coefficientsLength - firstNonZero); - /*Array.Copy(coefficients, // Source array - firstNonZero, // Source index - this.coefficients, // Destination array - 0, // Destination index - this.coefficients.length); // length*/ - for (var i = 0; i < this.coefficients.length; i++) { - this.coefficients[i] = coefficients[firstNonZero + i]; - } - } - } - else { - this.coefficients = coefficients; - } - } - GenericGFPoly.prototype.evaluateAt = function (a) { - var result = 0; - if (a == 0) { - // Just return the x^0 coefficient - return this.getCoefficient(0); - } - var size = this.coefficients.length; - if (a == 1) { - // Just the sum of the coefficients - this.coefficients.forEach(function (coefficient) { - result = GenericGF.addOrSubtract(result, coefficient); - }); - return result; - } - result = this.coefficients[0]; - for (var i = 1; i < size; i++) { - result = GenericGF.addOrSubtract(this.field.multiply(a, result), this.coefficients[i]); - } - return result; - }; - GenericGFPoly.prototype.getCoefficient = function (degree) { - return this.coefficients[this.coefficients.length - 1 - degree]; - }; - GenericGFPoly.prototype.degree = function () { - return this.coefficients.length - 1; - }; - GenericGFPoly.prototype.isZero = function () { - return this.coefficients[0] == 0; - }; - GenericGFPoly.prototype.addOrSubtract = function (other) { - /* TODO, fix this. - if (!this.field.Equals(other.field)) - { - throw new Error("GenericGFPolys do not have same GenericGF field"); - }*/ - if (this.isZero()) { - return other; - } - if (other.isZero()) { - return this; - } - var smallerCoefficients = this.coefficients; - var largerCoefficients = other.coefficients; - if (smallerCoefficients.length > largerCoefficients.length) { - var temp = smallerCoefficients; - smallerCoefficients = largerCoefficients; - largerCoefficients = temp; - } - var sumDiff = new Array(largerCoefficients.length); - var lengthDiff = largerCoefficients.length - smallerCoefficients.length; - // Copy high-order terms only found in higher-degree polynomial's coefficients - ///Array.Copy(largerCoefficients, 0, sumDiff, 0, lengthDiff); - for (var i = 0; i < lengthDiff; i++) { - sumDiff[i] = largerCoefficients[i]; - } - for (var i = lengthDiff; i < largerCoefficients.length; i++) { - sumDiff[i] = GenericGF.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]); - } - return new GenericGFPoly(this.field, sumDiff); - }; - GenericGFPoly.prototype.multiply = function (scalar) { - if (scalar == 0) { - return this.field.zero; - } - if (scalar == 1) { - return this; - } - var size = this.coefficients.length; - var product = new Array(size); - for (var i = 0; i < size; i++) { - product[i] = this.field.multiply(this.coefficients[i], scalar); - } - return new GenericGFPoly(this.field, product); - }; - GenericGFPoly.prototype.multiplyPoly = function (other) { - /* TODO Fix this. - if (!field.Equals(other.field)) - { - throw new Error("GenericGFPolys do not have same GenericGF field"); - }*/ - if (this.isZero() || other.isZero()) { - return this.field.zero; - } - var aCoefficients = this.coefficients; - var aLength = aCoefficients.length; - var bCoefficients = other.coefficients; - var bLength = bCoefficients.length; - var product = new Array(aLength + bLength - 1); - for (var i = 0; i < aLength; i++) { - var aCoeff = aCoefficients[i]; - for (var j = 0; j < bLength; j++) { - product[i + j] = GenericGF.addOrSubtract(product[i + j], this.field.multiply(aCoeff, bCoefficients[j])); - } - } - return new GenericGFPoly(this.field, product); - }; - GenericGFPoly.prototype.multiplyByMonomial = function (degree, coefficient) { - if (degree < 0) { - throw new Error("Invalid degree less than 0"); - } - if (coefficient == 0) { - return this.field.zero; - } - var size = this.coefficients.length; - var product = new Array(size + degree); - for (var i = 0; i < size; i++) { - product[i] = this.field.multiply(this.coefficients[i], coefficient); - } - return new GenericGFPoly(this.field, product); - }; - return GenericGFPoly; - }()); - var GenericGF = (function () { - function GenericGF(primitive, size, genBase) { - // ok. - this.INITIALIZATION_THRESHOLD = 0; - this.initialized = false; - this.primitive = primitive; - this.size = size; - this.generatorBase = genBase; - if (size <= this.INITIALIZATION_THRESHOLD) { - this.initialize(); - } - } - GenericGF.prototype.initialize = function () { - this.expTable = new Array(this.size); - this.logTable = new Array(this.size); - var x = 1; - for (var i = 0; i < this.size; i++) { - this.expTable[i] = x; - x <<= 1; // x = x * 2; we're assuming the generator alpha is 2 - if (x >= this.size) { - x ^= this.primitive; - x &= this.size - 1; - } - } - for (var i = 0; i < this.size - 1; i++) { - this.logTable[this.expTable[i]] = i; - } - // logTable[0] == 0 but this should never be used - this.zero = new GenericGFPoly(this, [0]); - this.one = new GenericGFPoly(this, [1]); - this.initialized = true; - }; - GenericGF.addOrSubtract = function (a, b) { - return a ^ b; - }; - GenericGF.prototype.checkInit = function () { - if (!this.initialized) - this.initialize(); - }; - GenericGF.prototype.multiply = function (a, b) { - this.checkInit(); - if (a == 0 || b == 0) { - return 0; - } - return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.size - 1)]; - }; - GenericGF.prototype.exp = function (a) { - this.checkInit(); - return this.expTable[a]; - }; - GenericGF.prototype.log = function (a) { - this.checkInit(); - if (a == 0) { - throw new Error("Can't take log(0)"); - } - return this.logTable[a]; - }; - GenericGF.prototype.inverse = function (a) { - this.checkInit(); - if (a == 0) { - throw new Error("Can't invert 0"); - } - return this.expTable[this.size - this.logTable[a] - 1]; - }; - GenericGF.prototype.buildMonomial = function (degree, coefficient) { - this.checkInit(); - if (degree < 0) { - throw new Error("Invalid monomial degree less than 0"); - } - if (coefficient == 0) { - return this.zero; - } - var coefficients = new Array(degree + 1); - coefficients[0] = coefficient; - return new GenericGFPoly(this, coefficients); - }; - return GenericGF; - }()); - - -/***/ } -/******/ ]) -}); -; -},{}],75:[function(require,module,exports){ -(function (global){ -/** - * @license - * Lodash - * Copyright JS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -;(function() { +/***/ (function(module, exports, __webpack_require__) { - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; +"use strict"; - /** Used as the semantic version number. */ - var VERSION = '4.17.11'; +Object.defineProperty(exports, "__esModule", { value: true }); +var BitMatrix = /** @class */ (function () { + function BitMatrix(data, width) { + this.width = width; + this.height = data.length / width; + this.data = data; + } + BitMatrix.createEmpty = function (width, height) { + return new BitMatrix(new Uint8ClampedArray(width * height), width); + }; + BitMatrix.prototype.get = function (x, y) { + if (x < 0 || x >= this.width || y < 0 || y >= this.height) { + return false; + } + return !!this.data[y * this.width + x]; + }; + BitMatrix.prototype.set = function (x, y, v) { + this.data[y * this.width + x] = v ? 1 : 0; + }; + BitMatrix.prototype.setRegion = function (left, top, width, height, v) { + for (var y = top; y < top + height; y++) { + for (var x = left; x < left + width; x++) { + this.set(x, y, !!v); + } + } + }; + BitMatrix.prototype.getInverted = function () { + return new BitMatrix(this.data.map(function (d) { return d === 0 ? 1 : 0; }), this.width); + }; + return BitMatrix; +}()); +exports.BitMatrix = BitMatrix; - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - /** Error message constants. */ - var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', - FUNC_ERROR_TEXT = 'Expected a function'; +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; +"use strict"; - /** Used as the maximum memoize cache size. */ - var MAX_MEMOIZE_SIZE = 500; +Object.defineProperty(exports, "__esModule", { value: true }); +var GenericGFPoly_1 = __webpack_require__(2); +function addOrSubtractGF(a, b) { + return a ^ b; // tslint:disable-line:no-bitwise +} +exports.addOrSubtractGF = addOrSubtractGF; +var GenericGF = /** @class */ (function () { + function GenericGF(primitive, size, genBase) { + this.primitive = primitive; + this.size = size; + this.generatorBase = genBase; + this.expTable = new Array(this.size); + this.logTable = new Array(this.size); + var x = 1; + for (var i = 0; i < this.size; i++) { + this.expTable[i] = x; + x = x * 2; + if (x >= this.size) { + x = (x ^ this.primitive) & (this.size - 1); // tslint:disable-line:no-bitwise + } + } + for (var i = 0; i < this.size - 1; i++) { + this.logTable[this.expTable[i]] = i; + } + this.zero = new GenericGFPoly_1.default(this, Uint8ClampedArray.from([0])); + this.one = new GenericGFPoly_1.default(this, Uint8ClampedArray.from([1])); + } + GenericGF.prototype.multiply = function (a, b) { + if (a === 0 || b === 0) { + return 0; + } + return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.size - 1)]; + }; + GenericGF.prototype.inverse = function (a) { + if (a === 0) { + throw new Error("Can't invert 0"); + } + return this.expTable[this.size - this.logTable[a] - 1]; + }; + GenericGF.prototype.buildMonomial = function (degree, coefficient) { + if (degree < 0) { + throw new Error("Invalid monomial degree less than 0"); + } + if (coefficient === 0) { + return this.zero; + } + var coefficients = new Uint8ClampedArray(degree + 1); + coefficients[0] = coefficient; + return new GenericGFPoly_1.default(this, coefficients); + }; + GenericGF.prototype.log = function (a) { + if (a === 0) { + throw new Error("Can't take log(0)"); + } + return this.logTable[a]; + }; + GenericGF.prototype.exp = function (a) { + return this.expTable[a]; + }; + return GenericGF; +}()); +exports.default = GenericGF; - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG = 4; +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; +"use strict"; - /** Used to compose bitmasks for function metadata. */ - 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; +Object.defineProperty(exports, "__esModule", { value: true }); +var GenericGF_1 = __webpack_require__(1); +var GenericGFPoly = /** @class */ (function () { + function GenericGFPoly(field, coefficients) { + if (coefficients.length === 0) { + throw new Error("No coefficients."); + } + this.field = field; + var coefficientsLength = coefficients.length; + if (coefficientsLength > 1 && coefficients[0] === 0) { + // Leading term must be non-zero for anything except the constant polynomial "0" + var firstNonZero = 1; + while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) { + firstNonZero++; + } + if (firstNonZero === coefficientsLength) { + this.coefficients = field.zero.coefficients; + } + else { + this.coefficients = new Uint8ClampedArray(coefficientsLength - firstNonZero); + for (var i = 0; i < this.coefficients.length; i++) { + this.coefficients[i] = coefficients[firstNonZero + i]; + } + } + } + else { + this.coefficients = coefficients; + } + } + GenericGFPoly.prototype.degree = function () { + return this.coefficients.length - 1; + }; + GenericGFPoly.prototype.isZero = function () { + return this.coefficients[0] === 0; + }; + GenericGFPoly.prototype.getCoefficient = function (degree) { + return this.coefficients[this.coefficients.length - 1 - degree]; + }; + GenericGFPoly.prototype.addOrSubtract = function (other) { + if (this.isZero()) { + return other; + } + if (other.isZero()) { + return this; + } + var smallerCoefficients = this.coefficients; + var largerCoefficients = other.coefficients; + if (smallerCoefficients.length > largerCoefficients.length) { + _a = [largerCoefficients, smallerCoefficients], smallerCoefficients = _a[0], largerCoefficients = _a[1]; + } + var sumDiff = new Uint8ClampedArray(largerCoefficients.length); + var lengthDiff = largerCoefficients.length - smallerCoefficients.length; + for (var i = 0; i < lengthDiff; i++) { + sumDiff[i] = largerCoefficients[i]; + } + for (var i = lengthDiff; i < largerCoefficients.length; i++) { + sumDiff[i] = GenericGF_1.addOrSubtractGF(smallerCoefficients[i - lengthDiff], largerCoefficients[i]); + } + return new GenericGFPoly(this.field, sumDiff); + var _a; + }; + GenericGFPoly.prototype.multiply = function (scalar) { + if (scalar === 0) { + return this.field.zero; + } + if (scalar === 1) { + return this; + } + var size = this.coefficients.length; + var product = new Uint8ClampedArray(size); + for (var i = 0; i < size; i++) { + product[i] = this.field.multiply(this.coefficients[i], scalar); + } + return new GenericGFPoly(this.field, product); + }; + GenericGFPoly.prototype.multiplyPoly = function (other) { + if (this.isZero() || other.isZero()) { + return this.field.zero; + } + var aCoefficients = this.coefficients; + var aLength = aCoefficients.length; + var bCoefficients = other.coefficients; + var bLength = bCoefficients.length; + var product = new Uint8ClampedArray(aLength + bLength - 1); + for (var i = 0; i < aLength; i++) { + var aCoeff = aCoefficients[i]; + for (var j = 0; j < bLength; j++) { + product[i + j] = GenericGF_1.addOrSubtractGF(product[i + j], this.field.multiply(aCoeff, bCoefficients[j])); + } + } + return new GenericGFPoly(this.field, product); + }; + GenericGFPoly.prototype.multiplyByMonomial = function (degree, coefficient) { + if (degree < 0) { + throw new Error("Invalid degree less than 0"); + } + if (coefficient === 0) { + return this.field.zero; + } + var size = this.coefficients.length; + var product = new Uint8ClampedArray(size + degree); + for (var i = 0; i < size; i++) { + product[i] = this.field.multiply(this.coefficients[i], coefficient); + } + return new GenericGFPoly(this.field, product); + }; + GenericGFPoly.prototype.evaluateAt = function (a) { + var result = 0; + if (a === 0) { + // Just return the x^0 coefficient + return this.getCoefficient(0); + } + var size = this.coefficients.length; + if (a === 1) { + // Just the sum of the coefficients + this.coefficients.forEach(function (coefficient) { + result = GenericGF_1.addOrSubtractGF(result, coefficient); + }); + return result; + } + result = this.coefficients[0]; + for (var i = 1; i < size; i++) { + result = GenericGF_1.addOrSubtractGF(this.field.multiply(a, result), this.coefficients[i]); + } + return result; + }; + return GenericGFPoly; +}()); +exports.default = GenericGFPoly; - /** Used as default options for `_.truncate`. */ - var DEFAULT_TRUNC_LENGTH = 30, - DEFAULT_TRUNC_OMISSION = '...'; - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 800, - HOT_SPAN = 16; +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to indicate the type of lazy iteratees. */ - var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_WHILE_FLAG = 3; +"use strict"; - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; +Object.defineProperty(exports, "__esModule", { value: true }); +var binarizer_1 = __webpack_require__(4); +var decoder_1 = __webpack_require__(5); +var extractor_1 = __webpack_require__(11); +var locator_1 = __webpack_require__(12); +function scan(matrix) { + var location = locator_1.locate(matrix); + if (!location) { + return null; + } + var extracted = extractor_1.extract(matrix, location); + var decoded = decoder_1.decode(extracted.matrix); + if (!decoded) { + return null; + } + return { + binaryData: decoded.bytes, + data: decoded.text, + chunks: decoded.chunks, + location: { + topRightCorner: extracted.mappingFunction(location.dimension, 0), + topLeftCorner: extracted.mappingFunction(0, 0), + bottomRightCorner: extracted.mappingFunction(location.dimension, location.dimension), + bottomLeftCorner: extracted.mappingFunction(0, location.dimension), + topRightFinderPattern: location.topRight, + topLeftFinderPattern: location.topLeft, + bottomLeftFinderPattern: location.bottomLeft, + bottomRightAlignmentPattern: location.alignmentPattern, + }, + }; +} +function jsQR(data, width, height) { + var binarized = binarizer_1.binarize(data, width, height); + var result = scan(binarized); + if (!result) { + result = scan(binarized.getInverted()); + } + return result; +} +jsQR.default = jsQR; +exports.default = jsQR; - /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - /** Used to associate wrap methods with their bit flags. */ - 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] - ]; +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { - /** `Object#toString` result references. */ - 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]'; +"use strict"; - 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]'; +Object.defineProperty(exports, "__esModule", { value: true }); +var BitMatrix_1 = __webpack_require__(0); +var REGION_SIZE = 8; +var MIN_DYNAMIC_RANGE = 24; +function numBetween(value, min, max) { + return value < min ? min : value > max ? max : value; +} +// Like BitMatrix but accepts arbitry Uint8 values +var Matrix = /** @class */ (function () { + function Matrix(width, height) { + this.width = width; + this.data = new Uint8ClampedArray(width * height); + } + Matrix.prototype.get = function (x, y) { + return this.data[y * this.width + x]; + }; + Matrix.prototype.set = function (x, y, value) { + this.data[y * this.width + x] = value; + }; + return Matrix; +}()); +function binarize(data, width, height) { + if (data.length !== width * height * 4) { + throw new Error("Malformed data passed to binarizer."); + } + // Convert image to greyscale + var greyscalePixels = new Matrix(width, height); + for (var x = 0; x < width; x++) { + for (var y = 0; y < height; y++) { + var r = data[((y * width + x) * 4) + 0]; + var g = data[((y * width + x) * 4) + 1]; + var b = data[((y * width + x) * 4) + 2]; + greyscalePixels.set(x, y, 0.2126 * r + 0.7152 * g + 0.0722 * b); + } + } + var horizontalRegionCount = Math.ceil(width / REGION_SIZE); + var verticalRegionCount = Math.ceil(height / REGION_SIZE); + var blackPoints = new Matrix(horizontalRegionCount, verticalRegionCount); + for (var verticalRegion = 0; verticalRegion < verticalRegionCount; verticalRegion++) { + for (var hortizontalRegion = 0; hortizontalRegion < horizontalRegionCount; hortizontalRegion++) { + var sum = 0; + var min = Infinity; + var max = 0; + for (var y = 0; y < REGION_SIZE; y++) { + for (var x = 0; x < REGION_SIZE; x++) { + var pixelLumosity = greyscalePixels.get(hortizontalRegion * REGION_SIZE + x, verticalRegion * REGION_SIZE + y); + sum += pixelLumosity; + min = Math.min(min, pixelLumosity); + max = Math.max(max, pixelLumosity); + } + } + var average = sum / (Math.pow(REGION_SIZE, 2)); + if (max - min <= MIN_DYNAMIC_RANGE) { + // If variation within the block is low, assume this is a block with only light or only + // dark pixels. In that case we do not want to use the average, as it would divide this + // low contrast area into black and white pixels, essentially creating data out of noise. + // + // Default the blackpoint for these blocks to be half the min - effectively white them out + average = min / 2; + if (verticalRegion > 0 && hortizontalRegion > 0) { + // Correct the "white background" assumption for blocks that have neighbors by comparing + // the pixels in this block to the previously calculated black points. This is based on + // the fact that dark barcode symbology is always surrounded by some amount of light + // background for which reasonable black point estimates were made. The bp estimated at + // the boundaries is used for the interior. + // The (min < bp) is arbitrary but works better than other heuristics that were tried. + var averageNeighborBlackPoint = (blackPoints.get(hortizontalRegion, verticalRegion - 1) + + (2 * blackPoints.get(hortizontalRegion - 1, verticalRegion)) + + blackPoints.get(hortizontalRegion - 1, verticalRegion - 1)) / 4; + if (min < averageNeighborBlackPoint) { + average = averageNeighborBlackPoint; + } + } + } + blackPoints.set(hortizontalRegion, verticalRegion, average); + } + } + var binarized = BitMatrix_1.BitMatrix.createEmpty(width, height); + for (var verticalRegion = 0; verticalRegion < verticalRegionCount; verticalRegion++) { + for (var hortizontalRegion = 0; hortizontalRegion < horizontalRegionCount; hortizontalRegion++) { + var left = numBetween(hortizontalRegion, 2, horizontalRegionCount - 3); + var top_1 = numBetween(verticalRegion, 2, verticalRegionCount - 3); + var sum = 0; + for (var xRegion = -2; xRegion <= 2; xRegion++) { + for (var yRegion = -2; yRegion <= 2; yRegion++) { + sum += blackPoints.get(left + xRegion, top_1 + yRegion); + } + } + var threshold = sum / 25; + for (var x = 0; x < REGION_SIZE; x++) { + for (var y = 0; y < REGION_SIZE; y++) { + var lum = greyscalePixels.get(hortizontalRegion * REGION_SIZE + x, verticalRegion * REGION_SIZE + y); + binarized.set(hortizontalRegion * REGION_SIZE + x, verticalRegion * REGION_SIZE + y, lum <= threshold); + } + } + } + } + return binarized; +} +exports.binarize = binarize; - /** Used to match empty string literals in compiled template source. */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - /** Used to match HTML entities and HTML characters. */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g, - reHasEscapedHtml = RegExp(reEscapedHtml.source), - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to match template delimiters. */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); +"use strict"; - /** Used to match leading and trailing whitespace. */ - var reTrim = /^\s+|\s+$/g, - reTrimStart = /^\s+/, - reTrimEnd = /\s+$/; +Object.defineProperty(exports, "__esModule", { value: true }); +var BitMatrix_1 = __webpack_require__(0); +var decodeData_1 = __webpack_require__(6); +var reedsolomon_1 = __webpack_require__(9); +var version_1 = __webpack_require__(10); +// tslint:disable:no-bitwise +function numBitsDiffering(x, y) { + var z = x ^ y; + var bitCount = 0; + while (z) { + bitCount++; + z &= z - 1; + } + return bitCount; +} +function pushBit(bit, byte) { + return (byte << 1) | bit; +} +// tslint:enable:no-bitwise +var FORMAT_INFO_TABLE = [ + { bits: 0x5412, formatInfo: { errorCorrectionLevel: 1, dataMask: 0 } }, + { bits: 0x5125, formatInfo: { errorCorrectionLevel: 1, dataMask: 1 } }, + { bits: 0x5E7C, formatInfo: { errorCorrectionLevel: 1, dataMask: 2 } }, + { bits: 0x5B4B, formatInfo: { errorCorrectionLevel: 1, dataMask: 3 } }, + { bits: 0x45F9, formatInfo: { errorCorrectionLevel: 1, dataMask: 4 } }, + { bits: 0x40CE, formatInfo: { errorCorrectionLevel: 1, dataMask: 5 } }, + { bits: 0x4F97, formatInfo: { errorCorrectionLevel: 1, dataMask: 6 } }, + { bits: 0x4AA0, formatInfo: { errorCorrectionLevel: 1, dataMask: 7 } }, + { bits: 0x77C4, formatInfo: { errorCorrectionLevel: 0, dataMask: 0 } }, + { bits: 0x72F3, formatInfo: { errorCorrectionLevel: 0, dataMask: 1 } }, + { bits: 0x7DAA, formatInfo: { errorCorrectionLevel: 0, dataMask: 2 } }, + { bits: 0x789D, formatInfo: { errorCorrectionLevel: 0, dataMask: 3 } }, + { bits: 0x662F, formatInfo: { errorCorrectionLevel: 0, dataMask: 4 } }, + { bits: 0x6318, formatInfo: { errorCorrectionLevel: 0, dataMask: 5 } }, + { bits: 0x6C41, formatInfo: { errorCorrectionLevel: 0, dataMask: 6 } }, + { bits: 0x6976, formatInfo: { errorCorrectionLevel: 0, dataMask: 7 } }, + { bits: 0x1689, formatInfo: { errorCorrectionLevel: 3, dataMask: 0 } }, + { bits: 0x13BE, formatInfo: { errorCorrectionLevel: 3, dataMask: 1 } }, + { bits: 0x1CE7, formatInfo: { errorCorrectionLevel: 3, dataMask: 2 } }, + { bits: 0x19D0, formatInfo: { errorCorrectionLevel: 3, dataMask: 3 } }, + { bits: 0x0762, formatInfo: { errorCorrectionLevel: 3, dataMask: 4 } }, + { bits: 0x0255, formatInfo: { errorCorrectionLevel: 3, dataMask: 5 } }, + { bits: 0x0D0C, formatInfo: { errorCorrectionLevel: 3, dataMask: 6 } }, + { bits: 0x083B, formatInfo: { errorCorrectionLevel: 3, dataMask: 7 } }, + { bits: 0x355F, formatInfo: { errorCorrectionLevel: 2, dataMask: 0 } }, + { bits: 0x3068, formatInfo: { errorCorrectionLevel: 2, dataMask: 1 } }, + { bits: 0x3F31, formatInfo: { errorCorrectionLevel: 2, dataMask: 2 } }, + { bits: 0x3A06, formatInfo: { errorCorrectionLevel: 2, dataMask: 3 } }, + { bits: 0x24B4, formatInfo: { errorCorrectionLevel: 2, dataMask: 4 } }, + { bits: 0x2183, formatInfo: { errorCorrectionLevel: 2, dataMask: 5 } }, + { bits: 0x2EDA, formatInfo: { errorCorrectionLevel: 2, dataMask: 6 } }, + { bits: 0x2BED, formatInfo: { errorCorrectionLevel: 2, dataMask: 7 } }, +]; +var DATA_MASKS = [ + function (p) { return ((p.y + p.x) % 2) === 0; }, + function (p) { return (p.y % 2) === 0; }, + function (p) { return p.x % 3 === 0; }, + function (p) { return (p.y + p.x) % 3 === 0; }, + function (p) { return (Math.floor(p.y / 2) + Math.floor(p.x / 3)) % 2 === 0; }, + function (p) { return ((p.x * p.y) % 2) + ((p.x * p.y) % 3) === 0; }, + function (p) { return ((((p.y * p.x) % 2) + (p.y * p.x) % 3) % 2) === 0; }, + function (p) { return ((((p.y + p.x) % 2) + (p.y * p.x) % 3) % 2) === 0; }, +]; +function buildFunctionPatternMask(version) { + var dimension = 17 + 4 * version.versionNumber; + var matrix = BitMatrix_1.BitMatrix.createEmpty(dimension, dimension); + matrix.setRegion(0, 0, 9, 9, true); // Top left finder pattern + separator + format + matrix.setRegion(dimension - 8, 0, 8, 9, true); // Top right finder pattern + separator + format + matrix.setRegion(0, dimension - 8, 9, 8, true); // Bottom left finder pattern + separator + format + // Alignment patterns + for (var _i = 0, _a = version.alignmentPatternCenters; _i < _a.length; _i++) { + var x = _a[_i]; + for (var _b = 0, _c = version.alignmentPatternCenters; _b < _c.length; _b++) { + var y = _c[_b]; + if (!(x === 6 && y === 6 || x === 6 && y === dimension - 7 || x === dimension - 7 && y === 6)) { + matrix.setRegion(x - 2, y - 2, 5, 5, true); + } + } + } + matrix.setRegion(6, 9, 1, dimension - 17, true); // Vertical timing pattern + matrix.setRegion(9, 6, dimension - 17, 1, true); // Horizontal timing pattern + if (version.versionNumber > 6) { + matrix.setRegion(dimension - 11, 0, 3, 6, true); // Version info, top right + matrix.setRegion(0, dimension - 11, 6, 3, true); // Version info, bottom left + } + return matrix; +} +function readCodewords(matrix, version, formatInfo) { + var dataMask = DATA_MASKS[formatInfo.dataMask]; + var dimension = matrix.height; + var functionPatternMask = buildFunctionPatternMask(version); + var codewords = []; + var currentByte = 0; + var bitsRead = 0; + // Read columns in pairs, from right to left + var readingUp = true; + for (var columnIndex = dimension - 1; columnIndex > 0; columnIndex -= 2) { + if (columnIndex === 6) { + columnIndex--; + } + for (var i = 0; i < dimension; i++) { + var y = readingUp ? dimension - 1 - i : i; + for (var columnOffset = 0; columnOffset < 2; columnOffset++) { + var x = columnIndex - columnOffset; + if (!functionPatternMask.get(x, y)) { + bitsRead++; + var bit = matrix.get(x, y); + if (dataMask({ y: y, x: x })) { + bit = !bit; + } + currentByte = pushBit(bit, currentByte); + if (bitsRead === 8) { + codewords.push(currentByte); + bitsRead = 0; + currentByte = 0; + } + } + } + } + readingUp = !readingUp; + } + return codewords; +} +function readVersion(matrix) { + var dimension = matrix.height; + var provisionalVersion = Math.floor((dimension - 17) / 4); + if (provisionalVersion <= 6) { + return version_1.VERSIONS[provisionalVersion - 1]; + } + var topRightVersionBits = 0; + for (var y = 5; y >= 0; y--) { + for (var x = dimension - 9; x >= dimension - 11; x--) { + topRightVersionBits = pushBit(matrix.get(x, y), topRightVersionBits); + } + } + var bottomLeftVersionBits = 0; + for (var x = 5; x >= 0; x--) { + for (var y = dimension - 9; y >= dimension - 11; y--) { + bottomLeftVersionBits = pushBit(matrix.get(x, y), bottomLeftVersionBits); + } + } + var bestDifference = Infinity; + var bestVersion; + for (var _i = 0, VERSIONS_1 = version_1.VERSIONS; _i < VERSIONS_1.length; _i++) { + var version = VERSIONS_1[_i]; + if (version.infoBits === topRightVersionBits || version.infoBits === bottomLeftVersionBits) { + return version; + } + var difference = numBitsDiffering(topRightVersionBits, version.infoBits); + if (difference < bestDifference) { + bestVersion = version; + bestDifference = difference; + } + difference = numBitsDiffering(bottomLeftVersionBits, version.infoBits); + if (difference < bestDifference) { + bestVersion = version; + bestDifference = difference; + } + } + // We can tolerate up to 3 bits of error since no two version info codewords will + // differ in less than 8 bits. + if (bestDifference <= 3) { + return bestVersion; + } +} +function readFormatInformation(matrix) { + var topLeftFormatInfoBits = 0; + for (var x = 0; x <= 8; x++) { + if (x !== 6) { + topLeftFormatInfoBits = pushBit(matrix.get(x, 8), topLeftFormatInfoBits); + } + } + for (var y = 7; y >= 0; y--) { + if (y !== 6) { + topLeftFormatInfoBits = pushBit(matrix.get(8, y), topLeftFormatInfoBits); + } + } + var dimension = matrix.height; + var topRightBottomRightFormatInfoBits = 0; + for (var y = dimension - 1; y >= dimension - 7; y--) { + topRightBottomRightFormatInfoBits = pushBit(matrix.get(8, y), topRightBottomRightFormatInfoBits); + } + for (var x = dimension - 8; x < dimension; x++) { + topRightBottomRightFormatInfoBits = pushBit(matrix.get(x, 8), topRightBottomRightFormatInfoBits); + } + var bestDifference = Infinity; + var bestFormatInfo = null; + for (var _i = 0, FORMAT_INFO_TABLE_1 = FORMAT_INFO_TABLE; _i < FORMAT_INFO_TABLE_1.length; _i++) { + var _a = FORMAT_INFO_TABLE_1[_i], bits = _a.bits, formatInfo = _a.formatInfo; + if (bits === topLeftFormatInfoBits || bits === topRightBottomRightFormatInfoBits) { + return formatInfo; + } + var difference = numBitsDiffering(topLeftFormatInfoBits, bits); + if (difference < bestDifference) { + bestFormatInfo = formatInfo; + bestDifference = difference; + } + if (topLeftFormatInfoBits !== topRightBottomRightFormatInfoBits) { + difference = numBitsDiffering(topRightBottomRightFormatInfoBits, bits); + if (difference < bestDifference) { + bestFormatInfo = formatInfo; + bestDifference = difference; + } + } + } + // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits differing means we found a match + if (bestDifference <= 3) { + return bestFormatInfo; + } + return null; +} +function getDataBlocks(codewords, version, ecLevel) { + var ecInfo = version.errorCorrectionLevels[ecLevel]; + var dataBlocks = []; + var totalCodewords = 0; + ecInfo.ecBlocks.forEach(function (block) { + for (var i = 0; i < block.numBlocks; i++) { + dataBlocks.push({ numDataCodewords: block.dataCodewordsPerBlock, codewords: [] }); + totalCodewords += block.dataCodewordsPerBlock + ecInfo.ecCodewordsPerBlock; + } + }); + // In some cases the QR code will be malformed enough that we pull off more or less than we should. + // If we pull off less there's nothing we can do. + // If we pull off more we can safely truncate + if (codewords.length < totalCodewords) { + return null; + } + codewords = codewords.slice(0, totalCodewords); + var shortBlockSize = ecInfo.ecBlocks[0].dataCodewordsPerBlock; + // Pull codewords to fill the blocks up to the minimum size + for (var i = 0; i < shortBlockSize; i++) { + for (var _i = 0, dataBlocks_1 = dataBlocks; _i < dataBlocks_1.length; _i++) { + var dataBlock = dataBlocks_1[_i]; + dataBlock.codewords.push(codewords.shift()); + } + } + // If there are any large blocks, pull codewords to fill the last element of those + if (ecInfo.ecBlocks.length > 1) { + var smallBlockCount = ecInfo.ecBlocks[0].numBlocks; + var largeBlockCount = ecInfo.ecBlocks[1].numBlocks; + for (var i = 0; i < largeBlockCount; i++) { + dataBlocks[smallBlockCount + i].codewords.push(codewords.shift()); + } + } + // Add the rest of the codewords to the blocks. These are the error correction codewords. + while (codewords.length > 0) { + for (var _a = 0, dataBlocks_2 = dataBlocks; _a < dataBlocks_2.length; _a++) { + var dataBlock = dataBlocks_2[_a]; + dataBlock.codewords.push(codewords.shift()); + } + } + return dataBlocks; +} +function decodeMatrix(matrix) { + var version = readVersion(matrix); + if (!version) { + return null; + } + var formatInfo = readFormatInformation(matrix); + if (!formatInfo) { + return null; + } + var codewords = readCodewords(matrix, version, formatInfo); + var dataBlocks = getDataBlocks(codewords, version, formatInfo.errorCorrectionLevel); + if (!dataBlocks) { + return null; + } + // Count total number of data bytes + var totalBytes = dataBlocks.reduce(function (a, b) { return a + b.numDataCodewords; }, 0); + var resultBytes = new Uint8ClampedArray(totalBytes); + var resultIndex = 0; + for (var _i = 0, dataBlocks_3 = dataBlocks; _i < dataBlocks_3.length; _i++) { + var dataBlock = dataBlocks_3[_i]; + var correctedBytes = reedsolomon_1.decode(dataBlock.codewords, dataBlock.codewords.length - dataBlock.numDataCodewords); + if (!correctedBytes) { + return null; + } + for (var i = 0; i < dataBlock.numDataCodewords; i++) { + resultBytes[resultIndex++] = correctedBytes[i]; + } + } + try { + return decodeData_1.decode(resultBytes, version.versionNumber); + } + catch (_a) { + return null; + } +} +function decode(matrix) { + if (matrix == null) { + return null; + } + var result = decodeMatrix(matrix); + if (result) { + return result; + } + // Decoding didn't work, try mirroring the QR across the topLeft -> bottomRight line. + for (var x = 0; x < matrix.width; x++) { + for (var y = x + 1; y < matrix.height; y++) { + if (matrix.get(x, y) !== matrix.get(y, x)) { + matrix.set(x, y, !matrix.get(x, y)); + matrix.set(y, x, !matrix.get(y, x)); + } + } + } + return decodeMatrix(matrix); +} +exports.decode = decode; - /** Used to match wrap detail comments. */ - var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, - reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, - reSplitDetails = /,? & /; - /** Used to match words composed of alphanumeric characters. */ - var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; +"use strict"; - /** - * Used to match - * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; +Object.defineProperty(exports, "__esModule", { value: true }); +// tslint:disable:no-bitwise +var BitStream_1 = __webpack_require__(7); +var shiftJISTable_1 = __webpack_require__(8); +var Mode; +(function (Mode) { + Mode["Numeric"] = "numeric"; + Mode["Alphanumeric"] = "alphanumeric"; + Mode["Byte"] = "byte"; + Mode["Kanji"] = "kanji"; + Mode["ECI"] = "eci"; +})(Mode = exports.Mode || (exports.Mode = {})); +var ModeByte; +(function (ModeByte) { + ModeByte[ModeByte["Terminator"] = 0] = "Terminator"; + ModeByte[ModeByte["Numeric"] = 1] = "Numeric"; + ModeByte[ModeByte["Alphanumeric"] = 2] = "Alphanumeric"; + ModeByte[ModeByte["Byte"] = 4] = "Byte"; + ModeByte[ModeByte["Kanji"] = 8] = "Kanji"; + ModeByte[ModeByte["ECI"] = 7] = "ECI"; + // StructuredAppend = 0x3, + // FNC1FirstPosition = 0x5, + // FNC1SecondPosition = 0x9, +})(ModeByte || (ModeByte = {})); +function decodeNumeric(stream, size) { + var bytes = []; + var text = ""; + var characterCountSize = [10, 12, 14][size]; + var length = stream.readBits(characterCountSize); + // Read digits in groups of 3 + while (length >= 3) { + var num = stream.readBits(10); + if (num >= 1000) { + throw new Error("Invalid numeric value above 999"); + } + var a = Math.floor(num / 100); + var b = Math.floor(num / 10) % 10; + var c = num % 10; + bytes.push(48 + a, 48 + b, 48 + c); + text += a.toString() + b.toString() + c.toString(); + length -= 3; + } + // If the number of digits aren't a multiple of 3, the remaining digits are special cased. + if (length === 2) { + var num = stream.readBits(7); + if (num >= 100) { + throw new Error("Invalid numeric value above 99"); + } + var a = Math.floor(num / 10); + var b = num % 10; + bytes.push(48 + a, 48 + b); + text += a.toString() + b.toString(); + } + else if (length === 1) { + var num = stream.readBits(4); + if (num >= 10) { + throw new Error("Invalid numeric value above 9"); + } + bytes.push(48 + num); + text += num.toString(); + } + return { bytes: bytes, text: text }; +} +var AlphanumericCharacterCodes = [ + "0", "1", "2", "3", "4", "5", "6", "7", "8", + "9", "A", "B", "C", "D", "E", "F", "G", "H", + "I", "J", "K", "L", "M", "N", "O", "P", "Q", + "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + " ", "$", "%", "*", "+", "-", ".", "/", ":", +]; +function decodeAlphanumeric(stream, size) { + var bytes = []; + var text = ""; + var characterCountSize = [9, 11, 13][size]; + var length = stream.readBits(characterCountSize); + while (length >= 2) { + var v = stream.readBits(11); + var a = Math.floor(v / 45); + var b = v % 45; + bytes.push(AlphanumericCharacterCodes[a].charCodeAt(0), AlphanumericCharacterCodes[b].charCodeAt(0)); + text += AlphanumericCharacterCodes[a] + AlphanumericCharacterCodes[b]; + length -= 2; + } + if (length === 1) { + var a = stream.readBits(6); + bytes.push(AlphanumericCharacterCodes[a].charCodeAt(0)); + text += AlphanumericCharacterCodes[a]; + } + return { bytes: bytes, text: text }; +} +function decodeByte(stream, size) { + var bytes = []; + var text = ""; + var characterCountSize = [8, 16, 16][size]; + var length = stream.readBits(characterCountSize); + for (var i = 0; i < length; i++) { + var b = stream.readBits(8); + bytes.push(b); + } + try { + text += decodeURIComponent(bytes.map(function (b) { return "%" + ("0" + b.toString(16)).substr(-2); }).join("")); + } + catch (_a) { + // failed to decode + } + return { bytes: bytes, text: text }; +} +function decodeKanji(stream, size) { + var bytes = []; + var text = ""; + var characterCountSize = [8, 10, 12][size]; + var length = stream.readBits(characterCountSize); + for (var i = 0; i < length; i++) { + var k = stream.readBits(13); + var c = (Math.floor(k / 0xC0) << 8) | (k % 0xC0); + if (c < 0x1F00) { + c += 0x8140; + } + else { + c += 0xC140; + } + bytes.push(c >> 8, c & 0xFF); + text += String.fromCharCode(shiftJISTable_1.shiftJISTable[c]); + } + return { bytes: bytes, text: text }; +} +function decode(data, version) { + var stream = new BitStream_1.BitStream(data); + // There are 3 'sizes' based on the version. 1-9 is small (0), 10-26 is medium (1) and 27-40 is large (2). + var size = version <= 9 ? 0 : version <= 26 ? 1 : 2; + var result = { + text: "", + bytes: [], + chunks: [], + }; + while (stream.available() >= 4) { + var mode = stream.readBits(4); + if (mode === ModeByte.Terminator) { + return result; + } + else if (mode === ModeByte.ECI) { + if (stream.readBits(1) === 0) { + result.chunks.push({ + type: Mode.ECI, + assignmentNumber: stream.readBits(7), + }); + } + else if (stream.readBits(1) === 0) { + result.chunks.push({ + type: Mode.ECI, + assignmentNumber: stream.readBits(14), + }); + } + else if (stream.readBits(1) === 0) { + result.chunks.push({ + type: Mode.ECI, + assignmentNumber: stream.readBits(21), + }); + } + else { + // ECI data seems corrupted + result.chunks.push({ + type: Mode.ECI, + assignmentNumber: -1, + }); + } + } + else if (mode === ModeByte.Numeric) { + var numericResult = decodeNumeric(stream, size); + result.text += numericResult.text; + (_a = result.bytes).push.apply(_a, numericResult.bytes); + result.chunks.push({ + type: Mode.Numeric, + text: numericResult.text, + }); + } + else if (mode === ModeByte.Alphanumeric) { + var alphanumericResult = decodeAlphanumeric(stream, size); + result.text += alphanumericResult.text; + (_b = result.bytes).push.apply(_b, alphanumericResult.bytes); + result.chunks.push({ + type: Mode.Alphanumeric, + text: alphanumericResult.text, + }); + } + else if (mode === ModeByte.Byte) { + var byteResult = decodeByte(stream, size); + result.text += byteResult.text; + (_c = result.bytes).push.apply(_c, byteResult.bytes); + result.chunks.push({ + type: Mode.Byte, + bytes: byteResult.bytes, + text: byteResult.text, + }); + } + else if (mode === ModeByte.Kanji) { + var kanjiResult = decodeKanji(stream, size); + result.text += kanjiResult.text; + (_d = result.bytes).push.apply(_d, kanjiResult.bytes); + result.chunks.push({ + type: Mode.Kanji, + bytes: kanjiResult.bytes, + text: kanjiResult.text, + }); + } + } + var _a, _b, _c, _d; +} +exports.decode = decode; - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; +"use strict"; - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; +// tslint:disable:no-bitwise +Object.defineProperty(exports, "__esModule", { value: true }); +var BitStream = /** @class */ (function () { + function BitStream(bytes) { + this.byteOffset = 0; + this.bitOffset = 0; + this.bytes = bytes; + } + BitStream.prototype.readBits = function (numBits) { + if (numBits < 1 || numBits > 32 || numBits > this.available()) { + throw new Error("Cannot read " + numBits.toString() + " bits"); + } + var result = 0; + // First, read remainder from current byte + if (this.bitOffset > 0) { + var bitsLeft = 8 - this.bitOffset; + var toRead = numBits < bitsLeft ? numBits : bitsLeft; + var bitsToNotRead = bitsLeft - toRead; + var mask = (0xFF >> (8 - toRead)) << bitsToNotRead; + result = (this.bytes[this.byteOffset] & mask) >> bitsToNotRead; + numBits -= toRead; + this.bitOffset += toRead; + if (this.bitOffset === 8) { + this.bitOffset = 0; + this.byteOffset++; + } + } + // Next read whole bytes + if (numBits > 0) { + while (numBits >= 8) { + result = (result << 8) | (this.bytes[this.byteOffset] & 0xFF); + this.byteOffset++; + numBits -= 8; + } + // Finally read a partial byte + if (numBits > 0) { + var bitsToNotRead = 8 - numBits; + var mask = (0xFF >> bitsToNotRead) << bitsToNotRead; + result = (result << numBits) | ((this.bytes[this.byteOffset] & mask) >> bitsToNotRead); + this.bitOffset += numBits; + } + } + return result; + }; + BitStream.prototype.available = function () { + return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset; + }; + return BitStream; +}()); +exports.BitStream = BitStream; - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; +"use strict"; - /** Used to ensure capturing order of template delimiters. */ - var reNoMatch = /($^)/; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shiftJISTable = { + 0x20: 0x0020, + 0x21: 0x0021, + 0x22: 0x0022, + 0x23: 0x0023, + 0x24: 0x0024, + 0x25: 0x0025, + 0x26: 0x0026, + 0x27: 0x0027, + 0x28: 0x0028, + 0x29: 0x0029, + 0x2A: 0x002A, + 0x2B: 0x002B, + 0x2C: 0x002C, + 0x2D: 0x002D, + 0x2E: 0x002E, + 0x2F: 0x002F, + 0x30: 0x0030, + 0x31: 0x0031, + 0x32: 0x0032, + 0x33: 0x0033, + 0x34: 0x0034, + 0x35: 0x0035, + 0x36: 0x0036, + 0x37: 0x0037, + 0x38: 0x0038, + 0x39: 0x0039, + 0x3A: 0x003A, + 0x3B: 0x003B, + 0x3C: 0x003C, + 0x3D: 0x003D, + 0x3E: 0x003E, + 0x3F: 0x003F, + 0x40: 0x0040, + 0x41: 0x0041, + 0x42: 0x0042, + 0x43: 0x0043, + 0x44: 0x0044, + 0x45: 0x0045, + 0x46: 0x0046, + 0x47: 0x0047, + 0x48: 0x0048, + 0x49: 0x0049, + 0x4A: 0x004A, + 0x4B: 0x004B, + 0x4C: 0x004C, + 0x4D: 0x004D, + 0x4E: 0x004E, + 0x4F: 0x004F, + 0x50: 0x0050, + 0x51: 0x0051, + 0x52: 0x0052, + 0x53: 0x0053, + 0x54: 0x0054, + 0x55: 0x0055, + 0x56: 0x0056, + 0x57: 0x0057, + 0x58: 0x0058, + 0x59: 0x0059, + 0x5A: 0x005A, + 0x5B: 0x005B, + 0x5C: 0x00A5, + 0x5D: 0x005D, + 0x5E: 0x005E, + 0x5F: 0x005F, + 0x60: 0x0060, + 0x61: 0x0061, + 0x62: 0x0062, + 0x63: 0x0063, + 0x64: 0x0064, + 0x65: 0x0065, + 0x66: 0x0066, + 0x67: 0x0067, + 0x68: 0x0068, + 0x69: 0x0069, + 0x6A: 0x006A, + 0x6B: 0x006B, + 0x6C: 0x006C, + 0x6D: 0x006D, + 0x6E: 0x006E, + 0x6F: 0x006F, + 0x70: 0x0070, + 0x71: 0x0071, + 0x72: 0x0072, + 0x73: 0x0073, + 0x74: 0x0074, + 0x75: 0x0075, + 0x76: 0x0076, + 0x77: 0x0077, + 0x78: 0x0078, + 0x79: 0x0079, + 0x7A: 0x007A, + 0x7B: 0x007B, + 0x7C: 0x007C, + 0x7D: 0x007D, + 0x7E: 0x203E, + 0x8140: 0x3000, + 0x8141: 0x3001, + 0x8142: 0x3002, + 0x8143: 0xFF0C, + 0x8144: 0xFF0E, + 0x8145: 0x30FB, + 0x8146: 0xFF1A, + 0x8147: 0xFF1B, + 0x8148: 0xFF1F, + 0x8149: 0xFF01, + 0x814A: 0x309B, + 0x814B: 0x309C, + 0x814C: 0x00B4, + 0x814D: 0xFF40, + 0x814E: 0x00A8, + 0x814F: 0xFF3E, + 0x8150: 0xFFE3, + 0x8151: 0xFF3F, + 0x8152: 0x30FD, + 0x8153: 0x30FE, + 0x8154: 0x309D, + 0x8155: 0x309E, + 0x8156: 0x3003, + 0x8157: 0x4EDD, + 0x8158: 0x3005, + 0x8159: 0x3006, + 0x815A: 0x3007, + 0x815B: 0x30FC, + 0x815C: 0x2015, + 0x815D: 0x2010, + 0x815E: 0xFF0F, + 0x815F: 0x005C, + 0x8160: 0x301C, + 0x8161: 0x2016, + 0x8162: 0xFF5C, + 0x8163: 0x2026, + 0x8164: 0x2025, + 0x8165: 0x2018, + 0x8166: 0x2019, + 0x8167: 0x201C, + 0x8168: 0x201D, + 0x8169: 0xFF08, + 0x816A: 0xFF09, + 0x816B: 0x3014, + 0x816C: 0x3015, + 0x816D: 0xFF3B, + 0x816E: 0xFF3D, + 0x816F: 0xFF5B, + 0x8170: 0xFF5D, + 0x8171: 0x3008, + 0x8172: 0x3009, + 0x8173: 0x300A, + 0x8174: 0x300B, + 0x8175: 0x300C, + 0x8176: 0x300D, + 0x8177: 0x300E, + 0x8178: 0x300F, + 0x8179: 0x3010, + 0x817A: 0x3011, + 0x817B: 0xFF0B, + 0x817C: 0x2212, + 0x817D: 0x00B1, + 0x817E: 0x00D7, + 0x8180: 0x00F7, + 0x8181: 0xFF1D, + 0x8182: 0x2260, + 0x8183: 0xFF1C, + 0x8184: 0xFF1E, + 0x8185: 0x2266, + 0x8186: 0x2267, + 0x8187: 0x221E, + 0x8188: 0x2234, + 0x8189: 0x2642, + 0x818A: 0x2640, + 0x818B: 0x00B0, + 0x818C: 0x2032, + 0x818D: 0x2033, + 0x818E: 0x2103, + 0x818F: 0xFFE5, + 0x8190: 0xFF04, + 0x8191: 0x00A2, + 0x8192: 0x00A3, + 0x8193: 0xFF05, + 0x8194: 0xFF03, + 0x8195: 0xFF06, + 0x8196: 0xFF0A, + 0x8197: 0xFF20, + 0x8198: 0x00A7, + 0x8199: 0x2606, + 0x819A: 0x2605, + 0x819B: 0x25CB, + 0x819C: 0x25CF, + 0x819D: 0x25CE, + 0x819E: 0x25C7, + 0x819F: 0x25C6, + 0x81A0: 0x25A1, + 0x81A1: 0x25A0, + 0x81A2: 0x25B3, + 0x81A3: 0x25B2, + 0x81A4: 0x25BD, + 0x81A5: 0x25BC, + 0x81A6: 0x203B, + 0x81A7: 0x3012, + 0x81A8: 0x2192, + 0x81A9: 0x2190, + 0x81AA: 0x2191, + 0x81AB: 0x2193, + 0x81AC: 0x3013, + 0x81B8: 0x2208, + 0x81B9: 0x220B, + 0x81BA: 0x2286, + 0x81BB: 0x2287, + 0x81BC: 0x2282, + 0x81BD: 0x2283, + 0x81BE: 0x222A, + 0x81BF: 0x2229, + 0x81C8: 0x2227, + 0x81C9: 0x2228, + 0x81CA: 0x00AC, + 0x81CB: 0x21D2, + 0x81CC: 0x21D4, + 0x81CD: 0x2200, + 0x81CE: 0x2203, + 0x81DA: 0x2220, + 0x81DB: 0x22A5, + 0x81DC: 0x2312, + 0x81DD: 0x2202, + 0x81DE: 0x2207, + 0x81DF: 0x2261, + 0x81E0: 0x2252, + 0x81E1: 0x226A, + 0x81E2: 0x226B, + 0x81E3: 0x221A, + 0x81E4: 0x223D, + 0x81E5: 0x221D, + 0x81E6: 0x2235, + 0x81E7: 0x222B, + 0x81E8: 0x222C, + 0x81F0: 0x212B, + 0x81F1: 0x2030, + 0x81F2: 0x266F, + 0x81F3: 0x266D, + 0x81F4: 0x266A, + 0x81F5: 0x2020, + 0x81F6: 0x2021, + 0x81F7: 0x00B6, + 0x81FC: 0x25EF, + 0x824F: 0xFF10, + 0x8250: 0xFF11, + 0x8251: 0xFF12, + 0x8252: 0xFF13, + 0x8253: 0xFF14, + 0x8254: 0xFF15, + 0x8255: 0xFF16, + 0x8256: 0xFF17, + 0x8257: 0xFF18, + 0x8258: 0xFF19, + 0x8260: 0xFF21, + 0x8261: 0xFF22, + 0x8262: 0xFF23, + 0x8263: 0xFF24, + 0x8264: 0xFF25, + 0x8265: 0xFF26, + 0x8266: 0xFF27, + 0x8267: 0xFF28, + 0x8268: 0xFF29, + 0x8269: 0xFF2A, + 0x826A: 0xFF2B, + 0x826B: 0xFF2C, + 0x826C: 0xFF2D, + 0x826D: 0xFF2E, + 0x826E: 0xFF2F, + 0x826F: 0xFF30, + 0x8270: 0xFF31, + 0x8271: 0xFF32, + 0x8272: 0xFF33, + 0x8273: 0xFF34, + 0x8274: 0xFF35, + 0x8275: 0xFF36, + 0x8276: 0xFF37, + 0x8277: 0xFF38, + 0x8278: 0xFF39, + 0x8279: 0xFF3A, + 0x8281: 0xFF41, + 0x8282: 0xFF42, + 0x8283: 0xFF43, + 0x8284: 0xFF44, + 0x8285: 0xFF45, + 0x8286: 0xFF46, + 0x8287: 0xFF47, + 0x8288: 0xFF48, + 0x8289: 0xFF49, + 0x828A: 0xFF4A, + 0x828B: 0xFF4B, + 0x828C: 0xFF4C, + 0x828D: 0xFF4D, + 0x828E: 0xFF4E, + 0x828F: 0xFF4F, + 0x8290: 0xFF50, + 0x8291: 0xFF51, + 0x8292: 0xFF52, + 0x8293: 0xFF53, + 0x8294: 0xFF54, + 0x8295: 0xFF55, + 0x8296: 0xFF56, + 0x8297: 0xFF57, + 0x8298: 0xFF58, + 0x8299: 0xFF59, + 0x829A: 0xFF5A, + 0x829F: 0x3041, + 0x82A0: 0x3042, + 0x82A1: 0x3043, + 0x82A2: 0x3044, + 0x82A3: 0x3045, + 0x82A4: 0x3046, + 0x82A5: 0x3047, + 0x82A6: 0x3048, + 0x82A7: 0x3049, + 0x82A8: 0x304A, + 0x82A9: 0x304B, + 0x82AA: 0x304C, + 0x82AB: 0x304D, + 0x82AC: 0x304E, + 0x82AD: 0x304F, + 0x82AE: 0x3050, + 0x82AF: 0x3051, + 0x82B0: 0x3052, + 0x82B1: 0x3053, + 0x82B2: 0x3054, + 0x82B3: 0x3055, + 0x82B4: 0x3056, + 0x82B5: 0x3057, + 0x82B6: 0x3058, + 0x82B7: 0x3059, + 0x82B8: 0x305A, + 0x82B9: 0x305B, + 0x82BA: 0x305C, + 0x82BB: 0x305D, + 0x82BC: 0x305E, + 0x82BD: 0x305F, + 0x82BE: 0x3060, + 0x82BF: 0x3061, + 0x82C0: 0x3062, + 0x82C1: 0x3063, + 0x82C2: 0x3064, + 0x82C3: 0x3065, + 0x82C4: 0x3066, + 0x82C5: 0x3067, + 0x82C6: 0x3068, + 0x82C7: 0x3069, + 0x82C8: 0x306A, + 0x82C9: 0x306B, + 0x82CA: 0x306C, + 0x82CB: 0x306D, + 0x82CC: 0x306E, + 0x82CD: 0x306F, + 0x82CE: 0x3070, + 0x82CF: 0x3071, + 0x82D0: 0x3072, + 0x82D1: 0x3073, + 0x82D2: 0x3074, + 0x82D3: 0x3075, + 0x82D4: 0x3076, + 0x82D5: 0x3077, + 0x82D6: 0x3078, + 0x82D7: 0x3079, + 0x82D8: 0x307A, + 0x82D9: 0x307B, + 0x82DA: 0x307C, + 0x82DB: 0x307D, + 0x82DC: 0x307E, + 0x82DD: 0x307F, + 0x82DE: 0x3080, + 0x82DF: 0x3081, + 0x82E0: 0x3082, + 0x82E1: 0x3083, + 0x82E2: 0x3084, + 0x82E3: 0x3085, + 0x82E4: 0x3086, + 0x82E5: 0x3087, + 0x82E6: 0x3088, + 0x82E7: 0x3089, + 0x82E8: 0x308A, + 0x82E9: 0x308B, + 0x82EA: 0x308C, + 0x82EB: 0x308D, + 0x82EC: 0x308E, + 0x82ED: 0x308F, + 0x82EE: 0x3090, + 0x82EF: 0x3091, + 0x82F0: 0x3092, + 0x82F1: 0x3093, + 0x8340: 0x30A1, + 0x8341: 0x30A2, + 0x8342: 0x30A3, + 0x8343: 0x30A4, + 0x8344: 0x30A5, + 0x8345: 0x30A6, + 0x8346: 0x30A7, + 0x8347: 0x30A8, + 0x8348: 0x30A9, + 0x8349: 0x30AA, + 0x834A: 0x30AB, + 0x834B: 0x30AC, + 0x834C: 0x30AD, + 0x834D: 0x30AE, + 0x834E: 0x30AF, + 0x834F: 0x30B0, + 0x8350: 0x30B1, + 0x8351: 0x30B2, + 0x8352: 0x30B3, + 0x8353: 0x30B4, + 0x8354: 0x30B5, + 0x8355: 0x30B6, + 0x8356: 0x30B7, + 0x8357: 0x30B8, + 0x8358: 0x30B9, + 0x8359: 0x30BA, + 0x835A: 0x30BB, + 0x835B: 0x30BC, + 0x835C: 0x30BD, + 0x835D: 0x30BE, + 0x835E: 0x30BF, + 0x835F: 0x30C0, + 0x8360: 0x30C1, + 0x8361: 0x30C2, + 0x8362: 0x30C3, + 0x8363: 0x30C4, + 0x8364: 0x30C5, + 0x8365: 0x30C6, + 0x8366: 0x30C7, + 0x8367: 0x30C8, + 0x8368: 0x30C9, + 0x8369: 0x30CA, + 0x836A: 0x30CB, + 0x836B: 0x30CC, + 0x836C: 0x30CD, + 0x836D: 0x30CE, + 0x836E: 0x30CF, + 0x836F: 0x30D0, + 0x8370: 0x30D1, + 0x8371: 0x30D2, + 0x8372: 0x30D3, + 0x8373: 0x30D4, + 0x8374: 0x30D5, + 0x8375: 0x30D6, + 0x8376: 0x30D7, + 0x8377: 0x30D8, + 0x8378: 0x30D9, + 0x8379: 0x30DA, + 0x837A: 0x30DB, + 0x837B: 0x30DC, + 0x837C: 0x30DD, + 0x837D: 0x30DE, + 0x837E: 0x30DF, + 0x8380: 0x30E0, + 0x8381: 0x30E1, + 0x8382: 0x30E2, + 0x8383: 0x30E3, + 0x8384: 0x30E4, + 0x8385: 0x30E5, + 0x8386: 0x30E6, + 0x8387: 0x30E7, + 0x8388: 0x30E8, + 0x8389: 0x30E9, + 0x838A: 0x30EA, + 0x838B: 0x30EB, + 0x838C: 0x30EC, + 0x838D: 0x30ED, + 0x838E: 0x30EE, + 0x838F: 0x30EF, + 0x8390: 0x30F0, + 0x8391: 0x30F1, + 0x8392: 0x30F2, + 0x8393: 0x30F3, + 0x8394: 0x30F4, + 0x8395: 0x30F5, + 0x8396: 0x30F6, + 0x839F: 0x0391, + 0x83A0: 0x0392, + 0x83A1: 0x0393, + 0x83A2: 0x0394, + 0x83A3: 0x0395, + 0x83A4: 0x0396, + 0x83A5: 0x0397, + 0x83A6: 0x0398, + 0x83A7: 0x0399, + 0x83A8: 0x039A, + 0x83A9: 0x039B, + 0x83AA: 0x039C, + 0x83AB: 0x039D, + 0x83AC: 0x039E, + 0x83AD: 0x039F, + 0x83AE: 0x03A0, + 0x83AF: 0x03A1, + 0x83B0: 0x03A3, + 0x83B1: 0x03A4, + 0x83B2: 0x03A5, + 0x83B3: 0x03A6, + 0x83B4: 0x03A7, + 0x83B5: 0x03A8, + 0x83B6: 0x03A9, + 0x83BF: 0x03B1, + 0x83C0: 0x03B2, + 0x83C1: 0x03B3, + 0x83C2: 0x03B4, + 0x83C3: 0x03B5, + 0x83C4: 0x03B6, + 0x83C5: 0x03B7, + 0x83C6: 0x03B8, + 0x83C7: 0x03B9, + 0x83C8: 0x03BA, + 0x83C9: 0x03BB, + 0x83CA: 0x03BC, + 0x83CB: 0x03BD, + 0x83CC: 0x03BE, + 0x83CD: 0x03BF, + 0x83CE: 0x03C0, + 0x83CF: 0x03C1, + 0x83D0: 0x03C3, + 0x83D1: 0x03C4, + 0x83D2: 0x03C5, + 0x83D3: 0x03C6, + 0x83D4: 0x03C7, + 0x83D5: 0x03C8, + 0x83D6: 0x03C9, + 0x8440: 0x0410, + 0x8441: 0x0411, + 0x8442: 0x0412, + 0x8443: 0x0413, + 0x8444: 0x0414, + 0x8445: 0x0415, + 0x8446: 0x0401, + 0x8447: 0x0416, + 0x8448: 0x0417, + 0x8449: 0x0418, + 0x844A: 0x0419, + 0x844B: 0x041A, + 0x844C: 0x041B, + 0x844D: 0x041C, + 0x844E: 0x041D, + 0x844F: 0x041E, + 0x8450: 0x041F, + 0x8451: 0x0420, + 0x8452: 0x0421, + 0x8453: 0x0422, + 0x8454: 0x0423, + 0x8455: 0x0424, + 0x8456: 0x0425, + 0x8457: 0x0426, + 0x8458: 0x0427, + 0x8459: 0x0428, + 0x845A: 0x0429, + 0x845B: 0x042A, + 0x845C: 0x042B, + 0x845D: 0x042C, + 0x845E: 0x042D, + 0x845F: 0x042E, + 0x8460: 0x042F, + 0x8470: 0x0430, + 0x8471: 0x0431, + 0x8472: 0x0432, + 0x8473: 0x0433, + 0x8474: 0x0434, + 0x8475: 0x0435, + 0x8476: 0x0451, + 0x8477: 0x0436, + 0x8478: 0x0437, + 0x8479: 0x0438, + 0x847A: 0x0439, + 0x847B: 0x043A, + 0x847C: 0x043B, + 0x847D: 0x043C, + 0x847E: 0x043D, + 0x8480: 0x043E, + 0x8481: 0x043F, + 0x8482: 0x0440, + 0x8483: 0x0441, + 0x8484: 0x0442, + 0x8485: 0x0443, + 0x8486: 0x0444, + 0x8487: 0x0445, + 0x8488: 0x0446, + 0x8489: 0x0447, + 0x848A: 0x0448, + 0x848B: 0x0449, + 0x848C: 0x044A, + 0x848D: 0x044B, + 0x848E: 0x044C, + 0x848F: 0x044D, + 0x8490: 0x044E, + 0x8491: 0x044F, + 0x849F: 0x2500, + 0x84A0: 0x2502, + 0x84A1: 0x250C, + 0x84A2: 0x2510, + 0x84A3: 0x2518, + 0x84A4: 0x2514, + 0x84A5: 0x251C, + 0x84A6: 0x252C, + 0x84A7: 0x2524, + 0x84A8: 0x2534, + 0x84A9: 0x253C, + 0x84AA: 0x2501, + 0x84AB: 0x2503, + 0x84AC: 0x250F, + 0x84AD: 0x2513, + 0x84AE: 0x251B, + 0x84AF: 0x2517, + 0x84B0: 0x2523, + 0x84B1: 0x2533, + 0x84B2: 0x252B, + 0x84B3: 0x253B, + 0x84B4: 0x254B, + 0x84B5: 0x2520, + 0x84B6: 0x252F, + 0x84B7: 0x2528, + 0x84B8: 0x2537, + 0x84B9: 0x253F, + 0x84BA: 0x251D, + 0x84BB: 0x2530, + 0x84BC: 0x2525, + 0x84BD: 0x2538, + 0x84BE: 0x2542, + 0x889F: 0x4E9C, + 0x88A0: 0x5516, + 0x88A1: 0x5A03, + 0x88A2: 0x963F, + 0x88A3: 0x54C0, + 0x88A4: 0x611B, + 0x88A5: 0x6328, + 0x88A6: 0x59F6, + 0x88A7: 0x9022, + 0x88A8: 0x8475, + 0x88A9: 0x831C, + 0x88AA: 0x7A50, + 0x88AB: 0x60AA, + 0x88AC: 0x63E1, + 0x88AD: 0x6E25, + 0x88AE: 0x65ED, + 0x88AF: 0x8466, + 0x88B0: 0x82A6, + 0x88B1: 0x9BF5, + 0x88B2: 0x6893, + 0x88B3: 0x5727, + 0x88B4: 0x65A1, + 0x88B5: 0x6271, + 0x88B6: 0x5B9B, + 0x88B7: 0x59D0, + 0x88B8: 0x867B, + 0x88B9: 0x98F4, + 0x88BA: 0x7D62, + 0x88BB: 0x7DBE, + 0x88BC: 0x9B8E, + 0x88BD: 0x6216, + 0x88BE: 0x7C9F, + 0x88BF: 0x88B7, + 0x88C0: 0x5B89, + 0x88C1: 0x5EB5, + 0x88C2: 0x6309, + 0x88C3: 0x6697, + 0x88C4: 0x6848, + 0x88C5: 0x95C7, + 0x88C6: 0x978D, + 0x88C7: 0x674F, + 0x88C8: 0x4EE5, + 0x88C9: 0x4F0A, + 0x88CA: 0x4F4D, + 0x88CB: 0x4F9D, + 0x88CC: 0x5049, + 0x88CD: 0x56F2, + 0x88CE: 0x5937, + 0x88CF: 0x59D4, + 0x88D0: 0x5A01, + 0x88D1: 0x5C09, + 0x88D2: 0x60DF, + 0x88D3: 0x610F, + 0x88D4: 0x6170, + 0x88D5: 0x6613, + 0x88D6: 0x6905, + 0x88D7: 0x70BA, + 0x88D8: 0x754F, + 0x88D9: 0x7570, + 0x88DA: 0x79FB, + 0x88DB: 0x7DAD, + 0x88DC: 0x7DEF, + 0x88DD: 0x80C3, + 0x88DE: 0x840E, + 0x88DF: 0x8863, + 0x88E0: 0x8B02, + 0x88E1: 0x9055, + 0x88E2: 0x907A, + 0x88E3: 0x533B, + 0x88E4: 0x4E95, + 0x88E5: 0x4EA5, + 0x88E6: 0x57DF, + 0x88E7: 0x80B2, + 0x88E8: 0x90C1, + 0x88E9: 0x78EF, + 0x88EA: 0x4E00, + 0x88EB: 0x58F1, + 0x88EC: 0x6EA2, + 0x88ED: 0x9038, + 0x88EE: 0x7A32, + 0x88EF: 0x8328, + 0x88F0: 0x828B, + 0x88F1: 0x9C2F, + 0x88F2: 0x5141, + 0x88F3: 0x5370, + 0x88F4: 0x54BD, + 0x88F5: 0x54E1, + 0x88F6: 0x56E0, + 0x88F7: 0x59FB, + 0x88F8: 0x5F15, + 0x88F9: 0x98F2, + 0x88FA: 0x6DEB, + 0x88FB: 0x80E4, + 0x88FC: 0x852D, + 0x8940: 0x9662, + 0x8941: 0x9670, + 0x8942: 0x96A0, + 0x8943: 0x97FB, + 0x8944: 0x540B, + 0x8945: 0x53F3, + 0x8946: 0x5B87, + 0x8947: 0x70CF, + 0x8948: 0x7FBD, + 0x8949: 0x8FC2, + 0x894A: 0x96E8, + 0x894B: 0x536F, + 0x894C: 0x9D5C, + 0x894D: 0x7ABA, + 0x894E: 0x4E11, + 0x894F: 0x7893, + 0x8950: 0x81FC, + 0x8951: 0x6E26, + 0x8952: 0x5618, + 0x8953: 0x5504, + 0x8954: 0x6B1D, + 0x8955: 0x851A, + 0x8956: 0x9C3B, + 0x8957: 0x59E5, + 0x8958: 0x53A9, + 0x8959: 0x6D66, + 0x895A: 0x74DC, + 0x895B: 0x958F, + 0x895C: 0x5642, + 0x895D: 0x4E91, + 0x895E: 0x904B, + 0x895F: 0x96F2, + 0x8960: 0x834F, + 0x8961: 0x990C, + 0x8962: 0x53E1, + 0x8963: 0x55B6, + 0x8964: 0x5B30, + 0x8965: 0x5F71, + 0x8966: 0x6620, + 0x8967: 0x66F3, + 0x8968: 0x6804, + 0x8969: 0x6C38, + 0x896A: 0x6CF3, + 0x896B: 0x6D29, + 0x896C: 0x745B, + 0x896D: 0x76C8, + 0x896E: 0x7A4E, + 0x896F: 0x9834, + 0x8970: 0x82F1, + 0x8971: 0x885B, + 0x8972: 0x8A60, + 0x8973: 0x92ED, + 0x8974: 0x6DB2, + 0x8975: 0x75AB, + 0x8976: 0x76CA, + 0x8977: 0x99C5, + 0x8978: 0x60A6, + 0x8979: 0x8B01, + 0x897A: 0x8D8A, + 0x897B: 0x95B2, + 0x897C: 0x698E, + 0x897D: 0x53AD, + 0x897E: 0x5186, + 0x8980: 0x5712, + 0x8981: 0x5830, + 0x8982: 0x5944, + 0x8983: 0x5BB4, + 0x8984: 0x5EF6, + 0x8985: 0x6028, + 0x8986: 0x63A9, + 0x8987: 0x63F4, + 0x8988: 0x6CBF, + 0x8989: 0x6F14, + 0x898A: 0x708E, + 0x898B: 0x7114, + 0x898C: 0x7159, + 0x898D: 0x71D5, + 0x898E: 0x733F, + 0x898F: 0x7E01, + 0x8990: 0x8276, + 0x8991: 0x82D1, + 0x8992: 0x8597, + 0x8993: 0x9060, + 0x8994: 0x925B, + 0x8995: 0x9D1B, + 0x8996: 0x5869, + 0x8997: 0x65BC, + 0x8998: 0x6C5A, + 0x8999: 0x7525, + 0x899A: 0x51F9, + 0x899B: 0x592E, + 0x899C: 0x5965, + 0x899D: 0x5F80, + 0x899E: 0x5FDC, + 0x899F: 0x62BC, + 0x89A0: 0x65FA, + 0x89A1: 0x6A2A, + 0x89A2: 0x6B27, + 0x89A3: 0x6BB4, + 0x89A4: 0x738B, + 0x89A5: 0x7FC1, + 0x89A6: 0x8956, + 0x89A7: 0x9D2C, + 0x89A8: 0x9D0E, + 0x89A9: 0x9EC4, + 0x89AA: 0x5CA1, + 0x89AB: 0x6C96, + 0x89AC: 0x837B, + 0x89AD: 0x5104, + 0x89AE: 0x5C4B, + 0x89AF: 0x61B6, + 0x89B0: 0x81C6, + 0x89B1: 0x6876, + 0x89B2: 0x7261, + 0x89B3: 0x4E59, + 0x89B4: 0x4FFA, + 0x89B5: 0x5378, + 0x89B6: 0x6069, + 0x89B7: 0x6E29, + 0x89B8: 0x7A4F, + 0x89B9: 0x97F3, + 0x89BA: 0x4E0B, + 0x89BB: 0x5316, + 0x89BC: 0x4EEE, + 0x89BD: 0x4F55, + 0x89BE: 0x4F3D, + 0x89BF: 0x4FA1, + 0x89C0: 0x4F73, + 0x89C1: 0x52A0, + 0x89C2: 0x53EF, + 0x89C3: 0x5609, + 0x89C4: 0x590F, + 0x89C5: 0x5AC1, + 0x89C6: 0x5BB6, + 0x89C7: 0x5BE1, + 0x89C8: 0x79D1, + 0x89C9: 0x6687, + 0x89CA: 0x679C, + 0x89CB: 0x67B6, + 0x89CC: 0x6B4C, + 0x89CD: 0x6CB3, + 0x89CE: 0x706B, + 0x89CF: 0x73C2, + 0x89D0: 0x798D, + 0x89D1: 0x79BE, + 0x89D2: 0x7A3C, + 0x89D3: 0x7B87, + 0x89D4: 0x82B1, + 0x89D5: 0x82DB, + 0x89D6: 0x8304, + 0x89D7: 0x8377, + 0x89D8: 0x83EF, + 0x89D9: 0x83D3, + 0x89DA: 0x8766, + 0x89DB: 0x8AB2, + 0x89DC: 0x5629, + 0x89DD: 0x8CA8, + 0x89DE: 0x8FE6, + 0x89DF: 0x904E, + 0x89E0: 0x971E, + 0x89E1: 0x868A, + 0x89E2: 0x4FC4, + 0x89E3: 0x5CE8, + 0x89E4: 0x6211, + 0x89E5: 0x7259, + 0x89E6: 0x753B, + 0x89E7: 0x81E5, + 0x89E8: 0x82BD, + 0x89E9: 0x86FE, + 0x89EA: 0x8CC0, + 0x89EB: 0x96C5, + 0x89EC: 0x9913, + 0x89ED: 0x99D5, + 0x89EE: 0x4ECB, + 0x89EF: 0x4F1A, + 0x89F0: 0x89E3, + 0x89F1: 0x56DE, + 0x89F2: 0x584A, + 0x89F3: 0x58CA, + 0x89F4: 0x5EFB, + 0x89F5: 0x5FEB, + 0x89F6: 0x602A, + 0x89F7: 0x6094, + 0x89F8: 0x6062, + 0x89F9: 0x61D0, + 0x89FA: 0x6212, + 0x89FB: 0x62D0, + 0x89FC: 0x6539, + 0x8A40: 0x9B41, + 0x8A41: 0x6666, + 0x8A42: 0x68B0, + 0x8A43: 0x6D77, + 0x8A44: 0x7070, + 0x8A45: 0x754C, + 0x8A46: 0x7686, + 0x8A47: 0x7D75, + 0x8A48: 0x82A5, + 0x8A49: 0x87F9, + 0x8A4A: 0x958B, + 0x8A4B: 0x968E, + 0x8A4C: 0x8C9D, + 0x8A4D: 0x51F1, + 0x8A4E: 0x52BE, + 0x8A4F: 0x5916, + 0x8A50: 0x54B3, + 0x8A51: 0x5BB3, + 0x8A52: 0x5D16, + 0x8A53: 0x6168, + 0x8A54: 0x6982, + 0x8A55: 0x6DAF, + 0x8A56: 0x788D, + 0x8A57: 0x84CB, + 0x8A58: 0x8857, + 0x8A59: 0x8A72, + 0x8A5A: 0x93A7, + 0x8A5B: 0x9AB8, + 0x8A5C: 0x6D6C, + 0x8A5D: 0x99A8, + 0x8A5E: 0x86D9, + 0x8A5F: 0x57A3, + 0x8A60: 0x67FF, + 0x8A61: 0x86CE, + 0x8A62: 0x920E, + 0x8A63: 0x5283, + 0x8A64: 0x5687, + 0x8A65: 0x5404, + 0x8A66: 0x5ED3, + 0x8A67: 0x62E1, + 0x8A68: 0x64B9, + 0x8A69: 0x683C, + 0x8A6A: 0x6838, + 0x8A6B: 0x6BBB, + 0x8A6C: 0x7372, + 0x8A6D: 0x78BA, + 0x8A6E: 0x7A6B, + 0x8A6F: 0x899A, + 0x8A70: 0x89D2, + 0x8A71: 0x8D6B, + 0x8A72: 0x8F03, + 0x8A73: 0x90ED, + 0x8A74: 0x95A3, + 0x8A75: 0x9694, + 0x8A76: 0x9769, + 0x8A77: 0x5B66, + 0x8A78: 0x5CB3, + 0x8A79: 0x697D, + 0x8A7A: 0x984D, + 0x8A7B: 0x984E, + 0x8A7C: 0x639B, + 0x8A7D: 0x7B20, + 0x8A7E: 0x6A2B, + 0x8A80: 0x6A7F, + 0x8A81: 0x68B6, + 0x8A82: 0x9C0D, + 0x8A83: 0x6F5F, + 0x8A84: 0x5272, + 0x8A85: 0x559D, + 0x8A86: 0x6070, + 0x8A87: 0x62EC, + 0x8A88: 0x6D3B, + 0x8A89: 0x6E07, + 0x8A8A: 0x6ED1, + 0x8A8B: 0x845B, + 0x8A8C: 0x8910, + 0x8A8D: 0x8F44, + 0x8A8E: 0x4E14, + 0x8A8F: 0x9C39, + 0x8A90: 0x53F6, + 0x8A91: 0x691B, + 0x8A92: 0x6A3A, + 0x8A93: 0x9784, + 0x8A94: 0x682A, + 0x8A95: 0x515C, + 0x8A96: 0x7AC3, + 0x8A97: 0x84B2, + 0x8A98: 0x91DC, + 0x8A99: 0x938C, + 0x8A9A: 0x565B, + 0x8A9B: 0x9D28, + 0x8A9C: 0x6822, + 0x8A9D: 0x8305, + 0x8A9E: 0x8431, + 0x8A9F: 0x7CA5, + 0x8AA0: 0x5208, + 0x8AA1: 0x82C5, + 0x8AA2: 0x74E6, + 0x8AA3: 0x4E7E, + 0x8AA4: 0x4F83, + 0x8AA5: 0x51A0, + 0x8AA6: 0x5BD2, + 0x8AA7: 0x520A, + 0x8AA8: 0x52D8, + 0x8AA9: 0x52E7, + 0x8AAA: 0x5DFB, + 0x8AAB: 0x559A, + 0x8AAC: 0x582A, + 0x8AAD: 0x59E6, + 0x8AAE: 0x5B8C, + 0x8AAF: 0x5B98, + 0x8AB0: 0x5BDB, + 0x8AB1: 0x5E72, + 0x8AB2: 0x5E79, + 0x8AB3: 0x60A3, + 0x8AB4: 0x611F, + 0x8AB5: 0x6163, + 0x8AB6: 0x61BE, + 0x8AB7: 0x63DB, + 0x8AB8: 0x6562, + 0x8AB9: 0x67D1, + 0x8ABA: 0x6853, + 0x8ABB: 0x68FA, + 0x8ABC: 0x6B3E, + 0x8ABD: 0x6B53, + 0x8ABE: 0x6C57, + 0x8ABF: 0x6F22, + 0x8AC0: 0x6F97, + 0x8AC1: 0x6F45, + 0x8AC2: 0x74B0, + 0x8AC3: 0x7518, + 0x8AC4: 0x76E3, + 0x8AC5: 0x770B, + 0x8AC6: 0x7AFF, + 0x8AC7: 0x7BA1, + 0x8AC8: 0x7C21, + 0x8AC9: 0x7DE9, + 0x8ACA: 0x7F36, + 0x8ACB: 0x7FF0, + 0x8ACC: 0x809D, + 0x8ACD: 0x8266, + 0x8ACE: 0x839E, + 0x8ACF: 0x89B3, + 0x8AD0: 0x8ACC, + 0x8AD1: 0x8CAB, + 0x8AD2: 0x9084, + 0x8AD3: 0x9451, + 0x8AD4: 0x9593, + 0x8AD5: 0x9591, + 0x8AD6: 0x95A2, + 0x8AD7: 0x9665, + 0x8AD8: 0x97D3, + 0x8AD9: 0x9928, + 0x8ADA: 0x8218, + 0x8ADB: 0x4E38, + 0x8ADC: 0x542B, + 0x8ADD: 0x5CB8, + 0x8ADE: 0x5DCC, + 0x8ADF: 0x73A9, + 0x8AE0: 0x764C, + 0x8AE1: 0x773C, + 0x8AE2: 0x5CA9, + 0x8AE3: 0x7FEB, + 0x8AE4: 0x8D0B, + 0x8AE5: 0x96C1, + 0x8AE6: 0x9811, + 0x8AE7: 0x9854, + 0x8AE8: 0x9858, + 0x8AE9: 0x4F01, + 0x8AEA: 0x4F0E, + 0x8AEB: 0x5371, + 0x8AEC: 0x559C, + 0x8AED: 0x5668, + 0x8AEE: 0x57FA, + 0x8AEF: 0x5947, + 0x8AF0: 0x5B09, + 0x8AF1: 0x5BC4, + 0x8AF2: 0x5C90, + 0x8AF3: 0x5E0C, + 0x8AF4: 0x5E7E, + 0x8AF5: 0x5FCC, + 0x8AF6: 0x63EE, + 0x8AF7: 0x673A, + 0x8AF8: 0x65D7, + 0x8AF9: 0x65E2, + 0x8AFA: 0x671F, + 0x8AFB: 0x68CB, + 0x8AFC: 0x68C4, + 0x8B40: 0x6A5F, + 0x8B41: 0x5E30, + 0x8B42: 0x6BC5, + 0x8B43: 0x6C17, + 0x8B44: 0x6C7D, + 0x8B45: 0x757F, + 0x8B46: 0x7948, + 0x8B47: 0x5B63, + 0x8B48: 0x7A00, + 0x8B49: 0x7D00, + 0x8B4A: 0x5FBD, + 0x8B4B: 0x898F, + 0x8B4C: 0x8A18, + 0x8B4D: 0x8CB4, + 0x8B4E: 0x8D77, + 0x8B4F: 0x8ECC, + 0x8B50: 0x8F1D, + 0x8B51: 0x98E2, + 0x8B52: 0x9A0E, + 0x8B53: 0x9B3C, + 0x8B54: 0x4E80, + 0x8B55: 0x507D, + 0x8B56: 0x5100, + 0x8B57: 0x5993, + 0x8B58: 0x5B9C, + 0x8B59: 0x622F, + 0x8B5A: 0x6280, + 0x8B5B: 0x64EC, + 0x8B5C: 0x6B3A, + 0x8B5D: 0x72A0, + 0x8B5E: 0x7591, + 0x8B5F: 0x7947, + 0x8B60: 0x7FA9, + 0x8B61: 0x87FB, + 0x8B62: 0x8ABC, + 0x8B63: 0x8B70, + 0x8B64: 0x63AC, + 0x8B65: 0x83CA, + 0x8B66: 0x97A0, + 0x8B67: 0x5409, + 0x8B68: 0x5403, + 0x8B69: 0x55AB, + 0x8B6A: 0x6854, + 0x8B6B: 0x6A58, + 0x8B6C: 0x8A70, + 0x8B6D: 0x7827, + 0x8B6E: 0x6775, + 0x8B6F: 0x9ECD, + 0x8B70: 0x5374, + 0x8B71: 0x5BA2, + 0x8B72: 0x811A, + 0x8B73: 0x8650, + 0x8B74: 0x9006, + 0x8B75: 0x4E18, + 0x8B76: 0x4E45, + 0x8B77: 0x4EC7, + 0x8B78: 0x4F11, + 0x8B79: 0x53CA, + 0x8B7A: 0x5438, + 0x8B7B: 0x5BAE, + 0x8B7C: 0x5F13, + 0x8B7D: 0x6025, + 0x8B7E: 0x6551, + 0x8B80: 0x673D, + 0x8B81: 0x6C42, + 0x8B82: 0x6C72, + 0x8B83: 0x6CE3, + 0x8B84: 0x7078, + 0x8B85: 0x7403, + 0x8B86: 0x7A76, + 0x8B87: 0x7AAE, + 0x8B88: 0x7B08, + 0x8B89: 0x7D1A, + 0x8B8A: 0x7CFE, + 0x8B8B: 0x7D66, + 0x8B8C: 0x65E7, + 0x8B8D: 0x725B, + 0x8B8E: 0x53BB, + 0x8B8F: 0x5C45, + 0x8B90: 0x5DE8, + 0x8B91: 0x62D2, + 0x8B92: 0x62E0, + 0x8B93: 0x6319, + 0x8B94: 0x6E20, + 0x8B95: 0x865A, + 0x8B96: 0x8A31, + 0x8B97: 0x8DDD, + 0x8B98: 0x92F8, + 0x8B99: 0x6F01, + 0x8B9A: 0x79A6, + 0x8B9B: 0x9B5A, + 0x8B9C: 0x4EA8, + 0x8B9D: 0x4EAB, + 0x8B9E: 0x4EAC, + 0x8B9F: 0x4F9B, + 0x8BA0: 0x4FA0, + 0x8BA1: 0x50D1, + 0x8BA2: 0x5147, + 0x8BA3: 0x7AF6, + 0x8BA4: 0x5171, + 0x8BA5: 0x51F6, + 0x8BA6: 0x5354, + 0x8BA7: 0x5321, + 0x8BA8: 0x537F, + 0x8BA9: 0x53EB, + 0x8BAA: 0x55AC, + 0x8BAB: 0x5883, + 0x8BAC: 0x5CE1, + 0x8BAD: 0x5F37, + 0x8BAE: 0x5F4A, + 0x8BAF: 0x602F, + 0x8BB0: 0x6050, + 0x8BB1: 0x606D, + 0x8BB2: 0x631F, + 0x8BB3: 0x6559, + 0x8BB4: 0x6A4B, + 0x8BB5: 0x6CC1, + 0x8BB6: 0x72C2, + 0x8BB7: 0x72ED, + 0x8BB8: 0x77EF, + 0x8BB9: 0x80F8, + 0x8BBA: 0x8105, + 0x8BBB: 0x8208, + 0x8BBC: 0x854E, + 0x8BBD: 0x90F7, + 0x8BBE: 0x93E1, + 0x8BBF: 0x97FF, + 0x8BC0: 0x9957, + 0x8BC1: 0x9A5A, + 0x8BC2: 0x4EF0, + 0x8BC3: 0x51DD, + 0x8BC4: 0x5C2D, + 0x8BC5: 0x6681, + 0x8BC6: 0x696D, + 0x8BC7: 0x5C40, + 0x8BC8: 0x66F2, + 0x8BC9: 0x6975, + 0x8BCA: 0x7389, + 0x8BCB: 0x6850, + 0x8BCC: 0x7C81, + 0x8BCD: 0x50C5, + 0x8BCE: 0x52E4, + 0x8BCF: 0x5747, + 0x8BD0: 0x5DFE, + 0x8BD1: 0x9326, + 0x8BD2: 0x65A4, + 0x8BD3: 0x6B23, + 0x8BD4: 0x6B3D, + 0x8BD5: 0x7434, + 0x8BD6: 0x7981, + 0x8BD7: 0x79BD, + 0x8BD8: 0x7B4B, + 0x8BD9: 0x7DCA, + 0x8BDA: 0x82B9, + 0x8BDB: 0x83CC, + 0x8BDC: 0x887F, + 0x8BDD: 0x895F, + 0x8BDE: 0x8B39, + 0x8BDF: 0x8FD1, + 0x8BE0: 0x91D1, + 0x8BE1: 0x541F, + 0x8BE2: 0x9280, + 0x8BE3: 0x4E5D, + 0x8BE4: 0x5036, + 0x8BE5: 0x53E5, + 0x8BE6: 0x533A, + 0x8BE7: 0x72D7, + 0x8BE8: 0x7396, + 0x8BE9: 0x77E9, + 0x8BEA: 0x82E6, + 0x8BEB: 0x8EAF, + 0x8BEC: 0x99C6, + 0x8BED: 0x99C8, + 0x8BEE: 0x99D2, + 0x8BEF: 0x5177, + 0x8BF0: 0x611A, + 0x8BF1: 0x865E, + 0x8BF2: 0x55B0, + 0x8BF3: 0x7A7A, + 0x8BF4: 0x5076, + 0x8BF5: 0x5BD3, + 0x8BF6: 0x9047, + 0x8BF7: 0x9685, + 0x8BF8: 0x4E32, + 0x8BF9: 0x6ADB, + 0x8BFA: 0x91E7, + 0x8BFB: 0x5C51, + 0x8BFC: 0x5C48, + 0x8C40: 0x6398, + 0x8C41: 0x7A9F, + 0x8C42: 0x6C93, + 0x8C43: 0x9774, + 0x8C44: 0x8F61, + 0x8C45: 0x7AAA, + 0x8C46: 0x718A, + 0x8C47: 0x9688, + 0x8C48: 0x7C82, + 0x8C49: 0x6817, + 0x8C4A: 0x7E70, + 0x8C4B: 0x6851, + 0x8C4C: 0x936C, + 0x8C4D: 0x52F2, + 0x8C4E: 0x541B, + 0x8C4F: 0x85AB, + 0x8C50: 0x8A13, + 0x8C51: 0x7FA4, + 0x8C52: 0x8ECD, + 0x8C53: 0x90E1, + 0x8C54: 0x5366, + 0x8C55: 0x8888, + 0x8C56: 0x7941, + 0x8C57: 0x4FC2, + 0x8C58: 0x50BE, + 0x8C59: 0x5211, + 0x8C5A: 0x5144, + 0x8C5B: 0x5553, + 0x8C5C: 0x572D, + 0x8C5D: 0x73EA, + 0x8C5E: 0x578B, + 0x8C5F: 0x5951, + 0x8C60: 0x5F62, + 0x8C61: 0x5F84, + 0x8C62: 0x6075, + 0x8C63: 0x6176, + 0x8C64: 0x6167, + 0x8C65: 0x61A9, + 0x8C66: 0x63B2, + 0x8C67: 0x643A, + 0x8C68: 0x656C, + 0x8C69: 0x666F, + 0x8C6A: 0x6842, + 0x8C6B: 0x6E13, + 0x8C6C: 0x7566, + 0x8C6D: 0x7A3D, + 0x8C6E: 0x7CFB, + 0x8C6F: 0x7D4C, + 0x8C70: 0x7D99, + 0x8C71: 0x7E4B, + 0x8C72: 0x7F6B, + 0x8C73: 0x830E, + 0x8C74: 0x834A, + 0x8C75: 0x86CD, + 0x8C76: 0x8A08, + 0x8C77: 0x8A63, + 0x8C78: 0x8B66, + 0x8C79: 0x8EFD, + 0x8C7A: 0x981A, + 0x8C7B: 0x9D8F, + 0x8C7C: 0x82B8, + 0x8C7D: 0x8FCE, + 0x8C7E: 0x9BE8, + 0x8C80: 0x5287, + 0x8C81: 0x621F, + 0x8C82: 0x6483, + 0x8C83: 0x6FC0, + 0x8C84: 0x9699, + 0x8C85: 0x6841, + 0x8C86: 0x5091, + 0x8C87: 0x6B20, + 0x8C88: 0x6C7A, + 0x8C89: 0x6F54, + 0x8C8A: 0x7A74, + 0x8C8B: 0x7D50, + 0x8C8C: 0x8840, + 0x8C8D: 0x8A23, + 0x8C8E: 0x6708, + 0x8C8F: 0x4EF6, + 0x8C90: 0x5039, + 0x8C91: 0x5026, + 0x8C92: 0x5065, + 0x8C93: 0x517C, + 0x8C94: 0x5238, + 0x8C95: 0x5263, + 0x8C96: 0x55A7, + 0x8C97: 0x570F, + 0x8C98: 0x5805, + 0x8C99: 0x5ACC, + 0x8C9A: 0x5EFA, + 0x8C9B: 0x61B2, + 0x8C9C: 0x61F8, + 0x8C9D: 0x62F3, + 0x8C9E: 0x6372, + 0x8C9F: 0x691C, + 0x8CA0: 0x6A29, + 0x8CA1: 0x727D, + 0x8CA2: 0x72AC, + 0x8CA3: 0x732E, + 0x8CA4: 0x7814, + 0x8CA5: 0x786F, + 0x8CA6: 0x7D79, + 0x8CA7: 0x770C, + 0x8CA8: 0x80A9, + 0x8CA9: 0x898B, + 0x8CAA: 0x8B19, + 0x8CAB: 0x8CE2, + 0x8CAC: 0x8ED2, + 0x8CAD: 0x9063, + 0x8CAE: 0x9375, + 0x8CAF: 0x967A, + 0x8CB0: 0x9855, + 0x8CB1: 0x9A13, + 0x8CB2: 0x9E78, + 0x8CB3: 0x5143, + 0x8CB4: 0x539F, + 0x8CB5: 0x53B3, + 0x8CB6: 0x5E7B, + 0x8CB7: 0x5F26, + 0x8CB8: 0x6E1B, + 0x8CB9: 0x6E90, + 0x8CBA: 0x7384, + 0x8CBB: 0x73FE, + 0x8CBC: 0x7D43, + 0x8CBD: 0x8237, + 0x8CBE: 0x8A00, + 0x8CBF: 0x8AFA, + 0x8CC0: 0x9650, + 0x8CC1: 0x4E4E, + 0x8CC2: 0x500B, + 0x8CC3: 0x53E4, + 0x8CC4: 0x547C, + 0x8CC5: 0x56FA, + 0x8CC6: 0x59D1, + 0x8CC7: 0x5B64, + 0x8CC8: 0x5DF1, + 0x8CC9: 0x5EAB, + 0x8CCA: 0x5F27, + 0x8CCB: 0x6238, + 0x8CCC: 0x6545, + 0x8CCD: 0x67AF, + 0x8CCE: 0x6E56, + 0x8CCF: 0x72D0, + 0x8CD0: 0x7CCA, + 0x8CD1: 0x88B4, + 0x8CD2: 0x80A1, + 0x8CD3: 0x80E1, + 0x8CD4: 0x83F0, + 0x8CD5: 0x864E, + 0x8CD6: 0x8A87, + 0x8CD7: 0x8DE8, + 0x8CD8: 0x9237, + 0x8CD9: 0x96C7, + 0x8CDA: 0x9867, + 0x8CDB: 0x9F13, + 0x8CDC: 0x4E94, + 0x8CDD: 0x4E92, + 0x8CDE: 0x4F0D, + 0x8CDF: 0x5348, + 0x8CE0: 0x5449, + 0x8CE1: 0x543E, + 0x8CE2: 0x5A2F, + 0x8CE3: 0x5F8C, + 0x8CE4: 0x5FA1, + 0x8CE5: 0x609F, + 0x8CE6: 0x68A7, + 0x8CE7: 0x6A8E, + 0x8CE8: 0x745A, + 0x8CE9: 0x7881, + 0x8CEA: 0x8A9E, + 0x8CEB: 0x8AA4, + 0x8CEC: 0x8B77, + 0x8CED: 0x9190, + 0x8CEE: 0x4E5E, + 0x8CEF: 0x9BC9, + 0x8CF0: 0x4EA4, + 0x8CF1: 0x4F7C, + 0x8CF2: 0x4FAF, + 0x8CF3: 0x5019, + 0x8CF4: 0x5016, + 0x8CF5: 0x5149, + 0x8CF6: 0x516C, + 0x8CF7: 0x529F, + 0x8CF8: 0x52B9, + 0x8CF9: 0x52FE, + 0x8CFA: 0x539A, + 0x8CFB: 0x53E3, + 0x8CFC: 0x5411, + 0x8D40: 0x540E, + 0x8D41: 0x5589, + 0x8D42: 0x5751, + 0x8D43: 0x57A2, + 0x8D44: 0x597D, + 0x8D45: 0x5B54, + 0x8D46: 0x5B5D, + 0x8D47: 0x5B8F, + 0x8D48: 0x5DE5, + 0x8D49: 0x5DE7, + 0x8D4A: 0x5DF7, + 0x8D4B: 0x5E78, + 0x8D4C: 0x5E83, + 0x8D4D: 0x5E9A, + 0x8D4E: 0x5EB7, + 0x8D4F: 0x5F18, + 0x8D50: 0x6052, + 0x8D51: 0x614C, + 0x8D52: 0x6297, + 0x8D53: 0x62D8, + 0x8D54: 0x63A7, + 0x8D55: 0x653B, + 0x8D56: 0x6602, + 0x8D57: 0x6643, + 0x8D58: 0x66F4, + 0x8D59: 0x676D, + 0x8D5A: 0x6821, + 0x8D5B: 0x6897, + 0x8D5C: 0x69CB, + 0x8D5D: 0x6C5F, + 0x8D5E: 0x6D2A, + 0x8D5F: 0x6D69, + 0x8D60: 0x6E2F, + 0x8D61: 0x6E9D, + 0x8D62: 0x7532, + 0x8D63: 0x7687, + 0x8D64: 0x786C, + 0x8D65: 0x7A3F, + 0x8D66: 0x7CE0, + 0x8D67: 0x7D05, + 0x8D68: 0x7D18, + 0x8D69: 0x7D5E, + 0x8D6A: 0x7DB1, + 0x8D6B: 0x8015, + 0x8D6C: 0x8003, + 0x8D6D: 0x80AF, + 0x8D6E: 0x80B1, + 0x8D6F: 0x8154, + 0x8D70: 0x818F, + 0x8D71: 0x822A, + 0x8D72: 0x8352, + 0x8D73: 0x884C, + 0x8D74: 0x8861, + 0x8D75: 0x8B1B, + 0x8D76: 0x8CA2, + 0x8D77: 0x8CFC, + 0x8D78: 0x90CA, + 0x8D79: 0x9175, + 0x8D7A: 0x9271, + 0x8D7B: 0x783F, + 0x8D7C: 0x92FC, + 0x8D7D: 0x95A4, + 0x8D7E: 0x964D, + 0x8D80: 0x9805, + 0x8D81: 0x9999, + 0x8D82: 0x9AD8, + 0x8D83: 0x9D3B, + 0x8D84: 0x525B, + 0x8D85: 0x52AB, + 0x8D86: 0x53F7, + 0x8D87: 0x5408, + 0x8D88: 0x58D5, + 0x8D89: 0x62F7, + 0x8D8A: 0x6FE0, + 0x8D8B: 0x8C6A, + 0x8D8C: 0x8F5F, + 0x8D8D: 0x9EB9, + 0x8D8E: 0x514B, + 0x8D8F: 0x523B, + 0x8D90: 0x544A, + 0x8D91: 0x56FD, + 0x8D92: 0x7A40, + 0x8D93: 0x9177, + 0x8D94: 0x9D60, + 0x8D95: 0x9ED2, + 0x8D96: 0x7344, + 0x8D97: 0x6F09, + 0x8D98: 0x8170, + 0x8D99: 0x7511, + 0x8D9A: 0x5FFD, + 0x8D9B: 0x60DA, + 0x8D9C: 0x9AA8, + 0x8D9D: 0x72DB, + 0x8D9E: 0x8FBC, + 0x8D9F: 0x6B64, + 0x8DA0: 0x9803, + 0x8DA1: 0x4ECA, + 0x8DA2: 0x56F0, + 0x8DA3: 0x5764, + 0x8DA4: 0x58BE, + 0x8DA5: 0x5A5A, + 0x8DA6: 0x6068, + 0x8DA7: 0x61C7, + 0x8DA8: 0x660F, + 0x8DA9: 0x6606, + 0x8DAA: 0x6839, + 0x8DAB: 0x68B1, + 0x8DAC: 0x6DF7, + 0x8DAD: 0x75D5, + 0x8DAE: 0x7D3A, + 0x8DAF: 0x826E, + 0x8DB0: 0x9B42, + 0x8DB1: 0x4E9B, + 0x8DB2: 0x4F50, + 0x8DB3: 0x53C9, + 0x8DB4: 0x5506, + 0x8DB5: 0x5D6F, + 0x8DB6: 0x5DE6, + 0x8DB7: 0x5DEE, + 0x8DB8: 0x67FB, + 0x8DB9: 0x6C99, + 0x8DBA: 0x7473, + 0x8DBB: 0x7802, + 0x8DBC: 0x8A50, + 0x8DBD: 0x9396, + 0x8DBE: 0x88DF, + 0x8DBF: 0x5750, + 0x8DC0: 0x5EA7, + 0x8DC1: 0x632B, + 0x8DC2: 0x50B5, + 0x8DC3: 0x50AC, + 0x8DC4: 0x518D, + 0x8DC5: 0x6700, + 0x8DC6: 0x54C9, + 0x8DC7: 0x585E, + 0x8DC8: 0x59BB, + 0x8DC9: 0x5BB0, + 0x8DCA: 0x5F69, + 0x8DCB: 0x624D, + 0x8DCC: 0x63A1, + 0x8DCD: 0x683D, + 0x8DCE: 0x6B73, + 0x8DCF: 0x6E08, + 0x8DD0: 0x707D, + 0x8DD1: 0x91C7, + 0x8DD2: 0x7280, + 0x8DD3: 0x7815, + 0x8DD4: 0x7826, + 0x8DD5: 0x796D, + 0x8DD6: 0x658E, + 0x8DD7: 0x7D30, + 0x8DD8: 0x83DC, + 0x8DD9: 0x88C1, + 0x8DDA: 0x8F09, + 0x8DDB: 0x969B, + 0x8DDC: 0x5264, + 0x8DDD: 0x5728, + 0x8DDE: 0x6750, + 0x8DDF: 0x7F6A, + 0x8DE0: 0x8CA1, + 0x8DE1: 0x51B4, + 0x8DE2: 0x5742, + 0x8DE3: 0x962A, + 0x8DE4: 0x583A, + 0x8DE5: 0x698A, + 0x8DE6: 0x80B4, + 0x8DE7: 0x54B2, + 0x8DE8: 0x5D0E, + 0x8DE9: 0x57FC, + 0x8DEA: 0x7895, + 0x8DEB: 0x9DFA, + 0x8DEC: 0x4F5C, + 0x8DED: 0x524A, + 0x8DEE: 0x548B, + 0x8DEF: 0x643E, + 0x8DF0: 0x6628, + 0x8DF1: 0x6714, + 0x8DF2: 0x67F5, + 0x8DF3: 0x7A84, + 0x8DF4: 0x7B56, + 0x8DF5: 0x7D22, + 0x8DF6: 0x932F, + 0x8DF7: 0x685C, + 0x8DF8: 0x9BAD, + 0x8DF9: 0x7B39, + 0x8DFA: 0x5319, + 0x8DFB: 0x518A, + 0x8DFC: 0x5237, + 0x8E40: 0x5BDF, + 0x8E41: 0x62F6, + 0x8E42: 0x64AE, + 0x8E43: 0x64E6, + 0x8E44: 0x672D, + 0x8E45: 0x6BBA, + 0x8E46: 0x85A9, + 0x8E47: 0x96D1, + 0x8E48: 0x7690, + 0x8E49: 0x9BD6, + 0x8E4A: 0x634C, + 0x8E4B: 0x9306, + 0x8E4C: 0x9BAB, + 0x8E4D: 0x76BF, + 0x8E4E: 0x6652, + 0x8E4F: 0x4E09, + 0x8E50: 0x5098, + 0x8E51: 0x53C2, + 0x8E52: 0x5C71, + 0x8E53: 0x60E8, + 0x8E54: 0x6492, + 0x8E55: 0x6563, + 0x8E56: 0x685F, + 0x8E57: 0x71E6, + 0x8E58: 0x73CA, + 0x8E59: 0x7523, + 0x8E5A: 0x7B97, + 0x8E5B: 0x7E82, + 0x8E5C: 0x8695, + 0x8E5D: 0x8B83, + 0x8E5E: 0x8CDB, + 0x8E5F: 0x9178, + 0x8E60: 0x9910, + 0x8E61: 0x65AC, + 0x8E62: 0x66AB, + 0x8E63: 0x6B8B, + 0x8E64: 0x4ED5, + 0x8E65: 0x4ED4, + 0x8E66: 0x4F3A, + 0x8E67: 0x4F7F, + 0x8E68: 0x523A, + 0x8E69: 0x53F8, + 0x8E6A: 0x53F2, + 0x8E6B: 0x55E3, + 0x8E6C: 0x56DB, + 0x8E6D: 0x58EB, + 0x8E6E: 0x59CB, + 0x8E6F: 0x59C9, + 0x8E70: 0x59FF, + 0x8E71: 0x5B50, + 0x8E72: 0x5C4D, + 0x8E73: 0x5E02, + 0x8E74: 0x5E2B, + 0x8E75: 0x5FD7, + 0x8E76: 0x601D, + 0x8E77: 0x6307, + 0x8E78: 0x652F, + 0x8E79: 0x5B5C, + 0x8E7A: 0x65AF, + 0x8E7B: 0x65BD, + 0x8E7C: 0x65E8, + 0x8E7D: 0x679D, + 0x8E7E: 0x6B62, + 0x8E80: 0x6B7B, + 0x8E81: 0x6C0F, + 0x8E82: 0x7345, + 0x8E83: 0x7949, + 0x8E84: 0x79C1, + 0x8E85: 0x7CF8, + 0x8E86: 0x7D19, + 0x8E87: 0x7D2B, + 0x8E88: 0x80A2, + 0x8E89: 0x8102, + 0x8E8A: 0x81F3, + 0x8E8B: 0x8996, + 0x8E8C: 0x8A5E, + 0x8E8D: 0x8A69, + 0x8E8E: 0x8A66, + 0x8E8F: 0x8A8C, + 0x8E90: 0x8AEE, + 0x8E91: 0x8CC7, + 0x8E92: 0x8CDC, + 0x8E93: 0x96CC, + 0x8E94: 0x98FC, + 0x8E95: 0x6B6F, + 0x8E96: 0x4E8B, + 0x8E97: 0x4F3C, + 0x8E98: 0x4F8D, + 0x8E99: 0x5150, + 0x8E9A: 0x5B57, + 0x8E9B: 0x5BFA, + 0x8E9C: 0x6148, + 0x8E9D: 0x6301, + 0x8E9E: 0x6642, + 0x8E9F: 0x6B21, + 0x8EA0: 0x6ECB, + 0x8EA1: 0x6CBB, + 0x8EA2: 0x723E, + 0x8EA3: 0x74BD, + 0x8EA4: 0x75D4, + 0x8EA5: 0x78C1, + 0x8EA6: 0x793A, + 0x8EA7: 0x800C, + 0x8EA8: 0x8033, + 0x8EA9: 0x81EA, + 0x8EAA: 0x8494, + 0x8EAB: 0x8F9E, + 0x8EAC: 0x6C50, + 0x8EAD: 0x9E7F, + 0x8EAE: 0x5F0F, + 0x8EAF: 0x8B58, + 0x8EB0: 0x9D2B, + 0x8EB1: 0x7AFA, + 0x8EB2: 0x8EF8, + 0x8EB3: 0x5B8D, + 0x8EB4: 0x96EB, + 0x8EB5: 0x4E03, + 0x8EB6: 0x53F1, + 0x8EB7: 0x57F7, + 0x8EB8: 0x5931, + 0x8EB9: 0x5AC9, + 0x8EBA: 0x5BA4, + 0x8EBB: 0x6089, + 0x8EBC: 0x6E7F, + 0x8EBD: 0x6F06, + 0x8EBE: 0x75BE, + 0x8EBF: 0x8CEA, + 0x8EC0: 0x5B9F, + 0x8EC1: 0x8500, + 0x8EC2: 0x7BE0, + 0x8EC3: 0x5072, + 0x8EC4: 0x67F4, + 0x8EC5: 0x829D, + 0x8EC6: 0x5C61, + 0x8EC7: 0x854A, + 0x8EC8: 0x7E1E, + 0x8EC9: 0x820E, + 0x8ECA: 0x5199, + 0x8ECB: 0x5C04, + 0x8ECC: 0x6368, + 0x8ECD: 0x8D66, + 0x8ECE: 0x659C, + 0x8ECF: 0x716E, + 0x8ED0: 0x793E, + 0x8ED1: 0x7D17, + 0x8ED2: 0x8005, + 0x8ED3: 0x8B1D, + 0x8ED4: 0x8ECA, + 0x8ED5: 0x906E, + 0x8ED6: 0x86C7, + 0x8ED7: 0x90AA, + 0x8ED8: 0x501F, + 0x8ED9: 0x52FA, + 0x8EDA: 0x5C3A, + 0x8EDB: 0x6753, + 0x8EDC: 0x707C, + 0x8EDD: 0x7235, + 0x8EDE: 0x914C, + 0x8EDF: 0x91C8, + 0x8EE0: 0x932B, + 0x8EE1: 0x82E5, + 0x8EE2: 0x5BC2, + 0x8EE3: 0x5F31, + 0x8EE4: 0x60F9, + 0x8EE5: 0x4E3B, + 0x8EE6: 0x53D6, + 0x8EE7: 0x5B88, + 0x8EE8: 0x624B, + 0x8EE9: 0x6731, + 0x8EEA: 0x6B8A, + 0x8EEB: 0x72E9, + 0x8EEC: 0x73E0, + 0x8EED: 0x7A2E, + 0x8EEE: 0x816B, + 0x8EEF: 0x8DA3, + 0x8EF0: 0x9152, + 0x8EF1: 0x9996, + 0x8EF2: 0x5112, + 0x8EF3: 0x53D7, + 0x8EF4: 0x546A, + 0x8EF5: 0x5BFF, + 0x8EF6: 0x6388, + 0x8EF7: 0x6A39, + 0x8EF8: 0x7DAC, + 0x8EF9: 0x9700, + 0x8EFA: 0x56DA, + 0x8EFB: 0x53CE, + 0x8EFC: 0x5468, + 0x8F40: 0x5B97, + 0x8F41: 0x5C31, + 0x8F42: 0x5DDE, + 0x8F43: 0x4FEE, + 0x8F44: 0x6101, + 0x8F45: 0x62FE, + 0x8F46: 0x6D32, + 0x8F47: 0x79C0, + 0x8F48: 0x79CB, + 0x8F49: 0x7D42, + 0x8F4A: 0x7E4D, + 0x8F4B: 0x7FD2, + 0x8F4C: 0x81ED, + 0x8F4D: 0x821F, + 0x8F4E: 0x8490, + 0x8F4F: 0x8846, + 0x8F50: 0x8972, + 0x8F51: 0x8B90, + 0x8F52: 0x8E74, + 0x8F53: 0x8F2F, + 0x8F54: 0x9031, + 0x8F55: 0x914B, + 0x8F56: 0x916C, + 0x8F57: 0x96C6, + 0x8F58: 0x919C, + 0x8F59: 0x4EC0, + 0x8F5A: 0x4F4F, + 0x8F5B: 0x5145, + 0x8F5C: 0x5341, + 0x8F5D: 0x5F93, + 0x8F5E: 0x620E, + 0x8F5F: 0x67D4, + 0x8F60: 0x6C41, + 0x8F61: 0x6E0B, + 0x8F62: 0x7363, + 0x8F63: 0x7E26, + 0x8F64: 0x91CD, + 0x8F65: 0x9283, + 0x8F66: 0x53D4, + 0x8F67: 0x5919, + 0x8F68: 0x5BBF, + 0x8F69: 0x6DD1, + 0x8F6A: 0x795D, + 0x8F6B: 0x7E2E, + 0x8F6C: 0x7C9B, + 0x8F6D: 0x587E, + 0x8F6E: 0x719F, + 0x8F6F: 0x51FA, + 0x8F70: 0x8853, + 0x8F71: 0x8FF0, + 0x8F72: 0x4FCA, + 0x8F73: 0x5CFB, + 0x8F74: 0x6625, + 0x8F75: 0x77AC, + 0x8F76: 0x7AE3, + 0x8F77: 0x821C, + 0x8F78: 0x99FF, + 0x8F79: 0x51C6, + 0x8F7A: 0x5FAA, + 0x8F7B: 0x65EC, + 0x8F7C: 0x696F, + 0x8F7D: 0x6B89, + 0x8F7E: 0x6DF3, + 0x8F80: 0x6E96, + 0x8F81: 0x6F64, + 0x8F82: 0x76FE, + 0x8F83: 0x7D14, + 0x8F84: 0x5DE1, + 0x8F85: 0x9075, + 0x8F86: 0x9187, + 0x8F87: 0x9806, + 0x8F88: 0x51E6, + 0x8F89: 0x521D, + 0x8F8A: 0x6240, + 0x8F8B: 0x6691, + 0x8F8C: 0x66D9, + 0x8F8D: 0x6E1A, + 0x8F8E: 0x5EB6, + 0x8F8F: 0x7DD2, + 0x8F90: 0x7F72, + 0x8F91: 0x66F8, + 0x8F92: 0x85AF, + 0x8F93: 0x85F7, + 0x8F94: 0x8AF8, + 0x8F95: 0x52A9, + 0x8F96: 0x53D9, + 0x8F97: 0x5973, + 0x8F98: 0x5E8F, + 0x8F99: 0x5F90, + 0x8F9A: 0x6055, + 0x8F9B: 0x92E4, + 0x8F9C: 0x9664, + 0x8F9D: 0x50B7, + 0x8F9E: 0x511F, + 0x8F9F: 0x52DD, + 0x8FA0: 0x5320, + 0x8FA1: 0x5347, + 0x8FA2: 0x53EC, + 0x8FA3: 0x54E8, + 0x8FA4: 0x5546, + 0x8FA5: 0x5531, + 0x8FA6: 0x5617, + 0x8FA7: 0x5968, + 0x8FA8: 0x59BE, + 0x8FA9: 0x5A3C, + 0x8FAA: 0x5BB5, + 0x8FAB: 0x5C06, + 0x8FAC: 0x5C0F, + 0x8FAD: 0x5C11, + 0x8FAE: 0x5C1A, + 0x8FAF: 0x5E84, + 0x8FB0: 0x5E8A, + 0x8FB1: 0x5EE0, + 0x8FB2: 0x5F70, + 0x8FB3: 0x627F, + 0x8FB4: 0x6284, + 0x8FB5: 0x62DB, + 0x8FB6: 0x638C, + 0x8FB7: 0x6377, + 0x8FB8: 0x6607, + 0x8FB9: 0x660C, + 0x8FBA: 0x662D, + 0x8FBB: 0x6676, + 0x8FBC: 0x677E, + 0x8FBD: 0x68A2, + 0x8FBE: 0x6A1F, + 0x8FBF: 0x6A35, + 0x8FC0: 0x6CBC, + 0x8FC1: 0x6D88, + 0x8FC2: 0x6E09, + 0x8FC3: 0x6E58, + 0x8FC4: 0x713C, + 0x8FC5: 0x7126, + 0x8FC6: 0x7167, + 0x8FC7: 0x75C7, + 0x8FC8: 0x7701, + 0x8FC9: 0x785D, + 0x8FCA: 0x7901, + 0x8FCB: 0x7965, + 0x8FCC: 0x79F0, + 0x8FCD: 0x7AE0, + 0x8FCE: 0x7B11, + 0x8FCF: 0x7CA7, + 0x8FD0: 0x7D39, + 0x8FD1: 0x8096, + 0x8FD2: 0x83D6, + 0x8FD3: 0x848B, + 0x8FD4: 0x8549, + 0x8FD5: 0x885D, + 0x8FD6: 0x88F3, + 0x8FD7: 0x8A1F, + 0x8FD8: 0x8A3C, + 0x8FD9: 0x8A54, + 0x8FDA: 0x8A73, + 0x8FDB: 0x8C61, + 0x8FDC: 0x8CDE, + 0x8FDD: 0x91A4, + 0x8FDE: 0x9266, + 0x8FDF: 0x937E, + 0x8FE0: 0x9418, + 0x8FE1: 0x969C, + 0x8FE2: 0x9798, + 0x8FE3: 0x4E0A, + 0x8FE4: 0x4E08, + 0x8FE5: 0x4E1E, + 0x8FE6: 0x4E57, + 0x8FE7: 0x5197, + 0x8FE8: 0x5270, + 0x8FE9: 0x57CE, + 0x8FEA: 0x5834, + 0x8FEB: 0x58CC, + 0x8FEC: 0x5B22, + 0x8FED: 0x5E38, + 0x8FEE: 0x60C5, + 0x8FEF: 0x64FE, + 0x8FF0: 0x6761, + 0x8FF1: 0x6756, + 0x8FF2: 0x6D44, + 0x8FF3: 0x72B6, + 0x8FF4: 0x7573, + 0x8FF5: 0x7A63, + 0x8FF6: 0x84B8, + 0x8FF7: 0x8B72, + 0x8FF8: 0x91B8, + 0x8FF9: 0x9320, + 0x8FFA: 0x5631, + 0x8FFB: 0x57F4, + 0x8FFC: 0x98FE, + 0x9040: 0x62ED, + 0x9041: 0x690D, + 0x9042: 0x6B96, + 0x9043: 0x71ED, + 0x9044: 0x7E54, + 0x9045: 0x8077, + 0x9046: 0x8272, + 0x9047: 0x89E6, + 0x9048: 0x98DF, + 0x9049: 0x8755, + 0x904A: 0x8FB1, + 0x904B: 0x5C3B, + 0x904C: 0x4F38, + 0x904D: 0x4FE1, + 0x904E: 0x4FB5, + 0x904F: 0x5507, + 0x9050: 0x5A20, + 0x9051: 0x5BDD, + 0x9052: 0x5BE9, + 0x9053: 0x5FC3, + 0x9054: 0x614E, + 0x9055: 0x632F, + 0x9056: 0x65B0, + 0x9057: 0x664B, + 0x9058: 0x68EE, + 0x9059: 0x699B, + 0x905A: 0x6D78, + 0x905B: 0x6DF1, + 0x905C: 0x7533, + 0x905D: 0x75B9, + 0x905E: 0x771F, + 0x905F: 0x795E, + 0x9060: 0x79E6, + 0x9061: 0x7D33, + 0x9062: 0x81E3, + 0x9063: 0x82AF, + 0x9064: 0x85AA, + 0x9065: 0x89AA, + 0x9066: 0x8A3A, + 0x9067: 0x8EAB, + 0x9068: 0x8F9B, + 0x9069: 0x9032, + 0x906A: 0x91DD, + 0x906B: 0x9707, + 0x906C: 0x4EBA, + 0x906D: 0x4EC1, + 0x906E: 0x5203, + 0x906F: 0x5875, + 0x9070: 0x58EC, + 0x9071: 0x5C0B, + 0x9072: 0x751A, + 0x9073: 0x5C3D, + 0x9074: 0x814E, + 0x9075: 0x8A0A, + 0x9076: 0x8FC5, + 0x9077: 0x9663, + 0x9078: 0x976D, + 0x9079: 0x7B25, + 0x907A: 0x8ACF, + 0x907B: 0x9808, + 0x907C: 0x9162, + 0x907D: 0x56F3, + 0x907E: 0x53A8, + 0x9080: 0x9017, + 0x9081: 0x5439, + 0x9082: 0x5782, + 0x9083: 0x5E25, + 0x9084: 0x63A8, + 0x9085: 0x6C34, + 0x9086: 0x708A, + 0x9087: 0x7761, + 0x9088: 0x7C8B, + 0x9089: 0x7FE0, + 0x908A: 0x8870, + 0x908B: 0x9042, + 0x908C: 0x9154, + 0x908D: 0x9310, + 0x908E: 0x9318, + 0x908F: 0x968F, + 0x9090: 0x745E, + 0x9091: 0x9AC4, + 0x9092: 0x5D07, + 0x9093: 0x5D69, + 0x9094: 0x6570, + 0x9095: 0x67A2, + 0x9096: 0x8DA8, + 0x9097: 0x96DB, + 0x9098: 0x636E, + 0x9099: 0x6749, + 0x909A: 0x6919, + 0x909B: 0x83C5, + 0x909C: 0x9817, + 0x909D: 0x96C0, + 0x909E: 0x88FE, + 0x909F: 0x6F84, + 0x90A0: 0x647A, + 0x90A1: 0x5BF8, + 0x90A2: 0x4E16, + 0x90A3: 0x702C, + 0x90A4: 0x755D, + 0x90A5: 0x662F, + 0x90A6: 0x51C4, + 0x90A7: 0x5236, + 0x90A8: 0x52E2, + 0x90A9: 0x59D3, + 0x90AA: 0x5F81, + 0x90AB: 0x6027, + 0x90AC: 0x6210, + 0x90AD: 0x653F, + 0x90AE: 0x6574, + 0x90AF: 0x661F, + 0x90B0: 0x6674, + 0x90B1: 0x68F2, + 0x90B2: 0x6816, + 0x90B3: 0x6B63, + 0x90B4: 0x6E05, + 0x90B5: 0x7272, + 0x90B6: 0x751F, + 0x90B7: 0x76DB, + 0x90B8: 0x7CBE, + 0x90B9: 0x8056, + 0x90BA: 0x58F0, + 0x90BB: 0x88FD, + 0x90BC: 0x897F, + 0x90BD: 0x8AA0, + 0x90BE: 0x8A93, + 0x90BF: 0x8ACB, + 0x90C0: 0x901D, + 0x90C1: 0x9192, + 0x90C2: 0x9752, + 0x90C3: 0x9759, + 0x90C4: 0x6589, + 0x90C5: 0x7A0E, + 0x90C6: 0x8106, + 0x90C7: 0x96BB, + 0x90C8: 0x5E2D, + 0x90C9: 0x60DC, + 0x90CA: 0x621A, + 0x90CB: 0x65A5, + 0x90CC: 0x6614, + 0x90CD: 0x6790, + 0x90CE: 0x77F3, + 0x90CF: 0x7A4D, + 0x90D0: 0x7C4D, + 0x90D1: 0x7E3E, + 0x90D2: 0x810A, + 0x90D3: 0x8CAC, + 0x90D4: 0x8D64, + 0x90D5: 0x8DE1, + 0x90D6: 0x8E5F, + 0x90D7: 0x78A9, + 0x90D8: 0x5207, + 0x90D9: 0x62D9, + 0x90DA: 0x63A5, + 0x90DB: 0x6442, + 0x90DC: 0x6298, + 0x90DD: 0x8A2D, + 0x90DE: 0x7A83, + 0x90DF: 0x7BC0, + 0x90E0: 0x8AAC, + 0x90E1: 0x96EA, + 0x90E2: 0x7D76, + 0x90E3: 0x820C, + 0x90E4: 0x8749, + 0x90E5: 0x4ED9, + 0x90E6: 0x5148, + 0x90E7: 0x5343, + 0x90E8: 0x5360, + 0x90E9: 0x5BA3, + 0x90EA: 0x5C02, + 0x90EB: 0x5C16, + 0x90EC: 0x5DDD, + 0x90ED: 0x6226, + 0x90EE: 0x6247, + 0x90EF: 0x64B0, + 0x90F0: 0x6813, + 0x90F1: 0x6834, + 0x90F2: 0x6CC9, + 0x90F3: 0x6D45, + 0x90F4: 0x6D17, + 0x90F5: 0x67D3, + 0x90F6: 0x6F5C, + 0x90F7: 0x714E, + 0x90F8: 0x717D, + 0x90F9: 0x65CB, + 0x90FA: 0x7A7F, + 0x90FB: 0x7BAD, + 0x90FC: 0x7DDA, + 0x9140: 0x7E4A, + 0x9141: 0x7FA8, + 0x9142: 0x817A, + 0x9143: 0x821B, + 0x9144: 0x8239, + 0x9145: 0x85A6, + 0x9146: 0x8A6E, + 0x9147: 0x8CCE, + 0x9148: 0x8DF5, + 0x9149: 0x9078, + 0x914A: 0x9077, + 0x914B: 0x92AD, + 0x914C: 0x9291, + 0x914D: 0x9583, + 0x914E: 0x9BAE, + 0x914F: 0x524D, + 0x9150: 0x5584, + 0x9151: 0x6F38, + 0x9152: 0x7136, + 0x9153: 0x5168, + 0x9154: 0x7985, + 0x9155: 0x7E55, + 0x9156: 0x81B3, + 0x9157: 0x7CCE, + 0x9158: 0x564C, + 0x9159: 0x5851, + 0x915A: 0x5CA8, + 0x915B: 0x63AA, + 0x915C: 0x66FE, + 0x915D: 0x66FD, + 0x915E: 0x695A, + 0x915F: 0x72D9, + 0x9160: 0x758F, + 0x9161: 0x758E, + 0x9162: 0x790E, + 0x9163: 0x7956, + 0x9164: 0x79DF, + 0x9165: 0x7C97, + 0x9166: 0x7D20, + 0x9167: 0x7D44, + 0x9168: 0x8607, + 0x9169: 0x8A34, + 0x916A: 0x963B, + 0x916B: 0x9061, + 0x916C: 0x9F20, + 0x916D: 0x50E7, + 0x916E: 0x5275, + 0x916F: 0x53CC, + 0x9170: 0x53E2, + 0x9171: 0x5009, + 0x9172: 0x55AA, + 0x9173: 0x58EE, + 0x9174: 0x594F, + 0x9175: 0x723D, + 0x9176: 0x5B8B, + 0x9177: 0x5C64, + 0x9178: 0x531D, + 0x9179: 0x60E3, + 0x917A: 0x60F3, + 0x917B: 0x635C, + 0x917C: 0x6383, + 0x917D: 0x633F, + 0x917E: 0x63BB, + 0x9180: 0x64CD, + 0x9181: 0x65E9, + 0x9182: 0x66F9, + 0x9183: 0x5DE3, + 0x9184: 0x69CD, + 0x9185: 0x69FD, + 0x9186: 0x6F15, + 0x9187: 0x71E5, + 0x9188: 0x4E89, + 0x9189: 0x75E9, + 0x918A: 0x76F8, + 0x918B: 0x7A93, + 0x918C: 0x7CDF, + 0x918D: 0x7DCF, + 0x918E: 0x7D9C, + 0x918F: 0x8061, + 0x9190: 0x8349, + 0x9191: 0x8358, + 0x9192: 0x846C, + 0x9193: 0x84BC, + 0x9194: 0x85FB, + 0x9195: 0x88C5, + 0x9196: 0x8D70, + 0x9197: 0x9001, + 0x9198: 0x906D, + 0x9199: 0x9397, + 0x919A: 0x971C, + 0x919B: 0x9A12, + 0x919C: 0x50CF, + 0x919D: 0x5897, + 0x919E: 0x618E, + 0x919F: 0x81D3, + 0x91A0: 0x8535, + 0x91A1: 0x8D08, + 0x91A2: 0x9020, + 0x91A3: 0x4FC3, + 0x91A4: 0x5074, + 0x91A5: 0x5247, + 0x91A6: 0x5373, + 0x91A7: 0x606F, + 0x91A8: 0x6349, + 0x91A9: 0x675F, + 0x91AA: 0x6E2C, + 0x91AB: 0x8DB3, + 0x91AC: 0x901F, + 0x91AD: 0x4FD7, + 0x91AE: 0x5C5E, + 0x91AF: 0x8CCA, + 0x91B0: 0x65CF, + 0x91B1: 0x7D9A, + 0x91B2: 0x5352, + 0x91B3: 0x8896, + 0x91B4: 0x5176, + 0x91B5: 0x63C3, + 0x91B6: 0x5B58, + 0x91B7: 0x5B6B, + 0x91B8: 0x5C0A, + 0x91B9: 0x640D, + 0x91BA: 0x6751, + 0x91BB: 0x905C, + 0x91BC: 0x4ED6, + 0x91BD: 0x591A, + 0x91BE: 0x592A, + 0x91BF: 0x6C70, + 0x91C0: 0x8A51, + 0x91C1: 0x553E, + 0x91C2: 0x5815, + 0x91C3: 0x59A5, + 0x91C4: 0x60F0, + 0x91C5: 0x6253, + 0x91C6: 0x67C1, + 0x91C7: 0x8235, + 0x91C8: 0x6955, + 0x91C9: 0x9640, + 0x91CA: 0x99C4, + 0x91CB: 0x9A28, + 0x91CC: 0x4F53, + 0x91CD: 0x5806, + 0x91CE: 0x5BFE, + 0x91CF: 0x8010, + 0x91D0: 0x5CB1, + 0x91D1: 0x5E2F, + 0x91D2: 0x5F85, + 0x91D3: 0x6020, + 0x91D4: 0x614B, + 0x91D5: 0x6234, + 0x91D6: 0x66FF, + 0x91D7: 0x6CF0, + 0x91D8: 0x6EDE, + 0x91D9: 0x80CE, + 0x91DA: 0x817F, + 0x91DB: 0x82D4, + 0x91DC: 0x888B, + 0x91DD: 0x8CB8, + 0x91DE: 0x9000, + 0x91DF: 0x902E, + 0x91E0: 0x968A, + 0x91E1: 0x9EDB, + 0x91E2: 0x9BDB, + 0x91E3: 0x4EE3, + 0x91E4: 0x53F0, + 0x91E5: 0x5927, + 0x91E6: 0x7B2C, + 0x91E7: 0x918D, + 0x91E8: 0x984C, + 0x91E9: 0x9DF9, + 0x91EA: 0x6EDD, + 0x91EB: 0x7027, + 0x91EC: 0x5353, + 0x91ED: 0x5544, + 0x91EE: 0x5B85, + 0x91EF: 0x6258, + 0x91F0: 0x629E, + 0x91F1: 0x62D3, + 0x91F2: 0x6CA2, + 0x91F3: 0x6FEF, + 0x91F4: 0x7422, + 0x91F5: 0x8A17, + 0x91F6: 0x9438, + 0x91F7: 0x6FC1, + 0x91F8: 0x8AFE, + 0x91F9: 0x8338, + 0x91FA: 0x51E7, + 0x91FB: 0x86F8, + 0x91FC: 0x53EA, + 0x9240: 0x53E9, + 0x9241: 0x4F46, + 0x9242: 0x9054, + 0x9243: 0x8FB0, + 0x9244: 0x596A, + 0x9245: 0x8131, + 0x9246: 0x5DFD, + 0x9247: 0x7AEA, + 0x9248: 0x8FBF, + 0x9249: 0x68DA, + 0x924A: 0x8C37, + 0x924B: 0x72F8, + 0x924C: 0x9C48, + 0x924D: 0x6A3D, + 0x924E: 0x8AB0, + 0x924F: 0x4E39, + 0x9250: 0x5358, + 0x9251: 0x5606, + 0x9252: 0x5766, + 0x9253: 0x62C5, + 0x9254: 0x63A2, + 0x9255: 0x65E6, + 0x9256: 0x6B4E, + 0x9257: 0x6DE1, + 0x9258: 0x6E5B, + 0x9259: 0x70AD, + 0x925A: 0x77ED, + 0x925B: 0x7AEF, + 0x925C: 0x7BAA, + 0x925D: 0x7DBB, + 0x925E: 0x803D, + 0x925F: 0x80C6, + 0x9260: 0x86CB, + 0x9261: 0x8A95, + 0x9262: 0x935B, + 0x9263: 0x56E3, + 0x9264: 0x58C7, + 0x9265: 0x5F3E, + 0x9266: 0x65AD, + 0x9267: 0x6696, + 0x9268: 0x6A80, + 0x9269: 0x6BB5, + 0x926A: 0x7537, + 0x926B: 0x8AC7, + 0x926C: 0x5024, + 0x926D: 0x77E5, + 0x926E: 0x5730, + 0x926F: 0x5F1B, + 0x9270: 0x6065, + 0x9271: 0x667A, + 0x9272: 0x6C60, + 0x9273: 0x75F4, + 0x9274: 0x7A1A, + 0x9275: 0x7F6E, + 0x9276: 0x81F4, + 0x9277: 0x8718, + 0x9278: 0x9045, + 0x9279: 0x99B3, + 0x927A: 0x7BC9, + 0x927B: 0x755C, + 0x927C: 0x7AF9, + 0x927D: 0x7B51, + 0x927E: 0x84C4, + 0x9280: 0x9010, + 0x9281: 0x79E9, + 0x9282: 0x7A92, + 0x9283: 0x8336, + 0x9284: 0x5AE1, + 0x9285: 0x7740, + 0x9286: 0x4E2D, + 0x9287: 0x4EF2, + 0x9288: 0x5B99, + 0x9289: 0x5FE0, + 0x928A: 0x62BD, + 0x928B: 0x663C, + 0x928C: 0x67F1, + 0x928D: 0x6CE8, + 0x928E: 0x866B, + 0x928F: 0x8877, + 0x9290: 0x8A3B, + 0x9291: 0x914E, + 0x9292: 0x92F3, + 0x9293: 0x99D0, + 0x9294: 0x6A17, + 0x9295: 0x7026, + 0x9296: 0x732A, + 0x9297: 0x82E7, + 0x9298: 0x8457, + 0x9299: 0x8CAF, + 0x929A: 0x4E01, + 0x929B: 0x5146, + 0x929C: 0x51CB, + 0x929D: 0x558B, + 0x929E: 0x5BF5, + 0x929F: 0x5E16, + 0x92A0: 0x5E33, + 0x92A1: 0x5E81, + 0x92A2: 0x5F14, + 0x92A3: 0x5F35, + 0x92A4: 0x5F6B, + 0x92A5: 0x5FB4, + 0x92A6: 0x61F2, + 0x92A7: 0x6311, + 0x92A8: 0x66A2, + 0x92A9: 0x671D, + 0x92AA: 0x6F6E, + 0x92AB: 0x7252, + 0x92AC: 0x753A, + 0x92AD: 0x773A, + 0x92AE: 0x8074, + 0x92AF: 0x8139, + 0x92B0: 0x8178, + 0x92B1: 0x8776, + 0x92B2: 0x8ABF, + 0x92B3: 0x8ADC, + 0x92B4: 0x8D85, + 0x92B5: 0x8DF3, + 0x92B6: 0x929A, + 0x92B7: 0x9577, + 0x92B8: 0x9802, + 0x92B9: 0x9CE5, + 0x92BA: 0x52C5, + 0x92BB: 0x6357, + 0x92BC: 0x76F4, + 0x92BD: 0x6715, + 0x92BE: 0x6C88, + 0x92BF: 0x73CD, + 0x92C0: 0x8CC3, + 0x92C1: 0x93AE, + 0x92C2: 0x9673, + 0x92C3: 0x6D25, + 0x92C4: 0x589C, + 0x92C5: 0x690E, + 0x92C6: 0x69CC, + 0x92C7: 0x8FFD, + 0x92C8: 0x939A, + 0x92C9: 0x75DB, + 0x92CA: 0x901A, + 0x92CB: 0x585A, + 0x92CC: 0x6802, + 0x92CD: 0x63B4, + 0x92CE: 0x69FB, + 0x92CF: 0x4F43, + 0x92D0: 0x6F2C, + 0x92D1: 0x67D8, + 0x92D2: 0x8FBB, + 0x92D3: 0x8526, + 0x92D4: 0x7DB4, + 0x92D5: 0x9354, + 0x92D6: 0x693F, + 0x92D7: 0x6F70, + 0x92D8: 0x576A, + 0x92D9: 0x58F7, + 0x92DA: 0x5B2C, + 0x92DB: 0x7D2C, + 0x92DC: 0x722A, + 0x92DD: 0x540A, + 0x92DE: 0x91E3, + 0x92DF: 0x9DB4, + 0x92E0: 0x4EAD, + 0x92E1: 0x4F4E, + 0x92E2: 0x505C, + 0x92E3: 0x5075, + 0x92E4: 0x5243, + 0x92E5: 0x8C9E, + 0x92E6: 0x5448, + 0x92E7: 0x5824, + 0x92E8: 0x5B9A, + 0x92E9: 0x5E1D, + 0x92EA: 0x5E95, + 0x92EB: 0x5EAD, + 0x92EC: 0x5EF7, + 0x92ED: 0x5F1F, + 0x92EE: 0x608C, + 0x92EF: 0x62B5, + 0x92F0: 0x633A, + 0x92F1: 0x63D0, + 0x92F2: 0x68AF, + 0x92F3: 0x6C40, + 0x92F4: 0x7887, + 0x92F5: 0x798E, + 0x92F6: 0x7A0B, + 0x92F7: 0x7DE0, + 0x92F8: 0x8247, + 0x92F9: 0x8A02, + 0x92FA: 0x8AE6, + 0x92FB: 0x8E44, + 0x92FC: 0x9013, + 0x9340: 0x90B8, + 0x9341: 0x912D, + 0x9342: 0x91D8, + 0x9343: 0x9F0E, + 0x9344: 0x6CE5, + 0x9345: 0x6458, + 0x9346: 0x64E2, + 0x9347: 0x6575, + 0x9348: 0x6EF4, + 0x9349: 0x7684, + 0x934A: 0x7B1B, + 0x934B: 0x9069, + 0x934C: 0x93D1, + 0x934D: 0x6EBA, + 0x934E: 0x54F2, + 0x934F: 0x5FB9, + 0x9350: 0x64A4, + 0x9351: 0x8F4D, + 0x9352: 0x8FED, + 0x9353: 0x9244, + 0x9354: 0x5178, + 0x9355: 0x586B, + 0x9356: 0x5929, + 0x9357: 0x5C55, + 0x9358: 0x5E97, + 0x9359: 0x6DFB, + 0x935A: 0x7E8F, + 0x935B: 0x751C, + 0x935C: 0x8CBC, + 0x935D: 0x8EE2, + 0x935E: 0x985B, + 0x935F: 0x70B9, + 0x9360: 0x4F1D, + 0x9361: 0x6BBF, + 0x9362: 0x6FB1, + 0x9363: 0x7530, + 0x9364: 0x96FB, + 0x9365: 0x514E, + 0x9366: 0x5410, + 0x9367: 0x5835, + 0x9368: 0x5857, + 0x9369: 0x59AC, + 0x936A: 0x5C60, + 0x936B: 0x5F92, + 0x936C: 0x6597, + 0x936D: 0x675C, + 0x936E: 0x6E21, + 0x936F: 0x767B, + 0x9370: 0x83DF, + 0x9371: 0x8CED, + 0x9372: 0x9014, + 0x9373: 0x90FD, + 0x9374: 0x934D, + 0x9375: 0x7825, + 0x9376: 0x783A, + 0x9377: 0x52AA, + 0x9378: 0x5EA6, + 0x9379: 0x571F, + 0x937A: 0x5974, + 0x937B: 0x6012, + 0x937C: 0x5012, + 0x937D: 0x515A, + 0x937E: 0x51AC, + 0x9380: 0x51CD, + 0x9381: 0x5200, + 0x9382: 0x5510, + 0x9383: 0x5854, + 0x9384: 0x5858, + 0x9385: 0x5957, + 0x9386: 0x5B95, + 0x9387: 0x5CF6, + 0x9388: 0x5D8B, + 0x9389: 0x60BC, + 0x938A: 0x6295, + 0x938B: 0x642D, + 0x938C: 0x6771, + 0x938D: 0x6843, + 0x938E: 0x68BC, + 0x938F: 0x68DF, + 0x9390: 0x76D7, + 0x9391: 0x6DD8, + 0x9392: 0x6E6F, + 0x9393: 0x6D9B, + 0x9394: 0x706F, + 0x9395: 0x71C8, + 0x9396: 0x5F53, + 0x9397: 0x75D8, + 0x9398: 0x7977, + 0x9399: 0x7B49, + 0x939A: 0x7B54, + 0x939B: 0x7B52, + 0x939C: 0x7CD6, + 0x939D: 0x7D71, + 0x939E: 0x5230, + 0x939F: 0x8463, + 0x93A0: 0x8569, + 0x93A1: 0x85E4, + 0x93A2: 0x8A0E, + 0x93A3: 0x8B04, + 0x93A4: 0x8C46, + 0x93A5: 0x8E0F, + 0x93A6: 0x9003, + 0x93A7: 0x900F, + 0x93A8: 0x9419, + 0x93A9: 0x9676, + 0x93AA: 0x982D, + 0x93AB: 0x9A30, + 0x93AC: 0x95D8, + 0x93AD: 0x50CD, + 0x93AE: 0x52D5, + 0x93AF: 0x540C, + 0x93B0: 0x5802, + 0x93B1: 0x5C0E, + 0x93B2: 0x61A7, + 0x93B3: 0x649E, + 0x93B4: 0x6D1E, + 0x93B5: 0x77B3, + 0x93B6: 0x7AE5, + 0x93B7: 0x80F4, + 0x93B8: 0x8404, + 0x93B9: 0x9053, + 0x93BA: 0x9285, + 0x93BB: 0x5CE0, + 0x93BC: 0x9D07, + 0x93BD: 0x533F, + 0x93BE: 0x5F97, + 0x93BF: 0x5FB3, + 0x93C0: 0x6D9C, + 0x93C1: 0x7279, + 0x93C2: 0x7763, + 0x93C3: 0x79BF, + 0x93C4: 0x7BE4, + 0x93C5: 0x6BD2, + 0x93C6: 0x72EC, + 0x93C7: 0x8AAD, + 0x93C8: 0x6803, + 0x93C9: 0x6A61, + 0x93CA: 0x51F8, + 0x93CB: 0x7A81, + 0x93CC: 0x6934, + 0x93CD: 0x5C4A, + 0x93CE: 0x9CF6, + 0x93CF: 0x82EB, + 0x93D0: 0x5BC5, + 0x93D1: 0x9149, + 0x93D2: 0x701E, + 0x93D3: 0x5678, + 0x93D4: 0x5C6F, + 0x93D5: 0x60C7, + 0x93D6: 0x6566, + 0x93D7: 0x6C8C, + 0x93D8: 0x8C5A, + 0x93D9: 0x9041, + 0x93DA: 0x9813, + 0x93DB: 0x5451, + 0x93DC: 0x66C7, + 0x93DD: 0x920D, + 0x93DE: 0x5948, + 0x93DF: 0x90A3, + 0x93E0: 0x5185, + 0x93E1: 0x4E4D, + 0x93E2: 0x51EA, + 0x93E3: 0x8599, + 0x93E4: 0x8B0E, + 0x93E5: 0x7058, + 0x93E6: 0x637A, + 0x93E7: 0x934B, + 0x93E8: 0x6962, + 0x93E9: 0x99B4, + 0x93EA: 0x7E04, + 0x93EB: 0x7577, + 0x93EC: 0x5357, + 0x93ED: 0x6960, + 0x93EE: 0x8EDF, + 0x93EF: 0x96E3, + 0x93F0: 0x6C5D, + 0x93F1: 0x4E8C, + 0x93F2: 0x5C3C, + 0x93F3: 0x5F10, + 0x93F4: 0x8FE9, + 0x93F5: 0x5302, + 0x93F6: 0x8CD1, + 0x93F7: 0x8089, + 0x93F8: 0x8679, + 0x93F9: 0x5EFF, + 0x93FA: 0x65E5, + 0x93FB: 0x4E73, + 0x93FC: 0x5165, + 0x9440: 0x5982, + 0x9441: 0x5C3F, + 0x9442: 0x97EE, + 0x9443: 0x4EFB, + 0x9444: 0x598A, + 0x9445: 0x5FCD, + 0x9446: 0x8A8D, + 0x9447: 0x6FE1, + 0x9448: 0x79B0, + 0x9449: 0x7962, + 0x944A: 0x5BE7, + 0x944B: 0x8471, + 0x944C: 0x732B, + 0x944D: 0x71B1, + 0x944E: 0x5E74, + 0x944F: 0x5FF5, + 0x9450: 0x637B, + 0x9451: 0x649A, + 0x9452: 0x71C3, + 0x9453: 0x7C98, + 0x9454: 0x4E43, + 0x9455: 0x5EFC, + 0x9456: 0x4E4B, + 0x9457: 0x57DC, + 0x9458: 0x56A2, + 0x9459: 0x60A9, + 0x945A: 0x6FC3, + 0x945B: 0x7D0D, + 0x945C: 0x80FD, + 0x945D: 0x8133, + 0x945E: 0x81BF, + 0x945F: 0x8FB2, + 0x9460: 0x8997, + 0x9461: 0x86A4, + 0x9462: 0x5DF4, + 0x9463: 0x628A, + 0x9464: 0x64AD, + 0x9465: 0x8987, + 0x9466: 0x6777, + 0x9467: 0x6CE2, + 0x9468: 0x6D3E, + 0x9469: 0x7436, + 0x946A: 0x7834, + 0x946B: 0x5A46, + 0x946C: 0x7F75, + 0x946D: 0x82AD, + 0x946E: 0x99AC, + 0x946F: 0x4FF3, + 0x9470: 0x5EC3, + 0x9471: 0x62DD, + 0x9472: 0x6392, + 0x9473: 0x6557, + 0x9474: 0x676F, + 0x9475: 0x76C3, + 0x9476: 0x724C, + 0x9477: 0x80CC, + 0x9478: 0x80BA, + 0x9479: 0x8F29, + 0x947A: 0x914D, + 0x947B: 0x500D, + 0x947C: 0x57F9, + 0x947D: 0x5A92, + 0x947E: 0x6885, + 0x9480: 0x6973, + 0x9481: 0x7164, + 0x9482: 0x72FD, + 0x9483: 0x8CB7, + 0x9484: 0x58F2, + 0x9485: 0x8CE0, + 0x9486: 0x966A, + 0x9487: 0x9019, + 0x9488: 0x877F, + 0x9489: 0x79E4, + 0x948A: 0x77E7, + 0x948B: 0x8429, + 0x948C: 0x4F2F, + 0x948D: 0x5265, + 0x948E: 0x535A, + 0x948F: 0x62CD, + 0x9490: 0x67CF, + 0x9491: 0x6CCA, + 0x9492: 0x767D, + 0x9493: 0x7B94, + 0x9494: 0x7C95, + 0x9495: 0x8236, + 0x9496: 0x8584, + 0x9497: 0x8FEB, + 0x9498: 0x66DD, + 0x9499: 0x6F20, + 0x949A: 0x7206, + 0x949B: 0x7E1B, + 0x949C: 0x83AB, + 0x949D: 0x99C1, + 0x949E: 0x9EA6, + 0x949F: 0x51FD, + 0x94A0: 0x7BB1, + 0x94A1: 0x7872, + 0x94A2: 0x7BB8, + 0x94A3: 0x8087, + 0x94A4: 0x7B48, + 0x94A5: 0x6AE8, + 0x94A6: 0x5E61, + 0x94A7: 0x808C, + 0x94A8: 0x7551, + 0x94A9: 0x7560, + 0x94AA: 0x516B, + 0x94AB: 0x9262, + 0x94AC: 0x6E8C, + 0x94AD: 0x767A, + 0x94AE: 0x9197, + 0x94AF: 0x9AEA, + 0x94B0: 0x4F10, + 0x94B1: 0x7F70, + 0x94B2: 0x629C, + 0x94B3: 0x7B4F, + 0x94B4: 0x95A5, + 0x94B5: 0x9CE9, + 0x94B6: 0x567A, + 0x94B7: 0x5859, + 0x94B8: 0x86E4, + 0x94B9: 0x96BC, + 0x94BA: 0x4F34, + 0x94BB: 0x5224, + 0x94BC: 0x534A, + 0x94BD: 0x53CD, + 0x94BE: 0x53DB, + 0x94BF: 0x5E06, + 0x94C0: 0x642C, + 0x94C1: 0x6591, + 0x94C2: 0x677F, + 0x94C3: 0x6C3E, + 0x94C4: 0x6C4E, + 0x94C5: 0x7248, + 0x94C6: 0x72AF, + 0x94C7: 0x73ED, + 0x94C8: 0x7554, + 0x94C9: 0x7E41, + 0x94CA: 0x822C, + 0x94CB: 0x85E9, + 0x94CC: 0x8CA9, + 0x94CD: 0x7BC4, + 0x94CE: 0x91C6, + 0x94CF: 0x7169, + 0x94D0: 0x9812, + 0x94D1: 0x98EF, + 0x94D2: 0x633D, + 0x94D3: 0x6669, + 0x94D4: 0x756A, + 0x94D5: 0x76E4, + 0x94D6: 0x78D0, + 0x94D7: 0x8543, + 0x94D8: 0x86EE, + 0x94D9: 0x532A, + 0x94DA: 0x5351, + 0x94DB: 0x5426, + 0x94DC: 0x5983, + 0x94DD: 0x5E87, + 0x94DE: 0x5F7C, + 0x94DF: 0x60B2, + 0x94E0: 0x6249, + 0x94E1: 0x6279, + 0x94E2: 0x62AB, + 0x94E3: 0x6590, + 0x94E4: 0x6BD4, + 0x94E5: 0x6CCC, + 0x94E6: 0x75B2, + 0x94E7: 0x76AE, + 0x94E8: 0x7891, + 0x94E9: 0x79D8, + 0x94EA: 0x7DCB, + 0x94EB: 0x7F77, + 0x94EC: 0x80A5, + 0x94ED: 0x88AB, + 0x94EE: 0x8AB9, + 0x94EF: 0x8CBB, + 0x94F0: 0x907F, + 0x94F1: 0x975E, + 0x94F2: 0x98DB, + 0x94F3: 0x6A0B, + 0x94F4: 0x7C38, + 0x94F5: 0x5099, + 0x94F6: 0x5C3E, + 0x94F7: 0x5FAE, + 0x94F8: 0x6787, + 0x94F9: 0x6BD8, + 0x94FA: 0x7435, + 0x94FB: 0x7709, + 0x94FC: 0x7F8E, + 0x9540: 0x9F3B, + 0x9541: 0x67CA, + 0x9542: 0x7A17, + 0x9543: 0x5339, + 0x9544: 0x758B, + 0x9545: 0x9AED, + 0x9546: 0x5F66, + 0x9547: 0x819D, + 0x9548: 0x83F1, + 0x9549: 0x8098, + 0x954A: 0x5F3C, + 0x954B: 0x5FC5, + 0x954C: 0x7562, + 0x954D: 0x7B46, + 0x954E: 0x903C, + 0x954F: 0x6867, + 0x9550: 0x59EB, + 0x9551: 0x5A9B, + 0x9552: 0x7D10, + 0x9553: 0x767E, + 0x9554: 0x8B2C, + 0x9555: 0x4FF5, + 0x9556: 0x5F6A, + 0x9557: 0x6A19, + 0x9558: 0x6C37, + 0x9559: 0x6F02, + 0x955A: 0x74E2, + 0x955B: 0x7968, + 0x955C: 0x8868, + 0x955D: 0x8A55, + 0x955E: 0x8C79, + 0x955F: 0x5EDF, + 0x9560: 0x63CF, + 0x9561: 0x75C5, + 0x9562: 0x79D2, + 0x9563: 0x82D7, + 0x9564: 0x9328, + 0x9565: 0x92F2, + 0x9566: 0x849C, + 0x9567: 0x86ED, + 0x9568: 0x9C2D, + 0x9569: 0x54C1, + 0x956A: 0x5F6C, + 0x956B: 0x658C, + 0x956C: 0x6D5C, + 0x956D: 0x7015, + 0x956E: 0x8CA7, + 0x956F: 0x8CD3, + 0x9570: 0x983B, + 0x9571: 0x654F, + 0x9572: 0x74F6, + 0x9573: 0x4E0D, + 0x9574: 0x4ED8, + 0x9575: 0x57E0, + 0x9576: 0x592B, + 0x9577: 0x5A66, + 0x9578: 0x5BCC, + 0x9579: 0x51A8, + 0x957A: 0x5E03, + 0x957B: 0x5E9C, + 0x957C: 0x6016, + 0x957D: 0x6276, + 0x957E: 0x6577, + 0x9580: 0x65A7, + 0x9581: 0x666E, + 0x9582: 0x6D6E, + 0x9583: 0x7236, + 0x9584: 0x7B26, + 0x9585: 0x8150, + 0x9586: 0x819A, + 0x9587: 0x8299, + 0x9588: 0x8B5C, + 0x9589: 0x8CA0, + 0x958A: 0x8CE6, + 0x958B: 0x8D74, + 0x958C: 0x961C, + 0x958D: 0x9644, + 0x958E: 0x4FAE, + 0x958F: 0x64AB, + 0x9590: 0x6B66, + 0x9591: 0x821E, + 0x9592: 0x8461, + 0x9593: 0x856A, + 0x9594: 0x90E8, + 0x9595: 0x5C01, + 0x9596: 0x6953, + 0x9597: 0x98A8, + 0x9598: 0x847A, + 0x9599: 0x8557, + 0x959A: 0x4F0F, + 0x959B: 0x526F, + 0x959C: 0x5FA9, + 0x959D: 0x5E45, + 0x959E: 0x670D, + 0x959F: 0x798F, + 0x95A0: 0x8179, + 0x95A1: 0x8907, + 0x95A2: 0x8986, + 0x95A3: 0x6DF5, + 0x95A4: 0x5F17, + 0x95A5: 0x6255, + 0x95A6: 0x6CB8, + 0x95A7: 0x4ECF, + 0x95A8: 0x7269, + 0x95A9: 0x9B92, + 0x95AA: 0x5206, + 0x95AB: 0x543B, + 0x95AC: 0x5674, + 0x95AD: 0x58B3, + 0x95AE: 0x61A4, + 0x95AF: 0x626E, + 0x95B0: 0x711A, + 0x95B1: 0x596E, + 0x95B2: 0x7C89, + 0x95B3: 0x7CDE, + 0x95B4: 0x7D1B, + 0x95B5: 0x96F0, + 0x95B6: 0x6587, + 0x95B7: 0x805E, + 0x95B8: 0x4E19, + 0x95B9: 0x4F75, + 0x95BA: 0x5175, + 0x95BB: 0x5840, + 0x95BC: 0x5E63, + 0x95BD: 0x5E73, + 0x95BE: 0x5F0A, + 0x95BF: 0x67C4, + 0x95C0: 0x4E26, + 0x95C1: 0x853D, + 0x95C2: 0x9589, + 0x95C3: 0x965B, + 0x95C4: 0x7C73, + 0x95C5: 0x9801, + 0x95C6: 0x50FB, + 0x95C7: 0x58C1, + 0x95C8: 0x7656, + 0x95C9: 0x78A7, + 0x95CA: 0x5225, + 0x95CB: 0x77A5, + 0x95CC: 0x8511, + 0x95CD: 0x7B86, + 0x95CE: 0x504F, + 0x95CF: 0x5909, + 0x95D0: 0x7247, + 0x95D1: 0x7BC7, + 0x95D2: 0x7DE8, + 0x95D3: 0x8FBA, + 0x95D4: 0x8FD4, + 0x95D5: 0x904D, + 0x95D6: 0x4FBF, + 0x95D7: 0x52C9, + 0x95D8: 0x5A29, + 0x95D9: 0x5F01, + 0x95DA: 0x97AD, + 0x95DB: 0x4FDD, + 0x95DC: 0x8217, + 0x95DD: 0x92EA, + 0x95DE: 0x5703, + 0x95DF: 0x6355, + 0x95E0: 0x6B69, + 0x95E1: 0x752B, + 0x95E2: 0x88DC, + 0x95E3: 0x8F14, + 0x95E4: 0x7A42, + 0x95E5: 0x52DF, + 0x95E6: 0x5893, + 0x95E7: 0x6155, + 0x95E8: 0x620A, + 0x95E9: 0x66AE, + 0x95EA: 0x6BCD, + 0x95EB: 0x7C3F, + 0x95EC: 0x83E9, + 0x95ED: 0x5023, + 0x95EE: 0x4FF8, + 0x95EF: 0x5305, + 0x95F0: 0x5446, + 0x95F1: 0x5831, + 0x95F2: 0x5949, + 0x95F3: 0x5B9D, + 0x95F4: 0x5CF0, + 0x95F5: 0x5CEF, + 0x95F6: 0x5D29, + 0x95F7: 0x5E96, + 0x95F8: 0x62B1, + 0x95F9: 0x6367, + 0x95FA: 0x653E, + 0x95FB: 0x65B9, + 0x95FC: 0x670B, + 0x9640: 0x6CD5, + 0x9641: 0x6CE1, + 0x9642: 0x70F9, + 0x9643: 0x7832, + 0x9644: 0x7E2B, + 0x9645: 0x80DE, + 0x9646: 0x82B3, + 0x9647: 0x840C, + 0x9648: 0x84EC, + 0x9649: 0x8702, + 0x964A: 0x8912, + 0x964B: 0x8A2A, + 0x964C: 0x8C4A, + 0x964D: 0x90A6, + 0x964E: 0x92D2, + 0x964F: 0x98FD, + 0x9650: 0x9CF3, + 0x9651: 0x9D6C, + 0x9652: 0x4E4F, + 0x9653: 0x4EA1, + 0x9654: 0x508D, + 0x9655: 0x5256, + 0x9656: 0x574A, + 0x9657: 0x59A8, + 0x9658: 0x5E3D, + 0x9659: 0x5FD8, + 0x965A: 0x5FD9, + 0x965B: 0x623F, + 0x965C: 0x66B4, + 0x965D: 0x671B, + 0x965E: 0x67D0, + 0x965F: 0x68D2, + 0x9660: 0x5192, + 0x9661: 0x7D21, + 0x9662: 0x80AA, + 0x9663: 0x81A8, + 0x9664: 0x8B00, + 0x9665: 0x8C8C, + 0x9666: 0x8CBF, + 0x9667: 0x927E, + 0x9668: 0x9632, + 0x9669: 0x5420, + 0x966A: 0x982C, + 0x966B: 0x5317, + 0x966C: 0x50D5, + 0x966D: 0x535C, + 0x966E: 0x58A8, + 0x966F: 0x64B2, + 0x9670: 0x6734, + 0x9671: 0x7267, + 0x9672: 0x7766, + 0x9673: 0x7A46, + 0x9674: 0x91E6, + 0x9675: 0x52C3, + 0x9676: 0x6CA1, + 0x9677: 0x6B86, + 0x9678: 0x5800, + 0x9679: 0x5E4C, + 0x967A: 0x5954, + 0x967B: 0x672C, + 0x967C: 0x7FFB, + 0x967D: 0x51E1, + 0x967E: 0x76C6, + 0x9680: 0x6469, + 0x9681: 0x78E8, + 0x9682: 0x9B54, + 0x9683: 0x9EBB, + 0x9684: 0x57CB, + 0x9685: 0x59B9, + 0x9686: 0x6627, + 0x9687: 0x679A, + 0x9688: 0x6BCE, + 0x9689: 0x54E9, + 0x968A: 0x69D9, + 0x968B: 0x5E55, + 0x968C: 0x819C, + 0x968D: 0x6795, + 0x968E: 0x9BAA, + 0x968F: 0x67FE, + 0x9690: 0x9C52, + 0x9691: 0x685D, + 0x9692: 0x4EA6, + 0x9693: 0x4FE3, + 0x9694: 0x53C8, + 0x9695: 0x62B9, + 0x9696: 0x672B, + 0x9697: 0x6CAB, + 0x9698: 0x8FC4, + 0x9699: 0x4FAD, + 0x969A: 0x7E6D, + 0x969B: 0x9EBF, + 0x969C: 0x4E07, + 0x969D: 0x6162, + 0x969E: 0x6E80, + 0x969F: 0x6F2B, + 0x96A0: 0x8513, + 0x96A1: 0x5473, + 0x96A2: 0x672A, + 0x96A3: 0x9B45, + 0x96A4: 0x5DF3, + 0x96A5: 0x7B95, + 0x96A6: 0x5CAC, + 0x96A7: 0x5BC6, + 0x96A8: 0x871C, + 0x96A9: 0x6E4A, + 0x96AA: 0x84D1, + 0x96AB: 0x7A14, + 0x96AC: 0x8108, + 0x96AD: 0x5999, + 0x96AE: 0x7C8D, + 0x96AF: 0x6C11, + 0x96B0: 0x7720, + 0x96B1: 0x52D9, + 0x96B2: 0x5922, + 0x96B3: 0x7121, + 0x96B4: 0x725F, + 0x96B5: 0x77DB, + 0x96B6: 0x9727, + 0x96B7: 0x9D61, + 0x96B8: 0x690B, + 0x96B9: 0x5A7F, + 0x96BA: 0x5A18, + 0x96BB: 0x51A5, + 0x96BC: 0x540D, + 0x96BD: 0x547D, + 0x96BE: 0x660E, + 0x96BF: 0x76DF, + 0x96C0: 0x8FF7, + 0x96C1: 0x9298, + 0x96C2: 0x9CF4, + 0x96C3: 0x59EA, + 0x96C4: 0x725D, + 0x96C5: 0x6EC5, + 0x96C6: 0x514D, + 0x96C7: 0x68C9, + 0x96C8: 0x7DBF, + 0x96C9: 0x7DEC, + 0x96CA: 0x9762, + 0x96CB: 0x9EBA, + 0x96CC: 0x6478, + 0x96CD: 0x6A21, + 0x96CE: 0x8302, + 0x96CF: 0x5984, + 0x96D0: 0x5B5F, + 0x96D1: 0x6BDB, + 0x96D2: 0x731B, + 0x96D3: 0x76F2, + 0x96D4: 0x7DB2, + 0x96D5: 0x8017, + 0x96D6: 0x8499, + 0x96D7: 0x5132, + 0x96D8: 0x6728, + 0x96D9: 0x9ED9, + 0x96DA: 0x76EE, + 0x96DB: 0x6762, + 0x96DC: 0x52FF, + 0x96DD: 0x9905, + 0x96DE: 0x5C24, + 0x96DF: 0x623B, + 0x96E0: 0x7C7E, + 0x96E1: 0x8CB0, + 0x96E2: 0x554F, + 0x96E3: 0x60B6, + 0x96E4: 0x7D0B, + 0x96E5: 0x9580, + 0x96E6: 0x5301, + 0x96E7: 0x4E5F, + 0x96E8: 0x51B6, + 0x96E9: 0x591C, + 0x96EA: 0x723A, + 0x96EB: 0x8036, + 0x96EC: 0x91CE, + 0x96ED: 0x5F25, + 0x96EE: 0x77E2, + 0x96EF: 0x5384, + 0x96F0: 0x5F79, + 0x96F1: 0x7D04, + 0x96F2: 0x85AC, + 0x96F3: 0x8A33, + 0x96F4: 0x8E8D, + 0x96F5: 0x9756, + 0x96F6: 0x67F3, + 0x96F7: 0x85AE, + 0x96F8: 0x9453, + 0x96F9: 0x6109, + 0x96FA: 0x6108, + 0x96FB: 0x6CB9, + 0x96FC: 0x7652, + 0x9740: 0x8AED, + 0x9741: 0x8F38, + 0x9742: 0x552F, + 0x9743: 0x4F51, + 0x9744: 0x512A, + 0x9745: 0x52C7, + 0x9746: 0x53CB, + 0x9747: 0x5BA5, + 0x9748: 0x5E7D, + 0x9749: 0x60A0, + 0x974A: 0x6182, + 0x974B: 0x63D6, + 0x974C: 0x6709, + 0x974D: 0x67DA, + 0x974E: 0x6E67, + 0x974F: 0x6D8C, + 0x9750: 0x7336, + 0x9751: 0x7337, + 0x9752: 0x7531, + 0x9753: 0x7950, + 0x9754: 0x88D5, + 0x9755: 0x8A98, + 0x9756: 0x904A, + 0x9757: 0x9091, + 0x9758: 0x90F5, + 0x9759: 0x96C4, + 0x975A: 0x878D, + 0x975B: 0x5915, + 0x975C: 0x4E88, + 0x975D: 0x4F59, + 0x975E: 0x4E0E, + 0x975F: 0x8A89, + 0x9760: 0x8F3F, + 0x9761: 0x9810, + 0x9762: 0x50AD, + 0x9763: 0x5E7C, + 0x9764: 0x5996, + 0x9765: 0x5BB9, + 0x9766: 0x5EB8, + 0x9767: 0x63DA, + 0x9768: 0x63FA, + 0x9769: 0x64C1, + 0x976A: 0x66DC, + 0x976B: 0x694A, + 0x976C: 0x69D8, + 0x976D: 0x6D0B, + 0x976E: 0x6EB6, + 0x976F: 0x7194, + 0x9770: 0x7528, + 0x9771: 0x7AAF, + 0x9772: 0x7F8A, + 0x9773: 0x8000, + 0x9774: 0x8449, + 0x9775: 0x84C9, + 0x9776: 0x8981, + 0x9777: 0x8B21, + 0x9778: 0x8E0A, + 0x9779: 0x9065, + 0x977A: 0x967D, + 0x977B: 0x990A, + 0x977C: 0x617E, + 0x977D: 0x6291, + 0x977E: 0x6B32, + 0x9780: 0x6C83, + 0x9781: 0x6D74, + 0x9782: 0x7FCC, + 0x9783: 0x7FFC, + 0x9784: 0x6DC0, + 0x9785: 0x7F85, + 0x9786: 0x87BA, + 0x9787: 0x88F8, + 0x9788: 0x6765, + 0x9789: 0x83B1, + 0x978A: 0x983C, + 0x978B: 0x96F7, + 0x978C: 0x6D1B, + 0x978D: 0x7D61, + 0x978E: 0x843D, + 0x978F: 0x916A, + 0x9790: 0x4E71, + 0x9791: 0x5375, + 0x9792: 0x5D50, + 0x9793: 0x6B04, + 0x9794: 0x6FEB, + 0x9795: 0x85CD, + 0x9796: 0x862D, + 0x9797: 0x89A7, + 0x9798: 0x5229, + 0x9799: 0x540F, + 0x979A: 0x5C65, + 0x979B: 0x674E, + 0x979C: 0x68A8, + 0x979D: 0x7406, + 0x979E: 0x7483, + 0x979F: 0x75E2, + 0x97A0: 0x88CF, + 0x97A1: 0x88E1, + 0x97A2: 0x91CC, + 0x97A3: 0x96E2, + 0x97A4: 0x9678, + 0x97A5: 0x5F8B, + 0x97A6: 0x7387, + 0x97A7: 0x7ACB, + 0x97A8: 0x844E, + 0x97A9: 0x63A0, + 0x97AA: 0x7565, + 0x97AB: 0x5289, + 0x97AC: 0x6D41, + 0x97AD: 0x6E9C, + 0x97AE: 0x7409, + 0x97AF: 0x7559, + 0x97B0: 0x786B, + 0x97B1: 0x7C92, + 0x97B2: 0x9686, + 0x97B3: 0x7ADC, + 0x97B4: 0x9F8D, + 0x97B5: 0x4FB6, + 0x97B6: 0x616E, + 0x97B7: 0x65C5, + 0x97B8: 0x865C, + 0x97B9: 0x4E86, + 0x97BA: 0x4EAE, + 0x97BB: 0x50DA, + 0x97BC: 0x4E21, + 0x97BD: 0x51CC, + 0x97BE: 0x5BEE, + 0x97BF: 0x6599, + 0x97C0: 0x6881, + 0x97C1: 0x6DBC, + 0x97C2: 0x731F, + 0x97C3: 0x7642, + 0x97C4: 0x77AD, + 0x97C5: 0x7A1C, + 0x97C6: 0x7CE7, + 0x97C7: 0x826F, + 0x97C8: 0x8AD2, + 0x97C9: 0x907C, + 0x97CA: 0x91CF, + 0x97CB: 0x9675, + 0x97CC: 0x9818, + 0x97CD: 0x529B, + 0x97CE: 0x7DD1, + 0x97CF: 0x502B, + 0x97D0: 0x5398, + 0x97D1: 0x6797, + 0x97D2: 0x6DCB, + 0x97D3: 0x71D0, + 0x97D4: 0x7433, + 0x97D5: 0x81E8, + 0x97D6: 0x8F2A, + 0x97D7: 0x96A3, + 0x97D8: 0x9C57, + 0x97D9: 0x9E9F, + 0x97DA: 0x7460, + 0x97DB: 0x5841, + 0x97DC: 0x6D99, + 0x97DD: 0x7D2F, + 0x97DE: 0x985E, + 0x97DF: 0x4EE4, + 0x97E0: 0x4F36, + 0x97E1: 0x4F8B, + 0x97E2: 0x51B7, + 0x97E3: 0x52B1, + 0x97E4: 0x5DBA, + 0x97E5: 0x601C, + 0x97E6: 0x73B2, + 0x97E7: 0x793C, + 0x97E8: 0x82D3, + 0x97E9: 0x9234, + 0x97EA: 0x96B7, + 0x97EB: 0x96F6, + 0x97EC: 0x970A, + 0x97ED: 0x9E97, + 0x97EE: 0x9F62, + 0x97EF: 0x66A6, + 0x97F0: 0x6B74, + 0x97F1: 0x5217, + 0x97F2: 0x52A3, + 0x97F3: 0x70C8, + 0x97F4: 0x88C2, + 0x97F5: 0x5EC9, + 0x97F6: 0x604B, + 0x97F7: 0x6190, + 0x97F8: 0x6F23, + 0x97F9: 0x7149, + 0x97FA: 0x7C3E, + 0x97FB: 0x7DF4, + 0x97FC: 0x806F, + 0x9840: 0x84EE, + 0x9841: 0x9023, + 0x9842: 0x932C, + 0x9843: 0x5442, + 0x9844: 0x9B6F, + 0x9845: 0x6AD3, + 0x9846: 0x7089, + 0x9847: 0x8CC2, + 0x9848: 0x8DEF, + 0x9849: 0x9732, + 0x984A: 0x52B4, + 0x984B: 0x5A41, + 0x984C: 0x5ECA, + 0x984D: 0x5F04, + 0x984E: 0x6717, + 0x984F: 0x697C, + 0x9850: 0x6994, + 0x9851: 0x6D6A, + 0x9852: 0x6F0F, + 0x9853: 0x7262, + 0x9854: 0x72FC, + 0x9855: 0x7BED, + 0x9856: 0x8001, + 0x9857: 0x807E, + 0x9858: 0x874B, + 0x9859: 0x90CE, + 0x985A: 0x516D, + 0x985B: 0x9E93, + 0x985C: 0x7984, + 0x985D: 0x808B, + 0x985E: 0x9332, + 0x985F: 0x8AD6, + 0x9860: 0x502D, + 0x9861: 0x548C, + 0x9862: 0x8A71, + 0x9863: 0x6B6A, + 0x9864: 0x8CC4, + 0x9865: 0x8107, + 0x9866: 0x60D1, + 0x9867: 0x67A0, + 0x9868: 0x9DF2, + 0x9869: 0x4E99, + 0x986A: 0x4E98, + 0x986B: 0x9C10, + 0x986C: 0x8A6B, + 0x986D: 0x85C1, + 0x986E: 0x8568, + 0x986F: 0x6900, + 0x9870: 0x6E7E, + 0x9871: 0x7897, + 0x9872: 0x8155, + 0x989F: 0x5F0C, + 0x98A0: 0x4E10, + 0x98A1: 0x4E15, + 0x98A2: 0x4E2A, + 0x98A3: 0x4E31, + 0x98A4: 0x4E36, + 0x98A5: 0x4E3C, + 0x98A6: 0x4E3F, + 0x98A7: 0x4E42, + 0x98A8: 0x4E56, + 0x98A9: 0x4E58, + 0x98AA: 0x4E82, + 0x98AB: 0x4E85, + 0x98AC: 0x8C6B, + 0x98AD: 0x4E8A, + 0x98AE: 0x8212, + 0x98AF: 0x5F0D, + 0x98B0: 0x4E8E, + 0x98B1: 0x4E9E, + 0x98B2: 0x4E9F, + 0x98B3: 0x4EA0, + 0x98B4: 0x4EA2, + 0x98B5: 0x4EB0, + 0x98B6: 0x4EB3, + 0x98B7: 0x4EB6, + 0x98B8: 0x4ECE, + 0x98B9: 0x4ECD, + 0x98BA: 0x4EC4, + 0x98BB: 0x4EC6, + 0x98BC: 0x4EC2, + 0x98BD: 0x4ED7, + 0x98BE: 0x4EDE, + 0x98BF: 0x4EED, + 0x98C0: 0x4EDF, + 0x98C1: 0x4EF7, + 0x98C2: 0x4F09, + 0x98C3: 0x4F5A, + 0x98C4: 0x4F30, + 0x98C5: 0x4F5B, + 0x98C6: 0x4F5D, + 0x98C7: 0x4F57, + 0x98C8: 0x4F47, + 0x98C9: 0x4F76, + 0x98CA: 0x4F88, + 0x98CB: 0x4F8F, + 0x98CC: 0x4F98, + 0x98CD: 0x4F7B, + 0x98CE: 0x4F69, + 0x98CF: 0x4F70, + 0x98D0: 0x4F91, + 0x98D1: 0x4F6F, + 0x98D2: 0x4F86, + 0x98D3: 0x4F96, + 0x98D4: 0x5118, + 0x98D5: 0x4FD4, + 0x98D6: 0x4FDF, + 0x98D7: 0x4FCE, + 0x98D8: 0x4FD8, + 0x98D9: 0x4FDB, + 0x98DA: 0x4FD1, + 0x98DB: 0x4FDA, + 0x98DC: 0x4FD0, + 0x98DD: 0x4FE4, + 0x98DE: 0x4FE5, + 0x98DF: 0x501A, + 0x98E0: 0x5028, + 0x98E1: 0x5014, + 0x98E2: 0x502A, + 0x98E3: 0x5025, + 0x98E4: 0x5005, + 0x98E5: 0x4F1C, + 0x98E6: 0x4FF6, + 0x98E7: 0x5021, + 0x98E8: 0x5029, + 0x98E9: 0x502C, + 0x98EA: 0x4FFE, + 0x98EB: 0x4FEF, + 0x98EC: 0x5011, + 0x98ED: 0x5006, + 0x98EE: 0x5043, + 0x98EF: 0x5047, + 0x98F0: 0x6703, + 0x98F1: 0x5055, + 0x98F2: 0x5050, + 0x98F3: 0x5048, + 0x98F4: 0x505A, + 0x98F5: 0x5056, + 0x98F6: 0x506C, + 0x98F7: 0x5078, + 0x98F8: 0x5080, + 0x98F9: 0x509A, + 0x98FA: 0x5085, + 0x98FB: 0x50B4, + 0x98FC: 0x50B2, + 0x9940: 0x50C9, + 0x9941: 0x50CA, + 0x9942: 0x50B3, + 0x9943: 0x50C2, + 0x9944: 0x50D6, + 0x9945: 0x50DE, + 0x9946: 0x50E5, + 0x9947: 0x50ED, + 0x9948: 0x50E3, + 0x9949: 0x50EE, + 0x994A: 0x50F9, + 0x994B: 0x50F5, + 0x994C: 0x5109, + 0x994D: 0x5101, + 0x994E: 0x5102, + 0x994F: 0x5116, + 0x9950: 0x5115, + 0x9951: 0x5114, + 0x9952: 0x511A, + 0x9953: 0x5121, + 0x9954: 0x513A, + 0x9955: 0x5137, + 0x9956: 0x513C, + 0x9957: 0x513B, + 0x9958: 0x513F, + 0x9959: 0x5140, + 0x995A: 0x5152, + 0x995B: 0x514C, + 0x995C: 0x5154, + 0x995D: 0x5162, + 0x995E: 0x7AF8, + 0x995F: 0x5169, + 0x9960: 0x516A, + 0x9961: 0x516E, + 0x9962: 0x5180, + 0x9963: 0x5182, + 0x9964: 0x56D8, + 0x9965: 0x518C, + 0x9966: 0x5189, + 0x9967: 0x518F, + 0x9968: 0x5191, + 0x9969: 0x5193, + 0x996A: 0x5195, + 0x996B: 0x5196, + 0x996C: 0x51A4, + 0x996D: 0x51A6, + 0x996E: 0x51A2, + 0x996F: 0x51A9, + 0x9970: 0x51AA, + 0x9971: 0x51AB, + 0x9972: 0x51B3, + 0x9973: 0x51B1, + 0x9974: 0x51B2, + 0x9975: 0x51B0, + 0x9976: 0x51B5, + 0x9977: 0x51BD, + 0x9978: 0x51C5, + 0x9979: 0x51C9, + 0x997A: 0x51DB, + 0x997B: 0x51E0, + 0x997C: 0x8655, + 0x997D: 0x51E9, + 0x997E: 0x51ED, + 0x9980: 0x51F0, + 0x9981: 0x51F5, + 0x9982: 0x51FE, + 0x9983: 0x5204, + 0x9984: 0x520B, + 0x9985: 0x5214, + 0x9986: 0x520E, + 0x9987: 0x5227, + 0x9988: 0x522A, + 0x9989: 0x522E, + 0x998A: 0x5233, + 0x998B: 0x5239, + 0x998C: 0x524F, + 0x998D: 0x5244, + 0x998E: 0x524B, + 0x998F: 0x524C, + 0x9990: 0x525E, + 0x9991: 0x5254, + 0x9992: 0x526A, + 0x9993: 0x5274, + 0x9994: 0x5269, + 0x9995: 0x5273, + 0x9996: 0x527F, + 0x9997: 0x527D, + 0x9998: 0x528D, + 0x9999: 0x5294, + 0x999A: 0x5292, + 0x999B: 0x5271, + 0x999C: 0x5288, + 0x999D: 0x5291, + 0x999E: 0x8FA8, + 0x999F: 0x8FA7, + 0x99A0: 0x52AC, + 0x99A1: 0x52AD, + 0x99A2: 0x52BC, + 0x99A3: 0x52B5, + 0x99A4: 0x52C1, + 0x99A5: 0x52CD, + 0x99A6: 0x52D7, + 0x99A7: 0x52DE, + 0x99A8: 0x52E3, + 0x99A9: 0x52E6, + 0x99AA: 0x98ED, + 0x99AB: 0x52E0, + 0x99AC: 0x52F3, + 0x99AD: 0x52F5, + 0x99AE: 0x52F8, + 0x99AF: 0x52F9, + 0x99B0: 0x5306, + 0x99B1: 0x5308, + 0x99B2: 0x7538, + 0x99B3: 0x530D, + 0x99B4: 0x5310, + 0x99B5: 0x530F, + 0x99B6: 0x5315, + 0x99B7: 0x531A, + 0x99B8: 0x5323, + 0x99B9: 0x532F, + 0x99BA: 0x5331, + 0x99BB: 0x5333, + 0x99BC: 0x5338, + 0x99BD: 0x5340, + 0x99BE: 0x5346, + 0x99BF: 0x5345, + 0x99C0: 0x4E17, + 0x99C1: 0x5349, + 0x99C2: 0x534D, + 0x99C3: 0x51D6, + 0x99C4: 0x535E, + 0x99C5: 0x5369, + 0x99C6: 0x536E, + 0x99C7: 0x5918, + 0x99C8: 0x537B, + 0x99C9: 0x5377, + 0x99CA: 0x5382, + 0x99CB: 0x5396, + 0x99CC: 0x53A0, + 0x99CD: 0x53A6, + 0x99CE: 0x53A5, + 0x99CF: 0x53AE, + 0x99D0: 0x53B0, + 0x99D1: 0x53B6, + 0x99D2: 0x53C3, + 0x99D3: 0x7C12, + 0x99D4: 0x96D9, + 0x99D5: 0x53DF, + 0x99D6: 0x66FC, + 0x99D7: 0x71EE, + 0x99D8: 0x53EE, + 0x99D9: 0x53E8, + 0x99DA: 0x53ED, + 0x99DB: 0x53FA, + 0x99DC: 0x5401, + 0x99DD: 0x543D, + 0x99DE: 0x5440, + 0x99DF: 0x542C, + 0x99E0: 0x542D, + 0x99E1: 0x543C, + 0x99E2: 0x542E, + 0x99E3: 0x5436, + 0x99E4: 0x5429, + 0x99E5: 0x541D, + 0x99E6: 0x544E, + 0x99E7: 0x548F, + 0x99E8: 0x5475, + 0x99E9: 0x548E, + 0x99EA: 0x545F, + 0x99EB: 0x5471, + 0x99EC: 0x5477, + 0x99ED: 0x5470, + 0x99EE: 0x5492, + 0x99EF: 0x547B, + 0x99F0: 0x5480, + 0x99F1: 0x5476, + 0x99F2: 0x5484, + 0x99F3: 0x5490, + 0x99F4: 0x5486, + 0x99F5: 0x54C7, + 0x99F6: 0x54A2, + 0x99F7: 0x54B8, + 0x99F8: 0x54A5, + 0x99F9: 0x54AC, + 0x99FA: 0x54C4, + 0x99FB: 0x54C8, + 0x99FC: 0x54A8, + 0x9A40: 0x54AB, + 0x9A41: 0x54C2, + 0x9A42: 0x54A4, + 0x9A43: 0x54BE, + 0x9A44: 0x54BC, + 0x9A45: 0x54D8, + 0x9A46: 0x54E5, + 0x9A47: 0x54E6, + 0x9A48: 0x550F, + 0x9A49: 0x5514, + 0x9A4A: 0x54FD, + 0x9A4B: 0x54EE, + 0x9A4C: 0x54ED, + 0x9A4D: 0x54FA, + 0x9A4E: 0x54E2, + 0x9A4F: 0x5539, + 0x9A50: 0x5540, + 0x9A51: 0x5563, + 0x9A52: 0x554C, + 0x9A53: 0x552E, + 0x9A54: 0x555C, + 0x9A55: 0x5545, + 0x9A56: 0x5556, + 0x9A57: 0x5557, + 0x9A58: 0x5538, + 0x9A59: 0x5533, + 0x9A5A: 0x555D, + 0x9A5B: 0x5599, + 0x9A5C: 0x5580, + 0x9A5D: 0x54AF, + 0x9A5E: 0x558A, + 0x9A5F: 0x559F, + 0x9A60: 0x557B, + 0x9A61: 0x557E, + 0x9A62: 0x5598, + 0x9A63: 0x559E, + 0x9A64: 0x55AE, + 0x9A65: 0x557C, + 0x9A66: 0x5583, + 0x9A67: 0x55A9, + 0x9A68: 0x5587, + 0x9A69: 0x55A8, + 0x9A6A: 0x55DA, + 0x9A6B: 0x55C5, + 0x9A6C: 0x55DF, + 0x9A6D: 0x55C4, + 0x9A6E: 0x55DC, + 0x9A6F: 0x55E4, + 0x9A70: 0x55D4, + 0x9A71: 0x5614, + 0x9A72: 0x55F7, + 0x9A73: 0x5616, + 0x9A74: 0x55FE, + 0x9A75: 0x55FD, + 0x9A76: 0x561B, + 0x9A77: 0x55F9, + 0x9A78: 0x564E, + 0x9A79: 0x5650, + 0x9A7A: 0x71DF, + 0x9A7B: 0x5634, + 0x9A7C: 0x5636, + 0x9A7D: 0x5632, + 0x9A7E: 0x5638, + 0x9A80: 0x566B, + 0x9A81: 0x5664, + 0x9A82: 0x562F, + 0x9A83: 0x566C, + 0x9A84: 0x566A, + 0x9A85: 0x5686, + 0x9A86: 0x5680, + 0x9A87: 0x568A, + 0x9A88: 0x56A0, + 0x9A89: 0x5694, + 0x9A8A: 0x568F, + 0x9A8B: 0x56A5, + 0x9A8C: 0x56AE, + 0x9A8D: 0x56B6, + 0x9A8E: 0x56B4, + 0x9A8F: 0x56C2, + 0x9A90: 0x56BC, + 0x9A91: 0x56C1, + 0x9A92: 0x56C3, + 0x9A93: 0x56C0, + 0x9A94: 0x56C8, + 0x9A95: 0x56CE, + 0x9A96: 0x56D1, + 0x9A97: 0x56D3, + 0x9A98: 0x56D7, + 0x9A99: 0x56EE, + 0x9A9A: 0x56F9, + 0x9A9B: 0x5700, + 0x9A9C: 0x56FF, + 0x9A9D: 0x5704, + 0x9A9E: 0x5709, + 0x9A9F: 0x5708, + 0x9AA0: 0x570B, + 0x9AA1: 0x570D, + 0x9AA2: 0x5713, + 0x9AA3: 0x5718, + 0x9AA4: 0x5716, + 0x9AA5: 0x55C7, + 0x9AA6: 0x571C, + 0x9AA7: 0x5726, + 0x9AA8: 0x5737, + 0x9AA9: 0x5738, + 0x9AAA: 0x574E, + 0x9AAB: 0x573B, + 0x9AAC: 0x5740, + 0x9AAD: 0x574F, + 0x9AAE: 0x5769, + 0x9AAF: 0x57C0, + 0x9AB0: 0x5788, + 0x9AB1: 0x5761, + 0x9AB2: 0x577F, + 0x9AB3: 0x5789, + 0x9AB4: 0x5793, + 0x9AB5: 0x57A0, + 0x9AB6: 0x57B3, + 0x9AB7: 0x57A4, + 0x9AB8: 0x57AA, + 0x9AB9: 0x57B0, + 0x9ABA: 0x57C3, + 0x9ABB: 0x57C6, + 0x9ABC: 0x57D4, + 0x9ABD: 0x57D2, + 0x9ABE: 0x57D3, + 0x9ABF: 0x580A, + 0x9AC0: 0x57D6, + 0x9AC1: 0x57E3, + 0x9AC2: 0x580B, + 0x9AC3: 0x5819, + 0x9AC4: 0x581D, + 0x9AC5: 0x5872, + 0x9AC6: 0x5821, + 0x9AC7: 0x5862, + 0x9AC8: 0x584B, + 0x9AC9: 0x5870, + 0x9ACA: 0x6BC0, + 0x9ACB: 0x5852, + 0x9ACC: 0x583D, + 0x9ACD: 0x5879, + 0x9ACE: 0x5885, + 0x9ACF: 0x58B9, + 0x9AD0: 0x589F, + 0x9AD1: 0x58AB, + 0x9AD2: 0x58BA, + 0x9AD3: 0x58DE, + 0x9AD4: 0x58BB, + 0x9AD5: 0x58B8, + 0x9AD6: 0x58AE, + 0x9AD7: 0x58C5, + 0x9AD8: 0x58D3, + 0x9AD9: 0x58D1, + 0x9ADA: 0x58D7, + 0x9ADB: 0x58D9, + 0x9ADC: 0x58D8, + 0x9ADD: 0x58E5, + 0x9ADE: 0x58DC, + 0x9ADF: 0x58E4, + 0x9AE0: 0x58DF, + 0x9AE1: 0x58EF, + 0x9AE2: 0x58FA, + 0x9AE3: 0x58F9, + 0x9AE4: 0x58FB, + 0x9AE5: 0x58FC, + 0x9AE6: 0x58FD, + 0x9AE7: 0x5902, + 0x9AE8: 0x590A, + 0x9AE9: 0x5910, + 0x9AEA: 0x591B, + 0x9AEB: 0x68A6, + 0x9AEC: 0x5925, + 0x9AED: 0x592C, + 0x9AEE: 0x592D, + 0x9AEF: 0x5932, + 0x9AF0: 0x5938, + 0x9AF1: 0x593E, + 0x9AF2: 0x7AD2, + 0x9AF3: 0x5955, + 0x9AF4: 0x5950, + 0x9AF5: 0x594E, + 0x9AF6: 0x595A, + 0x9AF7: 0x5958, + 0x9AF8: 0x5962, + 0x9AF9: 0x5960, + 0x9AFA: 0x5967, + 0x9AFB: 0x596C, + 0x9AFC: 0x5969, + 0x9B40: 0x5978, + 0x9B41: 0x5981, + 0x9B42: 0x599D, + 0x9B43: 0x4F5E, + 0x9B44: 0x4FAB, + 0x9B45: 0x59A3, + 0x9B46: 0x59B2, + 0x9B47: 0x59C6, + 0x9B48: 0x59E8, + 0x9B49: 0x59DC, + 0x9B4A: 0x598D, + 0x9B4B: 0x59D9, + 0x9B4C: 0x59DA, + 0x9B4D: 0x5A25, + 0x9B4E: 0x5A1F, + 0x9B4F: 0x5A11, + 0x9B50: 0x5A1C, + 0x9B51: 0x5A09, + 0x9B52: 0x5A1A, + 0x9B53: 0x5A40, + 0x9B54: 0x5A6C, + 0x9B55: 0x5A49, + 0x9B56: 0x5A35, + 0x9B57: 0x5A36, + 0x9B58: 0x5A62, + 0x9B59: 0x5A6A, + 0x9B5A: 0x5A9A, + 0x9B5B: 0x5ABC, + 0x9B5C: 0x5ABE, + 0x9B5D: 0x5ACB, + 0x9B5E: 0x5AC2, + 0x9B5F: 0x5ABD, + 0x9B60: 0x5AE3, + 0x9B61: 0x5AD7, + 0x9B62: 0x5AE6, + 0x9B63: 0x5AE9, + 0x9B64: 0x5AD6, + 0x9B65: 0x5AFA, + 0x9B66: 0x5AFB, + 0x9B67: 0x5B0C, + 0x9B68: 0x5B0B, + 0x9B69: 0x5B16, + 0x9B6A: 0x5B32, + 0x9B6B: 0x5AD0, + 0x9B6C: 0x5B2A, + 0x9B6D: 0x5B36, + 0x9B6E: 0x5B3E, + 0x9B6F: 0x5B43, + 0x9B70: 0x5B45, + 0x9B71: 0x5B40, + 0x9B72: 0x5B51, + 0x9B73: 0x5B55, + 0x9B74: 0x5B5A, + 0x9B75: 0x5B5B, + 0x9B76: 0x5B65, + 0x9B77: 0x5B69, + 0x9B78: 0x5B70, + 0x9B79: 0x5B73, + 0x9B7A: 0x5B75, + 0x9B7B: 0x5B78, + 0x9B7C: 0x6588, + 0x9B7D: 0x5B7A, + 0x9B7E: 0x5B80, + 0x9B80: 0x5B83, + 0x9B81: 0x5BA6, + 0x9B82: 0x5BB8, + 0x9B83: 0x5BC3, + 0x9B84: 0x5BC7, + 0x9B85: 0x5BC9, + 0x9B86: 0x5BD4, + 0x9B87: 0x5BD0, + 0x9B88: 0x5BE4, + 0x9B89: 0x5BE6, + 0x9B8A: 0x5BE2, + 0x9B8B: 0x5BDE, + 0x9B8C: 0x5BE5, + 0x9B8D: 0x5BEB, + 0x9B8E: 0x5BF0, + 0x9B8F: 0x5BF6, + 0x9B90: 0x5BF3, + 0x9B91: 0x5C05, + 0x9B92: 0x5C07, + 0x9B93: 0x5C08, + 0x9B94: 0x5C0D, + 0x9B95: 0x5C13, + 0x9B96: 0x5C20, + 0x9B97: 0x5C22, + 0x9B98: 0x5C28, + 0x9B99: 0x5C38, + 0x9B9A: 0x5C39, + 0x9B9B: 0x5C41, + 0x9B9C: 0x5C46, + 0x9B9D: 0x5C4E, + 0x9B9E: 0x5C53, + 0x9B9F: 0x5C50, + 0x9BA0: 0x5C4F, + 0x9BA1: 0x5B71, + 0x9BA2: 0x5C6C, + 0x9BA3: 0x5C6E, + 0x9BA4: 0x4E62, + 0x9BA5: 0x5C76, + 0x9BA6: 0x5C79, + 0x9BA7: 0x5C8C, + 0x9BA8: 0x5C91, + 0x9BA9: 0x5C94, + 0x9BAA: 0x599B, + 0x9BAB: 0x5CAB, + 0x9BAC: 0x5CBB, + 0x9BAD: 0x5CB6, + 0x9BAE: 0x5CBC, + 0x9BAF: 0x5CB7, + 0x9BB0: 0x5CC5, + 0x9BB1: 0x5CBE, + 0x9BB2: 0x5CC7, + 0x9BB3: 0x5CD9, + 0x9BB4: 0x5CE9, + 0x9BB5: 0x5CFD, + 0x9BB6: 0x5CFA, + 0x9BB7: 0x5CED, + 0x9BB8: 0x5D8C, + 0x9BB9: 0x5CEA, + 0x9BBA: 0x5D0B, + 0x9BBB: 0x5D15, + 0x9BBC: 0x5D17, + 0x9BBD: 0x5D5C, + 0x9BBE: 0x5D1F, + 0x9BBF: 0x5D1B, + 0x9BC0: 0x5D11, + 0x9BC1: 0x5D14, + 0x9BC2: 0x5D22, + 0x9BC3: 0x5D1A, + 0x9BC4: 0x5D19, + 0x9BC5: 0x5D18, + 0x9BC6: 0x5D4C, + 0x9BC7: 0x5D52, + 0x9BC8: 0x5D4E, + 0x9BC9: 0x5D4B, + 0x9BCA: 0x5D6C, + 0x9BCB: 0x5D73, + 0x9BCC: 0x5D76, + 0x9BCD: 0x5D87, + 0x9BCE: 0x5D84, + 0x9BCF: 0x5D82, + 0x9BD0: 0x5DA2, + 0x9BD1: 0x5D9D, + 0x9BD2: 0x5DAC, + 0x9BD3: 0x5DAE, + 0x9BD4: 0x5DBD, + 0x9BD5: 0x5D90, + 0x9BD6: 0x5DB7, + 0x9BD7: 0x5DBC, + 0x9BD8: 0x5DC9, + 0x9BD9: 0x5DCD, + 0x9BDA: 0x5DD3, + 0x9BDB: 0x5DD2, + 0x9BDC: 0x5DD6, + 0x9BDD: 0x5DDB, + 0x9BDE: 0x5DEB, + 0x9BDF: 0x5DF2, + 0x9BE0: 0x5DF5, + 0x9BE1: 0x5E0B, + 0x9BE2: 0x5E1A, + 0x9BE3: 0x5E19, + 0x9BE4: 0x5E11, + 0x9BE5: 0x5E1B, + 0x9BE6: 0x5E36, + 0x9BE7: 0x5E37, + 0x9BE8: 0x5E44, + 0x9BE9: 0x5E43, + 0x9BEA: 0x5E40, + 0x9BEB: 0x5E4E, + 0x9BEC: 0x5E57, + 0x9BED: 0x5E54, + 0x9BEE: 0x5E5F, + 0x9BEF: 0x5E62, + 0x9BF0: 0x5E64, + 0x9BF1: 0x5E47, + 0x9BF2: 0x5E75, + 0x9BF3: 0x5E76, + 0x9BF4: 0x5E7A, + 0x9BF5: 0x9EBC, + 0x9BF6: 0x5E7F, + 0x9BF7: 0x5EA0, + 0x9BF8: 0x5EC1, + 0x9BF9: 0x5EC2, + 0x9BFA: 0x5EC8, + 0x9BFB: 0x5ED0, + 0x9BFC: 0x5ECF, + 0x9C40: 0x5ED6, + 0x9C41: 0x5EE3, + 0x9C42: 0x5EDD, + 0x9C43: 0x5EDA, + 0x9C44: 0x5EDB, + 0x9C45: 0x5EE2, + 0x9C46: 0x5EE1, + 0x9C47: 0x5EE8, + 0x9C48: 0x5EE9, + 0x9C49: 0x5EEC, + 0x9C4A: 0x5EF1, + 0x9C4B: 0x5EF3, + 0x9C4C: 0x5EF0, + 0x9C4D: 0x5EF4, + 0x9C4E: 0x5EF8, + 0x9C4F: 0x5EFE, + 0x9C50: 0x5F03, + 0x9C51: 0x5F09, + 0x9C52: 0x5F5D, + 0x9C53: 0x5F5C, + 0x9C54: 0x5F0B, + 0x9C55: 0x5F11, + 0x9C56: 0x5F16, + 0x9C57: 0x5F29, + 0x9C58: 0x5F2D, + 0x9C59: 0x5F38, + 0x9C5A: 0x5F41, + 0x9C5B: 0x5F48, + 0x9C5C: 0x5F4C, + 0x9C5D: 0x5F4E, + 0x9C5E: 0x5F2F, + 0x9C5F: 0x5F51, + 0x9C60: 0x5F56, + 0x9C61: 0x5F57, + 0x9C62: 0x5F59, + 0x9C63: 0x5F61, + 0x9C64: 0x5F6D, + 0x9C65: 0x5F73, + 0x9C66: 0x5F77, + 0x9C67: 0x5F83, + 0x9C68: 0x5F82, + 0x9C69: 0x5F7F, + 0x9C6A: 0x5F8A, + 0x9C6B: 0x5F88, + 0x9C6C: 0x5F91, + 0x9C6D: 0x5F87, + 0x9C6E: 0x5F9E, + 0x9C6F: 0x5F99, + 0x9C70: 0x5F98, + 0x9C71: 0x5FA0, + 0x9C72: 0x5FA8, + 0x9C73: 0x5FAD, + 0x9C74: 0x5FBC, + 0x9C75: 0x5FD6, + 0x9C76: 0x5FFB, + 0x9C77: 0x5FE4, + 0x9C78: 0x5FF8, + 0x9C79: 0x5FF1, + 0x9C7A: 0x5FDD, + 0x9C7B: 0x60B3, + 0x9C7C: 0x5FFF, + 0x9C7D: 0x6021, + 0x9C7E: 0x6060, + 0x9C80: 0x6019, + 0x9C81: 0x6010, + 0x9C82: 0x6029, + 0x9C83: 0x600E, + 0x9C84: 0x6031, + 0x9C85: 0x601B, + 0x9C86: 0x6015, + 0x9C87: 0x602B, + 0x9C88: 0x6026, + 0x9C89: 0x600F, + 0x9C8A: 0x603A, + 0x9C8B: 0x605A, + 0x9C8C: 0x6041, + 0x9C8D: 0x606A, + 0x9C8E: 0x6077, + 0x9C8F: 0x605F, + 0x9C90: 0x604A, + 0x9C91: 0x6046, + 0x9C92: 0x604D, + 0x9C93: 0x6063, + 0x9C94: 0x6043, + 0x9C95: 0x6064, + 0x9C96: 0x6042, + 0x9C97: 0x606C, + 0x9C98: 0x606B, + 0x9C99: 0x6059, + 0x9C9A: 0x6081, + 0x9C9B: 0x608D, + 0x9C9C: 0x60E7, + 0x9C9D: 0x6083, + 0x9C9E: 0x609A, + 0x9C9F: 0x6084, + 0x9CA0: 0x609B, + 0x9CA1: 0x6096, + 0x9CA2: 0x6097, + 0x9CA3: 0x6092, + 0x9CA4: 0x60A7, + 0x9CA5: 0x608B, + 0x9CA6: 0x60E1, + 0x9CA7: 0x60B8, + 0x9CA8: 0x60E0, + 0x9CA9: 0x60D3, + 0x9CAA: 0x60B4, + 0x9CAB: 0x5FF0, + 0x9CAC: 0x60BD, + 0x9CAD: 0x60C6, + 0x9CAE: 0x60B5, + 0x9CAF: 0x60D8, + 0x9CB0: 0x614D, + 0x9CB1: 0x6115, + 0x9CB2: 0x6106, + 0x9CB3: 0x60F6, + 0x9CB4: 0x60F7, + 0x9CB5: 0x6100, + 0x9CB6: 0x60F4, + 0x9CB7: 0x60FA, + 0x9CB8: 0x6103, + 0x9CB9: 0x6121, + 0x9CBA: 0x60FB, + 0x9CBB: 0x60F1, + 0x9CBC: 0x610D, + 0x9CBD: 0x610E, + 0x9CBE: 0x6147, + 0x9CBF: 0x613E, + 0x9CC0: 0x6128, + 0x9CC1: 0x6127, + 0x9CC2: 0x614A, + 0x9CC3: 0x613F, + 0x9CC4: 0x613C, + 0x9CC5: 0x612C, + 0x9CC6: 0x6134, + 0x9CC7: 0x613D, + 0x9CC8: 0x6142, + 0x9CC9: 0x6144, + 0x9CCA: 0x6173, + 0x9CCB: 0x6177, + 0x9CCC: 0x6158, + 0x9CCD: 0x6159, + 0x9CCE: 0x615A, + 0x9CCF: 0x616B, + 0x9CD0: 0x6174, + 0x9CD1: 0x616F, + 0x9CD2: 0x6165, + 0x9CD3: 0x6171, + 0x9CD4: 0x615F, + 0x9CD5: 0x615D, + 0x9CD6: 0x6153, + 0x9CD7: 0x6175, + 0x9CD8: 0x6199, + 0x9CD9: 0x6196, + 0x9CDA: 0x6187, + 0x9CDB: 0x61AC, + 0x9CDC: 0x6194, + 0x9CDD: 0x619A, + 0x9CDE: 0x618A, + 0x9CDF: 0x6191, + 0x9CE0: 0x61AB, + 0x9CE1: 0x61AE, + 0x9CE2: 0x61CC, + 0x9CE3: 0x61CA, + 0x9CE4: 0x61C9, + 0x9CE5: 0x61F7, + 0x9CE6: 0x61C8, + 0x9CE7: 0x61C3, + 0x9CE8: 0x61C6, + 0x9CE9: 0x61BA, + 0x9CEA: 0x61CB, + 0x9CEB: 0x7F79, + 0x9CEC: 0x61CD, + 0x9CED: 0x61E6, + 0x9CEE: 0x61E3, + 0x9CEF: 0x61F6, + 0x9CF0: 0x61FA, + 0x9CF1: 0x61F4, + 0x9CF2: 0x61FF, + 0x9CF3: 0x61FD, + 0x9CF4: 0x61FC, + 0x9CF5: 0x61FE, + 0x9CF6: 0x6200, + 0x9CF7: 0x6208, + 0x9CF8: 0x6209, + 0x9CF9: 0x620D, + 0x9CFA: 0x620C, + 0x9CFB: 0x6214, + 0x9CFC: 0x621B, + 0x9D40: 0x621E, + 0x9D41: 0x6221, + 0x9D42: 0x622A, + 0x9D43: 0x622E, + 0x9D44: 0x6230, + 0x9D45: 0x6232, + 0x9D46: 0x6233, + 0x9D47: 0x6241, + 0x9D48: 0x624E, + 0x9D49: 0x625E, + 0x9D4A: 0x6263, + 0x9D4B: 0x625B, + 0x9D4C: 0x6260, + 0x9D4D: 0x6268, + 0x9D4E: 0x627C, + 0x9D4F: 0x6282, + 0x9D50: 0x6289, + 0x9D51: 0x627E, + 0x9D52: 0x6292, + 0x9D53: 0x6293, + 0x9D54: 0x6296, + 0x9D55: 0x62D4, + 0x9D56: 0x6283, + 0x9D57: 0x6294, + 0x9D58: 0x62D7, + 0x9D59: 0x62D1, + 0x9D5A: 0x62BB, + 0x9D5B: 0x62CF, + 0x9D5C: 0x62FF, + 0x9D5D: 0x62C6, + 0x9D5E: 0x64D4, + 0x9D5F: 0x62C8, + 0x9D60: 0x62DC, + 0x9D61: 0x62CC, + 0x9D62: 0x62CA, + 0x9D63: 0x62C2, + 0x9D64: 0x62C7, + 0x9D65: 0x629B, + 0x9D66: 0x62C9, + 0x9D67: 0x630C, + 0x9D68: 0x62EE, + 0x9D69: 0x62F1, + 0x9D6A: 0x6327, + 0x9D6B: 0x6302, + 0x9D6C: 0x6308, + 0x9D6D: 0x62EF, + 0x9D6E: 0x62F5, + 0x9D6F: 0x6350, + 0x9D70: 0x633E, + 0x9D71: 0x634D, + 0x9D72: 0x641C, + 0x9D73: 0x634F, + 0x9D74: 0x6396, + 0x9D75: 0x638E, + 0x9D76: 0x6380, + 0x9D77: 0x63AB, + 0x9D78: 0x6376, + 0x9D79: 0x63A3, + 0x9D7A: 0x638F, + 0x9D7B: 0x6389, + 0x9D7C: 0x639F, + 0x9D7D: 0x63B5, + 0x9D7E: 0x636B, + 0x9D80: 0x6369, + 0x9D81: 0x63BE, + 0x9D82: 0x63E9, + 0x9D83: 0x63C0, + 0x9D84: 0x63C6, + 0x9D85: 0x63E3, + 0x9D86: 0x63C9, + 0x9D87: 0x63D2, + 0x9D88: 0x63F6, + 0x9D89: 0x63C4, + 0x9D8A: 0x6416, + 0x9D8B: 0x6434, + 0x9D8C: 0x6406, + 0x9D8D: 0x6413, + 0x9D8E: 0x6426, + 0x9D8F: 0x6436, + 0x9D90: 0x651D, + 0x9D91: 0x6417, + 0x9D92: 0x6428, + 0x9D93: 0x640F, + 0x9D94: 0x6467, + 0x9D95: 0x646F, + 0x9D96: 0x6476, + 0x9D97: 0x644E, + 0x9D98: 0x652A, + 0x9D99: 0x6495, + 0x9D9A: 0x6493, + 0x9D9B: 0x64A5, + 0x9D9C: 0x64A9, + 0x9D9D: 0x6488, + 0x9D9E: 0x64BC, + 0x9D9F: 0x64DA, + 0x9DA0: 0x64D2, + 0x9DA1: 0x64C5, + 0x9DA2: 0x64C7, + 0x9DA3: 0x64BB, + 0x9DA4: 0x64D8, + 0x9DA5: 0x64C2, + 0x9DA6: 0x64F1, + 0x9DA7: 0x64E7, + 0x9DA8: 0x8209, + 0x9DA9: 0x64E0, + 0x9DAA: 0x64E1, + 0x9DAB: 0x62AC, + 0x9DAC: 0x64E3, + 0x9DAD: 0x64EF, + 0x9DAE: 0x652C, + 0x9DAF: 0x64F6, + 0x9DB0: 0x64F4, + 0x9DB1: 0x64F2, + 0x9DB2: 0x64FA, + 0x9DB3: 0x6500, + 0x9DB4: 0x64FD, + 0x9DB5: 0x6518, + 0x9DB6: 0x651C, + 0x9DB7: 0x6505, + 0x9DB8: 0x6524, + 0x9DB9: 0x6523, + 0x9DBA: 0x652B, + 0x9DBB: 0x6534, + 0x9DBC: 0x6535, + 0x9DBD: 0x6537, + 0x9DBE: 0x6536, + 0x9DBF: 0x6538, + 0x9DC0: 0x754B, + 0x9DC1: 0x6548, + 0x9DC2: 0x6556, + 0x9DC3: 0x6555, + 0x9DC4: 0x654D, + 0x9DC5: 0x6558, + 0x9DC6: 0x655E, + 0x9DC7: 0x655D, + 0x9DC8: 0x6572, + 0x9DC9: 0x6578, + 0x9DCA: 0x6582, + 0x9DCB: 0x6583, + 0x9DCC: 0x8B8A, + 0x9DCD: 0x659B, + 0x9DCE: 0x659F, + 0x9DCF: 0x65AB, + 0x9DD0: 0x65B7, + 0x9DD1: 0x65C3, + 0x9DD2: 0x65C6, + 0x9DD3: 0x65C1, + 0x9DD4: 0x65C4, + 0x9DD5: 0x65CC, + 0x9DD6: 0x65D2, + 0x9DD7: 0x65DB, + 0x9DD8: 0x65D9, + 0x9DD9: 0x65E0, + 0x9DDA: 0x65E1, + 0x9DDB: 0x65F1, + 0x9DDC: 0x6772, + 0x9DDD: 0x660A, + 0x9DDE: 0x6603, + 0x9DDF: 0x65FB, + 0x9DE0: 0x6773, + 0x9DE1: 0x6635, + 0x9DE2: 0x6636, + 0x9DE3: 0x6634, + 0x9DE4: 0x661C, + 0x9DE5: 0x664F, + 0x9DE6: 0x6644, + 0x9DE7: 0x6649, + 0x9DE8: 0x6641, + 0x9DE9: 0x665E, + 0x9DEA: 0x665D, + 0x9DEB: 0x6664, + 0x9DEC: 0x6667, + 0x9DED: 0x6668, + 0x9DEE: 0x665F, + 0x9DEF: 0x6662, + 0x9DF0: 0x6670, + 0x9DF1: 0x6683, + 0x9DF2: 0x6688, + 0x9DF3: 0x668E, + 0x9DF4: 0x6689, + 0x9DF5: 0x6684, + 0x9DF6: 0x6698, + 0x9DF7: 0x669D, + 0x9DF8: 0x66C1, + 0x9DF9: 0x66B9, + 0x9DFA: 0x66C9, + 0x9DFB: 0x66BE, + 0x9DFC: 0x66BC, + 0x9E40: 0x66C4, + 0x9E41: 0x66B8, + 0x9E42: 0x66D6, + 0x9E43: 0x66DA, + 0x9E44: 0x66E0, + 0x9E45: 0x663F, + 0x9E46: 0x66E6, + 0x9E47: 0x66E9, + 0x9E48: 0x66F0, + 0x9E49: 0x66F5, + 0x9E4A: 0x66F7, + 0x9E4B: 0x670F, + 0x9E4C: 0x6716, + 0x9E4D: 0x671E, + 0x9E4E: 0x6726, + 0x9E4F: 0x6727, + 0x9E50: 0x9738, + 0x9E51: 0x672E, + 0x9E52: 0x673F, + 0x9E53: 0x6736, + 0x9E54: 0x6741, + 0x9E55: 0x6738, + 0x9E56: 0x6737, + 0x9E57: 0x6746, + 0x9E58: 0x675E, + 0x9E59: 0x6760, + 0x9E5A: 0x6759, + 0x9E5B: 0x6763, + 0x9E5C: 0x6764, + 0x9E5D: 0x6789, + 0x9E5E: 0x6770, + 0x9E5F: 0x67A9, + 0x9E60: 0x677C, + 0x9E61: 0x676A, + 0x9E62: 0x678C, + 0x9E63: 0x678B, + 0x9E64: 0x67A6, + 0x9E65: 0x67A1, + 0x9E66: 0x6785, + 0x9E67: 0x67B7, + 0x9E68: 0x67EF, + 0x9E69: 0x67B4, + 0x9E6A: 0x67EC, + 0x9E6B: 0x67B3, + 0x9E6C: 0x67E9, + 0x9E6D: 0x67B8, + 0x9E6E: 0x67E4, + 0x9E6F: 0x67DE, + 0x9E70: 0x67DD, + 0x9E71: 0x67E2, + 0x9E72: 0x67EE, + 0x9E73: 0x67B9, + 0x9E74: 0x67CE, + 0x9E75: 0x67C6, + 0x9E76: 0x67E7, + 0x9E77: 0x6A9C, + 0x9E78: 0x681E, + 0x9E79: 0x6846, + 0x9E7A: 0x6829, + 0x9E7B: 0x6840, + 0x9E7C: 0x684D, + 0x9E7D: 0x6832, + 0x9E7E: 0x684E, + 0x9E80: 0x68B3, + 0x9E81: 0x682B, + 0x9E82: 0x6859, + 0x9E83: 0x6863, + 0x9E84: 0x6877, + 0x9E85: 0x687F, + 0x9E86: 0x689F, + 0x9E87: 0x688F, + 0x9E88: 0x68AD, + 0x9E89: 0x6894, + 0x9E8A: 0x689D, + 0x9E8B: 0x689B, + 0x9E8C: 0x6883, + 0x9E8D: 0x6AAE, + 0x9E8E: 0x68B9, + 0x9E8F: 0x6874, + 0x9E90: 0x68B5, + 0x9E91: 0x68A0, + 0x9E92: 0x68BA, + 0x9E93: 0x690F, + 0x9E94: 0x688D, + 0x9E95: 0x687E, + 0x9E96: 0x6901, + 0x9E97: 0x68CA, + 0x9E98: 0x6908, + 0x9E99: 0x68D8, + 0x9E9A: 0x6922, + 0x9E9B: 0x6926, + 0x9E9C: 0x68E1, + 0x9E9D: 0x690C, + 0x9E9E: 0x68CD, + 0x9E9F: 0x68D4, + 0x9EA0: 0x68E7, + 0x9EA1: 0x68D5, + 0x9EA2: 0x6936, + 0x9EA3: 0x6912, + 0x9EA4: 0x6904, + 0x9EA5: 0x68D7, + 0x9EA6: 0x68E3, + 0x9EA7: 0x6925, + 0x9EA8: 0x68F9, + 0x9EA9: 0x68E0, + 0x9EAA: 0x68EF, + 0x9EAB: 0x6928, + 0x9EAC: 0x692A, + 0x9EAD: 0x691A, + 0x9EAE: 0x6923, + 0x9EAF: 0x6921, + 0x9EB0: 0x68C6, + 0x9EB1: 0x6979, + 0x9EB2: 0x6977, + 0x9EB3: 0x695C, + 0x9EB4: 0x6978, + 0x9EB5: 0x696B, + 0x9EB6: 0x6954, + 0x9EB7: 0x697E, + 0x9EB8: 0x696E, + 0x9EB9: 0x6939, + 0x9EBA: 0x6974, + 0x9EBB: 0x693D, + 0x9EBC: 0x6959, + 0x9EBD: 0x6930, + 0x9EBE: 0x6961, + 0x9EBF: 0x695E, + 0x9EC0: 0x695D, + 0x9EC1: 0x6981, + 0x9EC2: 0x696A, + 0x9EC3: 0x69B2, + 0x9EC4: 0x69AE, + 0x9EC5: 0x69D0, + 0x9EC6: 0x69BF, + 0x9EC7: 0x69C1, + 0x9EC8: 0x69D3, + 0x9EC9: 0x69BE, + 0x9ECA: 0x69CE, + 0x9ECB: 0x5BE8, + 0x9ECC: 0x69CA, + 0x9ECD: 0x69DD, + 0x9ECE: 0x69BB, + 0x9ECF: 0x69C3, + 0x9ED0: 0x69A7, + 0x9ED1: 0x6A2E, + 0x9ED2: 0x6991, + 0x9ED3: 0x69A0, + 0x9ED4: 0x699C, + 0x9ED5: 0x6995, + 0x9ED6: 0x69B4, + 0x9ED7: 0x69DE, + 0x9ED8: 0x69E8, + 0x9ED9: 0x6A02, + 0x9EDA: 0x6A1B, + 0x9EDB: 0x69FF, + 0x9EDC: 0x6B0A, + 0x9EDD: 0x69F9, + 0x9EDE: 0x69F2, + 0x9EDF: 0x69E7, + 0x9EE0: 0x6A05, + 0x9EE1: 0x69B1, + 0x9EE2: 0x6A1E, + 0x9EE3: 0x69ED, + 0x9EE4: 0x6A14, + 0x9EE5: 0x69EB, + 0x9EE6: 0x6A0A, + 0x9EE7: 0x6A12, + 0x9EE8: 0x6AC1, + 0x9EE9: 0x6A23, + 0x9EEA: 0x6A13, + 0x9EEB: 0x6A44, + 0x9EEC: 0x6A0C, + 0x9EED: 0x6A72, + 0x9EEE: 0x6A36, + 0x9EEF: 0x6A78, + 0x9EF0: 0x6A47, + 0x9EF1: 0x6A62, + 0x9EF2: 0x6A59, + 0x9EF3: 0x6A66, + 0x9EF4: 0x6A48, + 0x9EF5: 0x6A38, + 0x9EF6: 0x6A22, + 0x9EF7: 0x6A90, + 0x9EF8: 0x6A8D, + 0x9EF9: 0x6AA0, + 0x9EFA: 0x6A84, + 0x9EFB: 0x6AA2, + 0x9EFC: 0x6AA3, + 0x9F40: 0x6A97, + 0x9F41: 0x8617, + 0x9F42: 0x6ABB, + 0x9F43: 0x6AC3, + 0x9F44: 0x6AC2, + 0x9F45: 0x6AB8, + 0x9F46: 0x6AB3, + 0x9F47: 0x6AAC, + 0x9F48: 0x6ADE, + 0x9F49: 0x6AD1, + 0x9F4A: 0x6ADF, + 0x9F4B: 0x6AAA, + 0x9F4C: 0x6ADA, + 0x9F4D: 0x6AEA, + 0x9F4E: 0x6AFB, + 0x9F4F: 0x6B05, + 0x9F50: 0x8616, + 0x9F51: 0x6AFA, + 0x9F52: 0x6B12, + 0x9F53: 0x6B16, + 0x9F54: 0x9B31, + 0x9F55: 0x6B1F, + 0x9F56: 0x6B38, + 0x9F57: 0x6B37, + 0x9F58: 0x76DC, + 0x9F59: 0x6B39, + 0x9F5A: 0x98EE, + 0x9F5B: 0x6B47, + 0x9F5C: 0x6B43, + 0x9F5D: 0x6B49, + 0x9F5E: 0x6B50, + 0x9F5F: 0x6B59, + 0x9F60: 0x6B54, + 0x9F61: 0x6B5B, + 0x9F62: 0x6B5F, + 0x9F63: 0x6B61, + 0x9F64: 0x6B78, + 0x9F65: 0x6B79, + 0x9F66: 0x6B7F, + 0x9F67: 0x6B80, + 0x9F68: 0x6B84, + 0x9F69: 0x6B83, + 0x9F6A: 0x6B8D, + 0x9F6B: 0x6B98, + 0x9F6C: 0x6B95, + 0x9F6D: 0x6B9E, + 0x9F6E: 0x6BA4, + 0x9F6F: 0x6BAA, + 0x9F70: 0x6BAB, + 0x9F71: 0x6BAF, + 0x9F72: 0x6BB2, + 0x9F73: 0x6BB1, + 0x9F74: 0x6BB3, + 0x9F75: 0x6BB7, + 0x9F76: 0x6BBC, + 0x9F77: 0x6BC6, + 0x9F78: 0x6BCB, + 0x9F79: 0x6BD3, + 0x9F7A: 0x6BDF, + 0x9F7B: 0x6BEC, + 0x9F7C: 0x6BEB, + 0x9F7D: 0x6BF3, + 0x9F7E: 0x6BEF, + 0x9F80: 0x9EBE, + 0x9F81: 0x6C08, + 0x9F82: 0x6C13, + 0x9F83: 0x6C14, + 0x9F84: 0x6C1B, + 0x9F85: 0x6C24, + 0x9F86: 0x6C23, + 0x9F87: 0x6C5E, + 0x9F88: 0x6C55, + 0x9F89: 0x6C62, + 0x9F8A: 0x6C6A, + 0x9F8B: 0x6C82, + 0x9F8C: 0x6C8D, + 0x9F8D: 0x6C9A, + 0x9F8E: 0x6C81, + 0x9F8F: 0x6C9B, + 0x9F90: 0x6C7E, + 0x9F91: 0x6C68, + 0x9F92: 0x6C73, + 0x9F93: 0x6C92, + 0x9F94: 0x6C90, + 0x9F95: 0x6CC4, + 0x9F96: 0x6CF1, + 0x9F97: 0x6CD3, + 0x9F98: 0x6CBD, + 0x9F99: 0x6CD7, + 0x9F9A: 0x6CC5, + 0x9F9B: 0x6CDD, + 0x9F9C: 0x6CAE, + 0x9F9D: 0x6CB1, + 0x9F9E: 0x6CBE, + 0x9F9F: 0x6CBA, + 0x9FA0: 0x6CDB, + 0x9FA1: 0x6CEF, + 0x9FA2: 0x6CD9, + 0x9FA3: 0x6CEA, + 0x9FA4: 0x6D1F, + 0x9FA5: 0x884D, + 0x9FA6: 0x6D36, + 0x9FA7: 0x6D2B, + 0x9FA8: 0x6D3D, + 0x9FA9: 0x6D38, + 0x9FAA: 0x6D19, + 0x9FAB: 0x6D35, + 0x9FAC: 0x6D33, + 0x9FAD: 0x6D12, + 0x9FAE: 0x6D0C, + 0x9FAF: 0x6D63, + 0x9FB0: 0x6D93, + 0x9FB1: 0x6D64, + 0x9FB2: 0x6D5A, + 0x9FB3: 0x6D79, + 0x9FB4: 0x6D59, + 0x9FB5: 0x6D8E, + 0x9FB6: 0x6D95, + 0x9FB7: 0x6FE4, + 0x9FB8: 0x6D85, + 0x9FB9: 0x6DF9, + 0x9FBA: 0x6E15, + 0x9FBB: 0x6E0A, + 0x9FBC: 0x6DB5, + 0x9FBD: 0x6DC7, + 0x9FBE: 0x6DE6, + 0x9FBF: 0x6DB8, + 0x9FC0: 0x6DC6, + 0x9FC1: 0x6DEC, + 0x9FC2: 0x6DDE, + 0x9FC3: 0x6DCC, + 0x9FC4: 0x6DE8, + 0x9FC5: 0x6DD2, + 0x9FC6: 0x6DC5, + 0x9FC7: 0x6DFA, + 0x9FC8: 0x6DD9, + 0x9FC9: 0x6DE4, + 0x9FCA: 0x6DD5, + 0x9FCB: 0x6DEA, + 0x9FCC: 0x6DEE, + 0x9FCD: 0x6E2D, + 0x9FCE: 0x6E6E, + 0x9FCF: 0x6E2E, + 0x9FD0: 0x6E19, + 0x9FD1: 0x6E72, + 0x9FD2: 0x6E5F, + 0x9FD3: 0x6E3E, + 0x9FD4: 0x6E23, + 0x9FD5: 0x6E6B, + 0x9FD6: 0x6E2B, + 0x9FD7: 0x6E76, + 0x9FD8: 0x6E4D, + 0x9FD9: 0x6E1F, + 0x9FDA: 0x6E43, + 0x9FDB: 0x6E3A, + 0x9FDC: 0x6E4E, + 0x9FDD: 0x6E24, + 0x9FDE: 0x6EFF, + 0x9FDF: 0x6E1D, + 0x9FE0: 0x6E38, + 0x9FE1: 0x6E82, + 0x9FE2: 0x6EAA, + 0x9FE3: 0x6E98, + 0x9FE4: 0x6EC9, + 0x9FE5: 0x6EB7, + 0x9FE6: 0x6ED3, + 0x9FE7: 0x6EBD, + 0x9FE8: 0x6EAF, + 0x9FE9: 0x6EC4, + 0x9FEA: 0x6EB2, + 0x9FEB: 0x6ED4, + 0x9FEC: 0x6ED5, + 0x9FED: 0x6E8F, + 0x9FEE: 0x6EA5, + 0x9FEF: 0x6EC2, + 0x9FF0: 0x6E9F, + 0x9FF1: 0x6F41, + 0x9FF2: 0x6F11, + 0x9FF3: 0x704C, + 0x9FF4: 0x6EEC, + 0x9FF5: 0x6EF8, + 0x9FF6: 0x6EFE, + 0x9FF7: 0x6F3F, + 0x9FF8: 0x6EF2, + 0x9FF9: 0x6F31, + 0x9FFA: 0x6EEF, + 0x9FFB: 0x6F32, + 0x9FFC: 0x6ECC, + 0xA1: 0xFF61, + 0xA2: 0xFF62, + 0xA3: 0xFF63, + 0xA4: 0xFF64, + 0xA5: 0xFF65, + 0xA6: 0xFF66, + 0xA7: 0xFF67, + 0xA8: 0xFF68, + 0xA9: 0xFF69, + 0xAA: 0xFF6A, + 0xAB: 0xFF6B, + 0xAC: 0xFF6C, + 0xAD: 0xFF6D, + 0xAE: 0xFF6E, + 0xAF: 0xFF6F, + 0xB0: 0xFF70, + 0xB1: 0xFF71, + 0xB2: 0xFF72, + 0xB3: 0xFF73, + 0xB4: 0xFF74, + 0xB5: 0xFF75, + 0xB6: 0xFF76, + 0xB7: 0xFF77, + 0xB8: 0xFF78, + 0xB9: 0xFF79, + 0xBA: 0xFF7A, + 0xBB: 0xFF7B, + 0xBC: 0xFF7C, + 0xBD: 0xFF7D, + 0xBE: 0xFF7E, + 0xBF: 0xFF7F, + 0xC0: 0xFF80, + 0xC1: 0xFF81, + 0xC2: 0xFF82, + 0xC3: 0xFF83, + 0xC4: 0xFF84, + 0xC5: 0xFF85, + 0xC6: 0xFF86, + 0xC7: 0xFF87, + 0xC8: 0xFF88, + 0xC9: 0xFF89, + 0xCA: 0xFF8A, + 0xCB: 0xFF8B, + 0xCC: 0xFF8C, + 0xCD: 0xFF8D, + 0xCE: 0xFF8E, + 0xCF: 0xFF8F, + 0xD0: 0xFF90, + 0xD1: 0xFF91, + 0xD2: 0xFF92, + 0xD3: 0xFF93, + 0xD4: 0xFF94, + 0xD5: 0xFF95, + 0xD6: 0xFF96, + 0xD7: 0xFF97, + 0xD8: 0xFF98, + 0xD9: 0xFF99, + 0xDA: 0xFF9A, + 0xDB: 0xFF9B, + 0xDC: 0xFF9C, + 0xDD: 0xFF9D, + 0xDE: 0xFF9E, + 0xDF: 0xFF9F, + 0xE040: 0x6F3E, + 0xE041: 0x6F13, + 0xE042: 0x6EF7, + 0xE043: 0x6F86, + 0xE044: 0x6F7A, + 0xE045: 0x6F78, + 0xE046: 0x6F81, + 0xE047: 0x6F80, + 0xE048: 0x6F6F, + 0xE049: 0x6F5B, + 0xE04A: 0x6FF3, + 0xE04B: 0x6F6D, + 0xE04C: 0x6F82, + 0xE04D: 0x6F7C, + 0xE04E: 0x6F58, + 0xE04F: 0x6F8E, + 0xE050: 0x6F91, + 0xE051: 0x6FC2, + 0xE052: 0x6F66, + 0xE053: 0x6FB3, + 0xE054: 0x6FA3, + 0xE055: 0x6FA1, + 0xE056: 0x6FA4, + 0xE057: 0x6FB9, + 0xE058: 0x6FC6, + 0xE059: 0x6FAA, + 0xE05A: 0x6FDF, + 0xE05B: 0x6FD5, + 0xE05C: 0x6FEC, + 0xE05D: 0x6FD4, + 0xE05E: 0x6FD8, + 0xE05F: 0x6FF1, + 0xE060: 0x6FEE, + 0xE061: 0x6FDB, + 0xE062: 0x7009, + 0xE063: 0x700B, + 0xE064: 0x6FFA, + 0xE065: 0x7011, + 0xE066: 0x7001, + 0xE067: 0x700F, + 0xE068: 0x6FFE, + 0xE069: 0x701B, + 0xE06A: 0x701A, + 0xE06B: 0x6F74, + 0xE06C: 0x701D, + 0xE06D: 0x7018, + 0xE06E: 0x701F, + 0xE06F: 0x7030, + 0xE070: 0x703E, + 0xE071: 0x7032, + 0xE072: 0x7051, + 0xE073: 0x7063, + 0xE074: 0x7099, + 0xE075: 0x7092, + 0xE076: 0x70AF, + 0xE077: 0x70F1, + 0xE078: 0x70AC, + 0xE079: 0x70B8, + 0xE07A: 0x70B3, + 0xE07B: 0x70AE, + 0xE07C: 0x70DF, + 0xE07D: 0x70CB, + 0xE07E: 0x70DD, + 0xE080: 0x70D9, + 0xE081: 0x7109, + 0xE082: 0x70FD, + 0xE083: 0x711C, + 0xE084: 0x7119, + 0xE085: 0x7165, + 0xE086: 0x7155, + 0xE087: 0x7188, + 0xE088: 0x7166, + 0xE089: 0x7162, + 0xE08A: 0x714C, + 0xE08B: 0x7156, + 0xE08C: 0x716C, + 0xE08D: 0x718F, + 0xE08E: 0x71FB, + 0xE08F: 0x7184, + 0xE090: 0x7195, + 0xE091: 0x71A8, + 0xE092: 0x71AC, + 0xE093: 0x71D7, + 0xE094: 0x71B9, + 0xE095: 0x71BE, + 0xE096: 0x71D2, + 0xE097: 0x71C9, + 0xE098: 0x71D4, + 0xE099: 0x71CE, + 0xE09A: 0x71E0, + 0xE09B: 0x71EC, + 0xE09C: 0x71E7, + 0xE09D: 0x71F5, + 0xE09E: 0x71FC, + 0xE09F: 0x71F9, + 0xE0A0: 0x71FF, + 0xE0A1: 0x720D, + 0xE0A2: 0x7210, + 0xE0A3: 0x721B, + 0xE0A4: 0x7228, + 0xE0A5: 0x722D, + 0xE0A6: 0x722C, + 0xE0A7: 0x7230, + 0xE0A8: 0x7232, + 0xE0A9: 0x723B, + 0xE0AA: 0x723C, + 0xE0AB: 0x723F, + 0xE0AC: 0x7240, + 0xE0AD: 0x7246, + 0xE0AE: 0x724B, + 0xE0AF: 0x7258, + 0xE0B0: 0x7274, + 0xE0B1: 0x727E, + 0xE0B2: 0x7282, + 0xE0B3: 0x7281, + 0xE0B4: 0x7287, + 0xE0B5: 0x7292, + 0xE0B6: 0x7296, + 0xE0B7: 0x72A2, + 0xE0B8: 0x72A7, + 0xE0B9: 0x72B9, + 0xE0BA: 0x72B2, + 0xE0BB: 0x72C3, + 0xE0BC: 0x72C6, + 0xE0BD: 0x72C4, + 0xE0BE: 0x72CE, + 0xE0BF: 0x72D2, + 0xE0C0: 0x72E2, + 0xE0C1: 0x72E0, + 0xE0C2: 0x72E1, + 0xE0C3: 0x72F9, + 0xE0C4: 0x72F7, + 0xE0C5: 0x500F, + 0xE0C6: 0x7317, + 0xE0C7: 0x730A, + 0xE0C8: 0x731C, + 0xE0C9: 0x7316, + 0xE0CA: 0x731D, + 0xE0CB: 0x7334, + 0xE0CC: 0x732F, + 0xE0CD: 0x7329, + 0xE0CE: 0x7325, + 0xE0CF: 0x733E, + 0xE0D0: 0x734E, + 0xE0D1: 0x734F, + 0xE0D2: 0x9ED8, + 0xE0D3: 0x7357, + 0xE0D4: 0x736A, + 0xE0D5: 0x7368, + 0xE0D6: 0x7370, + 0xE0D7: 0x7378, + 0xE0D8: 0x7375, + 0xE0D9: 0x737B, + 0xE0DA: 0x737A, + 0xE0DB: 0x73C8, + 0xE0DC: 0x73B3, + 0xE0DD: 0x73CE, + 0xE0DE: 0x73BB, + 0xE0DF: 0x73C0, + 0xE0E0: 0x73E5, + 0xE0E1: 0x73EE, + 0xE0E2: 0x73DE, + 0xE0E3: 0x74A2, + 0xE0E4: 0x7405, + 0xE0E5: 0x746F, + 0xE0E6: 0x7425, + 0xE0E7: 0x73F8, + 0xE0E8: 0x7432, + 0xE0E9: 0x743A, + 0xE0EA: 0x7455, + 0xE0EB: 0x743F, + 0xE0EC: 0x745F, + 0xE0ED: 0x7459, + 0xE0EE: 0x7441, + 0xE0EF: 0x745C, + 0xE0F0: 0x7469, + 0xE0F1: 0x7470, + 0xE0F2: 0x7463, + 0xE0F3: 0x746A, + 0xE0F4: 0x7476, + 0xE0F5: 0x747E, + 0xE0F6: 0x748B, + 0xE0F7: 0x749E, + 0xE0F8: 0x74A7, + 0xE0F9: 0x74CA, + 0xE0FA: 0x74CF, + 0xE0FB: 0x74D4, + 0xE0FC: 0x73F1, + 0xE140: 0x74E0, + 0xE141: 0x74E3, + 0xE142: 0x74E7, + 0xE143: 0x74E9, + 0xE144: 0x74EE, + 0xE145: 0x74F2, + 0xE146: 0x74F0, + 0xE147: 0x74F1, + 0xE148: 0x74F8, + 0xE149: 0x74F7, + 0xE14A: 0x7504, + 0xE14B: 0x7503, + 0xE14C: 0x7505, + 0xE14D: 0x750C, + 0xE14E: 0x750E, + 0xE14F: 0x750D, + 0xE150: 0x7515, + 0xE151: 0x7513, + 0xE152: 0x751E, + 0xE153: 0x7526, + 0xE154: 0x752C, + 0xE155: 0x753C, + 0xE156: 0x7544, + 0xE157: 0x754D, + 0xE158: 0x754A, + 0xE159: 0x7549, + 0xE15A: 0x755B, + 0xE15B: 0x7546, + 0xE15C: 0x755A, + 0xE15D: 0x7569, + 0xE15E: 0x7564, + 0xE15F: 0x7567, + 0xE160: 0x756B, + 0xE161: 0x756D, + 0xE162: 0x7578, + 0xE163: 0x7576, + 0xE164: 0x7586, + 0xE165: 0x7587, + 0xE166: 0x7574, + 0xE167: 0x758A, + 0xE168: 0x7589, + 0xE169: 0x7582, + 0xE16A: 0x7594, + 0xE16B: 0x759A, + 0xE16C: 0x759D, + 0xE16D: 0x75A5, + 0xE16E: 0x75A3, + 0xE16F: 0x75C2, + 0xE170: 0x75B3, + 0xE171: 0x75C3, + 0xE172: 0x75B5, + 0xE173: 0x75BD, + 0xE174: 0x75B8, + 0xE175: 0x75BC, + 0xE176: 0x75B1, + 0xE177: 0x75CD, + 0xE178: 0x75CA, + 0xE179: 0x75D2, + 0xE17A: 0x75D9, + 0xE17B: 0x75E3, + 0xE17C: 0x75DE, + 0xE17D: 0x75FE, + 0xE17E: 0x75FF, + 0xE180: 0x75FC, + 0xE181: 0x7601, + 0xE182: 0x75F0, + 0xE183: 0x75FA, + 0xE184: 0x75F2, + 0xE185: 0x75F3, + 0xE186: 0x760B, + 0xE187: 0x760D, + 0xE188: 0x7609, + 0xE189: 0x761F, + 0xE18A: 0x7627, + 0xE18B: 0x7620, + 0xE18C: 0x7621, + 0xE18D: 0x7622, + 0xE18E: 0x7624, + 0xE18F: 0x7634, + 0xE190: 0x7630, + 0xE191: 0x763B, + 0xE192: 0x7647, + 0xE193: 0x7648, + 0xE194: 0x7646, + 0xE195: 0x765C, + 0xE196: 0x7658, + 0xE197: 0x7661, + 0xE198: 0x7662, + 0xE199: 0x7668, + 0xE19A: 0x7669, + 0xE19B: 0x766A, + 0xE19C: 0x7667, + 0xE19D: 0x766C, + 0xE19E: 0x7670, + 0xE19F: 0x7672, + 0xE1A0: 0x7676, + 0xE1A1: 0x7678, + 0xE1A2: 0x767C, + 0xE1A3: 0x7680, + 0xE1A4: 0x7683, + 0xE1A5: 0x7688, + 0xE1A6: 0x768B, + 0xE1A7: 0x768E, + 0xE1A8: 0x7696, + 0xE1A9: 0x7693, + 0xE1AA: 0x7699, + 0xE1AB: 0x769A, + 0xE1AC: 0x76B0, + 0xE1AD: 0x76B4, + 0xE1AE: 0x76B8, + 0xE1AF: 0x76B9, + 0xE1B0: 0x76BA, + 0xE1B1: 0x76C2, + 0xE1B2: 0x76CD, + 0xE1B3: 0x76D6, + 0xE1B4: 0x76D2, + 0xE1B5: 0x76DE, + 0xE1B6: 0x76E1, + 0xE1B7: 0x76E5, + 0xE1B8: 0x76E7, + 0xE1B9: 0x76EA, + 0xE1BA: 0x862F, + 0xE1BB: 0x76FB, + 0xE1BC: 0x7708, + 0xE1BD: 0x7707, + 0xE1BE: 0x7704, + 0xE1BF: 0x7729, + 0xE1C0: 0x7724, + 0xE1C1: 0x771E, + 0xE1C2: 0x7725, + 0xE1C3: 0x7726, + 0xE1C4: 0x771B, + 0xE1C5: 0x7737, + 0xE1C6: 0x7738, + 0xE1C7: 0x7747, + 0xE1C8: 0x775A, + 0xE1C9: 0x7768, + 0xE1CA: 0x776B, + 0xE1CB: 0x775B, + 0xE1CC: 0x7765, + 0xE1CD: 0x777F, + 0xE1CE: 0x777E, + 0xE1CF: 0x7779, + 0xE1D0: 0x778E, + 0xE1D1: 0x778B, + 0xE1D2: 0x7791, + 0xE1D3: 0x77A0, + 0xE1D4: 0x779E, + 0xE1D5: 0x77B0, + 0xE1D6: 0x77B6, + 0xE1D7: 0x77B9, + 0xE1D8: 0x77BF, + 0xE1D9: 0x77BC, + 0xE1DA: 0x77BD, + 0xE1DB: 0x77BB, + 0xE1DC: 0x77C7, + 0xE1DD: 0x77CD, + 0xE1DE: 0x77D7, + 0xE1DF: 0x77DA, + 0xE1E0: 0x77DC, + 0xE1E1: 0x77E3, + 0xE1E2: 0x77EE, + 0xE1E3: 0x77FC, + 0xE1E4: 0x780C, + 0xE1E5: 0x7812, + 0xE1E6: 0x7926, + 0xE1E7: 0x7820, + 0xE1E8: 0x792A, + 0xE1E9: 0x7845, + 0xE1EA: 0x788E, + 0xE1EB: 0x7874, + 0xE1EC: 0x7886, + 0xE1ED: 0x787C, + 0xE1EE: 0x789A, + 0xE1EF: 0x788C, + 0xE1F0: 0x78A3, + 0xE1F1: 0x78B5, + 0xE1F2: 0x78AA, + 0xE1F3: 0x78AF, + 0xE1F4: 0x78D1, + 0xE1F5: 0x78C6, + 0xE1F6: 0x78CB, + 0xE1F7: 0x78D4, + 0xE1F8: 0x78BE, + 0xE1F9: 0x78BC, + 0xE1FA: 0x78C5, + 0xE1FB: 0x78CA, + 0xE1FC: 0x78EC, + 0xE240: 0x78E7, + 0xE241: 0x78DA, + 0xE242: 0x78FD, + 0xE243: 0x78F4, + 0xE244: 0x7907, + 0xE245: 0x7912, + 0xE246: 0x7911, + 0xE247: 0x7919, + 0xE248: 0x792C, + 0xE249: 0x792B, + 0xE24A: 0x7940, + 0xE24B: 0x7960, + 0xE24C: 0x7957, + 0xE24D: 0x795F, + 0xE24E: 0x795A, + 0xE24F: 0x7955, + 0xE250: 0x7953, + 0xE251: 0x797A, + 0xE252: 0x797F, + 0xE253: 0x798A, + 0xE254: 0x799D, + 0xE255: 0x79A7, + 0xE256: 0x9F4B, + 0xE257: 0x79AA, + 0xE258: 0x79AE, + 0xE259: 0x79B3, + 0xE25A: 0x79B9, + 0xE25B: 0x79BA, + 0xE25C: 0x79C9, + 0xE25D: 0x79D5, + 0xE25E: 0x79E7, + 0xE25F: 0x79EC, + 0xE260: 0x79E1, + 0xE261: 0x79E3, + 0xE262: 0x7A08, + 0xE263: 0x7A0D, + 0xE264: 0x7A18, + 0xE265: 0x7A19, + 0xE266: 0x7A20, + 0xE267: 0x7A1F, + 0xE268: 0x7980, + 0xE269: 0x7A31, + 0xE26A: 0x7A3B, + 0xE26B: 0x7A3E, + 0xE26C: 0x7A37, + 0xE26D: 0x7A43, + 0xE26E: 0x7A57, + 0xE26F: 0x7A49, + 0xE270: 0x7A61, + 0xE271: 0x7A62, + 0xE272: 0x7A69, + 0xE273: 0x9F9D, + 0xE274: 0x7A70, + 0xE275: 0x7A79, + 0xE276: 0x7A7D, + 0xE277: 0x7A88, + 0xE278: 0x7A97, + 0xE279: 0x7A95, + 0xE27A: 0x7A98, + 0xE27B: 0x7A96, + 0xE27C: 0x7AA9, + 0xE27D: 0x7AC8, + 0xE27E: 0x7AB0, + 0xE280: 0x7AB6, + 0xE281: 0x7AC5, + 0xE282: 0x7AC4, + 0xE283: 0x7ABF, + 0xE284: 0x9083, + 0xE285: 0x7AC7, + 0xE286: 0x7ACA, + 0xE287: 0x7ACD, + 0xE288: 0x7ACF, + 0xE289: 0x7AD5, + 0xE28A: 0x7AD3, + 0xE28B: 0x7AD9, + 0xE28C: 0x7ADA, + 0xE28D: 0x7ADD, + 0xE28E: 0x7AE1, + 0xE28F: 0x7AE2, + 0xE290: 0x7AE6, + 0xE291: 0x7AED, + 0xE292: 0x7AF0, + 0xE293: 0x7B02, + 0xE294: 0x7B0F, + 0xE295: 0x7B0A, + 0xE296: 0x7B06, + 0xE297: 0x7B33, + 0xE298: 0x7B18, + 0xE299: 0x7B19, + 0xE29A: 0x7B1E, + 0xE29B: 0x7B35, + 0xE29C: 0x7B28, + 0xE29D: 0x7B36, + 0xE29E: 0x7B50, + 0xE29F: 0x7B7A, + 0xE2A0: 0x7B04, + 0xE2A1: 0x7B4D, + 0xE2A2: 0x7B0B, + 0xE2A3: 0x7B4C, + 0xE2A4: 0x7B45, + 0xE2A5: 0x7B75, + 0xE2A6: 0x7B65, + 0xE2A7: 0x7B74, + 0xE2A8: 0x7B67, + 0xE2A9: 0x7B70, + 0xE2AA: 0x7B71, + 0xE2AB: 0x7B6C, + 0xE2AC: 0x7B6E, + 0xE2AD: 0x7B9D, + 0xE2AE: 0x7B98, + 0xE2AF: 0x7B9F, + 0xE2B0: 0x7B8D, + 0xE2B1: 0x7B9C, + 0xE2B2: 0x7B9A, + 0xE2B3: 0x7B8B, + 0xE2B4: 0x7B92, + 0xE2B5: 0x7B8F, + 0xE2B6: 0x7B5D, + 0xE2B7: 0x7B99, + 0xE2B8: 0x7BCB, + 0xE2B9: 0x7BC1, + 0xE2BA: 0x7BCC, + 0xE2BB: 0x7BCF, + 0xE2BC: 0x7BB4, + 0xE2BD: 0x7BC6, + 0xE2BE: 0x7BDD, + 0xE2BF: 0x7BE9, + 0xE2C0: 0x7C11, + 0xE2C1: 0x7C14, + 0xE2C2: 0x7BE6, + 0xE2C3: 0x7BE5, + 0xE2C4: 0x7C60, + 0xE2C5: 0x7C00, + 0xE2C6: 0x7C07, + 0xE2C7: 0x7C13, + 0xE2C8: 0x7BF3, + 0xE2C9: 0x7BF7, + 0xE2CA: 0x7C17, + 0xE2CB: 0x7C0D, + 0xE2CC: 0x7BF6, + 0xE2CD: 0x7C23, + 0xE2CE: 0x7C27, + 0xE2CF: 0x7C2A, + 0xE2D0: 0x7C1F, + 0xE2D1: 0x7C37, + 0xE2D2: 0x7C2B, + 0xE2D3: 0x7C3D, + 0xE2D4: 0x7C4C, + 0xE2D5: 0x7C43, + 0xE2D6: 0x7C54, + 0xE2D7: 0x7C4F, + 0xE2D8: 0x7C40, + 0xE2D9: 0x7C50, + 0xE2DA: 0x7C58, + 0xE2DB: 0x7C5F, + 0xE2DC: 0x7C64, + 0xE2DD: 0x7C56, + 0xE2DE: 0x7C65, + 0xE2DF: 0x7C6C, + 0xE2E0: 0x7C75, + 0xE2E1: 0x7C83, + 0xE2E2: 0x7C90, + 0xE2E3: 0x7CA4, + 0xE2E4: 0x7CAD, + 0xE2E5: 0x7CA2, + 0xE2E6: 0x7CAB, + 0xE2E7: 0x7CA1, + 0xE2E8: 0x7CA8, + 0xE2E9: 0x7CB3, + 0xE2EA: 0x7CB2, + 0xE2EB: 0x7CB1, + 0xE2EC: 0x7CAE, + 0xE2ED: 0x7CB9, + 0xE2EE: 0x7CBD, + 0xE2EF: 0x7CC0, + 0xE2F0: 0x7CC5, + 0xE2F1: 0x7CC2, + 0xE2F2: 0x7CD8, + 0xE2F3: 0x7CD2, + 0xE2F4: 0x7CDC, + 0xE2F5: 0x7CE2, + 0xE2F6: 0x9B3B, + 0xE2F7: 0x7CEF, + 0xE2F8: 0x7CF2, + 0xE2F9: 0x7CF4, + 0xE2FA: 0x7CF6, + 0xE2FB: 0x7CFA, + 0xE2FC: 0x7D06, + 0xE340: 0x7D02, + 0xE341: 0x7D1C, + 0xE342: 0x7D15, + 0xE343: 0x7D0A, + 0xE344: 0x7D45, + 0xE345: 0x7D4B, + 0xE346: 0x7D2E, + 0xE347: 0x7D32, + 0xE348: 0x7D3F, + 0xE349: 0x7D35, + 0xE34A: 0x7D46, + 0xE34B: 0x7D73, + 0xE34C: 0x7D56, + 0xE34D: 0x7D4E, + 0xE34E: 0x7D72, + 0xE34F: 0x7D68, + 0xE350: 0x7D6E, + 0xE351: 0x7D4F, + 0xE352: 0x7D63, + 0xE353: 0x7D93, + 0xE354: 0x7D89, + 0xE355: 0x7D5B, + 0xE356: 0x7D8F, + 0xE357: 0x7D7D, + 0xE358: 0x7D9B, + 0xE359: 0x7DBA, + 0xE35A: 0x7DAE, + 0xE35B: 0x7DA3, + 0xE35C: 0x7DB5, + 0xE35D: 0x7DC7, + 0xE35E: 0x7DBD, + 0xE35F: 0x7DAB, + 0xE360: 0x7E3D, + 0xE361: 0x7DA2, + 0xE362: 0x7DAF, + 0xE363: 0x7DDC, + 0xE364: 0x7DB8, + 0xE365: 0x7D9F, + 0xE366: 0x7DB0, + 0xE367: 0x7DD8, + 0xE368: 0x7DDD, + 0xE369: 0x7DE4, + 0xE36A: 0x7DDE, + 0xE36B: 0x7DFB, + 0xE36C: 0x7DF2, + 0xE36D: 0x7DE1, + 0xE36E: 0x7E05, + 0xE36F: 0x7E0A, + 0xE370: 0x7E23, + 0xE371: 0x7E21, + 0xE372: 0x7E12, + 0xE373: 0x7E31, + 0xE374: 0x7E1F, + 0xE375: 0x7E09, + 0xE376: 0x7E0B, + 0xE377: 0x7E22, + 0xE378: 0x7E46, + 0xE379: 0x7E66, + 0xE37A: 0x7E3B, + 0xE37B: 0x7E35, + 0xE37C: 0x7E39, + 0xE37D: 0x7E43, + 0xE37E: 0x7E37, + 0xE380: 0x7E32, + 0xE381: 0x7E3A, + 0xE382: 0x7E67, + 0xE383: 0x7E5D, + 0xE384: 0x7E56, + 0xE385: 0x7E5E, + 0xE386: 0x7E59, + 0xE387: 0x7E5A, + 0xE388: 0x7E79, + 0xE389: 0x7E6A, + 0xE38A: 0x7E69, + 0xE38B: 0x7E7C, + 0xE38C: 0x7E7B, + 0xE38D: 0x7E83, + 0xE38E: 0x7DD5, + 0xE38F: 0x7E7D, + 0xE390: 0x8FAE, + 0xE391: 0x7E7F, + 0xE392: 0x7E88, + 0xE393: 0x7E89, + 0xE394: 0x7E8C, + 0xE395: 0x7E92, + 0xE396: 0x7E90, + 0xE397: 0x7E93, + 0xE398: 0x7E94, + 0xE399: 0x7E96, + 0xE39A: 0x7E8E, + 0xE39B: 0x7E9B, + 0xE39C: 0x7E9C, + 0xE39D: 0x7F38, + 0xE39E: 0x7F3A, + 0xE39F: 0x7F45, + 0xE3A0: 0x7F4C, + 0xE3A1: 0x7F4D, + 0xE3A2: 0x7F4E, + 0xE3A3: 0x7F50, + 0xE3A4: 0x7F51, + 0xE3A5: 0x7F55, + 0xE3A6: 0x7F54, + 0xE3A7: 0x7F58, + 0xE3A8: 0x7F5F, + 0xE3A9: 0x7F60, + 0xE3AA: 0x7F68, + 0xE3AB: 0x7F69, + 0xE3AC: 0x7F67, + 0xE3AD: 0x7F78, + 0xE3AE: 0x7F82, + 0xE3AF: 0x7F86, + 0xE3B0: 0x7F83, + 0xE3B1: 0x7F88, + 0xE3B2: 0x7F87, + 0xE3B3: 0x7F8C, + 0xE3B4: 0x7F94, + 0xE3B5: 0x7F9E, + 0xE3B6: 0x7F9D, + 0xE3B7: 0x7F9A, + 0xE3B8: 0x7FA3, + 0xE3B9: 0x7FAF, + 0xE3BA: 0x7FB2, + 0xE3BB: 0x7FB9, + 0xE3BC: 0x7FAE, + 0xE3BD: 0x7FB6, + 0xE3BE: 0x7FB8, + 0xE3BF: 0x8B71, + 0xE3C0: 0x7FC5, + 0xE3C1: 0x7FC6, + 0xE3C2: 0x7FCA, + 0xE3C3: 0x7FD5, + 0xE3C4: 0x7FD4, + 0xE3C5: 0x7FE1, + 0xE3C6: 0x7FE6, + 0xE3C7: 0x7FE9, + 0xE3C8: 0x7FF3, + 0xE3C9: 0x7FF9, + 0xE3CA: 0x98DC, + 0xE3CB: 0x8006, + 0xE3CC: 0x8004, + 0xE3CD: 0x800B, + 0xE3CE: 0x8012, + 0xE3CF: 0x8018, + 0xE3D0: 0x8019, + 0xE3D1: 0x801C, + 0xE3D2: 0x8021, + 0xE3D3: 0x8028, + 0xE3D4: 0x803F, + 0xE3D5: 0x803B, + 0xE3D6: 0x804A, + 0xE3D7: 0x8046, + 0xE3D8: 0x8052, + 0xE3D9: 0x8058, + 0xE3DA: 0x805A, + 0xE3DB: 0x805F, + 0xE3DC: 0x8062, + 0xE3DD: 0x8068, + 0xE3DE: 0x8073, + 0xE3DF: 0x8072, + 0xE3E0: 0x8070, + 0xE3E1: 0x8076, + 0xE3E2: 0x8079, + 0xE3E3: 0x807D, + 0xE3E4: 0x807F, + 0xE3E5: 0x8084, + 0xE3E6: 0x8086, + 0xE3E7: 0x8085, + 0xE3E8: 0x809B, + 0xE3E9: 0x8093, + 0xE3EA: 0x809A, + 0xE3EB: 0x80AD, + 0xE3EC: 0x5190, + 0xE3ED: 0x80AC, + 0xE3EE: 0x80DB, + 0xE3EF: 0x80E5, + 0xE3F0: 0x80D9, + 0xE3F1: 0x80DD, + 0xE3F2: 0x80C4, + 0xE3F3: 0x80DA, + 0xE3F4: 0x80D6, + 0xE3F5: 0x8109, + 0xE3F6: 0x80EF, + 0xE3F7: 0x80F1, + 0xE3F8: 0x811B, + 0xE3F9: 0x8129, + 0xE3FA: 0x8123, + 0xE3FB: 0x812F, + 0xE3FC: 0x814B, + 0xE440: 0x968B, + 0xE441: 0x8146, + 0xE442: 0x813E, + 0xE443: 0x8153, + 0xE444: 0x8151, + 0xE445: 0x80FC, + 0xE446: 0x8171, + 0xE447: 0x816E, + 0xE448: 0x8165, + 0xE449: 0x8166, + 0xE44A: 0x8174, + 0xE44B: 0x8183, + 0xE44C: 0x8188, + 0xE44D: 0x818A, + 0xE44E: 0x8180, + 0xE44F: 0x8182, + 0xE450: 0x81A0, + 0xE451: 0x8195, + 0xE452: 0x81A4, + 0xE453: 0x81A3, + 0xE454: 0x815F, + 0xE455: 0x8193, + 0xE456: 0x81A9, + 0xE457: 0x81B0, + 0xE458: 0x81B5, + 0xE459: 0x81BE, + 0xE45A: 0x81B8, + 0xE45B: 0x81BD, + 0xE45C: 0x81C0, + 0xE45D: 0x81C2, + 0xE45E: 0x81BA, + 0xE45F: 0x81C9, + 0xE460: 0x81CD, + 0xE461: 0x81D1, + 0xE462: 0x81D9, + 0xE463: 0x81D8, + 0xE464: 0x81C8, + 0xE465: 0x81DA, + 0xE466: 0x81DF, + 0xE467: 0x81E0, + 0xE468: 0x81E7, + 0xE469: 0x81FA, + 0xE46A: 0x81FB, + 0xE46B: 0x81FE, + 0xE46C: 0x8201, + 0xE46D: 0x8202, + 0xE46E: 0x8205, + 0xE46F: 0x8207, + 0xE470: 0x820A, + 0xE471: 0x820D, + 0xE472: 0x8210, + 0xE473: 0x8216, + 0xE474: 0x8229, + 0xE475: 0x822B, + 0xE476: 0x8238, + 0xE477: 0x8233, + 0xE478: 0x8240, + 0xE479: 0x8259, + 0xE47A: 0x8258, + 0xE47B: 0x825D, + 0xE47C: 0x825A, + 0xE47D: 0x825F, + 0xE47E: 0x8264, + 0xE480: 0x8262, + 0xE481: 0x8268, + 0xE482: 0x826A, + 0xE483: 0x826B, + 0xE484: 0x822E, + 0xE485: 0x8271, + 0xE486: 0x8277, + 0xE487: 0x8278, + 0xE488: 0x827E, + 0xE489: 0x828D, + 0xE48A: 0x8292, + 0xE48B: 0x82AB, + 0xE48C: 0x829F, + 0xE48D: 0x82BB, + 0xE48E: 0x82AC, + 0xE48F: 0x82E1, + 0xE490: 0x82E3, + 0xE491: 0x82DF, + 0xE492: 0x82D2, + 0xE493: 0x82F4, + 0xE494: 0x82F3, + 0xE495: 0x82FA, + 0xE496: 0x8393, + 0xE497: 0x8303, + 0xE498: 0x82FB, + 0xE499: 0x82F9, + 0xE49A: 0x82DE, + 0xE49B: 0x8306, + 0xE49C: 0x82DC, + 0xE49D: 0x8309, + 0xE49E: 0x82D9, + 0xE49F: 0x8335, + 0xE4A0: 0x8334, + 0xE4A1: 0x8316, + 0xE4A2: 0x8332, + 0xE4A3: 0x8331, + 0xE4A4: 0x8340, + 0xE4A5: 0x8339, + 0xE4A6: 0x8350, + 0xE4A7: 0x8345, + 0xE4A8: 0x832F, + 0xE4A9: 0x832B, + 0xE4AA: 0x8317, + 0xE4AB: 0x8318, + 0xE4AC: 0x8385, + 0xE4AD: 0x839A, + 0xE4AE: 0x83AA, + 0xE4AF: 0x839F, + 0xE4B0: 0x83A2, + 0xE4B1: 0x8396, + 0xE4B2: 0x8323, + 0xE4B3: 0x838E, + 0xE4B4: 0x8387, + 0xE4B5: 0x838A, + 0xE4B6: 0x837C, + 0xE4B7: 0x83B5, + 0xE4B8: 0x8373, + 0xE4B9: 0x8375, + 0xE4BA: 0x83A0, + 0xE4BB: 0x8389, + 0xE4BC: 0x83A8, + 0xE4BD: 0x83F4, + 0xE4BE: 0x8413, + 0xE4BF: 0x83EB, + 0xE4C0: 0x83CE, + 0xE4C1: 0x83FD, + 0xE4C2: 0x8403, + 0xE4C3: 0x83D8, + 0xE4C4: 0x840B, + 0xE4C5: 0x83C1, + 0xE4C6: 0x83F7, + 0xE4C7: 0x8407, + 0xE4C8: 0x83E0, + 0xE4C9: 0x83F2, + 0xE4CA: 0x840D, + 0xE4CB: 0x8422, + 0xE4CC: 0x8420, + 0xE4CD: 0x83BD, + 0xE4CE: 0x8438, + 0xE4CF: 0x8506, + 0xE4D0: 0x83FB, + 0xE4D1: 0x846D, + 0xE4D2: 0x842A, + 0xE4D3: 0x843C, + 0xE4D4: 0x855A, + 0xE4D5: 0x8484, + 0xE4D6: 0x8477, + 0xE4D7: 0x846B, + 0xE4D8: 0x84AD, + 0xE4D9: 0x846E, + 0xE4DA: 0x8482, + 0xE4DB: 0x8469, + 0xE4DC: 0x8446, + 0xE4DD: 0x842C, + 0xE4DE: 0x846F, + 0xE4DF: 0x8479, + 0xE4E0: 0x8435, + 0xE4E1: 0x84CA, + 0xE4E2: 0x8462, + 0xE4E3: 0x84B9, + 0xE4E4: 0x84BF, + 0xE4E5: 0x849F, + 0xE4E6: 0x84D9, + 0xE4E7: 0x84CD, + 0xE4E8: 0x84BB, + 0xE4E9: 0x84DA, + 0xE4EA: 0x84D0, + 0xE4EB: 0x84C1, + 0xE4EC: 0x84C6, + 0xE4ED: 0x84D6, + 0xE4EE: 0x84A1, + 0xE4EF: 0x8521, + 0xE4F0: 0x84FF, + 0xE4F1: 0x84F4, + 0xE4F2: 0x8517, + 0xE4F3: 0x8518, + 0xE4F4: 0x852C, + 0xE4F5: 0x851F, + 0xE4F6: 0x8515, + 0xE4F7: 0x8514, + 0xE4F8: 0x84FC, + 0xE4F9: 0x8540, + 0xE4FA: 0x8563, + 0xE4FB: 0x8558, + 0xE4FC: 0x8548, + 0xE540: 0x8541, + 0xE541: 0x8602, + 0xE542: 0x854B, + 0xE543: 0x8555, + 0xE544: 0x8580, + 0xE545: 0x85A4, + 0xE546: 0x8588, + 0xE547: 0x8591, + 0xE548: 0x858A, + 0xE549: 0x85A8, + 0xE54A: 0x856D, + 0xE54B: 0x8594, + 0xE54C: 0x859B, + 0xE54D: 0x85EA, + 0xE54E: 0x8587, + 0xE54F: 0x859C, + 0xE550: 0x8577, + 0xE551: 0x857E, + 0xE552: 0x8590, + 0xE553: 0x85C9, + 0xE554: 0x85BA, + 0xE555: 0x85CF, + 0xE556: 0x85B9, + 0xE557: 0x85D0, + 0xE558: 0x85D5, + 0xE559: 0x85DD, + 0xE55A: 0x85E5, + 0xE55B: 0x85DC, + 0xE55C: 0x85F9, + 0xE55D: 0x860A, + 0xE55E: 0x8613, + 0xE55F: 0x860B, + 0xE560: 0x85FE, + 0xE561: 0x85FA, + 0xE562: 0x8606, + 0xE563: 0x8622, + 0xE564: 0x861A, + 0xE565: 0x8630, + 0xE566: 0x863F, + 0xE567: 0x864D, + 0xE568: 0x4E55, + 0xE569: 0x8654, + 0xE56A: 0x865F, + 0xE56B: 0x8667, + 0xE56C: 0x8671, + 0xE56D: 0x8693, + 0xE56E: 0x86A3, + 0xE56F: 0x86A9, + 0xE570: 0x86AA, + 0xE571: 0x868B, + 0xE572: 0x868C, + 0xE573: 0x86B6, + 0xE574: 0x86AF, + 0xE575: 0x86C4, + 0xE576: 0x86C6, + 0xE577: 0x86B0, + 0xE578: 0x86C9, + 0xE579: 0x8823, + 0xE57A: 0x86AB, + 0xE57B: 0x86D4, + 0xE57C: 0x86DE, + 0xE57D: 0x86E9, + 0xE57E: 0x86EC, + 0xE580: 0x86DF, + 0xE581: 0x86DB, + 0xE582: 0x86EF, + 0xE583: 0x8712, + 0xE584: 0x8706, + 0xE585: 0x8708, + 0xE586: 0x8700, + 0xE587: 0x8703, + 0xE588: 0x86FB, + 0xE589: 0x8711, + 0xE58A: 0x8709, + 0xE58B: 0x870D, + 0xE58C: 0x86F9, + 0xE58D: 0x870A, + 0xE58E: 0x8734, + 0xE58F: 0x873F, + 0xE590: 0x8737, + 0xE591: 0x873B, + 0xE592: 0x8725, + 0xE593: 0x8729, + 0xE594: 0x871A, + 0xE595: 0x8760, + 0xE596: 0x875F, + 0xE597: 0x8778, + 0xE598: 0x874C, + 0xE599: 0x874E, + 0xE59A: 0x8774, + 0xE59B: 0x8757, + 0xE59C: 0x8768, + 0xE59D: 0x876E, + 0xE59E: 0x8759, + 0xE59F: 0x8753, + 0xE5A0: 0x8763, + 0xE5A1: 0x876A, + 0xE5A2: 0x8805, + 0xE5A3: 0x87A2, + 0xE5A4: 0x879F, + 0xE5A5: 0x8782, + 0xE5A6: 0x87AF, + 0xE5A7: 0x87CB, + 0xE5A8: 0x87BD, + 0xE5A9: 0x87C0, + 0xE5AA: 0x87D0, + 0xE5AB: 0x96D6, + 0xE5AC: 0x87AB, + 0xE5AD: 0x87C4, + 0xE5AE: 0x87B3, + 0xE5AF: 0x87C7, + 0xE5B0: 0x87C6, + 0xE5B1: 0x87BB, + 0xE5B2: 0x87EF, + 0xE5B3: 0x87F2, + 0xE5B4: 0x87E0, + 0xE5B5: 0x880F, + 0xE5B6: 0x880D, + 0xE5B7: 0x87FE, + 0xE5B8: 0x87F6, + 0xE5B9: 0x87F7, + 0xE5BA: 0x880E, + 0xE5BB: 0x87D2, + 0xE5BC: 0x8811, + 0xE5BD: 0x8816, + 0xE5BE: 0x8815, + 0xE5BF: 0x8822, + 0xE5C0: 0x8821, + 0xE5C1: 0x8831, + 0xE5C2: 0x8836, + 0xE5C3: 0x8839, + 0xE5C4: 0x8827, + 0xE5C5: 0x883B, + 0xE5C6: 0x8844, + 0xE5C7: 0x8842, + 0xE5C8: 0x8852, + 0xE5C9: 0x8859, + 0xE5CA: 0x885E, + 0xE5CB: 0x8862, + 0xE5CC: 0x886B, + 0xE5CD: 0x8881, + 0xE5CE: 0x887E, + 0xE5CF: 0x889E, + 0xE5D0: 0x8875, + 0xE5D1: 0x887D, + 0xE5D2: 0x88B5, + 0xE5D3: 0x8872, + 0xE5D4: 0x8882, + 0xE5D5: 0x8897, + 0xE5D6: 0x8892, + 0xE5D7: 0x88AE, + 0xE5D8: 0x8899, + 0xE5D9: 0x88A2, + 0xE5DA: 0x888D, + 0xE5DB: 0x88A4, + 0xE5DC: 0x88B0, + 0xE5DD: 0x88BF, + 0xE5DE: 0x88B1, + 0xE5DF: 0x88C3, + 0xE5E0: 0x88C4, + 0xE5E1: 0x88D4, + 0xE5E2: 0x88D8, + 0xE5E3: 0x88D9, + 0xE5E4: 0x88DD, + 0xE5E5: 0x88F9, + 0xE5E6: 0x8902, + 0xE5E7: 0x88FC, + 0xE5E8: 0x88F4, + 0xE5E9: 0x88E8, + 0xE5EA: 0x88F2, + 0xE5EB: 0x8904, + 0xE5EC: 0x890C, + 0xE5ED: 0x890A, + 0xE5EE: 0x8913, + 0xE5EF: 0x8943, + 0xE5F0: 0x891E, + 0xE5F1: 0x8925, + 0xE5F2: 0x892A, + 0xE5F3: 0x892B, + 0xE5F4: 0x8941, + 0xE5F5: 0x8944, + 0xE5F6: 0x893B, + 0xE5F7: 0x8936, + 0xE5F8: 0x8938, + 0xE5F9: 0x894C, + 0xE5FA: 0x891D, + 0xE5FB: 0x8960, + 0xE5FC: 0x895E, + 0xE640: 0x8966, + 0xE641: 0x8964, + 0xE642: 0x896D, + 0xE643: 0x896A, + 0xE644: 0x896F, + 0xE645: 0x8974, + 0xE646: 0x8977, + 0xE647: 0x897E, + 0xE648: 0x8983, + 0xE649: 0x8988, + 0xE64A: 0x898A, + 0xE64B: 0x8993, + 0xE64C: 0x8998, + 0xE64D: 0x89A1, + 0xE64E: 0x89A9, + 0xE64F: 0x89A6, + 0xE650: 0x89AC, + 0xE651: 0x89AF, + 0xE652: 0x89B2, + 0xE653: 0x89BA, + 0xE654: 0x89BD, + 0xE655: 0x89BF, + 0xE656: 0x89C0, + 0xE657: 0x89DA, + 0xE658: 0x89DC, + 0xE659: 0x89DD, + 0xE65A: 0x89E7, + 0xE65B: 0x89F4, + 0xE65C: 0x89F8, + 0xE65D: 0x8A03, + 0xE65E: 0x8A16, + 0xE65F: 0x8A10, + 0xE660: 0x8A0C, + 0xE661: 0x8A1B, + 0xE662: 0x8A1D, + 0xE663: 0x8A25, + 0xE664: 0x8A36, + 0xE665: 0x8A41, + 0xE666: 0x8A5B, + 0xE667: 0x8A52, + 0xE668: 0x8A46, + 0xE669: 0x8A48, + 0xE66A: 0x8A7C, + 0xE66B: 0x8A6D, + 0xE66C: 0x8A6C, + 0xE66D: 0x8A62, + 0xE66E: 0x8A85, + 0xE66F: 0x8A82, + 0xE670: 0x8A84, + 0xE671: 0x8AA8, + 0xE672: 0x8AA1, + 0xE673: 0x8A91, + 0xE674: 0x8AA5, + 0xE675: 0x8AA6, + 0xE676: 0x8A9A, + 0xE677: 0x8AA3, + 0xE678: 0x8AC4, + 0xE679: 0x8ACD, + 0xE67A: 0x8AC2, + 0xE67B: 0x8ADA, + 0xE67C: 0x8AEB, + 0xE67D: 0x8AF3, + 0xE67E: 0x8AE7, + 0xE680: 0x8AE4, + 0xE681: 0x8AF1, + 0xE682: 0x8B14, + 0xE683: 0x8AE0, + 0xE684: 0x8AE2, + 0xE685: 0x8AF7, + 0xE686: 0x8ADE, + 0xE687: 0x8ADB, + 0xE688: 0x8B0C, + 0xE689: 0x8B07, + 0xE68A: 0x8B1A, + 0xE68B: 0x8AE1, + 0xE68C: 0x8B16, + 0xE68D: 0x8B10, + 0xE68E: 0x8B17, + 0xE68F: 0x8B20, + 0xE690: 0x8B33, + 0xE691: 0x97AB, + 0xE692: 0x8B26, + 0xE693: 0x8B2B, + 0xE694: 0x8B3E, + 0xE695: 0x8B28, + 0xE696: 0x8B41, + 0xE697: 0x8B4C, + 0xE698: 0x8B4F, + 0xE699: 0x8B4E, + 0xE69A: 0x8B49, + 0xE69B: 0x8B56, + 0xE69C: 0x8B5B, + 0xE69D: 0x8B5A, + 0xE69E: 0x8B6B, + 0xE69F: 0x8B5F, + 0xE6A0: 0x8B6C, + 0xE6A1: 0x8B6F, + 0xE6A2: 0x8B74, + 0xE6A3: 0x8B7D, + 0xE6A4: 0x8B80, + 0xE6A5: 0x8B8C, + 0xE6A6: 0x8B8E, + 0xE6A7: 0x8B92, + 0xE6A8: 0x8B93, + 0xE6A9: 0x8B96, + 0xE6AA: 0x8B99, + 0xE6AB: 0x8B9A, + 0xE6AC: 0x8C3A, + 0xE6AD: 0x8C41, + 0xE6AE: 0x8C3F, + 0xE6AF: 0x8C48, + 0xE6B0: 0x8C4C, + 0xE6B1: 0x8C4E, + 0xE6B2: 0x8C50, + 0xE6B3: 0x8C55, + 0xE6B4: 0x8C62, + 0xE6B5: 0x8C6C, + 0xE6B6: 0x8C78, + 0xE6B7: 0x8C7A, + 0xE6B8: 0x8C82, + 0xE6B9: 0x8C89, + 0xE6BA: 0x8C85, + 0xE6BB: 0x8C8A, + 0xE6BC: 0x8C8D, + 0xE6BD: 0x8C8E, + 0xE6BE: 0x8C94, + 0xE6BF: 0x8C7C, + 0xE6C0: 0x8C98, + 0xE6C1: 0x621D, + 0xE6C2: 0x8CAD, + 0xE6C3: 0x8CAA, + 0xE6C4: 0x8CBD, + 0xE6C5: 0x8CB2, + 0xE6C6: 0x8CB3, + 0xE6C7: 0x8CAE, + 0xE6C8: 0x8CB6, + 0xE6C9: 0x8CC8, + 0xE6CA: 0x8CC1, + 0xE6CB: 0x8CE4, + 0xE6CC: 0x8CE3, + 0xE6CD: 0x8CDA, + 0xE6CE: 0x8CFD, + 0xE6CF: 0x8CFA, + 0xE6D0: 0x8CFB, + 0xE6D1: 0x8D04, + 0xE6D2: 0x8D05, + 0xE6D3: 0x8D0A, + 0xE6D4: 0x8D07, + 0xE6D5: 0x8D0F, + 0xE6D6: 0x8D0D, + 0xE6D7: 0x8D10, + 0xE6D8: 0x9F4E, + 0xE6D9: 0x8D13, + 0xE6DA: 0x8CCD, + 0xE6DB: 0x8D14, + 0xE6DC: 0x8D16, + 0xE6DD: 0x8D67, + 0xE6DE: 0x8D6D, + 0xE6DF: 0x8D71, + 0xE6E0: 0x8D73, + 0xE6E1: 0x8D81, + 0xE6E2: 0x8D99, + 0xE6E3: 0x8DC2, + 0xE6E4: 0x8DBE, + 0xE6E5: 0x8DBA, + 0xE6E6: 0x8DCF, + 0xE6E7: 0x8DDA, + 0xE6E8: 0x8DD6, + 0xE6E9: 0x8DCC, + 0xE6EA: 0x8DDB, + 0xE6EB: 0x8DCB, + 0xE6EC: 0x8DEA, + 0xE6ED: 0x8DEB, + 0xE6EE: 0x8DDF, + 0xE6EF: 0x8DE3, + 0xE6F0: 0x8DFC, + 0xE6F1: 0x8E08, + 0xE6F2: 0x8E09, + 0xE6F3: 0x8DFF, + 0xE6F4: 0x8E1D, + 0xE6F5: 0x8E1E, + 0xE6F6: 0x8E10, + 0xE6F7: 0x8E1F, + 0xE6F8: 0x8E42, + 0xE6F9: 0x8E35, + 0xE6FA: 0x8E30, + 0xE6FB: 0x8E34, + 0xE6FC: 0x8E4A, + 0xE740: 0x8E47, + 0xE741: 0x8E49, + 0xE742: 0x8E4C, + 0xE743: 0x8E50, + 0xE744: 0x8E48, + 0xE745: 0x8E59, + 0xE746: 0x8E64, + 0xE747: 0x8E60, + 0xE748: 0x8E2A, + 0xE749: 0x8E63, + 0xE74A: 0x8E55, + 0xE74B: 0x8E76, + 0xE74C: 0x8E72, + 0xE74D: 0x8E7C, + 0xE74E: 0x8E81, + 0xE74F: 0x8E87, + 0xE750: 0x8E85, + 0xE751: 0x8E84, + 0xE752: 0x8E8B, + 0xE753: 0x8E8A, + 0xE754: 0x8E93, + 0xE755: 0x8E91, + 0xE756: 0x8E94, + 0xE757: 0x8E99, + 0xE758: 0x8EAA, + 0xE759: 0x8EA1, + 0xE75A: 0x8EAC, + 0xE75B: 0x8EB0, + 0xE75C: 0x8EC6, + 0xE75D: 0x8EB1, + 0xE75E: 0x8EBE, + 0xE75F: 0x8EC5, + 0xE760: 0x8EC8, + 0xE761: 0x8ECB, + 0xE762: 0x8EDB, + 0xE763: 0x8EE3, + 0xE764: 0x8EFC, + 0xE765: 0x8EFB, + 0xE766: 0x8EEB, + 0xE767: 0x8EFE, + 0xE768: 0x8F0A, + 0xE769: 0x8F05, + 0xE76A: 0x8F15, + 0xE76B: 0x8F12, + 0xE76C: 0x8F19, + 0xE76D: 0x8F13, + 0xE76E: 0x8F1C, + 0xE76F: 0x8F1F, + 0xE770: 0x8F1B, + 0xE771: 0x8F0C, + 0xE772: 0x8F26, + 0xE773: 0x8F33, + 0xE774: 0x8F3B, + 0xE775: 0x8F39, + 0xE776: 0x8F45, + 0xE777: 0x8F42, + 0xE778: 0x8F3E, + 0xE779: 0x8F4C, + 0xE77A: 0x8F49, + 0xE77B: 0x8F46, + 0xE77C: 0x8F4E, + 0xE77D: 0x8F57, + 0xE77E: 0x8F5C, + 0xE780: 0x8F62, + 0xE781: 0x8F63, + 0xE782: 0x8F64, + 0xE783: 0x8F9C, + 0xE784: 0x8F9F, + 0xE785: 0x8FA3, + 0xE786: 0x8FAD, + 0xE787: 0x8FAF, + 0xE788: 0x8FB7, + 0xE789: 0x8FDA, + 0xE78A: 0x8FE5, + 0xE78B: 0x8FE2, + 0xE78C: 0x8FEA, + 0xE78D: 0x8FEF, + 0xE78E: 0x9087, + 0xE78F: 0x8FF4, + 0xE790: 0x9005, + 0xE791: 0x8FF9, + 0xE792: 0x8FFA, + 0xE793: 0x9011, + 0xE794: 0x9015, + 0xE795: 0x9021, + 0xE796: 0x900D, + 0xE797: 0x901E, + 0xE798: 0x9016, + 0xE799: 0x900B, + 0xE79A: 0x9027, + 0xE79B: 0x9036, + 0xE79C: 0x9035, + 0xE79D: 0x9039, + 0xE79E: 0x8FF8, + 0xE79F: 0x904F, + 0xE7A0: 0x9050, + 0xE7A1: 0x9051, + 0xE7A2: 0x9052, + 0xE7A3: 0x900E, + 0xE7A4: 0x9049, + 0xE7A5: 0x903E, + 0xE7A6: 0x9056, + 0xE7A7: 0x9058, + 0xE7A8: 0x905E, + 0xE7A9: 0x9068, + 0xE7AA: 0x906F, + 0xE7AB: 0x9076, + 0xE7AC: 0x96A8, + 0xE7AD: 0x9072, + 0xE7AE: 0x9082, + 0xE7AF: 0x907D, + 0xE7B0: 0x9081, + 0xE7B1: 0x9080, + 0xE7B2: 0x908A, + 0xE7B3: 0x9089, + 0xE7B4: 0x908F, + 0xE7B5: 0x90A8, + 0xE7B6: 0x90AF, + 0xE7B7: 0x90B1, + 0xE7B8: 0x90B5, + 0xE7B9: 0x90E2, + 0xE7BA: 0x90E4, + 0xE7BB: 0x6248, + 0xE7BC: 0x90DB, + 0xE7BD: 0x9102, + 0xE7BE: 0x9112, + 0xE7BF: 0x9119, + 0xE7C0: 0x9132, + 0xE7C1: 0x9130, + 0xE7C2: 0x914A, + 0xE7C3: 0x9156, + 0xE7C4: 0x9158, + 0xE7C5: 0x9163, + 0xE7C6: 0x9165, + 0xE7C7: 0x9169, + 0xE7C8: 0x9173, + 0xE7C9: 0x9172, + 0xE7CA: 0x918B, + 0xE7CB: 0x9189, + 0xE7CC: 0x9182, + 0xE7CD: 0x91A2, + 0xE7CE: 0x91AB, + 0xE7CF: 0x91AF, + 0xE7D0: 0x91AA, + 0xE7D1: 0x91B5, + 0xE7D2: 0x91B4, + 0xE7D3: 0x91BA, + 0xE7D4: 0x91C0, + 0xE7D5: 0x91C1, + 0xE7D6: 0x91C9, + 0xE7D7: 0x91CB, + 0xE7D8: 0x91D0, + 0xE7D9: 0x91D6, + 0xE7DA: 0x91DF, + 0xE7DB: 0x91E1, + 0xE7DC: 0x91DB, + 0xE7DD: 0x91FC, + 0xE7DE: 0x91F5, + 0xE7DF: 0x91F6, + 0xE7E0: 0x921E, + 0xE7E1: 0x91FF, + 0xE7E2: 0x9214, + 0xE7E3: 0x922C, + 0xE7E4: 0x9215, + 0xE7E5: 0x9211, + 0xE7E6: 0x925E, + 0xE7E7: 0x9257, + 0xE7E8: 0x9245, + 0xE7E9: 0x9249, + 0xE7EA: 0x9264, + 0xE7EB: 0x9248, + 0xE7EC: 0x9295, + 0xE7ED: 0x923F, + 0xE7EE: 0x924B, + 0xE7EF: 0x9250, + 0xE7F0: 0x929C, + 0xE7F1: 0x9296, + 0xE7F2: 0x9293, + 0xE7F3: 0x929B, + 0xE7F4: 0x925A, + 0xE7F5: 0x92CF, + 0xE7F6: 0x92B9, + 0xE7F7: 0x92B7, + 0xE7F8: 0x92E9, + 0xE7F9: 0x930F, + 0xE7FA: 0x92FA, + 0xE7FB: 0x9344, + 0xE7FC: 0x932E, + 0xE840: 0x9319, + 0xE841: 0x9322, + 0xE842: 0x931A, + 0xE843: 0x9323, + 0xE844: 0x933A, + 0xE845: 0x9335, + 0xE846: 0x933B, + 0xE847: 0x935C, + 0xE848: 0x9360, + 0xE849: 0x937C, + 0xE84A: 0x936E, + 0xE84B: 0x9356, + 0xE84C: 0x93B0, + 0xE84D: 0x93AC, + 0xE84E: 0x93AD, + 0xE84F: 0x9394, + 0xE850: 0x93B9, + 0xE851: 0x93D6, + 0xE852: 0x93D7, + 0xE853: 0x93E8, + 0xE854: 0x93E5, + 0xE855: 0x93D8, + 0xE856: 0x93C3, + 0xE857: 0x93DD, + 0xE858: 0x93D0, + 0xE859: 0x93C8, + 0xE85A: 0x93E4, + 0xE85B: 0x941A, + 0xE85C: 0x9414, + 0xE85D: 0x9413, + 0xE85E: 0x9403, + 0xE85F: 0x9407, + 0xE860: 0x9410, + 0xE861: 0x9436, + 0xE862: 0x942B, + 0xE863: 0x9435, + 0xE864: 0x9421, + 0xE865: 0x943A, + 0xE866: 0x9441, + 0xE867: 0x9452, + 0xE868: 0x9444, + 0xE869: 0x945B, + 0xE86A: 0x9460, + 0xE86B: 0x9462, + 0xE86C: 0x945E, + 0xE86D: 0x946A, + 0xE86E: 0x9229, + 0xE86F: 0x9470, + 0xE870: 0x9475, + 0xE871: 0x9477, + 0xE872: 0x947D, + 0xE873: 0x945A, + 0xE874: 0x947C, + 0xE875: 0x947E, + 0xE876: 0x9481, + 0xE877: 0x947F, + 0xE878: 0x9582, + 0xE879: 0x9587, + 0xE87A: 0x958A, + 0xE87B: 0x9594, + 0xE87C: 0x9596, + 0xE87D: 0x9598, + 0xE87E: 0x9599, + 0xE880: 0x95A0, + 0xE881: 0x95A8, + 0xE882: 0x95A7, + 0xE883: 0x95AD, + 0xE884: 0x95BC, + 0xE885: 0x95BB, + 0xE886: 0x95B9, + 0xE887: 0x95BE, + 0xE888: 0x95CA, + 0xE889: 0x6FF6, + 0xE88A: 0x95C3, + 0xE88B: 0x95CD, + 0xE88C: 0x95CC, + 0xE88D: 0x95D5, + 0xE88E: 0x95D4, + 0xE88F: 0x95D6, + 0xE890: 0x95DC, + 0xE891: 0x95E1, + 0xE892: 0x95E5, + 0xE893: 0x95E2, + 0xE894: 0x9621, + 0xE895: 0x9628, + 0xE896: 0x962E, + 0xE897: 0x962F, + 0xE898: 0x9642, + 0xE899: 0x964C, + 0xE89A: 0x964F, + 0xE89B: 0x964B, + 0xE89C: 0x9677, + 0xE89D: 0x965C, + 0xE89E: 0x965E, + 0xE89F: 0x965D, + 0xE8A0: 0x965F, + 0xE8A1: 0x9666, + 0xE8A2: 0x9672, + 0xE8A3: 0x966C, + 0xE8A4: 0x968D, + 0xE8A5: 0x9698, + 0xE8A6: 0x9695, + 0xE8A7: 0x9697, + 0xE8A8: 0x96AA, + 0xE8A9: 0x96A7, + 0xE8AA: 0x96B1, + 0xE8AB: 0x96B2, + 0xE8AC: 0x96B0, + 0xE8AD: 0x96B4, + 0xE8AE: 0x96B6, + 0xE8AF: 0x96B8, + 0xE8B0: 0x96B9, + 0xE8B1: 0x96CE, + 0xE8B2: 0x96CB, + 0xE8B3: 0x96C9, + 0xE8B4: 0x96CD, + 0xE8B5: 0x894D, + 0xE8B6: 0x96DC, + 0xE8B7: 0x970D, + 0xE8B8: 0x96D5, + 0xE8B9: 0x96F9, + 0xE8BA: 0x9704, + 0xE8BB: 0x9706, + 0xE8BC: 0x9708, + 0xE8BD: 0x9713, + 0xE8BE: 0x970E, + 0xE8BF: 0x9711, + 0xE8C0: 0x970F, + 0xE8C1: 0x9716, + 0xE8C2: 0x9719, + 0xE8C3: 0x9724, + 0xE8C4: 0x972A, + 0xE8C5: 0x9730, + 0xE8C6: 0x9739, + 0xE8C7: 0x973D, + 0xE8C8: 0x973E, + 0xE8C9: 0x9744, + 0xE8CA: 0x9746, + 0xE8CB: 0x9748, + 0xE8CC: 0x9742, + 0xE8CD: 0x9749, + 0xE8CE: 0x975C, + 0xE8CF: 0x9760, + 0xE8D0: 0x9764, + 0xE8D1: 0x9766, + 0xE8D2: 0x9768, + 0xE8D3: 0x52D2, + 0xE8D4: 0x976B, + 0xE8D5: 0x9771, + 0xE8D6: 0x9779, + 0xE8D7: 0x9785, + 0xE8D8: 0x977C, + 0xE8D9: 0x9781, + 0xE8DA: 0x977A, + 0xE8DB: 0x9786, + 0xE8DC: 0x978B, + 0xE8DD: 0x978F, + 0xE8DE: 0x9790, + 0xE8DF: 0x979C, + 0xE8E0: 0x97A8, + 0xE8E1: 0x97A6, + 0xE8E2: 0x97A3, + 0xE8E3: 0x97B3, + 0xE8E4: 0x97B4, + 0xE8E5: 0x97C3, + 0xE8E6: 0x97C6, + 0xE8E7: 0x97C8, + 0xE8E8: 0x97CB, + 0xE8E9: 0x97DC, + 0xE8EA: 0x97ED, + 0xE8EB: 0x9F4F, + 0xE8EC: 0x97F2, + 0xE8ED: 0x7ADF, + 0xE8EE: 0x97F6, + 0xE8EF: 0x97F5, + 0xE8F0: 0x980F, + 0xE8F1: 0x980C, + 0xE8F2: 0x9838, + 0xE8F3: 0x9824, + 0xE8F4: 0x9821, + 0xE8F5: 0x9837, + 0xE8F6: 0x983D, + 0xE8F7: 0x9846, + 0xE8F8: 0x984F, + 0xE8F9: 0x984B, + 0xE8FA: 0x986B, + 0xE8FB: 0x986F, + 0xE8FC: 0x9870, + 0xE940: 0x9871, + 0xE941: 0x9874, + 0xE942: 0x9873, + 0xE943: 0x98AA, + 0xE944: 0x98AF, + 0xE945: 0x98B1, + 0xE946: 0x98B6, + 0xE947: 0x98C4, + 0xE948: 0x98C3, + 0xE949: 0x98C6, + 0xE94A: 0x98E9, + 0xE94B: 0x98EB, + 0xE94C: 0x9903, + 0xE94D: 0x9909, + 0xE94E: 0x9912, + 0xE94F: 0x9914, + 0xE950: 0x9918, + 0xE951: 0x9921, + 0xE952: 0x991D, + 0xE953: 0x991E, + 0xE954: 0x9924, + 0xE955: 0x9920, + 0xE956: 0x992C, + 0xE957: 0x992E, + 0xE958: 0x993D, + 0xE959: 0x993E, + 0xE95A: 0x9942, + 0xE95B: 0x9949, + 0xE95C: 0x9945, + 0xE95D: 0x9950, + 0xE95E: 0x994B, + 0xE95F: 0x9951, + 0xE960: 0x9952, + 0xE961: 0x994C, + 0xE962: 0x9955, + 0xE963: 0x9997, + 0xE964: 0x9998, + 0xE965: 0x99A5, + 0xE966: 0x99AD, + 0xE967: 0x99AE, + 0xE968: 0x99BC, + 0xE969: 0x99DF, + 0xE96A: 0x99DB, + 0xE96B: 0x99DD, + 0xE96C: 0x99D8, + 0xE96D: 0x99D1, + 0xE96E: 0x99ED, + 0xE96F: 0x99EE, + 0xE970: 0x99F1, + 0xE971: 0x99F2, + 0xE972: 0x99FB, + 0xE973: 0x99F8, + 0xE974: 0x9A01, + 0xE975: 0x9A0F, + 0xE976: 0x9A05, + 0xE977: 0x99E2, + 0xE978: 0x9A19, + 0xE979: 0x9A2B, + 0xE97A: 0x9A37, + 0xE97B: 0x9A45, + 0xE97C: 0x9A42, + 0xE97D: 0x9A40, + 0xE97E: 0x9A43, + 0xE980: 0x9A3E, + 0xE981: 0x9A55, + 0xE982: 0x9A4D, + 0xE983: 0x9A5B, + 0xE984: 0x9A57, + 0xE985: 0x9A5F, + 0xE986: 0x9A62, + 0xE987: 0x9A65, + 0xE988: 0x9A64, + 0xE989: 0x9A69, + 0xE98A: 0x9A6B, + 0xE98B: 0x9A6A, + 0xE98C: 0x9AAD, + 0xE98D: 0x9AB0, + 0xE98E: 0x9ABC, + 0xE98F: 0x9AC0, + 0xE990: 0x9ACF, + 0xE991: 0x9AD1, + 0xE992: 0x9AD3, + 0xE993: 0x9AD4, + 0xE994: 0x9ADE, + 0xE995: 0x9ADF, + 0xE996: 0x9AE2, + 0xE997: 0x9AE3, + 0xE998: 0x9AE6, + 0xE999: 0x9AEF, + 0xE99A: 0x9AEB, + 0xE99B: 0x9AEE, + 0xE99C: 0x9AF4, + 0xE99D: 0x9AF1, + 0xE99E: 0x9AF7, + 0xE99F: 0x9AFB, + 0xE9A0: 0x9B06, + 0xE9A1: 0x9B18, + 0xE9A2: 0x9B1A, + 0xE9A3: 0x9B1F, + 0xE9A4: 0x9B22, + 0xE9A5: 0x9B23, + 0xE9A6: 0x9B25, + 0xE9A7: 0x9B27, + 0xE9A8: 0x9B28, + 0xE9A9: 0x9B29, + 0xE9AA: 0x9B2A, + 0xE9AB: 0x9B2E, + 0xE9AC: 0x9B2F, + 0xE9AD: 0x9B32, + 0xE9AE: 0x9B44, + 0xE9AF: 0x9B43, + 0xE9B0: 0x9B4F, + 0xE9B1: 0x9B4D, + 0xE9B2: 0x9B4E, + 0xE9B3: 0x9B51, + 0xE9B4: 0x9B58, + 0xE9B5: 0x9B74, + 0xE9B6: 0x9B93, + 0xE9B7: 0x9B83, + 0xE9B8: 0x9B91, + 0xE9B9: 0x9B96, + 0xE9BA: 0x9B97, + 0xE9BB: 0x9B9F, + 0xE9BC: 0x9BA0, + 0xE9BD: 0x9BA8, + 0xE9BE: 0x9BB4, + 0xE9BF: 0x9BC0, + 0xE9C0: 0x9BCA, + 0xE9C1: 0x9BB9, + 0xE9C2: 0x9BC6, + 0xE9C3: 0x9BCF, + 0xE9C4: 0x9BD1, + 0xE9C5: 0x9BD2, + 0xE9C6: 0x9BE3, + 0xE9C7: 0x9BE2, + 0xE9C8: 0x9BE4, + 0xE9C9: 0x9BD4, + 0xE9CA: 0x9BE1, + 0xE9CB: 0x9C3A, + 0xE9CC: 0x9BF2, + 0xE9CD: 0x9BF1, + 0xE9CE: 0x9BF0, + 0xE9CF: 0x9C15, + 0xE9D0: 0x9C14, + 0xE9D1: 0x9C09, + 0xE9D2: 0x9C13, + 0xE9D3: 0x9C0C, + 0xE9D4: 0x9C06, + 0xE9D5: 0x9C08, + 0xE9D6: 0x9C12, + 0xE9D7: 0x9C0A, + 0xE9D8: 0x9C04, + 0xE9D9: 0x9C2E, + 0xE9DA: 0x9C1B, + 0xE9DB: 0x9C25, + 0xE9DC: 0x9C24, + 0xE9DD: 0x9C21, + 0xE9DE: 0x9C30, + 0xE9DF: 0x9C47, + 0xE9E0: 0x9C32, + 0xE9E1: 0x9C46, + 0xE9E2: 0x9C3E, + 0xE9E3: 0x9C5A, + 0xE9E4: 0x9C60, + 0xE9E5: 0x9C67, + 0xE9E6: 0x9C76, + 0xE9E7: 0x9C78, + 0xE9E8: 0x9CE7, + 0xE9E9: 0x9CEC, + 0xE9EA: 0x9CF0, + 0xE9EB: 0x9D09, + 0xE9EC: 0x9D08, + 0xE9ED: 0x9CEB, + 0xE9EE: 0x9D03, + 0xE9EF: 0x9D06, + 0xE9F0: 0x9D2A, + 0xE9F1: 0x9D26, + 0xE9F2: 0x9DAF, + 0xE9F3: 0x9D23, + 0xE9F4: 0x9D1F, + 0xE9F5: 0x9D44, + 0xE9F6: 0x9D15, + 0xE9F7: 0x9D12, + 0xE9F8: 0x9D41, + 0xE9F9: 0x9D3F, + 0xE9FA: 0x9D3E, + 0xE9FB: 0x9D46, + 0xE9FC: 0x9D48, + 0xEA40: 0x9D5D, + 0xEA41: 0x9D5E, + 0xEA42: 0x9D64, + 0xEA43: 0x9D51, + 0xEA44: 0x9D50, + 0xEA45: 0x9D59, + 0xEA46: 0x9D72, + 0xEA47: 0x9D89, + 0xEA48: 0x9D87, + 0xEA49: 0x9DAB, + 0xEA4A: 0x9D6F, + 0xEA4B: 0x9D7A, + 0xEA4C: 0x9D9A, + 0xEA4D: 0x9DA4, + 0xEA4E: 0x9DA9, + 0xEA4F: 0x9DB2, + 0xEA50: 0x9DC4, + 0xEA51: 0x9DC1, + 0xEA52: 0x9DBB, + 0xEA53: 0x9DB8, + 0xEA54: 0x9DBA, + 0xEA55: 0x9DC6, + 0xEA56: 0x9DCF, + 0xEA57: 0x9DC2, + 0xEA58: 0x9DD9, + 0xEA59: 0x9DD3, + 0xEA5A: 0x9DF8, + 0xEA5B: 0x9DE6, + 0xEA5C: 0x9DED, + 0xEA5D: 0x9DEF, + 0xEA5E: 0x9DFD, + 0xEA5F: 0x9E1A, + 0xEA60: 0x9E1B, + 0xEA61: 0x9E1E, + 0xEA62: 0x9E75, + 0xEA63: 0x9E79, + 0xEA64: 0x9E7D, + 0xEA65: 0x9E81, + 0xEA66: 0x9E88, + 0xEA67: 0x9E8B, + 0xEA68: 0x9E8C, + 0xEA69: 0x9E92, + 0xEA6A: 0x9E95, + 0xEA6B: 0x9E91, + 0xEA6C: 0x9E9D, + 0xEA6D: 0x9EA5, + 0xEA6E: 0x9EA9, + 0xEA6F: 0x9EB8, + 0xEA70: 0x9EAA, + 0xEA71: 0x9EAD, + 0xEA72: 0x9761, + 0xEA73: 0x9ECC, + 0xEA74: 0x9ECE, + 0xEA75: 0x9ECF, + 0xEA76: 0x9ED0, + 0xEA77: 0x9ED4, + 0xEA78: 0x9EDC, + 0xEA79: 0x9EDE, + 0xEA7A: 0x9EDD, + 0xEA7B: 0x9EE0, + 0xEA7C: 0x9EE5, + 0xEA7D: 0x9EE8, + 0xEA7E: 0x9EEF, + 0xEA80: 0x9EF4, + 0xEA81: 0x9EF6, + 0xEA82: 0x9EF7, + 0xEA83: 0x9EF9, + 0xEA84: 0x9EFB, + 0xEA85: 0x9EFC, + 0xEA86: 0x9EFD, + 0xEA87: 0x9F07, + 0xEA88: 0x9F08, + 0xEA89: 0x76B7, + 0xEA8A: 0x9F15, + 0xEA8B: 0x9F21, + 0xEA8C: 0x9F2C, + 0xEA8D: 0x9F3E, + 0xEA8E: 0x9F4A, + 0xEA8F: 0x9F52, + 0xEA90: 0x9F54, + 0xEA91: 0x9F63, + 0xEA92: 0x9F5F, + 0xEA93: 0x9F60, + 0xEA94: 0x9F61, + 0xEA95: 0x9F66, + 0xEA96: 0x9F67, + 0xEA97: 0x9F6C, + 0xEA98: 0x9F6A, + 0xEA99: 0x9F77, + 0xEA9A: 0x9F72, + 0xEA9B: 0x9F76, + 0xEA9C: 0x9F95, + 0xEA9D: 0x9F9C, + 0xEA9E: 0x9FA0, + 0xEA9F: 0x582F, + 0xEAA0: 0x69C7, + 0xEAA1: 0x9059, + 0xEAA2: 0x7464, + 0xEAA3: 0x51DC, + 0xEAA4: 0x7199, +}; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to match unescaped characters in compiled string literals. */ - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; +"use strict"; - /** Used to compose unicode character classes. */ - 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; +Object.defineProperty(exports, "__esModule", { value: true }); +var GenericGF_1 = __webpack_require__(1); +var GenericGFPoly_1 = __webpack_require__(2); +function runEuclideanAlgorithm(field, a, b, R) { + // Assume a's degree is >= b's + if (a.degree() < b.degree()) { + _a = [b, a], a = _a[0], b = _a[1]; + } + var rLast = a; + var r = b; + var tLast = field.zero; + var t = field.one; + // Run Euclidean algorithm until r's degree is less than R/2 + while (r.degree() >= R / 2) { + var rLastLast = rLast; + var tLastLast = tLast; + rLast = r; + tLast = t; + // Divide rLastLast by rLast, with quotient in q and remainder in r + if (rLast.isZero()) { + // Euclidean algorithm already terminated? + return null; + } + r = rLastLast; + var q = field.zero; + var denominatorLeadingTerm = rLast.getCoefficient(rLast.degree()); + var dltInverse = field.inverse(denominatorLeadingTerm); + while (r.degree() >= rLast.degree() && !r.isZero()) { + var degreeDiff = r.degree() - rLast.degree(); + var scale = field.multiply(r.getCoefficient(r.degree()), dltInverse); + q = q.addOrSubtract(field.buildMonomial(degreeDiff, scale)); + r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale)); + } + t = q.multiplyPoly(tLast).addOrSubtract(tLastLast); + if (r.degree() >= rLast.degree()) { + return null; + } + } + var sigmaTildeAtZero = t.getCoefficient(0); + if (sigmaTildeAtZero === 0) { + return null; + } + var inverse = field.inverse(sigmaTildeAtZero); + return [t.multiply(inverse), r.multiply(inverse)]; + var _a; +} +function findErrorLocations(field, errorLocator) { + // This is a direct application of Chien's search + var numErrors = errorLocator.degree(); + if (numErrors === 1) { + return [errorLocator.getCoefficient(1)]; + } + var result = new Array(numErrors); + var errorCount = 0; + for (var i = 1; i < field.size && errorCount < numErrors; i++) { + if (errorLocator.evaluateAt(i) === 0) { + result[errorCount] = field.inverse(i); + errorCount++; + } + } + if (errorCount !== numErrors) { + return null; + } + return result; +} +function findErrorMagnitudes(field, errorEvaluator, errorLocations) { + // This is directly applying Forney's Formula + var s = errorLocations.length; + var result = new Array(s); + for (var i = 0; i < s; i++) { + var xiInverse = field.inverse(errorLocations[i]); + var denominator = 1; + for (var j = 0; j < s; j++) { + if (i !== j) { + denominator = field.multiply(denominator, GenericGF_1.addOrSubtractGF(1, field.multiply(errorLocations[j], xiInverse))); + } + } + result[i] = field.multiply(errorEvaluator.evaluateAt(xiInverse), field.inverse(denominator)); + if (field.generatorBase !== 0) { + result[i] = field.multiply(result[i], xiInverse); + } + } + return result; +} +function decode(bytes, twoS) { + var outputBytes = new Uint8ClampedArray(bytes.length); + outputBytes.set(bytes); + var field = new GenericGF_1.default(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1 + var poly = new GenericGFPoly_1.default(field, outputBytes); + var syndromeCoefficients = new Uint8ClampedArray(twoS); + var error = false; + for (var s = 0; s < twoS; s++) { + var evaluation = poly.evaluateAt(field.exp(s + field.generatorBase)); + syndromeCoefficients[syndromeCoefficients.length - 1 - s] = evaluation; + if (evaluation !== 0) { + error = true; + } + } + if (!error) { + return outputBytes; + } + var syndrome = new GenericGFPoly_1.default(field, syndromeCoefficients); + var sigmaOmega = runEuclideanAlgorithm(field, field.buildMonomial(twoS, 1), syndrome, twoS); + if (sigmaOmega === null) { + return null; + } + var errorLocations = findErrorLocations(field, sigmaOmega[0]); + if (errorLocations == null) { + return null; + } + var errorMagnitudes = findErrorMagnitudes(field, sigmaOmega[1], errorLocations); + for (var i = 0; i < errorLocations.length; i++) { + var position = outputBytes.length - 1 - field.log(errorLocations[i]); + if (position < 0) { + return null; + } + outputBytes[position] = GenericGF_1.addOrSubtractGF(outputBytes[position], errorMagnitudes[i]); + } + return outputBytes; +} +exports.decode = decode; - /** Used to compose unicode capture groups. */ - var rsApos = "['\u2019]", - 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'; - /** Used to compose unicode regexes. */ - 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('|') + ')'; +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to match apostrophes. */ - var reApos = RegExp(rsApos, 'g'); +"use strict"; - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VERSIONS = [ + { + infoBits: null, + versionNumber: 1, + alignmentPatternCenters: [], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 7, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 19 }], + }, + { + ecCodewordsPerBlock: 10, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 16 }], + }, + { + ecCodewordsPerBlock: 13, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 13 }], + }, + { + ecCodewordsPerBlock: 17, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 9 }], + }, + ], + }, + { + infoBits: null, + versionNumber: 2, + alignmentPatternCenters: [6, 18], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 10, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 34 }], + }, + { + ecCodewordsPerBlock: 16, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 28 }], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 22 }], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 16 }], + }, + ], + }, + { + infoBits: null, + versionNumber: 3, + alignmentPatternCenters: [6, 22], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 15, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 55 }], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 44 }], + }, + { + ecCodewordsPerBlock: 18, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 17 }], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 13 }], + }, + ], + }, + { + infoBits: null, + versionNumber: 4, + alignmentPatternCenters: [6, 26], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 20, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 80 }], + }, + { + ecCodewordsPerBlock: 18, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 32 }], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 24 }], + }, + { + ecCodewordsPerBlock: 16, + ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 9 }], + }, + ], + }, + { + infoBits: null, + versionNumber: 5, + alignmentPatternCenters: [6, 30], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 26, + ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 108 }], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 43 }], + }, + { + ecCodewordsPerBlock: 18, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 15 }, + { numBlocks: 2, dataCodewordsPerBlock: 16 }, + ], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 11 }, + { numBlocks: 2, dataCodewordsPerBlock: 12 }, + ], + }, + ], + }, + { + infoBits: null, + versionNumber: 6, + alignmentPatternCenters: [6, 34], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 18, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 68 }], + }, + { + ecCodewordsPerBlock: 16, + ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 27 }], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 19 }], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 15 }], + }, + ], + }, + { + infoBits: 0x07C94, + versionNumber: 7, + alignmentPatternCenters: [6, 22, 38], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 20, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 78 }], + }, + { + ecCodewordsPerBlock: 18, + ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 31 }], + }, + { + ecCodewordsPerBlock: 18, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 14 }, + { numBlocks: 4, dataCodewordsPerBlock: 15 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 13 }, + { numBlocks: 1, dataCodewordsPerBlock: 14 }, + ], + }, + ], + }, + { + infoBits: 0x085BC, + versionNumber: 8, + alignmentPatternCenters: [6, 24, 42], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 24, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 97 }], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 38 }, + { numBlocks: 2, dataCodewordsPerBlock: 39 }, + ], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 18 }, + { numBlocks: 2, dataCodewordsPerBlock: 19 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 14 }, + { numBlocks: 2, dataCodewordsPerBlock: 15 }, + ], + }, + ], + }, + { + infoBits: 0x09A99, + versionNumber: 9, + alignmentPatternCenters: [6, 26, 46], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 116 }], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 36 }, + { numBlocks: 2, dataCodewordsPerBlock: 37 }, + ], + }, + { + ecCodewordsPerBlock: 20, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 16 }, + { numBlocks: 4, dataCodewordsPerBlock: 17 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 12 }, + { numBlocks: 4, dataCodewordsPerBlock: 13 }, + ], + }, + ], + }, + { + infoBits: 0x0A4D3, + versionNumber: 10, + alignmentPatternCenters: [6, 28, 50], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 18, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 68 }, + { numBlocks: 2, dataCodewordsPerBlock: 69 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 43 }, + { numBlocks: 1, dataCodewordsPerBlock: 44 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 6, dataCodewordsPerBlock: 19 }, + { numBlocks: 2, dataCodewordsPerBlock: 20 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 6, dataCodewordsPerBlock: 15 }, + { numBlocks: 2, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x0BBF6, + versionNumber: 11, + alignmentPatternCenters: [6, 30, 54], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 20, + ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 81 }], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 1, dataCodewordsPerBlock: 50 }, + { numBlocks: 4, dataCodewordsPerBlock: 51 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 22 }, + { numBlocks: 4, dataCodewordsPerBlock: 23 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 12 }, + { numBlocks: 8, dataCodewordsPerBlock: 13 }, + ], + }, + ], + }, + { + infoBits: 0x0C762, + versionNumber: 12, + alignmentPatternCenters: [6, 32, 58], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 92 }, + { numBlocks: 2, dataCodewordsPerBlock: 93 }, + ], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 6, dataCodewordsPerBlock: 36 }, + { numBlocks: 2, dataCodewordsPerBlock: 37 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 20 }, + { numBlocks: 6, dataCodewordsPerBlock: 21 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 7, dataCodewordsPerBlock: 14 }, + { numBlocks: 4, dataCodewordsPerBlock: 15 }, + ], + }, + ], + }, + { + infoBits: 0x0D847, + versionNumber: 13, + alignmentPatternCenters: [6, 34, 62], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 26, + ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 107 }], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 8, dataCodewordsPerBlock: 37 }, + { numBlocks: 1, dataCodewordsPerBlock: 38 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 8, dataCodewordsPerBlock: 20 }, + { numBlocks: 4, dataCodewordsPerBlock: 21 }, + ], + }, + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 12, dataCodewordsPerBlock: 11 }, + { numBlocks: 4, dataCodewordsPerBlock: 12 }, + ], + }, + ], + }, + { + infoBits: 0x0E60D, + versionNumber: 14, + alignmentPatternCenters: [6, 26, 46, 66], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 115 }, + { numBlocks: 1, dataCodewordsPerBlock: 116 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 40 }, + { numBlocks: 5, dataCodewordsPerBlock: 41 }, + ], + }, + { + ecCodewordsPerBlock: 20, + ecBlocks: [ + { numBlocks: 11, dataCodewordsPerBlock: 16 }, + { numBlocks: 5, dataCodewordsPerBlock: 17 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 11, dataCodewordsPerBlock: 12 }, + { numBlocks: 5, dataCodewordsPerBlock: 13 }, + ], + }, + ], + }, + { + infoBits: 0x0F928, + versionNumber: 15, + alignmentPatternCenters: [6, 26, 48, 70], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 22, + ecBlocks: [ + { numBlocks: 5, dataCodewordsPerBlock: 87 }, + { numBlocks: 1, dataCodewordsPerBlock: 88 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 5, dataCodewordsPerBlock: 41 }, + { numBlocks: 5, dataCodewordsPerBlock: 42 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 5, dataCodewordsPerBlock: 24 }, + { numBlocks: 7, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 11, dataCodewordsPerBlock: 12 }, + { numBlocks: 7, dataCodewordsPerBlock: 13 }, + ], + }, + ], + }, + { + infoBits: 0x10B78, + versionNumber: 16, + alignmentPatternCenters: [6, 26, 50, 74], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 5, dataCodewordsPerBlock: 98 }, + { numBlocks: 1, dataCodewordsPerBlock: 99 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 7, dataCodewordsPerBlock: 45 }, + { numBlocks: 3, dataCodewordsPerBlock: 46 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [ + { numBlocks: 15, dataCodewordsPerBlock: 19 }, + { numBlocks: 2, dataCodewordsPerBlock: 20 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 15 }, + { numBlocks: 13, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x1145D, + versionNumber: 17, + alignmentPatternCenters: [6, 30, 54, 78], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 1, dataCodewordsPerBlock: 107 }, + { numBlocks: 5, dataCodewordsPerBlock: 108 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 10, dataCodewordsPerBlock: 46 }, + { numBlocks: 1, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 1, dataCodewordsPerBlock: 22 }, + { numBlocks: 15, dataCodewordsPerBlock: 23 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 14 }, + { numBlocks: 17, dataCodewordsPerBlock: 15 }, + ], + }, + ], + }, + { + infoBits: 0x12A17, + versionNumber: 18, + alignmentPatternCenters: [6, 30, 56, 82], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 5, dataCodewordsPerBlock: 120 }, + { numBlocks: 1, dataCodewordsPerBlock: 121 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 9, dataCodewordsPerBlock: 43 }, + { numBlocks: 4, dataCodewordsPerBlock: 44 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 17, dataCodewordsPerBlock: 22 }, + { numBlocks: 1, dataCodewordsPerBlock: 23 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 14 }, + { numBlocks: 19, dataCodewordsPerBlock: 15 }, + ], + }, + ], + }, + { + infoBits: 0x13532, + versionNumber: 19, + alignmentPatternCenters: [6, 30, 58, 86], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 113 }, + { numBlocks: 4, dataCodewordsPerBlock: 114 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 44 }, + { numBlocks: 11, dataCodewordsPerBlock: 45 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 17, dataCodewordsPerBlock: 21 }, + { numBlocks: 4, dataCodewordsPerBlock: 22 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 9, dataCodewordsPerBlock: 13 }, + { numBlocks: 16, dataCodewordsPerBlock: 14 }, + ], + }, + ], + }, + { + infoBits: 0x149A6, + versionNumber: 20, + alignmentPatternCenters: [6, 34, 62, 90], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 107 }, + { numBlocks: 5, dataCodewordsPerBlock: 108 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 41 }, + { numBlocks: 13, dataCodewordsPerBlock: 42 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 15, dataCodewordsPerBlock: 24 }, + { numBlocks: 5, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 15, dataCodewordsPerBlock: 15 }, + { numBlocks: 10, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x15683, + versionNumber: 21, + alignmentPatternCenters: [6, 28, 50, 72, 94], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 116 }, + { numBlocks: 4, dataCodewordsPerBlock: 117 }, + ], + }, + { + ecCodewordsPerBlock: 26, + ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 42 }], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 17, dataCodewordsPerBlock: 22 }, + { numBlocks: 6, dataCodewordsPerBlock: 23 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 19, dataCodewordsPerBlock: 16 }, + { numBlocks: 6, dataCodewordsPerBlock: 17 }, + ], + }, + ], + }, + { + infoBits: 0x168C9, + versionNumber: 22, + alignmentPatternCenters: [6, 26, 50, 74, 98], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 111 }, + { numBlocks: 7, dataCodewordsPerBlock: 112 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 46 }], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 7, dataCodewordsPerBlock: 24 }, + { numBlocks: 16, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 24, + ecBlocks: [{ numBlocks: 34, dataCodewordsPerBlock: 13 }], + }, + ], + }, + { + infoBits: 0x177EC, + versionNumber: 23, + alignmentPatternCenters: [6, 30, 54, 74, 102], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 121 }, + { numBlocks: 5, dataCodewordsPerBlock: 122 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 47 }, + { numBlocks: 14, dataCodewordsPerBlock: 48 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 11, dataCodewordsPerBlock: 24 }, + { numBlocks: 14, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 16, dataCodewordsPerBlock: 15 }, + { numBlocks: 14, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x18EC4, + versionNumber: 24, + alignmentPatternCenters: [6, 28, 54, 80, 106], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 6, dataCodewordsPerBlock: 117 }, + { numBlocks: 4, dataCodewordsPerBlock: 118 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 6, dataCodewordsPerBlock: 45 }, + { numBlocks: 14, dataCodewordsPerBlock: 46 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 11, dataCodewordsPerBlock: 24 }, + { numBlocks: 16, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 30, dataCodewordsPerBlock: 16 }, + { numBlocks: 2, dataCodewordsPerBlock: 17 }, + ], + }, + ], + }, + { + infoBits: 0x191E1, + versionNumber: 25, + alignmentPatternCenters: [6, 32, 58, 84, 110], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 26, + ecBlocks: [ + { numBlocks: 8, dataCodewordsPerBlock: 106 }, + { numBlocks: 4, dataCodewordsPerBlock: 107 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 8, dataCodewordsPerBlock: 47 }, + { numBlocks: 13, dataCodewordsPerBlock: 48 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 7, dataCodewordsPerBlock: 24 }, + { numBlocks: 22, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 22, dataCodewordsPerBlock: 15 }, + { numBlocks: 13, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x1AFAB, + versionNumber: 26, + alignmentPatternCenters: [6, 30, 58, 86, 114], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 10, dataCodewordsPerBlock: 114 }, + { numBlocks: 2, dataCodewordsPerBlock: 115 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 19, dataCodewordsPerBlock: 46 }, + { numBlocks: 4, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 28, dataCodewordsPerBlock: 22 }, + { numBlocks: 6, dataCodewordsPerBlock: 23 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 33, dataCodewordsPerBlock: 16 }, + { numBlocks: 4, dataCodewordsPerBlock: 17 }, + ], + }, + ], + }, + { + infoBits: 0x1B08E, + versionNumber: 27, + alignmentPatternCenters: [6, 34, 62, 90, 118], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 8, dataCodewordsPerBlock: 122 }, + { numBlocks: 4, dataCodewordsPerBlock: 123 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 22, dataCodewordsPerBlock: 45 }, + { numBlocks: 3, dataCodewordsPerBlock: 46 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 8, dataCodewordsPerBlock: 23 }, + { numBlocks: 26, dataCodewordsPerBlock: 24 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 12, dataCodewordsPerBlock: 15 }, + { numBlocks: 28, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x1CC1A, + versionNumber: 28, + alignmentPatternCenters: [6, 26, 50, 74, 98, 122], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 117 }, + { numBlocks: 10, dataCodewordsPerBlock: 118 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 3, dataCodewordsPerBlock: 45 }, + { numBlocks: 23, dataCodewordsPerBlock: 46 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 24 }, + { numBlocks: 31, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 11, dataCodewordsPerBlock: 15 }, + { numBlocks: 31, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x1D33F, + versionNumber: 29, + alignmentPatternCenters: [6, 30, 54, 78, 102, 126], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 7, dataCodewordsPerBlock: 116 }, + { numBlocks: 7, dataCodewordsPerBlock: 117 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 21, dataCodewordsPerBlock: 45 }, + { numBlocks: 7, dataCodewordsPerBlock: 46 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 1, dataCodewordsPerBlock: 23 }, + { numBlocks: 37, dataCodewordsPerBlock: 24 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 19, dataCodewordsPerBlock: 15 }, + { numBlocks: 26, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x1ED75, + versionNumber: 30, + alignmentPatternCenters: [6, 26, 52, 78, 104, 130], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 5, dataCodewordsPerBlock: 115 }, + { numBlocks: 10, dataCodewordsPerBlock: 116 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 19, dataCodewordsPerBlock: 47 }, + { numBlocks: 10, dataCodewordsPerBlock: 48 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 15, dataCodewordsPerBlock: 24 }, + { numBlocks: 25, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 23, dataCodewordsPerBlock: 15 }, + { numBlocks: 25, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x1F250, + versionNumber: 31, + alignmentPatternCenters: [6, 30, 56, 82, 108, 134], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 13, dataCodewordsPerBlock: 115 }, + { numBlocks: 3, dataCodewordsPerBlock: 116 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 46 }, + { numBlocks: 29, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 42, dataCodewordsPerBlock: 24 }, + { numBlocks: 1, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 23, dataCodewordsPerBlock: 15 }, + { numBlocks: 28, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x209D5, + versionNumber: 32, + alignmentPatternCenters: [6, 34, 60, 86, 112, 138], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 115 }], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 10, dataCodewordsPerBlock: 46 }, + { numBlocks: 23, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 10, dataCodewordsPerBlock: 24 }, + { numBlocks: 35, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 19, dataCodewordsPerBlock: 15 }, + { numBlocks: 35, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x216F0, + versionNumber: 33, + alignmentPatternCenters: [6, 30, 58, 86, 114, 142], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 17, dataCodewordsPerBlock: 115 }, + { numBlocks: 1, dataCodewordsPerBlock: 116 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 14, dataCodewordsPerBlock: 46 }, + { numBlocks: 21, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 29, dataCodewordsPerBlock: 24 }, + { numBlocks: 19, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 11, dataCodewordsPerBlock: 15 }, + { numBlocks: 46, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x228BA, + versionNumber: 34, + alignmentPatternCenters: [6, 34, 62, 90, 118, 146], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 13, dataCodewordsPerBlock: 115 }, + { numBlocks: 6, dataCodewordsPerBlock: 116 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 14, dataCodewordsPerBlock: 46 }, + { numBlocks: 23, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 44, dataCodewordsPerBlock: 24 }, + { numBlocks: 7, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 59, dataCodewordsPerBlock: 16 }, + { numBlocks: 1, dataCodewordsPerBlock: 17 }, + ], + }, + ], + }, + { + infoBits: 0x2379F, + versionNumber: 35, + alignmentPatternCenters: [6, 30, 54, 78, 102, 126, 150], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 12, dataCodewordsPerBlock: 121 }, + { numBlocks: 7, dataCodewordsPerBlock: 122 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 12, dataCodewordsPerBlock: 47 }, + { numBlocks: 26, dataCodewordsPerBlock: 48 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 39, dataCodewordsPerBlock: 24 }, + { numBlocks: 14, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 22, dataCodewordsPerBlock: 15 }, + { numBlocks: 41, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x24B0B, + versionNumber: 36, + alignmentPatternCenters: [6, 24, 50, 76, 102, 128, 154], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 6, dataCodewordsPerBlock: 121 }, + { numBlocks: 14, dataCodewordsPerBlock: 122 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 6, dataCodewordsPerBlock: 47 }, + { numBlocks: 34, dataCodewordsPerBlock: 48 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 46, dataCodewordsPerBlock: 24 }, + { numBlocks: 10, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 2, dataCodewordsPerBlock: 15 }, + { numBlocks: 64, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x2542E, + versionNumber: 37, + alignmentPatternCenters: [6, 28, 54, 80, 106, 132, 158], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 17, dataCodewordsPerBlock: 122 }, + { numBlocks: 4, dataCodewordsPerBlock: 123 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 29, dataCodewordsPerBlock: 46 }, + { numBlocks: 14, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 49, dataCodewordsPerBlock: 24 }, + { numBlocks: 10, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 24, dataCodewordsPerBlock: 15 }, + { numBlocks: 46, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x26A64, + versionNumber: 38, + alignmentPatternCenters: [6, 32, 58, 84, 110, 136, 162], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 4, dataCodewordsPerBlock: 122 }, + { numBlocks: 18, dataCodewordsPerBlock: 123 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 13, dataCodewordsPerBlock: 46 }, + { numBlocks: 32, dataCodewordsPerBlock: 47 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 48, dataCodewordsPerBlock: 24 }, + { numBlocks: 14, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 42, dataCodewordsPerBlock: 15 }, + { numBlocks: 32, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x27541, + versionNumber: 39, + alignmentPatternCenters: [6, 26, 54, 82, 110, 138, 166], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 20, dataCodewordsPerBlock: 117 }, + { numBlocks: 4, dataCodewordsPerBlock: 118 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 40, dataCodewordsPerBlock: 47 }, + { numBlocks: 7, dataCodewordsPerBlock: 48 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 43, dataCodewordsPerBlock: 24 }, + { numBlocks: 22, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 10, dataCodewordsPerBlock: 15 }, + { numBlocks: 67, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, + { + infoBits: 0x28C69, + versionNumber: 40, + alignmentPatternCenters: [6, 30, 58, 86, 114, 142, 170], + errorCorrectionLevels: [ + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 19, dataCodewordsPerBlock: 118 }, + { numBlocks: 6, dataCodewordsPerBlock: 119 }, + ], + }, + { + ecCodewordsPerBlock: 28, + ecBlocks: [ + { numBlocks: 18, dataCodewordsPerBlock: 47 }, + { numBlocks: 31, dataCodewordsPerBlock: 48 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 34, dataCodewordsPerBlock: 24 }, + { numBlocks: 34, dataCodewordsPerBlock: 25 }, + ], + }, + { + ecCodewordsPerBlock: 30, + ecBlocks: [ + { numBlocks: 20, dataCodewordsPerBlock: 15 }, + { numBlocks: 61, dataCodewordsPerBlock: 16 }, + ], + }, + ], + }, +]; - /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ - var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - /** Used to match complex or compound words. */ - 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'); +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); +"use strict"; - /** Used to detect strings that need a more robust regexp to match words. */ - 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 ]/; +Object.defineProperty(exports, "__esModule", { value: true }); +var BitMatrix_1 = __webpack_require__(0); +function squareToQuadrilateral(p1, p2, p3, p4) { + var dx3 = p1.x - p2.x + p3.x - p4.x; + var dy3 = p1.y - p2.y + p3.y - p4.y; + if (dx3 === 0 && dy3 === 0) { + return { + a11: p2.x - p1.x, + a12: p2.y - p1.y, + a13: 0, + a21: p3.x - p2.x, + a22: p3.y - p2.y, + a23: 0, + a31: p1.x, + a32: p1.y, + a33: 1, + }; + } + else { + var dx1 = p2.x - p3.x; + var dx2 = p4.x - p3.x; + var dy1 = p2.y - p3.y; + var dy2 = p4.y - p3.y; + var denominator = dx1 * dy2 - dx2 * dy1; + var a13 = (dx3 * dy2 - dx2 * dy3) / denominator; + var a23 = (dx1 * dy3 - dx3 * dy1) / denominator; + return { + a11: p2.x - p1.x + a13 * p2.x, + a12: p2.y - p1.y + a13 * p2.y, + a13: a13, + a21: p4.x - p1.x + a23 * p4.x, + a22: p4.y - p1.y + a23 * p4.y, + a23: a23, + a31: p1.x, + a32: p1.y, + a33: 1, + }; + } +} +function quadrilateralToSquare(p1, p2, p3, p4) { + // Here, the adjoint serves as the inverse: + var sToQ = squareToQuadrilateral(p1, p2, p3, p4); + return { + a11: sToQ.a22 * sToQ.a33 - sToQ.a23 * sToQ.a32, + a12: sToQ.a13 * sToQ.a32 - sToQ.a12 * sToQ.a33, + a13: sToQ.a12 * sToQ.a23 - sToQ.a13 * sToQ.a22, + a21: sToQ.a23 * sToQ.a31 - sToQ.a21 * sToQ.a33, + a22: sToQ.a11 * sToQ.a33 - sToQ.a13 * sToQ.a31, + a23: sToQ.a13 * sToQ.a21 - sToQ.a11 * sToQ.a23, + a31: sToQ.a21 * sToQ.a32 - sToQ.a22 * sToQ.a31, + a32: sToQ.a12 * sToQ.a31 - sToQ.a11 * sToQ.a32, + a33: sToQ.a11 * sToQ.a22 - sToQ.a12 * sToQ.a21, + }; +} +function times(a, b) { + return { + a11: a.a11 * b.a11 + a.a21 * b.a12 + a.a31 * b.a13, + a12: a.a12 * b.a11 + a.a22 * b.a12 + a.a32 * b.a13, + a13: a.a13 * b.a11 + a.a23 * b.a12 + a.a33 * b.a13, + a21: a.a11 * b.a21 + a.a21 * b.a22 + a.a31 * b.a23, + a22: a.a12 * b.a21 + a.a22 * b.a22 + a.a32 * b.a23, + a23: a.a13 * b.a21 + a.a23 * b.a22 + a.a33 * b.a23, + a31: a.a11 * b.a31 + a.a21 * b.a32 + a.a31 * b.a33, + a32: a.a12 * b.a31 + a.a22 * b.a32 + a.a32 * b.a33, + a33: a.a13 * b.a31 + a.a23 * b.a32 + a.a33 * b.a33, + }; +} +function extract(image, location) { + var qToS = quadrilateralToSquare({ x: 3.5, y: 3.5 }, { x: location.dimension - 3.5, y: 3.5 }, { x: location.dimension - 6.5, y: location.dimension - 6.5 }, { x: 3.5, y: location.dimension - 3.5 }); + var sToQ = squareToQuadrilateral(location.topLeft, location.topRight, location.alignmentPattern, location.bottomLeft); + var transform = times(sToQ, qToS); + var matrix = BitMatrix_1.BitMatrix.createEmpty(location.dimension, location.dimension); + var mappingFunction = function (x, y) { + var denominator = transform.a13 * x + transform.a23 * y + transform.a33; + return { + x: (transform.a11 * x + transform.a21 * y + transform.a31) / denominator, + y: (transform.a12 * x + transform.a22 * y + transform.a32) / denominator, + }; + }; + for (var y = 0; y < location.dimension; y++) { + for (var x = 0; x < location.dimension; x++) { + var xValue = x + 0.5; + var yValue = y + 0.5; + var sourcePixel = mappingFunction(xValue, yValue); + matrix.set(x, y, image.get(Math.floor(sourcePixel.x), Math.floor(sourcePixel.y))); + } + } + return { + matrix: matrix, + mappingFunction: mappingFunction, + }; +} +exports.extract = extract; - /** Used to assign default `context` object properties. */ - 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' - ]; - /** Used to make template sourceURLs easier to identify. */ - var templateCounter = -1; +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { - /** Used to identify `toStringTag` values of typed arrays. */ - 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; +"use strict"; - /** Used to identify `toStringTag` values supported by `_.clone`. */ - 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; +Object.defineProperty(exports, "__esModule", { value: true }); +var MAX_FINDERPATTERNS_TO_SEARCH = 4; +var MIN_QUAD_RATIO = 0.5; +var MAX_QUAD_RATIO = 1.5; +var distance = function (a, b) { return Math.sqrt(Math.pow((b.x - a.x), 2) + Math.pow((b.y - a.y), 2)); }; +function sum(values) { + return values.reduce(function (a, b) { return a + b; }); +} +// Takes three finder patterns and organizes them into topLeft, topRight, etc +function reorderFinderPatterns(pattern1, pattern2, pattern3) { + // Find distances between pattern centers + var oneTwoDistance = distance(pattern1, pattern2); + var twoThreeDistance = distance(pattern2, pattern3); + var oneThreeDistance = distance(pattern1, pattern3); + var bottomLeft; + var topLeft; + var topRight; + // Assume one closest to other two is B; A and C will just be guesses at first + if (twoThreeDistance >= oneTwoDistance && twoThreeDistance >= oneThreeDistance) { + _a = [pattern2, pattern1, pattern3], bottomLeft = _a[0], topLeft = _a[1], topRight = _a[2]; + } + else if (oneThreeDistance >= twoThreeDistance && oneThreeDistance >= oneTwoDistance) { + _b = [pattern1, pattern2, pattern3], bottomLeft = _b[0], topLeft = _b[1], topRight = _b[2]; + } + else { + _c = [pattern1, pattern3, pattern2], bottomLeft = _c[0], topLeft = _c[1], topRight = _c[2]; + } + // Use cross product to figure out whether bottomLeft (A) and topRight (C) are correct or flipped in relation to topLeft (B) + // This asks whether BC x BA has a positive z component, which is the arrangement we want. If it's negative, then + // we've got it flipped around and should swap topRight and bottomLeft. + if (((topRight.x - topLeft.x) * (bottomLeft.y - topLeft.y)) - ((topRight.y - topLeft.y) * (bottomLeft.x - topLeft.x)) < 0) { + _d = [topRight, bottomLeft], bottomLeft = _d[0], topRight = _d[1]; + } + return { bottomLeft: bottomLeft, topLeft: topLeft, topRight: topRight }; + var _a, _b, _c, _d; +} +// Computes the dimension (number of modules on a side) of the QR Code based on the position of the finder patterns +function computeDimension(topLeft, topRight, bottomLeft, matrix) { + var moduleSize = (sum(countBlackWhiteRun(topLeft, bottomLeft, matrix, 5)) / 7 + // Divide by 7 since the ratio is 1:1:3:1:1 + sum(countBlackWhiteRun(topLeft, topRight, matrix, 5)) / 7 + + sum(countBlackWhiteRun(bottomLeft, topLeft, matrix, 5)) / 7 + + sum(countBlackWhiteRun(topRight, topLeft, matrix, 5)) / 7) / 4; + if (moduleSize < 1) { + throw new Error("Invalid module size"); + } + var topDimension = Math.round(distance(topLeft, topRight) / moduleSize); + var sideDimension = Math.round(distance(topLeft, bottomLeft) / moduleSize); + var dimension = Math.floor((topDimension + sideDimension) / 2) + 7; + switch (dimension % 4) { + case 0: + dimension++; + break; + case 2: + dimension--; + break; + } + return { dimension: dimension, moduleSize: moduleSize }; +} +// Takes an origin point and an end point and counts the sizes of the black white run from the origin towards the end point. +// Returns an array of elements, representing the pixel size of the black white run. +// Uses a variant of http://en.wikipedia.org/wiki/Bresenham's_line_algorithm +function countBlackWhiteRunTowardsPoint(origin, end, matrix, length) { + var switchPoints = [{ x: Math.floor(origin.x), y: Math.floor(origin.y) }]; + var steep = Math.abs(end.y - origin.y) > Math.abs(end.x - origin.x); + var fromX; + var fromY; + var toX; + var toY; + if (steep) { + fromX = Math.floor(origin.y); + fromY = Math.floor(origin.x); + toX = Math.floor(end.y); + toY = Math.floor(end.x); + } + else { + fromX = Math.floor(origin.x); + fromY = Math.floor(origin.y); + toX = Math.floor(end.x); + toY = Math.floor(end.y); + } + var dx = Math.abs(toX - fromX); + var dy = Math.abs(toY - fromY); + var error = Math.floor(-dx / 2); + var xStep = fromX < toX ? 1 : -1; + var yStep = fromY < toY ? 1 : -1; + var currentPixel = true; + // Loop up until x == toX, but not beyond + for (var x = fromX, y = fromY; x !== toX + xStep; x += xStep) { + // Does current pixel mean we have moved white to black or vice versa? + // Scanning black in state 0,2 and white in state 1, so if we find the wrong + // color, advance to next state or end if we are in state 2 already + var realX = steep ? y : x; + var realY = steep ? x : y; + if (matrix.get(realX, realY) !== currentPixel) { + currentPixel = !currentPixel; + switchPoints.push({ x: realX, y: realY }); + if (switchPoints.length === length + 1) { + break; + } + } + error += dy; + if (error > 0) { + if (y === toY) { + break; + } + y += yStep; + error -= dx; + } + } + var distances = []; + for (var i = 0; i < length; i++) { + if (switchPoints[i] && switchPoints[i + 1]) { + distances.push(distance(switchPoints[i], switchPoints[i + 1])); + } + else { + distances.push(0); + } + } + return distances; +} +// Takes an origin point and an end point and counts the sizes of the black white run in the origin point +// along the line that intersects with the end point. Returns an array of elements, representing the pixel sizes +// of the black white run. Takes a length which represents the number of switches from black to white to look for. +function countBlackWhiteRun(origin, end, matrix, length) { + var rise = end.y - origin.y; + var run = end.x - origin.x; + var towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2)); + var awayFromEnd = countBlackWhiteRunTowardsPoint(origin, { x: origin.x - run, y: origin.y - rise }, matrix, Math.ceil(length / 2)); + var middleValue = towardsEnd.shift() + awayFromEnd.shift() - 1; // Substract one so we don't double count a pixel + return (_a = awayFromEnd.concat(middleValue)).concat.apply(_a, towardsEnd); + var _a; +} +// Takes in a black white run and an array of expected ratios. Returns the average size of the run as well as the "error" - +// that is the amount the run diverges from the expected ratio +function scoreBlackWhiteRun(sequence, ratios) { + var averageSize = sum(sequence) / sum(ratios); + var error = 0; + ratios.forEach(function (ratio, i) { + error += Math.pow((sequence[i] - ratio * averageSize), 2); + }); + return { averageSize: averageSize, error: error }; +} +// Takes an X,Y point and an array of sizes and scores the point against those ratios. +// For example for a finder pattern takes the ratio list of 1:1:3:1:1 and checks horizontal, vertical and diagonal ratios +// against that. +function scorePattern(point, ratios, matrix) { + try { + var horizontalRun = countBlackWhiteRun(point, { x: -1, y: point.y }, matrix, ratios.length); + var verticalRun = countBlackWhiteRun(point, { x: point.x, y: -1 }, matrix, ratios.length); + var topLeftPoint = { + x: Math.max(0, point.x - point.y) - 1, + y: Math.max(0, point.y - point.x) - 1, + }; + var topLeftBottomRightRun = countBlackWhiteRun(point, topLeftPoint, matrix, ratios.length); + var bottomLeftPoint = { + x: Math.min(matrix.width, point.x + point.y) + 1, + y: Math.min(matrix.height, point.y + point.x) + 1, + }; + var bottomLeftTopRightRun = countBlackWhiteRun(point, bottomLeftPoint, matrix, ratios.length); + var horzError = scoreBlackWhiteRun(horizontalRun, ratios); + var vertError = scoreBlackWhiteRun(verticalRun, ratios); + var diagDownError = scoreBlackWhiteRun(topLeftBottomRightRun, ratios); + var diagUpError = scoreBlackWhiteRun(bottomLeftTopRightRun, ratios); + var ratioError = Math.sqrt(horzError.error * horzError.error + + vertError.error * vertError.error + + diagDownError.error * diagDownError.error + + diagUpError.error * diagUpError.error); + var avgSize = (horzError.averageSize + vertError.averageSize + diagDownError.averageSize + diagUpError.averageSize) / 4; + var sizeError = (Math.pow((horzError.averageSize - avgSize), 2) + + Math.pow((vertError.averageSize - avgSize), 2) + + Math.pow((diagDownError.averageSize - avgSize), 2) + + Math.pow((diagUpError.averageSize - avgSize), 2)) / avgSize; + return ratioError + sizeError; + } + catch (_a) { + return Infinity; + } +} +function locate(matrix) { + var finderPatternQuads = []; + var activeFinderPatternQuads = []; + var alignmentPatternQuads = []; + var activeAlignmentPatternQuads = []; + var _loop_1 = function (y) { + var length_1 = 0; + var lastBit = false; + var scans = [0, 0, 0, 0, 0]; + var _loop_2 = function (x) { + var v = matrix.get(x, y); + if (v === lastBit) { + length_1++; + } + else { + scans = [scans[1], scans[2], scans[3], scans[4], length_1]; + length_1 = 1; + lastBit = v; + // Do the last 5 color changes ~ match the expected ratio for a finder pattern? 1:1:3:1:1 of b:w:b:w:b + var averageFinderPatternBlocksize = sum(scans) / 7; + var validFinderPattern = Math.abs(scans[0] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize && + Math.abs(scans[1] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize && + Math.abs(scans[2] - 3 * averageFinderPatternBlocksize) < 3 * averageFinderPatternBlocksize && + Math.abs(scans[3] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize && + Math.abs(scans[4] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize && + !v; // And make sure the current pixel is white since finder patterns are bordered in white + // Do the last 3 color changes ~ match the expected ratio for an alignment pattern? 1:1:1 of w:b:w + var averageAlignmentPatternBlocksize = sum(scans.slice(-3)) / 3; + var validAlignmentPattern = Math.abs(scans[2] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize && + Math.abs(scans[3] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize && + Math.abs(scans[4] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize && + v; // Is the current pixel black since alignment patterns are bordered in black + if (validFinderPattern) { + // Compute the start and end x values of the large center black square + var endX_1 = x - scans[3] - scans[4]; + var startX_1 = endX_1 - scans[2]; + var line = { startX: startX_1, endX: endX_1, y: y }; + // Is there a quad directly above the current spot? If so, extend it with the new line. Otherwise, create a new quad with + // that line as the starting point. + var matchingQuads = activeFinderPatternQuads.filter(function (q) { + return (startX_1 >= q.bottom.startX && startX_1 <= q.bottom.endX) || + (endX_1 >= q.bottom.startX && startX_1 <= q.bottom.endX) || + (startX_1 <= q.bottom.startX && endX_1 >= q.bottom.endX && ((scans[2] / (q.bottom.endX - q.bottom.startX)) < MAX_QUAD_RATIO && + (scans[2] / (q.bottom.endX - q.bottom.startX)) > MIN_QUAD_RATIO)); + }); + if (matchingQuads.length > 0) { + matchingQuads[0].bottom = line; + } + else { + activeFinderPatternQuads.push({ top: line, bottom: line }); + } + } + if (validAlignmentPattern) { + // Compute the start and end x values of the center black square + var endX_2 = x - scans[4]; + var startX_2 = endX_2 - scans[3]; + var line = { startX: startX_2, y: y, endX: endX_2 }; + // Is there a quad directly above the current spot? If so, extend it with the new line. Otherwise, create a new quad with + // that line as the starting point. + var matchingQuads = activeAlignmentPatternQuads.filter(function (q) { + return (startX_2 >= q.bottom.startX && startX_2 <= q.bottom.endX) || + (endX_2 >= q.bottom.startX && startX_2 <= q.bottom.endX) || + (startX_2 <= q.bottom.startX && endX_2 >= q.bottom.endX && ((scans[2] / (q.bottom.endX - q.bottom.startX)) < MAX_QUAD_RATIO && + (scans[2] / (q.bottom.endX - q.bottom.startX)) > MIN_QUAD_RATIO)); + }); + if (matchingQuads.length > 0) { + matchingQuads[0].bottom = line; + } + else { + activeAlignmentPatternQuads.push({ top: line, bottom: line }); + } + } + } + }; + for (var x = -1; x <= matrix.width; x++) { + _loop_2(x); + } + finderPatternQuads.push.apply(finderPatternQuads, activeFinderPatternQuads.filter(function (q) { return q.bottom.y !== y && q.bottom.y - q.top.y >= 2; })); + activeFinderPatternQuads = activeFinderPatternQuads.filter(function (q) { return q.bottom.y === y; }); + alignmentPatternQuads.push.apply(alignmentPatternQuads, activeAlignmentPatternQuads.filter(function (q) { return q.bottom.y !== y; })); + activeAlignmentPatternQuads = activeAlignmentPatternQuads.filter(function (q) { return q.bottom.y === y; }); + }; + for (var y = 0; y <= matrix.height; y++) { + _loop_1(y); + } + finderPatternQuads.push.apply(finderPatternQuads, activeFinderPatternQuads.filter(function (q) { return q.bottom.y - q.top.y >= 2; })); + alignmentPatternQuads.push.apply(alignmentPatternQuads, activeAlignmentPatternQuads); + var finderPatternGroups = finderPatternQuads + .filter(function (q) { return q.bottom.y - q.top.y >= 2; }) // All quads must be at least 2px tall since the center square is larger than a block + .map(function (q) { + var x = (q.top.startX + q.top.endX + q.bottom.startX + q.bottom.endX) / 4; + var y = (q.top.y + q.bottom.y + 1) / 2; + if (!matrix.get(Math.round(x), Math.round(y))) { + return; + } + var lengths = [q.top.endX - q.top.startX, q.bottom.endX - q.bottom.startX, q.bottom.y - q.top.y + 1]; + var size = sum(lengths) / lengths.length; + var score = scorePattern({ x: Math.round(x), y: Math.round(y) }, [1, 1, 3, 1, 1], matrix); + return { score: score, x: x, y: y, size: size }; + }) + .filter(function (q) { return !!q; }) // Filter out any rejected quads from above + .sort(function (a, b) { return a.score - b.score; }) + .map(function (point, i, finderPatterns) { + if (i > MAX_FINDERPATTERNS_TO_SEARCH) { + return null; + } + var otherPoints = finderPatterns + .filter(function (p, ii) { return i !== ii; }) + .map(function (p) { return ({ x: p.x, y: p.y, score: p.score + (Math.pow((p.size - point.size), 2)) / point.size, size: p.size }); }) + .sort(function (a, b) { return a.score - b.score; }); + if (otherPoints.length < 2) { + return null; + } + var score = point.score + otherPoints[0].score + otherPoints[1].score; + return { points: [point].concat(otherPoints.slice(0, 2)), score: score }; + }) + .filter(function (q) { return !!q; }) // Filter out any rejected finder patterns from above + .sort(function (a, b) { return a.score - b.score; }); + if (finderPatternGroups.length === 0) { + return null; + } + var _a = reorderFinderPatterns(finderPatternGroups[0].points[0], finderPatternGroups[0].points[1], finderPatternGroups[0].points[2]), topRight = _a.topRight, topLeft = _a.topLeft, bottomLeft = _a.bottomLeft; + // Now that we've found the three finder patterns we can determine the blockSize and the size of the QR code. + // We'll use these to help find the alignment pattern but also later when we do the extraction. + var dimension; + var moduleSize; + try { + (_b = computeDimension(topLeft, topRight, bottomLeft, matrix), dimension = _b.dimension, moduleSize = _b.moduleSize); + } + catch (e) { + return null; + } + // Now find the alignment pattern + var bottomRightFinderPattern = { + x: topRight.x - topLeft.x + bottomLeft.x, + y: topRight.y - topLeft.y + bottomLeft.y, + }; + var modulesBetweenFinderPatterns = ((distance(topLeft, bottomLeft) + distance(topLeft, topRight)) / 2 / moduleSize); + var correctionToTopLeft = 1 - (3 / modulesBetweenFinderPatterns); + var expectedAlignmentPattern = { + x: topLeft.x + correctionToTopLeft * (bottomRightFinderPattern.x - topLeft.x), + y: topLeft.y + correctionToTopLeft * (bottomRightFinderPattern.y - topLeft.y), + }; + var alignmentPatterns = alignmentPatternQuads + .map(function (q) { + var x = (q.top.startX + q.top.endX + q.bottom.startX + q.bottom.endX) / 4; + var y = (q.top.y + q.bottom.y + 1) / 2; + if (!matrix.get(Math.floor(x), Math.floor(y))) { + return; + } + var lengths = [q.top.endX - q.top.startX, q.bottom.endX - q.bottom.startX, (q.bottom.y - q.top.y + 1)]; + var size = sum(lengths) / lengths.length; + var sizeScore = scorePattern({ x: Math.floor(x), y: Math.floor(y) }, [1, 1, 1], matrix); + var score = sizeScore + distance({ x: x, y: y }, expectedAlignmentPattern); + return { x: x, y: y, score: score }; + }) + .filter(function (v) { return !!v; }) + .sort(function (a, b) { return a.score - b.score; }); + // If there are less than 15 modules between finder patterns it's a version 1 QR code and as such has no alignmemnt pattern + // so we can only use our best guess. + var alignmentPattern = modulesBetweenFinderPatterns >= 15 && alignmentPatterns.length ? alignmentPatterns[0] : expectedAlignmentPattern; + return { + alignmentPattern: { x: alignmentPattern.x, y: alignmentPattern.y }, + bottomLeft: { x: bottomLeft.x, y: bottomLeft.y }, + dimension: dimension, + topLeft: { x: topLeft.x, y: topLeft.y }, + topRight: { x: topRight.x, y: topRight.y }, + }; + var _b; +} +exports.locate = locate; - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - /** Used to map HTML entities to characters. */ - var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'" - }; +/***/ }) +/******/ ])["default"]; +}); +},{}],75:[function(require,module,exports){ +(function (global){ +/** + * @license + * Lodash + * Copyright JS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +;(function() { - /** Used to escape characters for inclusion in compiled string literals. */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; - /** Built-in method references without a dependency on `root`. */ - var freeParseFloat = parseFloat, - freeParseInt = parseInt; + /** Used as the semantic version number. */ + var VERSION = '4.17.11'; - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + /** Error message constants. */ + var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', + FUNC_ERROR_TEXT = 'Expected a function'; - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; + /** Used to compose bitmasks for function metadata. */ + 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; - if (types) { - return types; - } + /** Used as default options for `_.truncate`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); + /** Used to detect hot functions by number of calls within a span of milliseconds. */ + var HOT_COUNT = 800, + HOT_SPAN = 16; - /* Node.js helper references. */ - 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; + /** Used to indicate the type of lazy iteratees. */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; - /*--------------------------------------------------------------------------*/ + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - /** - * A specialized version of `baseAggregator` for arrays. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; + /** Used to associate wrap methods with their bit flags. */ + 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] + ]; - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; - } + /** `Object#toString` result references. */ + 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]'; - /** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; + 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]'; - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.forEachRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; + /** Used to match empty string literals in compiled template source. */ + var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; - } + /** Used to match HTML entities and HTML characters. */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source), + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - /** - * A specialized version of `_.every` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - */ - function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; + /** Used to match template delimiters. */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; - } + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } + /** Used to match leading and trailing whitespace. */ + var reTrim = /^\s+|\s+$/g, + reTrimStart = /^\s+/, + reTrimEnd = /\s+$/; - /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; - } + /** Used to match wrap detail comments. */ + var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; - /** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; + /** Used to match words composed of alphanumeric characters. */ + var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; - } + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; /** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). */ - function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; - /** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array == null ? 0 : array.length; + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; - } + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; - /** - * A specialized version of `_.reduceRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - 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; - } + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; + /** Used to match Latin Unicode letters (excluding mathematical operators). */ + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; - /** - * Gets the size of an ASCII `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - var asciiSize = baseProperty('length'); + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - /** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function asciiToArray(string) { - return string.split(''); - } - - /** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function asciiWords(string) { - return string.match(reAsciiWord) || []; - } + /** Used to compose unicode character classes. */ + 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; - /** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the found element or its key, else `undefined`. - */ - function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = key; - return false; - } - }); - return result; - } + /** Used to compose unicode capture groups. */ + var rsApos = "['\u2019]", + 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'; - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); + /** Used to compose unicode regexes. */ + 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('|') + ')'; - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } + /** Used to match apostrophes. */ + var reApos = RegExp(rsApos, 'g'); /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ - function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); - } + var reComboMark = RegExp(rsCombo, 'g'); - /** - * This function is like `baseIndexOf` except that it accepts a comparator. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @param {Function} comparator The comparator invoked per element. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; + /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ + var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } - } - return -1; - } + /** Used to match complex or compound words. */ + 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'); - /** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ - function baseIsNaN(value) { - return value !== value; - } + /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ + var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - /** - * The base implementation of `_.mean` and `_.meanBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the mean. - */ - function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? (baseSum(array, iteratee) / length) : NAN; - } + /** Used to detect strings that need a more robust regexp to match words. */ + 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 ]/; - /** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; - } + /** Used to assign default `context` object properties. */ + 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' + ]; - /** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; - } + /** Used to make template sourceURLs easier to identify. */ + var templateCounter = -1; - /** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for iteratee shorthands, which iterates over `collection` using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of - * `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ - 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; - } + /** Used to identify `toStringTag` values of typed arrays. */ + 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; - /** - * The base implementation of `_.sortBy` which uses `comparer` to define the - * sort order of `array` and replaces criteria objects with their corresponding - * values. + /** Used to identify `toStringTag` values supported by `_.clone`. */ + 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; + + /** Used to map Latin Unicode letters to basic Latin letters. */ + var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 's' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Built-in method references without a dependency on `root`. */ + var freeParseFloat = parseFloat, + freeParseInt = parseInt; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + /** Detect free variable `exports`. */ + var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports`. */ + var moduleExports = freeModule && freeModule.exports === freeExports; + + /** Detect free variable `process` from Node.js. */ + var freeProcess = moduleExports && freeGlobal.process; + + /** Used to access faster Node.js helpers. */ + var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} + }()); + + /* Node.js helper references. */ + 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; + + /*--------------------------------------------------------------------------*/ + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. * * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. */ - function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; + 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 array; + return func.apply(thisArg, args); } /** - * The base implementation of `_.sum` and `_.sumBy` without support for - * iteratee shorthands. + * A specialized version of `baseAggregator` for arrays. * * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. */ - function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; + function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } + var value = array[index]; + setter(accumulator, value, iteratee(value), array); } - return result; + return accumulator; } /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. * * @private - * @param {number} n The number of times to invoke `iteratee`. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. + * @returns {Array} Returns `array`. */ - function baseTimes(n, iteratee) { + function arrayEach(array, iteratee) { var index = -1, - result = Array(n); + length = array == null ? 0 : array.length; - while (++index < n) { - result[index] = iteratee(index); + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } } - return result; + return array; } /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. + * A specialized version of `_.forEachRight` for arrays without support for + * iteratee shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); + function arrayEachRight(array, iteratee) { + var length = array == null ? 0 : array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; } /** - * The base implementation of `_.unary` without support for storing metadata. + * A specialized version of `_.every` for arrays without support for + * iteratee shorthands. * * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. */ - function baseUnary(func) { - return function(value) { - return func(value); - }; + 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; } /** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. */ - function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); + 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; } /** - * Checks if a `cache` value for `key` exists. + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. * * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. */ - function cacheHas(cache, key) { - return cache.has(key); + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; } /** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. + * This function is like `arrayIncludes` except that it accepts a comparator. * * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. */ - function charsStartIndex(strSymbols, chrSymbols) { + function arrayIncludesWith(array, value, comparator) { var index = -1, - length = strSymbols.length; + length = array == null ? 0 : array.length; - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; } /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. * * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. */ - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; } /** - * Gets the number of `placeholder` occurrences in `array`. + * Appends the elements of `values` to `array`. * * @private - * @param {Array} array The array to inspect. - * @param {*} placeholder The placeholder to search for. - * @returns {number} Returns the placeholder count. + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. */ - function countHolders(array, placeholder) { - var length = array.length, - result = 0; + function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; - while (length--) { - if (array[length] === placeholder) { - ++result; - } + while (++index < length) { + array[offset + index] = values[index]; } - return result; + return array; } /** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. * * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. */ - var deburrLetter = basePropertyOf(deburredLetters); + 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; + } /** - * Used by `_.escape` to convert characters to HTML entities. + * A specialized version of `_.reduceRight` for arrays without support for + * iteratee shorthands. * * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. */ - var escapeHtmlChar = basePropertyOf(htmlEscapes); + 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; + } /** - * Used by `_.template` to escape characters for inclusion in compiled string literals. + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. * * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ - function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; + 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; } /** - * Gets the value at `key` of `object`. + * Gets the size of an ASCII `string`. * * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. + * @param {string} string The string inspect. + * @returns {number} Returns the string size. */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } + var asciiSize = baseProperty('length'); /** - * Checks if `string` contains Unicode symbols. + * Converts an ASCII `string` to an array. * * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. */ - function hasUnicode(string) { - return reHasUnicode.test(string); + function asciiToArray(string) { + return string.split(''); } /** - * Checks if `string` contains a word composed of Unicode symbols. + * Splits an ASCII `string` into an array of its words. * * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. */ - function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); + function asciiWords(string) { + return string.match(reAsciiWord) || []; } /** - * Converts `iterator` to an array. + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. * * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. + * @param {Array|Object} collection The collection to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the found element or its key, else `undefined`. */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } + function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = key; + return false; + } + }); return result; } /** - * Converts `map` to its key-value pairs. + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. * * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; } /** - * Creates a unary function that invokes `func` with its argument transformed. + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; + function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. + * This function is like `baseIndexOf` except that it accepts a comparator. * * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. */ - function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; while (++index < length) { - var value = array[index]; - if (value === placeholder || value === PLACEHOLDER) { - array[index] = PLACEHOLDER; - result[resIndex++] = index; + if (comparator(array[index], value)) { + return index; } } - return result; + return -1; } /** - * Converts `set` to an array of its values. + * The base implementation of `_.isNaN` without support for number objects. * * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; + function baseIsNaN(value) { + return value !== value; } /** - * Converts `set` to its value-value pairs. + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. * * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; + function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? (baseSum(array, iteratee) / length) : NAN; } /** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. + * The base implementation of `_.property` without support for deep paths. * * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. */ - function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; } /** - * A specialized version of `_.lastIndexOf` which performs strict equality - * comparisons of values, i.e. `===`. + * The base implementation of `_.propertyOf` without support for deep paths. * * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. */ - function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; } /** - * Gets the number of symbols in `string`. + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. * * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. */ - function stringSize(string) { - return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + 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; } /** - * Converts `string` to an array. + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. * * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. */ - function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; } /** - * Used by `_.unescape` to convert HTML entities to characters. + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. * * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. */ - var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + 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; + } /** - * Gets the size of a Unicode `string`. + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. * * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. */ - function unicodeSize(string) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { - ++result; + function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); } return result; } /** - * Converts a Unicode `string` to an array. + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. * * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the key-value pairs. */ - function unicodeToArray(string) { - return string.match(reUnicode) || []; + function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); } /** - * Splits a Unicode `string` into an array of its words. + * The base implementation of `_.unary` without support for storing metadata. * * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. */ - function unicodeWords(string) { - return string.match(reUnicodeWord) || []; + function baseUnary(func) { + return function(value) { + return func(value); + }; } - /*--------------------------------------------------------------------------*/ - /** - * Create a new pristine `lodash` function using the `context` object. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Util - * @param {Object} [context=root] The context object. - * @returns {Function} Returns a new `lodash` function. - * @example - * - * _.mixin({ 'foo': _.constant('foo') }); - * - * var lodash = _.runInContext(); - * lodash.mixin({ 'bar': lodash.constant('bar') }); + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. * - * _.isFunction(_.foo); - * // => true - * _.isFunction(_.bar); - * // => false + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); + } + + /** + * Checks if a `cache` value for `key` exists. * - * lodash.isFunction(lodash.foo); - * // => false - * lodash.isFunction(lodash.bar); - * // => true + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function cacheHas(cache, key) { + return cache.has(key); + } + + /** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. * - * // Create a suped-up `defer` in Node.js. - * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. */ - var runInContext = (function runInContext(context) { - context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); + function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; - /** Built-in constructor references. */ - 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; + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } - /** Used for built-in method references. */ - var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ + function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; - /** Used to detect overreaching core-js shims. */ - var coreJsData = context['__core-js_shared__']; + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; + /** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ + function countHolders(array, placeholder) { + var length = array.length, + result = 0; - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; + } - /** Used to generate unique IDs. */ - var idCounter = 0; + /** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + var deburrLetter = basePropertyOf(deburredLetters); - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + var escapeHtmlChar = basePropertyOf(htmlEscapes); - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; + } - /** Used to infer the `Object` constructor. */ - var objectCtorString = funcToString.call(Object); + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; + /** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ + function hasUnicode(string) { + return reHasUnicode.test(string); + } - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); + /** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ + function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); + } - /** Built-in value references. */ - 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; + /** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ + function iteratorToArray(iterator) { + var data, + result = []; - var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; + } - /** Mocked built-ins. */ - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, - ctxNow = Date && Date.now !== root.Date.now && Date.now, - ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + /** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ + function mapToArray(map) { + var index = -1, + result = Array(map.size); - /* Built-in method references for those with the same name as other `lodash` methods. */ - 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; + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; + } - /* Built-in method references that are verified to be native. */ - 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'); + /** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ + function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; + } - /** Used to store function metadata. */ - var metaMap = WeakMap && new WeakMap; + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; - /** Used to lookup unminified function names. */ - var realNames = {}; + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; + } - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); + /** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ + function setToArray(set) { + var index = -1, + result = Array(set.size); - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; + set.forEach(function(value) { + result[++index] = value; + }); + return result; + } - /*------------------------------------------------------------------------*/ + /** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ + function setToPairs(set) { + var index = -1, + result = Array(set.size); - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chain sequences. Methods that operate on and return arrays, collections, - * and functions can be chained together. Methods that retrieve a single value - * or may return a primitive value will automatically end the chain sequence - * and return the unwrapped value. Otherwise, the value must be unwrapped - * with `_#value`. - * - * Explicit chain sequences, which must be unwrapped with `_#value`, may be - * enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, it's deferred until - * `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. - * Shortcut fusion is an optimization to merge iteratee calls; this avoids - * the creation of intermediate arrays and can greatly reduce the number of - * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array and iteratees accept only - * one argument. The heuristic for whether a section qualifies for shortcut - * fusion is subject to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, - * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, - * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, - * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, - * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, - * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, - * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, - * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, - * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, - * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, - * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, - * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, - * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, - * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, - * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, - * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, - * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, - * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, - * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, - * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, - * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, - * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, - * `zipObject`, `zipObjectDeep`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, - * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, - * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, - * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, - * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, - * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Seq - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // Returns an unwrapped value. - * wrapped.reduce(_.add); - * // => 6 - * - * // Returns a wrapped value. - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - 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); - } + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; + } + + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; } - return new LodashWrapper(value); } + return -1; + } - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - 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; - }; - }()); - - /** - * The function whose prototype chain sequence wrappers inherit from. - * - * @private - */ - function baseLodash() { - // No operation performed. + /** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } } + return index; + } - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; + /** + * Gets the number of symbols in `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ + function stringSize(string) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); + } + + /** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + + /** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; } + return result; + } - /** - * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB) as well as ES2015 template strings. Change the - * following template settings to use alternative delimiters. - * - * @static - * @memberOf _ - * @type {Object} - */ - lodash.templateSettings = { + /** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function unicodeToArray(string) { + return string.match(reUnicode) || []; + } - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'escape': reEscape, + /** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function unicodeWords(string) { + return string.match(reUnicodeWord) || []; + } - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'evaluate': reEvaluate, + /*--------------------------------------------------------------------------*/ - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'interpolate': reInterpolate, + /** + * Create a new pristine `lodash` function using the `context` object. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Util + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // Create a suped-up `defer` in Node.js. + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + var runInContext = (function runInContext(context) { + context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type {string} - */ - 'variable': '', + /** Built-in constructor references. */ + 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; - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type {Object} - */ - 'imports': { + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type {Function} - */ - '_': lodash - } - }; + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; - // Ensure wrappers are instances of `baseLodash`. - lodash.prototype = baseLodash.prototype; - lodash.prototype.constructor = lodash; + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; - /*------------------------------------------------------------------------*/ + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); /** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @constructor - * @param {*} value The value to wrap. + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. */ - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } + var nativeObjectToString = objectProto.toString; - /** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ - 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; - } + /** Used to infer the `Object` constructor. */ + var objectCtorString = funcToString.call(Object); - /** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ - 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; - } + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; - /** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ - 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__); + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); - if (!isArr || (!isRight && arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; + /** Built-in value references. */ + 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; - outer: - while (length-- && resIndex < takeCount) { - index += dir; + var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); - var iterIndex = -1, - value = array[index]; + /** Mocked built-ins. */ + var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, + ctxNow = Date && Date.now !== root.Date.now && Date.now, + ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); + /* Built-in method references for those with the same name as other `lodash` methods. */ + 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; - 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; - } + /* Built-in method references that are verified to be native. */ + 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'); - // Ensure `LazyWrapper` is an instance of `baseLodash`. - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; - /*------------------------------------------------------------------------*/ + /** Used to lookup unminified function names. */ + var realNames = {}; - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } + /*------------------------------------------------------------------------*/ /** - * Removes `key` and its value from the hash. + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the hash value for `key`. + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; - } - - /** - * Checks if a hash value for `key` exists. + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); - } - - /** - * Sets the hash `key` to `value`. + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an list cache object. + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. * - * @private + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - 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]); - } - } - - /** - * Removes all key-value entries from the list cache. + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Removes `key` and its value from the list cache. + * function square(n) { + * return n * n; + * } * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true */ - 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); + 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); + } } - --this.size; - return true; + return new LodashWrapper(value); } /** - * Gets the list cache value for `key`. + * The base implementation of `_.create` without support for assigning + * properties to the created object. * * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. + * @param {Object} proto The object to inherit from. + * @returns {Object} Returns the new object. */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } + 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; + }; + }()); /** - * Checks if a list cache value for `key` exists. + * The function whose prototype chain sequence wrappers inherit from. * * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; + function baseLodash() { + // No operation performed. } /** - * Sets the list cache `key` to `value`. + * The base constructor for creating `lodash` wrapper objects. * * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. */ - 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; + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined; } - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /*------------------------------------------------------------------------*/ - /** - * Creates a map cache object to store key-value pairs. + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. + * @static + * @memberOf _ + * @type {Object} */ - 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]); - } - } + lodash.templateSettings = { - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; - } + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type {string} + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type {Object} + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type {Function} + */ + '_': lodash + } + }; + + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + /*------------------------------------------------------------------------*/ /** - * Removes `key` and its value from the map. + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. + * @constructor + * @param {*} value The value to wrap. */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; } /** - * Gets the map value for `key`. + * Creates a clone of the lazy wrapper object. * * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); + 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; } /** - * Checks if a map value for `key` exists. + * Reverses the direction of lazy iteration. * * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); + 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; } /** - * Sets the map `key` to `value`. + * Extracts the unwrapped value from its lazy wrapper. * * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; + 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__); - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; + 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; } - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; + // Ensure `LazyWrapper` is an instance of `baseLodash`. + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; /*------------------------------------------------------------------------*/ /** - * - * Creates an array cache object to store unique values. + * Creates a hash object. * * @private * @constructor - * @param {Array} [values] The values to cache. + * @param {Array} [entries] The key-value pairs to cache. */ - function SetCache(values) { + function Hash(entries) { var index = -1, - length = values == null ? 0 : values.length; + length = entries == null ? 0 : entries.length; - this.__data__ = new MapCache; + this.clear(); while (++index < length) { - this.add(values[index]); + var entry = entries[index]; + this.set(entry[0], entry[1]); } } /** - * Adds `value` to the array cache. + * Removes all key-value entries from the hash. * * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. + * @name clear + * @memberOf Hash */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; } /** - * Checks if `value` is in the array cache. + * Removes `key` and its value from the hash. * * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ - function setCacheHas(value) { - return this.__data__.has(value); + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; } - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /*------------------------------------------------------------------------*/ - /** - * Creates a stack cache object to store key-value pairs. + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; + } + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); + } + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; + 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]); + } } /** - * Removes all key-value entries from the stack. + * Removes all key-value entries from the list cache. * * @private * @name clear - * @memberOf Stack + * @memberOf ListCache */ - function stackClear() { - this.__data__ = new ListCache; + function listCacheClear() { + this.__data__ = []; this.size = 0; } /** - * Removes `key` and its value from the stack. + * Removes `key` and its value from the list cache. * * @private * @name delete - * @memberOf Stack + * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ - function stackDelete(key) { + function listCacheDelete(key) { var data = this.__data__, - result = data['delete'](key); + index = assocIndexOf(data, key); - this.size = data.size; - return result; + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; } /** - * Gets the stack value for `key`. + * Gets the list cache value for `key`. * * @private * @name get - * @memberOf Stack + * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ - function stackGet(key) { - return this.__data__.get(key); + function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; } /** - * Checks if a stack value for `key` exists. + * Checks if a list cache value for `key` exists. * * @private * @name has - * @memberOf Stack + * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ - function stackHas(key) { - return this.__data__.has(key); + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; } /** - * Sets the stack `key` to `value`. + * Sets the list cache `key` to `value`. * * @private * @name set - * @memberOf Stack + * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. + * @returns {Object} Returns the list cache instance. */ - 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); + 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; } - data.set(key, value); - this.size = data.size; return this; } - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; /*------------------------------------------------------------------------*/ /** - * Creates an array of the enumerable property names of the array-like `value`. + * Creates a map cache object to store key-value pairs. * * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ - 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; + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); } - return result; } /** - * A specialized version of `_.sample` for arrays. + * Removes all key-value entries from the map. * * @private - * @param {Array} array The array to sample. - * @returns {*} Returns the random element. + * @name clear + * @memberOf MapCache */ - function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined; + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; } /** - * A specialized version of `_.sampleSize` for arrays. + * Removes `key` and its value from the map. * * @private - * @param {Array} array The array to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; } /** - * A specialized version of `_.shuffle` for arrays. + * Gets the map value for `key`. * * @private - * @param {Array} array The array to shuffle. - * @returns {Array} Returns the new shuffled array. + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ - function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); + function mapCacheGet(key) { + return getMapData(this, key).get(key); } /** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. + * Checks if a map value for `key` exists. * * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ - function assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } + function mapCacheHas(key) { + return getMapData(this, key).has(key); } /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. + * Sets the map `key` to `value`. * * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. */ - function 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 mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; } + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + /*------------------------------------------------------------------------*/ + /** - * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * Creates an array cache object to store unique values. * * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. + * @constructor + * @param {Array} [values] The values to cache. */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } + function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); } - return -1; } /** - * Aggregates elements of `collection` on `accumulator` with keys transformed - * by `iteratee` and values set by `setter`. + * Adds `value` to the array cache. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. */ - function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function(value, key, collection) { - setter(accumulator, value, iteratee(value), collection); - }); - return accumulator; + function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; } /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. + * Checks if `value` is in the array cache. * * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); + function setCacheHas(value) { + return this.__data__.has(value); } + // Add methods to `SetCache`. + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + + /*------------------------------------------------------------------------*/ + /** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. + * Creates a stack cache object to store key-value pairs. * * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); + function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; } /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. + * Removes all key-value entries from the stack. * * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. + * @name clear + * @memberOf Stack */ - 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 stackClear() { + this.__data__ = new ListCache; + this.size = 0; } /** - * The base implementation of `_.at` without support for individual paths. + * Removes `key` and its value from the stack. * * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths to pick. - * @returns {Array} Returns the picked elements. + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ - function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; + function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); - while (++index < length) { - result[index] = skip ? undefined : get(object, paths[index]); - } + this.size = data.size; return result; } /** - * The base implementation of `_.clamp` which doesn't coerce arguments. + * Gets the stack value for `key`. * * @private - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ - 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 stackGet(key) { + return this.__data__.get(key); } /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. + * Checks if a stack value for `key` exists. * * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ - function 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; + function stackHas(key) { + return this.__data__.has(key); + } - 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); + /** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ + function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; } + data = this.__data__ = new MapCache(pairs); } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - - return result; - } + data.set(key, value); + this.size = data.size; + return this; + } - if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; - return result; - } + /*------------------------------------------------------------------------*/ - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + /** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ + 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; - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); + } return result; } /** - * The base implementation of `_.conforms` which doesn't clone `source`. + * A specialized version of `_.sample` for arrays. * * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. */ - function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; } /** - * The base implementation of `_.conformsTo` which accepts `props` to check. + * A specialized version of `_.sampleSize` for arrays. * * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. */ - 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 arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); } /** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. + * A specialized version of `_.shuffle` for arrays. * * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); } /** - * The base implementation of methods like `_.difference` without support - * for excluding multiple arrays or iteratee shorthands. + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. * * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. */ - 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); - } + function assignMergeValue(object, key, value) { + if ((value !== undefined && !eq(object[key], value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); } - return result; } /** - * The base implementation of `_.forEach` without support for iteratee shorthands. + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. */ - var baseEach = createBaseEach(baseForOwn); + 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); + } + } /** - * The base implementation of `_.forEachRight` without support for iteratee shorthands. + * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. */ - var baseEachRight = createBaseEach(baseForOwnRight, true); + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } /** - * The base implementation of `_.every` without support for iteratee shorthands. + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. * * @private * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; + function baseAggregator(collection, setter, iteratee, accumulator) { + baseEach(collection, function(value, key, collection) { + setter(accumulator, value, iteratee(value), collection); }); - return result; + return accumulator; } /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. + * The base implementation of `_.assign` without support for multiple sources + * or `customizer` functions. * * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. */ - 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 baseAssign(object, source) { + return object && copyObject(source, keys(source), object); } /** - * The base implementation of `_.fill` without an iteratee call guard. + * The base implementation of `_.assignIn` without support for multiple sources + * or `customizer` functions. * * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. */ - 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 baseAssignIn(object, source) { + return object && copyObject(source, keysIn(source), object); } /** - * The base implementation of `_.filter` without support for iteratee shorthands. + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } } /** - * The base implementation of `_.flatten` with support for restricting flattening. + * The base implementation of `_.at` without support for individual paths. * * @private - * @param {Array} array The array to flatten. - * @param {number} depth The maximum recursion depth. - * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. - * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. + * @param {Object} object The object to iterate over. + * @param {string[]} paths The property paths to pick. + * @returns {Array} Returns the picked elements. */ - function baseFlatten(array, depth, predicate, isStrict, result) { + function baseAt(object, paths) { var index = -1, - length = array.length; - - predicate || (predicate = isFlattenable); - result || (result = []); + length = paths.length, + result = Array(length), + skip = object == null; while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } + result[index] = skip ? undefined : get(object, paths[index]); } return result; } /** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. + * The base implementation of `_.clamp` which doesn't coerce arguments. * * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. */ - var baseFor = createBaseFor(); + 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; + } /** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. + * The base implementation of `_.clone` and `_.cloneDeep` which tracks + * traversed objects. * * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. + * @param {*} value The value to clone. + * @param {boolean} bitmask The bitmask flags. + * 1 - Deep clone + * 2 - Flatten inherited properties + * 4 - Clone symbols + * @param {Function} [customizer] The function to customize cloning. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The parent object of `value`. + * @param {Object} [stack] Tracks traversed objects and their clone counterparts. + * @returns {*} Returns the cloned value. */ - var baseForRight = createBaseFor(true); + 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; - /** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); + 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); + } + } + // Check for circular references and return its corresponding clone. + stack || (stack = new Stack); + var stacked = stack.get(value); + if (stacked) { + return stacked; + } + stack.set(value, result); + + 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]; + } + // Recursively populate clone (susceptible to call stack limits). + assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); + }); + return result; } /** - * The base implementation of `_.forOwnRight` without support for iteratee shorthands. + * The base implementation of `_.conforms` which doesn't clone `source`. * * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. */ - function baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); + function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; } /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. + * The base implementation of `_.conformsTo` which accepts `props` to check. * * @private * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. */ - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ - function baseGet(object, path) { - path = castPath(path, object); - - var index = 0, - length = path.length; + 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]; - while (object != null && index < length) { - object = object[toKey(path[index++])]; + if ((value === undefined && !(key in object)) || !predicate(value)) { + return false; + } } - return (index && index == length) ? object : undefined; + return true; } /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. * * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); } /** - * The base implementation of `getTag` without fallbacks for buggy environments. + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. * * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; + function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } + 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); - /** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ - function baseGt(value, other) { - return value > other; + 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; } /** - * The base implementation of `_.has` without support for deep paths. + * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. */ - function baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); - } + var baseEach = createBaseEach(baseForOwn); /** - * The base implementation of `_.hasIn` without support for deep paths. + * The base implementation of `_.forEachRight` without support for iteratee shorthands. * * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. */ - function baseHasIn(object, key) { - return object != null && key in Object(object); - } + var baseEachRight = createBaseEach(baseForOwnRight, true); /** - * The base implementation of `_.inRange` which doesn't coerce arguments. + * The base implementation of `_.every` without support for iteratee shorthands. * * @private - * @param {number} number The number to check. - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` */ - function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; } /** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. + * The base implementation of methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. * * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. */ - 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]; - + function baseExtremum(array, iteratee, comparator) { var index = -1, - seen = caches[0]; + length = array.length; - outer: - while (++index < length && result.length < maxLength) { + while (++index < length) { var value = array[index], - computed = iteratee ? iteratee(value) : value; + current = iteratee(value); - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + if (current != null && (computed === undefined + ? (current === current && !isSymbol(current)) + : comparator(current, computed) )) { - 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); + var computed = current, + result = value; } } return result; } /** - * The base implementation of `_.invert` and `_.invertBy` which inverts - * `object` with values transformed by `iteratee` and set by `setter`. + * The base implementation of `_.fill` without an iteratee call guard. * * @private - * @param {Object} object The object to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform values. - * @param {Object} accumulator The initial inverted object. - * @returns {Function} Returns `accumulator`. + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. */ - function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function(value, key, object) { - setter(accumulator, iteratee(value), key, object); - }); - return accumulator; - } + function baseFill(array, value, start, end) { + var length = array.length; - /** - * The base implementation of `_.invoke` without support for individual - * method arguments. + 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; + } + + /** + * The base implementation of `_.filter` without support for iteratee shorthands. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. */ - 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 baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; } /** - * The base implementation of `_.isArguments`. + * The base implementation of `_.flatten` with support for restricting flattening. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; } /** - * The base implementation of `_.isArrayBuffer` without Node.js optimizations. + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. */ - function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; - } + var baseFor = createBaseFor(); /** - * The base implementation of `_.isDate` without Node.js optimizations. + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. */ - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } + var baseForRight = createBaseFor(true); /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. + * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. */ - 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 baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); } /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. + * The base implementation of `_.forOwnRight` without support for iteratee shorthands. * * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. */ - 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 baseForOwnRight(object, iteratee) { + return object && baseForRight(object, iteratee, keys); } /** - * The base implementation of `_.isMap` without Node.js optimizations. + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. */ - function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; + function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); } /** - * The base implementation of `_.isMatch` without support for iteratee shorthands. + * The base implementation of `_.get` without support for default values. * * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. */ - function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; + function baseGet(object, path) { + path = castPath(path, object); - 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]; + var index = 0, + length = path.length; - 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; - } - } + while (object != null && index < length) { + object = object[toKey(path[index++])]; } - return true; + return (index && index == length) ? object : undefined; } /** - * The base implementation of `_.isNative` without bad shim checks. + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); + function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } /** - * The base implementation of `_.isRegExp` without Node.js optimizations. + * The base implementation of `getTag` without fallbacks for buggy environments. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. */ - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); } /** - * The base implementation of `_.isSet` without Node.js optimizations. + * The base implementation of `_.gt` which doesn't coerce arguments. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. */ - function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; + function baseGt(value, other) { + return value > other; } /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. + * The base implementation of `_.has` without support for deep paths. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); } /** - * The base implementation of `_.iteratee`. + * The base implementation of `_.hasIn` without support for deep paths. * * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. */ - function baseIteratee(value) { - // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. - // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. - 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 baseHasIn(object, key) { + return object != null && key in Object(object); } /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * The base implementation of `_.inRange` which doesn't coerce arguments. * * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. + * @param {number} number The number to check. + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. */ - 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 baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); } /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. + * The base implementation of methods like `_.intersection`, without support + * for iteratee shorthands, that accepts an array of arrays to inspect. * * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), + 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 = []; - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); + 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; } /** - * The base implementation of `_.lt` which doesn't coerce arguments. + * The base implementation of `_.invert` and `_.invertBy` which inverts + * `object` with values transformed by `iteratee` and set by `setter`. * * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. + * @param {Object} object The object to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform values. + * @param {Object} accumulator The initial inverted object. + * @returns {Function} Returns `accumulator`. */ - function baseLt(value, other) { - return value < other; + function baseInverter(object, setter, iteratee, accumulator) { + baseForOwn(object, function(value, key, object) { + setter(accumulator, iteratee(value), key, object); + }); + return accumulator; } /** - * The base implementation of `_.map` without support for iteratee shorthands. + * The base implementation of `_.invoke` without support for individual + * method arguments. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. */ - 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 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); } /** - * The base implementation of `_.matches` which doesn't clone `source`. + * The base implementation of `_.isArguments`. * * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ - 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 baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; } /** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * The base implementation of `_.isArrayBuffer` without Node.js optimizations. * * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. */ - 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 baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; } /** - * The base implementation of `_.merge` without support for multiple sources. + * The base implementation of `_.isDate` without Node.js optimizations. * * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. */ - 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 baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; } /** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. * * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ - 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; + function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); + } - var isCommon = newValue === undefined; + /** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + 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); - if (isCommon) { - var isArr = isArray(srcValue), - isBuff = !isArr && isBuffer(srcValue), - isTyped = !isArr && !isBuff && isTypedArray(srcValue); + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; - 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); - } + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; } - else { - isCommon = 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 (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); + if (!isSameTag) { + return false; } - assignMergeValue(object, key, newValue); + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } /** - * The base implementation of `_.nth` which doesn't coerce arguments. + * The base implementation of `_.isMap` without Node.js optimizations. * * @private - * @param {Array} array The array to query. - * @param {number} n The index of the element to return. - * @returns {*} Returns the nth element of `array`. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a map, else `false`. */ - function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined; + function baseIsMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; } /** - * The base implementation of `_.orderBy` without param guards. + * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ - function baseOrderBy(collection, iteratees, orders) { - var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); + 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]; - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); + 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; } /** - * The base implementation of `_.pick` without support for individual - * property identifiers. + * The base implementation of `_.isNative` without bad shim checks. * * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. */ - function basePick(object, paths) { - return basePickBy(object, paths, function(value, path) { - return hasIn(object, path); - }); + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } /** - * The base implementation of `_.pickBy` without support for iteratee shorthands. + * The base implementation of `_.isRegExp` without Node.js optimizations. * * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. */ - 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 baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; } /** - * A specialized version of `baseProperty` which supports deep paths. + * The base implementation of `_.isSet` without Node.js optimizations. * * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a set, else `false`. */ - function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; + function baseIsSet(value) { + return isObjectLike(value) && getTag(value) == setTag; } /** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. + * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ - function basePullAll(array, values, iteratee, comparator) { - var indexOf = comparator ? baseIndexOfWith : baseIndexOf, - index = -1, - length = values.length, - seen = array; + function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + } - if (array === values) { - values = copyArray(values); + /** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; } - if (iteratee) { - seen = arrayMap(array, baseUnary(iteratee)); + if (value == null) { + return identity; } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); + } - while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); + /** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); } } - return array; + return result; } /** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. + * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. */ - function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; + function baseKeysIn(object) { + if (!isObject(object)) { + return nativeKeysIn(object); + } + var isProto = isPrototype(object), + result = []; - 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); - } + for (var key in object) { + if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); } } - return array; + return result; } /** - * The base implementation of `_.random` without support for returning - * floating-point numbers. + * The base implementation of `_.lt` which doesn't coerce arguments. * * @private - * @param {number} lower The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the random number. + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. */ - function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + function baseLt(value, other) { + return value < other; } /** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. + * The base implementation of `_.map` without support for iteratee shorthands. * * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. */ - function baseRange(start, end, step, fromRight) { + function baseMap(collection, iteratee) { var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); + result = isArrayLike(collection) ? Array(collection.length) : []; - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); return result; } /** - * The base implementation of `_.repeat` which doesn't coerce arguments. + * The base implementation of `_.matches` which doesn't clone `source`. * * @private - * @param {string} string The string to repeat. - * @param {number} n The number of times to repeat the string. - * @returns {string} Returns the repeated string. + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. */ - function baseRepeat(string, n) { - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - if (n) { - string += string; - } - } while (n); - - return result; + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; } /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. */ - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); + 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); + }; } /** - * The base implementation of `_.sample`. + * The base implementation of `_.merge` without support for multiple sources. * * @private - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. */ - function baseSample(collection) { - return arraySample(values(collection)); + 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); } /** - * The base implementation of `_.sampleSize` without param guards. + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. * * @private - * @param {Array|Object} collection The collection to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); - } - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. */ - function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; + 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; } - path = castPath(path, object); + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; + var isCommon = newValue === undefined; - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); - 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]) ? [] : {}); + 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 = []; } } - assignValue(nested, key, newValue); - nested = nested[key]; + 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; + } } - return object; + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); } /** - * The base implementation of `setData` without support for hot loop shorting. + * The base implementation of `_.nth` which doesn't coerce arguments. * * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. + * @param {Array} array The array to query. + * @param {number} n The index of the element to return. + * @returns {*} Returns the nth element of `array`. */ - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; + function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined; + } /** - * The base implementation of `setToString` without support for hot loop shorting. + * The base implementation of `_.orderBy` without param guards. * * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. */ - var baseSetToString = !defineProperty ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true + 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); + }); + } /** - * The base implementation of `_.shuffle`. + * The base implementation of `_.pick` without support for individual + * property identifiers. * * @private - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. */ - function baseShuffle(collection) { - return shuffleSelf(values(collection)); + function basePick(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); } /** - * The base implementation of `_.slice` without an iteratee call guard. + * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. */ - function baseSlice(array, start, end) { + function basePickBy(object, paths, predicate) { 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; + length = paths.length, + result = {}; - var result = Array(length); while (++index < length) { - result[index] = array[index + start]; + var path = paths[index], + value = baseGet(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath(path, object), value); + } } return result; } /** - * The base implementation of `_.some` without support for iteratee shorthands. + * A specialized version of `baseProperty` which supports deep paths. * * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. */ - function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; + function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; } /** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. * * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. */ - function baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array == null ? low : array.length; + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; + 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; - if (computed !== null && !isSymbol(computed) && - (retHighest ? (computed <= value) : (computed < value))) { - low = mid + 1; - } else { - high = mid; + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); } + splice.call(array, fromIndex, 1); } - return high; } - return baseSortedIndexBy(array, value, identity, retHighest); + return array; } /** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which invokes `iteratee` for `value` and each element of `array` to compute - * their sort ranking. The iteratee is invoked with one argument; (value). + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. * * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} iteratee The iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. */ - 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); + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; - 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; + 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 nativeMin(high, MAX_ARRAY_INDEX); + return array; } /** - * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without - * support for iteratee shorthands. + * The base implementation of `_.random` without support for returning + * floating-point numbers. * * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. */ - function baseSortedUniq(array, iteratee) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; + function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + } - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; + /** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ + function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); - if (!index || !eq(computed, seen)) { - var seen = computed; - result[resIndex++] = value === 0 ? 0 : value; - } + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; } return result; } /** - * The base implementation of `_.toNumber` which doesn't ensure correct - * conversions of binary, hexadecimal, or octal string values. + * The base implementation of `_.repeat` which doesn't coerce arguments. * * @private - * @param {*} value The value to process. - * @returns {number} Returns the number. + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. */ - function baseToNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; } - return +value; + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; } /** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. + * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. */ - function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); } /** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * The base implementation of `_.sample`. * * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. */ - 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 baseSample(collection) { + return arraySample(values(collection)); } /** - * The base implementation of `_.unset`. + * The base implementation of `_.sampleSize` without param guards. * * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The property path to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. */ - function baseUnset(object, path) { - path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; + function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); } /** - * The base implementation of `_.update`. + * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to update. - * @param {Function} updater The function to produce the updated value. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ - function baseUpdate(object, path, updater, customizer) { - return baseSet(object, path, updater(baseGet(object, path)), customizer); - } + function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); - /** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + 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; } /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. + * The base implementation of `setData` without support for hot loop shorting. * * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. */ - 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); - } + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; /** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. + * The base implementation of `setToString` without support for hot loop shorting. * * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. */ - 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; + var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); + }; - while (++othIndex < length) { - if (othIndex != index) { - result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); - } - } - } - return baseUniq(baseFlatten(result, 1), iteratee, comparator); + /** + * The base implementation of `_.shuffle`. + * + * @private + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function baseShuffle(collection) { + return shuffleSelf(values(collection)); } /** - * This base implementation of `_.zipObject` which assigns values using `assignFunc`. + * The base implementation of `_.slice` without an iteratee call guard. * * @private - * @param {Array} props The property identifiers. - * @param {Array} values The property values. - * @param {Function} assignFunc The function to assign values. - * @returns {Object} Returns the new object. + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. */ - function baseZipObject(props, values, assignFunc) { + function baseSlice(array, start, end) { var index = -1, - length = props.length, - valsLength = values.length, - result = {}; + 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) { - var value = index < valsLength ? values[index] : undefined; - assignFunc(result, props[index], value); + result[index] = array[index + start]; } return result; } /** - * Casts `value` to an empty array if it's not an array like object. + * The base implementation of `_.some` without support for iteratee shorthands. * * @private - * @param {*} value The value to inspect. - * @returns {Array|Object} Returns the cast array-like object. + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ - function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; + function baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; } /** - * Casts `value` to `identity` if it's not a function. + * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which + * performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. * * @private - * @param {*} value The value to inspect. - * @returns {Function} Returns cast function. + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. */ - function castFunction(value) { - return typeof value == 'function' ? value : identity; + 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); } /** - * Casts `value` to a path array if it's not one. + * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` + * which invokes `iteratee` for `value` and each element of `array` to compute + * their sort ranking. The iteratee is invoked with one argument; (value). * * @private - * @param {*} value The value to inspect. - * @param {Object} [object] The object to query keys on. - * @returns {Array} Returns the cast property path array. + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The iteratee invoked per element. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. */ - function castPath(value, object) { - if (isArray(value)) { - return value; + 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 isKey(value, object) ? [value] : stringToPath(toString(value)); + return nativeMin(high, MAX_ARRAY_INDEX); } /** - * A `baseRest` alias which can be replaced with `identity` by module - * replacement plugins. + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. * * @private - * @type {Function} - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. */ - var castRest = baseRest; + function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; - /** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ - function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); + 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; } /** - * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. * * @private - * @param {number|Object} id The timer id or timeout object of the timer to clear. + * @param {*} value The value to process. + * @returns {number} Returns the number. */ - var clearTimeout = ctxClearTimeout || function(id) { - return root.clearTimeout(id); - }; + function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; + } /** - * Creates a clone of `buffer`. + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. * * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. + * @param {*} value The value to process. + * @returns {string} Returns the string. */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** - * Creates a clone of `arrayBuffer`. + * The base implementation of `_.uniqBy` without support for iteratee shorthands. * * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + 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; } /** - * Creates a clone of `dataView`. + * The base implementation of `_.unset`. * * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; } /** - * Creates a clone of `regexp`. + * The base implementation of `_.update`. * * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. */ - function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; + function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); } /** - * Creates a clone of the `symbol` object. + * The base implementation of methods like `_.dropWhile` and `_.takeWhile` + * without support for iteratee shorthands. * * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. */ - function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + 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)); } /** - * Creates a clone of `typedArray`. + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. * * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + 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); } /** - * Compares values to sort them in ascending order. + * The base implementation of methods like `_.xor`, without support for + * iteratee shorthands, that accepts an array of arrays to inspect. * * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. */ - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = isSymbol(value); + function baseXor(arrays, iteratee, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, + result = Array(length); - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = isSymbol(other); + while (++index < length) { + var array = arrays[index], + othIndex = -1; - 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; + while (++othIndex < length) { + if (othIndex != index) { + result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); + } } } - return 0; + return baseUniq(baseFlatten(result, 1), iteratee, comparator); } /** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. + * This base implementation of `_.zipObject` which assigns values using `assignFunc`. * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order + * @private + * @param {Array} props The property identifiers. + * @param {Array} values The property values. + * @param {Function} assignFunc The function to assign values. + * @returns {Object} Returns the new object. + */ + 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; + } + + /** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ + function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + + /** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ + function castFunction(value) { + return typeof value == 'function' ? value : identity; + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + /** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + var castRest = baseRest; + + /** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ + function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); + } + + /** + * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). + * + * @private + * @param {number|Object} id The timer id or timeout object of the timer to clear. + */ + var clearTimeout = ctxClearTimeout || function(id) { + return root.clearTimeout(id); + }; + + /** + * Creates a clone of `buffer`. + * + * @private + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. + */ + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length = buffer.length, + result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); + + buffer.copy(result); + return result; + } + + /** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ + function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array(result).set(new Uint8Array(arrayBuffer)); + return result; + } + + /** + * Creates a clone of `dataView`. + * + * @private + * @param {Object} dataView The data view to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned data view. + */ + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + + /** + * Creates a clone of `regexp`. + * + * @private + * @param {Object} regexp The regexp to clone. + * @returns {Object} Returns the cloned regexp. + */ + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + + /** + * Creates a clone of the `symbol` object. + * + * @private + * @param {Object} symbol The symbol object to clone. + * @returns {Object} Returns the cloned symbol object. + */ + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + + /** + * Creates a clone of `typedArray`. + * + * @private + * @param {Object} typedArray The typed array to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Object} Returns the cloned typed array. + */ + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + 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; + } + + /** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order * of corresponding values. * * @private @@ -57529,4529 +64827,4529 @@ arguments[4][42][0].apply(exports,arguments) },{"dup":42}],150:[function(require,module,exports){ arguments[4][43][0].apply(exports,arguments) },{"./support/isBuffer":149,"_process":117,"dup":43,"inherits":70}],151:[function(require,module,exports){ -// add steps to the sequencer -function AddStep(_sequencer, image, name, o) { - return require('./InsertStep')(_sequencer,image,-1,name,o); -} -module.exports = AddStep; +// add steps to the sequencer +function AddStep(_sequencer, image, name, o) { + return require('./InsertStep')(_sequencer,image,-1,name,o); +} +module.exports = AddStep; },{"./InsertStep":155}],152:[function(require,module,exports){ -var fs = require('fs'); -var getDirectories = function(rootDir, cb) { - fs.readdir(rootDir, function(err, files) { - var dirs = []; - if (typeof (files) == "undefined" || files.length == 0) { - cb(dirs); - return []; - } - for (var index = 0; index < files.length; ++index) { - var file = files[index]; - if (file[0] !== '.') { - var filePath = rootDir + '/' + file; - fs.stat(filePath, function(err, stat) { - if (stat.isDirectory()) { - dirs.push(this.file); - } - if (files.length === (this.index + 1)) { - return cb(dirs); - } - }.bind({ index: index, file: file })); - } - } - }); -} - -module.exports = function ExportBin(dir = "./output/", ref, basic, filename) { - - // If user did not give an output filename so we can continue without doing anything - dir = (dir[dir.length - 1] == "/") ? dir : dir + "/"; - if (ref.options.inBrowser) return false; - fs.access(dir, function(err) { - if (err) console.error(err) - }); - if (filename && basic) { - for (var image in ref.images) { - var steps = ref.images[image].steps; - var datauri = steps.slice(-1)[0].output.src; - var ext = steps.slice(-1)[0].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(dir + filename, buffer, function() { }); - } - } - else { - getDirectories(dir, function(dirs) { - var num = 1; - for (var d in dirs) { - if (dirs[d].match(/^sequencer(.*)$/) == null) continue; - var n = parseInt(dirs[d].match(/^sequencer(.*)$/)[1]); - num = (n >= num) ? (n + 1) : num; - } - fs.mkdir(dir + 'sequencer' + num, function() { - var root = dir + 'sequencer' + num + '/'; - for (var image in ref.images) { - var steps = ref.images[image].steps; - if (basic) { - var datauri = steps.slice(-1)[0].output.src; - var ext = steps.slice(-1)[0].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(root + image + "_" + (steps.length - 1) + "." + ext, buffer, function() { }); - } - else { - for (var i in steps) { - var datauri = steps[i].output.src; - var ext = steps[i].output.format; - var buffer = require('data-uri-to-buffer')(datauri); - fs.writeFile(root + image + "_" + i + "." + ext, buffer, function() { }); - } - } - } - }); - }); - } -} +var fs = require('fs'); +var getDirectories = function(rootDir, cb) { + fs.readdir(rootDir, function(err, files) { + var dirs = []; + if (typeof (files) == "undefined" || files.length == 0) { + cb(dirs); + return []; + } + for (var index = 0; index < files.length; ++index) { + var file = files[index]; + if (file[0] !== '.') { + var filePath = rootDir + '/' + file; + fs.stat(filePath, function(err, stat) { + if (stat.isDirectory()) { + dirs.push(this.file); + } + if (files.length === (this.index + 1)) { + return cb(dirs); + } + }.bind({ index: index, file: file })); + } + } + }); +} -},{"data-uri-to-buffer":19,"fs":46}],153:[function(require,module,exports){ -function objTypeOf(object){ - return Object.prototype.toString.call(object).split(" ")[1].slice(0,-1) -} - -function getPrimitive(object){ - return (objTypeOf(object)=='Array')?object[0]:object; -} - -function makeArray(input) { - return (objTypeOf(input)=="Array")?input:[input]; -} - -function copy(a) { - if (!typeof(a) == "object") return a; - if (objTypeOf(a) == "Array") return a.slice(); - if (objTypeOf(a) == "Object") { - var b = {}; - for (var v in a) { - b[v] = copy(a[v]); - } - return b; - } - return a; -} - -function formatInput(args,format,images) { - images = []; - for (var image in this.images) { - images.push(image); - } - var json_q = {}; - var format_i = format; - if (format == "+") - format = ['o_string_a', 'string_a', 'o_object']; - else if (format == "-") - format = ['o_string_a', 'number_a']; - else if (format == "^") - format = ['o_string_a', 'number', 'string', 'o_object']; - else if (format == "r") - format = ['o_string_a', 'o_number']; - else if (format == "l") - format = ['o_string','string','o_function']; - - /* - formats: - addSteps :: o_image_a, name_a, o_o - o_string_a, string_a, o_object => { image: [{name,o}] } - removeSteps :: o_image_a, index_a - o_string_a, number_a => { image: [index] } - insertSteps :: o_image_a, index, name, o_o - o_string_a, number, string, o_object => { image: [{index,name,o}] } - run :: o_image_a, o_from - o_string_a, o_number => { image: index } - loadImages :: image, src, o_function - string, string, o_function => { images: [{image:src}], callback } - - optionals: - image: o_string_a - options: o_object - from: o_number - callback: o_function - */ - - if(format[format.length-1] == "o_object") { - if(objTypeOf(args[args.length-1]) != "Object") - args.push({}); - } - else if (format[format.length-1] == "o_number") { - if(typeof(args[args.length-1]) != "number" && objTypeOf(args[0])!="Object") - args.push(1); - } - else if (format[format.length-1] == "o_function") { - if(objTypeOf(args[args.length-1]) != "Function" && objTypeOf(args[0])!="Object") - args.push(function(){}); - } - - if(format[0] == "o_string_a") { - if(args.length == format.length - 1) { - var insert = false; - for (var i in args) { - if (format[parseInt(i)+1].includes( typeof(getPrimitive(args[i])) )){ - insert = true; - } - else {insert = false; break;} - } - if(insert) - args.splice(0,0,copy(images)); - } - } - else if (format[0] == "o_string" && format_i == "l" && args.length == 2) { - if (typeof(args[0]) == "string") { - var identifier = "image"; - var number = 1; - while (this.images.hasOwnProperty(identifier+number)) number++; - args.splice(0,0,identifier+number); - } - } - - if(args.length == format.length) { - for (var i in format) { - if (format[i].substr(format[i].length-2,2)=="_a") - args[i] = makeArray(args[i]); - } - } - - if (args.length == 1) { - json_q = copy(args[0]); - if(!(format_i == "r" || format_i == "l")) { - for (var img in json_q) - json_q[img] = makeArray(json_q[img]); - } - } - else if (format_i == "r") { - for (var img in args[0]) json_q[args[0][img]] = args[1]; - } - else if (format_i == "l") { - json_q = { - images: {}, - callback: args[2] - } - json_q.images[args[0]] = args[1]; - } - else { - for (var img in args[0]) { - var image = args[0][img]; - json_q[image] = []; - - if(format_i == "+") { - for(var s in args[1]) { - json_q[image].push({ - name: args[1][s], - o: args[2] - }); - } - } - - if(format_i == "-") { - json_q[image] = args[1]; - } - - if(format_i == "^") { - var size = this.images[image].steps.length; - var index = args[1]; - index = (index==size)?index:index%size; - if (index<0) index += size+1; - json_q[image].push({ - index: index, - name: args[2], - o: args[3] - }); - } - - } - } - - if(format_i == "l") { - json_q.loadedimages = []; - for (var i in json_q.images) json_q.loadedimages.push(i); - } - - return json_q; - -} -module.exports = formatInput; +module.exports = function ExportBin(dir = "./output/", ref, basic, filename) { + + // If user did not give an output filename so we can continue without doing anything + dir = (dir[dir.length - 1] == "/") ? dir : dir + "/"; + if (ref.options.inBrowser) return false; + fs.access(dir, function(err) { + if (err) console.error(err) + }); + if (filename && basic) { + for (var image in ref.images) { + var steps = ref.images[image].steps; + var datauri = steps.slice(-1)[0].output.src; + var ext = steps.slice(-1)[0].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(dir + filename, buffer, function() { }); + } + } + else { + getDirectories(dir, function(dirs) { + var num = 1; + for (var d in dirs) { + if (dirs[d].match(/^sequencer(.*)$/) == null) continue; + var n = parseInt(dirs[d].match(/^sequencer(.*)$/)[1]); + num = (n >= num) ? (n + 1) : num; + } + fs.mkdir(dir + 'sequencer' + num, function() { + var root = dir + 'sequencer' + num + '/'; + for (var image in ref.images) { + var steps = ref.images[image].steps; + if (basic) { + var datauri = steps.slice(-1)[0].output.src; + var ext = steps.slice(-1)[0].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(root + image + "_" + (steps.length - 1) + "." + ext, buffer, function() { }); + } + else { + for (var i in steps) { + var datauri = steps[i].output.src; + var ext = steps[i].output.format; + var buffer = require('data-uri-to-buffer')(datauri); + fs.writeFile(root + image + "_" + i + "." + ext, buffer, function() { }); + } + } + } + }); + }); + } +} + +},{"data-uri-to-buffer":19,"fs":46}],153:[function(require,module,exports){ +function objTypeOf(object){ + return Object.prototype.toString.call(object).split(" ")[1].slice(0,-1) +} + +function getPrimitive(object){ + return (objTypeOf(object)=='Array')?object[0]:object; +} + +function makeArray(input) { + return (objTypeOf(input)=="Array")?input:[input]; +} + +function copy(a) { + if (!typeof(a) == "object") return a; + if (objTypeOf(a) == "Array") return a.slice(); + if (objTypeOf(a) == "Object") { + var b = {}; + for (var v in a) { + b[v] = copy(a[v]); + } + return b; + } + return a; +} + +function formatInput(args,format,images) { + images = []; + for (var image in this.images) { + images.push(image); + } + var json_q = {}; + var format_i = format; + if (format == "+") + format = ['o_string_a', 'string_a', 'o_object']; + else if (format == "-") + format = ['o_string_a', 'number_a']; + else if (format == "^") + format = ['o_string_a', 'number', 'string', 'o_object']; + else if (format == "r") + format = ['o_string_a', 'o_number']; + else if (format == "l") + format = ['o_string','string','o_function']; + + /* + formats: + addSteps :: o_image_a, name_a, o_o + o_string_a, string_a, o_object => { image: [{name,o}] } + removeSteps :: o_image_a, index_a + o_string_a, number_a => { image: [index] } + insertSteps :: o_image_a, index, name, o_o + o_string_a, number, string, o_object => { image: [{index,name,o}] } + run :: o_image_a, o_from + o_string_a, o_number => { image: index } + loadImages :: image, src, o_function + string, string, o_function => { images: [{image:src}], callback } + + optionals: + image: o_string_a + options: o_object + from: o_number + callback: o_function + */ + + if(format[format.length-1] == "o_object") { + if(objTypeOf(args[args.length-1]) != "Object") + args.push({}); + } + else if (format[format.length-1] == "o_number") { + if(typeof(args[args.length-1]) != "number" && objTypeOf(args[0])!="Object") + args.push(1); + } + else if (format[format.length-1] == "o_function") { + if(objTypeOf(args[args.length-1]) != "Function" && objTypeOf(args[0])!="Object") + args.push(function(){}); + } + + if(format[0] == "o_string_a") { + if(args.length == format.length - 1) { + var insert = false; + for (var i in args) { + if (format[parseInt(i)+1].includes( typeof(getPrimitive(args[i])) )){ + insert = true; + } + else {insert = false; break;} + } + if(insert) + args.splice(0,0,copy(images)); + } + } + else if (format[0] == "o_string" && format_i == "l" && args.length == 2) { + if (typeof(args[0]) == "string") { + var identifier = "image"; + var number = 1; + while (this.images.hasOwnProperty(identifier+number)) number++; + args.splice(0,0,identifier+number); + } + } + + if(args.length == format.length) { + for (var i in format) { + if (format[i].substr(format[i].length-2,2)=="_a") + args[i] = makeArray(args[i]); + } + } + + if (args.length == 1) { + json_q = copy(args[0]); + if(!(format_i == "r" || format_i == "l")) { + for (var img in json_q) + json_q[img] = makeArray(json_q[img]); + } + } + else if (format_i == "r") { + for (var img in args[0]) json_q[args[0][img]] = args[1]; + } + else if (format_i == "l") { + json_q = { + images: {}, + callback: args[2] + } + json_q.images[args[0]] = args[1]; + } + else { + for (var img in args[0]) { + var image = args[0][img]; + json_q[image] = []; + + if(format_i == "+") { + for(var s in args[1]) { + json_q[image].push({ + name: args[1][s], + o: args[2] + }); + } + } + + if(format_i == "-") { + json_q[image] = args[1]; + } + + if(format_i == "^") { + var size = this.images[image].steps.length; + var index = args[1]; + index = (index==size)?index:index%size; + if (index<0) index += size+1; + json_q[image].push({ + index: index, + name: args[2], + o: args[3] + }); + } + + } + } + + if(format_i == "l") { + json_q.loadedimages = []; + for (var i in json_q.images) json_q.loadedimages.push(i); + } + + return json_q; + +} +module.exports = formatInput; },{}],154:[function(require,module,exports){ -if (typeof window !== 'undefined') { isBrowser = true } -else { var isBrowser = false } -require('./util/getStep.js'); - -ImageSequencer = function ImageSequencer(options) { - - var sequencer = (this.name == "ImageSequencer") ? this : this.sequencer; - options = options || {}; - options.inBrowser = options.inBrowser || isBrowser; - options.sequencerCounter = 0; - - function objTypeOf(object) { - return Object.prototype.toString.call(object).split(" ")[1].slice(0, -1) - } - - function log(color, msg) { - if (options.ui != "none") { - if (arguments.length == 1) console.log(arguments[0]); - else if (arguments.length == 2) console.log(color, msg); - } - } - - function copy(a) { - if (!typeof (a) == "object") return a; - if (objTypeOf(a) == "Array") return a.slice(); - if (objTypeOf(a) == "Object") { - var b = {}; - for (var v in a) { - b[v] = copy(a[v]); - } - return b; - } - return a; - } - - function makeArray(input) { - return (objTypeOf(input) == "Array") ? input : [input]; - } - - var image, - steps = [], - modules = require('./Modules'), - sequences = require('./SavedSequences.json'), - formatInput = require('./FormatInput'), - images = {}, - inputlog = [], - events = require('./ui/UserInterface')(), - fs = require('fs'); - - - - if (options.inBrowser) { - for (o in sequencer) { - modules[o] = sequencer[o]; - } - sequences = JSON.parse(window.localStorage.getItem('sequences')); - if (!sequences) { - sequences = {}; - window.localStorage.setItem('sequences', JSON.stringify(sequences)); - } - } - - // if in browser, prompt for an image - // if (options.imageSelect || options.inBrowser) addStep('image-select'); - // else if (options.imageUrl) loadImage(imageUrl); - - function addSteps() { - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - var json_q = {}; - for (var arg in arguments) { args.push(copy(arguments[arg])); } - json_q = formatInput.call(this_, args, "+"); - - inputlog.push({ method: "addSteps", json_q: copy(json_q) }); - - for (var i in json_q) - for (var j in json_q[i]) - require("./AddStep")(this_, i, json_q[i][j].name, json_q[i][j].o); - - return this; - } - - function removeStep(image, index) { - //remove the step from images[image].steps and redraw remaining images - if (index > 0) { - thisStep = images[image].steps[index]; - thisStep.UI.onRemove(thisStep.options.step); - images[image].steps.splice(index, 1); - } - //tell the UI a step has been removed - } - - function removeSteps(image, index) { - var run = {}, indices; - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(copy(arguments[arg])); - - var json_q = formatInput.call(this_, args, "-"); - inputlog.push({ method: "removeSteps", json_q: copy(json_q) }); - - for (var img in json_q) { - indices = json_q[img].sort(function(a, b) { return b - a }); - run[img] = indices[indices.length - 1]; - for (var i in indices) - removeStep(img, indices[i]); - } - // this.run(run); // This is creating problems - return this; - } - - function insertSteps(image, index, name, o) { - var run = {}; - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(arguments[arg]); - - var json_q = formatInput.call(this_, args, "^"); - inputlog.push({ method: "insertSteps", json_q: copy(json_q) }); - - for (var img in json_q) { - var details = json_q[img]; - details = details.sort(function(a, b) { return b.index - a.index }); - for (var i in details) - require("./InsertStep")(this_, img, details[i].index, details[i].name, details[i].o); - run[img] = details[details.length - 1].index; - } - // this.run(run); // This is Creating issues - return this; - } - - // Config is an object which contains the runtime configuration like progress bar - // information and index from which the sequencer should run - function run(config, t_image, t_from) { - let progressObj, index = 0; - config = config || { mode: 'no-arg' }; - if (config.index) index = config.index; - - if (config.mode != 'test') { - if (config.mode != "no-arg" && typeof config != 'function') { - if (config.progressObj) progressObj = config.progressObj; - delete arguments['0']; - } - } - else { - arguments['0'] = config.mode; - } - - var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; - var args = (this.name == "ImageSequencer") ? [] : [this.images]; - for (var arg in arguments) args.push(copy(arguments[arg])); - - var callback = function() { }; - for (var arg in args) - if (objTypeOf(args[arg]) == "Function") - callback = args.splice(arg, 1)[0]; - - var json_q = formatInput.call(this_, args, "r"); - - require('./Run')(this_, json_q, callback, index, progressObj); - - return true; - } - - function loadImages() { - var args = []; - var sequencer = this; - for (var arg in arguments) args.push(copy(arguments[arg])); - var json_q = formatInput.call(this, args, "l"); - - inputlog.push({ method: "loadImages", json_q: copy(json_q) }); - var loadedimages = this.copy(json_q.loadedimages); - - var ret = { - name: "ImageSequencer Wrapper", - sequencer: this, - addSteps: this.addSteps, - removeSteps: this.removeSteps, - insertSteps: this.insertSteps, - run: this.run, - UI: this.UI, - setUI: this.setUI, - images: loadedimages - }; - - function load(i) { - if (i == loadedimages.length) { - json_q.callback.call(ret); - return; - } - var img = loadedimages[i]; - require('./ui/LoadImage')(sequencer, img, json_q.images[img], function() { - load(++i); - }); - } - - load(0); - } - - function replaceImage(selector, steps, options) { - options = options || {}; - options.callback = options.callback || function() { }; - return require('./ReplaceImage')(this, selector, steps, options); - } - - function setUI(UI) { - this.events = require('./ui/UserInterface')(UI); - } - - var exportBin = function(dir, basic, filename) { - return require('./ExportBin')(dir, this, basic, filename); - } - - function modulesInfo(name) { - var modulesdata = {} - if (name == "load-image") return {}; - if (arguments.length == 0) { - for (var modulename in this.modules) { - modulesdata[modulename] = modules[modulename][1]; - } - for (var sequencename in this.sequences) { - modulesdata[sequencename] = { name: sequencename, steps: this.sequences[sequencename] }; - } - } - else { - if (modules[name]) - modulesdata = modules[name][1]; - else - modulesdata = { 'inputs': sequences[name]['options'] }; - } - return modulesdata; - } - - // Genates a CLI string for the current sequence - function toCliString() { - var cliStringSteps = `"`, cliOptions = {}; - for (var step in this.steps) { - if (this.steps[step].options.name !== "load-image") - cliStringSteps += `${this.steps[step].options.name} `; - for (var inp in modulesInfo(this.steps[step].options.name).inputs) { - cliOptions[inp] = this.steps[step].options[inp]; - } - } - cliStringSteps = cliStringSteps.substr(0, cliStringSteps.length - 1) + `"`; - return `sequencer -i [PATH] -s ${cliStringSteps} -d '${JSON.stringify(cliOptions)}'` - } - - // Strigifies the current sequence - function toString(step) { - if (step) { - return stepToString(step); - } else { - return copy(this.images.image1.steps).map(stepToString).slice(1).join(','); - } - } - - // Stringifies one step of the sequence - function stepToString(step) { - let inputs = modulesInfo(step.options.name).inputs || {}, op = {}; - - for (let input in inputs) { - - if (!!step.options[input] && step.options[input] != inputs[input].default) { - op[input] = step.options[input]; - op[input] = encodeURIComponent(op[input]); - } - - } - - var configurations = Object.keys(op).map(key => key + ':' + op[key]).join('|'); - return `${step.options.name}{${configurations}}`; - } - - // exports the current sequence as an array of JSON steps - function toJSON() { - return this.stringToJSON(this.toString()); - } - - // Coverts stringified sequence into an array of JSON steps - function stringToJSON(str) { - let steps; - if (str.includes(',')) - steps = str.split(','); - else - steps = [str]; - return steps.map(stringToJSONstep); - } - - // Converts one stringified step into JSON - function stringToJSONstep(str) { - var bracesStrings; - if (str.includes('{')) - if (str.includes('(') && str.indexOf('(') < str.indexOf('{')) - bracesStrings = ['(', ')']; - else - bracesStrings = ['{', '}']; - else - bracesStrings = ['(', ')']; - - if (str.indexOf(bracesStrings[0]) === -1) { // if there are no settings specified - var moduleName = str.substr(0); - stepSettings = ""; - } else { - var moduleName = str.substr(0, str.indexOf(bracesStrings[0])); - stepSettings = str.slice(str.indexOf(bracesStrings[0]) + 1, -1); - } - - stepSettings = stepSettings.split('|').reduce(function formatSettings(accumulator, current, i) { - var settingName = current.substr(0, current.indexOf(':')), - settingValue = current.substr(current.indexOf(':') + 1); - settingValue = settingValue.replace(/^\(/, '').replace(/\)$/, ''); // strip () at start/end - settingValue = settingValue.replace(/^\{/, '').replace(/\}$/, ''); // strip {} at start/end - settingValue = decodeURIComponent(settingValue); - current = [ - settingName, - settingValue - ]; - if (!!settingName) accumulator[settingName] = settingValue; - return accumulator; - }, {}); - - return { - name: moduleName, - options: stepSettings - } - } - - // imports a string into the sequencer steps - function importString(str) { - let sequencer = this; - if (this.name != "ImageSequencer") - sequencer = this.sequencer; - var stepsFromString = stringToJSON(str); - stepsFromString.forEach(function eachStep(stepObj) { - sequencer.addSteps(stepObj.name, stepObj.options); - }); - } - - // imports a array of JSON steps into the sequencer steps - function importJSON(obj) { - let sequencer = this; - if (this.name != "ImageSequencer") - sequencer = this.sequencer; - obj.forEach(function eachStep(stepObj) { - sequencer.addSteps(stepObj.name, stepObj.options); - }); - } - - function loadNewModule(name, options) { - - if (!options) { - return this; - - } else if (Array.isArray(options)) { - // contains the array of module and info - this.modules[name] = options; - - } else if (options.func && options.info) { - // passed in options object - this.modules[name] = [ - options.func, options.info - ]; - - } else if (options.path && !this.inBrowser) { - // load from path(only in node) - const module = [ - require(`${options.path}/Module.js`), - require(`${options.path}/info.json`) - ]; - this.modules[name] = module; - } - return this; - } - - function saveNewModule(name, path) { - if (options.inBrowser) { - // Not for browser context - return; - } - var mods = fs.readFileSync('./src/Modules.js').toString(); - mods = mods.substr(0, mods.length - 1) + " '" + name + "': require('" + path + "'),\n}"; - fs.writeFileSync('./src/Modules.js', mods); - } - - function createMetaModule(stepsCollection, info) { - var stepsArr = stepsCollection; - if (typeof stepsCollection === 'string') - stepsArr = stringToJSON(stepsCollection); - var metaMod = function() { - this.expandSteps(stepsArr); - return { - isMeta: true - } - } - return [metaMod, info]; - } - - function saveSequence(name, sequenceString) { - const sequence = stringToJSON(sequenceString); - // Save the given sequence string as a module - if (options.inBrowser) { - // Inside the browser we save the meta-modules using the Web Storage API - var sequences = JSON.parse(window.localStorage.getItem('sequences')); - sequences[name] = sequence; - window.localStorage.setItem('sequences', JSON.stringify(sequences)); - } - else { - // In node we save the sequences in the json file SavedSequences.json - var sequences = require('./SavedSequences.json'); - sequences[name] = sequence; - fs.writeFileSync('./src/SavedSequences.json', JSON.stringify(sequences)); - } - } - - function loadModules() { - // This function loads the modules and saved sequences - this.modules = require('./Modules'); - if (options.inBrowser) - this.sequences = JSON.parse(window.localStorage.getItem('sequences')); - else - this.sequences = require('./SavedSequences.json'); - } - - return { - //literals and objects - name: "ImageSequencer", - options: options, - inputlog: inputlog, - modules: modules, - sequences: sequences, - images: images, - events: events, - - //user functions - loadImages: loadImages, - loadImage: loadImages, - addSteps: addSteps, - removeSteps: removeSteps, - insertSteps: insertSteps, - replaceImage: replaceImage, - run: run, - setUI: setUI, - exportBin: exportBin, - modulesInfo: modulesInfo, - toCliString: toCliString, - toString: toString, - stepToString: stepToString, - toJSON: toJSON, - stringToJSON: stringToJSON, - stringToJSONstep: stringToJSONstep, - importString: importString, - importJSON: importJSON, - loadNewModule: loadNewModule, - saveNewModule: saveNewModule, - createMetaModule: createMetaModule, - saveSequence: saveSequence, - loadModules: loadModules, - - //other functions - log: log, - objTypeOf: objTypeOf, - copy: copy, - - setInputStep: require('./ui/SetInputStep')(sequencer) - } - -} -module.exports = ImageSequencer; +if (typeof window !== 'undefined') { isBrowser = true } +else { var isBrowser = false } +require('./util/getStep.js'); + +ImageSequencer = function ImageSequencer(options) { + + var sequencer = (this.name == "ImageSequencer") ? this : this.sequencer; + options = options || {}; + options.inBrowser = options.inBrowser || isBrowser; + options.sequencerCounter = 0; + + function objTypeOf(object) { + return Object.prototype.toString.call(object).split(" ")[1].slice(0, -1) + } + + function log(color, msg) { + if (options.ui != "none") { + if (arguments.length == 1) console.log(arguments[0]); + else if (arguments.length == 2) console.log(color, msg); + } + } + + function copy(a) { + if (!typeof (a) == "object") return a; + if (objTypeOf(a) == "Array") return a.slice(); + if (objTypeOf(a) == "Object") { + var b = {}; + for (var v in a) { + b[v] = copy(a[v]); + } + return b; + } + return a; + } + + function makeArray(input) { + return (objTypeOf(input) == "Array") ? input : [input]; + } + + var image, + steps = [], + modules = require('./Modules'), + sequences = require('./SavedSequences.json'), + formatInput = require('./FormatInput'), + images = {}, + inputlog = [], + events = require('./ui/UserInterface')(), + fs = require('fs'); + + + + if (options.inBrowser) { + for (o in sequencer) { + modules[o] = sequencer[o]; + } + sequences = JSON.parse(window.localStorage.getItem('sequences')); + if (!sequences) { + sequences = {}; + window.localStorage.setItem('sequences', JSON.stringify(sequences)); + } + } + + // if in browser, prompt for an image + // if (options.imageSelect || options.inBrowser) addStep('image-select'); + // else if (options.imageUrl) loadImage(imageUrl); + + function addSteps() { + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + var json_q = {}; + for (var arg in arguments) { args.push(copy(arguments[arg])); } + json_q = formatInput.call(this_, args, "+"); + + inputlog.push({ method: "addSteps", json_q: copy(json_q) }); + + for (var i in json_q) + for (var j in json_q[i]) + require("./AddStep")(this_, i, json_q[i][j].name, json_q[i][j].o); + + return this; + } + + function removeStep(image, index) { + //remove the step from images[image].steps and redraw remaining images + if (index > 0) { + thisStep = images[image].steps[index]; + thisStep.UI.onRemove(thisStep.options.step); + images[image].steps.splice(index, 1); + } + //tell the UI a step has been removed + } + + function removeSteps(image, index) { + var run = {}, indices; + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(copy(arguments[arg])); + + var json_q = formatInput.call(this_, args, "-"); + inputlog.push({ method: "removeSteps", json_q: copy(json_q) }); + + for (var img in json_q) { + indices = json_q[img].sort(function(a, b) { return b - a }); + run[img] = indices[indices.length - 1]; + for (var i in indices) + removeStep(img, indices[i]); + } + // this.run(run); // This is creating problems + return this; + } + + function insertSteps(image, index, name, o) { + var run = {}; + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(arguments[arg]); + + var json_q = formatInput.call(this_, args, "^"); + inputlog.push({ method: "insertSteps", json_q: copy(json_q) }); + + for (var img in json_q) { + var details = json_q[img]; + details = details.sort(function(a, b) { return b.index - a.index }); + for (var i in details) + require("./InsertStep")(this_, img, details[i].index, details[i].name, details[i].o); + run[img] = details[details.length - 1].index; + } + // this.run(run); // This is Creating issues + return this; + } + + // Config is an object which contains the runtime configuration like progress bar + // information and index from which the sequencer should run + function run(config, t_image, t_from) { + let progressObj, index = 0; + config = config || { mode: 'no-arg' }; + if (config.index) index = config.index; + + if (config.mode != 'test') { + if (config.mode != "no-arg" && typeof config != 'function') { + if (config.progressObj) progressObj = config.progressObj; + delete arguments['0']; + } + } + else { + arguments['0'] = config.mode; + } + + var this_ = (this.name == "ImageSequencer") ? this : this.sequencer; + var args = (this.name == "ImageSequencer") ? [] : [this.images]; + for (var arg in arguments) args.push(copy(arguments[arg])); + + var callback = function() { }; + for (var arg in args) + if (objTypeOf(args[arg]) == "Function") + callback = args.splice(arg, 1)[0]; + + var json_q = formatInput.call(this_, args, "r"); + + require('./Run')(this_, json_q, callback, index, progressObj); + + return true; + } + + function loadImages() { + var args = []; + var sequencer = this; + for (var arg in arguments) args.push(copy(arguments[arg])); + var json_q = formatInput.call(this, args, "l"); + + inputlog.push({ method: "loadImages", json_q: copy(json_q) }); + var loadedimages = this.copy(json_q.loadedimages); + + var ret = { + name: "ImageSequencer Wrapper", + sequencer: this, + addSteps: this.addSteps, + removeSteps: this.removeSteps, + insertSteps: this.insertSteps, + run: this.run, + UI: this.UI, + setUI: this.setUI, + images: loadedimages + }; + + function load(i) { + if (i == loadedimages.length) { + json_q.callback.call(ret); + return; + } + var img = loadedimages[i]; + require('./ui/LoadImage')(sequencer, img, json_q.images[img], function() { + load(++i); + }); + } + + load(0); + } + + function replaceImage(selector, steps, options) { + options = options || {}; + options.callback = options.callback || function() { }; + return require('./ReplaceImage')(this, selector, steps, options); + } + + function setUI(UI) { + this.events = require('./ui/UserInterface')(UI); + } + + var exportBin = function(dir, basic, filename) { + return require('./ExportBin')(dir, this, basic, filename); + } + + function modulesInfo(name) { + var modulesdata = {} + if (name == "load-image") return {}; + if (arguments.length == 0) { + for (var modulename in this.modules) { + modulesdata[modulename] = modules[modulename][1]; + } + for (var sequencename in this.sequences) { + modulesdata[sequencename] = { name: sequencename, steps: this.sequences[sequencename] }; + } + } + else { + if (modules[name]) + modulesdata = modules[name][1]; + else + modulesdata = { 'inputs': sequences[name]['options'] }; + } + return modulesdata; + } + + // Genates a CLI string for the current sequence + function toCliString() { + var cliStringSteps = `"`, cliOptions = {}; + for (var step in this.steps) { + if (this.steps[step].options.name !== "load-image") + cliStringSteps += `${this.steps[step].options.name} `; + for (var inp in modulesInfo(this.steps[step].options.name).inputs) { + cliOptions[inp] = this.steps[step].options[inp]; + } + } + cliStringSteps = cliStringSteps.substr(0, cliStringSteps.length - 1) + `"`; + return `sequencer -i [PATH] -s ${cliStringSteps} -d '${JSON.stringify(cliOptions)}'` + } + + // Strigifies the current sequence + function toString(step) { + if (step) { + return stepToString(step); + } else { + return copy(this.images.image1.steps).map(stepToString).slice(1).join(','); + } + } + + // Stringifies one step of the sequence + function stepToString(step) { + let inputs = modulesInfo(step.options.name).inputs || {}, op = {}; + + for (let input in inputs) { + + if (!!step.options[input] && step.options[input] != inputs[input].default) { + op[input] = step.options[input]; + op[input] = encodeURIComponent(op[input]); + } + + } + + var configurations = Object.keys(op).map(key => key + ':' + op[key]).join('|'); + return `${step.options.name}{${configurations}}`; + } + + // exports the current sequence as an array of JSON steps + function toJSON() { + return this.stringToJSON(this.toString()); + } + + // Coverts stringified sequence into an array of JSON steps + function stringToJSON(str) { + let steps; + if (str.includes(',')) + steps = str.split(','); + else + steps = [str]; + return steps.map(stringToJSONstep); + } + + // Converts one stringified step into JSON + function stringToJSONstep(str) { + var bracesStrings; + if (str.includes('{')) + if (str.includes('(') && str.indexOf('(') < str.indexOf('{')) + bracesStrings = ['(', ')']; + else + bracesStrings = ['{', '}']; + else + bracesStrings = ['(', ')']; + + if (str.indexOf(bracesStrings[0]) === -1) { // if there are no settings specified + var moduleName = str.substr(0); + stepSettings = ""; + } else { + var moduleName = str.substr(0, str.indexOf(bracesStrings[0])); + stepSettings = str.slice(str.indexOf(bracesStrings[0]) + 1, -1); + } + + stepSettings = stepSettings.split('|').reduce(function formatSettings(accumulator, current, i) { + var settingName = current.substr(0, current.indexOf(':')), + settingValue = current.substr(current.indexOf(':') + 1); + settingValue = settingValue.replace(/^\(/, '').replace(/\)$/, ''); // strip () at start/end + settingValue = settingValue.replace(/^\{/, '').replace(/\}$/, ''); // strip {} at start/end + settingValue = decodeURIComponent(settingValue); + current = [ + settingName, + settingValue + ]; + if (!!settingName) accumulator[settingName] = settingValue; + return accumulator; + }, {}); + + return { + name: moduleName, + options: stepSettings + } + } + + // imports a string into the sequencer steps + function importString(str) { + let sequencer = this; + if (this.name != "ImageSequencer") + sequencer = this.sequencer; + var stepsFromString = stringToJSON(str); + stepsFromString.forEach(function eachStep(stepObj) { + sequencer.addSteps(stepObj.name, stepObj.options); + }); + } + + // imports a array of JSON steps into the sequencer steps + function importJSON(obj) { + let sequencer = this; + if (this.name != "ImageSequencer") + sequencer = this.sequencer; + obj.forEach(function eachStep(stepObj) { + sequencer.addSteps(stepObj.name, stepObj.options); + }); + } + + function loadNewModule(name, options) { + + if (!options) { + return this; + + } else if (Array.isArray(options)) { + // contains the array of module and info + this.modules[name] = options; + + } else if (options.func && options.info) { + // passed in options object + this.modules[name] = [ + options.func, options.info + ]; + + } else if (options.path && !this.inBrowser) { + // load from path(only in node) + const module = [ + require(`${options.path}/Module.js`), + require(`${options.path}/info.json`) + ]; + this.modules[name] = module; + } + return this; + } + + function saveNewModule(name, path) { + if (options.inBrowser) { + // Not for browser context + return; + } + var mods = fs.readFileSync('./src/Modules.js').toString(); + mods = mods.substr(0, mods.length - 1) + " '" + name + "': require('" + path + "'),\n}"; + fs.writeFileSync('./src/Modules.js', mods); + } + + function createMetaModule(stepsCollection, info) { + var stepsArr = stepsCollection; + if (typeof stepsCollection === 'string') + stepsArr = stringToJSON(stepsCollection); + var metaMod = function() { + this.expandSteps(stepsArr); + return { + isMeta: true + } + } + return [metaMod, info]; + } + + function saveSequence(name, sequenceString) { + const sequence = stringToJSON(sequenceString); + // Save the given sequence string as a module + if (options.inBrowser) { + // Inside the browser we save the meta-modules using the Web Storage API + var sequences = JSON.parse(window.localStorage.getItem('sequences')); + sequences[name] = sequence; + window.localStorage.setItem('sequences', JSON.stringify(sequences)); + } + else { + // In node we save the sequences in the json file SavedSequences.json + var sequences = require('./SavedSequences.json'); + sequences[name] = sequence; + fs.writeFileSync('./src/SavedSequences.json', JSON.stringify(sequences)); + } + } + + function loadModules() { + // This function loads the modules and saved sequences + this.modules = require('./Modules'); + if (options.inBrowser) + this.sequences = JSON.parse(window.localStorage.getItem('sequences')); + else + this.sequences = require('./SavedSequences.json'); + } + + return { + //literals and objects + name: "ImageSequencer", + options: options, + inputlog: inputlog, + modules: modules, + sequences: sequences, + images: images, + events: events, + + //user functions + loadImages: loadImages, + loadImage: loadImages, + addSteps: addSteps, + removeSteps: removeSteps, + insertSteps: insertSteps, + replaceImage: replaceImage, + run: run, + setUI: setUI, + exportBin: exportBin, + modulesInfo: modulesInfo, + toCliString: toCliString, + toString: toString, + stepToString: stepToString, + toJSON: toJSON, + stringToJSON: stringToJSON, + stringToJSONstep: stringToJSONstep, + importString: importString, + importJSON: importJSON, + loadNewModule: loadNewModule, + saveNewModule: saveNewModule, + createMetaModule: createMetaModule, + saveSequence: saveSequence, + loadModules: loadModules, + + //other functions + log: log, + objTypeOf: objTypeOf, + copy: copy, + + setInputStep: require('./ui/SetInputStep')(sequencer) + } + +} +module.exports = ImageSequencer; },{"./AddStep":151,"./ExportBin":152,"./FormatInput":153,"./InsertStep":155,"./Modules":156,"./ReplaceImage":157,"./Run":158,"./SavedSequences.json":160,"./ui/LoadImage":250,"./ui/SetInputStep":251,"./ui/UserInterface":252,"./util/getStep.js":255,"fs":46}],155:[function(require,module,exports){ -const getStepUtils = require('./util/getStep.js'); - -// insert one or more steps at a given index in the sequencer -function InsertStep(ref, image, index, name, o) { - if (ref.sequences[name]) { - return ref.importJSON(ref.sequences[name]); - } - - function insertStep(image, index, name, o_) { - if (ref.modules[name]) var moduleInfo = ref.modules[name][1]; - else { - console.log('Module ' + name + ' not found.'); - } - - var o = ref.copy(o_); - o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step - o.name = o_.name || name || moduleInfo.name; - o.description = o_.description || moduleInfo.description; - o.selector = o_.selector || 'ismod-' + name; - o.container = o_.container || ref.options.selector; - o.image = image; - o.inBrowser = ref.options.inBrowser; - - if (index == -1) index = ref.images[image].steps.length; - - o.step = { - name: o.name, - description: o.description, - ID: o.number, - imageName: o.image, - inBrowser: ref.options.inBrowser, - ui: ref.options.ui, - options: o - }; - var UI = ref.events; - - // define the expandSteps function for sequencer - ref.modules[name].expandSteps = function expandSteps(stepsArray) { - for (var i in stepsArray) { - let step = stepsArray[i]; - console.log(step['name']) - console.log(step['options']) - ref.insertSteps(index + Number.parseInt(i), step['name'], step['options']); - // ref.addSteps(step['name'], step['options']); - } - } - - // Tell UI that a step has been set up. - o = o || {}; - - if (!ref.modules[name][1].length) { - UI.onSetup(o.step, { index: index }); - ref.images[image].steps.splice(index, 0, ref.modules[name][0](o, UI)); - } else { - ref.modules[name][0](o, UI); - } - - return true; - } - - insertStep(image, index, name, o); - ref.steps = ref.images[image].steps; - -} -module.exports = InsertStep; +const getStepUtils = require('./util/getStep.js'); + +// insert one or more steps at a given index in the sequencer +function InsertStep(ref, image, index, name, o) { + if (ref.sequences[name]) { + return ref.importJSON(ref.sequences[name]); + } + + function insertStep(image, index, name, o_) { + if (ref.modules[name]) var moduleInfo = ref.modules[name][1]; + else { + console.log('Module ' + name + ' not found.'); + } + + var o = ref.copy(o_); + o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step + o.name = o_.name || name || moduleInfo.name; + o.description = o_.description || moduleInfo.description; + o.selector = o_.selector || 'ismod-' + name; + o.container = o_.container || ref.options.selector; + o.image = image; + o.inBrowser = ref.options.inBrowser; + + if (index == -1) index = ref.images[image].steps.length; + + o.step = { + name: o.name, + description: o.description, + ID: o.number, + imageName: o.image, + inBrowser: ref.options.inBrowser, + ui: ref.options.ui, + options: o + }; + var UI = ref.events; + + // define the expandSteps function for sequencer + ref.modules[name].expandSteps = function expandSteps(stepsArray) { + for (var i in stepsArray) { + let step = stepsArray[i]; + console.log(step['name']) + console.log(step['options']) + ref.insertSteps(index + Number.parseInt(i), step['name'], step['options']); + // ref.addSteps(step['name'], step['options']); + } + } + + // Tell UI that a step has been set up. + o = o || {}; + + if (!ref.modules[name][1].length) { + UI.onSetup(o.step, { index: index }); + ref.images[image].steps.splice(index, 0, ref.modules[name][0](o, UI)); + } else { + ref.modules[name][0](o, UI); + } + + return true; + } + + insertStep(image, index, name, o); + ref.steps = ref.images[image].steps; + +} +module.exports = InsertStep; },{"./util/getStep.js":255}],156:[function(require,module,exports){ -/* -* Core modules and their info files -*/ -module.exports = { - 'average': require('./modules/Average'), - 'blend': require('./modules/Blend'), - 'blur': require('./modules/Blur'), - 'brightness': require('./modules/Brightness'), - 'channel': require('./modules/Channel'), - 'colorbar': require('./modules/Colorbar'), - 'colormap': require('./modules/Colormap'), - 'contrast': require('./modules/Contrast'), - 'convolution': require('./modules/Convolution'), - 'crop': require('./modules/Crop'), - 'decode-qr': require('./modules/DecodeQr'), - 'draw-rectangle': require('./modules/DrawRectangle'), - 'dynamic': require('./modules/Dynamic'), - 'edge-detect': require('./modules/EdgeDetect'), - 'fisheye-gl': require('./modules/FisheyeGl'), - 'histogram': require('./modules/Histogram'), - 'gamma-correction': require('./modules/GammaCorrection'), - 'gradient': require('./modules/Gradient'), - 'import-image': require('./modules/ImportImage'), - 'invert': require('image-sequencer-invert'), - 'ndvi': require('./modules/Ndvi'), - 'ndvi-colormap': require('./modules/NdviColormap'), - 'overlay': require('./modules/Overlay'), - 'resize': require('./modules/Resize'), - 'rotate': require('./modules/Rotate'), - 'saturation': require('./modules/Saturation'), - 'white-balance': require('./modules/WhiteBalance') -} +/* +* Core modules and their info files +*/ +module.exports = { + 'average': require('./modules/Average'), + 'blend': require('./modules/Blend'), + 'blur': require('./modules/Blur'), + 'brightness': require('./modules/Brightness'), + 'channel': require('./modules/Channel'), + 'colorbar': require('./modules/Colorbar'), + 'colormap': require('./modules/Colormap'), + 'contrast': require('./modules/Contrast'), + 'convolution': require('./modules/Convolution'), + 'crop': require('./modules/Crop'), + 'decode-qr': require('./modules/DecodeQr'), + 'draw-rectangle': require('./modules/DrawRectangle'), + 'dynamic': require('./modules/Dynamic'), + 'edge-detect': require('./modules/EdgeDetect'), + 'fisheye-gl': require('./modules/FisheyeGl'), + 'histogram': require('./modules/Histogram'), + 'gamma-correction': require('./modules/GammaCorrection'), + 'gradient': require('./modules/Gradient'), + 'import-image': require('./modules/ImportImage'), + 'invert': require('image-sequencer-invert'), + 'ndvi': require('./modules/Ndvi'), + 'ndvi-colormap': require('./modules/NdviColormap'), + 'overlay': require('./modules/Overlay'), + 'resize': require('./modules/Resize'), + 'rotate': require('./modules/Rotate'), + 'saturation': require('./modules/Saturation'), + 'white-balance': require('./modules/WhiteBalance') +} + +},{"./modules/Average":162,"./modules/Blend":165,"./modules/Blur":169,"./modules/Brightness":172,"./modules/Channel":175,"./modules/Colorbar":178,"./modules/Colormap":182,"./modules/Contrast":186,"./modules/Convolution":190,"./modules/Crop":195,"./modules/DecodeQr":198,"./modules/DrawRectangle":202,"./modules/Dynamic":205,"./modules/EdgeDetect":209,"./modules/FisheyeGl":212,"./modules/GammaCorrection":215,"./modules/Gradient":218,"./modules/Histogram":221,"./modules/ImportImage":225,"./modules/Ndvi":229,"./modules/NdviColormap":232,"./modules/Overlay":235,"./modules/Resize":238,"./modules/Rotate":241,"./modules/Saturation":244,"./modules/WhiteBalance":247,"image-sequencer-invert":61}],157:[function(require,module,exports){ +// Uses a given image as input and replaces it with the output. +// Works only in the browser. +function ReplaceImage(ref,selector,steps,options) { + if(!ref.options.inBrowser) return false; // This isn't for Node.js + var tempSequencer = ImageSequencer({ui: false}); + var this_ = ref; + if (window.hasOwnProperty('$')) var input = $(selector); + else var input = document.querySelectorAll(selector); + var images = []; + for (var i = 0; i < input.length; i++) { + if (input[i] instanceof HTMLImageElement) images.push(input[i]); + } + + function replaceImage (img, steps) { + var url = img.src; + // refactor to filetypeFromUrl() + var ext = url.split('?')[0].split('.').pop(); + + var xmlHTTP = new XMLHttpRequest(); + xmlHTTP.open('GET', url, true); + xmlHTTP.responseType = 'arraybuffer'; + xmlHTTP.onload = function(e) { + var arr = new Uint8Array(this.response); + + // in chunks to avoid "RangeError: Maximum call stack exceeded" + // https://github.com/publiclab/image-sequencer/issues/241 + // https://stackoverflow.com/a/20048852/1116657 + var raw = ''; + var i,j,subArray,chunk = 5000; + for (i=0,j=arr.length; i= ref.images[image].steps.length) return { options: { name: undefined } }; - else return ref.images[image].steps.slice(i + offset)[0]; - }; - ref.images[image].steps[i].getIndex = function getIndex() { - return i; - } - - for (var util in getStepUtils) { - if (getStepUtils.hasOwnProperty(util)) { - ref.images[image].steps[i][util] = getStepUtils[util]; - } - } - - // Tell UI that a step is being drawn. - ref.images[image].steps[i].UI.onDraw(ref.images[image].steps[i].options.step); - - // provides a set of standard tools for each step - var inputForNextStep = require('./RunToolkit')(ref.copy(input)); - - ref.images[image].steps[i].draw( - inputForNextStep, - function onEachStep() { - - // This output is accessible by UI - ref.images[image].steps[i].options.step.output = ref.images[image].steps[i].output.src; - - // Tell UI that step has been drawn. - ref.images[image].steps[i].UI.onComplete(ref.images[image].steps[i].options.step); - - drawStep(drawarray, ++pos); - }, - progressObj - ); - } - } - - function drawSteps(json_q) { - var drawarray = []; - for (var image in json_q) { - var no_steps = ref.images[image].steps.length; - var init = json_q[image]; - for (var i = 0; i < no_steps - init; i++) { - drawarray.push({ image: image, i: init + i }); - } - } - drawStep(drawarray, ind); - } - - function filter(json_q) { - for (var image in json_q) { - if (json_q[image] == 0 && ref.images[image].steps.length == 1) - delete json_q[image]; - else if (json_q[image] == 0) json_q[image]++; - } - for (var image in json_q) { - var prevstep = ref.images[image].steps[json_q[image] - 1]; - while ( - typeof prevstep == "undefined" || - typeof prevstep.output == "undefined" - ) { - prevstep = ref.images[image].steps[--json_q[image] - 1]; - } - } - return json_q; - } - - var json_q = filter(json_q); - return drawSteps(json_q); -} -module.exports = Run; +const getStepUtils = require('./util/getStep.js'); + +function Run(ref, json_q, callback, ind, progressObj) { + if (!progressObj) progressObj = { stop: function() { } }; + + function drawStep(drawarray, pos) { + if (pos == drawarray.length && drawarray[pos - 1] !== undefined) { + var image = drawarray[pos - 1].image; + if (ref.objTypeOf(callback) == "Function" && ref.images[image].steps.slice(-1)[0].output) { + var steps = ref.images[image].steps; + var out = steps[steps.length - 1].output.src; + callback(out); + return true; + } + } + + // so we don't run on the loadImage module: + if (drawarray[pos] !== undefined) { + var image = drawarray[pos].image; + var i = drawarray[pos].i; + var input = ref.images[image].steps[i - 1].output; + + ref.images[image].steps[i].getStep = function getStep(offset) { + if (i + offset >= ref.images[image].steps.length) return { options: { name: undefined } }; + else return ref.images[image].steps.slice(i + offset)[0]; + }; + ref.images[image].steps[i].getIndex = function getIndex() { + return i; + } + + for (var util in getStepUtils) { + if (getStepUtils.hasOwnProperty(util)) { + ref.images[image].steps[i][util] = getStepUtils[util]; + } + } + + // Tell UI that a step is being drawn. + ref.images[image].steps[i].UI.onDraw(ref.images[image].steps[i].options.step); + + // provides a set of standard tools for each step + var inputForNextStep = require('./RunToolkit')(ref.copy(input)); + + ref.images[image].steps[i].draw( + inputForNextStep, + function onEachStep() { + + // This output is accessible by UI + ref.images[image].steps[i].options.step.output = ref.images[image].steps[i].output.src; + + // Tell UI that step has been drawn. + ref.images[image].steps[i].UI.onComplete(ref.images[image].steps[i].options.step); + + drawStep(drawarray, ++pos); + }, + progressObj + ); + } + } + + function drawSteps(json_q) { + var drawarray = []; + for (var image in json_q) { + var no_steps = ref.images[image].steps.length; + var init = json_q[image]; + for (var i = 0; i < no_steps - init; i++) { + drawarray.push({ image: image, i: init + i }); + } + } + drawStep(drawarray, ind); + } + + function filter(json_q) { + for (var image in json_q) { + if (json_q[image] == 0 && ref.images[image].steps.length == 1) + delete json_q[image]; + else if (json_q[image] == 0) json_q[image]++; + } + for (var image in json_q) { + var prevstep = ref.images[image].steps[json_q[image] - 1]; + while ( + typeof prevstep == "undefined" || + typeof prevstep.output == "undefined" + ) { + prevstep = ref.images[image].steps[--json_q[image] - 1]; + } + } + return json_q; + } + + var json_q = filter(json_q); + return drawSteps(json_q); +} +module.exports = Run; },{"./RunToolkit":159,"./util/getStep.js":255}],159:[function(require,module,exports){ -const getPixels = require('get-pixels'); -const pixelManipulation = require('./modules/_nomodule/PixelManipulation'); -const lodash = require('lodash'); -const dataUriToBuffer = require('data-uri-to-buffer'); -const savePixels = require('save-pixels'); - -module.exports = function(input) { - input.getPixels = getPixels; - input.pixelManipulation = pixelManipulation; - input.lodash = lodash; - input.dataUriToBuffer = dataUriToBuffer; - input.savePixels = savePixels; - return input; +const getPixels = require('get-pixels'); +const pixelManipulation = require('./modules/_nomodule/PixelManipulation'); +const lodash = require('lodash'); +const dataUriToBuffer = require('data-uri-to-buffer'); +const savePixels = require('save-pixels'); + +module.exports = function(input) { + input.getPixels = getPixels; + input.pixelManipulation = pixelManipulation; + input.lodash = lodash; + input.dataUriToBuffer = dataUriToBuffer; + input.savePixels = savePixels; + return input; } },{"./modules/_nomodule/PixelManipulation":249,"data-uri-to-buffer":19,"get-pixels":29,"lodash":75,"save-pixels":138}],160:[function(require,module,exports){ module.exports={"sample":[{"name":"invert","options":{}},{"name":"channel","options":{"channel":"red"}},{"name":"blur","options":{"blur":"5"}}]} },{}],161:[function(require,module,exports){ -/* -* Average all pixel colors -*/ -module.exports = function Average(options, UI){ - - options.blur = options.blur || 2 - var output; - - options.step.metadata = options.step.metadata || {}; - - function draw(input,callback,progressObj){ - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a){ - return [r,g,b,a] - } - - // do the averaging - function extraManipulation(pixels){ - var sum = [0,0,0,0]; - for (var i = 0; i < pixels.data.length; i += 4) { - sum[0] += pixels.data[i + 0]; - sum[1] += pixels.data[i + 1]; - sum[2] += pixels.data[i + 2]; - sum[3] += pixels.data[i + 3]; - } - - sum[0] = parseInt(sum[0] / (pixels.data.length / 4)); - sum[1] = parseInt(sum[1] / (pixels.data.length / 4)); - sum[2] = parseInt(sum[2] / (pixels.data.length / 4)); - sum[3] = parseInt(sum[3] / (pixels.data.length / 4)); - - for (var i = 0; i < pixels.data.length; i += 4) { - pixels.data[i + 0] = sum[0]; - pixels.data[i + 1] = sum[1]; - pixels.data[i + 2] = sum[2]; - pixels.data[i + 3] = sum[3]; - } - // report back and store average in metadata: - options.step.metadata.averages = sum; - console.log("average: ", sum); - // TODO: refactor into a new "display()" method as per https://github.com/publiclab/image-sequencer/issues/242 - if (options.step.inBrowser && options.step.ui) $(options.step.ui).find('.details').append("

Averages (r, g, b, a): " + sum.join(', ') + "

"); - return pixels; - } - - function output(image, datauri, mimetype){ - - // This output is accessible by Image Sequencer - step.output = { - src: datauri, - format: mimetype - }; - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* +* Average all pixel colors +*/ +module.exports = function Average(options, UI){ + + options.blur = options.blur || 2 + var output; + + options.step.metadata = options.step.metadata || {}; + + function draw(input,callback,progressObj){ + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a){ + return [r,g,b,a] + } + + // do the averaging + function extraManipulation(pixels){ + var sum = [0,0,0,0]; + for (var i = 0; i < pixels.data.length; i += 4) { + sum[0] += pixels.data[i + 0]; + sum[1] += pixels.data[i + 1]; + sum[2] += pixels.data[i + 2]; + sum[3] += pixels.data[i + 3]; + } + + sum[0] = parseInt(sum[0] / (pixels.data.length / 4)); + sum[1] = parseInt(sum[1] / (pixels.data.length / 4)); + sum[2] = parseInt(sum[2] / (pixels.data.length / 4)); + sum[3] = parseInt(sum[3] / (pixels.data.length / 4)); + + for (var i = 0; i < pixels.data.length; i += 4) { + pixels.data[i + 0] = sum[0]; + pixels.data[i + 1] = sum[1]; + pixels.data[i + 2] = sum[2]; + pixels.data[i + 3] = sum[3]; + } + // report back and store average in metadata: + options.step.metadata.averages = sum; + console.log("average: ", sum); + // TODO: refactor into a new "display()" method as per https://github.com/publiclab/image-sequencer/issues/242 + if (options.step.inBrowser && options.step.ui) $(options.step.ui).find('.details').append("

Averages (r, g, b, a): " + sum.join(', ') + "

"); + return pixels; + } + + function output(image, datauri, mimetype){ + + // This output is accessible by Image Sequencer + step.output = { + src: datauri, + format: mimetype + }; + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249}],162:[function(require,module,exports){ -module.exports = [ - require('./Module'), - require('./info.json') +module.exports = [ + require('./Module'), + require('./info.json') ] },{"./Module":161,"./info.json":163}],163:[function(require,module,exports){ -module.exports={ - "name": "Average", - "description": "Average all pixel color", - "inputs": { - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Average", + "description": "Average all pixel color", + "inputs": { + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],164:[function(require,module,exports){ -module.exports = function Dynamic(options, UI, util) { - - options.func = options.func || "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"; - options.offset = options.offset || -2; - - var output; - - // This function is called on every draw. - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - // convert to runnable code: - if (typeof options.func === "string") eval('options.func = ' + options.func); - - var getPixels = require('get-pixels'); - - // convert offset as string to int - if(typeof options.offset === "string") options.offset = parseInt(options.offset); - - // save first image's pixels - var priorStep = this.getStep(options.offset); - - getPixels(priorStep.output.src, function(err, pixels) { - options.firstImagePixels = pixels; - - function changePixel(r2, g2, b2, a2, x, y) { - // blend! - var p = options.firstImagePixels; - return options.func( - r2, g2, b2, a2, - p.get(x, y, 0), - p.get(x, y, 1), - p.get(x, y, 2), - p.get(x, y, 3) - ) - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - // run PixelManipulatin on second image's pixels - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - }); - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Dynamic(options, UI, util) { + + options.func = options.func || "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"; + options.offset = options.offset || -2; + + var output; + + // This function is called on every draw. + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + // convert to runnable code: + if (typeof options.func === "string") eval('options.func = ' + options.func); + + var getPixels = require('get-pixels'); + + // convert offset as string to int + if(typeof options.offset === "string") options.offset = parseInt(options.offset); + + // save first image's pixels + var priorStep = this.getStep(options.offset); + + getPixels(priorStep.output.src, function(err, pixels) { + options.firstImagePixels = pixels; + + function changePixel(r2, g2, b2, a2, x, y) { + // blend! + var p = options.firstImagePixels; + return options.func( + r2, g2, b2, a2, + p.get(x, y, 0), + p.get(x, y, 1), + p.get(x, y, 2), + p.get(x, y, 3) + ) + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + // run PixelManipulatin on second image's pixels + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249,"get-pixels":29}],165:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":164,"./info.json":166,"dup":162}],166:[function(require,module,exports){ -module.exports={ - "name": "Blend", - "description": "Blend two chosen image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!", - "inputs": { - "offset": { - "type": "integer", - "desc": "Choose which image to blend the current image with. Two steps back is -2, three steps back is -3 etc.", - "default": -2 - }, - "blend": { - "type": "input", - "desc": "Function to use to blend the two images.", - "default": "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Blend", + "description": "Blend two chosen image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!", + "inputs": { + "offset": { + "type": "integer", + "desc": "Choose which image to blend the current image with. Two steps back is -2, three steps back is -3 etc.", + "default": -2 + }, + "blend": { + "type": "input", + "desc": "Function to use to blend the two images.", + "default": "function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],167:[function(require,module,exports){ -module.exports = exports = function(pixels, blur) { - let kernel = kernelGenerator(blur, 1), oldpix = pixels; - kernel = flipKernel(kernel); - - for (let i = 0; i < pixels.shape[0]; i++) { - for (let j = 0; j < pixels.shape[1]; j++) { - let neighboutPos = getNeighbouringPixelPositions([i, j]); - let acc = [0.0, 0.0, 0.0, 0.0]; - for (let a = 0; a < kernel.length; a++) { - for (let b = 0; b < kernel.length; b++) { - acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); - acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); - acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); - acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); - } - } - pixels.set(i, j, 0, acc[0]); - pixels.set(i, j, 1, acc[1]); - pixels.set(i, j, 2, acc[2]); - } - } - return pixels; - - - - //Generates a 3x3 Gaussian kernel - function kernelGenerator(sigma, size) { - - /* - Trying out a variable radius kernel not working as of now - */ - // const coeff = (1.0/(2.0*Math.PI*sigma*sigma)) - // const expCoeff = -1 * (1.0/2.0 * sigma * sigma) - // let e = Math.E - // let result = [] - // for(let i = -1 * size;i<=size;i++){ - // let arr = [] - // for(let j= -1 * size;j<=size;j++){ - // arr.push(coeff * Math.pow(e,expCoeff * ((i * i) + (j*j)))) - // } - // result.push(arr) - // } - // let sum = result.reduce((sum,val)=>{ - // return val.reduce((sumInner,valInner)=>{ - // return sumInner+valInner - // }) - // }) - // result = result.map(arr=>arr.map(val=>(val + 0.0)/(sum + 0.0))) - - // return result - - return [ - [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0], - [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], - [5.0 / 159.0, 12.0 / 159.0, 15.0 / 159.0, 12.0 / 159.0, 5.0 / 159.0], - [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], - [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0] - ]; - } - function getNeighbouringPixelPositions(pixelPosition) { - let x = pixelPosition[0], y = pixelPosition[1], result = []; - - for (let i = -2; i <= 2; i++) { - let arr = []; - for (let j = -2; j <= 2; j++) - arr.push([x + i, y + j]); - - result.push(arr); - } - return result; - } - - function flipKernel(kernel) { - let result = []; - for (let i = kernel.length - 1; i >= 0; i--) { - let arr = []; - for (let j = kernel[i].length - 1; j >= 0; j--) { - arr.push(kernel[i][j]); - } - result.push(arr); - } - return result; - } +module.exports = exports = function(pixels, blur) { + let kernel = kernelGenerator(blur, 1), oldpix = pixels; + kernel = flipKernel(kernel); + + for (let i = 0; i < pixels.shape[0]; i++) { + for (let j = 0; j < pixels.shape[1]; j++) { + let neighboutPos = getNeighbouringPixelPositions([i, j]); + let acc = [0.0, 0.0, 0.0, 0.0]; + for (let a = 0; a < kernel.length; a++) { + for (let b = 0; b < kernel.length; b++) { + acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); + acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); + acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); + acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); + } + } + pixels.set(i, j, 0, acc[0]); + pixels.set(i, j, 1, acc[1]); + pixels.set(i, j, 2, acc[2]); + } + } + return pixels; + + + + //Generates a 3x3 Gaussian kernel + function kernelGenerator(sigma, size) { + + /* + Trying out a variable radius kernel not working as of now + */ + // const coeff = (1.0/(2.0*Math.PI*sigma*sigma)) + // const expCoeff = -1 * (1.0/2.0 * sigma * sigma) + // let e = Math.E + // let result = [] + // for(let i = -1 * size;i<=size;i++){ + // let arr = [] + // for(let j= -1 * size;j<=size;j++){ + // arr.push(coeff * Math.pow(e,expCoeff * ((i * i) + (j*j)))) + // } + // result.push(arr) + // } + // let sum = result.reduce((sum,val)=>{ + // return val.reduce((sumInner,valInner)=>{ + // return sumInner+valInner + // }) + // }) + // result = result.map(arr=>arr.map(val=>(val + 0.0)/(sum + 0.0))) + + // return result + + return [ + [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0], + [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], + [5.0 / 159.0, 12.0 / 159.0, 15.0 / 159.0, 12.0 / 159.0, 5.0 / 159.0], + [4.0 / 159.0, 9.0 / 159.0, 12.0 / 159.0, 9.0 / 159.0, 4.0 / 159.0], + [2.0 / 159.0, 4.0 / 159.0, 5.0 / 159.0, 4.0 / 159.0, 2.0 / 159.0] + ]; + } + function getNeighbouringPixelPositions(pixelPosition) { + let x = pixelPosition[0], y = pixelPosition[1], result = []; + + for (let i = -2; i <= 2; i++) { + let arr = []; + for (let j = -2; j <= 2; j++) + arr.push([x + i, y + j]); + + result.push(arr); + } + return result; + } + + function flipKernel(kernel) { + let result = []; + for (let i = kernel.length - 1; i >= 0; i--) { + let arr = []; + for (let j = kernel[i].length - 1; j >= 0; j--) { + arr.push(kernel[i][j]); + } + result.push(arr); + } + return result; + } } },{}],168:[function(require,module,exports){ -/* -* Blur an Image -*/ -module.exports = function Blur(options, UI) { - - options.blur = options.blur || 2 - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - return [r, g, b, a] - } - - function extraManipulation(pixels) { - pixels = require('./Blur')(pixels, options.blur) - return pixels - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* +* Blur an Image +*/ +module.exports = function Blur(options, UI) { + + options.blur = options.blur || 2 + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + return [r, g, b, a] + } + + function extraManipulation(pixels) { + pixels = require('./Blur')(pixels, options.blur) + return pixels + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249,"./Blur":167}],169:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":168,"./info.json":170,"dup":162}],170:[function(require,module,exports){ -module.exports={ - "name": "Blur", - "description": "Applies a Gaussian blur given by the intensity value", - "inputs": { - "blur": { - "type": "range", - "desc": "Amount of gaussian blur(Less blur gives more detail, typically 0-5)", - "default": "2", - "min": "0", - "max": "5", - "step": "0.25" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Blur", + "description": "Applies a Gaussian blur given by the intensity value", + "inputs": { + "blur": { + "type": "range", + "desc": "Amount of gaussian blur(Less blur gives more detail, typically 0-5)", + "default": "2", + "min": "0", + "max": "5", + "step": "0.25" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],171:[function(require,module,exports){ -/* -* Changes the Image Brightness -*/ - -module.exports = function Brightness(options,UI){ - - - var output; - - function draw(input,callback,progressObj){ - - options.brightness = parseInt(options.brightness) || 100; - var val = (options.brightness)/100.0; - progressObj.stop(true); - progressObj.overrideFlag = true; - - /* - In this case progress is handled by changepixel internally otherwise progressObj - needs to be overriden and used - For eg. progressObj = new SomeProgressModule() - */ - - var step = this; - - function changePixel(r, g, b, a){ - - r = Math.min(val*r, 255) - g = Math.min(val*g, 255) - b = Math.min(val*b, 255) - return [r, g, b, a] - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* +* Changes the Image Brightness +*/ + +module.exports = function Brightness(options,UI){ + + + var output; + + function draw(input,callback,progressObj){ + + options.brightness = parseInt(options.brightness) || 100; + var val = (options.brightness)/100.0; + progressObj.stop(true); + progressObj.overrideFlag = true; + + /* + In this case progress is handled by changepixel internally otherwise progressObj + needs to be overriden and used + For eg. progressObj = new SomeProgressModule() + */ + + var step = this; + + function changePixel(r, g, b, a){ + + r = Math.min(val*r, 255) + g = Math.min(val*g, 255) + b = Math.min(val*b, 255) + return [r, g, b, a] + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":249}],172:[function(require,module,exports){ +arguments[4][162][0].apply(exports,arguments) +},{"./Module":171,"./info.json":173,"dup":162}],173:[function(require,module,exports){ +module.exports={ + "name": "Brightness", + "description": "Change the brightness of the image by given percent value", + "inputs": { + "brightness": { + "type": "range", + "desc": "% brightness for the new image", + "default": "175", + "min": "0", + "max": "200", + "step": "1" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} + +},{}],174:[function(require,module,exports){ +/* + * Display only one color channel + */ +module.exports = function Channel(options, UI) { + + options.channel = options.channel || "green"; + + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; -},{"../_nomodule/PixelManipulation.js":249}],172:[function(require,module,exports){ -arguments[4][162][0].apply(exports,arguments) -},{"./Module":171,"./info.json":173,"dup":162}],173:[function(require,module,exports){ -module.exports={ - "name": "Brightness", - "description": "Change the brightness of the image by given percent value", - "inputs": { - "brightness": { - "type": "range", - "desc": "% brightness for the new image", - "default": "175", - "min": "0", - "max": "200", - "step": "1" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} + function changePixel(r, g, b, a) { + if (options.channel == "red") return [r, 0, 0, a]; + if (options.channel == "green") return [0, g, 0, a]; + if (options.channel == "blue") return [0, 0, b, a]; + } -},{}],174:[function(require,module,exports){ -/* - * Display only one color channel - */ -module.exports = function Channel(options, UI) { - - options.channel = options.channel || "green"; - - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - if (options.channel == "red") return [r, 0, 0, a]; - if (options.channel == "green") return [0, g, 0, a]; - if (options.channel == "blue") return [0, 0, b, a]; - } - - function output(image, datauri, mimetype) { - - // This output is accesible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } -} + function output(image, datauri, mimetype) { + + // This output is accesible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249}],175:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":174,"./info.json":176,"dup":162}],176:[function(require,module,exports){ -module.exports={ - "name": "Channel", - "description": "Displays only one color channel of an image -- default is green", - "inputs": { - "channel": { - "type": "select", - "desc": "Color channel", - "default": "green", - "values": ["red", "green", "blue"] - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Channel", + "description": "Displays only one color channel of an image -- default is green", + "inputs": { + "channel": { + "type": "select", + "desc": "Color channel", + "default": "green", + "values": ["red", "green", "blue"] + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],177:[function(require,module,exports){ -module.exports = function NdviColormapfunction(options, UI) { - - options.x = options.x || 0; - options.y = options.y || 0; - options.colormap = options.colormap || "default"; - options.h = options.h || 10; - this.expandSteps([ - { 'name': 'gradient', 'options': {} }, - { 'name': 'colormap', 'options': { colormap: options.colormap } }, - { 'name': 'crop', 'options': { 'y': 0, 'h': options.h } }, - { 'name': 'overlay', 'options': { 'x': options.x, 'y': options.y, 'offset': -4 } } - ]); - return { - isMeta: true - } +module.exports = function NdviColormapfunction(options, UI) { + + options.x = options.x || 0; + options.y = options.y || 0; + options.colormap = options.colormap || "default"; + options.h = options.h || 10; + this.expandSteps([ + { 'name': 'gradient', 'options': {} }, + { 'name': 'colormap', 'options': { colormap: options.colormap } }, + { 'name': 'crop', 'options': { 'y': 0, 'h': options.h } }, + { 'name': 'overlay', 'options': { 'x': options.x, 'y': options.y, 'offset': -4 } } + ]); + return { + isMeta: true + } } },{}],178:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":177,"./info.json":179,"dup":162}],179:[function(require,module,exports){ -module.exports={ - "name": "Colorbar", - "description": "Generates a colorbar to lay over the image", - "inputs": { - "colormap": { - "type": "select", - "desc": "Name of the Colormap", - "default": "default", - "values": [ - "default", - "greyscale", - "stretched", - "fastie" - ] - }, - "x": { - "type": "integer", - "desc": "X-position of the image on which the new image is overlayed", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position of the image on which the new image is overlayed", - "default": 0 - }, - "h": { - "type": "iinteger", - "desc": "height of the colorbar", - "default": 10 - } - }, - "length": 4, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +module.exports={ + "name": "Colorbar", + "description": "Generates a colorbar to lay over the image", + "inputs": { + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": [ + "default", + "greyscale", + "stretched", + "fastie" + ] + }, + "x": { + "type": "integer", + "desc": "X-position of the image on which the new image is overlayed", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position of the image on which the new image is overlayed", + "default": 0 + }, + "h": { + "type": "iinteger", + "desc": "height of the colorbar", + "default": 10 + } + }, + "length": 4, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" } },{}],180:[function(require,module,exports){ -/* - * Accepts a value from 0-255 and returns the new color-mapped pixel - * from a lookup table, which can be specified as an array of [begin, end] - * gradients, where begin and end are represented as [r, g, b] colors. In - * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: - * [ - * [0, [0, 0, 0], [255, 255, 255]], - * [1, [255, 255, 255], [255, 255, 255]] - * ] - * - * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b - */ - -module.exports = function Colormap(value, options) { - options.colormap = options.colormap || colormaps.default; - // if a lookup table is provided as an array: - if(typeof(options.colormap) == "object") - colormapFunction = colormap(options.colormap); - // if a stored colormap is named with a string like "fastie": - else if(colormaps.hasOwnProperty(options.colormap)) - colormapFunction = colormaps[options.colormap]; - else colormapFunction = colormaps.default; - return colormapFunction(value / 255.00); -} - -function colormap(segments) { - return function(x) { - var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; - _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; - _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; - if (x < x0) { - return y0; - } - for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { - _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; - x0 = xstart; - if (i === segments.length - 1) { - x1 = 1; - break; - } - x1 = segments[i + 1][0]; - if ((xstart <= x && x < x1)) { - break; - } - } - result = []; - for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { - result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; - } - return result; - }; -}; - -var colormaps = { - greyscale: colormap([ - [0, [0, 0, 0], [255, 255, 255] ], - [1, [255, 255, 255], [255, 255, 255] ] - ]), - - bluwhtgrngis: colormap([ - [0, [6,23,86], [6,25, 84] ], - [0.0625, [6,25,84], [6,25, 84] ],//1 - [0.125, [6,25,84], [6,25, 84] ],//2 - [0.1875, [6,25,84], [6,25, 84] ], - [0.25, [6,25,84], [6,25,84] ], - [0.3125, [6,25,84], [9,24, 84] ],//5 - [0.3438, [9,24, 84], [119,120,162] ],//5 - [0.375, [119,129,162],[249,250,251] ], //6 - [0.406, [249,250,251],[255,255,255] ], //6.5 - [0.4375, [255,255,255],[255,255,255] ], //7 white - [0.50, [255,255,255],[214,205,191] ],//8 - [0.52, [214,205,191],[178,175,96] ],//8.2 - [0.5625, [178,175,96], [151,176,53] ],//9 - [0.593, [151,176,53], [146,188,12] ],//9.5 - [0.625, [146,188,12], [96,161,1] ], //10 - [0.6875, [96,161,1], [30,127,3] ],//11 - [0.75, [30,127,3], [0,99,1] ],//12 - [0.8125, [0,99,1], [0,74,1] ],//13 - [0.875, [0,74,1], [0,52, 0] ],//14 - [0.9375, [0,52, 0], [0,34,0] ], //15 - [0.968, [0,34,0], [68,70,67] ] //16 - ]), - - - brntogrn: colormap([ - [0, [110,12,3], [118,6,1] ], - [0.0625, [118,6,1], [141,19,6] ], - [0.125, [141,19,6], [165,35,13] ], - [0.1875, [165,35,13], [177,59,25] ], - [0.2188, [177,59,25], [192,91,36] ], - [0.25, [192,91,36], [214, 145, 76] ], - [0.3125, [214,145,76], [230,183,134] ], - [0.375, [230,183,134],[243, 224, 194]], - [0.4375, [243,224,194],[250,252,229] ], - [0.50, [250,252,229],[217,235,185] ], - [0.5625, [217,235,185],[184,218,143] ], - [0.625, [184,218,143],[141,202,89] ], - [0.6875, [141,202,89], [80,176,61] ], - [0.75, [80,176,61], [0, 147, 32] ], - [0.8125, [0,147,32], [1, 122, 22] ], - [0.875, [1,122,22], [0, 114, 19] ], - [0.90, [0,114,19], [0,105,18] ], - [0.9375, [0,105,18], [7,70,14] ] - - ]), - - - blutoredjet: colormap([ - [0, [0,0,140], [1,1,186] ], - [0.0625, [1,1,186], [0,1,248] ], - [0.125, [0,1,248], [0,70,254] ], - [0.1875, [0,70,254], [0,130,255] ], - [0.25, [0,130,255], [2,160,255] ], - [0.2813, [2,160,255], [0,187,255] ], //inset - [0.3125, [0,187,255], [6,250,255] ], - // [0.348, [0,218,255], [8,252,251] ],//inset - [0.375, [8,252,251], [27,254,228] ], - [0.406, [27,254,228], [70,255,187] ], //insert - [0.4375, [70,255,187], [104,254,151]], - [0.47, [104,254,151],[132,255,19] ],//insert - [0.50, [132,255,19], [195,255,60] ], - [0.5625, [195,255,60], [231,254,25] ], - [0.5976, [231,254,25], [253,246,1] ],//insert - [0.625, [253,246,1], [252,210,1] ], //yellow - [0.657, [252,210,1], [255,183,0] ],//insert - [0.6875, [255,183,0], [255,125,2] ], - [0.75, [255,125,2], [255,65, 1] ], - [0.8125, [255,65, 1], [247, 1, 1] ], - [0.875, [247,1,1], [200, 1, 3] ], - [0.9375, [200,1,3], [122, 3, 2] ] - - ]), - - - colors16: colormap([ - [0, [0,0,0], [0,0,0] ], - [0.0625, [3,1,172], [3,1,172] ], - [0.125, [3,1,222], [3,1, 222] ], - [0.1875, [0,111,255], [0,111,255] ], - [0.25, [3,172,255], [3,172,255] ], - [0.3125, [1,226,255], [1,226,255] ], - [0.375, [2,255,0], [2,255,0] ], - [0.4375, [198,254,0], [190,254,0] ], - [0.50, [252,255,0], [252,255,0] ], - [0.5625, [255,223,3], [255,223,3] ], - [0.625, [255,143,3], [255,143,3] ], - [0.6875, [255,95,3], [255,95,3] ], - [0.75, [242,0,1], [242,0,1] ], - [0.8125, [245,0,170], [245,0,170] ], - [0.875, [223,180,225], [223,180,225] ], - [0.9375, [255,255,255], [255,255, 255]] - - ]), - - default: colormap([ - [0, [45,1,121], [25,1,137] ], - [0.125, [25,1,137], [0,6,156] ], - [0.1875, [0,6,156], [7,41,172] ], - [0.25, [7,41,172], [22,84,187] ], - [0.3125, [22,84,187], [25,125,194] ], - [0.375, [25,125,194], [26,177,197] ], - [0.4375, [26,177,197], [23,199,193] ], - [0.47, [23,199,193], [25, 200,170] ], - [0.50, [25, 200,170], [21,209,27] ], - [0.5625, [21,209,27], [108,215,18] ], - [0.625, [108,215,18], [166,218,19] ], - [0.6875, [166,218,19], [206,221,20] ], - [0.75, [206,221,20], [222,213,19 ] ], - [0.7813, [222,213,19], [222, 191, 19]], - [0.8125, [222, 191, 19], [227,133,17] ], - [0.875, [227,133,17], [231,83,16] ], - [0.9375, [231,83,16], [220,61,48] ] - - ]), - - - fastie: colormap([ - [0, [255, 255, 255], [0, 0, 0] ], - [0.167, [0, 0, 0], [255, 255, 255] ], - [0.33, [255, 255, 255], [0, 0, 0] ], - [0.5, [0, 0, 0], [140, 140, 255] ], - [0.55, [140, 140, 255], [0, 255, 0] ], - [0.63, [0, 255, 0], [255, 255, 0] ], - [0.75, [255, 255, 0], [255, 0, 0] ], - [0.95, [255, 0, 0], [255, 0, 255] ] - ]), - - - stretched: colormap([ - [0, [0, 0, 255], [0, 0, 255] ], - [0.1, [0, 0, 255], [38, 195, 195] ], - [0.5, [0, 150, 0], [255, 255, 0] ], - [0.7, [255, 255, 0], [255, 50, 50] ], - [0.9, [255, 50, 50], [255, 50, 50] ] - ]) - +/* + * Accepts a value from 0-255 and returns the new color-mapped pixel + * from a lookup table, which can be specified as an array of [begin, end] + * gradients, where begin and end are represented as [r, g, b] colors. In + * combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like: + * [ + * [0, [0, 0, 0], [255, 255, 255]], + * [1, [255, 255, 255], [255, 255, 255]] + * ] + * + * Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b + */ + +module.exports = function Colormap(value, options) { + options.colormap = options.colormap || colormaps.default; + // if a lookup table is provided as an array: + if(typeof(options.colormap) == "object") + colormapFunction = colormap(options.colormap); + // if a stored colormap is named with a string like "fastie": + else if(colormaps.hasOwnProperty(options.colormap)) + colormapFunction = colormaps[options.colormap]; + else colormapFunction = colormaps.default; + return colormapFunction(value / 255.00); +} + +function colormap(segments) { + return function(x) { + var i, result, x0, x1, xstart, y0, y1, _i, _j, _len, _ref, _ref1, _ref2, _ref3; + _ref = [0, 0], y0 = _ref[0], y1 = _ref[1]; + _ref1 = [segments[0][0], 1], x0 = _ref1[0], x1 = _ref1[1]; + if (x < x0) { + return y0; + } + for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) { + _ref2 = segments[i], xstart = _ref2[0], y0 = _ref2[1], y1 = _ref2[2]; + x0 = xstart; + if (i === segments.length - 1) { + x1 = 1; + break; + } + x1 = segments[i + 1][0]; + if ((xstart <= x && x < x1)) { + break; + } + } + result = []; + for (i = _j = 0, _ref3 = y0.length; 0 <= _ref3 ? _j < _ref3 : _j > _ref3; i = 0 <= _ref3 ? ++_j : --_j) { + result[i] = (x - x0) / (x1 - x0) * (y1[i] - y0[i]) + y0[i]; + } + return result; + }; +}; + +var colormaps = { + greyscale: colormap([ + [0, [0, 0, 0], [255, 255, 255] ], + [1, [255, 255, 255], [255, 255, 255] ] + ]), + + bluwhtgrngis: colormap([ + [0, [6,23,86], [6,25, 84] ], + [0.0625, [6,25,84], [6,25, 84] ],//1 + [0.125, [6,25,84], [6,25, 84] ],//2 + [0.1875, [6,25,84], [6,25, 84] ], + [0.25, [6,25,84], [6,25,84] ], + [0.3125, [6,25,84], [9,24, 84] ],//5 + [0.3438, [9,24, 84], [119,120,162] ],//5 + [0.375, [119,129,162],[249,250,251] ], //6 + [0.406, [249,250,251],[255,255,255] ], //6.5 + [0.4375, [255,255,255],[255,255,255] ], //7 white + [0.50, [255,255,255],[214,205,191] ],//8 + [0.52, [214,205,191],[178,175,96] ],//8.2 + [0.5625, [178,175,96], [151,176,53] ],//9 + [0.593, [151,176,53], [146,188,12] ],//9.5 + [0.625, [146,188,12], [96,161,1] ], //10 + [0.6875, [96,161,1], [30,127,3] ],//11 + [0.75, [30,127,3], [0,99,1] ],//12 + [0.8125, [0,99,1], [0,74,1] ],//13 + [0.875, [0,74,1], [0,52, 0] ],//14 + [0.9375, [0,52, 0], [0,34,0] ], //15 + [0.968, [0,34,0], [68,70,67] ] //16 + ]), + + + brntogrn: colormap([ + [0, [110,12,3], [118,6,1] ], + [0.0625, [118,6,1], [141,19,6] ], + [0.125, [141,19,6], [165,35,13] ], + [0.1875, [165,35,13], [177,59,25] ], + [0.2188, [177,59,25], [192,91,36] ], + [0.25, [192,91,36], [214, 145, 76] ], + [0.3125, [214,145,76], [230,183,134] ], + [0.375, [230,183,134],[243, 224, 194]], + [0.4375, [243,224,194],[250,252,229] ], + [0.50, [250,252,229],[217,235,185] ], + [0.5625, [217,235,185],[184,218,143] ], + [0.625, [184,218,143],[141,202,89] ], + [0.6875, [141,202,89], [80,176,61] ], + [0.75, [80,176,61], [0, 147, 32] ], + [0.8125, [0,147,32], [1, 122, 22] ], + [0.875, [1,122,22], [0, 114, 19] ], + [0.90, [0,114,19], [0,105,18] ], + [0.9375, [0,105,18], [7,70,14] ] + + ]), + + + blutoredjet: colormap([ + [0, [0,0,140], [1,1,186] ], + [0.0625, [1,1,186], [0,1,248] ], + [0.125, [0,1,248], [0,70,254] ], + [0.1875, [0,70,254], [0,130,255] ], + [0.25, [0,130,255], [2,160,255] ], + [0.2813, [2,160,255], [0,187,255] ], //inset + [0.3125, [0,187,255], [6,250,255] ], + // [0.348, [0,218,255], [8,252,251] ],//inset + [0.375, [8,252,251], [27,254,228] ], + [0.406, [27,254,228], [70,255,187] ], //insert + [0.4375, [70,255,187], [104,254,151]], + [0.47, [104,254,151],[132,255,19] ],//insert + [0.50, [132,255,19], [195,255,60] ], + [0.5625, [195,255,60], [231,254,25] ], + [0.5976, [231,254,25], [253,246,1] ],//insert + [0.625, [253,246,1], [252,210,1] ], //yellow + [0.657, [252,210,1], [255,183,0] ],//insert + [0.6875, [255,183,0], [255,125,2] ], + [0.75, [255,125,2], [255,65, 1] ], + [0.8125, [255,65, 1], [247, 1, 1] ], + [0.875, [247,1,1], [200, 1, 3] ], + [0.9375, [200,1,3], [122, 3, 2] ] + + ]), + + + colors16: colormap([ + [0, [0,0,0], [0,0,0] ], + [0.0625, [3,1,172], [3,1,172] ], + [0.125, [3,1,222], [3,1, 222] ], + [0.1875, [0,111,255], [0,111,255] ], + [0.25, [3,172,255], [3,172,255] ], + [0.3125, [1,226,255], [1,226,255] ], + [0.375, [2,255,0], [2,255,0] ], + [0.4375, [198,254,0], [190,254,0] ], + [0.50, [252,255,0], [252,255,0] ], + [0.5625, [255,223,3], [255,223,3] ], + [0.625, [255,143,3], [255,143,3] ], + [0.6875, [255,95,3], [255,95,3] ], + [0.75, [242,0,1], [242,0,1] ], + [0.8125, [245,0,170], [245,0,170] ], + [0.875, [223,180,225], [223,180,225] ], + [0.9375, [255,255,255], [255,255, 255]] + + ]), + + default: colormap([ + [0, [45,1,121], [25,1,137] ], + [0.125, [25,1,137], [0,6,156] ], + [0.1875, [0,6,156], [7,41,172] ], + [0.25, [7,41,172], [22,84,187] ], + [0.3125, [22,84,187], [25,125,194] ], + [0.375, [25,125,194], [26,177,197] ], + [0.4375, [26,177,197], [23,199,193] ], + [0.47, [23,199,193], [25, 200,170] ], + [0.50, [25, 200,170], [21,209,27] ], + [0.5625, [21,209,27], [108,215,18] ], + [0.625, [108,215,18], [166,218,19] ], + [0.6875, [166,218,19], [206,221,20] ], + [0.75, [206,221,20], [222,213,19 ] ], + [0.7813, [222,213,19], [222, 191, 19]], + [0.8125, [222, 191, 19], [227,133,17] ], + [0.875, [227,133,17], [231,83,16] ], + [0.9375, [231,83,16], [220,61,48] ] + + ]), + + + fastie: colormap([ + [0, [255, 255, 255], [0, 0, 0] ], + [0.167, [0, 0, 0], [255, 255, 255] ], + [0.33, [255, 255, 255], [0, 0, 0] ], + [0.5, [0, 0, 0], [140, 140, 255] ], + [0.55, [140, 140, 255], [0, 255, 0] ], + [0.63, [0, 255, 0], [255, 255, 0] ], + [0.75, [255, 255, 0], [255, 0, 0] ], + [0.95, [255, 0, 0], [255, 0, 255] ] + ]), + + + stretched: colormap([ + [0, [0, 0, 255], [0, 0, 255] ], + [0.1, [0, 0, 255], [38, 195, 195] ], + [0.5, [0, 150, 0], [255, 255, 0] ], + [0.7, [255, 255, 0], [255, 50, 50] ], + [0.9, [255, 50, 50], [255, 50, 50] ] + ]) + } },{}],181:[function(require,module,exports){ -module.exports = function Colormap(options,UI) { - - var output; - - // This function is called on every draw. - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - var combined = (r + g + b) / 3.000; - var res = require('./Colormap')(combined, options); - return [res[0], res[1], res[2], 255]; - } - - function output(image,datauri,mimetype){ - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Colormap(options,UI) { + + var output; + + // This function is called on every draw. + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + var combined = (r + g + b) / 3.000; + var res = require('./Colormap')(combined, options); + return [res[0], res[1], res[2], 255]; + } + + function output(image,datauri,mimetype){ + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249,"./Colormap":180}],182:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":181,"./info.json":183,"dup":162}],183:[function(require,module,exports){ -module.exports={ - "name": "Colormap", - "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.", - "inputs": { - "colormap": { - "type": "select", - "desc": "Name of the Colormap", - "default": "default", - "values": ["default","greyscale","bluwhtgrngis","stretched","fastie","brntogrn","blutoredjet","colors16"] - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Colormap", + "description": "Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.", + "inputs": { + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": ["default","greyscale","bluwhtgrngis","stretched","fastie","brntogrn","blutoredjet","colors16"] + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],184:[function(require,module,exports){ -var _ = require('lodash'); -module.exports = exports = function(pixels , contrast){ - let oldpix = _.cloneDeep(pixels); - contrast = Number(contrast) - if (contrast < -100) contrast = -100; - if (contrast > 100) contrast = 100; - contrast = (100.0 + contrast) / 100.0; - contrast *= contrast; - - for (let i = 0; i < oldpix.shape[0]; i++) { - for (let j = 0; j < oldpix.shape[1]; j++) { - var r = oldpix.get(i,j,0)/255.0; - r -= 0.5; - r *= contrast; - r += 0.5; - r *= 255; - if (r < 0) r = 0; - if (r > 255) r = 255; - - - var g = oldpix.get(i,j,1)/255.0; - g -= 0.5; - g *= contrast; - g += 0.5; - g *= 255; - if (g < 0) g = 0; - if (g > 255) g = 255; - - - - var b = oldpix.get(i,j,2)/255.0; - b -= 0.5; - b *= contrast; - b += 0.5; - b *= 255; - if (b < 0) b = 0; - if (b > 255) b = 255; - - - pixels.set(i, j, 0, r); - pixels.set(i, j, 1, g); - pixels.set(i, j, 2, b); - - } - } - return pixels; +var _ = require('lodash'); +module.exports = exports = function(pixels , contrast){ + let oldpix = _.cloneDeep(pixels); + contrast = Number(contrast) + if (contrast < -100) contrast = -100; + if (contrast > 100) contrast = 100; + contrast = (100.0 + contrast) / 100.0; + contrast *= contrast; + + for (let i = 0; i < oldpix.shape[0]; i++) { + for (let j = 0; j < oldpix.shape[1]; j++) { + var r = oldpix.get(i,j,0)/255.0; + r -= 0.5; + r *= contrast; + r += 0.5; + r *= 255; + if (r < 0) r = 0; + if (r > 255) r = 255; + + + var g = oldpix.get(i,j,1)/255.0; + g -= 0.5; + g *= contrast; + g += 0.5; + g *= 255; + if (g < 0) g = 0; + if (g > 255) g = 255; + + + + var b = oldpix.get(i,j,2)/255.0; + b -= 0.5; + b *= contrast; + b += 0.5; + b *= 255; + if (b < 0) b = 0; + if (b > 255) b = 255; + + + pixels.set(i, j, 0, r); + pixels.set(i, j, 1, g); + pixels.set(i, j, 2, b); + + } + } + return pixels; } },{"lodash":75}],185:[function(require,module,exports){ -// /* -// * Changes the Image Contrast -// */ - -module.exports = function Contrast(options, UI) { - - options.contrast = options.contrast || 70 - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - return [r, g, b, a] - } - - function extraManipulation(pixels) { - pixels = require('./Contrast')(pixels, options.contrast) - return pixels - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +// /* +// * Changes the Image Contrast +// */ + +module.exports = function Contrast(options, UI) { + + options.contrast = options.contrast || 70 + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + return [r, g, b, a] + } + + function extraManipulation(pixels) { + pixels = require('./Contrast')(pixels, options.contrast) + return pixels + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} + +},{"../_nomodule/PixelManipulation.js":249,"./Contrast":184}],186:[function(require,module,exports){ +arguments[4][162][0].apply(exports,arguments) +},{"./Module":185,"./info.json":187,"dup":162}],187:[function(require,module,exports){ +module.exports={ + "name": "Contrast", + "description": "Change the contrast of the image by given value", + "inputs": { + "contrast": { + "type": "range", + "desc": "contrast for the new image, typically -100 to 100", + "default": "70", + "min": "-100", + "max": "100", + "step": "1" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} + +},{}],188:[function(require,module,exports){ +var _ = require('lodash'); +module.exports = exports = function(pixels, constantFactor, kernelValues){ + let kernel = kernelGenerator(constantFactor, kernelValues), oldpix = _.cloneDeep(pixels); + kernel = flipKernel(kernel); + + for (let i = 0; i < pixels.shape[0]; i++) { + for (let j = 0; j < pixels.shape[1]; j++) { + let neighboutPos = getNeighbouringPixelPositions([i, j]); + let acc = [0.0, 0.0, 0.0, 0.0]; + for (let a = 0; a < kernel.length; a++) { + for (let b = 0; b < kernel.length; b++) { + acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); + acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); + acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); + acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); + } + } + acc[0] = acc[0]%255; + acc[1] = acc[1]%255; + acc[2] = acc[2]%255; + pixels.set(i, j, 0, acc[0]); + pixels.set(i, j, 1, acc[1]); + pixels.set(i, j, 2, acc[2]); + } + } + return pixels; + + + function kernelGenerator(constantFactor, kernelValues){ + kernelValues = kernelValues.split(" "); + for(i = 0 ; i < 9; i++){ + kernelValues[i] = Number(kernelValues[i]) * constantFactor; + } + let k = 0; + let arr = []; + for(i = 0; i < 3; i++){ + let columns = []; + for(j = 0; j < 3; j++){ + columns.push(kernelValues[k]); + k += 1; + } + arr.push(columns); + } + return arr; + } + + function getNeighbouringPixelPositions(pixelPosition) { + let x = pixelPosition[0], y = pixelPosition[1], result = []; + + for (let i = -1; i <= 1; i++) { + let arr = []; + for (let j = -1; j <= 1; j++) + arr.push([x + i, y + j]); + + result.push(arr); + } + return result; + } + + function flipKernel(kernel) { + let result = []; + for (let i = kernel.length - 1; i >= 0; i--) { + let arr = []; + for (let j = kernel[i].length - 1; j >= 0; j--) { + arr.push(kernel[i][j]); + } + result.push(arr); + } + return result; + } +} +},{"lodash":75}],189:[function(require,module,exports){ +module.exports = function Convolution(options, UI) { + + options.kernelValues = options.kernelValues || '1 1 1 1 1 1 1 1 1'; + options.constantFactor = options.constantFactor || 1/9; + var output; + + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; -},{"../_nomodule/PixelManipulation.js":249,"./Contrast":184}],186:[function(require,module,exports){ -arguments[4][162][0].apply(exports,arguments) -},{"./Module":185,"./info.json":187,"dup":162}],187:[function(require,module,exports){ -module.exports={ - "name": "Contrast", - "description": "Change the contrast of the image by given value", - "inputs": { - "contrast": { - "type": "range", - "desc": "contrast for the new image, typically -100 to 100", - "default": "70", - "min": "-100", - "max": "100", - "step": "1" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} + function changePixel(r, g, b, a) { + return [r, g, b, a] + } -},{}],188:[function(require,module,exports){ -var _ = require('lodash'); -module.exports = exports = function(pixels, constantFactor, kernelValues){ - let kernel = kernelGenerator(constantFactor, kernelValues), oldpix = _.cloneDeep(pixels); - kernel = flipKernel(kernel); - - for (let i = 0; i < pixels.shape[0]; i++) { - for (let j = 0; j < pixels.shape[1]; j++) { - let neighboutPos = getNeighbouringPixelPositions([i, j]); - let acc = [0.0, 0.0, 0.0, 0.0]; - for (let a = 0; a < kernel.length; a++) { - for (let b = 0; b < kernel.length; b++) { - acc[0] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 0) * kernel[a][b]); - acc[1] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 1) * kernel[a][b]); - acc[2] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 2) * kernel[a][b]); - acc[3] += (oldpix.get(neighboutPos[a][b][0], neighboutPos[a][b][1], 3) * kernel[a][b]); - } - } - acc[0] = acc[0]%255; - acc[1] = acc[1]%255; - acc[2] = acc[2]%255; - pixels.set(i, j, 0, acc[0]); - pixels.set(i, j, 1, acc[1]); - pixels.set(i, j, 2, acc[2]); - } - } - return pixels; - - - function kernelGenerator(constantFactor, kernelValues){ - kernelValues = kernelValues.split(" "); - for(i = 0 ; i < 9; i++){ - kernelValues[i] = Number(kernelValues[i]) * constantFactor; - } - let k = 0; - let arr = []; - for(i = 0; i < 3; i++){ - let columns = []; - for(j = 0; j < 3; j++){ - columns.push(kernelValues[k]); - k += 1; - } - arr.push(columns); - } - return arr; - } - - function getNeighbouringPixelPositions(pixelPosition) { - let x = pixelPosition[0], y = pixelPosition[1], result = []; - - for (let i = -1; i <= 1; i++) { - let arr = []; - for (let j = -1; j <= 1; j++) - arr.push([x + i, y + j]); - - result.push(arr); - } - return result; - } - - function flipKernel(kernel) { - let result = []; - for (let i = kernel.length - 1; i >= 0; i--) { - let arr = []; - for (let j = kernel[i].length - 1; j >= 0; j--) { - arr.push(kernel[i][j]); - } - result.push(arr); - } - return result; - } + function extraManipulation(pixels) { + pixels = require('./Convolution')(pixels, options.constantFactor, options.kernelValues) + return pixels + } + + function output(image, datauri, mimetype) { + + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } } -},{"lodash":75}],189:[function(require,module,exports){ -module.exports = function Convolution(options, UI) { - - options.kernelValues = options.kernelValues || '1 1 1 1 1 1 1 1 1'; - options.constantFactor = options.constantFactor || 1/9; - var output; - - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - return [r, g, b, a] - } - - function extraManipulation(pixels) { - pixels = require('./Convolution')(pixels, options.constantFactor, options.kernelValues) - return pixels - } - - function output(image, datauri, mimetype) { - - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} },{"../_nomodule/PixelManipulation.js":249,"./Convolution":188}],190:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":189,"./info.json":191,"dup":162}],191:[function(require,module,exports){ -module.exports={ - "name": "Convolution", - "description": "Image Convolution using a given 3x3 kernel matrix Read more", - "inputs": { - "constantFactor":{ - "type": "Float", - "desc": "a constant factor, multiplies all the kernel values by that factor", - "default": 0.1111, - "placeholder": 0.1111 - }, - - "kernelValues": { - "type": "String", - "desc": "nine space separated numbers representing the kernel values in left to right and top to bottom format.", - "default": "1 1 1 1 1 1 1 1 1", - "placeholder": "1 1 1 1 1 1 1 1 1" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Convolution", + "description": "Image Convolution using a given 3x3 kernel matrix Read more", + "inputs": { + "constantFactor":{ + "type": "Float", + "desc": "a constant factor, multiplies all the kernel values by that factor", + "default": 0.1111, + "placeholder": 0.1111 + }, + + "kernelValues": { + "type": "String", + "desc": "nine space separated numbers representing the kernel values in left to right and top to bottom format.", + "default": "1 1 1 1 1 1 1 1 1", + "placeholder": "1 1 1 1 1 1 1 1 1" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],192:[function(require,module,exports){ (function (Buffer){ -module.exports = function Crop(input,options,callback) { - - var getPixels = require('get-pixels'), - savePixels = require('save-pixels'); - - options.x = parseInt(options.x) || 0; - options.y = parseInt(options.y) || 0; - - getPixels(input.src,function(err,pixels){ - options.w = parseInt(options.w) || Math.floor(pixels.shape[0]); - options.h = parseInt(options.h) || Math.floor(pixels.shape[1]); - options.backgroundColor = options.backgroundColor || '255 255 255 255'; - var ox = options.x; - var oy = options.y; - var w = options.w; - var h = options.h; - var iw = pixels.shape[0]; //Width of Original Image - var ih = pixels.shape[1]; //Height of Original Image - var backgroundArray = []; - backgroundColor = options.backgroundColor.split(" "); - for(var i = 0; i < w ; i++){ - backgroundArray = backgroundArray.concat([backgroundColor[0],backgroundColor[1],backgroundColor[2],backgroundColor[3]]); - } - var newarray = new Uint8Array(4*w*h); - for (var n = oy; n < oy + h; n++) { - if(nInfragrammar.", - "inputs": { - "red": { - "type": "input", - "desc": "Expression to return for red channel with R, G, B, and A inputs", - "default": "r" - }, - "green": { - "type": "input", - "desc": "Expression to return for green channel with R, G, B, and A inputs", - "default": "g" - }, - "blue": { - "type": "input", - "desc": "Expression to return for blue channel with R, G, B, and A inputs", - "default": "b" - }, - "monochrome (fallback)": { - "type": "input", - "desc": "Expression to return with R, G, B, and A inputs; fallback for other channels if none provided", - "default": "r + g + b" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Dynamic", + "description": "A module which accepts JavaScript math expressions to produce each color channel based on the original image's color. See Infragrammar.", + "inputs": { + "red": { + "type": "input", + "desc": "Expression to return for red channel with R, G, B, and A inputs", + "default": "r" + }, + "green": { + "type": "input", + "desc": "Expression to return for green channel with R, G, B, and A inputs", + "default": "g" + }, + "blue": { + "type": "input", + "desc": "Expression to return for blue channel with R, G, B, and A inputs", + "default": "b" + }, + "monochrome (fallback)": { + "type": "input", + "desc": "Expression to return with R, G, B, and A inputs; fallback for other channels if none provided", + "default": "r + g + b" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],207:[function(require,module,exports){ -const _ = require('lodash') - -//define kernels for the sobel filter -const kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], - kernely = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]; - -module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, inBrowser) { - let angles = [], mags = [], strongEdgePixels = [], weakEdgePixels = [], notInUI = !inBrowser; - for (var x = 0; x < pixels.shape[0]; x++) { - angles.push([]); - mags.push([]); - for (var y = 0; y < pixels.shape[1]; y++) { - var result = changePixel( - pixels, - pixels.get(x, y, 0), - pixels.get(x, y, 3), - x, - y - ); - let pixel = result.pixel; - - pixels.set(x, y, 0, pixel[0]); - pixels.set(x, y, 1, pixel[1]); - pixels.set(x, y, 2, pixel[2]); - pixels.set(x, y, 3, pixel[3]); - - mags.slice(-1)[0].push(pixel[3]); - angles.slice(-1)[0].push(result.angle); - } - } - nonMaxSupress(pixels, mags, angles); - doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio, mags, strongEdgePixels, weakEdgePixels); - return pixels; -} - -//changepixel function that convolutes every pixel (sobel filter) -function changePixel(pixels, val, a, x, y) { - let magX = 0.0; - for (let a = 0; a < 3; a++) { - for (let b = 0; b < 3; b++) { - - let xn = x + a - 1; - let yn = y + b - 1; - - magX += pixels.get(xn, yn, 0) * kernelx[a][b]; - } - } - let magY = 0.0; - for (let a = 0; a < 3; a++) { - for (let b = 0; b < 3; b++) { - - let xn = x + a - 1; - let yn = y + b - 1; - - magY += pixels.get(xn, yn, 0) * kernely[a][b]; - } - } - let mag = Math.sqrt(Math.pow(magX, 2) + Math.pow(magY, 2)); - let angle = Math.atan2(magY, magX); - return { - pixel: - [val, val, val, mag], - angle: angle - }; -} - -//Non Maximum Supression without interpolation -function nonMaxSupress(pixels, mags, angles) { - - angles = angles.map((arr) => arr.map(convertToDegrees)); - - for (let i = 1; i < pixels.shape[0] - 1; i++) { - for (let j = 1; j < pixels.shape[1] - 1; j++) { - - let angle = angles[i][j]; - let pixel = pixels.get(i, j); - - if ((angle >= -22.5 && angle <= 22.5) || - (angle < -157.5 && angle >= -180)) - - if ((mags[i][j] >= mags[i][j + 1]) && - (mags[i][j] >= mags[i][j - 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 22.5 && angle <= 67.5) || - (angle < -112.5 && angle >= -157.5)) - - if ((mags[i][j] >= mags[i + 1][j + 1]) && - (mags[i][j] >= mags[i - 1][j - 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 67.5 && angle <= 112.5) || - (angle < -67.5 && angle >= -112.5)) - - if ((mags[i][i] >= mags[i + 1][j]) && - (mags[i][j] >= mags[i][j])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - else if ((angle >= 112.5 && angle <= 157.5) || - (angle < -22.5 && angle >= -67.5)) - - if ((mags[i][j] >= mags[i + 1][j - 1]) && - (mags[i][j] >= mags[i - 1][j + 1])) - pixels.set(i, j, 3, mags[i][j]); - else - pixels.set(i, j, 3, 0); - - } - } -} -//Converts radians to degrees -var convertToDegrees = radians => (radians * 180) / Math.PI; - -//Finds the max value in a 2d array like mags -var findMaxInMatrix = arr => Math.max(...arr.map(el => el.map(val => !!val ? val : 0)).map(el => Math.max(...el))); - -//Applies the double threshold to the image -function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio, mags, strongEdgePixels, weakEdgePixels) { - - const highThreshold = findMaxInMatrix(mags) * highThresholdRatio; - const lowThreshold = highThreshold * lowThresholdRatio; - - for (let i = 0; i < pixels.shape[0]; i++) { - for (let j = 0; j < pixels.shape[1]; j++) { - let pixelPos = [i, j]; - - mags[i][j] > lowThreshold - ? mags[i][j] > highThreshold - ? strongEdgePixels.push(pixelPos) - : weakEdgePixels.push(pixelPos) - : pixels.set(i, j, 3, 0); - } - } - - strongEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 255)); -} - -// hysteresis edge tracking algorithm -- not working as of now -/* function hysteresis(pixels) { - function getNeighbouringPixelPositions(pixelPosition) { - let x = pixelPosition[0], y = pixelPosition[1] - return [[x + 1, y + 1], - [x + 1, y], - [x + 1, y - 1], - [x, y + 1], - [x, y - 1], - [x - 1, y + 1], - [x - 1, y], - [x - 1, y - 1]] - } - - //This can potentially be improved see https://en.wikipedia.org/wiki/Connected-component_labeling - for (weakPixel in weakEdgePixels) { - let neighbourPixels = getNeighbouringPixelPositions(weakEdgePixels[weakPixel]) - for (pixel in neighbourPixels) { - if (strongEdgePixels.find(el => _.isEqual(el, neighbourPixels[pixel]))) { - pixels.set(weakPixel[0], weakPixel[1], 3, 255) - weakEdgePixels.splice(weakPixel, weakPixel) - break - } - } - } - weakEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 0)) - return pixels -} */ - - - +const _ = require('lodash') + +//define kernels for the sobel filter +const kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], + kernely = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]; + +module.exports = function(pixels, highThresholdRatio, lowThresholdRatio, inBrowser) { + let angles = [], mags = [], strongEdgePixels = [], weakEdgePixels = [], notInUI = !inBrowser; + for (var x = 0; x < pixels.shape[0]; x++) { + angles.push([]); + mags.push([]); + for (var y = 0; y < pixels.shape[1]; y++) { + var result = changePixel( + pixels, + pixels.get(x, y, 0), + pixels.get(x, y, 3), + x, + y + ); + let pixel = result.pixel; + + pixels.set(x, y, 0, pixel[0]); + pixels.set(x, y, 1, pixel[1]); + pixels.set(x, y, 2, pixel[2]); + pixels.set(x, y, 3, pixel[3]); + + mags.slice(-1)[0].push(pixel[3]); + angles.slice(-1)[0].push(result.angle); + } + } + nonMaxSupress(pixels, mags, angles); + doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio, mags, strongEdgePixels, weakEdgePixels); + return pixels; +} + +//changepixel function that convolutes every pixel (sobel filter) +function changePixel(pixels, val, a, x, y) { + let magX = 0.0; + for (let a = 0; a < 3; a++) { + for (let b = 0; b < 3; b++) { + + let xn = x + a - 1; + let yn = y + b - 1; + + magX += pixels.get(xn, yn, 0) * kernelx[a][b]; + } + } + let magY = 0.0; + for (let a = 0; a < 3; a++) { + for (let b = 0; b < 3; b++) { + + let xn = x + a - 1; + let yn = y + b - 1; + + magY += pixels.get(xn, yn, 0) * kernely[a][b]; + } + } + let mag = Math.sqrt(Math.pow(magX, 2) + Math.pow(magY, 2)); + let angle = Math.atan2(magY, magX); + return { + pixel: + [val, val, val, mag], + angle: angle + }; +} + +//Non Maximum Supression without interpolation +function nonMaxSupress(pixels, mags, angles) { + + angles = angles.map((arr) => arr.map(convertToDegrees)); + + for (let i = 1; i < pixels.shape[0] - 1; i++) { + for (let j = 1; j < pixels.shape[1] - 1; j++) { + + let angle = angles[i][j]; + let pixel = pixels.get(i, j); + + if ((angle >= -22.5 && angle <= 22.5) || + (angle < -157.5 && angle >= -180)) + + if ((mags[i][j] >= mags[i][j + 1]) && + (mags[i][j] >= mags[i][j - 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 22.5 && angle <= 67.5) || + (angle < -112.5 && angle >= -157.5)) + + if ((mags[i][j] >= mags[i + 1][j + 1]) && + (mags[i][j] >= mags[i - 1][j - 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 67.5 && angle <= 112.5) || + (angle < -67.5 && angle >= -112.5)) + + if ((mags[i][i] >= mags[i + 1][j]) && + (mags[i][j] >= mags[i][j])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + else if ((angle >= 112.5 && angle <= 157.5) || + (angle < -22.5 && angle >= -67.5)) + + if ((mags[i][j] >= mags[i + 1][j - 1]) && + (mags[i][j] >= mags[i - 1][j + 1])) + pixels.set(i, j, 3, mags[i][j]); + else + pixels.set(i, j, 3, 0); + + } + } +} +//Converts radians to degrees +var convertToDegrees = radians => (radians * 180) / Math.PI; + +//Finds the max value in a 2d array like mags +var findMaxInMatrix = arr => Math.max(...arr.map(el => el.map(val => !!val ? val : 0)).map(el => Math.max(...el))); + +//Applies the double threshold to the image +function doubleThreshold(pixels, highThresholdRatio, lowThresholdRatio, mags, strongEdgePixels, weakEdgePixels) { + + const highThreshold = findMaxInMatrix(mags) * highThresholdRatio; + const lowThreshold = highThreshold * lowThresholdRatio; + + for (let i = 0; i < pixels.shape[0]; i++) { + for (let j = 0; j < pixels.shape[1]; j++) { + let pixelPos = [i, j]; + + mags[i][j] > lowThreshold + ? mags[i][j] > highThreshold + ? strongEdgePixels.push(pixelPos) + : weakEdgePixels.push(pixelPos) + : pixels.set(i, j, 3, 0); + } + } + + strongEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 255)); +} + +// hysteresis edge tracking algorithm -- not working as of now +/* function hysteresis(pixels) { + function getNeighbouringPixelPositions(pixelPosition) { + let x = pixelPosition[0], y = pixelPosition[1] + return [[x + 1, y + 1], + [x + 1, y], + [x + 1, y - 1], + [x, y + 1], + [x, y - 1], + [x - 1, y + 1], + [x - 1, y], + [x - 1, y - 1]] + } + + //This can potentially be improved see https://en.wikipedia.org/wiki/Connected-component_labeling + for (weakPixel in weakEdgePixels) { + let neighbourPixels = getNeighbouringPixelPositions(weakEdgePixels[weakPixel]) + for (pixel in neighbourPixels) { + if (strongEdgePixels.find(el => _.isEqual(el, neighbourPixels[pixel]))) { + pixels.set(weakPixel[0], weakPixel[1], 3, 255) + weakEdgePixels.splice(weakPixel, weakPixel) + break + } + } + } + weakEdgePixels.forEach(pix => pixels.set(pix[0], pix[1], 3, 0)) + return pixels +} */ + + + + +},{"lodash":75}],208:[function(require,module,exports){ +/* +* Detect Edges in an Image +*/ +module.exports = function edgeDetect(options, UI) { + + options.blur = options.blur || 2; + options.highThresholdRatio = options.highThresholdRatio || 0.2; + options.lowThresholdRatio = options.lowThresholdRatio || 0.15; + + var output; + + // The function which is called on every draw. + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + + // Extra Manipulation function used as an enveloper for applying gaussian blur and Convolution + function extraManipulation(pixels) { + pixels = require('ndarray-gaussian-filter')(pixels, options.blur); + pixels = require('./EdgeUtils')(pixels, options.highThresholdRatio, options.lowThresholdRatio, options.inBrowser); + return pixels; + } + + function changePixel(r, g, b, a) { + return [(r + g + b) / 3, (r + g + b) / 3, (r + g + b) / 3, a]; + } -},{"lodash":75}],208:[function(require,module,exports){ -/* -* Detect Edges in an Image -*/ -module.exports = function edgeDetect(options, UI) { - - options.blur = options.blur || 2; - options.highThresholdRatio = options.highThresholdRatio || 0.2; - options.lowThresholdRatio = options.lowThresholdRatio || 0.15; - - var output; - - // The function which is called on every draw. - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - - // Extra Manipulation function used as an enveloper for applying gaussian blur and Convolution - function extraManipulation(pixels) { - pixels = require('ndarray-gaussian-filter')(pixels, options.blur); - pixels = require('./EdgeUtils')(pixels, options.highThresholdRatio, options.lowThresholdRatio, options.inBrowser); - return pixels; - } - - function changePixel(r, g, b, a) { - return [(r + g + b) / 3, (r + g + b) / 3, (r + g + b) / 3, a]; - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249,"./EdgeUtils":207,"ndarray-gaussian-filter":80}],209:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":208,"./info.json":210,"dup":162}],210:[function(require,module,exports){ -module.exports={ - "name": "Detect Edges", - "description": "This module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more. ", - "inputs": { - "blur": { - "type": "range", - "desc": "Amount of gaussian blur(Less blur gives more detail, typically 0-5)", - "default": "2", - "min": "0", - "max": "5", - "step": "0.25" - }, - "highThresholdRatio":{ - "type": "float", - "desc": "The high threshold ratio for the image", - "default": 0.2 - }, - "lowThresholdRatio": { - "type": "float", - "desc": "The low threshold value for the image", - "default": 0.15 - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Detect Edges", + "description": "This module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more. ", + "inputs": { + "blur": { + "type": "range", + "desc": "Amount of gaussian blur(Less blur gives more detail, typically 0-5)", + "default": "2", + "min": "0", + "max": "5", + "step": "0.25" + }, + "highThresholdRatio":{ + "type": "float", + "desc": "The high threshold ratio for the image", + "default": 0.2 + }, + "lowThresholdRatio": { + "type": "float", + "desc": "The low threshold value for the image", + "default": 0.15 + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],211:[function(require,module,exports){ -/* - * Resolves Fisheye Effect - */ -module.exports = function DoNothing(options,UI) { - - var output; - - require('fisheyegl'); - - function draw(input,callback) { - - var step = this; - - if (!options.inBrowser) { // This module is only for browser - this.output = input; - callback(); - } - else { - // Create a canvas, if it doesn't already exist. - if (!document.querySelector('#image-sequencer-canvas')) { - var canvas = document.createElement('canvas'); - canvas.style.display = "none"; - canvas.setAttribute('id','image-sequencer-canvas'); - document.body.append(canvas); - } - else var canvas = document.querySelector('#image-sequencer-canvas'); - - distorter = FisheyeGl({ - selector: "#image-sequencer-canvas" - }); - - // Parse the inputs - options.a = parseFloat(options.a) || distorter.lens.a; - options.b = parseFloat(options.b) || distorter.lens.b; - options.Fx = parseFloat(options.Fx) || distorter.lens.Fx; - options.Fy = parseFloat(options.Fy) || distorter.lens.Fy; - options.scale = parseFloat(options.scale) || distorter.lens.scale; - options.x = parseFloat(options.x) || distorter.fov.x; - options.y = parseFloat(options.y) || distorter.fov.y; - - // Set fisheyegl inputs - distorter.lens.a = options.a; - distorter.lens.b = options.b; - distorter.lens.Fx = options.Fx; - distorter.lens.Fy = options.Fy; - distorter.lens.scale = options.scale; - distorter.fov.x = options.x; - distorter.fov.y = options.y; - - // generate fisheyegl output - distorter.setImage(input.src,function(){ - - // this output is accessible to Image Sequencer - step.output = {src: canvas.toDataURL(), format: input.format}; - - // Tell Image Sequencer and UI that step has been drawn - callback(); - - }); - - } - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Resolves Fisheye Effect + */ +module.exports = function DoNothing(options,UI) { + + var output; + + require('fisheyegl'); + + function draw(input,callback) { + + var step = this; + + if (!options.inBrowser) { // This module is only for browser + this.output = input; + callback(); + } + else { + // Create a canvas, if it doesn't already exist. + if (!document.querySelector('#image-sequencer-canvas')) { + var canvas = document.createElement('canvas'); + canvas.style.display = "none"; + canvas.setAttribute('id','image-sequencer-canvas'); + document.body.append(canvas); + } + else var canvas = document.querySelector('#image-sequencer-canvas'); + + distorter = FisheyeGl({ + selector: "#image-sequencer-canvas" + }); + + // Parse the inputs + options.a = parseFloat(options.a) || distorter.lens.a; + options.b = parseFloat(options.b) || distorter.lens.b; + options.Fx = parseFloat(options.Fx) || distorter.lens.Fx; + options.Fy = parseFloat(options.Fy) || distorter.lens.Fy; + options.scale = parseFloat(options.scale) || distorter.lens.scale; + options.x = parseFloat(options.x) || distorter.fov.x; + options.y = parseFloat(options.y) || distorter.fov.y; + + // Set fisheyegl inputs + distorter.lens.a = options.a; + distorter.lens.b = options.b; + distorter.lens.Fx = options.Fx; + distorter.lens.Fy = options.Fy; + distorter.lens.scale = options.scale; + distorter.fov.x = options.x; + distorter.fov.y = options.y; + + // generate fisheyegl output + distorter.setImage(input.src,function(){ + + // this output is accessible to Image Sequencer + step.output = {src: canvas.toDataURL(), format: input.format}; + + // Tell Image Sequencer and UI that step has been drawn + callback(); + + }); + + } + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"fisheyegl":21}],212:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":211,"./info.json":213,"dup":162}],213:[function(require,module,exports){ -module.exports={ - "name": "Fisheye GL", - "description": "Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).", - "requires": [ "webgl" ], - "inputs": { - "a": { - "type": "float", - "desc": "a parameter", - "default": 1, - "min": 1, - "max": 4 - }, - "b": { - "type": "float", - "desc": "b parameter", - "default": 1, - "min": 1, - "max": 4 - }, - "Fx": { - "type": "float", - "desc": "Fx parameter", - "default": 0, - "min": 0, - "max": 4 - }, - "Fy": { - "type": "float", - "desc": "Fy parameter", - "default": 0, - "min": 0, - "max": 4 - }, - "scale": { - "type": "float", - "desc": "Image Scaling", - "default": 1.5, - "min": 0, - "max": 20 - }, - "x": { - "type": "float", - "desc": "FOV x parameter", - "default": 1.5, - "min": 0, - "max": 20 - }, - "y": { - "type": "float", - "desc": "FOV y parameter", - "default": 1.5, - "min": 0, - "max": 20 - }, - "fragmentSrc": { - "type": "PATH", - "desc": "Path to a WebGL fragment shader file", - "default": "(inbuilt)" - }, - "vertexSrc": { - "type": "PATH", - "desc": "Path to a WebGL vertex shader file", - "default": "(inbuilt)" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Fisheye GL", + "description": "Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).", + "requires": [ "webgl" ], + "inputs": { + "a": { + "type": "float", + "desc": "a parameter", + "default": 1, + "min": 1, + "max": 4 + }, + "b": { + "type": "float", + "desc": "b parameter", + "default": 1, + "min": 1, + "max": 4 + }, + "Fx": { + "type": "float", + "desc": "Fx parameter", + "default": 0, + "min": 0, + "max": 4 + }, + "Fy": { + "type": "float", + "desc": "Fy parameter", + "default": 0, + "min": 0, + "max": 4 + }, + "scale": { + "type": "float", + "desc": "Image Scaling", + "default": 1.5, + "min": 0, + "max": 20 + }, + "x": { + "type": "float", + "desc": "FOV x parameter", + "default": 1.5, + "min": 0, + "max": 20 + }, + "y": { + "type": "float", + "desc": "FOV y parameter", + "default": 1.5, + "min": 0, + "max": 20 + }, + "fragmentSrc": { + "type": "PATH", + "desc": "Path to a WebGL fragment shader file", + "default": "(inbuilt)" + }, + "vertexSrc": { + "type": "PATH", + "desc": "Path to a WebGL vertex shader file", + "default": "(inbuilt)" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],214:[function(require,module,exports){ -module.exports = function Gamma(options,UI){ - - var output; - - function draw(input,callback,progressObj){ - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a){ - var val = options.adjustment || 0.2; - - r = Math.pow(r / 255, val) * 255; - g = Math.pow(g / 255, val) * 255; - b = Math.pow(b / 255, val) * 255; - - return [r , g, b, a]; - } - - function output(image,datauri,mimetype){ - - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Gamma(options,UI){ + + var output; + + function draw(input,callback,progressObj){ + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a){ + var val = options.adjustment || 0.2; + + r = Math.pow(r / 255, val) * 255; + g = Math.pow(g / 255, val) * 255; + b = Math.pow(b / 255, val) * 255; + + return [r , g, b, a]; + } + + function output(image,datauri,mimetype){ + + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249}],215:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":214,"./info.json":216,"dup":162}],216:[function(require,module,exports){ -module.exports={ - "name": "Gamma Correction", - "description": "Apply gamma correction on the image Read more", - "inputs": { - "adjustment": { - "type": "float", - "desc": "gamma correction (inverse of actual gamma factor) for the new image", - "default": 0.2 - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Gamma Correction", + "description": "Apply gamma correction on the image Read more", + "inputs": { + "adjustment": { + "type": "float", + "desc": "gamma correction (inverse of actual gamma factor) for the new image", + "default": 0.2 + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],217:[function(require,module,exports){ (function (Buffer){ -module.exports = function Invert(options, UI) { - - var output; - - // The function which is called on every draw. - function draw(input, callback, progressObj) { - var getPixels = require('get-pixels'); - var savePixels = require('save-pixels'); - - var step = this; - - getPixels(input.src, function(err, pixels) { - - if (err) { - console.log("Bad Image path"); - return; - } - var width = 0; - - for (var i = 0; i < pixels.shape[0]; i++) width++; - - for (var i = 0; i < pixels.shape[0]; i++) { - for (var j = 0; j < pixels.shape[1]; j++) { - let val = (i / width) * 255; - pixels.set(i, j, 0, val); - pixels.set(i, j, 1, val); - pixels.set(i, j, 2, val); - pixels.set(i, j, 3, 255); - } - } - var chunks = []; - var totalLength = 0; - var r = savePixels(pixels, input.format, { quality: 100 }); - - r.on("data", function(chunk) { - totalLength += chunk.length; - chunks.push(chunk); - }); - - r.on("end", function() { - var data = Buffer.concat(chunks, totalLength).toString("base64"); - var datauri = "data:image/" + input.format + ";base64," + data; - output(input.image, datauri, input.format); - callback(); - }); - }); - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Invert(options, UI) { + + var output; + + // The function which is called on every draw. + function draw(input, callback, progressObj) { + var getPixels = require('get-pixels'); + var savePixels = require('save-pixels'); + + var step = this; + + getPixels(input.src, function(err, pixels) { + + if (err) { + console.log("Bad Image path"); + return; + } + var width = 0; + + for (var i = 0; i < pixels.shape[0]; i++) width++; + + for (var i = 0; i < pixels.shape[0]; i++) { + for (var j = 0; j < pixels.shape[1]; j++) { + let val = (i / width) * 255; + pixels.set(i, j, 0, val); + pixels.set(i, j, 1, val); + pixels.set(i, j, 2, val); + pixels.set(i, j, 3, 255); + } + } + var chunks = []; + var totalLength = 0; + var r = savePixels(pixels, input.format, { quality: 100 }); + + r.on("data", function(chunk) { + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on("end", function() { + var data = Buffer.concat(chunks, totalLength).toString("base64"); + var datauri = "data:image/" + input.format + ";base64," + data; + output(input.image, datauri, input.format); + callback(); + }); + }); + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} }).call(this,require("buffer").Buffer) },{"buffer":47,"get-pixels":29,"save-pixels":138}],218:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":217,"./info.json":219,"dup":162}],219:[function(require,module,exports){ -module.exports={ - "name": "Gradient", - "description": "Gives a gradient of the image", - "inputs": {}, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +module.exports={ + "name": "Gradient", + "description": "Gives a gradient of the image", + "inputs": {}, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" } },{}],220:[function(require,module,exports){ -/* - * Calculates the histogram of the image - */ -module.exports = function Channel(options, UI) { - - var output; - - function draw(input, callback, progressObj) { - - options.gradient = options.gradient || "true"; - options.gradient = JSON.parse(options.gradient); - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this, hist = new Array(256).fill(0); - - function changePixel(r, g, b, a) { - let pixVal = Math.round((r + g + b) / 3); - hist[pixVal]++; - return [r, g, b, a]; - } - - function extraManipulation(pixels) { - // if (!options.inBrowser) - // require('fs').writeFileSync('./output/histo.txt', hist.reduce((tot, cur, idx) => `${tot}\n${idx} : ${cur}`, ``)); - var newarray = new Uint8Array(4 * 256 * 256); - pixels.data = newarray; - pixels.shape = [256, 256, 4]; - pixels.stride[1] = 4 * 256; - - for (let x = 0; x < 256; x++) { - for (let y = 0; y < 256; y++) { - pixels.set(x, y, 0, 255); - pixels.set(x, y, 1, 255); - pixels.set(x, y, 2, 255); - pixels.set(x, y, 3, 255); - } - } - - let startY = options.gradient ? 10 : 0; - if (options.gradient) { - for (let x = 0; x < 256; x++) { - for (let y = 0; y < 10; y++) { - pixels.set(x, 255 - y, 0, x); - pixels.set(x, 255 - y, 1, x); - pixels.set(x, 255 - y, 2, x); - } - } - } - - let convfactor = (256 - startY) / Math.max(...hist); - - for (let x = 0; x < 256; x++) { - let pixCount = Math.round(convfactor * hist[x]); - - for (let y = startY; y < pixCount; y++) { - pixels.set(x, 255 - y, 0, 204); - pixels.set(x, 255 - y, 1, 255); - pixels.set(x, 255 - y, 2, 153); - } - } - - return pixels; - } - - function output(image, datauri, mimetype) { - - // This output is accesible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } -} +/* + * Calculates the histogram of the image + */ +module.exports = function Channel(options, UI) { + + var output; + + function draw(input, callback, progressObj) { + + options.gradient = options.gradient || "true"; + options.gradient = JSON.parse(options.gradient); + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this, hist = new Array(256).fill(0); + + function changePixel(r, g, b, a) { + let pixVal = Math.round((r + g + b) / 3); + hist[pixVal]++; + return [r, g, b, a]; + } + + function extraManipulation(pixels) { + // if (!options.inBrowser) + // require('fs').writeFileSync('./output/histo.txt', hist.reduce((tot, cur, idx) => `${tot}\n${idx} : ${cur}`, ``)); + var newarray = new Uint8Array(4 * 256 * 256); + pixels.data = newarray; + pixels.shape = [256, 256, 4]; + pixels.stride[1] = 4 * 256; + + for (let x = 0; x < 256; x++) { + for (let y = 0; y < 256; y++) { + pixels.set(x, y, 0, 255); + pixels.set(x, y, 1, 255); + pixels.set(x, y, 2, 255); + pixels.set(x, y, 3, 255); + } + } + + let startY = options.gradient ? 10 : 0; + if (options.gradient) { + for (let x = 0; x < 256; x++) { + for (let y = 0; y < 10; y++) { + pixels.set(x, 255 - y, 0, x); + pixels.set(x, 255 - y, 1, x); + pixels.set(x, 255 - y, 2, x); + } + } + } + + let convfactor = (256 - startY) / Math.max(...hist); + + for (let x = 0; x < 256; x++) { + let pixCount = Math.round(convfactor * hist[x]); + + for (let y = startY; y < pixCount; y++) { + pixels.set(x, 255 - y, 0, 204); + pixels.set(x, 255 - y, 1, 255); + pixels.set(x, 255 - y, 2, 153); + } + } + + return pixels; + } + + function output(image, datauri, mimetype) { + + // This output is accesible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249}],221:[function(require,module,exports){ -module.exports = [ - require('./Module.js'), - require('./info.json') +module.exports = [ + require('./Module.js'), + require('./info.json') ] },{"./Module.js":220,"./info.json":222}],222:[function(require,module,exports){ -module.exports={ - "name": "Histogram", - "description": "Calculates the histogram for the image", - "inputs": { - "gradient": { - "type": "select", - "desc": "Toggle the gradient along x-axis", - "default": "true", - "values": [ - "true", - "false" - ] - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +module.exports={ + "name": "Histogram", + "description": "Calculates the histogram for the image", + "inputs": { + "gradient": { + "type": "select", + "desc": "Toggle the gradient along x-axis", + "default": "true", + "values": [ + "true", + "false" + ] + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" } },{}],223:[function(require,module,exports){ -/* - * Import Image module; this fetches a given remote or local image via URL - * or data-url, and overwrites the current one. It saves the original as - * step.metadata.input for use in future modules such as blending. - * TODO: we could accept an operation for blending like "screen" or "overlay", - * or a function with blend(r1,g1,b1,a1,r2,g2,b2,a2), OR we could simply allow - * subsequent modules to do this blending and keep this one simple. - */ -module.exports = function ImportImageModule(options, UI) { - - options.imageUrl = options.url || "./images/monarch.png"; - - var output, - imgObj = new Image(); - - // we should get UI to return the image thumbnail so we can attach our own UI extensions - - // add our custom in-module html ui: - if (options.step.inBrowser) { - var ui = require('./Ui.js')(options.step, UI); - ui.setup(); - } - - // This function is caled everytime the step has to be redrawn - function draw(input,callback) { - - var step = this; - - step.metadata = step.metadata || {}; - // TODO: develop a standard API method for saving each input state, - // for reference in future steps (for blending, for example) - step.metadata.input = input; - - function onLoad() { - - // This output is accessible to Image Sequencer - step.output = { - src: imgObj.src, - format: options.format - } - - // Tell Image Sequencer that step has been drawn - callback(); - } - - options.format = require('../../util/GetFormat')(options.imageUrl); - imgObj.onload = onLoad; - imgObj.src = options.imageUrl; - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Import Image module; this fetches a given remote or local image via URL + * or data-url, and overwrites the current one. It saves the original as + * step.metadata.input for use in future modules such as blending. + * TODO: we could accept an operation for blending like "screen" or "overlay", + * or a function with blend(r1,g1,b1,a1,r2,g2,b2,a2), OR we could simply allow + * subsequent modules to do this blending and keep this one simple. + */ +module.exports = function ImportImageModule(options, UI) { + + options.imageUrl = options.url || "./images/monarch.png"; + + var output, + imgObj = new Image(); + + // we should get UI to return the image thumbnail so we can attach our own UI extensions + + // add our custom in-module html ui: + if (options.step.inBrowser) { + var ui = require('./Ui.js')(options.step, UI); + ui.setup(); + } + + // This function is caled everytime the step has to be redrawn + function draw(input,callback) { + + var step = this; + + step.metadata = step.metadata || {}; + // TODO: develop a standard API method for saving each input state, + // for reference in future steps (for blending, for example) + step.metadata.input = input; + + function onLoad() { + + // This output is accessible to Image Sequencer + step.output = { + src: imgObj.src, + format: options.format + } + + // Tell Image Sequencer that step has been drawn + callback(); + } + + options.format = require('../../util/GetFormat')(options.imageUrl); + imgObj.onload = onLoad; + imgObj.src = options.imageUrl; + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../../util/GetFormat":253,"./Ui.js":224}],224:[function(require,module,exports){ -// hide on save -module.exports = function ImportImageModuleUi(step, ui) { - - function setup(setImage, onLoad) { - - // generate a unique timestamp based id for the dropzone - var dropzoneId = 'dropzone-import-image-' + step.ID; - - // add a file input listener - var dropZone ='\ -
\ -

\ - Select or drag in an image to overlay.\ -

\ -
\ - \ -
\ -
'; - - // insert into .details area - // TODO: develop API-based consistent way to add UI elements - $(step.ui) - .find('.details') - .prepend(dropZone); - - // setup file input listener - sequencer.setInputStep({ - dropZoneSelector: "#" + dropzoneId, - fileInputSelector: "#" + dropzoneId + " .file-input", - onLoad: function onLoadFromInput(progress) { - var reader = progress.target; - step.options.imageUrl = reader.result; - step.options.url = reader.result; - sequencer.run(); - setUrlHashParameter("steps", sequencer.toString()); - } - }); - - $(step.ui) - .find('.btn-save').on('click', function onClickSave() { - - var src = $(step.ui) - .find('.det input').val(); - step.options.imageUrl = src; - sequencer.run(); - - }); - - } - - return { - setup: setup - } -} +// hide on save +module.exports = function ImportImageModuleUi(step, ui) { + + function setup(setImage, onLoad) { + + // generate a unique timestamp based id for the dropzone + var dropzoneId = 'dropzone-import-image-' + step.ID; + + // add a file input listener + var dropZone ='\ +
\ +

\ + Select or drag in an image to overlay.\ +

\ +
\ + \ +
\ +
'; + + // insert into .details area + // TODO: develop API-based consistent way to add UI elements + $(step.ui) + .find('.details') + .prepend(dropZone); + + // setup file input listener + sequencer.setInputStep({ + dropZoneSelector: "#" + dropzoneId, + fileInputSelector: "#" + dropzoneId + " .file-input", + onLoad: function onLoadFromInput(progress) { + var reader = progress.target; + step.options.imageUrl = reader.result; + step.options.url = reader.result; + sequencer.run(); + setUrlHashParameter("steps", sequencer.toString()); + } + }); + + $(step.ui) + .find('.btn-save').on('click', function onClickSave() { + + var src = $(step.ui) + .find('.det input').val(); + step.options.imageUrl = src; + sequencer.run(); + + }); + + } + + return { + setup: setup + } +} },{}],225:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":223,"./info.json":226,"dup":162}],226:[function(require,module,exports){ -module.exports={ - "name": "Import Image", - "description": "Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.", - "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", - "inputs": { - "url": { - "type": "string", - "desc": "URL of image to import", - "default": "./images/monarch.png" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +module.exports={ + "name": "Import Image", + "description": "Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.", + "url": "https://github.com/publiclab/image-sequencer/tree/master/MODULES.md", + "inputs": { + "url": { + "type": "string", + "desc": "URL of image to import", + "default": "./images/monarch.png" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" } },{}],227:[function(require,module,exports){ -/* - * Sample Meta Module for demonstration purpose only - */ -module.exports = function NdviColormapfunction() { - this.expandSteps([{ 'name': 'ndvi', 'options': {} }, { 'name': 'colormap', options: {} }]); - return { - isMeta: true - } +/* + * NDVI with red filter (blue channel is infrared) + */ +module.exports = function Ndvi(options, UI) { + + if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); + + options.filter = options.filter || "red"; + + var output; + + // The function which is called on every draw. + function draw(input, callback, progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + if (options.filter == "red") var ndvi = (b - r) / (1.00 * b + r); + if (options.filter == "blue") var ndvi = (r - b) / (1.00 * b + r); + var x = 255 * (ndvi + 1) / 2; + return [x, x, x, a]; + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + function modifiedCallback() { + if (options.step.inBrowser) { + ui.setup(); + } + callback(); + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: modifiedCallback + }); + + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } } -},{}],228:[function(require,module,exports){ -arguments[4][162][0].apply(exports,arguments) -},{"./Module":227,"./info.json":229,"dup":162}],229:[function(require,module,exports){ -module.exports={ - "name": "NDVI-Colormap", - "description": "Sequentially Applies NDVI and Colormap steps", - "inputs": {}, - "length": 2, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} -},{}],230:[function(require,module,exports){ -/* - * NDVI with red filter (blue channel is infrared) - */ -module.exports = function Ndvi(options, UI) { - - if (options.step.inBrowser) var ui = require('./Ui.js')(options.step, UI); - - options.filter = options.filter || "red"; - - var output; - - // The function which is called on every draw. - function draw(input, callback, progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - if (options.filter == "red") var ndvi = (b - r) / (1.00 * b + r); - if (options.filter == "blue") var ndvi = (r - b) / (1.00 * b + r); - var x = 255 * (ndvi + 1) / 2; - return [x, x, x, a]; - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - function modifiedCallback() { - if (options.step.inBrowser) { - ui.setup(); - } - callback(); - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: modifiedCallback - }); - - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} -},{"../_nomodule/PixelManipulation.js":249,"./Ui.js":231}],231:[function(require,module,exports){ -// hide on save -module.exports = function CropModuleUi(step, ui) { - - /* sets the pixel value under the mouse pointer - * on the title attribute of the image element. - */ - function setup() { - var ndviImage = $(imgEl()); - - ndviImage.mousemove(function ndviMousemove(e) { - - var canvas = document.createElement("canvas"); - canvas.width = ndviImage.width(); - canvas.height = ndviImage.height(); - canvas.getContext('2d').drawImage(this, 0, 0); - - var offset = $(this).offset(); - var xPos = e.pageX - offset.left; - var yPos = e.pageY - offset.top; - var ndvi = canvas.getContext('2d').getImageData(xPos, yPos, 1, 1).data[0]; - ndvi = ndvi/127.5 - 1 ; - ndvi = ndvi.toFixed(2); - ndviImage[0].title = "NDVI: " + ndvi; - }); - } - // step.imgSelector is not defined, imgElement is: - function imgEl() { - return step.imgElement; - } - - return { - setup: setup - } -} +},{"../_nomodule/PixelManipulation.js":249,"./Ui.js":228}],228:[function(require,module,exports){ +// hide on save +module.exports = function CropModuleUi(step, ui) { -},{}],232:[function(require,module,exports){ + /* sets the pixel value under the mouse pointer + * on the title attribute of the image element. + */ + function setup() { + var ndviImage = $(imgEl()); + + ndviImage.mousemove(function ndviMousemove(e) { + + var canvas = document.createElement("canvas"); + canvas.width = ndviImage.width(); + canvas.height = ndviImage.height(); + canvas.getContext('2d').drawImage(this, 0, 0); + + var offset = $(this).offset(); + var xPos = e.pageX - offset.left; + var yPos = e.pageY - offset.top; + var ndvi = canvas.getContext('2d').getImageData(xPos, yPos, 1, 1).data[0]; + ndvi = ndvi/127.5 - 1 ; + ndvi = ndvi.toFixed(2); + ndviImage[0].title = "NDVI: " + ndvi; + }); + } + // step.imgSelector is not defined, imgElement is: + function imgEl() { + return step.imgElement; + } + + return { + setup: setup + } +} + +},{}],229:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) -},{"./Module":230,"./info.json":233,"dup":162}],233:[function(require,module,exports){ -module.exports={ - "name": "NDVI", - "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters", - "inputs": { - "filter": { - "type": "select", - "desc": "Filter color", - "default": "red", - "values": ["red", "blue"] - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +},{"./Module":227,"./info.json":230,"dup":162}],230:[function(require,module,exports){ +module.exports={ + "name": "NDVI", + "description": "Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters", + "inputs": { + "filter": { + "type": "select", + "desc": "Filter color", + "default": "red", + "values": ["red", "blue"] + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} +},{}],231:[function(require,module,exports){ +/* + * Sample Meta Module for demonstration purpose only + */ +module.exports = function NdviColormapfunction() { + this.expandSteps([{ 'name': 'ndvi', 'options': {} }, { 'name': 'colormap', options: {} }]); + return { + isMeta: true + } +} +},{}],232:[function(require,module,exports){ +arguments[4][162][0].apply(exports,arguments) +},{"./Module":231,"./info.json":233,"dup":162}],233:[function(require,module,exports){ +module.exports={ + "name": "NDVI-Colormap", + "description": "Sequentially Applies NDVI and Colormap steps", + "inputs": {}, + "length": 2, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],234:[function(require,module,exports){ -module.exports = function Dynamic(options, UI, util) { - - options.x = options.x || 0; - options.y = options.y || 0; - - var output; - - // This function is called on every draw. - function draw(input, callback, progressObj) { - - options.offset = options.offset || -2; - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - var parseCoordInputs = require('../../util/ParseInputCoordinates'); - - //parse the inputs - parseCoordInputs.parseCornerCoordinateInputs(options, { - src: input.src, - x: { valInp: options.x, type: 'horizontal' }, - y: { valInp: options.y, type: 'vertical' }, - }, function (options, input) { - options.x = parseInt(input.x.valInp); - options.y = parseInt(input.y.valInp); - }); - - // save the pixels of the base image - var baseStepImage = this.getStep(options.offset).image; - var baseStepOutput = this.getOutput(options.offset); - - var getPixels = require('get-pixels'); - - getPixels(input.src, function (err, pixels) { - options.secondImagePixels = pixels; - - function changePixel(r1, g1, b1, a1, x, y) { - - // overlay - var p = options.secondImagePixels; - if (x >= options.x - && x < p.shape[0] - && y >= options.y - && y < p.shape[1]) - return [ - p.get(x, y, 0), - p.get(x, y, 1), - p.get(x, y, 2), - p.get(x, y, 3) - ]; - else - return [r1, g1, b1, a1]; - } - - function output(image, datauri, mimetype) { - - // This output is accessible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - - } - - // run PixelManipulation on first Image pixels - return require('../_nomodule/PixelManipulation.js')(baseStepOutput, { - output: output, - changePixel: changePixel, - format: baseStepOutput.format, - image: baseStepImage, - inBrowser: options.inBrowser, - callback: callback - }); - }); - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +module.exports = function Dynamic(options, UI, util) { + + options.x = options.x || 0; + options.y = options.y || 0; + + var output; + + // This function is called on every draw. + function draw(input, callback, progressObj) { + + options.offset = options.offset || -2; + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + var parseCornerCoordinateInputs = require('../../util/ParseInputCoordinates'); + + //parse the inputs + parseCornerCoordinateInputs(options, { + src: input.src, + x: { valInp: options.x, type: 'horizontal' }, + y: { valInp: options.y, type: 'vertical' }, + }, function (options, input) { + options.x = parseInt(input.x.valInp); + options.y = parseInt(input.y.valInp); + }); + + // save the pixels of the base image + var baseStepImage = this.getStep(options.offset).image; + var baseStepOutput = this.getOutput(options.offset); + + var getPixels = require('get-pixels'); + + getPixels(input.src, function (err, pixels) { + options.secondImagePixels = pixels; + + function changePixel(r1, g1, b1, a1, x, y) { + + // overlay + var p = options.secondImagePixels; + if (x >= options.x + && x < p.shape[0] + && y >= options.y + && y < p.shape[1]) + return [ + p.get(x, y, 0), + p.get(x, y, 1), + p.get(x, y, 2), + p.get(x, y, 3) + ]; + else + return [r1, g1, b1, a1]; + } + + function output(image, datauri, mimetype) { + + // This output is accessible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + + } + + // run PixelManipulation on first Image pixels + return require('../_nomodule/PixelManipulation.js')(baseStepOutput, { + output: output, + changePixel: changePixel, + format: baseStepOutput.format, + image: baseStepImage, + inBrowser: options.inBrowser, + callback: callback + }); + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../../util/ParseInputCoordinates":254,"../_nomodule/PixelManipulation.js":249,"get-pixels":29}],235:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":234,"./info.json":236,"dup":162}],236:[function(require,module,exports){ -module.exports={ - "name": "Overlay", - "description": "Overlays an Image over another at a given position(x,y) in pixels or in %", - "inputs": { - "x": { - "type": "integer", - "desc": "X-position of the image on which the new image is overlayed", - "default": 0 - }, - "y": { - "type": "integer", - "desc": "Y-position of the image on which the new image is overlayed", - "default": 0 - }, - "offset": { - "type": "integer", - "desc": "offset to the output of the step on which the output of the last step is overlayed", - "default": -2 - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +module.exports={ + "name": "Overlay", + "description": "Overlays an Image over another at a given position(x,y) in pixels or in %", + "inputs": { + "x": { + "type": "integer", + "desc": "X-position of the image on which the new image is overlayed", + "default": 0 + }, + "y": { + "type": "integer", + "desc": "Y-position of the image on which the new image is overlayed", + "default": 0 + }, + "offset": { + "type": "integer", + "desc": "offset to the output of the step on which the output of the last step is overlayed", + "default": -2 + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" } },{}],237:[function(require,module,exports){ -/* - * Resize the image by given percentage value - */ -module.exports = function Resize(options, UI) { - - var output; - - function draw(input, callback, progressObj) { - - options.resize = options.resize || "125%"; - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - var imagejs = require('imagejs'); - - function changePixel(r, g, b, a) { - return [r, g, b, a] - } - - function extraManipulation(pixels) { - // value above 100% scales up, and below 100% scales down - var resize_value = parseInt(options.resize.slice(0, -1)); - - var new_width, - new_height; - - new_width = Math.round(pixels.shape[0] * (resize_value / 100)); - new_height = Math.round(pixels.shape[1] * (resize_value / 100)); - - var bitmap = new imagejs.Bitmap({width: pixels.shape[0], height: pixels.shape[1]}); - bitmap._data.data = pixels.data; - - - var resized = bitmap.resize({ - width: new_width, height: new_height, - algorithm: "bicubicInterpolation" - }); - - pixels.data = resized._data.data; - pixels.shape = [new_width,new_height,4]; - pixels.stride[1] = 4 * new_width; - - return pixels; - } - - function output(image, datauri, mimetype) { - // This output is accesible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Resize the image by given percentage value + */ +module.exports = function Resize(options, UI) { + + var output; + + function draw(input, callback, progressObj) { + + options.resize = options.resize || "125%"; + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + var imagejs = require('imagejs'); + + function changePixel(r, g, b, a) { + return [r, g, b, a] + } + + function extraManipulation(pixels) { + // value above 100% scales up, and below 100% scales down + var resize_value = parseInt(options.resize.slice(0, -1)); + + var new_width, + new_height; + + new_width = Math.round(pixels.shape[0] * (resize_value / 100)); + new_height = Math.round(pixels.shape[1] * (resize_value / 100)); + + var bitmap = new imagejs.Bitmap({width: pixels.shape[0], height: pixels.shape[1]}); + bitmap._data.data = pixels.data; + + + var resized = bitmap.resize({ + width: new_width, height: new_height, + algorithm: "bicubicInterpolation" + }); + + pixels.data = resized._data.data; + pixels.shape = [new_width,new_height,4]; + pixels.stride[1] = 4 * new_width; + + return pixels; + } + + function output(image, datauri, mimetype) { + // This output is accesible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249,"imagejs":62}],238:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":237,"./info.json":239,"dup":162}],239:[function(require,module,exports){ -module.exports={ - "name": "Resize", - "description": "Resize image by given percentage value", - "inputs": { - "resize": { - "type": "string", - "desc": "Percentage value of the resize", - "default": "125%" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +module.exports={ + "name": "Resize", + "description": "Resize image by given percentage value", + "inputs": { + "resize": { + "type": "string", + "desc": "Percentage value of the resize", + "default": "125%" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" } },{}],240:[function(require,module,exports){ -/* - * Rotates image - */ -module.exports = function Rotate(options, UI) { - - var output; - - function draw(input, callback, progressObj) { - - options.rotate = parseInt(options.rotate) || 0; - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - var imagejs = require('imagejs'); - - function changePixel(r, g, b, a) { - return [r, g, b, a] - } - - function extraManipulation(pixels) { - var rotate_value = (options.rotate)%360; - - if(rotate_value%360 == 0) - return pixels; - - var bitmap = new imagejs.Bitmap({width: pixels.shape[0], height: pixels.shape[1]}); - bitmap._data.data = pixels.data; - - var rotated = bitmap.rotate({ - degrees: rotate_value, - }); - pixels.data = rotated._data.data; - - return pixels; - } - - function output(image, datauri, mimetype) { - // This output is accesible by Image Sequencer - step.output = { src: datauri, format: mimetype }; - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - extraManipulation: extraManipulation, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - } - - return { - options: options, - draw: draw, - output: output, - UI: UI - } -} +/* + * Rotates image + */ +module.exports = function Rotate(options, UI) { + + var output; + + function draw(input, callback, progressObj) { + + options.rotate = parseInt(options.rotate) || 0; + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + var imagejs = require('imagejs'); + + function changePixel(r, g, b, a) { + return [r, g, b, a] + } + + function extraManipulation(pixels) { + var rotate_value = (options.rotate)%360; + + if(rotate_value%360 == 0) + return pixels; + + var bitmap = new imagejs.Bitmap({width: pixels.shape[0], height: pixels.shape[1]}); + bitmap._data.data = pixels.data; + + var rotated = bitmap.rotate({ + degrees: rotate_value, + }); + pixels.data = rotated._data.data; + + return pixels; + } + + function output(image, datauri, mimetype) { + // This output is accesible by Image Sequencer + step.output = { src: datauri, format: mimetype }; + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + extraManipulation: extraManipulation, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + } + + return { + options: options, + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249,"imagejs":62}],241:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":240,"./info.json":242,"dup":162}],242:[function(require,module,exports){ -module.exports={ - "name": "Rotate", - "description": "Rotates image by specified degrees", - "inputs": { - "rotate": { - "type": "range", - "desc": "Angular value for rotation in degrees", - "default": "0", - "min": "0", - "max": "360", - "step": "1" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +module.exports={ + "name": "Rotate", + "description": "Rotates image by specified degrees", + "inputs": { + "rotate": { + "type": "range", + "desc": "Angular value for rotation in degrees", + "default": "0", + "min": "0", + "max": "360", + "step": "1" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" } },{}],243:[function(require,module,exports){ -/* - * Saturate an image with a value from 0 to 1 - */ -module.exports = function Saturation(options,UI) { - - var output; - - function draw(input,callback,progressObj) { - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - - var cR = 0.299; - var cG = 0.587; - var cB = 0.114; - - var p = Math.sqrt((cR * (r*r)) + (cG * (g*g)) + (cB * (g*g))); - - r = p+(r-p)*(options.saturation); - g = p+(g-p)*(options.saturation); - b = p+(b-p)*(options.saturation); - - - return [Math.round(r), Math.round(g), Math.round(b), a]; - } - - function output(image,datauri,mimetype){ - - // This output is accesible by Image Sequencer - step.output = {src:datauri,format:mimetype}; - - } - - return require('../_nomodule/PixelManipulation.js')(input, { - output: output, - changePixel: changePixel, - format: input.format, - image: options.image, - inBrowser: options.inBrowser, - callback: callback - }); - - } - - return { - options: options, - //setup: setup, // optional - draw: draw, - output: output, - UI: UI - } -} +/* + * Saturate an image with a value from 0 to 1 + */ +module.exports = function Saturation(options,UI) { + + var output; + + function draw(input,callback,progressObj) { + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + + var cR = 0.299; + var cG = 0.587; + var cB = 0.114; + + var p = Math.sqrt((cR * (r*r)) + (cG * (g*g)) + (cB * (g*g))); + + r = p+(r-p)*(options.saturation); + g = p+(g-p)*(options.saturation); + b = p+(b-p)*(options.saturation); + + + return [Math.round(r), Math.round(g), Math.round(b), a]; + } + + function output(image,datauri,mimetype){ + + // This output is accesible by Image Sequencer + step.output = {src:datauri,format:mimetype}; + + } + + return require('../_nomodule/PixelManipulation.js')(input, { + output: output, + changePixel: changePixel, + format: input.format, + image: options.image, + inBrowser: options.inBrowser, + callback: callback + }); + + } + + return { + options: options, + //setup: setup, // optional + draw: draw, + output: output, + UI: UI + } +} },{"../_nomodule/PixelManipulation.js":249}],244:[function(require,module,exports){ arguments[4][162][0].apply(exports,arguments) },{"./Module":243,"./info.json":245,"dup":162}],245:[function(require,module,exports){ -module.exports={ - "name": "Saturation", - "description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.", - "inputs": { - "saturation": { - "type": "range", - "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated", - "default": "0.5", - "min": "0", - "max": "2", - "step": "0.1" - } - }, - "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" -} +module.exports={ + "name": "Saturation", + "description": "Change the saturation of the image by given value, from 0-1, with 1 being 100% saturated.", + "inputs": { + "saturation": { + "type": "range", + "desc": "saturation for the new image between 0 and 2, 0 being black and white and 2 being highly saturated", + "default": "0.5", + "min": "0", + "max": "2", + "step": "0.1" + } + }, + "docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md" +} },{}],246:[function(require,module,exports){ -module.exports = function Balance(options, UI) { - - var output; - - function draw (input, callback, progressObj) { - - options.temperature = (options.temperature > "40000") ? "40000" : options.temperature - - progressObj.stop(true); - progressObj.overrideFlag = true; - - var step = this; - - function changePixel(r, g, b, a) { - return [r, g, b ,a] - } - - function extraManipulation(pixels) { - - let temp = parseInt(options.temperature) - temp /= 100 - - let r, g, b; - - if (temp <= 66) { - r = 255; - g = Math.min(Math.max(99.4708025861 * Math.log(temp) - 161.1195681661, 0), 255); - } else { - r = Math.min(Math.max(329.698727446 * Math.pow(temp - 60, -0.1332047592), 0), 255); - g = Math.min(Math.max(288.1221695283 * Math.pow(temp - 60, -0.0755148492), 0), 255); - } - - if (temp >= 66) { - b = 255; - } else if (temp <= 19) { - b = 0; - } else { - b = temp - 10; - b = Math.min(Math.max(138.5177312231 * Math.log(b) - 305.0447927307, 0), 255); - } - - for(let i=0; i "40000") ? "40000" : options.temperature + + progressObj.stop(true); + progressObj.overrideFlag = true; + + var step = this; + + function changePixel(r, g, b, a) { + return [r, g, b ,a] + } + + function extraManipulation(pixels) { + + let temp = parseInt(options.temperature) + temp /= 100 + + let r, g, b; + + if (temp <= 66) { + r = 255; + g = Math.min(Math.max(99.4708025861 * Math.log(temp) - 161.1195681661, 0), 255); + } else { + r = Math.min(Math.max(329.698727446 * Math.pow(temp - 60, -0.1332047592), 0), 255); + g = Math.min(Math.max(288.1221695283 * Math.pow(temp - 60, -0.0755148492), 0), 255); + } + + if (temp >= 66) { + b = 255; + } else if (temp <= 19) { + b = 0; + } else { + b = temp - 10; + b = Math.min(Math.max(138.5177312231 * Math.log(b) - 305.0447927307, 0), 255); + } + + for(let i=0; i
To work with a new or different image, drag one into the drop zone.", - ID: ref.options.sequencerCounter++, - imageName: name, - inBrowser: ref.options.inBrowser, - ui: ref.options.ui - }; - - var image = { - src: src, - steps: [{ - options: { - id: step.ID, - name: "load-image", - description: "This initial step loads and displays the original image without any modifications.", - title: "Load Image", - step: step - }, - UI: ref.events, - draw: function() { - UI.onDraw(options.step); - if(arguments.length==1){ - this.output = CImage(arguments[0]); - options.step.output = this.output; - UI.onComplete(options.step); - return true; - } - else if(arguments.length==2) { - this.output = CImage(arguments[0]); - options.step.output = this.output; - arguments[1](); - UI.onComplete(options.step); - return true; - } - return false; - }, - }] - }; - CImage(src, function(datauri) { - var output = makeImage(datauri); - ref.images[name] = image; - var loadImageStep = ref.images[name].steps[0]; - loadImageStep.output = output; - loadImageStep.options.step.output = loadImageStep.output.src; - loadImageStep.UI.onSetup(loadImageStep.options.step); - loadImageStep.UI.onDraw(loadImageStep.options.step); - loadImageStep.UI.onComplete(loadImageStep.options.step); - - main_callback(); - return true; - }); - } - - return loadImage(name,src); -} - -module.exports = LoadImage; +// special module to load an image into the start of the sequence; used in the HTML UI +function LoadImage(ref, name, src, main_callback) { + function makeImage(datauri) { + var image = { + src: datauri, + format: datauri.split(':')[1].split(';')[0].split('/')[1] + } + return image; + } + function CImage(src, callback) { + var datauri; + if (!!src.match(/^data:/i)) { + datauri = src; + callback(datauri); + } + else if (!ref.options.inBrowser && !!src.match(/^https?:\/\//i)) { + require( src.match(/^(https?):\/\//i)[1] ).get(src,function(res){ + var data = ''; + var contentType = res.headers['content-type']; + res.setEncoding('base64'); + res.on('data',function(chunk) {data += chunk;}); + res.on('end',function() { + callback("data:"+contentType+";base64,"+data); + }); + }); + } + else if (ref.options.inBrowser) { + var ext = src.split('.').pop(); + var image = document.createElement('img'); + var canvas = document.createElement('canvas'); + var context = canvas.getContext('2d'); + image.onload = function() { + canvas.width = image.naturalWidth; + canvas.height = image.naturalHeight; + context.drawImage(image,0,0); + datauri = canvas.toDataURL(ext); + callback(datauri); + } + image.src = src; + } + else { + datauri = require('urify')(src); + callback(datauri); + } + } + + function loadImage(name, src) { + var step = { + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.

To work with a new or different image, drag one into the drop zone.", + ID: ref.options.sequencerCounter++, + imageName: name, + inBrowser: ref.options.inBrowser, + ui: ref.options.ui + }; + + var image = { + src: src, + steps: [{ + options: { + id: step.ID, + name: "load-image", + description: "This initial step loads and displays the original image without any modifications.", + title: "Load Image", + step: step + }, + UI: ref.events, + draw: function() { + UI.onDraw(options.step); + if(arguments.length==1){ + this.output = CImage(arguments[0]); + options.step.output = this.output; + UI.onComplete(options.step); + return true; + } + else if(arguments.length==2) { + this.output = CImage(arguments[0]); + options.step.output = this.output; + arguments[1](); + UI.onComplete(options.step); + return true; + } + return false; + }, + }] + }; + CImage(src, function(datauri) { + var output = makeImage(datauri); + ref.images[name] = image; + var loadImageStep = ref.images[name].steps[0]; + loadImageStep.output = output; + loadImageStep.options.step.output = loadImageStep.output.src; + loadImageStep.UI.onSetup(loadImageStep.options.step); + loadImageStep.UI.onDraw(loadImageStep.options.step); + loadImageStep.UI.onComplete(loadImageStep.options.step); + + main_callback(); + return true; + }); + } + + return loadImage(name,src); +} + +module.exports = LoadImage; },{"urify":147}],251:[function(require,module,exports){ -// TODO: potentially move this into ImportImage module -function setInputStepInit() { - - return function setInputStep(options) { - - var dropzone = $(options.dropZoneSelector); - var fileInput = $(options.fileInputSelector); - var takePhoto = $(options.takePhotoSelector); - - var onLoad = options.onLoad; - var onTakePhoto = options.onTakePhoto; - - var reader = new FileReader(); - - function handleFile(e) { - - e.preventDefault(); - e.stopPropagation(); // stops the browser from redirecting. - - if (e.target && e.target.files) var file = e.target.files[0]; - else var file = e.dataTransfer.files[0]; - if(!file) return; - - var reader = new FileReader(); - - reader.onload = onLoad; - - reader.readAsDataURL(file); - } - - function runVideo(){ - /* event handler for Take-Photo */ - document.getElementById('video').style.display='inline'; - document.getElementById('capture').style.display='inline'; - document.getElementById('close').style.display='inline'; - - var video = document.getElementById('video'); - canvas = document.getElementById('canvas'), - context = canvas.getContext('2d'), - vendorUrl = window.URL || window.webkitURL; - - navigator.getMedia = navigator.getUserMedia || navigator.wekitGetUserMedia || - navigator.mozGetUserMedia || navigator.msGetUserMedia; - - navigator.getMedia({ - video: true, - audio: false - }, function(stream){ // success callback - video.srcObject = stream; - video.onloadedmetadata = function(e) { - video.play(); - }; - document.getElementById('close').addEventListener('click', function () { - stopStream(stream); - }); - }, function(error){ // error - console.log("error"); - }); - - document.getElementById('capture').addEventListener('click', function(stream){ - context.drawImage(video, 0, 0, 400, 300); - options.onTakePhoto(canvas.toDataURL()); - }); - - function stopStream(stream) { - stream.getVideoTracks().forEach(function (track) { - track.stop(); - }); - document.getElementById('video').style.display='none'; - document.getElementById('capture').style.display='none'; - document.getElementById('close').style.display='none'; - } -} - - fileInput.on('change', handleFile); - takePhoto.on('click', runVideo); - - dropzone[0].addEventListener('drop', handleFile, false); - - dropzone.on('dragover', function onDragover(e) { - e.stopPropagation(); - e.preventDefault(); - e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. - }, false); - - dropzone.on('dragenter', function onDragEnter(e) { - dropzone.addClass('hover'); - }); - - dropzone.on('dragleave', function onDragLeave(e) { - dropzone.removeClass('hover'); - }); - - } - -} -module.exports = setInputStepInit; +// TODO: potentially move this into ImportImage module +function setInputStepInit() { + + return function setInputStep(options) { + + var dropzone = $(options.dropZoneSelector); + var fileInput = $(options.fileInputSelector); + var takePhoto = $(options.takePhotoSelector); + + var onLoad = options.onLoad; + var onTakePhoto = options.onTakePhoto; + + var reader = new FileReader(); + + function handleFile(e) { + + e.preventDefault(); + e.stopPropagation(); // stops the browser from redirecting. + + if (e.target && e.target.files) var file = e.target.files[0]; + else var file = e.dataTransfer.files[0]; + if(!file) return; + + var reader = new FileReader(); + + reader.onload = onLoad; + + reader.readAsDataURL(file); + } + + function runVideo(){ + /* event handler for Take-Photo */ + document.getElementById('video').style.display='inline'; + document.getElementById('capture').style.display='inline'; + document.getElementById('close').style.display='inline'; + + var video = document.getElementById('video'); + canvas = document.getElementById('canvas'), + context = canvas.getContext('2d'), + vendorUrl = window.URL || window.webkitURL; + + navigator.getMedia = navigator.getUserMedia || navigator.wekitGetUserMedia || + navigator.mozGetUserMedia || navigator.msGetUserMedia; + + navigator.getMedia({ + video: true, + audio: false + }, function(stream){ // success callback + video.srcObject = stream; + video.onloadedmetadata = function(e) { + video.play(); + }; + document.getElementById('close').addEventListener('click', function () { + stopStream(stream); + }); + }, function(error){ // error + console.log("error"); + }); + + document.getElementById('capture').addEventListener('click', function(stream){ + context.drawImage(video, 0, 0, 400, 300); + options.onTakePhoto(canvas.toDataURL()); + }); + + function stopStream(stream) { + stream.getVideoTracks().forEach(function (track) { + track.stop(); + }); + document.getElementById('video').style.display='none'; + document.getElementById('capture').style.display='none'; + document.getElementById('close').style.display='none'; + } +} + + fileInput.on('change', handleFile); + takePhoto.on('click', runVideo); + + dropzone[0].addEventListener('drop', handleFile, false); + + dropzone.on('dragover', function onDragover(e) { + e.stopPropagation(); + e.preventDefault(); + e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy. + }, false); + + dropzone.on('dragenter', function onDragEnter(e) { + dropzone.addClass('hover'); + }); + + dropzone.on('dragleave', function onDragLeave(e) { + dropzone.removeClass('hover'); + }); + + } + +} +module.exports = setInputStepInit; },{}],252:[function(require,module,exports){ -/* - * User Interface Handling Module - */ - -module.exports = function UserInterface(events = {}) { - - events.onSetup = events.onSetup || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Create and append an HTML Element - console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } else { - // Create a NodeJS Object - console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); - } - } - - events.onDraw = events.onDraw || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Overlay a loading spinner - console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } else { - // Don't do anything - console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onComplete = events.onComplete || function(step) { - if (step.ui == false) { - // No UI - } else if(step.inBrowser) { - // Update the DIV Element - // Hide the laoding spinner - console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } else { - // Update the NodeJS Object - console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); - } - } - - events.onRemove = events.onRemove || function(step) { - if (step.ui == false){ - // No UI - } else if(step.inBrowser) { - // Remove the DIV Element - console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } else { - // Delete the NodeJS Object - console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); - } - } - - return events; - -} +/* + * User Interface Handling Module + */ + +module.exports = function UserInterface(events = {}) { + + events.onSetup = events.onSetup || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Create and append an HTML Element + console.log("Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } else { + // Create a NodeJS Object + console.log('\x1b[36m%s\x1b[0m',"Added Step \""+step.name+"\" to \""+step.imageName+"\"."); + } + } + + events.onDraw = events.onDraw || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Overlay a loading spinner + console.log("Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } else { + // Don't do anything + console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onComplete = events.onComplete || function(step) { + if (step.ui == false) { + // No UI + } else if(step.inBrowser) { + // Update the DIV Element + // Hide the laoding spinner + console.log("Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } else { + // Update the NodeJS Object + console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+step.name+"\" on \""+step.imageName+"\"."); + } + } + + events.onRemove = events.onRemove || function(step) { + if (step.ui == false){ + // No UI + } else if(step.inBrowser) { + // Remove the DIV Element + console.log("Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } else { + // Delete the NodeJS Object + console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+step.name+"\" of \""+step.imageName+"\"."); + } + } + + return events; + +} },{}],253:[function(require,module,exports){ -/* -* Determine format from a URL or data-url, return "jpg" "png" "gif" etc -* TODO: write a test for this using the examples -*/ -module.exports = function GetFormat(src) { - - var format = undefined; // haha default - - // EXAMPLE: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; - // EXAMPLE: "http://example.com/example.png" - // EXAMPLE: "/example.png" - - if (isDataUrl(src)) { - format = src.split(';')[0].split('/').pop(); - } else { - format = src.split('.').pop(); - } - - function isDataUrl(src) { - return src.substr(0, 10) === "data:image" - } - - format = format.toLowerCase(); - - if (format === "jpeg") format = "jpg"; - - function validateFormat(data){ - let supportedFormats = [ - 'jpg', - 'jpeg', - 'png', - 'gif', - 'canvas', - ]; - return supportedFormats.includes(data); - } - - return validateFormat(format)?format:'jpg'; - -} +/* +* Determine format from a URL or data-url, return "jpg" "png" "gif" etc +* TODO: write a test for this using the examples +*/ +module.exports = function GetFormat(src) { + + var format = undefined; // haha default + + // EXAMPLE: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; + // EXAMPLE: "http://example.com/example.png" + // EXAMPLE: "/example.png" + + if (isDataUrl(src)) { + format = src.split(';')[0].split('/').pop(); + } else { + format = src.split('.').pop(); + } + + function isDataUrl(src) { + return src.substr(0, 10) === "data:image" + } + + format = format.toLowerCase(); + + if (format === "jpeg") format = "jpg"; + + function validateFormat(data){ + let supportedFormats = [ + 'jpg', + 'jpeg', + 'png', + 'gif', + 'canvas', + ]; + return supportedFormats.includes(data); + } + + return validateFormat(format)?format:'jpg'; + +} },{}],254:[function(require,module,exports){ -module.exports = function parseCornerCoordinateInputs(options,coord,callback) { - var getPixels = require('get-pixels'); - getPixels(coord.src, function(err, pixels) { - var iw = pixels.shape[0], - ih = pixels.shape[1]; - if (!coord.x.valInp) { - return - } - else { - Object.keys(coord).forEach(convert); - function convert(key) { - var val = coord[key]; - if (val.valInp && val.valInp.slice(-1) === "%") { - val.valInp = parseInt(val.valInp, 10); - if (val.type === 'horizontal') - val.valInp = val.valInp * iw / 100; - else - val.valInp = val.valInp * ih / 100; - } - } - } - callback(options, coord); - }) +module.exports = function parseCornerCoordinateInputs(options,coord,callback) { + var getPixels = require('get-pixels'); + getPixels(coord.src, function(err, pixels) { + var iw = pixels.shape[0], + ih = pixels.shape[1]; + if (!coord.x.valInp) { + return + } + else { + Object.keys(coord).forEach(convert); + function convert(key) { + var val = coord[key]; + if (val.valInp && val.valInp.slice(-1) === "%") { + val.valInp = parseInt(val.valInp, 10); + if (val.type === 'horizontal') + val.valInp = val.valInp * iw / 100; + else + val.valInp = val.valInp * ih / 100; + } + } + } + callback(options, coord); + }) } },{"get-pixels":29}],255:[function(require,module,exports){ -module.exports = { - getPreviousStep: function() { - return this.getStep(-1); - }, - - getNextStep: function() { - return this.getStep(1); - }, - - getInput: function(offset) { - if (offset + this.getIndex() === 0) offset++; - return this.getStep(offset - 1).output; - }, - - getOutput: function(offset) { - return this.getStep(offset).output; - }, - - getOptions: function() { - return this.getStep(0).options; - }, - - setOptions: function(optionsObj) { - let options = this.getStep(0).options; - for (let key in optionsObj) { - if (options[key]) options[key] = optionsObj[key]; - } - }, - - getFormat: function() { - return this.getStep(-1).output.format; - }, - - getHeight: function(callback) { - let img = new Image(); - img.onload = function() { - callback(img.height); - }; - img.src = this.getInput(0).src; - }, - - getWidth: function(callback) { - let img = new Image(); - img.onload = function() { - callback(img.width); - }; - img.src = this.getInput(0).src; - } +module.exports = { + getPreviousStep: function() { + return this.getStep(-1); + }, + + getNextStep: function() { + return this.getStep(1); + }, + + getInput: function(offset) { + if (offset + this.getIndex() === 0) offset++; + return this.getStep(offset - 1).output; + }, + + getOutput: function(offset) { + return this.getStep(offset).output; + }, + + getOptions: function() { + return this.getStep(0).options; + }, + + setOptions: function(optionsObj) { + let options = this.getStep(0).options; + for (let key in optionsObj) { + if (options[key]) options[key] = optionsObj[key]; + } + }, + + getFormat: function() { + return this.getStep(-1).output.format; + }, + + getHeight: function(callback) { + let img = new Image(); + img.onload = function() { + callback(img.height); + }; + img.src = this.getInput(0).src; + }, + + getWidth: function(callback) { + let img = new Image(); + img.onload = function() { + callback(img.width); + }; + img.src = this.getInput(0).src; + } } },{}]},{},[154]); diff --git a/dist/image-sequencer.min.js b/dist/image-sequencer.min.js index b952852e39..8a2e28d007 100644 --- a/dist/image-sequencer.min.js +++ b/dist/image-sequencer.min.js @@ -1 +1 @@ -!function(){return function t(e,n,r){function i(o,s){if(!n[o]){if(!e[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};e[o][0].call(c.exports,function(t){return i(e[o][1][t]||t)},c,c.exports,t,e,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o0?r-4:r,f=0;f>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===o&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,s[u++]=255&e);1===o&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},n.fromByteArray=function(t){for(var e,n=t.length,i=n%3,a=[],o=0,s=n-i;os?s:o+16383));1===i?(e=t[n-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return a.join("")};for(var r=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,n){for(var i,a,o=[],s=e;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,n){"use strict";"use restrict";function r(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}n.INT_BITS=32,n.INT_MAX=2147483647,n.INT_MIN=-1<<31,n.sign=function(t){return(t>0)-(t<0)},n.abs=function(t){var e=t>>31;return(t^e)-e},n.min=function(t,e){return e^(t^e)&-(t65535)<<4,e|=n=((t>>>=e)>255)<<3,e|=n=((t>>>=n)>15)<<2,(e|=n=((t>>>=n)>3)<<1)|(t>>>=n)>>1},n.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},n.popCount=function(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},n.countTrailingZeros=r,n.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},n.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},n.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var n=e,r=e,i=7;for(n>>>=1;n;n>>>=1)r<<=1,r|=1&n,--i;t[e]=r<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},n.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},n.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},n.interleave3=function(t,e,n){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(n=1227133513&((n=3272356035&((n=251719695&((n=4278190335&((n&=1023)|n<<16))|n<<8))|n<<4))|n<<2))<<2},n.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},n.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>r(t)+1}},{}],3:[function(t,e,n){(function(t,r,i){!function(t){if("object"==typeof n&&void 0!==e)e.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;"undefined"!=typeof window?i=window:void 0!==r?i=r:"undefined"!=typeof self&&(i=self),i.Promise=t()}}(function(){var e,n,a;return function t(e,n,r){function i(o,s){if(!n[o]){if(!e[o]){var u="function"==typeof _dereq_&&_dereq_;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};e[o][0].call(c.exports,function(t){var n=e[o][1][t];return i(n||t)},c,c.exports,t,e,n,r)}return n[o].exports}for(var a="function"==typeof _dereq_&&_dereq_,o=0;o0;)p(t)}function p(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),r=t.shift();e.call(n,r)}}u.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},u.prototype.hasCustomScheduler=function(){return this._customScheduler},u.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},u.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},u.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},u.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},u.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(u.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?l.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},u.prototype.invoke=function(t,e,n){this._trampolineEnabled?c.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},u.prototype.settlePromises=function(t){this._trampolineEnabled?f.call(this,t):this._schedule(function(){t._settlePromises()})}):(u.prototype.invokeLater=l,u.prototype.invoke=c,u.prototype.settlePromises=f),u.prototype._drainQueues=function(){h(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,h(this._lateQueue)},u.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},u.prototype._reset=function(){this._isTickUsed=!1},n.exports=u,n.exports.firstLineError=i},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,a=function(t,e){this._reject(e)},o=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(a,a,null,this,t)},s=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(a){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var l=n(a),c=new t(e);c._propagateFrom(this,1);var f=this._target();if(c._setBoundTo(l),l instanceof t){var h={promiseRejectionQueued:!1,promise:c,target:f,bindingPromise:l};f._then(e,o,void 0,c,h),l._then(s,u,void 0,c,h),c._setOnCancel(l)}else c._resolveCallback(f);return c},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";var r;"undefined"!=typeof Promise&&(r=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=r)}catch(t){}return i},e.exports=i},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),a=r(null);i[" size"]=a[" size"]=0}e.exports=function(e){var n,r=t("./util"),i=r.canEvaluate;r.isIdentifier;function a(t,n){var i;if(null!=t&&(i=t[n]),"function"!=typeof i){var a="Object "+r.classString(t)+" has no method '"+r.toString(n)+"'";throw new e.TypeError(a)}return i}function o(t){return a(t,this.pop()).apply(t,this)}function s(t){return t[this]}function u(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(o,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if("number"==typeof t)e=u;else if(i){var r=n(t);e=null!==r?r:s}else e=s;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var a=t("./util"),o=a.tryCatch,s=a.errorObj,u=e._async;e.prototype.break=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(a.isArray(t))for(var n=0;n=0)return n[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},r.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},r.prototype._popContext=function(){if(void 0!==this._trace){var t=n.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},r.CapturedTrace=null,r.create=function(){if(e)return new r},r.deactivateLongStackTraces=function(){},r.activateLongStackTraces=function(){var n=t.prototype._pushContext,a=t.prototype._popContext,o=t._peekContext,s=t.prototype._peekContext,u=t.prototype._promiseCreated;r.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=a,t._peekContext=o,t.prototype._peekContext=s,t.prototype._promiseCreated=u,e=!1},e=!0,t.prototype._pushContext=r.prototype._pushContext,t.prototype._popContext=r.prototype._popContext,t._peekContext=t.prototype._peekContext=i,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},r}},{}],9:[function(e,n,r){"use strict";n.exports=function(n,r){var i,a,o,s=n._getDomain,u=n._async,l=e("./errors").Warning,c=e("./util"),f=e("./es5"),h=c.canAttachTrace,p=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,d=/\((?:timers\.js):\d+:\d+\)/,v=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,g=null,m=null,_=!1,y=!(0==c.env("BLUEBIRD_DEBUG")),b=!(0==c.env("BLUEBIRD_WARNINGS")||!y&&!c.env("BLUEBIRD_WARNINGS")),w=!(0==c.env("BLUEBIRD_LONG_STACK_TRACES")||!y&&!c.env("BLUEBIRD_LONG_STACK_TRACES")),x=0!=c.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!c.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){H("rejectionHandled",i,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),H("unhandledRejection",a,t,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(t,e,n){return z(t,e,n||this)},n.onPossiblyUnhandledRejection=function(t){var e=s();a="function"==typeof t?null===e?t:c.domainBind(e,t):void 0},n.onUnhandledRejectionHandled=function(t){var e=s();i="function"==typeof t?null===e?t:c.domainBind(e,t):void 0};var k=function(){};n.longStackTraces=function(){if(u.haveItemsQueued()&&!K.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!K.longStackTraces&&Z()){var t=n.prototype._captureStackTrace,e=n.prototype._attachExtraTrace,i=n.prototype._dereferenceTrace;K.longStackTraces=!0,k=function(){if(u.haveItemsQueued()&&!K.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=t,n.prototype._attachExtraTrace=e,n.prototype._dereferenceTrace=i,r.deactivateLongStackTraces(),u.enableTrampoline(),K.longStackTraces=!1},n.prototype._captureStackTrace=D,n.prototype._attachExtraTrace=U,n.prototype._dereferenceTrace=N,r.activateLongStackTraces(),u.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return K.longStackTraces&&Z()};var E=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return c.global.dispatchEvent(t),function(t,e){var n={detail:e,cancelable:!0};f.defineProperty(n,"promise",{value:e.promise}),f.defineProperty(n,"reason",{value:e.reason});var r=new CustomEvent(t.toLowerCase(),n);return!c.global.dispatchEvent(r)}}if("function"==typeof Event){t=new Event("CustomEvent");return c.global.dispatchEvent(t),function(t,e){var n=new Event(t.toLowerCase(),{cancelable:!0});return n.detail=e,f.defineProperty(n,"promise",{value:e.promise}),f.defineProperty(n,"reason",{value:e.reason}),!c.global.dispatchEvent(n)}}return(t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),c.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!c.global.dispatchEvent(n)}}catch(t){}return function(){return!1}}(),S=c.isNode?function(){return t.emit.apply(t,arguments)}:c.global?function(t){var e="on"+t.toLowerCase(),n=c.global[e];return!!n&&(n.apply(c.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function j(t,e){return{promise:e}}var T={promiseCreated:j,promiseFulfilled:j,promiseRejected:j,promiseResolved:j,promiseCancelled:j,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:j},C=function(t){var e=!1;try{e=S.apply(null,arguments)}catch(t){u.throwLater(t),e=!0}var n=!1;try{n=E(t,T[t].apply(null,arguments))}catch(t){u.throwLater(t),n=!0}return n||e};function A(){return!1}function M(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+c.toString(t));r._attachCancellationCallback(t)})}catch(t){return t}}function I(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?c.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function R(){return this._onCancelField}function L(t){this._onCancelField=t}function B(){this._cancellationParent=void 0,this._onCancelField=void 0}function F(t,e){if(0!=(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}n.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?n.longStackTraces():!t.longStackTraces&&n.hasLongStackTraces()&&k()),"warnings"in t){var e=t.warnings;K.warnings=!!e,x=K.warnings,c.isObject(e)&&"wForgottenReturn"in e&&(x=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!K.cancellation){if(u.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=B,n.prototype._propagateFrom=F,n.prototype._onCancel=R,n.prototype._setOnCancel=L,n.prototype._attachCancellationCallback=I,n.prototype._execute=M,O=F,K.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!K.monitoring?(K.monitoring=!0,n.prototype._fireEvent=C):!t.monitoring&&K.monitoring&&(K.monitoring=!1,n.prototype._fireEvent=A)),n},n.prototype._fireEvent=A,n.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(t){},n.prototype._attachCancellationCallback=function(t){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._dereferenceTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(t,e){};var O=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function P(){var t=this._boundTo;return void 0!==t&&t instanceof n?t.isFulfilled()?t.value():void 0:t}function D(){this._trace=new J(this._peekContext())}function U(t,e){if(h(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=V(t);c.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),c.notEnumerableProp(t,"__stackCleaned__",!0)}}}function N(){this._trace=void 0}function z(t,e,r){if(K.warnings){var i,a=new l(t);if(e)r._attachExtraTrace(a);else if(K.longStackTraces&&(i=n._peekContext()))i.attachExtraTrace(a);else{var o=V(a);a.stack=o.message+"\n"+o.stack.join("\n")}C("warning",a)||G(a,"",!0)}}function q(t){for(var e=[],n=0;n0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:q(e)}}function G(t,e,n){if("undefined"!=typeof console){var r;if(c.isObject(t)){var i=t.stack;r=e+m(i,t)}else r=e+String(t);"function"==typeof o?o(r,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function H(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(t){u.throwLater(t)}"unhandledRejection"===t?C(t,n,r)||i||G(n,"Unhandled rejection "):C(t,r)}function W(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():c.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){if(t.length<41)return t;return t.substr(0,38)+"..."}(e)+">, no stack trace)"}function Z(){return"function"==typeof Q}var Y=function(){return!1},X=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function $(t){var e=t.match(X);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function J(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);Q(this,J),e>32&&this.uncycle()}c.inherits(J,Error),r.CapturedTrace=J,J.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;for(r=(t=this._length=r)-1;r>=0;--r){var a=e[r].stack;void 0===n[a]&&(n[a]=r)}for(r=0;r0&&(e[o-1]._parent=void 0,e[o-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var s=r>0?e[r-1]:this;o=0;--l)e[l]._length=u,u++;return}}}},J.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=V(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(q(i.stack.split("\n"))),i=i._parent;!function(t){for(var e=t[0],n=1;n=0;--s)if(r[s]===a){o=s;break}for(s=o;s>=0;--s){var u=r[s];if(e[i]!==u)break;e.pop(),i--}e=r}}(r),function(t){for(var e=0;e=0)return g=/@/,m=e,_=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){r="stack"in t}return"stack"in i||!r||"number"!=typeof Error.stackTraceLimit?(m=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?W(e):e.toString()},null):(g=t,m=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(o=function(t){console.warn(t)},c.isNode&&t.stderr.isTTY?o=function(t,e){var n=e?"":"";console.warn(n+t+"\n")}:c.isNode||"string"!=typeof(new Error).stack||(o=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var K={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return w&&n.longStackTraces(),{longStackTraces:function(){return K.longStackTraces},warnings:function(){return K.warnings},cancellation:function(){return K.cancellation},monitoring:function(){return K.monitoring},propagateFromFunction:function(){return O},boundValueFunction:function(){return P},checkForgottenReturns:function(t,e,n,r,i){if(void 0===t&&null!==e&&x){if(void 0!==i&&i._returnedNonUndefined())return;if(0==(65535&r._bitField))return;n&&(n+=" ");var a="",o="";if(e._trace){for(var s=e._trace.stack.split("\n"),u=q(s),l=u.length-1;l>=0;--l){var c=u[l];if(!d.test(c)){var f=c.match(v);f&&(a="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(u.length>0){var h=u[0];for(l=0;l0&&(o="\n"+s[l-1]);break}}}var p="a promise was created in a "+n+"handler "+a+"but was not returned from it, see http://goo.gl/rRqMUw"+o;r._warn(p,!0,e)}},setBounds:function(t,e){if(Z()){for(var n,r,i=t.stack.split("\n"),a=e.stack.split("\n"),o=-1,s=-1,u=0;u=s||(Y=function(t){if(p.test(t))return!0;var e=$(t);return!!(e&&e.fileName===n&&o<=e.line&&e.line<=s)})}},warn:z,deprecated:function(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),z(n)},CapturedTrace:J,fireDomEvent:E,fireGlobalEvent:S}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();return this.caught(n,function(){return r})}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.reduce,r=t.all;function i(){return r(this)}t.prototype.each=function(t){return n(this,t,e,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return n(this,t,e,e)},t.each=function(t,r){return n(t,r,e,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,r){return n(t,r,e,e)}}},{}],12:[function(t,e,n){"use strict";var r,i,a=t("./es5"),o=a.freeze,s=t("./util"),u=s.inherits,l=s.notEnumerableProp;function c(t,e){function n(r){if(!(this instanceof n))return new n(r);l(this,"message","string"==typeof r?r:e),l(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return u(n,Error),n}var f=c("Warning","warning"),h=c("CancellationError","cancellation error"),p=c("TimeoutError","timeout error"),d=c("AggregateError","aggregate error");try{r=TypeError,i=RangeError}catch(t){r=c("TypeError","type error"),i=c("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function f(){return p.call(this,this.promise._target()._settledValue())}function h(t){if(!c(this,t))return o.e=t,o}function p(t){var i=this.promise,s=this.handler;if(!this.called){this.called=!0;var u=this.isFinallyHandler()?s.call(i._boundValue()):s.call(i._boundValue(),t);if(u===r)return u;if(void 0!==u){i._setReturnedNonUndefined();var p=n(u,i);if(p instanceof e){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new a("late cancellation observer");return i._attachExtraTrace(d),o.e=d,o}p.isPending()&&p._attachCancellationCallback(new l(this))}return p._then(f,h,void 0,this,void 0)}}}return i.isRejected()?(c(this),o.e=t,o):(c(this),t)}return u.prototype.isFinallyHandler=function(){return 0===this.type},l.prototype._resultCancelled=function(){c(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new u(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,p,p)},e.prototype.tap=function(t){return this._passThrough(t,1,p)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,p);var r,a=new Array(n-1),o=0;for(r=0;r0&&"function"==typeof arguments[e]&&(t=arguments[e]);var r=[].slice.call(arguments);t&&r.pop();var i=new n(r).promise();return void 0!==t?i.spread(t):i}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,a,o){var s=e._getDomain,u=t("./util"),l=u.tryCatch,c=u.errorObj,f=e._async;function h(t,e,n,r){this.constructor$(t),this._promise._captureStackTrace();var i=s();this._callback=null===i?e:u.domainBind(i,e),this._preservedValues=r===a?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function p(t,n,i,a){if("function"!=typeof n)return r("expecting a function but got "+u.classString(n));var o=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));o=i.concurrency}return new h(t,n,o="number"==typeof o&&isFinite(o)&&o>=1?o:0,a).promise()}u.inherits(h,n),h.prototype._asyncInit=function(){this._init$(void 0,-2)},h.prototype._init=function(){},h.prototype._promiseFulfilled=function(t,n){var r=this._values,a=this.length(),s=this._preservedValues,u=this._limit;if(n<0){if(r[n=-1*n-1]=t,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return r[n]=t,this._queue.push(n),!1;null!==s&&(s[n]=t);var f=this._promise,h=this._callback,p=f._boundValue();f._pushContext();var d=l(h).call(p,t,n,a),v=f._popContext();if(o.checkForgottenReturns(d,v,null!==s?"Promise.filter":"Promise.map",f),d===c)return this._reject(d.e),!0;var g=i(d,this._promise);if(g instanceof e){var m=(g=g._target())._bitField;if(0==(50397184&m))return u>=1&&this._inFlight++,r[n]=g,g._proxy(this,-1*(n+1)),!1;if(0==(33554432&m))return 0!=(16777216&m)?(this._reject(g._reason()),!0):(this._cancel(),!0);d=g._value()}r[n]=d}return++this._totalResolved>=a&&(null!==s?this._filter(r,s):this._resolve(r),!0)},h.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight1){a.deprecated("calling Promise.try with more than 1 argument");var l=arguments[1],c=arguments[2];r=o.isArray(l)?s(t).apply(c,l):s(t).call(c,l)}else r=s(t)();var f=u._popContext();return a.checkForgottenReturns(r,f,"Promise.try",u),u._resolveFromSyncValue(r),u},e.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";var r=t("./util"),i=r.maybeWrapAsError,a=t("./errors").OperationalError,o=t("./es5");var s=/^(?:name|message|stack|cause)$/;function u(t){var e;if(function(t){return t instanceof Error&&o.getPrototypeOf(t)===Error.prototype}(t)){(e=new a(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var n=o.keys(t),i=0;i1){var n,r=new Array(e-1),i=0;for(n=0;n0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+l.classString(t);arguments.length>1&&(n+=", "+l.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},A.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},A.prototype.spread=function(t){return"function"!=typeof t?a("expecting a function but got "+l.classString(t)):this.all()._then(t,void 0,void 0,m,void 0)},A.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},A.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new b(this).promise()},A.prototype.error=function(t){return this.caught(l.originatesFromRejection,t)},A.getNewLibraryCopy=n.exports,A.is=function(t){return t instanceof A},A.fromNode=A.fromCallback=function(t){var e=new A(g);e._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=C(t)(j(e,n));return r===T&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},A.all=function(t){return new b(t).promise()},A.cast=function(t){var e=y(t);return e instanceof A||((e=new A(g))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},A.resolve=A.fulfilled=A.cast,A.reject=A.rejected=function(t){var e=new A(g);return e._captureStackTrace(),e._rejectCallback(t,!0),e},A.setScheduler=function(t){if("function"!=typeof t)throw new d("expecting a function but got "+l.classString(t));return h.setScheduler(t)},A.prototype._then=function(t,e,n,r,i){var a=void 0!==i,o=a?i:new A(g),u=this._target(),c=u._bitField;a||(o._propagateFrom(this,3),o._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&c)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,o));var f=s();if(0!=(50397184&c)){var p,d,m=u._settlePromiseCtx;0!=(33554432&c)?(d=u._rejectionHandler0,p=t):0!=(16777216&c)?(d=u._fulfillmentHandler0,p=e,u._unsetRejectionIsUnhandled()):(m=u._settlePromiseLateCancellationObserver,d=new v("late cancellation observer"),u._attachExtraTrace(d),p=e),h.invoke(m,u,{handler:null===f?p:"function"==typeof p&&l.domainBind(f,p),promise:o,receiver:r,value:d})}else u._addCallbacks(t,e,o,r,f);return o},A.prototype._length=function(){return 65535&this._bitField},A.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},A.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},A.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},A.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},A.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},A.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},A.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},A.prototype._isFinal=function(){return(4194304&this._bitField)>0},A.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},A.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},A.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},A.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},A.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==u)return void 0===e&&this._isBound()?this._boundValue():e},A.prototype._promiseAt=function(t){return this[4*t-4+2]},A.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},A.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},A.prototype._boundValue=function(){},A.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=u),this._addCallbacks(e,n,r,i,null)},A.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),a=t._receiverAt(e);void 0===a&&(a=u),this._addCallbacks(n,r,i,a,null)},A.prototype._addCallbacks=function(t,e,n,r,i){var a=this._length();if(a>=65531&&(a=0,this._setLength(0)),0===a)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:l.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:l.domainBind(i,e));else{var o=4*a-4;this[o+2]=n,this[o+3]=r,"function"==typeof t&&(this[o+0]=null===i?t:l.domainBind(i,t)),"function"==typeof e&&(this[o+1]=null===i?e:l.domainBind(i,e))}return this._setLength(a+1),a},A.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},A.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(r(),!1);var n=y(t,this);if(!(n instanceof A))return this._fulfill(t);e&&this._propagateFrom(n,2);var i=n._target();if(i!==this){var a=i._bitField;if(0==(50397184&a)){var o=this._length();o>0&&i._migrateCallback0(this);for(var s=1;s>>16)){if(t===this){var n=r();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():h.settlePromises(this),this._dereferenceTrace())}},A.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return h.fatalError(t,l.isNode);(65535&e)>0?h.settlePromises(this):this._ensurePossibleRejectionHandled()}},A.prototype._fulfillPromises=function(t,e){for(var n=1;n0){if(0!=(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},A.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},A.defer=A.pending=function(){return k.deprecated("Promise.defer","new Promise"),{promise:new A(g),resolve:M,reject:I}},l.notEnumerableProp(A,"_makeSelfResolutionError",r),e("./method")(A,g,y,a,k),e("./bind")(A,g,y,k),e("./cancel")(A,b,a,k),e("./direct_resolve")(A),e("./synchronous_inspection")(A),e("./join")(A,b,y,g,h,s),A.Promise=A,A.version="3.5.2",e("./map.js")(A,b,a,y,g,k),e("./call_get.js")(A),e("./using.js")(A,a,y,x,g,k),e("./timers.js")(A,g,k),e("./generators.js")(A,a,g,y,o,k),e("./nodeify.js")(A),e("./promisify.js")(A,g),e("./props.js")(A,b,y,a),e("./race.js")(A,g,y,a),e("./reduce.js")(A,b,a,y,g,k),e("./settle.js")(A,b,k),e("./some.js")(A,b,a),e("./filter.js")(A,g),e("./each.js")(A,g),e("./any.js")(A),l.toFastProperties(A),l.toFastProperties(A.prototype),R({a:1}),R({b:2}),R({c:3}),R(1),R(function(){}),R(void 0),R(!1),R(new A(g)),k.setBounds(f.firstLineError,l.lastLineError),A}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,a){var o=t("./util");o.isArray;function s(t){var r=this._promise=new e(n);t instanceof e&&r._propagateFrom(t,3),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return o.inherits(s,a),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(n,a){var s=r(this._values,this._promise);if(s instanceof e){var u=(s=s._target())._bitField;if(this._values=s,0==(50397184&u))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,a);if(0==(33554432&u))return 0!=(16777216&u)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=o.asArray(s)))0!==s.length?this._iterate(s):-5===a?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(a));else{var l=i("expecting an array or an iterable object but got "+o.classString(s)).reason();this._promise._rejectCallback(l,!1)}},s.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,a=!1,o=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n=this._length){var n;if(this._isMap)n=function(t){for(var e=new a,n=t.length/2|0,r=0;r>1},e.prototype.props=function(){return f(this)},e.props=function(t){return f(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t){this._capacity=t,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseFulfilled=function(t,e){var n=new i;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},a.prototype._promiseRejected=function(t,e){var n=new i;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new a(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){var i=t("./util"),a=t("./errors").RangeError,o=t("./errors").AggregateError,s=i.isArray,u={};function l(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function c(t,e){if((0|e)!==e||e<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new l(t),i=n.promise();return n.setHowMany(e),n.init(),i}i.inherits(l,n),l.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=s(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},l.prototype.init=function(){this._initialized=!0,this._init()},l.prototype.setUnwrap=function(){this._unwrap=!0},l.prototype.howMany=function(){return this._howMany},l.prototype.setHowMany=function(t){this._howMany=t},l.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},l.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},l.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(u),this._checkOutcome())},l.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new o,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},l.prototype._fulfilled=function(){return this._totalResolved},l.prototype._rejected=function(){return this._values.length-this.length()},l.prototype._addRejected=function(t){this._values.push(t)},l.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},l.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},l.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},l.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return c(t,e)},e.prototype.some=function(t){return c(this,t)},e._SomePromiseArray=l}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},a=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},o=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return o.call(this._target())},t.prototype.isRejected=function(){return a.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){var r=t("./util"),i=r.errorObj,a=r.isObject;var o={}.hasOwnProperty;return function(t,s){if(a(t)){if(t instanceof e)return t;var u=function(t){try{return function(t){return t.then}(t)}catch(t){return i.e=t,i}}(t);if(u===i){s&&s._pushContext();var l=e.reject(u.e);return s&&s._popContext(),l}if("function"==typeof u)return function(t){try{return o.call(t,"_promise0")}catch(t){return!1}}(t)?(l=new e(n),t._then(l._fulfill,l._reject,void 0,l,null),l):function(t,a,o){var s=new e(n),u=s;o&&o._pushContext(),s._captureStackTrace(),o&&o._popContext();var l=!0,c=r.tryCatch(a).call(t,function(t){s&&(s._resolveCallback(t),s=null)},function(t){s&&(s._rejectCallback(t,l,!0),s=null)});return l=!1,s&&c===i&&(s._rejectCallback(c.e,!0,!0),s=null),u}(t,u,s)}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){var i=t("./util"),a=e.TimeoutError;function o(t){this.handle=t}o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(t){return u(+this).thenReturn(t)},u=e.delay=function(t,i){var a,u;return void 0!==i?(a=e.resolve(i)._then(s,null,null,t,void 0),r.cancellation()&&i instanceof e&&a._setOnCancel(i)):(a=new e(n),u=setTimeout(function(){a._fulfill()},+t),r.cancellation()&&a._setOnCancel(new o(u)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};e.prototype.delay=function(t){return u(t,this)};function l(t){return clearTimeout(this.handle),t}function c(t){throw clearTimeout(this.handle),t}e.prototype.timeout=function(t,e){var n,s;t=+t;var u=new o(setTimeout(function(){n.isPending()&&function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new a("operation timed out"):new a(e),i.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()}(n,e,s)},t));return r.cancellation()?(s=this.then(),(n=s._then(l,c,void 0,u,void 0))._setOnCancel(u)):n=this._then(l,c,void 0,u,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,a,o){var s=t("./util"),u=t("./errors").TypeError,l=t("./util").inherits,c=s.errorObj,f=s.tryCatch,h={};function p(t){setTimeout(function(){throw t},0)}function d(t,n){var i=0,o=t.length,s=new e(a);return function a(){if(i>=o)return s._fulfill();var u=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(u instanceof e&&u._isDisposable()){try{u=r(u._getDisposer().tryDispose(n),t.promise)}catch(t){return p(t)}if(u instanceof e)return u._then(a,p,null,null,null)}a()}(),s}function v(t,e,n){this._data=t,this._promise=e,this._context=n}function g(t,e,n){this.constructor$(t,e,n)}function m(t){return v.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function _(t){this.length=t,this.promise=null,this[t-1]=null}v.prototype.data=function(){return this._data},v.prototype.promise=function(){return this._promise},v.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},v.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==h?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},v.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},l(g,v),g.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},_.prototype._resultCancelled=function(){for(var t=this.length,n=0;n0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new g(t,this,i());throw new u}}},{"./errors":12,"./util":36}],36:[function(e,n,i){"use strict";var a=e("./es5"),o="undefined"==typeof navigator,s={e:{}},u,l="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:void 0!==this?this:null;function c(){try{var t=u;return u=null,t.apply(this,arguments)}catch(t){return s.e=t,s}}function f(t){return u=t,c}var h=function(t,e){var n={}.hasOwnProperty;function r(){for(var r in this.constructor=t,this.constructor$=e,e.prototype)n.call(e.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=e.prototype[r])}return r.prototype=e.prototype,t.prototype=new r,t.prototype};function p(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function d(t){return"function"==typeof t||"object"==typeof t&&null!==t}function v(t){return p(t)?new Error(T(t)):t}function g(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;n1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=w.test(t+"")&&a.names(t).length>0;if(n||r||i)return!0}return!1}catch(t){return!1}}function k(t){function e(){}e.prototype=t;var n=new e;function r(){return typeof n.foo}return r(),r(),t}var E=/^[a-z$_][a-z$_0-9]*$/i;function S(t){return E.test(t)}function j(t,e,n){for(var r=new Array(t),i=0;i10||V[0]>0),q.isNode&&q.toFastProperties(t);try{throw new Error}catch(t){q.lastLineError=t}n.exports=q},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{_process:117,timers:142}],4:[function(t,e,n){},{}],5:[function(t,e,n){(function(n){var r=t("tty"),i=t("./lib/encode"),a=t("stream").Stream,o=e.exports=function(){var t=null;function e(e){if(t)throw new Error("multiple inputs specified");t=e}var i=null;function a(t){if(i)throw new Error("multiple outputs specified");i=t}for(var o=0;o0&&this.down(e),t>0?this.right(t):t<0&&this.left(-t),this},s.prototype.up=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"A")),this},s.prototype.down=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"B")),this},s.prototype.right=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"C")),this},s.prototype.left=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"D")),this},s.prototype.column=function(t){return this.write(i("["+Math.floor(t)+"G")),this},s.prototype.push=function(t){return this.write(i(t?"7":"[s")),this},s.prototype.pop=function(t){return this.write(i(t?"8":"[u")),this},s.prototype.erase=function(t){return"end"===t||"$"===t?this.write(i("[K")):"start"===t||"^"===t?this.write(i("[1K")):"line"===t?this.write(i("[2K")):"down"===t?this.write(i("[J")):"up"===t?this.write(i("[1J")):"screen"===t?this.write(i("[1J")):this.emit("error",new Error("Unknown erase type: "+t)),this},s.prototype.display=function(t){var e={reset:0,bright:1,dim:2,underscore:4,blink:5,reverse:7,hidden:8}[t];return void 0===e&&this.emit("error",new Error("Unknown attribute: "+t)),this.write(i("["+e+"m")),this},s.prototype.foreground=function(t){if("number"==typeof t)(t<0||t>=256)&&this.emit("error",new Error("Color out of range: "+t)),this.write(i("[38;5;"+t+"m"));else{var e={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}[t.toLowerCase()];e||this.emit("error",new Error("Unknown color: "+t)),this.write(i("["+e+"m"))}return this},s.prototype.background=function(t){if("number"==typeof t)(t<0||t>=256)&&this.emit("error",new Error("Color out of range: "+t)),this.write(i("[48;5;"+t+"m"));else{var e={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47}[t.toLowerCase()];e||this.emit("error",new Error("Unknown color: "+t)),this.write(i("["+e+"m"))}return this},s.prototype.cursor=function(t){return this.write(i(t?"[?25h":"[?25l")),this};var u=o.extractCodes=function(t){for(var e=[],n=-1,r=0;r=0&&e.push(t.slice(n,r)),n=r):n>=0&&r===t.length-1&&e.push(t.slice(n));return e}}).call(this,t("_process"))},{"./lib/encode":6,_process:117,stream:139,tty:143}],6:[function(t,e,n){(function(t){var n=(e.exports=function(e){return new t([27].concat(function t(e){return"string"==typeof e?e.split("").map(n):Array.isArray(e)?e.reduce(function(e,n){return e.concat(t(n))},[]):void 0}(e)))}).ord=function(t){return t.charCodeAt(0)}}).call(this,t("buffer").Buffer)},{buffer:47}],7:[function(t,e,n){(function(n){"use strict";var r=t("readable-stream").Readable,i=t("util");function a(t,e){if(!(this instanceof a))return new a(t,e);r.call(this,e),null!==t&&void 0!==t||(t=String(t)),this._obj=t}e.exports=a,i.inherits(a,r),a.prototype._read=function(t){var e=this._obj;"string"==typeof e?this.push(new n(e)):n.isBuffer(e)?this.push(e):this.push(new n(JSON.stringify(e))),this.push(null)}}).call(this,t("buffer").Buffer)},{buffer:47,"readable-stream":13,util:150}],8:[function(t,e,n){(function(n){e.exports=s;var r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e},i=t("core-util-is");i.inherits=t("inherits");var a=t("./_stream_readable"),o=t("./_stream_writable");function s(t){if(!(this instanceof s))return new s(t);a.call(this,t),o.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",u)}function u(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}i.inherits(s,a),function(t,e){for(var n=0,r=t.length;n0?d(t):b(t)}(t,e);else if(e.objectMode||r&&r.length>0)if(e.ended&&!o){var u=new Error("stream.push() after EOF");t.emit("error",u)}else if(e.endEmitted&&o){u=new Error("stream.unshift() after end event");t.emit("error",u)}else!e.decoder||o||a||(r=e.decoder.write(r)),e.length+=e.objectMode?1:r.length,o?e.buffer.unshift(r):(e.reading=!1,e.buffer.push(r)),e.needReadable&&d(t),function(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(function(){!function(t,e){var n=e.length;for(;!e.reading&&!e.flowing&&!e.ended&&e.lengthe.highWaterMark&&(e.highWaterMark=function(t){if(t>=h)t=h;else{t--;for(var e=1;e<32;e<<=1)t|=t>>e;t++}return t}(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function d(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,e.sync?n.nextTick(function(){v(t)}):v(t))}function v(t){t.emit("readable")}function g(t){var e,n=t._readableState;function r(t,r,i){!1===t.write(e)&&n.awaitDrain++}for(n.awaitDrain=0;n.pipesCount&&null!==(e=t.read());)if(1===n.pipesCount?r(n.pipes):w(n.pipes,r),t.emit("data",e),n.awaitDrain>0)return;if(0===n.pipesCount)return n.flowing=!1,void(a.listenerCount(t,"data")>0&&_(t));n.ranOut=!0}function m(){this._readableState.ranOut&&(this._readableState.ranOut=!1,g(this))}function _(t,e){if(t._readableState.flowing)throw new Error("Cannot switch to old mode now.");var r=e||!1,i=!1;t.readable=!0,t.pipe=s.prototype.pipe,t.on=t.addListener=s.prototype.on,t.on("readable",function(){var e;for(i=!0;!r&&null!==(e=t.read());)t.emit("data",e);null===e&&(i=!1,t._readableState.needReadable=!0)}),t.pause=function(){r=!0,this.emit("pause")},t.resume=function(){r=!1,i?n.nextTick(function(){t.emit("readable")}):this.read(0),this.emit("resume")},t.emit("readable")}function y(t,e){var n,r=e.buffer,a=e.length,o=!!e.decoder,s=!!e.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!t||t>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(t0)throw new Error("endReadable called on non-empty stream");!e.endEmitted&&e.calledRead&&(e.ended=!0,n.nextTick(function(){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function w(t,e){for(var n=0,r=t.length;n0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return d(this),null;if(0===(t=p(t,e))&&e.ended)return n=null,e.length>0&&e.decoder&&(n=y(t,e),e.length-=n.length),0===e.length&&b(this),n;var i=e.needReadable;return e.length-t<=e.highWaterMark&&(i=!0),(e.ended||e.reading)&&(i=!1),i&&(e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1),i&&!e.reading&&(t=p(r,e)),null===(n=t>0?y(t,e):null)&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),e.ended&&!e.endEmitted&&0===e.length&&b(this),n},c.prototype._read=function(t){this.emit("error",new Error("not implemented"))},c.prototype.pipe=function(t,e){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1;var s=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?l:f;function u(t){t===i&&f()}function l(){t.end()}o.endEmitted?n.nextTick(s):i.once("end",s),t.on("unpipe",u);var c=function(t){return function(){var e=t._readableState;e.awaitDrain--,0===e.awaitDrain&&g(t)}}(i);function f(){t.removeListener("close",p),t.removeListener("finish",d),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",u),i.removeListener("end",l),i.removeListener("end",f),t._writableState&&!t._writableState.needDrain||c()}function h(e){v(),t.removeListener("error",h),0===a.listenerCount(t,"error")&&t.emit("error",e)}function p(){t.removeListener("finish",d),v()}function d(){t.removeListener("close",p),v()}function v(){i.unpipe(t)}return t.on("drain",c),t._events&&t._events.error?r(t._events.error)?t._events.error.unshift(h):t._events.error=[h,t._events.error]:t.on("error",h),t.once("close",p),t.once("finish",d),t.emit("pipe",i),o.flowing||(this.on("readable",m),o.flowing=!0,n.nextTick(function(){g(i)})),t},c.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,this.removeListener("readable",m),e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,this.removeListener("readable",m),e.flowing=!1;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),in.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,r(e)}},{"./lib/thunk.js":17}],16:[function(t,e,n){"use strict";var r=t("uniq");function i(t,e,n){var r,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,u=[],l=[],c=0,f=0;for(r=0;r0&&u.push("var "+l.join(",")),r=a-1;r>=0;--r)c=t[r],u.push(["for(i",r,"=0;i",r,"0&&u.push(["index[",f,"]-=s",f].join("")),u.push(["++index[",c,"]"].join(""))),u.push("}")}return u.join("\n")}function a(t,e,n){for(var r=t.body,i=[],a=[],o=0;o0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){var y=new Array(n);for(u=0;u0&&m.push("var "+_.join(",")),u=0;u3&&m.push(a(t.pre,t,s));var k=a(t.body,t,s),E=function(t){for(var e=0,n=t[0].length;e0,l=[],c=0;c0;){"].join("")),l.push(["if(j",c,"<",s,"){"].join("")),l.push(["s",e[c],"=j",c].join("")),l.push(["j",c,"=0"].join("")),l.push(["}else{s",e[c],"=",s].join("")),l.push(["j",c,"-=",s,"}"].join("")),u&&l.push(["index[",e[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+m.join("\n")+"\n----------");var S=[t.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",E,function(t){for(var e=new Array(t.length),n=!0,r=0;r0&&(n=n&&e[r]===e[r-1])}return n?e[0]:e.join("")}(s)].join("");return new Function(["function ",S,"(",g.join(","),"){",m.join("\n"),"} return ",S].join(""))()}},{uniq:146}],17:[function(t,e,n){"use strict";var r=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],n=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],u=[],l=[],c=0;c0&&(u.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),l.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}for(t.arrayArgs.length>1&&(e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),c=0;c0)return function(t,e){var n,r;for(n=new Array(t),r=0;r 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],24:[function(t,e,n){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat correctionRadius = 0.5;\n\tfloat distance = sqrt(vPosition.x * vPosition.x + vPosition.y * vPosition.y) / correctionRadius;\n\tfloat theta = 1.0;\n\tif(distance != 0.0){\n\t\ttheta = atan(distance);\n\t}\n\tvec2 vMapping = theta * vPosition.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\t\t\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],25:[function(t,e,n){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 uLensS;\nuniform vec2 uLensF;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord * vec2(1.0, -1.0)/ 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat scale = uLensS.z;\n\tvec3 vPos = vPosition;\n\tfloat Fx = uLensF.x;\n\tfloat Fy = uLensF.y;\n\tvec2 vMapping = vPos.xy;\n\tvMapping.x = vMapping.x + ((pow(vPos.y, 2.0)/scale)*vPos.x/scale)*-Fx;\n\tvMapping.y = vMapping.y + ((pow(vPos.x, 2.0)/scale)*vPos.y/scale)*-Fy;\n\tvMapping = vMapping * uLensS.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping/scale);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t}\n\tgl_FragColor = texture;\n}\n"},{}],26:[function(t,e,n){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TODO insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],27:[function(t,e,n){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TOD insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],28:[function(t,e,n){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvoid main(void){\n\tvPosition = aVertexPosition;\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = vec4(vPosition,1.0);\n}\n"},{}],29:[function(t,e,n){(function(n,r){"use strict";var i=t("path"),a=t("ndarray"),o=t("omggif").GifReader,s=(t("ndarray-pack"),t("through"),t("data-uri-to-buffer"));function u(t,e){var n;try{n=new o(t)}catch(t){return void e(t)}if(n.numFrames()>0){var r=[n.numFrames(),n.height,n.width,4],i=new Uint8Array(r[0]*r[1]*r[2]*r[3]),s=a(i,r);try{for(var u=0;u=0&&(this.dispose=t)},u.prototype.setRepeat=function(t){this.repeat=t},u.prototype.setTransparent=function(t){this.transparent=t},u.prototype.analyzeImage=function(t){this.setImagePixels(this.removeAlphaChannel(t)),this.analyzePixels()},u.prototype.writeImageInfo=function(){this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.firstFrame=!1},u.prototype.outputImage=function(){this.writePixels()},u.prototype.addFrame=function(t){this.emit("frame#start"),this.analyzeImage(t),this.writeImageInfo(),this.outputImage(),this.emit("frame#stop")},u.prototype.finish=function(){this.emit("finish#start"),this.writeByte(59),this.emit("finish#stop")},u.prototype.setQuality=function(t){t<1&&(t=1),this.sample=t},u.prototype.writeHeader=function(){this.emit("writeHeader#start"),this.writeUTFBytes("GIF89a"),this.emit("writeHeader#stop")},u.prototype.analyzePixels=function(){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);var e=new a(this.pixels,this.sample);e.buildColormap(),this.colorTab=e.getColormap();for(var n=0,r=0;r>16,n=(65280&t)>>8,r=255&t,i=0,a=16777216,o=this.colorTab.length,s=0;s=0&&(e=7&dispose),e<<=2,this.writeByte(0|e|t),this.writeShort(this.delay),this.writeByte(this.transIndex),this.writeByte(0)},u.prototype.writeImageDesc=function(){this.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.writeByte(0):this.writeByte(128|this.palSize)},u.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.writeByte(240|this.palSize),this.writeByte(0),this.writeByte(0)},u.prototype.writeNetscapeExt=function(){this.writeByte(33),this.writeByte(255),this.writeByte(11),this.writeUTFBytes("NETSCAPE2.0"),this.writeByte(3),this.writeByte(1),this.writeShort(this.repeat),this.writeByte(0)},u.prototype.writePalette=function(){this.writeBytes(this.colorTab);for(var t=768-this.colorTab.length,e=0;e>8&255)},u.prototype.writePixels=function(){new o(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this)},u.prototype.stream=function(){return this},u.ByteCapacitor=s,e.exports=u}).call(this,t("buffer").Buffer)},{"./LZWEncoder.js":32,"./TypedNeuQuant.js":33,assert:40,buffer:47,events:48,"readable-stream":39,util:150}],32:[function(t,e,n){var r=-1,i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];e.exports=function(t,e,n,s){var u,l,c,f,h,p,d,v,g,m=Math.max(2,s),_=new Uint8Array(256),y=new Int32Array(a),b=new Int32Array(a),w=0,x=0,k=!1;function E(t,e){_[l++]=t,l>=254&&T(e)}function S(t){j(a),x=v+2,k=!0,M(v,t)}function j(t){for(var e=0;e0&&(t.writeByte(l),t.writeBytes(_,0,l),l=0)}function C(t){return(1<0?u|=t<=8;)E(255&u,e),u>>=8,w-=8;if((x>c||k)&&(k?(c=C(p=d),k=!1):c=++p==i?1<0;)E(255&u,e),u>>=8,w-=8;T(e)}}this.encode=function(n){n.writeByte(m),f=t*e,h=0,function(t,e){var n,o,s,u,f,h,m;for(k=!1,c=C(p=d=t),g=1+(v=1<=0){f=h-s,0===s&&(f=1);do{if((s-=f)<0&&(s+=h),y[s]===n){u=b[s];continue t}}while(y[s]>=0)}M(u,e),u=o,x<1<>c,h=u<>3)*(1<l;)u=T[p++],fl&&((s=n[h--])[0]-=u*(s[0]-r)/_,s[1]-=u*(s[1]-a)/_,s[2]-=u*(s[2]-o)/_)}function M(t,e,r){var a,u,p,d,v,g=~(1<<31),m=g,_=-1,y=_;for(a=0;a>s-o))>c,j[a]-=v,S[a]+=v<>3),t=0;t>p;for(j<=1&&(j=0),n=0;n=c&&(I-=c),n++,0===_&&(_=1),n%_==0)for(E-=E/f,(j=(S-=S/v)>>p)<=1&&(j=0),l=0;l>=o,n[t][1]>>=o,n[t][2]>>=o,n[t][3]=t}(),function(){var t,e,r,o,s,u,l=0,c=0;for(t=0;t>1,e=l+1;e>1,e=l+1;e<256;e++)E[e]=a}()},this.getColormap=function(){for(var t=[],e=[],r=0;r=0;)c=u?c=i:(c++,s<0&&(s=-s),(a=o[0]-t)<0&&(a=-a),(s+=a)=0&&((s=e-(o=n[f])[1])>=u?f=-1:(f--,s<0&&(s=-s),(a=o[0]-t)<0&&(a=-a),(s+=a)0)if(e.ended&&!a){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&a){s=new Error("stream.unshift() after end event");t.emit("error",s)}else!e.decoder||a||i||(r=e.decoder.write(r)),a||(e.reading=!1),e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,a?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&v(t)),function(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(function(){!function(t,e){var n=e.length;for(;!e.reading&&!e.flowing&&!e.ended&&e.lengthe.highWaterMark&&(e.highWaterMark=function(t){if(t>=p)t=p;else{t--;for(var e=1;e<32;e<<=1)t|=t>>e;t++}return t}(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function v(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(function(){g(t)}):g(t))}function g(t){l("emit readable"),t.emit("readable"),m(t)}function m(t){var e=t._readableState;if(l("flow",e.flowing),e.flowing)do{var n=t.read()}while(null!==n&&e.flowing)}function _(t,e){var n,r=e.buffer,a=e.length,o=!!e.decoder,s=!!e.objectMode;if(0===r.length)return null;if(0===a)n=null;else if(s)n=r.shift();else if(!t||t>=a)n=o?r.join(""):i.concat(r,a),r.length=0;else{if(t0)throw new Error("endReadable called on non-empty stream");e.endEmitted||(e.ended=!0,n.nextTick(function(){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}))}f.prototype.read=function(t){l("read",t);var e=this._readableState,n=t;if((!u.isNumber(t)||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?y(this):v(this),null;if(0===(t=d(t,e))&&e.ended)return 0===e.length&&y(this),null;var r,i=e.needReadable;return l("need readable",i),(0===e.length||e.length-t0?_(t,e):null,u.isNull(r)&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),n!==t&&e.ended&&0===e.length&&y(this),u.isNull(r)||this.emit("data",r),r},f.prototype._read=function(t){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(t,e){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,e);var s=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?c:h;function u(t){l("onunpipe"),t===i&&h()}function c(){l("onend"),t.end()}o.endEmitted?n.nextTick(s):i.once("end",s),t.on("unpipe",u);var f=function(t){return function(){var e=t._readableState;l("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a.listenerCount(t,"data")&&(e.flowing=!0,m(t))}}(i);function h(){l("cleanup"),t.removeListener("close",v),t.removeListener("finish",g),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",u),i.removeListener("end",c),i.removeListener("end",h),i.removeListener("data",p),!o.awaitDrain||t._writableState&&!t._writableState.needDrain||f()}function p(e){l("ondata"),!1===t.write(e)&&(l("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,i.pause())}function d(e){l("onerror",e),_(),t.removeListener("error",d),0===a.listenerCount(t,"error")&&t.emit("error",e)}function v(){t.removeListener("finish",g),_()}function g(){l("onfinish"),t.removeListener("close",v),_()}function _(){l("unpipe"),i.unpipe(t)}return t.on("drain",f),i.on("data",p),t._events&&t._events.error?r(t._events.error)?t._events.error.unshift(d):t._events.error=[d,t._events.error]:t.on("error",d),t.once("close",v),t.once("finish",g),t.emit("pipe",i),o.flowing||(l("pipe resume"),i.resume()),t},f.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i1){for(var n=[],r=0;r=0;l--)if(c[l]!==f[l])return!1;for(l=c.length-1;l>=0;l--)if(u=c[l],!_(t[u],e[u],n,r))return!1;return!0}(t,e,n,o))}return n?t===e:t==e}function y(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function b(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&g(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!t&&a.isError(i),u=!t&&i&&!n;if((s&&o&&b(i,n)||u)&&g(i,n,"Got unwanted exception"+r),t&&i&&n&&!b(i,n)||!t&&i)throw i}f.AssertionError=function(t){var e;this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=d(v((e=this).actual),128)+" "+e.operator+" "+d(v(e.expected),128),this.generatedMessage=!0);var n=t.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,a=p(n),o=i.indexOf("\n"+a);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}},a.inherits(f.AssertionError,Error),f.fail=g,f.ok=m,f.equal=function(t,e,n){t!=e&&g(t,e,n,"==",f.equal)},f.notEqual=function(t,e,n){t==e&&g(t,e,n,"!=",f.notEqual)},f.deepEqual=function(t,e,n){_(t,e,!1)||g(t,e,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(t,e,n){_(t,e,!0)||g(t,e,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(t,e,n){_(t,e,!1)&&g(t,e,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function t(e,n,r){_(e,n,!0)&&g(e,n,r,"notDeepStrictEqual",t)},f.strictEqual=function(t,e,n){t!==e&&g(t,e,n,"===",f.strictEqual)},f.notStrictEqual=function(t,e,n){t===e&&g(t,e,n,"!==",f.notStrictEqual)},f.throws=function(t,e,n){w(!0,t,e,n)},f.doesNotThrow=function(t,e,n){w(!1,t,e,n)},f.ifError=function(t){if(t)throw t};var x=Object.keys||function(t){var e=[];for(var n in t)o.call(t,n)&&e.push(n);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":43}],41:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],42:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],43:[function(t,e,n){(function(e,r){var i=/%[sdj%]/g;n.format=function(t){if(!m(t)){for(var e=[],n=0;n=a)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(e)?r.showHidden=e:e&&n._extend(r,e),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,t,r.depth)}function u(t,e){var n=s.styles[e];return n?"["+s.colors[n][0]+"m"+t+"["+s.colors[n][1]+"m":t}function l(t,e){return t}function c(t,e,r){if(t.customInspect&&e&&k(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return m(i)||(i=c(t,i,r)),i}var a=function(t,e){if(_(e))return t.stylize("undefined","undefined");if(m(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(g(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(v(e))return t.stylize("null","null")}(t,e);if(a)return a;var o=Object.keys(e),s=function(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),x(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(k(e)){var u=e.name?": "+e.name:"";return t.stylize("[Function"+u+"]","special")}if(y(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(w(e))return t.stylize(Date.prototype.toString.call(e),"date");if(x(e))return f(e)}var l,b="",E=!1,S=["{","}"];(p(e)&&(E=!0,S=["[","]"]),k(e))&&(b=" [Function"+(e.name?": "+e.name:"")+"]");return y(e)&&(b=" "+RegExp.prototype.toString.call(e)),w(e)&&(b=" "+Date.prototype.toUTCString.call(e)),x(e)&&(b=" "+f(e)),0!==o.length||E&&0!=e.length?r<0?y(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=E?function(t,e,n,r,i){for(var a=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(l,b,S)):S[0]+b+S[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,r,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),T(r,i)||(o="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=v(n)?c(t,u.value,null):c(t,u.value,n-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n")):s=t.stylize("[Circular]","special")),_(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function v(t){return null===t}function g(t){return"number"==typeof t}function m(t){return"string"==typeof t}function _(t){return void 0===t}function y(t){return b(t)&&"[object RegExp]"===E(t)}function b(t){return"object"==typeof t&&null!==t}function w(t){return b(t)&&"[object Date]"===E(t)}function x(t){return b(t)&&("[object Error]"===E(t)||t instanceof Error)}function k(t){return"function"==typeof t}function E(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}n.debuglog=function(t){if(_(a)&&(a=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(a)){var r=e.pid;o[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else o[t]=function(){};return o[t]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=v,n.isNullOrUndefined=function(t){return null==t},n.isNumber=g,n.isString=m,n.isSymbol=function(t){return"symbol"==typeof t},n.isUndefined=_,n.isRegExp=y,n.isObject=b,n.isDate=w,n.isError=x,n.isFunction=k,n.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},n.isBuffer=t("./support/isBuffer");var j=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}n.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":"),[t.getDate(),j[t.getMonth()],e].join(" ")),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!b(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":42,_process:117,inherits:41}],44:[function(t,e,n){(function(e,r){"use strict";var i=t("assert"),a=t("pako/lib/zlib/zstream"),o=t("pako/lib/zlib/deflate.js"),s=t("pako/lib/zlib/inflate.js"),u=t("pako/lib/zlib/constants");for(var l in u)n[l]=u[l];n.NONE=0,n.DEFLATE=1,n.INFLATE=2,n.GZIP=3,n.GUNZIP=4,n.DEFLATERAW=5,n.INFLATERAW=6,n.UNZIP=7;function c(t){if("number"!=typeof t||tn.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}c.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=n.UNZIP),this.mode===n.DEFLATE||this.mode===n.GZIP||this.mode===n.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==n.INFLATE&&this.mode!==n.GUNZIP&&this.mode!==n.INFLATERAW&&this.mode!==n.UNZIP||s.inflateEnd(this.strm),this.mode=n.NONE,this.dictionary=null)},c.prototype.write=function(t,e,n,r,i,a,o){return this._write(!0,t,e,n,r,i,a,o)},c.prototype.writeSync=function(t,e,n,r,i,a,o){return this._write(!1,t,e,n,r,i,a,o)},c.prototype._write=function(t,a,o,s,u,l,c,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==n.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==n.Z_NO_FLUSH&&a!==n.Z_PARTIAL_FLUSH&&a!==n.Z_SYNC_FLUSH&&a!==n.Z_FULL_FLUSH&&a!==n.Z_FINISH&&a!==n.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=r.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=l,this.strm.next_out=c,this.flush=a,!t)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return e.nextTick(function(){h._process(),h._after()}),this},c.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},c.prototype._process=function(){var t=null;switch(this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case n.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=n.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=n.GUNZIP):this.mode=n.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===n.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===n.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===n.Z_DATA_ERROR&&(this.err=n.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===n.GUNZIP&&this.err===n.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},c.prototype._checkError=function(){switch(this.err){case n.Z_OK:case n.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===n.Z_FINISH)return this._error("unexpected end of file"),!1;break;case n.Z_STREAM_END:break;case n.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},c.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},c.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},c.prototype.init=function(t,e,r,a,o){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(t>=8&&t<=15,"invalid windowBits"),i(e>=-1&&e<=9,"invalid compression level"),i(r>=1&&r<=9,"invalid memlevel"),i(a===n.Z_FILTERED||a===n.Z_HUFFMAN_ONLY||a===n.Z_RLE||a===n.Z_FIXED||a===n.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(e,t,r,a,o),this._setDictionary()},c.prototype.params=function(){throw new Error("deflateParams Not supported")},c.prototype.reset=function(){this._reset(),this._setDictionary()},c.prototype._init=function(t,e,r,i,u){switch(this.level=t,this.windowBits=e,this.memLevel=r,this.strategy=i,this.flush=n.Z_NO_FLUSH,this.err=n.Z_OK,this.mode!==n.GZIP&&this.mode!==n.GUNZIP||(this.windowBits+=16),this.mode===n.UNZIP&&(this.windowBits+=32),this.mode!==n.DEFLATERAW&&this.mode!==n.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case n.DEFLATE:case n.GZIP:case n.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,n.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case n.INFLATE:case n.GUNZIP:case n.INFLATERAW:case n.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==n.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},c.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==n.Z_OK&&this._error("Failed to set dictionary")}},c.prototype._reset=function(){switch(this.err=n.Z_OK,this.mode){case n.DEFLATE:case n.DEFLATERAW:case n.GZIP:this.err=o.deflateReset(this.strm);break;case n.INFLATE:case n.INFLATERAW:case n.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==n.Z_OK&&this._error("Failed to reset stream")},n.Zlib=c}).call(this,t("_process"),t("buffer").Buffer)},{_process:117,assert:40,buffer:47,"pako/lib/zlib/constants":51,"pako/lib/zlib/deflate.js":53,"pako/lib/zlib/inflate.js":55,"pako/lib/zlib/zstream":59}],45:[function(t,e,n){(function(e){"use strict";var r=t("buffer").Buffer,i=t("stream").Transform,a=t("./binding"),o=t("util"),s=t("assert").ok,u=t("buffer").kMaxLength,l="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var c=Object.keys(a),f=0;f=u?o=new RangeError(l):e=r.concat(i,a),i=[],t.close(),n(o,e)}t.on("error",function(e){t.removeListener("end",s),t.removeListener("readable",o),n(e)}),t.on("end",s),t.end(e),o()}function _(t,e){if("string"==typeof e&&(e=r.from(e)),!r.isBuffer(e))throw new TypeError("Not a string or buffer");var n=t._finishFlushFlag;return t._processChunk(e,n)}function y(t){if(!(this instanceof y))return new y(t);T.call(this,t,a.DEFLATE)}function b(t){if(!(this instanceof b))return new b(t);T.call(this,t,a.INFLATE)}function w(t){if(!(this instanceof w))return new w(t);T.call(this,t,a.GZIP)}function x(t){if(!(this instanceof x))return new x(t);T.call(this,t,a.GUNZIP)}function k(t){if(!(this instanceof k))return new k(t);T.call(this,t,a.DEFLATERAW)}function E(t){if(!(this instanceof E))return new E(t);T.call(this,t,a.INFLATERAW)}function S(t){if(!(this instanceof S))return new S(t);T.call(this,t,a.UNZIP)}function j(t){return t===a.Z_NO_FLUSH||t===a.Z_PARTIAL_FLUSH||t===a.Z_SYNC_FLUSH||t===a.Z_FULL_FLUSH||t===a.Z_FINISH||t===a.Z_BLOCK}function T(t,e){var o=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||n.Z_DEFAULT_CHUNK,i.call(this,t),t.flush&&!j(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!j(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:a.Z_FINISH,t.chunkSize&&(t.chunkSizen.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBitsn.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.leveln.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLeveln.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=n.Z_FILTERED&&t.strategy!=n.Z_HUFFMAN_ONLY&&t.strategy!=n.Z_RLE&&t.strategy!=n.Z_FIXED&&t.strategy!=n.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!r.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(e);var s=this;this._hadError=!1,this._handle.onerror=function(t,e){C(s),s._hadError=!0;var r=new Error(t);r.errno=e,r.code=n.codes[e],s.emit("error",r)};var u=n.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(u=t.level);var l=n.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(l=t.strategy),this._handle.init(t.windowBits||n.Z_DEFAULT_WINDOWBITS,u,t.memLevel||n.Z_DEFAULT_MEMLEVEL,l,t.dictionary),this._buffer=r.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function C(t,n){n&&e.nextTick(n),t._handle&&(t._handle.close(),t._handle=null)}function A(t){t.emit("close")}Object.defineProperty(n,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),n.Deflate=y,n.Inflate=b,n.Gzip=w,n.Gunzip=x,n.DeflateRaw=k,n.InflateRaw=E,n.Unzip=S,n.createDeflate=function(t){return new y(t)},n.createInflate=function(t){return new b(t)},n.createDeflateRaw=function(t){return new k(t)},n.createInflateRaw=function(t){return new E(t)},n.createGzip=function(t){return new w(t)},n.createGunzip=function(t){return new x(t)},n.createUnzip=function(t){return new S(t)},n.deflate=function(t,e,n){return"function"==typeof e&&(n=e,e={}),m(new y(e),t,n)},n.deflateSync=function(t,e){return _(new y(e),t)},n.gzip=function(t,e,n){return"function"==typeof e&&(n=e,e={}),m(new w(e),t,n)},n.gzipSync=function(t,e){return _(new w(e),t)},n.deflateRaw=function(t,e,n){return"function"==typeof e&&(n=e,e={}),m(new k(e),t,n)},n.deflateRawSync=function(t,e){return _(new k(e),t)},n.unzip=function(t,e,n){return"function"==typeof e&&(n=e,e={}),m(new S(e),t,n)},n.unzipSync=function(t,e){return _(new S(e),t)},n.inflate=function(t,e,n){return"function"==typeof e&&(n=e,e={}),m(new b(e),t,n)},n.inflateSync=function(t,e){return _(new b(e),t)},n.gunzip=function(t,e,n){return"function"==typeof e&&(n=e,e={}),m(new x(e),t,n)},n.gunzipSync=function(t,e){return _(new x(e),t)},n.inflateRaw=function(t,e,n){return"function"==typeof e&&(n=e,e={}),m(new E(e),t,n)},n.inflateRawSync=function(t,e){return _(new E(e),t)},o.inherits(T,i),T.prototype.params=function(t,r,i){if(tn.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(r!=n.Z_FILTERED&&r!=n.Z_HUFFMAN_ONLY&&r!=n.Z_RLE&&r!=n.Z_FIXED&&r!=n.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==t||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,function(){s(o._handle,"zlib binding closed"),o._handle.params(t,r),o._hadError||(o._level=t,o._strategy=r,i&&i())})}else e.nextTick(i)},T.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},T.prototype._flush=function(t){this._transform(r.alloc(0),"",t)},T.prototype.flush=function(t,n){var i=this,o=this._writableState;("function"==typeof t||void 0===t&&!n)&&(n=t,t=a.Z_FULL_FLUSH),o.ended?n&&e.nextTick(n):o.ending?n&&this.once("end",n):o.needDrain?n&&this.once("drain",function(){return i.flush(t,n)}):(this._flushFlag=t,this.write(r.alloc(0),"",n))},T.prototype.close=function(t){C(this,t),e.nextTick(A,this)},T.prototype._transform=function(t,e,n){var i,o=this._writableState,s=(o.ending||o.ended)&&(!t||o.length===t.length);return null===t||r.isBuffer(t)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,t.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(t,i,n)):n(new Error("zlib binding closed")):n(new Error("invalid input"))},T.prototype._processChunk=function(t,e,n){var i=t&&t.length,a=this._chunkSize-this._offset,o=0,c=this,f="function"==typeof n;if(!f){var h,p=[],d=0;this.on("error",function(t){h=t}),s(this._handle,"zlib binding closed");do{var v=this._handle.writeSync(e,t,o,i,this._buffer,this._offset,a)}while(!this._hadError&&_(v[0],v[1]));if(this._hadError)throw h;if(d>=u)throw C(this),new RangeError(l);var g=r.concat(p,d);return C(this),g}s(this._handle,"zlib binding closed");var m=this._handle.write(e,t,o,i,this._buffer,this._offset,a);function _(u,l){if(this&&(this.buffer=null,this.callback=null),!c._hadError){var h=a-l;if(s(h>=0,"have should not go down"),h>0){var v=c._buffer.slice(c._offset,c._offset+h);c._offset+=h,f?c.push(v):(p.push(v),d+=v.length)}if((0===l||c._offset>=c._chunkSize)&&(a=c._chunkSize,c._offset=0,c._buffer=r.allocUnsafe(c._chunkSize)),0===l){if(o+=i-u,i=u,!f)return!0;var g=c._handle.write(e,t,o,i,c._buffer,c._offset,c._chunkSize);return g.callback=_,void(g.buffer=t)}if(!f)return!1;n()}}m.buffer=t,m.callback=_},o.inherits(y,T),o.inherits(b,T),o.inherits(w,T),o.inherits(x,T),o.inherits(k,T),o.inherits(E,T),o.inherits(S,T)}).call(this,t("_process"))},{"./binding":44,_process:117,assert:40,buffer:47,stream:139,util:150}],46:[function(t,e,n){arguments[4][4][0].apply(n,arguments)},{dup:4}],47:[function(t,e,n){"use strict";var r=t("base64-js"),i=t("ieee754");n.Buffer=s,n.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},n.INSPECT_MAX_BYTES=50;var a=2147483647;function o(t){if(t>a)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return u(t,e,n)}function u(t,e,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return N(t)?function(t,e,n){if(e<0||t.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(z(t)||N(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return P(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return D(t).length;default:if(r)return P(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function v(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){var a,o=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,h=0;hi&&(r=i):r=i;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(e,t.length-n),t,n,r)}function k(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function E(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=t[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,n);case"utf8":case"utf-8":return E(this,e,n);case"ascii":return j(this,e,n);case"latin1":case"binary":return T(this,e,n);case"base64":return k(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=n.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},s.prototype.compare=function(t,e,n,r,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,i>>>=0,this===t)return 0;for(var a=i-r,o=n-e,u=Math.min(a,o),l=this.slice(r,i),c=t.slice(e,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return y(this,t,e,n);case"latin1":case"binary":return b(this,t,e,n);case"base64":return w(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function j(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",a=e;an)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,r,i,a){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i,a){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(t,e,n,r,a){return e=+e,n>>>=0,a||R(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function B(t,e,n,r,a){return e=+e,n>>>=0,a||R(t,0,n,8),i.write(t,e,n,r,52,8),n+8}s.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||M(t,e,this.length);for(var r=this[t],i=1,a=0;++a>>=0,e>>>=0,n||M(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||M(t,e,this.length);for(var r=this[t],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||M(t,e,this.length);for(var r=e,i=1,a=this[t+--r];r>0&&(i*=256);)a+=this[t+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},s.prototype.readInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||M(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){t>>>=0,e||M(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||M(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||M(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||M(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||M(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e>>>=0,n>>>=0,r)||I(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[e]=255&t;++a>>=0,n>>>=0,r)||I(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+n},s.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);I(this,t,e,n,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);I(this,t,e,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--i)t[i+e]=this[i+n];else if(a<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(e-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function D(t){return r.toByteArray(function(t){if((t=t.trim().replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function N(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function z(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function q(t){return t!=t}},{"base64-js":1,ieee754:60}],48:[function(t,e,n){var r=Object.create||function(t){var e=function(){};return e.prototype=t,new e},i=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return n},a=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var s,u=10;try{var l={};Object.defineProperty&&Object.defineProperty(l,"x",{value:0}),s=0===l.x}catch(t){s=!1}function c(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,n,i){var a,o,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]):(o=t._events=r(null),t._eventsCount=0),s){if("function"==typeof s?s=o[e]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),!s.warned&&(a=c(t))&&a>0&&s.length>a){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else s=o[e]=n,++t._eventsCount;return t}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var u=new Error('Unhandled "error" event. ('+e+")");throw u.context=e,u}if(!(n=o[t]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:!function(t,e,n){if(e)t.call(n);else for(var r=t.length,i=g(t,r),a=0;a=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,a=o;break}if(a<0)return this;0===a?n.shift():function(t,e){for(var n=e,r=n+1,i=t.length;r=0;a--)this.removeListener(t,e[a]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):v.call(t,e)},o.prototype.listenerCount=v,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],49:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}n.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(t[r]=n[r])}}return t},n.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var a={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var a=0;a>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{a=a+(i=i+e[r++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0}},{}],51:[function(t,e,n){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],52:[function(t,e,n){"use strict";var r=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,i){var a=r,o=i+n;t^=-1;for(var s=i;s>>8^a[255&(t^e[s])];return-1^t}},{}],53:[function(t,e,n){"use strict";var r,i=t("../utils/common"),a=t("./trees"),o=t("./adler32"),s=t("./crc32"),u=t("./messages"),l=0,c=1,f=3,h=4,p=5,d=0,v=1,g=-2,m=-3,_=-5,y=-1,b=1,w=2,x=3,k=4,E=0,S=2,j=8,T=9,C=15,A=8,M=286,I=30,R=19,L=2*M+1,B=15,F=3,O=258,P=O+F+1,D=32,U=42,N=69,z=73,q=91,V=103,G=113,H=666,W=1,Z=2,Y=3,X=4,$=3;function J(t,e){return t.msg=u[e],e}function Q(t){return(t<<1)-(t>4?9:0)}function K(t){for(var e=t.length;--e>=0;)t[e]=0}function tt(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function et(t,e){a._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,tt(t.strm)}function nt(t,e){t.pending_buf[t.pending++]=e}function rt(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function it(t,e){var n,r,i=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-P?t.strstart-(t.w_size-P):0,l=t.window,c=t.w_mask,f=t.prev,h=t.strstart+O,p=l[a+o-1],d=l[a+o];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(n=e)+o]===d&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do{}while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ao){if(t.match_start=e,o=r,r>=s)break;p=l[a+o-1],d=l[a+o]}}}while((e=f[e&c])>u&&0!=--i);return o<=t.lookahead?o:t.lookahead}function at(t){var e,n,r,a,u,l,c,f,h,p,d=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=d+(d-P)){i.arraySet(t.window,t.window,d,d,0),t.match_start-=d,t.strstart-=d,t.block_start-=d,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=d?r-d:0}while(--n);e=n=d;do{r=t.prev[--e],t.prev[e]=r>=d?r-d:0}while(--n);a+=d}if(0===t.strm.avail_in)break;if(l=t.strm,c=t.window,f=t.strstart+t.lookahead,h=a,p=void 0,(p=l.avail_in)>h&&(p=h),n=0===p?0:(l.avail_in-=p,i.arraySet(c,l.input,l.next_in,p,f),1===l.state.wrap?l.adler=o(l.adler,c,p,f):2===l.state.wrap&&(l.adler=s(l.adler,c,p,f)),l.next_in+=p,l.total_in+=p,p),t.lookahead+=n,t.lookahead+t.insert>=F)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<=F&&(t.ins_h=(t.ins_h<=F)if(r=a._tr_tally(t,t.strstart-t.match_start,t.match_length-F),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=F){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=F&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=F-1)),t.prev_length>=F&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-F,r=a._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-F),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<15&&(s=2,r-=16),a<1||a>T||n!==j||r<8||r>15||e<0||e>9||o<0||o>k)return J(t,g);8===r&&(r=9);var u=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=j,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*L),this.dyn_dtree=new i.Buf16(2*(2*I+1)),this.bl_tree=new i.Buf16(2*(2*R+1)),K(this.dyn_ltree),K(this.dyn_dtree),K(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(B+1),this.heap=new i.Buf16(2*M+1),K(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*M+1),K(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(at(t),0===t.lookahead&&e===l)return W;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,et(t,!1),0===t.strm.avail_out))return W;if(t.strstart-t.block_start>=t.w_size-P&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===h?(et(t,!0),0===t.strm.avail_out?Y:X):(t.strstart>t.block_start&&(et(t,!1),t.strm.avail_out),W)}),new ut(4,4,8,4,ot),new ut(4,5,16,8,ot),new ut(4,6,32,32,ot),new ut(4,4,16,16,st),new ut(8,16,32,32,st),new ut(8,16,128,128,st),new ut(8,32,128,256,st),new ut(32,128,258,1024,st),new ut(32,258,258,4096,st)],n.deflateInit=function(t,e){return ft(t,e,j,C,A,E)},n.deflateInit2=ft,n.deflateReset=ct,n.deflateResetKeep=lt,n.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?g:(t.state.gzhead=e,d):g},n.deflate=function(t,e){var n,i,o,u;if(!t||!t.state||e>p||e<0)return t?J(t,g):g;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||i.status===H&&e!==h)return J(t,0===t.avail_out?_:g);if(i.strm=t,n=i.last_flush,i.last_flush=e,i.status===U)if(2===i.wrap)t.adler=0,nt(i,31),nt(i,139),nt(i,8),i.gzhead?(nt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),nt(i,255&i.gzhead.time),nt(i,i.gzhead.time>>8&255),nt(i,i.gzhead.time>>16&255),nt(i,i.gzhead.time>>24&255),nt(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),nt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(nt(i,255&i.gzhead.extra.length),nt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=N):(nt(i,0),nt(i,0),nt(i,0),nt(i,0),nt(i,0),nt(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),nt(i,$),i.status=G);else{var m=j+(i.w_bits-8<<4)<<8;m|=(i.strategy>=w||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=D),m+=31-m%31,i.status=G,rt(i,m),0!==i.strstart&&(rt(i,t.adler>>>16),rt(i,65535&t.adler)),t.adler=1}if(i.status===N)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),tt(t),o=i.pending,i.pending!==i.pending_buf_size));)nt(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=z)}else i.status=z;if(i.status===z)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),tt(t),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.gzindex=0,i.status=q)}else i.status=q;if(i.status===q)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),tt(t),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(t.adler=s(t.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.status=V)}else i.status=V;if(i.status===V&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&tt(t),i.pending+2<=i.pending_buf_size&&(nt(i,255&t.adler),nt(i,t.adler>>8&255),t.adler=0,i.status=G)):i.status=G),0!==i.pending){if(tt(t),0===t.avail_out)return i.last_flush=-1,d}else if(0===t.avail_in&&Q(e)<=Q(n)&&e!==h)return J(t,_);if(i.status===H&&0!==t.avail_in)return J(t,_);if(0!==t.avail_in||0!==i.lookahead||e!==l&&i.status!==H){var y=i.strategy===w?function(t,e){for(var n;;){if(0===t.lookahead&&(at(t),0===t.lookahead)){if(e===l)return W;break}if(t.match_length=0,n=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===h?(et(t,!0),0===t.strm.avail_out?Y:X):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:Z}(i,e):i.strategy===x?function(t,e){for(var n,r,i,o,s=t.window;;){if(t.lookahead<=O){if(at(t),t.lookahead<=O&&e===l)return W;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=F&&t.strstart>0&&(r=s[i=t.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){o=t.strstart+O;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=F?(n=a._tr_tally(t,1,t.match_length-F),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===h?(et(t,!0),0===t.strm.avail_out?Y:X):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:Z}(i,e):r[i.level].func(i,e);if(y!==Y&&y!==X||(i.status=H),y===W||y===Y)return 0===t.avail_out&&(i.last_flush=-1),d;if(y===Z&&(e===c?a._tr_align(i):e!==p&&(a._tr_stored_block(i,0,0,!1),e===f&&(K(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),tt(t),0===t.avail_out))return i.last_flush=-1,d}return e!==h?d:i.wrap<=0?v:(2===i.wrap?(nt(i,255&t.adler),nt(i,t.adler>>8&255),nt(i,t.adler>>16&255),nt(i,t.adler>>24&255),nt(i,255&t.total_in),nt(i,t.total_in>>8&255),nt(i,t.total_in>>16&255),nt(i,t.total_in>>24&255)):(rt(i,t.adler>>>16),rt(i,65535&t.adler)),tt(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:v)},n.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==U&&e!==N&&e!==z&&e!==q&&e!==V&&e!==G&&e!==H?J(t,g):(t.state=null,e===G?J(t,m):d):g},n.deflateSetDictionary=function(t,e){var n,r,a,s,u,l,c,f,h=e.length;if(!t||!t.state)return g;if(2===(s=(n=t.state).wrap)||1===s&&n.status!==U||n.lookahead)return g;for(1===s&&(t.adler=o(t.adler,e,h,0)),n.wrap=0,h>=n.w_size&&(0===s&&(K(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,e,h-n.w_size,n.w_size,0),e=f,h=n.w_size),u=t.avail_in,l=t.next_in,c=t.input,t.avail_in=h,t.next_in=0,t.input=e,at(n);n.lookahead>=F;){r=n.strstart,a=n.lookahead-(F-1);do{n.ins_h=(n.ins_h<>>=b=y>>>24,d-=b,0===(b=y>>>16&255))j[a++]=65535&y;else{if(!(16&b)){if(0==(64&b)){y=v[(65535&y)+(p&(1<>>=b,d-=b),d<15&&(p+=S[r++]<>>=b=y>>>24,d-=b,!(16&(b=y>>>16&255))){if(0==(64&b)){y=g[(65535&y)+(p&(1<u){t.msg="invalid distance too far back",n.mode=30;break t}if(p>>>=b,d-=b,x>(b=a-o)){if((b=x-b)>c&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(k=0,E=h,0===f){if(k+=l-b,b2;)j[a++]=E[k++],j[a++]=E[k++],j[a++]=E[k++],w-=3;w&&(j[a++]=E[k++],w>1&&(j[a++]=E[k++]))}else{k=a-x;do{j[a++]=j[k++],j[a++]=j[k++],j[a++]=j[k++],w-=3}while(w>2);w&&(j[a++]=j[k++],w>1&&(j[a++]=j[k++]))}break}}break}}while(r>3,p&=(1<<(d-=w<<3))-1,t.next_in=r,t.next_out=a,t.avail_in=r>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function it(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=x,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(tt),e.distcode=e.distdyn=new r.Buf32(et),e.sane=1,e.back=-1,d):m}function at(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,it(t)):m}function ot(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?m:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,at(t))):m}function st(t,e){var n,i;return t?(i=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},t.state=i,i.window=null,(n=ot(t,e))!==d&&(t.state=null),n):m}var ut,lt,ct=!0;function ft(t){if(ct){var e;for(ut=new r.Buf32(512),lt=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(l,t.lens,0,288,ut,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(c,t.lens,0,32,lt,0,t.work,{bits:5}),ct=!1}t.lencode=ut,t.lenbits=9,t.distcode=lt,t.distbits=5}function ht(t,e,n,i){var a,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(r.arraySet(o.window,e,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>i&&(a=i),r.arraySet(o.window,e,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,e,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,Tt,2,0),st=0,ut=0,n.mode=k;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&st)<<8)+(st>>8))%31){t.msg="incorrect header check",n.mode=J;break}if((15&st)!==w){t.msg="unknown compression method",n.mode=J;break}if(ut-=4,xt=8+(15&(st>>>=4)),0===n.wbits)n.wbits=xt;else if(xt>n.wbits){t.msg="invalid window size",n.mode=J;break}n.dmax=1<>8&1),512&n.flags&&(Tt[0]=255&st,Tt[1]=st>>>8&255,n.check=a(n.check,Tt,2,0)),st=0,ut=0,n.mode=E;case E:for(;ut<32;){if(0===at)break t;at--,st+=tt[nt++]<>>8&255,Tt[2]=st>>>16&255,Tt[3]=st>>>24&255,n.check=a(n.check,Tt,4,0)),st=0,ut=0,n.mode=S;case S:for(;ut<16;){if(0===at)break t;at--,st+=tt[nt++]<>8),512&n.flags&&(Tt[0]=255&st,Tt[1]=st>>>8&255,n.check=a(n.check,Tt,2,0)),st=0,ut=0,n.mode=j;case j:if(1024&n.flags){for(;ut<16;){if(0===at)break t;at--,st+=tt[nt++]<>>8&255,n.check=a(n.check,Tt,2,0)),st=0,ut=0}else n.head&&(n.head.extra=null);n.mode=T;case T:if(1024&n.flags&&((pt=n.length)>at&&(pt=at),pt&&(n.head&&(xt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,tt,nt,pt,xt)),512&n.flags&&(n.check=a(n.check,tt,pt,nt)),at-=pt,nt+=pt,n.length-=pt),n.length))break t;n.length=0,n.mode=C;case C:if(2048&n.flags){if(0===at)break t;pt=0;do{xt=tt[nt+pt++],n.head&&xt&&n.length<65536&&(n.head.name+=String.fromCharCode(xt))}while(xt&&pt>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=L;break;case I:for(;ut<32;){if(0===at)break t;at--,st+=tt[nt++]<>>=7&ut,ut-=7&ut,n.mode=Y;break}for(;ut<3;){if(0===at)break t;at--,st+=tt[nt++]<>>=1)){case 0:n.mode=F;break;case 1:if(ft(n),n.mode=z,e===p){st>>>=2,ut-=2;break t}break;case 2:n.mode=D;break;case 3:t.msg="invalid block type",n.mode=J}st>>>=2,ut-=2;break;case F:for(st>>>=7&ut,ut-=7&ut;ut<32;){if(0===at)break t;at--,st+=tt[nt++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=J;break}if(n.length=65535&st,st=0,ut=0,n.mode=O,e===p)break t;case O:n.mode=P;case P:if(pt=n.length){if(pt>at&&(pt=at),pt>ot&&(pt=ot),0===pt)break t;r.arraySet(et,tt,nt,pt,it),at-=pt,nt+=pt,ot-=pt,it+=pt,n.length-=pt;break}n.mode=L;break;case D:for(;ut<14;){if(0===at)break t;at--,st+=tt[nt++]<>>=5,ut-=5,n.ndist=1+(31&st),st>>>=5,ut-=5,n.ncode=4+(15&st),st>>>=4,ut-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=J;break}n.have=0,n.mode=U;case U:for(;n.have>>=3,ut-=3}for(;n.have<19;)n.lens[Ct[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Et={bits:n.lenbits},kt=s(u,n.lens,0,19,n.lencode,0,n.work,Et),n.lenbits=Et.bits,kt){t.msg="invalid code lengths set",n.mode=J;break}n.have=0,n.mode=N;case N:for(;n.have>>16&255,_t=65535&jt,!((gt=jt>>>24)<=ut);){if(0===at)break t;at--,st+=tt[nt++]<>>=gt,ut-=gt,n.lens[n.have++]=_t;else{if(16===_t){for(St=gt+2;ut>>=gt,ut-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=J;break}xt=n.lens[n.have-1],pt=3+(3&st),st>>>=2,ut-=2}else if(17===_t){for(St=gt+3;ut>>=gt)),st>>>=3,ut-=3}else{for(St=gt+7;ut>>=gt)),st>>>=7,ut-=7}if(n.have+pt>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=J;break}for(;pt--;)n.lens[n.have++]=xt}}if(n.mode===J)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=J;break}if(n.lenbits=9,Et={bits:n.lenbits},kt=s(l,n.lens,0,n.nlen,n.lencode,0,n.work,Et),n.lenbits=Et.bits,kt){t.msg="invalid literal/lengths set",n.mode=J;break}if(n.distbits=6,n.distcode=n.distdyn,Et={bits:n.distbits},kt=s(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Et),n.distbits=Et.bits,kt){t.msg="invalid distances set",n.mode=J;break}if(n.mode=z,e===p)break t;case z:n.mode=q;case q:if(at>=6&&ot>=258){t.next_out=it,t.avail_out=ot,t.next_in=nt,t.avail_in=at,n.hold=st,n.bits=ut,o(t,ct),it=t.next_out,et=t.output,ot=t.avail_out,nt=t.next_in,tt=t.input,at=t.avail_in,st=n.hold,ut=n.bits,n.mode===L&&(n.back=-1);break}for(n.back=0;mt=(jt=n.lencode[st&(1<>>16&255,_t=65535&jt,!((gt=jt>>>24)<=ut);){if(0===at)break t;at--,st+=tt[nt++]<>yt)])>>>16&255,_t=65535&jt,!(yt+(gt=jt>>>24)<=ut);){if(0===at)break t;at--,st+=tt[nt++]<>>=yt,ut-=yt,n.back+=yt}if(st>>>=gt,ut-=gt,n.back+=gt,n.length=_t,0===mt){n.mode=Z;break}if(32&mt){n.back=-1,n.mode=L;break}if(64&mt){t.msg="invalid literal/length code",n.mode=J;break}n.extra=15&mt,n.mode=V;case V:if(n.extra){for(St=n.extra;ut>>=n.extra,ut-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=G;case G:for(;mt=(jt=n.distcode[st&(1<>>16&255,_t=65535&jt,!((gt=jt>>>24)<=ut);){if(0===at)break t;at--,st+=tt[nt++]<>yt)])>>>16&255,_t=65535&jt,!(yt+(gt=jt>>>24)<=ut);){if(0===at)break t;at--,st+=tt[nt++]<>>=yt,ut-=yt,n.back+=yt}if(st>>>=gt,ut-=gt,n.back+=gt,64&mt){t.msg="invalid distance code",n.mode=J;break}n.offset=_t,n.extra=15&mt,n.mode=H;case H:if(n.extra){for(St=n.extra;ut>>=n.extra,ut-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=J;break}n.mode=W;case W:if(0===ot)break t;if(pt=ct-ot,n.offset>pt){if((pt=n.offset-pt)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=J;break}pt>n.wnext?(pt-=n.wnext,dt=n.wsize-pt):dt=n.wnext-pt,pt>n.length&&(pt=n.length),vt=n.window}else vt=et,dt=it-n.offset,pt=n.length;pt>ot&&(pt=ot),ot-=pt,n.length-=pt;do{et[it++]=vt[dt++]}while(--pt);0===n.length&&(n.mode=q);break;case Z:if(0===ot)break t;et[it++]=n.length,ot--,n.mode=q;break;case Y:if(n.wrap){for(;ut<32;){if(0===at)break t;at--,st|=tt[nt++]<=1&&0===F[j];j--);if(T>j&&(T=j),0===j)return l[c++]=20971520,l[c++]=20971520,h.bits=1,0;for(S=1;S0&&(0===t||1!==j))return-1;for(O[1]=0,k=1;k<15;k++)O[k+1]=O[k]+F[k];for(E=0;E852||2===t&&I>592)return 1;for(;;){y=k-A,f[E]<_?(b=0,w=f[E]):f[E]>_?(b=P[D+f[E]],w=L[B+f[E]]):(b=96,w=0),p=1<>A)+(d-=p)]=y<<24|b<<16|w|0}while(0!==d);for(p=1<>=1;if(0!==p?(R&=p-1,R+=p):R=0,E++,0==--F[k]){if(k===j)break;k=e[n+f[E]]}if(k>T&&(R&g)!==v){for(0===A&&(A=T),m+=S,M=1<<(C=k-A);C+A852||2===t&&I>592)return 1;l[v=R&g]=T<<24|C<<16|m-c|0}}return 0!==R&&(l[m+R]=k-A<<24|64<<16|0),h.bits=T,0}},{"../utils/common":49}],57:[function(t,e,n){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],58:[function(t,e,n){"use strict";var r=t("../utils/common"),i=4,a=0,o=1,s=2;function u(t){for(var e=t.length;--e>=0;)t[e]=0}var l=0,c=1,f=2,h=29,p=256,d=p+1+h,v=30,g=19,m=2*d+1,_=15,y=16,b=7,w=256,x=16,k=17,E=18,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],j=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],A=new Array(2*(d+2));u(A);var M=new Array(2*v);u(M);var I=new Array(512);u(I);var R=new Array(256);u(R);var L=new Array(h);u(L);var B,F,O,P=new Array(v);function D(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function U(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function N(t){return t<256?I[t]:I[256+(t>>>7)]}function z(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function q(t,e,n){t.bi_valid>y-n?(t.bi_buf|=e<>y-t.bi_valid,t.bi_valid+=n-y):(t.bi_buf|=e<>>=1,n<<=1}while(--e>0);return n>>>1}function H(t,e,n){var r,i,a=new Array(_+1),o=0;for(r=1;r<=_;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=G(a[s]++,s))}}function W(t){var e;for(e=0;e8?z(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Y(t,e,n,r){var i=2*e,a=2*n;return t[i]>1;n>=1;n--)X(t,a,n);i=u;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],X(t,a,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,a[2*i]=a[2*n]+a[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,a[2*n+1]=a[2*r+1]=i,t.heap[1]=i++,X(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,a,o,s,u=e.dyn_tree,l=e.max_code,c=e.stat_desc.static_tree,f=e.stat_desc.has_stree,h=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,d=e.stat_desc.max_length,v=0;for(a=0;a<=_;a++)t.bl_count[a]=0;for(u[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;nd&&(a=d,v++),u[2*r+1]=a,r>l||(t.bl_count[a]++,o=0,r>=p&&(o=h[r-p]),s=u[2*r],t.opt_len+=s*(a+o),f&&(t.static_len+=s*(c[2*r+1]+o)));if(0!==v){do{for(a=d-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[d]--,v-=2}while(v>0);for(a=d;0!==a;a--)for(r=t.bl_count[a];0!==r;)(i=t.heap[--n])>l||(u[2*i+1]!==a&&(t.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),r--)}}(t,e),H(a,l,t.bl_count)}function Q(t,e,n){var r,i,a=-1,o=e[1],s=0,u=7,l=4;for(0===o&&(u=138,l=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=e[2*(r+1)+1],++s>=7;r0?(t.strm.data_type===s&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return a;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return o;for(e=32;e=3&&0===t.bl_tree[2*C[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),u=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=u&&(u=l)):u=l=n+5,n+4<=u&&-1!==e?et(t,e,n,r):t.strategy===i||l===u?(q(t,(c<<1)+(r?1:0),3),$(t,A,M)):(q(t,(f<<1)+(r?1:0),3),function(t,e,n,r){var i;for(q(t,e-257,5),q(t,n-1,5),q(t,r-4,4),i=0;i>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(R[n]+p+1)]++,t.dyn_dtree[2*N(e)]++),t.last_lit===t.lit_bufsize-1},n._tr_align=function(t){q(t,c<<1,3),V(t,w,A),function(t){16===t.bi_valid?(z(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":49}],59:[function(t,e,n){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],60:[function(t,e,n){n.read=function(t,e,n,r,i){var a,o,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,h=n?-1:1,p=t[e+f];for(f+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),a-=l}return(p?-1:1)*o*Math.pow(2,a-r)},n.write=function(t,e,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:a-1,d=r?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(e*u-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[n+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;t[n+p]=255&o,p+=d,o/=256,l-=8);t[n+p-d]|=128*v}},{}],61:[function(t,e,n){e.exports=[function(t,e){return{options:t,draw:function(e,n,r){r.stop(!0),r.overrideFlag=!0;var i=this;return e.pixelManipulation({output:function(t,e,n){i.output={src:e,format:n}},changePixel:function(t,e,n,r){return[255-t,255-e,255-n,r]},format:e.format,image:t.image,inBrowser:t.inBrowser,callback:n})},output:void 0,UI:e}},{name:"Invert",description:"Inverts the image.",inputs:{}}]},{}],62:[function(t,e,n){"use strict";var r=t("underscore"),i=e.exports={Bitmap:t("./lib/bitmap")};r.extend(i,t("./lib/enums"))},{"./lib/bitmap":63,"./lib/enums":64,underscore:145}],63:[function(t,e,n){(function(n){"use strict";var r=t("fs"),i=(t("underscore"),t("bluebird")),a=t("jpeg-js"),o=t("node-png").PNG,s=t("./enums"),u=t("./utils"),l=t("./resize"),c={r:0,g:0,b:0,a:0},f=e.exports=function(t){t&&(t instanceof f?this._data={data:new n(t.data.data),width:t.width,height:t.height}:t.data?this._data=t:t.width&&t.height&&(this._data={data:new n(4*t.width*t.height),width:t.width,height:t.height},t.color&&this._fill(t.color)))};f.prototype={get width(){return this._data.width},get height(){return this._data.height},attach:function(t){var e=this._data;return this._data=t,e},detach:function(){var t=this._data;return delete this._data,t},_deduceFileType:function(t){if(!t)throw new Error("Can't determine image type");switch(t.substr(-4).toLowerCase()){case".jpg":return s.ImageType.JPG;case".png":return s.ImageType.PNG}if(".jpeg"==t.substr(-5).toLowerCase())return s.ImageType.JPG;throw new Error("Can't recognise image type: "+t)},_readStream:function(t){var e=i.defer(),r=[];return t.on("data",function(t){r.push(t)}),t.on("end",function(){var t=n.concat(r);e.resolve(t)}),t.on("error",function(t){e.reject(t)}),e.promise},_readPNG:function(t){var e=i.defer(),n=new o({filterType:4});return n.on("parsed",function(){e.resolve(n)}),n.on("error",function(t){e.rejecyt(t)}),t.pipe(n),e.promise},_parseOptions:function(t,e){return"number"==typeof(t=t||{})&&(t={type:t}),t.type=t.type||this._deduceFileType(e),t},read:function(t,e){var n=this;switch((e=this._parseOptions(e)).type){case s.ImageType.JPG:return this._readStream(t).then(function(t){n._data=a.decode(t)});case s.ImageType.PNG:return this._readPNG(t).then(function(t){n._data={data:t.data,width:t.width,height:t.height}});default:return i.reject(new Error("Not supported: ImageType "+e.type))}},readFile:function(t,e){var n=this;return u.fs.exists(t).then(function(i){if(i){e=n._parseOptions(e,t);var a=r.createReadStream(t);return n.read(a,e)}throw new Error("File Not Found: "+t)})},write:function(t,e){e=this._parseOptions(e);var n=i.defer();try{switch(t.on("finish",function(){n.resolve()}),t.on("error",function(t){n.reject(t)}),e.type){case s.ImageType.JPG:var r=a.encode(this._data,e.quality||90).data;t.write(r),t.end();break;case s.ImageType.PNG:var u=new o;u.width=this.width,u.height=this.height,u.data=this._data.data,u.on("end",function(){n.resolve()}),u.on("error",function(t){n.reject(t)}),u.pack().pipe(t);break;default:throw new Error("Not supported: ImageType "+e.type)}}catch(t){n.reject(t)}return n.promise},writeFile:function(t,e){e=this._parseOptions(e,t);var n=r.createWriteStream(t);return this.write(n,e)},clone:function(){return new f({width:this.width,height:this.height,data:new n(this._data.data)})},setPixel:function(t,e,n,r,i,a){if(void 0===r){var o=n;n=o.r,r=o.g,i=o.b,a=o.a}void 0===a&&(a=255);var s=4*(e*this.width+t),u=this._data.data;u[s++]=n,u[s++]=r,u[s++]=i,u[s++]=a},getPixel:function(t,e,n){var r=4*(e*this.width+t);n=n||{};var i=this._data.data;return n.r=i[r++],n.g=i[r++],n.b=i[r++],n.a=i[r++],n},negative:function(){for(var t=new f({width:this.width,height:this.height}),e=this.width*this.height,n=this._data.data,r=t._data.data,i=0,a=0,o=0;o-1&&A-1&&M=0&&M>=0?w[O]:P)+D*(g=A=0?w[O+4]:P),z=(1-D)*(m=A>=0&&M0?o:0)-(c>0?4:0)]+2*s[p-(l>0?o:0)]+1*s[p-(l>0?o:0)+(c0?4:0)]+4*s[p]+2*s[p+(c0?4:0)]+2*s[p+(l0?a[x-4]:2*a[x]-a[x+4],E=a[x],S=a[x+4],j=z0?v[x-4*h]:2*v[x]-v[x+4*h],M=v[x],I=v[x+4*h],R=U1)for(g=0;g0&&!t[o-1];)o--;a.push({children:[],index:0});var s,u=a[0];for(n=0;n0;)u=a.pop();for(u.index++,a.push(u);a.length<=n;)a.push(s={children:[],index:0}),u.children[u.index]=s.children,u=s;i++}n+10)return p>>--d&1;if(255==(p=e[n++])){var t=e[n++];if(t)throw"unexpected marker: "+(p<<8|t).toString(16)}return d=7,p>>>7}function g(t){for(var e,n=t;null!==(e=v());){if("number"==typeof(n=n[e]))return n;if("object"!=typeof n)throw"invalid huffman sequence"}return null}function m(t){for(var e=0;t>0;){var n=v();if(null===n)return;e=e<<1|n,t--}return e}function _(t){var e=m(t);return e>=1<0)y--;else for(var r=o,i=s;r<=i;){var a=g(e.huffmanTableAC),u=15&a,c=a>>4;if(0!==u)n[t[r+=c]]=_(u)*(1<>4,0===f)a<15?(y=m(a)+(1<>4;if(0!==s)n[t[a+=u]]=_(s),a++;else{if(u<15)break;a+=16}}};var I,R,L,B,F=0;for(R=1==M?i[0].blocksPerLine*i[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=R);F=65488&&I<=65495))break;n+=2}return n-h}function h(t,l){var c,f,h=[],p=l.blocksPerLine,d=l.blocksPerColumn,v=p<<3,g=new Int32Array(64),m=new Uint8Array(64);function _(t,c,f){var h,p,d,v,g,m,_,y,b,w,x=l.quantizationTable,k=f;for(w=0;w<64;w++)k[w]=t[w]*x[w];for(w=0;w<8;++w){var E=8*w;0!=k[1+E]||0!=k[2+E]||0!=k[3+E]||0!=k[4+E]||0!=k[5+E]||0!=k[6+E]||0!=k[7+E]?(h=s*k[0+E]+128>>8,p=s*k[4+E]+128>>8,d=k[2+E],v=k[6+E],g=u*(k[1+E]-k[7+E])+128>>8,y=u*(k[1+E]+k[7+E])+128>>8,m=k[3+E]<<4,_=k[5+E]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+v*a+128>>8,d=d*a-v*o+128>>8,v=b,b=g-_+1>>1,g=g+_+1>>1,_=b,b=y+m+1>>1,m=y-m+1>>1,y=b,b=h-v+1>>1,h=h+v+1>>1,v=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=g*i+y*r+2048>>12,g=g*r-y*i+2048>>12,y=b,b=m*n+_*e+2048>>12,m=m*e-_*n+2048>>12,_=b,k[0+E]=h+y,k[7+E]=h-y,k[1+E]=p+_,k[6+E]=p-_,k[2+E]=d+m,k[5+E]=d-m,k[3+E]=v+g,k[4+E]=v-g):(b=s*k[0+E]+512>>10,k[0+E]=b,k[1+E]=b,k[2+E]=b,k[3+E]=b,k[4+E]=b,k[5+E]=b,k[6+E]=b,k[7+E]=b)}for(w=0;w<8;++w){var S=w;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(h=s*k[0+S]+2048>>12,p=s*k[32+S]+2048>>12,d=k[16+S],v=k[48+S],g=u*(k[8+S]-k[56+S])+2048>>12,y=u*(k[8+S]+k[56+S])+2048>>12,m=k[24+S],_=k[40+S],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+v*a+2048>>12,d=d*a-v*o+2048>>12,v=b,b=g-_+1>>1,g=g+_+1>>1,_=b,b=y+m+1>>1,m=y-m+1>>1,y=b,b=h-v+1>>1,h=h+v+1>>1,v=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=g*i+y*r+2048>>12,g=g*r-y*i+2048>>12,y=b,b=m*n+_*e+2048>>12,m=m*e-_*n+2048>>12,_=b,k[0+S]=h+y,k[56+S]=h-y,k[8+S]=p+_,k[48+S]=p-_,k[16+S]=d+m,k[40+S]=d-m,k[24+S]=v+g,k[32+S]=v-g):(b=s*f[w+0]+8192>>14,k[0+S]=b,k[8+S]=b,k[16+S]=b,k[24+S]=b,k[32+S]=b,k[40+S]=b,k[48+S]=b,k[56+S]=b)}for(w=0;w<64;++w){var j=128+(k[w]+8>>4);c[w]=j<0?0:j>255?255:j}}for(var y=0;y255?255:t}return l.prototype={load:function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){var t=new Uint8Array(e.response||e.mozResponseArrayBuffer);this.parse(t),this.onload&&this.onload()}.bind(this),e.send(null)},parse:function(e){var n=0;e.length;function r(){var t=e[n]<<8|e[n+1];return n+=2,t}function i(){var t=r(),i=e.subarray(n,n+t-2);return n+=i.length,i}function a(t){var e,n,r=0,i=0;for(n in t.components)t.components.hasOwnProperty(n)&&(r<(e=t.components[n]).h&&(r=e.h),i>4==0)for(z=0;z<64;z++){w[t[z]]=e[n++]}else{if(b>>4!=1)throw"DQT: invalid table spec";for(z=0;z<64;z++){w[t[z]]=r()}}p[15&b]=w}break;case 65472:case 65473:case 65474:r(),(o={}).extended=65473===m,o.progressive=65474===m,o.precision=e[n++],o.scanLines=r(),o.samplesPerLine=r(),o.components={},o.componentsOrder=[];var x,k=e[n++];for(U=0;U>4,S=15&e[n+1],j=e[n+2];o.componentsOrder.push(x),o.components[x]={h:E,v:S,quantizationIdx:j},n+=3}a(o),d.push(o);break;case 65476:var T=r();for(U=2;U>4==0?g:v)[15&C]=c(A,I)}break;case 65501:r(),s=r();break;case 65498:r();var R=e[n++],L=[];for(U=0;U>4],q.huffmanTableAC=v[15&B],L.push(q)}var F=e[n++],O=e[n++],P=e[n++],D=f(e,n,o,L,s,F,O,P>>4,15&P);n+=D;break;default:if(255==e[n-3]&&e[n-2]>=192&&e[n-2]<=254){n-=3;break}throw"unknown JPEG marker "+m.toString(16)}m=r()}if(1!=d.length)throw"only single frame JPEGs supported";for(var U=0;U=0;)e&1<>8&255),F(255&t)}function P(t,e,n,r,i){var a,o=i[0],s=i[240];for(var u=function(t,e){var n,r,i,a,o,s,u,l,c,f,h=0;for(c=0;c<8;++c){n=t[h],r=t[h+1],i=t[h+2],a=t[h+3],o=t[h+4],s=t[h+5],u=t[h+6];var p=n+(l=t[h+7]),v=n-l,g=r+u,m=r-u,_=i+s,y=i-s,b=a+o,w=a-o,x=p+b,k=p-b,E=g+_,S=g-_;t[h]=x+E,t[h+4]=x-E;var j=.707106781*(S+k);t[h+2]=k+j,t[h+6]=k-j;var T=.382683433*((x=w+y)-(S=m+v)),C=.5411961*x+T,A=1.306562965*S+T,M=.707106781*(E=y+m),I=v+M,R=v-M;t[h+5]=R+C,t[h+3]=R-C,t[h+1]=I+A,t[h+7]=I-A,h+=8}for(h=0,c=0;c<8;++c){n=t[h],r=t[h+8],i=t[h+16],a=t[h+24],o=t[h+32],s=t[h+40],u=t[h+48];var L=n+(l=t[h+56]),B=n-l,F=r+u,O=r-u,P=i+s,D=i-s,U=a+o,N=a-o,z=L+U,q=L-U,V=F+P,G=F-P;t[h]=z+V,t[h+32]=z-V;var H=.707106781*(G+q);t[h+16]=q+H,t[h+48]=q-H;var W=.382683433*((z=N+D)-(G=O+B)),Z=.5411961*z+W,Y=1.306562965*G+W,X=.707106781*(V=D+O),$=B+X,J=B-X;t[h+40]=J+Z,t[h+24]=J-Z,t[h+8]=$+Y,t[h+56]=$-Y,h++}for(c=0;c<64;++c)f=t[c]*e[c],d[c]=f>0?f+.5|0:f-.5|0;return d}(t,e),l=0;l<64;++l)v[E[l]]=u[l];var c=v[0]-n;n=v[0],0==c?B(r[0]):(B(r[p[a=32767+c]]),B(h[a]));for(var f=63;f>0&&0==v[f];f--);if(0==f)return B(o),n;for(var g,m=1;m<=f;){for(var _=m;0==v[m]&&m<=f;++m);var y=m-_;if(y>=16){g=y>>4;for(var b=1;b<=g;++b)B(s);y&=15}a=32767+v[m],B(i[(y<<4)+p[a]]),B(h[a]),m++}return 63!=f&&B(o),n}function D(t){if(t<=0&&(t=1),t>100&&(t=100),o!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=s((e[n]*t+50)/100);r<1?r=1:r>255&&(r=255),u[E[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var o=s((i[a]*t+50)/100);o<1?o=1:o>255&&(o=255),l[E[a]]=o}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,d=0;d<8;d++)for(var v=0;v<8;v++)c[p]=1/(u[E[p]]*h[d]*h[v]*8),f[p]=1/(l[E[p]]*h[d]*h[v]*8),p++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),o=t}}this.encode=function(e,o){(new Date).getTime();o&&D(o),g=new Array,m=0,_=7,O(65496),O(65504),O(16),F(74),F(70),F(73),F(70),F(0),F(1),F(1),F(0),O(1),O(1),F(0),F(0),function(){O(65499),O(132),F(0);for(var t=0;t<64;t++)F(u[t]);F(1);for(var e=0;e<64;e++)F(l[e])}(),function(t,e){O(65472),O(17),F(8),O(e),O(t),F(3),F(1),F(17),F(0),F(2),F(17),F(1),F(3),F(17),F(1)}(e.width,e.height),function(){O(65476),O(418),F(0);for(var t=0;t<16;t++)F(S[t+1]);for(var e=0;e<=11;e++)F(j[e]);F(16);for(var n=0;n<16;n++)F(T[n+1]);for(var r=0;r<=161;r++)F(C[r]);F(1);for(var i=0;i<16;i++)F(A[i+1]);for(var a=0;a<=11;a++)F(M[a]);F(17);for(var o=0;o<16;o++)F(I[o+1]);for(var s=0;s<=161;s++)F(R[s])}(),O(65498),O(12),F(3),F(1),F(0),F(2),F(17),F(3),F(17),F(0),F(63),F(0);var s=0,h=0,p=0;m=0,_=7,this.encode.displayName="_encode_";for(var d,v,x,E,L,U,N,z,q,V=e.data,G=e.width,H=e.height,W=4*G,Z=0;Z>3)*W+(N=4*(7&q)),Z+z>=H&&(U-=W*(Z+1+z-H)),d+N>=W&&(U-=d+N-W+4),v=V[U++],x=V[U++],E=V[U++],y[q]=(k[v]+k[x+256>>0]+k[E+512>>0]>>16)-128,b[q]=(k[v+768>>0]+k[x+1024>>0]+k[E+1280>>0]>>16)-128,w[q]=(k[v+1280>>0]+k[x+1536>>0]+k[E+1792>>0]>>16)-128;s=P(y,c,s,n,i),h=P(b,f,h,r,a),p=P(w,f,p,r,a),d+=32}Z+=8}if(_>=0){var Y=[];Y[1]=_+1,Y[0]=(1<<_+1)-1,B(Y)}return O(65497),new t(g)},function(){(new Date).getTime();e||(e=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)x[e]=t(e)}(),n=L(S,j),r=L(A,M),i=L(T,C),a=L(I,R),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r>0]=38470*t,k[t+512>>0]=7471*t+32768,k[t+768>>0]=-11059*t,k[t+1024>>0]=-21709*t,k[t+1280>>0]=32768*t+8421375,k[t+1536>>0]=-27439*t,k[t+1792>>0]=-5329*t}(),D(e),(new Date).getTime()}()}e.exports=function(t,e){void 0===e&&(e=50);return{data:new n(e).encode(t,e),width:t.width,height:t.height}}}).call(this,t("buffer").Buffer)},{buffer:47}],70:[function(t,e,n){arguments[4][41][0].apply(n,arguments)},{dup:41}],71:[function(t,e,n){"use strict";e.exports=function(t){for(var e=new Array(t),n=0;n>i;0!=(e&o)&&p++;var d=n>>i;return 0!=(n&o)&&d++,function(t,e,n,o,s,u){function l(t,e,n){return tn?n:t}var c=r.BitMatrix.createEmpty(o,s);function f(t,e,n,r,i){for(var o=n*i+e,s=0;sd&&(p=d);for(var v=0;vm&&(g=m);for(var _=l(v,2,e-3),y=l(h,2,n-3),b=0,w=-2;w<=2;w++){var x=u[y+w];b+=x[_-2],b+=x[_-1],b+=x[_],b+=x[_+1],b+=x[_+2]}f(t,g,p,b/25,o)}}return c}(u,p,d,e,n,function(t,e,n,r,o){for(var u=new Array(n),l=0;lh&&(f=h);for(var p=0;pv&&(d=v);for(var g=0,m=255,_=0,y=0,b=f*r+d;y_&&(_=x)}if(_-m>s)for(y++,b+=r;y>2*i;if(_-m<=s&&(k=m>>1,c>0&&p>0)){var E=u[c-1][p]+2*u[c][p-1]+u[c-1][p-1]>>2;m=n&&(t++,r+=e.estimatedModuleSize)}),t<3)return!1;for(var a=r/i,o=0,s=0;s=0&&c(n,l);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(n,l)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(n,l)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=e+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=2*i?null:s(o)?u(o,l):null}(r,Math.floor(f),n[2],l);if(null!=h&&null!=(f=function(e,n,r,i){for(var a=t.width,o=[0,0,0,0,0],l=e;l>=0&&c(l,n);)o[2]++,l--;if(l<0)return null;for(;l>=0&&!c(l,n)&&o[1]<=r;)o[1]++,l--;if(l<0||o[1]>r)return null;for(;l>=0&&c(l,n)&&o[0]<=r;)o[0]++,l--;if(o[0]>r)return null;for(l=e+1;l=r)return null;for(;l=r)return null;var f=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(f-i)>=i?null:s(o)?u(o,l):null}(Math.floor(f),Math.floor(h),n[2],l))&&(!a||function(e,n,r,i){for(var a=t.height,o=t.width,u=[0,0,0,0,0],l=0;e-l>=0&&c(n-l,e-l);)u[2]++,l++;if(e-l<0||n-l<0)return!1;for(;e-l>=0&&n-l>=0&&!c(n-l,e-l)&&u[1]<=r;)u[1]++,l++;if(e-l<0||n-l<0||u[1]>r)return!1;for(;e-l>=0&&n-l>=0&&c(n-l,e-l)&&u[0]<=r;)u[0]++,l++;if(u[0]>r)return!1;for(l=1;e+l=a||n+l>=o)return!1;for(;e+l=a||n+l>=o||u[3]>=r)return!1;for(;e+l=r)return!1;var f=u[0]+u[1]+u[2]+u[3]+u[4];return Math.abs(f-i)<2*i&&s(u)}(Math.floor(h),Math.floor(f),n[2],l))){for(var p=l/7,d=!1,v=0;v=n){if(null!=t)return a=!0,Math.floor(Math.abs(t.x-e.x)-Math.abs(t.y-e.y))/2;t=e}}),0}var d=t.height,v=t.width,g=Math.floor(3*d/(4*i));g_[2]&&(y+=x-_[2]-g,w=v-1)}_=[0,0,0,0,0],b=0}else _=[_[2],_[3],_[4],1,0],b=3;else _[++b]++;else _[b]++;s(_)&&h(_,y,v,!1)&&(g=_[0],a&&(m=f()))}var k=function(){var t=e.length;if(t<3)return null;if(t>3){var n=0,r=0;e.forEach(function(t){var e=t.estimatedModuleSize;n+=e,r+=e*e});var i=n/t,a=Math.sqrt(r/t-i*i);e.sort(function(t,e){var n=Math.abs(e.estimatedModuleSize-i),r=Math.abs(t.estimatedModuleSize-i);return n3;s++){var u=e[s];Math.abs(u.estimatedModuleSize-i)>o&&(e.splice(s,1),s--)}}return e.length>3&&(n=0,e.forEach(function(t){n+=t.estimatedModuleSize}),i=n/e.length,e.sort(function(t,e){if(e.count===t.count){var n=Math.abs(e.estimatedModuleSize-i),r=Math.abs(t.estimatedModuleSize-i);return n=i&&a>=o?(n=t[0],e=t[1],r=t[2]):o>=a&&o>=i?(n=t[1],e=t[0],r=t[2]):(n=t[2],e=t[0],r=t[1]),function(t,e,n){var r=e.x,i=e.y;return(n.x-r)*(t.y-i)-(n.y-i)*(t.x-r)}(e,n,r)<0){var s=e;e=r,r=s}return{bottomLeft:{x:e.x,y:e.y},topLeft:{x:n.x,y:n.y},topRight:{x:r.x,y:r.y}}}(k):null}},function(t,e,n){"use strict";var r=n(5),i=n(7),a=n(8),o=n(2),s=n(6);function u(t,e,n){for(var r=!0,i=0;it||o<-1||o>e)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==t&&(n[i]=t-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==e&&(n[i+1]=e-1,r=!0)}r=!0;for(i=n.length-2;i>=0&&r;i-=2){a=Math.floor(n[i]),o=Math.floor(n[i+1]);if(a<-1||a>t||o<-1||o>e)throw new Error;r=!1,-1==a?(n[i]=0,r=!0):a==t&&(n[i]=t-1,r=!0),-1==o?(n[i+1]=0,r=!0):o==e&&(n[i+1]=e-1,r=!0)}return n}function l(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function c(t,e,n,i,a){e=Math.floor(e),n=Math.floor(n);var o=Math.floor(i*t),s=Math.max(0,e-o),u=Math.min(a.width,e+o);if(u-s<3*t)return null;var l=Math.max(0,n-o),c=Math.min(a.height-1,n+o);return r.findAlignment(s,l,u-s,c-l,t,a)}function f(t,e,n,r,i){t=Math.floor(t),e=Math.floor(e),n=Math.floor(n),r=Math.floor(r);var a=Math.abs(r-e)>Math.abs(n-t);if(a){var o=t;t=e,e=o,o=n,n=r,r=o}for(var s=Math.abs(n-t),u=Math.abs(r-e),c=-s>>1,f=t0){if(g==r)break;g+=h,c-=s}}return 2==p?l(n+f,r,t,e):NaN}function h(t,e,n,r,i){var a=f(t,e,n,r,i),o=1,s=t-(n-t);s<0?(o=t/(t-s),s=0):s>=i.width&&(o=(i.width-1-t)/(s-t),s=i.width-1);var u=e-(r-e)*o;return o=1,u<0?(o=e/(e-u),u=0):u>=i.height&&(o=(i.height-1-e)/(u-e),u=i.height-1),(a+=f(t,e,s=t+(s-t)*o,u,i))-1}function p(t,e,n){var r=h(t.x,t.y,e.x,e.y,n),i=h(e.x,e.y,t.x,t.y,n);return s.isNaN(r)?i/7:s.isNaN(i)?r/7:(r+i)/14}e.extract=function(t,e){var n=function(t,e,n,r){return(p(t,e,r)+p(t,n,r))/2}(e.topLeft,e.topRight,e.bottomLeft,t);if(n<1)return null;var r=function(t,e,n,r){var i=7+(Math.round(l(t.x,t.y,e.x,e.y)/r)+Math.round(l(t.x,t.y,n.x,n.y)/r)>>1);switch(3&i){case 0:i++;break;case 2:i--}return i}(e.topLeft,e.topRight,e.bottomLeft,n);if(!r)return null;var s=function(t){if(t%4!=1)return null;var e=t-17>>2;return e<1||e>40?null:a.getVersionForNumber(e)}(r);if(null==s)return null;var f=s.getDimensionForVersion()-7,h=null;if(s.alignmentPatternCenters.length>0)for(var d=e.topRight.x-e.topLeft.x+e.bottomLeft.x,v=e.topRight.y-e.topLeft.y+e.bottomLeft.y,g=1-3/f,m=e.topLeft.x+g*(d-e.topLeft.x),_=e.topLeft.y+g*(v-e.topLeft.y),y=4;y<=16&&!(h=c(n,m,_,y,t));y<<=1);return function(t,e,n){if(e<=0)return null;for(var r=o.BitMatrix.createEmpty(e,e),a=new Array(e<<1),s=0;s>1),a[f+1]=c;a=i.transformPoints(n,a);try{var h=u(t.width,t.height,a)}catch(t){return null}for(f=0;f>1,s,t.get(Math.floor(h[f]),Math.floor(h[f+1])))}return r}(t,r,function(t,e,n,r,a){var o,s,u,l,c=a-3.5;return null!=r?(o=r.x,s=r.y,u=l=c-3):(o=e.x-t.x+n.x,s=e.y-t.y+n.y,u=l=c),i.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,u,l,3.5,c,t.x,t.y,e.x,e.y,o,s,n.x,n.y)}(e.topLeft,e.topRight,e.bottomLeft,h,r))}},function(t,e,n){"use strict";var r=n(6);function i(t,e,n,r){if(Math.abs(n-t.y)<=e&&Math.abs(r-t.x)<=e){var i=Math.abs(e-t.estimatedModuleSize);return i<=1||i<=t.estimatedModuleSize}return!1}function a(t,e,n,r){return{x:(t.x+n)/2,y:(t.y+e)/2,estimatedModuleSize:(t.estimatedModuleSize+r)/2}}function o(t,e){for(var n=e/2,r=0;r<3;r++)if(Math.abs(e-t[r])>=n)return!1;return!0}function s(t,e){var n=e-t[2]-t[1]/2;return r.isNaN(n)?null:n}e.findAlignment=function(t,e,n,r,u,l){var c=[];function f(t,e,n,r){var u=t[0]+t[1]+t[2],f=s(t,n);if(null==f)return null;var h=function(t,e,n,r,i,a){for(var u=a.height,l=[0,0,0],c=t;c>=0&&a.get(e,c)&&l[1]<=n;)l[1]++,c--;if(c<0||l[1]>n)return null;for(;c>=0&&!a.get(e,c)&&l[0]<=n;)l[0]++,c--;if(l[0]>n)return null;for(c=t+1;cn)return null;for(;cn)return null;var f=l[0]+l[1]+l[2];return 5*Math.abs(f-r)>=2*r?null:o(l,i)?s(l,c):null}(e,Math.floor(f),2*t[1],u,r,l);if(null!=h){var p=(t[0]+t[1]+t[2])/3;for(var d in c){var v=c[d];if(i(v,p,h,f))return a(v,h,f,p)}var g={x:f,y:h,estimatedModuleSize:p};c.push(g)}return null}for(var h=t+n,p=e+(r>>1),d=[0,0,0],v=0;v>1:-(v+1>>1));d[0]=0,d[1]=0,d[2]=0;for(var m=t;m>4&15]+n[t>>8&15]+n[t>>12&15]+n[t>>16&15]+n[t>>20&15]+n[t>>24&15]+n[t>>28&15]},e.isNaN=function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t!==+t}},function(t,e){"use strict";function n(t,e,n,r,i,a,o,s){var u=t-n+i-o,l=e-r+a-s;if(0==u&&0==l)return{a11:n-t,a21:i-n,a31:t,a12:r-e,a22:a-r,a32:e,a13:0,a23:0,a33:1};var c=n-i,f=o-i,h=r-a,p=s-a,d=c*p-f*h,v=(u*p-f*l)/d,g=(c*l-u*h)/d;return{a11:n-t+v*n,a21:o-t+g*o,a31:t,a12:r-e+v*r,a22:s-e+g*s,a32:e,a13:v,a23:g,a33:1}}e.transformPoints=function(t,e){for(var n=e.length,r=t.a11,i=t.a12,a=t.a13,o=t.a21,s=t.a22,u=t.a23,l=t.a31,c=t.a32,f=t.a33,h=0;h40)throw new Error("Invalid version number "+t);return u[t-1]}e.getVersionForNumber=l},function(t,e,n){"use strict";var r=n(2),i=n(10),a=n(6),o=n(12),s=n(8),u=21522,l=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],c=[function(t,e){return 0==(t+e&1)},function(t,e){return 0==(1&t)},function(t,e){return e%3==0},function(t,e){return(t+e)%3==0},function(t,e){return 0==((t>>1)+e/3&1)},function(t,e){return(t*e&1)+t*e%3==0},function(t,e){return 0==((t*e&1)+t*e%3&1)},function(t,e){return 0==((t+e&1)+t*e%3&1)}],f=[{ordinal:1,bits:0,name:"M"},{ordinal:0,bits:1,name:"L"},{ordinal:3,bits:2,name:"H"},{ordinal:2,bits:3,name:"Q"}];function h(t,e,n){for(var i=c[n.dataMask],a=t.height,o=function(t){for(var e=t.getDimensionForVersion(),n=new Array(e*e),i=0;i6&&(a.setRegion(e-11,0,3,6),a.setRegion(0,e-11,6,3)),a}(e),s=!0,u=[],l=0,f=0,h=0,p=a-1;p>0;p-=2){6==p&&p--;for(var d=0;d>3&3],dataMask:7&t}}function d(t,e){for(var n=1/0,r=0,i=0;i=0;r--)e=t.copyBit(8,r,e);var i=t.height,a=0,o=i-7;for(r=i-1;r>=o;r--)a=t.copyBit(8,r,a);for(n=i-8;n>2;if(n<=6)return s.getVersionForNumber(n);for(var r=0,i=e-11,a=5;a>=0;a--)for(var o=e-9;o>=i;o--)r=t.copyBit(o,a,r);var u=s.Version.decodeVersionInformation(r);if(null!=u&&u.getDimensionForVersion()==e)return u;for(r=0,o=5;o>=0;o--)for(a=e-9;a>=i;a--)r=t.copyBit(o,a,r);return null!=(u=s.Version.decodeVersionInformation(r))&&u.getDimensionForVersion()==e?u:null}(t);if(!e)return null;var n=v(t);if(!n)return null;var r=n.errorCorrectionLevel,a=h(t,e,n);if(!a)return null;var o=function(t,e,n){if(t.length!=e.totalCodewords)throw new Error("Invalid number of codewords for version; got "+t.length+" expected "+e.totalCodewords);var r=e.getECBlocksForLevel(n),i=0,a=r.ecBlocks;a.forEach(function(t){i+=t.count});var o=new Array(i),s=0;a.forEach(function(t){for(var e=0;e=0&&o[l].codewords.length!=u;)l--;l++;for(var c=u-r.ecCodewordsPerBlock,f=0,h=0;h=e.length)throw new Error("Could not decode alphanumeric char");return e[t].charCodeAt(0)}var a=function(){function t(t,e){this.characterCountBitsForVersions=t,this.bits=e}return t.prototype.getCharacterCountBits=function(t){if(null==this.characterCountBitsForVersions)throw new Error("Character count doesn't apply to this mode");var e;return e=t<=9?0:t<=26?1:2,this.characterCountBitsForVersions[e]},t}(),o=new a([0,0,0],0),s=new a([10,12,14],1),u=new a([9,11,13],2),l=new a([0,0,0],3),c=new a([8,16,16],4),f=new a(null,7),h=new a([8,10,12],8),p=new a(null,5),d=new a(null,9),v=new a([8,10,12],13);function g(t){switch(t){case 0:return o;case 1:return s;case 2:return u;case 3:return l;case 4:return c;case 5:return p;case 7:return f;case 8:return h;case 9:return d;case 13:return v;default:throw new Error("Couldn't decode mode from byte array")}}function m(t){var e=t.readBits(8);if(0==(128&e))return 127&e;if(128==(192&e))return(63&e)<<8|t.readBits(8);if(192==(224&e))return(31&e)<<16|t.readBits(16);throw new Error("Bad ECI bits starting with byte "+e)}function _(t,e,n){if(13*n>t.available())return!1;for(var r=new Array(2*n),i=0;n>0;){var a=t.readBits(13),o=Math.floor(a/96)<<8|a%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}return e.val=r,!0}function y(t,e,n){for(;n>=3;){if(t.available()<10)return!1;var r=t.readBits(10);if(r>=1e3)return!1;e.val.push(i(Math.floor(r/100))),e.val.push(i(Math.floor(r/10)%10)),e.val.push(i(r%10)),n-=3}if(2==n){if(t.available()<7)return!1;var a=t.readBits(7);if(a>=100)return!1;e.val.push(i(Math.floor(a/10))),e.val.push(i(a%10))}else if(1==n){if(t.available()<4)return!1;var o=t.readBits(4);if(o>=10)return!1;e.val.push(i(o))}return!0}function b(t,e,n,r){for(var a=e.val.length;n>1;){if(t.available()<11)return!1;var o=t.readBits(11);e.val.push(i(Math.floor(o/45))),e.val.push(i(o%45)),n-=2}if(1==n){if(t.available()<6)return!1;e.val.push(i(t.readBits(6)))}if(r)for(var s=a;st.available())return!1;for(var r=new Array(n),i=0;i30)return null}else if(i==v){var j=a.readBits(4),T=a.readBits(i.getCharacterCountBits(e));if(j==x&&!_(a,k,T))return null}else{var C=a.readBits(i.getCharacterCountBits(e));if(i==s){if(!y(a,k,C))return null}else if(i==u){if(!b(a,k,C,E))return null}else if(i==c){if(!w(a,k,C))return null}else if(i!=h)return null}return k.val}},function(t,e){"use strict";var n=function(){function t(t){this.byteOffset=0,this.bitOffset=0,this.bytes=t}return t.prototype.readBits=function(t){if(t<1||t>32||t>this.available())throw new Error("Cannot read "+t.toString()+" bits");var e=0;if(this.bitOffset>0){var n=8-this.bitOffset,r=t>8-r<<(a=n-r);e=(this.bytes[this.byteOffset]&i)>>a,t-=r,this.bitOffset+=r,8==this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(t>0){for(;t>=8;)e=e<<8|255&this.bytes[this.byteOffset],this.byteOffset++,t-=8;if(t>0){var a;i=255>>(a=8-t)<>a,this.bitOffset+=t}}return e},t.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},t}();e.BitStream=n},function(t,e){"use strict";var n=function(){function t(){this.field=new i(285,256,0)}return t.prototype.decode=function(t,e){for(var n=new r(this.field,t),a=new Array(e),o=!0,s=0;s=n/2;){var u=i,l=o;if(o=s,(i=a).isZero())return null;a=u;for(var c=this.field.zero,f=i.getCoefficient(i.degree()),h=this.field.inverse(f);a.degree()>=i.degree()&&!a.isZero();){var p=a.degree()-i.degree(),d=this.field.multiply(a.getCoefficient(a.degree()),h);c=c.addOrSubtract(this.field.buildMonomial(p,d)),a=a.addOrSubtract(i.multiplyByMonomial(p,d))}if(s=c.multiplyPoly(o).addOrSubtract(l),a.degree()>=i.degree())return null}var v=s.getCoefficient(0);if(0==v)return null;var g=this.field.inverse(v);return[s.multiply(g),a.multiply(g)]},t.prototype.findErrorLocations=function(t){var e=t.degree();if(1==e)return[t.getCoefficient(1)];for(var n=new Array(e),r=0,i=1;i1&&0==e[0]){for(var r=1;rr.length){var a=n;n=r,r=a}for(var o=new Array(r.length),s=r.length-n.length,u=0;u=this.size&&(t^=this.primitive,t&=this.size-1);for(e=0;e>>1,D=[["ary",x],["bind",v],["bindKey",g],["curry",_],["curryRight",y],["flip",E],["partial",b],["partialRight",w],["rearg",k]],U="[object Arguments]",N="[object Array]",z="[object AsyncFunction]",q="[object Boolean]",V="[object Date]",G="[object DOMException]",H="[object Error]",W="[object Function]",Z="[object GeneratorFunction]",Y="[object Map]",X="[object Number]",$="[object Null]",J="[object Object]",Q="[object Proxy]",K="[object RegExp]",tt="[object Set]",et="[object String]",nt="[object Symbol]",rt="[object Undefined]",it="[object WeakMap]",at="[object WeakSet]",ot="[object ArrayBuffer]",st="[object DataView]",ut="[object Float32Array]",lt="[object Float64Array]",ct="[object Int8Array]",ft="[object Int16Array]",ht="[object Int32Array]",pt="[object Uint8Array]",dt="[object Uint8ClampedArray]",vt="[object Uint16Array]",gt="[object Uint32Array]",mt=/\b__p \+= '';/g,_t=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bt=/&(?:amp|lt|gt|quot|#39);/g,wt=/[&<>"']/g,xt=RegExp(bt.source),kt=RegExp(wt.source),Et=/<%-([\s\S]+?)%>/g,St=/<%([\s\S]+?)%>/g,jt=/<%=([\s\S]+?)%>/g,Tt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ct=/^\w*$/,At=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Mt=/[\\^$.*+?()[\]{}|]/g,It=RegExp(Mt.source),Rt=/^\s+|\s+$/g,Lt=/^\s+/,Bt=/\s+$/,Ft=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ot=/\{\n\/\* \[wrapped with (.+)\] \*/,Pt=/,? & /,Dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ut=/\\(\\)?/g,Nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,zt=/\w*$/,qt=/^[-+]0x[0-9a-f]+$/i,Vt=/^0b[01]+$/i,Gt=/^\[object .+?Constructor\]$/,Ht=/^0o[0-7]+$/i,Wt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yt=/($^)/,Xt=/['\n\r\u2028\u2029\\]/g,$t="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Jt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",Qt="[\\ud800-\\udfff]",Kt="["+Jt+"]",te="["+$t+"]",ee="\\d+",ne="[\\u2700-\\u27bf]",re="[a-z\\xdf-\\xf6\\xf8-\\xff]",ie="[^\\ud800-\\udfff"+Jt+ee+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ae="\\ud83c[\\udffb-\\udfff]",oe="[^\\ud800-\\udfff]",se="(?:\\ud83c[\\udde6-\\uddff]){2}",ue="[\\ud800-\\udbff][\\udc00-\\udfff]",le="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ce="(?:"+re+"|"+ie+")",fe="(?:"+le+"|"+ie+")",he="(?:"+te+"|"+ae+")"+"?",pe="[\\ufe0e\\ufe0f]?"+he+("(?:\\u200d(?:"+[oe,se,ue].join("|")+")[\\ufe0e\\ufe0f]?"+he+")*"),de="(?:"+[ne,se,ue].join("|")+")"+pe,ve="(?:"+[oe+te+"?",te,se,ue,Qt].join("|")+")",ge=RegExp("['’]","g"),me=RegExp(te,"g"),_e=RegExp(ae+"(?="+ae+")|"+ve+pe,"g"),ye=RegExp([le+"?"+re+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Kt,le,"$"].join("|")+")",fe+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Kt,le+ce,"$"].join("|")+")",le+"?"+ce+"+(?:['’](?:d|ll|m|re|s|t|ve))?",le+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ee,de].join("|"),"g"),be=RegExp("[\\u200d\\ud800-\\udfff"+$t+"\\ufe0e\\ufe0f]"),we=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xe=["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"],ke=-1,Ee={};Ee[ut]=Ee[lt]=Ee[ct]=Ee[ft]=Ee[ht]=Ee[pt]=Ee[dt]=Ee[vt]=Ee[gt]=!0,Ee[U]=Ee[N]=Ee[ot]=Ee[q]=Ee[st]=Ee[V]=Ee[H]=Ee[W]=Ee[Y]=Ee[X]=Ee[J]=Ee[K]=Ee[tt]=Ee[et]=Ee[it]=!1;var Se={};Se[U]=Se[N]=Se[ot]=Se[st]=Se[q]=Se[V]=Se[ut]=Se[lt]=Se[ct]=Se[ft]=Se[ht]=Se[Y]=Se[X]=Se[J]=Se[K]=Se[tt]=Se[et]=Se[nt]=Se[pt]=Se[dt]=Se[vt]=Se[gt]=!0,Se[H]=Se[W]=Se[it]=!1;var je={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Te=parseFloat,Ce=parseInt,Ae="object"==typeof t&&t&&t.Object===Object&&t,Me="object"==typeof self&&self&&self.Object===Object&&self,Ie=Ae||Me||Function("return this")(),Re="object"==typeof n&&n&&!n.nodeType&&n,Le=Re&&"object"==typeof e&&e&&!e.nodeType&&e,Be=Le&&Le.exports===Re,Fe=Be&&Ae.process,Oe=function(){try{var t=Le&&Le.require&&Le.require("util").types;return t||Fe&&Fe.binding&&Fe.binding("util")}catch(t){}}(),Pe=Oe&&Oe.isArrayBuffer,De=Oe&&Oe.isDate,Ue=Oe&&Oe.isMap,Ne=Oe&&Oe.isRegExp,ze=Oe&&Oe.isSet,qe=Oe&&Oe.isTypedArray;function Ve(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ge(t,e,n,r){for(var i=-1,a=null==t?0:t.length;++i-1}function $e(t,e,n){for(var r=-1,i=null==t?0:t.length;++r-1;);return n}function yn(t,e){for(var n=t.length;n--&&on(e,t[n],0)>-1;);return n}var bn=fn({"À":"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"}),wn=fn({"&":"&","<":"<",">":">",'"':""","'":"'"});function xn(t){return"\\"+je[t]}function kn(t){return be.test(t)}function En(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function Sn(t,e){return function(n){return t(e(n))}}function jn(t,e){for(var n=-1,r=t.length,i=0,a=[];++n",""":'"',"'":"'"});var Rn=function t(e){var n,$t=(e=null==e?Ie:Rn.defaults(Ie.Object(),e,Rn.pick(Ie,xe))).Array,Jt=e.Date,Qt=e.Error,Kt=e.Function,te=e.Math,ee=e.Object,ne=e.RegExp,re=e.String,ie=e.TypeError,ae=$t.prototype,oe=Kt.prototype,se=ee.prototype,ue=e["__core-js_shared__"],le=oe.toString,ce=se.hasOwnProperty,fe=0,he=(n=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",pe=se.toString,de=le.call(ee),ve=Ie._,_e=ne("^"+le.call(ce).replace(Mt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),be=Be?e.Buffer:r,je=e.Symbol,Ae=e.Uint8Array,Me=be?be.allocUnsafe:r,Re=Sn(ee.getPrototypeOf,ee),Le=ee.create,Fe=se.propertyIsEnumerable,Oe=ae.splice,nn=je?je.isConcatSpreadable:r,fn=je?je.iterator:r,Ln=je?je.toStringTag:r,Bn=function(){try{var t=Da(ee,"defineProperty");return t({},"",{}),t}catch(t){}}(),Fn=e.clearTimeout!==Ie.clearTimeout&&e.clearTimeout,On=Jt&&Jt.now!==Ie.Date.now&&Jt.now,Pn=e.setTimeout!==Ie.setTimeout&&e.setTimeout,Dn=te.ceil,Un=te.floor,Nn=ee.getOwnPropertySymbols,zn=be?be.isBuffer:r,qn=e.isFinite,Vn=ae.join,Gn=Sn(ee.keys,ee),Hn=te.max,Wn=te.min,Zn=Jt.now,Yn=e.parseInt,Xn=te.random,$n=ae.reverse,Jn=Da(e,"DataView"),Qn=Da(e,"Map"),Kn=Da(e,"Promise"),tr=Da(e,"Set"),er=Da(e,"WeakMap"),nr=Da(ee,"create"),rr=er&&new er,ir={},ar=co(Jn),or=co(Qn),sr=co(Kn),ur=co(tr),lr=co(er),cr=je?je.prototype:r,fr=cr?cr.valueOf:r,hr=cr?cr.toString:r;function pr(t){if(Cs(t)&&!ms(t)&&!(t instanceof mr)){if(t instanceof gr)return t;if(ce.call(t,"__wrapped__"))return fo(t)}return new gr(t)}var dr=function(){function t(){}return function(e){if(!Ts(e))return{};if(Le)return Le(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function vr(){}function gr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function mr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=F,this.__views__=[]}function _r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function Fr(t,e,n,i,a,o){var s,u=e&c,l=e&f,p=e&h;if(n&&(s=a?n(t,i,a,o):n(t)),s!==r)return s;if(!Ts(t))return t;var d=ms(t);if(d){if(s=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&ce.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!u)return na(t,s)}else{var v=za(t),g=v==W||v==Z;if(ws(t))return $i(t,u);if(v==J||v==U||g&&!a){if(s=l||g?{}:Va(t),!u)return l?function(t,e){return ra(t,Na(t),e)}(t,function(t,e){return t&&ra(e,au(e),t)}(s,t)):function(t,e){return ra(t,Ua(t),e)}(t,Ir(s,t))}else{if(!Se[v])return a?t:{};s=function(t,e,n){var r,i,a,o=t.constructor;switch(e){case ot:return Ji(t);case q:case V:return new o(+t);case st:return function(t,e){var n=e?Ji(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case ut:case lt:case ct:case ft:case ht:case pt:case dt:case vt:case gt:return Qi(t,n);case Y:return new o;case X:case et:return new o(t);case K:return(a=new(i=t).constructor(i.source,zt.exec(i))).lastIndex=i.lastIndex,a;case tt:return new o;case nt:return r=t,fr?ee(fr.call(r)):{}}}(t,v,u)}}o||(o=new xr);var m=o.get(t);if(m)return m;if(o.set(t,s),Ls(t))return t.forEach(function(r){s.add(Fr(r,e,n,r,t,o))}),s;if(As(t))return t.forEach(function(r,i){s.set(i,Fr(r,e,n,i,t,o))}),s;var _=d?r:(p?l?Ia:Ma:l?au:iu)(t);return He(_||t,function(r,i){_&&(r=t[i=r]),Cr(s,i,Fr(r,e,n,i,t,o))}),s}function Or(t,e,n){var i=n.length;if(null==t)return!i;for(t=ee(t);i--;){var a=n[i],o=e[a],s=t[a];if(s===r&&!(a in t)||!o(s))return!1}return!0}function Pr(t,e,n){if("function"!=typeof t)throw new ie(o);return ro(function(){t.apply(r,n)},e)}function Dr(t,e,n,r){var a=-1,o=Xe,s=!0,u=t.length,l=[],c=e.length;if(!u)return l;n&&(e=Je(e,vn(n))),r?(o=$e,s=!1):e.length>=i&&(o=mn,s=!1,e=new wr(e));t:for(;++a-1},yr.prototype.set=function(t,e){var n=this.__data__,r=Ar(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},br.prototype.clear=function(){this.size=0,this.__data__={hash:new _r,map:new(Qn||yr),string:new _r}},br.prototype.delete=function(t){var e=Oa(this,t).delete(t);return this.size-=e?1:0,e},br.prototype.get=function(t){return Oa(this,t).get(t)},br.prototype.has=function(t){return Oa(this,t).has(t)},br.prototype.set=function(t,e){var n=Oa(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},wr.prototype.add=wr.prototype.push=function(t){return this.__data__.set(t,s),this},wr.prototype.has=function(t){return this.__data__.has(t)},xr.prototype.clear=function(){this.__data__=new yr,this.size=0},xr.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},xr.prototype.get=function(t){return this.__data__.get(t)},xr.prototype.has=function(t){return this.__data__.has(t)},xr.prototype.set=function(t,e){var n=this.__data__;if(n instanceof yr){var r=n.__data__;if(!Qn||r.length0&&n(s)?e>1?Gr(s,e-1,n,r,i):Qe(i,s):r||(i[i.length]=s)}return i}var Hr=sa(),Wr=sa(!0);function Zr(t,e){return t&&Hr(t,e,iu)}function Yr(t,e){return t&&Wr(t,e,iu)}function Xr(t,e){return Ye(e,function(e){return Es(t[e])})}function $r(t,e){for(var n=0,i=(e=Wi(e,t)).length;null!=t&&ne}function ti(t,e){return null!=t&&ce.call(t,e)}function ei(t,e){return null!=t&&e in ee(t)}function ni(t,e,n){for(var i=n?$e:Xe,a=t[0].length,o=t.length,s=o,u=$t(o),l=1/0,c=[];s--;){var f=t[s];s&&e&&(f=Je(f,vn(e))),l=Wn(f.length,l),u[s]=!n&&(e||a>=120&&f.length>=120)?new wr(s&&f):r}f=t[0];var h=-1,p=u[0];t:for(;++h=s)return u;var l=n[r];return u*("desc"==l?-1:1)}}return t.index-e.index}(t,e,n)})}function _i(t,e,n){for(var r=-1,i=e.length,a={};++r-1;)s!==t&&Oe.call(s,u,1),Oe.call(t,u,1);return t}function bi(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==a){var a=i;Ha(i)?Oe.call(t,i,1):Di(t,i)}}return t}function wi(t,e){return t+Un(Xn()*(e-t+1))}function xi(t,e){var n="";if(!t||e<1||e>R)return n;do{e%2&&(n+=t),(e=Un(e/2))&&(t+=t)}while(e);return n}function ki(t,e){return io(Ka(t,e,Mu),t+"")}function Ei(t){return Er(pu(t))}function Si(t,e){var n=pu(t);return so(n,Br(e,0,n.length))}function ji(t,e,n,i){if(!Ts(t))return t;for(var a=-1,o=(e=Wi(e,t)).length,s=o-1,u=t;null!=u&&++ai?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var a=$t(i);++r>>1,o=t[a];null!==o&&!Fs(o)&&(n?o<=e:o=i){var c=e?null:xa(t);if(c)return Tn(c);s=!1,a=mn,l=new wr}else l=e?[]:u;t:for(;++r=i?t:Mi(t,e,n)}var Xi=Fn||function(t){return Ie.clearTimeout(t)};function $i(t,e){if(e)return t.slice();var n=t.length,r=Me?Me(n):new t.constructor(n);return t.copy(r),r}function Ji(t){var e=new t.constructor(t.byteLength);return new Ae(e).set(new Ae(t)),e}function Qi(t,e){var n=e?Ji(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ki(t,e){if(t!==e){var n=t!==r,i=null===t,a=t==t,o=Fs(t),s=e!==r,u=null===e,l=e==e,c=Fs(e);if(!u&&!c&&!o&&t>e||o&&s&&l&&!u&&!c||i&&s&&l||!n&&l||!a)return 1;if(!i&&!o&&!c&&t1?n[a-1]:r,s=a>2?n[2]:r;for(o=t.length>3&&"function"==typeof o?(a--,o):r,s&&Wa(n[0],n[1],s)&&(o=a<3?r:o,a=1),e=ee(e);++i-1?a[o?e[s]:s]:r}}function ha(t){return Aa(function(e){var n=e.length,i=n,a=gr.prototype.thru;for(t&&e.reverse();i--;){var s=e[i];if("function"!=typeof s)throw new ie(o);if(a&&!u&&"wrapper"==La(s))var u=new gr([],!0)}for(i=u?i:n;++i1&&_.reverse(),f&&lu))return!1;var c=o.get(t);if(c&&o.get(e))return c==e;var f=-1,h=!0,v=n&d?new wr:r;for(o.set(t,e),o.set(e,t);++f-1&&t%1==0&&t1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Ft,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return He(D,function(n){var r="_."+n[0];e&n[1]&&!Xe(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(Ot);return e?e[1].split(Pt):[]}(r),n)))}function oo(t){var e=0,n=0;return function(){var i=Zn(),a=C-(i-n);if(n=i,a>0){if(++e>=T)return arguments[0]}else e=0;return t.apply(r,arguments)}}function so(t,e){var n=-1,i=t.length,a=i-1;for(e=e===r?i:e;++n1?t[e-1]:r;return Ro(t,n="function"==typeof n?(t.pop(),n):r)});function Uo(t){var e=pr(t);return e.__chain__=!0,e}function No(t,e){return e(t)}var zo=Aa(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,a=function(e){return Lr(e,t)};return!(e>1||this.__actions__.length)&&i instanceof mr&&Ha(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:No,args:[a],thisArg:r}),new gr(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(r),t})):this.thru(a)});var qo=ia(function(t,e,n){ce.call(t,n)?++t[n]:Rr(t,n,1)});var Vo=fa(go),Go=fa(mo);function Ho(t,e){return(ms(t)?He:Ur)(t,Fa(e,3))}function Wo(t,e){return(ms(t)?We:Nr)(t,Fa(e,3))}var Zo=ia(function(t,e,n){ce.call(t,n)?t[n].push(e):Rr(t,n,[e])});var Yo=ki(function(t,e,n){var r=-1,i="function"==typeof e,a=ys(t)?$t(t.length):[];return Ur(t,function(t){a[++r]=i?Ve(e,t,n):ri(t,e,n)}),a}),Xo=ia(function(t,e,n){Rr(t,n,e)});function $o(t,e){return(ms(t)?Je:hi)(t,Fa(e,3))}var Jo=ia(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});var Qo=ki(function(t,e){if(null==t)return[];var n=e.length;return n>1&&Wa(t,e[0],e[1])?e=[]:n>2&&Wa(e[0],e[1],e[2])&&(e=[e[0]]),mi(t,Gr(e,1),[])}),Ko=On||function(){return Ie.Date.now()};function ts(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Ea(t,x,r,r,r,r,e)}function es(t,e){var n;if("function"!=typeof e)throw new ie(o);return t=zs(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=r),n}}var ns=ki(function(t,e,n){var r=v;if(n.length){var i=jn(n,Ba(ns));r|=b}return Ea(t,r,e,n,i)}),rs=ki(function(t,e,n){var r=v|g;if(n.length){var i=jn(n,Ba(rs));r|=b}return Ea(e,r,t,n,i)});function is(t,e,n){var i,a,s,u,l,c,f=0,h=!1,p=!1,d=!0;if("function"!=typeof t)throw new ie(o);function v(e){var n=i,o=a;return i=a=r,f=e,u=t.apply(o,n)}function g(t){var n=t-c;return c===r||n>=e||n<0||p&&t-f>=s}function m(){var t=Ko();if(g(t))return _(t);l=ro(m,function(t){var n=e-(t-c);return p?Wn(n,s-(t-f)):n}(t))}function _(t){return l=r,d&&i?v(t):(i=a=r,u)}function y(){var t=Ko(),n=g(t);if(i=arguments,a=this,c=t,n){if(l===r)return function(t){return f=t,l=ro(m,e),h?v(t):u}(c);if(p)return l=ro(m,e),v(c)}return l===r&&(l=ro(m,e)),u}return e=Vs(e)||0,Ts(n)&&(h=!!n.leading,s=(p="maxWait"in n)?Hn(Vs(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d),y.cancel=function(){l!==r&&Xi(l),f=0,i=c=a=l=r},y.flush=function(){return l===r?u:_(Ko())},y}var as=ki(function(t,e){return Pr(t,1,e)}),os=ki(function(t,e,n){return Pr(t,Vs(e)||0,n)});function ss(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new ie(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=t.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ss.Cache||br),n}function us(t){if("function"!=typeof t)throw new ie(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ss.Cache=br;var ls=Zi(function(t,e){var n=(e=1==e.length&&ms(e[0])?Je(e[0],vn(Fa())):Je(Gr(e,1),vn(Fa()))).length;return ki(function(r){for(var i=-1,a=Wn(r.length,n);++i=e}),gs=ii(function(){return arguments}())?ii:function(t){return Cs(t)&&ce.call(t,"callee")&&!Fe.call(t,"callee")},ms=$t.isArray,_s=Pe?vn(Pe):function(t){return Cs(t)&&Qr(t)==ot};function ys(t){return null!=t&&js(t.length)&&!Es(t)}function bs(t){return Cs(t)&&ys(t)}var ws=zn||Vu,xs=De?vn(De):function(t){return Cs(t)&&Qr(t)==V};function ks(t){if(!Cs(t))return!1;var e=Qr(t);return e==H||e==G||"string"==typeof t.message&&"string"==typeof t.name&&!Is(t)}function Es(t){if(!Ts(t))return!1;var e=Qr(t);return e==W||e==Z||e==z||e==Q}function Ss(t){return"number"==typeof t&&t==zs(t)}function js(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=R}function Ts(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Cs(t){return null!=t&&"object"==typeof t}var As=Ue?vn(Ue):function(t){return Cs(t)&&za(t)==Y};function Ms(t){return"number"==typeof t||Cs(t)&&Qr(t)==X}function Is(t){if(!Cs(t)||Qr(t)!=J)return!1;var e=Re(t);if(null===e)return!0;var n=ce.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&le.call(n)==de}var Rs=Ne?vn(Ne):function(t){return Cs(t)&&Qr(t)==K};var Ls=ze?vn(ze):function(t){return Cs(t)&&za(t)==tt};function Bs(t){return"string"==typeof t||!ms(t)&&Cs(t)&&Qr(t)==et}function Fs(t){return"symbol"==typeof t||Cs(t)&&Qr(t)==nt}var Os=qe?vn(qe):function(t){return Cs(t)&&js(t.length)&&!!Ee[Qr(t)]};var Ps=ya(fi),Ds=ya(function(t,e){return t<=e});function Us(t){if(!t)return[];if(ys(t))return Bs(t)?Mn(t):na(t);if(fn&&t[fn])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[fn]());var e=za(t);return(e==Y?En:e==tt?Tn:pu)(t)}function Ns(t){return t?(t=Vs(t))===I||t===-I?(t<0?-1:1)*L:t==t?t:0:0===t?t:0}function zs(t){var e=Ns(t),n=e%1;return e==e?n?e-n:e:0}function qs(t){return t?Br(zs(t),0,F):0}function Vs(t){if("number"==typeof t)return t;if(Fs(t))return B;if(Ts(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ts(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Rt,"");var n=Vt.test(t);return n||Ht.test(t)?Ce(t.slice(2),n?2:8):qt.test(t)?B:+t}function Gs(t){return ra(t,au(t))}function Hs(t){return null==t?"":Oi(t)}var Ws=aa(function(t,e){if($a(e)||ys(e))ra(e,iu(e),t);else for(var n in e)ce.call(e,n)&&Cr(t,n,e[n])}),Zs=aa(function(t,e){ra(e,au(e),t)}),Ys=aa(function(t,e,n,r){ra(e,au(e),t,r)}),Xs=aa(function(t,e,n,r){ra(e,iu(e),t,r)}),$s=Aa(Lr);var Js=ki(function(t,e){t=ee(t);var n=-1,i=e.length,a=i>2?e[2]:r;for(a&&Wa(e[0],e[1],a)&&(i=1);++n1),e}),ra(t,Ia(t),n),r&&(n=Fr(n,c|f|h,Ta));for(var i=e.length;i--;)Di(n,e[i]);return n});var lu=Aa(function(t,e){return null==t?{}:function(t,e){return _i(t,e,function(e,n){return tu(t,n)})}(t,e)});function cu(t,e){if(null==t)return{};var n=Je(Ia(t),function(t){return[t]});return e=Fa(e),_i(t,n,function(t,n){return e(t,n[0])})}var fu=ka(iu),hu=ka(au);function pu(t){return null==t?[]:gn(t,iu(t))}var du=la(function(t,e,n){return e=e.toLowerCase(),t+(n?vu(e):e)});function vu(t){return ku(Hs(t).toLowerCase())}function gu(t){return(t=Hs(t))&&t.replace(Zt,bn).replace(me,"")}var mu=la(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),_u=la(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),yu=ua("toLowerCase");var bu=la(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()});var wu=la(function(t,e,n){return t+(n?" ":"")+ku(e)});var xu=la(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),ku=ua("toUpperCase");function Eu(t,e,n){return t=Hs(t),(e=n?r:e)===r?function(t){return we.test(t)}(t)?function(t){return t.match(ye)||[]}(t):function(t){return t.match(Dt)||[]}(t):t.match(e)||[]}var Su=ki(function(t,e){try{return Ve(t,r,e)}catch(t){return ks(t)?t:new Qt(t)}}),ju=Aa(function(t,e){return He(e,function(e){e=lo(e),Rr(t,e,ns(t[e],t))}),t});function Tu(t){return function(){return t}}var Cu=ha(),Au=ha(!0);function Mu(t){return t}function Iu(t){return ui("function"==typeof t?t:Fr(t,c))}var Ru=ki(function(t,e){return function(n){return ri(n,t,e)}}),Lu=ki(function(t,e){return function(n){return ri(t,n,e)}});function Bu(t,e,n){var r=iu(e),i=Xr(e,r);null!=n||Ts(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=Xr(e,iu(e)));var a=!(Ts(n)&&"chain"in n&&!n.chain),o=Es(t);return He(i,function(n){var r=e[n];t[n]=r,o&&(t.prototype[n]=function(){var e=this.__chain__;if(a||e){var n=t(this.__wrapped__);return(n.__actions__=na(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Qe([this.value()],arguments))})}),t}function Fu(){}var Ou=ga(Je),Pu=ga(Ze),Du=ga(en);function Uu(t){return Za(t)?cn(lo(t)):function(t){return function(e){return $r(e,t)}}(t)}var Nu=_a(),zu=_a(!0);function qu(){return[]}function Vu(){return!1}var Gu=va(function(t,e){return t+e},0),Hu=wa("ceil"),Wu=va(function(t,e){return t/e},1),Zu=wa("floor");var Yu,Xu=va(function(t,e){return t*e},1),$u=wa("round"),Ju=va(function(t,e){return t-e},0);return pr.after=function(t,e){if("function"!=typeof e)throw new ie(o);return t=zs(t),function(){if(--t<1)return e.apply(this,arguments)}},pr.ary=ts,pr.assign=Ws,pr.assignIn=Zs,pr.assignInWith=Ys,pr.assignWith=Xs,pr.at=$s,pr.before=es,pr.bind=ns,pr.bindAll=ju,pr.bindKey=rs,pr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ms(t)?t:[t]},pr.chain=Uo,pr.chunk=function(t,e,n){e=(n?Wa(t,e,n):e===r)?1:Hn(zs(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var a=0,o=0,s=$t(Dn(i/e));aa?0:a+n),(i=i===r||i>a?a:zs(i))<0&&(i+=a),i=n>i?0:qs(i);n>>0)?(t=Hs(t))&&("string"==typeof e||null!=e&&!Rs(e))&&!(e=Oi(e))&&kn(t)?Yi(Mn(t),0,n):t.split(e,n):[]},pr.spread=function(t,e){if("function"!=typeof t)throw new ie(o);return e=null==e?0:Hn(zs(e),0),ki(function(n){var r=n[e],i=Yi(n,0,e);return r&&Qe(i,r),Ve(t,this,i)})},pr.tail=function(t){var e=null==t?0:t.length;return e?Mi(t,1,e):[]},pr.take=function(t,e,n){return t&&t.length?Mi(t,0,(e=n||e===r?1:zs(e))<0?0:e):[]},pr.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?Mi(t,(e=i-(e=n||e===r?1:zs(e)))<0?0:e,i):[]},pr.takeRightWhile=function(t,e){return t&&t.length?Ni(t,Fa(e,3),!1,!0):[]},pr.takeWhile=function(t,e){return t&&t.length?Ni(t,Fa(e,3)):[]},pr.tap=function(t,e){return e(t),t},pr.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new ie(o);return Ts(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),is(t,e,{leading:r,maxWait:e,trailing:i})},pr.thru=No,pr.toArray=Us,pr.toPairs=fu,pr.toPairsIn=hu,pr.toPath=function(t){return ms(t)?Je(t,lo):Fs(t)?[t]:na(uo(Hs(t)))},pr.toPlainObject=Gs,pr.transform=function(t,e,n){var r=ms(t),i=r||ws(t)||Os(t);if(e=Fa(e,4),null==n){var a=t&&t.constructor;n=i?r?new a:[]:Ts(t)&&Es(a)?dr(Re(t)):{}}return(i?He:Zr)(t,function(t,r,i){return e(n,t,r,i)}),n},pr.unary=function(t){return ts(t,1)},pr.union=Co,pr.unionBy=Ao,pr.unionWith=Mo,pr.uniq=function(t){return t&&t.length?Pi(t):[]},pr.uniqBy=function(t,e){return t&&t.length?Pi(t,Fa(e,2)):[]},pr.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?Pi(t,r,e):[]},pr.unset=function(t,e){return null==t||Di(t,e)},pr.unzip=Io,pr.unzipWith=Ro,pr.update=function(t,e,n){return null==t?t:Ui(t,e,Hi(n))},pr.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:Ui(t,e,Hi(n),i)},pr.values=pu,pr.valuesIn=function(t){return null==t?[]:gn(t,au(t))},pr.without=Lo,pr.words=Eu,pr.wrap=function(t,e){return cs(Hi(e),t)},pr.xor=Bo,pr.xorBy=Fo,pr.xorWith=Oo,pr.zip=Po,pr.zipObject=function(t,e){return Vi(t||[],e||[],Cr)},pr.zipObjectDeep=function(t,e){return Vi(t||[],e||[],ji)},pr.zipWith=Do,pr.entries=fu,pr.entriesIn=hu,pr.extend=Zs,pr.extendWith=Ys,Bu(pr,pr),pr.add=Gu,pr.attempt=Su,pr.camelCase=du,pr.capitalize=vu,pr.ceil=Hu,pr.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=Vs(n))==n?n:0),e!==r&&(e=(e=Vs(e))==e?e:0),Br(Vs(t),e,n)},pr.clone=function(t){return Fr(t,h)},pr.cloneDeep=function(t){return Fr(t,c|h)},pr.cloneDeepWith=function(t,e){return Fr(t,c|h,e="function"==typeof e?e:r)},pr.cloneWith=function(t,e){return Fr(t,h,e="function"==typeof e?e:r)},pr.conformsTo=function(t,e){return null==e||Or(t,e,iu(e))},pr.deburr=gu,pr.defaultTo=function(t,e){return null==t||t!=t?e:t},pr.divide=Wu,pr.endsWith=function(t,e,n){t=Hs(t),e=Oi(e);var i=t.length,a=n=n===r?i:Br(zs(n),0,i);return(n-=e.length)>=0&&t.slice(n,a)==e},pr.eq=ps,pr.escape=function(t){return(t=Hs(t))&&kt.test(t)?t.replace(wt,wn):t},pr.escapeRegExp=function(t){return(t=Hs(t))&&It.test(t)?t.replace(Mt,"\\$&"):t},pr.every=function(t,e,n){var i=ms(t)?Ze:zr;return n&&Wa(t,e,n)&&(e=r),i(t,Fa(e,3))},pr.find=Vo,pr.findIndex=go,pr.findKey=function(t,e){return rn(t,Fa(e,3),Zr)},pr.findLast=Go,pr.findLastIndex=mo,pr.findLastKey=function(t,e){return rn(t,Fa(e,3),Yr)},pr.floor=Zu,pr.forEach=Ho,pr.forEachRight=Wo,pr.forIn=function(t,e){return null==t?t:Hr(t,Fa(e,3),au)},pr.forInRight=function(t,e){return null==t?t:Wr(t,Fa(e,3),au)},pr.forOwn=function(t,e){return t&&Zr(t,Fa(e,3))},pr.forOwnRight=function(t,e){return t&&Yr(t,Fa(e,3))},pr.get=Ks,pr.gt=ds,pr.gte=vs,pr.has=function(t,e){return null!=t&&qa(t,e,ti)},pr.hasIn=tu,pr.head=yo,pr.identity=Mu,pr.includes=function(t,e,n,r){t=ys(t)?t:pu(t),n=n&&!r?zs(n):0;var i=t.length;return n<0&&(n=Hn(i+n,0)),Bs(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&on(t,e,n)>-1},pr.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:zs(n);return i<0&&(i=Hn(r+i,0)),on(t,e,i)},pr.inRange=function(t,e,n){return e=Ns(e),n===r?(n=e,e=0):n=Ns(n),function(t,e,n){return t>=Wn(e,n)&&t=-R&&t<=R},pr.isSet=Ls,pr.isString=Bs,pr.isSymbol=Fs,pr.isTypedArray=Os,pr.isUndefined=function(t){return t===r},pr.isWeakMap=function(t){return Cs(t)&&za(t)==it},pr.isWeakSet=function(t){return Cs(t)&&Qr(t)==at},pr.join=function(t,e){return null==t?"":Vn.call(t,e)},pr.kebabCase=mu,pr.last=ko,pr.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var a=i;return n!==r&&(a=(a=zs(n))<0?Hn(i+a,0):Wn(a,i-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,a):an(t,un,a,!0)},pr.lowerCase=_u,pr.lowerFirst=yu,pr.lt=Ps,pr.lte=Ds,pr.max=function(t){return t&&t.length?qr(t,Mu,Kr):r},pr.maxBy=function(t,e){return t&&t.length?qr(t,Fa(e,2),Kr):r},pr.mean=function(t){return ln(t,Mu)},pr.meanBy=function(t,e){return ln(t,Fa(e,2))},pr.min=function(t){return t&&t.length?qr(t,Mu,fi):r},pr.minBy=function(t,e){return t&&t.length?qr(t,Fa(e,2),fi):r},pr.stubArray=qu,pr.stubFalse=Vu,pr.stubObject=function(){return{}},pr.stubString=function(){return""},pr.stubTrue=function(){return!0},pr.multiply=Xu,pr.nth=function(t,e){return t&&t.length?gi(t,zs(e)):r},pr.noConflict=function(){return Ie._===this&&(Ie._=ve),this},pr.noop=Fu,pr.now=Ko,pr.pad=function(t,e,n){t=Hs(t);var r=(e=zs(e))?An(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return ma(Un(i),n)+t+ma(Dn(i),n)},pr.padEnd=function(t,e,n){t=Hs(t);var r=(e=zs(e))?An(t):0;return e&&re){var i=t;t=e,e=i}if(n||t%1||e%1){var a=Xn();return Wn(t+a*(e-t+Te("1e-"+((a+"").length-1))),e)}return wi(t,e)},pr.reduce=function(t,e,n){var r=ms(t)?Ke:hn,i=arguments.length<3;return r(t,Fa(e,4),n,i,Ur)},pr.reduceRight=function(t,e,n){var r=ms(t)?tn:hn,i=arguments.length<3;return r(t,Fa(e,4),n,i,Nr)},pr.repeat=function(t,e,n){return e=(n?Wa(t,e,n):e===r)?1:zs(e),xi(Hs(t),e)},pr.replace=function(){var t=arguments,e=Hs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},pr.result=function(t,e,n){var i=-1,a=(e=Wi(e,t)).length;for(a||(a=1,t=r);++iR)return[];var n=F,r=Wn(t,F);e=Fa(e),t-=F;for(var i=dn(r,e);++n=o)return t;var u=n-An(i);if(u<1)return i;var l=s?Yi(s,0,u).join(""):t.slice(0,u);if(a===r)return l+i;if(s&&(u+=l.length-u),Rs(a)){if(t.slice(u).search(a)){var c,f=l;for(a.global||(a=ne(a.source,Hs(zt.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var h=c.index;l=l.slice(0,h===r?u:h)}}else if(t.indexOf(Oi(a),u)!=u){var p=l.lastIndexOf(a);p>-1&&(l=l.slice(0,p))}return l+i},pr.unescape=function(t){return(t=Hs(t))&&xt.test(t)?t.replace(bt,In):t},pr.uniqueId=function(t){var e=++fe;return Hs(t)+e},pr.upperCase=xu,pr.upperFirst=ku,pr.each=Ho,pr.eachRight=Wo,pr.first=yo,Bu(pr,(Yu={},Zr(pr,function(t,e){ce.call(pr.prototype,e)||(Yu[e]=t)}),Yu),{chain:!1}),pr.VERSION="4.17.11",He(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){pr[t].placeholder=pr}),He(["drop","take"],function(t,e){mr.prototype[t]=function(n){n=n===r?1:Hn(zs(n),0);var i=this.__filtered__&&!e?new mr(this):this.clone();return i.__filtered__?i.__takeCount__=Wn(n,i.__takeCount__):i.__views__.push({size:Wn(n,F),type:t+(i.__dir__<0?"Right":"")}),i},mr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),He(["filter","map","takeWhile"],function(t,e){var n=e+1,r=n==A||3==n;mr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Fa(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),He(["head","last"],function(t,e){var n="take"+(e?"Right":"");mr.prototype[t]=function(){return this[n](1).value()[0]}}),He(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");mr.prototype[t]=function(){return this.__filtered__?new mr(this):this[n](1)}}),mr.prototype.compact=function(){return this.filter(Mu)},mr.prototype.find=function(t){return this.filter(t).head()},mr.prototype.findLast=function(t){return this.reverse().find(t)},mr.prototype.invokeMap=ki(function(t,e){return"function"==typeof t?new mr(this):this.map(function(n){return ri(n,t,e)})}),mr.prototype.reject=function(t){return this.filter(us(Fa(t)))},mr.prototype.slice=function(t,e){t=zs(t);var n=this;return n.__filtered__&&(t>0||e<0)?new mr(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=zs(e))<0?n.dropRight(-e):n.take(e-t)),n)},mr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},mr.prototype.toArray=function(){return this.take(F)},Zr(mr.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),a=pr[i?"take"+("last"==e?"Right":""):e],o=i||/^find/.test(e);a&&(pr.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,u=e instanceof mr,l=s[0],c=u||ms(e),f=function(t){var e=a.apply(pr,Qe([t],s));return i&&h?e[0]:e};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var h=this.__chain__,p=!!this.__actions__.length,d=o&&!h,v=u&&!p;if(!o&&c){e=v?e:new mr(this);var g=t.apply(e,s);return g.__actions__.push({func:No,args:[f],thisArg:r}),new gr(g,h)}return d&&v?t.apply(this,s):(g=this.thru(f),d?i?g.value()[0]:g.value():g)})}),He(["pop","push","shift","sort","splice","unshift"],function(t){var e=ae[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);pr.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(ms(i)?i:[],t)}return this[n](function(n){return e.apply(ms(n)?n:[],t)})}}),Zr(mr.prototype,function(t,e){var n=pr[e];if(n){var r=n.name+"";(ir[r]||(ir[r]=[])).push({name:e,func:n})}}),ir[pa(r,g).name]=[{name:"wrapper",func:r}],mr.prototype.clone=function(){var t=new mr(this.__wrapped__);return t.__actions__=na(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=na(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=na(this.__views__),t},mr.prototype.reverse=function(){if(this.__filtered__){var t=new mr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},mr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=ms(t),r=e<0,i=n?t.length:0,a=function(t,e,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},pr.prototype.plant=function(t){for(var e,n=this;n instanceof vr;){var i=fo(n);i.__index__=0,i.__values__=r,e?a.__wrapped__=i:e=i;var a=i;n=n.__wrapped__}return a.__wrapped__=t,e},pr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof mr){var e=t;return this.__actions__.length&&(e=new mr(this)),(e=e.reverse()).__actions__.push({func:No,args:[To],thisArg:r}),new gr(e,this.__chain__)}return this.thru(To)},pr.prototype.toJSON=pr.prototype.valueOf=pr.prototype.value=function(){return zi(this.__wrapped__,this.__actions__)},pr.prototype.first=pr.prototype.head,fn&&(pr.prototype[fn]=function(){return this}),pr}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Ie._=Rn,define(function(){return Rn})):Le?((Le.exports=Rn)._=Rn,Re._=Rn):Ie._=Rn}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],76:[function(t,e,n){(function(n){t("path");var r=t("fs");function i(){this.types=Object.create(null),this.extensions=Object.create(null)}i.prototype.define=function(t){for(var e in t){for(var r=t[e],i=0;i=0;--s)if(h[s]=f,f*=l[s],p=Math.max(p,o.scratchMemory(l[s])),e.shape[s]!==n.shape[s])throw new Error("Shape mismatch, real and imaginary arrays must have same size");var d,v=4*f+p;d="array"===e.dtype||"float64"===e.dtype||"custom"===e.dtype?a.mallocDouble(v):a.mallocFloat(v);var g,m,_,y,b=i(d,l.slice(0),h,0),w=i(d,l.slice(0),h.slice(0),f),x=i(d,l.slice(0),h.slice(0),2*f),k=i(d,l.slice(0),h.slice(0),3*f),E=4*f;for(r.assign(b,e),r.assign(w,n),s=c-1;s>=0&&(o(t,f/l[s],l[s],d,b.offset,w.offset,E),0!==s);--s){for(m=1,_=x.stride,y=k.stride,u=s-1;u=0;--u)y[u]=_[u]=m,m*=l[u];r.assign(x,b),r.assign(k,w),g=b,b=x,x=g,g=w,w=k,k=g}r.assign(e,b),r.assign(n,w),a.free(d)}},{"./lib/fft-matrix.js":79,ndarray:84,"ndarray-ops":81,"typedarray-pool":144}],79:[function(t,e,n){var r=t("bit-twiddle");function i(t,e,n,i,a,o){var s,u,l,c,f,h,p,d,v,g,m,_,y,b,w,x,k,E,S,j,T,C,A,M;for(t|=0,e|=0,a|=0,o|=0,s=n|=0,u=r.log2(s),E=0;E>1,f=0,l=0;l>=1;f+=h}for(m=-1,_=0,g=1,d=0;d>",rrshift:">>>"};!function(){for(var t in s){var e=s[t];n[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),n[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),n[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),n[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];n[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),n[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in l){var e=l[t];n[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),n[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),n[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),n[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),n.norm1=r({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),n.sup=r({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),n.inf=r({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),n.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),n.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),n.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),n.equals=r({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":15}],82:[function(t,e,n){"use strict";var r=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var n=[],a=t,o=1;Array.isArray(a);)n.push(a.length),o*=a.length,a=a[0];return 0===n.length?r():(e||(e=r(new Float64Array(o),n)),i(e,t),e)}},{"./doConvert.js":83,ndarray:84}],83:[function(t,e,n){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":15}],84:[function(t,e,n){var r=t("iota-array"),i=t("is-buffer"),a="undefined"!=typeof Float64Array;function o(t,e){return t[0]-e[0]}function s(){var t,e=this.stride,n=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+n+"_set("+u.join(",")+",v){"),i?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+n+"_get("+u.join(",")+"){"),i?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+n+"_index(",u.join(),"){return "+c+"}"),a.push("proto.hi=function "+n+"_hi("+u.join(",")+"){return new "+n+"(this.data,"+o.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+o.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=o.map(function(t){return"a"+t+"=this.shape["+t+"]"}),d=o.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+n+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var v=0;v=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=d}");a.push("return new "+n+"(this.data,"+o.map(function(t){return"a"+t}).join(",")+","+o.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+n+"_step("+u.join(",")+"){var "+o.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+o.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(v=0;v=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+o.map(function(t){return"shape["+t+"]"}).join(",")+","+o.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(l[t],s)}var l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=function(t,e,n,r){if(void 0===t)return(0,l.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var o=e.length;if(void 0===n){n=new Array(o);for(var s=o-1,c=1;s>=0;--s)n[s]=c,c*=e[s]}if(void 0===r)for(r=0,s=0;s>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}},{}],86:[function(t,e,n){(function(n,r){"use strict";var i=t("util"),a=t("stream"),o=e.exports=function(){a.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};i.inherits(o,a),o.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),n.nextTick(function(){this._process(),this._paused&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(t,e){return this.writable?(r.isBuffer(t)||(t=new r(t,e||this._encoding)),this._buffers.push(t),this._buffered+=t.length,this._process(),this._reads&&0==this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1)},o.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0==this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._process=function(){for(;this._buffered>0&&this._reads&&this._reads.length>0;){var t=this._reads[0];if(t.allowLess){this._reads.shift(),(a=this._buffers[0]).length>t.length?(this._buffered-=t.length,this._buffers[0]=a.slice(t.length),t.func.call(this,a.slice(0,t.length))):(this._buffered-=a.length,this._buffers.shift(),t.func.call(this,a))}else{if(!(this._buffered>=t.length))break;this._reads.shift();for(var e=0,n=0,i=new r(t.length);e0&&this._buffers.splice(0,n),this._buffered-=t.length,t.func.call(this,i)}}this._buffers&&this._buffers.length>0&&null==this._buffers[0]&&this._end()}}).call(this,t("_process"),t("buffer").Buffer)},{_process:117,buffer:47,stream:139,util:150}],87:[function(t,e,n){"use strict";e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLOR_PALETTE:1,COLOR_COLOR:2,COLOR_ALPHA:4}},{}],88:[function(t,e,n){"use strict";var r=t("util"),i=t("stream"),a=e.exports=function(){i.call(this),this._crc=-1,this.writable=!0};r.inherits(a,i),a.prototype.write=function(t){for(var e=0;e>>8;return!0},a.prototype.end=function(t){t&&this.write(t),this.emit("crc",this.crc32())},a.prototype.crc32=function(){return-1^this._crc},a.crc32=function(t){for(var e=-1,n=0;n>>8;return-1^e};for(var o=[],s=0;s<256;s++){for(var u=s,l=0;l<8;l++)1&u?u=3988292384^u>>>1:u>>>=1;o[s]=u}},{stream:139,util:150}],89:[function(t,e,n){(function(n){"use strict";var r=t("util"),i=(t("zlib"),t("./chunkstream")),a=e.exports=function(t,e,n,r,a){i.call(this),this._width=t,this._height=e,this._Bpp=n,this._data=r,this._options=a,this._line=0,"filterType"in a&&-1!=a.filterType?"number"==typeof a.filterType&&(a.filterType=[a.filterType]):a.filterType=[0,1,2,3,4],this._filters={0:this._filterNone.bind(this),1:this._filterSub.bind(this),2:this._filterUp.bind(this),3:this._filterAvg.bind(this),4:this._filterPaeth.bind(this)},this.read(this._width*n+1,this._reverseFilterLine.bind(this))};r.inherits(a,i);var o={1:{0:0,1:0,2:0,3:255},2:{0:0,1:0,2:0,3:1},3:{0:0,1:1,2:2,3:255},4:{0:0,1:1,2:2,3:3}};a.prototype._reverseFilterLine=function(t){var e=this._data,n=this._width<<2,r=this._line*n,i=t[0];if(0==i)for(var a=0;a0?e[u+c-4]:0;e[u+c]=255!=f?t[l+f]+h:255}else if(2==i)for(a=0;a0?e[u-n+c]:0;e[u+c]=255!=f?t[l+f]+p:255}else if(3==i)for(a=0;a0?e[u+c-4]:0,p=this._line>0?e[u-n+c]:0;var d=Math.floor((h+p)/2);e[u+c]=255!=f?t[l+f]+d:255}else if(4==i)for(a=0;a0?e[u+c-4]:0,p=this._line>0?e[u-n+c]:0;var v=a>0&&this._line>0?e[u-n+c-4]:0;d=s(h,p,v);e[u+c]=255!=f?t[l+f]+d:255}this._line++,this._line=4?t[e*r+o-4]:0,u=t[e*r+o]-s;n?n[e*i+1+o]=u:a+=Math.abs(u)}return a},a.prototype._filterUp=function(t,e,n){var r=this._width<<2,i=r+1,a=0;n&&(n[e*i]=2);for(var o=0;o0?t[(e-1)*r+o]:0,u=t[e*r+o]-s;n?n[e*i+1+o]=u:a+=Math.abs(u)}return a},a.prototype._filterAvg=function(t,e,n){var r=this._width<<2,i=r+1,a=0;n&&(n[e*i]=3);for(var o=0;o=4?t[e*r+o-4]:0,u=e>0?t[(e-1)*r+o]:0,l=t[e*r+o]-(s+u>>1);n?n[e*i+1+o]=l:a+=Math.abs(l)}return a},a.prototype._filterPaeth=function(t,e,n){var r=this._width<<2,i=r+1,a=0;n&&(n[e*i]=4);for(var o=0;o=4?t[e*r+o-4]:0,l=e>0?t[(e-1)*r+o]:0,c=o>=4&&e>0?t[(e-1)*r+o-4]:0,f=t[e*r+o]-s(u,l,c);n?n[e*i+1+o]=f:a+=Math.abs(f)}return a};var s=function(t,e,n){var r=t+e-n,i=Math.abs(r-t),a=Math.abs(r-e),o=Math.abs(r-n);return i<=a&&i<=o?t:a<=o?e:n}}).call(this,t("buffer").Buffer)},{"./chunkstream":86,buffer:47,util:150,zlib:45}],90:[function(t,e,n){(function(n){"use strict";var r=t("util"),i=t("stream"),a=t("zlib"),o=t("./filter"),s=t("./crc"),u=t("./constants"),l=e.exports=function(t){i.call(this),this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=t.deflateLevel||9,t.deflateStrategy=t.deflateStrategy||3,this.readable=!0};r.inherits(l,i),l.prototype.pack=function(t,e,r){this.emit("data",new n(u.PNG_SIGNATURE)),this.emit("data",this._packIHDR(e,r));t=new o(e,r,4,t,this._options).filter();var i=a.createDeflate({chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy});i.on("error",this.emit.bind(this,"error")),i.on("data",function(t){this.emit("data",this._packIDAT(t))}.bind(this)),i.on("end",function(){this.emit("data",this._packIEND()),this.emit("end")}.bind(this)),i.end(t)},l.prototype._packChunk=function(t,e){var r=e?e.length:0,i=new n(r+12);return i.writeUInt32BE(r,0),i.writeUInt32BE(t,4),e&&e.copy(i,8),i.writeInt32BE(s.crc32(i.slice(4,i.length-4)),i.length-4),i},l.prototype._packIHDR=function(t,e){var r=new n(13);return r.writeUInt32BE(t,0),r.writeUInt32BE(e,4),r[8]=8,r[9]=6,r[10]=0,r[11]=0,r[12]=0,this._packChunk(u.TYPE_IHDR,r)},l.prototype._packIDAT=function(t){return this._packChunk(u.TYPE_IDAT,t)},l.prototype._packIEND=function(){return this._packChunk(u.TYPE_IEND,null)}}).call(this,t("buffer").Buffer)},{"./constants":87,"./crc":88,"./filter":89,buffer:47,stream:139,util:150,zlib:45}],91:[function(t,e,n){(function(n){"use strict";var r=t("util"),i=t("zlib"),a=t("./crc"),o=t("./chunkstream"),s=t("./constants"),u=t("./filter"),l=e.exports=function(t){o.call(this),this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._inflate=null,this._filter=null,this._crc=null,this._palette=[],this._colorType=0,this._chunks={},this._chunks[s.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[s.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[s.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[s.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[s.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[s.TYPE_gAMA]=this._handleGAMA.bind(this),this.writable=!0,this.on("error",this._handleError.bind(this)),this._handleSignature()};r.inherits(l,o),l.prototype._handleError=function(){this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy()},l.prototype._handleSignature=function(){this.read(s.PNG_SIGNATURE.length,this._parseSignature.bind(this))},l.prototype._parseSignature=function(t){for(var e=s.PNG_SIGNATURE,n=0;nthis._palette.length)return void this.emit("error",new Error("More transparent colors than palette size"));for(var e=0;e0?this._handleIDAT(t):this._handleChunkEnd()},l.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},l.prototype._parseIEND=function(t){this._crc.write(t),this._inflate.end(),this._hasIEND=!0,this._handleChunkEnd()};var c={0:1,2:3,3:1,4:2,6:4};l.prototype._reverseFiltered=function(t,e,n){if(3==this._colorType)for(var r=e<<2,i=0;i0&&this.height>0?new r(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(t||{}),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new s(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(u,a),u.prototype.pack=function(){return e.nextTick(function(){this._packer.pack(this.data,this.width,this.height)}.bind(this)),this},u.prototype.parse=function(t,e){if(e){var n,r=null;this.once("parsed",n=function(t){this.removeListener("error",r),this.data=t,e(null,this)}.bind(this)),this.once("error",r=function(t){this.removeListener("parsed",n),e(t,null)}.bind(this))}return this.end(t),this},u.prototype.write=function(t){return this._parser.write(t),!0},u.prototype.end=function(t){this._parser.end(t)},u.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.data=t.data,delete t.data,this.emit("metadata",t)},u.prototype._gamma=function(t){this.gamma=t},u.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},u.prototype.bitblt=function(t,e,n,r,i,a,o){if(e>this.width||n>this.height||e+r>this.width||n+i>this.height)throw new Error("bitblt reading outside image");if(a>t.width||o>t.height||a+r>t.width||o+i>t.height)throw new Error("bitblt writing outside image");for(var s=0;s>=u,c-=u,g!==a){if(g===o)break;for(var m=ga;)y=d[y]>>8,++_;var b=y;if(h+_+(m!==g?1:0)>r)return void console.log("Warning, gif stream longer than expected.");n[h++]=b;var w=h+=_;for(m!==g&&(n[h++]=b),y=m;_--;)y=d[y],n[--w]=255&y,y>>=8;null!==v&&s<4096&&(d[s++]=v<<8|b,s>=l+1&&u<12&&(++u,l=l<<1|1)),v=g}else s=o+1,l=(1<<(u=i+1))-1,v=null}return h!==r&&console.log("Warning, gif stream shorter than expected."),n}try{n.GifWriter=function(t,e,n,r){var i=0,a=void 0===(r=void 0===r?{}:r).loop?null:r.loop,o=void 0===r.palette?null:r.palette;if(e<=0||n<=0||e>65535||n>65535)throw new Error("Width/Height invalid.");function s(t){var e=t.length;if(e<2||e>256||e&e-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return e}t[i++]=71,t[i++]=73,t[i++]=70,t[i++]=56,t[i++]=57,t[i++]=97;var u=0,l=0;if(null!==o){for(var c=s(o);c>>=1;)++u;if(c=1<=c)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&n,t[i++]=n>>8&255,t[i++]=(null!==o?128:0)|u,t[i++]=l,t[i++]=0,null!==o)for(var f=0,h=o.length;f>16&255,t[i++]=p>>8&255,t[i++]=255&p}if(null!==a){if(a<0||a>65535)throw new Error("Loop count invalid.");t[i++]=33,t[i++]=255,t[i++]=11,t[i++]=78,t[i++]=69,t[i++]=84,t[i++]=83,t[i++]=67,t[i++]=65,t[i++]=80,t[i++]=69,t[i++]=50,t[i++]=46,t[i++]=48,t[i++]=3,t[i++]=1,t[i++]=255&a,t[i++]=a>>8&255,t[i++]=0}var d=!1;this.addFrame=function(e,n,r,a,u,l){if(!0===d&&(--i,d=!1),l=void 0===l?{}:l,e<0||n<0||e>65535||n>65535)throw new Error("x/y invalid.");if(r<=0||a<=0||r>65535||a>65535)throw new Error("Width/Height invalid.");if(u.length>=1;)++p;h=1<3)throw new Error("Disposal out of range.");var m=!1,_=0;if(void 0!==l.transparent&&null!==l.transparent&&(m=!0,(_=l.transparent)<0||_>=h))throw new Error("Transparent color index.");if((0!==g||m||0!==v)&&(t[i++]=33,t[i++]=249,t[i++]=4,t[i++]=g<<2|(!0===m?1:0),t[i++]=255&v,t[i++]=v>>8&255,t[i++]=_,t[i++]=0),t[i++]=44,t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&n,t[i++]=n>>8&255,t[i++]=255&r,t[i++]=r>>8&255,t[i++]=255&a,t[i++]=a>>8&255,t[i++]=!0===c?128|p-1:0,!0===c)for(var y=0,b=f.length;y>16&255,t[i++]=w>>8&255,t[i++]=255&w}return i=function(t,e,n,r){t[e++]=n;var i=e++,a=1<=n;)t[e++]=255&f,f>>=8,c-=8,e===i+256&&(t[i]=255,i=e++)}function p(t){f|=t<=8;)t[e++]=255&f,f>>=8,c-=8,e===i+256&&(t[i]=255,i=e++);4096===u?(p(a),u=s+1,l=n+1,v={}):(u>=1<>7,s=1<<1+(7&a);t[e++],t[e++];var u=null,l=null;o&&(u=e,l=s,e+=3*s);var c=!0,f=[],h=0,p=null,d=0,v=null;for(this.width=n,this.height=i;c&&e=0))throw Error("Invalid block size");if(0===C)break;e+=C}break;case 249:if(4!==t[e++]||0!==t[e+4])throw new Error("Invalid graphics extension block.");var g=t[e++];h=t[e++]|t[e++]<<8,p=t[e++],0==(1&g)&&(p=null),d=g>>2&7,e++;break;case 254:for(;;){if(!((C=t[e++])>=0))throw Error("Invalid block size");if(0===C)break;e+=C}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var m=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,b=t[e++]|t[e++]<<8,w=t[e++],x=w>>6&1,k=1<<1+(7&w),E=u,S=l,j=!1;w>>7&&(j=!0,E=e,S=k,e+=3*k);var T=e;for(e++;;){var C;if(!((C=t[e++])>=0))throw Error("Invalid block size");if(0===C)break;e+=C}f.push({x:m,y:_,width:y,height:b,has_local_palette:j,palette_offset:E,palette_size:S,data_offset:T,data_length:e-T,transparent_index:p,interlaced:!!x,delay:h,disposal:d});break;case 59:c=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return v},this.frameInfo=function(t){if(t<0||t>=f.length)throw new Error("Frame index out of range.");return f[t]},this.decodeAndBlitFrameBGRA=function(e,i){var a=this.frameInfo(e),o=a.width*a.height,s=new Uint8Array(o);r(t,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),v=p,g=4*f;!0===a.interlaced&&(g+=4*n*7);for(var m=8,_=0,y=s.length;_=d&&(g=4*f+4*n*(m-1),v=p+(c+f)*(m<<1),m>>=1)),b===l)v+=4;else{var w=t[u+3*b],x=t[u+3*b+1],k=t[u+3*b+2];i[v++]=k,i[v++]=x,i[v++]=w,i[v++]=255}--h}},this.decodeAndBlitFrameRGBA=function(e,i){var a=this.frameInfo(e),o=a.width*a.height,s=new Uint8Array(o);r(t,a.data_offset,s,o);var u=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var c=a.width,f=n-c,h=c,p=4*(a.y*n+a.x),d=4*((a.y+a.height)*n+a.x),v=p,g=4*f;!0===a.interlaced&&(g+=4*n*7);for(var m=8,_=0,y=s.length;_=d&&(g=4*f+4*n*(m-1),v=p+(c+f)*(m<<1),m>>=1)),b===l)v+=4;else{var w=t[u+3*b],x=t[u+3*b+1],k=t[u+3*b+2];i[v++]=w,i[v++]=x,i[v++]=k,i[v++]=255}--h}}}}catch(t){}},{}],94:[function(t,e,n){(function(n){var r=t("charm");function i(t){if(!(t=t||{}).total)throw new Error("You MUST specify the total number of operations that will be processed.");this.total=t.total,this.current=0,this.max_burden=t.maxBurden||.5,this.show_burden=t.showBurden||!1,this.started=!1,this.size=50,this.inner_time=0,this.outer_time=0,this.elapsed=0,this.time_start=0,this.time_end=0,this.time_left=0,this.time_burden=0,this.skip_steps=0,this.skipped=0,this.aborted=!1,this.charm=r(),this.charm.pipe(n.stdout),this.charm.write("\n\n\n")}function a(t,e,n){for(n=n||" ";t.length3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(u[1]||"").length=this.total&&this.finished(),this.time_end=(new Date).getTime(),this.inner_time=this.time_end-this.time_start)},i.prototype.updateTimes=function(){this.elapsed=this.time_start-this.started,this.time_end>0&&(this.outer_time=this.time_start-this.time_end),this.inner_time>0&&this.outer_time>0&&(this.time_burden=this.inner_time/(this.inner_time+this.outer_time)*100,this.time_left=this.elapsed/this.current*(this.total-this.current),this.time_left<0&&(this.time_left=0)),this.time_burden>this.max_burden&&this.skip_steps0&&this.current=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var a=n.isAbsolute(t),o="/"===i(t,-1);return(t=e(r(t.split("/"),function(t){return!!t}),!a).join("/"))||a||(t="."),t&&o&&(t+="/"),(a?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),a=r(e.split("/")),o=Math.min(i.length,a.length),s=o,u=0;u=1;--a)if(47===(e=t.charCodeAt(a))){if(!i){r=a;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":t.slice(0,r)},n.basename=function(t,e){var n=function(t){"string"!=typeof t&&(t+="");var e,n=0,r=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){n=e+1;break}}else-1===r&&(i=!1,r=e+1);return-1===r?"":t.slice(n,r)}(t);return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,n=0,r=-1,i=!0,a=0,o=t.length-1;o>=0;--o){var s=t.charCodeAt(o);if(47!==s)-1===r&&(i=!1,r=o+1),46===s?-1===e?e=o:1!==a&&(a=1):-1!==e&&(a=-1);else if(!i){n=o+1;break}}return-1===e||-1===r||0===a||1===a&&e===r-1&&e===n+1?"":t.slice(e,r)};var i="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,t("_process"))},{_process:117}],96:[function(t,e,n){(function(e){"use strict";var r=t("./interlace"),i={1:{0:0,1:0,2:0,3:255},2:{0:0,1:0,2:0,3:1},3:{0:0,1:1,2:2,3:255},4:{0:0,1:1,2:2,3:3}};function a(t,e,n,r,a,o){for(var s=t.width,u=t.height,l=t.index,c=0;c>4,n.push(f,c);break;case 2:u=3&h,l=h>>2&3,c=h>>4&3,f=h>>6&3,n.push(f,c,l,u);break;case 1:i=1&h,a=h>>1&1,o=h>>2&1,s=h>>3&1,u=h>>4&1,l=h>>5&1,c=h>>6&1,f=h>>7&1,n.push(f,c,l,u,s,o,a,i)}}return{get:function(t){for(;n.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(t,e){return this.writable?(n=r.isBuffer(t)?t:new r(t,e||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var n},o.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._processReadAllowingLess=function(t){this._reads.shift();var e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},o.prototype._processRead=function(t){this._reads.shift();for(var e=0,n=0,i=new r(t.length);e0&&this._buffers.splice(0,n),this._buffered-=t.length,t.func.call(this,i)},o.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(t){this.emit("error",t)}}}).call(this,t("_process"),t("buffer").Buffer)},{_process:117,buffer:47,stream:139,util:150}],99:[function(t,e,n){"use strict";e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],100:[function(t,e,n){"use strict";var r=[];!function(){for(var t=0;t<256;t++){for(var e=t,n=0;n<8;n++)1&e?e=3988292384^e>>>1:e>>>=1;r[t]=e}}();var i=e.exports=function(){this._crc=-1};i.prototype.write=function(t){for(var e=0;e>>8;return!0},i.prototype.crc32=function(){return-1^this._crc},i.crc32=function(t){for(var e=-1,n=0;n>>8;return-1^e}},{}],101:[function(t,e,n){(function(n){"use strict";var r=t("./paeth-predictor");var i={0:function(t,e,n,r,i){t.copy(r,i,e,e+n)},1:function(t,e,n,r,i,a){for(var o=0;o=a?t[e+o-a]:0,u=t[e+o]-s;r[i+o]=u}},2:function(t,e,n,r,i){for(var a=0;a0?t[e+a-n]:0,s=t[e+a]-o;r[i+a]=s}},3:function(t,e,n,r,i,a){for(var o=0;o=a?t[e+o-a]:0,u=e>0?t[e+o-n]:0,l=t[e+o]-(s+u>>1);r[i+o]=l}},4:function(t,e,n,i,a,o){for(var s=0;s=o?t[e+s-o]:0,l=e>0?t[e+s-n]:0,c=e>0&&s>=o?t[e+s-(n+o)]:0,f=t[e+s]-r(u,l,c);i[a+s]=f}}},a={0:function(t,e,n){for(var r=0,i=e+n,a=e;a=r?t[e+a-r]:0,s=t[e+a]-o;i+=Math.abs(s)}return i},2:function(t,e,n){for(var r=0,i=e+n,a=e;a0?t[a-n]:0,s=t[a]-o;r+=Math.abs(s)}return r},3:function(t,e,n,r){for(var i=0,a=0;a=r?t[e+a-r]:0,s=e>0?t[e+a-n]:0,u=t[e+a]-(o+s>>1);i+=Math.abs(u)}return i},4:function(t,e,n,i){for(var a=0,o=0;o=i?t[e+o-i]:0,u=e>0?t[e+o-n]:0,l=e>0&&o>=i?t[e+o-(n+i)]:0,c=t[e+o]-r(s,u,l);a+=Math.abs(c)}return a}};e.exports=function(t,e,r,o,s){var u;if("filterType"in o&&-1!==o.filterType){if("number"!=typeof o.filterType)throw new Error("unrecognised filter types");u=[o.filterType]}else u=[0,1,2,3,4];for(var l=e*s,c=0,f=0,h=new n((l+1)*r),p=u[0],d=0;d1)for(var v=1/0,g=0;gi?e[a-r]:0;e[a]=o+s}},o.prototype._unFilterType2=function(t,e,n){for(var r=this._lastLine,i=0;ii?e[o-r]:0,c=Math.floor((l+u)/2);e[o]=s+c}},o.prototype._unFilterType4=function(t,e,n){for(var r=this._xComparison,a=r-1,o=this._lastLine,s=0;sa?e[s-r]:0,f=s>a&&o?o[s-r]:0,h=i(c,l,f);e[s]=u+h}},o.prototype._reverseFilterLine=function(t){var e,r=t[0],i=this._images[this._imageIndex],a=i.byteWidth;if(0===r)e=t.slice(1,a+1);else switch(e=new n(a),r){case 1:this._unFilterType1(t,e,a);break;case 2:this._unFilterType2(t,e,a);break;case 3:this._unFilterType3(t,e,a);break;case 4:this._unFilterType4(t,e,a);break;default:throw new Error("Unrecognised filter type - "+r)}this.write(e),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=e,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,t("buffer").Buffer)},{"./interlace":106,"./paeth-predictor":110,buffer:47}],105:[function(t,e,n){(function(t){"use strict";e.exports=function(e,n){var r=n.depth,i=n.width,a=n.height,o=n.colorType,s=n.transColor,u=n.palette,l=e;return 3===o?function(t,e,n,r,i){for(var a=0,o=0;o0&&f>0&&n.push({width:c,height:f,index:u})}return n},n.getInterlaceIterator=function(t){return function(e,n,i){var a=e%r[i].x.length,o=(e-a)/r[i].x.length*8+r[i].x[a],s=n%r[i].y.length;return 4*o+((n-s)/r[i].y.length*8+r[i].y[s])*t*4}}},{}],107:[function(t,e,n){(function(n){"use strict";var r=t("util"),i=t("stream"),a=t("./constants"),o=t("./packer"),s=e.exports=function(t){i.call(this);var e=t||{};this._packer=new o(e),this._deflate=this._packer.createDeflate(),this.readable=!0};r.inherits(s,i),s.prototype.pack=function(t,e,r,i){this.emit("data",new n(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,r)),i&&this.emit("data",this._packer.packGAMA(i));var o=this._packer.filterData(t,e,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}}).call(this,t("buffer").Buffer)},{"./constants":99,"./packer":109,buffer:47,stream:139,util:150}],108:[function(t,e,n){(function(n){"use strict";var r=!0,i=t("zlib");i.deflateSync||(r=!1);var a=t("./constants"),o=t("./packer");e.exports=function(t,e){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var s=new o(e||{}),u=[];u.push(new n(a.PNG_SIGNATURE)),u.push(s.packIHDR(t.width,t.height)),t.gamma&&u.push(s.packGAMA(t.gamma));var l=s.filterData(t.data,t.width,t.height),c=i.deflateSync(l,s.getDeflateOptions());if(l=null,!c||!c.length)throw new Error("bad png - invalid compressed data response");return u.push(s.packIDAT(c)),u.push(s.packIEND()),n.concat(u)}}).call(this,t("buffer").Buffer)},{"./constants":99,"./packer":109,buffer:47,zlib:45}],109:[function(t,e,n){(function(n){"use strict";var r=t("./constants"),i=t("./crc"),a=t("./bitpacker"),o=t("./filter-pack"),s=t("zlib"),u=e.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||s.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:r.COLORTYPE_COLOR_ALPHA,t.colorType!==r.COLORTYPE_COLOR&&t.colorType!==r.COLORTYPE_COLOR_ALPHA)throw new Error("option color type:"+t.colorType+" is not supported at present");if(8!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};u.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},u.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},u.prototype.filterData=function(t,e,n){var i=a(t,e,n,this._options),s=r.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(i,e,n,this._options,s)},u.prototype._packChunk=function(t,e){var r=e?e.length:0,a=new n(r+12);return a.writeUInt32BE(r,0),a.writeUInt32BE(t,4),e&&e.copy(a,8),a.writeInt32BE(i.crc32(a.slice(4,a.length-4)),a.length-4),a},u.prototype.packGAMA=function(t){var e=new n(4);return e.writeUInt32BE(Math.floor(t*r.GAMMA_DIVISION),0),this._packChunk(r.TYPE_gAMA,e)},u.prototype.packIHDR=function(t,e){var i=new n(13);return i.writeUInt32BE(t,0),i.writeUInt32BE(e,4),i[8]=this._options.bitDepth,i[9]=this._options.colorType,i[10]=0,i[11]=0,i[12]=0,this._packChunk(r.TYPE_IHDR,i)},u.prototype.packIDAT=function(t){return this._packChunk(r.TYPE_IDAT,t)},u.prototype.packIEND=function(){return this._packChunk(r.TYPE_IEND,null)}}).call(this,t("buffer").Buffer)},{"./bitpacker":97,"./constants":99,"./crc":100,"./filter-pack":101,buffer:47,zlib:45}],110:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=t+e-n,i=Math.abs(r-t),a=Math.abs(r-e),o=Math.abs(r-n);return i<=a&&i<=o?t:a<=o?e:n}},{}],111:[function(t,e,n){"use strict";var r=t("util"),i=t("zlib"),a=t("./chunkstream"),o=t("./filter-parse-async"),s=t("./parser"),u=t("./bitmapper"),l=t("./format-normaliser"),c=e.exports=function(t){a.call(this),this._parser=new s(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};r.inherits(c,a),c.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this.errord=!0},c.prototype._inflateData=function(t){this._inflate||(this._inflate=i.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter)),this._inflate.write(t)},c.prototype._handleMetaData=function(t){this.emit("metadata",t),this._bitmapInfo=Object.create(t),this._filter=new o(this._bitmapInfo)},c.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},c.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},c.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},c.prototype._complete=function(t){if(!this.errord){try{var e=u.dataToBitMap(t,this._bitmapInfo),n=l(e,this._bitmapInfo);e=null}catch(t){return void this._handleError(t)}this.emit("parsed",n)}}},{"./bitmapper":96,"./chunkstream":98,"./filter-parse-async":102,"./format-normaliser":105,"./parser":113,util:150,zlib:45}],112:[function(t,e,n){(function(n){"use strict";var r=!0,i=t("zlib");i.deflateSync||(r=!1);var a=t("./sync-reader"),o=t("./filter-parse-sync"),s=t("./parser"),u=t("./bitmapper"),l=t("./format-normaliser");e.exports=function(t,e){if(!r)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var c,f,h;var p=[];var d=new a(t);if(new s(e,{read:d.read.bind(d),error:function(t){c=t},metadata:function(t){f=t},gamma:function(t){h=t},palette:function(t){f.palette=t},transColor:function(t){f.transColor=t},inflateData:function(t){p.push(t)}}).start(),d.process(),c)throw c;var v=n.concat(p);p.length=0;var g=i.inflateSync(v);if(v=null,!g||!g.length)throw new Error("bad png - invalid inflate data response");var m=o.process(g,f);v=null;var _=u.dataToBitMap(m,f);m=null;var y=l(_,f);return f.data=y,f.gamma=h||0,f}}).call(this,t("buffer").Buffer)},{"./bitmapper":96,"./filter-parse-sync":103,"./format-normaliser":105,"./parser":113,"./sync-reader":116,buffer:47,zlib:45}],113:[function(t,e,n){(function(n){"use strict";var r=t("./constants"),i=t("./crc"),a=e.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[r.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[r.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[r.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[r.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[r.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[r.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.inflateData=e.inflateData,this.finished=e.finished};a.prototype.start=function(){this.read(r.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(t){for(var e=r.PNG_SIGNATURE,n=0;nthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var e=0;e0?this._handleIDAT(n):this._handleChunkEnd()},a.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},a.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,t("buffer").Buffer)},{"./constants":99,"./crc":100,buffer:47}],114:[function(t,e,n){"use strict";var r=t("./parser-sync"),i=t("./packer-sync");n.read=function(t,e){return r(t,e||{})},n.write=function(t){return i(t)}},{"./packer-sync":108,"./parser-sync":112}],115:[function(t,e,n){(function(e,r){"use strict";var i=t("util"),a=t("stream"),o=t("./parser-async"),s=t("./packer-async"),u=t("./png-sync"),l=n.PNG=function(t){a.call(this),t=t||{},this.width=t.width||0,this.height=t.height||0,this.data=this.width>0&&this.height>0?new r(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new s(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(l,a),l.sync=u,l.prototype.pack=function(){return this.data&&this.data.length?(e.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(t,e){var n,r;e&&(n=function(t){this.removeListener("error",r),this.data=t,e(null,this)}.bind(this),r=function(t){this.removeListener("parsed",n),e(t,null)}.bind(this),this.once("parsed",n),this.once("error",r));return this.end(t),this},l.prototype.write=function(t){return this._parser.write(t),!0},l.prototype.end=function(t){this._parser.end(t)},l.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},l.prototype._gamma=function(t){this.gamma=t},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(t,e,n,r,i,a,o,s){if(n>t.width||r>t.height||n+i>t.width||r+a>t.height)throw new Error("bitblt reading outside image");if(o>e.width||s>e.height||o+i>e.width||s+a>e.height)throw new Error("bitblt writing outside image");for(var u=0;u0&&this._buffer.length;){var t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;this._reads.shift();var e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],117:[function(t,e,n){var r,i,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var l,c=[],f=!1,h=-1;function p(){f&&l&&(f=!1,l.length?c=l.concat(c):h=-1,c.length&&d())}function d(){if(!f){var t=u(p);f=!0;for(var e=c.length;e;){for(l=c,c=[];++h1)for(var n=1;n0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===l.prototype||(e=function(t){return l.from(t)}(e)),r?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(e=o.decoder.write(e),o.objectMode||0!==e.length?w(t,o,e,!1):j(t,o)):w(t,o,e,!1))):r||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=x?t=x:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(S,t):S(t))}function S(t){p("emit readable"),t.emit("readable"),M(t)}function j(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(T,t,e))}function T(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;ta.length?a.length:t;if(o===a.length?i+=a:i+=a.slice(0,t),0===(t-=o)){o===a.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=a.slice(o));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=l.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var a=r.data,o=t>a.length?a.length:t;if(a.copy(n,n.length-t,0,o),0===(t-=o)){o===a.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=a.slice(o));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function R(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(L,e,t))}function L(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function B(t,e){for(var n=0,r=t.length;n=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):E(this),null;if(0===(t=k(t,e))&&e.ended)return 0===e.length&&R(this),null;var r,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&R(this)),null!==r&&this.emit("data",r),r},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(t,e){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,p("pipe count=%d opts=%j",a.pipesCount,e);var u=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?c:y;function l(e,n){p("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),t.removeListener("close",m),t.removeListener("finish",_),t.removeListener("drain",f),t.removeListener("error",g),t.removeListener("unpipe",l),r.removeListener("end",c),r.removeListener("end",y),r.removeListener("data",v),h=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function c(){p("onend"),t.end()}a.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",l);var f=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,M(t))}}(r);t.on("drain",f);var h=!1;var d=!1;function v(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==B(a.pipes,t))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function g(e){p("onerror",e),y(),t.removeListener("error",g),0===s(t,"error")&&t.emit("error",e)}function m(){t.removeListener("finish",_),y()}function _(){p("onfinish"),t.removeListener("close",m),y()}function y(){p("unpipe"),r.unpipe(t)}return r.on("data",v),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",g),t.once("close",m),t.once("finish",_),t.emit("pipe",r),a.flowing||(p("pipe resume"),r.resume()),t},y.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a-1?i:a.nextTick;_.WritableState=m;var l=t("core-util-is");l.inherits=t("inherits");var c={deprecate:t("util-deprecate")},f=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,p=r.Uint8Array||function(){};var d,v=t("./internal/streams/destroy");function g(){}function m(e,n){s=s||t("./_stream_duplex"),e=e||{};var r=n instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(a.nextTick(i,r),a.nextTick(E,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),E(t,e))}(t,n,r,e,i);else{var o=x(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||w(t,n),r?u(b,t,n,o,i):b(t,n,o,i)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(e){if(s=s||t("./_stream_duplex"),!(d.call(_,this)||this instanceof s))return new _(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function y(t,e,n,r,i,a,o){e.writelen=r,e.writecb=o,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,a,e.onwrite),e.sync=!1}function b(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),E(t,e)}function w(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),a=e.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,y(t,e,!0,e.length,i,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(y(t,e,!1,e.objectMode?1:l.length,l,c,f),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function x(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function k(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),E(t,e)})}function E(t,e){var n=x(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,a.nextTick(k,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}l.inherits(_,f),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===_&&(t&&t._writableState instanceof m)}})):d=function(t){return t instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(t,e,n){var r,i=this._writableState,o=!1,s=!i.objectMode&&(r=t,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=g),i.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),a.nextTick(e,n)}(this,n):(s||function(t,e,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),a.nextTick(r,o),i=!1),i}(this,i,t,n))&&(i.pendingcb++,o=function(t,e,n,r,i,a){if(!n){var o=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=e.objectMode?1:r.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,E(t,e),n&&(e.finished?a.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),_.prototype.destroy=v.destroy,_.prototype._undestroy=v.undestroy,_.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":119,"./internal/streams/destroy":125,"./internal/streams/stream":126,_process:117,"core-util-is":14,inherits:70,"process-nextick-args":128,"safe-buffer":134,timers:142,"util-deprecate":148}],124:[function(t,e,n){"use strict";var r=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e,n,i,a=r.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=a,i=s,e.copy(n,i),s+=o.data.length,o=o.next;return a},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":134,util:4}],125:[function(t,e,n){"use strict";var r=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(r.nextTick(i,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":128}],126:[function(t,e,n){e.exports=t("events").EventEmitter},{events:48}],127:[function(t,e,n){var r={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},{}],128:[function(t,e,n){(function(t){"use strict";!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,n)});case 3:return t.nextTick(function(){e.call(null,n,r)});case 4:return t.nextTick(function(){e.call(null,n,r,i)});default:for(a=new Array(s-1),o=0;o>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function c(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}n.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(t.lastNeed=i-1),i;if(--r=0)return i>0&&(t.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":134}],130:[function(t,e,n){e.exports=t("./readable").PassThrough},{"./readable":131}],131:[function(t,e,n){(n=e.exports=t("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=t("./lib/_stream_writable.js"),n.Duplex=t("./lib/_stream_duplex.js"),n.Transform=t("./lib/_stream_transform.js"),n.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":119,"./lib/_stream_passthrough.js":120,"./lib/_stream_readable.js":121,"./lib/_stream_transform.js":122,"./lib/_stream_writable.js":123}],132:[function(t,e,n){e.exports=t("./readable").Transform},{"./readable":131}],133:[function(t,e,n){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":123}],134:[function(t,e,n){var r=t("buffer"),i=r.Buffer;function a(t,e){for(var n in t)e[n]=t[n]}function o(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(a(r,n),n.Buffer=o),a(i,o),o.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},o.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},{buffer:47}],135:[function(t,e,n){arguments[4][67][0].apply(n,arguments)},{"./lib/decoder":136,"./lib/encoder":137,dup:67}],136:[function(t,e,n){(function(t){var n=function(){"use strict";var t=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),e=4017,n=799,r=3406,i=2276,a=1567,o=3784,s=5793,u=2896;function l(){}function c(t,e){for(var n,r,i=0,a=[],o=16;o>0&&!t[o-1];)o--;a.push({children:[],index:0});var s,u=a[0];for(n=0;n0;)u=a.pop();for(u.index++,a.push(u);a.length<=n;)a.push(s={children:[],index:0}),u.children[u.index]=s.children,u=s;i++}n+10)return p>>--d&1;if(255==(p=e[n++])){var t=e[n++];if(t)throw"unexpected marker: "+(p<<8|t).toString(16)}return d=7,p>>>7}function g(t){for(var e,n=t;null!==(e=v());){if("number"==typeof(n=n[e]))return n;if("object"!=typeof n)throw"invalid huffman sequence"}return null}function m(t){for(var e=0;t>0;){var n=v();if(null===n)return;e=e<<1|n,t--}return e}function _(t){var e=m(t);return e>=1<0)y--;else for(var r=o,i=s;r<=i;){var a=g(e.huffmanTableAC),u=15&a,c=a>>4;if(0!==u)n[t[r+=c]]=_(u)*(1<>4,0===f)a<15?(y=m(a)+(1<>4;if(0!==s)n[t[a+=u]]=_(s),a++;else{if(u<15)break;a+=16}}};var I,R,L,B,F=0;for(R=1==M?i[0].blocksPerLine*i[0].blocksPerColumn:c*r.mcusPerColumn,a||(a=R);F=65488&&I<=65495))break;n+=2}return n-h}function h(t,l){var c,f,h=[],p=l.blocksPerLine,d=l.blocksPerColumn,v=p<<3,g=new Int32Array(64),m=new Uint8Array(64);function _(t,c,f){var h,p,d,v,g,m,_,y,b,w,x=l.quantizationTable,k=f;for(w=0;w<64;w++)k[w]=t[w]*x[w];for(w=0;w<8;++w){var E=8*w;0!=k[1+E]||0!=k[2+E]||0!=k[3+E]||0!=k[4+E]||0!=k[5+E]||0!=k[6+E]||0!=k[7+E]?(h=s*k[0+E]+128>>8,p=s*k[4+E]+128>>8,d=k[2+E],v=k[6+E],g=u*(k[1+E]-k[7+E])+128>>8,y=u*(k[1+E]+k[7+E])+128>>8,m=k[3+E]<<4,_=k[5+E]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+v*a+128>>8,d=d*a-v*o+128>>8,v=b,b=g-_+1>>1,g=g+_+1>>1,_=b,b=y+m+1>>1,m=y-m+1>>1,y=b,b=h-v+1>>1,h=h+v+1>>1,v=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=g*i+y*r+2048>>12,g=g*r-y*i+2048>>12,y=b,b=m*n+_*e+2048>>12,m=m*e-_*n+2048>>12,_=b,k[0+E]=h+y,k[7+E]=h-y,k[1+E]=p+_,k[6+E]=p-_,k[2+E]=d+m,k[5+E]=d-m,k[3+E]=v+g,k[4+E]=v-g):(b=s*k[0+E]+512>>10,k[0+E]=b,k[1+E]=b,k[2+E]=b,k[3+E]=b,k[4+E]=b,k[5+E]=b,k[6+E]=b,k[7+E]=b)}for(w=0;w<8;++w){var S=w;0!=k[8+S]||0!=k[16+S]||0!=k[24+S]||0!=k[32+S]||0!=k[40+S]||0!=k[48+S]||0!=k[56+S]?(h=s*k[0+S]+2048>>12,p=s*k[32+S]+2048>>12,d=k[16+S],v=k[48+S],g=u*(k[8+S]-k[56+S])+2048>>12,y=u*(k[8+S]+k[56+S])+2048>>12,m=k[24+S],_=k[40+S],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*o+v*a+2048>>12,d=d*a-v*o+2048>>12,v=b,b=g-_+1>>1,g=g+_+1>>1,_=b,b=y+m+1>>1,m=y-m+1>>1,y=b,b=h-v+1>>1,h=h+v+1>>1,v=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=g*i+y*r+2048>>12,g=g*r-y*i+2048>>12,y=b,b=m*n+_*e+2048>>12,m=m*e-_*n+2048>>12,_=b,k[0+S]=h+y,k[56+S]=h-y,k[8+S]=p+_,k[48+S]=p-_,k[16+S]=d+m,k[40+S]=d-m,k[24+S]=v+g,k[32+S]=v-g):(b=s*f[w+0]+8192>>14,k[0+S]=b,k[8+S]=b,k[16+S]=b,k[24+S]=b,k[32+S]=b,k[40+S]=b,k[48+S]=b,k[56+S]=b)}for(w=0;w<64;++w){var j=128+(k[w]+8>>4);c[w]=j<0?0:j>255?255:j}}for(var y=0;y255?255:t}return l.prototype={load:function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){var t=new Uint8Array(e.response||e.mozResponseArrayBuffer);this.parse(t),this.onload&&this.onload()}.bind(this),e.send(null)},parse:function(e){var n=0;e.length;function r(){var t=e[n]<<8|e[n+1];return n+=2,t}function i(){var t=r(),i=e.subarray(n,n+t-2);return n+=i.length,i}function a(t){var e,n,r=0,i=0;for(n in t.components)t.components.hasOwnProperty(n)&&(r<(e=t.components[n]).h&&(r=e.h),i>4==0)for(_=0;_<64;_++){x[t[_]]=e[n++]}else{if(w>>4!=1)throw"DQT: invalid table spec";for(_=0;_<64;_++){x[t[_]]=r()}}p[15&w]=x}break;case 65472:case 65473:case 65474:r(),(o={}).extended=65473===m,o.progressive=65474===m,o.precision=e[n++],o.scanLines=r(),o.samplesPerLine=r(),o.components={},o.componentsOrder=[];var k,E=e[n++];for(N=0;N>4,j=15&e[n+1],T=e[n+2];o.componentsOrder.push(k),o.components[k]={h:S,v:j,quantizationTable:p[T]},n+=3}a(o),d.push(o);break;case 65476:var C=r();for(N=2;N>4==0?g:v)[15&A]=c(M,R)}break;case 65501:r(),s=r();break;case 65498:r();var L=e[n++],B=[];for(N=0;N>4],z.huffmanTableAC=v[15&F],B.push(z)}var O=e[n++],P=e[n++],D=e[n++],U=f(e,n,o,B,s,O,P,D>>4,15&D);n+=U;break;default:if(255==e[n-3]&&e[n-2]>=192&&e[n-2]<=254){n-=3;break}throw"unknown JPEG marker "+m.toString(16)}m=r()}if(1!=d.length)throw"only single frame JPEGs supported";this.width=o.samplesPerLine,this.height=o.scanLines,this.jfif=u,this.adobe=l,this.components=[];for(var N=0;N=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,r),r-=this.charReceived);var i;r=(e+=t.toString(this.encoding,0,r)).length-1;if((i=e.charCodeAt(r))>=55296&&i<=56319){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),t.copy(this.charBuffer,0,0,a),e.substring(0,r)}return e},a.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},a.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},{buffer:47}],141:[function(t,e,n){(function(n){var r=t("stream");function i(t,e,i){t=t||function(t){this.queue(t)},e=e||function(){this.queue(null)};var a=!1,o=!1,s=[],u=!1,l=new r;function c(){for(;s.length&&!l.paused;){var t=s.shift();if(null===t)return l.emit("end");l.emit("data",t)}}return l.readable=l.writable=!0,l.paused=!1,l.autoDestroy=!(i&&!1===i.autoDestroy),l.write=function(e){return t.call(this,e),!l.paused},l.queue=l.push=function(t){return u?l:(null===t&&(u=!0),s.push(t),c(),l)},l.on("end",function(){l.readable=!1,!l.writable&&l.autoDestroy&&n.nextTick(function(){l.destroy()})}),l.end=function(t){if(!a)return a=!0,arguments.length&&l.write(t),l.writable=!1,e.call(l),!l.readable&&l.autoDestroy&&l.destroy(),l},l.destroy=function(){if(!o)return o=!0,a=!0,s.length=0,l.writable=l.readable=!1,l.emit("close"),l},l.pause=function(){if(!l.paused)return l.paused=!0,l},l.resume=function(){return l.paused&&(l.paused=!1,l.emit("resume")),c(),l.paused||l.emit("drain"),l},l}e.exports=i,i.through=i}).call(this,t("_process"))},{_process:117,stream:139}],142:[function(t,e,n){(function(e,r){var i=t("process/browser.js").nextTick,a=Function.prototype.apply,o=Array.prototype.slice,s={},u=0;function l(t,e){this._id=t,this._clearFn=e}n.setTimeout=function(){return new l(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new l(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n.setImmediate="function"==typeof e?e:function(t){var e=u++,r=!(arguments.length<2)&&o.call(arguments,1);return s[e]=!0,i(function(){s[e]&&(r?t.apply(null,r):t.call(null),n.clearImmediate(e))}),e},n.clearImmediate="function"==typeof r?r:function(t){delete s[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":117,timers:142}],143:[function(t,e,n){n.isatty=function(){return!1},n.ReadStream=function(){throw new Error("tty.ReadStream is not implemented")},n.WriteStream=function(){throw new Error("tty.WriteStream is not implemented")}},{}],144:[function(t,e,n){(function(e,r){"use strict";var i=t("bit-twiddle"),a=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s=e.__TYPEDARRAY_POOL;s.UINT8C||(s.UINT8C=a([32,0])),s.BUFFER||(s.BUFFER=a([32,0]));var u=s.DATA,l=s.BUFFER;function c(t){if(t){var e=t.length||t.byteLength,n=i.log2(e);u[n].push(t)}}function f(t){t=i.nextPow2(t);var e=i.log2(t),n=u[e];return n.length>0?n.pop():new ArrayBuffer(t)}function h(t){return new Uint8Array(f(t),0,t)}function p(t){return new Uint16Array(f(2*t),0,t)}function d(t){return new Uint32Array(f(4*t),0,t)}function v(t){return new Int8Array(f(t),0,t)}function g(t){return new Int16Array(f(2*t),0,t)}function m(t){return new Int32Array(f(4*t),0,t)}function _(t){return new Float32Array(f(4*t),0,t)}function y(t){return new Float64Array(f(8*t),0,t)}function b(t){return o?new Uint8ClampedArray(f(t),0,t):h(t)}function w(t){return new DataView(f(t),0,t)}function x(t){t=i.nextPow2(t);var e=i.log2(t),n=l[e];return n.length>0?n.pop():new r(t)}n.free=function(t){if(r.isBuffer(t))l[i.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,n=0|i.log2(e);u[n].push(t)}},n.freeUint8=n.freeUint16=n.freeUint32=n.freeInt8=n.freeInt16=n.freeInt32=n.freeFloat32=n.freeFloat=n.freeFloat64=n.freeDouble=n.freeUint8Clamped=n.freeDataView=function(t){c(t.buffer)},n.freeArrayBuffer=c,n.freeBuffer=function(t){l[i.log2(t.length)].push(t)},n.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return f(t);switch(e){case"uint8":return h(t);case"uint16":return p(t);case"uint32":return d(t);case"int8":return v(t);case"int16":return g(t);case"int32":return m(t);case"float":case"float32":return _(t);case"double":case"float64":return y(t);case"uint8_clamped":return b(t);case"buffer":return x(t);case"data":case"dataview":return w(t);default:return null}return null},n.mallocArrayBuffer=f,n.mallocUint8=h,n.mallocUint16=p,n.mallocUint32=d,n.mallocInt8=v,n.mallocInt16=g,n.mallocInt32=m,n.mallocFloat32=n.mallocFloat=_,n.mallocFloat64=n.mallocDouble=y,n.mallocUint8Clamped=b,n.mallocDataView=w,n.mallocBuffer=x,n.clearCache=function(){for(var t=0;t<32;++t)s.UINT8[t].length=0,s.UINT16[t].length=0,s.UINT32[t].length=0,s.INT8[t].length=0,s.INT16[t].length=0,s.INT32[t].length=0,s.FLOAT[t].length=0,s.DOUBLE[t].length=0,s.UINT8C[t].length=0,u[t].length=0,l[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":2,buffer:47,dup:20}],145:[function(t,e,n){(function(){var t=this,r=t._,i={},a=Array.prototype,o=Object.prototype,s=Function.prototype,u=a.push,l=a.slice,c=a.concat,f=o.toString,h=o.hasOwnProperty,p=a.forEach,d=a.map,v=a.reduce,g=a.reduceRight,m=a.filter,_=a.every,y=a.some,b=a.indexOf,w=a.lastIndexOf,x=Array.isArray,k=Object.keys,E=s.bind,S=function(t){return t instanceof S?t:this instanceof S?void(this._wrapped=t):new S(t)};void 0!==n?(void 0!==e&&e.exports&&(n=e.exports=S),n._=S):t._=S,S.VERSION="1.4.4";var j=S.each=S.forEach=function(t,e,n){if(null!=t)if(p&&t.forEach===p)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,a=t.length;r2;if(null==t&&(t=[]),v&&t.reduce===v)return r&&(e=S.bind(e,r)),i?t.reduce(e,n):t.reduce(e);if(j(t,function(t,a,o){i?n=e.call(r,n,t,a,o):(n=t,i=!0)}),!i)throw new TypeError(T);return n},S.reduceRight=S.foldr=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),g&&t.reduceRight===g)return r&&(e=S.bind(e,r)),i?t.reduceRight(e,n):t.reduceRight(e);var a=t.length;if(a!==+a){var o=S.keys(t);a=o.length}if(j(t,function(s,u,l){u=o?o[--a]:--a,i?n=e.call(r,n,t[u],u,l):(n=t[u],i=!0)}),!i)throw new TypeError(T);return n},S.find=S.detect=function(t,e,n){var r;return C(t,function(t,i,a){if(e.call(n,t,i,a))return r=t,!0}),r},S.filter=S.select=function(t,e,n){var r=[];return null==t?r:m&&t.filter===m?t.filter(e,n):(j(t,function(t,i,a){e.call(n,t,i,a)&&(r[r.length]=t)}),r)},S.reject=function(t,e,n){return S.filter(t,function(t,r,i){return!e.call(n,t,r,i)},n)},S.every=S.all=function(t,e,n){e||(e=S.identity);var r=!0;return null==t?r:_&&t.every===_?t.every(e,n):(j(t,function(t,a,o){if(!(r=r&&e.call(n,t,a,o)))return i}),!!r)};var C=S.some=S.any=function(t,e,n){e||(e=S.identity);var r=!1;return null==t?r:y&&t.some===y?t.some(e,n):(j(t,function(t,a,o){if(r||(r=e.call(n,t,a,o)))return i}),!!r)};S.contains=S.include=function(t,e){return null!=t&&(b&&t.indexOf===b?-1!=t.indexOf(e):C(t,function(t){return t===e}))},S.invoke=function(t,e){var n=l.call(arguments,2),r=S.isFunction(e);return S.map(t,function(t){return(r?e:t[e]).apply(t,n)})},S.pluck=function(t,e){return S.map(t,function(t){return t[e]})},S.where=function(t,e,n){return S.isEmpty(e)?n?null:[]:S[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},S.findWhere=function(t,e){return S.where(t,e,!0)},S.max=function(t,e,n){if(!e&&S.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&S.isEmpty(t))return-1/0;var r={computed:-1/0,value:-1/0};return j(t,function(t,i,a){var o=e?e.call(n,t,i,a):t;o>=r.computed&&(r={value:t,computed:o})}),r.value},S.min=function(t,e,n){if(!e&&S.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&S.isEmpty(t))return 1/0;var r={computed:1/0,value:1/0};return j(t,function(t,i,a){var o=e?e.call(n,t,i,a):t;or||void 0===n)return 1;if(n>>1;n.call(r,t[s])=0})})},S.difference=function(t){var e=c.apply(a,l.call(arguments,1));return S.filter(t,function(t){return!S.contains(e,t)})},S.zip=function(){for(var t=l.call(arguments),e=S.max(S.pluck(t,"length")),n=new Array(e),r=0;r=0;n--)e=[t[n].apply(this,e)];return e[0]}},S.after=function(t,e){return t<=0?e():function(){if(--t<1)return e.apply(this,arguments)}},S.keys=k||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)S.has(t,n)&&(e[e.length]=n);return e},S.values=function(t){var e=[];for(var n in t)S.has(t,n)&&e.push(t[n]);return e},S.pairs=function(t){var e=[];for(var n in t)S.has(t,n)&&e.push([n,t[n]]);return e},S.invert=function(t){var e={};for(var n in t)S.has(t,n)&&(e[t[n]]=n);return e},S.functions=S.methods=function(t){var e=[];for(var n in t)S.isFunction(t[n])&&e.push(n);return e.sort()},S.extend=function(t){return j(l.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},S.pick=function(t){var e={},n=c.apply(a,l.call(arguments,1));return j(n,function(n){n in t&&(e[n]=t[n])}),e},S.omit=function(t){var e={},n=c.apply(a,l.call(arguments,1));for(var r in t)S.contains(n,r)||(e[r]=t[r]);return e},S.defaults=function(t){return j(l.call(arguments,1),function(e){if(e)for(var n in e)null==t[n]&&(t[n]=e[n])}),t},S.clone=function(t){return S.isObject(t)?S.isArray(t)?t.slice():S.extend({},t):t},S.tap=function(t,e){return e(t),t};var R=function(t,e,n,r){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof S&&(t=t._wrapped),e instanceof S&&(e=e._wrapped);var i=f.call(t);if(i!=f.call(e))return!1;switch(i){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var a=n.length;a--;)if(n[a]==t)return r[a]==e;n.push(t),r.push(e);var o=0,s=!0;if("[object Array]"==i){if(s=(o=t.length)==e.length)for(;o--&&(s=R(t[o],e[o],n,r)););}else{var u=t.constructor,l=e.constructor;if(u!==l&&!(S.isFunction(u)&&u instanceof u&&S.isFunction(l)&&l instanceof l))return!1;for(var c in t)if(S.has(t,c)&&(o++,!(s=S.has(e,c)&&R(t[c],e[c],n,r))))break;if(s){for(c in e)if(S.has(e,c)&&!o--)break;s=!o}}return n.pop(),r.pop(),s};S.isEqual=function(t,e){return R(t,e,[],[])},S.isEmpty=function(t){if(null==t)return!0;if(S.isArray(t)||S.isString(t))return 0===t.length;for(var e in t)if(S.has(t,e))return!1;return!0},S.isElement=function(t){return!(!t||1!==t.nodeType)},S.isArray=x||function(t){return"[object Array]"==f.call(t)},S.isObject=function(t){return t===Object(t)},j(["Arguments","Function","String","Number","Date","RegExp"],function(t){S["is"+t]=function(e){return f.call(e)=="[object "+t+"]"}}),S.isArguments(arguments)||(S.isArguments=function(t){return!(!t||!S.has(t,"callee"))}),"function"!=typeof/./&&(S.isFunction=function(t){return"function"==typeof t}),S.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},S.isNaN=function(t){return S.isNumber(t)&&t!=+t},S.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"==f.call(t)},S.isNull=function(t){return null===t},S.isUndefined=function(t){return void 0===t},S.has=function(t,e){return h.call(t,e)},S.noConflict=function(){return t._=r,this},S.identity=function(t){return t},S.times=function(t,e,n){for(var r=Array(t),i=0;i":">",'"':""","'":"'","/":"/"}};L.unescape=S.invert(L.escape);var B={escape:new RegExp("["+S.keys(L.escape).join("")+"]","g"),unescape:new RegExp("("+S.keys(L.unescape).join("|")+")","g")};S.each(["escape","unescape"],function(t){S[t]=function(e){return null==e?"":(""+e).replace(B[t],function(e){return L[t][e]})}}),S.result=function(t,e){if(null==t)return null;var n=t[e];return S.isFunction(n)?n.call(t):n},S.mixin=function(t){j(S.functions(t),function(e){var n=S[e]=t[e];S.prototype[e]=function(){var t=[this._wrapped];return u.apply(t,arguments),U.call(this,n.apply(S,t))}})};var F=0;S.uniqueId=function(t){var e=++F+"";return t?t+e:e},S.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,P={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;S.template=function(t,e,n){var r;n=S.defaults({},n,S.templateSettings);var i=new RegExp([(n.escape||O).source,(n.interpolate||O).source,(n.evaluate||O).source].join("|")+"|$","g"),a=0,o="__p+='";t.replace(i,function(e,n,r,i,s){return o+=t.slice(a,s).replace(D,function(t){return"\\"+P[t]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),a=s+e.length,e}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(t){throw t.source=o,t}if(e)return r(e,S);var s=function(t){return r.call(this,t,S)};return s.source="function("+(n.variable||"obj")+"){\n"+o+"}",s},S.chain=function(t){return S(t).chain()};var U=function(t){return this._chain?S(t).chain():t};S.mixin(S),j(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=a[t];S.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],U.call(this,n)}}),j(["concat","join","slice"],function(t){var e=a[t];S.prototype[t]=function(){return U.call(this,e.apply(this._wrapped,arguments))}}),S.extend(S.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],146:[function(t,e,n){"use strict";e.exports=function(t,e,n){return 0===t.length?t:e?(n||t.sort(e),function(t,e){for(var n=1,r=t.length,i=t[0],a=t[0],o=1;o=o?u+1:o}r.mkdir(e+"sequencer"+o,function(){var a=e+"sequencer"+o+"/";for(var s in n.images){var u=n.images[s].steps;if(i){var l=u.slice(-1)[0].output.src,c=u.slice(-1)[0].output.format,f=t("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+(u.length-1)+"."+c,f,function(){})}else for(var h in u){l=u[h].output.src,c=u[h].output.format,f=t("data-uri-to-buffer")(l);r.writeFile(a+s+"_"+h+"."+c,f,function(){})}}})},r.readdir(c,function(t,e){var n=[];if(void 0===e||0==e.length)return f(n),[];for(var i=0;i0&&(thisStep=c[t].steps[e],thisStep.UI.onRemove(thisStep.options.step),c[t].steps.splice(e,1))}function v(){var e=[],n=this;for(var r in arguments)e.push(a(arguments[r]));var i=l.call(this,e,"l");f.push({method:"loadImages",json_q:a(i)});var o=this.copy(i.loadedimages),s={name:"ImageSequencer Wrapper",sequencer:this,addSteps:this.addSteps,removeSteps:this.removeSteps,insertSteps:this.insertSteps,run:this.run,UI:this.UI,setUI:this.setUI,images:o};!function e(r){if(r!=o.length){var a=o[r];t("./ui/LoadImage")(n,a,i.images[a],function(){e(++r)})}else i.callback.call(s)}(0)}function g(t){var e={};if("load-image"==t)return{};if(0==arguments.length){for(var n in this.modules)e[n]=s[n][1];for(var r in this.sequences)e[r]={name:r,steps:this.sequences[r]}}else e=s[t]?s[t][1]:{inputs:u[t].options};return e}function m(t){let e=g(t.options.name).inputs||{},n={};for(let r in e)t.options[r]&&t.options[r]!=e[r].default&&(n[r]=t.options[r],n[r]=encodeURIComponent(n[r]));var r=Object.keys(n).map(t=>t+":"+n[t]).join("|");return`${t.options.name}{${r}}`}function _(t){let e;return(e=t.includes(",")?t.split(","):[t]).map(y)}function y(t){var e;if(e=t.includes("{")?t.includes("(")&&t.indexOf("(")=e.images[u].steps.length?{options:{name:void 0}}:e.images[u].steps.slice(f+t)[0]},e.images[u].steps[f].getIndex=function(){return f},r)r.hasOwnProperty(p)&&(e.images[u].steps[f][p]=r[p]);e.images[u].steps[f].UI.onDraw(e.images[u].steps[f].options.step);var d=t("./RunToolkit")(e.copy(h));e.images[u].steps[f].draw(d,function(){e.images[u].steps[f].options.step.output=e.images[u].steps[f].output.src,e.images[u].steps[f].UI.onComplete(e.images[u].steps[f].options.step),n(a,++s)},o)}}(s,a)}(n=function(t){for(var n in t)0==t[n]&&1==e.images[n].steps.length?delete t[n]:0==t[n]&&t[n]++;for(var n in t)for(var r=e.images[n].steps[t[n]-1];void 0===r||void 0===r.output;)r=e.images[n].steps[--t[n]-1];return t}(n))}},{"./RunToolkit":159,"./util/getStep.js":255}],159:[function(t,e,n){const r=t("get-pixels"),i=t("./modules/_nomodule/PixelManipulation"),a=t("lodash"),o=t("data-uri-to-buffer"),s=t("save-pixels");e.exports=function(t){return t.getPixels=r,t.pixelManipulation=i,t.lodash=a,t.dataUriToBuffer=o,t.savePixels=s,t}},{"./modules/_nomodule/PixelManipulation":249,"data-uri-to-buffer":19,"get-pixels":29,lodash:75,"save-pixels":138}],160:[function(t,e,n){e.exports={sample:[{name:"invert",options:{}},{name:"channel",options:{channel:"red"}},{name:"blur",options:{blur:"5"}}]}},{}],161:[function(t,e,n){e.exports=function(e,n){return e.blur=e.blur||2,e.step.metadata=e.step.metadata||{},{options:e,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return t("../_nomodule/PixelManipulation.js")(n,{output:function(t,e,n){a.output={src:e,format:n}},changePixel:function(t,e,n,r){return[t,e,n,r]},extraManipulation:function(t){for(var n=[0,0,0,0],r=0;rAverages (r, g, b, a): "+n.join(", ")+"

"),t},format:n.format,image:e.image,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":249}],162:[function(t,e,n){e.exports=[t("./Module"),t("./info.json")]},{"./Module":161,"./info.json":163}],163:[function(t,e,n){e.exports={name:"Average",description:"Average all pixel color",inputs:{},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],164:[function(require,module,exports){module.exports=function Dynamic(options,UI,util){var output;function draw(input,callback,progressObj){progressObj.stop(!0),progressObj.overrideFlag=!0;var step=this;"string"==typeof options.func&&eval("options.func = "+options.func);var getPixels=require("get-pixels");"string"==typeof options.offset&&(options.offset=parseInt(options.offset));var priorStep=this.getStep(options.offset);getPixels(priorStep.output.src,function(t,e){return options.firstImagePixels=e,require("../_nomodule/PixelManipulation.js")(input,{output:function(t,e,n){step.output={src:e,format:n}},changePixel:function(t,e,n,r,i,a){var o=options.firstImagePixels;return options.func(t,e,n,r,o.get(i,a,0),o.get(i,a,1),o.get(i,a,2),o.get(i,a,3))},format:input.format,image:options.image,inBrowser:options.inBrowser,callback:callback})})}return options.func=options.func||"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }",options.offset=options.offset||-2,{options:options,draw:draw,output:output,UI:UI}}},{"../_nomodule/PixelManipulation.js":249,"get-pixels":29}],165:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":164,"./info.json":166,dup:162}],166:[function(t,e,n){e.exports={name:"Blend",description:"Blend two chosen image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!",inputs:{offset:{type:"integer",desc:"Choose which image to blend the current image with. Two steps back is -2, three steps back is -3 etc.",default:-2},blend:{type:"input",desc:"Function to use to blend the two images.",default:"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],167:[function(t,e,n){e.exports=function(t,e){let n=[[2/159,4/159,5/159,4/159,2/159],[4/159,9/159,12/159,9/159,4/159],[5/159,12/159,15/159,12/159,5/159],[4/159,9/159,12/159,9/159,4/159],[2/159,4/159,5/159,4/159,2/159]],r=t;n=function(t){let e=[];for(let n=t.length-1;n>=0;n--){let r=[];for(let e=t[n].length-1;e>=0;e--)r.push(t[n][e]);e.push(r)}return e}(n);for(let e=0;ev;n=0<=v?++c:--c)r[n]=(e-i)/(a-i)*(u[n]-s[n])+s[n];return r}}e.exports=function(t,e){return e.colormap=e.colormap||i.default,"object"==typeof e.colormap?colormapFunction=r(e.colormap):i.hasOwnProperty(e.colormap)?colormapFunction=i[e.colormap]:colormapFunction=i.default,colormapFunction(t/255)};var i={greyscale:r([[0,[0,0,0],[255,255,255]],[1,[255,255,255],[255,255,255]]]),bluwhtgrngis:r([[0,[6,23,86],[6,25,84]],[.0625,[6,25,84],[6,25,84]],[.125,[6,25,84],[6,25,84]],[.1875,[6,25,84],[6,25,84]],[.25,[6,25,84],[6,25,84]],[.3125,[6,25,84],[9,24,84]],[.3438,[9,24,84],[119,120,162]],[.375,[119,129,162],[249,250,251]],[.406,[249,250,251],[255,255,255]],[.4375,[255,255,255],[255,255,255]],[.5,[255,255,255],[214,205,191]],[.52,[214,205,191],[178,175,96]],[.5625,[178,175,96],[151,176,53]],[.593,[151,176,53],[146,188,12]],[.625,[146,188,12],[96,161,1]],[.6875,[96,161,1],[30,127,3]],[.75,[30,127,3],[0,99,1]],[.8125,[0,99,1],[0,74,1]],[.875,[0,74,1],[0,52,0]],[.9375,[0,52,0],[0,34,0]],[.968,[0,34,0],[68,70,67]]]),brntogrn:r([[0,[110,12,3],[118,6,1]],[.0625,[118,6,1],[141,19,6]],[.125,[141,19,6],[165,35,13]],[.1875,[165,35,13],[177,59,25]],[.2188,[177,59,25],[192,91,36]],[.25,[192,91,36],[214,145,76]],[.3125,[214,145,76],[230,183,134]],[.375,[230,183,134],[243,224,194]],[.4375,[243,224,194],[250,252,229]],[.5,[250,252,229],[217,235,185]],[.5625,[217,235,185],[184,218,143]],[.625,[184,218,143],[141,202,89]],[.6875,[141,202,89],[80,176,61]],[.75,[80,176,61],[0,147,32]],[.8125,[0,147,32],[1,122,22]],[.875,[1,122,22],[0,114,19]],[.9,[0,114,19],[0,105,18]],[.9375,[0,105,18],[7,70,14]]]),blutoredjet:r([[0,[0,0,140],[1,1,186]],[.0625,[1,1,186],[0,1,248]],[.125,[0,1,248],[0,70,254]],[.1875,[0,70,254],[0,130,255]],[.25,[0,130,255],[2,160,255]],[.2813,[2,160,255],[0,187,255]],[.3125,[0,187,255],[6,250,255]],[.375,[8,252,251],[27,254,228]],[.406,[27,254,228],[70,255,187]],[.4375,[70,255,187],[104,254,151]],[.47,[104,254,151],[132,255,19]],[.5,[132,255,19],[195,255,60]],[.5625,[195,255,60],[231,254,25]],[.5976,[231,254,25],[253,246,1]],[.625,[253,246,1],[252,210,1]],[.657,[252,210,1],[255,183,0]],[.6875,[255,183,0],[255,125,2]],[.75,[255,125,2],[255,65,1]],[.8125,[255,65,1],[247,1,1]],[.875,[247,1,1],[200,1,3]],[.9375,[200,1,3],[122,3,2]]]),colors16:r([[0,[0,0,0],[0,0,0]],[.0625,[3,1,172],[3,1,172]],[.125,[3,1,222],[3,1,222]],[.1875,[0,111,255],[0,111,255]],[.25,[3,172,255],[3,172,255]],[.3125,[1,226,255],[1,226,255]],[.375,[2,255,0],[2,255,0]],[.4375,[198,254,0],[190,254,0]],[.5,[252,255,0],[252,255,0]],[.5625,[255,223,3],[255,223,3]],[.625,[255,143,3],[255,143,3]],[.6875,[255,95,3],[255,95,3]],[.75,[242,0,1],[242,0,1]],[.8125,[245,0,170],[245,0,170]],[.875,[223,180,225],[223,180,225]],[.9375,[255,255,255],[255,255,255]]]),default:r([[0,[45,1,121],[25,1,137]],[.125,[25,1,137],[0,6,156]],[.1875,[0,6,156],[7,41,172]],[.25,[7,41,172],[22,84,187]],[.3125,[22,84,187],[25,125,194]],[.375,[25,125,194],[26,177,197]],[.4375,[26,177,197],[23,199,193]],[.47,[23,199,193],[25,200,170]],[.5,[25,200,170],[21,209,27]],[.5625,[21,209,27],[108,215,18]],[.625,[108,215,18],[166,218,19]],[.6875,[166,218,19],[206,221,20]],[.75,[206,221,20],[222,213,19]],[.7813,[222,213,19],[222,191,19]],[.8125,[222,191,19],[227,133,17]],[.875,[227,133,17],[231,83,16]],[.9375,[231,83,16],[220,61,48]]]),fastie:r([[0,[255,255,255],[0,0,0]],[.167,[0,0,0],[255,255,255]],[.33,[255,255,255],[0,0,0]],[.5,[0,0,0],[140,140,255]],[.55,[140,140,255],[0,255,0]],[.63,[0,255,0],[255,255,0]],[.75,[255,255,0],[255,0,0]],[.95,[255,0,0],[255,0,255]]]),stretched:r([[0,[0,0,255],[0,0,255]],[.1,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.7,[255,255,0],[255,50,50]],[.9,[255,50,50],[255,50,50]]])}},{}],181:[function(t,e,n){e.exports=function(e,n){return{options:e,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return t("../_nomodule/PixelManipulation.js")(n,{output:function(t,e,n){a.output={src:e,format:n}},changePixel:function(n,r,i,a){var o=(n+r+i)/3,s=t("./Colormap")(o,e);return[s[0],s[1],s[2],255]},format:n.format,image:e.image,inBrowser:e.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":249,"./Colormap":180}],182:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":181,"./info.json":183,dup:162}],183:[function(t,e,n){e.exports={name:"Colormap",description:"Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.",inputs:{colormap:{type:"select",desc:"Name of the Colormap",default:"default",values:["default","greyscale","bluwhtgrngis","stretched","fastie","brntogrn","blutoredjet","colors16"]}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],184:[function(t,e,n){var r=t("lodash");e.exports=function(t,e){let n=r.cloneDeep(t);(e=Number(e))<-100&&(e=-100),e>100&&(e=100),e=(100+e)/100,e*=e;for(let r=0;r255&&(i=255);var a=n.get(r,s,1)/255;a-=.5,a*=e,a+=.5,(a*=255)<0&&(a=0),a>255&&(a=255);var o=n.get(r,s,2)/255;o-=.5,o*=e,o+=.5,(o*=255)<0&&(o=0),o>255&&(o=255),t.set(r,s,0,i),t.set(r,s,1,a),t.set(r,s,2,o)}return t}},{lodash:75}],185:[function(t,e,n){e.exports=function(e,n){return e.contrast=e.contrast||70,{options:e,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return t("../_nomodule/PixelManipulation.js")(n,{output:function(t,e,n){a.output={src:e,format:n}},changePixel:function(t,e,n,r){return[t,e,n,r]},extraManipulation:function(n){return n=t("./Contrast")(n,e.contrast)},format:n.format,image:e.image,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":249,"./Contrast":184}],186:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":185,"./info.json":187,dup:162}],187:[function(t,e,n){e.exports={name:"Contrast",description:"Change the contrast of the image by given value",inputs:{contrast:{type:"range",desc:"contrast for the new image, typically -100 to 100",default:"70",min:"-100",max:"100",step:"1"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],188:[function(t,e,n){var r=t("lodash");e.exports=function(t,e,n){let a=function(t,e){for(e=e.split(" "),i=0;i<9;i++)e[i]=Number(e[i])*t;let n=0,r=[];for(i=0;i<3;i++){let t=[];for(j=0;j<3;j++)t.push(e[n]),n+=1;r.push(t)}return r}(e,n),o=r.cloneDeep(t);a=function(t){let e=[];for(let n=t.length-1;n>=0;n--){let r=[];for(let e=t[n].length-1;e>=0;e--)r.push(t[n][e]);e.push(r)}return e}(a);for(let e=0;eRead more",inputs:{constantFactor:{type:"Float",desc:"a constant factor, multiplies all the kernel values by that factor",default:.1111,placeholder:.1111},kernelValues:{type:"String",desc:"nine space separated numbers representing the kernel values in left to right and top to bottom format.",default:"1 1 1 1 1 1 1 1 1",placeholder:"1 1 1 1 1 1 1 1 1"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],192:[function(t,e,n){(function(n){e.exports=function(e,r,i){var a=t("get-pixels"),o=t("save-pixels");r.x=parseInt(r.x)||0,r.y=parseInt(r.y)||0,a(e.src,function(t,a){r.w=parseInt(r.w)||Math.floor(a.shape[0]),r.h=parseInt(r.h)||Math.floor(a.shape[1]),r.backgroundColor=r.backgroundColor||"255 255 255 255";var s=r.x,u=r.y,l=r.w,c=r.h,f=a.shape[0],h=a.shape[1],p=[];backgroundColor=r.backgroundColor.split(" ");for(var d=0;dInfragrammar.",inputs:{red:{type:"input",desc:"Expression to return for red channel with R, G, B, and A inputs",default:"r"},green:{type:"input",desc:"Expression to return for green channel with R, G, B, and A inputs",default:"g"},blue:{type:"input",desc:"Expression to return for blue channel with R, G, B, and A inputs",default:"b"},"monochrome (fallback)":{type:"input",desc:"Expression to return with R, G, B, and A inputs; fallback for other channels if none provided",default:"r + g + b"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],207:[function(t,e,n){t("lodash");const r=[[-1,0,1],[-2,0,2],[-1,0,1]],i=[[-1,-2,-1],[0,0,0],[1,2,1]];function a(t,e,n,a,o){let s=0;for(let e=0;e<3;e++)for(let n=0;n<3;n++){let i=a+e-1,u=o+n-1;s+=t.get(i,u,0)*r[e][n]}let u=0;for(let e=0;e<3;e++)for(let n=0;n<3;n++){let r=a+e-1,s=o+n-1;u+=t.get(r,s,0)*i[e][n]}return{pixel:[e,e,e,Math.sqrt(Math.pow(s,2)+Math.pow(u,2))],angle:Math.atan2(u,s)}}e.exports=function(t,e,n,r){let i=[],u=[];for(var l=0;lt.map(o));for(let r=1;r=-22.5&&a<=22.5||a<-157.5&&a>=-180?e[r][i]>=e[r][i+1]&&e[r][i]>=e[r][i-1]?t.set(r,i,3,e[r][i]):t.set(r,i,3,0):a>=22.5&&a<=67.5||a<-112.5&&a>=-157.5?e[r][i]>=e[r+1][i+1]&&e[r][i]>=e[r-1][i-1]?t.set(r,i,3,e[r][i]):t.set(r,i,3,0):a>=67.5&&a<=112.5||a<-67.5&&a>=-112.5?e[r][r]>=e[r+1][i]&&e[r][i]>=e[r][i]?t.set(r,i,3,e[r][i]):t.set(r,i,3,0):(a>=112.5&&a<=157.5||a<-22.5&&a>=-67.5)&&(e[r][i]>=e[r+1][i-1]&&e[r][i]>=e[r-1][i+1]?t.set(r,i,3,e[r][i]):t.set(r,i,3,0))}}(t,u,i),function(t,e,n,r,i,a){const o=s(r)*e,u=o*n;for(let e=0;eu?r[e][n]>o?i.push(s):a.push(s):t.set(e,n,3,0)}i.forEach(e=>t.set(e[0],e[1],3,255))}(t,e,n,u,[],[]),t};var o=t=>180*t/Math.PI,s=t=>Math.max(...t.map(t=>t.map(t=>t||0)).map(t=>Math.max(...t)))},{lodash:75}],208:[function(t,e,n){e.exports=function(e,n){return e.blur=e.blur||2,e.highThresholdRatio=e.highThresholdRatio||.2,e.lowThresholdRatio=e.lowThresholdRatio||.15,{options:e,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return t("../_nomodule/PixelManipulation.js")(n,{output:function(t,e,n){a.output={src:e,format:n}},changePixel:function(t,e,n,r){return[(t+e+n)/3,(t+e+n)/3,(t+e+n)/3,r]},extraManipulation:function(n){return n=t("ndarray-gaussian-filter")(n,e.blur),n=t("./EdgeUtils")(n,e.highThresholdRatio,e.lowThresholdRatio,e.inBrowser)},format:n.format,image:e.image,inBrowser:e.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":249,"./EdgeUtils":207,"ndarray-gaussian-filter":80}],209:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":208,"./info.json":210,dup:162}],210:[function(t,e,n){e.exports={name:"Detect Edges",description:"This module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more. ",inputs:{blur:{type:"range",desc:"Amount of gaussian blur(Less blur gives more detail, typically 0-5)",default:"2",min:"0",max:"5",step:"0.25"},highThresholdRatio:{type:"float",desc:"The high threshold ratio for the image",default:.2},lowThresholdRatio:{type:"float",desc:"The low threshold value for the image",default:.15}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],211:[function(t,e,n){e.exports=function(e,n){return t("fisheyegl"),{options:e,draw:function(t,n){var r=this;if(e.inBrowser){if(document.querySelector("#image-sequencer-canvas"))var i=document.querySelector("#image-sequencer-canvas");else(i=document.createElement("canvas")).style.display="none",i.setAttribute("id","image-sequencer-canvas"),document.body.append(i);distorter=FisheyeGl({selector:"#image-sequencer-canvas"}),e.a=parseFloat(e.a)||distorter.lens.a,e.b=parseFloat(e.b)||distorter.lens.b,e.Fx=parseFloat(e.Fx)||distorter.lens.Fx,e.Fy=parseFloat(e.Fy)||distorter.lens.Fy,e.scale=parseFloat(e.scale)||distorter.lens.scale,e.x=parseFloat(e.x)||distorter.fov.x,e.y=parseFloat(e.y)||distorter.fov.y,distorter.lens.a=e.a,distorter.lens.b=e.b,distorter.lens.Fx=e.Fx,distorter.lens.Fy=e.Fy,distorter.lens.scale=e.scale,distorter.fov.x=e.x,distorter.fov.y=e.y,distorter.setImage(t.src,function(){r.output={src:i.toDataURL(),format:t.format},n()})}else this.output=t,n()},output:void 0,UI:n}}},{fisheyegl:21}],212:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":211,"./info.json":213,dup:162}],213:[function(t,e,n){e.exports={name:"Fisheye GL",description:"Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).",requires:["webgl"],inputs:{a:{type:"float",desc:"a parameter",default:1,min:1,max:4},b:{type:"float",desc:"b parameter",default:1,min:1,max:4},Fx:{type:"float",desc:"Fx parameter",default:0,min:0,max:4},Fy:{type:"float",desc:"Fy parameter",default:0,min:0,max:4},scale:{type:"float",desc:"Image Scaling",default:1.5,min:0,max:20},x:{type:"float",desc:"FOV x parameter",default:1.5,min:0,max:20},y:{type:"float",desc:"FOV y parameter",default:1.5,min:0,max:20},fragmentSrc:{type:"PATH",desc:"Path to a WebGL fragment shader file",default:"(inbuilt)"},vertexSrc:{type:"PATH",desc:"Path to a WebGL vertex shader file",default:"(inbuilt)"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],214:[function(t,e,n){e.exports=function(e,n){return{options:e,draw:function(n,r,i){i.stop(!0),i.overrideFlag=!0;var a=this;return t("../_nomodule/PixelManipulation.js")(n,{output:function(t,e,n){a.output={src:e,format:n}},changePixel:function(t,n,r,i){var a=e.adjustment||.2;return[t=255*Math.pow(t/255,a),n=255*Math.pow(n/255,a),r=255*Math.pow(r/255,a),i]},format:n.format,image:e.image,inBrowser:e.inBrowser,callback:r})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":249}],215:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":214,"./info.json":216,dup:162}],216:[function(t,e,n){e.exports={name:"Gamma Correction",description:"Apply gamma correction on the image Read more",inputs:{adjustment:{type:"float",desc:"gamma correction (inverse of actual gamma factor) for the new image",default:.2}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],217:[function(t,e,n){(function(n){e.exports=function(e,r){return{options:e,draw:function(e,r,i){var a=t("get-pixels"),o=t("save-pixels"),s=this;a(e.src,function(t,i){if(t)console.log("Bad Image path");else{for(var a=0,u=0;u

Select or drag in an image to overlay.

';$(t.ui).find(".details").prepend(i),sequencer.setInputStep({dropZoneSelector:"#"+r,fileInputSelector:"#"+r+" .file-input",onLoad:function(e){var n=e.target;t.options.imageUrl=n.result,t.options.url=n.result,sequencer.run(),setUrlHashParameter("steps",sequencer.toString())}}),$(t.ui).find(".btn-save").on("click",function(){var e=$(t.ui).find(".det input").val();t.options.imageUrl=e,sequencer.run()})}}}},{}],225:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":223,"./info.json":226,dup:162}],226:[function(t,e,n){e.exports={name:"Import Image",description:"Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.",url:"https://github.com/publiclab/image-sequencer/tree/master/MODULES.md",inputs:{url:{type:"string",desc:"URL of image to import",default:"./images/monarch.png"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],227:[function(t,e,n){e.exports=function(){return this.expandSteps([{name:"ndvi",options:{}},{name:"colormap",options:{}}]),{isMeta:!0}}},{}],228:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":227,"./info.json":229,dup:162}],229:[function(t,e,n){e.exports={name:"NDVI-Colormap",description:"Sequentially Applies NDVI and Colormap steps",inputs:{},length:2,"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],230:[function(t,e,n){e.exports=function(e,n){if(e.step.inBrowser)var r=t("./Ui.js")(e.step,n);return e.filter=e.filter||"red",{options:e,draw:function(n,i,a){a.stop(!0),a.overrideFlag=!0;var o=this;return t("../_nomodule/PixelManipulation.js")(n,{output:function(t,e,n){o.output={src:e,format:n}},changePixel:function(t,n,r,i){if("red"==e.filter)var a=(r-t)/(1*r+t);"blue"==e.filter&&(a=(t-r)/(1*r+t));var o=255*(a+1)/2;return[o,o,o,i]},format:n.format,image:e.image,inBrowser:e.inBrowser,callback:function(){e.step.inBrowser&&r.setup(),i()}})},output:void 0,UI:n}}},{"../_nomodule/PixelManipulation.js":249,"./Ui.js":231}],231:[function(t,e,n){e.exports=function(t,e){return{setup:function(){var e=$(t.imgElement);e.mousemove(function(t){var n=document.createElement("canvas");n.width=e.width(),n.height=e.height(),n.getContext("2d").drawImage(this,0,0);var r=$(this).offset(),i=t.pageX-r.left,a=t.pageY-r.top,o=n.getContext("2d").getImageData(i,a,1,1).data[0];o=(o=o/127.5-1).toFixed(2),e[0].title="NDVI: "+o})}}}},{}],232:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{"./Module":230,"./info.json":233,dup:162}],233:[function(t,e,n){e.exports={name:"NDVI",description:"Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters",inputs:{filter:{type:"select",desc:"Filter color",default:"red",values:["red","blue"]}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],234:[function(t,e,n){e.exports=function(e,n,r){return e.x=e.x||0,e.y=e.y||0,{options:e,draw:function(n,r,i){e.offset=e.offset||-2,i.stop(!0),i.overrideFlag=!0;var a=this;t("../../util/ParseInputCoordinates").parseCornerCoordinateInputs(e,{src:n.src,x:{valInp:e.x,type:"horizontal"},y:{valInp:e.y,type:"vertical"}},function(t,e){t.x=parseInt(e.x.valInp),t.y=parseInt(e.y.valInp)});var o=this.getStep(e.offset).image,s=this.getOutput(e.offset);t("get-pixels")(n.src,function(n,i){return e.secondImagePixels=i,t("../_nomodule/PixelManipulation.js")(s,{output:function(t,e,n){a.output={src:e,format:n}},changePixel:function(t,n,r,i,a,o){var s=e.secondImagePixels;return a>=e.x&&a=e.y&&o"40000"?"40000":e.temperature,i.stop(!0),i.overrideFlag=!0;var a=this;return t("../_nomodule/PixelManipulation.js")(n,{output:function(t,e,n){a.output={src:e,format:n}},changePixel:function(t,e,n,r){return[t,e,n,r]},extraManipulation:function(t){let n,r,i,a=parseInt(e.temperature);(a/=100)<=66?(n=255,r=Math.min(Math.max(99.4708025861*Math.log(a)-161.1195681661,0),255)):(n=Math.min(Math.max(329.698727446*Math.pow(a-60,-.1332047592),0),255),r=Math.min(Math.max(288.1221695283*Math.pow(a-60,-.0755148492),0),255)),a>=66?i=255:a<=19?i=0:(i=a-10,i=Math.min(Math.max(138.5177312231*Math.log(i)-305.0447927307,0),255));for(let e=0;e
To work with a new or different image, drag one into the drop zone.",ID:e.options.sequencerCounter++,imageName:t,inBrowser:e.options.inBrowser,ui:e.options.ui},o={src:n,steps:[{options:{id:r.ID,name:"load-image",description:"This initial step loads and displays the original image without any modifications.",title:"Load Image",step:r},UI:e.events,draw:function(){return UI.onDraw(options.step),1==arguments.length?(this.output=a(arguments[0]),options.step.output=this.output,UI.onComplete(options.step),!0):2==arguments.length&&(this.output=a(arguments[0]),options.step.output=this.output,arguments[1](),UI.onComplete(options.step),!0)}}]};a(n,function(n){var r=function(t){return{src:t,format:t.split(":")[1].split(";")[0].split("/")[1]}}(n);e.images[t]=o;var a=e.images[t].steps[0];return a.output=r,a.options.step.output=a.output.src,a.UI.onSetup(a.options.step),a.UI.onDraw(a.options.step),a.UI.onComplete(a.options.step),i(),!0})}(n,r)}},{urify:147}],251:[function(t,e,n){e.exports=function(){return function(t){var e=$(t.dropZoneSelector),n=$(t.fileInputSelector),r=$(t.takePhotoSelector),i=t.onLoad;function a(t){if(t.preventDefault(),t.stopPropagation(),t.target&&t.target.files)var e=t.target.files[0];else e=t.dataTransfer.files[0];if(e){var n=new FileReader;n.onload=i,n.readAsDataURL(e)}}t.onTakePhoto,new FileReader,n.on("change",a),r.on("click",function(){document.getElementById("video").style.display="inline",document.getElementById("capture").style.display="inline",document.getElementById("close").style.display="inline";var e=document.getElementById("video");canvas=document.getElementById("canvas"),context=canvas.getContext("2d"),vendorUrl=window.URL||window.webkitURL,navigator.getMedia=navigator.getUserMedia||navigator.wekitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getMedia({video:!0,audio:!1},function(t){e.srcObject=t,e.onloadedmetadata=function(t){e.play()},document.getElementById("close").addEventListener("click",function(){!function(t){t.getVideoTracks().forEach(function(t){t.stop()}),document.getElementById("video").style.display="none",document.getElementById("capture").style.display="none",document.getElementById("close").style.display="none"}(t)})},function(t){console.log("error")}),document.getElementById("capture").addEventListener("click",function(n){context.drawImage(e,0,0,400,300),t.onTakePhoto(canvas.toDataURL())})}),e[0].addEventListener("drop",a,!1),e.on("dragover",function(t){t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"},!1),e.on("dragenter",function(t){e.addClass("hover")}),e.on("dragleave",function(t){e.removeClass("hover")})}}},{}],252:[function(t,e,n){e.exports=function(t={}){return t.onSetup=t.onSetup||function(t){0==t.ui||(t.inBrowser?console.log('Added Step "'+t.name+'" to "'+t.imageName+'".'):console.log("%s",'Added Step "'+t.name+'" to "'+t.imageName+'".'))},t.onDraw=t.onDraw||function(t){0==t.ui||(t.inBrowser?console.log('Drawing Step "'+t.name+'" on "'+t.imageName+'".'):console.log("%s",'Drawing Step "'+t.name+'" on "'+t.imageName+'".'))},t.onComplete=t.onComplete||function(t){0==t.ui||(t.inBrowser?console.log('Drawn Step "'+t.name+'" on "'+t.imageName+'".'):console.log("%s",'Drawn Step "'+t.name+'" on "'+t.imageName+'".'))},t.onRemove=t.onRemove||function(t){0==t.ui||(t.inBrowser?console.log('Removing Step "'+t.name+'" of "'+t.imageName+'".'):console.log("%s",'Removing Step "'+t.name+'" of "'+t.imageName+'".'))},t}},{}],253:[function(t,e,n){e.exports=function(t){var e=void 0;return"jpeg"===(e=(e=function(t){return"data:image"===t.substr(0,10)}(t)?t.split(";")[0].split("/").pop():t.split(".").pop()).toLowerCase())&&(e="jpg"),["jpg","jpeg","png","gif","canvas"].includes(e)?e:"jpg"}},{}],254:[function(t,e,n){e.exports=function(e,n,r){t("get-pixels")(n.src,function(t,i){var a=i.shape[0],o=i.shape[1];if(n.x.valInp){Object.keys(n).forEach(function(t){var e=n[t];e.valInp&&"%"===e.valInp.slice(-1)&&(e.valInp=parseInt(e.valInp,10),"horizontal"===e.type?e.valInp=e.valInp*a/100:e.valInp=e.valInp*o/100)});r(e,n)}})}},{"get-pixels":29}],255:[function(t,e,n){e.exports={getPreviousStep:function(){return this.getStep(-1)},getNextStep:function(){return this.getStep(1)},getInput:function(t){return t+this.getIndex()===0&&t++,this.getStep(t-1).output},getOutput:function(t){return this.getStep(t).output},getOptions:function(){return this.getStep(0).options},setOptions:function(t){let e=this.getStep(0).options;for(let n in t)e[n]&&(e[n]=t[n])},getFormat:function(){return this.getStep(-1).output.format},getHeight:function(t){let e=new Image;e.onload=function(){t(e.height)},e.src=this.getInput(0).src},getWidth:function(t){let e=new Image;e.onload=function(){t(e.width)},e.src=this.getInput(0).src}}},{}]},{},[154]); \ No newline at end of file +!function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[a]={exports:{}};e[a][0].call(u.exports,function(t){return i(e[a][1][t]||t)},u,u.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a0?n-4:n,f=0;f>16&255,s[l++]=e>>8&255,s[l++]=255&e;2===a&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,s[l++]=255&e);1===a&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,s[l++]=e>>8&255,s[l++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},r.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},r.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},r.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],3:[function(t,e,r){(function(t,n,i){!function(t){if("object"==typeof r&&void 0!==e)e.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;"undefined"!=typeof window?i=window:void 0!==n?i=n:"undefined"!=typeof self&&(i=self),i.Promise=t()}}(function(){var e,r,o;return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var l="function"==typeof _dereq_&&_dereq_;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[a]={exports:{}};e[a][0].call(u.exports,function(t){var r=e[a][1][t];return i(r||t)},u,u.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof _dereq_&&_dereq_,a=0;a0;)p(t)}function p(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var r=t.shift(),n=t.shift();e.call(r,n)}}l.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},l.prototype.hasCustomScheduler=function(){return this._customScheduler},l.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},l.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},l.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},l.prototype.fatalError=function(e,r){r?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},l.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(l.prototype.invokeLater=function(t,e,r){this._trampolineEnabled?c.call(this,t,e,r):this._schedule(function(){setTimeout(function(){t.call(e,r)},100)})},l.prototype.invoke=function(t,e,r){this._trampolineEnabled?u.call(this,t,e,r):this._schedule(function(){t.call(e,r)})},l.prototype.settlePromises=function(t){this._trampolineEnabled?f.call(this,t):this._schedule(function(){t._settlePromises()})}):(l.prototype.invokeLater=c,l.prototype.invoke=u,l.prototype.settlePromises=f),l.prototype._drainQueues=function(){h(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,h(this._lateQueue)},l.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},l.prototype._reset=function(){this._isTickUsed=!1},r.exports=l,r.exports.firstLineError=i},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=!1,o=function(t,e){this._reject(e)},a=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},s=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},l=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=n.propagateFromFunction(),t.prototype._boundValue=n.boundValueFunction());var c=r(o),u=new t(e);u._propagateFrom(this,1);var f=this._target();if(u._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:u,target:f,bindingPromise:c};f._then(e,a,void 0,u,h),c._then(s,l,void 0,u,h),u._setOnCancel(c)}else u._resolveCallback(f);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},t.bind=function(e,r){return t.resolve(r).bind(e)}}},{}],4:[function(t,e,r){"use strict";var n;"undefined"!=typeof Promise&&(n=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=n)}catch(t){}return i},e.exports=i},{"./promise":22}],5:[function(t,e,r){"use strict";var n=Object.create;if(n){var i=n(null),o=n(null);i[" size"]=o[" size"]=0}e.exports=function(e){var r,n=t("./util"),i=n.canEvaluate;n.isIdentifier;function o(t,r){var i;if(null!=t&&(i=t[r]),"function"!=typeof i){var o="Object "+n.classString(t)+" has no method '"+n.toString(r)+"'";throw new e.TypeError(o)}return i}function a(t){return o(t,this.pop()).apply(t,this)}function s(t){return t[this]}function l(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(a,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e;if("number"==typeof t)e=l;else if(i){var n=r(t);e=null!==n?n:s}else e=s;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,r){"use strict";e.exports=function(e,r,n,i){var o=t("./util"),a=o.tryCatch,s=o.errorObj,l=e._async;e.prototype.break=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var r=t._cancellationParent;if(null==r||!r._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=r}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),l.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var r=0;r=0)return r[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},n.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(void 0!==this._trace){var t=r.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},n.CapturedTrace=null,n.create=function(){if(e)return new n},n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var r=t.prototype._pushContext,o=t.prototype._popContext,a=t._peekContext,s=t.prototype._peekContext,l=t.prototype._promiseCreated;n.deactivateLongStackTraces=function(){t.prototype._pushContext=r,t.prototype._popContext=o,t._peekContext=a,t.prototype._peekContext=s,t.prototype._promiseCreated=l,e=!1},e=!0,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,t._peekContext=t.prototype._peekContext=i,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},n}},{}],9:[function(e,r,n){"use strict";r.exports=function(r,n){var i,o,a,s=r._getDomain,l=r._async,c=e("./errors").Warning,u=e("./util"),f=e("./es5"),h=u.canAttachTrace,p=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,d=/\((?:timers\.js):\d+:\d+\)/,m=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,v=null,g=null,_=!1,y=!(0==u.env("BLUEBIRD_DEBUG")),b=!(0==u.env("BLUEBIRD_WARNINGS")||!y&&!u.env("BLUEBIRD_WARNINGS")),w=!(0==u.env("BLUEBIRD_LONG_STACK_TRACES")||!y&&!u.env("BLUEBIRD_LONG_STACK_TRACES")),k=0!=u.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!u.env("BLUEBIRD_W_FORGOTTEN_RETURN"));r.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},r.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var t=this;setTimeout(function(){t._notifyUnhandledRejection()},1)}},r.prototype._notifyUnhandledRejectionIsHandled=function(){H("rejectionHandled",i,void 0,this)},r.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},r.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},r.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),H("unhandledRejection",o,t,this)}},r.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},r.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},r.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},r.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},r.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},r.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},r.prototype._warn=function(t,e,r){return z(t,e,r||this)},r.onPossiblyUnhandledRejection=function(t){var e=s();o="function"==typeof t?null===e?t:u.domainBind(e,t):void 0},r.onUnhandledRejectionHandled=function(t){var e=s();i="function"==typeof t?null===e?t:u.domainBind(e,t):void 0};var x=function(){};r.longStackTraces=function(){if(l.haveItemsQueued()&&!Q.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!Q.longStackTraces&&Z()){var t=r.prototype._captureStackTrace,e=r.prototype._attachExtraTrace,i=r.prototype._dereferenceTrace;Q.longStackTraces=!0,x=function(){if(l.haveItemsQueued()&&!Q.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");r.prototype._captureStackTrace=t,r.prototype._attachExtraTrace=e,r.prototype._dereferenceTrace=i,n.deactivateLongStackTraces(),l.enableTrampoline(),Q.longStackTraces=!1},r.prototype._captureStackTrace=D,r.prototype._attachExtraTrace=N,r.prototype._dereferenceTrace=U,n.activateLongStackTraces(),l.disableTrampolineIfNecessary()}},r.hasLongStackTraces=function(){return Q.longStackTraces&&Z()};var B=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var r={detail:e,cancelable:!0};f.defineProperty(r,"promise",{value:e.promise}),f.defineProperty(r,"reason",{value:e.reason});var n=new CustomEvent(t.toLowerCase(),r);return!u.global.dispatchEvent(n)}}if("function"==typeof Event){t=new Event("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var r=new Event(t.toLowerCase(),{cancelable:!0});return r.detail=e,f.defineProperty(r,"promise",{value:e.promise}),f.defineProperty(r,"reason",{value:e.reason}),!u.global.dispatchEvent(r)}}return(t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),u.global.dispatchEvent(t),function(t,e){var r=document.createEvent("CustomEvent");return r.initCustomEvent(t.toLowerCase(),!1,!0,e),!u.global.dispatchEvent(r)}}catch(t){}return function(){return!1}}(),C=u.isNode?function(){return t.emit.apply(t,arguments)}:u.global?function(t){var e="on"+t.toLowerCase(),r=u.global[e];return!!r&&(r.apply(u.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function E(t,e){return{promise:e}}var P={promiseCreated:E,promiseFulfilled:E,promiseRejected:E,promiseResolved:E,promiseCancelled:E,promiseChained:function(t,e,r){return{promise:e,child:r}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,r){return{reason:e,promise:r}},rejectionHandled:E},S=function(t){var e=!1;try{e=C.apply(null,arguments)}catch(t){l.throwLater(t),e=!0}var r=!1;try{r=B(t,P[t].apply(null,arguments))}catch(t){l.throwLater(t),r=!0}return r||e};function j(){return!1}function T(t,e,r){var n=this;try{t(e,r,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+u.toString(t));n._attachCancellationCallback(t)})}catch(t){return t}}function M(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?u.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function A(){return this._onCancelField}function I(t){this._onCancelField=t}function R(){this._cancellationParent=void 0,this._onCancelField=void 0}function L(t,e){if(0!=(1&e)){this._cancellationParent=t;var r=t._branchesRemainingToCancel;void 0===r&&(r=0),t._branchesRemainingToCancel=r+1}0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}r.config=function(t){if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?r.longStackTraces():!t.longStackTraces&&r.hasLongStackTraces()&&x()),"warnings"in t){var e=t.warnings;Q.warnings=!!e,k=Q.warnings,u.isObject(e)&&"wForgottenReturn"in e&&(k=!!e.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!Q.cancellation){if(l.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");r.prototype._clearCancellationData=R,r.prototype._propagateFrom=L,r.prototype._onCancel=A,r.prototype._setOnCancel=I,r.prototype._attachCancellationCallback=M,r.prototype._execute=T,O=L,Q.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!Q.monitoring?(Q.monitoring=!0,r.prototype._fireEvent=S):!t.monitoring&&Q.monitoring&&(Q.monitoring=!1,r.prototype._fireEvent=j)),r},r.prototype._fireEvent=j,r.prototype._execute=function(t,e,r){try{t(e,r)}catch(t){return t}},r.prototype._onCancel=function(){},r.prototype._setOnCancel=function(t){},r.prototype._attachCancellationCallback=function(t){},r.prototype._captureStackTrace=function(){},r.prototype._attachExtraTrace=function(){},r.prototype._dereferenceTrace=function(){},r.prototype._clearCancellationData=function(){},r.prototype._propagateFrom=function(t,e){};var O=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function F(){var t=this._boundTo;return void 0!==t&&t instanceof r?t.isFulfilled()?t.value():void 0:t}function D(){this._trace=new J(this._peekContext())}function N(t,e){if(h(t)){var r=this._trace;if(void 0!==r&&e&&(r=r._parent),void 0!==r)r.attachExtraTrace(t);else if(!t.__stackCleaned__){var n=V(t);u.notEnumerableProp(t,"stack",n.message+"\n"+n.stack.join("\n")),u.notEnumerableProp(t,"__stackCleaned__",!0)}}}function U(){this._trace=void 0}function z(t,e,n){if(Q.warnings){var i,o=new c(t);if(e)n._attachExtraTrace(o);else if(Q.longStackTraces&&(i=r._peekContext()))i.attachExtraTrace(o);else{var a=V(o);o.stack=a.message+"\n"+a.stack.join("\n")}S("warning",o)||G(o,"",!0)}}function q(t){for(var e=[],r=0;r0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),r=0;r0&&"SyntaxError"!=t.name&&(e=e.slice(r)),e}(t):[" (No stack trace)"],{message:r,stack:"SyntaxError"==t.name?e:q(e)}}function G(t,e,r){if("undefined"!=typeof console){var n;if(u.isObject(t)){var i=t.stack;n=e+g(i,t)}else n=e+String(t);"function"==typeof a?a(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function H(t,e,r,n){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(n):e(r,n))}catch(t){l.throwLater(t)}"unhandledRejection"===t?S(t,r,n)||i||G(r,"Unhandled rejection "):S(t,n)}function W(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():u.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){if(t.length<41)return t;return t.substr(0,38)+"..."}(e)+">, no stack trace)"}function Z(){return"function"==typeof K}var X=function(){return!1},Y=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function $(t){var e=t.match(Y);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function J(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);K(this,J),e>32&&this.uncycle()}u.inherits(J,Error),n.CapturedTrace=J,J.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;for(n=(t=this._length=n)-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(n=0;n0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var s=n>0?e[n-1]:this;a=0;--c)e[c]._length=l,l++;return}}}},J.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=V(t),r=e.message,n=[e.stack],i=this;void 0!==i;)n.push(q(i.stack.split("\n"))),i=i._parent;!function(t){for(var e=t[0],r=1;r=0;--s)if(n[s]===o){a=s;break}for(s=a;s>=0;--s){var l=n[s];if(e[i]!==l)break;e.pop(),i--}e=n}}(n),function(t){for(var e=0;e=0)return v=/@/,g=e,_=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){n="stack"in t}return"stack"in i||!n||"number"!=typeof Error.stackTraceLimit?(g=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?W(e):e.toString()},null):(v=t,g=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(a=function(t){console.warn(t)},u.isNode&&t.stderr.isTTY?a=function(t,e){var r=e?"":"";console.warn(r+t+"\n")}:u.isNode||"string"!=typeof(new Error).stack||(a=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var Q={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return w&&r.longStackTraces(),{longStackTraces:function(){return Q.longStackTraces},warnings:function(){return Q.warnings},cancellation:function(){return Q.cancellation},monitoring:function(){return Q.monitoring},propagateFromFunction:function(){return O},boundValueFunction:function(){return F},checkForgottenReturns:function(t,e,r,n,i){if(void 0===t&&null!==e&&k){if(void 0!==i&&i._returnedNonUndefined())return;if(0==(65535&n._bitField))return;r&&(r+=" ");var o="",a="";if(e._trace){for(var s=e._trace.stack.split("\n"),l=q(s),c=l.length-1;c>=0;--c){var u=l[c];if(!d.test(u)){var f=u.match(m);f&&(o="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(l.length>0){var h=l[0];for(c=0;c0&&(a="\n"+s[c-1]);break}}}var p="a promise was created in a "+r+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+a;n._warn(p,!0,e)}},setBounds:function(t,e){if(Z()){for(var r,n,i=t.stack.split("\n"),o=e.stack.split("\n"),a=-1,s=-1,l=0;l=s||(X=function(t){if(p.test(t))return!0;var e=$(t);return!!(e&&e.fileName===r&&a<=e.line&&e.line<=s)})}},warn:z,deprecated:function(t,e){var r=t+" is deprecated and will be removed in a future version.";return e&&(r+=" Use "+e+" instead."),z(r)},CapturedTrace:J,fireDomEvent:B,fireGlobalEvent:C}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,r){"use strict";e.exports=function(t){function e(){return this.value}function r(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(r){return r instanceof t&&r.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:r},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(r,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof t&&r.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:r},void 0);var n=arguments[1];n instanceof t&&n.suppressUnhandledRejections();return this.caught(r,function(){return n})}}},{}],11:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.reduce,n=t.all;function i(){return n(this)}t.prototype.each=function(t){return r(this,t,e,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return r(this,t,e,e)},t.each=function(t,n){return r(t,n,e,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,n){return r(t,n,e,e)}}},{}],12:[function(t,e,r){"use strict";var n,i,o=t("./es5"),a=o.freeze,s=t("./util"),l=s.inherits,c=s.notEnumerableProp;function u(t,e){function r(n){if(!(this instanceof r))return new r(n);c(this,"message","string"==typeof n?n:e),c(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(r,Error),r}var f=u("Warning","warning"),h=u("CancellationError","cancellation error"),p=u("TimeoutError","timeout error"),d=u("AggregateError","aggregate error");try{n=TypeError,i=RangeError}catch(t){n=u("TypeError","type error"),i=u("RangeError","range error")}for(var m="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),v=0;v1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function f(){return p.call(this,this.promise._target()._settledValue())}function h(t){if(!u(this,t))return a.e=t,a}function p(t){var i=this.promise,s=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?s.call(i._boundValue()):s.call(i._boundValue(),t);if(l===n)return l;if(void 0!==l){i._setReturnedNonUndefined();var p=r(l,i);if(p instanceof e){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new o("late cancellation observer");return i._attachExtraTrace(d),a.e=d,a}p.isPending()&&p._attachCancellationCallback(new c(this))}return p._then(f,h,void 0,this,void 0)}}}return i.isRejected()?(u(this),a.e=t,a):(u(this),t)}return l.prototype.isFinallyHandler=function(){return 0===this.type},c.prototype._resultCancelled=function(){u(this.finallyHandler)},e.prototype._passThrough=function(t,e,r,n){return"function"!=typeof t?this.then():this._then(r,n,void 0,new l(this,e,t),void 0)},e.prototype.lastly=e.prototype.finally=function(t){return this._passThrough(t,0,p,p)},e.prototype.tap=function(t){return this._passThrough(t,1,p)},e.prototype.tapCatch=function(t){var r=arguments.length;if(1===r)return this._passThrough(t,1,void 0,p);var n,o=new Array(r-1),a=0;for(n=0;n0&&"function"==typeof arguments[e]&&(t=arguments[e]);var n=[].slice.call(arguments);t&&n.pop();var i=new r(n).promise();return void 0!==t?i.spread(t):i}}},{"./util":36}],18:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o,a){var s=e._getDomain,l=t("./util"),c=l.tryCatch,u=l.errorObj,f=e._async;function h(t,e,r,n){this.constructor$(t),this._promise._captureStackTrace();var i=s();this._callback=null===i?e:l.domainBind(i,e),this._preservedValues=n===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function p(t,r,i,o){if("function"!=typeof r)return n("expecting a function but got "+l.classString(r));var a=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+l.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+l.classString(i.concurrency)));a=i.concurrency}return new h(t,r,a="number"==typeof a&&isFinite(a)&&a>=1?a:0,o).promise()}l.inherits(h,r),h.prototype._asyncInit=function(){this._init$(void 0,-2)},h.prototype._init=function(){},h.prototype._promiseFulfilled=function(t,r){var n=this._values,o=this.length(),s=this._preservedValues,l=this._limit;if(r<0){if(n[r=-1*r-1]=t,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return n[r]=t,this._queue.push(r),!1;null!==s&&(s[r]=t);var f=this._promise,h=this._callback,p=f._boundValue();f._pushContext();var d=c(h).call(p,t,r,o),m=f._popContext();if(a.checkForgottenReturns(d,m,null!==s?"Promise.filter":"Promise.map",f),d===u)return this._reject(d.e),!0;var v=i(d,this._promise);if(v instanceof e){var g=(v=v._target())._bitField;if(0==(50397184&g))return l>=1&&this._inFlight++,n[r]=v,v._proxy(this,-1*(r+1)),!1;if(0==(33554432&g))return 0!=(16777216&g)?(this._reject(v._reason()),!0):(this._cancel(),!0);d=v._value()}n[r]=d}return++this._totalResolved>=o&&(null!==s?this._filter(n,s):this._resolve(n),!0)},h.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlight1){o.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],u=arguments[2];n=a.isArray(c)?s(t).apply(u,c):s(t).call(u,c)}else n=s(t)();var f=l._popContext();return o.checkForgottenReturns(n,f,"Promise.try",l),l._resolveFromSyncValue(n),l},e.prototype._resolveFromSyncValue=function(t){t===a.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,r){"use strict";var n=t("./util"),i=n.maybeWrapAsError,o=t("./errors").OperationalError,a=t("./es5");var s=/^(?:name|message|stack|cause)$/;function l(t){var e;if(function(t){return t instanceof Error&&a.getPrototypeOf(t)===Error.prototype}(t)){(e=new o(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var r=a.keys(t),i=0;i1){var r,n=new Array(e-1),i=0;for(r=0;r0&&"function"!=typeof t&&"function"!=typeof e){var r=".then() only accepts functions but was passed: "+c.classString(t);arguments.length>1&&(r+=", "+c.classString(e)),this._warn(r)}return this._then(t,e,void 0,void 0,void 0)},j.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},j.prototype.spread=function(t){return"function"!=typeof t?o("expecting a function but got "+c.classString(t)):this.all()._then(t,void 0,void 0,g,void 0)},j.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},j.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new b(this).promise()},j.prototype.error=function(t){return this.caught(c.originatesFromRejection,t)},j.getNewLibraryCopy=r.exports,j.is=function(t){return t instanceof j},j.fromNode=j.fromCallback=function(t){var e=new j(v);e._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=S(t)(E(e,r));return n===P&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},j.all=function(t){return new b(t).promise()},j.cast=function(t){var e=y(t);return e instanceof j||((e=new j(v))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},j.resolve=j.fulfilled=j.cast,j.reject=j.rejected=function(t){var e=new j(v);return e._captureStackTrace(),e._rejectCallback(t,!0),e},j.setScheduler=function(t){if("function"!=typeof t)throw new d("expecting a function but got "+c.classString(t));return h.setScheduler(t)},j.prototype._then=function(t,e,r,n,i){var o=void 0!==i,a=o?i:new j(v),l=this._target(),u=l._bitField;o||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===n&&0!=(2097152&this._bitField)&&(n=0!=(50397184&u)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var f=s();if(0!=(50397184&u)){var p,d,g=l._settlePromiseCtx;0!=(33554432&u)?(d=l._rejectionHandler0,p=t):0!=(16777216&u)?(d=l._fulfillmentHandler0,p=e,l._unsetRejectionIsUnhandled()):(g=l._settlePromiseLateCancellationObserver,d=new m("late cancellation observer"),l._attachExtraTrace(d),p=e),h.invoke(g,l,{handler:null===f?p:"function"==typeof p&&c.domainBind(f,p),promise:a,receiver:n,value:d})}else l._addCallbacks(t,e,a,n,f);return a},j.prototype._length=function(){return 65535&this._bitField},j.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},j.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},j.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},j.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},j.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},j.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},j.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},j.prototype._isFinal=function(){return(4194304&this._bitField)>0},j.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},j.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},j.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},j.prototype._setAsyncGuaranteed=function(){h.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},j.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==l)return void 0===e&&this._isBound()?this._boundValue():e},j.prototype._promiseAt=function(t){return this[4*t-4+2]},j.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},j.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},j.prototype._boundValue=function(){},j.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,r=t._rejectionHandler0,n=t._promise0,i=t._receiverAt(0);void 0===i&&(i=l),this._addCallbacks(e,r,n,i,null)},j.prototype._migrateCallbackAt=function(t,e){var r=t._fulfillmentHandlerAt(e),n=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=l),this._addCallbacks(r,n,i,o,null)},j.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:c.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:c.domainBind(i,e));else{var a=4*o-4;this[a+2]=r,this[a+3]=n,"function"==typeof t&&(this[a+0]=null===i?t:c.domainBind(i,t)),"function"==typeof e&&(this[a+1]=null===i?e:c.domainBind(i,e))}return this._setLength(o+1),o},j.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},j.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(n(),!1);var r=y(t,this);if(!(r instanceof j))return this._fulfill(t);e&&this._propagateFrom(r,2);var i=r._target();if(i!==this){var o=i._bitField;if(0==(50397184&o)){var a=this._length();a>0&&i._migrateCallback0(this);for(var s=1;s>>16)){if(t===this){var r=n();return this._attachExtraTrace(r),this._reject(r)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!=(134217728&e)?this._settlePromises():h.settlePromises(this),this._dereferenceTrace())}},j.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return h.fatalError(t,c.isNode);(65535&e)>0?h.settlePromises(this):this._ensurePossibleRejectionHandled()}},j.prototype._fulfillPromises=function(t,e){for(var r=1;r0){if(0!=(16842752&t)){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,t),this._rejectPromises(e,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,t),this._fulfillPromises(e,n)}this._setLength(0)}this._clearCancellationData()},j.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},j.defer=j.pending=function(){return x.deprecated("Promise.defer","new Promise"),{promise:new j(v),resolve:T,reject:M}},c.notEnumerableProp(j,"_makeSelfResolutionError",n),e("./method")(j,v,y,o,x),e("./bind")(j,v,y,x),e("./cancel")(j,b,o,x),e("./direct_resolve")(j),e("./synchronous_inspection")(j),e("./join")(j,b,y,v,h,s),j.Promise=j,j.version="3.5.2",e("./map.js")(j,b,o,y,v,x),e("./call_get.js")(j),e("./using.js")(j,o,y,k,v,x),e("./timers.js")(j,v,x),e("./generators.js")(j,o,v,y,a,x),e("./nodeify.js")(j),e("./promisify.js")(j,v),e("./props.js")(j,b,y,o),e("./race.js")(j,v,y,o),e("./reduce.js")(j,b,o,y,v,x),e("./settle.js")(j,b,x),e("./some.js")(j,b,o),e("./filter.js")(j,v),e("./each.js")(j,v),e("./any.js")(j),c.toFastProperties(j),c.toFastProperties(j.prototype),A({a:1}),A({b:2}),A({c:3}),A(1),A(function(){}),A(void 0),A(!1),A(new j(v)),x.setBounds(f.firstLineError,c.lastLineError),j}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o){var a=t("./util");a.isArray;function s(t){var n=this._promise=new e(r);t instanceof e&&n._propagateFrom(t,3),n._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return a.inherits(s,o),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function t(r,o){var s=n(this._values,this._promise);if(s instanceof e){var l=(s=s._target())._bitField;if(this._values=s,0==(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(t,this._reject,void 0,this,o);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=a.asArray(s)))0!==s.length?this._iterate(s):-5===o?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(o));else{var c=i("expecting an array or an iterable object but got "+a.classString(s)).reason();this._promise._rejectCallback(c,!1)}},s.prototype._iterate=function(t){var r=this.getActualLength(t.length);this._length=r,this._values=this.shouldCopyValues()?new Array(r):this._values;for(var i=this._promise,o=!1,a=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var r=0;r=this._length){var r;if(this._isMap)r=function(t){for(var e=new o,r=t.length/2|0,n=0;n>1},e.prototype.props=function(){return f(this)},e.props=function(t){return f(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,r){"use strict";function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacity=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(t,e){var r=new i;return r._bitField=33554432,r._settledValueField=t,this._promiseResolved(e,r)},o.prototype._promiseRejected=function(t,e){var r=new i;return r._bitField=16777216,r._settledValueField=t,this._promiseResolved(e,r)},e.settle=function(t){return n.deprecated(".settle()",".reflect()"),new o(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,r){"use strict";e.exports=function(e,r,n){var i=t("./util"),o=t("./errors").RangeError,a=t("./errors").AggregateError,s=i.isArray,l={};function c(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function u(t,e){if((0|e)!==e||e<0)return n("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var r=new c(t),i=r.promise();return r.setHowMany(e),r.init(),i}i.inherits(c,r),c.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=s(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(t){this._howMany=t},c.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},c.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new a,e=this.length();e0?this._reject(t):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(t){this._values.push(t)},c.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new o(e)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return u(t,e)},e.prototype.some=function(t){return u(this,t)},e._SomePromiseArray=c}},{"./errors":12,"./util":36}],32:[function(t,e,r){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var r=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},n=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},a=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return a.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return s.call(this._target())},t.prototype.value=function(){return r.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),n.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,r){"use strict";e.exports=function(e,r){var n=t("./util"),i=n.errorObj,o=n.isObject;var a={}.hasOwnProperty;return function(t,s){if(o(t)){if(t instanceof e)return t;var l=function(t){try{return function(t){return t.then}(t)}catch(t){return i.e=t,i}}(t);if(l===i){s&&s._pushContext();var c=e.reject(l.e);return s&&s._popContext(),c}if("function"==typeof l)return function(t){try{return a.call(t,"_promise0")}catch(t){return!1}}(t)?(c=new e(r),t._then(c._fulfill,c._reject,void 0,c,null),c):function(t,o,a){var s=new e(r),l=s;a&&a._pushContext(),s._captureStackTrace(),a&&a._popContext();var c=!0,u=n.tryCatch(o).call(t,function(t){s&&(s._resolveCallback(t),s=null)},function(t){s&&(s._rejectCallback(t,c,!0),s=null)});return c=!1,s&&u===i&&(s._rejectCallback(u.e,!0,!0),s=null),l}(t,l,s)}return t}}},{"./util":36}],34:[function(t,e,r){"use strict";e.exports=function(e,r,n){var i=t("./util"),o=e.TimeoutError;function a(t){this.handle=t}a.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,i){var o,l;return void 0!==i?(o=e.resolve(i)._then(s,null,null,t,void 0),n.cancellation()&&i instanceof e&&o._setOnCancel(i)):(o=new e(r),l=setTimeout(function(){o._fulfill()},+t),n.cancellation()&&o._setOnCancel(new a(l)),o._captureStackTrace()),o._setAsyncGuaranteed(),o};e.prototype.delay=function(t){return l(t,this)};function c(t){return clearTimeout(this.handle),t}function u(t){throw clearTimeout(this.handle),t}e.prototype.timeout=function(t,e){var r,s;t=+t;var l=new a(setTimeout(function(){r.isPending()&&function(t,e,r){var n;n="string"!=typeof e?e instanceof Error?e:new o("operation timed out"):new o(e),i.markAsOriginatingFromRejection(n),t._attachExtraTrace(n),t._reject(n),null!=r&&r.cancel()}(r,e,s)},t));return n.cancellation()?(s=this.then(),(r=s._then(c,u,void 0,l,void 0))._setOnCancel(l)):r=this._then(c,u,void 0,l,void 0),r}}},{"./util":36}],35:[function(t,e,r){"use strict";e.exports=function(e,r,n,i,o,a){var s=t("./util"),l=t("./errors").TypeError,c=t("./util").inherits,u=s.errorObj,f=s.tryCatch,h={};function p(t){setTimeout(function(){throw t},0)}function d(t,r){var i=0,a=t.length,s=new e(o);return function o(){if(i>=a)return s._fulfill();var l=function(t){var e=n(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(t[i++]);if(l instanceof e&&l._isDisposable()){try{l=n(l._getDisposer().tryDispose(r),t.promise)}catch(t){return p(t)}if(l instanceof e)return l._then(o,p,null,null,null)}o()}(),s}function m(t,e,r){this._data=t,this._promise=e,this._context=r}function v(t,e,r){this.constructor$(t,e,r)}function g(t){return m.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function _(t){this.length=t,this.promise=null,this[t-1]=null}m.prototype.data=function(){return this._data},m.prototype.promise=function(){return this._promise},m.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},m.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=e!==h?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},m.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},c(v,m),v.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},_.prototype._resultCancelled=function(){for(var t=this.length,r=0;r0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new v(t,this,i());throw new l}}},{"./errors":12,"./util":36}],36:[function(e,r,i){"use strict";var o=e("./es5"),a="undefined"==typeof navigator,s={e:{}},l,c="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:void 0!==this?this:null;function u(){try{var t=l;return l=null,t.apply(this,arguments)}catch(t){return s.e=t,s}}function f(t){return l=t,u}var h=function(t,e){var r={}.hasOwnProperty;function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}return n.prototype=e.prototype,t.prototype=new n,t.prototype};function p(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function d(t){return"function"==typeof t||"object"==typeof t&&null!==t}function m(t){return p(t)?new Error(P(t)):t}function v(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;r1,n=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=w.test(t+"")&&o.names(t).length>0;if(r||n||i)return!0}return!1}catch(t){return!1}}function x(t){function e(){}e.prototype=t;var r=new e;function n(){return typeof r.foo}return n(),n(),t}var B=/^[a-z$_][a-z$_0-9]*$/i;function C(t){return B.test(t)}function E(t,e,r){for(var n=new Array(t),i=0;i10||V[0]>0),q.isNode&&q.toFastProperties(t);try{throw new Error}catch(t){q.lastLineError=t}r.exports=q},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{_process:117,timers:142}],4:[function(t,e,r){},{}],5:[function(t,e,r){(function(r){var n=t("tty"),i=t("./lib/encode"),o=t("stream").Stream,a=e.exports=function(){var t=null;function e(e){if(t)throw new Error("multiple inputs specified");t=e}var i=null;function o(t){if(i)throw new Error("multiple outputs specified");i=t}for(var a=0;a0&&this.down(e),t>0?this.right(t):t<0&&this.left(-t),this},s.prototype.up=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"A")),this},s.prototype.down=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"B")),this},s.prototype.right=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"C")),this},s.prototype.left=function(t){return void 0===t&&(t=1),this.write(i("["+Math.floor(t)+"D")),this},s.prototype.column=function(t){return this.write(i("["+Math.floor(t)+"G")),this},s.prototype.push=function(t){return this.write(i(t?"7":"[s")),this},s.prototype.pop=function(t){return this.write(i(t?"8":"[u")),this},s.prototype.erase=function(t){return"end"===t||"$"===t?this.write(i("[K")):"start"===t||"^"===t?this.write(i("[1K")):"line"===t?this.write(i("[2K")):"down"===t?this.write(i("[J")):"up"===t?this.write(i("[1J")):"screen"===t?this.write(i("[1J")):this.emit("error",new Error("Unknown erase type: "+t)),this},s.prototype.display=function(t){var e={reset:0,bright:1,dim:2,underscore:4,blink:5,reverse:7,hidden:8}[t];return void 0===e&&this.emit("error",new Error("Unknown attribute: "+t)),this.write(i("["+e+"m")),this},s.prototype.foreground=function(t){if("number"==typeof t)(t<0||t>=256)&&this.emit("error",new Error("Color out of range: "+t)),this.write(i("[38;5;"+t+"m"));else{var e={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37}[t.toLowerCase()];e||this.emit("error",new Error("Unknown color: "+t)),this.write(i("["+e+"m"))}return this},s.prototype.background=function(t){if("number"==typeof t)(t<0||t>=256)&&this.emit("error",new Error("Color out of range: "+t)),this.write(i("[48;5;"+t+"m"));else{var e={black:40,red:41,green:42,yellow:43,blue:44,magenta:45,cyan:46,white:47}[t.toLowerCase()];e||this.emit("error",new Error("Unknown color: "+t)),this.write(i("["+e+"m"))}return this},s.prototype.cursor=function(t){return this.write(i(t?"[?25h":"[?25l")),this};var l=a.extractCodes=function(t){for(var e=[],r=-1,n=0;n=0&&e.push(t.slice(r,n)),r=n):r>=0&&n===t.length-1&&e.push(t.slice(r));return e}}).call(this,t("_process"))},{"./lib/encode":6,_process:117,stream:139,tty:143}],6:[function(t,e,r){(function(t){var r=(e.exports=function(e){return new t([27].concat(function t(e){return"string"==typeof e?e.split("").map(r):Array.isArray(e)?e.reduce(function(e,r){return e.concat(t(r))},[]):void 0}(e)))}).ord=function(t){return t.charCodeAt(0)}}).call(this,t("buffer").Buffer)},{buffer:47}],7:[function(t,e,r){(function(r){"use strict";var n=t("readable-stream").Readable,i=t("util");function o(t,e){if(!(this instanceof o))return new o(t,e);n.call(this,e),null!==t&&void 0!==t||(t=String(t)),this._obj=t}e.exports=o,i.inherits(o,n),o.prototype._read=function(t){var e=this._obj;"string"==typeof e?this.push(new r(e)):r.isBuffer(e)?this.push(e):this.push(new r(JSON.stringify(e))),this.push(null)}}).call(this,t("buffer").Buffer)},{buffer:47,"readable-stream":13,util:150}],8:[function(t,e,r){(function(r){e.exports=s;var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e},i=t("core-util-is");i.inherits=t("inherits");var o=t("./_stream_readable"),a=t("./_stream_writable");function s(t){if(!(this instanceof s))return new s(t);o.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||r.nextTick(this.end.bind(this))}i.inherits(s,o),function(t,e){for(var r=0,n=t.length;r0?d(t):b(t)}(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!a){var l=new Error("stream.push() after EOF");t.emit("error",l)}else if(e.endEmitted&&a){l=new Error("stream.unshift() after end event");t.emit("error",l)}else!e.decoder||a||o||(n=e.decoder.write(n)),e.length+=e.objectMode?1:n.length,a?e.buffer.unshift(n):(e.reading=!1,e.buffer.push(n)),e.needReadable&&d(t),function(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(function(){!function(t,e){var r=e.length;for(;!e.reading&&!e.flowing&&!e.ended&&e.lengthe.highWaterMark&&(e.highWaterMark=function(t){if(t>=h)t=h;else{t--;for(var e=1;e<32;e<<=1)t|=t>>e;t++}return t}(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function d(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,e.sync?r.nextTick(function(){m(t)}):m(t))}function m(t){t.emit("readable")}function v(t){var e,r=t._readableState;function n(t,n,i){!1===t.write(e)&&r.awaitDrain++}for(r.awaitDrain=0;r.pipesCount&&null!==(e=t.read());)if(1===r.pipesCount?n(r.pipes):w(r.pipes,n),t.emit("data",e),r.awaitDrain>0)return;if(0===r.pipesCount)return r.flowing=!1,void(o.listenerCount(t,"data")>0&&_(t));r.ranOut=!0}function g(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function _(t,e){if(t._readableState.flowing)throw new Error("Cannot switch to old mode now.");var n=e||!1,i=!1;t.readable=!0,t.pipe=s.prototype.pipe,t.on=t.addListener=s.prototype.on,t.on("readable",function(){var e;for(i=!0;!n&&null!==(e=t.read());)t.emit("data",e);null===e&&(i=!1,t._readableState.needReadable=!0)}),t.pause=function(){n=!0,this.emit("pause")},t.resume=function(){n=!1,i?r.nextTick(function(){t.emit("readable")}):this.read(0),this.emit("resume")},t.emit("readable")}function y(t,e){var r,n=e.buffer,o=e.length,a=!!e.decoder,s=!!e.objectMode;if(0===n.length)return null;if(0===o)r=null;else if(s)r=n.shift();else if(!t||t>=o)r=a?n.join(""):i.concat(n,o),n.length=0;else{if(t0)throw new Error("endReadable called on non-empty stream");!e.endEmitted&&e.calledRead&&(e.ended=!0,r.nextTick(function(){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function w(t,e){for(var r=0,n=t.length;r0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return d(this),null;if(0===(t=p(t,e))&&e.ended)return r=null,e.length>0&&e.decoder&&(r=y(t,e),e.length-=r.length),0===e.length&&b(this),r;var i=e.needReadable;return e.length-t<=e.highWaterMark&&(i=!0),(e.ended||e.reading)&&(i=!1),i&&(e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1),i&&!e.reading&&(t=p(n,e)),null===(r=t>0?y(t,e):null)&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),e.ended&&!e.endEmitted&&0===e.length&&b(this),r},u.prototype._read=function(t){this.emit("error",new Error("not implemented"))},u.prototype.pipe=function(t,e){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1;var s=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:f;function l(t){t===i&&f()}function c(){t.end()}a.endEmitted?r.nextTick(s):i.once("end",s),t.on("unpipe",l);var u=function(t){return function(){var e=t._readableState;e.awaitDrain--,0===e.awaitDrain&&v(t)}}(i);function f(){t.removeListener("close",p),t.removeListener("finish",d),t.removeListener("drain",u),t.removeListener("error",h),t.removeListener("unpipe",l),i.removeListener("end",c),i.removeListener("end",f),t._writableState&&!t._writableState.needDrain||u()}function h(e){m(),t.removeListener("error",h),0===o.listenerCount(t,"error")&&t.emit("error",e)}function p(){t.removeListener("finish",d),m()}function d(){t.removeListener("close",p),m()}function m(){i.unpipe(t)}return t.on("drain",u),t._events&&t._events.error?n(t._events.error)?t._events.error.unshift(h):t._events.error=[h,t._events.error]:t.on("error",h),t.once("close",p),t.once("finish",d),t.emit("pipe",i),a.flowing||(this.on("readable",g),a.flowing=!0,r.nextTick(function(){v(i)})),t},u.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,this.removeListener("readable",g),e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,this.removeListener("readable",g),e.flowing=!1;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(i),ir.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,n(e)}},{"./lib/thunk.js":17}],16:[function(t,e,r){"use strict";var n=t("uniq");function i(t,e,r){var n,i,o=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],c=[],u=0,f=0;for(n=0;n0&&l.push("var "+c.join(",")),n=o-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function o(t,e,r){for(var n=t.body,i=[],o=[],a=0;a0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){var y=new Array(r);for(l=0;l0&&g.push("var "+_.join(",")),l=0;l3&&g.push(o(t.pre,t,s));var x=o(t.body,t,s),B=function(t){for(var e=0,r=t[0].length;e0,c=[],u=0;u0;){"].join("")),c.push(["if(j",u,"<",s,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",s].join("")),c.push(["j",u,"-=",s,"}"].join("")),l&&c.push(["index[",e[u],"]=j",u].join(""));for(u=0;u3&&g.push(o(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+g.join("\n")+"\n----------");var C=[t.funcName||"unnamed","_cwise_loop_",a[0].join("s"),"m",B,function(t){for(var e=new Array(t.length),r=!0,n=0;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(s)].join("");return new Function(["function ",C,"(",v.join(","),"){",g.join("\n"),"} return ",C].join(""))()}},{uniq:146}],17:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],c=[],u=0;u0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),c.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}for(t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),e.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;u0)return function(t,e){var r,n;for(r=new Array(t),n=0;n 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],24:[function(t,e,r){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat correctionRadius = 0.5;\n\tfloat distance = sqrt(vPosition.x * vPosition.x + vPosition.y * vPosition.y) / correctionRadius;\n\tfloat theta = 1.0;\n\tif(distance != 0.0){\n\t\ttheta = atan(distance);\n\t}\n\tvec2 vMapping = theta * vPosition.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\t\t\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],25:[function(t,e,r){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 uLensS;\nuniform vec2 uLensF;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord * vec2(1.0, -1.0)/ 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tfloat scale = uLensS.z;\n\tvec3 vPos = vPosition;\n\tfloat Fx = uLensF.x;\n\tfloat Fy = uLensF.y;\n\tvec2 vMapping = vPos.xy;\n\tvMapping.x = vMapping.x + ((pow(vPos.y, 2.0)/scale)*vPos.x/scale)*-Fx;\n\tvMapping.y = vMapping.y + ((pow(vPos.x, 2.0)/scale)*vPos.y/scale)*-Fy;\n\tvMapping = vMapping * uLensS.xy;\n\tvMapping = GLCoord2TextureCoord(vMapping/scale);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t}\n\tgl_FragColor = texture;\n}\n"},{}],26:[function(t,e,r){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TODO insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],27:[function(t,e,r){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec4 uLens;\nuniform vec2 uFov;\nuniform sampler2D uSampler;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvec2 TextureCoord2GLCoord(vec2 textureCoord) {\n\treturn (textureCoord - vec2(0.5, 0.5)) * 2.0;\n}\nvec2 GLCoord2TextureCoord(vec2 glCoord) {\n\treturn glCoord / 2.0 + vec2(0.5, 0.5);\n}\nvoid main(void){\n\tvec2 vMapping = vec2(vTextureCoord.x, 1.0 - vTextureCoord.y);\n\tvMapping = TextureCoord2GLCoord(vMapping);\n\t//TOD insert Code\n\tfloat F = uLens.x/ uLens.w;\n\tfloat seta = length(vMapping) / F;\n\tvMapping = sin(seta) * F / length(vMapping) * vMapping;\n\tvMapping *= uLens.w * 1.414;\n\tvMapping = GLCoord2TextureCoord(vMapping);\n\tvec4 texture = texture2D(uSampler, vMapping);\n\tif(vMapping.x > 0.99 || vMapping.x < 0.01 || vMapping.y > 0.99 || vMapping.y < 0.01){\n\t\ttexture = vec4(0.0, 0.0, 0.0, 1.0);\n\t} \n\tgl_FragColor = texture;\n}\n"},{}],28:[function(t,e,r){e.exports="#ifdef GL_ES\nprecision highp float;\n#endif\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nvarying vec3 vPosition;\nvarying vec2 vTextureCoord;\nvoid main(void){\n\tvPosition = aVertexPosition;\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = vec4(vPosition,1.0);\n}\n"},{}],29:[function(t,e,r){(function(r,n){"use strict";var i=t("path"),o=t("ndarray"),a=t("omggif").GifReader,s=(t("ndarray-pack"),t("through"),t("data-uri-to-buffer"));function l(t,e){var r;try{r=new a(t)}catch(t){return void e(t)}if(r.numFrames()>0){var n=[r.numFrames(),r.height,r.width,4],i=new Uint8Array(n[0]*n[1]*n[2]*n[3]),s=o(i,n);try{for(var l=0;l=0&&(this.dispose=t)},l.prototype.setRepeat=function(t){this.repeat=t},l.prototype.setTransparent=function(t){this.transparent=t},l.prototype.analyzeImage=function(t){this.setImagePixels(this.removeAlphaChannel(t)),this.analyzePixels()},l.prototype.writeImageInfo=function(){this.firstFrame&&(this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.writePalette(),this.firstFrame=!1},l.prototype.outputImage=function(){this.writePixels()},l.prototype.addFrame=function(t){this.emit("frame#start"),this.analyzeImage(t),this.writeImageInfo(),this.outputImage(),this.emit("frame#stop")},l.prototype.finish=function(){this.emit("finish#start"),this.writeByte(59),this.emit("finish#stop")},l.prototype.setQuality=function(t){t<1&&(t=1),this.sample=t},l.prototype.writeHeader=function(){this.emit("writeHeader#start"),this.writeUTFBytes("GIF89a"),this.emit("writeHeader#stop")},l.prototype.analyzePixels=function(){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);var e=new o(this.pixels,this.sample);e.buildColormap(),this.colorTab=e.getColormap();for(var r=0,n=0;n>16,r=(65280&t)>>8,n=255&t,i=0,o=16777216,a=this.colorTab.length,s=0;s=0&&(e=7&dispose),e<<=2,this.writeByte(0|e|t),this.writeShort(this.delay),this.writeByte(this.transIndex),this.writeByte(0)},l.prototype.writeImageDesc=function(){this.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame?this.writeByte(0):this.writeByte(128|this.palSize)},l.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.writeByte(240|this.palSize),this.writeByte(0),this.writeByte(0)},l.prototype.writeNetscapeExt=function(){this.writeByte(33),this.writeByte(255),this.writeByte(11),this.writeUTFBytes("NETSCAPE2.0"),this.writeByte(3),this.writeByte(1),this.writeShort(this.repeat),this.writeByte(0)},l.prototype.writePalette=function(){this.writeBytes(this.colorTab);for(var t=768-this.colorTab.length,e=0;e>8&255)},l.prototype.writePixels=function(){new a(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this)},l.prototype.stream=function(){return this},l.ByteCapacitor=s,e.exports=l}).call(this,t("buffer").Buffer)},{"./LZWEncoder.js":32,"./TypedNeuQuant.js":33,assert:40,buffer:47,events:48,"readable-stream":39,util:150}],32:[function(t,e,r){var n=-1,i=12,o=5003,a=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];e.exports=function(t,e,r,s){var l,c,u,f,h,p,d,m,v,g=Math.max(2,s),_=new Uint8Array(256),y=new Int32Array(o),b=new Int32Array(o),w=0,k=0,x=!1;function B(t,e){_[c++]=t,c>=254&&P(e)}function C(t){E(o),k=m+2,x=!0,T(m,t)}function E(t){for(var e=0;e0&&(t.writeByte(c),t.writeBytes(_,0,c),c=0)}function S(t){return(1<0?l|=t<=8;)B(255&l,e),l>>=8,w-=8;if((k>u||x)&&(x?(u=S(p=d),x=!1):u=++p==i?1<0;)B(255&l,e),l>>=8,w-=8;P(e)}}this.encode=function(r){r.writeByte(g),f=t*e,h=0,function(t,e){var r,a,s,l,f,h,g;for(x=!1,u=S(p=d=t),v=1+(m=1<=0){f=h-s,0===s&&(f=1);do{if((s-=f)<0&&(s+=h),y[s]===r){l=b[s];continue t}}while(y[s]>=0)}T(l,e),l=a,k<1<>u,h=l<>3)*(1<c;)l=P[p++],fc&&((s=r[h--])[0]-=l*(s[0]-n)/_,s[1]-=l*(s[1]-o)/_,s[2]-=l*(s[2]-a)/_)}function T(t,e,n){var o,l,p,d,m,v=~(1<<31),g=v,_=-1,y=_;for(o=0;o>s-a))>u,E[o]-=m,C[o]+=m<>3),t=0;t>p;for(E<=1&&(E=0),r=0;r=u&&(M-=u),r++,0===_&&(_=1),r%_==0)for(B-=B/f,(E=(C-=C/m)>>p)<=1&&(E=0),c=0;c>=a,r[t][1]>>=a,r[t][2]>>=a,r[t][3]=t}(),function(){var t,e,n,a,s,l,c=0,u=0;for(t=0;t>1,e=c+1;e>1,e=c+1;e<256;e++)B[e]=o}()},this.getColormap=function(){for(var t=[],e=[],n=0;n=0;)u=l?u=i:(u++,s<0&&(s=-s),(o=a[0]-t)<0&&(o=-o),(s+=o)=0&&((s=e-(a=r[f])[1])>=l?f=-1:(f--,s<0&&(s=-s),(o=a[0]-t)<0&&(o=-o),(s+=o)0)if(e.ended&&!o){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&o){s=new Error("stream.unshift() after end event");t.emit("error",s)}else!e.decoder||o||i||(n=e.decoder.write(n)),o||(e.reading=!1),e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,o?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&m(t)),function(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(function(){!function(t,e){var r=e.length;for(;!e.reading&&!e.flowing&&!e.ended&&e.lengthe.highWaterMark&&(e.highWaterMark=function(t){if(t>=p)t=p;else{t--;for(var e=1;e<32;e<<=1)t|=t>>e;t++}return t}(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function m(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?r.nextTick(function(){v(t)}):v(t))}function v(t){c("emit readable"),t.emit("readable"),g(t)}function g(t){var e=t._readableState;if(c("flow",e.flowing),e.flowing)do{var r=t.read()}while(null!==r&&e.flowing)}function _(t,e){var r,n=e.buffer,o=e.length,a=!!e.decoder,s=!!e.objectMode;if(0===n.length)return null;if(0===o)r=null;else if(s)r=n.shift();else if(!t||t>=o)r=a?n.join(""):i.concat(n,o),n.length=0;else{if(t0)throw new Error("endReadable called on non-empty stream");e.endEmitted||(e.ended=!0,r.nextTick(function(){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}))}f.prototype.read=function(t){c("read",t);var e=this._readableState,r=t;if((!l.isNumber(t)||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?y(this):m(this),null;if(0===(t=d(t,e))&&e.ended)return 0===e.length&&y(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t0?_(t,e):null,l.isNull(n)&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),r!==t&&e.ended&&0===e.length&&y(this),l.isNull(n)||this.emit("data",n),n},f.prototype._read=function(t){this.emit("error",new Error("not implemented"))},f.prototype.pipe=function(t,e){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,c("pipe count=%d opts=%j",a.pipesCount,e);var s=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?u:h;function l(t){c("onunpipe"),t===i&&h()}function u(){c("onend"),t.end()}a.endEmitted?r.nextTick(s):i.once("end",s),t.on("unpipe",l);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o.listenerCount(t,"data")&&(e.flowing=!0,g(t))}}(i);function h(){c("cleanup"),t.removeListener("close",m),t.removeListener("finish",v),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",l),i.removeListener("end",u),i.removeListener("end",h),i.removeListener("data",p),!a.awaitDrain||t._writableState&&!t._writableState.needDrain||f()}function p(e){c("ondata"),!1===t.write(e)&&(c("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++,i.pause())}function d(e){c("onerror",e),_(),t.removeListener("error",d),0===o.listenerCount(t,"error")&&t.emit("error",e)}function m(){t.removeListener("finish",v),_()}function v(){c("onfinish"),t.removeListener("close",m),_()}function _(){c("unpipe"),i.unpipe(t)}return t.on("drain",f),i.on("data",p),t._events&&t._events.error?n(t._events.error)?t._events.error.unshift(d):t._events.error=[d,t._events.error]:t.on("error",d),t.once("close",m),t.once("finish",v),t.emit("pipe",i),a.flowing||(c("pipe resume"),i.resume()),t},f.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i1){for(var r=[],n=0;n=0;c--)if(u[c]!==f[c])return!1;for(c=u.length-1;c>=0;c--)if(l=u[c],!_(t[l],e[l],r,n))return!1;return!0}(t,e,r,a))}return r?t===e:t==e}function y(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function b(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&v(i,r,"Missing expected exception"+n);var a="string"==typeof n,s=!t&&o.isError(i),l=!t&&i&&!r;if((s&&a&&b(i,r)||l)&&v(i,r,"Got unwanted exception"+n),t&&i&&r&&!b(i,r)||!t&&i)throw i}f.AssertionError=function(t){var e;this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=d(m((e=this).actual),128)+" "+e.operator+" "+d(m(e.expected),128),this.generatedMessage=!0);var r=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=p(r),a=i.indexOf("\n"+o);if(a>=0){var s=i.indexOf("\n",a+1);i=i.substring(s+1)}this.stack=i}}},o.inherits(f.AssertionError,Error),f.fail=v,f.ok=g,f.equal=function(t,e,r){t!=e&&v(t,e,r,"==",f.equal)},f.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",f.notEqual)},f.deepEqual=function(t,e,r){_(t,e,!1)||v(t,e,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(t,e,r){_(t,e,!0)||v(t,e,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(t,e,r){_(t,e,!1)&&v(t,e,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function t(e,r,n){_(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},f.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",f.strictEqual)},f.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",f.notStrictEqual)},f.throws=function(t,e,r){w(!0,t,e,r)},f.doesNotThrow=function(t,e,r){w(!1,t,e,r)},f.ifError=function(t){if(t)throw t};var k=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":43}],41:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],42:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],43:[function(t,e,r){(function(e,n){var i=/%[sdj%]/g;r.format=function(t){if(!g(t)){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),l=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),u(n,t,n.depth)}function l(t,e){var r=s.styles[e];return r?"["+s.colors[r][0]+"m"+t+"["+s.colors[r][1]+"m":t}function c(t,e){return t}function u(t,e,n){if(t.customInspect&&e&&x(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return g(i)||(i=u(t,i,n)),i}var o=function(t,e){if(_(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(v(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,e);if(o)return o;var a=Object.keys(e),s=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),k(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(e);if(0===a.length){if(x(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(y(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(w(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return f(e)}var c,b="",B=!1,C=["{","}"];(p(e)&&(B=!0,C=["[","]"]),x(e))&&(b=" [Function"+(e.name?": "+e.name:"")+"]");return y(e)&&(b=" "+RegExp.prototype.toString.call(e)),w(e)&&(b=" "+Date.prototype.toUTCString.call(e)),k(e)&&(b=" "+f(e)),0!==a.length||B&&0!=e.length?n<0?y(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=B?function(t,e,r,n,i){for(var o=[],a=0,s=e.length;a=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,b,C)):C[0]+b+C[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),P(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(l.value)<0?(s=m(r)?u(t,l.value,null):u(t,l.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n")):s=t.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return"number"==typeof t}function g(t){return"string"==typeof t}function _(t){return void 0===t}function y(t){return b(t)&&"[object RegExp]"===B(t)}function b(t){return"object"==typeof t&&null!==t}function w(t){return b(t)&&"[object Date]"===B(t)}function k(t){return b(t)&&("[object Error]"===B(t)||t instanceof Error)}function x(t){return"function"==typeof t}function B(t){return Object.prototype.toString.call(t)}function C(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(_(o)&&(o=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!a[t])if(new RegExp("\\b"+t+"\\b","i").test(o)){var n=e.pid;a[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else a[t]=function(){};return a[t]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=m,r.isNullOrUndefined=function(t){return null==t},r.isNumber=v,r.isString=g,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=_,r.isRegExp=y,r.isObject=b,r.isDate=w,r.isError=k,r.isFunction=x,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":"),[t.getDate(),E[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":42,_process:117,inherits:41}],44:[function(t,e,r){(function(e,n){"use strict";var i=t("assert"),o=t("pako/lib/zlib/zstream"),a=t("pako/lib/zlib/deflate.js"),s=t("pako/lib/zlib/inflate.js"),l=t("pako/lib/zlib/constants");for(var c in l)r[c]=l[c];r.NONE=0,r.DEFLATE=1,r.INFLATE=2,r.GZIP=3,r.GUNZIP=4,r.DEFLATERAW=5,r.INFLATERAW=6,r.UNZIP=7;function u(t){if("number"!=typeof t||tr.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}u.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=r.UNZIP),this.mode===r.DEFLATE||this.mode===r.GZIP||this.mode===r.DEFLATERAW?a.deflateEnd(this.strm):this.mode!==r.INFLATE&&this.mode!==r.GUNZIP&&this.mode!==r.INFLATERAW&&this.mode!==r.UNZIP||s.inflateEnd(this.strm),this.mode=r.NONE,this.dictionary=null)},u.prototype.write=function(t,e,r,n,i,o,a){return this._write(!0,t,e,r,n,i,o,a)},u.prototype.writeSync=function(t,e,r,n,i,o,a){return this._write(!1,t,e,r,n,i,o,a)},u.prototype._write=function(t,o,a,s,l,c,u,f){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==r.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===o,"must provide flush value"),this.write_in_progress=!0,o!==r.Z_NO_FLUSH&&o!==r.Z_PARTIAL_FLUSH&&o!==r.Z_SYNC_FLUSH&&o!==r.Z_FULL_FLUSH&&o!==r.Z_FINISH&&o!==r.Z_BLOCK)throw new Error("Invalid flush value");if(null==a&&(a=n.alloc(0),l=0,s=0),this.strm.avail_in=l,this.strm.input=a,this.strm.next_in=s,this.strm.avail_out=f,this.strm.output=c,this.strm.next_out=u,this.flush=o,!t)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return e.nextTick(function(){h._process(),h._after()}),this},u.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},u.prototype._process=function(){var t=null;switch(this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:this.err=a.deflate(this.strm,this.flush);break;case r.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=r.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=r.GUNZIP):this.mode=r.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===r.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===r.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===r.Z_DATA_ERROR&&(this.err=r.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===r.GUNZIP&&this.err===r.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},u.prototype._checkError=function(){switch(this.err){case r.Z_OK:case r.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===r.Z_FINISH)return this._error("unexpected end of file"),!1;break;case r.Z_STREAM_END:break;case r.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},u.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},u.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},u.prototype.init=function(t,e,n,o,a){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(t>=8&&t<=15,"invalid windowBits"),i(e>=-1&&e<=9,"invalid compression level"),i(n>=1&&n<=9,"invalid memlevel"),i(o===r.Z_FILTERED||o===r.Z_HUFFMAN_ONLY||o===r.Z_RLE||o===r.Z_FIXED||o===r.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(e,t,n,o,a),this._setDictionary()},u.prototype.params=function(){throw new Error("deflateParams Not supported")},u.prototype.reset=function(){this._reset(),this._setDictionary()},u.prototype._init=function(t,e,n,i,l){switch(this.level=t,this.windowBits=e,this.memLevel=n,this.strategy=i,this.flush=r.Z_NO_FLUSH,this.err=r.Z_OK,this.mode!==r.GZIP&&this.mode!==r.GUNZIP||(this.windowBits+=16),this.mode===r.UNZIP&&(this.windowBits+=32),this.mode!==r.DEFLATERAW&&this.mode!==r.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new o,this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:this.err=a.deflateInit2(this.strm,this.level,r.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:case r.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==r.Z_OK&&this._error("Init error"),this.dictionary=l,this.write_in_progress=!1,this.init_done=!0},u.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=r.Z_OK,this.mode){case r.DEFLATE:case r.DEFLATERAW:this.err=a.deflateSetDictionary(this.strm,this.dictionary)}this.err!==r.Z_OK&&this._error("Failed to set dictionary")}},u.prototype._reset=function(){switch(this.err=r.Z_OK,this.mode){case r.DEFLATE:case r.DEFLATERAW:case r.GZIP:this.err=a.deflateReset(this.strm);break;case r.INFLATE:case r.INFLATERAW:case r.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==r.Z_OK&&this._error("Failed to reset stream")},r.Zlib=u}).call(this,t("_process"),t("buffer").Buffer)},{_process:117,assert:40,buffer:47,"pako/lib/zlib/constants":51,"pako/lib/zlib/deflate.js":53,"pako/lib/zlib/inflate.js":55,"pako/lib/zlib/zstream":59}],45:[function(t,e,r){(function(e){"use strict";var n=t("buffer").Buffer,i=t("stream").Transform,o=t("./binding"),a=t("util"),s=t("assert").ok,l=t("buffer").kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+l.toString(16)+" bytes";o.Z_MIN_WINDOWBITS=8,o.Z_MAX_WINDOWBITS=15,o.Z_DEFAULT_WINDOWBITS=15,o.Z_MIN_CHUNK=64,o.Z_MAX_CHUNK=1/0,o.Z_DEFAULT_CHUNK=16384,o.Z_MIN_MEMLEVEL=1,o.Z_MAX_MEMLEVEL=9,o.Z_DEFAULT_MEMLEVEL=8,o.Z_MIN_LEVEL=-1,o.Z_MAX_LEVEL=9,o.Z_DEFAULT_LEVEL=o.Z_DEFAULT_COMPRESSION;for(var u=Object.keys(o),f=0;f=l?a=new RangeError(c):e=n.concat(i,o),i=[],t.close(),r(a,e)}t.on("error",function(e){t.removeListener("end",s),t.removeListener("readable",a),r(e)}),t.on("end",s),t.end(e),a()}function _(t,e){if("string"==typeof e&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Not a string or buffer");var r=t._finishFlushFlag;return t._processChunk(e,r)}function y(t){if(!(this instanceof y))return new y(t);P.call(this,t,o.DEFLATE)}function b(t){if(!(this instanceof b))return new b(t);P.call(this,t,o.INFLATE)}function w(t){if(!(this instanceof w))return new w(t);P.call(this,t,o.GZIP)}function k(t){if(!(this instanceof k))return new k(t);P.call(this,t,o.GUNZIP)}function x(t){if(!(this instanceof x))return new x(t);P.call(this,t,o.DEFLATERAW)}function B(t){if(!(this instanceof B))return new B(t);P.call(this,t,o.INFLATERAW)}function C(t){if(!(this instanceof C))return new C(t);P.call(this,t,o.UNZIP)}function E(t){return t===o.Z_NO_FLUSH||t===o.Z_PARTIAL_FLUSH||t===o.Z_SYNC_FLUSH||t===o.Z_FULL_FLUSH||t===o.Z_FINISH||t===o.Z_BLOCK}function P(t,e){var a=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||r.Z_DEFAULT_CHUNK,i.call(this,t),t.flush&&!E(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!E(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||o.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:o.Z_FINISH,t.chunkSize&&(t.chunkSizer.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBitsr.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.levelr.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevelr.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=r.Z_FILTERED&&t.strategy!=r.Z_HUFFMAN_ONLY&&t.strategy!=r.Z_RLE&&t.strategy!=r.Z_FIXED&&t.strategy!=r.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!n.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new o.Zlib(e);var s=this;this._hadError=!1,this._handle.onerror=function(t,e){S(s),s._hadError=!0;var n=new Error(t);n.errno=e,n.code=r.codes[e],s.emit("error",n)};var l=r.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(l=t.level);var c=r.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(c=t.strategy),this._handle.init(t.windowBits||r.Z_DEFAULT_WINDOWBITS,l,t.memLevel||r.Z_DEFAULT_MEMLEVEL,c,t.dictionary),this._buffer=n.allocUnsafe(this._chunkSize),this._offset=0,this._level=l,this._strategy=c,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!a._handle},configurable:!0,enumerable:!0})}function S(t,r){r&&e.nextTick(r),t._handle&&(t._handle.close(),t._handle=null)}function j(t){t.emit("close")}Object.defineProperty(r,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),r.Deflate=y,r.Inflate=b,r.Gzip=w,r.Gunzip=k,r.DeflateRaw=x,r.InflateRaw=B,r.Unzip=C,r.createDeflate=function(t){return new y(t)},r.createInflate=function(t){return new b(t)},r.createDeflateRaw=function(t){return new x(t)},r.createInflateRaw=function(t){return new B(t)},r.createGzip=function(t){return new w(t)},r.createGunzip=function(t){return new k(t)},r.createUnzip=function(t){return new C(t)},r.deflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new y(e),t,r)},r.deflateSync=function(t,e){return _(new y(e),t)},r.gzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new w(e),t,r)},r.gzipSync=function(t,e){return _(new w(e),t)},r.deflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new x(e),t,r)},r.deflateRawSync=function(t,e){return _(new x(e),t)},r.unzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new C(e),t,r)},r.unzipSync=function(t,e){return _(new C(e),t)},r.inflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new b(e),t,r)},r.inflateSync=function(t,e){return _(new b(e),t)},r.gunzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new k(e),t,r)},r.gunzipSync=function(t,e){return _(new k(e),t)},r.inflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),g(new B(e),t,r)},r.inflateRawSync=function(t,e){return _(new B(e),t)},a.inherits(P,i),P.prototype.params=function(t,n,i){if(tr.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(n!=r.Z_FILTERED&&n!=r.Z_HUFFMAN_ONLY&&n!=r.Z_RLE&&n!=r.Z_FIXED&&n!=r.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+n);if(this._level!==t||this._strategy!==n){var a=this;this.flush(o.Z_SYNC_FLUSH,function(){s(a._handle,"zlib binding closed"),a._handle.params(t,n),a._hadError||(a._level=t,a._strategy=n,i&&i())})}else e.nextTick(i)},P.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},P.prototype._flush=function(t){this._transform(n.alloc(0),"",t)},P.prototype.flush=function(t,r){var i=this,a=this._writableState;("function"==typeof t||void 0===t&&!r)&&(r=t,t=o.Z_FULL_FLUSH),a.ended?r&&e.nextTick(r):a.ending?r&&this.once("end",r):a.needDrain?r&&this.once("drain",function(){return i.flush(t,r)}):(this._flushFlag=t,this.write(n.alloc(0),"",r))},P.prototype.close=function(t){S(this,t),e.nextTick(j,this)},P.prototype._transform=function(t,e,r){var i,a=this._writableState,s=(a.ending||a.ended)&&(!t||a.length===t.length);return null===t||n.isBuffer(t)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,t.length>=a.length&&(this._flushFlag=this._opts.flush||o.Z_NO_FLUSH)),void this._processChunk(t,i,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},P.prototype._processChunk=function(t,e,r){var i=t&&t.length,o=this._chunkSize-this._offset,a=0,u=this,f="function"==typeof r;if(!f){var h,p=[],d=0;this.on("error",function(t){h=t}),s(this._handle,"zlib binding closed");do{var m=this._handle.writeSync(e,t,a,i,this._buffer,this._offset,o)}while(!this._hadError&&_(m[0],m[1]));if(this._hadError)throw h;if(d>=l)throw S(this),new RangeError(c);var v=n.concat(p,d);return S(this),v}s(this._handle,"zlib binding closed");var g=this._handle.write(e,t,a,i,this._buffer,this._offset,o);function _(l,c){if(this&&(this.buffer=null,this.callback=null),!u._hadError){var h=o-c;if(s(h>=0,"have should not go down"),h>0){var m=u._buffer.slice(u._offset,u._offset+h);u._offset+=h,f?u.push(m):(p.push(m),d+=m.length)}if((0===c||u._offset>=u._chunkSize)&&(o=u._chunkSize,u._offset=0,u._buffer=n.allocUnsafe(u._chunkSize)),0===c){if(a+=i-l,i=l,!f)return!0;var v=u._handle.write(e,t,a,i,u._buffer,u._offset,u._chunkSize);return v.callback=_,void(v.buffer=t)}if(!f)return!1;r()}}g.buffer=t,g.callback=_},a.inherits(y,P),a.inherits(b,P),a.inherits(w,P),a.inherits(k,P),a.inherits(x,P),a.inherits(B,P),a.inherits(C,P)}).call(this,t("_process"))},{"./binding":44,_process:117,assert:40,buffer:47,stream:139,util:150}],46:[function(t,e,r){arguments[4][4][0].apply(r,arguments)},{dup:4}],47:[function(t,e,r){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function a(t){if(t>o)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return l(t,e,r)}function l(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return U(t)?function(t,e,r){if(e<0||t.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(z(t)||U(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,a=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,l/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var u=-1;for(o=r;os&&(r=s-l),o=r;o>=0;o--){for(var f=!0,h=0;hi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(u=c);break;case 2:128==(192&(o=t[i+1]))&&(l=(31&c)<<6|63&o)>127&&(u=l);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(l=(15&c)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}return function(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,l=Math.min(o,a),c=this.slice(n,i),u=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return w(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function E(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function A(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,o){return e=+e,r>>>=0,o||A(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,o){return e=+e,r>>>=0,o||A(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function D(t){return n.toByteArray(function(t){if((t=t.trim().replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function U(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function z(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function q(t){return t!=t}},{"base64-js":1,ieee754:60}],48:[function(t,e,r){var n=Object.create||function(t){var e=function(){};return e.prototype=t,new e},i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},o=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function a(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._maxListeners=void 0;var s,l=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),s=0===c.x}catch(t){s=!1}function u(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function f(t,e,r,i){var o,a,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((a=t._events)?(a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),s=a[e]):(a=t._events=n(null),t._eventsCount=0),s){if("function"==typeof s?s=a[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),!s.warned&&(o=u(t))&&o>0&&s.length>o){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else s=a[e]=r,++t._eventsCount;return t}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var l=new Error('Unhandled "error" event. ('+e+")");throw l.context=e,l}if(!(r=a[t]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=v(t,n),o=0;o=0;a--)if(r[a]===e||r[a].listener===e){s=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;o--)this.removeListener(t,e[o]);return this},a.prototype.listeners=function(t){return d(this,t,!0)},a.prototype.rawListeners=function(t){return d(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],49:[function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var o=0;o>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+e[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},{}],51:[function(t,e,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],52:[function(t,e,r){"use strict";var n=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();e.exports=function(t,e,r,i){var o=n,a=i+r;t^=-1;for(var s=i;s>>8^o[255&(t^e[s])];return-1^t}},{}],53:[function(t,e,r){"use strict";var n,i=t("../utils/common"),o=t("./trees"),a=t("./adler32"),s=t("./crc32"),l=t("./messages"),c=0,u=1,f=3,h=4,p=5,d=0,m=1,v=-2,g=-3,_=-5,y=-1,b=1,w=2,k=3,x=4,B=0,C=2,E=8,P=9,S=15,j=8,T=286,M=30,A=19,I=2*T+1,R=15,L=3,O=258,F=O+L+1,D=32,N=42,U=69,z=73,q=91,V=103,G=113,H=666,W=1,Z=2,X=3,Y=4,$=3;function J(t,e){return t.msg=l[e],e}function K(t){return(t<<1)-(t>4?9:0)}function Q(t){for(var e=t.length;--e>=0;)t[e]=0}function tt(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(i.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function et(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,tt(t.strm)}function rt(t,e){t.pending_buf[t.pending++]=e}function nt(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function it(t,e){var r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,l=t.strstart>t.w_size-F?t.strstart-(t.w_size-F):0,c=t.window,u=t.w_mask,f=t.prev,h=t.strstart+O,p=c[o+a-1],d=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(c[(r=e)+a]===d&&c[r+a-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&oa){if(t.match_start=e,a=n,n>=s)break;p=c[o+a-1],d=c[o+a]}}}while((e=f[e&u])>l&&0!=--i);return a<=t.lookahead?a:t.lookahead}function ot(t){var e,r,n,o,l,c,u,f,h,p,d=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=d+(d-F)){i.arraySet(t.window,t.window,d,d,0),t.match_start-=d,t.strstart-=d,t.block_start-=d,e=r=t.hash_size;do{n=t.head[--e],t.head[e]=n>=d?n-d:0}while(--r);e=r=d;do{n=t.prev[--e],t.prev[e]=n>=d?n-d:0}while(--r);o+=d}if(0===t.strm.avail_in)break;if(c=t.strm,u=t.window,f=t.strstart+t.lookahead,h=o,p=void 0,(p=c.avail_in)>h&&(p=h),r=0===p?0:(c.avail_in-=p,i.arraySet(u,c.input,c.next_in,p,f),1===c.state.wrap?c.adler=a(c.adler,u,p,f):2===c.state.wrap&&(c.adler=s(c.adler,u,p,f)),c.next_in+=p,c.total_in+=p,p),t.lookahead+=r,t.lookahead+t.insert>=L)for(l=t.strstart-t.insert,t.ins_h=t.window[l],t.ins_h=(t.ins_h<=L&&(t.ins_h=(t.ins_h<=L)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-L),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=L){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=L&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=L-1)),t.prev_length>=L&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-L,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-L),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<15&&(s=2,n-=16),o<1||o>P||r!==E||n<8||n>15||e<0||e>9||a<0||a>x)return J(t,v);8===n&&(n=9);var l=new function(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=E,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*I),this.dyn_dtree=new i.Buf16(2*(2*M+1)),this.bl_tree=new i.Buf16(2*(2*A+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(R+1),this.heap=new i.Buf16(2*T+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*T+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0};return t.state=l,l.strm=t,l.wrap=s,l.gzhead=null,l.w_bits=n,l.w_size=1<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ot(t),0===t.lookahead&&e===c)return W;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,et(t,!1),0===t.strm.avail_out))return W;if(t.strstart-t.block_start>=t.w_size-F&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===h?(et(t,!0),0===t.strm.avail_out?X:Y):(t.strstart>t.block_start&&(et(t,!1),t.strm.avail_out),W)}),new lt(4,4,8,4,at),new lt(4,5,16,8,at),new lt(4,6,32,32,at),new lt(4,4,16,16,st),new lt(8,16,32,32,st),new lt(8,16,128,128,st),new lt(8,32,128,256,st),new lt(32,128,258,1024,st),new lt(32,258,258,4096,st)],r.deflateInit=function(t,e){return ft(t,e,E,S,j,B)},r.deflateInit2=ft,r.deflateReset=ut,r.deflateResetKeep=ct,r.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?v:(t.state.gzhead=e,d):v},r.deflate=function(t,e){var r,i,a,l;if(!t||!t.state||e>p||e<0)return t?J(t,v):v;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||i.status===H&&e!==h)return J(t,0===t.avail_out?_:v);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===N)if(2===i.wrap)t.adler=0,rt(i,31),rt(i,139),rt(i,8),i.gzhead?(rt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),rt(i,255&i.gzhead.time),rt(i,i.gzhead.time>>8&255),rt(i,i.gzhead.time>>16&255),rt(i,i.gzhead.time>>24&255),rt(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),rt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(rt(i,255&i.gzhead.extra.length),rt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=U):(rt(i,0),rt(i,0),rt(i,0),rt(i,0),rt(i,0),rt(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),rt(i,$),i.status=G);else{var g=E+(i.w_bits-8<<4)<<8;g|=(i.strategy>=w||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(g|=D),g+=31-g%31,i.status=G,nt(i,g),0!==i.strstart&&(nt(i,t.adler>>>16),nt(i,65535&t.adler)),t.adler=1}if(i.status===U)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),tt(t),a=i.pending,i.pending!==i.pending_buf_size));)rt(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=z)}else i.status=z;if(i.status===z)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),tt(t),a=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexa&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===l&&(i.gzindex=0,i.status=q)}else i.status=q;if(i.status===q)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),tt(t),a=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexa&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===l&&(i.status=V)}else i.status=V;if(i.status===V&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&tt(t),i.pending+2<=i.pending_buf_size&&(rt(i,255&t.adler),rt(i,t.adler>>8&255),t.adler=0,i.status=G)):i.status=G),0!==i.pending){if(tt(t),0===t.avail_out)return i.last_flush=-1,d}else if(0===t.avail_in&&K(e)<=K(r)&&e!==h)return J(t,_);if(i.status===H&&0!==t.avail_in)return J(t,_);if(0!==t.avail_in||0!==i.lookahead||e!==c&&i.status!==H){var y=i.strategy===w?function(t,e){for(var r;;){if(0===t.lookahead&&(ot(t),0===t.lookahead)){if(e===c)return W;break}if(t.match_length=0,r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===h?(et(t,!0),0===t.strm.avail_out?X:Y):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:Z}(i,e):i.strategy===k?function(t,e){for(var r,n,i,a,s=t.window;;){if(t.lookahead<=O){if(ot(t),t.lookahead<=O&&e===c)return W;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=L&&t.strstart>0&&(n=s[i=t.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){a=t.strstart+O;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=L?(r=o._tr_tally(t,1,t.match_length-L),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(et(t,!1),0===t.strm.avail_out))return W}return t.insert=0,e===h?(et(t,!0),0===t.strm.avail_out?X:Y):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?W:Z}(i,e):n[i.level].func(i,e);if(y!==X&&y!==Y||(i.status=H),y===W||y===X)return 0===t.avail_out&&(i.last_flush=-1),d;if(y===Z&&(e===u?o._tr_align(i):e!==p&&(o._tr_stored_block(i,0,0,!1),e===f&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),tt(t),0===t.avail_out))return i.last_flush=-1,d}return e!==h?d:i.wrap<=0?m:(2===i.wrap?(rt(i,255&t.adler),rt(i,t.adler>>8&255),rt(i,t.adler>>16&255),rt(i,t.adler>>24&255),rt(i,255&t.total_in),rt(i,t.total_in>>8&255),rt(i,t.total_in>>16&255),rt(i,t.total_in>>24&255)):(nt(i,t.adler>>>16),nt(i,65535&t.adler)),tt(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:m)},r.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==N&&e!==U&&e!==z&&e!==q&&e!==V&&e!==G&&e!==H?J(t,v):(t.state=null,e===G?J(t,g):d):v},r.deflateSetDictionary=function(t,e){var r,n,o,s,l,c,u,f,h=e.length;if(!t||!t.state)return v;if(2===(s=(r=t.state).wrap)||1===s&&r.status!==N||r.lookahead)return v;for(1===s&&(t.adler=a(t.adler,e,h,0)),r.wrap=0,h>=r.w_size&&(0===s&&(Q(r.head),r.strstart=0,r.block_start=0,r.insert=0),f=new i.Buf8(r.w_size),i.arraySet(f,e,h-r.w_size,r.w_size,0),e=f,h=r.w_size),l=t.avail_in,c=t.next_in,u=t.input,t.avail_in=h,t.next_in=0,t.input=e,ot(r);r.lookahead>=L;){n=r.strstart,o=r.lookahead-(L-1);do{r.ins_h=(r.ins_h<>>=b=y>>>24,d-=b,0===(b=y>>>16&255))E[o++]=65535&y;else{if(!(16&b)){if(0==(64&b)){y=m[(65535&y)+(p&(1<>>=b,d-=b),d<15&&(p+=C[n++]<>>=b=y>>>24,d-=b,!(16&(b=y>>>16&255))){if(0==(64&b)){y=v[(65535&y)+(p&(1<l){t.msg="invalid distance too far back",r.mode=30;break t}if(p>>>=b,d-=b,k>(b=o-a)){if((b=k-b)>u&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(x=0,B=h,0===f){if(x+=c-b,b2;)E[o++]=B[x++],E[o++]=B[x++],E[o++]=B[x++],w-=3;w&&(E[o++]=B[x++],w>1&&(E[o++]=B[x++]))}else{x=o-k;do{E[o++]=E[x++],E[o++]=E[x++],E[o++]=E[x++],w-=3}while(w>2);w&&(E[o++]=E[x++],w>1&&(E[o++]=E[x++]))}break}}break}}while(n>3,p&=(1<<(d-=w<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function it(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=k,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(tt),e.distcode=e.distdyn=new n.Buf32(et),e.sane=1,e.back=-1,d):g}function ot(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,it(t)):g}function at(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?g:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,ot(t))):g}function st(t,e){var r,i;return t?(i=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},t.state=i,i.window=null,(r=at(t,e))!==d&&(t.state=null),r):g}var lt,ct,ut=!0;function ft(t){if(ut){var e;for(lt=new n.Buf32(512),ct=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(c,t.lens,0,288,lt,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(u,t.lens,0,32,ct,0,t.work,{bits:5}),ut=!1}t.lencode=lt,t.lenbits=9,t.distcode=ct,t.distbits=5}function ht(t,e,r,i){var o,a=t.state;return null===a.window&&(a.wsize=1<=a.wsize?(n.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),n.arraySet(a.window,e,r-i,o,a.wnext),(i-=o)?(n.arraySet(a.window,e,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,r.check=o(r.check,Pt,2,0),st=0,lt=0,r.mode=x;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&st)<<8)+(st>>8))%31){t.msg="incorrect header check",r.mode=J;break}if((15&st)!==w){t.msg="unknown compression method",r.mode=J;break}if(lt-=4,kt=8+(15&(st>>>=4)),0===r.wbits)r.wbits=kt;else if(kt>r.wbits){t.msg="invalid window size",r.mode=J;break}r.dmax=1<>8&1),512&r.flags&&(Pt[0]=255&st,Pt[1]=st>>>8&255,r.check=o(r.check,Pt,2,0)),st=0,lt=0,r.mode=B;case B:for(;lt<32;){if(0===ot)break t;ot--,st+=tt[rt++]<>>8&255,Pt[2]=st>>>16&255,Pt[3]=st>>>24&255,r.check=o(r.check,Pt,4,0)),st=0,lt=0,r.mode=C;case C:for(;lt<16;){if(0===ot)break t;ot--,st+=tt[rt++]<>8),512&r.flags&&(Pt[0]=255&st,Pt[1]=st>>>8&255,r.check=o(r.check,Pt,2,0)),st=0,lt=0,r.mode=E;case E:if(1024&r.flags){for(;lt<16;){if(0===ot)break t;ot--,st+=tt[rt++]<>>8&255,r.check=o(r.check,Pt,2,0)),st=0,lt=0}else r.head&&(r.head.extra=null);r.mode=P;case P:if(1024&r.flags&&((pt=r.length)>ot&&(pt=ot),pt&&(r.head&&(kt=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,tt,rt,pt,kt)),512&r.flags&&(r.check=o(r.check,tt,pt,rt)),ot-=pt,rt+=pt,r.length-=pt),r.length))break t;r.length=0,r.mode=S;case S:if(2048&r.flags){if(0===ot)break t;pt=0;do{kt=tt[rt+pt++],r.head&&kt&&r.length<65536&&(r.head.name+=String.fromCharCode(kt))}while(kt&&pt>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=I;break;case M:for(;lt<32;){if(0===ot)break t;ot--,st+=tt[rt++]<>>=7<,lt-=7<,r.mode=X;break}for(;lt<3;){if(0===ot)break t;ot--,st+=tt[rt++]<>>=1)){case 0:r.mode=L;break;case 1:if(ft(r),r.mode=z,e===p){st>>>=2,lt-=2;break t}break;case 2:r.mode=D;break;case 3:t.msg="invalid block type",r.mode=J}st>>>=2,lt-=2;break;case L:for(st>>>=7<,lt-=7<lt<32;){if(0===ot)break t;ot--,st+=tt[rt++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=J;break}if(r.length=65535&st,st=0,lt=0,r.mode=O,e===p)break t;case O:r.mode=F;case F:if(pt=r.length){if(pt>ot&&(pt=ot),pt>at&&(pt=at),0===pt)break t;n.arraySet(et,tt,rt,pt,it),ot-=pt,rt+=pt,at-=pt,it+=pt,r.length-=pt;break}r.mode=I;break;case D:for(;lt<14;){if(0===ot)break t;ot--,st+=tt[rt++]<>>=5,lt-=5,r.ndist=1+(31&st),st>>>=5,lt-=5,r.ncode=4+(15&st),st>>>=4,lt-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=J;break}r.have=0,r.mode=N;case N:for(;r.have>>=3,lt-=3}for(;r.have<19;)r.lens[St[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,Bt={bits:r.lenbits},xt=s(l,r.lens,0,19,r.lencode,0,r.work,Bt),r.lenbits=Bt.bits,xt){t.msg="invalid code lengths set",r.mode=J;break}r.have=0,r.mode=U;case U:for(;r.have>>16&255,_t=65535&Et,!((vt=Et>>>24)<=lt);){if(0===ot)break t;ot--,st+=tt[rt++]<>>=vt,lt-=vt,r.lens[r.have++]=_t;else{if(16===_t){for(Ct=vt+2;lt>>=vt,lt-=vt,0===r.have){t.msg="invalid bit length repeat",r.mode=J;break}kt=r.lens[r.have-1],pt=3+(3&st),st>>>=2,lt-=2}else if(17===_t){for(Ct=vt+3;lt>>=vt)),st>>>=3,lt-=3}else{for(Ct=vt+7;lt>>=vt)),st>>>=7,lt-=7}if(r.have+pt>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=J;break}for(;pt--;)r.lens[r.have++]=kt}}if(r.mode===J)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=J;break}if(r.lenbits=9,Bt={bits:r.lenbits},xt=s(c,r.lens,0,r.nlen,r.lencode,0,r.work,Bt),r.lenbits=Bt.bits,xt){t.msg="invalid literal/lengths set",r.mode=J;break}if(r.distbits=6,r.distcode=r.distdyn,Bt={bits:r.distbits},xt=s(u,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,Bt),r.distbits=Bt.bits,xt){t.msg="invalid distances set",r.mode=J;break}if(r.mode=z,e===p)break t;case z:r.mode=q;case q:if(ot>=6&&at>=258){t.next_out=it,t.avail_out=at,t.next_in=rt,t.avail_in=ot,r.hold=st,r.bits=lt,a(t,ut),it=t.next_out,et=t.output,at=t.avail_out,rt=t.next_in,tt=t.input,ot=t.avail_in,st=r.hold,lt=r.bits,r.mode===I&&(r.back=-1);break}for(r.back=0;gt=(Et=r.lencode[st&(1<>>16&255,_t=65535&Et,!((vt=Et>>>24)<=lt);){if(0===ot)break t;ot--,st+=tt[rt++]<>yt)])>>>16&255,_t=65535&Et,!(yt+(vt=Et>>>24)<=lt);){if(0===ot)break t;ot--,st+=tt[rt++]<>>=yt,lt-=yt,r.back+=yt}if(st>>>=vt,lt-=vt,r.back+=vt,r.length=_t,0===gt){r.mode=Z;break}if(32>){r.back=-1,r.mode=I;break}if(64>){t.msg="invalid literal/length code",r.mode=J;break}r.extra=15>,r.mode=V;case V:if(r.extra){for(Ct=r.extra;lt>>=r.extra,lt-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=G;case G:for(;gt=(Et=r.distcode[st&(1<>>16&255,_t=65535&Et,!((vt=Et>>>24)<=lt);){if(0===ot)break t;ot--,st+=tt[rt++]<>yt)])>>>16&255,_t=65535&Et,!(yt+(vt=Et>>>24)<=lt);){if(0===ot)break t;ot--,st+=tt[rt++]<>>=yt,lt-=yt,r.back+=yt}if(st>>>=vt,lt-=vt,r.back+=vt,64>){t.msg="invalid distance code",r.mode=J;break}r.offset=_t,r.extra=15>,r.mode=H;case H:if(r.extra){for(Ct=r.extra;lt>>=r.extra,lt-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=J;break}r.mode=W;case W:if(0===at)break t;if(pt=ut-at,r.offset>pt){if((pt=r.offset-pt)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=J;break}pt>r.wnext?(pt-=r.wnext,dt=r.wsize-pt):dt=r.wnext-pt,pt>r.length&&(pt=r.length),mt=r.window}else mt=et,dt=it-r.offset,pt=r.length;pt>at&&(pt=at),at-=pt,r.length-=pt;do{et[it++]=mt[dt++]}while(--pt);0===r.length&&(r.mode=q);break;case Z:if(0===at)break t;et[it++]=r.length,at--,r.mode=q;break;case X:if(r.wrap){for(;lt<32;){if(0===ot)break t;ot--,st|=tt[rt++]<=1&&0===L[E];E--);if(P>E&&(P=E),0===E)return c[u++]=20971520,c[u++]=20971520,h.bits=1,0;for(C=1;C0&&(0===t||1!==E))return-1;for(O[1]=0,x=1;x<15;x++)O[x+1]=O[x]+L[x];for(B=0;B852||2===t&&M>592)return 1;for(;;){y=x-j,f[B]<_?(b=0,w=f[B]):f[B]>_?(b=F[D+f[B]],w=I[R+f[B]]):(b=96,w=0),p=1<>j)+(d-=p)]=y<<24|b<<16|w|0}while(0!==d);for(p=1<>=1;if(0!==p?(A&=p-1,A+=p):A=0,B++,0==--L[x]){if(x===E)break;x=e[r+f[B]]}if(x>P&&(A&v)!==m){for(0===j&&(j=P),g+=C,T=1<<(S=x-j);S+j852||2===t&&M>592)return 1;c[m=A&v]=P<<24|S<<16|g-u|0}}return 0!==A&&(c[g+A]=x-j<<24|64<<16|0),h.bits=P,0}},{"../utils/common":49}],57:[function(t,e,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],58:[function(t,e,r){"use strict";var n=t("../utils/common"),i=4,o=0,a=1,s=2;function l(t){for(var e=t.length;--e>=0;)t[e]=0}var c=0,u=1,f=2,h=29,p=256,d=p+1+h,m=30,v=19,g=2*d+1,_=15,y=16,b=7,w=256,k=16,x=17,B=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],j=new Array(2*(d+2));l(j);var T=new Array(2*m);l(T);var M=new Array(512);l(M);var A=new Array(256);l(A);var I=new Array(h);l(I);var R,L,O,F=new Array(m);function D(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}function N(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function U(t){return t<256?M[t]:M[256+(t>>>7)]}function z(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function q(t,e,r){t.bi_valid>y-r?(t.bi_buf|=e<>y-t.bi_valid,t.bi_valid+=r-y):(t.bi_buf|=e<>>=1,r<<=1}while(--e>0);return r>>>1}function H(t,e,r){var n,i,o=new Array(_+1),a=0;for(n=1;n<=_;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=G(o[s]++,s))}}function W(t){var e;for(e=0;e8?z(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function X(t,e,r,n){var i=2*e,o=2*r;return t[i]>1;r>=1;r--)Y(t,o,r);i=l;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Y(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=n,o[2*i]=o[2*r]+o[2*n],t.depth[i]=(t.depth[r]>=t.depth[n]?t.depth[r]:t.depth[n])+1,o[2*r+1]=o[2*n+1]=i,t.heap[1]=i++,Y(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,n,i,o,a,s,l=e.dyn_tree,c=e.max_code,u=e.stat_desc.static_tree,f=e.stat_desc.has_stree,h=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,d=e.stat_desc.max_length,m=0;for(o=0;o<=_;o++)t.bl_count[o]=0;for(l[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;rd&&(o=d,m++),l[2*n+1]=o,n>c||(t.bl_count[o]++,a=0,n>=p&&(a=h[n-p]),s=l[2*n],t.opt_len+=s*(o+a),f&&(t.static_len+=s*(u[2*n+1]+a)));if(0!==m){do{for(o=d-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[d]--,m-=2}while(m>0);for(o=d;0!==o;o--)for(n=t.bl_count[o];0!==n;)(i=t.heap[--r])>c||(l[2*i+1]!==o&&(t.opt_len+=(o-l[2*i+1])*l[2*i],l[2*i+1]=o),n--)}}(t,e),H(o,c,t.bl_count)}function K(t,e,r){var n,i,o=-1,a=e[1],s=0,l=7,c=4;for(0===a&&(l=138,c=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=e[2*(n+1)+1],++s>=7;n0?(t.strm.data_type===s&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return o;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return a;for(e=32;e=3&&0===t.bl_tree[2*S[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),l=t.opt_len+3+7>>>3,(c=t.static_len+3+7>>>3)<=l&&(l=c)):l=c=r+5,r+4<=l&&-1!==e?et(t,e,r,n):t.strategy===i||c===l?(q(t,(u<<1)+(n?1:0),3),$(t,j,T)):(q(t,(f<<1)+(n?1:0),3),function(t,e,r,n){var i;for(q(t,e-257,5),q(t,r-1,5),q(t,n-4,4),i=0;i>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(A[r]+p+1)]++,t.dyn_dtree[2*U(e)]++),t.last_lit===t.lit_bufsize-1},r._tr_align=function(t){q(t,u<<1,3),V(t,w,j),function(t){16===t.bi_valid?(z(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":49}],59:[function(t,e,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],60:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,o=p&(1<<-u)-1,p>>=-u,u+=s;u>0;o=256*o+t[e+f],f+=h,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=n;u>0;a=256*a+t[e+f],f+=h,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,l,c=8*o-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(a++,l/=2),a+f>=u?(s=0,a=u):a+f>=1?(s=(e*l-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=d,a/=256,c-=8);t[r+p-d]|=128*m}},{}],61:[function(t,e,r){e.exports=[function(t,e){return{options:t,draw:function(e,r,n){n.stop(!0),n.overrideFlag=!0;var i=this;return e.pixelManipulation({output:function(t,e,r){i.output={src:e,format:r}},changePixel:function(t,e,r,n){return[255-t,255-e,255-r,n]},format:e.format,image:t.image,inBrowser:t.inBrowser,callback:r})},output:void 0,UI:e}},{name:"Invert",description:"Inverts the image.",inputs:{}}]},{}],62:[function(t,e,r){"use strict";var n=t("underscore"),i=e.exports={Bitmap:t("./lib/bitmap")};n.extend(i,t("./lib/enums"))},{"./lib/bitmap":63,"./lib/enums":64,underscore:145}],63:[function(t,e,r){(function(r){"use strict";var n=t("fs"),i=(t("underscore"),t("bluebird")),o=t("jpeg-js"),a=t("node-png").PNG,s=t("./enums"),l=t("./utils"),c=t("./resize"),u={r:0,g:0,b:0,a:0},f=e.exports=function(t){t&&(t instanceof f?this._data={data:new r(t.data.data),width:t.width,height:t.height}:t.data?this._data=t:t.width&&t.height&&(this._data={data:new r(4*t.width*t.height),width:t.width,height:t.height},t.color&&this._fill(t.color)))};f.prototype={get width(){return this._data.width},get height(){return this._data.height},attach:function(t){var e=this._data;return this._data=t,e},detach:function(){var t=this._data;return delete this._data,t},_deduceFileType:function(t){if(!t)throw new Error("Can't determine image type");switch(t.substr(-4).toLowerCase()){case".jpg":return s.ImageType.JPG;case".png":return s.ImageType.PNG}if(".jpeg"==t.substr(-5).toLowerCase())return s.ImageType.JPG;throw new Error("Can't recognise image type: "+t)},_readStream:function(t){var e=i.defer(),n=[];return t.on("data",function(t){n.push(t)}),t.on("end",function(){var t=r.concat(n);e.resolve(t)}),t.on("error",function(t){e.reject(t)}),e.promise},_readPNG:function(t){var e=i.defer(),r=new a({filterType:4});return r.on("parsed",function(){e.resolve(r)}),r.on("error",function(t){e.rejecyt(t)}),t.pipe(r),e.promise},_parseOptions:function(t,e){return"number"==typeof(t=t||{})&&(t={type:t}),t.type=t.type||this._deduceFileType(e),t},read:function(t,e){var r=this;switch((e=this._parseOptions(e)).type){case s.ImageType.JPG:return this._readStream(t).then(function(t){r._data=o.decode(t)});case s.ImageType.PNG:return this._readPNG(t).then(function(t){r._data={data:t.data,width:t.width,height:t.height}});default:return i.reject(new Error("Not supported: ImageType "+e.type))}},readFile:function(t,e){var r=this;return l.fs.exists(t).then(function(i){if(i){e=r._parseOptions(e,t);var o=n.createReadStream(t);return r.read(o,e)}throw new Error("File Not Found: "+t)})},write:function(t,e){e=this._parseOptions(e);var r=i.defer();try{switch(t.on("finish",function(){r.resolve()}),t.on("error",function(t){r.reject(t)}),e.type){case s.ImageType.JPG:var n=o.encode(this._data,e.quality||90).data;t.write(n),t.end();break;case s.ImageType.PNG:var l=new a;l.width=this.width,l.height=this.height,l.data=this._data.data,l.on("end",function(){r.resolve()}),l.on("error",function(t){r.reject(t)}),l.pack().pipe(t);break;default:throw new Error("Not supported: ImageType "+e.type)}}catch(t){r.reject(t)}return r.promise},writeFile:function(t,e){e=this._parseOptions(e,t);var r=n.createWriteStream(t);return this.write(r,e)},clone:function(){return new f({width:this.width,height:this.height,data:new r(this._data.data)})},setPixel:function(t,e,r,n,i,o){if(void 0===n){var a=r;r=a.r,n=a.g,i=a.b,o=a.a}void 0===o&&(o=255);var s=4*(e*this.width+t),l=this._data.data;l[s++]=r,l[s++]=n,l[s++]=i,l[s++]=o},getPixel:function(t,e,r){var n=4*(e*this.width+t);r=r||{};var i=this._data.data;return r.r=i[n++],r.g=i[n++],r.b=i[n++],r.a=i[n++],r},negative:function(){for(var t=new f({width:this.width,height:this.height}),e=this.width*this.height,r=this._data.data,n=t._data.data,i=0,o=0,a=0;a-1&&j-1&&T=0&&T>=0?w[O]:F)+D*(v=j=0?w[O+4]:F),z=(1-D)*(g=j>=0&&T0?a:0)-(u>0?4:0)]+2*s[p-(c>0?a:0)]+1*s[p-(c>0?a:0)+(u0?4:0)]+4*s[p]+2*s[p+(u0?4:0)]+2*s[p+(c0?o[k-4]:2*o[k]-o[k+4],B=o[k],C=o[k+4],E=z0?m[k-4*h]:2*m[k]-m[k+4*h],T=m[k],M=m[k+4*h],A=N1)for(v=0;v0&&!t[a-1];)a--;o.push({children:[],index:0});var s,l=o[0];for(r=0;r0;)l=o.pop();for(l.index++,o.push(l);o.length<=r;)o.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s;i++}r+10)return p>>--d&1;if(255==(p=e[r++])){var t=e[r++];if(t)throw"unexpected marker: "+(p<<8|t).toString(16)}return d=7,p>>>7}function v(t){for(var e,r=t;null!==(e=m());){if("number"==typeof(r=r[e]))return r;if("object"!=typeof r)throw"invalid huffman sequence"}return null}function g(t){for(var e=0;t>0;){var r=m();if(null===r)return;e=e<<1|r,t--}return e}function _(t){var e=g(t);return e>=1<0)y--;else for(var n=a,i=s;n<=i;){var o=v(e.huffmanTableAC),l=15&o,u=o>>4;if(0!==l)r[t[n+=u]]=_(l)*(1<>4,0===f)o<15?(y=g(o)+(1<>4;if(0!==s)r[t[o+=l]]=_(s),o++;else{if(l<15)break;o+=16}}};var M,A,I,R,L=0;for(A=1==T?i[0].blocksPerLine*i[0].blocksPerColumn:u*n.mcusPerColumn,o||(o=A);L=65488&&M<=65495))break;r+=2}return r-h}function h(t,c){var u,f,h=[],p=c.blocksPerLine,d=c.blocksPerColumn,m=p<<3,v=new Int32Array(64),g=new Uint8Array(64);function _(t,u,f){var h,p,d,m,v,g,_,y,b,w,k=c.quantizationTable,x=f;for(w=0;w<64;w++)x[w]=t[w]*k[w];for(w=0;w<8;++w){var B=8*w;0!=x[1+B]||0!=x[2+B]||0!=x[3+B]||0!=x[4+B]||0!=x[5+B]||0!=x[6+B]||0!=x[7+B]?(h=s*x[0+B]+128>>8,p=s*x[4+B]+128>>8,d=x[2+B],m=x[6+B],v=l*(x[1+B]-x[7+B])+128>>8,y=l*(x[1+B]+x[7+B])+128>>8,g=x[3+B]<<4,_=x[5+B]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*a+m*o+128>>8,d=d*o-m*a+128>>8,m=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=y+g+1>>1,g=y-g+1>>1,y=b,b=h-m+1>>1,h=h+m+1>>1,m=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+y*n+2048>>12,v=v*n-y*i+2048>>12,y=b,b=g*r+_*e+2048>>12,g=g*e-_*r+2048>>12,_=b,x[0+B]=h+y,x[7+B]=h-y,x[1+B]=p+_,x[6+B]=p-_,x[2+B]=d+g,x[5+B]=d-g,x[3+B]=m+v,x[4+B]=m-v):(b=s*x[0+B]+512>>10,x[0+B]=b,x[1+B]=b,x[2+B]=b,x[3+B]=b,x[4+B]=b,x[5+B]=b,x[6+B]=b,x[7+B]=b)}for(w=0;w<8;++w){var C=w;0!=x[8+C]||0!=x[16+C]||0!=x[24+C]||0!=x[32+C]||0!=x[40+C]||0!=x[48+C]||0!=x[56+C]?(h=s*x[0+C]+2048>>12,p=s*x[32+C]+2048>>12,d=x[16+C],m=x[48+C],v=l*(x[8+C]-x[56+C])+2048>>12,y=l*(x[8+C]+x[56+C])+2048>>12,g=x[24+C],_=x[40+C],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*a+m*o+2048>>12,d=d*o-m*a+2048>>12,m=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=y+g+1>>1,g=y-g+1>>1,y=b,b=h-m+1>>1,h=h+m+1>>1,m=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+y*n+2048>>12,v=v*n-y*i+2048>>12,y=b,b=g*r+_*e+2048>>12,g=g*e-_*r+2048>>12,_=b,x[0+C]=h+y,x[56+C]=h-y,x[8+C]=p+_,x[48+C]=p-_,x[16+C]=d+g,x[40+C]=d-g,x[24+C]=m+v,x[32+C]=m-v):(b=s*f[w+0]+8192>>14,x[0+C]=b,x[8+C]=b,x[16+C]=b,x[24+C]=b,x[32+C]=b,x[40+C]=b,x[48+C]=b,x[56+C]=b)}for(w=0;w<64;++w){var E=128+(x[w]+8>>4);u[w]=E<0?0:E>255?255:E}}for(var y=0;y255?255:t}return c.prototype={load:function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){var t=new Uint8Array(e.response||e.mozResponseArrayBuffer);this.parse(t),this.onload&&this.onload()}.bind(this),e.send(null)},parse:function(e){var r=0;e.length;function n(){var t=e[r]<<8|e[r+1];return r+=2,t}function i(){var t=n(),i=e.subarray(r,r+t-2);return r+=i.length,i}function o(t){var e,r,n=0,i=0;for(r in t.components)t.components.hasOwnProperty(r)&&(n<(e=t.components[r]).h&&(n=e.h),i>4==0)for(z=0;z<64;z++){w[t[z]]=e[r++]}else{if(b>>4!=1)throw"DQT: invalid table spec";for(z=0;z<64;z++){w[t[z]]=n()}}p[15&b]=w}break;case 65472:case 65473:case 65474:n(),(a={}).extended=65473===g,a.progressive=65474===g,a.precision=e[r++],a.scanLines=n(),a.samplesPerLine=n(),a.components={},a.componentsOrder=[];var k,x=e[r++];for(N=0;N>4,C=15&e[r+1],E=e[r+2];a.componentsOrder.push(k),a.components[k]={h:B,v:C,quantizationIdx:E},r+=3}o(a),d.push(a);break;case 65476:var P=n();for(N=2;N>4==0?v:m)[15&S]=u(j,M)}break;case 65501:n(),s=n();break;case 65498:n();var A=e[r++],I=[];for(N=0;N>4],q.huffmanTableAC=m[15&R],I.push(q)}var L=e[r++],O=e[r++],F=e[r++],D=f(e,r,a,I,s,L,O,F>>4,15&F);r+=D;break;default:if(255==e[r-3]&&e[r-2]>=192&&e[r-2]<=254){r-=3;break}throw"unknown JPEG marker "+g.toString(16)}g=n()}if(1!=d.length)throw"only single frame JPEGs supported";for(var N=0;N=0;)e&1<>8&255),L(255&t)}function F(t,e,r,n,i){var o,a=i[0],s=i[240];for(var l=function(t,e){var r,n,i,o,a,s,l,c,u,f,h=0;for(u=0;u<8;++u){r=t[h],n=t[h+1],i=t[h+2],o=t[h+3],a=t[h+4],s=t[h+5],l=t[h+6];var p=r+(c=t[h+7]),m=r-c,v=n+l,g=n-l,_=i+s,y=i-s,b=o+a,w=o-a,k=p+b,x=p-b,B=v+_,C=v-_;t[h]=k+B,t[h+4]=k-B;var E=.707106781*(C+x);t[h+2]=x+E,t[h+6]=x-E;var P=.382683433*((k=w+y)-(C=g+m)),S=.5411961*k+P,j=1.306562965*C+P,T=.707106781*(B=y+g),M=m+T,A=m-T;t[h+5]=A+S,t[h+3]=A-S,t[h+1]=M+j,t[h+7]=M-j,h+=8}for(h=0,u=0;u<8;++u){r=t[h],n=t[h+8],i=t[h+16],o=t[h+24],a=t[h+32],s=t[h+40],l=t[h+48];var I=r+(c=t[h+56]),R=r-c,L=n+l,O=n-l,F=i+s,D=i-s,N=o+a,U=o-a,z=I+N,q=I-N,V=L+F,G=L-F;t[h]=z+V,t[h+32]=z-V;var H=.707106781*(G+q);t[h+16]=q+H,t[h+48]=q-H;var W=.382683433*((z=U+D)-(G=O+R)),Z=.5411961*z+W,X=1.306562965*G+W,Y=.707106781*(V=D+O),$=R+Y,J=R-Y;t[h+40]=J+Z,t[h+24]=J-Z,t[h+8]=$+X,t[h+56]=$-X,h++}for(u=0;u<64;++u)f=t[u]*e[u],d[u]=f>0?f+.5|0:f-.5|0;return d}(t,e),c=0;c<64;++c)m[B[c]]=l[c];var u=m[0]-r;r=m[0],0==u?R(n[0]):(R(n[p[o=32767+u]]),R(h[o]));for(var f=63;f>0&&0==m[f];f--);if(0==f)return R(a),r;for(var v,g=1;g<=f;){for(var _=g;0==m[g]&&g<=f;++g);var y=g-_;if(y>=16){v=y>>4;for(var b=1;b<=v;++b)R(s);y&=15}o=32767+m[g],R(i[(y<<4)+p[o]]),R(h[o]),g++}return 63!=f&&R(a),r}function D(t){if(t<=0&&(t=1),t>100&&(t=100),a!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],r=0;r<64;r++){var n=s((e[r]*t+50)/100);n<1?n=1:n>255&&(n=255),l[B[r]]=n}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=s((i[o]*t+50)/100);a<1?a=1:a>255&&(a=255),c[B[o]]=a}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,d=0;d<8;d++)for(var m=0;m<8;m++)u[p]=1/(l[B[p]]*h[d]*h[m]*8),f[p]=1/(c[B[p]]*h[d]*h[m]*8),p++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),a=t}}this.encode=function(e,a){(new Date).getTime();a&&D(a),v=new Array,g=0,_=7,O(65496),O(65504),O(16),L(74),L(70),L(73),L(70),L(0),L(1),L(1),L(0),O(1),O(1),L(0),L(0),function(){O(65499),O(132),L(0);for(var t=0;t<64;t++)L(l[t]);L(1);for(var e=0;e<64;e++)L(c[e])}(),function(t,e){O(65472),O(17),L(8),O(e),O(t),L(3),L(1),L(17),L(0),L(2),L(17),L(1),L(3),L(17),L(1)}(e.width,e.height),function(){O(65476),O(418),L(0);for(var t=0;t<16;t++)L(C[t+1]);for(var e=0;e<=11;e++)L(E[e]);L(16);for(var r=0;r<16;r++)L(P[r+1]);for(var n=0;n<=161;n++)L(S[n]);L(1);for(var i=0;i<16;i++)L(j[i+1]);for(var o=0;o<=11;o++)L(T[o]);L(17);for(var a=0;a<16;a++)L(M[a+1]);for(var s=0;s<=161;s++)L(A[s])}(),O(65498),O(12),L(3),L(1),L(0),L(2),L(17),L(3),L(17),L(0),L(63),L(0);var s=0,h=0,p=0;g=0,_=7,this.encode.displayName="_encode_";for(var d,m,k,B,I,N,U,z,q,V=e.data,G=e.width,H=e.height,W=4*G,Z=0;Z>3)*W+(U=4*(7&q)),Z+z>=H&&(N-=W*(Z+1+z-H)),d+U>=W&&(N-=d+U-W+4),m=V[N++],k=V[N++],B=V[N++],y[q]=(x[m]+x[k+256>>0]+x[B+512>>0]>>16)-128,b[q]=(x[m+768>>0]+x[k+1024>>0]+x[B+1280>>0]>>16)-128,w[q]=(x[m+1280>>0]+x[k+1536>>0]+x[B+1792>>0]>>16)-128;s=F(y,u,s,r,i),h=F(b,f,h,n,o),p=F(w,f,p,n,o),d+=32}Z+=8}if(_>=0){var X=[];X[1]=_+1,X[0]=(1<<_+1)-1,R(X)}return O(65497),new t(v)},function(){(new Date).getTime();e||(e=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)k[e]=t(e)}(),r=I(C,E),n=I(j,T),i=I(P,S),o=I(M,A),function(){for(var t=1,e=2,r=1;r<=15;r++){for(var n=t;n>0]=38470*t,x[t+512>>0]=7471*t+32768,x[t+768>>0]=-11059*t,x[t+1024>>0]=-21709*t,x[t+1280>>0]=32768*t+8421375,x[t+1536>>0]=-27439*t,x[t+1792>>0]=-5329*t}(),D(e),(new Date).getTime()}()}e.exports=function(t,e){void 0===e&&(e=50);return{data:new r(e).encode(t,e),width:t.width,height:t.height}}}).call(this,t("buffer").Buffer)},{buffer:47}],70:[function(t,e,r){arguments[4][41][0].apply(r,arguments)},{dup:41}],71:[function(t,e,r){"use strict";e.exports=function(t){for(var e=new Array(t),r=0;r=this.width||e<0||e>=this.height)&&!!this.data[e*this.width+t]},t.prototype.set=function(t,e,r){this.data[e*this.width+t]=r?1:0},t.prototype.setRegion=function(t,e,r,n,i){for(var o=e;o=this.size&&(i=(i^this.primitive)&this.size-1);for(o=0;o1&&0===e[0]){for(var n=1;ni.length&&(r=(o=[i,r])[0],i=o[1]);for(var o,a=new Uint8ClampedArray(i.length),s=i.length-r.length,l=0;lr?r:t}var s=function(){function t(t,e){this.width=t,this.data=new Uint8ClampedArray(t*e)}return t.prototype.get=function(t,e){return this.data[e*this.width+t]},t.prototype.set=function(t,e,r){this.data[e*this.width+t]=r},t}();e.binarize=function(t,e,r){if(t.length!==e*r*4)throw new Error("Malformed data passed to binarizer.");for(var l=new s(e,r),c=0;c0&&_>0)){var B=(v.get(_,g-1)+2*v.get(_-1,g)+v.get(_-1,g-1))/4;b6&&(r.setRegion(e-11,0,3,6,!0),r.setRegion(0,e-11,6,3,!0)),r}(e),s=[],c=0,f=0,h=!0,p=o-1;p>0;p-=2){6===p&&p--;for(var d=0;d=0;i--)for(var o=e-9;o>=e-11;o--)n=l(t.get(o,i),n);var c=0;for(o=5;o>=0;o--)for(i=e-9;i>=e-11;i--)c=l(t.get(o,i),c);for(var u,f=1/0,h=0,p=a.VERSIONS;h=0;n--)6!==n&&(e=l(t.get(8,n),e));var i=t.height,o=0;for(n=i-1;n>=i-7;n--)o=l(t.get(8,n),o);for(r=i-8;r1){var u=n.ecBlocks[0].numBlocks,f=n.ecBlocks[1].numBlocks;for(s=0;s0;)for(var h=0,p=i;h=3;){if((c=t.readBits(10))>=1e3)throw new Error("Invalid numeric value above 999");var a=Math.floor(c/100),s=Math.floor(c/10)%10,l=c%10;r.push(48+a,48+s,48+l),n+=a.toString()+s.toString()+l.toString(),o-=3}if(2===o){if((c=t.readBits(7))>=100)throw new Error("Invalid numeric value above 99");a=Math.floor(c/10),s=c%10;r.push(48+a,48+s),n+=a.toString()+s.toString()}else if(1===o){var c;if((c=t.readBits(4))>=10)throw new Error("Invalid numeric value above 9");r.push(48+c),n+=c.toString()}return{bytes:r,text:n}}!function(t){t.Numeric="numeric",t.Alphanumeric="alphanumeric",t.Byte="byte",t.Kanji="kanji",t.ECI="eci"}(n=e.Mode||(e.Mode={})),function(t){t[t.Terminator=0]="Terminator",t[t.Numeric=1]="Numeric",t[t.Alphanumeric=2]="Alphanumeric",t[t.Byte=4]="Byte",t[t.Kanji=8]="Kanji",t[t.ECI=7]="ECI"}(i||(i={}));var l=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function c(t,e){for(var r=[],n="",i=[9,11,13][e],o=t.readBits(i);o>=2;){var a=t.readBits(11),s=Math.floor(a/45),c=a%45;r.push(l[s].charCodeAt(0),l[c].charCodeAt(0)),n+=l[s]+l[c],o-=2}if(1===o){s=t.readBits(6);r.push(l[s].charCodeAt(0)),n+=l[s]}return{bytes:r,text:n}}function u(t,e){for(var r=[],n="",i=[8,16,16][e],o=t.readBits(i),a=0;a>8,255&c),n+=String.fromCharCode(a.shiftJISTable[c])}return{bytes:r,text:n}}e.decode=function(t,e){for(var r,a,l,h,p=new o.BitStream(t),d=e<=9?0:e<=26?1:2,m={text:"",bytes:[],chunks:[]};p.available()>=4;){var v=p.readBits(4);if(v===i.Terminator)return m;if(v===i.ECI)0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(7)}):0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(14)}):0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(21)}):m.chunks.push({type:n.ECI,assignmentNumber:-1});else if(v===i.Numeric){var g=s(p,d);m.text+=g.text,(r=m.bytes).push.apply(r,g.bytes),m.chunks.push({type:n.Numeric,text:g.text})}else if(v===i.Alphanumeric){var _=c(p,d);m.text+=_.text,(a=m.bytes).push.apply(a,_.bytes),m.chunks.push({type:n.Alphanumeric,text:_.text})}else if(v===i.Byte){var y=u(p,d);m.text+=y.text,(l=m.bytes).push.apply(l,y.bytes),m.chunks.push({type:n.Byte,bytes:y.bytes,text:y.text})}else if(v===i.Kanji){var b=f(p,d);m.text+=b.text,(h=m.bytes).push.apply(h,b.bytes),m.chunks.push({type:n.Kanji,bytes:b.bytes,text:b.text})}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.byteOffset=0,this.bitOffset=0,this.bytes=t}return t.prototype.readBits=function(t){if(t<1||t>32||t>this.available())throw new Error("Cannot read "+t.toString()+" bits");var e=0;if(this.bitOffset>0){var r=8-this.bitOffset,n=t>8-n<<(o=r-n);e=(this.bytes[this.byteOffset]&i)>>o,t-=n,this.bitOffset+=n,8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(t>0){for(;t>=8;)e=e<<8|255&this.bytes[this.byteOffset],this.byteOffset++,t-=8;if(t>0){var o;i=255>>(o=8-t)<>o,this.bitOffset+=t}}return e},t.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},t}();e.BitStream=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.shiftJISTable={32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:165,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:8254,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:92,33120:12316,33121:8214,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:8722,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:162,33170:163,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:172,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35000:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36000:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37000:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38000:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39000:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,40000:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58000:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59000:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,60000:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(1),i=r(2);e.decode=function(t,e){var r=new Uint8ClampedArray(t.length);r.set(t);for(var o=new n.default(285,256,0),a=new i.default(o,r),s=new Uint8ClampedArray(e),l=!1,c=0;c=n/2;){var l=i,c=a;if(a=s,(i=o).isZero())return null;o=l;for(var u=t.zero,f=i.getCoefficient(i.degree()),h=t.inverse(f);o.degree()>=i.degree()&&!o.isZero();){var p=o.degree()-i.degree(),d=t.multiply(o.getCoefficient(o.degree()),h);u=u.addOrSubtract(t.buildMonomial(p,d)),o=o.addOrSubtract(i.multiplyByMonomial(p,d))}if(s=u.multiplyPoly(a).addOrSubtract(c),o.degree()>=i.degree())return null}var m=s.getCoefficient(0);if(0===m)return null;var v,g=t.inverse(m);return[s.multiply(g),o.multiply(g)]}(o,o.buildMonomial(e,1),f,e);if(null===h)return null;var p=function(t,e){var r=e.degree();if(1===r)return[e.getCoefficient(1)];for(var n=new Array(r),i=0,o=1;oMath.abs(e.x-t.x);u?(i=Math.floor(t.y),o=Math.floor(t.x),s=Math.floor(e.y),l=Math.floor(e.x)):(i=Math.floor(t.x),o=Math.floor(t.y),s=Math.floor(e.x),l=Math.floor(e.y));for(var f=Math.abs(s-i),h=Math.abs(l-o),p=Math.floor(-f/2),d=i0){if(_===l)break;_+=m,p-=f}}for(var w=[],k=0;k=t.bottom.startX&&g<=t.bottom.endX||v>=t.bottom.startX&&g<=t.bottom.endX||g<=t.bottom.startX&&v>=t.bottom.endX&&f[2]/(t.bottom.endX-t.bottom.startX)i})).length>0?y[0].bottom=_:r.push({top:_,bottom:_})}if(m){var y,b=e-f[4],w=b-f[3];_={startX:w,y:n,endX:b},(y=u.filter(function(t){return w>=t.bottom.startX&&w<=t.bottom.endX||b>=t.bottom.startX&&w<=t.bottom.endX||w<=t.bottom.startX&&b>=t.bottom.endX&&f[2]/(t.bottom.endX-t.bottom.startX)i})).length>0?y[0].bottom=_:u.push({top:_,bottom:_})}}},p=-1;p<=t.width;p++)h(p);e.push.apply(e,r.filter(function(t){return t.bottom.y!==n&&t.bottom.y-t.top.y>=2})),r=r.filter(function(t){return t.bottom.y===n}),l.push.apply(l,u.filter(function(t){return t.bottom.y!==n})),u=u.filter(function(t){return t.bottom.y===n})},p=0;p<=t.height;p++)h(p);e.push.apply(e,r.filter(function(t){return t.bottom.y-t.top.y>=2})),l.push.apply(l,u);var d=e.filter(function(t){return t.bottom.y-t.top.y>=2}).map(function(e){var r=(e.top.startX+e.top.endX+e.bottom.startX+e.bottom.endX)/4,n=(e.top.y+e.bottom.y+1)/2;if(t.get(Math.round(r),Math.round(n))){var i=[e.top.endX-e.top.startX,e.bottom.endX-e.bottom.startX,e.bottom.y-e.top.y+1],o=s(i)/i.length;return{score:f({x:Math.round(r),y:Math.round(n)},[1,1,3,1,1],t),x:r,y:n,size:o}}}).filter(function(t){return!!t}).sort(function(t,e){return t.score-e.score}).map(function(t,e,r){if(e>n)return null;var i=r.filter(function(t,r){return e!==r}).map(function(e){return{x:e.x,y:e.y,score:e.score+Math.pow(e.size-t.size,2)/t.size,size:e.size}}).sort(function(t,e){return t.score-e.score});if(i.length<2)return null;var o=t.score+i[0].score+i[1].score;return{points:[t].concat(i.slice(0,2)),score:o}}).filter(function(t){return!!t}).sort(function(t,e){return t.score-e.score});if(0===d.length)return null;var m,v,g=function(t,e,r){var n,i,o,s,l,c,u,f=a(t,e),h=a(e,r),p=a(t,r);return h>=f&&h>=p?(n=(s=[e,t,r])[0],i=s[1],o=s[2]):p>=h&&p>=f?(n=(l=[t,e,r])[0],i=l[1],o=l[2]):(n=(c=[t,r,e])[0],i=c[1],o=c[2]),(o.x-i.x)*(n.y-i.y)-(o.y-i.y)*(n.x-i.x)<0&&(n=(u=[o,n])[0],o=u[1]),{bottomLeft:n,topLeft:i,topRight:o}}(d[0].points[0],d[0].points[1],d[0].points[2]),_=g.topRight,y=g.topLeft,b=g.bottomLeft;try{w=function(t,e,r,n){var i=(s(c(t,r,n,5))/7+s(c(t,e,n,5))/7+s(c(r,t,n,5))/7+s(c(e,t,n,5))/7)/4;if(i<1)throw new Error("Invalid module size");var o=Math.round(a(t,e)/i),l=Math.round(a(t,r)/i),u=Math.floor((o+l)/2)+7;switch(u%4){case 0:u++;break;case 2:u--}return{dimension:u,moduleSize:i}}(y,_,b,t),m=w.dimension,v=w.moduleSize}catch(t){return null}var w,k=_.x-y.x+b.x,x=_.y-y.y+b.y,B=(a(y,b)+a(y,_))/2/v,C=1-3/B,E={x:y.x+C*(k-y.x),y:y.y+C*(x-y.y)},P=l.map(function(e){var r=(e.top.startX+e.top.endX+e.bottom.startX+e.bottom.endX)/4,n=(e.top.y+e.bottom.y+1)/2;if(t.get(Math.floor(r),Math.floor(n))){var i=[e.top.endX-e.top.startX,e.bottom.endX-e.bottom.startX,e.bottom.y-e.top.y+1];return s(i),{x:r,y:n,score:f({x:Math.floor(r),y:Math.floor(n)},[1,1,1],t)+a({x:r,y:n},E)}}}).filter(function(t){return!!t}).sort(function(t,e){return t.score-e.score}),S=B>=15&&P.length?P[0]:E;return{alignmentPattern:{x:S.x,y:S.y},bottomLeft:{x:b.x,y:b.y},dimension:m,topLeft:{x:y.x,y:y.y},topRight:{x:_.x,y:_.y}}}}]).default},"object"==typeof r&&"object"==typeof e?e.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof r?r.jsQR=i():n.jsQR=i()},{}],75:[function(t,e,r){(function(t){(function(){var n,i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",s="__lodash_hash_undefined__",l=500,c="__lodash_placeholder__",u=1,f=2,h=4,p=1,d=2,m=1,v=2,g=4,_=8,y=16,b=32,w=64,k=128,x=256,B=512,C=30,E="...",P=800,S=16,j=1,T=2,M=1/0,A=9007199254740991,I=1.7976931348623157e308,R=NaN,L=4294967295,O=L-1,F=L>>>1,D=[["ary",k],["bind",m],["bindKey",v],["curry",_],["curryRight",y],["flip",B],["partial",b],["partialRight",w],["rearg",x]],N="[object Arguments]",U="[object Array]",z="[object AsyncFunction]",q="[object Boolean]",V="[object Date]",G="[object DOMException]",H="[object Error]",W="[object Function]",Z="[object GeneratorFunction]",X="[object Map]",Y="[object Number]",$="[object Null]",J="[object Object]",K="[object Proxy]",Q="[object RegExp]",tt="[object Set]",et="[object String]",rt="[object Symbol]",nt="[object Undefined]",it="[object WeakMap]",ot="[object WeakSet]",at="[object ArrayBuffer]",st="[object DataView]",lt="[object Float32Array]",ct="[object Float64Array]",ut="[object Int8Array]",ft="[object Int16Array]",ht="[object Int32Array]",pt="[object Uint8Array]",dt="[object Uint8ClampedArray]",mt="[object Uint16Array]",vt="[object Uint32Array]",gt=/\b__p \+= '';/g,_t=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bt=/&(?:amp|lt|gt|quot|#39);/g,wt=/[&<>"']/g,kt=RegExp(bt.source),xt=RegExp(wt.source),Bt=/<%-([\s\S]+?)%>/g,Ct=/<%([\s\S]+?)%>/g,Et=/<%=([\s\S]+?)%>/g,Pt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,St=/^\w*$/,jt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tt=/[\\^$.*+?()[\]{}|]/g,Mt=RegExp(Tt.source),At=/^\s+|\s+$/g,It=/^\s+/,Rt=/\s+$/,Lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ot=/\{\n\/\* \[wrapped with (.+)\] \*/,Ft=/,? & /,Dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Nt=/\\(\\)?/g,Ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,zt=/\w*$/,qt=/^[-+]0x[0-9a-f]+$/i,Vt=/^0b[01]+$/i,Gt=/^\[object .+?Constructor\]$/,Ht=/^0o[0-7]+$/i,Wt=/^(?:0|[1-9]\d*)$/,Zt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xt=/($^)/,Yt=/['\n\r\u2028\u2029\\]/g,$t="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Jt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",Kt="[\\ud800-\\udfff]",Qt="["+Jt+"]",te="["+$t+"]",ee="\\d+",re="[\\u2700-\\u27bf]",ne="[a-z\\xdf-\\xf6\\xf8-\\xff]",ie="[^\\ud800-\\udfff"+Jt+ee+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",oe="\\ud83c[\\udffb-\\udfff]",ae="[^\\ud800-\\udfff]",se="(?:\\ud83c[\\udde6-\\uddff]){2}",le="[\\ud800-\\udbff][\\udc00-\\udfff]",ce="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ue="(?:"+ne+"|"+ie+")",fe="(?:"+ce+"|"+ie+")",he="(?:"+te+"|"+oe+")"+"?",pe="[\\ufe0e\\ufe0f]?"+he+("(?:\\u200d(?:"+[ae,se,le].join("|")+")[\\ufe0e\\ufe0f]?"+he+")*"),de="(?:"+[re,se,le].join("|")+")"+pe,me="(?:"+[ae+te+"?",te,se,le,Kt].join("|")+")",ve=RegExp("['’]","g"),ge=RegExp(te,"g"),_e=RegExp(oe+"(?="+oe+")|"+me+pe,"g"),ye=RegExp([ce+"?"+ne+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Qt,ce,"$"].join("|")+")",fe+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Qt,ce+ue,"$"].join("|")+")",ce+"?"+ue+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ee,de].join("|"),"g"),be=RegExp("[\\u200d\\ud800-\\udfff"+$t+"\\ufe0e\\ufe0f]"),we=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ke=["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"],xe=-1,Be={};Be[lt]=Be[ct]=Be[ut]=Be[ft]=Be[ht]=Be[pt]=Be[dt]=Be[mt]=Be[vt]=!0,Be[N]=Be[U]=Be[at]=Be[q]=Be[st]=Be[V]=Be[H]=Be[W]=Be[X]=Be[Y]=Be[J]=Be[Q]=Be[tt]=Be[et]=Be[it]=!1;var Ce={};Ce[N]=Ce[U]=Ce[at]=Ce[st]=Ce[q]=Ce[V]=Ce[lt]=Ce[ct]=Ce[ut]=Ce[ft]=Ce[ht]=Ce[X]=Ce[Y]=Ce[J]=Ce[Q]=Ce[tt]=Ce[et]=Ce[rt]=Ce[pt]=Ce[dt]=Ce[mt]=Ce[vt]=!0,Ce[H]=Ce[W]=Ce[it]=!1;var Ee={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pe=parseFloat,Se=parseInt,je="object"==typeof t&&t&&t.Object===Object&&t,Te="object"==typeof self&&self&&self.Object===Object&&self,Me=je||Te||Function("return this")(),Ae="object"==typeof r&&r&&!r.nodeType&&r,Ie=Ae&&"object"==typeof e&&e&&!e.nodeType&&e,Re=Ie&&Ie.exports===Ae,Le=Re&&je.process,Oe=function(){try{var t=Ie&&Ie.require&&Ie.require("util").types;return t||Le&&Le.binding&&Le.binding("util")}catch(t){}}(),Fe=Oe&&Oe.isArrayBuffer,De=Oe&&Oe.isDate,Ne=Oe&&Oe.isMap,Ue=Oe&&Oe.isRegExp,ze=Oe&&Oe.isSet,qe=Oe&&Oe.isTypedArray;function Ve(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Ge(t,e,r,n){for(var i=-1,o=null==t?0:t.length;++i-1}function $e(t,e,r){for(var n=-1,i=null==t?0:t.length;++n-1;);return r}function _r(t,e){for(var r=t.length;r--&&or(e,t[r],0)>-1;);return r}var yr=ur({"À":"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"}),br=ur({"&":"&","<":"<",">":">",'"':""","'":"'"});function wr(t){return"\\"+Ee[t]}function kr(t){return be.test(t)}function xr(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function Br(t,e){return function(r){return t(e(r))}}function Cr(t,e){for(var r=-1,n=t.length,i=0,o=[];++r",""":'"',"'":"'"});var Mr=function t(e){var r,$t=(e=null==e?Me:Mr.defaults(Me.Object(),e,Mr.pick(Me,ke))).Array,Jt=e.Date,Kt=e.Error,Qt=e.Function,te=e.Math,ee=e.Object,re=e.RegExp,ne=e.String,ie=e.TypeError,oe=$t.prototype,ae=Qt.prototype,se=ee.prototype,le=e["__core-js_shared__"],ce=ae.toString,ue=se.hasOwnProperty,fe=0,he=(r=/[^.]+$/.exec(le&&le.keys&&le.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",pe=se.toString,de=ce.call(ee),me=Me._,_e=re("^"+ce.call(ue).replace(Tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),be=Re?e.Buffer:n,Ee=e.Symbol,je=e.Uint8Array,Te=be?be.allocUnsafe:n,Ae=Br(ee.getPrototypeOf,ee),Ie=ee.create,Le=se.propertyIsEnumerable,Oe=oe.splice,rr=Ee?Ee.isConcatSpreadable:n,ur=Ee?Ee.iterator:n,Ar=Ee?Ee.toStringTag:n,Ir=function(){try{var t=No(ee,"defineProperty");return t({},"",{}),t}catch(t){}}(),Rr=e.clearTimeout!==Me.clearTimeout&&e.clearTimeout,Lr=Jt&&Jt.now!==Me.Date.now&&Jt.now,Or=e.setTimeout!==Me.setTimeout&&e.setTimeout,Fr=te.ceil,Dr=te.floor,Nr=ee.getOwnPropertySymbols,Ur=be?be.isBuffer:n,zr=e.isFinite,qr=oe.join,Vr=Br(ee.keys,ee),Gr=te.max,Hr=te.min,Wr=Jt.now,Zr=e.parseInt,Xr=te.random,Yr=oe.reverse,$r=No(e,"DataView"),Jr=No(e,"Map"),Kr=No(e,"Promise"),Qr=No(e,"Set"),tn=No(e,"WeakMap"),en=No(ee,"create"),rn=tn&&new tn,nn={},on=fa($r),an=fa(Jr),sn=fa(Kr),ln=fa(Qr),cn=fa(tn),un=Ee?Ee.prototype:n,fn=un?un.valueOf:n,hn=un?un.toString:n;function pn(t){if(Ss(t)&&!gs(t)&&!(t instanceof gn)){if(t instanceof vn)return t;if(ue.call(t,"__wrapped__"))return ha(t)}return new vn(t)}var dn=function(){function t(){}return function(e){if(!Ps(e))return{};if(Ie)return Ie(e);t.prototype=e;var r=new t;return t.prototype=n,r}}();function mn(){}function vn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=n}function gn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=L,this.__views__=[]}function _n(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function Ln(t,e,r,i,o,a){var s,l=e&u,c=e&f,p=e&h;if(r&&(s=o?r(t,i,o,a):r(t)),s!==n)return s;if(!Ps(t))return t;var d=gs(t);if(d){if(s=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&ue.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!l)return ro(t,s)}else{var m=qo(t),v=m==W||m==Z;if(ws(t))return $i(t,l);if(m==J||m==N||v&&!o){if(s=c||v?{}:Go(t),!l)return c?function(t,e){return no(t,zo(t),e)}(t,function(t,e){return t&&no(e,ol(e),t)}(s,t)):function(t,e){return no(t,Uo(t),e)}(t,Mn(s,t))}else{if(!Ce[m])return o?t:{};s=function(t,e,r){var n,i,o,a=t.constructor;switch(e){case at:return Ji(t);case q:case V:return new a(+t);case st:return function(t,e){var r=e?Ji(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case lt:case ct:case ut:case ft:case ht:case pt:case dt:case mt:case vt:return Ki(t,r);case X:return new a;case Y:case et:return new a(t);case Q:return(o=new(i=t).constructor(i.source,zt.exec(i))).lastIndex=i.lastIndex,o;case tt:return new a;case rt:return n=t,fn?ee(fn.call(n)):{}}}(t,m,l)}}a||(a=new kn);var g=a.get(t);if(g)return g;if(a.set(t,s),Is(t))return t.forEach(function(n){s.add(Ln(n,e,r,n,t,a))}),s;if(js(t))return t.forEach(function(n,i){s.set(i,Ln(n,e,r,i,t,a))}),s;var _=d?n:(p?c?Ao:Mo:c?ol:il)(t);return He(_||t,function(n,i){_&&(n=t[i=n]),Sn(s,i,Ln(n,e,r,i,t,a))}),s}function On(t,e,r){var i=r.length;if(null==t)return!i;for(t=ee(t);i--;){var o=r[i],a=e[o],s=t[o];if(s===n&&!(o in t)||!a(s))return!1}return!0}function Fn(t,e,r){if("function"!=typeof t)throw new ie(a);return ia(function(){t.apply(n,r)},e)}function Dn(t,e,r,n){var o=-1,a=Ye,s=!0,l=t.length,c=[],u=e.length;if(!l)return c;r&&(e=Je(e,dr(r))),n?(a=$e,s=!1):e.length>=i&&(a=vr,s=!1,e=new wn(e));t:for(;++o-1},yn.prototype.set=function(t,e){var r=this.__data__,n=jn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},bn.prototype.clear=function(){this.size=0,this.__data__={hash:new _n,map:new(Jr||yn),string:new _n}},bn.prototype.delete=function(t){var e=Fo(this,t).delete(t);return this.size-=e?1:0,e},bn.prototype.get=function(t){return Fo(this,t).get(t)},bn.prototype.has=function(t){return Fo(this,t).has(t)},bn.prototype.set=function(t,e){var r=Fo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},wn.prototype.add=wn.prototype.push=function(t){return this.__data__.set(t,s),this},wn.prototype.has=function(t){return this.__data__.has(t)},kn.prototype.clear=function(){this.__data__=new yn,this.size=0},kn.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},kn.prototype.get=function(t){return this.__data__.get(t)},kn.prototype.has=function(t){return this.__data__.has(t)},kn.prototype.set=function(t,e){var r=this.__data__;if(r instanceof yn){var n=r.__data__;if(!Jr||n.length0&&r(s)?e>1?Gn(s,e-1,r,n,i):Ke(i,s):n||(i[i.length]=s)}return i}var Hn=so(),Wn=so(!0);function Zn(t,e){return t&&Hn(t,e,il)}function Xn(t,e){return t&&Wn(t,e,il)}function Yn(t,e){return Xe(e,function(e){return Bs(t[e])})}function $n(t,e){for(var r=0,i=(e=Wi(e,t)).length;null!=t&&re}function ti(t,e){return null!=t&&ue.call(t,e)}function ei(t,e){return null!=t&&e in ee(t)}function ri(t,e,r){for(var i=r?$e:Ye,o=t[0].length,a=t.length,s=a,l=$t(a),c=1/0,u=[];s--;){var f=t[s];s&&e&&(f=Je(f,dr(e))),c=Hr(f.length,c),l[s]=!r&&(e||o>=120&&f.length>=120)?new wn(s&&f):n}f=t[0];var h=-1,p=l[0];t:for(;++h=s)return l;var c=r[n];return l*("desc"==c?-1:1)}}return t.index-e.index}(t,e,r)})}function _i(t,e,r){for(var n=-1,i=e.length,o={};++n-1;)s!==t&&Oe.call(s,l,1),Oe.call(t,l,1);return t}function bi(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==o){var o=i;Wo(i)?Oe.call(t,i,1):Di(t,i)}}return t}function wi(t,e){return t+Dr(Xr()*(e-t+1))}function ki(t,e){var r="";if(!t||e<1||e>A)return r;do{e%2&&(r+=t),(e=Dr(e/2))&&(t+=t)}while(e);return r}function xi(t,e){return oa(ta(t,e,Tl),t+"")}function Bi(t){return Bn(pl(t))}function Ci(t,e){var r=pl(t);return la(r,Rn(e,0,r.length))}function Ei(t,e,r,i){if(!Ps(t))return t;for(var o=-1,a=(e=Wi(e,t)).length,s=a-1,l=t;null!=l&&++oi?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=$t(i);++n>>1,a=t[o];null!==a&&!Ls(a)&&(r?a<=e:a=i){var u=e?null:xo(t);if(u)return Er(u);s=!1,o=vr,c=new wn}else c=e?[]:l;t:for(;++n=i?t:Ti(t,e,r)}var Yi=Rr||function(t){return Me.clearTimeout(t)};function $i(t,e){if(e)return t.slice();var r=t.length,n=Te?Te(r):new t.constructor(r);return t.copy(n),n}function Ji(t){var e=new t.constructor(t.byteLength);return new je(e).set(new je(t)),e}function Ki(t,e){var r=e?Ji(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Qi(t,e){if(t!==e){var r=t!==n,i=null===t,o=t==t,a=Ls(t),s=e!==n,l=null===e,c=e==e,u=Ls(e);if(!l&&!u&&!a&&t>e||a&&s&&c&&!l&&!u||i&&s&&c||!r&&c||!o)return 1;if(!i&&!a&&!u&&t1?r[o-1]:n,s=o>2?r[2]:n;for(a=t.length>3&&"function"==typeof a?(o--,a):n,s&&Zo(r[0],r[1],s)&&(a=o<3?n:a,o=1),e=ee(e);++i-1?o[a?e[s]:s]:n}}function ho(t){return To(function(e){var r=e.length,i=r,o=vn.prototype.thru;for(t&&e.reverse();i--;){var s=e[i];if("function"!=typeof s)throw new ie(a);if(o&&!l&&"wrapper"==Ro(s))var l=new vn([],!0)}for(i=l?i:r;++i1&&_.reverse(),f&&cl))return!1;var u=a.get(t);if(u&&a.get(e))return u==e;var f=-1,h=!0,m=r&d?new wn:n;for(a.set(t,e),a.set(e,t);++f-1&&t%1==0&&t1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(Lt,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return He(D,function(r){var n="_."+r[0];e&r[1]&&!Ye(t,n)&&t.push(n)}),t.sort()}(function(t){var e=t.match(Ot);return e?e[1].split(Ft):[]}(n),r)))}function sa(t){var e=0,r=0;return function(){var i=Wr(),o=S-(i-r);if(r=i,o>0){if(++e>=P)return arguments[0]}else e=0;return t.apply(n,arguments)}}function la(t,e){var r=-1,i=t.length,o=i-1;for(e=e===n?i:e;++r1?t[e-1]:n;return Aa(t,r="function"==typeof r?(t.pop(),r):n)});function Na(t){var e=pn(t);return e.__chain__=!0,e}function Ua(t,e){return e(t)}var za=To(function(t){var e=t.length,r=e?t[0]:0,i=this.__wrapped__,o=function(e){return In(e,t)};return!(e>1||this.__actions__.length)&&i instanceof gn&&Wo(r)?((i=i.slice(r,+r+(e?1:0))).__actions__.push({func:Ua,args:[o],thisArg:n}),new vn(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(n),t})):this.thru(o)});var qa=io(function(t,e,r){ue.call(t,r)?++t[r]:An(t,r,1)});var Va=fo(va),Ga=fo(ga);function Ha(t,e){return(gs(t)?He:Nn)(t,Oo(e,3))}function Wa(t,e){return(gs(t)?We:Un)(t,Oo(e,3))}var Za=io(function(t,e,r){ue.call(t,r)?t[r].push(e):An(t,r,[e])});var Xa=xi(function(t,e,r){var n=-1,i="function"==typeof e,o=ys(t)?$t(t.length):[];return Nn(t,function(t){o[++n]=i?Ve(e,t,r):ni(t,e,r)}),o}),Ya=io(function(t,e,r){An(t,r,e)});function $a(t,e){return(gs(t)?Je:hi)(t,Oo(e,3))}var Ja=io(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]});var Ka=xi(function(t,e){if(null==t)return[];var r=e.length;return r>1&&Zo(t,e[0],e[1])?e=[]:r>2&&Zo(e[0],e[1],e[2])&&(e=[e[0]]),gi(t,Gn(e,1),[])}),Qa=Lr||function(){return Me.Date.now()};function ts(t,e,r){return e=r?n:e,e=t&&null==e?t.length:e,Co(t,k,n,n,n,n,e)}function es(t,e){var r;if("function"!=typeof e)throw new ie(a);return t=zs(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=n),r}}var rs=xi(function(t,e,r){var n=m;if(r.length){var i=Cr(r,Lo(rs));n|=b}return Co(t,n,e,r,i)}),ns=xi(function(t,e,r){var n=m|v;if(r.length){var i=Cr(r,Lo(ns));n|=b}return Co(e,n,t,r,i)});function is(t,e,r){var i,o,s,l,c,u,f=0,h=!1,p=!1,d=!0;if("function"!=typeof t)throw new ie(a);function m(e){var r=i,a=o;return i=o=n,f=e,l=t.apply(a,r)}function v(t){var r=t-u;return u===n||r>=e||r<0||p&&t-f>=s}function g(){var t=Qa();if(v(t))return _(t);c=ia(g,function(t){var r=e-(t-u);return p?Hr(r,s-(t-f)):r}(t))}function _(t){return c=n,d&&i?m(t):(i=o=n,l)}function y(){var t=Qa(),r=v(t);if(i=arguments,o=this,u=t,r){if(c===n)return function(t){return f=t,c=ia(g,e),h?m(t):l}(u);if(p)return c=ia(g,e),m(u)}return c===n&&(c=ia(g,e)),l}return e=Vs(e)||0,Ps(r)&&(h=!!r.leading,s=(p="maxWait"in r)?Gr(Vs(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d),y.cancel=function(){c!==n&&Yi(c),f=0,i=u=o=c=n},y.flush=function(){return c===n?l:_(Qa())},y}var os=xi(function(t,e){return Fn(t,1,e)}),as=xi(function(t,e,r){return Fn(t,Vs(e)||0,r)});function ss(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new ie(a);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=t.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(ss.Cache||bn),r}function ls(t){if("function"!=typeof t)throw new ie(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}ss.Cache=bn;var cs=Zi(function(t,e){var r=(e=1==e.length&&gs(e[0])?Je(e[0],dr(Oo())):Je(Gn(e,1),dr(Oo()))).length;return xi(function(n){for(var i=-1,o=Hr(n.length,r);++i=e}),vs=ii(function(){return arguments}())?ii:function(t){return Ss(t)&&ue.call(t,"callee")&&!Le.call(t,"callee")},gs=$t.isArray,_s=Fe?dr(Fe):function(t){return Ss(t)&&Kn(t)==at};function ys(t){return null!=t&&Es(t.length)&&!Bs(t)}function bs(t){return Ss(t)&&ys(t)}var ws=Ur||Vl,ks=De?dr(De):function(t){return Ss(t)&&Kn(t)==V};function xs(t){if(!Ss(t))return!1;var e=Kn(t);return e==H||e==G||"string"==typeof t.message&&"string"==typeof t.name&&!Ms(t)}function Bs(t){if(!Ps(t))return!1;var e=Kn(t);return e==W||e==Z||e==z||e==K}function Cs(t){return"number"==typeof t&&t==zs(t)}function Es(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=A}function Ps(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ss(t){return null!=t&&"object"==typeof t}var js=Ne?dr(Ne):function(t){return Ss(t)&&qo(t)==X};function Ts(t){return"number"==typeof t||Ss(t)&&Kn(t)==Y}function Ms(t){if(!Ss(t)||Kn(t)!=J)return!1;var e=Ae(t);if(null===e)return!0;var r=ue.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&ce.call(r)==de}var As=Ue?dr(Ue):function(t){return Ss(t)&&Kn(t)==Q};var Is=ze?dr(ze):function(t){return Ss(t)&&qo(t)==tt};function Rs(t){return"string"==typeof t||!gs(t)&&Ss(t)&&Kn(t)==et}function Ls(t){return"symbol"==typeof t||Ss(t)&&Kn(t)==rt}var Os=qe?dr(qe):function(t){return Ss(t)&&Es(t.length)&&!!Be[Kn(t)]};var Fs=bo(fi),Ds=bo(function(t,e){return t<=e});function Ns(t){if(!t)return[];if(ys(t))return Rs(t)?jr(t):ro(t);if(ur&&t[ur])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[ur]());var e=qo(t);return(e==X?xr:e==tt?Er:pl)(t)}function Us(t){return t?(t=Vs(t))===M||t===-M?(t<0?-1:1)*I:t==t?t:0:0===t?t:0}function zs(t){var e=Us(t),r=e%1;return e==e?r?e-r:e:0}function qs(t){return t?Rn(zs(t),0,L):0}function Vs(t){if("number"==typeof t)return t;if(Ls(t))return R;if(Ps(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ps(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(At,"");var r=Vt.test(t);return r||Ht.test(t)?Se(t.slice(2),r?2:8):qt.test(t)?R:+t}function Gs(t){return no(t,ol(t))}function Hs(t){return null==t?"":Oi(t)}var Ws=oo(function(t,e){if(Jo(e)||ys(e))no(e,il(e),t);else for(var r in e)ue.call(e,r)&&Sn(t,r,e[r])}),Zs=oo(function(t,e){no(e,ol(e),t)}),Xs=oo(function(t,e,r,n){no(e,ol(e),t,n)}),Ys=oo(function(t,e,r,n){no(e,il(e),t,n)}),$s=To(In);var Js=xi(function(t,e){t=ee(t);var r=-1,i=e.length,o=i>2?e[2]:n;for(o&&Zo(e[0],e[1],o)&&(i=1);++r1),e}),no(t,Ao(t),r),n&&(r=Ln(r,u|f|h,So));for(var i=e.length;i--;)Di(r,e[i]);return r});var cl=To(function(t,e){return null==t?{}:function(t,e){return _i(t,e,function(e,r){return tl(t,r)})}(t,e)});function ul(t,e){if(null==t)return{};var r=Je(Ao(t),function(t){return[t]});return e=Oo(e),_i(t,r,function(t,r){return e(t,r[0])})}var fl=Bo(il),hl=Bo(ol);function pl(t){return null==t?[]:mr(t,il(t))}var dl=co(function(t,e,r){return e=e.toLowerCase(),t+(r?ml(e):e)});function ml(t){return xl(Hs(t).toLowerCase())}function vl(t){return(t=Hs(t))&&t.replace(Zt,yr).replace(ge,"")}var gl=co(function(t,e,r){return t+(r?"-":"")+e.toLowerCase()}),_l=co(function(t,e,r){return t+(r?" ":"")+e.toLowerCase()}),yl=lo("toLowerCase");var bl=co(function(t,e,r){return t+(r?"_":"")+e.toLowerCase()});var wl=co(function(t,e,r){return t+(r?" ":"")+xl(e)});var kl=co(function(t,e,r){return t+(r?" ":"")+e.toUpperCase()}),xl=lo("toUpperCase");function Bl(t,e,r){return t=Hs(t),(e=r?n:e)===n?function(t){return we.test(t)}(t)?function(t){return t.match(ye)||[]}(t):function(t){return t.match(Dt)||[]}(t):t.match(e)||[]}var Cl=xi(function(t,e){try{return Ve(t,n,e)}catch(t){return xs(t)?t:new Kt(t)}}),El=To(function(t,e){return He(e,function(e){e=ua(e),An(t,e,rs(t[e],t))}),t});function Pl(t){return function(){return t}}var Sl=ho(),jl=ho(!0);function Tl(t){return t}function Ml(t){return li("function"==typeof t?t:Ln(t,u))}var Al=xi(function(t,e){return function(r){return ni(r,t,e)}}),Il=xi(function(t,e){return function(r){return ni(t,r,e)}});function Rl(t,e,r){var n=il(e),i=Yn(e,n);null!=r||Ps(e)&&(i.length||!n.length)||(r=e,e=t,t=this,i=Yn(e,il(e)));var o=!(Ps(r)&&"chain"in r&&!r.chain),a=Bs(t);return He(i,function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(o||e){var r=t(this.__wrapped__);return(r.__actions__=ro(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,Ke([this.value()],arguments))})}),t}function Ll(){}var Ol=go(Je),Fl=go(Ze),Dl=go(er);function Nl(t){return Xo(t)?cr(ua(t)):function(t){return function(e){return $n(e,t)}}(t)}var Ul=yo(),zl=yo(!0);function ql(){return[]}function Vl(){return!1}var Gl=vo(function(t,e){return t+e},0),Hl=ko("ceil"),Wl=vo(function(t,e){return t/e},1),Zl=ko("floor");var Xl,Yl=vo(function(t,e){return t*e},1),$l=ko("round"),Jl=vo(function(t,e){return t-e},0);return pn.after=function(t,e){if("function"!=typeof e)throw new ie(a);return t=zs(t),function(){if(--t<1)return e.apply(this,arguments)}},pn.ary=ts,pn.assign=Ws,pn.assignIn=Zs,pn.assignInWith=Xs,pn.assignWith=Ys,pn.at=$s,pn.before=es,pn.bind=rs,pn.bindAll=El,pn.bindKey=ns,pn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return gs(t)?t:[t]},pn.chain=Na,pn.chunk=function(t,e,r){e=(r?Zo(t,e,r):e===n)?1:Gr(zs(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=$t(Fr(i/e));oo?0:o+r),(i=i===n||i>o?o:zs(i))<0&&(i+=o),i=r>i?0:qs(i);r>>0)?(t=Hs(t))&&("string"==typeof e||null!=e&&!As(e))&&!(e=Oi(e))&&kr(t)?Xi(jr(t),0,r):t.split(e,r):[]},pn.spread=function(t,e){if("function"!=typeof t)throw new ie(a);return e=null==e?0:Gr(zs(e),0),xi(function(r){var n=r[e],i=Xi(r,0,e);return n&&Ke(i,n),Ve(t,this,i)})},pn.tail=function(t){var e=null==t?0:t.length;return e?Ti(t,1,e):[]},pn.take=function(t,e,r){return t&&t.length?Ti(t,0,(e=r||e===n?1:zs(e))<0?0:e):[]},pn.takeRight=function(t,e,r){var i=null==t?0:t.length;return i?Ti(t,(e=i-(e=r||e===n?1:zs(e)))<0?0:e,i):[]},pn.takeRightWhile=function(t,e){return t&&t.length?Ui(t,Oo(e,3),!1,!0):[]},pn.takeWhile=function(t,e){return t&&t.length?Ui(t,Oo(e,3)):[]},pn.tap=function(t,e){return e(t),t},pn.throttle=function(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new ie(a);return Ps(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),is(t,e,{leading:n,maxWait:e,trailing:i})},pn.thru=Ua,pn.toArray=Ns,pn.toPairs=fl,pn.toPairsIn=hl,pn.toPath=function(t){return gs(t)?Je(t,ua):Ls(t)?[t]:ro(ca(Hs(t)))},pn.toPlainObject=Gs,pn.transform=function(t,e,r){var n=gs(t),i=n||ws(t)||Os(t);if(e=Oo(e,4),null==r){var o=t&&t.constructor;r=i?n?new o:[]:Ps(t)&&Bs(o)?dn(Ae(t)):{}}return(i?He:Zn)(t,function(t,n,i){return e(r,t,n,i)}),r},pn.unary=function(t){return ts(t,1)},pn.union=Sa,pn.unionBy=ja,pn.unionWith=Ta,pn.uniq=function(t){return t&&t.length?Fi(t):[]},pn.uniqBy=function(t,e){return t&&t.length?Fi(t,Oo(e,2)):[]},pn.uniqWith=function(t,e){return e="function"==typeof e?e:n,t&&t.length?Fi(t,n,e):[]},pn.unset=function(t,e){return null==t||Di(t,e)},pn.unzip=Ma,pn.unzipWith=Aa,pn.update=function(t,e,r){return null==t?t:Ni(t,e,Hi(r))},pn.updateWith=function(t,e,r,i){return i="function"==typeof i?i:n,null==t?t:Ni(t,e,Hi(r),i)},pn.values=pl,pn.valuesIn=function(t){return null==t?[]:mr(t,ol(t))},pn.without=Ia,pn.words=Bl,pn.wrap=function(t,e){return us(Hi(e),t)},pn.xor=Ra,pn.xorBy=La,pn.xorWith=Oa,pn.zip=Fa,pn.zipObject=function(t,e){return Vi(t||[],e||[],Sn)},pn.zipObjectDeep=function(t,e){return Vi(t||[],e||[],Ei)},pn.zipWith=Da,pn.entries=fl,pn.entriesIn=hl,pn.extend=Zs,pn.extendWith=Xs,Rl(pn,pn),pn.add=Gl,pn.attempt=Cl,pn.camelCase=dl,pn.capitalize=ml,pn.ceil=Hl,pn.clamp=function(t,e,r){return r===n&&(r=e,e=n),r!==n&&(r=(r=Vs(r))==r?r:0),e!==n&&(e=(e=Vs(e))==e?e:0),Rn(Vs(t),e,r)},pn.clone=function(t){return Ln(t,h)},pn.cloneDeep=function(t){return Ln(t,u|h)},pn.cloneDeepWith=function(t,e){return Ln(t,u|h,e="function"==typeof e?e:n)},pn.cloneWith=function(t,e){return Ln(t,h,e="function"==typeof e?e:n)},pn.conformsTo=function(t,e){return null==e||On(t,e,il(e))},pn.deburr=vl,pn.defaultTo=function(t,e){return null==t||t!=t?e:t},pn.divide=Wl,pn.endsWith=function(t,e,r){t=Hs(t),e=Oi(e);var i=t.length,o=r=r===n?i:Rn(zs(r),0,i);return(r-=e.length)>=0&&t.slice(r,o)==e},pn.eq=ps,pn.escape=function(t){return(t=Hs(t))&&xt.test(t)?t.replace(wt,br):t},pn.escapeRegExp=function(t){return(t=Hs(t))&&Mt.test(t)?t.replace(Tt,"\\$&"):t},pn.every=function(t,e,r){var i=gs(t)?Ze:zn;return r&&Zo(t,e,r)&&(e=n),i(t,Oo(e,3))},pn.find=Va,pn.findIndex=va,pn.findKey=function(t,e){return nr(t,Oo(e,3),Zn)},pn.findLast=Ga,pn.findLastIndex=ga,pn.findLastKey=function(t,e){return nr(t,Oo(e,3),Xn)},pn.floor=Zl,pn.forEach=Ha,pn.forEachRight=Wa,pn.forIn=function(t,e){return null==t?t:Hn(t,Oo(e,3),ol)},pn.forInRight=function(t,e){return null==t?t:Wn(t,Oo(e,3),ol)},pn.forOwn=function(t,e){return t&&Zn(t,Oo(e,3))},pn.forOwnRight=function(t,e){return t&&Xn(t,Oo(e,3))},pn.get=Qs,pn.gt=ds,pn.gte=ms,pn.has=function(t,e){return null!=t&&Vo(t,e,ti)},pn.hasIn=tl,pn.head=ya,pn.identity=Tl,pn.includes=function(t,e,r,n){t=ys(t)?t:pl(t),r=r&&!n?zs(r):0;var i=t.length;return r<0&&(r=Gr(i+r,0)),Rs(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&or(t,e,r)>-1},pn.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:zs(r);return i<0&&(i=Gr(n+i,0)),or(t,e,i)},pn.inRange=function(t,e,r){return e=Us(e),r===n?(r=e,e=0):r=Us(r),function(t,e,r){return t>=Hr(e,r)&&t=-A&&t<=A},pn.isSet=Is,pn.isString=Rs,pn.isSymbol=Ls,pn.isTypedArray=Os,pn.isUndefined=function(t){return t===n},pn.isWeakMap=function(t){return Ss(t)&&qo(t)==it},pn.isWeakSet=function(t){return Ss(t)&&Kn(t)==ot},pn.join=function(t,e){return null==t?"":qr.call(t,e)},pn.kebabCase=gl,pn.last=xa,pn.lastIndexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=zs(r))<0?Gr(i+o,0):Hr(o,i-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,o):ir(t,sr,o,!0)},pn.lowerCase=_l,pn.lowerFirst=yl,pn.lt=Fs,pn.lte=Ds,pn.max=function(t){return t&&t.length?qn(t,Tl,Qn):n},pn.maxBy=function(t,e){return t&&t.length?qn(t,Oo(e,2),Qn):n},pn.mean=function(t){return lr(t,Tl)},pn.meanBy=function(t,e){return lr(t,Oo(e,2))},pn.min=function(t){return t&&t.length?qn(t,Tl,fi):n},pn.minBy=function(t,e){return t&&t.length?qn(t,Oo(e,2),fi):n},pn.stubArray=ql,pn.stubFalse=Vl,pn.stubObject=function(){return{}},pn.stubString=function(){return""},pn.stubTrue=function(){return!0},pn.multiply=Yl,pn.nth=function(t,e){return t&&t.length?vi(t,zs(e)):n},pn.noConflict=function(){return Me._===this&&(Me._=me),this},pn.noop=Ll,pn.now=Qa,pn.pad=function(t,e,r){t=Hs(t);var n=(e=zs(e))?Sr(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return _o(Dr(i),r)+t+_o(Fr(i),r)},pn.padEnd=function(t,e,r){t=Hs(t);var n=(e=zs(e))?Sr(t):0;return e&&ne){var i=t;t=e,e=i}if(r||t%1||e%1){var o=Xr();return Hr(t+o*(e-t+Pe("1e-"+((o+"").length-1))),e)}return wi(t,e)},pn.reduce=function(t,e,r){var n=gs(t)?Qe:fr,i=arguments.length<3;return n(t,Oo(e,4),r,i,Nn)},pn.reduceRight=function(t,e,r){var n=gs(t)?tr:fr,i=arguments.length<3;return n(t,Oo(e,4),r,i,Un)},pn.repeat=function(t,e,r){return e=(r?Zo(t,e,r):e===n)?1:zs(e),ki(Hs(t),e)},pn.replace=function(){var t=arguments,e=Hs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},pn.result=function(t,e,r){var i=-1,o=(e=Wi(e,t)).length;for(o||(o=1,t=n);++iA)return[];var r=L,n=Hr(t,L);e=Oo(e),t-=L;for(var i=pr(n,e);++r=a)return t;var l=r-Sr(i);if(l<1)return i;var c=s?Xi(s,0,l).join(""):t.slice(0,l);if(o===n)return c+i;if(s&&(l+=c.length-l),As(o)){if(t.slice(l).search(o)){var u,f=c;for(o.global||(o=re(o.source,Hs(zt.exec(o))+"g")),o.lastIndex=0;u=o.exec(f);)var h=u.index;c=c.slice(0,h===n?l:h)}}else if(t.indexOf(Oi(o),l)!=l){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+i},pn.unescape=function(t){return(t=Hs(t))&&kt.test(t)?t.replace(bt,Tr):t},pn.uniqueId=function(t){var e=++fe;return Hs(t)+e},pn.upperCase=kl,pn.upperFirst=xl,pn.each=Ha,pn.eachRight=Wa,pn.first=ya,Rl(pn,(Xl={},Zn(pn,function(t,e){ue.call(pn.prototype,e)||(Xl[e]=t)}),Xl),{chain:!1}),pn.VERSION="4.17.11",He(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){pn[t].placeholder=pn}),He(["drop","take"],function(t,e){gn.prototype[t]=function(r){r=r===n?1:Gr(zs(r),0);var i=this.__filtered__&&!e?new gn(this):this.clone();return i.__filtered__?i.__takeCount__=Hr(r,i.__takeCount__):i.__views__.push({size:Hr(r,L),type:t+(i.__dir__<0?"Right":"")}),i},gn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),He(["filter","map","takeWhile"],function(t,e){var r=e+1,n=r==j||3==r;gn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Oo(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}}),He(["head","last"],function(t,e){var r="take"+(e?"Right":"");gn.prototype[t]=function(){return this[r](1).value()[0]}}),He(["initial","tail"],function(t,e){var r="drop"+(e?"":"Right");gn.prototype[t]=function(){return this.__filtered__?new gn(this):this[r](1)}}),gn.prototype.compact=function(){return this.filter(Tl)},gn.prototype.find=function(t){return this.filter(t).head()},gn.prototype.findLast=function(t){return this.reverse().find(t)},gn.prototype.invokeMap=xi(function(t,e){return"function"==typeof t?new gn(this):this.map(function(r){return ni(r,t,e)})}),gn.prototype.reject=function(t){return this.filter(ls(Oo(t)))},gn.prototype.slice=function(t,e){t=zs(t);var r=this;return r.__filtered__&&(t>0||e<0)?new gn(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==n&&(r=(e=zs(e))<0?r.dropRight(-e):r.take(e-t)),r)},gn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},gn.prototype.toArray=function(){return this.take(L)},Zn(gn.prototype,function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=pn[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(pn.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,l=e instanceof gn,c=s[0],u=l||gs(e),f=function(t){var e=o.apply(pn,Ke([t],s));return i&&h?e[0]:e};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,p=!!this.__actions__.length,d=a&&!h,m=l&&!p;if(!a&&u){e=m?e:new gn(this);var v=t.apply(e,s);return v.__actions__.push({func:Ua,args:[f],thisArg:n}),new vn(v,h)}return d&&m?t.apply(this,s):(v=this.thru(f),d?i?v.value()[0]:v.value():v)})}),He(["pop","push","shift","sort","splice","unshift"],function(t){var e=oe[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);pn.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(gs(i)?i:[],t)}return this[r](function(r){return e.apply(gs(r)?r:[],t)})}}),Zn(gn.prototype,function(t,e){var r=pn[e];if(r){var n=r.name+"";(nn[n]||(nn[n]=[])).push({name:e,func:r})}}),nn[po(n,v).name]=[{name:"wrapper",func:n}],gn.prototype.clone=function(){var t=new gn(this.__wrapped__);return t.__actions__=ro(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=ro(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=ro(this.__views__),t},gn.prototype.reverse=function(){if(this.__filtered__){var t=new gn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},gn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=gs(t),n=e<0,i=r?t.length:0,o=function(t,e,r){for(var n=-1,i=r.length;++n=this.__values__.length;return{done:t,value:t?n:this.__values__[this.__index__++]}},pn.prototype.plant=function(t){for(var e,r=this;r instanceof mn;){var i=ha(r);i.__index__=0,i.__values__=n,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=t,e},pn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof gn){var e=t;return this.__actions__.length&&(e=new gn(this)),(e=e.reverse()).__actions__.push({func:Ua,args:[Pa],thisArg:n}),new vn(e,this.__chain__)}return this.thru(Pa)},pn.prototype.toJSON=pn.prototype.valueOf=pn.prototype.value=function(){return zi(this.__wrapped__,this.__actions__)},pn.prototype.first=pn.prototype.head,ur&&(pn.prototype[ur]=function(){return this}),pn}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Me._=Mr,define(function(){return Mr})):Ie?((Ie.exports=Mr)._=Mr,Ae._=Mr):Me._=Mr}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],76:[function(t,e,r){(function(r){t("path");var n=t("fs");function i(){this.types=Object.create(null),this.extensions=Object.create(null)}i.prototype.define=function(t){for(var e in t){for(var n=t[e],i=0;i=0;--s)if(h[s]=f,f*=c[s],p=Math.max(p,a.scratchMemory(c[s])),e.shape[s]!==r.shape[s])throw new Error("Shape mismatch, real and imaginary arrays must have same size");var d,m=4*f+p;d="array"===e.dtype||"float64"===e.dtype||"custom"===e.dtype?o.mallocDouble(m):o.mallocFloat(m);var v,g,_,y,b=i(d,c.slice(0),h,0),w=i(d,c.slice(0),h.slice(0),f),k=i(d,c.slice(0),h.slice(0),2*f),x=i(d,c.slice(0),h.slice(0),3*f),B=4*f;for(n.assign(b,e),n.assign(w,r),s=u-1;s>=0&&(a(t,f/c[s],c[s],d,b.offset,w.offset,B),0!==s);--s){for(g=1,_=k.stride,y=x.stride,l=s-1;l=0;--l)y[l]=_[l]=g,g*=c[l];n.assign(k,b),n.assign(x,w),v=b,b=k,k=v,v=w,w=x,x=v}n.assign(e,b),n.assign(r,w),o.free(d)}},{"./lib/fft-matrix.js":79,ndarray:84,"ndarray-ops":81,"typedarray-pool":144}],79:[function(t,e,r){var n=t("bit-twiddle");function i(t,e,r,i,o,a){var s,l,c,u,f,h,p,d,m,v,g,_,y,b,w,k,x,B,C,E,P,S,j,T;for(t|=0,e|=0,o|=0,a|=0,s=r|=0,l=n.log2(s),B=0;B>1,f=0,c=0;c>=1;f+=h}for(g=-1,_=0,v=1,d=0;d>",rrshift:">>>"};!function(){for(var t in s){var e=s[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var l={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in l){var e=l[t];r[t]=a({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=a({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var u=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=n({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=n({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=n({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=a({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=n({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":15}],82:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],o=t,a=1;Array.isArray(o);)r.push(o.length),a*=o.length,o=o[0];return 0===r.length?n():(e||(e=n(new Float64Array(a),r)),i(e,t),e)}},{"./doConvert.js":83,ndarray:84}],83:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":15}],84:[function(t,e,r){var n=t("iota-array"),i=t("is-buffer"),o="undefined"!=typeof Float64Array;function a(t,e){return t[0]-e[0]}function s(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),i?o.push("return this.data.set("+u+",v)}"):o.push("return this.data["+u+"]=v}"),o.push("proto.get=function "+r+"_get("+l.join(",")+"){"),i?o.push("return this.data.get("+u+")}"):o.push("return this.data["+u+"]}"),o.push("proto.index=function "+r+"_index(",l.join(),"){return "+u+"}"),o.push("proto.hi=function "+r+"_hi("+l.join(",")+"){return new "+r+"(this.data,"+a.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+a.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=a.map(function(t){return"a"+t+"=this.shape["+t+"]"}),d=a.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var m=0;m=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");o.push("return new "+r+"(this.data,"+a.map(function(t){return"a"+t}).join(",")+","+a.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+l.join(",")+"){var "+a.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+a.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(m=0;m=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");return o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+a.map(function(t){return"shape["+t+"]"}).join(",")+","+a.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",o.join("\n"))(c[t],s)}var c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=function(t,e,r,n){if(void 0===t)return(0,c.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var a=e.length;if(void 0===r){r=new Array(a);for(var s=a-1,u=1;s>=0;--s)r[s]=u,u*=e[s]}if(void 0===n)for(n=0,s=0;s>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}},{}],86:[function(t,e,r){(function(r,n){"use strict";var i=t("util"),o=t("stream"),a=e.exports=function(){o.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};i.inherits(a,o),a.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),r.nextTick(function(){this._process(),this._paused&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},a.prototype.write=function(t,e){return this.writable?(n.isBuffer(t)||(t=new n(t,e||this._encoding)),this._buffers.push(t),this._buffered+=t.length,this._process(),this._reads&&0==this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1)},a.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0==this._buffers.length?this._end():(this._buffers.push(null),this._process()))},a.prototype.destroySoon=a.prototype.end,a.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},a.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},a.prototype._process=function(){for(;this._buffered>0&&this._reads&&this._reads.length>0;){var t=this._reads[0];if(t.allowLess){this._reads.shift(),(o=this._buffers[0]).length>t.length?(this._buffered-=t.length,this._buffers[0]=o.slice(t.length),t.func.call(this,o.slice(0,t.length))):(this._buffered-=o.length,this._buffers.shift(),t.func.call(this,o))}else{if(!(this._buffered>=t.length))break;this._reads.shift();for(var e=0,r=0,i=new n(t.length);e0&&this._buffers.splice(0,r),this._buffered-=t.length,t.func.call(this,i)}}this._buffers&&this._buffers.length>0&&null==this._buffers[0]&&this._end()}}).call(this,t("_process"),t("buffer").Buffer)},{_process:117,buffer:47,stream:139,util:150}],87:[function(t,e,r){"use strict";e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLOR_PALETTE:1,COLOR_COLOR:2,COLOR_ALPHA:4}},{}],88:[function(t,e,r){"use strict";var n=t("util"),i=t("stream"),o=e.exports=function(){i.call(this),this._crc=-1,this.writable=!0};n.inherits(o,i),o.prototype.write=function(t){for(var e=0;e>>8;return!0},o.prototype.end=function(t){t&&this.write(t),this.emit("crc",this.crc32())},o.prototype.crc32=function(){return-1^this._crc},o.crc32=function(t){for(var e=-1,r=0;r>>8;return-1^e};for(var a=[],s=0;s<256;s++){for(var l=s,c=0;c<8;c++)1&l?l=3988292384^l>>>1:l>>>=1;a[s]=l}},{stream:139,util:150}],89:[function(t,e,r){(function(r){"use strict";var n=t("util"),i=(t("zlib"),t("./chunkstream")),o=e.exports=function(t,e,r,n,o){i.call(this),this._width=t,this._height=e,this._Bpp=r,this._data=n,this._options=o,this._line=0,"filterType"in o&&-1!=o.filterType?"number"==typeof o.filterType&&(o.filterType=[o.filterType]):o.filterType=[0,1,2,3,4],this._filters={0:this._filterNone.bind(this),1:this._filterSub.bind(this),2:this._filterUp.bind(this),3:this._filterAvg.bind(this),4:this._filterPaeth.bind(this)},this.read(this._width*r+1,this._reverseFilterLine.bind(this))};n.inherits(o,i);var a={1:{0:0,1:0,2:0,3:255},2:{0:0,1:0,2:0,3:1},3:{0:0,1:1,2:2,3:255},4:{0:0,1:1,2:2,3:3}};o.prototype._reverseFilterLine=function(t){var e=this._data,r=this._width<<2,n=this._line*r,i=t[0];if(0==i)for(var o=0;o0?e[l+u-4]:0;e[l+u]=255!=f?t[c+f]+h:255}else if(2==i)for(o=0;o0?e[l-r+u]:0;e[l+u]=255!=f?t[c+f]+p:255}else if(3==i)for(o=0;o0?e[l+u-4]:0,p=this._line>0?e[l-r+u]:0;var d=Math.floor((h+p)/2);e[l+u]=255!=f?t[c+f]+d:255}else if(4==i)for(o=0;o0?e[l+u-4]:0,p=this._line>0?e[l-r+u]:0;var m=o>0&&this._line>0?e[l-r+u-4]:0;d=s(h,p,m);e[l+u]=255!=f?t[c+f]+d:255}this._line++,this._line=4?t[e*n+a-4]:0,l=t[e*n+a]-s;r?r[e*i+1+a]=l:o+=Math.abs(l)}return o},o.prototype._filterUp=function(t,e,r){var n=this._width<<2,i=n+1,o=0;r&&(r[e*i]=2);for(var a=0;a0?t[(e-1)*n+a]:0,l=t[e*n+a]-s;r?r[e*i+1+a]=l:o+=Math.abs(l)}return o},o.prototype._filterAvg=function(t,e,r){var n=this._width<<2,i=n+1,o=0;r&&(r[e*i]=3);for(var a=0;a=4?t[e*n+a-4]:0,l=e>0?t[(e-1)*n+a]:0,c=t[e*n+a]-(s+l>>1);r?r[e*i+1+a]=c:o+=Math.abs(c)}return o},o.prototype._filterPaeth=function(t,e,r){var n=this._width<<2,i=n+1,o=0;r&&(r[e*i]=4);for(var a=0;a=4?t[e*n+a-4]:0,c=e>0?t[(e-1)*n+a]:0,u=a>=4&&e>0?t[(e-1)*n+a-4]:0,f=t[e*n+a]-s(l,c,u);r?r[e*i+1+a]=f:o+=Math.abs(f)}return o};var s=function(t,e,r){var n=t+e-r,i=Math.abs(n-t),o=Math.abs(n-e),a=Math.abs(n-r);return i<=o&&i<=a?t:o<=a?e:r}}).call(this,t("buffer").Buffer)},{"./chunkstream":86,buffer:47,util:150,zlib:45}],90:[function(t,e,r){(function(r){"use strict";var n=t("util"),i=t("stream"),o=t("zlib"),a=t("./filter"),s=t("./crc"),l=t("./constants"),c=e.exports=function(t){i.call(this),this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=t.deflateLevel||9,t.deflateStrategy=t.deflateStrategy||3,this.readable=!0};n.inherits(c,i),c.prototype.pack=function(t,e,n){this.emit("data",new r(l.PNG_SIGNATURE)),this.emit("data",this._packIHDR(e,n));t=new a(e,n,4,t,this._options).filter();var i=o.createDeflate({chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy});i.on("error",this.emit.bind(this,"error")),i.on("data",function(t){this.emit("data",this._packIDAT(t))}.bind(this)),i.on("end",function(){this.emit("data",this._packIEND()),this.emit("end")}.bind(this)),i.end(t)},c.prototype._packChunk=function(t,e){var n=e?e.length:0,i=new r(n+12);return i.writeUInt32BE(n,0),i.writeUInt32BE(t,4),e&&e.copy(i,8),i.writeInt32BE(s.crc32(i.slice(4,i.length-4)),i.length-4),i},c.prototype._packIHDR=function(t,e){var n=new r(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(e,4),n[8]=8,n[9]=6,n[10]=0,n[11]=0,n[12]=0,this._packChunk(l.TYPE_IHDR,n)},c.prototype._packIDAT=function(t){return this._packChunk(l.TYPE_IDAT,t)},c.prototype._packIEND=function(){return this._packChunk(l.TYPE_IEND,null)}}).call(this,t("buffer").Buffer)},{"./constants":87,"./crc":88,"./filter":89,buffer:47,stream:139,util:150,zlib:45}],91:[function(t,e,r){(function(r){"use strict";var n=t("util"),i=t("zlib"),o=t("./crc"),a=t("./chunkstream"),s=t("./constants"),l=t("./filter"),c=e.exports=function(t){a.call(this),this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._inflate=null,this._filter=null,this._crc=null,this._palette=[],this._colorType=0,this._chunks={},this._chunks[s.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[s.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[s.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[s.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[s.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[s.TYPE_gAMA]=this._handleGAMA.bind(this),this.writable=!0,this.on("error",this._handleError.bind(this)),this._handleSignature()};n.inherits(c,a),c.prototype._handleError=function(){this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy()},c.prototype._handleSignature=function(){this.read(s.PNG_SIGNATURE.length,this._parseSignature.bind(this))},c.prototype._parseSignature=function(t){for(var e=s.PNG_SIGNATURE,r=0;rthis._palette.length)return void this.emit("error",new Error("More transparent colors than palette size"));for(var e=0;e0?this._handleIDAT(t):this._handleChunkEnd()},c.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},c.prototype._parseIEND=function(t){this._crc.write(t),this._inflate.end(),this._hasIEND=!0,this._handleChunkEnd()};var u={0:1,2:3,3:1,4:2,6:4};c.prototype._reverseFiltered=function(t,e,r){if(3==this._colorType)for(var n=e<<2,i=0;i0&&this.height>0?new n(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new a(t||{}),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new s(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(l,o),l.prototype.pack=function(){return e.nextTick(function(){this._packer.pack(this.data,this.width,this.height)}.bind(this)),this},l.prototype.parse=function(t,e){if(e){var r,n=null;this.once("parsed",r=function(t){this.removeListener("error",n),this.data=t,e(null,this)}.bind(this)),this.once("error",n=function(t){this.removeListener("parsed",r),e(t,null)}.bind(this))}return this.end(t),this},l.prototype.write=function(t){return this._parser.write(t),!0},l.prototype.end=function(t){this._parser.end(t)},l.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.data=t.data,delete t.data,this.emit("metadata",t)},l.prototype._gamma=function(t){this.gamma=t},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.prototype.bitblt=function(t,e,r,n,i,o,a){if(e>this.width||r>this.height||e+n>this.width||r+i>this.height)throw new Error("bitblt reading outside image");if(o>t.width||a>t.height||o+n>t.width||a+i>t.height)throw new Error("bitblt writing outside image");for(var s=0;s>=l,u-=l,v!==o){if(v===a)break;for(var g=vo;)y=d[y]>>8,++_;var b=y;if(h+_+(g!==v?1:0)>n)return void console.log("Warning, gif stream longer than expected.");r[h++]=b;var w=h+=_;for(g!==v&&(r[h++]=b),y=g;_--;)y=d[y],r[--w]=255&y,y>>=8;null!==m&&s<4096&&(d[s++]=m<<8|b,s>=c+1&&l<12&&(++l,c=c<<1|1)),m=v}else s=a+1,c=(1<<(l=i+1))-1,m=null}return h!==n&&console.log("Warning, gif stream shorter than expected."),r}try{r.GifWriter=function(t,e,r,n){var i=0,o=void 0===(n=void 0===n?{}:n).loop?null:n.loop,a=void 0===n.palette?null:n.palette;if(e<=0||r<=0||e>65535||r>65535)throw new Error("Width/Height invalid.");function s(t){var e=t.length;if(e<2||e>256||e&e-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return e}t[i++]=71,t[i++]=73,t[i++]=70,t[i++]=56,t[i++]=57,t[i++]=97;var l=0,c=0;if(null!==a){for(var u=s(a);u>>=1;)++l;if(u=1<=u)throw new Error("Background index out of range.");if(0===c)throw new Error("Background index explicitly passed as 0.")}}if(t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&r,t[i++]=r>>8&255,t[i++]=(null!==a?128:0)|l,t[i++]=c,t[i++]=0,null!==a)for(var f=0,h=a.length;f>16&255,t[i++]=p>>8&255,t[i++]=255&p}if(null!==o){if(o<0||o>65535)throw new Error("Loop count invalid.");t[i++]=33,t[i++]=255,t[i++]=11,t[i++]=78,t[i++]=69,t[i++]=84,t[i++]=83,t[i++]=67,t[i++]=65,t[i++]=80,t[i++]=69,t[i++]=50,t[i++]=46,t[i++]=48,t[i++]=3,t[i++]=1,t[i++]=255&o,t[i++]=o>>8&255,t[i++]=0}var d=!1;this.addFrame=function(e,r,n,o,l,c){if(!0===d&&(--i,d=!1),c=void 0===c?{}:c,e<0||r<0||e>65535||r>65535)throw new Error("x/y invalid.");if(n<=0||o<=0||n>65535||o>65535)throw new Error("Width/Height invalid.");if(l.length>=1;)++p;h=1<3)throw new Error("Disposal out of range.");var g=!1,_=0;if(void 0!==c.transparent&&null!==c.transparent&&(g=!0,(_=c.transparent)<0||_>=h))throw new Error("Transparent color index.");if((0!==v||g||0!==m)&&(t[i++]=33,t[i++]=249,t[i++]=4,t[i++]=v<<2|(!0===g?1:0),t[i++]=255&m,t[i++]=m>>8&255,t[i++]=_,t[i++]=0),t[i++]=44,t[i++]=255&e,t[i++]=e>>8&255,t[i++]=255&r,t[i++]=r>>8&255,t[i++]=255&n,t[i++]=n>>8&255,t[i++]=255&o,t[i++]=o>>8&255,t[i++]=!0===u?128|p-1:0,!0===u)for(var y=0,b=f.length;y>16&255,t[i++]=w>>8&255,t[i++]=255&w}return i=function(t,e,r,n){t[e++]=r;var i=e++,o=1<=r;)t[e++]=255&f,f>>=8,u-=8,e===i+256&&(t[i]=255,i=e++)}function p(t){f|=t<=8;)t[e++]=255&f,f>>=8,u-=8,e===i+256&&(t[i]=255,i=e++);4096===l?(p(o),l=s+1,c=r+1,m={}):(l>=1<>7,s=1<<1+(7&o);t[e++],t[e++];var l=null,c=null;a&&(l=e,c=s,e+=3*s);var u=!0,f=[],h=0,p=null,d=0,m=null;for(this.width=r,this.height=i;u&&e=0))throw Error("Invalid block size");if(0===S)break;e+=S}break;case 249:if(4!==t[e++]||0!==t[e+4])throw new Error("Invalid graphics extension block.");var v=t[e++];h=t[e++]|t[e++]<<8,p=t[e++],0==(1&v)&&(p=null),d=v>>2&7,e++;break;case 254:for(;;){if(!((S=t[e++])>=0))throw Error("Invalid block size");if(0===S)break;e+=S}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var g=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,b=t[e++]|t[e++]<<8,w=t[e++],k=w>>6&1,x=1<<1+(7&w),B=l,C=c,E=!1;w>>7&&(E=!0,B=e,C=x,e+=3*x);var P=e;for(e++;;){var S;if(!((S=t[e++])>=0))throw Error("Invalid block size");if(0===S)break;e+=S}f.push({x:g,y:_,width:y,height:b,has_local_palette:E,palette_offset:B,palette_size:C,data_offset:P,data_length:e-P,transparent_index:p,interlaced:!!k,delay:h,disposal:d});break;case 59:u=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return m},this.frameInfo=function(t){if(t<0||t>=f.length)throw new Error("Frame index out of range.");return f[t]},this.decodeAndBlitFrameBGRA=function(e,i){var o=this.frameInfo(e),a=o.width*o.height,s=new Uint8Array(a);n(t,o.data_offset,s,a);var l=o.palette_offset,c=o.transparent_index;null===c&&(c=256);var u=o.width,f=r-u,h=u,p=4*(o.y*r+o.x),d=4*((o.y+o.height)*r+o.x),m=p,v=4*f;!0===o.interlaced&&(v+=4*r*7);for(var g=8,_=0,y=s.length;_=d&&(v=4*f+4*r*(g-1),m=p+(u+f)*(g<<1),g>>=1)),b===c)m+=4;else{var w=t[l+3*b],k=t[l+3*b+1],x=t[l+3*b+2];i[m++]=x,i[m++]=k,i[m++]=w,i[m++]=255}--h}},this.decodeAndBlitFrameRGBA=function(e,i){var o=this.frameInfo(e),a=o.width*o.height,s=new Uint8Array(a);n(t,o.data_offset,s,a);var l=o.palette_offset,c=o.transparent_index;null===c&&(c=256);var u=o.width,f=r-u,h=u,p=4*(o.y*r+o.x),d=4*((o.y+o.height)*r+o.x),m=p,v=4*f;!0===o.interlaced&&(v+=4*r*7);for(var g=8,_=0,y=s.length;_=d&&(v=4*f+4*r*(g-1),m=p+(u+f)*(g<<1),g>>=1)),b===c)m+=4;else{var w=t[l+3*b],k=t[l+3*b+1],x=t[l+3*b+2];i[m++]=w,i[m++]=k,i[m++]=x,i[m++]=255}--h}}}}catch(t){}},{}],94:[function(t,e,r){(function(r){var n=t("charm");function i(t){if(!(t=t||{}).total)throw new Error("You MUST specify the total number of operations that will be processed.");this.total=t.total,this.current=0,this.max_burden=t.maxBurden||.5,this.show_burden=t.showBurden||!1,this.started=!1,this.size=50,this.inner_time=0,this.outer_time=0,this.elapsed=0,this.time_start=0,this.time_end=0,this.time_left=0,this.time_burden=0,this.skip_steps=0,this.skipped=0,this.aborted=!1,this.charm=n(),this.charm.pipe(r.stdout),this.charm.write("\n\n\n")}function o(t,e,r){for(r=r||" ";t.length3&&(l[0]=l[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,a)),(l[1]||"").length=this.total&&this.finished(),this.time_end=(new Date).getTime(),this.inner_time=this.time_end-this.time_start)},i.prototype.updateTimes=function(){this.elapsed=this.time_start-this.started,this.time_end>0&&(this.outer_time=this.time_start-this.time_end),this.inner_time>0&&this.outer_time>0&&(this.time_burden=this.inner_time/(this.inner_time+this.outer_time)*100,this.time_left=this.elapsed/this.current*(this.total-this.current),this.time_left<0&&(this.time_left=0)),this.time_burden>this.max_burden&&this.skip_steps0&&this.current=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var o=r.isAbsolute(t),a="/"===i(t,-1);return(t=e(n(t.split("/"),function(t){return!!t}),!o).join("/"))||o||(t="."),t&&a&&(t+="/"),(o?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,l=0;l=1;--o)if(47===(e=t.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)},r.basename=function(t,e){var r=function(t){"string"!=typeof t&&(t+="");var e,r=0,n=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){r=e+1;break}}else-1===n&&(i=!1,n=e+1);return-1===n?"":t.slice(r,n)}(t);return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},r.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,r=0,n=-1,i=!0,o=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s)-1===n&&(i=!1,n=a+1),46===s?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){r=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)};var i="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:117}],96:[function(t,e,r){(function(e){"use strict";var n=t("./interlace"),i={1:{0:0,1:0,2:0,3:255},2:{0:0,1:0,2:0,3:1},3:{0:0,1:1,2:2,3:255},4:{0:0,1:1,2:2,3:3}};function o(t,e,r,n,o,a){for(var s=t.width,l=t.height,c=t.index,u=0;u>4,r.push(f,u);break;case 2:l=3&h,c=h>>2&3,u=h>>4&3,f=h>>6&3,r.push(f,u,c,l);break;case 1:i=1&h,o=h>>1&1,a=h>>2&1,s=h>>3&1,l=h>>4&1,c=h>>5&1,u=h>>6&1,f=h>>7&1,r.push(f,u,c,l,s,a,o,i)}}return{get:function(t){for(;r.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},a.prototype.write=function(t,e){return this.writable?(r=n.isBuffer(t)?t:new n(t,e||this._encoding),this._buffers.push(r),this._buffered+=r.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var r},a.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},a.prototype.destroySoon=a.prototype.end,a.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("There are some read requests waitng on finished stream")),this.destroy()},a.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},a.prototype._processReadAllowingLess=function(t){this._reads.shift();var e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},a.prototype._processRead=function(t){this._reads.shift();for(var e=0,r=0,i=new n(t.length);e0&&this._buffers.splice(0,r),this._buffered-=t.length,t.func.call(this,i)},a.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&this._buffers.length>0&&null===this._buffers[0]&&this._end()}catch(t){this.emit("error",t)}}}).call(this,t("_process"),t("buffer").Buffer)},{_process:117,buffer:47,stream:139,util:150}],99:[function(t,e,r){"use strict";e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],100:[function(t,e,r){"use strict";var n=[];!function(){for(var t=0;t<256;t++){for(var e=t,r=0;r<8;r++)1&e?e=3988292384^e>>>1:e>>>=1;n[t]=e}}();var i=e.exports=function(){this._crc=-1};i.prototype.write=function(t){for(var e=0;e>>8;return!0},i.prototype.crc32=function(){return-1^this._crc},i.crc32=function(t){for(var e=-1,r=0;r>>8;return-1^e}},{}],101:[function(t,e,r){(function(r){"use strict";var n=t("./paeth-predictor");var i={0:function(t,e,r,n,i){t.copy(n,i,e,e+r)},1:function(t,e,r,n,i,o){for(var a=0;a=o?t[e+a-o]:0,l=t[e+a]-s;n[i+a]=l}},2:function(t,e,r,n,i){for(var o=0;o0?t[e+o-r]:0,s=t[e+o]-a;n[i+o]=s}},3:function(t,e,r,n,i,o){for(var a=0;a=o?t[e+a-o]:0,l=e>0?t[e+a-r]:0,c=t[e+a]-(s+l>>1);n[i+a]=c}},4:function(t,e,r,i,o,a){for(var s=0;s=a?t[e+s-a]:0,c=e>0?t[e+s-r]:0,u=e>0&&s>=a?t[e+s-(r+a)]:0,f=t[e+s]-n(l,c,u);i[o+s]=f}}},o={0:function(t,e,r){for(var n=0,i=e+r,o=e;o=n?t[e+o-n]:0,s=t[e+o]-a;i+=Math.abs(s)}return i},2:function(t,e,r){for(var n=0,i=e+r,o=e;o0?t[o-r]:0,s=t[o]-a;n+=Math.abs(s)}return n},3:function(t,e,r,n){for(var i=0,o=0;o=n?t[e+o-n]:0,s=e>0?t[e+o-r]:0,l=t[e+o]-(a+s>>1);i+=Math.abs(l)}return i},4:function(t,e,r,i){for(var o=0,a=0;a=i?t[e+a-i]:0,l=e>0?t[e+a-r]:0,c=e>0&&a>=i?t[e+a-(r+i)]:0,u=t[e+a]-n(s,l,c);o+=Math.abs(u)}return o}};e.exports=function(t,e,n,a,s){var l;if("filterType"in a&&-1!==a.filterType){if("number"!=typeof a.filterType)throw new Error("unrecognised filter types");l=[a.filterType]}else l=[0,1,2,3,4];for(var c=e*s,u=0,f=0,h=new r((c+1)*n),p=l[0],d=0;d1)for(var m=1/0,v=0;vi?e[o-n]:0;e[o]=a+s}},a.prototype._unFilterType2=function(t,e,r){for(var n=this._lastLine,i=0;ii?e[a-n]:0,u=Math.floor((c+l)/2);e[a]=s+u}},a.prototype._unFilterType4=function(t,e,r){for(var n=this._xComparison,o=n-1,a=this._lastLine,s=0;so?e[s-n]:0,f=s>o&&a?a[s-n]:0,h=i(u,c,f);e[s]=l+h}},a.prototype._reverseFilterLine=function(t){var e,n=t[0],i=this._images[this._imageIndex],o=i.byteWidth;if(0===n)e=t.slice(1,o+1);else switch(e=new r(o),n){case 1:this._unFilterType1(t,e,o);break;case 2:this._unFilterType2(t,e,o);break;case 3:this._unFilterType3(t,e,o);break;case 4:this._unFilterType4(t,e,o);break;default:throw new Error("Unrecognised filter type - "+n)}this.write(e),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=e,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this,t("buffer").Buffer)},{"./interlace":106,"./paeth-predictor":110,buffer:47}],105:[function(t,e,r){(function(t){"use strict";e.exports=function(e,r){var n=r.depth,i=r.width,o=r.height,a=r.colorType,s=r.transColor,l=r.palette,c=e;return 3===a?function(t,e,r,n,i){for(var o=0,a=0;a0&&f>0&&r.push({width:u,height:f,index:l})}return r},r.getInterlaceIterator=function(t){return function(e,r,i){var o=e%n[i].x.length,a=(e-o)/n[i].x.length*8+n[i].x[o],s=r%n[i].y.length;return 4*a+((r-s)/n[i].y.length*8+n[i].y[s])*t*4}}},{}],107:[function(t,e,r){(function(r){"use strict";var n=t("util"),i=t("stream"),o=t("./constants"),a=t("./packer"),s=e.exports=function(t){i.call(this);var e=t||{};this._packer=new a(e),this._deflate=this._packer.createDeflate(),this.readable=!0};n.inherits(s,i),s.prototype.pack=function(t,e,n,i){this.emit("data",new r(o.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,n)),i&&this.emit("data",this._packer.packGAMA(i));var a=this._packer.filterData(t,e,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(a)}}).call(this,t("buffer").Buffer)},{"./constants":99,"./packer":109,buffer:47,stream:139,util:150}],108:[function(t,e,r){(function(r){"use strict";var n=!0,i=t("zlib");i.deflateSync||(n=!1);var o=t("./constants"),a=t("./packer");e.exports=function(t,e){if(!n)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var s=new a(e||{}),l=[];l.push(new r(o.PNG_SIGNATURE)),l.push(s.packIHDR(t.width,t.height)),t.gamma&&l.push(s.packGAMA(t.gamma));var c=s.filterData(t.data,t.width,t.height),u=i.deflateSync(c,s.getDeflateOptions());if(c=null,!u||!u.length)throw new Error("bad png - invalid compressed data response");return l.push(s.packIDAT(u)),l.push(s.packIEND()),r.concat(l)}}).call(this,t("buffer").Buffer)},{"./constants":99,"./packer":109,buffer:47,zlib:45}],109:[function(t,e,r){(function(r){"use strict";var n=t("./constants"),i=t("./crc"),o=t("./bitpacker"),a=t("./filter-pack"),s=t("zlib"),l=e.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||s.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:n.COLORTYPE_COLOR_ALPHA,t.colorType!==n.COLORTYPE_COLOR&&t.colorType!==n.COLORTYPE_COLOR_ALPHA)throw new Error("option color type:"+t.colorType+" is not supported at present");if(8!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};l.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},l.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},l.prototype.filterData=function(t,e,r){var i=o(t,e,r,this._options),s=n.COLORTYPE_TO_BPP_MAP[this._options.colorType];return a(i,e,r,this._options,s)},l.prototype._packChunk=function(t,e){var n=e?e.length:0,o=new r(n+12);return o.writeUInt32BE(n,0),o.writeUInt32BE(t,4),e&&e.copy(o,8),o.writeInt32BE(i.crc32(o.slice(4,o.length-4)),o.length-4),o},l.prototype.packGAMA=function(t){var e=new r(4);return e.writeUInt32BE(Math.floor(t*n.GAMMA_DIVISION),0),this._packChunk(n.TYPE_gAMA,e)},l.prototype.packIHDR=function(t,e){var i=new r(13);return i.writeUInt32BE(t,0),i.writeUInt32BE(e,4),i[8]=this._options.bitDepth,i[9]=this._options.colorType,i[10]=0,i[11]=0,i[12]=0,this._packChunk(n.TYPE_IHDR,i)},l.prototype.packIDAT=function(t){return this._packChunk(n.TYPE_IDAT,t)},l.prototype.packIEND=function(){return this._packChunk(n.TYPE_IEND,null)}}).call(this,t("buffer").Buffer)},{"./bitpacker":97,"./constants":99,"./crc":100,"./filter-pack":101,buffer:47,zlib:45}],110:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=t+e-r,i=Math.abs(n-t),o=Math.abs(n-e),a=Math.abs(n-r);return i<=o&&i<=a?t:o<=a?e:r}},{}],111:[function(t,e,r){"use strict";var n=t("util"),i=t("zlib"),o=t("./chunkstream"),a=t("./filter-parse-async"),s=t("./parser"),l=t("./bitmapper"),c=t("./format-normaliser"),u=e.exports=function(t){o.call(this),this._parser=new s(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};n.inherits(u,o),u.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this.errord=!0},u.prototype._inflateData=function(t){this._inflate||(this._inflate=i.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter)),this._inflate.write(t)},u.prototype._handleMetaData=function(t){this.emit("metadata",t),this._bitmapInfo=Object.create(t),this._filter=new a(this._bitmapInfo)},u.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},u.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},u.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},u.prototype._complete=function(t){if(!this.errord){try{var e=l.dataToBitMap(t,this._bitmapInfo),r=c(e,this._bitmapInfo);e=null}catch(t){return void this._handleError(t)}this.emit("parsed",r)}}},{"./bitmapper":96,"./chunkstream":98,"./filter-parse-async":102,"./format-normaliser":105,"./parser":113,util:150,zlib:45}],112:[function(t,e,r){(function(r){"use strict";var n=!0,i=t("zlib");i.deflateSync||(n=!1);var o=t("./sync-reader"),a=t("./filter-parse-sync"),s=t("./parser"),l=t("./bitmapper"),c=t("./format-normaliser");e.exports=function(t,e){if(!n)throw new Error("To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport");var u,f,h;var p=[];var d=new o(t);if(new s(e,{read:d.read.bind(d),error:function(t){u=t},metadata:function(t){f=t},gamma:function(t){h=t},palette:function(t){f.palette=t},transColor:function(t){f.transColor=t},inflateData:function(t){p.push(t)}}).start(),d.process(),u)throw u;var m=r.concat(p);p.length=0;var v=i.inflateSync(m);if(m=null,!v||!v.length)throw new Error("bad png - invalid inflate data response");var g=a.process(v,f);m=null;var _=l.dataToBitMap(g,f);g=null;var y=c(_,f);return f.data=y,f.gamma=h||0,f}}).call(this,t("buffer").Buffer)},{"./bitmapper":96,"./filter-parse-sync":103,"./format-normaliser":105,"./parser":113,"./sync-reader":116,buffer:47,zlib:45}],113:[function(t,e,r){(function(r){"use strict";var n=t("./constants"),i=t("./crc"),o=e.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[n.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[n.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[n.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[n.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[n.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[n.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.inflateData=e.inflateData,this.finished=e.finished};o.prototype.start=function(){this.read(n.PNG_SIGNATURE.length,this._parseSignature.bind(this))},o.prototype._parseSignature=function(t){for(var e=n.PNG_SIGNATURE,r=0;rthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var e=0;e0?this._handleIDAT(r):this._handleChunkEnd()},o.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},o.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this,t("buffer").Buffer)},{"./constants":99,"./crc":100,buffer:47}],114:[function(t,e,r){"use strict";var n=t("./parser-sync"),i=t("./packer-sync");r.read=function(t,e){return n(t,e||{})},r.write=function(t){return i(t)}},{"./packer-sync":108,"./parser-sync":112}],115:[function(t,e,r){(function(e,n){"use strict";var i=t("util"),o=t("stream"),a=t("./parser-async"),s=t("./packer-async"),l=t("./png-sync"),c=r.PNG=function(t){o.call(this),t=t||{},this.width=t.width||0,this.height=t.height||0,this.data=this.width>0&&this.height>0?new n(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new a(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new s(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};i.inherits(c,o),c.sync=l,c.prototype.pack=function(){return this.data&&this.data.length?(e.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},c.prototype.parse=function(t,e){var r,n;e&&(r=function(t){this.removeListener("error",n),this.data=t,e(null,this)}.bind(this),n=function(t){this.removeListener("parsed",r),e(t,null)}.bind(this),this.once("parsed",r),this.once("error",n));return this.end(t),this},c.prototype.write=function(t){return this._parser.write(t),!0},c.prototype.end=function(t){this._parser.end(t)},c.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},c.prototype._gamma=function(t){this.gamma=t},c.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},c.bitblt=function(t,e,r,n,i,o,a,s){if(r>t.width||n>t.height||r+i>t.width||n+o>t.height)throw new Error("bitblt reading outside image");if(a>e.width||s>e.height||a+i>e.width||s+o>e.height)throw new Error("bitblt writing outside image");for(var l=0;l0&&this._buffer.length;){var t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;this._reads.shift();var e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0}},{}],117:[function(t,e,r){var n,i,o=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(t){if(n===setTimeout)return setTimeout(t,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(t){n=a}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var c,u=[],f=!1,h=-1;function p(){f&&c&&(f=!1,c.length?u=c.concat(u):h=-1,u.length&&d())}function d(){if(!f){var t=l(p);f=!0;for(var e=u.length;e;){for(c=u,u=[];++h1)for(var r=1;r0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),n?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):w(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(e=a.decoder.write(e),a.objectMode||0!==e.length?w(t,a,e,!1):E(t,a)):w(t,a,e,!1))):n||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=k?t=k:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function B(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(C,t):C(t))}function C(t){p("emit readable"),t.emit("readable"),T(t)}function E(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(P,t,e))}function P(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;to.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=c.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function A(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(I,e,t))}function I(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?A(this):B(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&A(this),null;var n,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?M(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&A(this)),null!==n&&this.emit("data",n),n},y.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},y.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,e);var l=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?u:y;function c(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",g),t.removeListener("finish",_),t.removeListener("drain",f),t.removeListener("error",v),t.removeListener("unpipe",c),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",m),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){p("onend"),t.end()}o.endEmitted?i.nextTick(l):n.once("end",l),t.on("unpipe",c);var f=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,T(t))}}(n);t.on("drain",f);var h=!1;var d=!1;function m(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==R(o.pipes,t))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function v(e){p("onerror",e),y(),t.removeListener("error",v),0===s(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",_),y()}function _(){p("onfinish"),t.removeListener("close",g),y()}function y(){p("unpipe"),n.unpipe(t)}return n.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",v),t.once("close",g),t.once("finish",_),t.emit("pipe",n),o.flowing||(p("pipe resume"),n.resume()),t},y.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o-1?i:o.nextTick;_.WritableState=g;var c=t("core-util-is");c.inherits=t("inherits");var u={deprecate:t("util-deprecate")},f=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,p=n.Uint8Array||function(){};var d,m=t("./internal/streams/destroy");function v(){}function g(e,r){s=s||t("./_stream_duplex"),e=e||{};var n=r instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(B,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),B(t,e))}(t,r,n,e,i);else{var a=k(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),n?l(b,t,r,a,i):b(t,r,a,i)}}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function _(e){if(s=s||t("./_stream_duplex"),!(d.call(_,this)||this instanceof s))return new _(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function y(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function b(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),B(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var s=0,l=!0;r;)i[s]=r,r.isBuf||(l=!1),r=r.next,s+=1;i.allBuffers=l,y(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,u=r.encoding,f=r.callback;if(y(t,e,!1,e.objectMode?1:c.length,c,u,f),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function k(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),B(t,e)})}function B(t,e){var r=k(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(x,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}c.inherits(_,f),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===_&&(t&&t._writableState instanceof g)}})):d=function(t){return t instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(t,e,r){var n,i=this._writableState,a=!1,s=!i.objectMode&&(n=t,h.isBuffer(n)||n instanceof p);return s&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=v),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(s||function(t,e,r,n){var i=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(n,a),i=!1),i}(this,i,t,r))&&(i.pendingcb++,a=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var l=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,B(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{"./_stream_duplex":119,"./internal/streams/destroy":125,"./internal/streams/stream":126,_process:117,"core-util-is":14,inherits:70,"process-nextick-args":128,"safe-buffer":134,timers:142,"util-deprecate":148}],124:[function(t,e,r){"use strict";var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=o,i=s,e.copy(r,i),s+=a.data.length,a=a.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":134,util:4}],125:[function(t,e,r){"use strict";var n=t("process-nextick-args");function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n.nextTick(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":128}],126:[function(t,e,r){e.exports=t("events").EventEmitter},{events:48}],127:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],128:[function(t,e,r){(function(t){"use strict";!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(o=new Array(s-1),a=0;a>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function l(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function u(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}r.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":134}],130:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":131}],131:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":119,"./lib/_stream_passthrough.js":120,"./lib/_stream_readable.js":121,"./lib/_stream_transform.js":122,"./lib/_stream_writable.js":123}],132:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":131}],133:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":123}],134:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:47}],135:[function(t,e,r){arguments[4][67][0].apply(r,arguments)},{"./lib/decoder":136,"./lib/encoder":137,dup:67}],136:[function(t,e,r){(function(t){var r=function(){"use strict";var t=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),e=4017,r=799,n=3406,i=2276,o=1567,a=3784,s=5793,l=2896;function c(){}function u(t,e){for(var r,n,i=0,o=[],a=16;a>0&&!t[a-1];)a--;o.push({children:[],index:0});var s,l=o[0];for(r=0;r0;)l=o.pop();for(l.index++,o.push(l);o.length<=r;)o.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s;i++}r+10)return p>>--d&1;if(255==(p=e[r++])){var t=e[r++];if(t)throw"unexpected marker: "+(p<<8|t).toString(16)}return d=7,p>>>7}function v(t){for(var e,r=t;null!==(e=m());){if("number"==typeof(r=r[e]))return r;if("object"!=typeof r)throw"invalid huffman sequence"}return null}function g(t){for(var e=0;t>0;){var r=m();if(null===r)return;e=e<<1|r,t--}return e}function _(t){var e=g(t);return e>=1<0)y--;else for(var n=a,i=s;n<=i;){var o=v(e.huffmanTableAC),l=15&o,u=o>>4;if(0!==l)r[t[n+=u]]=_(l)*(1<>4,0===f)o<15?(y=g(o)+(1<>4;if(0!==s)r[t[o+=l]]=_(s),o++;else{if(l<15)break;o+=16}}};var M,A,I,R,L=0;for(A=1==T?i[0].blocksPerLine*i[0].blocksPerColumn:u*n.mcusPerColumn,o||(o=A);L=65488&&M<=65495))break;r+=2}return r-h}function h(t,c){var u,f,h=[],p=c.blocksPerLine,d=c.blocksPerColumn,m=p<<3,v=new Int32Array(64),g=new Uint8Array(64);function _(t,u,f){var h,p,d,m,v,g,_,y,b,w,k=c.quantizationTable,x=f;for(w=0;w<64;w++)x[w]=t[w]*k[w];for(w=0;w<8;++w){var B=8*w;0!=x[1+B]||0!=x[2+B]||0!=x[3+B]||0!=x[4+B]||0!=x[5+B]||0!=x[6+B]||0!=x[7+B]?(h=s*x[0+B]+128>>8,p=s*x[4+B]+128>>8,d=x[2+B],m=x[6+B],v=l*(x[1+B]-x[7+B])+128>>8,y=l*(x[1+B]+x[7+B])+128>>8,g=x[3+B]<<4,_=x[5+B]<<4,b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*a+m*o+128>>8,d=d*o-m*a+128>>8,m=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=y+g+1>>1,g=y-g+1>>1,y=b,b=h-m+1>>1,h=h+m+1>>1,m=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+y*n+2048>>12,v=v*n-y*i+2048>>12,y=b,b=g*r+_*e+2048>>12,g=g*e-_*r+2048>>12,_=b,x[0+B]=h+y,x[7+B]=h-y,x[1+B]=p+_,x[6+B]=p-_,x[2+B]=d+g,x[5+B]=d-g,x[3+B]=m+v,x[4+B]=m-v):(b=s*x[0+B]+512>>10,x[0+B]=b,x[1+B]=b,x[2+B]=b,x[3+B]=b,x[4+B]=b,x[5+B]=b,x[6+B]=b,x[7+B]=b)}for(w=0;w<8;++w){var C=w;0!=x[8+C]||0!=x[16+C]||0!=x[24+C]||0!=x[32+C]||0!=x[40+C]||0!=x[48+C]||0!=x[56+C]?(h=s*x[0+C]+2048>>12,p=s*x[32+C]+2048>>12,d=x[16+C],m=x[48+C],v=l*(x[8+C]-x[56+C])+2048>>12,y=l*(x[8+C]+x[56+C])+2048>>12,g=x[24+C],_=x[40+C],b=h-p+1>>1,h=h+p+1>>1,p=b,b=d*a+m*o+2048>>12,d=d*o-m*a+2048>>12,m=b,b=v-_+1>>1,v=v+_+1>>1,_=b,b=y+g+1>>1,g=y-g+1>>1,y=b,b=h-m+1>>1,h=h+m+1>>1,m=b,b=p-d+1>>1,p=p+d+1>>1,d=b,b=v*i+y*n+2048>>12,v=v*n-y*i+2048>>12,y=b,b=g*r+_*e+2048>>12,g=g*e-_*r+2048>>12,_=b,x[0+C]=h+y,x[56+C]=h-y,x[8+C]=p+_,x[48+C]=p-_,x[16+C]=d+g,x[40+C]=d-g,x[24+C]=m+v,x[32+C]=m-v):(b=s*f[w+0]+8192>>14,x[0+C]=b,x[8+C]=b,x[16+C]=b,x[24+C]=b,x[32+C]=b,x[40+C]=b,x[48+C]=b,x[56+C]=b)}for(w=0;w<64;++w){var E=128+(x[w]+8>>4);u[w]=E<0?0:E>255?255:E}}for(var y=0;y255?255:t}return c.prototype={load:function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){var t=new Uint8Array(e.response||e.mozResponseArrayBuffer);this.parse(t),this.onload&&this.onload()}.bind(this),e.send(null)},parse:function(e){var r=0;e.length;function n(){var t=e[r]<<8|e[r+1];return r+=2,t}function i(){var t=n(),i=e.subarray(r,r+t-2);return r+=i.length,i}function o(t){var e,r,n=0,i=0;for(r in t.components)t.components.hasOwnProperty(r)&&(n<(e=t.components[r]).h&&(n=e.h),i>4==0)for(_=0;_<64;_++){k[t[_]]=e[r++]}else{if(w>>4!=1)throw"DQT: invalid table spec";for(_=0;_<64;_++){k[t[_]]=n()}}p[15&w]=k}break;case 65472:case 65473:case 65474:n(),(a={}).extended=65473===g,a.progressive=65474===g,a.precision=e[r++],a.scanLines=n(),a.samplesPerLine=n(),a.components={},a.componentsOrder=[];var x,B=e[r++];for(U=0;U>4,E=15&e[r+1],P=e[r+2];a.componentsOrder.push(x),a.components[x]={h:C,v:E,quantizationTable:p[P]},r+=3}o(a),d.push(a);break;case 65476:var S=n();for(U=2;U>4==0?v:m)[15&j]=u(T,A)}break;case 65501:n(),s=n();break;case 65498:n();var I=e[r++],R=[];for(U=0;U>4],z.huffmanTableAC=m[15&L],R.push(z)}var O=e[r++],F=e[r++],D=e[r++],N=f(e,r,a,R,s,O,F,D>>4,15&D);r+=N;break;default:if(255==e[r-3]&&e[r-2]>=192&&e[r-2]<=254){r-=3;break}throw"unknown JPEG marker "+g.toString(16)}g=n()}if(1!=d.length)throw"only single frame JPEGs supported";this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=l,this.adobe=c,this.components=[];for(var U=0;U=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var n=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,n),n-=this.charReceived);var i;n=(e+=t.toString(this.encoding,0,n)).length-1;if((i=e.charCodeAt(n))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,n)}return e},o.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&r>>5==6){this.charLength=2;break}if(e<=2&&r>>4==14){this.charLength=3;break}if(e<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=e},o.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;e+=n.slice(0,r).toString(i)}return e}},{buffer:47}],141:[function(t,e,r){(function(r){var n=t("stream");function i(t,e,i){t=t||function(t){this.queue(t)},e=e||function(){this.queue(null)};var o=!1,a=!1,s=[],l=!1,c=new n;function u(){for(;s.length&&!c.paused;){var t=s.shift();if(null===t)return c.emit("end");c.emit("data",t)}}return c.readable=c.writable=!0,c.paused=!1,c.autoDestroy=!(i&&!1===i.autoDestroy),c.write=function(e){return t.call(this,e),!c.paused},c.queue=c.push=function(t){return l?c:(null===t&&(l=!0),s.push(t),u(),c)},c.on("end",function(){c.readable=!1,!c.writable&&c.autoDestroy&&r.nextTick(function(){c.destroy()})}),c.end=function(t){if(!o)return o=!0,arguments.length&&c.write(t),c.writable=!1,e.call(c),!c.readable&&c.autoDestroy&&c.destroy(),c},c.destroy=function(){if(!a)return a=!0,o=!0,s.length=0,c.writable=c.readable=!1,c.emit("close"),c},c.pause=function(){if(!c.paused)return c.paused=!0,c},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),u(),c.paused||c.emit("drain"),c},c}e.exports=i,i.through=i}).call(this,t("_process"))},{_process:117,stream:139}],142:[function(t,e,r){(function(e,n){var i=t("process/browser.js").nextTick,o=Function.prototype.apply,a=Array.prototype.slice,s={},l=0;function c(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new c(o.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new c(o.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r.setImmediate="function"==typeof e?e:function(t){var e=l++,n=!(arguments.length<2)&&a.call(arguments,1);return s[e]=!0,i(function(){s[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))}),e},r.clearImmediate="function"==typeof n?n:function(t){delete s[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":117,timers:142}],143:[function(t,e,r){r.isatty=function(){return!1},r.ReadStream=function(){throw new Error("tty.ReadStream is not implemented")},r.WriteStream=function(){throw new Error("tty.WriteStream is not implemented")}},{}],144:[function(t,e,r){(function(e,n){"use strict";var i=t("bit-twiddle"),o=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:o([32,0]),UINT16:o([32,0]),UINT32:o([32,0]),INT8:o([32,0]),INT16:o([32,0]),INT32:o([32,0]),FLOAT:o([32,0]),DOUBLE:o([32,0]),DATA:o([32,0]),UINT8C:o([32,0]),BUFFER:o([32,0])});var a="undefined"!=typeof Uint8ClampedArray,s=e.__TYPEDARRAY_POOL;s.UINT8C||(s.UINT8C=o([32,0])),s.BUFFER||(s.BUFFER=o([32,0]));var l=s.DATA,c=s.BUFFER;function u(t){if(t){var e=t.length||t.byteLength,r=i.log2(e);l[r].push(t)}}function f(t){t=i.nextPow2(t);var e=i.log2(t),r=l[e];return r.length>0?r.pop():new ArrayBuffer(t)}function h(t){return new Uint8Array(f(t),0,t)}function p(t){return new Uint16Array(f(2*t),0,t)}function d(t){return new Uint32Array(f(4*t),0,t)}function m(t){return new Int8Array(f(t),0,t)}function v(t){return new Int16Array(f(2*t),0,t)}function g(t){return new Int32Array(f(4*t),0,t)}function _(t){return new Float32Array(f(4*t),0,t)}function y(t){return new Float64Array(f(8*t),0,t)}function b(t){return a?new Uint8ClampedArray(f(t),0,t):h(t)}function w(t){return new DataView(f(t),0,t)}function k(t){t=i.nextPow2(t);var e=i.log2(t),r=c[e];return r.length>0?r.pop():new n(t)}r.free=function(t){if(n.isBuffer(t))c[i.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|i.log2(e);l[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){u(t.buffer)},r.freeArrayBuffer=u,r.freeBuffer=function(t){c[i.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return f(t);switch(e){case"uint8":return h(t);case"uint16":return p(t);case"uint32":return d(t);case"int8":return m(t);case"int16":return v(t);case"int32":return g(t);case"float":case"float32":return _(t);case"double":case"float64":return y(t);case"uint8_clamped":return b(t);case"buffer":return k(t);case"data":case"dataview":return w(t);default:return null}return null},r.mallocArrayBuffer=f,r.mallocUint8=h,r.mallocUint16=p,r.mallocUint32=d,r.mallocInt8=m,r.mallocInt16=v,r.mallocInt32=g,r.mallocFloat32=r.mallocFloat=_,r.mallocFloat64=r.mallocDouble=y,r.mallocUint8Clamped=b,r.mallocDataView=w,r.mallocBuffer=k,r.clearCache=function(){for(var t=0;t<32;++t)s.UINT8[t].length=0,s.UINT16[t].length=0,s.UINT32[t].length=0,s.INT8[t].length=0,s.INT16[t].length=0,s.INT32[t].length=0,s.FLOAT[t].length=0,s.DOUBLE[t].length=0,s.UINT8C[t].length=0,l[t].length=0,c[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":2,buffer:47,dup:20}],145:[function(t,e,r){(function(){var t=this,n=t._,i={},o=Array.prototype,a=Object.prototype,s=Function.prototype,l=o.push,c=o.slice,u=o.concat,f=a.toString,h=a.hasOwnProperty,p=o.forEach,d=o.map,m=o.reduce,v=o.reduceRight,g=o.filter,_=o.every,y=o.some,b=o.indexOf,w=o.lastIndexOf,k=Array.isArray,x=Object.keys,B=s.bind,C=function(t){return t instanceof C?t:this instanceof C?void(this._wrapped=t):new C(t)};void 0!==r?(void 0!==e&&e.exports&&(r=e.exports=C),r._=C):t._=C,C.VERSION="1.4.4";var E=C.each=C.forEach=function(t,e,r){if(null!=t)if(p&&t.forEach===p)t.forEach(e,r);else if(t.length===+t.length){for(var n=0,o=t.length;n2;if(null==t&&(t=[]),m&&t.reduce===m)return n&&(e=C.bind(e,n)),i?t.reduce(e,r):t.reduce(e);if(E(t,function(t,o,a){i?r=e.call(n,r,t,o,a):(r=t,i=!0)}),!i)throw new TypeError(P);return r},C.reduceRight=C.foldr=function(t,e,r,n){var i=arguments.length>2;if(null==t&&(t=[]),v&&t.reduceRight===v)return n&&(e=C.bind(e,n)),i?t.reduceRight(e,r):t.reduceRight(e);var o=t.length;if(o!==+o){var a=C.keys(t);o=a.length}if(E(t,function(s,l,c){l=a?a[--o]:--o,i?r=e.call(n,r,t[l],l,c):(r=t[l],i=!0)}),!i)throw new TypeError(P);return r},C.find=C.detect=function(t,e,r){var n;return S(t,function(t,i,o){if(e.call(r,t,i,o))return n=t,!0}),n},C.filter=C.select=function(t,e,r){var n=[];return null==t?n:g&&t.filter===g?t.filter(e,r):(E(t,function(t,i,o){e.call(r,t,i,o)&&(n[n.length]=t)}),n)},C.reject=function(t,e,r){return C.filter(t,function(t,n,i){return!e.call(r,t,n,i)},r)},C.every=C.all=function(t,e,r){e||(e=C.identity);var n=!0;return null==t?n:_&&t.every===_?t.every(e,r):(E(t,function(t,o,a){if(!(n=n&&e.call(r,t,o,a)))return i}),!!n)};var S=C.some=C.any=function(t,e,r){e||(e=C.identity);var n=!1;return null==t?n:y&&t.some===y?t.some(e,r):(E(t,function(t,o,a){if(n||(n=e.call(r,t,o,a)))return i}),!!n)};C.contains=C.include=function(t,e){return null!=t&&(b&&t.indexOf===b?-1!=t.indexOf(e):S(t,function(t){return t===e}))},C.invoke=function(t,e){var r=c.call(arguments,2),n=C.isFunction(e);return C.map(t,function(t){return(n?e:t[e]).apply(t,r)})},C.pluck=function(t,e){return C.map(t,function(t){return t[e]})},C.where=function(t,e,r){return C.isEmpty(e)?r?null:[]:C[r?"find":"filter"](t,function(t){for(var r in e)if(e[r]!==t[r])return!1;return!0})},C.findWhere=function(t,e){return C.where(t,e,!0)},C.max=function(t,e,r){if(!e&&C.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&C.isEmpty(t))return-1/0;var n={computed:-1/0,value:-1/0};return E(t,function(t,i,o){var a=e?e.call(r,t,i,o):t;a>=n.computed&&(n={value:t,computed:a})}),n.value},C.min=function(t,e,r){if(!e&&C.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&C.isEmpty(t))return 1/0;var n={computed:1/0,value:1/0};return E(t,function(t,i,o){var a=e?e.call(r,t,i,o):t;an||void 0===r)return 1;if(r>>1;r.call(n,t[s])=0})})},C.difference=function(t){var e=u.apply(o,c.call(arguments,1));return C.filter(t,function(t){return!C.contains(e,t)})},C.zip=function(){for(var t=c.call(arguments),e=C.max(C.pluck(t,"length")),r=new Array(e),n=0;n=0;r--)e=[t[r].apply(this,e)];return e[0]}},C.after=function(t,e){return t<=0?e():function(){if(--t<1)return e.apply(this,arguments)}},C.keys=x||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var r in t)C.has(t,r)&&(e[e.length]=r);return e},C.values=function(t){var e=[];for(var r in t)C.has(t,r)&&e.push(t[r]);return e},C.pairs=function(t){var e=[];for(var r in t)C.has(t,r)&&e.push([r,t[r]]);return e},C.invert=function(t){var e={};for(var r in t)C.has(t,r)&&(e[t[r]]=r);return e},C.functions=C.methods=function(t){var e=[];for(var r in t)C.isFunction(t[r])&&e.push(r);return e.sort()},C.extend=function(t){return E(c.call(arguments,1),function(e){if(e)for(var r in e)t[r]=e[r]}),t},C.pick=function(t){var e={},r=u.apply(o,c.call(arguments,1));return E(r,function(r){r in t&&(e[r]=t[r])}),e},C.omit=function(t){var e={},r=u.apply(o,c.call(arguments,1));for(var n in t)C.contains(r,n)||(e[n]=t[n]);return e},C.defaults=function(t){return E(c.call(arguments,1),function(e){if(e)for(var r in e)null==t[r]&&(t[r]=e[r])}),t},C.clone=function(t){return C.isObject(t)?C.isArray(t)?t.slice():C.extend({},t):t},C.tap=function(t,e){return e(t),t};var A=function(t,e,r,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof C&&(t=t._wrapped),e instanceof C&&(e=e._wrapped);var i=f.call(t);if(i!=f.call(e))return!1;switch(i){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var o=r.length;o--;)if(r[o]==t)return n[o]==e;r.push(t),n.push(e);var a=0,s=!0;if("[object Array]"==i){if(s=(a=t.length)==e.length)for(;a--&&(s=A(t[a],e[a],r,n)););}else{var l=t.constructor,c=e.constructor;if(l!==c&&!(C.isFunction(l)&&l instanceof l&&C.isFunction(c)&&c instanceof c))return!1;for(var u in t)if(C.has(t,u)&&(a++,!(s=C.has(e,u)&&A(t[u],e[u],r,n))))break;if(s){for(u in e)if(C.has(e,u)&&!a--)break;s=!a}}return r.pop(),n.pop(),s};C.isEqual=function(t,e){return A(t,e,[],[])},C.isEmpty=function(t){if(null==t)return!0;if(C.isArray(t)||C.isString(t))return 0===t.length;for(var e in t)if(C.has(t,e))return!1;return!0},C.isElement=function(t){return!(!t||1!==t.nodeType)},C.isArray=k||function(t){return"[object Array]"==f.call(t)},C.isObject=function(t){return t===Object(t)},E(["Arguments","Function","String","Number","Date","RegExp"],function(t){C["is"+t]=function(e){return f.call(e)=="[object "+t+"]"}}),C.isArguments(arguments)||(C.isArguments=function(t){return!(!t||!C.has(t,"callee"))}),"function"!=typeof/./&&(C.isFunction=function(t){return"function"==typeof t}),C.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},C.isNaN=function(t){return C.isNumber(t)&&t!=+t},C.isBoolean=function(t){return!0===t||!1===t||"[object Boolean]"==f.call(t)},C.isNull=function(t){return null===t},C.isUndefined=function(t){return void 0===t},C.has=function(t,e){return h.call(t,e)},C.noConflict=function(){return t._=n,this},C.identity=function(t){return t},C.times=function(t,e,r){for(var n=Array(t),i=0;i":">",'"':""","'":"'","/":"/"}};I.unescape=C.invert(I.escape);var R={escape:new RegExp("["+C.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+C.keys(I.unescape).join("|")+")","g")};C.each(["escape","unescape"],function(t){C[t]=function(e){return null==e?"":(""+e).replace(R[t],function(e){return I[t][e]})}}),C.result=function(t,e){if(null==t)return null;var r=t[e];return C.isFunction(r)?r.call(t):r},C.mixin=function(t){E(C.functions(t),function(e){var r=C[e]=t[e];C.prototype[e]=function(){var t=[this._wrapped];return l.apply(t,arguments),N.call(this,r.apply(C,t))}})};var L=0;C.uniqueId=function(t){var e=++L+"";return t?t+e:e},C.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,F={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;C.template=function(t,e,r){var n;r=C.defaults({},r,C.templateSettings);var i=new RegExp([(r.escape||O).source,(r.interpolate||O).source,(r.evaluate||O).source].join("|")+"|$","g"),o=0,a="__p+='";t.replace(i,function(e,r,n,i,s){return a+=t.slice(o,s).replace(D,function(t){return"\\"+F[t]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),n&&(a+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),i&&(a+="';\n"+i+"\n__p+='"),o=s+e.length,e}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{n=new Function(r.variable||"obj","_",a)}catch(t){throw t.source=a,t}if(e)return n(e,C);var s=function(t){return n.call(this,t,C)};return s.source="function("+(r.variable||"obj")+"){\n"+a+"}",s},C.chain=function(t){return C(t).chain()};var N=function(t){return this._chain?C(t).chain():t};C.mixin(C),E(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=o[t];C.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!=t&&"splice"!=t||0!==r.length||delete r[0],N.call(this,r)}}),E(["concat","join","slice"],function(t){var e=o[t];C.prototype[t]=function(){return N.call(this,e.apply(this._wrapped,arguments))}}),C.extend(C.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],146:[function(t,e,r){"use strict";e.exports=function(t,e,r){return 0===t.length?t:e?(r||t.sort(e),function(t,e){for(var r=1,n=t.length,i=t[0],o=t[0],a=1;a=a?l+1:a}n.mkdir(e+"sequencer"+a,function(){var o=e+"sequencer"+a+"/";for(var s in r.images){var l=r.images[s].steps;if(i){var c=l.slice(-1)[0].output.src,u=l.slice(-1)[0].output.format,f=t("data-uri-to-buffer")(c);n.writeFile(o+s+"_"+(l.length-1)+"."+u,f,function(){})}else for(var h in l){c=l[h].output.src,u=l[h].output.format,f=t("data-uri-to-buffer")(c);n.writeFile(o+s+"_"+h+"."+u,f,function(){})}}})},n.readdir(u,function(t,e){var r=[];if(void 0===e||0==e.length)return f(r),[];for(var i=0;i0&&(thisStep=u[t].steps[e],thisStep.UI.onRemove(thisStep.options.step),u[t].steps.splice(e,1))}function m(){var e=[],r=this;for(var n in arguments)e.push(a(arguments[n]));var i=c.call(this,e,"l");f.push({method:"loadImages",json_q:a(i)});var o=this.copy(i.loadedimages),s={name:"ImageSequencer Wrapper",sequencer:this,addSteps:this.addSteps,removeSteps:this.removeSteps,insertSteps:this.insertSteps,run:this.run,UI:this.UI,setUI:this.setUI,images:o};!function e(n){if(n!=o.length){var a=o[n];t("./ui/LoadImage")(r,a,i.images[a],function(){e(++n)})}else i.callback.call(s)}(0)}function v(t){var e={};if("load-image"==t)return{};if(0==arguments.length){for(var r in this.modules)e[r]=s[r][1];for(var n in this.sequences)e[n]={name:n,steps:this.sequences[n]}}else e=s[t]?s[t][1]:{inputs:l[t].options};return e}function g(t){let e=v(t.options.name).inputs||{},r={};for(let n in e)t.options[n]&&t.options[n]!=e[n].default&&(r[n]=t.options[n],r[n]=encodeURIComponent(r[n]));var n=Object.keys(r).map(t=>t+":"+r[t]).join("|");return`${t.options.name}{${n}}`}function _(t){let e;return(e=t.includes(",")?t.split(","):[t]).map(y)}function y(t){var e;if(e=t.includes("{")?t.includes("(")&&t.indexOf("(")=e.images[l].steps.length?{options:{name:void 0}}:e.images[l].steps.slice(f+t)[0]},e.images[l].steps[f].getIndex=function(){return f},n)n.hasOwnProperty(p)&&(e.images[l].steps[f][p]=n[p]);e.images[l].steps[f].UI.onDraw(e.images[l].steps[f].options.step);var d=t("./RunToolkit")(e.copy(h));e.images[l].steps[f].draw(d,function(){e.images[l].steps[f].options.step.output=e.images[l].steps[f].output.src,e.images[l].steps[f].UI.onComplete(e.images[l].steps[f].options.step),r(o,++s)},a)}}(s,o)}(r=function(t){for(var r in t)0==t[r]&&1==e.images[r].steps.length?delete t[r]:0==t[r]&&t[r]++;for(var r in t)for(var n=e.images[r].steps[t[r]-1];void 0===n||void 0===n.output;)n=e.images[r].steps[--t[r]-1];return t}(r))}},{"./RunToolkit":159,"./util/getStep.js":255}],159:[function(t,e,r){const n=t("get-pixels"),i=t("./modules/_nomodule/PixelManipulation"),o=t("lodash"),a=t("data-uri-to-buffer"),s=t("save-pixels");e.exports=function(t){return t.getPixels=n,t.pixelManipulation=i,t.lodash=o,t.dataUriToBuffer=a,t.savePixels=s,t}},{"./modules/_nomodule/PixelManipulation":249,"data-uri-to-buffer":19,"get-pixels":29,lodash:75,"save-pixels":138}],160:[function(t,e,r){e.exports={sample:[{name:"invert",options:{}},{name:"channel",options:{channel:"red"}},{name:"blur",options:{blur:"5"}}]}},{}],161:[function(t,e,r){e.exports=function(e,r){return e.blur=e.blur||2,e.step.metadata=e.step.metadata||{},{options:e,draw:function(r,n,i){i.stop(!0),i.overrideFlag=!0;var o=this;return t("../_nomodule/PixelManipulation.js")(r,{output:function(t,e,r){o.output={src:e,format:r}},changePixel:function(t,e,r,n){return[t,e,r,n]},extraManipulation:function(t){for(var r=[0,0,0,0],n=0;nAverages (r, g, b, a): "+r.join(", ")+"

"),t},format:r.format,image:e.image,callback:n})},output:void 0,UI:r}}},{"../_nomodule/PixelManipulation.js":249}],162:[function(t,e,r){e.exports=[t("./Module"),t("./info.json")]},{"./Module":161,"./info.json":163}],163:[function(t,e,r){e.exports={name:"Average",description:"Average all pixel color",inputs:{},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],164:[function(require,module,exports){module.exports=function Dynamic(options,UI,util){var output;function draw(input,callback,progressObj){progressObj.stop(!0),progressObj.overrideFlag=!0;var step=this;"string"==typeof options.func&&eval("options.func = "+options.func);var getPixels=require("get-pixels");"string"==typeof options.offset&&(options.offset=parseInt(options.offset));var priorStep=this.getStep(options.offset);getPixels(priorStep.output.src,function(t,e){return options.firstImagePixels=e,require("../_nomodule/PixelManipulation.js")(input,{output:function(t,e,r){step.output={src:e,format:r}},changePixel:function(t,e,r,n,i,o){var a=options.firstImagePixels;return options.func(t,e,r,n,a.get(i,o,0),a.get(i,o,1),a.get(i,o,2),a.get(i,o,3))},format:input.format,image:options.image,inBrowser:options.inBrowser,callback:callback})})}return options.func=options.func||"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }",options.offset=options.offset||-2,{options:options,draw:draw,output:output,UI:UI}}},{"../_nomodule/PixelManipulation.js":249,"get-pixels":29}],165:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":164,"./info.json":166,dup:162}],166:[function(t,e,r){e.exports={name:"Blend",description:"Blend two chosen image steps with the given function. Defaults to using the red channel from image 1 and the green and blue and alpha channels of image 2. Easier to use interfaces coming soon!",inputs:{offset:{type:"integer",desc:"Choose which image to blend the current image with. Two steps back is -2, three steps back is -3 etc.",default:-2},blend:{type:"input",desc:"Function to use to blend the two images.",default:"function(r1, g1, b1, a1, r2, g2, b2, a2) { return [ r1, g2, b2, a2 ] }"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],167:[function(t,e,r){e.exports=function(t,e){let r=[[2/159,4/159,5/159,4/159,2/159],[4/159,9/159,12/159,9/159,4/159],[5/159,12/159,15/159,12/159,5/159],[4/159,9/159,12/159,9/159,4/159],[2/159,4/159,5/159,4/159,2/159]],n=t;r=function(t){let e=[];for(let r=t.length-1;r>=0;r--){let n=[];for(let e=t[r].length-1;e>=0;e--)n.push(t[r][e]);e.push(n)}return e}(r);for(let e=0;em;r=0<=m?++u:--u)n[r]=(e-i)/(o-i)*(l[r]-s[r])+s[r];return n}}e.exports=function(t,e){return e.colormap=e.colormap||i.default,"object"==typeof e.colormap?colormapFunction=n(e.colormap):i.hasOwnProperty(e.colormap)?colormapFunction=i[e.colormap]:colormapFunction=i.default,colormapFunction(t/255)};var i={greyscale:n([[0,[0,0,0],[255,255,255]],[1,[255,255,255],[255,255,255]]]),bluwhtgrngis:n([[0,[6,23,86],[6,25,84]],[.0625,[6,25,84],[6,25,84]],[.125,[6,25,84],[6,25,84]],[.1875,[6,25,84],[6,25,84]],[.25,[6,25,84],[6,25,84]],[.3125,[6,25,84],[9,24,84]],[.3438,[9,24,84],[119,120,162]],[.375,[119,129,162],[249,250,251]],[.406,[249,250,251],[255,255,255]],[.4375,[255,255,255],[255,255,255]],[.5,[255,255,255],[214,205,191]],[.52,[214,205,191],[178,175,96]],[.5625,[178,175,96],[151,176,53]],[.593,[151,176,53],[146,188,12]],[.625,[146,188,12],[96,161,1]],[.6875,[96,161,1],[30,127,3]],[.75,[30,127,3],[0,99,1]],[.8125,[0,99,1],[0,74,1]],[.875,[0,74,1],[0,52,0]],[.9375,[0,52,0],[0,34,0]],[.968,[0,34,0],[68,70,67]]]),brntogrn:n([[0,[110,12,3],[118,6,1]],[.0625,[118,6,1],[141,19,6]],[.125,[141,19,6],[165,35,13]],[.1875,[165,35,13],[177,59,25]],[.2188,[177,59,25],[192,91,36]],[.25,[192,91,36],[214,145,76]],[.3125,[214,145,76],[230,183,134]],[.375,[230,183,134],[243,224,194]],[.4375,[243,224,194],[250,252,229]],[.5,[250,252,229],[217,235,185]],[.5625,[217,235,185],[184,218,143]],[.625,[184,218,143],[141,202,89]],[.6875,[141,202,89],[80,176,61]],[.75,[80,176,61],[0,147,32]],[.8125,[0,147,32],[1,122,22]],[.875,[1,122,22],[0,114,19]],[.9,[0,114,19],[0,105,18]],[.9375,[0,105,18],[7,70,14]]]),blutoredjet:n([[0,[0,0,140],[1,1,186]],[.0625,[1,1,186],[0,1,248]],[.125,[0,1,248],[0,70,254]],[.1875,[0,70,254],[0,130,255]],[.25,[0,130,255],[2,160,255]],[.2813,[2,160,255],[0,187,255]],[.3125,[0,187,255],[6,250,255]],[.375,[8,252,251],[27,254,228]],[.406,[27,254,228],[70,255,187]],[.4375,[70,255,187],[104,254,151]],[.47,[104,254,151],[132,255,19]],[.5,[132,255,19],[195,255,60]],[.5625,[195,255,60],[231,254,25]],[.5976,[231,254,25],[253,246,1]],[.625,[253,246,1],[252,210,1]],[.657,[252,210,1],[255,183,0]],[.6875,[255,183,0],[255,125,2]],[.75,[255,125,2],[255,65,1]],[.8125,[255,65,1],[247,1,1]],[.875,[247,1,1],[200,1,3]],[.9375,[200,1,3],[122,3,2]]]),colors16:n([[0,[0,0,0],[0,0,0]],[.0625,[3,1,172],[3,1,172]],[.125,[3,1,222],[3,1,222]],[.1875,[0,111,255],[0,111,255]],[.25,[3,172,255],[3,172,255]],[.3125,[1,226,255],[1,226,255]],[.375,[2,255,0],[2,255,0]],[.4375,[198,254,0],[190,254,0]],[.5,[252,255,0],[252,255,0]],[.5625,[255,223,3],[255,223,3]],[.625,[255,143,3],[255,143,3]],[.6875,[255,95,3],[255,95,3]],[.75,[242,0,1],[242,0,1]],[.8125,[245,0,170],[245,0,170]],[.875,[223,180,225],[223,180,225]],[.9375,[255,255,255],[255,255,255]]]),default:n([[0,[45,1,121],[25,1,137]],[.125,[25,1,137],[0,6,156]],[.1875,[0,6,156],[7,41,172]],[.25,[7,41,172],[22,84,187]],[.3125,[22,84,187],[25,125,194]],[.375,[25,125,194],[26,177,197]],[.4375,[26,177,197],[23,199,193]],[.47,[23,199,193],[25,200,170]],[.5,[25,200,170],[21,209,27]],[.5625,[21,209,27],[108,215,18]],[.625,[108,215,18],[166,218,19]],[.6875,[166,218,19],[206,221,20]],[.75,[206,221,20],[222,213,19]],[.7813,[222,213,19],[222,191,19]],[.8125,[222,191,19],[227,133,17]],[.875,[227,133,17],[231,83,16]],[.9375,[231,83,16],[220,61,48]]]),fastie:n([[0,[255,255,255],[0,0,0]],[.167,[0,0,0],[255,255,255]],[.33,[255,255,255],[0,0,0]],[.5,[0,0,0],[140,140,255]],[.55,[140,140,255],[0,255,0]],[.63,[0,255,0],[255,255,0]],[.75,[255,255,0],[255,0,0]],[.95,[255,0,0],[255,0,255]]]),stretched:n([[0,[0,0,255],[0,0,255]],[.1,[0,0,255],[38,195,195]],[.5,[0,150,0],[255,255,0]],[.7,[255,255,0],[255,50,50]],[.9,[255,50,50],[255,50,50]]])}},{}],181:[function(t,e,r){e.exports=function(e,r){return{options:e,draw:function(r,n,i){i.stop(!0),i.overrideFlag=!0;var o=this;return t("../_nomodule/PixelManipulation.js")(r,{output:function(t,e,r){o.output={src:e,format:r}},changePixel:function(r,n,i,o){var a=(r+n+i)/3,s=t("./Colormap")(a,e);return[s[0],s[1],s[2],255]},format:r.format,image:e.image,inBrowser:e.inBrowser,callback:n})},output:void 0,UI:r}}},{"../_nomodule/PixelManipulation.js":249,"./Colormap":180}],182:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":181,"./info.json":183,dup:162}],183:[function(t,e,r){e.exports={name:"Colormap",description:"Maps brightness values (average of red, green & blue) to a given color lookup table, made up of a set of one more color gradients.\n\nFor example, 'cooler' colors like blue could represent low values, while 'hot' colors like red could represent high values.",inputs:{colormap:{type:"select",desc:"Name of the Colormap",default:"default",values:["default","greyscale","bluwhtgrngis","stretched","fastie","brntogrn","blutoredjet","colors16"]}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],184:[function(t,e,r){var n=t("lodash");e.exports=function(t,e){let r=n.cloneDeep(t);(e=Number(e))<-100&&(e=-100),e>100&&(e=100),e=(100+e)/100,e*=e;for(let n=0;n255&&(i=255);var o=r.get(n,s,1)/255;o-=.5,o*=e,o+=.5,(o*=255)<0&&(o=0),o>255&&(o=255);var a=r.get(n,s,2)/255;a-=.5,a*=e,a+=.5,(a*=255)<0&&(a=0),a>255&&(a=255),t.set(n,s,0,i),t.set(n,s,1,o),t.set(n,s,2,a)}return t}},{lodash:75}],185:[function(t,e,r){e.exports=function(e,r){return e.contrast=e.contrast||70,{options:e,draw:function(r,n,i){i.stop(!0),i.overrideFlag=!0;var o=this;return t("../_nomodule/PixelManipulation.js")(r,{output:function(t,e,r){o.output={src:e,format:r}},changePixel:function(t,e,r,n){return[t,e,r,n]},extraManipulation:function(r){return r=t("./Contrast")(r,e.contrast)},format:r.format,image:e.image,callback:n})},output:void 0,UI:r}}},{"../_nomodule/PixelManipulation.js":249,"./Contrast":184}],186:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":185,"./info.json":187,dup:162}],187:[function(t,e,r){e.exports={name:"Contrast",description:"Change the contrast of the image by given value",inputs:{contrast:{type:"range",desc:"contrast for the new image, typically -100 to 100",default:"70",min:"-100",max:"100",step:"1"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],188:[function(t,e,r){var n=t("lodash");e.exports=function(t,e,r){let o=function(t,e){for(e=e.split(" "),i=0;i<9;i++)e[i]=Number(e[i])*t;let r=0,n=[];for(i=0;i<3;i++){let t=[];for(j=0;j<3;j++)t.push(e[r]),r+=1;n.push(t)}return n}(e,r),a=n.cloneDeep(t);o=function(t){let e=[];for(let r=t.length-1;r>=0;r--){let n=[];for(let e=t[r].length-1;e>=0;e--)n.push(t[r][e]);e.push(n)}return e}(o);for(let e=0;eRead more",inputs:{constantFactor:{type:"Float",desc:"a constant factor, multiplies all the kernel values by that factor",default:.1111,placeholder:.1111},kernelValues:{type:"String",desc:"nine space separated numbers representing the kernel values in left to right and top to bottom format.",default:"1 1 1 1 1 1 1 1 1",placeholder:"1 1 1 1 1 1 1 1 1"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],192:[function(t,e,r){(function(r){e.exports=function(e,n,i){var o=t("get-pixels"),a=t("save-pixels");n.x=parseInt(n.x)||0,n.y=parseInt(n.y)||0,o(e.src,function(t,o){n.w=parseInt(n.w)||Math.floor(o.shape[0]),n.h=parseInt(n.h)||Math.floor(o.shape[1]),n.backgroundColor=n.backgroundColor||"255 255 255 255";var s=n.x,l=n.y,c=n.w,u=n.h,f=o.shape[0],h=o.shape[1],p=[];backgroundColor=n.backgroundColor.split(" ");for(var d=0;dInfragrammar.",inputs:{red:{type:"input",desc:"Expression to return for red channel with R, G, B, and A inputs",default:"r"},green:{type:"input",desc:"Expression to return for green channel with R, G, B, and A inputs",default:"g"},blue:{type:"input",desc:"Expression to return for blue channel with R, G, B, and A inputs",default:"b"},"monochrome (fallback)":{type:"input",desc:"Expression to return with R, G, B, and A inputs; fallback for other channels if none provided",default:"r + g + b"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],207:[function(t,e,r){t("lodash");const n=[[-1,0,1],[-2,0,2],[-1,0,1]],i=[[-1,-2,-1],[0,0,0],[1,2,1]];function o(t,e,r,o,a){let s=0;for(let e=0;e<3;e++)for(let r=0;r<3;r++){let i=o+e-1,l=a+r-1;s+=t.get(i,l,0)*n[e][r]}let l=0;for(let e=0;e<3;e++)for(let r=0;r<3;r++){let n=o+e-1,s=a+r-1;l+=t.get(n,s,0)*i[e][r]}return{pixel:[e,e,e,Math.sqrt(Math.pow(s,2)+Math.pow(l,2))],angle:Math.atan2(l,s)}}e.exports=function(t,e,r,n){let i=[],l=[];for(var c=0;ct.map(a));for(let n=1;n=-22.5&&o<=22.5||o<-157.5&&o>=-180?e[n][i]>=e[n][i+1]&&e[n][i]>=e[n][i-1]?t.set(n,i,3,e[n][i]):t.set(n,i,3,0):o>=22.5&&o<=67.5||o<-112.5&&o>=-157.5?e[n][i]>=e[n+1][i+1]&&e[n][i]>=e[n-1][i-1]?t.set(n,i,3,e[n][i]):t.set(n,i,3,0):o>=67.5&&o<=112.5||o<-67.5&&o>=-112.5?e[n][n]>=e[n+1][i]&&e[n][i]>=e[n][i]?t.set(n,i,3,e[n][i]):t.set(n,i,3,0):(o>=112.5&&o<=157.5||o<-22.5&&o>=-67.5)&&(e[n][i]>=e[n+1][i-1]&&e[n][i]>=e[n-1][i+1]?t.set(n,i,3,e[n][i]):t.set(n,i,3,0))}}(t,l,i),function(t,e,r,n,i,o){const a=s(n)*e,l=a*r;for(let e=0;el?n[e][r]>a?i.push(s):o.push(s):t.set(e,r,3,0)}i.forEach(e=>t.set(e[0],e[1],3,255))}(t,e,r,l,[],[]),t};var a=t=>180*t/Math.PI,s=t=>Math.max(...t.map(t=>t.map(t=>t||0)).map(t=>Math.max(...t)))},{lodash:75}],208:[function(t,e,r){e.exports=function(e,r){return e.blur=e.blur||2,e.highThresholdRatio=e.highThresholdRatio||.2,e.lowThresholdRatio=e.lowThresholdRatio||.15,{options:e,draw:function(r,n,i){i.stop(!0),i.overrideFlag=!0;var o=this;return t("../_nomodule/PixelManipulation.js")(r,{output:function(t,e,r){o.output={src:e,format:r}},changePixel:function(t,e,r,n){return[(t+e+r)/3,(t+e+r)/3,(t+e+r)/3,n]},extraManipulation:function(r){return r=t("ndarray-gaussian-filter")(r,e.blur),r=t("./EdgeUtils")(r,e.highThresholdRatio,e.lowThresholdRatio,e.inBrowser)},format:r.format,image:e.image,inBrowser:e.inBrowser,callback:n})},output:void 0,UI:r}}},{"../_nomodule/PixelManipulation.js":249,"./EdgeUtils":207,"ndarray-gaussian-filter":80}],209:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":208,"./info.json":210,dup:162}],210:[function(t,e,r){e.exports={name:"Detect Edges",description:"This module detects edges using the Canny method, which first Gaussian blurs the image to reduce noise (amount of blur configurable in settings as `options.blur`), then applies a number of steps to highlight edges, resulting in a greyscale image where the brighter the pixel, the stronger the detected edge. Read more. ",inputs:{blur:{type:"range",desc:"Amount of gaussian blur(Less blur gives more detail, typically 0-5)",default:"2",min:"0",max:"5",step:"0.25"},highThresholdRatio:{type:"float",desc:"The high threshold ratio for the image",default:.2},lowThresholdRatio:{type:"float",desc:"The low threshold value for the image",default:.15}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],211:[function(t,e,r){e.exports=function(e,r){return t("fisheyegl"),{options:e,draw:function(t,r){var n=this;if(e.inBrowser){if(document.querySelector("#image-sequencer-canvas"))var i=document.querySelector("#image-sequencer-canvas");else(i=document.createElement("canvas")).style.display="none",i.setAttribute("id","image-sequencer-canvas"),document.body.append(i);distorter=FisheyeGl({selector:"#image-sequencer-canvas"}),e.a=parseFloat(e.a)||distorter.lens.a,e.b=parseFloat(e.b)||distorter.lens.b,e.Fx=parseFloat(e.Fx)||distorter.lens.Fx,e.Fy=parseFloat(e.Fy)||distorter.lens.Fy,e.scale=parseFloat(e.scale)||distorter.lens.scale,e.x=parseFloat(e.x)||distorter.fov.x,e.y=parseFloat(e.y)||distorter.fov.y,distorter.lens.a=e.a,distorter.lens.b=e.b,distorter.lens.Fx=e.Fx,distorter.lens.Fy=e.Fy,distorter.lens.scale=e.scale,distorter.fov.x=e.x,distorter.fov.y=e.y,distorter.setImage(t.src,function(){n.output={src:i.toDataURL(),format:t.format},r()})}else this.output=t,r()},output:void 0,UI:r}}},{fisheyegl:21}],212:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":211,"./info.json":213,dup:162}],213:[function(t,e,r){e.exports={name:"Fisheye GL",description:"Correct fisheye, or barrel distortion, in images (with WebGL -- adapted from fisheye-correction-webgl by @bluemir).",requires:["webgl"],inputs:{a:{type:"float",desc:"a parameter",default:1,min:1,max:4},b:{type:"float",desc:"b parameter",default:1,min:1,max:4},Fx:{type:"float",desc:"Fx parameter",default:0,min:0,max:4},Fy:{type:"float",desc:"Fy parameter",default:0,min:0,max:4},scale:{type:"float",desc:"Image Scaling",default:1.5,min:0,max:20},x:{type:"float",desc:"FOV x parameter",default:1.5,min:0,max:20},y:{type:"float",desc:"FOV y parameter",default:1.5,min:0,max:20},fragmentSrc:{type:"PATH",desc:"Path to a WebGL fragment shader file",default:"(inbuilt)"},vertexSrc:{type:"PATH",desc:"Path to a WebGL vertex shader file",default:"(inbuilt)"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],214:[function(t,e,r){e.exports=function(e,r){return{options:e,draw:function(r,n,i){i.stop(!0),i.overrideFlag=!0;var o=this;return t("../_nomodule/PixelManipulation.js")(r,{output:function(t,e,r){o.output={src:e,format:r}},changePixel:function(t,r,n,i){var o=e.adjustment||.2;return[t=255*Math.pow(t/255,o),r=255*Math.pow(r/255,o),n=255*Math.pow(n/255,o),i]},format:r.format,image:e.image,inBrowser:e.inBrowser,callback:n})},output:void 0,UI:r}}},{"../_nomodule/PixelManipulation.js":249}],215:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":214,"./info.json":216,dup:162}],216:[function(t,e,r){e.exports={name:"Gamma Correction",description:"Apply gamma correction on the image Read more",inputs:{adjustment:{type:"float",desc:"gamma correction (inverse of actual gamma factor) for the new image",default:.2}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],217:[function(t,e,r){(function(r){e.exports=function(e,n){return{options:e,draw:function(e,n,i){var o=t("get-pixels"),a=t("save-pixels"),s=this;o(e.src,function(t,i){if(t)console.log("Bad Image path");else{for(var o=0,l=0;l

Select or drag in an image to overlay.

';$(t.ui).find(".details").prepend(i),sequencer.setInputStep({dropZoneSelector:"#"+n,fileInputSelector:"#"+n+" .file-input",onLoad:function(e){var r=e.target;t.options.imageUrl=r.result,t.options.url=r.result,sequencer.run(),setUrlHashParameter("steps",sequencer.toString())}}),$(t.ui).find(".btn-save").on("click",function(){var e=$(t.ui).find(".det input").val();t.options.imageUrl=e,sequencer.run()})}}}},{}],225:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":223,"./info.json":226,dup:162}],226:[function(t,e,r){e.exports={name:"Import Image",description:"Import a new image and replace the original with it. Future versions may enable a blend mode. Specify an image by URL or by file selector.",url:"https://github.com/publiclab/image-sequencer/tree/master/MODULES.md",inputs:{url:{type:"string",desc:"URL of image to import",default:"./images/monarch.png"}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],227:[function(t,e,r){e.exports=function(e,r){if(e.step.inBrowser)var n=t("./Ui.js")(e.step,r);return e.filter=e.filter||"red",{options:e,draw:function(r,i,o){o.stop(!0),o.overrideFlag=!0;var a=this;return t("../_nomodule/PixelManipulation.js")(r,{output:function(t,e,r){a.output={src:e,format:r}},changePixel:function(t,r,n,i){if("red"==e.filter)var o=(n-t)/(1*n+t);"blue"==e.filter&&(o=(t-n)/(1*n+t));var a=255*(o+1)/2;return[a,a,a,i]},format:r.format,image:e.image,inBrowser:e.inBrowser,callback:function(){e.step.inBrowser&&n.setup(),i()}})},output:void 0,UI:r}}},{"../_nomodule/PixelManipulation.js":249,"./Ui.js":228}],228:[function(t,e,r){e.exports=function(t,e){return{setup:function(){var e=$(t.imgElement);e.mousemove(function(t){var r=document.createElement("canvas");r.width=e.width(),r.height=e.height(),r.getContext("2d").drawImage(this,0,0);var n=$(this).offset(),i=t.pageX-n.left,o=t.pageY-n.top,a=r.getContext("2d").getImageData(i,o,1,1).data[0];a=(a=a/127.5-1).toFixed(2),e[0].title="NDVI: "+a})}}}},{}],229:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":227,"./info.json":230,dup:162}],230:[function(t,e,r){e.exports={name:"NDVI",description:"Normalized Difference Vegetation Index, or NDVI, is an image analysis technique used with aerial photography. It's a way to visualize the amounts of infrared and other wavelengths of light reflected from vegetation by comparing ratios of blue and red light absorbed versus green and IR light reflected. NDVI is used to evaluate the health of vegetation in satellite imagery, where it correlates with how much photosynthesis is happening. This is helpful in assessing vegetative health or stress. Read more.

This is designed for use with red-filtered single camera DIY Infragram cameras; change to 'blue' for blue filters",inputs:{filter:{type:"select",desc:"Filter color",default:"red",values:["red","blue"]}},"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],231:[function(t,e,r){e.exports=function(){return this.expandSteps([{name:"ndvi",options:{}},{name:"colormap",options:{}}]),{isMeta:!0}}},{}],232:[function(t,e,r){arguments[4][162][0].apply(r,arguments)},{"./Module":231,"./info.json":233,dup:162}],233:[function(t,e,r){e.exports={name:"NDVI-Colormap",description:"Sequentially Applies NDVI and Colormap steps",inputs:{},length:2,"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md"}},{}],234:[function(t,e,r){e.exports=function(e,r,n){return e.x=e.x||0,e.y=e.y||0,{options:e,draw:function(r,n,i){e.offset=e.offset||-2,i.stop(!0),i.overrideFlag=!0;var o=this;t("../../util/ParseInputCoordinates")(e,{src:r.src,x:{valInp:e.x,type:"horizontal"},y:{valInp:e.y,type:"vertical"}},function(t,e){t.x=parseInt(e.x.valInp),t.y=parseInt(e.y.valInp)});var a=this.getStep(e.offset).image,s=this.getOutput(e.offset);t("get-pixels")(r.src,function(r,i){return e.secondImagePixels=i,t("../_nomodule/PixelManipulation.js")(s,{output:function(t,e,r){o.output={src:e,format:r}},changePixel:function(t,r,n,i,o,a){var s=e.secondImagePixels;return o>=e.x&&o=e.y&&a"40000"?"40000":e.temperature,i.stop(!0),i.overrideFlag=!0;var o=this;return t("../_nomodule/PixelManipulation.js")(r,{output:function(t,e,r){o.output={src:e,format:r}},changePixel:function(t,e,r,n){return[t,e,r,n]},extraManipulation:function(t){let r,n,i,o=parseInt(e.temperature);(o/=100)<=66?(r=255,n=Math.min(Math.max(99.4708025861*Math.log(o)-161.1195681661,0),255)):(r=Math.min(Math.max(329.698727446*Math.pow(o-60,-.1332047592),0),255),n=Math.min(Math.max(288.1221695283*Math.pow(o-60,-.0755148492),0),255)),o>=66?i=255:o<=19?i=0:(i=o-10,i=Math.min(Math.max(138.5177312231*Math.log(i)-305.0447927307,0),255));for(let e=0;e
To work with a new or different image, drag one into the drop zone.",ID:e.options.sequencerCounter++,imageName:t,inBrowser:e.options.inBrowser,ui:e.options.ui},a={src:r,steps:[{options:{id:n.ID,name:"load-image",description:"This initial step loads and displays the original image without any modifications.",title:"Load Image",step:n},UI:e.events,draw:function(){return UI.onDraw(options.step),1==arguments.length?(this.output=o(arguments[0]),options.step.output=this.output,UI.onComplete(options.step),!0):2==arguments.length&&(this.output=o(arguments[0]),options.step.output=this.output,arguments[1](),UI.onComplete(options.step),!0)}}]};o(r,function(r){var n=function(t){return{src:t,format:t.split(":")[1].split(";")[0].split("/")[1]}}(r);e.images[t]=a;var o=e.images[t].steps[0];return o.output=n,o.options.step.output=o.output.src,o.UI.onSetup(o.options.step),o.UI.onDraw(o.options.step),o.UI.onComplete(o.options.step),i(),!0})}(r,n)}},{urify:147}],251:[function(t,e,r){e.exports=function(){return function(t){var e=$(t.dropZoneSelector),r=$(t.fileInputSelector),n=$(t.takePhotoSelector),i=t.onLoad;function o(t){if(t.preventDefault(),t.stopPropagation(),t.target&&t.target.files)var e=t.target.files[0];else e=t.dataTransfer.files[0];if(e){var r=new FileReader;r.onload=i,r.readAsDataURL(e)}}t.onTakePhoto,new FileReader,r.on("change",o),n.on("click",function(){document.getElementById("video").style.display="inline",document.getElementById("capture").style.display="inline",document.getElementById("close").style.display="inline";var e=document.getElementById("video");canvas=document.getElementById("canvas"),context=canvas.getContext("2d"),vendorUrl=window.URL||window.webkitURL,navigator.getMedia=navigator.getUserMedia||navigator.wekitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getMedia({video:!0,audio:!1},function(t){e.srcObject=t,e.onloadedmetadata=function(t){e.play()},document.getElementById("close").addEventListener("click",function(){!function(t){t.getVideoTracks().forEach(function(t){t.stop()}),document.getElementById("video").style.display="none",document.getElementById("capture").style.display="none",document.getElementById("close").style.display="none"}(t)})},function(t){console.log("error")}),document.getElementById("capture").addEventListener("click",function(r){context.drawImage(e,0,0,400,300),t.onTakePhoto(canvas.toDataURL())})}),e[0].addEventListener("drop",o,!1),e.on("dragover",function(t){t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"},!1),e.on("dragenter",function(t){e.addClass("hover")}),e.on("dragleave",function(t){e.removeClass("hover")})}}},{}],252:[function(t,e,r){e.exports=function(t={}){return t.onSetup=t.onSetup||function(t){0==t.ui||(t.inBrowser?console.log('Added Step "'+t.name+'" to "'+t.imageName+'".'):console.log("%s",'Added Step "'+t.name+'" to "'+t.imageName+'".'))},t.onDraw=t.onDraw||function(t){0==t.ui||(t.inBrowser?console.log('Drawing Step "'+t.name+'" on "'+t.imageName+'".'):console.log("%s",'Drawing Step "'+t.name+'" on "'+t.imageName+'".'))},t.onComplete=t.onComplete||function(t){0==t.ui||(t.inBrowser?console.log('Drawn Step "'+t.name+'" on "'+t.imageName+'".'):console.log("%s",'Drawn Step "'+t.name+'" on "'+t.imageName+'".'))},t.onRemove=t.onRemove||function(t){0==t.ui||(t.inBrowser?console.log('Removing Step "'+t.name+'" of "'+t.imageName+'".'):console.log("%s",'Removing Step "'+t.name+'" of "'+t.imageName+'".'))},t}},{}],253:[function(t,e,r){e.exports=function(t){var e=void 0;return"jpeg"===(e=(e=function(t){return"data:image"===t.substr(0,10)}(t)?t.split(";")[0].split("/").pop():t.split(".").pop()).toLowerCase())&&(e="jpg"),["jpg","jpeg","png","gif","canvas"].includes(e)?e:"jpg"}},{}],254:[function(t,e,r){e.exports=function(e,r,n){t("get-pixels")(r.src,function(t,i){var o=i.shape[0],a=i.shape[1];if(r.x.valInp){Object.keys(r).forEach(function(t){var e=r[t];e.valInp&&"%"===e.valInp.slice(-1)&&(e.valInp=parseInt(e.valInp,10),"horizontal"===e.type?e.valInp=e.valInp*o/100:e.valInp=e.valInp*a/100)});n(e,r)}})}},{"get-pixels":29}],255:[function(t,e,r){e.exports={getPreviousStep:function(){return this.getStep(-1)},getNextStep:function(){return this.getStep(1)},getInput:function(t){return t+this.getIndex()===0&&t++,this.getStep(t-1).output},getOutput:function(t){return this.getStep(t).output},getOptions:function(){return this.getStep(0).options},setOptions:function(t){let e=this.getStep(0).options;for(let r in t)e[r]&&(e[r]=t[r])},getFormat:function(){return this.getStep(-1).output.format},getHeight:function(t){let e=new Image;e.onload=function(){t(e.height)},e.src=this.getInput(0).src},getWidth:function(t){let e=new Image;e.onload=function(){t(e.width)},e.src=this.getInput(0).src}}},{}]},{},[154]); \ No newline at end of file diff --git a/src/modules/Crop/Module.js b/src/modules/Crop/Module.js index db13a36041..7aca2278eb 100644 --- a/src/modules/Crop/Module.js +++ b/src/modules/Crop/Module.js @@ -29,10 +29,10 @@ module.exports = function CropModule(options, UI) { // save the input image; // TODO: this should be moved to module API to persist the input image options.step.input = input.src; - var parseCoordInputs = require('../../util/ParseInputCoordinates'); + var parseCornerCoordinateInputs = require('../../util/ParseInputCoordinates'); - //parse the inputs - parseCoordInputs.parseCornerCoordinateInputs(options,{ + //parse the inputs + parseCornerCoordinateInputs(options,{ src: input.src, x: { valInp: options.x, type: 'horizontal' }, y: { valInp: options.y, type: 'vertical' }, diff --git a/src/modules/Overlay/Module.js b/src/modules/Overlay/Module.js index fb435ab7f5..b43fe20fb5 100644 --- a/src/modules/Overlay/Module.js +++ b/src/modules/Overlay/Module.js @@ -15,10 +15,10 @@ module.exports = function Dynamic(options, UI, util) { var step = this; - var parseCoordInputs = require('../../util/ParseInputCoordinates'); + var parseCornerCoordinateInputs = require('../../util/ParseInputCoordinates'); - //parse the inputs - parseCoordInputs.parseCornerCoordinateInputs(options, { + //parse the inputs + parseCornerCoordinateInputs(options, { src: input.src, x: { valInp: options.x, type: 'horizontal' }, y: { valInp: options.y, type: 'vertical' },