Orders by {@link FinderPattern#getCount()}, descending.
\n */\n // CenterComparator implements Comparator\n (center1, center2) => {\n if (center2.getCount() === center1.getCount()) {\n const dA = Math.abs(center2.getEstimatedModuleSize() - average);\n const dB = Math.abs(center1.getEstimatedModuleSize() - average);\n return dA < dB ? 1 : dA > dB ? -1 : 0;\n }\n else {\n return center2.getCount() - center1.getCount();\n }\n });\n possibleCenters.splice(3); // this is not realy necessary as we only return first 3 anyway\n }\n return [\n possibleCenters[0],\n possibleCenters[1],\n possibleCenters[2]\n ];\n }\n }\n FinderPatternFinder.CENTER_QUORUM = 2;\n FinderPatternFinder.MIN_SKIP = 3; // 1 pixel/module times 3 modules/center\n FinderPatternFinder.MAX_MODULES = 57; // support up to version 10 for mobile clients\n\n /*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /*import java.util.Map;*/\n /**\n * Encapsulates logic that can detect a QR Code in an image, even if the QR Code\n * is rotated or skewed, or partially obscured.
\n *\n * @author Sean Owen\n */\n class Detector$2 {\n constructor(image) {\n this.image = image;\n }\n getImage() {\n return this.image;\n }\n getResultPointCallback() {\n return this.resultPointCallback;\n }\n /**\n * Detects a QR Code in an image.
\n *\n * @return {@link DetectorResult} encapsulating results of detecting a QR Code\n * @throws NotFoundException if QR Code cannot be found\n * @throws FormatException if a QR Code cannot be decoded\n */\n // public detect(): DetectorResult /*throws NotFoundException, FormatException*/ {\n // return detect(null)\n // }\n /**\n * Detects a QR Code in an image.
\n *\n * @param hints optional hints to detector\n * @return {@link DetectorResult} encapsulating results of detecting a QR Code\n * @throws NotFoundException if QR Code cannot be found\n * @throws FormatException if a QR Code cannot be decoded\n */\n detect(hints) {\n this.resultPointCallback = (hints === null || hints === undefined) ? null :\n /*(ResultPointCallback) */ hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);\n const finder = new FinderPatternFinder(this.image, this.resultPointCallback);\n const info = finder.find(hints);\n return this.processFinderPatternInfo(info);\n }\n processFinderPatternInfo(info) {\n const topLeft = info.getTopLeft();\n const topRight = info.getTopRight();\n const bottomLeft = info.getBottomLeft();\n const moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);\n if (moduleSize < 1.0) {\n throw new NotFoundException('No pattern found in proccess finder.');\n }\n const dimension = Detector$2.computeDimension(topLeft, topRight, bottomLeft, moduleSize);\n const provisionalVersion = Version$1.getProvisionalVersionForDimension(dimension);\n const modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7;\n let alignmentPattern = null;\n // Anything above version 1 has an alignment pattern\n if (provisionalVersion.getAlignmentPatternCenters().length > 0) {\n // Guess where a \"bottom right\" finder pattern would have been\n const bottomRightX = topRight.getX() - topLeft.getX() + bottomLeft.getX();\n const bottomRightY = topRight.getY() - topLeft.getY() + bottomLeft.getY();\n // Estimate that alignment pattern is closer by 3 modules\n // from \"bottom right\" to known top left location\n const correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;\n const estAlignmentX = /*(int) */ Math.floor(topLeft.getX() + correctionToTopLeft * (bottomRightX - topLeft.getX()));\n const estAlignmentY = /*(int) */ Math.floor(topLeft.getY() + correctionToTopLeft * (bottomRightY - topLeft.getY()));\n // Kind of arbitrary -- expand search radius before giving up\n for (let i = 4; i <= 16; i <<= 1) {\n try {\n alignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);\n break;\n }\n catch (re /*NotFoundException*/) {\n if (!(re instanceof NotFoundException)) {\n throw re;\n }\n // try next round\n }\n }\n // If we didn't find alignment pattern... well try anyway without it\n }\n const transform = Detector$2.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);\n const bits = Detector$2.sampleGrid(this.image, transform, dimension);\n let points;\n if (alignmentPattern === null) {\n points = [bottomLeft, topLeft, topRight];\n }\n else {\n points = [bottomLeft, topLeft, topRight, alignmentPattern];\n }\n return new DetectorResult(bits, points);\n }\n static createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension /*int*/) {\n const dimMinusThree = dimension - 3.5;\n let bottomRightX; /*float*/\n let bottomRightY; /*float*/\n let sourceBottomRightX; /*float*/\n let sourceBottomRightY; /*float*/\n if (alignmentPattern !== null) {\n bottomRightX = alignmentPattern.getX();\n bottomRightY = alignmentPattern.getY();\n sourceBottomRightX = dimMinusThree - 3.0;\n sourceBottomRightY = sourceBottomRightX;\n }\n else {\n // Don't have an alignment pattern, just make up the bottom-right point\n bottomRightX = (topRight.getX() - topLeft.getX()) + bottomLeft.getX();\n bottomRightY = (topRight.getY() - topLeft.getY()) + bottomLeft.getY();\n sourceBottomRightX = dimMinusThree;\n sourceBottomRightY = dimMinusThree;\n }\n return PerspectiveTransform.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRightX, bottomRightY, bottomLeft.getX(), bottomLeft.getY());\n }\n static sampleGrid(image, transform, dimension /*int*/) {\n const sampler = GridSamplerInstance.getInstance();\n return sampler.sampleGridWithTransform(image, dimension, dimension, transform);\n }\n /**\n * Computes the dimension (number of modules on a size) of the QR Code based on the position\n * of the finder patterns and estimated module size.
\n */\n static computeDimension(topLeft, topRight, bottomLeft, moduleSize /*float*/) {\n const tltrCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, topRight) / moduleSize);\n const tlblCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);\n let dimension = Math.floor((tltrCentersDimension + tlblCentersDimension) / 2) + 7;\n switch (dimension & 0x03) { // mod 4\n case 0:\n dimension++;\n break;\n // 1? do nothing\n case 2:\n dimension--;\n break;\n case 3:\n throw new NotFoundException('Dimensions could be not found.');\n }\n return dimension;\n }\n /**\n * Computes an average estimated module size based on estimated derived from the positions\n * of the three finder patterns.
\n *\n * @param topLeft detected top-left finder pattern center\n * @param topRight detected top-right finder pattern center\n * @param bottomLeft detected bottom-left finder pattern center\n * @return estimated module size\n */\n calculateModuleSize(topLeft, topRight, bottomLeft) {\n // Take the average\n return (this.calculateModuleSizeOneWay(topLeft, topRight) +\n this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;\n }\n /**\n * Estimates module size based on two finder patterns -- it uses\n * {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the\n * width of each, measuring along the axis between their centers.
\n */\n calculateModuleSizeOneWay(pattern, otherPattern) {\n const moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays(/*(int) */ Math.floor(pattern.getX()), \n /*(int) */ Math.floor(pattern.getY()), \n /*(int) */ Math.floor(otherPattern.getX()), \n /*(int) */ Math.floor(otherPattern.getY()));\n const moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays(/*(int) */ Math.floor(otherPattern.getX()), \n /*(int) */ Math.floor(otherPattern.getY()), \n /*(int) */ Math.floor(pattern.getX()), \n /*(int) */ Math.floor(pattern.getY()));\n if (isNaN(moduleSizeEst1)) {\n return moduleSizeEst2 / 7.0;\n }\n if (isNaN(moduleSizeEst2)) {\n return moduleSizeEst1 / 7.0;\n }\n // Average them, and divide by 7 since we've counted the width of 3 black modules,\n // and 1 white and 1 black module on either side. Ergo, divide sum by 14.\n return (moduleSizeEst1 + moduleSizeEst2) / 14.0;\n }\n /**\n * See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of\n * a finder pattern by looking for a black-white-black run from the center in the direction\n * of another point (another finder pattern center), and in the opposite direction too.\n */\n sizeOfBlackWhiteBlackRunBothWays(fromX /*int*/, fromY /*int*/, toX /*int*/, toY /*int*/) {\n let result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);\n // Now count other way -- don't run off image though of course\n let scale = 1.0;\n let otherToX = fromX - (toX - fromX);\n if (otherToX < 0) {\n scale = fromX / /*(float) */ (fromX - otherToX);\n otherToX = 0;\n }\n else if (otherToX >= this.image.getWidth()) {\n scale = (this.image.getWidth() - 1 - fromX) / /*(float) */ (otherToX - fromX);\n otherToX = this.image.getWidth() - 1;\n }\n let otherToY = /*(int) */ Math.floor(fromY - (toY - fromY) * scale);\n scale = 1.0;\n if (otherToY < 0) {\n scale = fromY / /*(float) */ (fromY - otherToY);\n otherToY = 0;\n }\n else if (otherToY >= this.image.getHeight()) {\n scale = (this.image.getHeight() - 1 - fromY) / /*(float) */ (otherToY - fromY);\n otherToY = this.image.getHeight() - 1;\n }\n otherToX = /*(int) */ Math.floor(fromX + (otherToX - fromX) * scale);\n result += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);\n // Middle pixel is double-counted this way; subtract 1\n return result - 1.0;\n }\n /**\n * This method traces a line from a point in the image, in the direction towards another point.\n * It begins in a black region, and keeps going until it finds white, then black, then white again.\n * It reports the distance from the start to this point.
\n *\n * This is used when figuring out how wide a finder pattern is, when the finder pattern\n * may be skewed or rotated.
\n */\n sizeOfBlackWhiteBlackRun(fromX /*int*/, fromY /*int*/, toX /*int*/, toY /*int*/) {\n // Mild variant of Bresenham's algorithm\n // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm\n const steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);\n if (steep) {\n let temp = fromX;\n fromX = fromY;\n fromY = temp;\n temp = toX;\n toX = toY;\n toY = temp;\n }\n const dx = Math.abs(toX - fromX);\n const dy = Math.abs(toY - fromY);\n let error = -dx / 2;\n const xstep = fromX < toX ? 1 : -1;\n const ystep = fromY < toY ? 1 : -1;\n // In black pixels, looking for white, first or second time.\n let state = 0;\n // Loop up until x == toX, but not beyond\n const xLimit = toX + xstep;\n for (let x = fromX, y = fromY; x !== xLimit; x += xstep) {\n const realX = steep ? y : x;\n const realY = steep ? x : y;\n // Does current pixel mean we have moved white to black or vice versa?\n // Scanning black in state 0,2 and white in state 1, so if we find the wrong\n // color, advance to next state or end if we are in state 2 already\n if ((state === 1) === this.image.get(realX, realY)) {\n if (state === 2) {\n return MathUtils.distance(x, y, fromX, fromY);\n }\n state++;\n }\n error += dy;\n if (error > 0) {\n if (y === toY) {\n break;\n }\n y += ystep;\n error -= dx;\n }\n }\n // Found black-white-black; give the benefit of the doubt that the next pixel outside the image\n // is \"white\" so this last point at (toX+xStep,toY) is the right ending. This is really a\n // small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this.\n if (state === 2) {\n return MathUtils.distance(toX + xstep, toY, fromX, fromY);\n }\n // else we didn't find even black-white-black; no estimate is really possible\n return NaN;\n }\n /**\n * Attempts to locate an alignment pattern in a limited region of the image, which is\n * guessed to contain it. This method uses {@link AlignmentPattern}.
\n *\n * @param overallEstModuleSize estimated module size so far\n * @param estAlignmentX x coordinate of center of area probably containing alignment pattern\n * @param estAlignmentY y coordinate of above\n * @param allowanceFactor number of pixels in all directions to search from the center\n * @return {@link AlignmentPattern} if found, or null otherwise\n * @throws NotFoundException if an unexpected error occurs during detection\n */\n findAlignmentInRegion(overallEstModuleSize /*float*/, estAlignmentX /*int*/, estAlignmentY /*int*/, allowanceFactor /*float*/) {\n // Look for an alignment pattern (3 modules in size) around where it\n // should be\n const allowance = /*(int) */ Math.floor(allowanceFactor * overallEstModuleSize);\n const alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);\n const alignmentAreaRightX = Math.min(this.image.getWidth() - 1, estAlignmentX + allowance);\n if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) {\n throw new NotFoundException('Alignment top exceeds estimated module size.');\n }\n const alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);\n const alignmentAreaBottomY = Math.min(this.image.getHeight() - 1, estAlignmentY + allowance);\n if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) {\n throw new NotFoundException('Alignment bottom exceeds estimated module size.');\n }\n const alignmentFinder = new AlignmentPatternFinder(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);\n return alignmentFinder.find();\n }\n }\n\n /*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /*import java.util.List;*/\n /*import java.util.Map;*/\n /**\n * This implementation can detect and decode QR Codes in an image.\n *\n * @author Sean Owen\n */\n class QRCodeReader {\n constructor() {\n this.decoder = new Decoder$2();\n }\n getDecoder() {\n return this.decoder;\n }\n /**\n * Locates and decodes a QR code in an image.\n *\n * @return a representing: string the content encoded by the QR code\n * @throws NotFoundException if a QR code cannot be found\n * @throws FormatException if a QR code cannot be decoded\n * @throws ChecksumException if error correction fails\n */\n /*@Override*/\n // public decode(image: BinaryBitmap): Result /*throws NotFoundException, ChecksumException, FormatException */ {\n // return this.decode(image, null)\n // }\n /*@Override*/\n decode(image, hints) {\n let decoderResult;\n let points;\n if (hints !== undefined && hints !== null && undefined !== hints.get(DecodeHintType$1.PURE_BARCODE)) {\n const bits = QRCodeReader.extractPureBits(image.getBlackMatrix());\n decoderResult = this.decoder.decodeBitMatrix(bits, hints);\n points = QRCodeReader.NO_POINTS;\n }\n else {\n const detectorResult = new Detector$2(image.getBlackMatrix()).detect(hints);\n decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints);\n points = detectorResult.getPoints();\n }\n // If the code was mirrored: swap the bottom-left and the top-right points.\n if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {\n decoderResult.getOther().applyMirroredCorrection(points);\n }\n const result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, BarcodeFormat$1.QR_CODE, undefined);\n const byteSegments = decoderResult.getByteSegments();\n if (byteSegments !== null) {\n result.putMetadata(ResultMetadataType$1.BYTE_SEGMENTS, byteSegments);\n }\n const ecLevel = decoderResult.getECLevel();\n if (ecLevel !== null) {\n result.putMetadata(ResultMetadataType$1.ERROR_CORRECTION_LEVEL, ecLevel);\n }\n if (decoderResult.hasStructuredAppend()) {\n result.putMetadata(ResultMetadataType$1.STRUCTURED_APPEND_SEQUENCE, decoderResult.getStructuredAppendSequenceNumber());\n result.putMetadata(ResultMetadataType$1.STRUCTURED_APPEND_PARITY, decoderResult.getStructuredAppendParity());\n }\n return result;\n }\n /*@Override*/\n reset() {\n // do nothing\n }\n /**\n * This method detects a code in a \"pure\" image -- that is, pure monochrome image\n * which contains only an unrotated, unskewed, image of a code, with some white border\n * around it. This is a specialized method that works exceptionally fast in this special\n * case.\n *\n * @see com.google.zxing.datamatrix.DataMatrixReader#extractPureBits(BitMatrix)\n */\n static extractPureBits(image) {\n const leftTopBlack = image.getTopLeftOnBit();\n const rightBottomBlack = image.getBottomRightOnBit();\n if (leftTopBlack === null || rightBottomBlack === null) {\n throw new NotFoundException();\n }\n const moduleSize = this.moduleSize(leftTopBlack, image);\n let top = leftTopBlack[1];\n let bottom = rightBottomBlack[1];\n let left = leftTopBlack[0];\n let right = rightBottomBlack[0];\n // Sanity check!\n if (left >= right || top >= bottom) {\n throw new NotFoundException();\n }\n if (bottom - top !== right - left) {\n // Special case, where bottom-right module wasn't black so we found something else in the last row\n // Assume it's a square, so use height as the width\n right = left + (bottom - top);\n if (right >= image.getWidth()) {\n // Abort if that would not make sense -- off image\n throw new NotFoundException();\n }\n }\n const matrixWidth = Math.round((right - left + 1) / moduleSize);\n const matrixHeight = Math.round((bottom - top + 1) / moduleSize);\n if (matrixWidth <= 0 || matrixHeight <= 0) {\n throw new NotFoundException();\n }\n if (matrixHeight !== matrixWidth) {\n // Only possibly decode square regions\n throw new NotFoundException();\n }\n // Push in the \"border\" by half the module width so that we start\n // sampling in the middle of the module. Just in case the image is a\n // little off, this will help recover.\n const nudge = /*(int) */ Math.floor(moduleSize / 2.0);\n top += nudge;\n left += nudge;\n // But careful that this does not sample off the edge\n // \"right\" is the farthest-right valid pixel location -- right+1 is not necessarily\n // This is positive by how much the inner x loop below would be too large\n const nudgedTooFarRight = left + /*(int) */ Math.floor((matrixWidth - 1) * moduleSize) - right;\n if (nudgedTooFarRight > 0) {\n if (nudgedTooFarRight > nudge) {\n // Neither way fits; abort\n throw new NotFoundException();\n }\n left -= nudgedTooFarRight;\n }\n // See logic above\n const nudgedTooFarDown = top + /*(int) */ Math.floor((matrixHeight - 1) * moduleSize) - bottom;\n if (nudgedTooFarDown > 0) {\n if (nudgedTooFarDown > nudge) {\n // Neither way fits; abort\n throw new NotFoundException();\n }\n top -= nudgedTooFarDown;\n }\n // Now just read off the bits\n const bits = new BitMatrix(matrixWidth, matrixHeight);\n for (let y = 0; y < matrixHeight; y++) {\n const iOffset = top + /*(int) */ Math.floor(y * moduleSize);\n for (let x = 0; x < matrixWidth; x++) {\n if (image.get(left + /*(int) */ Math.floor(x * moduleSize), iOffset)) {\n bits.set(x, y);\n }\n }\n }\n return bits;\n }\n static moduleSize(leftTopBlack, image) {\n const height = image.getHeight();\n const width = image.getWidth();\n let x = leftTopBlack[0];\n let y = leftTopBlack[1];\n let inBlack = true;\n let transitions = 0;\n while (x < width && y < height) {\n if (inBlack !== image.get(x, y)) {\n if (++transitions === 5) {\n break;\n }\n inBlack = !inBlack;\n }\n x++;\n y++;\n }\n if (x === width || y === height) {\n throw new NotFoundException();\n }\n return (x - leftTopBlack[0]) / 7.0;\n }\n }\n QRCodeReader.NO_POINTS = new Array();\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * @author SITA Lab (kevin.osullivan@sita.aero)\n * @author Guenther Grau\n */\n /*public final*/ class PDF417Common {\n PDF417Common() {\n }\n /**\n * @param moduleBitCount values to sum\n * @return sum of values\n * @deprecated call {@link MathUtils#sum(int[])}\n */\n // @Deprecated\n static getBitCountSum(moduleBitCount) {\n return MathUtils.sum(moduleBitCount);\n }\n static toIntArray(list) {\n if (list == null || !list.length) {\n return PDF417Common.EMPTY_INT_ARRAY;\n }\n const result = new Int32Array(list.length);\n let i = 0;\n for (const integer of list) {\n result[i++] = integer;\n }\n return result;\n }\n /**\n * @param symbol encoded symbol to translate to a codeword\n * @return the codeword corresponding to the symbol.\n */\n static getCodeword(symbol /*int*/) {\n const i = Arrays.binarySearch(PDF417Common.SYMBOL_TABLE, symbol & 0x3FFFF);\n if (i < 0) {\n return -1;\n }\n return (PDF417Common.CODEWORD_TABLE[i] - 1) % PDF417Common.NUMBER_OF_CODEWORDS;\n }\n }\n PDF417Common.NUMBER_OF_CODEWORDS = 929;\n // Maximum Codewords (Data + Error).\n PDF417Common.MAX_CODEWORDS_IN_BARCODE = PDF417Common.NUMBER_OF_CODEWORDS - 1;\n PDF417Common.MIN_ROWS_IN_BARCODE = 3;\n PDF417Common.MAX_ROWS_IN_BARCODE = 90;\n // One left row indication column + max 30 data columns + one right row indicator column\n // public static /*final*/ MAX_CODEWORDS_IN_ROW: /*int*/ number = 32;\n PDF417Common.MODULES_IN_CODEWORD = 17;\n PDF417Common.MODULES_IN_STOP_PATTERN = 18;\n PDF417Common.BARS_IN_MODULE = 8;\n PDF417Common.EMPTY_INT_ARRAY = new Int32Array([]);\n /**\n * The sorted table of all possible symbols. Extracted from the PDF417\n * specification. The index of a symbol in this table corresponds to the\n * index into the codeword table.\n */\n PDF417Common.SYMBOL_TABLE = Int32Array.from([\n 0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x1035c, 0x10396, 0x103a6, 0x103ac,\n 0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10466, 0x1046c, 0x1047a, 0x10482,\n 0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10504, 0x10508, 0x10510, 0x1051e,\n 0x10520, 0x1053c, 0x10540, 0x10578, 0x10586, 0x1058c, 0x10598, 0x105b0, 0x105be, 0x105ce, 0x105dc, 0x105e2,\n 0x105e4, 0x105e8, 0x105f6, 0x1062e, 0x1064e, 0x1065c, 0x1068e, 0x1069c, 0x106b8, 0x106de, 0x106fa, 0x10716,\n 0x10726, 0x1072c, 0x10746, 0x1074c, 0x10758, 0x1076e, 0x10792, 0x10794, 0x107a2, 0x107a4, 0x107a8, 0x107b6,\n 0x10822, 0x10828, 0x10842, 0x10848, 0x10850, 0x1085e, 0x10866, 0x1086c, 0x1087a, 0x10882, 0x10884, 0x10890,\n 0x1089e, 0x108a0, 0x108bc, 0x108c6, 0x108cc, 0x108d8, 0x108ee, 0x108f2, 0x108f4, 0x10902, 0x10908, 0x1091e,\n 0x10920, 0x1093c, 0x10940, 0x10978, 0x10986, 0x10998, 0x109b0, 0x109be, 0x109ce, 0x109dc, 0x109e2, 0x109e4,\n 0x109e8, 0x109f6, 0x10a08, 0x10a10, 0x10a1e, 0x10a20, 0x10a3c, 0x10a40, 0x10a78, 0x10af0, 0x10b06, 0x10b0c,\n 0x10b18, 0x10b30, 0x10b3e, 0x10b60, 0x10b7c, 0x10b8e, 0x10b9c, 0x10bb8, 0x10bc2, 0x10bc4, 0x10bc8, 0x10bd0,\n 0x10bde, 0x10be6, 0x10bec, 0x10c2e, 0x10c4e, 0x10c5c, 0x10c62, 0x10c64, 0x10c68, 0x10c76, 0x10c8e, 0x10c9c,\n 0x10cb8, 0x10cc2, 0x10cc4, 0x10cc8, 0x10cd0, 0x10cde, 0x10ce6, 0x10cec, 0x10cfa, 0x10d0e, 0x10d1c, 0x10d38,\n 0x10d70, 0x10d7e, 0x10d82, 0x10d84, 0x10d88, 0x10d90, 0x10d9e, 0x10da0, 0x10dbc, 0x10dc6, 0x10dcc, 0x10dd8,\n 0x10dee, 0x10df2, 0x10df4, 0x10e16, 0x10e26, 0x10e2c, 0x10e46, 0x10e58, 0x10e6e, 0x10e86, 0x10e8c, 0x10e98,\n 0x10eb0, 0x10ebe, 0x10ece, 0x10edc, 0x10f0a, 0x10f12, 0x10f14, 0x10f22, 0x10f28, 0x10f36, 0x10f42, 0x10f44,\n 0x10f48, 0x10f50, 0x10f5e, 0x10f66, 0x10f6c, 0x10fb2, 0x10fb4, 0x11022, 0x11028, 0x11042, 0x11048, 0x11050,\n 0x1105e, 0x1107a, 0x11082, 0x11084, 0x11090, 0x1109e, 0x110a0, 0x110bc, 0x110c6, 0x110cc, 0x110d8, 0x110ee,\n 0x110f2, 0x110f4, 0x11102, 0x1111e, 0x11120, 0x1113c, 0x11140, 0x11178, 0x11186, 0x11198, 0x111b0, 0x111be,\n 0x111ce, 0x111dc, 0x111e2, 0x111e4, 0x111e8, 0x111f6, 0x11208, 0x1121e, 0x11220, 0x11278, 0x112f0, 0x1130c,\n 0x11330, 0x1133e, 0x11360, 0x1137c, 0x1138e, 0x1139c, 0x113b8, 0x113c2, 0x113c8, 0x113d0, 0x113de, 0x113e6,\n 0x113ec, 0x11408, 0x11410, 0x1141e, 0x11420, 0x1143c, 0x11440, 0x11478, 0x114f0, 0x115e0, 0x1160c, 0x11618,\n 0x11630, 0x1163e, 0x11660, 0x1167c, 0x116c0, 0x116f8, 0x1171c, 0x11738, 0x11770, 0x1177e, 0x11782, 0x11784,\n 0x11788, 0x11790, 0x1179e, 0x117a0, 0x117bc, 0x117c6, 0x117cc, 0x117d8, 0x117ee, 0x1182e, 0x11834, 0x1184e,\n 0x1185c, 0x11862, 0x11864, 0x11868, 0x11876, 0x1188e, 0x1189c, 0x118b8, 0x118c2, 0x118c8, 0x118d0, 0x118de,\n 0x118e6, 0x118ec, 0x118fa, 0x1190e, 0x1191c, 0x11938, 0x11970, 0x1197e, 0x11982, 0x11984, 0x11990, 0x1199e,\n 0x119a0, 0x119bc, 0x119c6, 0x119cc, 0x119d8, 0x119ee, 0x119f2, 0x119f4, 0x11a0e, 0x11a1c, 0x11a38, 0x11a70,\n 0x11a7e, 0x11ae0, 0x11afc, 0x11b08, 0x11b10, 0x11b1e, 0x11b20, 0x11b3c, 0x11b40, 0x11b78, 0x11b8c, 0x11b98,\n 0x11bb0, 0x11bbe, 0x11bce, 0x11bdc, 0x11be2, 0x11be4, 0x11be8, 0x11bf6, 0x11c16, 0x11c26, 0x11c2c, 0x11c46,\n 0x11c4c, 0x11c58, 0x11c6e, 0x11c86, 0x11c98, 0x11cb0, 0x11cbe, 0x11cce, 0x11cdc, 0x11ce2, 0x11ce4, 0x11ce8,\n 0x11cf6, 0x11d06, 0x11d0c, 0x11d18, 0x11d30, 0x11d3e, 0x11d60, 0x11d7c, 0x11d8e, 0x11d9c, 0x11db8, 0x11dc4,\n 0x11dc8, 0x11dd0, 0x11dde, 0x11de6, 0x11dec, 0x11dfa, 0x11e0a, 0x11e12, 0x11e14, 0x11e22, 0x11e24, 0x11e28,\n 0x11e36, 0x11e42, 0x11e44, 0x11e50, 0x11e5e, 0x11e66, 0x11e6c, 0x11e82, 0x11e84, 0x11e88, 0x11e90, 0x11e9e,\n 0x11ea0, 0x11ebc, 0x11ec6, 0x11ecc, 0x11ed8, 0x11eee, 0x11f1a, 0x11f2e, 0x11f32, 0x11f34, 0x11f4e, 0x11f5c,\n 0x11f62, 0x11f64, 0x11f68, 0x11f76, 0x12048, 0x1205e, 0x12082, 0x12084, 0x12090, 0x1209e, 0x120a0, 0x120bc,\n 0x120d8, 0x120f2, 0x120f4, 0x12108, 0x1211e, 0x12120, 0x1213c, 0x12140, 0x12178, 0x12186, 0x12198, 0x121b0,\n 0x121be, 0x121e2, 0x121e4, 0x121e8, 0x121f6, 0x12204, 0x12210, 0x1221e, 0x12220, 0x12278, 0x122f0, 0x12306,\n 0x1230c, 0x12330, 0x1233e, 0x12360, 0x1237c, 0x1238e, 0x1239c, 0x123b8, 0x123c2, 0x123c8, 0x123d0, 0x123e6,\n 0x123ec, 0x1241e, 0x12420, 0x1243c, 0x124f0, 0x125e0, 0x12618, 0x1263e, 0x12660, 0x1267c, 0x126c0, 0x126f8,\n 0x12738, 0x12770, 0x1277e, 0x12782, 0x12784, 0x12790, 0x1279e, 0x127a0, 0x127bc, 0x127c6, 0x127cc, 0x127d8,\n 0x127ee, 0x12820, 0x1283c, 0x12840, 0x12878, 0x128f0, 0x129e0, 0x12bc0, 0x12c18, 0x12c30, 0x12c3e, 0x12c60,\n 0x12c7c, 0x12cc0, 0x12cf8, 0x12df0, 0x12e1c, 0x12e38, 0x12e70, 0x12e7e, 0x12ee0, 0x12efc, 0x12f04, 0x12f08,\n 0x12f10, 0x12f20, 0x12f3c, 0x12f40, 0x12f78, 0x12f86, 0x12f8c, 0x12f98, 0x12fb0, 0x12fbe, 0x12fce, 0x12fdc,\n 0x1302e, 0x1304e, 0x1305c, 0x13062, 0x13068, 0x1308e, 0x1309c, 0x130b8, 0x130c2, 0x130c8, 0x130d0, 0x130de,\n 0x130ec, 0x130fa, 0x1310e, 0x13138, 0x13170, 0x1317e, 0x13182, 0x13184, 0x13190, 0x1319e, 0x131a0, 0x131bc,\n 0x131c6, 0x131cc, 0x131d8, 0x131f2, 0x131f4, 0x1320e, 0x1321c, 0x13270, 0x1327e, 0x132e0, 0x132fc, 0x13308,\n 0x1331e, 0x13320, 0x1333c, 0x13340, 0x13378, 0x13386, 0x13398, 0x133b0, 0x133be, 0x133ce, 0x133dc, 0x133e2,\n 0x133e4, 0x133e8, 0x133f6, 0x1340e, 0x1341c, 0x13438, 0x13470, 0x1347e, 0x134e0, 0x134fc, 0x135c0, 0x135f8,\n 0x13608, 0x13610, 0x1361e, 0x13620, 0x1363c, 0x13640, 0x13678, 0x136f0, 0x1370c, 0x13718, 0x13730, 0x1373e,\n 0x13760, 0x1377c, 0x1379c, 0x137b8, 0x137c2, 0x137c4, 0x137c8, 0x137d0, 0x137de, 0x137e6, 0x137ec, 0x13816,\n 0x13826, 0x1382c, 0x13846, 0x1384c, 0x13858, 0x1386e, 0x13874, 0x13886, 0x13898, 0x138b0, 0x138be, 0x138ce,\n 0x138dc, 0x138e2, 0x138e4, 0x138e8, 0x13906, 0x1390c, 0x13930, 0x1393e, 0x13960, 0x1397c, 0x1398e, 0x1399c,\n 0x139b8, 0x139c8, 0x139d0, 0x139de, 0x139e6, 0x139ec, 0x139fa, 0x13a06, 0x13a0c, 0x13a18, 0x13a30, 0x13a3e,\n 0x13a60, 0x13a7c, 0x13ac0, 0x13af8, 0x13b0e, 0x13b1c, 0x13b38, 0x13b70, 0x13b7e, 0x13b88, 0x13b90, 0x13b9e,\n 0x13ba0, 0x13bbc, 0x13bcc, 0x13bd8, 0x13bee, 0x13bf2, 0x13bf4, 0x13c12, 0x13c14, 0x13c22, 0x13c24, 0x13c28,\n 0x13c36, 0x13c42, 0x13c48, 0x13c50, 0x13c5e, 0x13c66, 0x13c6c, 0x13c82, 0x13c84, 0x13c90, 0x13c9e, 0x13ca0,\n 0x13cbc, 0x13cc6, 0x13ccc, 0x13cd8, 0x13cee, 0x13d02, 0x13d04, 0x13d08, 0x13d10, 0x13d1e, 0x13d20, 0x13d3c,\n 0x13d40, 0x13d78, 0x13d86, 0x13d8c, 0x13d98, 0x13db0, 0x13dbe, 0x13dce, 0x13ddc, 0x13de4, 0x13de8, 0x13df6,\n 0x13e1a, 0x13e2e, 0x13e32, 0x13e34, 0x13e4e, 0x13e5c, 0x13e62, 0x13e64, 0x13e68, 0x13e76, 0x13e8e, 0x13e9c,\n 0x13eb8, 0x13ec2, 0x13ec4, 0x13ec8, 0x13ed0, 0x13ede, 0x13ee6, 0x13eec, 0x13f26, 0x13f2c, 0x13f3a, 0x13f46,\n 0x13f4c, 0x13f58, 0x13f6e, 0x13f72, 0x13f74, 0x14082, 0x1409e, 0x140a0, 0x140bc, 0x14104, 0x14108, 0x14110,\n 0x1411e, 0x14120, 0x1413c, 0x14140, 0x14178, 0x1418c, 0x14198, 0x141b0, 0x141be, 0x141e2, 0x141e4, 0x141e8,\n 0x14208, 0x14210, 0x1421e, 0x14220, 0x1423c, 0x14240, 0x14278, 0x142f0, 0x14306, 0x1430c, 0x14318, 0x14330,\n 0x1433e, 0x14360, 0x1437c, 0x1438e, 0x143c2, 0x143c4, 0x143c8, 0x143d0, 0x143e6, 0x143ec, 0x14408, 0x14410,\n 0x1441e, 0x14420, 0x1443c, 0x14440, 0x14478, 0x144f0, 0x145e0, 0x1460c, 0x14618, 0x14630, 0x1463e, 0x14660,\n 0x1467c, 0x146c0, 0x146f8, 0x1471c, 0x14738, 0x14770, 0x1477e, 0x14782, 0x14784, 0x14788, 0x14790, 0x147a0,\n 0x147bc, 0x147c6, 0x147cc, 0x147d8, 0x147ee, 0x14810, 0x14820, 0x1483c, 0x14840, 0x14878, 0x148f0, 0x149e0,\n 0x14bc0, 0x14c30, 0x14c3e, 0x14c60, 0x14c7c, 0x14cc0, 0x14cf8, 0x14df0, 0x14e38, 0x14e70, 0x14e7e, 0x14ee0,\n 0x14efc, 0x14f04, 0x14f08, 0x14f10, 0x14f1e, 0x14f20, 0x14f3c, 0x14f40, 0x14f78, 0x14f86, 0x14f8c, 0x14f98,\n 0x14fb0, 0x14fce, 0x14fdc, 0x15020, 0x15040, 0x15078, 0x150f0, 0x151e0, 0x153c0, 0x15860, 0x1587c, 0x158c0,\n 0x158f8, 0x159f0, 0x15be0, 0x15c70, 0x15c7e, 0x15ce0, 0x15cfc, 0x15dc0, 0x15df8, 0x15e08, 0x15e10, 0x15e20,\n 0x15e40, 0x15e78, 0x15ef0, 0x15f0c, 0x15f18, 0x15f30, 0x15f60, 0x15f7c, 0x15f8e, 0x15f9c, 0x15fb8, 0x1604e,\n 0x1605c, 0x1608e, 0x1609c, 0x160b8, 0x160c2, 0x160c4, 0x160c8, 0x160de, 0x1610e, 0x1611c, 0x16138, 0x16170,\n 0x1617e, 0x16184, 0x16188, 0x16190, 0x1619e, 0x161a0, 0x161bc, 0x161c6, 0x161cc, 0x161d8, 0x161f2, 0x161f4,\n 0x1620e, 0x1621c, 0x16238, 0x16270, 0x1627e, 0x162e0, 0x162fc, 0x16304, 0x16308, 0x16310, 0x1631e, 0x16320,\n 0x1633c, 0x16340, 0x16378, 0x16386, 0x1638c, 0x16398, 0x163b0, 0x163be, 0x163ce, 0x163dc, 0x163e2, 0x163e4,\n 0x163e8, 0x163f6, 0x1640e, 0x1641c, 0x16438, 0x16470, 0x1647e, 0x164e0, 0x164fc, 0x165c0, 0x165f8, 0x16610,\n 0x1661e, 0x16620, 0x1663c, 0x16640, 0x16678, 0x166f0, 0x16718, 0x16730, 0x1673e, 0x16760, 0x1677c, 0x1678e,\n 0x1679c, 0x167b8, 0x167c2, 0x167c4, 0x167c8, 0x167d0, 0x167de, 0x167e6, 0x167ec, 0x1681c, 0x16838, 0x16870,\n 0x168e0, 0x168fc, 0x169c0, 0x169f8, 0x16bf0, 0x16c10, 0x16c1e, 0x16c20, 0x16c3c, 0x16c40, 0x16c78, 0x16cf0,\n 0x16de0, 0x16e18, 0x16e30, 0x16e3e, 0x16e60, 0x16e7c, 0x16ec0, 0x16ef8, 0x16f1c, 0x16f38, 0x16f70, 0x16f7e,\n 0x16f84, 0x16f88, 0x16f90, 0x16f9e, 0x16fa0, 0x16fbc, 0x16fc6, 0x16fcc, 0x16fd8, 0x17026, 0x1702c, 0x17046,\n 0x1704c, 0x17058, 0x1706e, 0x17086, 0x1708c, 0x17098, 0x170b0, 0x170be, 0x170ce, 0x170dc, 0x170e8, 0x17106,\n 0x1710c, 0x17118, 0x17130, 0x1713e, 0x17160, 0x1717c, 0x1718e, 0x1719c, 0x171b8, 0x171c2, 0x171c4, 0x171c8,\n 0x171d0, 0x171de, 0x171e6, 0x171ec, 0x171fa, 0x17206, 0x1720c, 0x17218, 0x17230, 0x1723e, 0x17260, 0x1727c,\n 0x172c0, 0x172f8, 0x1730e, 0x1731c, 0x17338, 0x17370, 0x1737e, 0x17388, 0x17390, 0x1739e, 0x173a0, 0x173bc,\n 0x173cc, 0x173d8, 0x173ee, 0x173f2, 0x173f4, 0x1740c, 0x17418, 0x17430, 0x1743e, 0x17460, 0x1747c, 0x174c0,\n 0x174f8, 0x175f0, 0x1760e, 0x1761c, 0x17638, 0x17670, 0x1767e, 0x176e0, 0x176fc, 0x17708, 0x17710, 0x1771e,\n 0x17720, 0x1773c, 0x17740, 0x17778, 0x17798, 0x177b0, 0x177be, 0x177dc, 0x177e2, 0x177e4, 0x177e8, 0x17822,\n 0x17824, 0x17828, 0x17836, 0x17842, 0x17844, 0x17848, 0x17850, 0x1785e, 0x17866, 0x1786c, 0x17882, 0x17884,\n 0x17888, 0x17890, 0x1789e, 0x178a0, 0x178bc, 0x178c6, 0x178cc, 0x178d8, 0x178ee, 0x178f2, 0x178f4, 0x17902,\n 0x17904, 0x17908, 0x17910, 0x1791e, 0x17920, 0x1793c, 0x17940, 0x17978, 0x17986, 0x1798c, 0x17998, 0x179b0,\n 0x179be, 0x179ce, 0x179dc, 0x179e2, 0x179e4, 0x179e8, 0x179f6, 0x17a04, 0x17a08, 0x17a10, 0x17a1e, 0x17a20,\n 0x17a3c, 0x17a40, 0x17a78, 0x17af0, 0x17b06, 0x17b0c, 0x17b18, 0x17b30, 0x17b3e, 0x17b60, 0x17b7c, 0x17b8e,\n 0x17b9c, 0x17bb8, 0x17bc4, 0x17bc8, 0x17bd0, 0x17bde, 0x17be6, 0x17bec, 0x17c2e, 0x17c32, 0x17c34, 0x17c4e,\n 0x17c5c, 0x17c62, 0x17c64, 0x17c68, 0x17c76, 0x17c8e, 0x17c9c, 0x17cb8, 0x17cc2, 0x17cc4, 0x17cc8, 0x17cd0,\n 0x17cde, 0x17ce6, 0x17cec, 0x17d0e, 0x17d1c, 0x17d38, 0x17d70, 0x17d82, 0x17d84, 0x17d88, 0x17d90, 0x17d9e,\n 0x17da0, 0x17dbc, 0x17dc6, 0x17dcc, 0x17dd8, 0x17dee, 0x17e26, 0x17e2c, 0x17e3a, 0x17e46, 0x17e4c, 0x17e58,\n 0x17e6e, 0x17e72, 0x17e74, 0x17e86, 0x17e8c, 0x17e98, 0x17eb0, 0x17ece, 0x17edc, 0x17ee2, 0x17ee4, 0x17ee8,\n 0x17ef6, 0x1813a, 0x18172, 0x18174, 0x18216, 0x18226, 0x1823a, 0x1824c, 0x18258, 0x1826e, 0x18272, 0x18274,\n 0x18298, 0x182be, 0x182e2, 0x182e4, 0x182e8, 0x182f6, 0x1835e, 0x1837a, 0x183ae, 0x183d6, 0x18416, 0x18426,\n 0x1842c, 0x1843a, 0x18446, 0x18458, 0x1846e, 0x18472, 0x18474, 0x18486, 0x184b0, 0x184be, 0x184ce, 0x184dc,\n 0x184e2, 0x184e4, 0x184e8, 0x184f6, 0x18506, 0x1850c, 0x18518, 0x18530, 0x1853e, 0x18560, 0x1857c, 0x1858e,\n 0x1859c, 0x185b8, 0x185c2, 0x185c4, 0x185c8, 0x185d0, 0x185de, 0x185e6, 0x185ec, 0x185fa, 0x18612, 0x18614,\n 0x18622, 0x18628, 0x18636, 0x18642, 0x18650, 0x1865e, 0x1867a, 0x18682, 0x18684, 0x18688, 0x18690, 0x1869e,\n 0x186a0, 0x186bc, 0x186c6, 0x186cc, 0x186d8, 0x186ee, 0x186f2, 0x186f4, 0x1872e, 0x1874e, 0x1875c, 0x18796,\n 0x187a6, 0x187ac, 0x187d2, 0x187d4, 0x18826, 0x1882c, 0x1883a, 0x18846, 0x1884c, 0x18858, 0x1886e, 0x18872,\n 0x18874, 0x18886, 0x18898, 0x188b0, 0x188be, 0x188ce, 0x188dc, 0x188e2, 0x188e4, 0x188e8, 0x188f6, 0x1890c,\n 0x18930, 0x1893e, 0x18960, 0x1897c, 0x1898e, 0x189b8, 0x189c2, 0x189c8, 0x189d0, 0x189de, 0x189e6, 0x189ec,\n 0x189fa, 0x18a18, 0x18a30, 0x18a3e, 0x18a60, 0x18a7c, 0x18ac0, 0x18af8, 0x18b1c, 0x18b38, 0x18b70, 0x18b7e,\n 0x18b82, 0x18b84, 0x18b88, 0x18b90, 0x18b9e, 0x18ba0, 0x18bbc, 0x18bc6, 0x18bcc, 0x18bd8, 0x18bee, 0x18bf2,\n 0x18bf4, 0x18c22, 0x18c24, 0x18c28, 0x18c36, 0x18c42, 0x18c48, 0x18c50, 0x18c5e, 0x18c66, 0x18c7a, 0x18c82,\n 0x18c84, 0x18c90, 0x18c9e, 0x18ca0, 0x18cbc, 0x18ccc, 0x18cf2, 0x18cf4, 0x18d04, 0x18d08, 0x18d10, 0x18d1e,\n 0x18d20, 0x18d3c, 0x18d40, 0x18d78, 0x18d86, 0x18d98, 0x18dce, 0x18de2, 0x18de4, 0x18de8, 0x18e2e, 0x18e32,\n 0x18e34, 0x18e4e, 0x18e5c, 0x18e62, 0x18e64, 0x18e68, 0x18e8e, 0x18e9c, 0x18eb8, 0x18ec2, 0x18ec4, 0x18ec8,\n 0x18ed0, 0x18efa, 0x18f16, 0x18f26, 0x18f2c, 0x18f46, 0x18f4c, 0x18f58, 0x18f6e, 0x18f8a, 0x18f92, 0x18f94,\n 0x18fa2, 0x18fa4, 0x18fa8, 0x18fb6, 0x1902c, 0x1903a, 0x19046, 0x1904c, 0x19058, 0x19072, 0x19074, 0x19086,\n 0x19098, 0x190b0, 0x190be, 0x190ce, 0x190dc, 0x190e2, 0x190e8, 0x190f6, 0x19106, 0x1910c, 0x19130, 0x1913e,\n 0x19160, 0x1917c, 0x1918e, 0x1919c, 0x191b8, 0x191c2, 0x191c8, 0x191d0, 0x191de, 0x191e6, 0x191ec, 0x191fa,\n 0x19218, 0x1923e, 0x19260, 0x1927c, 0x192c0, 0x192f8, 0x19338, 0x19370, 0x1937e, 0x19382, 0x19384, 0x19390,\n 0x1939e, 0x193a0, 0x193bc, 0x193c6, 0x193cc, 0x193d8, 0x193ee, 0x193f2, 0x193f4, 0x19430, 0x1943e, 0x19460,\n 0x1947c, 0x194c0, 0x194f8, 0x195f0, 0x19638, 0x19670, 0x1967e, 0x196e0, 0x196fc, 0x19702, 0x19704, 0x19708,\n 0x19710, 0x19720, 0x1973c, 0x19740, 0x19778, 0x19786, 0x1978c, 0x19798, 0x197b0, 0x197be, 0x197ce, 0x197dc,\n 0x197e2, 0x197e4, 0x197e8, 0x19822, 0x19824, 0x19842, 0x19848, 0x19850, 0x1985e, 0x19866, 0x1987a, 0x19882,\n 0x19884, 0x19890, 0x1989e, 0x198a0, 0x198bc, 0x198cc, 0x198f2, 0x198f4, 0x19902, 0x19908, 0x1991e, 0x19920,\n 0x1993c, 0x19940, 0x19978, 0x19986, 0x19998, 0x199ce, 0x199e2, 0x199e4, 0x199e8, 0x19a08, 0x19a10, 0x19a1e,\n 0x19a20, 0x19a3c, 0x19a40, 0x19a78, 0x19af0, 0x19b18, 0x19b3e, 0x19b60, 0x19b9c, 0x19bc2, 0x19bc4, 0x19bc8,\n 0x19bd0, 0x19be6, 0x19c2e, 0x19c34, 0x19c4e, 0x19c5c, 0x19c62, 0x19c64, 0x19c68, 0x19c8e, 0x19c9c, 0x19cb8,\n 0x19cc2, 0x19cc8, 0x19cd0, 0x19ce6, 0x19cfa, 0x19d0e, 0x19d1c, 0x19d38, 0x19d70, 0x19d7e, 0x19d82, 0x19d84,\n 0x19d88, 0x19d90, 0x19da0, 0x19dcc, 0x19df2, 0x19df4, 0x19e16, 0x19e26, 0x19e2c, 0x19e46, 0x19e4c, 0x19e58,\n 0x19e74, 0x19e86, 0x19e8c, 0x19e98, 0x19eb0, 0x19ebe, 0x19ece, 0x19ee2, 0x19ee4, 0x19ee8, 0x19f0a, 0x19f12,\n 0x19f14, 0x19f22, 0x19f24, 0x19f28, 0x19f42, 0x19f44, 0x19f48, 0x19f50, 0x19f5e, 0x19f6c, 0x19f9a, 0x19fae,\n 0x19fb2, 0x19fb4, 0x1a046, 0x1a04c, 0x1a072, 0x1a074, 0x1a086, 0x1a08c, 0x1a098, 0x1a0b0, 0x1a0be, 0x1a0e2,\n 0x1a0e4, 0x1a0e8, 0x1a0f6, 0x1a106, 0x1a10c, 0x1a118, 0x1a130, 0x1a13e, 0x1a160, 0x1a17c, 0x1a18e, 0x1a19c,\n 0x1a1b8, 0x1a1c2, 0x1a1c4, 0x1a1c8, 0x1a1d0, 0x1a1de, 0x1a1e6, 0x1a1ec, 0x1a218, 0x1a230, 0x1a23e, 0x1a260,\n 0x1a27c, 0x1a2c0, 0x1a2f8, 0x1a31c, 0x1a338, 0x1a370, 0x1a37e, 0x1a382, 0x1a384, 0x1a388, 0x1a390, 0x1a39e,\n 0x1a3a0, 0x1a3bc, 0x1a3c6, 0x1a3cc, 0x1a3d8, 0x1a3ee, 0x1a3f2, 0x1a3f4, 0x1a418, 0x1a430, 0x1a43e, 0x1a460,\n 0x1a47c, 0x1a4c0, 0x1a4f8, 0x1a5f0, 0x1a61c, 0x1a638, 0x1a670, 0x1a67e, 0x1a6e0, 0x1a6fc, 0x1a702, 0x1a704,\n 0x1a708, 0x1a710, 0x1a71e, 0x1a720, 0x1a73c, 0x1a740, 0x1a778, 0x1a786, 0x1a78c, 0x1a798, 0x1a7b0, 0x1a7be,\n 0x1a7ce, 0x1a7dc, 0x1a7e2, 0x1a7e4, 0x1a7e8, 0x1a830, 0x1a860, 0x1a87c, 0x1a8c0, 0x1a8f8, 0x1a9f0, 0x1abe0,\n 0x1ac70, 0x1ac7e, 0x1ace0, 0x1acfc, 0x1adc0, 0x1adf8, 0x1ae04, 0x1ae08, 0x1ae10, 0x1ae20, 0x1ae3c, 0x1ae40,\n 0x1ae78, 0x1aef0, 0x1af06, 0x1af0c, 0x1af18, 0x1af30, 0x1af3e, 0x1af60, 0x1af7c, 0x1af8e, 0x1af9c, 0x1afb8,\n 0x1afc4, 0x1afc8, 0x1afd0, 0x1afde, 0x1b042, 0x1b05e, 0x1b07a, 0x1b082, 0x1b084, 0x1b088, 0x1b090, 0x1b09e,\n 0x1b0a0, 0x1b0bc, 0x1b0cc, 0x1b0f2, 0x1b0f4, 0x1b102, 0x1b104, 0x1b108, 0x1b110, 0x1b11e, 0x1b120, 0x1b13c,\n 0x1b140, 0x1b178, 0x1b186, 0x1b198, 0x1b1ce, 0x1b1e2, 0x1b1e4, 0x1b1e8, 0x1b204, 0x1b208, 0x1b210, 0x1b21e,\n 0x1b220, 0x1b23c, 0x1b240, 0x1b278, 0x1b2f0, 0x1b30c, 0x1b33e, 0x1b360, 0x1b39c, 0x1b3c2, 0x1b3c4, 0x1b3c8,\n 0x1b3d0, 0x1b3e6, 0x1b410, 0x1b41e, 0x1b420, 0x1b43c, 0x1b440, 0x1b478, 0x1b4f0, 0x1b5e0, 0x1b618, 0x1b660,\n 0x1b67c, 0x1b6c0, 0x1b738, 0x1b782, 0x1b784, 0x1b788, 0x1b790, 0x1b79e, 0x1b7a0, 0x1b7cc, 0x1b82e, 0x1b84e,\n 0x1b85c, 0x1b88e, 0x1b89c, 0x1b8b8, 0x1b8c2, 0x1b8c4, 0x1b8c8, 0x1b8d0, 0x1b8e6, 0x1b8fa, 0x1b90e, 0x1b91c,\n 0x1b938, 0x1b970, 0x1b97e, 0x1b982, 0x1b984, 0x1b988, 0x1b990, 0x1b99e, 0x1b9a0, 0x1b9cc, 0x1b9f2, 0x1b9f4,\n 0x1ba0e, 0x1ba1c, 0x1ba38, 0x1ba70, 0x1ba7e, 0x1bae0, 0x1bafc, 0x1bb08, 0x1bb10, 0x1bb20, 0x1bb3c, 0x1bb40,\n 0x1bb98, 0x1bbce, 0x1bbe2, 0x1bbe4, 0x1bbe8, 0x1bc16, 0x1bc26, 0x1bc2c, 0x1bc46, 0x1bc4c, 0x1bc58, 0x1bc72,\n 0x1bc74, 0x1bc86, 0x1bc8c, 0x1bc98, 0x1bcb0, 0x1bcbe, 0x1bcce, 0x1bce2, 0x1bce4, 0x1bce8, 0x1bd06, 0x1bd0c,\n 0x1bd18, 0x1bd30, 0x1bd3e, 0x1bd60, 0x1bd7c, 0x1bd9c, 0x1bdc2, 0x1bdc4, 0x1bdc8, 0x1bdd0, 0x1bde6, 0x1bdfa,\n 0x1be12, 0x1be14, 0x1be22, 0x1be24, 0x1be28, 0x1be42, 0x1be44, 0x1be48, 0x1be50, 0x1be5e, 0x1be66, 0x1be82,\n 0x1be84, 0x1be88, 0x1be90, 0x1be9e, 0x1bea0, 0x1bebc, 0x1becc, 0x1bef4, 0x1bf1a, 0x1bf2e, 0x1bf32, 0x1bf34,\n 0x1bf4e, 0x1bf5c, 0x1bf62, 0x1bf64, 0x1bf68, 0x1c09a, 0x1c0b2, 0x1c0b4, 0x1c11a, 0x1c132, 0x1c134, 0x1c162,\n 0x1c164, 0x1c168, 0x1c176, 0x1c1ba, 0x1c21a, 0x1c232, 0x1c234, 0x1c24e, 0x1c25c, 0x1c262, 0x1c264, 0x1c268,\n 0x1c276, 0x1c28e, 0x1c2c2, 0x1c2c4, 0x1c2c8, 0x1c2d0, 0x1c2de, 0x1c2e6, 0x1c2ec, 0x1c2fa, 0x1c316, 0x1c326,\n 0x1c33a, 0x1c346, 0x1c34c, 0x1c372, 0x1c374, 0x1c41a, 0x1c42e, 0x1c432, 0x1c434, 0x1c44e, 0x1c45c, 0x1c462,\n 0x1c464, 0x1c468, 0x1c476, 0x1c48e, 0x1c49c, 0x1c4b8, 0x1c4c2, 0x1c4c8, 0x1c4d0, 0x1c4de, 0x1c4e6, 0x1c4ec,\n 0x1c4fa, 0x1c51c, 0x1c538, 0x1c570, 0x1c57e, 0x1c582, 0x1c584, 0x1c588, 0x1c590, 0x1c59e, 0x1c5a0, 0x1c5bc,\n 0x1c5c6, 0x1c5cc, 0x1c5d8, 0x1c5ee, 0x1c5f2, 0x1c5f4, 0x1c616, 0x1c626, 0x1c62c, 0x1c63a, 0x1c646, 0x1c64c,\n 0x1c658, 0x1c66e, 0x1c672, 0x1c674, 0x1c686, 0x1c68c, 0x1c698, 0x1c6b0, 0x1c6be, 0x1c6ce, 0x1c6dc, 0x1c6e2,\n 0x1c6e4, 0x1c6e8, 0x1c712, 0x1c714, 0x1c722, 0x1c728, 0x1c736, 0x1c742, 0x1c744, 0x1c748, 0x1c750, 0x1c75e,\n 0x1c766, 0x1c76c, 0x1c77a, 0x1c7ae, 0x1c7d6, 0x1c7ea, 0x1c81a, 0x1c82e, 0x1c832, 0x1c834, 0x1c84e, 0x1c85c,\n 0x1c862, 0x1c864, 0x1c868, 0x1c876, 0x1c88e, 0x1c89c, 0x1c8b8, 0x1c8c2, 0x1c8c8, 0x1c8d0, 0x1c8de, 0x1c8e6,\n 0x1c8ec, 0x1c8fa, 0x1c90e, 0x1c938, 0x1c970, 0x1c97e, 0x1c982, 0x1c984, 0x1c990, 0x1c99e, 0x1c9a0, 0x1c9bc,\n 0x1c9c6, 0x1c9cc, 0x1c9d8, 0x1c9ee, 0x1c9f2, 0x1c9f4, 0x1ca38, 0x1ca70, 0x1ca7e, 0x1cae0, 0x1cafc, 0x1cb02,\n 0x1cb04, 0x1cb08, 0x1cb10, 0x1cb20, 0x1cb3c, 0x1cb40, 0x1cb78, 0x1cb86, 0x1cb8c, 0x1cb98, 0x1cbb0, 0x1cbbe,\n 0x1cbce, 0x1cbdc, 0x1cbe2, 0x1cbe4, 0x1cbe8, 0x1cbf6, 0x1cc16, 0x1cc26, 0x1cc2c, 0x1cc3a, 0x1cc46, 0x1cc58,\n 0x1cc72, 0x1cc74, 0x1cc86, 0x1ccb0, 0x1ccbe, 0x1ccce, 0x1cce2, 0x1cce4, 0x1cce8, 0x1cd06, 0x1cd0c, 0x1cd18,\n 0x1cd30, 0x1cd3e, 0x1cd60, 0x1cd7c, 0x1cd9c, 0x1cdc2, 0x1cdc4, 0x1cdc8, 0x1cdd0, 0x1cdde, 0x1cde6, 0x1cdfa,\n 0x1ce22, 0x1ce28, 0x1ce42, 0x1ce50, 0x1ce5e, 0x1ce66, 0x1ce7a, 0x1ce82, 0x1ce84, 0x1ce88, 0x1ce90, 0x1ce9e,\n 0x1cea0, 0x1cebc, 0x1cecc, 0x1cef2, 0x1cef4, 0x1cf2e, 0x1cf32, 0x1cf34, 0x1cf4e, 0x1cf5c, 0x1cf62, 0x1cf64,\n 0x1cf68, 0x1cf96, 0x1cfa6, 0x1cfac, 0x1cfca, 0x1cfd2, 0x1cfd4, 0x1d02e, 0x1d032, 0x1d034, 0x1d04e, 0x1d05c,\n 0x1d062, 0x1d064, 0x1d068, 0x1d076, 0x1d08e, 0x1d09c, 0x1d0b8, 0x1d0c2, 0x1d0c4, 0x1d0c8, 0x1d0d0, 0x1d0de,\n 0x1d0e6, 0x1d0ec, 0x1d0fa, 0x1d11c, 0x1d138, 0x1d170, 0x1d17e, 0x1d182, 0x1d184, 0x1d188, 0x1d190, 0x1d19e,\n 0x1d1a0, 0x1d1bc, 0x1d1c6, 0x1d1cc, 0x1d1d8, 0x1d1ee, 0x1d1f2, 0x1d1f4, 0x1d21c, 0x1d238, 0x1d270, 0x1d27e,\n 0x1d2e0, 0x1d2fc, 0x1d302, 0x1d304, 0x1d308, 0x1d310, 0x1d31e, 0x1d320, 0x1d33c, 0x1d340, 0x1d378, 0x1d386,\n 0x1d38c, 0x1d398, 0x1d3b0, 0x1d3be, 0x1d3ce, 0x1d3dc, 0x1d3e2, 0x1d3e4, 0x1d3e8, 0x1d3f6, 0x1d470, 0x1d47e,\n 0x1d4e0, 0x1d4fc, 0x1d5c0, 0x1d5f8, 0x1d604, 0x1d608, 0x1d610, 0x1d620, 0x1d640, 0x1d678, 0x1d6f0, 0x1d706,\n 0x1d70c, 0x1d718, 0x1d730, 0x1d73e, 0x1d760, 0x1d77c, 0x1d78e, 0x1d79c, 0x1d7b8, 0x1d7c2, 0x1d7c4, 0x1d7c8,\n 0x1d7d0, 0x1d7de, 0x1d7e6, 0x1d7ec, 0x1d826, 0x1d82c, 0x1d83a, 0x1d846, 0x1d84c, 0x1d858, 0x1d872, 0x1d874,\n 0x1d886, 0x1d88c, 0x1d898, 0x1d8b0, 0x1d8be, 0x1d8ce, 0x1d8e2, 0x1d8e4, 0x1d8e8, 0x1d8f6, 0x1d90c, 0x1d918,\n 0x1d930, 0x1d93e, 0x1d960, 0x1d97c, 0x1d99c, 0x1d9c2, 0x1d9c4, 0x1d9c8, 0x1d9d0, 0x1d9e6, 0x1d9fa, 0x1da0c,\n 0x1da18, 0x1da30, 0x1da3e, 0x1da60, 0x1da7c, 0x1dac0, 0x1daf8, 0x1db38, 0x1db82, 0x1db84, 0x1db88, 0x1db90,\n 0x1db9e, 0x1dba0, 0x1dbcc, 0x1dbf2, 0x1dbf4, 0x1dc22, 0x1dc42, 0x1dc44, 0x1dc48, 0x1dc50, 0x1dc5e, 0x1dc66,\n 0x1dc7a, 0x1dc82, 0x1dc84, 0x1dc88, 0x1dc90, 0x1dc9e, 0x1dca0, 0x1dcbc, 0x1dccc, 0x1dcf2, 0x1dcf4, 0x1dd04,\n 0x1dd08, 0x1dd10, 0x1dd1e, 0x1dd20, 0x1dd3c, 0x1dd40, 0x1dd78, 0x1dd86, 0x1dd98, 0x1ddce, 0x1dde2, 0x1dde4,\n 0x1dde8, 0x1de2e, 0x1de32, 0x1de34, 0x1de4e, 0x1de5c, 0x1de62, 0x1de64, 0x1de68, 0x1de8e, 0x1de9c, 0x1deb8,\n 0x1dec2, 0x1dec4, 0x1dec8, 0x1ded0, 0x1dee6, 0x1defa, 0x1df16, 0x1df26, 0x1df2c, 0x1df46, 0x1df4c, 0x1df58,\n 0x1df72, 0x1df74, 0x1df8a, 0x1df92, 0x1df94, 0x1dfa2, 0x1dfa4, 0x1dfa8, 0x1e08a, 0x1e092, 0x1e094, 0x1e0a2,\n 0x1e0a4, 0x1e0a8, 0x1e0b6, 0x1e0da, 0x1e10a, 0x1e112, 0x1e114, 0x1e122, 0x1e124, 0x1e128, 0x1e136, 0x1e142,\n 0x1e144, 0x1e148, 0x1e150, 0x1e166, 0x1e16c, 0x1e17a, 0x1e19a, 0x1e1b2, 0x1e1b4, 0x1e20a, 0x1e212, 0x1e214,\n 0x1e222, 0x1e224, 0x1e228, 0x1e236, 0x1e242, 0x1e248, 0x1e250, 0x1e25e, 0x1e266, 0x1e26c, 0x1e27a, 0x1e282,\n 0x1e284, 0x1e288, 0x1e290, 0x1e2a0, 0x1e2bc, 0x1e2c6, 0x1e2cc, 0x1e2d8, 0x1e2ee, 0x1e2f2, 0x1e2f4, 0x1e31a,\n 0x1e332, 0x1e334, 0x1e35c, 0x1e362, 0x1e364, 0x1e368, 0x1e3ba, 0x1e40a, 0x1e412, 0x1e414, 0x1e422, 0x1e428,\n 0x1e436, 0x1e442, 0x1e448, 0x1e450, 0x1e45e, 0x1e466, 0x1e46c, 0x1e47a, 0x1e482, 0x1e484, 0x1e490, 0x1e49e,\n 0x1e4a0, 0x1e4bc, 0x1e4c6, 0x1e4cc, 0x1e4d8, 0x1e4ee, 0x1e4f2, 0x1e4f4, 0x1e502, 0x1e504, 0x1e508, 0x1e510,\n 0x1e51e, 0x1e520, 0x1e53c, 0x1e540, 0x1e578, 0x1e586, 0x1e58c, 0x1e598, 0x1e5b0, 0x1e5be, 0x1e5ce, 0x1e5dc,\n 0x1e5e2, 0x1e5e4, 0x1e5e8, 0x1e5f6, 0x1e61a, 0x1e62e, 0x1e632, 0x1e634, 0x1e64e, 0x1e65c, 0x1e662, 0x1e668,\n 0x1e68e, 0x1e69c, 0x1e6b8, 0x1e6c2, 0x1e6c4, 0x1e6c8, 0x1e6d0, 0x1e6e6, 0x1e6fa, 0x1e716, 0x1e726, 0x1e72c,\n 0x1e73a, 0x1e746, 0x1e74c, 0x1e758, 0x1e772, 0x1e774, 0x1e792, 0x1e794, 0x1e7a2, 0x1e7a4, 0x1e7a8, 0x1e7b6,\n 0x1e812, 0x1e814, 0x1e822, 0x1e824, 0x1e828, 0x1e836, 0x1e842, 0x1e844, 0x1e848, 0x1e850, 0x1e85e, 0x1e866,\n 0x1e86c, 0x1e87a, 0x1e882, 0x1e884, 0x1e888, 0x1e890, 0x1e89e, 0x1e8a0, 0x1e8bc, 0x1e8c6, 0x1e8cc, 0x1e8d8,\n 0x1e8ee, 0x1e8f2, 0x1e8f4, 0x1e902, 0x1e904, 0x1e908, 0x1e910, 0x1e920, 0x1e93c, 0x1e940, 0x1e978, 0x1e986,\n 0x1e98c, 0x1e998, 0x1e9b0, 0x1e9be, 0x1e9ce, 0x1e9dc, 0x1e9e2, 0x1e9e4, 0x1e9e8, 0x1e9f6, 0x1ea04, 0x1ea08,\n 0x1ea10, 0x1ea20, 0x1ea40, 0x1ea78, 0x1eaf0, 0x1eb06, 0x1eb0c, 0x1eb18, 0x1eb30, 0x1eb3e, 0x1eb60, 0x1eb7c,\n 0x1eb8e, 0x1eb9c, 0x1ebb8, 0x1ebc2, 0x1ebc4, 0x1ebc8, 0x1ebd0, 0x1ebde, 0x1ebe6, 0x1ebec, 0x1ec1a, 0x1ec2e,\n 0x1ec32, 0x1ec34, 0x1ec4e, 0x1ec5c, 0x1ec62, 0x1ec64, 0x1ec68, 0x1ec8e, 0x1ec9c, 0x1ecb8, 0x1ecc2, 0x1ecc4,\n 0x1ecc8, 0x1ecd0, 0x1ece6, 0x1ecfa, 0x1ed0e, 0x1ed1c, 0x1ed38, 0x1ed70, 0x1ed7e, 0x1ed82, 0x1ed84, 0x1ed88,\n 0x1ed90, 0x1ed9e, 0x1eda0, 0x1edcc, 0x1edf2, 0x1edf4, 0x1ee16, 0x1ee26, 0x1ee2c, 0x1ee3a, 0x1ee46, 0x1ee4c,\n 0x1ee58, 0x1ee6e, 0x1ee72, 0x1ee74, 0x1ee86, 0x1ee8c, 0x1ee98, 0x1eeb0, 0x1eebe, 0x1eece, 0x1eedc, 0x1eee2,\n 0x1eee4, 0x1eee8, 0x1ef12, 0x1ef22, 0x1ef24, 0x1ef28, 0x1ef36, 0x1ef42, 0x1ef44, 0x1ef48, 0x1ef50, 0x1ef5e,\n 0x1ef66, 0x1ef6c, 0x1ef7a, 0x1efae, 0x1efb2, 0x1efb4, 0x1efd6, 0x1f096, 0x1f0a6, 0x1f0ac, 0x1f0ba, 0x1f0ca,\n 0x1f0d2, 0x1f0d4, 0x1f116, 0x1f126, 0x1f12c, 0x1f13a, 0x1f146, 0x1f14c, 0x1f158, 0x1f16e, 0x1f172, 0x1f174,\n 0x1f18a, 0x1f192, 0x1f194, 0x1f1a2, 0x1f1a4, 0x1f1a8, 0x1f1da, 0x1f216, 0x1f226, 0x1f22c, 0x1f23a, 0x1f246,\n 0x1f258, 0x1f26e, 0x1f272, 0x1f274, 0x1f286, 0x1f28c, 0x1f298, 0x1f2b0, 0x1f2be, 0x1f2ce, 0x1f2dc, 0x1f2e2,\n 0x1f2e4, 0x1f2e8, 0x1f2f6, 0x1f30a, 0x1f312, 0x1f314, 0x1f322, 0x1f328, 0x1f342, 0x1f344, 0x1f348, 0x1f350,\n 0x1f35e, 0x1f366, 0x1f37a, 0x1f39a, 0x1f3ae, 0x1f3b2, 0x1f3b4, 0x1f416, 0x1f426, 0x1f42c, 0x1f43a, 0x1f446,\n 0x1f44c, 0x1f458, 0x1f46e, 0x1f472, 0x1f474, 0x1f486, 0x1f48c, 0x1f498, 0x1f4b0, 0x1f4be, 0x1f4ce, 0x1f4dc,\n 0x1f4e2, 0x1f4e4, 0x1f4e8, 0x1f4f6, 0x1f506, 0x1f50c, 0x1f518, 0x1f530, 0x1f53e, 0x1f560, 0x1f57c, 0x1f58e,\n 0x1f59c, 0x1f5b8, 0x1f5c2, 0x1f5c4, 0x1f5c8, 0x1f5d0, 0x1f5de, 0x1f5e6, 0x1f5ec, 0x1f5fa, 0x1f60a, 0x1f612,\n 0x1f614, 0x1f622, 0x1f624, 0x1f628, 0x1f636, 0x1f642, 0x1f644, 0x1f648, 0x1f650, 0x1f65e, 0x1f666, 0x1f67a,\n 0x1f682, 0x1f684, 0x1f688, 0x1f690, 0x1f69e, 0x1f6a0, 0x1f6bc, 0x1f6cc, 0x1f6f2, 0x1f6f4, 0x1f71a, 0x1f72e,\n 0x1f732, 0x1f734, 0x1f74e, 0x1f75c, 0x1f762, 0x1f764, 0x1f768, 0x1f776, 0x1f796, 0x1f7a6, 0x1f7ac, 0x1f7ba,\n 0x1f7d2, 0x1f7d4, 0x1f89a, 0x1f8ae, 0x1f8b2, 0x1f8b4, 0x1f8d6, 0x1f8ea, 0x1f91a, 0x1f92e, 0x1f932, 0x1f934,\n 0x1f94e, 0x1f95c, 0x1f962, 0x1f964, 0x1f968, 0x1f976, 0x1f996, 0x1f9a6, 0x1f9ac, 0x1f9ba, 0x1f9ca, 0x1f9d2,\n 0x1f9d4, 0x1fa1a, 0x1fa2e, 0x1fa32, 0x1fa34, 0x1fa4e, 0x1fa5c, 0x1fa62, 0x1fa64, 0x1fa68, 0x1fa76, 0x1fa8e,\n 0x1fa9c, 0x1fab8, 0x1fac2, 0x1fac4, 0x1fac8, 0x1fad0, 0x1fade, 0x1fae6, 0x1faec, 0x1fb16, 0x1fb26, 0x1fb2c,\n 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1fb92, 0x1fb94, 0x1fba2, 0x1fba4,\n 0x1fba8, 0x1fbb6, 0x1fbda\n ]);\n /**\n * This table contains to codewords for all symbols.\n */\n PDF417Common.CODEWORD_TABLE = Int32Array.from([\n 2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511,\n 873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 809, 2483, 807, 2482, 806, 2480, 815,\n 814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 2626, 2625, 2623, 2628, 1820, 2752,\n 2739, 2737, 2728, 2727, 2725, 2730, 2785, 2783, 2778, 2777, 2775, 2780, 787, 781, 747, 739, 736, 2413, 754, 752,\n 1719, 692, 689, 681, 2371, 678, 2369, 700, 697, 694, 703, 1688, 1686, 642, 638, 2343, 631, 2341, 627, 2338, 651,\n 646, 643, 2345, 654, 652, 1652, 1650, 1647, 1654, 601, 599, 2322, 596, 2321, 594, 2319, 2317, 611, 610, 608, 606,\n 2324, 603, 2323, 615, 614, 612, 1617, 1616, 1614, 1612, 616, 1619, 1618, 2575, 2538, 2536, 905, 901, 898, 909,\n 2509, 2507, 2504, 870, 867, 864, 860, 2512, 875, 872, 1781, 2490, 2489, 2487, 2485, 1748, 836, 834, 832, 830,\n 2494, 827, 2492, 843, 841, 839, 845, 1765, 1763, 2701, 2676, 2674, 2653, 2648, 2656, 2634, 2633, 2631, 2629,\n 1821, 2638, 2636, 2770, 2763, 2761, 2750, 2745, 2753, 2736, 2735, 2733, 2731, 1848, 2740, 2738, 2786, 2784, 591,\n 588, 576, 569, 566, 2296, 1590, 537, 534, 526, 2276, 522, 2274, 545, 542, 539, 548, 1572, 1570, 481, 2245, 466,\n 2242, 462, 2239, 492, 485, 482, 2249, 496, 494, 1534, 1531, 1528, 1538, 413, 2196, 406, 2191, 2188, 425, 419,\n 2202, 415, 2199, 432, 430, 427, 1472, 1467, 1464, 433, 1476, 1474, 368, 367, 2160, 365, 2159, 362, 2157, 2155,\n 2152, 378, 377, 375, 2166, 372, 2165, 369, 2162, 383, 381, 379, 2168, 1419, 1418, 1416, 1414, 385, 1411, 384,\n 1423, 1422, 1420, 1424, 2461, 802, 2441, 2439, 790, 786, 783, 794, 2409, 2406, 2403, 750, 742, 738, 2414, 756,\n 753, 1720, 2367, 2365, 2362, 2359, 1663, 693, 691, 684, 2373, 680, 2370, 702, 699, 696, 704, 1690, 1687, 2337,\n 2336, 2334, 2332, 1624, 2329, 1622, 640, 637, 2344, 634, 2342, 630, 2340, 650, 648, 645, 2346, 655, 653, 1653,\n 1651, 1649, 1655, 2612, 2597, 2595, 2571, 2568, 2565, 2576, 2534, 2529, 2526, 1787, 2540, 2537, 907, 904, 900,\n 910, 2503, 2502, 2500, 2498, 1768, 2495, 1767, 2510, 2508, 2506, 869, 866, 863, 2513, 876, 874, 1782, 2720, 2713,\n 2711, 2697, 2694, 2691, 2702, 2672, 2670, 2664, 1828, 2678, 2675, 2647, 2646, 2644, 2642, 1823, 2639, 1822, 2654,\n 2652, 2650, 2657, 2771, 1855, 2765, 2762, 1850, 1849, 2751, 2749, 2747, 2754, 353, 2148, 344, 342, 336, 2142,\n 332, 2140, 345, 1375, 1373, 306, 2130, 299, 2128, 295, 2125, 319, 314, 311, 2132, 1354, 1352, 1349, 1356, 262,\n 257, 2101, 253, 2096, 2093, 274, 273, 267, 2107, 263, 2104, 280, 278, 275, 1316, 1311, 1308, 1320, 1318, 2052,\n 202, 2050, 2044, 2040, 219, 2063, 212, 2060, 208, 2055, 224, 221, 2066, 1260, 1258, 1252, 231, 1248, 229, 1266,\n 1264, 1261, 1268, 155, 1998, 153, 1996, 1994, 1991, 1988, 165, 164, 2007, 162, 2006, 159, 2003, 2000, 172, 171,\n 169, 2012, 166, 2010, 1186, 1184, 1182, 1179, 175, 1176, 173, 1192, 1191, 1189, 1187, 176, 1194, 1193, 2313,\n 2307, 2305, 592, 589, 2294, 2292, 2289, 578, 572, 568, 2297, 580, 1591, 2272, 2267, 2264, 1547, 538, 536, 529,\n 2278, 525, 2275, 547, 544, 541, 1574, 1571, 2237, 2235, 2229, 1493, 2225, 1489, 478, 2247, 470, 2244, 465, 2241,\n 493, 488, 484, 2250, 498, 495, 1536, 1533, 1530, 1539, 2187, 2186, 2184, 2182, 1432, 2179, 1430, 2176, 1427, 414,\n 412, 2197, 409, 2195, 405, 2193, 2190, 426, 424, 421, 2203, 418, 2201, 431, 429, 1473, 1471, 1469, 1466, 434,\n 1477, 1475, 2478, 2472, 2470, 2459, 2457, 2454, 2462, 803, 2437, 2432, 2429, 1726, 2443, 2440, 792, 789, 785,\n 2401, 2399, 2393, 1702, 2389, 1699, 2411, 2408, 2405, 745, 741, 2415, 758, 755, 1721, 2358, 2357, 2355, 2353,\n 1661, 2350, 1660, 2347, 1657, 2368, 2366, 2364, 2361, 1666, 690, 687, 2374, 683, 2372, 701, 698, 705, 1691, 1689,\n 2619, 2617, 2610, 2608, 2605, 2613, 2593, 2588, 2585, 1803, 2599, 2596, 2563, 2561, 2555, 1797, 2551, 1795, 2573,\n 2570, 2567, 2577, 2525, 2524, 2522, 2520, 1786, 2517, 1785, 2514, 1783, 2535, 2533, 2531, 2528, 1788, 2541, 2539,\n 906, 903, 911, 2721, 1844, 2715, 2712, 1838, 1836, 2699, 2696, 2693, 2703, 1827, 1826, 1824, 2673, 2671, 2669,\n 2666, 1829, 2679, 2677, 1858, 1857, 2772, 1854, 1853, 1851, 1856, 2766, 2764, 143, 1987, 139, 1986, 135, 133,\n 131, 1984, 128, 1983, 125, 1981, 138, 137, 136, 1985, 1133, 1132, 1130, 112, 110, 1974, 107, 1973, 104, 1971,\n 1969, 122, 121, 119, 117, 1977, 114, 1976, 124, 1115, 1114, 1112, 1110, 1117, 1116, 84, 83, 1953, 81, 1952, 78,\n 1950, 1948, 1945, 94, 93, 91, 1959, 88, 1958, 85, 1955, 99, 97, 95, 1961, 1086, 1085, 1083, 1081, 1078, 100,\n 1090, 1089, 1087, 1091, 49, 47, 1917, 44, 1915, 1913, 1910, 1907, 59, 1926, 56, 1925, 53, 1922, 1919, 66, 64,\n 1931, 61, 1929, 1042, 1040, 1038, 71, 1035, 70, 1032, 68, 1048, 1047, 1045, 1043, 1050, 1049, 12, 10, 1869, 1867,\n 1864, 1861, 21, 1880, 19, 1877, 1874, 1871, 28, 1888, 25, 1886, 22, 1883, 982, 980, 977, 974, 32, 30, 991, 989,\n 987, 984, 34, 995, 994, 992, 2151, 2150, 2147, 2146, 2144, 356, 355, 354, 2149, 2139, 2138, 2136, 2134, 1359,\n 343, 341, 338, 2143, 335, 2141, 348, 347, 346, 1376, 1374, 2124, 2123, 2121, 2119, 1326, 2116, 1324, 310, 308,\n 305, 2131, 302, 2129, 298, 2127, 320, 318, 316, 313, 2133, 322, 321, 1355, 1353, 1351, 1357, 2092, 2091, 2089,\n 2087, 1276, 2084, 1274, 2081, 1271, 259, 2102, 256, 2100, 252, 2098, 2095, 272, 269, 2108, 266, 2106, 281, 279,\n 277, 1317, 1315, 1313, 1310, 282, 1321, 1319, 2039, 2037, 2035, 2032, 1203, 2029, 1200, 1197, 207, 2053, 205,\n 2051, 201, 2049, 2046, 2043, 220, 218, 2064, 215, 2062, 211, 2059, 228, 226, 223, 2069, 1259, 1257, 1254, 232,\n 1251, 230, 1267, 1265, 1263, 2316, 2315, 2312, 2311, 2309, 2314, 2304, 2303, 2301, 2299, 1593, 2308, 2306, 590,\n 2288, 2287, 2285, 2283, 1578, 2280, 1577, 2295, 2293, 2291, 579, 577, 574, 571, 2298, 582, 581, 1592, 2263, 2262,\n 2260, 2258, 1545, 2255, 1544, 2252, 1541, 2273, 2271, 2269, 2266, 1550, 535, 532, 2279, 528, 2277, 546, 543, 549,\n 1575, 1573, 2224, 2222, 2220, 1486, 2217, 1485, 2214, 1482, 1479, 2238, 2236, 2234, 2231, 1496, 2228, 1492, 480,\n 477, 2248, 473, 2246, 469, 2243, 490, 487, 2251, 497, 1537, 1535, 1532, 2477, 2476, 2474, 2479, 2469, 2468, 2466,\n 2464, 1730, 2473, 2471, 2453, 2452, 2450, 2448, 1729, 2445, 1728, 2460, 2458, 2456, 2463, 805, 804, 2428, 2427,\n 2425, 2423, 1725, 2420, 1724, 2417, 1722, 2438, 2436, 2434, 2431, 1727, 2444, 2442, 793, 791, 788, 795, 2388,\n 2386, 2384, 1697, 2381, 1696, 2378, 1694, 1692, 2402, 2400, 2398, 2395, 1703, 2392, 1701, 2412, 2410, 2407, 751,\n 748, 744, 2416, 759, 757, 1807, 2620, 2618, 1806, 1805, 2611, 2609, 2607, 2614, 1802, 1801, 1799, 2594, 2592,\n 2590, 2587, 1804, 2600, 2598, 1794, 1793, 1791, 1789, 2564, 2562, 2560, 2557, 1798, 2554, 1796, 2574, 2572, 2569,\n 2578, 1847, 1846, 2722, 1843, 1842, 1840, 1845, 2716, 2714, 1835, 1834, 1832, 1830, 1839, 1837, 2700, 2698, 2695,\n 2704, 1817, 1811, 1810, 897, 862, 1777, 829, 826, 838, 1760, 1758, 808, 2481, 1741, 1740, 1738, 1743, 2624, 1818,\n 2726, 2776, 782, 740, 737, 1715, 686, 679, 695, 1682, 1680, 639, 628, 2339, 647, 644, 1645, 1643, 1640, 1648,\n 602, 600, 597, 595, 2320, 593, 2318, 609, 607, 604, 1611, 1610, 1608, 1606, 613, 1615, 1613, 2328, 926, 924, 892,\n 886, 899, 857, 850, 2505, 1778, 824, 823, 821, 819, 2488, 818, 2486, 833, 831, 828, 840, 1761, 1759, 2649, 2632,\n 2630, 2746, 2734, 2732, 2782, 2781, 570, 567, 1587, 531, 527, 523, 540, 1566, 1564, 476, 467, 463, 2240, 486,\n 483, 1524, 1521, 1518, 1529, 411, 403, 2192, 399, 2189, 423, 416, 1462, 1457, 1454, 428, 1468, 1465, 2210, 366,\n 363, 2158, 360, 2156, 357, 2153, 376, 373, 370, 2163, 1410, 1409, 1407, 1405, 382, 1402, 380, 1417, 1415, 1412,\n 1421, 2175, 2174, 777, 774, 771, 784, 732, 725, 722, 2404, 743, 1716, 676, 674, 668, 2363, 665, 2360, 685, 1684,\n 1681, 626, 624, 622, 2335, 620, 2333, 617, 2330, 641, 635, 649, 1646, 1644, 1642, 2566, 928, 925, 2530, 2527,\n 894, 891, 888, 2501, 2499, 2496, 858, 856, 854, 851, 1779, 2692, 2668, 2665, 2645, 2643, 2640, 2651, 2768, 2759,\n 2757, 2744, 2743, 2741, 2748, 352, 1382, 340, 337, 333, 1371, 1369, 307, 300, 296, 2126, 315, 312, 1347, 1342,\n 1350, 261, 258, 250, 2097, 246, 2094, 271, 268, 264, 1306, 1301, 1298, 276, 1312, 1309, 2115, 203, 2048, 195,\n 2045, 191, 2041, 213, 209, 2056, 1246, 1244, 1238, 225, 1234, 222, 1256, 1253, 1249, 1262, 2080, 2079, 154, 1997,\n 150, 1995, 147, 1992, 1989, 163, 160, 2004, 156, 2001, 1175, 1174, 1172, 1170, 1167, 170, 1164, 167, 1185, 1183,\n 1180, 1177, 174, 1190, 1188, 2025, 2024, 2022, 587, 586, 564, 559, 556, 2290, 573, 1588, 520, 518, 512, 2268,\n 508, 2265, 530, 1568, 1565, 461, 457, 2233, 450, 2230, 446, 2226, 479, 471, 489, 1526, 1523, 1520, 397, 395,\n 2185, 392, 2183, 389, 2180, 2177, 410, 2194, 402, 422, 1463, 1461, 1459, 1456, 1470, 2455, 799, 2433, 2430, 779,\n 776, 773, 2397, 2394, 2390, 734, 728, 724, 746, 1717, 2356, 2354, 2351, 2348, 1658, 677, 675, 673, 670, 667, 688,\n 1685, 1683, 2606, 2589, 2586, 2559, 2556, 2552, 927, 2523, 2521, 2518, 2515, 1784, 2532, 895, 893, 890, 2718,\n 2709, 2707, 2689, 2687, 2684, 2663, 2662, 2660, 2658, 1825, 2667, 2769, 1852, 2760, 2758, 142, 141, 1139, 1138,\n 134, 132, 129, 126, 1982, 1129, 1128, 1126, 1131, 113, 111, 108, 105, 1972, 101, 1970, 120, 118, 115, 1109, 1108,\n 1106, 1104, 123, 1113, 1111, 82, 79, 1951, 75, 1949, 72, 1946, 92, 89, 86, 1956, 1077, 1076, 1074, 1072, 98,\n 1069, 96, 1084, 1082, 1079, 1088, 1968, 1967, 48, 45, 1916, 42, 1914, 39, 1911, 1908, 60, 57, 54, 1923, 50, 1920,\n 1031, 1030, 1028, 1026, 67, 1023, 65, 1020, 62, 1041, 1039, 1036, 1033, 69, 1046, 1044, 1944, 1943, 1941, 11, 9,\n 1868, 7, 1865, 1862, 1859, 20, 1878, 16, 1875, 13, 1872, 970, 968, 966, 963, 29, 960, 26, 23, 983, 981, 978, 975,\n 33, 971, 31, 990, 988, 985, 1906, 1904, 1902, 993, 351, 2145, 1383, 331, 330, 328, 326, 2137, 323, 2135, 339,\n 1372, 1370, 294, 293, 291, 289, 2122, 286, 2120, 283, 2117, 309, 303, 317, 1348, 1346, 1344, 245, 244, 242, 2090,\n 239, 2088, 236, 2085, 2082, 260, 2099, 249, 270, 1307, 1305, 1303, 1300, 1314, 189, 2038, 186, 2036, 183, 2033,\n 2030, 2026, 206, 198, 2047, 194, 216, 1247, 1245, 1243, 1240, 227, 1237, 1255, 2310, 2302, 2300, 2286, 2284,\n 2281, 565, 563, 561, 558, 575, 1589, 2261, 2259, 2256, 2253, 1542, 521, 519, 517, 514, 2270, 511, 533, 1569,\n 1567, 2223, 2221, 2218, 2215, 1483, 2211, 1480, 459, 456, 453, 2232, 449, 474, 491, 1527, 1525, 1522, 2475, 2467,\n 2465, 2451, 2449, 2446, 801, 800, 2426, 2424, 2421, 2418, 1723, 2435, 780, 778, 775, 2387, 2385, 2382, 2379,\n 1695, 2375, 1693, 2396, 735, 733, 730, 727, 749, 1718, 2616, 2615, 2604, 2603, 2601, 2584, 2583, 2581, 2579,\n 1800, 2591, 2550, 2549, 2547, 2545, 1792, 2542, 1790, 2558, 929, 2719, 1841, 2710, 2708, 1833, 1831, 2690, 2688,\n 2686, 1815, 1809, 1808, 1774, 1756, 1754, 1737, 1736, 1734, 1739, 1816, 1711, 1676, 1674, 633, 629, 1638, 1636,\n 1633, 1641, 598, 1605, 1604, 1602, 1600, 605, 1609, 1607, 2327, 887, 853, 1775, 822, 820, 1757, 1755, 1584, 524,\n 1560, 1558, 468, 464, 1514, 1511, 1508, 1519, 408, 404, 400, 1452, 1447, 1444, 417, 1458, 1455, 2208, 364, 361,\n 358, 2154, 1401, 1400, 1398, 1396, 374, 1393, 371, 1408, 1406, 1403, 1413, 2173, 2172, 772, 726, 723, 1712, 672,\n 669, 666, 682, 1678, 1675, 625, 623, 621, 618, 2331, 636, 632, 1639, 1637, 1635, 920, 918, 884, 880, 889, 849,\n 848, 847, 846, 2497, 855, 852, 1776, 2641, 2742, 2787, 1380, 334, 1367, 1365, 301, 297, 1340, 1338, 1335, 1343,\n 255, 251, 247, 1296, 1291, 1288, 265, 1302, 1299, 2113, 204, 196, 192, 2042, 1232, 1230, 1224, 214, 1220, 210,\n 1242, 1239, 1235, 1250, 2077, 2075, 151, 148, 1993, 144, 1990, 1163, 1162, 1160, 1158, 1155, 161, 1152, 157,\n 1173, 1171, 1168, 1165, 168, 1181, 1178, 2021, 2020, 2018, 2023, 585, 560, 557, 1585, 516, 509, 1562, 1559, 458,\n 447, 2227, 472, 1516, 1513, 1510, 398, 396, 393, 390, 2181, 386, 2178, 407, 1453, 1451, 1449, 1446, 420, 1460,\n 2209, 769, 764, 720, 712, 2391, 729, 1713, 664, 663, 661, 659, 2352, 656, 2349, 671, 1679, 1677, 2553, 922, 919,\n 2519, 2516, 885, 883, 881, 2685, 2661, 2659, 2767, 2756, 2755, 140, 1137, 1136, 130, 127, 1125, 1124, 1122, 1127,\n 109, 106, 102, 1103, 1102, 1100, 1098, 116, 1107, 1105, 1980, 80, 76, 73, 1947, 1068, 1067, 1065, 1063, 90, 1060,\n 87, 1075, 1073, 1070, 1080, 1966, 1965, 46, 43, 40, 1912, 36, 1909, 1019, 1018, 1016, 1014, 58, 1011, 55, 1008,\n 51, 1029, 1027, 1024, 1021, 63, 1037, 1034, 1940, 1939, 1937, 1942, 8, 1866, 4, 1863, 1, 1860, 956, 954, 952,\n 949, 946, 17, 14, 969, 967, 964, 961, 27, 957, 24, 979, 976, 972, 1901, 1900, 1898, 1896, 986, 1905, 1903, 350,\n 349, 1381, 329, 327, 324, 1368, 1366, 292, 290, 287, 284, 2118, 304, 1341, 1339, 1337, 1345, 243, 240, 237, 2086,\n 233, 2083, 254, 1297, 1295, 1293, 1290, 1304, 2114, 190, 187, 184, 2034, 180, 2031, 177, 2027, 199, 1233, 1231,\n 1229, 1226, 217, 1223, 1241, 2078, 2076, 584, 555, 554, 552, 550, 2282, 562, 1586, 507, 506, 504, 502, 2257, 499,\n 2254, 515, 1563, 1561, 445, 443, 441, 2219, 438, 2216, 435, 2212, 460, 454, 475, 1517, 1515, 1512, 2447, 798,\n 797, 2422, 2419, 770, 768, 766, 2383, 2380, 2376, 721, 719, 717, 714, 731, 1714, 2602, 2582, 2580, 2548, 2546,\n 2543, 923, 921, 2717, 2706, 2705, 2683, 2682, 2680, 1771, 1752, 1750, 1733, 1732, 1731, 1735, 1814, 1707, 1670,\n 1668, 1631, 1629, 1626, 1634, 1599, 1598, 1596, 1594, 1603, 1601, 2326, 1772, 1753, 1751, 1581, 1554, 1552, 1504,\n 1501, 1498, 1509, 1442, 1437, 1434, 401, 1448, 1445, 2206, 1392, 1391, 1389, 1387, 1384, 359, 1399, 1397, 1394,\n 1404, 2171, 2170, 1708, 1672, 1669, 619, 1632, 1630, 1628, 1773, 1378, 1363, 1361, 1333, 1328, 1336, 1286, 1281,\n 1278, 248, 1292, 1289, 2111, 1218, 1216, 1210, 197, 1206, 193, 1228, 1225, 1221, 1236, 2073, 2071, 1151, 1150,\n 1148, 1146, 152, 1143, 149, 1140, 145, 1161, 1159, 1156, 1153, 158, 1169, 1166, 2017, 2016, 2014, 2019, 1582,\n 510, 1556, 1553, 452, 448, 1506, 1500, 394, 391, 387, 1443, 1441, 1439, 1436, 1450, 2207, 765, 716, 713, 1709,\n 662, 660, 657, 1673, 1671, 916, 914, 879, 878, 877, 882, 1135, 1134, 1121, 1120, 1118, 1123, 1097, 1096, 1094,\n 1092, 103, 1101, 1099, 1979, 1059, 1058, 1056, 1054, 77, 1051, 74, 1066, 1064, 1061, 1071, 1964, 1963, 1007,\n 1006, 1004, 1002, 999, 41, 996, 37, 1017, 1015, 1012, 1009, 52, 1025, 1022, 1936, 1935, 1933, 1938, 942, 940,\n 938, 935, 932, 5, 2, 955, 953, 950, 947, 18, 943, 15, 965, 962, 958, 1895, 1894, 1892, 1890, 973, 1899, 1897,\n 1379, 325, 1364, 1362, 288, 285, 1334, 1332, 1330, 241, 238, 234, 1287, 1285, 1283, 1280, 1294, 2112, 188, 185,\n 181, 178, 2028, 1219, 1217, 1215, 1212, 200, 1209, 1227, 2074, 2072, 583, 553, 551, 1583, 505, 503, 500, 513,\n 1557, 1555, 444, 442, 439, 436, 2213, 455, 451, 1507, 1505, 1502, 796, 763, 762, 760, 767, 711, 710, 708, 706,\n 2377, 718, 715, 1710, 2544, 917, 915, 2681, 1627, 1597, 1595, 2325, 1769, 1749, 1747, 1499, 1438, 1435, 2204,\n 1390, 1388, 1385, 1395, 2169, 2167, 1704, 1665, 1662, 1625, 1623, 1620, 1770, 1329, 1282, 1279, 2109, 1214, 1207,\n 1222, 2068, 2065, 1149, 1147, 1144, 1141, 146, 1157, 1154, 2013, 2011, 2008, 2015, 1579, 1549, 1546, 1495, 1487,\n 1433, 1431, 1428, 1425, 388, 1440, 2205, 1705, 658, 1667, 1664, 1119, 1095, 1093, 1978, 1057, 1055, 1052, 1062,\n 1962, 1960, 1005, 1003, 1000, 997, 38, 1013, 1010, 1932, 1930, 1927, 1934, 941, 939, 936, 933, 6, 930, 3, 951,\n 948, 944, 1889, 1887, 1884, 1881, 959, 1893, 1891, 35, 1377, 1360, 1358, 1327, 1325, 1322, 1331, 1277, 1275,\n 1272, 1269, 235, 1284, 2110, 1205, 1204, 1201, 1198, 182, 1195, 179, 1213, 2070, 2067, 1580, 501, 1551, 1548,\n 440, 437, 1497, 1494, 1490, 1503, 761, 709, 707, 1706, 913, 912, 2198, 1386, 2164, 2161, 1621, 1766, 2103, 1208,\n 2058, 2054, 1145, 1142, 2005, 2002, 1999, 2009, 1488, 1429, 1426, 2200, 1698, 1659, 1656, 1975, 1053, 1957, 1954,\n 1001, 998, 1924, 1921, 1918, 1928, 937, 934, 931, 1879, 1876, 1873, 1870, 945, 1885, 1882, 1323, 1273, 1270,\n 2105, 1202, 1199, 1196, 1211, 2061, 2057, 1576, 1543, 1540, 1484, 1481, 1478, 1491, 1700\n ]);\n\n /*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // import java.util.List;\n /**\n * @author Guenther Grau\n */\n /*public final*/ class PDF417DetectorResult {\n constructor(bits, points) {\n this.bits = bits;\n this.points = points;\n }\n getBits() {\n return this.bits;\n }\n getPoints() {\n return this.points;\n }\n }\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // import java.util.ArrayList;\n // import java.util.Arrays;\n // import java.util.List;\n // import java.util.Map;\n /**\n * Encapsulates logic that can detect a PDF417 Code in an image, even if the\n * PDF417 Code is rotated or skewed, or partially obscured.
\n *\n * @author SITA Lab (kevin.osullivan@sita.aero)\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Guenther Grau\n */\n /*public*/ /*final*/ class Detector$3 {\n /**\n * Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.
\n *\n * @param image barcode image to decode\n * @param hints optional hints to detector\n * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will\n * be found and returned\n * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code\n * @throws NotFoundException if no PDF417 Code can be found\n */\n static detectMultiple(image, hints, multiple) {\n // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even\n // different binarizers\n // boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);\n let bitMatrix = image.getBlackMatrix();\n let barcodeCoordinates = Detector$3.detect(multiple, bitMatrix);\n if (!barcodeCoordinates.length) {\n bitMatrix = bitMatrix.clone();\n bitMatrix.rotate180();\n barcodeCoordinates = Detector$3.detect(multiple, bitMatrix);\n }\n return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);\n }\n /**\n * Detects PDF417 codes in an image. Only checks 0 degree rotation\n * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will\n * be found and returned\n * @param bitMatrix bit matrix to detect barcodes in\n * @return List of ResultPoint arrays containing the coordinates of found barcodes\n */\n static detect(multiple, bitMatrix) {\n const barcodeCoordinates = new Array();\n let row = 0;\n let column = 0;\n let foundBarcodeInRow = false;\n while (row < bitMatrix.getHeight()) {\n const vertices = Detector$3.findVertices(bitMatrix, row, column);\n if (vertices[0] == null && vertices[3] == null) {\n if (!foundBarcodeInRow) {\n // we didn't find any barcode so that's the end of searching\n break;\n }\n // we didn't find a barcode starting at the given column and row. Try again from the first column and slightly\n // below the lowest barcode we found so far.\n foundBarcodeInRow = false;\n column = 0;\n for (const barcodeCoordinate of barcodeCoordinates) {\n if (barcodeCoordinate[1] != null) {\n row = Math.trunc(Math.max(row, barcodeCoordinate[1].getY()));\n }\n if (barcodeCoordinate[3] != null) {\n row = Math.max(row, Math.trunc(barcodeCoordinate[3].getY()));\n }\n }\n row += Detector$3.ROW_STEP;\n continue;\n }\n foundBarcodeInRow = true;\n barcodeCoordinates.push(vertices);\n if (!multiple) {\n break;\n }\n // if we didn't find a right row indicator column, then continue the search for the next barcode after the\n // start pattern of the barcode just found.\n if (vertices[2] != null) {\n column = Math.trunc(vertices[2].getX());\n row = Math.trunc(vertices[2].getY());\n }\n else {\n column = Math.trunc(vertices[4].getX());\n row = Math.trunc(vertices[4].getY());\n }\n }\n return barcodeCoordinates;\n }\n /**\n * Locate the vertices and the codewords area of a black blob using the Start\n * and Stop patterns as locators.\n *\n * @param matrix the scanned barcode image.\n * @return an array containing the vertices:\n * vertices[0] x, y top left barcode\n * vertices[1] x, y bottom left barcode\n * vertices[2] x, y top right barcode\n * vertices[3] x, y bottom right barcode\n * vertices[4] x, y top left codeword area\n * vertices[5] x, y bottom left codeword area\n * vertices[6] x, y top right codeword area\n * vertices[7] x, y bottom right codeword area\n */\n static findVertices(matrix, startRow, startColumn) {\n const height = matrix.getHeight();\n const width = matrix.getWidth();\n // const result = new ResultPoint[8];\n const result = new Array(8);\n Detector$3.copyToResult(result, Detector$3.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector$3.START_PATTERN), Detector$3.INDEXES_START_PATTERN);\n if (result[4] != null) {\n startColumn = Math.trunc(result[4].getX());\n startRow = Math.trunc(result[4].getY());\n }\n Detector$3.copyToResult(result, Detector$3.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector$3.STOP_PATTERN), Detector$3.INDEXES_STOP_PATTERN);\n return result;\n }\n static copyToResult(result, tmpResult, destinationIndexes) {\n for (let i = 0; i < destinationIndexes.length; i++) {\n result[destinationIndexes[i]] = tmpResult[i];\n }\n }\n static findRowsWithPattern(matrix, height, width, startRow, startColumn, pattern) {\n // const result = new ResultPoint[4];\n const result = new Array(4);\n let found = false;\n const counters = new Int32Array(pattern.length);\n for (; startRow < height; startRow += Detector$3.ROW_STEP) {\n let loc = Detector$3.findGuardPattern(matrix, startColumn, startRow, width, false, pattern, counters);\n if (loc != null) {\n while (startRow > 0) {\n const previousRowLoc = Detector$3.findGuardPattern(matrix, startColumn, --startRow, width, false, pattern, counters);\n if (previousRowLoc != null) {\n loc = previousRowLoc;\n }\n else {\n startRow++;\n break;\n }\n }\n result[0] = new ResultPoint(loc[0], startRow);\n result[1] = new ResultPoint(loc[1], startRow);\n found = true;\n break;\n }\n }\n let stopRow = startRow + 1;\n // Last row of the current symbol that contains pattern\n if (found) {\n let skippedRowCount = 0;\n let previousRowLoc = Int32Array.from([Math.trunc(result[0].getX()), Math.trunc(result[1].getX())]);\n for (; stopRow < height; stopRow++) {\n const loc = Detector$3.findGuardPattern(matrix, previousRowLoc[0], stopRow, width, false, pattern, counters);\n // a found pattern is only considered to belong to the same barcode if the start and end positions\n // don't differ too much. Pattern drift should be not bigger than two for consecutive rows. With\n // a higher number of skipped rows drift could be larger. To keep it simple for now, we allow a slightly\n // larger drift and don't check for skipped rows.\n if (loc != null &&\n Math.abs(previousRowLoc[0] - loc[0]) < Detector$3.MAX_PATTERN_DRIFT &&\n Math.abs(previousRowLoc[1] - loc[1]) < Detector$3.MAX_PATTERN_DRIFT) {\n previousRowLoc = loc;\n skippedRowCount = 0;\n }\n else {\n if (skippedRowCount > Detector$3.SKIPPED_ROW_COUNT_MAX) {\n break;\n }\n else {\n skippedRowCount++;\n }\n }\n }\n stopRow -= skippedRowCount + 1;\n result[2] = new ResultPoint(previousRowLoc[0], stopRow);\n result[3] = new ResultPoint(previousRowLoc[1], stopRow);\n }\n if (stopRow - startRow < Detector$3.BARCODE_MIN_HEIGHT) {\n Arrays.fill(result, null);\n }\n return result;\n }\n /**\n * @param matrix row of black/white values to search\n * @param column x position to start search\n * @param row y position to start search\n * @param width the number of pixels to search on this row\n * @param pattern pattern of counts of number of black and white pixels that are\n * being searched for as a pattern\n * @param counters array of counters, as long as pattern, to re-use\n * @return start/end horizontal offset of guard pattern, as an array of two ints.\n */\n static findGuardPattern(matrix, column, row, width, whiteFirst, pattern, counters) {\n Arrays.fillWithin(counters, 0, counters.length, 0);\n let patternStart = column;\n let pixelDrift = 0;\n // if there are black pixels left of the current pixel shift to the left, but only for MAX_PIXEL_DRIFT pixels\n while (matrix.get(patternStart, row) && patternStart > 0 && pixelDrift++ < Detector$3.MAX_PIXEL_DRIFT) {\n patternStart--;\n }\n let x = patternStart;\n let counterPosition = 0;\n let patternLength = pattern.length;\n for (let isWhite = whiteFirst; x < width; x++) {\n let pixel = matrix.get(x, row);\n if (pixel !== isWhite) {\n counters[counterPosition]++;\n }\n else {\n if (counterPosition === patternLength - 1) {\n if (Detector$3.patternMatchVariance(counters, pattern, Detector$3.MAX_INDIVIDUAL_VARIANCE) < Detector$3.MAX_AVG_VARIANCE) {\n return new Int32Array([patternStart, x]);\n }\n patternStart += counters[0] + counters[1];\n System.arraycopy(counters, 2, counters, 0, counterPosition - 1);\n counters[counterPosition - 1] = 0;\n counters[counterPosition] = 0;\n counterPosition--;\n }\n else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n if (counterPosition === patternLength - 1 &&\n Detector$3.patternMatchVariance(counters, pattern, Detector$3.MAX_INDIVIDUAL_VARIANCE) < Detector$3.MAX_AVG_VARIANCE) {\n return new Int32Array([patternStart, x - 1]);\n }\n return null;\n }\n /**\n * Determines how closely a set of observed counts of runs of black/white\n * values matches a given target pattern. This is reported as the ratio of\n * the total variance from the expected pattern proportions across all\n * pattern elements, to the length of the pattern.\n *\n * @param counters observed counters\n * @param pattern expected pattern\n * @param maxIndividualVariance The most any counter can differ before we give up\n * @return ratio of total variance between counters and pattern compared to total pattern size\n */\n static patternMatchVariance(counters, pattern, maxIndividualVariance) {\n let numCounters = counters.length;\n let total = 0;\n let patternLength = 0;\n for (let i = 0; i < numCounters; i++) {\n total += counters[i];\n patternLength += pattern[i];\n }\n if (total < patternLength) {\n // If we don't even have one pixel per unit of bar width, assume this\n // is too small to reliably match, so fail:\n return /*Float.POSITIVE_INFINITY*/ Infinity;\n }\n // We're going to fake floating-point math in integers. We just need to use more bits.\n // Scale up patternLength so that intermediate values below like scaledCounter will have\n // more \"significant digits\".\n let unitBarWidth = total / patternLength;\n maxIndividualVariance *= unitBarWidth;\n let totalVariance = 0.0;\n for (let x = 0; x < numCounters; x++) {\n let counter = counters[x];\n let scaledPattern = pattern[x] * unitBarWidth;\n let variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;\n if (variance > maxIndividualVariance) {\n return /*Float.POSITIVE_INFINITY*/ Infinity;\n }\n totalVariance += variance;\n }\n return totalVariance / total;\n }\n }\n Detector$3.INDEXES_START_PATTERN = Int32Array.from([0, 4, 1, 5]);\n Detector$3.INDEXES_STOP_PATTERN = Int32Array.from([6, 2, 7, 3]);\n Detector$3.MAX_AVG_VARIANCE = 0.42;\n Detector$3.MAX_INDIVIDUAL_VARIANCE = 0.8;\n // B S B S B S B S Bar/Space pattern\n // 11111111 0 1 0 1 0 1 000\n Detector$3.START_PATTERN = Int32Array.from([8, 1, 1, 1, 1, 1, 1, 3]);\n // 1111111 0 1 000 1 0 1 00 1\n Detector$3.STOP_PATTERN = Int32Array.from([7, 1, 1, 3, 1, 1, 1, 2, 1]);\n Detector$3.MAX_PIXEL_DRIFT = 3;\n Detector$3.MAX_PATTERN_DRIFT = 5;\n // if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged.\n // if we set the value too high, then we might detect the start pattern from a neighbor barcode.\n Detector$3.SKIPPED_ROW_COUNT_MAX = 25;\n // A PDF471 barcode should have at least 3 rows, with each row being >= 3 times the module width. Therefore it should be at least\n // 9 pixels tall. To be conservative, we use about half the size to ensure we don't miss it.\n Detector$3.ROW_STEP = 5;\n Detector$3.BARCODE_MIN_HEIGHT = 10;\n\n /*\n * Copyright 2012 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * @author Sean Owen\n * @see com.google.zxing.common.reedsolomon.GenericGFPoly\n */\n /*final*/ class ModulusPoly {\n constructor(field, coefficients) {\n if (coefficients.length === 0) {\n throw new IllegalArgumentException();\n }\n this.field = field;\n let coefficientsLength = /*int*/ coefficients.length;\n if (coefficientsLength > 1 && coefficients[0] === 0) {\n // Leading term must be non-zero for anything except the constant polynomial \"0\"\n let firstNonZero = /*int*/ 1;\n while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {\n firstNonZero++;\n }\n if (firstNonZero === coefficientsLength) {\n this.coefficients = new Int32Array([0]);\n }\n else {\n this.coefficients = new Int32Array(coefficientsLength - firstNonZero);\n System.arraycopy(coefficients, firstNonZero, this.coefficients, 0, this.coefficients.length);\n }\n }\n else {\n this.coefficients = coefficients;\n }\n }\n getCoefficients() {\n return this.coefficients;\n }\n /**\n * @return degree of this polynomial\n */\n getDegree() {\n return this.coefficients.length - 1;\n }\n /**\n * @return true iff this polynomial is the monomial \"0\"\n */\n isZero() {\n return this.coefficients[0] === 0;\n }\n /**\n * @return coefficient of x^degree term in this polynomial\n */\n getCoefficient(degree) {\n return this.coefficients[this.coefficients.length - 1 - degree];\n }\n /**\n * @return evaluation of this polynomial at a given point\n */\n evaluateAt(a) {\n if (a === 0) {\n // Just return the x^0 coefficient\n return this.getCoefficient(0);\n }\n if (a === 1) {\n // Just the sum of the coefficients\n let sum = /*int*/ 0;\n for (let coefficient /*int*/ of this.coefficients) {\n sum = this.field.add(sum, coefficient);\n }\n return sum;\n }\n let result = /*int*/ this.coefficients[0];\n let size = /*int*/ this.coefficients.length;\n for (let i /*int*/ = 1; i < size; i++) {\n result = this.field.add(this.field.multiply(a, result), this.coefficients[i]);\n }\n return result;\n }\n add(other) {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('ModulusPolys do not have same ModulusGF field');\n }\n if (this.isZero()) {\n return other;\n }\n if (other.isZero()) {\n return this;\n }\n let smallerCoefficients = this.coefficients;\n let largerCoefficients = other.coefficients;\n if (smallerCoefficients.length > largerCoefficients.length) {\n let temp = smallerCoefficients;\n smallerCoefficients = largerCoefficients;\n largerCoefficients = temp;\n }\n let sumDiff = new Int32Array(largerCoefficients.length);\n let lengthDiff = /*int*/ largerCoefficients.length - smallerCoefficients.length;\n // Copy high-order terms only found in higher-degree polynomial's coefficients\n System.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);\n for (let i /*int*/ = lengthDiff; i < largerCoefficients.length; i++) {\n sumDiff[i] = this.field.add(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);\n }\n return new ModulusPoly(this.field, sumDiff);\n }\n subtract(other) {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('ModulusPolys do not have same ModulusGF field');\n }\n if (other.isZero()) {\n return this;\n }\n return this.add(other.negative());\n }\n multiply(other) {\n if (other instanceof ModulusPoly) {\n return this.multiplyOther(other);\n }\n return this.multiplyScalar(other);\n }\n multiplyOther(other) {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('ModulusPolys do not have same ModulusGF field');\n }\n if (this.isZero() || other.isZero()) {\n // return this.field.getZero();\n return new ModulusPoly(this.field, new Int32Array([0]));\n }\n let aCoefficients = this.coefficients;\n let aLength = /*int*/ aCoefficients.length;\n let bCoefficients = other.coefficients;\n let bLength = /*int*/ bCoefficients.length;\n let product = new Int32Array(aLength + bLength - 1);\n for (let i /*int*/ = 0; i < aLength; i++) {\n let aCoeff = /*int*/ aCoefficients[i];\n for (let j /*int*/ = 0; j < bLength; j++) {\n product[i + j] = this.field.add(product[i + j], this.field.multiply(aCoeff, bCoefficients[j]));\n }\n }\n return new ModulusPoly(this.field, product);\n }\n negative() {\n let size = /*int*/ this.coefficients.length;\n let negativeCoefficients = new Int32Array(size);\n for (let i /*int*/ = 0; i < size; i++) {\n negativeCoefficients[i] = this.field.subtract(0, this.coefficients[i]);\n }\n return new ModulusPoly(this.field, negativeCoefficients);\n }\n multiplyScalar(scalar) {\n if (scalar === 0) {\n return new ModulusPoly(this.field, new Int32Array([0]));\n }\n if (scalar === 1) {\n return this;\n }\n let size = /*int*/ this.coefficients.length;\n let product = new Int32Array(size);\n for (let i /*int*/ = 0; i < size; i++) {\n product[i] = this.field.multiply(this.coefficients[i], scalar);\n }\n return new ModulusPoly(this.field, product);\n }\n multiplyByMonomial(degree, coefficient) {\n if (degree < 0) {\n throw new IllegalArgumentException();\n }\n if (coefficient === 0) {\n return new ModulusPoly(this.field, new Int32Array([0]));\n }\n let size = /*int*/ this.coefficients.length;\n let product = new Int32Array(size + degree);\n for (let i /*int*/ = 0; i < size; i++) {\n product[i] = this.field.multiply(this.coefficients[i], coefficient);\n }\n return new ModulusPoly(this.field, product);\n }\n /*\n ModulusPoly[] divide(other: ModulusPoly) {\n if (!field.equals(other.field)) {\n throw new IllegalArgumentException(\"ModulusPolys do not have same ModulusGF field\");\n }\n if (other.isZero()) {\n throw new IllegalArgumentException(\"Divide by 0\");\n }\n \n let quotient: ModulusPoly = field.getZero();\n let remainder: ModulusPoly = this;\n \n let denominatorLeadingTerm: /*int/ number = other.getCoefficient(other.getDegree());\n let inverseDenominatorLeadingTerm: /*int/ number = field.inverse(denominatorLeadingTerm);\n \n while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {\n let degreeDifference: /*int/ number = remainder.getDegree() - other.getDegree();\n let scale: /*int/ number = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);\n let term: ModulusPoly = other.multiplyByMonomial(degreeDifference, scale);\n let iterationQuotient: ModulusPoly = field.buildMonomial(degreeDifference, scale);\n quotient = quotient.add(iterationQuotient);\n remainder = remainder.subtract(term);\n }\n \n return new ModulusPoly[] { quotient, remainder };\n }\n */\n // @Override\n toString() {\n let result = new StringBuilder( /*8 * this.getDegree()*/); // dynamic string size in JS\n for (let degree /*int*/ = this.getDegree(); degree >= 0; degree--) {\n let coefficient = /*int*/ this.getCoefficient(degree);\n if (coefficient !== 0) {\n if (coefficient < 0) {\n result.append(' - ');\n coefficient = -coefficient;\n }\n else {\n if (result.length() > 0) {\n result.append(' + ');\n }\n }\n if (degree === 0 || coefficient !== 1) {\n result.append(coefficient);\n }\n if (degree !== 0) {\n if (degree === 1) {\n result.append('x');\n }\n else {\n result.append('x^');\n result.append(degree);\n }\n }\n }\n }\n return result.toString();\n }\n }\n\n class ModulusBase {\n add(a, b) {\n return (a + b) % this.modulus;\n }\n subtract(a, b) {\n return (this.modulus + a - b) % this.modulus;\n }\n exp(a) {\n return this.expTable[a];\n }\n log(a) {\n if (a === 0) {\n throw new IllegalArgumentException();\n }\n return this.logTable[a];\n }\n inverse(a) {\n if (a === 0) {\n throw new ArithmeticException();\n }\n return this.expTable[this.modulus - this.logTable[a] - 1];\n }\n multiply(a, b) {\n if (a === 0 || b === 0) {\n return 0;\n }\n return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.modulus - 1)];\n }\n getSize() {\n return this.modulus;\n }\n equals(o) {\n return o === this;\n }\n }\n\n /*\n * Copyright 2012 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * A field based on powers of a generator integer, modulo some modulus.
\n *\n * @author Sean Owen\n * @see com.google.zxing.common.reedsolomon.GenericGF\n */\n /*public final*/ class ModulusGF extends ModulusBase {\n // private /*final*/ modulus: /*int*/ number;\n constructor(modulus, generator) {\n super();\n this.modulus = modulus;\n this.expTable = new Int32Array(modulus);\n this.logTable = new Int32Array(modulus);\n let x = /*int*/ 1;\n for (let i /*int*/ = 0; i < modulus; i++) {\n this.expTable[i] = x;\n x = (x * generator) % modulus;\n }\n for (let i /*int*/ = 0; i < modulus - 1; i++) {\n this.logTable[this.expTable[i]] = i;\n }\n // logTable[0] == 0 but this should never be used\n this.zero = new ModulusPoly(this, new Int32Array([0]));\n this.one = new ModulusPoly(this, new Int32Array([1]));\n }\n getZero() {\n return this.zero;\n }\n getOne() {\n return this.one;\n }\n buildMonomial(degree, coefficient) {\n if (degree < 0) {\n throw new IllegalArgumentException();\n }\n if (coefficient === 0) {\n return this.zero;\n }\n let coefficients = new Int32Array(degree + 1);\n coefficients[0] = coefficient;\n return new ModulusPoly(this, coefficients);\n }\n }\n ModulusGF.PDF417_GF = new ModulusGF(PDF417Common.NUMBER_OF_CODEWORDS, 3);\n\n /*\n * Copyright 2012 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * PDF417 error correction implementation.
\n *\n * This example\n * is quite useful in understanding the algorithm.
\n *\n * @author Sean Owen\n * @see com.google.zxing.common.reedsolomon.ReedSolomonDecoder\n */\n /*public final*/ class ErrorCorrection {\n constructor() {\n this.field = ModulusGF.PDF417_GF;\n }\n /**\n * @param received received codewords\n * @param numECCodewords number of those codewords used for EC\n * @param erasures location of erasures\n * @return number of errors\n * @throws ChecksumException if errors cannot be corrected, maybe because of too many errors\n */\n decode(received, numECCodewords, erasures) {\n let poly = new ModulusPoly(this.field, received);\n let S = new Int32Array(numECCodewords);\n let error = false;\n for (let i /*int*/ = numECCodewords; i > 0; i--) {\n let evaluation = poly.evaluateAt(this.field.exp(i));\n S[numECCodewords - i] = evaluation;\n if (evaluation !== 0) {\n error = true;\n }\n }\n if (!error) {\n return 0;\n }\n let knownErrors = this.field.getOne();\n if (erasures != null) {\n for (const erasure of erasures) {\n let b = this.field.exp(received.length - 1 - erasure);\n // Add (1 - bx) term:\n let term = new ModulusPoly(this.field, new Int32Array([this.field.subtract(0, b), 1]));\n knownErrors = knownErrors.multiply(term);\n }\n }\n let syndrome = new ModulusPoly(this.field, S);\n // syndrome = syndrome.multiply(knownErrors);\n let sigmaOmega = this.runEuclideanAlgorithm(this.field.buildMonomial(numECCodewords, 1), syndrome, numECCodewords);\n let sigma = sigmaOmega[0];\n let omega = sigmaOmega[1];\n // sigma = sigma.multiply(knownErrors);\n let errorLocations = this.findErrorLocations(sigma);\n let errorMagnitudes = this.findErrorMagnitudes(omega, sigma, errorLocations);\n for (let i /*int*/ = 0; i < errorLocations.length; i++) {\n let position = received.length - 1 - this.field.log(errorLocations[i]);\n if (position < 0) {\n throw ChecksumException.getChecksumInstance();\n }\n received[position] = this.field.subtract(received[position], errorMagnitudes[i]);\n }\n return errorLocations.length;\n }\n /**\n *\n * @param ModulusPoly\n * @param a\n * @param ModulusPoly\n * @param b\n * @param int\n * @param R\n * @throws ChecksumException\n */\n runEuclideanAlgorithm(a, b, R) {\n // Assume a's degree is >= b's\n if (a.getDegree() < b.getDegree()) {\n let temp = a;\n a = b;\n b = temp;\n }\n let rLast = a;\n let r = b;\n let tLast = this.field.getZero();\n let t = this.field.getOne();\n // Run Euclidean algorithm until r's degree is less than R/2\n while (r.getDegree() >= Math.round(R / 2)) {\n let rLastLast = rLast;\n let tLastLast = tLast;\n rLast = r;\n tLast = t;\n // Divide rLastLast by rLast, with quotient in q and remainder in r\n if (rLast.isZero()) {\n // Oops, Euclidean algorithm already terminated?\n throw ChecksumException.getChecksumInstance();\n }\n r = rLastLast;\n let q = this.field.getZero();\n let denominatorLeadingTerm = rLast.getCoefficient(rLast.getDegree());\n let dltInverse = this.field.inverse(denominatorLeadingTerm);\n while (r.getDegree() >= rLast.getDegree() && !r.isZero()) {\n let degreeDiff = r.getDegree() - rLast.getDegree();\n let scale = this.field.multiply(r.getCoefficient(r.getDegree()), dltInverse);\n q = q.add(this.field.buildMonomial(degreeDiff, scale));\n r = r.subtract(rLast.multiplyByMonomial(degreeDiff, scale));\n }\n t = q.multiply(tLast).subtract(tLastLast).negative();\n }\n let sigmaTildeAtZero = t.getCoefficient(0);\n if (sigmaTildeAtZero === 0) {\n throw ChecksumException.getChecksumInstance();\n }\n let inverse = this.field.inverse(sigmaTildeAtZero);\n let sigma = t.multiply(inverse);\n let omega = r.multiply(inverse);\n return [sigma, omega];\n }\n /**\n *\n * @param errorLocator\n * @throws ChecksumException\n */\n findErrorLocations(errorLocator) {\n // This is a direct application of Chien's search\n let numErrors = errorLocator.getDegree();\n let result = new Int32Array(numErrors);\n let e = 0;\n for (let i /*int*/ = 1; i < this.field.getSize() && e < numErrors; i++) {\n if (errorLocator.evaluateAt(i) === 0) {\n result[e] = this.field.inverse(i);\n e++;\n }\n }\n if (e !== numErrors) {\n throw ChecksumException.getChecksumInstance();\n }\n return result;\n }\n findErrorMagnitudes(errorEvaluator, errorLocator, errorLocations) {\n let errorLocatorDegree = errorLocator.getDegree();\n let formalDerivativeCoefficients = new Int32Array(errorLocatorDegree);\n for (let i /*int*/ = 1; i <= errorLocatorDegree; i++) {\n formalDerivativeCoefficients[errorLocatorDegree - i] =\n this.field.multiply(i, errorLocator.getCoefficient(i));\n }\n let formalDerivative = new ModulusPoly(this.field, formalDerivativeCoefficients);\n // This is directly applying Forney's Formula\n let s = errorLocations.length;\n let result = new Int32Array(s);\n for (let i /*int*/ = 0; i < s; i++) {\n let xiInverse = this.field.inverse(errorLocations[i]);\n let numerator = this.field.subtract(0, errorEvaluator.evaluateAt(xiInverse));\n let denominator = this.field.inverse(formalDerivative.evaluateAt(xiInverse));\n result[i] = this.field.multiply(numerator, denominator);\n }\n return result;\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * @author Guenther Grau\n */\n /*final*/ class BoundingBox {\n constructor(image, topLeft, bottomLeft, topRight, bottomRight) {\n if (image instanceof BoundingBox) {\n this.constructor_2(image);\n }\n else {\n this.constructor_1(image, topLeft, bottomLeft, topRight, bottomRight);\n }\n }\n /**\n *\n * @param image\n * @param topLeft\n * @param bottomLeft\n * @param topRight\n * @param bottomRight\n *\n * @throws NotFoundException\n */\n constructor_1(image, topLeft, bottomLeft, topRight, bottomRight) {\n const leftUnspecified = topLeft == null || bottomLeft == null;\n const rightUnspecified = topRight == null || bottomRight == null;\n if (leftUnspecified && rightUnspecified) {\n throw new NotFoundException();\n }\n if (leftUnspecified) {\n topLeft = new ResultPoint(0, topRight.getY());\n bottomLeft = new ResultPoint(0, bottomRight.getY());\n }\n else if (rightUnspecified) {\n topRight = new ResultPoint(image.getWidth() - 1, topLeft.getY());\n bottomRight = new ResultPoint(image.getWidth() - 1, bottomLeft.getY());\n }\n this.image = image;\n this.topLeft = topLeft;\n this.bottomLeft = bottomLeft;\n this.topRight = topRight;\n this.bottomRight = bottomRight;\n this.minX = Math.trunc(Math.min(topLeft.getX(), bottomLeft.getX()));\n this.maxX = Math.trunc(Math.max(topRight.getX(), bottomRight.getX()));\n this.minY = Math.trunc(Math.min(topLeft.getY(), topRight.getY()));\n this.maxY = Math.trunc(Math.max(bottomLeft.getY(), bottomRight.getY()));\n }\n constructor_2(boundingBox) {\n this.image = boundingBox.image;\n this.topLeft = boundingBox.getTopLeft();\n this.bottomLeft = boundingBox.getBottomLeft();\n this.topRight = boundingBox.getTopRight();\n this.bottomRight = boundingBox.getBottomRight();\n this.minX = boundingBox.getMinX();\n this.maxX = boundingBox.getMaxX();\n this.minY = boundingBox.getMinY();\n this.maxY = boundingBox.getMaxY();\n }\n /**\n * @throws NotFoundException\n */\n static merge(leftBox, rightBox) {\n if (leftBox == null) {\n return rightBox;\n }\n if (rightBox == null) {\n return leftBox;\n }\n return new BoundingBox(leftBox.image, leftBox.topLeft, leftBox.bottomLeft, rightBox.topRight, rightBox.bottomRight);\n }\n /**\n * @throws NotFoundException\n */\n addMissingRows(missingStartRows, missingEndRows, isLeft) {\n let newTopLeft = this.topLeft;\n let newBottomLeft = this.bottomLeft;\n let newTopRight = this.topRight;\n let newBottomRight = this.bottomRight;\n if (missingStartRows > 0) {\n let top = isLeft ? this.topLeft : this.topRight;\n let newMinY = Math.trunc(top.getY() - missingStartRows);\n if (newMinY < 0) {\n newMinY = 0;\n }\n let newTop = new ResultPoint(top.getX(), newMinY);\n if (isLeft) {\n newTopLeft = newTop;\n }\n else {\n newTopRight = newTop;\n }\n }\n if (missingEndRows > 0) {\n let bottom = isLeft ? this.bottomLeft : this.bottomRight;\n let newMaxY = Math.trunc(bottom.getY() + missingEndRows);\n if (newMaxY >= this.image.getHeight()) {\n newMaxY = this.image.getHeight() - 1;\n }\n let newBottom = new ResultPoint(bottom.getX(), newMaxY);\n if (isLeft) {\n newBottomLeft = newBottom;\n }\n else {\n newBottomRight = newBottom;\n }\n }\n return new BoundingBox(this.image, newTopLeft, newBottomLeft, newTopRight, newBottomRight);\n }\n getMinX() {\n return this.minX;\n }\n getMaxX() {\n return this.maxX;\n }\n getMinY() {\n return this.minY;\n }\n getMaxY() {\n return this.maxY;\n }\n getTopLeft() {\n return this.topLeft;\n }\n getTopRight() {\n return this.topRight;\n }\n getBottomLeft() {\n return this.bottomLeft;\n }\n getBottomRight() {\n return this.bottomRight;\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // package com.google.zxing.pdf417.decoder;\n /**\n * @author Guenther Grau\n */\n /*final*/ class BarcodeMetadata {\n constructor(columnCount, rowCountUpperPart, rowCountLowerPart, errorCorrectionLevel) {\n this.columnCount = columnCount;\n this.errorCorrectionLevel = errorCorrectionLevel;\n this.rowCountUpperPart = rowCountUpperPart;\n this.rowCountLowerPart = rowCountLowerPart;\n this.rowCount = rowCountUpperPart + rowCountLowerPart;\n }\n getColumnCount() {\n return this.columnCount;\n }\n getErrorCorrectionLevel() {\n return this.errorCorrectionLevel;\n }\n getRowCount() {\n return this.rowCount;\n }\n getRowCountUpperPart() {\n return this.rowCountUpperPart;\n }\n getRowCountLowerPart() {\n return this.rowCountLowerPart;\n }\n }\n\n /**\n * Java Formatter class polyfill that works in the JS way.\n */\n class Formatter {\n constructor() {\n this.buffer = '';\n }\n /**\n *\n * @see https://stackoverflow.com/a/13439711/4367683\n *\n * @param str\n * @param arr\n */\n static form(str, arr) {\n let i = -1;\n function callback(exp, p0, p1, p2, p3, p4) {\n if (exp === '%%')\n return '%';\n if (arr[++i] === undefined)\n return undefined;\n exp = p2 ? parseInt(p2.substr(1)) : undefined;\n let base = p3 ? parseInt(p3.substr(1)) : undefined;\n let val;\n switch (p4) {\n case 's':\n val = arr[i];\n break;\n case 'c':\n val = arr[i][0];\n break;\n case 'f':\n val = parseFloat(arr[i]).toFixed(exp);\n break;\n case 'p':\n val = parseFloat(arr[i]).toPrecision(exp);\n break;\n case 'e':\n val = parseFloat(arr[i]).toExponential(exp);\n break;\n case 'x':\n val = parseInt(arr[i]).toString(base ? base : 16);\n break;\n case 'd':\n val = parseFloat(parseInt(arr[i], base ? base : 10).toPrecision(exp)).toFixed(0);\n break;\n }\n val = typeof val === 'object' ? JSON.stringify(val) : (+val).toString(base);\n let size = parseInt(p1); /* padding size */\n let ch = p1 && (p1[0] + '') === '0' ? '0' : ' '; /* isnull? */\n while (val.length < size)\n val = p0 !== undefined ? val + ch : ch + val; /* isminus? */\n return val;\n }\n let regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;\n return str.replace(regex, callback);\n }\n /**\n *\n * @param append The new string to append.\n * @param args Argumets values to be formated.\n */\n format(append, ...args) {\n this.buffer += Formatter.form(append, args);\n }\n /**\n * Returns the Formatter string value.\n */\n toString() {\n return this.buffer;\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * @author Guenther Grau\n */\n class DetectionResultColumn {\n constructor(boundingBox) {\n this.boundingBox = new BoundingBox(boundingBox);\n // this.codewords = new Codeword[boundingBox.getMaxY() - boundingBox.getMinY() + 1];\n this.codewords = new Array(boundingBox.getMaxY() - boundingBox.getMinY() + 1);\n }\n /*final*/ getCodewordNearby(imageRow) {\n let codeword = this.getCodeword(imageRow);\n if (codeword != null) {\n return codeword;\n }\n for (let i = 1; i < DetectionResultColumn.MAX_NEARBY_DISTANCE; i++) {\n let nearImageRow = this.imageRowToCodewordIndex(imageRow) - i;\n if (nearImageRow >= 0) {\n codeword = this.codewords[nearImageRow];\n if (codeword != null) {\n return codeword;\n }\n }\n nearImageRow = this.imageRowToCodewordIndex(imageRow) + i;\n if (nearImageRow < this.codewords.length) {\n codeword = this.codewords[nearImageRow];\n if (codeword != null) {\n return codeword;\n }\n }\n }\n return null;\n }\n /*final int*/ imageRowToCodewordIndex(imageRow) {\n return imageRow - this.boundingBox.getMinY();\n }\n /*final void*/ setCodeword(imageRow, codeword) {\n this.codewords[this.imageRowToCodewordIndex(imageRow)] = codeword;\n }\n /*final*/ getCodeword(imageRow) {\n return this.codewords[this.imageRowToCodewordIndex(imageRow)];\n }\n /*final*/ getBoundingBox() {\n return this.boundingBox;\n }\n /*final*/ getCodewords() {\n return this.codewords;\n }\n // @Override\n toString() {\n const formatter = new Formatter();\n let row = 0;\n for (const codeword of this.codewords) {\n if (codeword == null) {\n formatter.format('%3d: | %n', row++);\n continue;\n }\n formatter.format('%3d: %3d|%3d%n', row++, codeword.getRowNumber(), codeword.getValue());\n }\n return formatter.toString();\n }\n }\n DetectionResultColumn.MAX_NEARBY_DISTANCE = 5;\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // import java.util.ArrayList;\n // import java.util.Collection;\n // import java.util.HashMap;\n // import java.util.Map;\n // import java.util.Map.Entry;\n /**\n * @author Guenther Grau\n */\n /*final*/ class BarcodeValue {\n constructor() {\n this.values = new Map();\n }\n /**\n * Add an occurrence of a value\n */\n setValue(value) {\n value = Math.trunc(value);\n let confidence = this.values.get(value);\n if (confidence == null) {\n confidence = 0;\n }\n confidence++;\n this.values.set(value, confidence);\n }\n /**\n * Determines the maximum occurrence of a set value and returns all values which were set with this occurrence.\n * @return an array of int, containing the values with the highest occurrence, or null, if no value was set\n */\n getValue() {\n let maxConfidence = -1;\n let result = new Array();\n for (const [key, value] of this.values.entries()) {\n const entry = {\n getKey: () => key,\n getValue: () => value,\n };\n if (entry.getValue() > maxConfidence) {\n maxConfidence = entry.getValue();\n result = [];\n result.push(entry.getKey());\n }\n else if (entry.getValue() === maxConfidence) {\n result.push(entry.getKey());\n }\n }\n return PDF417Common.toIntArray(result);\n }\n getConfidence(value) {\n return this.values.get(value);\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * @author Guenther Grau\n */\n /*final*/ class DetectionResultRowIndicatorColumn extends DetectionResultColumn {\n constructor(boundingBox, isLeft) {\n super(boundingBox);\n this._isLeft = isLeft;\n }\n setRowNumbers() {\n for (let codeword /*Codeword*/ of this.getCodewords()) {\n if (codeword != null) {\n codeword.setRowNumberAsRowIndicatorColumn();\n }\n }\n }\n // TODO implement properly\n // TODO maybe we should add missing codewords to store the correct row number to make\n // finding row numbers for other columns easier\n // use row height count to make detection of invalid row numbers more reliable\n adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata) {\n let codewords = this.getCodewords();\n this.setRowNumbers();\n this.removeIncorrectCodewords(codewords, barcodeMetadata);\n let boundingBox = this.getBoundingBox();\n let top = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();\n let bottom = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();\n let firstRow = this.imageRowToCodewordIndex(Math.trunc(top.getY()));\n let lastRow = this.imageRowToCodewordIndex(Math.trunc(bottom.getY()));\n // We need to be careful using the average row height. Barcode could be skewed so that we have smaller and\n // taller rows\n // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();\n let barcodeRow = -1;\n let maxRowHeight = 1;\n let currentRowHeight = 0;\n for (let codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let codeword = codewords[codewordsRow];\n // float expectedRowNumber = (codewordsRow - firstRow) / averageRowHeight;\n // if (Math.abs(codeword.getRowNumber() - expectedRowNumber) > 2) {\n // SimpleLog.log(LEVEL.WARNING,\n // \"Removing codeword, rowNumberSkew too high, codeword[\" + codewordsRow + \"]: Expected Row: \" +\n // expectedRowNumber + \", RealRow: \" + codeword.getRowNumber() + \", value: \" + codeword.getValue());\n // codewords[codewordsRow] = null;\n // }\n let rowDifference = codeword.getRowNumber() - barcodeRow;\n // TODO improve handling with case where first row indicator doesn't start with 0\n if (rowDifference === 0) {\n currentRowHeight++;\n }\n else if (rowDifference === 1) {\n maxRowHeight = Math.max(maxRowHeight, currentRowHeight);\n currentRowHeight = 1;\n barcodeRow = codeword.getRowNumber();\n }\n else if (rowDifference < 0 ||\n codeword.getRowNumber() >= barcodeMetadata.getRowCount() ||\n rowDifference > codewordsRow) {\n codewords[codewordsRow] = null;\n }\n else {\n let checkedRows;\n if (maxRowHeight > 2) {\n checkedRows = (maxRowHeight - 2) * rowDifference;\n }\n else {\n checkedRows = rowDifference;\n }\n let closePreviousCodewordFound = checkedRows >= codewordsRow;\n for (let i /*int*/ = 1; i <= checkedRows && !closePreviousCodewordFound; i++) {\n // there must be (height * rowDifference) number of codewords missing. For now we assume height = 1.\n // This should hopefully get rid of most problems already.\n closePreviousCodewordFound = codewords[codewordsRow - i] != null;\n }\n if (closePreviousCodewordFound) {\n codewords[codewordsRow] = null;\n }\n else {\n barcodeRow = codeword.getRowNumber();\n currentRowHeight = 1;\n }\n }\n }\n // return (int) (averageRowHeight + 0.5);\n }\n getRowHeights() {\n let barcodeMetadata = this.getBarcodeMetadata();\n if (barcodeMetadata == null) {\n return null;\n }\n this.adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata);\n let result = new Int32Array(barcodeMetadata.getRowCount());\n for (let codeword /*Codeword*/ of this.getCodewords()) {\n if (codeword != null) {\n let rowNumber = codeword.getRowNumber();\n if (rowNumber >= result.length) {\n // We have more rows than the barcode metadata allows for, ignore them.\n continue;\n }\n result[rowNumber]++;\n } // else throw exception?\n }\n return result;\n }\n // TODO maybe we should add missing codewords to store the correct row number to make\n // finding row numbers for other columns easier\n // use row height count to make detection of invalid row numbers more reliable\n adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata) {\n let boundingBox = this.getBoundingBox();\n let top = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();\n let bottom = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();\n let firstRow = this.imageRowToCodewordIndex(Math.trunc(top.getY()));\n let lastRow = this.imageRowToCodewordIndex(Math.trunc(bottom.getY()));\n // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();\n let codewords = this.getCodewords();\n let barcodeRow = -1;\n for (let codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let codeword = codewords[codewordsRow];\n codeword.setRowNumberAsRowIndicatorColumn();\n let rowDifference = codeword.getRowNumber() - barcodeRow;\n // TODO improve handling with case where first row indicator doesn't start with 0\n if (rowDifference === 0) ;\n else if (rowDifference === 1) {\n barcodeRow = codeword.getRowNumber();\n }\n else if (codeword.getRowNumber() >= barcodeMetadata.getRowCount()) {\n codewords[codewordsRow] = null;\n }\n else {\n barcodeRow = codeword.getRowNumber();\n }\n }\n // return (int) (averageRowHeight + 0.5);\n }\n getBarcodeMetadata() {\n let codewords = this.getCodewords();\n let barcodeColumnCount = new BarcodeValue();\n let barcodeRowCountUpperPart = new BarcodeValue();\n let barcodeRowCountLowerPart = new BarcodeValue();\n let barcodeECLevel = new BarcodeValue();\n for (let codeword /*Codeword*/ of codewords) {\n if (codeword == null) {\n continue;\n }\n codeword.setRowNumberAsRowIndicatorColumn();\n let rowIndicatorValue = codeword.getValue() % 30;\n let codewordRowNumber = codeword.getRowNumber();\n if (!this._isLeft) {\n codewordRowNumber += 2;\n }\n switch (codewordRowNumber % 3) {\n case 0:\n barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);\n break;\n case 1:\n barcodeECLevel.setValue(rowIndicatorValue / 3);\n barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);\n break;\n case 2:\n barcodeColumnCount.setValue(rowIndicatorValue + 1);\n break;\n }\n }\n // Maybe we should check if we have ambiguous values?\n if ((barcodeColumnCount.getValue().length === 0) ||\n (barcodeRowCountUpperPart.getValue().length === 0) ||\n (barcodeRowCountLowerPart.getValue().length === 0) ||\n (barcodeECLevel.getValue().length === 0) ||\n barcodeColumnCount.getValue()[0] < 1 ||\n barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE ||\n barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) {\n return null;\n }\n let barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0], barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);\n this.removeIncorrectCodewords(codewords, barcodeMetadata);\n return barcodeMetadata;\n }\n removeIncorrectCodewords(codewords, barcodeMetadata) {\n // Remove codewords which do not match the metadata\n // TODO Maybe we should keep the incorrect codewords for the start and end positions?\n for (let codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {\n let codeword = codewords[codewordRow];\n if (codewords[codewordRow] == null) {\n continue;\n }\n let rowIndicatorValue = codeword.getValue() % 30;\n let codewordRowNumber = codeword.getRowNumber();\n if (codewordRowNumber > barcodeMetadata.getRowCount()) {\n codewords[codewordRow] = null;\n continue;\n }\n if (!this._isLeft) {\n codewordRowNumber += 2;\n }\n switch (codewordRowNumber % 3) {\n case 0:\n if (rowIndicatorValue * 3 + 1 !== barcodeMetadata.getRowCountUpperPart()) {\n codewords[codewordRow] = null;\n }\n break;\n case 1:\n if (Math.trunc(rowIndicatorValue / 3) !== barcodeMetadata.getErrorCorrectionLevel() ||\n rowIndicatorValue % 3 !== barcodeMetadata.getRowCountLowerPart()) {\n codewords[codewordRow] = null;\n }\n break;\n case 2:\n if (rowIndicatorValue + 1 !== barcodeMetadata.getColumnCount()) {\n codewords[codewordRow] = null;\n }\n break;\n }\n }\n }\n isLeft() {\n return this._isLeft;\n }\n // @Override\n toString() {\n return 'IsLeft: ' + this._isLeft + '\\n' + super.toString();\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * @author Guenther Grau\n */\n /*final*/ class DetectionResult {\n constructor(barcodeMetadata, boundingBox) {\n /*final*/ this.ADJUST_ROW_NUMBER_SKIP = 2;\n this.barcodeMetadata = barcodeMetadata;\n this.barcodeColumnCount = barcodeMetadata.getColumnCount();\n this.boundingBox = boundingBox;\n // this.detectionResultColumns = new DetectionResultColumn[this.barcodeColumnCount + 2];\n this.detectionResultColumns = new Array(this.barcodeColumnCount + 2);\n }\n getDetectionResultColumns() {\n this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]);\n this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount + 1]);\n let unadjustedCodewordCount = PDF417Common.MAX_CODEWORDS_IN_BARCODE;\n let previousUnadjustedCount;\n do {\n previousUnadjustedCount = unadjustedCodewordCount;\n unadjustedCodewordCount = this.adjustRowNumbersAndGetCount();\n } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);\n return this.detectionResultColumns;\n }\n adjustIndicatorColumnRowNumbers(detectionResultColumn) {\n if (detectionResultColumn != null) {\n detectionResultColumn\n .adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata);\n }\n }\n // TODO ensure that no detected codewords with unknown row number are left\n // we should be able to estimate the row height and use it as a hint for the row number\n // we should also fill the rows top to bottom and bottom to top\n /**\n * @return number of codewords which don't have a valid row number. Note that the count is not accurate as codewords\n * will be counted several times. It just serves as an indicator to see when we can stop adjusting row numbers\n */\n adjustRowNumbersAndGetCount() {\n let unadjustedCount = this.adjustRowNumbersByRow();\n if (unadjustedCount === 0) {\n return 0;\n }\n for (let barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1; barcodeColumn++) {\n let codewords = this.detectionResultColumns[barcodeColumn].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n if (!codewords[codewordsRow].hasValidRowNumber()) {\n this.adjustRowNumbers(barcodeColumn, codewordsRow, codewords);\n }\n }\n }\n return unadjustedCount;\n }\n adjustRowNumbersByRow() {\n this.adjustRowNumbersFromBothRI();\n // TODO we should only do full row adjustments if row numbers of left and right row indicator column match.\n // Maybe it's even better to calculated the height (rows: d) and divide it by the number of barcode\n // rows. This, together with the LRI and RRI row numbers should allow us to get a good estimate where a row\n // number starts and ends.\n let unadjustedCount = this.adjustRowNumbersFromLRI();\n return unadjustedCount + this.adjustRowNumbersFromRRI();\n }\n adjustRowNumbersFromBothRI() {\n if (this.detectionResultColumns[0] == null || this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {\n return;\n }\n let LRIcodewords = this.detectionResultColumns[0].getCodewords();\n let RRIcodewords = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < LRIcodewords.length; codewordsRow++) {\n if (LRIcodewords[codewordsRow] != null &&\n RRIcodewords[codewordsRow] != null &&\n LRIcodewords[codewordsRow].getRowNumber() === RRIcodewords[codewordsRow].getRowNumber()) {\n for (let barcodeColumn /*int*/ = 1; barcodeColumn <= this.barcodeColumnCount; barcodeColumn++) {\n let codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword == null) {\n continue;\n }\n codeword.setRowNumber(LRIcodewords[codewordsRow].getRowNumber());\n if (!codeword.hasValidRowNumber()) {\n this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow] = null;\n }\n }\n }\n }\n }\n adjustRowNumbersFromRRI() {\n if (this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {\n return 0;\n }\n let unadjustedCount = 0;\n let codewords = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();\n let invalidRowCounts = 0;\n for (let barcodeColumn /*int*/ = this.barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) {\n let codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword != null) {\n invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);\n if (!codeword.hasValidRowNumber()) {\n unadjustedCount++;\n }\n }\n }\n }\n return unadjustedCount;\n }\n adjustRowNumbersFromLRI() {\n if (this.detectionResultColumns[0] == null) {\n return 0;\n }\n let unadjustedCount = 0;\n let codewords = this.detectionResultColumns[0].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();\n let invalidRowCounts = 0;\n for (let barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) {\n let codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword != null) {\n invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);\n if (!codeword.hasValidRowNumber()) {\n unadjustedCount++;\n }\n }\n }\n }\n return unadjustedCount;\n }\n static adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword) {\n if (codeword == null) {\n return invalidRowCounts;\n }\n if (!codeword.hasValidRowNumber()) {\n if (codeword.isValidRowNumber(rowIndicatorRowNumber)) {\n codeword.setRowNumber(rowIndicatorRowNumber);\n invalidRowCounts = 0;\n }\n else {\n ++invalidRowCounts;\n }\n }\n return invalidRowCounts;\n }\n adjustRowNumbers(barcodeColumn, codewordsRow, codewords) {\n if (!this.detectionResultColumns[barcodeColumn - 1]) {\n return;\n }\n let codeword = codewords[codewordsRow];\n let previousColumnCodewords = this.detectionResultColumns[barcodeColumn - 1].getCodewords();\n let nextColumnCodewords = previousColumnCodewords;\n if (this.detectionResultColumns[barcodeColumn + 1] != null) {\n nextColumnCodewords = this.detectionResultColumns[barcodeColumn + 1].getCodewords();\n }\n // let otherCodewords: Codeword[] = new Codeword[14];\n let otherCodewords = new Array(14);\n otherCodewords[2] = previousColumnCodewords[codewordsRow];\n otherCodewords[3] = nextColumnCodewords[codewordsRow];\n if (codewordsRow > 0) {\n otherCodewords[0] = codewords[codewordsRow - 1];\n otherCodewords[4] = previousColumnCodewords[codewordsRow - 1];\n otherCodewords[5] = nextColumnCodewords[codewordsRow - 1];\n }\n if (codewordsRow > 1) {\n otherCodewords[8] = codewords[codewordsRow - 2];\n otherCodewords[10] = previousColumnCodewords[codewordsRow - 2];\n otherCodewords[11] = nextColumnCodewords[codewordsRow - 2];\n }\n if (codewordsRow < codewords.length - 1) {\n otherCodewords[1] = codewords[codewordsRow + 1];\n otherCodewords[6] = previousColumnCodewords[codewordsRow + 1];\n otherCodewords[7] = nextColumnCodewords[codewordsRow + 1];\n }\n if (codewordsRow < codewords.length - 2) {\n otherCodewords[9] = codewords[codewordsRow + 2];\n otherCodewords[12] = previousColumnCodewords[codewordsRow + 2];\n otherCodewords[13] = nextColumnCodewords[codewordsRow + 2];\n }\n for (let otherCodeword of otherCodewords) {\n if (DetectionResult.adjustRowNumber(codeword, otherCodeword)) {\n return;\n }\n }\n }\n /**\n * @return true, if row number was adjusted, false otherwise\n */\n static adjustRowNumber(codeword, otherCodeword) {\n if (otherCodeword == null) {\n return false;\n }\n if (otherCodeword.hasValidRowNumber() && otherCodeword.getBucket() === codeword.getBucket()) {\n codeword.setRowNumber(otherCodeword.getRowNumber());\n return true;\n }\n return false;\n }\n getBarcodeColumnCount() {\n return this.barcodeColumnCount;\n }\n getBarcodeRowCount() {\n return this.barcodeMetadata.getRowCount();\n }\n getBarcodeECLevel() {\n return this.barcodeMetadata.getErrorCorrectionLevel();\n }\n setBoundingBox(boundingBox) {\n this.boundingBox = boundingBox;\n }\n getBoundingBox() {\n return this.boundingBox;\n }\n setDetectionResultColumn(barcodeColumn, detectionResultColumn) {\n this.detectionResultColumns[barcodeColumn] = detectionResultColumn;\n }\n getDetectionResultColumn(barcodeColumn) {\n return this.detectionResultColumns[barcodeColumn];\n }\n // @Override\n toString() {\n let rowIndicatorColumn = this.detectionResultColumns[0];\n if (rowIndicatorColumn == null) {\n rowIndicatorColumn = this.detectionResultColumns[this.barcodeColumnCount + 1];\n }\n // try (\n let formatter = new Formatter();\n // ) {\n for (let codewordsRow /*int*/ = 0; codewordsRow < rowIndicatorColumn.getCodewords().length; codewordsRow++) {\n formatter.format('CW %3d:', codewordsRow);\n for (let barcodeColumn /*int*/ = 0; barcodeColumn < this.barcodeColumnCount + 2; barcodeColumn++) {\n if (this.detectionResultColumns[barcodeColumn] == null) {\n formatter.format(' | ');\n continue;\n }\n let codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword == null) {\n formatter.format(' | ');\n continue;\n }\n formatter.format(' %3d|%3d', codeword.getRowNumber(), codeword.getValue());\n }\n formatter.format('%n');\n }\n return formatter.toString();\n // }\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // package com.google.zxing.pdf417.decoder;\n /**\n * @author Guenther Grau\n */\n /*final*/ class Codeword {\n constructor(startX, endX, bucket, value) {\n this.rowNumber = Codeword.BARCODE_ROW_UNKNOWN;\n this.startX = Math.trunc(startX);\n this.endX = Math.trunc(endX);\n this.bucket = Math.trunc(bucket);\n this.value = Math.trunc(value);\n }\n hasValidRowNumber() {\n return this.isValidRowNumber(this.rowNumber);\n }\n isValidRowNumber(rowNumber) {\n return rowNumber !== Codeword.BARCODE_ROW_UNKNOWN && this.bucket === (rowNumber % 3) * 3;\n }\n setRowNumberAsRowIndicatorColumn() {\n this.rowNumber = Math.trunc((Math.trunc(this.value / 30)) * 3 + Math.trunc(this.bucket / 3));\n }\n getWidth() {\n return this.endX - this.startX;\n }\n getStartX() {\n return this.startX;\n }\n getEndX() {\n return this.endX;\n }\n getBucket() {\n return this.bucket;\n }\n getValue() {\n return this.value;\n }\n getRowNumber() {\n return this.rowNumber;\n }\n setRowNumber(rowNumber) {\n this.rowNumber = rowNumber;\n }\n // @Override\n toString() {\n return this.rowNumber + '|' + this.value;\n }\n }\n Codeword.BARCODE_ROW_UNKNOWN = -1;\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * @author Guenther Grau\n * @author creatale GmbH (christoph.schulz@creatale.de)\n */\n /*final*/ class PDF417CodewordDecoder {\n /* @note\n * this action have to be performed before first use of class\n * - static constructor\n * working with 32bit float (based from Java logic)\n */\n static initialize() {\n // Pre-computes the symbol ratio table.\n for ( /*int*/let i = 0; i < PDF417Common.SYMBOL_TABLE.length; i++) {\n let currentSymbol = PDF417Common.SYMBOL_TABLE[i];\n let currentBit = currentSymbol & 0x1;\n for ( /*int*/let j = 0; j < PDF417Common.BARS_IN_MODULE; j++) {\n let size = 0.0;\n while ((currentSymbol & 0x1) === currentBit) {\n size += 1.0;\n currentSymbol >>= 1;\n }\n currentBit = currentSymbol & 0x1;\n if (!PDF417CodewordDecoder.RATIOS_TABLE[i]) {\n PDF417CodewordDecoder.RATIOS_TABLE[i] = new Array(PDF417Common.BARS_IN_MODULE);\n }\n PDF417CodewordDecoder.RATIOS_TABLE[i][PDF417Common.BARS_IN_MODULE - j - 1] = Math.fround(size / PDF417Common.MODULES_IN_CODEWORD);\n }\n }\n this.bSymbolTableReady = true;\n }\n static getDecodedValue(moduleBitCount) {\n let decodedValue = PDF417CodewordDecoder.getDecodedCodewordValue(PDF417CodewordDecoder.sampleBitCounts(moduleBitCount));\n if (decodedValue !== -1) {\n return decodedValue;\n }\n return PDF417CodewordDecoder.getClosestDecodedValue(moduleBitCount);\n }\n static sampleBitCounts(moduleBitCount) {\n let bitCountSum = MathUtils.sum(moduleBitCount);\n let result = new Int32Array(PDF417Common.BARS_IN_MODULE);\n let bitCountIndex = 0;\n let sumPreviousBits = 0;\n for ( /*int*/let i = 0; i < PDF417Common.MODULES_IN_CODEWORD; i++) {\n let sampleIndex = bitCountSum / (2 * PDF417Common.MODULES_IN_CODEWORD) +\n (i * bitCountSum) / PDF417Common.MODULES_IN_CODEWORD;\n if (sumPreviousBits + moduleBitCount[bitCountIndex] <= sampleIndex) {\n sumPreviousBits += moduleBitCount[bitCountIndex];\n bitCountIndex++;\n }\n result[bitCountIndex]++;\n }\n return result;\n }\n static getDecodedCodewordValue(moduleBitCount) {\n let decodedValue = PDF417CodewordDecoder.getBitValue(moduleBitCount);\n return PDF417Common.getCodeword(decodedValue) === -1 ? -1 : decodedValue;\n }\n static getBitValue(moduleBitCount) {\n let result = /*long*/ 0;\n for (let /*int*/ i = 0; i < moduleBitCount.length; i++) {\n for ( /*int*/let bit = 0; bit < moduleBitCount[i]; bit++) {\n result = (result << 1) | (i % 2 === 0 ? 1 : 0);\n }\n }\n return Math.trunc(result);\n }\n // working with 32bit float (as in Java)\n static getClosestDecodedValue(moduleBitCount) {\n let bitCountSum = MathUtils.sum(moduleBitCount);\n let bitCountRatios = new Array(PDF417Common.BARS_IN_MODULE);\n if (bitCountSum > 1) {\n for (let /*int*/ i = 0; i < bitCountRatios.length; i++) {\n bitCountRatios[i] = Math.fround(moduleBitCount[i] / bitCountSum);\n }\n }\n let bestMatchError = Float.MAX_VALUE;\n let bestMatch = -1;\n if (!this.bSymbolTableReady) {\n PDF417CodewordDecoder.initialize();\n }\n for ( /*int*/let j = 0; j < PDF417CodewordDecoder.RATIOS_TABLE.length; j++) {\n let error = 0.0;\n let ratioTableRow = PDF417CodewordDecoder.RATIOS_TABLE[j];\n for ( /*int*/let k = 0; k < PDF417Common.BARS_IN_MODULE; k++) {\n let diff = Math.fround(ratioTableRow[k] - bitCountRatios[k]);\n error += Math.fround(diff * diff);\n if (error >= bestMatchError) {\n break;\n }\n }\n if (error < bestMatchError) {\n bestMatchError = error;\n bestMatch = PDF417Common.SYMBOL_TABLE[j];\n }\n }\n return bestMatch;\n }\n }\n // flag that the table is ready for use\n PDF417CodewordDecoder.bSymbolTableReady = false;\n PDF417CodewordDecoder.RATIOS_TABLE = new Array(PDF417Common.SYMBOL_TABLE.length).map(x => x = new Array(PDF417Common.BARS_IN_MODULE));\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // package com.google.zxing.pdf417;\n /**\n * @author Guenther Grau\n */\n /*public final*/ class PDF417ResultMetadata {\n constructor() {\n this.segmentCount = -1;\n this.fileSize = -1;\n this.timestamp = -1;\n this.checksum = -1;\n }\n /**\n * The Segment ID represents the segment of the whole file distributed over different symbols.\n *\n * @return File segment index\n */\n getSegmentIndex() {\n return this.segmentIndex;\n }\n setSegmentIndex(segmentIndex) {\n this.segmentIndex = segmentIndex;\n }\n /**\n * Is the same for each related PDF417 symbol\n *\n * @return File ID\n */\n getFileId() {\n return this.fileId;\n }\n setFileId(fileId) {\n this.fileId = fileId;\n }\n /**\n * @return always null\n * @deprecated use dedicated already parsed fields\n */\n // @Deprecated\n getOptionalData() {\n return this.optionalData;\n }\n /**\n * @param optionalData old optional data format as int array\n * @deprecated parse and use new fields\n */\n // @Deprecated\n setOptionalData(optionalData) {\n this.optionalData = optionalData;\n }\n /**\n * @return true if it is the last segment\n */\n isLastSegment() {\n return this.lastSegment;\n }\n setLastSegment(lastSegment) {\n this.lastSegment = lastSegment;\n }\n /**\n * @return count of segments, -1 if not set\n */\n getSegmentCount() {\n return this.segmentCount;\n }\n setSegmentCount(segmentCount /*int*/) {\n this.segmentCount = segmentCount;\n }\n getSender() {\n return this.sender || null;\n }\n setSender(sender) {\n this.sender = sender;\n }\n getAddressee() {\n return this.addressee || null;\n }\n setAddressee(addressee) {\n this.addressee = addressee;\n }\n /**\n * Filename of the encoded file\n *\n * @return filename\n */\n getFileName() {\n return this.fileName;\n }\n setFileName(fileName) {\n this.fileName = fileName;\n }\n /**\n * filesize in bytes of the encoded file\n *\n * @return filesize in bytes, -1 if not set\n */\n getFileSize() {\n return this.fileSize;\n }\n setFileSize(fileSize /*long*/) {\n this.fileSize = fileSize;\n }\n /**\n * 16-bit CRC checksum using CCITT-16\n *\n * @return crc checksum, -1 if not set\n */\n getChecksum() {\n return this.checksum;\n }\n setChecksum(checksum /*int*/) {\n this.checksum = checksum;\n }\n /**\n * unix epock timestamp, elapsed seconds since 1970-01-01\n *\n * @return elapsed seconds, -1 if not set\n */\n getTimestamp() {\n return this.timestamp;\n }\n setTimestamp(timestamp /*long*/) {\n this.timestamp = timestamp;\n }\n }\n\n /**\n * Ponyfill for Java's Long class.\n */\n class Long {\n /**\n * Parses a string to a number, since JS has no really Int64.\n *\n * @param num Numeric string.\n * @param radix Destination radix.\n */\n static parseLong(num, radix = undefined) {\n return parseInt(num, radix);\n }\n }\n\n /**\n * Custom Error class of type Exception.\n */\n class NullPointerException extends Exception {\n }\n NullPointerException.kind = 'NullPointerException';\n\n /*\n * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.\n * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n *\n * This code is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License version 2 only, as\n * published by the Free Software Foundation. Oracle designates this\n * particular file as subject to the \"Classpath\" exception as provided\n * by Oracle in the LICENSE file that accompanied this code.\n *\n * This code is distributed in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n * version 2 for more details (a copy is included in the LICENSE file that\n * accompanied this code).\n *\n * You should have received a copy of the GNU General Public License version\n * 2 along with this work; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n * or visit www.oracle.com if you need additional information or have any\n * questions.\n */\n // package java.io;\n /**\n * This abstract class is the superclass of all classes representing\n * an output stream of bytes. An output stream accepts output bytes\n * and sends them to some sink.\n * \n * Applications that need to define a subclass of\n * OutputStream
must always provide at least a method\n * that writes one byte of output.\n *\n * @author Arthur van Hoff\n * @see java.io.BufferedOutputStream\n * @see java.io.ByteArrayOutputStream\n * @see java.io.DataOutputStream\n * @see java.io.FilterOutputStream\n * @see java.io.InputStream\n * @see java.io.OutputStream#write(int)\n * @since JDK1.0\n */\n /*public*/ class OutputStream /*implements Closeable, Flushable*/ {\n /**\n * Writes b.length
bytes from the specified byte array\n * to this output stream. The general contract for write(b)
\n * is that it should have exactly the same effect as the call\n * write(b, 0, b.length)
.\n *\n * @param b the data.\n * @exception IOException if an I/O error occurs.\n * @see java.io.OutputStream#write(byte[], int, int)\n */\n writeBytes(b) {\n this.writeBytesOffset(b, 0, b.length);\n }\n /**\n * Writes len
bytes from the specified byte array\n * starting at offset off
to this output stream.\n * The general contract for write(b, off, len)
is that\n * some of the bytes in the array b
are written to the\n * output stream in order; element b[off]
is the first\n * byte written and b[off+len-1]
is the last byte written\n * by this operation.\n *
\n * The write
method of OutputStream
calls\n * the write method of one argument on each of the bytes to be\n * written out. Subclasses are encouraged to override this method and\n * provide a more efficient implementation.\n *
\n * If b
is null
, a\n * NullPointerException
is thrown.\n *
\n * If off
is negative, or len
is negative, or\n * off+len
is greater than the length of the array\n * b
, then an IndexOutOfBoundsException is thrown.\n *\n * @param b the data.\n * @param off the start offset in the data.\n * @param len the number of bytes to write.\n * @exception IOException if an I/O error occurs. In particular,\n * an IOException
is thrown if the output\n * stream is closed.\n */\n writeBytesOffset(b, off, len) {\n if (b == null) {\n throw new NullPointerException();\n }\n else if ((off < 0) || (off > b.length) || (len < 0) ||\n ((off + len) > b.length) || ((off + len) < 0)) {\n throw new IndexOutOfBoundsException();\n }\n else if (len === 0) {\n return;\n }\n for (let i = 0; i < len; i++) {\n this.write(b[off + i]);\n }\n }\n /**\n * Flushes this output stream and forces any buffered output bytes\n * to be written out. The general contract of flush
is\n * that calling it is an indication that, if any bytes previously\n * written have been buffered by the implementation of the output\n * stream, such bytes should immediately be written to their\n * intended destination.\n *
\n * If the intended destination of this stream is an abstraction provided by\n * the underlying operating system, for example a file, then flushing the\n * stream guarantees only that bytes previously written to the stream are\n * passed to the operating system for writing; it does not guarantee that\n * they are actually written to a physical device such as a disk drive.\n *
\n * The flush
method of OutputStream
does nothing.\n *\n * @exception IOException if an I/O error occurs.\n */\n flush() {\n }\n /**\n * Closes this output stream and releases any system resources\n * associated with this stream. The general contract of close
\n * is that it closes the output stream. A closed stream cannot perform\n * output operations and cannot be reopened.\n *
\n * The close
method of OutputStream
does nothing.\n *\n * @exception IOException if an I/O error occurs.\n */\n close() {\n }\n }\n\n /**\n * Custom Error class of type Exception.\n */\n class OutOfMemoryError extends Exception {\n }\n\n /*\n * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.\n * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n *\n * This code is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License version 2 only, as\n * published by the Free Software Foundation. Oracle designates this\n * particular file as subject to the \"Classpath\" exception as provided\n * by Oracle in the LICENSE file that accompanied this code.\n *\n * This code is distributed in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n * version 2 for more details (a copy is included in the LICENSE file that\n * accompanied this code).\n *\n * You should have received a copy of the GNU General Public License version\n * 2 along with this work; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n * or visit www.oracle.com if you need additional information or have any\n * questions.\n */\n /**\n * This class implements an output stream in which the data is\n * written into a byte array. The buffer automatically grows as data\n * is written to it.\n * The data can be retrieved using toByteArray()
and\n * toString()
.\n *
\n * Closing a ByteArrayOutputStream has no effect. The methods in\n * this class can be called after the stream has been closed without\n * generating an IOException.\n *\n * @author Arthur van Hoff\n * @since JDK1.0\n */\n /*public*/ class ByteArrayOutputStream extends OutputStream {\n /**\n * Creates a new byte array output stream. The buffer capacity is\n * initially 32 bytes, though its size increases if necessary.\n */\n // public constructor() {\n // this(32);\n // }\n /**\n * Creates a new byte array output stream, with a buffer capacity of\n * the specified size, in bytes.\n *\n * @param size the initial size.\n * @exception IllegalArgumentException if size is negative.\n */\n constructor(size = 32) {\n super();\n /**\n * The number of valid bytes in the buffer.\n */\n this.count = 0;\n if (size < 0) {\n throw new IllegalArgumentException('Negative initial size: '\n + size);\n }\n this.buf = new Uint8Array(size);\n }\n /**\n * Increases the capacity if necessary to ensure that it can hold\n * at least the number of elements specified by the minimum\n * capacity argument.\n *\n * @param minCapacity the desired minimum capacity\n * @throws OutOfMemoryError if {@code minCapacity < 0}. This is\n * interpreted as a request for the unsatisfiably large capacity\n * {@code (long) Integer.MAX_VALUE + (minCapacity - Integer.MAX_VALUE)}.\n */\n ensureCapacity(minCapacity) {\n // overflow-conscious code\n if (minCapacity - this.buf.length > 0)\n this.grow(minCapacity);\n }\n /**\n * Increases the capacity to ensure that it can hold at least the\n * number of elements specified by the minimum capacity argument.\n *\n * @param minCapacity the desired minimum capacity\n */\n grow(minCapacity) {\n // overflow-conscious code\n let oldCapacity = this.buf.length;\n let newCapacity = oldCapacity << 1;\n if (newCapacity - minCapacity < 0)\n newCapacity = minCapacity;\n if (newCapacity < 0) {\n if (minCapacity < 0) // overflow\n throw new OutOfMemoryError();\n newCapacity = Integer.MAX_VALUE;\n }\n this.buf = Arrays.copyOfUint8Array(this.buf, newCapacity);\n }\n /**\n * Writes the specified byte to this byte array output stream.\n *\n * @param b the byte to be written.\n */\n write(b) {\n this.ensureCapacity(this.count + 1);\n this.buf[this.count] = /*(byte)*/ b;\n this.count += 1;\n }\n /**\n * Writes len
bytes from the specified byte array\n * starting at offset off
to this byte array output stream.\n *\n * @param b the data.\n * @param off the start offset in the data.\n * @param len the number of bytes to write.\n */\n writeBytesOffset(b, off, len) {\n if ((off < 0) || (off > b.length) || (len < 0) ||\n ((off + len) - b.length > 0)) {\n throw new IndexOutOfBoundsException();\n }\n this.ensureCapacity(this.count + len);\n System.arraycopy(b, off, this.buf, this.count, len);\n this.count += len;\n }\n /**\n * Writes the complete contents of this byte array output stream to\n * the specified output stream argument, as if by calling the output\n * stream's write method using out.write(buf, 0, count)
.\n *\n * @param out the output stream to which to write the data.\n * @exception IOException if an I/O error occurs.\n */\n writeTo(out) {\n out.writeBytesOffset(this.buf, 0, this.count);\n }\n /**\n * Resets the count
field of this byte array output\n * stream to zero, so that all currently accumulated output in the\n * output stream is discarded. The output stream can be used again,\n * reusing the already allocated buffer space.\n *\n * @see java.io.ByteArrayInputStream#count\n */\n reset() {\n this.count = 0;\n }\n /**\n * Creates a newly allocated byte array. Its size is the current\n * size of this output stream and the valid contents of the buffer\n * have been copied into it.\n *\n * @return the current contents of this output stream, as a byte array.\n * @see java.io.ByteArrayOutputStream#size()\n */\n toByteArray() {\n return Arrays.copyOfUint8Array(this.buf, this.count);\n }\n /**\n * Returns the current size of the buffer.\n *\n * @return the value of the count
field, which is the number\n * of valid bytes in this output stream.\n * @see java.io.ByteArrayOutputStream#count\n */\n size() {\n return this.count;\n }\n toString(param) {\n if (!param) {\n return this.toString_void();\n }\n if (typeof param === 'string') {\n return this.toString_string(param);\n }\n return this.toString_number(param);\n }\n /**\n * Converts the buffer's contents into a string decoding bytes using the\n * platform's default character set. The length of the new String\n * is a function of the character set, and hence may not be equal to the\n * size of the buffer.\n *\n *
This method always replaces malformed-input and unmappable-character\n * sequences with the default replacement string for the platform's\n * default character set. The {@linkplain java.nio.charset.CharsetDecoder}\n * class should be used when more control over the decoding process is\n * required.\n *\n * @return String decoded from the buffer's contents.\n * @since JDK1.1\n */\n toString_void() {\n return new String(this.buf /*, 0, this.count*/).toString();\n }\n /**\n * Converts the buffer's contents into a string by decoding the bytes using\n * the specified {@link java.nio.charset.Charset charsetName}. The length of\n * the new String is a function of the charset, and hence may not be\n * equal to the length of the byte array.\n *\n *
This method always replaces malformed-input and unmappable-character\n * sequences with this charset's default replacement string. The {@link\n * java.nio.charset.CharsetDecoder} class should be used when more control\n * over the decoding process is required.\n *\n * @param charsetName the name of a supported\n * {@linkplain java.nio.charset.Charset charset}\n * @return String decoded from the buffer's contents.\n * @exception UnsupportedEncodingException\n * If the named charset is not supported\n * @since JDK1.1\n */\n toString_string(charsetName) {\n return new String(this.buf /*, 0, this.count, charsetName*/).toString();\n }\n /**\n * Creates a newly allocated string. Its size is the current size of\n * the output stream and the valid contents of the buffer have been\n * copied into it. Each character c in the resulting string is\n * constructed from the corresponding element b in the byte\n * array such that:\n * \n * c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))\n *
\n *\n * @deprecated This method does not properly convert bytes into characters.\n * As of JDK 1.1, the preferred way to do this is via the\n * toString(String enc)
method, which takes an encoding-name\n * argument, or the toString()
method, which uses the\n * platform's default character encoding.\n *\n * @param hibyte the high byte of each resulting Unicode character.\n * @return the current contents of the output stream, as a string.\n * @see java.io.ByteArrayOutputStream#size()\n * @see java.io.ByteArrayOutputStream#toString(String)\n * @see java.io.ByteArrayOutputStream#toString()\n */\n // @Deprecated\n toString_number(hibyte) {\n return new String(this.buf /*, hibyte, 0, this.count*/).toString();\n }\n /**\n * Closing a ByteArrayOutputStream has no effect. The methods in\n * this class can be called after the stream has been closed without\n * generating an IOException.\n * \n *\n * @throws IOException\n */\n close() {\n }\n }\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /*private*/ var Mode$2;\n (function (Mode) {\n Mode[Mode[\"ALPHA\"] = 0] = \"ALPHA\";\n Mode[Mode[\"LOWER\"] = 1] = \"LOWER\";\n Mode[Mode[\"MIXED\"] = 2] = \"MIXED\";\n Mode[Mode[\"PUNCT\"] = 3] = \"PUNCT\";\n Mode[Mode[\"ALPHA_SHIFT\"] = 4] = \"ALPHA_SHIFT\";\n Mode[Mode[\"PUNCT_SHIFT\"] = 5] = \"PUNCT_SHIFT\";\n })(Mode$2 || (Mode$2 = {}));\n /**\n * Indirectly access the global BigInt constructor, it\n * allows browsers that doesn't support BigInt to run\n * the library without breaking due to \"undefined BigInt\"\n * errors.\n */\n function getBigIntConstructor() {\n if (typeof window !== 'undefined') {\n return window['BigInt'] || null;\n }\n if (typeof global !== 'undefined') {\n return global['BigInt'] || null;\n }\n if (typeof self !== 'undefined') {\n return self['BigInt'] || null;\n }\n throw new Error('Can\\'t search globals for BigInt!');\n }\n /**\n * Used to store the BigInt constructor.\n */\n let BigInteger;\n /**\n * This function creates a bigint value. It allows browsers\n * that doesn't support BigInt to run the rest of the library\n * by not directly accessing the BigInt constructor.\n */\n function createBigInt(num) {\n if (typeof BigInteger === 'undefined') {\n BigInteger = getBigIntConstructor();\n }\n if (BigInteger === null) {\n throw new Error('BigInt is not supported!');\n }\n return BigInteger(num);\n }\n function getEXP900() {\n // in Java - array with length = 16\n let EXP900 = [];\n EXP900[0] = createBigInt(1);\n let nineHundred = createBigInt(900);\n EXP900[1] = nineHundred;\n // in Java - array with length = 16\n for (let i /*int*/ = 2; i < 16; i++) {\n EXP900[i] = EXP900[i - 1] * nineHundred;\n }\n return EXP900;\n }\n /**\n *
This class contains the methods for decoding the PDF417 codewords.
\n *\n * @author SITA Lab (kevin.osullivan@sita.aero)\n * @author Guenther Grau\n */\n /*final*/ class DecodedBitStreamParser$2 {\n // private DecodedBitStreamParser() {\n // }\n /**\n *\n * @param codewords\n * @param ecLevel\n *\n * @throws FormatException\n */\n static decode(codewords, ecLevel) {\n // pass encoding to result (will be used for decode symbols in byte mode)\n let result = new StringBuilder('');\n // let encoding: Charset = StandardCharsets.ISO_8859_1;\n let encoding = CharacterSetECI.ISO8859_1;\n /**\n * @note the next command is specific from this TypeScript library\n * because TS can't properly cast some values to char and\n * convert it to string later correctly due to encoding\n * differences from Java version. As reported here:\n * https://github.com/zxing-js/library/pull/264/files#r382831593\n */\n result.enableDecoding(encoding);\n // Get compaction mode\n let codeIndex = 1;\n let code = codewords[codeIndex++];\n let resultMetadata = new PDF417ResultMetadata();\n while (codeIndex < codewords[0]) {\n switch (code) {\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n codeIndex = DecodedBitStreamParser$2.textCompaction(codewords, codeIndex, result);\n break;\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH_6:\n codeIndex = DecodedBitStreamParser$2.byteCompaction(code, codewords, encoding, codeIndex, result);\n break;\n case DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ codewords[codeIndex++]);\n break;\n case DecodedBitStreamParser$2.NUMERIC_COMPACTION_MODE_LATCH:\n codeIndex = DecodedBitStreamParser$2.numericCompaction(codewords, codeIndex, result);\n break;\n case DecodedBitStreamParser$2.ECI_CHARSET:\n let charsetECI = CharacterSetECI.getCharacterSetECIByValue(codewords[codeIndex++]);\n // encoding = Charset.forName(charsetECI.getName());\n break;\n case DecodedBitStreamParser$2.ECI_GENERAL_PURPOSE:\n // Can't do anything with generic ECI; skip its 2 characters\n codeIndex += 2;\n break;\n case DecodedBitStreamParser$2.ECI_USER_DEFINED:\n // Can't do anything with user ECI; skip its 1 character\n codeIndex++;\n break;\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n codeIndex = DecodedBitStreamParser$2.decodeMacroBlock(codewords, codeIndex, resultMetadata);\n break;\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser$2.MACRO_PDF417_TERMINATOR:\n // Should not see these outside a macro block\n throw new FormatException();\n default:\n // Default to text compaction. During testing numerous barcodes\n // appeared to be missing the starting mode. In these cases defaulting\n // to text compaction seems to work.\n codeIndex--;\n codeIndex = DecodedBitStreamParser$2.textCompaction(codewords, codeIndex, result);\n break;\n }\n if (codeIndex < codewords.length) {\n code = codewords[codeIndex++];\n }\n else {\n throw FormatException.getFormatInstance();\n }\n }\n if (result.length() === 0) {\n throw FormatException.getFormatInstance();\n }\n let decoderResult = new DecoderResult(null, result.toString(), null, ecLevel);\n decoderResult.setOther(resultMetadata);\n return decoderResult;\n }\n /**\n *\n * @param int\n * @param param1\n * @param codewords\n * @param int\n * @param codeIndex\n * @param PDF417ResultMetadata\n * @param resultMetadata\n *\n * @throws FormatException\n */\n // @SuppressWarnings(\"deprecation\")\n static decodeMacroBlock(codewords, codeIndex, resultMetadata) {\n if (codeIndex + DecodedBitStreamParser$2.NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {\n // we must have at least two bytes left for the segment index\n throw FormatException.getFormatInstance();\n }\n let segmentIndexArray = new Int32Array(DecodedBitStreamParser$2.NUMBER_OF_SEQUENCE_CODEWORDS);\n for (let i /*int*/ = 0; i < DecodedBitStreamParser$2.NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {\n segmentIndexArray[i] = codewords[codeIndex];\n }\n resultMetadata.setSegmentIndex(Integer.parseInt(DecodedBitStreamParser$2.decodeBase900toBase10(segmentIndexArray, DecodedBitStreamParser$2.NUMBER_OF_SEQUENCE_CODEWORDS)));\n let fileId = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.textCompaction(codewords, codeIndex, fileId);\n resultMetadata.setFileId(fileId.toString());\n let optionalFieldsStart = -1;\n if (codewords[codeIndex] === DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {\n optionalFieldsStart = codeIndex + 1;\n }\n while (codeIndex < codewords[0]) {\n switch (codewords[codeIndex]) {\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n codeIndex++;\n switch (codewords[codeIndex]) {\n case DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:\n let fileName = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.textCompaction(codewords, codeIndex + 1, fileName);\n resultMetadata.setFileName(fileName.toString());\n break;\n case DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_SENDER:\n let sender = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.textCompaction(codewords, codeIndex + 1, sender);\n resultMetadata.setSender(sender.toString());\n break;\n case DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:\n let addressee = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.textCompaction(codewords, codeIndex + 1, addressee);\n resultMetadata.setAddressee(addressee.toString());\n break;\n case DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:\n let segmentCount = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.numericCompaction(codewords, codeIndex + 1, segmentCount);\n resultMetadata.setSegmentCount(Integer.parseInt(segmentCount.toString()));\n break;\n case DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:\n let timestamp = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.numericCompaction(codewords, codeIndex + 1, timestamp);\n resultMetadata.setTimestamp(Long.parseLong(timestamp.toString()));\n break;\n case DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:\n let checksum = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.numericCompaction(codewords, codeIndex + 1, checksum);\n resultMetadata.setChecksum(Integer.parseInt(checksum.toString()));\n break;\n case DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:\n let fileSize = new StringBuilder();\n codeIndex = DecodedBitStreamParser$2.numericCompaction(codewords, codeIndex + 1, fileSize);\n resultMetadata.setFileSize(Long.parseLong(fileSize.toString()));\n break;\n default:\n throw FormatException.getFormatInstance();\n }\n break;\n case DecodedBitStreamParser$2.MACRO_PDF417_TERMINATOR:\n codeIndex++;\n resultMetadata.setLastSegment(true);\n break;\n default:\n throw FormatException.getFormatInstance();\n }\n }\n // copy optional fields to additional options\n if (optionalFieldsStart !== -1) {\n let optionalFieldsLength = codeIndex - optionalFieldsStart;\n if (resultMetadata.isLastSegment()) {\n // do not include terminator\n optionalFieldsLength--;\n }\n resultMetadata.setOptionalData(Arrays.copyOfRange(codewords, optionalFieldsStart, optionalFieldsStart + optionalFieldsLength));\n }\n return codeIndex;\n }\n /**\n * Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be\n * encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as\n * well as selected control characters.\n *\n * @param codewords The array of codewords (data + error)\n * @param codeIndex The current index into the codeword array.\n * @param result The decoded data is appended to the result.\n * @return The next index into the codeword array.\n */\n static textCompaction(codewords, codeIndex, result) {\n // 2 character per codeword\n let textCompactionData = new Int32Array((codewords[0] - codeIndex) * 2);\n // Used to hold the byte compaction value if there is a mode shift\n let byteCompactionData = new Int32Array((codewords[0] - codeIndex) * 2);\n let index = 0;\n let end = false;\n while ((codeIndex < codewords[0]) && !end) {\n let code = codewords[codeIndex++];\n if (code < DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH) {\n textCompactionData[index] = code / 30;\n textCompactionData[index + 1] = code % 30;\n index += 2;\n }\n else {\n switch (code) {\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n // reinitialize text compaction mode to alpha sub mode\n textCompactionData[index++] = DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH;\n break;\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser$2.NUMERIC_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser$2.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n case DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n // The Mode Shift codeword 913 shall cause a temporary\n // switch from Text Compaction mode to Byte Compaction mode.\n // This switch shall be in effect for only the next codeword,\n // after which the mode shall revert to the prevailing sub-mode\n // of the Text Compaction mode. Codeword 913 is only available\n // in Text Compaction mode; its use is described in 5.4.2.4.\n textCompactionData[index] = DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE;\n code = codewords[codeIndex++];\n byteCompactionData[index] = code;\n index++;\n break;\n }\n }\n }\n DecodedBitStreamParser$2.decodeTextCompaction(textCompactionData, byteCompactionData, index, result);\n return codeIndex;\n }\n /**\n * The Text Compaction mode includes all the printable ASCII characters\n * (i.e. values from 32 to 126) and three ASCII control characters: HT or tab\n * (9: e), LF or line feed (10: e), and CR or carriage\n * return (13: e). The Text Compaction mode also includes various latch\n * and shift characters which are used exclusively within the mode. The Text\n * Compaction mode encodes up to 2 characters per codeword. The compaction rules\n * for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode\n * switches are defined in 5.4.2.3.\n *\n * @param textCompactionData The text compaction data.\n * @param byteCompactionData The byte compaction data if there\n * was a mode shift.\n * @param length The size of the text compaction and byte compaction data.\n * @param result The decoded data is appended to the result.\n */\n static decodeTextCompaction(textCompactionData, byteCompactionData, length, result) {\n // Beginning from an initial state of the Alpha sub-mode\n // The default compaction mode for PDF417 in effect at the start of each symbol shall always be Text\n // Compaction mode Alpha sub-mode (alphabetic: uppercase). A latch codeword from another mode to the Text\n // Compaction mode shall always switch to the Text Compaction Alpha sub-mode.\n let subMode = Mode$2.ALPHA;\n let priorToShiftMode = Mode$2.ALPHA;\n let i = 0;\n while (i < length) {\n let subModeCh = textCompactionData[i];\n let ch = /*char*/ '';\n switch (subMode) {\n case Mode$2.ALPHA:\n // Alpha (alphabetic: uppercase)\n if (subModeCh < 26) {\n // Upper case Alpha Character\n // Note: 65 = 'A' ASCII -> there is byte code of symbol\n ch = /*(char)('A' + subModeCh) */ String.fromCharCode(65 + subModeCh);\n }\n else {\n switch (subModeCh) {\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser$2.LL:\n subMode = Mode$2.LOWER;\n break;\n case DecodedBitStreamParser$2.ML:\n subMode = Mode$2.MIXED;\n break;\n case DecodedBitStreamParser$2.PS:\n // Shift to punctuation\n priorToShiftMode = subMode;\n subMode = Mode$2.PUNCT_SHIFT;\n break;\n case DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode$2.ALPHA;\n break;\n }\n }\n break;\n case Mode$2.LOWER:\n // Lower (alphabetic: lowercase)\n if (subModeCh < 26) {\n ch = /*(char)('a' + subModeCh)*/ String.fromCharCode(97 + subModeCh);\n }\n else {\n switch (subModeCh) {\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser$2.AS:\n // Shift to alpha\n priorToShiftMode = subMode;\n subMode = Mode$2.ALPHA_SHIFT;\n break;\n case DecodedBitStreamParser$2.ML:\n subMode = Mode$2.MIXED;\n break;\n case DecodedBitStreamParser$2.PS:\n // Shift to punctuation\n priorToShiftMode = subMode;\n subMode = Mode$2.PUNCT_SHIFT;\n break;\n case DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n // TODO Does this need to use the current character encoding? See other occurrences below\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode$2.ALPHA;\n break;\n }\n }\n break;\n case Mode$2.MIXED:\n // Mixed (punctuation: e)\n if (subModeCh < DecodedBitStreamParser$2.PL) {\n ch = DecodedBitStreamParser$2.MIXED_CHARS[subModeCh];\n }\n else {\n switch (subModeCh) {\n case DecodedBitStreamParser$2.PL:\n subMode = Mode$2.PUNCT;\n break;\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser$2.LL:\n subMode = Mode$2.LOWER;\n break;\n case DecodedBitStreamParser$2.AL:\n subMode = Mode$2.ALPHA;\n break;\n case DecodedBitStreamParser$2.PS:\n // Shift to punctuation\n priorToShiftMode = subMode;\n subMode = Mode$2.PUNCT_SHIFT;\n break;\n case DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode$2.ALPHA;\n break;\n }\n }\n break;\n case Mode$2.PUNCT:\n // Punctuation\n if (subModeCh < DecodedBitStreamParser$2.PAL) {\n ch = DecodedBitStreamParser$2.PUNCT_CHARS[subModeCh];\n }\n else {\n switch (subModeCh) {\n case DecodedBitStreamParser$2.PAL:\n subMode = Mode$2.ALPHA;\n break;\n case DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode$2.ALPHA;\n break;\n }\n }\n break;\n case Mode$2.ALPHA_SHIFT:\n // Restore sub-mode\n subMode = priorToShiftMode;\n if (subModeCh < 26) {\n ch = /*(char)('A' + subModeCh)*/ String.fromCharCode(65 + subModeCh);\n }\n else {\n switch (subModeCh) {\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode$2.ALPHA;\n break;\n }\n }\n break;\n case Mode$2.PUNCT_SHIFT:\n // Restore sub-mode\n subMode = priorToShiftMode;\n if (subModeCh < DecodedBitStreamParser$2.PAL) {\n ch = DecodedBitStreamParser$2.PUNCT_CHARS[subModeCh];\n }\n else {\n switch (subModeCh) {\n case DecodedBitStreamParser$2.PAL:\n subMode = Mode$2.ALPHA;\n break;\n case DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n // PS before Shift-to-Byte is used as a padding character,\n // see 5.4.2.4 of the specification\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode$2.ALPHA;\n break;\n }\n }\n break;\n }\n // if (ch !== 0) {\n if (ch !== '') {\n // Append decoded character to result\n result.append(ch);\n }\n i++;\n }\n }\n /**\n * Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded.\n * This includes all ASCII characters value 0 to 127 inclusive and provides for international\n * character set support.\n *\n * @param mode The byte compaction mode i.e. 901 or 924\n * @param codewords The array of codewords (data + error)\n * @param encoding Currently active character encoding\n * @param codeIndex The current index into the codeword array.\n * @param result The decoded data is appended to the result.\n * @return The next index into the codeword array.\n */\n static /*int*/ byteCompaction(mode, codewords, encoding, codeIndex, result) {\n let decodedBytes = new ByteArrayOutputStream();\n let count = 0;\n let value = /*long*/ 0;\n let end = false;\n switch (mode) {\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH:\n // Total number of Byte Compaction characters to be encoded\n // is not a multiple of 6\n let byteCompactedCodewords = new Int32Array(6);\n let nextCode = codewords[codeIndex++];\n while ((codeIndex < codewords[0]) && !end) {\n byteCompactedCodewords[count++] = nextCode;\n // Base 900\n value = 900 * value + nextCode;\n nextCode = codewords[codeIndex++];\n // perhaps it should be ok to check only nextCode >= TEXT_COMPACTION_MODE_LATCH\n switch (nextCode) {\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.NUMERIC_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser$2.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n default:\n if ((count % 5 === 0) && (count > 0)) {\n // Decode every 5 codewords\n // Convert to Base 256\n for (let j /*int*/ = 0; j < 6; ++j) {\n /* @note\n * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.\n * So the next bitwise operation could not be done with simple numbers\n */\n decodedBytes.write(/*(byte)*/ Number(createBigInt(value) >> createBigInt(8 * (5 - j))));\n }\n value = 0;\n count = 0;\n }\n break;\n }\n }\n // if the end of all codewords is reached the last codeword needs to be added\n if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH) {\n byteCompactedCodewords[count++] = nextCode;\n }\n // If Byte Compaction mode is invoked with codeword 901,\n // the last group of codewords is interpreted directly\n // as one byte per codeword, without compaction.\n for (let i /*int*/ = 0; i < count; i++) {\n decodedBytes.write(/*(byte)*/ byteCompactedCodewords[i]);\n }\n break;\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH_6:\n // Total number of Byte Compaction characters to be encoded\n // is an integer multiple of 6\n while (codeIndex < codewords[0] && !end) {\n let code = codewords[codeIndex++];\n if (code < DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH) {\n count++;\n // Base 900\n value = 900 * value + code;\n }\n else {\n switch (code) {\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.NUMERIC_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser$2.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n }\n }\n if ((count % 5 === 0) && (count > 0)) {\n // Decode every 5 codewords\n // Convert to Base 256\n /* @note\n * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.\n * So the next bitwise operation could not be done with simple numbers\n */\n for (let j /*int*/ = 0; j < 6; ++j) {\n decodedBytes.write(/*(byte)*/ Number(createBigInt(value) >> createBigInt(8 * (5 - j))));\n }\n value = 0;\n count = 0;\n }\n }\n break;\n }\n result.append(StringEncoding.decode(decodedBytes.toByteArray(), encoding));\n return codeIndex;\n }\n /**\n * Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.\n *\n * @param codewords The array of codewords (data + error)\n * @param codeIndex The current index into the codeword array.\n * @param result The decoded data is appended to the result.\n * @return The next index into the codeword array.\n *\n * @throws FormatException\n */\n static numericCompaction(codewords, codeIndex /*int*/, result) {\n let count = 0;\n let end = false;\n let numericCodewords = new Int32Array(DecodedBitStreamParser$2.MAX_NUMERIC_CODEWORDS);\n while (codeIndex < codewords[0] && !end) {\n let code = codewords[codeIndex++];\n if (codeIndex === codewords[0]) {\n end = true;\n }\n if (code < DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH) {\n numericCodewords[count] = code;\n count++;\n }\n else {\n switch (code) {\n case DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser$2.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n }\n }\n if ((count % DecodedBitStreamParser$2.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser$2.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {\n // Re-invoking Numeric Compaction mode (by using codeword 902\n // while in Numeric Compaction mode) serves to terminate the\n // current Numeric Compaction mode grouping as described in 5.4.4.2,\n // and then to start a new one grouping.\n result.append(DecodedBitStreamParser$2.decodeBase900toBase10(numericCodewords, count));\n count = 0;\n }\n }\n return codeIndex;\n }\n /**\n * Convert a list of Numeric Compacted codewords from Base 900 to Base 10.\n *\n * @param codewords The array of codewords\n * @param count The number of codewords\n * @return The decoded string representing the Numeric data.\n *\n * EXAMPLE\n * Encode the fifteen digit numeric string 000213298174000\n * Prefix the numeric string with a 1 and set the initial value of\n * t = 1 000 213 298 174 000\n * Calculate codeword 0\n * d0 = 1 000 213 298 174 000 mod 900 = 200\n *\n * t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082\n * Calculate codeword 1\n * d1 = 1 111 348 109 082 mod 900 = 282\n *\n * t = 1 111 348 109 082 div 900 = 1 234 831 232\n * Calculate codeword 2\n * d2 = 1 234 831 232 mod 900 = 632\n *\n * t = 1 234 831 232 div 900 = 1 372 034\n * Calculate codeword 3\n * d3 = 1 372 034 mod 900 = 434\n *\n * t = 1 372 034 div 900 = 1 524\n * Calculate codeword 4\n * d4 = 1 524 mod 900 = 624\n *\n * t = 1 524 div 900 = 1\n * Calculate codeword 5\n * d5 = 1 mod 900 = 1\n * t = 1 div 900 = 0\n * Codeword sequence is: 1, 624, 434, 632, 282, 200\n *\n * Decode the above codewords involves\n * 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 +\n * 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000\n *\n * Remove leading 1 => Result is 000213298174000\n *\n * @throws FormatException\n */\n static decodeBase900toBase10(codewords, count) {\n let result = createBigInt(0);\n for (let i /*int*/ = 0; i < count; i++) {\n result += DecodedBitStreamParser$2.EXP900[count - i - 1] * createBigInt(codewords[i]);\n }\n let resultString = result.toString();\n if (resultString.charAt(0) !== '1') {\n throw new FormatException();\n }\n return resultString.substring(1);\n }\n }\n DecodedBitStreamParser$2.TEXT_COMPACTION_MODE_LATCH = 900;\n DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH = 901;\n DecodedBitStreamParser$2.NUMERIC_COMPACTION_MODE_LATCH = 902;\n DecodedBitStreamParser$2.BYTE_COMPACTION_MODE_LATCH_6 = 924;\n DecodedBitStreamParser$2.ECI_USER_DEFINED = 925;\n DecodedBitStreamParser$2.ECI_GENERAL_PURPOSE = 926;\n DecodedBitStreamParser$2.ECI_CHARSET = 927;\n DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_CONTROL_BLOCK = 928;\n DecodedBitStreamParser$2.BEGIN_MACRO_PDF417_OPTIONAL_FIELD = 923;\n DecodedBitStreamParser$2.MACRO_PDF417_TERMINATOR = 922;\n DecodedBitStreamParser$2.MODE_SHIFT_TO_BYTE_COMPACTION_MODE = 913;\n DecodedBitStreamParser$2.MAX_NUMERIC_CODEWORDS = 15;\n DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME = 0;\n DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT = 1;\n DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP = 2;\n DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_SENDER = 3;\n DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE = 4;\n DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE = 5;\n DecodedBitStreamParser$2.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM = 6;\n DecodedBitStreamParser$2.PL = 25;\n DecodedBitStreamParser$2.LL = 27;\n DecodedBitStreamParser$2.AS = 27;\n DecodedBitStreamParser$2.ML = 28;\n DecodedBitStreamParser$2.AL = 28;\n DecodedBitStreamParser$2.PS = 29;\n DecodedBitStreamParser$2.PAL = 29;\n DecodedBitStreamParser$2.PUNCT_CHARS = ';<>@[\\\\]_`~!\\r\\t,:\\n-.$/\"|*()?{}\\'';\n DecodedBitStreamParser$2.MIXED_CHARS = '0123456789&\\r\\t,:#-.$/+%*=^';\n /**\n * Table containing values for the exponent of 900.\n * This is used in the numeric compaction decode algorithm.\n */\n DecodedBitStreamParser$2.EXP900 = getBigIntConstructor() ? getEXP900() : [];\n DecodedBitStreamParser$2.NUMBER_OF_SEQUENCE_CODEWORDS = 2;\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // import java.util.ArrayList;\n // import java.util.Collection;\n // import java.util.Formatter;\n // import java.util.List;\n /**\n * @author Guenther Grau\n */\n /*public final*/ class PDF417ScanningDecoder {\n constructor() { }\n /**\n * @TODO don't pass in minCodewordWidth and maxCodewordWidth, pass in barcode columns for start and stop pattern\n *\n * columns. That way width can be deducted from the pattern column.\n * This approach also allows to detect more details about the barcode, e.g. if a bar type (white or black) is wider\n * than it should be. This can happen if the scanner used a bad blackpoint.\n *\n * @param BitMatrix\n * @param image\n * @param ResultPoint\n * @param imageTopLeft\n * @param ResultPoint\n * @param imageBottomLeft\n * @param ResultPoint\n * @param imageTopRight\n * @param ResultPoint\n * @param imageBottomRight\n * @param int\n * @param minCodewordWidth\n * @param int\n * @param maxCodewordWidth\n *\n * @throws NotFoundException\n * @throws FormatException\n * @throws ChecksumException\n */\n static decode(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight, minCodewordWidth, maxCodewordWidth) {\n let boundingBox = new BoundingBox(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight);\n let leftRowIndicatorColumn = null;\n let rightRowIndicatorColumn = null;\n let detectionResult;\n for (let firstPass /*boolean*/ = true;; firstPass = false) {\n if (imageTopLeft != null) {\n leftRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopLeft, true, minCodewordWidth, maxCodewordWidth);\n }\n if (imageTopRight != null) {\n rightRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopRight, false, minCodewordWidth, maxCodewordWidth);\n }\n detectionResult = PDF417ScanningDecoder.merge(leftRowIndicatorColumn, rightRowIndicatorColumn);\n if (detectionResult == null) {\n throw NotFoundException.getNotFoundInstance();\n }\n let resultBox = detectionResult.getBoundingBox();\n if (firstPass && resultBox != null &&\n (resultBox.getMinY() < boundingBox.getMinY() || resultBox.getMaxY() > boundingBox.getMaxY())) {\n boundingBox = resultBox;\n }\n else {\n break;\n }\n }\n detectionResult.setBoundingBox(boundingBox);\n let maxBarcodeColumn = detectionResult.getBarcodeColumnCount() + 1;\n detectionResult.setDetectionResultColumn(0, leftRowIndicatorColumn);\n detectionResult.setDetectionResultColumn(maxBarcodeColumn, rightRowIndicatorColumn);\n let leftToRight = leftRowIndicatorColumn != null;\n for (let barcodeColumnCount /*int*/ = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) {\n let barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount;\n if (detectionResult.getDetectionResultColumn(barcodeColumn) !== /* null */ undefined) {\n // This will be the case for the opposite row indicator column, which doesn't need to be decoded again.\n continue;\n }\n let detectionResultColumn;\n if (barcodeColumn === 0 || barcodeColumn === maxBarcodeColumn) {\n detectionResultColumn = new DetectionResultRowIndicatorColumn(boundingBox, barcodeColumn === 0);\n }\n else {\n detectionResultColumn = new DetectionResultColumn(boundingBox);\n }\n detectionResult.setDetectionResultColumn(barcodeColumn, detectionResultColumn);\n let startColumn = -1;\n let previousStartColumn = startColumn;\n // TODO start at a row for which we know the start position, then detect upwards and downwards from there.\n for (let imageRow /*int*/ = boundingBox.getMinY(); imageRow <= boundingBox.getMaxY(); imageRow++) {\n startColumn = PDF417ScanningDecoder.getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight);\n if (startColumn < 0 || startColumn > boundingBox.getMaxX()) {\n if (previousStartColumn === -1) {\n continue;\n }\n startColumn = previousStartColumn;\n }\n let codeword = PDF417ScanningDecoder.detectCodeword(image, boundingBox.getMinX(), boundingBox.getMaxX(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth);\n if (codeword != null) {\n detectionResultColumn.setCodeword(imageRow, codeword);\n previousStartColumn = startColumn;\n minCodewordWidth = Math.min(minCodewordWidth, codeword.getWidth());\n maxCodewordWidth = Math.max(maxCodewordWidth, codeword.getWidth());\n }\n }\n }\n return PDF417ScanningDecoder.createDecoderResult(detectionResult);\n }\n /**\n *\n * @param leftRowIndicatorColumn\n * @param rightRowIndicatorColumn\n *\n * @throws NotFoundException\n */\n static merge(leftRowIndicatorColumn, rightRowIndicatorColumn) {\n if (leftRowIndicatorColumn == null && rightRowIndicatorColumn == null) {\n return null;\n }\n let barcodeMetadata = PDF417ScanningDecoder.getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn);\n if (barcodeMetadata == null) {\n return null;\n }\n let boundingBox = BoundingBox.merge(PDF417ScanningDecoder.adjustBoundingBox(leftRowIndicatorColumn), PDF417ScanningDecoder.adjustBoundingBox(rightRowIndicatorColumn));\n return new DetectionResult(barcodeMetadata, boundingBox);\n }\n /**\n *\n * @param rowIndicatorColumn\n *\n * @throws NotFoundException\n */\n static adjustBoundingBox(rowIndicatorColumn) {\n if (rowIndicatorColumn == null) {\n return null;\n }\n let rowHeights = rowIndicatorColumn.getRowHeights();\n if (rowHeights == null) {\n return null;\n }\n let maxRowHeight = PDF417ScanningDecoder.getMax(rowHeights);\n let missingStartRows = 0;\n for (let rowHeight /*int*/ of rowHeights) {\n missingStartRows += maxRowHeight - rowHeight;\n if (rowHeight > 0) {\n break;\n }\n }\n let codewords = rowIndicatorColumn.getCodewords();\n for (let row /*int*/ = 0; missingStartRows > 0 && codewords[row] == null; row++) {\n missingStartRows--;\n }\n let missingEndRows = 0;\n for (let row /*int*/ = rowHeights.length - 1; row >= 0; row--) {\n missingEndRows += maxRowHeight - rowHeights[row];\n if (rowHeights[row] > 0) {\n break;\n }\n }\n for (let row /*int*/ = codewords.length - 1; missingEndRows > 0 && codewords[row] == null; row--) {\n missingEndRows--;\n }\n return rowIndicatorColumn.getBoundingBox().addMissingRows(missingStartRows, missingEndRows, rowIndicatorColumn.isLeft());\n }\n static getMax(values) {\n let maxValue = -1;\n for (let value /*int*/ of values) {\n maxValue = Math.max(maxValue, value);\n }\n return maxValue;\n }\n static getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn) {\n let leftBarcodeMetadata;\n if (leftRowIndicatorColumn == null ||\n (leftBarcodeMetadata = leftRowIndicatorColumn.getBarcodeMetadata()) == null) {\n return rightRowIndicatorColumn == null ? null : rightRowIndicatorColumn.getBarcodeMetadata();\n }\n let rightBarcodeMetadata;\n if (rightRowIndicatorColumn == null ||\n (rightBarcodeMetadata = rightRowIndicatorColumn.getBarcodeMetadata()) == null) {\n return leftBarcodeMetadata;\n }\n if (leftBarcodeMetadata.getColumnCount() !== rightBarcodeMetadata.getColumnCount() &&\n leftBarcodeMetadata.getErrorCorrectionLevel() !== rightBarcodeMetadata.getErrorCorrectionLevel() &&\n leftBarcodeMetadata.getRowCount() !== rightBarcodeMetadata.getRowCount()) {\n return null;\n }\n return leftBarcodeMetadata;\n }\n static getRowIndicatorColumn(image, boundingBox, startPoint, leftToRight, minCodewordWidth, maxCodewordWidth) {\n let rowIndicatorColumn = new DetectionResultRowIndicatorColumn(boundingBox, leftToRight);\n for (let i /*int*/ = 0; i < 2; i++) {\n let increment = i === 0 ? 1 : -1;\n let startColumn = Math.trunc(Math.trunc(startPoint.getX()));\n for (let imageRow /*int*/ = Math.trunc(Math.trunc(startPoint.getY())); imageRow <= boundingBox.getMaxY() &&\n imageRow >= boundingBox.getMinY(); imageRow += increment) {\n let codeword = PDF417ScanningDecoder.detectCodeword(image, 0, image.getWidth(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth);\n if (codeword != null) {\n rowIndicatorColumn.setCodeword(imageRow, codeword);\n if (leftToRight) {\n startColumn = codeword.getStartX();\n }\n else {\n startColumn = codeword.getEndX();\n }\n }\n }\n }\n return rowIndicatorColumn;\n }\n /**\n *\n * @param detectionResult\n * @param BarcodeValue\n * @param param2\n * @param param3\n * @param barcodeMatrix\n *\n * @throws NotFoundException\n */\n static adjustCodewordCount(detectionResult, barcodeMatrix) {\n let barcodeMatrix01 = barcodeMatrix[0][1];\n let numberOfCodewords = barcodeMatrix01.getValue();\n let calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() *\n detectionResult.getBarcodeRowCount() -\n PDF417ScanningDecoder.getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());\n if (numberOfCodewords.length === 0) {\n if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > PDF417Common.MAX_CODEWORDS_IN_BARCODE) {\n throw NotFoundException.getNotFoundInstance();\n }\n barcodeMatrix01.setValue(calculatedNumberOfCodewords);\n }\n else if (numberOfCodewords[0] !== calculatedNumberOfCodewords) {\n // The calculated one is more reliable as it is derived from the row indicator columns\n barcodeMatrix01.setValue(calculatedNumberOfCodewords);\n }\n }\n /**\n *\n * @param detectionResult\n *\n * @throws FormatException\n * @throws ChecksumException\n * @throws NotFoundException\n */\n static createDecoderResult(detectionResult) {\n let barcodeMatrix = PDF417ScanningDecoder.createBarcodeMatrix(detectionResult);\n PDF417ScanningDecoder.adjustCodewordCount(detectionResult, barcodeMatrix);\n let erasures /*Collection*/ = new Array();\n let codewords = new Int32Array(detectionResult.getBarcodeRowCount() * detectionResult.getBarcodeColumnCount());\n let ambiguousIndexValuesList = /*List*/ [];\n let ambiguousIndexesList = /*Collection*/ new Array();\n for (let row /*int*/ = 0; row < detectionResult.getBarcodeRowCount(); row++) {\n for (let column /*int*/ = 0; column < detectionResult.getBarcodeColumnCount(); column++) {\n let values = barcodeMatrix[row][column + 1].getValue();\n let codewordIndex = row * detectionResult.getBarcodeColumnCount() + column;\n if (values.length === 0) {\n erasures.push(codewordIndex);\n }\n else if (values.length === 1) {\n codewords[codewordIndex] = values[0];\n }\n else {\n ambiguousIndexesList.push(codewordIndex);\n ambiguousIndexValuesList.push(values);\n }\n }\n }\n let ambiguousIndexValues = new Array(ambiguousIndexValuesList.length);\n for (let i /*int*/ = 0; i < ambiguousIndexValues.length; i++) {\n ambiguousIndexValues[i] = ambiguousIndexValuesList[i];\n }\n return PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues(detectionResult.getBarcodeECLevel(), codewords, PDF417Common.toIntArray(erasures), PDF417Common.toIntArray(ambiguousIndexesList), ambiguousIndexValues);\n }\n /**\n * This method deals with the fact, that the decoding process doesn't always yield a single most likely value. The\n * current error correction implementation doesn't deal with erasures very well, so it's better to provide a value\n * for these ambiguous codewords instead of treating it as an erasure. The problem is that we don't know which of\n * the ambiguous values to choose. We try decode using the first value, and if that fails, we use another of the\n * ambiguous values and try to decode again. This usually only happens on very hard to read and decode barcodes,\n * so decoding the normal barcodes is not affected by this.\n *\n * @param erasureArray contains the indexes of erasures\n * @param ambiguousIndexes array with the indexes that have more than one most likely value\n * @param ambiguousIndexValues two dimensional array that contains the ambiguous values. The first dimension must\n * be the same length as the ambiguousIndexes array\n *\n * @throws FormatException\n * @throws ChecksumException\n */\n static createDecoderResultFromAmbiguousValues(ecLevel, codewords, erasureArray, ambiguousIndexes, ambiguousIndexValues) {\n let ambiguousIndexCount = new Int32Array(ambiguousIndexes.length);\n let tries = 100;\n while (tries-- > 0) {\n for (let i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {\n codewords[ambiguousIndexes[i]] = ambiguousIndexValues[i][ambiguousIndexCount[i]];\n }\n try {\n return PDF417ScanningDecoder.decodeCodewords(codewords, ecLevel, erasureArray);\n }\n catch (err) {\n let ignored = err instanceof ChecksumException;\n if (!ignored) {\n throw err;\n }\n }\n if (ambiguousIndexCount.length === 0) {\n throw ChecksumException.getChecksumInstance();\n }\n for (let i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {\n if (ambiguousIndexCount[i] < ambiguousIndexValues[i].length - 1) {\n ambiguousIndexCount[i]++;\n break;\n }\n else {\n ambiguousIndexCount[i] = 0;\n if (i === ambiguousIndexCount.length - 1) {\n throw ChecksumException.getChecksumInstance();\n }\n }\n }\n }\n throw ChecksumException.getChecksumInstance();\n }\n static createBarcodeMatrix(detectionResult) {\n // let barcodeMatrix: BarcodeValue[][] =\n // new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult.getBarcodeColumnCount() + 2];\n let barcodeMatrix = Array.from({ length: detectionResult.getBarcodeRowCount() }, () => new Array(detectionResult.getBarcodeColumnCount() + 2));\n for (let row /*int*/ = 0; row < barcodeMatrix.length; row++) {\n for (let column /*int*/ = 0; column < barcodeMatrix[row].length; column++) {\n barcodeMatrix[row][column] = new BarcodeValue();\n }\n }\n let column = 0;\n for (let detectionResultColumn /*DetectionResultColumn*/ of detectionResult.getDetectionResultColumns()) {\n if (detectionResultColumn != null) {\n for (let codeword /*Codeword*/ of detectionResultColumn.getCodewords()) {\n if (codeword != null) {\n let rowNumber = codeword.getRowNumber();\n if (rowNumber >= 0) {\n if (rowNumber >= barcodeMatrix.length) {\n // We have more rows than the barcode metadata allows for, ignore them.\n continue;\n }\n barcodeMatrix[rowNumber][column].setValue(codeword.getValue());\n }\n }\n }\n }\n column++;\n }\n return barcodeMatrix;\n }\n static isValidBarcodeColumn(detectionResult, barcodeColumn) {\n return barcodeColumn >= 0 && barcodeColumn <= detectionResult.getBarcodeColumnCount() + 1;\n }\n static getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight) {\n let offset = leftToRight ? 1 : -1;\n let codeword = null;\n if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {\n codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodeword(imageRow);\n }\n if (codeword != null) {\n return leftToRight ? codeword.getEndX() : codeword.getStartX();\n }\n codeword = detectionResult.getDetectionResultColumn(barcodeColumn).getCodewordNearby(imageRow);\n if (codeword != null) {\n return leftToRight ? codeword.getStartX() : codeword.getEndX();\n }\n if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {\n codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodewordNearby(imageRow);\n }\n if (codeword != null) {\n return leftToRight ? codeword.getEndX() : codeword.getStartX();\n }\n let skippedColumns = 0;\n while (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {\n barcodeColumn -= offset;\n for (let previousRowCodeword /*Codeword*/ of detectionResult.getDetectionResultColumn(barcodeColumn).getCodewords()) {\n if (previousRowCodeword != null) {\n return (leftToRight ? previousRowCodeword.getEndX() : previousRowCodeword.getStartX()) +\n offset *\n skippedColumns *\n (previousRowCodeword.getEndX() - previousRowCodeword.getStartX());\n }\n }\n skippedColumns++;\n }\n return leftToRight ? detectionResult.getBoundingBox().getMinX() : detectionResult.getBoundingBox().getMaxX();\n }\n static detectCodeword(image, minColumn, maxColumn, leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth) {\n startColumn = PDF417ScanningDecoder.adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);\n // we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length\n // and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.\n // min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate\n // for the current position\n let moduleBitCount = PDF417ScanningDecoder.getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);\n if (moduleBitCount == null) {\n return null;\n }\n let endColumn;\n let codewordBitCount = MathUtils.sum(moduleBitCount);\n if (leftToRight) {\n endColumn = startColumn + codewordBitCount;\n }\n else {\n for (let i /*int*/ = 0; i < moduleBitCount.length / 2; i++) {\n let tmpCount = moduleBitCount[i];\n moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];\n moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;\n }\n endColumn = startColumn;\n startColumn = endColumn - codewordBitCount;\n }\n // TODO implement check for width and correction of black and white bars\n // use start (and maybe stop pattern) to determine if black bars are wider than white bars. If so, adjust.\n // should probably done only for codewords with a lot more than 17 bits.\n // The following fixes 10-1.png, which has wide black bars and small white bars\n // for (let i /*int*/ = 0; i < moduleBitCount.length; i++) {\n // if (i % 2 === 0) {\n // moduleBitCount[i]--;\n // } else {\n // moduleBitCount[i]++;\n // }\n // }\n // We could also use the width of surrounding codewords for more accurate results, but this seems\n // sufficient for now\n if (!PDF417ScanningDecoder.checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {\n // We could try to use the startX and endX position of the codeword in the same column in the previous row,\n // create the bit count from it and normalize it to 8. This would help with single pixel errors.\n return null;\n }\n let decodedValue = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);\n let codeword = PDF417Common.getCodeword(decodedValue);\n if (codeword === -1) {\n return null;\n }\n return new Codeword(startColumn, endColumn, PDF417ScanningDecoder.getCodewordBucketNumber(decodedValue), codeword);\n }\n static getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow) {\n let imageColumn = startColumn;\n let moduleBitCount = new Int32Array(8);\n let moduleNumber = 0;\n let increment = leftToRight ? 1 : -1;\n let previousPixelValue = leftToRight;\n while ((leftToRight ? imageColumn < maxColumn : imageColumn >= minColumn) &&\n moduleNumber < moduleBitCount.length) {\n if (image.get(imageColumn, imageRow) === previousPixelValue) {\n moduleBitCount[moduleNumber]++;\n imageColumn += increment;\n }\n else {\n moduleNumber++;\n previousPixelValue = !previousPixelValue;\n }\n }\n if (moduleNumber === moduleBitCount.length ||\n ((imageColumn === (leftToRight ? maxColumn : minColumn)) &&\n moduleNumber === moduleBitCount.length - 1)) {\n return moduleBitCount;\n }\n return null;\n }\n static getNumberOfECCodeWords(barcodeECLevel) {\n return 2 << barcodeECLevel;\n }\n static adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, codewordStartColumn, imageRow) {\n let correctedStartColumn = codewordStartColumn;\n let increment = leftToRight ? -1 : 1;\n // there should be no black pixels before the start column. If there are, then we need to start earlier.\n for (let i /*int*/ = 0; i < 2; i++) {\n while ((leftToRight ? correctedStartColumn >= minColumn : correctedStartColumn < maxColumn) &&\n leftToRight === image.get(correctedStartColumn, imageRow)) {\n if (Math.abs(codewordStartColumn - correctedStartColumn) > PDF417ScanningDecoder.CODEWORD_SKEW_SIZE) {\n return codewordStartColumn;\n }\n correctedStartColumn += increment;\n }\n increment = -increment;\n leftToRight = !leftToRight;\n }\n return correctedStartColumn;\n }\n static checkCodewordSkew(codewordSize, minCodewordWidth, maxCodewordWidth) {\n return minCodewordWidth - PDF417ScanningDecoder.CODEWORD_SKEW_SIZE <= codewordSize &&\n codewordSize <= maxCodewordWidth + PDF417ScanningDecoder.CODEWORD_SKEW_SIZE;\n }\n /**\n * @throws FormatException,\n * @throws ChecksumException\n */\n static decodeCodewords(codewords, ecLevel, erasures) {\n if (codewords.length === 0) {\n throw FormatException.getFormatInstance();\n }\n let numECCodewords = 1 << (ecLevel + 1);\n let correctedErrorsCount = PDF417ScanningDecoder.correctErrors(codewords, erasures, numECCodewords);\n PDF417ScanningDecoder.verifyCodewordCount(codewords, numECCodewords);\n // Decode the codewords\n let decoderResult = DecodedBitStreamParser$2.decode(codewords, '' + ecLevel);\n decoderResult.setErrorsCorrected(correctedErrorsCount);\n decoderResult.setErasures(erasures.length);\n return decoderResult;\n }\n /**\n * Given data and error-correction codewords received, possibly corrupted by errors, attempts to\n * correct the errors in-place.
\n *\n * @param codewords data and error correction codewords\n * @param erasures positions of any known erasures\n * @param numECCodewords number of error correction codewords that are available in codewords\n * @throws ChecksumException if error correction fails\n */\n static correctErrors(codewords, erasures, numECCodewords) {\n if (erasures != null &&\n erasures.length > numECCodewords / 2 + PDF417ScanningDecoder.MAX_ERRORS ||\n numECCodewords < 0 ||\n numECCodewords > PDF417ScanningDecoder.MAX_EC_CODEWORDS) {\n // Too many errors or EC Codewords is corrupted\n throw ChecksumException.getChecksumInstance();\n }\n return PDF417ScanningDecoder.errorCorrection.decode(codewords, numECCodewords, erasures);\n }\n /**\n * Verify that all is OK with the codeword array.\n * @throws FormatException\n */\n static verifyCodewordCount(codewords, numECCodewords) {\n if (codewords.length < 4) {\n // Codeword array size should be at least 4 allowing for\n // Count CW, At least one Data CW, Error Correction CW, Error Correction CW\n throw FormatException.getFormatInstance();\n }\n // The first codeword, the Symbol Length Descriptor, shall always encode the total number of data\n // codewords in the symbol, including the Symbol Length Descriptor itself, data codewords and pad\n // codewords, but excluding the number of error correction codewords.\n let numberOfCodewords = codewords[0];\n if (numberOfCodewords > codewords.length) {\n throw FormatException.getFormatInstance();\n }\n if (numberOfCodewords === 0) {\n // Reset to the length of the array - 8 (Allow for at least level 3 Error Correction (8 Error Codewords)\n if (numECCodewords < codewords.length) {\n codewords[0] = codewords.length - numECCodewords;\n }\n else {\n throw FormatException.getFormatInstance();\n }\n }\n }\n static getBitCountForCodeword(codeword) {\n let result = new Int32Array(8);\n let previousValue = 0;\n let i = result.length - 1;\n while (true) {\n if ((codeword & 0x1) !== previousValue) {\n previousValue = codeword & 0x1;\n i--;\n if (i < 0) {\n break;\n }\n }\n result[i]++;\n codeword >>= 1;\n }\n return result;\n }\n static getCodewordBucketNumber(codeword) {\n if (codeword instanceof Int32Array) {\n return this.getCodewordBucketNumber_Int32Array(codeword);\n }\n return this.getCodewordBucketNumber_number(codeword);\n }\n static getCodewordBucketNumber_number(codeword) {\n return PDF417ScanningDecoder.getCodewordBucketNumber(PDF417ScanningDecoder.getBitCountForCodeword(codeword));\n }\n static getCodewordBucketNumber_Int32Array(moduleBitCount) {\n return (moduleBitCount[0] - moduleBitCount[2] + moduleBitCount[4] - moduleBitCount[6] + 9) % 9;\n }\n static toString(barcodeMatrix) {\n let formatter = new Formatter();\n // try (let formatter = new Formatter()) {\n for (let row /*int*/ = 0; row < barcodeMatrix.length; row++) {\n formatter.format('Row %2d: ', row);\n for (let column /*int*/ = 0; column < barcodeMatrix[row].length; column++) {\n let barcodeValue = barcodeMatrix[row][column];\n if (barcodeValue.getValue().length === 0) {\n formatter.format(' ', null);\n }\n else {\n formatter.format('%4d(%2d)', barcodeValue.getValue()[0], barcodeValue.getConfidence(barcodeValue.getValue()[0]));\n }\n }\n formatter.format('%n');\n }\n return formatter.toString();\n // }\n }\n }\n /*final*/ PDF417ScanningDecoder.CODEWORD_SKEW_SIZE = 2;\n /*final*/ PDF417ScanningDecoder.MAX_ERRORS = 3;\n /*final*/ PDF417ScanningDecoder.MAX_EC_CODEWORDS = 512;\n /*final*/ PDF417ScanningDecoder.errorCorrection = new ErrorCorrection();\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // import java.util.ArrayList;\n // import java.util.List;\n // import java.util.Map;\n /**\n * This implementation can detect and decode PDF417 codes in an image.\n *\n * @author Guenther Grau\n */\n /*public final*/ class PDF417Reader {\n // private static /*final Result[]*/ EMPTY_RESULT_ARRAY: Result[] = new Result([0]);\n /**\n * Locates and decodes a PDF417 code in an image.\n *\n * @return a String representing the content encoded by the PDF417 code\n * @throws NotFoundException if a PDF417 code cannot be found,\n * @throws FormatException if a PDF417 cannot be decoded\n * @throws ChecksumException\n */\n // @Override\n decode(image, hints = null) {\n let result = PDF417Reader.decode(image, hints, false);\n if (result == null || result.length === 0 || result[0] == null) {\n throw NotFoundException.getNotFoundInstance();\n }\n return result[0];\n }\n /**\n *\n * @param BinaryBitmap\n * @param image\n * @throws NotFoundException\n */\n // @Override\n decodeMultiple(image, hints = null) {\n try {\n return PDF417Reader.decode(image, hints, true);\n }\n catch (ignored) {\n if (ignored instanceof FormatException || ignored instanceof ChecksumException) {\n throw NotFoundException.getNotFoundInstance();\n }\n throw ignored;\n }\n }\n /**\n *\n * @param image\n * @param hints\n * @param multiple\n *\n * @throws NotFoundException\n * @throws FormatExceptionß\n * @throws ChecksumException\n */\n static decode(image, hints, multiple) {\n const results = new Array();\n const detectorResult = Detector$3.detectMultiple(image, hints, multiple);\n for (const points of detectorResult.getPoints()) {\n const decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5], points[6], points[7], PDF417Reader.getMinCodewordWidth(points), PDF417Reader.getMaxCodewordWidth(points));\n const result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, BarcodeFormat$1.PDF_417);\n result.putMetadata(ResultMetadataType$1.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());\n const pdf417ResultMetadata = decoderResult.getOther();\n if (pdf417ResultMetadata != null) {\n result.putMetadata(ResultMetadataType$1.PDF417_EXTRA_METADATA, pdf417ResultMetadata);\n }\n results.push(result);\n }\n return results.map(x => x);\n }\n static getMaxWidth(p1, p2) {\n if (p1 == null || p2 == null) {\n return 0;\n }\n return Math.trunc(Math.abs(p1.getX() - p2.getX()));\n }\n static getMinWidth(p1, p2) {\n if (p1 == null || p2 == null) {\n return Integer.MAX_VALUE;\n }\n return Math.trunc(Math.abs(p1.getX() - p2.getX()));\n }\n static getMaxCodewordWidth(p) {\n return Math.floor(Math.max(Math.max(PDF417Reader.getMaxWidth(p[0], p[4]), PDF417Reader.getMaxWidth(p[6], p[2]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN), Math.max(PDF417Reader.getMaxWidth(p[1], p[5]), PDF417Reader.getMaxWidth(p[7], p[3]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN)));\n }\n static getMinCodewordWidth(p) {\n return Math.floor(Math.min(Math.min(PDF417Reader.getMinWidth(p[0], p[4]), PDF417Reader.getMinWidth(p[6], p[2]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN), Math.min(PDF417Reader.getMinWidth(p[1], p[5]), PDF417Reader.getMinWidth(p[7], p[3]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN)));\n }\n // @Override\n reset() {\n // nothing needs to be reset\n }\n }\n\n /**\n * Custom Error class of type Exception.\n */\n class ReaderException extends Exception {\n }\n ReaderException.kind = 'ReaderException';\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /*namespace com.google.zxing {*/\n /**\n * MultiFormatReader is a convenience class and the main entry point into the library for most uses.\n * By default it attempts to decode all barcode formats that the library supports. Optionally, you\n * can provide a hints object to request different behavior, for example only decoding QR codes.\n *\n * @author Sean Owen\n * @author dswitkin@google.com (Daniel Switkin)\n */\n class MultiFormatReader {\n /**\n * Creates an instance of this class\n * \n * @param {Boolean} verbose if 'true' logs will be dumped to console, otherwise hidden.\n * @param hints The hints to use, clearing the previous state.\n */\n constructor(verbose, hints) {\n this.verbose = (verbose === true);\n if (hints) {\n this.setHints(hints);\n }\n }\n /**\n * This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it\n * passes null as a hint to the decoders. However, that makes it inefficient to call repeatedly.\n * Use setHints() followed by decodeWithState() for continuous scan applications.\n *\n * @param image The pixel data to decode\n * @return The contents of the image\n *\n * @throws NotFoundException Any errors which occurred\n */\n /*@Override*/\n // public decode(image: BinaryBitmap): Result {\n // setHints(null)\n // return decodeInternal(image)\n // }\n /**\n * Decode an image using the hints provided. Does not honor existing state.\n *\n * @param image The pixel data to decode\n * @param hints The hints to use, clearing the previous state.\n * @return The contents of the image\n *\n * @throws NotFoundException Any errors which occurred\n */\n /*@Override*/\n decode(image, hints) {\n if (hints) {\n this.setHints(hints);\n }\n return this.decodeInternal(image);\n }\n /**\n * Decode an image using the state set up by calling setHints() previously. Continuous scan\n * clients will get a large speed increase by using this instead of decode().\n *\n * @param image The pixel data to decode\n * @return The contents of the image\n *\n * @throws NotFoundException Any errors which occurred\n */\n decodeWithState(image) {\n // Make sure to set up the default state so we don't crash\n if (this.readers === null || this.readers === undefined) {\n this.setHints(null);\n }\n return this.decodeInternal(image);\n }\n /**\n * This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls\n * to decodeWithState(image) can reuse the same set of readers without reallocating memory. This\n * is important for performance in continuous scan clients.\n *\n * @param hints The set of hints to use for subsequent calls to decode(image)\n */\n setHints(hints) {\n this.hints = hints;\n const tryHarder = !isNullOrUndefined(hints)\n && hints.get(DecodeHintType$1.TRY_HARDER) === true;\n const formats = isNullOrUndefined(hints) ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);\n const readers = new Array();\n if (!isNullOrUndefined(formats)) {\n const addOneDReader = formats.some(f => {\n return (\n f === BarcodeFormat$1.UPC_A ||\n f === BarcodeFormat$1.UPC_E ||\n f === BarcodeFormat$1.EAN_13 ||\n f === BarcodeFormat$1.EAN_8 ||\n f === BarcodeFormat$1.CODABAR ||\n f === BarcodeFormat$1.CODE_39 ||\n f === BarcodeFormat$1.CODE_93 ||\n f === BarcodeFormat$1.CODE_128 ||\n f === BarcodeFormat$1.ITF ||\n f === BarcodeFormat$1.RSS_14 ||\n f === BarcodeFormat$1.RSS_EXPANDED);\n });\n // Put 1D readers upfront in \"normal\" mode\n if (addOneDReader && !tryHarder) {\n readers.push(new MultiFormatOneDReader(hints, this.verbose));\n }\n if (formats.includes(BarcodeFormat$1.QR_CODE)) {\n readers.push(new QRCodeReader());\n }\n if (formats.includes(BarcodeFormat$1.DATA_MATRIX)) {\n readers.push(new DataMatrixReader());\n }\n if (formats.includes(BarcodeFormat$1.AZTEC)) {\n readers.push(new AztecReader());\n }\n if (formats.includes(BarcodeFormat$1.PDF_417)) {\n readers.push(new PDF417Reader());\n }\n // if (formats.includes(BarcodeFormat.MAXICODE)) {\n // readers.push(new MaxiCodeReader())\n // }\n // At end in \"try harder\" mode\n if (addOneDReader && tryHarder) {\n readers.push(new MultiFormatOneDReader(hints, this.verbose));\n }\n }\n if (readers.length === 0) {\n if (!tryHarder) {\n readers.push(new MultiFormatOneDReader(hints, this.verbose));\n }\n readers.push(new QRCodeReader());\n readers.push(new DataMatrixReader());\n readers.push(new AztecReader());\n readers.push(new PDF417Reader());\n // readers.push(new MaxiCodeReader())\n if (tryHarder) {\n readers.push(new MultiFormatOneDReader(hints, this.verbose));\n }\n }\n this.readers = readers; // .toArray(new Reader[readers.size()])\n }\n /*@Override*/\n reset() {\n if (this.readers !== null) {\n for (const reader of this.readers) {\n reader.reset();\n }\n }\n }\n /**\n * @throws NotFoundException\n */\n decodeInternal(image) {\n if (this.readers === null) {\n throw new ReaderException('No readers where selected, nothing can be read.');\n }\n for (const reader of this.readers) {\n // Trying to decode with ${reader} reader.\n try {\n return reader.decode(image, this.hints);\n }\n catch (ex) {\n if (ex instanceof ReaderException) {\n continue;\n }\n // Bad Exception.\n }\n }\n throw new NotFoundException('No MultiFormat Readers were able to detect the code.');\n }\n }\n\n class BrowserMultiFormatReader extends BrowserCodeReader {\n constructor(hints = null, timeBetweenScansMillis = 500) {\n const reader = new MultiFormatReader();\n reader.setHints(hints);\n super(reader, timeBetweenScansMillis);\n }\n /**\n * Overwrite decodeBitmap to call decodeWithState, which will pay\n * attention to the hints set in the constructor function\n */\n decodeBitmap(binaryBitmap) {\n return this.reader.decodeWithState(binaryBitmap);\n }\n }\n\n /**\n * @deprecated Moving to @zxing/browser\n *\n * QR Code reader to use from browser.\n */\n class BrowserPDF417Reader extends BrowserCodeReader {\n /**\n * Creates an instance of BrowserPDF417Reader.\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries\n */\n constructor(timeBetweenScansMillis = 500) {\n super(new PDF417Reader(), timeBetweenScansMillis);\n }\n }\n\n /**\n * @deprecated Moving to @zxing/browser\n *\n * QR Code reader to use from browser.\n */\n class BrowserQRCodeReader extends BrowserCodeReader {\n /**\n * Creates an instance of BrowserQRCodeReader.\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries\n */\n constructor(timeBetweenScansMillis = 500) {\n super(new QRCodeReader(), timeBetweenScansMillis);\n }\n }\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /*namespace com.google.zxing {*/\n /**\n * These are a set of hints that you may pass to Writers to specify their behavior.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\n var EncodeHintType;\n (function (EncodeHintType) {\n /**\n * Specifies what degree of error correction to use, for example in QR Codes.\n * Type depends on the encoder. For example for QR codes it's type\n * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.\n * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.\n * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.\n * In all cases, it can also be a {@link String} representation of the desired value as well.\n * Note: an Aztec symbol should have a minimum of 25% EC words.\n */\n EncodeHintType[EncodeHintType[\"ERROR_CORRECTION\"] = 0] = \"ERROR_CORRECTION\";\n /**\n * Specifies what character encoding to use where applicable (type {@link String})\n */\n EncodeHintType[EncodeHintType[\"CHARACTER_SET\"] = 1] = \"CHARACTER_SET\";\n /**\n * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})\n */\n EncodeHintType[EncodeHintType[\"DATA_MATRIX_SHAPE\"] = 2] = \"DATA_MATRIX_SHAPE\";\n /**\n * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.\n *\n * @deprecated use width/height params in\n * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}\n */\n /*@Deprecated*/\n EncodeHintType[EncodeHintType[\"MIN_SIZE\"] = 3] = \"MIN_SIZE\";\n /**\n * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.\n *\n * @deprecated without replacement\n */\n /*@Deprecated*/\n EncodeHintType[EncodeHintType[\"MAX_SIZE\"] = 4] = \"MAX_SIZE\";\n /**\n * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary\n * by format; for example it controls margin before and after the barcode horizontally for\n * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).\n */\n EncodeHintType[EncodeHintType[\"MARGIN\"] = 5] = \"MARGIN\";\n /**\n * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or \"true\" or \"false\"\n * {@link String} value).\n */\n EncodeHintType[EncodeHintType[\"PDF417_COMPACT\"] = 6] = \"PDF417_COMPACT\";\n /**\n * Specifies what compaction mode to use for PDF417 (type\n * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its\n * enum values).\n */\n EncodeHintType[EncodeHintType[\"PDF417_COMPACTION\"] = 7] = \"PDF417_COMPACTION\";\n /**\n * Specifies the minimum and maximum number of rows and columns for PDF417 (type\n * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).\n */\n EncodeHintType[EncodeHintType[\"PDF417_DIMENSIONS\"] = 8] = \"PDF417_DIMENSIONS\";\n /**\n * Specifies the required number of layers for an Aztec code.\n * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.\n * 0 indicates to use the minimum number of layers (the default).\n * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.\n * (Type {@link Integer}, or {@link String} representation of the integer value).\n */\n EncodeHintType[EncodeHintType[\"AZTEC_LAYERS\"] = 9] = \"AZTEC_LAYERS\";\n /**\n * Specifies the exact version of QR code to be encoded.\n * (Type {@link Integer}, or {@link String} representation of the integer value).\n */\n EncodeHintType[EncodeHintType[\"QR_VERSION\"] = 10] = \"QR_VERSION\";\n })(EncodeHintType || (EncodeHintType = {}));\n var EncodeHintType$1 = EncodeHintType;\n\n /**\n * Implements Reed-Solomon encoding, as the name implies.
\n *\n * @author Sean Owen\n * @author William Rucklidge\n */\n class ReedSolomonEncoder {\n /**\n * A reed solomon error-correcting encoding constructor is created by\n * passing as Galois Field with of size equal to the number of code\n * words (symbols) in the alphabet (the number of values in each\n * element of arrays that are encoded/decoded).\n * @param field A galois field with a number of elements equal to the size\n * of the alphabet of symbols to encode.\n */\n constructor(field) {\n this.field = field;\n this.cachedGenerators = [];\n this.cachedGenerators.push(new GenericGFPoly(field, Int32Array.from([1])));\n }\n buildGenerator(degree /*int*/) {\n const cachedGenerators = this.cachedGenerators;\n if (degree >= cachedGenerators.length) {\n let lastGenerator = cachedGenerators[cachedGenerators.length - 1];\n const field = this.field;\n for (let d = cachedGenerators.length; d <= degree; d++) {\n const nextGenerator = lastGenerator.multiply(new GenericGFPoly(field, Int32Array.from([1, field.exp(d - 1 + field.getGeneratorBase())])));\n cachedGenerators.push(nextGenerator);\n lastGenerator = nextGenerator;\n }\n }\n return cachedGenerators[degree];\n }\n /**\n * Encode a sequence of code words (symbols) using Reed-Solomon to allow decoders\n * to detect and correct errors that may have been introduced when the resulting\n * data is stored or transmitted.
\n *\n * @param toEncode array used for both and output. Caller initializes the array with\n * the code words (symbols) to be encoded followed by empty elements allocated to make\n * space for error-correction code words in the encoded output. The array contains\n * the encdoded output when encode returns. Code words are encoded as numbers from\n * 0 to n-1, where n is the number of possible code words (symbols), as determined\n * by the size of the Galois Field passed in the constructor of this object.\n * @param ecBytes the number of elements reserved in the array (first parameter)\n * to store error-correction code words. Thus, the number of code words (symbols)\n * to encode in the first parameter is thus toEncode.length - ecBytes.\n * Note, the use of \"bytes\" in the name of this parameter is misleading, as there may\n * be more or fewer than 256 symbols being encoded, as determined by the number of\n * elements in the Galois Field passed as a constructor to this object.\n * @throws IllegalArgumentException thrown in response to validation errros.\n */\n encode(toEncode, ecBytes /*int*/) {\n if (ecBytes === 0) {\n throw new IllegalArgumentException('No error correction bytes');\n }\n const dataBytes = toEncode.length - ecBytes;\n if (dataBytes <= 0) {\n throw new IllegalArgumentException('No data bytes provided');\n }\n const generator = this.buildGenerator(ecBytes);\n const infoCoefficients = new Int32Array(dataBytes);\n System.arraycopy(toEncode, 0, infoCoefficients, 0, dataBytes);\n let info = new GenericGFPoly(this.field, infoCoefficients);\n info = info.multiplyByMonomial(ecBytes, 1);\n const remainder = info.divide(generator)[1];\n const coefficients = remainder.getCoefficients();\n const numZeroCoefficients = ecBytes - coefficients.length;\n for (let i = 0; i < numZeroCoefficients; i++) {\n toEncode[dataBytes + i] = 0;\n }\n System.arraycopy(coefficients, 0, toEncode, dataBytes + numZeroCoefficients, coefficients.length);\n }\n }\n\n /**\n * @author Satoru Takabayashi\n * @author Daniel Switkin\n * @author Sean Owen\n */\n class MaskUtil {\n constructor() {\n // do nothing\n }\n /**\n * Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and\n * give penalty to them. Example: 00000 or 11111.\n */\n static applyMaskPenaltyRule1(matrix) {\n return MaskUtil.applyMaskPenaltyRule1Internal(matrix, true) + MaskUtil.applyMaskPenaltyRule1Internal(matrix, false);\n }\n /**\n * Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give\n * penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a\n * penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.\n */\n static applyMaskPenaltyRule2(matrix) {\n let penalty = 0;\n const array = matrix.getArray();\n const width = matrix.getWidth();\n const height = matrix.getHeight();\n for (let y = 0; y < height - 1; y++) {\n const arrayY = array[y];\n for (let x = 0; x < width - 1; x++) {\n const value = arrayY[x];\n if (value === arrayY[x + 1] && value === array[y + 1][x] && value === array[y + 1][x + 1]) {\n penalty++;\n }\n }\n }\n return MaskUtil.N2 * penalty;\n }\n /**\n * Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4\n * starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we\n * find patterns like 000010111010000, we give penalty once.\n */\n static applyMaskPenaltyRule3(matrix) {\n let numPenalties = 0;\n const array = matrix.getArray();\n const width = matrix.getWidth();\n const height = matrix.getHeight();\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const arrayY = array[y]; // We can at least optimize this access\n if (x + 6 < width &&\n arrayY[x] === 1 &&\n arrayY[x + 1] === 0 &&\n arrayY[x + 2] === 1 &&\n arrayY[x + 3] === 1 &&\n arrayY[x + 4] === 1 &&\n arrayY[x + 5] === 0 &&\n arrayY[x + 6] === 1 &&\n (MaskUtil.isWhiteHorizontal(arrayY, x - 4, x) || MaskUtil.isWhiteHorizontal(arrayY, x + 7, x + 11))) {\n numPenalties++;\n }\n if (y + 6 < height &&\n array[y][x] === 1 &&\n array[y + 1][x] === 0 &&\n array[y + 2][x] === 1 &&\n array[y + 3][x] === 1 &&\n array[y + 4][x] === 1 &&\n array[y + 5][x] === 0 &&\n array[y + 6][x] === 1 &&\n (MaskUtil.isWhiteVertical(array, x, y - 4, y) || MaskUtil.isWhiteVertical(array, x, y + 7, y + 11))) {\n numPenalties++;\n }\n }\n }\n return numPenalties * MaskUtil.N3;\n }\n static isWhiteHorizontal(rowArray, from /*int*/, to /*int*/) {\n from = Math.max(from, 0);\n to = Math.min(to, rowArray.length);\n for (let i = from; i < to; i++) {\n if (rowArray[i] === 1) {\n return false;\n }\n }\n return true;\n }\n static isWhiteVertical(array, col /*int*/, from /*int*/, to /*int*/) {\n from = Math.max(from, 0);\n to = Math.min(to, array.length);\n for (let i = from; i < to; i++) {\n if (array[i][col] === 1) {\n return false;\n }\n }\n return true;\n }\n /**\n * Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give\n * penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.\n */\n static applyMaskPenaltyRule4(matrix) {\n let numDarkCells = 0;\n const array = matrix.getArray();\n const width = matrix.getWidth();\n const height = matrix.getHeight();\n for (let y = 0; y < height; y++) {\n const arrayY = array[y];\n for (let x = 0; x < width; x++) {\n if (arrayY[x] === 1) {\n numDarkCells++;\n }\n }\n }\n const numTotalCells = matrix.getHeight() * matrix.getWidth();\n const fivePercentVariances = Math.floor(Math.abs(numDarkCells * 2 - numTotalCells) * 10 / numTotalCells);\n return fivePercentVariances * MaskUtil.N4;\n }\n /**\n * Return the mask bit for \"getMaskPattern\" at \"x\" and \"y\". See 8.8 of JISX0510:2004 for mask\n * pattern conditions.\n */\n static getDataMaskBit(maskPattern /*int*/, x /*int*/, y /*int*/) {\n let intermediate; /*int*/\n let temp; /*int*/\n switch (maskPattern) {\n case 0:\n intermediate = (y + x) & 0x1;\n break;\n case 1:\n intermediate = y & 0x1;\n break;\n case 2:\n intermediate = x % 3;\n break;\n case 3:\n intermediate = (y + x) % 3;\n break;\n case 4:\n intermediate = (Math.floor(y / 2) + Math.floor(x / 3)) & 0x1;\n break;\n case 5:\n temp = y * x;\n intermediate = (temp & 0x1) + (temp % 3);\n break;\n case 6:\n temp = y * x;\n intermediate = ((temp & 0x1) + (temp % 3)) & 0x1;\n break;\n case 7:\n temp = y * x;\n intermediate = ((temp % 3) + ((y + x) & 0x1)) & 0x1;\n break;\n default:\n throw new IllegalArgumentException('Invalid mask pattern: ' + maskPattern);\n }\n return intermediate === 0;\n }\n /**\n * Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both\n * vertical and horizontal orders respectively.\n */\n static applyMaskPenaltyRule1Internal(matrix, isHorizontal) {\n let penalty = 0;\n const iLimit = isHorizontal ? matrix.getHeight() : matrix.getWidth();\n const jLimit = isHorizontal ? matrix.getWidth() : matrix.getHeight();\n const array = matrix.getArray();\n for (let i = 0; i < iLimit; i++) {\n let numSameBitCells = 0;\n let prevBit = -1;\n for (let j = 0; j < jLimit; j++) {\n const bit = isHorizontal ? array[i][j] : array[j][i];\n if (bit === prevBit) {\n numSameBitCells++;\n }\n else {\n if (numSameBitCells >= 5) {\n penalty += MaskUtil.N1 + (numSameBitCells - 5);\n }\n numSameBitCells = 1; // Include the cell itself.\n prevBit = bit;\n }\n }\n if (numSameBitCells >= 5) {\n penalty += MaskUtil.N1 + (numSameBitCells - 5);\n }\n }\n return penalty;\n }\n }\n // Penalty weights from section 6.8.2.1\n MaskUtil.N1 = 3;\n MaskUtil.N2 = 3;\n MaskUtil.N3 = 40;\n MaskUtil.N4 = 10;\n\n /**\n * JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned\n * -1, 0, and 1, I'm going to use less memory and go with bytes.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\n class ByteMatrix {\n constructor(width /*int*/, height /*int*/) {\n this.width = width;\n this.height = height;\n const bytes = new Array(height); // [height][width]\n for (let i = 0; i !== height; i++) {\n bytes[i] = new Uint8Array(width);\n }\n this.bytes = bytes;\n }\n getHeight() {\n return this.height;\n }\n getWidth() {\n return this.width;\n }\n get(x /*int*/, y /*int*/) {\n return this.bytes[y][x];\n }\n /**\n * @return an internal representation as bytes, in row-major order. array[y][x] represents point (x,y)\n */\n getArray() {\n return this.bytes;\n }\n // TYPESCRIPTPORT: preffer to let two methods instead of override to avoid type comparison inside\n setNumber(x /*int*/, y /*int*/, value /*byte|int*/) {\n this.bytes[y][x] = value;\n }\n // public set(x: number /*int*/, y: number /*int*/, value: number /*int*/): void {\n // bytes[y][x] = (byte) value\n // }\n setBoolean(x /*int*/, y /*int*/, value) {\n this.bytes[y][x] = /*(byte) */ (value ? 1 : 0);\n }\n clear(value /*byte*/) {\n for (const aByte of this.bytes) {\n Arrays.fill(aByte, value);\n }\n }\n equals(o) {\n if (!(o instanceof ByteMatrix)) {\n return false;\n }\n const other = o;\n if (this.width !== other.width) {\n return false;\n }\n if (this.height !== other.height) {\n return false;\n }\n for (let y = 0, height = this.height; y < height; ++y) {\n const bytesY = this.bytes[y];\n const otherBytesY = other.bytes[y];\n for (let x = 0, width = this.width; x < width; ++x) {\n if (bytesY[x] !== otherBytesY[x]) {\n return false;\n }\n }\n }\n return true;\n }\n /*@Override*/\n toString() {\n const result = new StringBuilder(); // (2 * width * height + 2)\n for (let y = 0, height = this.height; y < height; ++y) {\n const bytesY = this.bytes[y];\n for (let x = 0, width = this.width; x < width; ++x) {\n switch (bytesY[x]) {\n case 0:\n result.append(' 0');\n break;\n case 1:\n result.append(' 1');\n break;\n default:\n result.append(' ');\n break;\n }\n }\n result.append('\\n');\n }\n return result.toString();\n }\n }\n\n /**\n * @author satorux@google.com (Satoru Takabayashi) - creator\n * @author dswitkin@google.com (Daniel Switkin) - ported from C++\n */\n class QRCode {\n constructor() {\n this.maskPattern = -1;\n }\n getMode() {\n return this.mode;\n }\n getECLevel() {\n return this.ecLevel;\n }\n getVersion() {\n return this.version;\n }\n getMaskPattern() {\n return this.maskPattern;\n }\n getMatrix() {\n return this.matrix;\n }\n /*@Override*/\n toString() {\n const result = new StringBuilder(); // (200)\n result.append('<<\\n');\n result.append(' mode: ');\n result.append(this.mode ? this.mode.toString() : 'null');\n result.append('\\n ecLevel: ');\n result.append(this.ecLevel ? this.ecLevel.toString() : 'null');\n result.append('\\n version: ');\n result.append(this.version ? this.version.toString() : 'null');\n result.append('\\n maskPattern: ');\n result.append(this.maskPattern.toString());\n if (this.matrix) {\n result.append('\\n matrix:\\n');\n result.append(this.matrix.toString());\n }\n else {\n result.append('\\n matrix: null\\n');\n }\n result.append('>>\\n');\n return result.toString();\n }\n setMode(value) {\n this.mode = value;\n }\n setECLevel(value) {\n this.ecLevel = value;\n }\n setVersion(version) {\n this.version = version;\n }\n setMaskPattern(value /*int*/) {\n this.maskPattern = value;\n }\n setMatrix(value) {\n this.matrix = value;\n }\n // Check if \"mask_pattern\" is valid.\n static isValidMaskPattern(maskPattern /*int*/) {\n return maskPattern >= 0 && maskPattern < QRCode.NUM_MASK_PATTERNS;\n }\n }\n QRCode.NUM_MASK_PATTERNS = 8;\n\n /**\n * Custom Error class of type Exception.\n */\n class WriterException extends Exception {\n }\n WriterException.kind = 'WriterException';\n\n /**\n * @author satorux@google.com (Satoru Takabayashi) - creator\n * @author dswitkin@google.com (Daniel Switkin) - ported from C++\n */\n class MatrixUtil {\n constructor() {\n // do nothing\n }\n // Set all cells to -1 (TYPESCRIPTPORT: 255). -1 (TYPESCRIPTPORT: 255) means that the cell is empty (not set yet).\n //\n // JAVAPORT: We shouldn't need to do this at all. The code should be rewritten to begin encoding\n // with the ByteMatrix initialized all to zero.\n static clearMatrix(matrix) {\n // TYPESCRIPTPORT: we use UintArray se changed here from -1 to 255\n matrix.clear(/*(byte) */ /*-1*/ 255);\n }\n // Build 2D matrix of QR Code from \"dataBits\" with \"ecLevel\", \"version\" and \"getMaskPattern\". On\n // success, store the result in \"matrix\" and return true.\n static buildMatrix(dataBits, ecLevel, version, maskPattern /*int*/, matrix) {\n MatrixUtil.clearMatrix(matrix);\n MatrixUtil.embedBasicPatterns(version, matrix);\n // Type information appear with any version.\n MatrixUtil.embedTypeInfo(ecLevel, maskPattern, matrix);\n // Version info appear if version >= 7.\n MatrixUtil.maybeEmbedVersionInfo(version, matrix);\n // Data should be embedded at end.\n MatrixUtil.embedDataBits(dataBits, maskPattern, matrix);\n }\n // Embed basic patterns. On success, modify the matrix and return true.\n // The basic patterns are:\n // - Position detection patterns\n // - Timing patterns\n // - Dark dot at the left bottom corner\n // - Position adjustment patterns, if need be\n static embedBasicPatterns(version, matrix) {\n // Let's get started with embedding big squares at corners.\n MatrixUtil.embedPositionDetectionPatternsAndSeparators(matrix);\n // Then, embed the dark dot at the left bottom corner.\n MatrixUtil.embedDarkDotAtLeftBottomCorner(matrix);\n // Position adjustment patterns appear if version >= 2.\n MatrixUtil.maybeEmbedPositionAdjustmentPatterns(version, matrix);\n // Timing patterns should be embedded after position adj. patterns.\n MatrixUtil.embedTimingPatterns(matrix);\n }\n // Embed type information. On success, modify the matrix.\n static embedTypeInfo(ecLevel, maskPattern /*int*/, matrix) {\n const typeInfoBits = new BitArray();\n MatrixUtil.makeTypeInfoBits(ecLevel, maskPattern, typeInfoBits);\n for (let i = 0, size = typeInfoBits.getSize(); i < size; ++i) {\n // Place bits in LSB to MSB order. LSB (least significant bit) is the last value in\n // \"typeInfoBits\".\n const bit = typeInfoBits.get(typeInfoBits.getSize() - 1 - i);\n // Type info bits at the left top corner. See 8.9 of JISX0510:2004 (p.46).\n const coordinates = MatrixUtil.TYPE_INFO_COORDINATES[i];\n const x1 = coordinates[0];\n const y1 = coordinates[1];\n matrix.setBoolean(x1, y1, bit);\n if (i < 8) {\n // Right top corner.\n const x2 = matrix.getWidth() - i - 1;\n const y2 = 8;\n matrix.setBoolean(x2, y2, bit);\n }\n else {\n // Left bottom corner.\n const x2 = 8;\n const y2 = matrix.getHeight() - 7 + (i - 8);\n matrix.setBoolean(x2, y2, bit);\n }\n }\n }\n // Embed version information if need be. On success, modify the matrix and return true.\n // See 8.10 of JISX0510:2004 (p.47) for how to embed version information.\n static maybeEmbedVersionInfo(version, matrix) {\n if (version.getVersionNumber() < 7) { // Version info is necessary if version >= 7.\n return; // Don't need version info.\n }\n const versionInfoBits = new BitArray();\n MatrixUtil.makeVersionInfoBits(version, versionInfoBits);\n let bitIndex = 6 * 3 - 1; // It will decrease from 17 to 0.\n for (let i = 0; i < 6; ++i) {\n for (let j = 0; j < 3; ++j) {\n // Place bits in LSB (least significant bit) to MSB order.\n const bit = versionInfoBits.get(bitIndex);\n bitIndex--;\n // Left bottom corner.\n matrix.setBoolean(i, matrix.getHeight() - 11 + j, bit);\n // Right bottom corner.\n matrix.setBoolean(matrix.getHeight() - 11 + j, i, bit);\n }\n }\n }\n // Embed \"dataBits\" using \"getMaskPattern\". On success, modify the matrix and return true.\n // For debugging purposes, it skips masking process if \"getMaskPattern\" is -1(TYPESCRIPTPORT: 255).\n // See 8.7 of JISX0510:2004 (p.38) for how to embed data bits.\n static embedDataBits(dataBits, maskPattern /*int*/, matrix) {\n let bitIndex = 0;\n let direction = -1;\n // Start from the right bottom cell.\n let x = matrix.getWidth() - 1;\n let y = matrix.getHeight() - 1;\n while (x > 0) {\n // Skip the vertical timing pattern.\n if (x === 6) {\n x -= 1;\n }\n while (y >= 0 && y < matrix.getHeight()) {\n for (let i = 0; i < 2; ++i) {\n const xx = x - i;\n // Skip the cell if it's not empty.\n if (!MatrixUtil.isEmpty(matrix.get(xx, y))) {\n continue;\n }\n let bit;\n if (bitIndex < dataBits.getSize()) {\n bit = dataBits.get(bitIndex);\n ++bitIndex;\n }\n else {\n // Padding bit. If there is no bit left, we'll fill the left cells with 0, as described\n // in 8.4.9 of JISX0510:2004 (p. 24).\n bit = false;\n }\n // Skip masking if mask_pattern is -1 (TYPESCRIPTPORT: 255).\n if (maskPattern !== 255 && MaskUtil.getDataMaskBit(maskPattern, xx, y)) {\n bit = !bit;\n }\n matrix.setBoolean(xx, y, bit);\n }\n y += direction;\n }\n direction = -direction; // Reverse the direction.\n y += direction;\n x -= 2; // Move to the left.\n }\n // All bits should be consumed.\n if (bitIndex !== dataBits.getSize()) {\n throw new WriterException('Not all bits consumed: ' + bitIndex + '/' + dataBits.getSize());\n }\n }\n // Return the position of the most significant bit set (one: to) in the \"value\". The most\n // significant bit is position 32. If there is no bit set, return 0. Examples:\n // - findMSBSet(0) => 0\n // - findMSBSet(1) => 1\n // - findMSBSet(255) => 8\n static findMSBSet(value /*int*/) {\n return 32 - Integer.numberOfLeadingZeros(value);\n }\n // Calculate BCH (Bose-Chaudhuri-Hocquenghem) code for \"value\" using polynomial \"poly\". The BCH\n // code is used for encoding type information and version information.\n // Example: Calculation of version information of 7.\n // f(x) is created from 7.\n // - 7 = 000111 in 6 bits\n // - f(x) = x^2 + x^1 + x^0\n // g(x) is given by the standard (p. 67)\n // - g(x) = x^12 + x^11 + x^10 + x^9 + x^8 + x^5 + x^2 + 1\n // Multiply f(x) by x^(18 - 6)\n // - f'(x) = f(x) * x^(18 - 6)\n // - f'(x) = x^14 + x^13 + x^12\n // Calculate the remainder of f'(x) / g(x)\n // x^2\n // __________________________________________________\n // g(x) )x^14 + x^13 + x^12\n // x^14 + x^13 + x^12 + x^11 + x^10 + x^7 + x^4 + x^2\n // --------------------------------------------------\n // x^11 + x^10 + x^7 + x^4 + x^2\n //\n // The remainder is x^11 + x^10 + x^7 + x^4 + x^2\n // Encode it in binary: 110010010100\n // The return value is 0xc94 (1100 1001 0100)\n //\n // Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit\n // operations. We don't care if coefficients are positive or negative.\n static calculateBCHCode(value /*int*/, poly /*int*/) {\n if (poly === 0) {\n throw new IllegalArgumentException('0 polynomial');\n }\n // If poly is \"1 1111 0010 0101\" (version info poly), msbSetInPoly is 13. We'll subtract 1\n // from 13 to make it 12.\n const msbSetInPoly = MatrixUtil.findMSBSet(poly);\n value <<= msbSetInPoly - 1;\n // Do the division business using exclusive-or operations.\n while (MatrixUtil.findMSBSet(value) >= msbSetInPoly) {\n value ^= poly << (MatrixUtil.findMSBSet(value) - msbSetInPoly);\n }\n // Now the \"value\" is the remainder (i.e. the BCH code)\n return value;\n }\n // Make bit vector of type information. On success, store the result in \"bits\" and return true.\n // Encode error correction level and mask pattern. See 8.9 of\n // JISX0510:2004 (p.45) for details.\n static makeTypeInfoBits(ecLevel, maskPattern /*int*/, bits) {\n if (!QRCode.isValidMaskPattern(maskPattern)) {\n throw new WriterException('Invalid mask pattern');\n }\n const typeInfo = (ecLevel.getBits() << 3) | maskPattern;\n bits.appendBits(typeInfo, 5);\n const bchCode = MatrixUtil.calculateBCHCode(typeInfo, MatrixUtil.TYPE_INFO_POLY);\n bits.appendBits(bchCode, 10);\n const maskBits = new BitArray();\n maskBits.appendBits(MatrixUtil.TYPE_INFO_MASK_PATTERN, 15);\n bits.xor(maskBits);\n if (bits.getSize() !== 15) { // Just in case.\n throw new WriterException('should not happen but we got: ' + bits.getSize());\n }\n }\n // Make bit vector of version information. On success, store the result in \"bits\" and return true.\n // See 8.10 of JISX0510:2004 (p.45) for details.\n static makeVersionInfoBits(version, bits) {\n bits.appendBits(version.getVersionNumber(), 6);\n const bchCode = MatrixUtil.calculateBCHCode(version.getVersionNumber(), MatrixUtil.VERSION_INFO_POLY);\n bits.appendBits(bchCode, 12);\n if (bits.getSize() !== 18) { // Just in case.\n throw new WriterException('should not happen but we got: ' + bits.getSize());\n }\n }\n // Check if \"value\" is empty.\n static isEmpty(value /*int*/) {\n return value === 255; // -1\n }\n static embedTimingPatterns(matrix) {\n // -8 is for skipping position detection patterns (7: size), and two horizontal/vertical\n // separation patterns (1: size). Thus, 8 = 7 + 1.\n for (let i = 8; i < matrix.getWidth() - 8; ++i) {\n const bit = (i + 1) % 2;\n // Horizontal line.\n if (MatrixUtil.isEmpty(matrix.get(i, 6))) {\n matrix.setNumber(i, 6, bit);\n }\n // Vertical line.\n if (MatrixUtil.isEmpty(matrix.get(6, i))) {\n matrix.setNumber(6, i, bit);\n }\n }\n }\n // Embed the lonely dark dot at left bottom corner. JISX0510:2004 (p.46)\n static embedDarkDotAtLeftBottomCorner(matrix) {\n if (matrix.get(8, matrix.getHeight() - 8) === 0) {\n throw new WriterException();\n }\n matrix.setNumber(8, matrix.getHeight() - 8, 1);\n }\n static embedHorizontalSeparationPattern(xStart /*int*/, yStart /*int*/, matrix) {\n for (let x = 0; x < 8; ++x) {\n if (!MatrixUtil.isEmpty(matrix.get(xStart + x, yStart))) {\n throw new WriterException();\n }\n matrix.setNumber(xStart + x, yStart, 0);\n }\n }\n static embedVerticalSeparationPattern(xStart /*int*/, yStart /*int*/, matrix) {\n for (let y = 0; y < 7; ++y) {\n if (!MatrixUtil.isEmpty(matrix.get(xStart, yStart + y))) {\n throw new WriterException();\n }\n matrix.setNumber(xStart, yStart + y, 0);\n }\n }\n static embedPositionAdjustmentPattern(xStart /*int*/, yStart /*int*/, matrix) {\n for (let y = 0; y < 5; ++y) {\n const patternY = MatrixUtil.POSITION_ADJUSTMENT_PATTERN[y];\n for (let x = 0; x < 5; ++x) {\n matrix.setNumber(xStart + x, yStart + y, patternY[x]);\n }\n }\n }\n static embedPositionDetectionPattern(xStart /*int*/, yStart /*int*/, matrix) {\n for (let y = 0; y < 7; ++y) {\n const patternY = MatrixUtil.POSITION_DETECTION_PATTERN[y];\n for (let x = 0; x < 7; ++x) {\n matrix.setNumber(xStart + x, yStart + y, patternY[x]);\n }\n }\n }\n // Embed position detection patterns and surrounding vertical/horizontal separators.\n static embedPositionDetectionPatternsAndSeparators(matrix) {\n // Embed three big squares at corners.\n const pdpWidth = MatrixUtil.POSITION_DETECTION_PATTERN[0].length;\n // Left top corner.\n MatrixUtil.embedPositionDetectionPattern(0, 0, matrix);\n // Right top corner.\n MatrixUtil.embedPositionDetectionPattern(matrix.getWidth() - pdpWidth, 0, matrix);\n // Left bottom corner.\n MatrixUtil.embedPositionDetectionPattern(0, matrix.getWidth() - pdpWidth, matrix);\n // Embed horizontal separation patterns around the squares.\n const hspWidth = 8;\n // Left top corner.\n MatrixUtil.embedHorizontalSeparationPattern(0, hspWidth - 1, matrix);\n // Right top corner.\n MatrixUtil.embedHorizontalSeparationPattern(matrix.getWidth() - hspWidth, hspWidth - 1, matrix);\n // Left bottom corner.\n MatrixUtil.embedHorizontalSeparationPattern(0, matrix.getWidth() - hspWidth, matrix);\n // Embed vertical separation patterns around the squares.\n const vspSize = 7;\n // Left top corner.\n MatrixUtil.embedVerticalSeparationPattern(vspSize, 0, matrix);\n // Right top corner.\n MatrixUtil.embedVerticalSeparationPattern(matrix.getHeight() - vspSize - 1, 0, matrix);\n // Left bottom corner.\n MatrixUtil.embedVerticalSeparationPattern(vspSize, matrix.getHeight() - vspSize, matrix);\n }\n // Embed position adjustment patterns if need be.\n static maybeEmbedPositionAdjustmentPatterns(version, matrix) {\n if (version.getVersionNumber() < 2) { // The patterns appear if version >= 2\n return;\n }\n const index = version.getVersionNumber() - 1;\n const coordinates = MatrixUtil.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];\n for (let i = 0, length = coordinates.length; i !== length; i++) {\n const y = coordinates[i];\n if (y >= 0) {\n for (let j = 0; j !== length; j++) {\n const x = coordinates[j];\n if (x >= 0 && MatrixUtil.isEmpty(matrix.get(x, y))) {\n // If the cell is unset, we embed the position adjustment pattern here.\n // -2 is necessary since the x/y coordinates point to the center of the pattern, not the\n // left top corner.\n MatrixUtil.embedPositionAdjustmentPattern(x - 2, y - 2, matrix);\n }\n }\n }\n }\n }\n }\n MatrixUtil.POSITION_DETECTION_PATTERN = Array.from([\n Int32Array.from([1, 1, 1, 1, 1, 1, 1]),\n Int32Array.from([1, 0, 0, 0, 0, 0, 1]),\n Int32Array.from([1, 0, 1, 1, 1, 0, 1]),\n Int32Array.from([1, 0, 1, 1, 1, 0, 1]),\n Int32Array.from([1, 0, 1, 1, 1, 0, 1]),\n Int32Array.from([1, 0, 0, 0, 0, 0, 1]),\n Int32Array.from([1, 1, 1, 1, 1, 1, 1]),\n ]);\n MatrixUtil.POSITION_ADJUSTMENT_PATTERN = Array.from([\n Int32Array.from([1, 1, 1, 1, 1]),\n Int32Array.from([1, 0, 0, 0, 1]),\n Int32Array.from([1, 0, 1, 0, 1]),\n Int32Array.from([1, 0, 0, 0, 1]),\n Int32Array.from([1, 1, 1, 1, 1]),\n ]);\n // From Appendix E. Table 1, JIS0510X:2004 (71: p). The table was double-checked by komatsu.\n MatrixUtil.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE = Array.from([\n Int32Array.from([-1, -1, -1, -1, -1, -1, -1]),\n Int32Array.from([6, 18, -1, -1, -1, -1, -1]),\n Int32Array.from([6, 22, -1, -1, -1, -1, -1]),\n Int32Array.from([6, 26, -1, -1, -1, -1, -1]),\n Int32Array.from([6, 30, -1, -1, -1, -1, -1]),\n Int32Array.from([6, 34, -1, -1, -1, -1, -1]),\n Int32Array.from([6, 22, 38, -1, -1, -1, -1]),\n Int32Array.from([6, 24, 42, -1, -1, -1, -1]),\n Int32Array.from([6, 26, 46, -1, -1, -1, -1]),\n Int32Array.from([6, 28, 50, -1, -1, -1, -1]),\n Int32Array.from([6, 30, 54, -1, -1, -1, -1]),\n Int32Array.from([6, 32, 58, -1, -1, -1, -1]),\n Int32Array.from([6, 34, 62, -1, -1, -1, -1]),\n Int32Array.from([6, 26, 46, 66, -1, -1, -1]),\n Int32Array.from([6, 26, 48, 70, -1, -1, -1]),\n Int32Array.from([6, 26, 50, 74, -1, -1, -1]),\n Int32Array.from([6, 30, 54, 78, -1, -1, -1]),\n Int32Array.from([6, 30, 56, 82, -1, -1, -1]),\n Int32Array.from([6, 30, 58, 86, -1, -1, -1]),\n Int32Array.from([6, 34, 62, 90, -1, -1, -1]),\n Int32Array.from([6, 28, 50, 72, 94, -1, -1]),\n Int32Array.from([6, 26, 50, 74, 98, -1, -1]),\n Int32Array.from([6, 30, 54, 78, 102, -1, -1]),\n Int32Array.from([6, 28, 54, 80, 106, -1, -1]),\n Int32Array.from([6, 32, 58, 84, 110, -1, -1]),\n Int32Array.from([6, 30, 58, 86, 114, -1, -1]),\n Int32Array.from([6, 34, 62, 90, 118, -1, -1]),\n Int32Array.from([6, 26, 50, 74, 98, 122, -1]),\n Int32Array.from([6, 30, 54, 78, 102, 126, -1]),\n Int32Array.from([6, 26, 52, 78, 104, 130, -1]),\n Int32Array.from([6, 30, 56, 82, 108, 134, -1]),\n Int32Array.from([6, 34, 60, 86, 112, 138, -1]),\n Int32Array.from([6, 30, 58, 86, 114, 142, -1]),\n Int32Array.from([6, 34, 62, 90, 118, 146, -1]),\n Int32Array.from([6, 30, 54, 78, 102, 126, 150]),\n Int32Array.from([6, 24, 50, 76, 102, 128, 154]),\n Int32Array.from([6, 28, 54, 80, 106, 132, 158]),\n Int32Array.from([6, 32, 58, 84, 110, 136, 162]),\n Int32Array.from([6, 26, 54, 82, 110, 138, 166]),\n Int32Array.from([6, 30, 58, 86, 114, 142, 170]),\n ]);\n // Type info cells at the left top corner.\n MatrixUtil.TYPE_INFO_COORDINATES = Array.from([\n Int32Array.from([8, 0]),\n Int32Array.from([8, 1]),\n Int32Array.from([8, 2]),\n Int32Array.from([8, 3]),\n Int32Array.from([8, 4]),\n Int32Array.from([8, 5]),\n Int32Array.from([8, 7]),\n Int32Array.from([8, 8]),\n Int32Array.from([7, 8]),\n Int32Array.from([5, 8]),\n Int32Array.from([4, 8]),\n Int32Array.from([3, 8]),\n Int32Array.from([2, 8]),\n Int32Array.from([1, 8]),\n Int32Array.from([0, 8]),\n ]);\n // From Appendix D in JISX0510:2004 (p. 67)\n MatrixUtil.VERSION_INFO_POLY = 0x1f25; // 1 1111 0010 0101\n // From Appendix C in JISX0510:2004 (p.65).\n MatrixUtil.TYPE_INFO_POLY = 0x537;\n MatrixUtil.TYPE_INFO_MASK_PATTERN = 0x5412;\n\n /*namespace com.google.zxing.qrcode.encoder {*/\n class BlockPair {\n constructor(dataBytes, errorCorrectionBytes) {\n this.dataBytes = dataBytes;\n this.errorCorrectionBytes = errorCorrectionBytes;\n }\n getDataBytes() {\n return this.dataBytes;\n }\n getErrorCorrectionBytes() {\n return this.errorCorrectionBytes;\n }\n }\n\n /*import java.io.UnsupportedEncodingException;*/\n /*import java.util.ArrayList;*/\n /*import java.util.Collection;*/\n /*import java.util.Map;*/\n /**\n * @author satorux@google.com (Satoru Takabayashi) - creator\n * @author dswitkin@google.com (Daniel Switkin) - ported from C++\n */\n class Encoder {\n // TYPESCRIPTPORT: changed to UTF8, the default for js\n constructor() { }\n // The mask penalty calculation is complicated. See Table 21 of JISX0510:2004 (p.45) for details.\n // Basically it applies four rules and summate all penalties.\n static calculateMaskPenalty(matrix) {\n return MaskUtil.applyMaskPenaltyRule1(matrix)\n + MaskUtil.applyMaskPenaltyRule2(matrix)\n + MaskUtil.applyMaskPenaltyRule3(matrix)\n + MaskUtil.applyMaskPenaltyRule4(matrix);\n }\n /**\n * @param content text to encode\n * @param ecLevel error correction level to use\n * @return {@link QRCode} representing the encoded QR code\n * @throws WriterException if encoding can't succeed, because of for example invalid content\n * or configuration\n */\n // public static encode(content: string, ecLevel: ErrorCorrectionLevel): QRCode /*throws WriterException*/ {\n // return encode(content, ecLevel, null)\n // }\n static encode(content, ecLevel, hints = null) {\n // Determine what character encoding has been specified by the caller, if any\n let encoding = Encoder.DEFAULT_BYTE_MODE_ENCODING;\n const hasEncodingHint = hints !== null && undefined !== hints.get(EncodeHintType$1.CHARACTER_SET);\n if (hasEncodingHint) {\n encoding = hints.get(EncodeHintType$1.CHARACTER_SET).toString();\n }\n // Pick an encoding mode appropriate for the content. Note that this will not attempt to use\n // multiple modes / segments even if that were more efficient. Twould be nice.\n const mode = this.chooseMode(content, encoding);\n // This will store the header information, like mode and\n // length, as well as \"header\" segments like an ECI segment.\n const headerBits = new BitArray();\n // Append ECI segment if applicable\n if (mode === Mode$1.BYTE && (hasEncodingHint || Encoder.DEFAULT_BYTE_MODE_ENCODING !== encoding)) {\n const eci = CharacterSetECI.getCharacterSetECIByName(encoding);\n if (eci !== undefined) {\n this.appendECI(eci, headerBits);\n }\n }\n // (With ECI in place,) Write the mode marker\n this.appendModeInfo(mode, headerBits);\n // Collect data within the main segment, separately, to count its size if needed. Don't add it to\n // main payload yet.\n const dataBits = new BitArray();\n this.appendBytes(content, mode, dataBits, encoding);\n let version;\n if (hints !== null && undefined !== hints.get(EncodeHintType$1.QR_VERSION)) {\n const versionNumber = Number.parseInt(hints.get(EncodeHintType$1.QR_VERSION).toString(), 10);\n version = Version$1.getVersionForNumber(versionNumber);\n const bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, version);\n if (!this.willFit(bitsNeeded, version, ecLevel)) {\n throw new WriterException('Data too big for requested version');\n }\n }\n else {\n version = this.recommendVersion(ecLevel, mode, headerBits, dataBits);\n }\n const headerAndDataBits = new BitArray();\n headerAndDataBits.appendBitArray(headerBits);\n // Find \"length\" of main segment and write it\n const numLetters = mode === Mode$1.BYTE ? dataBits.getSizeInBytes() : content.length;\n this.appendLengthInfo(numLetters, version, mode, headerAndDataBits);\n // Put data together into the overall payload\n headerAndDataBits.appendBitArray(dataBits);\n const ecBlocks = version.getECBlocksForLevel(ecLevel);\n const numDataBytes = version.getTotalCodewords() - ecBlocks.getTotalECCodewords();\n // Terminate the bits properly.\n this.terminateBits(numDataBytes, headerAndDataBits);\n // Interleave data bits with error correction code.\n const finalBits = this.interleaveWithECBytes(headerAndDataBits, version.getTotalCodewords(), numDataBytes, ecBlocks.getNumBlocks());\n const qrCode = new QRCode();\n qrCode.setECLevel(ecLevel);\n qrCode.setMode(mode);\n qrCode.setVersion(version);\n // Choose the mask pattern and set to \"qrCode\".\n const dimension = version.getDimensionForVersion();\n const matrix = new ByteMatrix(dimension, dimension);\n const maskPattern = this.chooseMaskPattern(finalBits, ecLevel, version, matrix);\n qrCode.setMaskPattern(maskPattern);\n // Build the matrix and set it to \"qrCode\".\n MatrixUtil.buildMatrix(finalBits, ecLevel, version, maskPattern, matrix);\n qrCode.setMatrix(matrix);\n return qrCode;\n }\n /**\n * Decides the smallest version of QR code that will contain all of the provided data.\n *\n * @throws WriterException if the data cannot fit in any version\n */\n static recommendVersion(ecLevel, mode, headerBits, dataBits) {\n // Hard part: need to know version to know how many bits length takes. But need to know how many\n // bits it takes to know version. First we take a guess at version by assuming version will be\n // the minimum, 1:\n const provisionalBitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, Version$1.getVersionForNumber(1));\n const provisionalVersion = this.chooseVersion(provisionalBitsNeeded, ecLevel);\n // Use that guess to calculate the right version. I am still not sure this works in 100% of cases.\n const bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);\n return this.chooseVersion(bitsNeeded, ecLevel);\n }\n static calculateBitsNeeded(mode, headerBits, dataBits, version) {\n return headerBits.getSize() + mode.getCharacterCountBits(version) + dataBits.getSize();\n }\n /**\n * @return the code point of the table used in alphanumeric mode or\n * -1 if there is no corresponding code in the table.\n */\n static getAlphanumericCode(code /*int*/) {\n if (code < Encoder.ALPHANUMERIC_TABLE.length) {\n return Encoder.ALPHANUMERIC_TABLE[code];\n }\n return -1;\n }\n // public static chooseMode(content: string): Mode {\n // return chooseMode(content, null);\n // }\n /**\n * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;\n * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.\n */\n static chooseMode(content, encoding = null) {\n if (CharacterSetECI.SJIS.getName() === encoding && this.isOnlyDoubleByteKanji(content)) {\n // Choose Kanji mode if all input are double-byte characters\n return Mode$1.KANJI;\n }\n let hasNumeric = false;\n let hasAlphanumeric = false;\n for (let i = 0, length = content.length; i < length; ++i) {\n const c = content.charAt(i);\n if (Encoder.isDigit(c)) {\n hasNumeric = true;\n }\n else if (this.getAlphanumericCode(c.charCodeAt(0)) !== -1) {\n hasAlphanumeric = true;\n }\n else {\n return Mode$1.BYTE;\n }\n }\n if (hasAlphanumeric) {\n return Mode$1.ALPHANUMERIC;\n }\n if (hasNumeric) {\n return Mode$1.NUMERIC;\n }\n return Mode$1.BYTE;\n }\n static isOnlyDoubleByteKanji(content) {\n let bytes;\n try {\n bytes = StringEncoding.encode(content, CharacterSetECI.SJIS); // content.getBytes(\"Shift_JIS\"))\n }\n catch (ignored /*: UnsupportedEncodingException*/) {\n return false;\n }\n const length = bytes.length;\n if (length % 2 !== 0) {\n return false;\n }\n for (let i = 0; i < length; i += 2) {\n const byte1 = bytes[i] & 0xFF;\n if ((byte1 < 0x81 || byte1 > 0x9F) && (byte1 < 0xE0 || byte1 > 0xEB)) {\n return false;\n }\n }\n return true;\n }\n static chooseMaskPattern(bits, ecLevel, version, matrix) {\n let minPenalty = Number.MAX_SAFE_INTEGER; // Lower penalty is better.\n let bestMaskPattern = -1;\n // We try all mask patterns to choose the best one.\n for (let maskPattern = 0; maskPattern < QRCode.NUM_MASK_PATTERNS; maskPattern++) {\n MatrixUtil.buildMatrix(bits, ecLevel, version, maskPattern, matrix);\n let penalty = this.calculateMaskPenalty(matrix);\n if (penalty < minPenalty) {\n minPenalty = penalty;\n bestMaskPattern = maskPattern;\n }\n }\n return bestMaskPattern;\n }\n static chooseVersion(numInputBits /*int*/, ecLevel) {\n for (let versionNum = 1; versionNum <= 40; versionNum++) {\n const version = Version$1.getVersionForNumber(versionNum);\n if (Encoder.willFit(numInputBits, version, ecLevel)) {\n return version;\n }\n }\n throw new WriterException('Data too big');\n }\n /**\n * @return true if the number of input bits will fit in a code with the specified version and\n * error correction level.\n */\n static willFit(numInputBits /*int*/, version, ecLevel) {\n // In the following comments, we use numbers of Version 7-H.\n // numBytes = 196\n const numBytes = version.getTotalCodewords();\n // getNumECBytes = 130\n const ecBlocks = version.getECBlocksForLevel(ecLevel);\n const numEcBytes = ecBlocks.getTotalECCodewords();\n // getNumDataBytes = 196 - 130 = 66\n const numDataBytes = numBytes - numEcBytes;\n const totalInputBytes = (numInputBits + 7) / 8;\n return numDataBytes >= totalInputBytes;\n }\n /**\n * Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24).\n */\n static terminateBits(numDataBytes /*int*/, bits) {\n const capacity = numDataBytes * 8;\n if (bits.getSize() > capacity) {\n throw new WriterException('data bits cannot fit in the QR Code' + bits.getSize() + ' > ' +\n capacity);\n }\n for (let i = 0; i < 4 && bits.getSize() < capacity; ++i) {\n bits.appendBit(false);\n }\n // Append termination bits. See 8.4.8 of JISX0510:2004 (p.24) for details.\n // If the last byte isn't 8-bit aligned, we'll add padding bits.\n const numBitsInLastByte = bits.getSize() & 0x07;\n if (numBitsInLastByte > 0) {\n for (let i = numBitsInLastByte; i < 8; i++) {\n bits.appendBit(false);\n }\n }\n // If we have more space, we'll fill the space with padding patterns defined in 8.4.9 (p.24).\n const numPaddingBytes = numDataBytes - bits.getSizeInBytes();\n for (let i = 0; i < numPaddingBytes; ++i) {\n bits.appendBits((i & 0x01) === 0 ? 0xEC : 0x11, 8);\n }\n if (bits.getSize() !== capacity) {\n throw new WriterException('Bits size does not equal capacity');\n }\n }\n /**\n * Get number of data bytes and number of error correction bytes for block id \"blockID\". Store\n * the result in \"numDataBytesInBlock\", and \"numECBytesInBlock\". See table 12 in 8.5.1 of\n * JISX0510:2004 (p.30)\n */\n static getNumDataBytesAndNumECBytesForBlockID(numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/, blockID /*int*/, numDataBytesInBlock, numECBytesInBlock) {\n if (blockID >= numRSBlocks) {\n throw new WriterException('Block ID too large');\n }\n // numRsBlocksInGroup2 = 196 % 5 = 1\n const numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;\n // numRsBlocksInGroup1 = 5 - 1 = 4\n const numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;\n // numTotalBytesInGroup1 = 196 / 5 = 39\n const numTotalBytesInGroup1 = Math.floor(numTotalBytes / numRSBlocks);\n // numTotalBytesInGroup2 = 39 + 1 = 40\n const numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;\n // numDataBytesInGroup1 = 66 / 5 = 13\n const numDataBytesInGroup1 = Math.floor(numDataBytes / numRSBlocks);\n // numDataBytesInGroup2 = 13 + 1 = 14\n const numDataBytesInGroup2 = numDataBytesInGroup1 + 1;\n // numEcBytesInGroup1 = 39 - 13 = 26\n const numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;\n // numEcBytesInGroup2 = 40 - 14 = 26\n const numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;\n // Sanity checks.\n // 26 = 26\n if (numEcBytesInGroup1 !== numEcBytesInGroup2) {\n throw new WriterException('EC bytes mismatch');\n }\n // 5 = 4 + 1.\n if (numRSBlocks !== numRsBlocksInGroup1 + numRsBlocksInGroup2) {\n throw new WriterException('RS blocks mismatch');\n }\n // 196 = (13 + 26) * 4 + (14 + 26) * 1\n if (numTotalBytes !==\n ((numDataBytesInGroup1 + numEcBytesInGroup1) *\n numRsBlocksInGroup1) +\n ((numDataBytesInGroup2 + numEcBytesInGroup2) *\n numRsBlocksInGroup2)) {\n throw new WriterException('Total bytes mismatch');\n }\n if (blockID < numRsBlocksInGroup1) {\n numDataBytesInBlock[0] = numDataBytesInGroup1;\n numECBytesInBlock[0] = numEcBytesInGroup1;\n }\n else {\n numDataBytesInBlock[0] = numDataBytesInGroup2;\n numECBytesInBlock[0] = numEcBytesInGroup2;\n }\n }\n /**\n * Interleave \"bits\" with corresponding error correction bytes. On success, store the result in\n * \"result\". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.\n */\n static interleaveWithECBytes(bits, numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/) {\n // \"bits\" must have \"getNumDataBytes\" bytes of data.\n if (bits.getSizeInBytes() !== numDataBytes) {\n throw new WriterException('Number of bits and data bytes does not match');\n }\n // Step 1. Divide data bytes into blocks and generate error correction bytes for them. We'll\n // store the divided data bytes blocks and error correction bytes blocks into \"blocks\".\n let dataBytesOffset = 0;\n let maxNumDataBytes = 0;\n let maxNumEcBytes = 0;\n // Since, we know the number of reedsolmon blocks, we can initialize the vector with the number.\n const blocks = new Array(); // new Array(numRSBlocks)\n for (let i = 0; i < numRSBlocks; ++i) {\n const numDataBytesInBlock = new Int32Array(1);\n const numEcBytesInBlock = new Int32Array(1);\n Encoder.getNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes, numRSBlocks, i, numDataBytesInBlock, numEcBytesInBlock);\n const size = numDataBytesInBlock[0];\n const dataBytes = new Uint8Array(size);\n bits.toBytes(8 * dataBytesOffset, dataBytes, 0, size);\n const ecBytes = Encoder.generateECBytes(dataBytes, numEcBytesInBlock[0]);\n blocks.push(new BlockPair(dataBytes, ecBytes));\n maxNumDataBytes = Math.max(maxNumDataBytes, size);\n maxNumEcBytes = Math.max(maxNumEcBytes, ecBytes.length);\n dataBytesOffset += numDataBytesInBlock[0];\n }\n if (numDataBytes !== dataBytesOffset) {\n throw new WriterException('Data bytes does not match offset');\n }\n const result = new BitArray();\n // First, place data blocks.\n for (let i = 0; i < maxNumDataBytes; ++i) {\n for (const block of blocks) {\n const dataBytes = block.getDataBytes();\n if (i < dataBytes.length) {\n result.appendBits(dataBytes[i], 8);\n }\n }\n }\n // Then, place error correction blocks.\n for (let i = 0; i < maxNumEcBytes; ++i) {\n for (const block of blocks) {\n const ecBytes = block.getErrorCorrectionBytes();\n if (i < ecBytes.length) {\n result.appendBits(ecBytes[i], 8);\n }\n }\n }\n if (numTotalBytes !== result.getSizeInBytes()) { // Should be same.\n throw new WriterException('Interleaving error: ' + numTotalBytes + ' and ' +\n result.getSizeInBytes() + ' differ.');\n }\n return result;\n }\n static generateECBytes(dataBytes, numEcBytesInBlock /*int*/) {\n const numDataBytes = dataBytes.length;\n const toEncode = new Int32Array(numDataBytes + numEcBytesInBlock); // int[numDataBytes + numEcBytesInBlock]\n for (let i = 0; i < numDataBytes; i++) {\n toEncode[i] = dataBytes[i] & 0xFF;\n }\n new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);\n const ecBytes = new Uint8Array(numEcBytesInBlock);\n for (let i = 0; i < numEcBytesInBlock; i++) {\n ecBytes[i] = /*(byte) */ toEncode[numDataBytes + i];\n }\n return ecBytes;\n }\n /**\n * Append mode info. On success, store the result in \"bits\".\n */\n static appendModeInfo(mode, bits) {\n bits.appendBits(mode.getBits(), 4);\n }\n /**\n * Append length info. On success, store the result in \"bits\".\n */\n static appendLengthInfo(numLetters /*int*/, version, mode, bits) {\n const numBits = mode.getCharacterCountBits(version);\n if (numLetters >= (1 << numBits)) {\n throw new WriterException(numLetters + ' is bigger than ' + ((1 << numBits) - 1));\n }\n bits.appendBits(numLetters, numBits);\n }\n /**\n * Append \"bytes\" in \"mode\" mode (encoding) into \"bits\". On success, store the result in \"bits\".\n */\n static appendBytes(content, mode, bits, encoding) {\n switch (mode) {\n case Mode$1.NUMERIC:\n Encoder.appendNumericBytes(content, bits);\n break;\n case Mode$1.ALPHANUMERIC:\n Encoder.appendAlphanumericBytes(content, bits);\n break;\n case Mode$1.BYTE:\n Encoder.append8BitBytes(content, bits, encoding);\n break;\n case Mode$1.KANJI:\n Encoder.appendKanjiBytes(content, bits);\n break;\n default:\n throw new WriterException('Invalid mode: ' + mode);\n }\n }\n static getDigit(singleCharacter) {\n return singleCharacter.charCodeAt(0) - 48;\n }\n static isDigit(singleCharacter) {\n const cn = Encoder.getDigit(singleCharacter);\n return cn >= 0 && cn <= 9;\n }\n static appendNumericBytes(content, bits) {\n const length = content.length;\n let i = 0;\n while (i < length) {\n const num1 = Encoder.getDigit(content.charAt(i));\n if (i + 2 < length) {\n // Encode three numeric letters in ten bits.\n const num2 = Encoder.getDigit(content.charAt(i + 1));\n const num3 = Encoder.getDigit(content.charAt(i + 2));\n bits.appendBits(num1 * 100 + num2 * 10 + num3, 10);\n i += 3;\n }\n else if (i + 1 < length) {\n // Encode two numeric letters in seven bits.\n const num2 = Encoder.getDigit(content.charAt(i + 1));\n bits.appendBits(num1 * 10 + num2, 7);\n i += 2;\n }\n else {\n // Encode one numeric letter in four bits.\n bits.appendBits(num1, 4);\n i++;\n }\n }\n }\n static appendAlphanumericBytes(content, bits) {\n const length = content.length;\n let i = 0;\n while (i < length) {\n const code1 = Encoder.getAlphanumericCode(content.charCodeAt(i));\n if (code1 === -1) {\n throw new WriterException();\n }\n if (i + 1 < length) {\n const code2 = Encoder.getAlphanumericCode(content.charCodeAt(i + 1));\n if (code2 === -1) {\n throw new WriterException();\n }\n // Encode two alphanumeric letters in 11 bits.\n bits.appendBits(code1 * 45 + code2, 11);\n i += 2;\n }\n else {\n // Encode one alphanumeric letter in six bits.\n bits.appendBits(code1, 6);\n i++;\n }\n }\n }\n static append8BitBytes(content, bits, encoding) {\n let bytes;\n try {\n bytes = StringEncoding.encode(content, encoding);\n }\n catch (uee /*: UnsupportedEncodingException*/) {\n throw new WriterException(uee);\n }\n for (let i = 0, length = bytes.length; i !== length; i++) {\n const b = bytes[i];\n bits.appendBits(b, 8);\n }\n }\n /**\n * @throws WriterException\n */\n static appendKanjiBytes(content, bits) {\n let bytes;\n try {\n bytes = StringEncoding.encode(content, CharacterSetECI.SJIS);\n }\n catch (uee /*: UnsupportedEncodingException*/) {\n throw new WriterException(uee);\n }\n const length = bytes.length;\n for (let i = 0; i < length; i += 2) {\n const byte1 = bytes[i] & 0xFF;\n const byte2 = bytes[i + 1] & 0xFF;\n const code = ((byte1 << 8) & 0xFFFFFFFF) | byte2;\n let subtracted = -1;\n if (code >= 0x8140 && code <= 0x9ffc) {\n subtracted = code - 0x8140;\n }\n else if (code >= 0xe040 && code <= 0xebbf) {\n subtracted = code - 0xc140;\n }\n if (subtracted === -1) {\n throw new WriterException('Invalid byte sequence');\n }\n const encoded = ((subtracted >> 8) * 0xc0) + (subtracted & 0xff);\n bits.appendBits(encoded, 13);\n }\n }\n static appendECI(eci, bits) {\n bits.appendBits(Mode$1.ECI.getBits(), 4);\n // This is correct for values up to 127, which is all we need now.\n bits.appendBits(eci.getValue(), 8);\n }\n }\n // The original table is defined in the table 5 of JISX0510:2004 (p.19).\n Encoder.ALPHANUMERIC_TABLE = Int32Array.from([\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,\n 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,\n -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\n 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,\n ]);\n Encoder.DEFAULT_BYTE_MODE_ENCODING = CharacterSetECI.UTF8.getName(); // \"ISO-8859-1\"\n\n /**\n * @deprecated Moving to @zxing/browser\n */\n class BrowserQRCodeSvgWriter {\n /**\n * Writes and renders a QRCode SVG element.\n *\n * @param contents\n * @param width\n * @param height\n * @param hints\n */\n write(contents, width, height, hints = null) {\n if (contents.length === 0) {\n throw new IllegalArgumentException('Found empty contents');\n }\n // if (format != BarcodeFormat.QR_CODE) {\n // throw new IllegalArgumentException(\"Can only encode QR_CODE, but got \" + format)\n // }\n if (width < 0 || height < 0) {\n throw new IllegalArgumentException('Requested dimensions are too small: ' + width + 'x' + height);\n }\n let errorCorrectionLevel = ErrorCorrectionLevel.L;\n let quietZone = BrowserQRCodeSvgWriter.QUIET_ZONE_SIZE;\n if (hints !== null) {\n if (undefined !== hints.get(EncodeHintType$1.ERROR_CORRECTION)) {\n errorCorrectionLevel = ErrorCorrectionLevel.fromString(hints.get(EncodeHintType$1.ERROR_CORRECTION).toString());\n }\n if (undefined !== hints.get(EncodeHintType$1.MARGIN)) {\n quietZone = Number.parseInt(hints.get(EncodeHintType$1.MARGIN).toString(), 10);\n }\n }\n const code = Encoder.encode(contents, errorCorrectionLevel, hints);\n return this.renderResult(code, width, height, quietZone);\n }\n /**\n * Renders the result and then appends it to the DOM.\n */\n writeToDom(containerElement, contents, width, height, hints = null) {\n if (typeof containerElement === 'string') {\n containerElement = document.querySelector(containerElement);\n }\n const svgElement = this.write(contents, width, height, hints);\n if (containerElement)\n containerElement.appendChild(svgElement);\n }\n /**\n * Note that the input matrix uses 0 == white, 1 == black.\n * The output matrix uses 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).\n */\n renderResult(code, width /*int*/, height /*int*/, quietZone /*int*/) {\n const input = code.getMatrix();\n if (input === null) {\n throw new IllegalStateException();\n }\n const inputWidth = input.getWidth();\n const inputHeight = input.getHeight();\n const qrWidth = inputWidth + (quietZone * 2);\n const qrHeight = inputHeight + (quietZone * 2);\n const outputWidth = Math.max(width, qrWidth);\n const outputHeight = Math.max(height, qrHeight);\n const multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));\n // Padding includes both the quiet zone and the extra white pixels to accommodate the requested\n // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.\n // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will\n // handle all the padding from 100x100 (the actual QR) up to 200x160.\n const leftPadding = Math.floor((outputWidth - (inputWidth * multiple)) / 2);\n const topPadding = Math.floor((outputHeight - (inputHeight * multiple)) / 2);\n const svgElement = this.createSVGElement(outputWidth, outputHeight);\n for (let inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {\n // Write the contents of this row of the barcode\n for (let inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {\n if (input.get(inputX, inputY) === 1) {\n const svgRectElement = this.createSvgRectElement(outputX, outputY, multiple, multiple);\n svgElement.appendChild(svgRectElement);\n }\n }\n }\n return svgElement;\n }\n /**\n * Creates a SVG element.\n *\n * @param w SVG's width attribute\n * @param h SVG's height attribute\n */\n createSVGElement(w, h) {\n const svgElement = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'svg');\n svgElement.setAttributeNS(null, 'height', w.toString());\n svgElement.setAttributeNS(null, 'width', h.toString());\n return svgElement;\n }\n /**\n * Creates a SVG rect element.\n *\n * @param x Element's x coordinate\n * @param y Element's y coordinate\n * @param w Element's width attribute\n * @param h Element's height attribute\n */\n createSvgRectElement(x, y, w, h) {\n const rect = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'rect');\n rect.setAttributeNS(null, 'x', x.toString());\n rect.setAttributeNS(null, 'y', y.toString());\n rect.setAttributeNS(null, 'height', w.toString());\n rect.setAttributeNS(null, 'width', h.toString());\n rect.setAttributeNS(null, 'fill', '#000000');\n return rect;\n }\n }\n BrowserQRCodeSvgWriter.QUIET_ZONE_SIZE = 4;\n /**\n * SVG markup NameSpace\n */\n BrowserQRCodeSvgWriter.SVG_NS = 'http://www.w3.org/2000/svg';\n\n /*import java.util.Map;*/\n /**\n * This object renders a QR Code as a BitMatrix 2D array of greyscale values.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\n class QRCodeWriter {\n /*@Override*/\n // public encode(contents: string, format: BarcodeFormat, width: number /*int*/, height: number /*int*/): BitMatrix\n // /*throws WriterException */ {\n // return encode(contents, format, width, height, null)\n // }\n /*@Override*/\n encode(contents, format, width /*int*/, height /*int*/, hints) {\n if (contents.length === 0) {\n throw new IllegalArgumentException('Found empty contents');\n }\n if (format !== BarcodeFormat$1.QR_CODE) {\n throw new IllegalArgumentException('Can only encode QR_CODE, but got ' + format);\n }\n if (width < 0 || height < 0) {\n throw new IllegalArgumentException(`Requested dimensions are too small: ${width}x${height}`);\n }\n let errorCorrectionLevel = ErrorCorrectionLevel.L;\n let quietZone = QRCodeWriter.QUIET_ZONE_SIZE;\n if (hints !== null) {\n if (undefined !== hints.get(EncodeHintType$1.ERROR_CORRECTION)) {\n errorCorrectionLevel = ErrorCorrectionLevel.fromString(hints.get(EncodeHintType$1.ERROR_CORRECTION).toString());\n }\n if (undefined !== hints.get(EncodeHintType$1.MARGIN)) {\n quietZone = Number.parseInt(hints.get(EncodeHintType$1.MARGIN).toString(), 10);\n }\n }\n const code = Encoder.encode(contents, errorCorrectionLevel, hints);\n return QRCodeWriter.renderResult(code, width, height, quietZone);\n }\n // Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses\n // 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).\n static renderResult(code, width /*int*/, height /*int*/, quietZone /*int*/) {\n const input = code.getMatrix();\n if (input === null) {\n throw new IllegalStateException();\n }\n const inputWidth = input.getWidth();\n const inputHeight = input.getHeight();\n const qrWidth = inputWidth + (quietZone * 2);\n const qrHeight = inputHeight + (quietZone * 2);\n const outputWidth = Math.max(width, qrWidth);\n const outputHeight = Math.max(height, qrHeight);\n const multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));\n // Padding includes both the quiet zone and the extra white pixels to accommodate the requested\n // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.\n // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will\n // handle all the padding from 100x100 (the actual QR) up to 200x160.\n const leftPadding = Math.floor((outputWidth - (inputWidth * multiple)) / 2);\n const topPadding = Math.floor((outputHeight - (inputHeight * multiple)) / 2);\n const output = new BitMatrix(outputWidth, outputHeight);\n for (let inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {\n // Write the contents of this row of the barcode\n for (let inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {\n if (input.get(inputX, inputY) === 1) {\n output.setRegion(outputX, outputY, multiple, multiple);\n }\n }\n }\n return output;\n }\n }\n QRCodeWriter.QUIET_ZONE_SIZE = 4;\n\n /*import java.util.Map;*/\n /**\n * This is a factory class which finds the appropriate Writer subclass for the BarcodeFormat\n * requested and encodes the barcode with the supplied contents.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\n class MultiFormatWriter {\n /*@Override*/\n // public encode(contents: string,\n // format: BarcodeFormat,\n // width: number /*int*/,\n // height: number /*int*/): BitMatrix /*throws WriterException */ {\n // return encode(contents, format, width, height, null)\n // }\n /*@Override*/\n encode(contents, format, width /*int*/, height /*int*/, hints) {\n let writer;\n switch (format) {\n // case BarcodeFormat.EAN_8:\n // writer = new EAN8Writer()\n // break\n // case BarcodeFormat.UPC_E:\n // writer = new UPCEWriter()\n // break\n // case BarcodeFormat.EAN_13:\n // writer = new EAN13Writer()\n // break\n // case BarcodeFormat.UPC_A:\n // writer = new UPCAWriter()\n // break\n case BarcodeFormat$1.QR_CODE:\n writer = new QRCodeWriter();\n break;\n // case BarcodeFormat.CODE_39:\n // writer = new Code39Writer()\n // break\n // case BarcodeFormat.CODE_93:\n // writer = new Code93Writer()\n // break\n // case BarcodeFormat.CODE_128:\n // writer = new Code128Writer()\n // break\n // case BarcodeFormat.ITF:\n // writer = new ITFWriter()\n // break\n // case BarcodeFormat.PDF_417:\n // writer = new PDF417Writer()\n // break\n // case BarcodeFormat.CODABAR:\n // writer = new CodaBarWriter()\n // break\n // case BarcodeFormat.DATA_MATRIX:\n // writer = new DataMatrixWriter()\n // break\n // case BarcodeFormat.AZTEC:\n // writer = new AztecWriter()\n // break\n default:\n throw new IllegalArgumentException('No encoder available for format ' + format);\n }\n return writer.encode(contents, format, width, height, hints);\n }\n }\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * This object extends LuminanceSource around an array of YUV data returned from the camera driver,\n * with the option to crop to a rectangle within the full data. This can be used to exclude\n * superfluous pixels around the perimeter and speed up decoding.\n *\n * It works for any pixel format where the Y channel is planar and appears first, including\n * YCbCr_420_SP and YCbCr_422_SP.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\n class PlanarYUVLuminanceSource extends LuminanceSource {\n constructor(yuvData, dataWidth /*int*/, dataHeight /*int*/, left /*int*/, top /*int*/, width /*int*/, height /*int*/, reverseHorizontal) {\n super(width, height);\n this.yuvData = yuvData;\n this.dataWidth = dataWidth;\n this.dataHeight = dataHeight;\n this.left = left;\n this.top = top;\n if (left + width > dataWidth || top + height > dataHeight) {\n throw new IllegalArgumentException('Crop rectangle does not fit within image data.');\n }\n if (reverseHorizontal) {\n this.reverseHorizontal(width, height);\n }\n }\n /*@Override*/\n getRow(y /*int*/, row) {\n if (y < 0 || y >= this.getHeight()) {\n throw new IllegalArgumentException('Requested row is outside the image: ' + y);\n }\n const width = this.getWidth();\n if (row === null || row === undefined || row.length < width) {\n row = new Uint8ClampedArray(width);\n }\n const offset = (y + this.top) * this.dataWidth + this.left;\n System.arraycopy(this.yuvData, offset, row, 0, width);\n return row;\n }\n /*@Override*/\n getMatrix() {\n const width = this.getWidth();\n const height = this.getHeight();\n // If the caller asks for the entire underlying image, save the copy and give them the\n // original data. The docs specifically warn that result.length must be ignored.\n if (width === this.dataWidth && height === this.dataHeight) {\n return this.yuvData;\n }\n const area = width * height;\n const matrix = new Uint8ClampedArray(area);\n let inputOffset = this.top * this.dataWidth + this.left;\n // If the width matches the full width of the underlying data, perform a single copy.\n if (width === this.dataWidth) {\n System.arraycopy(this.yuvData, inputOffset, matrix, 0, area);\n return matrix;\n }\n // Otherwise copy one cropped row at a time.\n for (let y = 0; y < height; y++) {\n const outputOffset = y * width;\n System.arraycopy(this.yuvData, inputOffset, matrix, outputOffset, width);\n inputOffset += this.dataWidth;\n }\n return matrix;\n }\n /*@Override*/\n isCropSupported() {\n return true;\n }\n /*@Override*/\n crop(left /*int*/, top /*int*/, width /*int*/, height /*int*/) {\n return new PlanarYUVLuminanceSource(this.yuvData, this.dataWidth, this.dataHeight, this.left + left, this.top + top, width, height, false);\n }\n renderThumbnail() {\n const width = this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n const height = this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n const pixels = new Int32Array(width * height);\n const yuv = this.yuvData;\n let inputOffset = this.top * this.dataWidth + this.left;\n for (let y = 0; y < height; y++) {\n const outputOffset = y * width;\n for (let x = 0; x < width; x++) {\n const grey = yuv[inputOffset + x * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR] & 0xff;\n pixels[outputOffset + x] = 0xFF000000 | (grey * 0x00010101);\n }\n inputOffset += this.dataWidth * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n }\n return pixels;\n }\n /**\n * @return width of image from {@link #renderThumbnail()}\n */\n getThumbnailWidth() {\n return this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n }\n /**\n * @return height of image from {@link #renderThumbnail()}\n */\n getThumbnailHeight() {\n return this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n }\n reverseHorizontal(width /*int*/, height /*int*/) {\n const yuvData = this.yuvData;\n for (let y = 0, rowStart = this.top * this.dataWidth + this.left; y < height; y++, rowStart += this.dataWidth) {\n const middle = rowStart + width / 2;\n for (let x1 = rowStart, x2 = rowStart + width - 1; x1 < middle; x1++, x2--) {\n const temp = yuvData[x1];\n yuvData[x1] = yuvData[x2];\n yuvData[x2] = temp;\n }\n }\n }\n invert() {\n return new InvertedLuminanceSource(this);\n }\n }\n PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR = 2;\n\n /*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * This class is used to help decode images from files which arrive as RGB data from\n * an ARGB pixel array. It does not support rotation.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Betaminos\n */\n class RGBLuminanceSource extends LuminanceSource {\n constructor(luminances, width /*int*/, height /*int*/, dataWidth /*int*/, dataHeight /*int*/, left /*int*/, top /*int*/) {\n super(width, height);\n this.dataWidth = dataWidth;\n this.dataHeight = dataHeight;\n this.left = left;\n this.top = top;\n if (luminances.BYTES_PER_ELEMENT === 4) { // Int32Array\n const size = width * height;\n const luminancesUint8Array = new Uint8ClampedArray(size);\n for (let offset = 0; offset < size; offset++) {\n const pixel = luminances[offset];\n const r = (pixel >> 16) & 0xff; // red\n const g2 = (pixel >> 7) & 0x1fe; // 2 * green\n const b = pixel & 0xff; // blue\n // Calculate green-favouring average cheaply\n luminancesUint8Array[offset] = /*(byte) */ ((r + g2 + b) / 4) & 0xFF;\n }\n this.luminances = luminancesUint8Array;\n }\n else {\n this.luminances = luminances;\n }\n if (undefined === dataWidth) {\n this.dataWidth = width;\n }\n if (undefined === dataHeight) {\n this.dataHeight = height;\n }\n if (undefined === left) {\n this.left = 0;\n }\n if (undefined === top) {\n this.top = 0;\n }\n if (this.left + width > this.dataWidth || this.top + height > this.dataHeight) {\n throw new IllegalArgumentException('Crop rectangle does not fit within image data.');\n }\n }\n /*@Override*/\n getRow(y /*int*/, row) {\n if (y < 0 || y >= this.getHeight()) {\n throw new IllegalArgumentException('Requested row is outside the image: ' + y);\n }\n const width = this.getWidth();\n if (row === null || row === undefined || row.length < width) {\n row = new Uint8ClampedArray(width);\n }\n const offset = (y + this.top) * this.dataWidth + this.left;\n System.arraycopy(this.luminances, offset, row, 0, width);\n return row;\n }\n /*@Override*/\n getMatrix() {\n const width = this.getWidth();\n const height = this.getHeight();\n // If the caller asks for the entire underlying image, save the copy and give them the\n // original data. The docs specifically warn that result.length must be ignored.\n if (width === this.dataWidth && height === this.dataHeight) {\n return this.luminances;\n }\n const area = width * height;\n const matrix = new Uint8ClampedArray(area);\n let inputOffset = this.top * this.dataWidth + this.left;\n // If the width matches the full width of the underlying data, perform a single copy.\n if (width === this.dataWidth) {\n System.arraycopy(this.luminances, inputOffset, matrix, 0, area);\n return matrix;\n }\n // Otherwise copy one cropped row at a time.\n for (let y = 0; y < height; y++) {\n const outputOffset = y * width;\n System.arraycopy(this.luminances, inputOffset, matrix, outputOffset, width);\n inputOffset += this.dataWidth;\n }\n return matrix;\n }\n /*@Override*/\n isCropSupported() {\n return true;\n }\n /*@Override*/\n crop(left /*int*/, top /*int*/, width /*int*/, height /*int*/) {\n return new RGBLuminanceSource(this.luminances, width, height, this.dataWidth, this.dataHeight, this.left + left, this.top + top);\n }\n invert() {\n return new InvertedLuminanceSource(this);\n }\n }\n\n /**\n * Just to make a shortcut between Java code and TS code.\n */\n class Charset extends CharacterSetECI {\n static forName(name) {\n return this.getCharacterSetECIByName(name);\n }\n }\n\n /**\n * Just to make a shortcut between Java code and TS code.\n */\n class StandardCharsets {\n }\n StandardCharsets.ISO_8859_1 = CharacterSetECI.ISO8859_1;\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * Aztec 2D code representation\n *\n * @author Rustam Abdullaev\n */\n /*public final*/ class AztecCode {\n /**\n * @return {@code true} if compact instead of full mode\n */\n isCompact() {\n return this.compact;\n }\n setCompact(compact) {\n this.compact = compact;\n }\n /**\n * @return size in pixels (width and height)\n */\n getSize() {\n return this.size;\n }\n setSize(size) {\n this.size = size;\n }\n /**\n * @return number of levels\n */\n getLayers() {\n return this.layers;\n }\n setLayers(layers) {\n this.layers = layers;\n }\n /**\n * @return number of data codewords\n */\n getCodeWords() {\n return this.codeWords;\n }\n setCodeWords(codeWords) {\n this.codeWords = codeWords;\n }\n /**\n * @return the symbol image\n */\n getMatrix() {\n return this.matrix;\n }\n setMatrix(matrix) {\n this.matrix = matrix;\n }\n }\n\n class Collections {\n /**\n * The singletonList(T) method is used to return an immutable list containing only the specified object.\n */\n static singletonList(item) {\n return [item];\n }\n /**\n * The min(Collection extends T>, Comparator super T>) method is used to return the minimum element of the given collection, according to the order induced by the specified comparator.\n */\n static min(collection, comparator) {\n return collection.sort(comparator)[0];\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n class Token {\n constructor(previous) {\n this.previous = previous;\n }\n getPrevious() {\n return this.previous;\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /*final*/ class SimpleToken extends Token {\n constructor(previous, value, bitCount) {\n super(previous);\n this.value = value;\n this.bitCount = bitCount;\n }\n /**\n * @Override\n */\n appendTo(bitArray, text) {\n bitArray.appendBits(this.value, this.bitCount);\n }\n add(value, bitCount) {\n return new SimpleToken(this, value, bitCount);\n }\n addBinaryShift(start, byteCount) {\n // no-op can't binary shift a simple token\n console.warn('addBinaryShift on SimpleToken, this simply returns a copy of this token');\n return new SimpleToken(this, start, byteCount);\n }\n /**\n * @Override\n */\n toString() {\n let value = this.value & ((1 << this.bitCount) - 1);\n value |= 1 << this.bitCount;\n return '<' + Integer.toBinaryString(value | (1 << this.bitCount)).substring(1) + '>';\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /*final*/ class BinaryShiftToken extends SimpleToken {\n constructor(previous, binaryShiftStart, binaryShiftByteCount) {\n super(previous, 0, 0);\n this.binaryShiftStart = binaryShiftStart;\n this.binaryShiftByteCount = binaryShiftByteCount;\n }\n /**\n * @Override\n */\n appendTo(bitArray, text) {\n for (let i = 0; i < this.binaryShiftByteCount; i++) {\n if (i === 0 || (i === 31 && this.binaryShiftByteCount <= 62)) {\n // We need a header before the first character, and before\n // character 31 when the total byte code is <= 62\n bitArray.appendBits(31, 5); // BINARY_SHIFT\n if (this.binaryShiftByteCount > 62) {\n bitArray.appendBits(this.binaryShiftByteCount - 31, 16);\n }\n else if (i === 0) {\n // 1 <= binaryShiftByteCode <= 62\n bitArray.appendBits(Math.min(this.binaryShiftByteCount, 31), 5);\n }\n else {\n // 32 <= binaryShiftCount <= 62 and i == 31\n bitArray.appendBits(this.binaryShiftByteCount - 31, 5);\n }\n }\n bitArray.appendBits(text[this.binaryShiftStart + i], 8);\n }\n }\n addBinaryShift(start, byteCount) {\n // int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);\n return new BinaryShiftToken(this, start, byteCount);\n }\n /**\n * @Override\n */\n toString() {\n return '<' + this.binaryShiftStart + '::' + (this.binaryShiftStart + this.binaryShiftByteCount - 1) + '>';\n }\n }\n\n function addBinaryShift(token, start, byteCount) {\n // int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);\n return new BinaryShiftToken(token, start, byteCount);\n }\n function add(token, value, bitCount) {\n return new SimpleToken(token, value, bitCount);\n }\n\n const /*final*/ MODE_NAMES = [\n 'UPPER',\n 'LOWER',\n 'DIGIT',\n 'MIXED',\n 'PUNCT'\n ];\n const /*final*/ MODE_UPPER = 0; // 5 bits\n const /*final*/ MODE_LOWER = 1; // 5 bits\n const /*final*/ MODE_DIGIT = 2; // 4 bits\n const /*final*/ MODE_MIXED = 3; // 5 bits\n const /*final*/ MODE_PUNCT = 4; // 5 bits\n const EMPTY_TOKEN = new SimpleToken(null, 0, 0);\n\n // The Latch Table shows, for each pair of Modes, the optimal method for\n // getting from one mode to another. In the worst possible case, this can\n // be up to 14 bits. In the best possible case, we are already there!\n // The high half-word of each entry gives the number of bits.\n // The low half-word of each entry are the actual bits necessary to change\n const LATCH_TABLE = [\n Int32Array.from([\n 0,\n (5 << 16) + 28,\n (5 << 16) + 30,\n (5 << 16) + 29,\n (10 << 16) + (29 << 5) + 30 // UPPER -> MIXED -> PUNCT\n ]),\n Int32Array.from([\n (9 << 16) + (30 << 4) + 14,\n 0,\n (5 << 16) + 30,\n (5 << 16) + 29,\n (10 << 16) + (29 << 5) + 30 // LOWER -> MIXED -> PUNCT\n ]),\n Int32Array.from([\n (4 << 16) + 14,\n (9 << 16) + (14 << 5) + 28,\n 0,\n (9 << 16) + (14 << 5) + 29,\n (14 << 16) + (14 << 10) + (29 << 5) + 30\n // DIGIT -> UPPER -> MIXED -> PUNCT\n ]),\n Int32Array.from([\n (5 << 16) + 29,\n (5 << 16) + 28,\n (10 << 16) + (29 << 5) + 30,\n 0,\n (5 << 16) + 30 // MIXED -> PUNCT\n ]),\n Int32Array.from([\n (5 << 16) + 31,\n (10 << 16) + (31 << 5) + 28,\n (10 << 16) + (31 << 5) + 30,\n (10 << 16) + (31 << 5) + 29,\n 0\n ])\n ];\n\n function static_SHIFT_TABLE(SHIFT_TABLE) {\n for (let table /*Int32Array*/ of SHIFT_TABLE) {\n Arrays.fill(table, -1);\n }\n SHIFT_TABLE[MODE_UPPER][MODE_PUNCT] = 0;\n SHIFT_TABLE[MODE_LOWER][MODE_PUNCT] = 0;\n SHIFT_TABLE[MODE_LOWER][MODE_UPPER] = 28;\n SHIFT_TABLE[MODE_MIXED][MODE_PUNCT] = 0;\n SHIFT_TABLE[MODE_DIGIT][MODE_PUNCT] = 0;\n SHIFT_TABLE[MODE_DIGIT][MODE_UPPER] = 15;\n return SHIFT_TABLE;\n }\n const /*final*/ SHIFT_TABLE = static_SHIFT_TABLE(Arrays.createInt32Array(6, 6)); // mode shift codes, per table\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * State represents all information about a sequence necessary to generate the current output.\n * Note that a state is immutable.\n */\n /*final*/ class State {\n constructor(token, mode, binaryBytes, bitCount) {\n this.token = token;\n this.mode = mode;\n this.binaryShiftByteCount = binaryBytes;\n this.bitCount = bitCount;\n // Make sure we match the token\n // int binaryShiftBitCount = (binaryShiftByteCount * 8) +\n // (binaryShiftByteCount === 0 ? 0 :\n // binaryShiftByteCount <= 31 ? 10 :\n // binaryShiftByteCount <= 62 ? 20 : 21);\n // assert this.bitCount === token.getTotalBitCount() + binaryShiftBitCount;\n }\n getMode() {\n return this.mode;\n }\n getToken() {\n return this.token;\n }\n getBinaryShiftByteCount() {\n return this.binaryShiftByteCount;\n }\n getBitCount() {\n return this.bitCount;\n }\n // Create a new state representing this state with a latch to a (not\n // necessary different) mode, and then a code.\n latchAndAppend(mode, value) {\n // assert binaryShiftByteCount === 0;\n let bitCount = this.bitCount;\n let token = this.token;\n if (mode !== this.mode) {\n let latch = LATCH_TABLE[this.mode][mode];\n token = add(token, latch & 0xffff, latch >> 16);\n bitCount += latch >> 16;\n }\n let latchModeBitCount = mode === MODE_DIGIT ? 4 : 5;\n token = add(token, value, latchModeBitCount);\n return new State(token, mode, 0, bitCount + latchModeBitCount);\n }\n // Create a new state representing this state, with a temporary shift\n // to a different mode to output a single value.\n shiftAndAppend(mode, value) {\n // assert binaryShiftByteCount === 0 && this.mode !== mode;\n let token = this.token;\n let thisModeBitCount = this.mode === MODE_DIGIT ? 4 : 5;\n // Shifts exist only to UPPER and PUNCT, both with tokens size 5.\n token = add(token, SHIFT_TABLE[this.mode][mode], thisModeBitCount);\n token = add(token, value, 5);\n return new State(token, this.mode, 0, this.bitCount + thisModeBitCount + 5);\n }\n // Create a new state representing this state, but an additional character\n // output in Binary Shift mode.\n addBinaryShiftChar(index) {\n let token = this.token;\n let mode = this.mode;\n let bitCount = this.bitCount;\n if (this.mode === MODE_PUNCT || this.mode === MODE_DIGIT) {\n // assert binaryShiftByteCount === 0;\n let latch = LATCH_TABLE[mode][MODE_UPPER];\n token = add(token, latch & 0xffff, latch >> 16);\n bitCount += latch >> 16;\n mode = MODE_UPPER;\n }\n let deltaBitCount = this.binaryShiftByteCount === 0 || this.binaryShiftByteCount === 31\n ? 18\n : this.binaryShiftByteCount === 62\n ? 9\n : 8;\n let result = new State(token, mode, this.binaryShiftByteCount + 1, bitCount + deltaBitCount);\n if (result.binaryShiftByteCount === 2047 + 31) {\n // The string is as long as it's allowed to be. We should end it.\n result = result.endBinaryShift(index + 1);\n }\n return result;\n }\n // Create the state identical to this one, but we are no longer in\n // Binary Shift mode.\n endBinaryShift(index) {\n if (this.binaryShiftByteCount === 0) {\n return this;\n }\n let token = this.token;\n token = addBinaryShift(token, index - this.binaryShiftByteCount, this.binaryShiftByteCount);\n // assert token.getTotalBitCount() === this.bitCount;\n return new State(token, this.mode, 0, this.bitCount);\n }\n // Returns true if \"this\" state is better (equal: or) to be in than \"that\"\n // state under all possible circumstances.\n isBetterThanOrEqualTo(other) {\n let newModeBitCount = this.bitCount + (LATCH_TABLE[this.mode][other.mode] >> 16);\n if (this.binaryShiftByteCount < other.binaryShiftByteCount) {\n // add additional B/S encoding cost of other, if any\n newModeBitCount +=\n State.calculateBinaryShiftCost(other) -\n State.calculateBinaryShiftCost(this);\n }\n else if (this.binaryShiftByteCount > other.binaryShiftByteCount &&\n other.binaryShiftByteCount > 0) {\n // maximum possible additional cost (it: h)\n newModeBitCount += 10;\n }\n return newModeBitCount <= other.bitCount;\n }\n toBitArray(text) {\n // Reverse the tokens, so that they are in the order that they should\n // be output\n let symbols = [];\n for (let token = this.endBinaryShift(text.length).token; token !== null; token = token.getPrevious()) {\n symbols.unshift(token);\n }\n let bitArray = new BitArray();\n // Add each token to the result.\n for (const symbol of symbols) {\n symbol.appendTo(bitArray, text);\n }\n // assert bitArray.getSize() === this.bitCount;\n return bitArray;\n }\n /**\n * @Override\n */\n toString() {\n return StringUtils.format('%s bits=%d bytes=%d', MODE_NAMES[this.mode], this.bitCount, this.binaryShiftByteCount);\n }\n static calculateBinaryShiftCost(state) {\n if (state.binaryShiftByteCount > 62) {\n return 21; // B/S with extended length\n }\n if (state.binaryShiftByteCount > 31) {\n return 20; // two B/S\n }\n if (state.binaryShiftByteCount > 0) {\n return 10; // one B/S\n }\n return 0;\n }\n }\n State.INITIAL_STATE = new State(EMPTY_TOKEN, MODE_UPPER, 0, 0);\n\n function static_CHAR_MAP(CHAR_MAP) {\n const spaceCharCode = StringUtils.getCharCode(' ');\n const pointCharCode = StringUtils.getCharCode('.');\n const commaCharCode = StringUtils.getCharCode(',');\n CHAR_MAP[MODE_UPPER][spaceCharCode] = 1;\n const zUpperCharCode = StringUtils.getCharCode('Z');\n const aUpperCharCode = StringUtils.getCharCode('A');\n for (let c = aUpperCharCode; c <= zUpperCharCode; c++) {\n CHAR_MAP[MODE_UPPER][c] = c - aUpperCharCode + 2;\n }\n CHAR_MAP[MODE_LOWER][spaceCharCode] = 1;\n const zLowerCharCode = StringUtils.getCharCode('z');\n const aLowerCharCode = StringUtils.getCharCode('a');\n for (let c = aLowerCharCode; c <= zLowerCharCode; c++) {\n CHAR_MAP[MODE_LOWER][c] = c - aLowerCharCode + 2;\n }\n CHAR_MAP[MODE_DIGIT][spaceCharCode] = 1;\n const nineCharCode = StringUtils.getCharCode('9');\n const zeroCharCode = StringUtils.getCharCode('0');\n for (let c = zeroCharCode; c <= nineCharCode; c++) {\n CHAR_MAP[MODE_DIGIT][c] = c - zeroCharCode + 2;\n }\n CHAR_MAP[MODE_DIGIT][commaCharCode] = 12;\n CHAR_MAP[MODE_DIGIT][pointCharCode] = 13;\n const mixedTable = [\n '\\x00',\n ' ',\n '\\x01',\n '\\x02',\n '\\x03',\n '\\x04',\n '\\x05',\n '\\x06',\n '\\x07',\n '\\b',\n '\\t',\n '\\n',\n '\\x0b',\n '\\f',\n '\\r',\n '\\x1b',\n '\\x1c',\n '\\x1d',\n '\\x1e',\n '\\x1f',\n '@',\n '\\\\',\n '^',\n '_',\n '`',\n '|',\n '~',\n '\\x7f'\n ];\n for (let i = 0; i < mixedTable.length; i++) {\n CHAR_MAP[MODE_MIXED][StringUtils.getCharCode(mixedTable[i])] = i;\n }\n const punctTable = [\n '\\x00',\n '\\r',\n '\\x00',\n '\\x00',\n '\\x00',\n '\\x00',\n '!',\n '\\'',\n '#',\n '$',\n '%',\n '&',\n '\\'',\n '(',\n ')',\n '*',\n '+',\n ',',\n '-',\n '.',\n '/',\n ':',\n ';',\n '<',\n '=',\n '>',\n '?',\n '[',\n ']',\n '{',\n '}'\n ];\n for (let i = 0; i < punctTable.length; i++) {\n if (StringUtils.getCharCode(punctTable[i]) > 0) {\n CHAR_MAP[MODE_PUNCT][StringUtils.getCharCode(punctTable[i])] = i;\n }\n }\n return CHAR_MAP;\n }\n const CHAR_MAP = static_CHAR_MAP(Arrays.createInt32Array(5, 256));\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * This produces nearly optimal encodings of text into the first-level of\n * encoding used by Aztec code.\n *\n * It uses a dynamic algorithm. For each prefix of the string, it determines\n * a set of encodings that could lead to this prefix. We repeatedly add a\n * character and generate a new set of optimal encodings until we have read\n * through the entire input.\n *\n * @author Frank Yellin\n * @author Rustam Abdullaev\n */\n /*public final*/ class HighLevelEncoder {\n constructor(text) {\n this.text = text;\n }\n /**\n * @return text represented by this encoder encoded as a {@link BitArray}\n */\n encode() {\n const spaceCharCode = StringUtils.getCharCode(' ');\n const lineBreakCharCode = StringUtils.getCharCode('\\n');\n let states = Collections.singletonList(State.INITIAL_STATE);\n for (let index = 0; index < this.text.length; index++) {\n let pairCode;\n let nextChar = index + 1 < this.text.length ? this.text[index + 1] : 0;\n switch (this.text[index]) {\n case StringUtils.getCharCode('\\r'):\n pairCode = nextChar === lineBreakCharCode ? 2 : 0;\n break;\n case StringUtils.getCharCode('.'):\n pairCode = nextChar === spaceCharCode ? 3 : 0;\n break;\n case StringUtils.getCharCode(','):\n pairCode = nextChar === spaceCharCode ? 4 : 0;\n break;\n case StringUtils.getCharCode(':'):\n pairCode = nextChar === spaceCharCode ? 5 : 0;\n break;\n default:\n pairCode = 0;\n }\n if (pairCode > 0) {\n // We have one of the four special PUNCT pairs. Treat them specially.\n // Get a new set of states for the two new characters.\n states = HighLevelEncoder.updateStateListForPair(states, index, pairCode);\n index++;\n }\n else {\n // Get a new set of states for the new character.\n states = this.updateStateListForChar(states, index);\n }\n }\n // We are left with a set of states. Find the shortest one.\n const minState = Collections.min(states, (a, b) => {\n return a.getBitCount() - b.getBitCount();\n });\n // Convert it to a bit array, and return.\n return minState.toBitArray(this.text);\n }\n // We update a set of states for a new character by updating each state\n // for the new character, merging the results, and then removing the\n // non-optimal states.\n updateStateListForChar(states, index) {\n const result = [];\n for (let state /*State*/ of states) {\n this.updateStateForChar(state, index, result);\n }\n return HighLevelEncoder.simplifyStates(result);\n }\n // Return a set of states that represent the possible ways of updating this\n // state for the next character. The resulting set of states are added to\n // the \"result\" list.\n updateStateForChar(state, index, result) {\n let ch = (this.text[index] & 0xff);\n let charInCurrentTable = CHAR_MAP[state.getMode()][ch] > 0;\n let stateNoBinary = null;\n for (let mode /*int*/ = 0; mode <= MODE_PUNCT; mode++) {\n let charInMode = CHAR_MAP[mode][ch];\n if (charInMode > 0) {\n if (stateNoBinary == null) {\n // Only create stateNoBinary the first time it's required.\n stateNoBinary = state.endBinaryShift(index);\n }\n // Try generating the character by latching to its mode\n if (!charInCurrentTable ||\n mode === state.getMode() ||\n mode === MODE_DIGIT) {\n // If the character is in the current table, we don't want to latch to\n // any other mode except possibly digit (which uses only 4 bits). Any\n // other latch would be equally successful *after* this character, and\n // so wouldn't save any bits.\n const latchState = stateNoBinary.latchAndAppend(mode, charInMode);\n result.push(latchState);\n }\n // Try generating the character by switching to its mode.\n if (!charInCurrentTable &&\n SHIFT_TABLE[state.getMode()][mode] >= 0) {\n // It never makes sense to temporarily shift to another mode if the\n // character exists in the current mode. That can never save bits.\n const shiftState = stateNoBinary.shiftAndAppend(mode, charInMode);\n result.push(shiftState);\n }\n }\n }\n if (state.getBinaryShiftByteCount() > 0 ||\n CHAR_MAP[state.getMode()][ch] === 0) {\n // It's never worthwhile to go into binary shift mode if you're not already\n // in binary shift mode, and the character exists in your current mode.\n // That can never save bits over just outputting the char in the current mode.\n let binaryState = state.addBinaryShiftChar(index);\n result.push(binaryState);\n }\n }\n static updateStateListForPair(states, index, pairCode) {\n const result = [];\n for (let state /*State*/ of states) {\n this.updateStateForPair(state, index, pairCode, result);\n }\n return this.simplifyStates(result);\n }\n static updateStateForPair(state, index, pairCode, result) {\n let stateNoBinary = state.endBinaryShift(index);\n // Possibility 1. Latch to C.MODE_PUNCT, and then append this code\n result.push(stateNoBinary.latchAndAppend(MODE_PUNCT, pairCode));\n if (state.getMode() !== MODE_PUNCT) {\n // Possibility 2. Shift to C.MODE_PUNCT, and then append this code.\n // Every state except C.MODE_PUNCT (handled above) can shift\n result.push(stateNoBinary.shiftAndAppend(MODE_PUNCT, pairCode));\n }\n if (pairCode === 3 || pairCode === 4) {\n // both characters are in DIGITS. Sometimes better to just add two digits\n let digitState = stateNoBinary\n .latchAndAppend(MODE_DIGIT, 16 - pairCode) // period or comma in DIGIT\n .latchAndAppend(MODE_DIGIT, 1); // space in DIGIT\n result.push(digitState);\n }\n if (state.getBinaryShiftByteCount() > 0) {\n // It only makes sense to do the characters as binary if we're already\n // in binary mode.\n let binaryState = state\n .addBinaryShiftChar(index)\n .addBinaryShiftChar(index + 1);\n result.push(binaryState);\n }\n }\n static simplifyStates(states) {\n let result = [];\n for (const newState of states) {\n let add = true;\n for (const oldState of result) {\n if (oldState.isBetterThanOrEqualTo(newState)) {\n add = false;\n break;\n }\n if (newState.isBetterThanOrEqualTo(oldState)) {\n // iterator.remove();\n result = result.filter(x => x !== oldState); // remove old state\n }\n }\n if (add) {\n result.push(newState);\n }\n }\n return result;\n }\n }\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n // package com.google.zxing.aztec.encoder;\n // import com.google.zxing.common.BitArray;\n // import com.google.zxing.common.BitMatrix;\n // import com.google.zxing.common.reedsolomon.GenericGF;\n // import com.google.zxing.common.reedsolomon.ReedSolomonEncoder;\n /**\n * Generates Aztec 2D barcodes.\n *\n * @author Rustam Abdullaev\n */\n /*public final*/ class Encoder$1 {\n constructor() {\n }\n /**\n * Encodes the given binary content as an Aztec symbol\n *\n * @param data input data string\n * @return Aztec symbol matrix with metadata\n */\n static encodeBytes(data) {\n return Encoder$1.encode(data, Encoder$1.DEFAULT_EC_PERCENT, Encoder$1.DEFAULT_AZTEC_LAYERS);\n }\n /**\n * Encodes the given binary content as an Aztec symbol\n *\n * @param data input data string\n * @param minECCPercent minimal percentage of error check words (According to ISO/IEC 24778:2008,\n * a minimum of 23% + 3 words is recommended)\n * @param userSpecifiedLayers if non-zero, a user-specified value for the number of layers\n * @return Aztec symbol matrix with metadata\n */\n static encode(data, minECCPercent, userSpecifiedLayers) {\n // High-level encode\n let bits = new HighLevelEncoder(data).encode();\n // stuff bits and choose symbol size\n let eccBits = Integer.truncDivision((bits.getSize() * minECCPercent), 100) + 11;\n let totalSizeBits = bits.getSize() + eccBits;\n let compact;\n let layers;\n let totalBitsInLayer;\n let wordSize;\n let stuffedBits;\n if (userSpecifiedLayers !== Encoder$1.DEFAULT_AZTEC_LAYERS) {\n compact = userSpecifiedLayers < 0;\n layers = Math.abs(userSpecifiedLayers);\n if (layers > (compact ? Encoder$1.MAX_NB_BITS_COMPACT : Encoder$1.MAX_NB_BITS)) {\n throw new IllegalArgumentException(StringUtils.format('Illegal value %s for layers', userSpecifiedLayers));\n }\n totalBitsInLayer = Encoder$1.totalBitsInLayer(layers, compact);\n wordSize = Encoder$1.WORD_SIZE[layers];\n let usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);\n stuffedBits = Encoder$1.stuffBits(bits, wordSize);\n if (stuffedBits.getSize() + eccBits > usableBitsInLayers) {\n throw new IllegalArgumentException('Data to large for user specified layer');\n }\n if (compact && stuffedBits.getSize() > wordSize * 64) {\n // Compact format only allows 64 data words, though C4 can hold more words than that\n throw new IllegalArgumentException('Data to large for user specified layer');\n }\n }\n else {\n wordSize = 0;\n stuffedBits = null;\n // We look at the possible table sizes in the order Compact1, Compact2, Compact3,\n // Compact4, Normal4,... Normal(i) for i < 4 isn't typically used since Compact(i+1)\n // is the same size, but has more data.\n for (let i /*int*/ = 0;; i++) {\n if (i > Encoder$1.MAX_NB_BITS) {\n throw new IllegalArgumentException('Data too large for an Aztec code');\n }\n compact = i <= 3;\n layers = compact ? i + 1 : i;\n totalBitsInLayer = Encoder$1.totalBitsInLayer(layers, compact);\n if (totalSizeBits > totalBitsInLayer) {\n continue;\n }\n // [Re]stuff the bits if this is the first opportunity, or if the\n // wordSize has changed\n if (stuffedBits == null || wordSize !== Encoder$1.WORD_SIZE[layers]) {\n wordSize = Encoder$1.WORD_SIZE[layers];\n stuffedBits = Encoder$1.stuffBits(bits, wordSize);\n }\n let usableBitsInLayers = totalBitsInLayer - (totalBitsInLayer % wordSize);\n if (compact && stuffedBits.getSize() > wordSize * 64) {\n // Compact format only allows 64 data words, though C4 can hold more words than that\n continue;\n }\n if (stuffedBits.getSize() + eccBits <= usableBitsInLayers) {\n break;\n }\n }\n }\n let messageBits = Encoder$1.generateCheckWords(stuffedBits, totalBitsInLayer, wordSize);\n // generate mode message\n let messageSizeInWords = stuffedBits.getSize() / wordSize;\n let modeMessage = Encoder$1.generateModeMessage(compact, layers, messageSizeInWords);\n // allocate symbol\n let baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines\n let alignmentMap = new Int32Array(baseMatrixSize);\n let matrixSize;\n if (compact) {\n // no alignment marks in compact mode, alignmentMap is a no-op\n matrixSize = baseMatrixSize;\n for (let i /*int*/ = 0; i < alignmentMap.length; i++) {\n alignmentMap[i] = i;\n }\n }\n else {\n matrixSize = baseMatrixSize + 1 + 2 * Integer.truncDivision((Integer.truncDivision(baseMatrixSize, 2) - 1), 15);\n let origCenter = Integer.truncDivision(baseMatrixSize, 2);\n let center = Integer.truncDivision(matrixSize, 2);\n for (let i /*int*/ = 0; i < origCenter; i++) {\n let newOffset = i + Integer.truncDivision(i, 15);\n alignmentMap[origCenter - i - 1] = center - newOffset - 1;\n alignmentMap[origCenter + i] = center + newOffset + 1;\n }\n }\n let matrix = new BitMatrix(matrixSize);\n // draw data bits\n for (let i /*int*/ = 0, rowOffset = 0; i < layers; i++) {\n let rowSize = (layers - i) * 4 + (compact ? 9 : 12);\n for (let j /*int*/ = 0; j < rowSize; j++) {\n let columnOffset = j * 2;\n for (let k /*int*/ = 0; k < 2; k++) {\n if (messageBits.get(rowOffset + columnOffset + k)) {\n matrix.set(alignmentMap[i * 2 + k], alignmentMap[i * 2 + j]);\n }\n if (messageBits.get(rowOffset + rowSize * 2 + columnOffset + k)) {\n matrix.set(alignmentMap[i * 2 + j], alignmentMap[baseMatrixSize - 1 - i * 2 - k]);\n }\n if (messageBits.get(rowOffset + rowSize * 4 + columnOffset + k)) {\n matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - k], alignmentMap[baseMatrixSize - 1 - i * 2 - j]);\n }\n if (messageBits.get(rowOffset + rowSize * 6 + columnOffset + k)) {\n matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - j], alignmentMap[i * 2 + k]);\n }\n }\n }\n rowOffset += rowSize * 8;\n }\n // draw mode message\n Encoder$1.drawModeMessage(matrix, compact, matrixSize, modeMessage);\n // draw alignment marks\n if (compact) {\n Encoder$1.drawBullsEye(matrix, Integer.truncDivision(matrixSize, 2), 5);\n }\n else {\n Encoder$1.drawBullsEye(matrix, Integer.truncDivision(matrixSize, 2), 7);\n for (let i /*int*/ = 0, j = 0; i < Integer.truncDivision(baseMatrixSize, 2) - 1; i += 15, j += 16) {\n for (let k /*int*/ = Integer.truncDivision(matrixSize, 2) & 1; k < matrixSize; k += 2) {\n matrix.set(Integer.truncDivision(matrixSize, 2) - j, k);\n matrix.set(Integer.truncDivision(matrixSize, 2) + j, k);\n matrix.set(k, Integer.truncDivision(matrixSize, 2) - j);\n matrix.set(k, Integer.truncDivision(matrixSize, 2) + j);\n }\n }\n }\n let aztec = new AztecCode();\n aztec.setCompact(compact);\n aztec.setSize(matrixSize);\n aztec.setLayers(layers);\n aztec.setCodeWords(messageSizeInWords);\n aztec.setMatrix(matrix);\n return aztec;\n }\n static drawBullsEye(matrix, center, size) {\n for (let i /*int*/ = 0; i < size; i += 2) {\n for (let j /*int*/ = center - i; j <= center + i; j++) {\n matrix.set(j, center - i);\n matrix.set(j, center + i);\n matrix.set(center - i, j);\n matrix.set(center + i, j);\n }\n }\n matrix.set(center - size, center - size);\n matrix.set(center - size + 1, center - size);\n matrix.set(center - size, center - size + 1);\n matrix.set(center + size, center - size);\n matrix.set(center + size, center - size + 1);\n matrix.set(center + size, center + size - 1);\n }\n static generateModeMessage(compact, layers, messageSizeInWords) {\n let modeMessage = new BitArray();\n if (compact) {\n modeMessage.appendBits(layers - 1, 2);\n modeMessage.appendBits(messageSizeInWords - 1, 6);\n modeMessage = Encoder$1.generateCheckWords(modeMessage, 28, 4);\n }\n else {\n modeMessage.appendBits(layers - 1, 5);\n modeMessage.appendBits(messageSizeInWords - 1, 11);\n modeMessage = Encoder$1.generateCheckWords(modeMessage, 40, 4);\n }\n return modeMessage;\n }\n static drawModeMessage(matrix, compact, matrixSize, modeMessage) {\n let center = Integer.truncDivision(matrixSize, 2);\n if (compact) {\n for (let i /*int*/ = 0; i < 7; i++) {\n let offset = center - 3 + i;\n if (modeMessage.get(i)) {\n matrix.set(offset, center - 5);\n }\n if (modeMessage.get(i + 7)) {\n matrix.set(center + 5, offset);\n }\n if (modeMessage.get(20 - i)) {\n matrix.set(offset, center + 5);\n }\n if (modeMessage.get(27 - i)) {\n matrix.set(center - 5, offset);\n }\n }\n }\n else {\n for (let i /*int*/ = 0; i < 10; i++) {\n let offset = center - 5 + i + Integer.truncDivision(i, 5);\n if (modeMessage.get(i)) {\n matrix.set(offset, center - 7);\n }\n if (modeMessage.get(i + 10)) {\n matrix.set(center + 7, offset);\n }\n if (modeMessage.get(29 - i)) {\n matrix.set(offset, center + 7);\n }\n if (modeMessage.get(39 - i)) {\n matrix.set(center - 7, offset);\n }\n }\n }\n }\n static generateCheckWords(bitArray, totalBits, wordSize) {\n // bitArray is guaranteed to be a multiple of the wordSize, so no padding needed\n let messageSizeInWords = bitArray.getSize() / wordSize;\n let rs = new ReedSolomonEncoder(Encoder$1.getGF(wordSize));\n let totalWords = Integer.truncDivision(totalBits, wordSize);\n let messageWords = Encoder$1.bitsToWords(bitArray, wordSize, totalWords);\n rs.encode(messageWords, totalWords - messageSizeInWords);\n let startPad = totalBits % wordSize;\n let messageBits = new BitArray();\n messageBits.appendBits(0, startPad);\n for (const messageWord /*: int*/ of Array.from(messageWords)) {\n messageBits.appendBits(messageWord, wordSize);\n }\n return messageBits;\n }\n static bitsToWords(stuffedBits, wordSize, totalWords) {\n let message = new Int32Array(totalWords);\n let i;\n let n;\n for (i = 0, n = stuffedBits.getSize() / wordSize; i < n; i++) {\n let value = 0;\n for (let j /*int*/ = 0; j < wordSize; j++) {\n value |= stuffedBits.get(i * wordSize + j) ? (1 << wordSize - j - 1) : 0;\n }\n message[i] = value;\n }\n return message;\n }\n static getGF(wordSize) {\n switch (wordSize) {\n case 4:\n return GenericGF.AZTEC_PARAM;\n case 6:\n return GenericGF.AZTEC_DATA_6;\n case 8:\n return GenericGF.AZTEC_DATA_8;\n case 10:\n return GenericGF.AZTEC_DATA_10;\n case 12:\n return GenericGF.AZTEC_DATA_12;\n default:\n throw new IllegalArgumentException('Unsupported word size ' + wordSize);\n }\n }\n static stuffBits(bits, wordSize) {\n let out = new BitArray();\n let n = bits.getSize();\n let mask = (1 << wordSize) - 2;\n for (let i /*int*/ = 0; i < n; i += wordSize) {\n let word = 0;\n for (let j /*int*/ = 0; j < wordSize; j++) {\n if (i + j >= n || bits.get(i + j)) {\n word |= 1 << (wordSize - 1 - j);\n }\n }\n if ((word & mask) === mask) {\n out.appendBits(word & mask, wordSize);\n i--;\n }\n else if ((word & mask) === 0) {\n out.appendBits(word | 1, wordSize);\n i--;\n }\n else {\n out.appendBits(word, wordSize);\n }\n }\n return out;\n }\n static totalBitsInLayer(layers, compact) {\n return ((compact ? 88 : 112) + 16 * layers) * layers;\n }\n }\n Encoder$1.DEFAULT_EC_PERCENT = 33; // default minimal percentage of error check words\n Encoder$1.DEFAULT_AZTEC_LAYERS = 0;\n Encoder$1.MAX_NB_BITS = 32;\n Encoder$1.MAX_NB_BITS_COMPACT = 4;\n Encoder$1.WORD_SIZE = Int32Array.from([\n 4, 6, 6, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,\n 12, 12, 12, 12, 12, 12, 12, 12, 12, 12\n ]);\n\n /*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n /**\n * Renders an Aztec code as a {@link BitMatrix}.\n */\n /*public final*/ class AztecWriter {\n // @Override\n encode(contents, format, width, height) {\n return this.encodeWithHints(contents, format, width, height, null);\n }\n // @Override\n encodeWithHints(contents, format, width, height, hints) {\n let charset = StandardCharsets.ISO_8859_1;\n let eccPercent = Encoder$1.DEFAULT_EC_PERCENT;\n let layers = Encoder$1.DEFAULT_AZTEC_LAYERS;\n if (hints != null) {\n if (hints.has(EncodeHintType$1.CHARACTER_SET)) {\n charset = Charset.forName(hints.get(EncodeHintType$1.CHARACTER_SET).toString());\n }\n if (hints.has(EncodeHintType$1.ERROR_CORRECTION)) {\n eccPercent = Integer.parseInt(hints.get(EncodeHintType$1.ERROR_CORRECTION).toString());\n }\n if (hints.has(EncodeHintType$1.AZTEC_LAYERS)) {\n layers = Integer.parseInt(hints.get(EncodeHintType$1.AZTEC_LAYERS).toString());\n }\n }\n return AztecWriter.encodeLayers(contents, format, width, height, charset, eccPercent, layers);\n }\n static encodeLayers(contents, format, width, height, charset, eccPercent, layers) {\n if (format !== BarcodeFormat$1.AZTEC) {\n throw new IllegalArgumentException('Can only encode AZTEC, but got ' + format);\n }\n let aztec = Encoder$1.encode(StringUtils.getBytes(contents, charset), eccPercent, layers);\n return AztecWriter.renderResult(aztec, width, height);\n }\n static renderResult(code, width, height) {\n let input = code.getMatrix();\n if (input == null) {\n throw new IllegalStateException();\n }\n let inputWidth = input.getWidth();\n let inputHeight = input.getHeight();\n let outputWidth = Math.max(width, inputWidth);\n let outputHeight = Math.max(height, inputHeight);\n let multiple = Math.min(outputWidth / inputWidth, outputHeight / inputHeight);\n let leftPadding = (outputWidth - (inputWidth * multiple)) / 2;\n let topPadding = (outputHeight - (inputHeight * multiple)) / 2;\n let output = new BitMatrix(outputWidth, outputHeight);\n for (let inputY /*int*/ = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {\n // Write the contents of this row of the barcode\n for (let inputX /*int*/ = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {\n if (input.get(inputX, inputY)) {\n output.setRegion(outputX, outputY, multiple, multiple);\n }\n }\n }\n return output;\n }\n }\n\n exports.AbstractExpandedDecoder = AbstractExpandedDecoder;\n exports.ArgumentException = ArgumentException;\n exports.ArithmeticException = ArithmeticException;\n exports.AztecCode = AztecCode;\n exports.AztecCodeReader = AztecReader;\n exports.AztecCodeWriter = AztecWriter;\n exports.AztecDecoder = Decoder;\n exports.AztecDetector = Detector;\n exports.AztecDetectorResult = AztecDetectorResult;\n exports.AztecEncoder = Encoder$1;\n exports.AztecHighLevelEncoder = HighLevelEncoder;\n exports.AztecPoint = Point;\n exports.BarcodeFormat = BarcodeFormat$1;\n exports.Binarizer = Binarizer;\n exports.BinaryBitmap = BinaryBitmap;\n exports.BitArray = BitArray;\n exports.BitMatrix = BitMatrix;\n exports.BitSource = BitSource;\n exports.BrowserAztecCodeReader = BrowserAztecCodeReader;\n exports.BrowserBarcodeReader = BrowserBarcodeReader;\n exports.BrowserCodeReader = BrowserCodeReader;\n exports.BrowserDatamatrixCodeReader = BrowserDatamatrixCodeReader;\n exports.BrowserMultiFormatReader = BrowserMultiFormatReader;\n exports.BrowserPDF417Reader = BrowserPDF417Reader;\n exports.BrowserQRCodeReader = BrowserQRCodeReader;\n exports.BrowserQRCodeSvgWriter = BrowserQRCodeSvgWriter;\n exports.CharacterSetECI = CharacterSetECI;\n exports.ChecksumException = ChecksumException;\n exports.Code128Reader = Code128Reader;\n exports.Code39Reader = Code39Reader;\n exports.DataMatrixDecodedBitStreamParser = DecodedBitStreamParser;\n exports.DataMatrixReader = DataMatrixReader;\n exports.DecodeHintType = DecodeHintType$1;\n exports.DecoderResult = DecoderResult;\n exports.DefaultGridSampler = DefaultGridSampler;\n exports.DetectorResult = DetectorResult;\n exports.EAN13Reader = EAN13Reader;\n exports.EncodeHintType = EncodeHintType$1;\n exports.Exception = Exception;\n exports.FormatException = FormatException;\n exports.GenericGF = GenericGF;\n exports.GenericGFPoly = GenericGFPoly;\n exports.GlobalHistogramBinarizer = GlobalHistogramBinarizer;\n exports.GridSampler = GridSampler;\n exports.GridSamplerInstance = GridSamplerInstance;\n exports.HTMLCanvasElementLuminanceSource = HTMLCanvasElementLuminanceSource;\n exports.HybridBinarizer = HybridBinarizer;\n exports.ITFReader = ITFReader;\n exports.IllegalArgumentException = IllegalArgumentException;\n exports.IllegalStateException = IllegalStateException;\n exports.InvertedLuminanceSource = InvertedLuminanceSource;\n exports.LuminanceSource = LuminanceSource;\n exports.MathUtils = MathUtils;\n exports.MultiFormatOneDReader = MultiFormatOneDReader;\n exports.MultiFormatReader = MultiFormatReader;\n exports.MultiFormatWriter = MultiFormatWriter;\n exports.NotFoundException = NotFoundException;\n exports.OneDReader = OneDReader;\n exports.PDF417DecodedBitStreamParser = DecodedBitStreamParser$2;\n exports.PDF417DecoderErrorCorrection = ErrorCorrection;\n exports.PDF417Reader = PDF417Reader;\n exports.PDF417ResultMetadata = PDF417ResultMetadata;\n exports.PerspectiveTransform = PerspectiveTransform;\n exports.PlanarYUVLuminanceSource = PlanarYUVLuminanceSource;\n exports.QRCodeByteMatrix = ByteMatrix;\n exports.QRCodeDataMask = DataMask;\n exports.QRCodeDecodedBitStreamParser = DecodedBitStreamParser$1;\n exports.QRCodeDecoderErrorCorrectionLevel = ErrorCorrectionLevel;\n exports.QRCodeDecoderFormatInformation = FormatInformation;\n exports.QRCodeEncoder = Encoder;\n exports.QRCodeEncoderQRCode = QRCode;\n exports.QRCodeMaskUtil = MaskUtil;\n exports.QRCodeMatrixUtil = MatrixUtil;\n exports.QRCodeMode = Mode$1;\n exports.QRCodeReader = QRCodeReader;\n exports.QRCodeVersion = Version$1;\n exports.QRCodeWriter = QRCodeWriter;\n exports.RGBLuminanceSource = RGBLuminanceSource;\n exports.RSS14Reader = RSS14Reader;\n exports.RSSExpandedReader = RSSExpandedReader;\n exports.ReaderException = ReaderException;\n exports.ReedSolomonDecoder = ReedSolomonDecoder;\n exports.ReedSolomonEncoder = ReedSolomonEncoder;\n exports.ReedSolomonException = ReedSolomonException;\n exports.Result = Result;\n exports.ResultMetadataType = ResultMetadataType$1;\n exports.ResultPoint = ResultPoint;\n exports.StringUtils = StringUtils;\n exports.UnsupportedOperationException = UnsupportedOperationException;\n exports.VideoInputDevice = VideoInputDevice;\n exports.WhiteRectangleDetector = WhiteRectangleDetector;\n exports.WriterException = WriterException;\n exports.ZXingArrays = Arrays;\n exports.ZXingCharset = Charset;\n exports.ZXingInteger = Integer;\n exports.ZXingStandardCharsets = StandardCharsets;\n exports.ZXingStringBuilder = StringBuilder;\n exports.ZXingStringEncoding = StringEncoding;\n exports.ZXingSystem = System;\n exports.createAbstractExpandedDecoder = createDecoder;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","/*\n Expose functions.\n*/\nmodule.exports =\n { toJalaali: toJalaali\n , toGregorian: toGregorian\n , isValidJalaaliDate: isValidJalaaliDate\n , isLeapJalaaliYear: isLeapJalaaliYear\n , jalaaliMonthLength: jalaaliMonthLength\n , jalCal: jalCal\n , j2d: j2d\n , d2j: d2j\n , g2d: g2d\n , d2g: d2g\n , jalaaliToDateObject: jalaaliToDateObject\n , jalaaliWeek: jalaaliWeek\n }\n\n/*\n Jalaali years starting the 33-year rule.\n*/\nvar breaks = [ -61, 9, 38, 199, 426, 686, 756, 818, 1111, 1181, 1210\n , 1635, 2060, 2097, 2192, 2262, 2324, 2394, 2456, 3178\n ]\n\n/*\n Converts a Gregorian date to Jalaali.\n*/\nfunction toJalaali(gy, gm, gd) {\n if (Object.prototype.toString.call(gy) === '[object Date]') {\n gd = gy.getDate()\n gm = gy.getMonth() + 1\n gy = gy.getFullYear()\n }\n return d2j(g2d(gy, gm, gd))\n}\n\n/*\n Converts a Jalaali date to Gregorian.\n*/\nfunction toGregorian(jy, jm, jd) {\n return d2g(j2d(jy, jm, jd))\n}\n\n/*\n Checks whether a Jalaali date is valid or not.\n*/\nfunction isValidJalaaliDate(jy, jm, jd) {\n return jy >= -61 && jy <= 3177 &&\n jm >= 1 && jm <= 12 &&\n jd >= 1 && jd <= jalaaliMonthLength(jy, jm)\n}\n\n/*\n Is this a leap year or not?\n*/\nfunction isLeapJalaaliYear(jy) {\n return jalCalLeap(jy) === 0\n}\n\n/*\n Number of days in a given month in a Jalaali year.\n*/\nfunction jalaaliMonthLength(jy, jm) {\n if (jm <= 6) return 31\n if (jm <= 11) return 30\n if (isLeapJalaaliYear(jy)) return 30\n return 29\n}\n\n/*\n This function determines if the Jalaali (Persian) year is\n leap (366-day long) or is the common year (365 days)\n\n @param jy Jalaali calendar year (-61 to 3177)\n @returns number of years since the last leap year (0 to 4)\n */\nfunction jalCalLeap(jy) {\n var bl = breaks.length\n , jp = breaks[0]\n , jm\n , jump\n , leap\n , n\n , i\n\n if (jy < jp || jy >= breaks[bl - 1])\n throw new Error('Invalid Jalaali year ' + jy)\n\n for (i = 1; i < bl; i += 1) {\n jm = breaks[i]\n jump = jm - jp\n if (jy < jm)\n break\n jp = jm\n }\n n = jy - jp\n\n if (jump - n < 6)\n n = n - jump + div(jump + 4, 33) * 33\n leap = mod(mod(n + 1, 33) - 1, 4)\n if (leap === -1) {\n leap = 4\n }\n\n return leap\n}\n\n/*\n This function determines if the Jalaali (Persian) year is\n leap (366-day long) or is the common year (365 days), and\n finds the day in March (Gregorian calendar) of the first\n day of the Jalaali year (jy).\n\n @param jy Jalaali calendar year (-61 to 3177)\n @param withoutLeap when don't need leap (true or false) default is false\n @return\n leap: number of years since the last leap year (0 to 4)\n gy: Gregorian year of the beginning of Jalaali year\n march: the March day of Farvardin the 1st (1st day of jy)\n @see: http://www.astro.uni.torun.pl/~kb/Papers/EMP/PersianC-EMP.htm\n @see: http://www.fourmilab.ch/documents/calendar/\n*/\nfunction jalCal(jy, withoutLeap) {\n var bl = breaks.length\n , gy = jy + 621\n , leapJ = -14\n , jp = breaks[0]\n , jm\n , jump\n , leap\n , leapG\n , march\n , n\n , i\n\n if (jy < jp || jy >= breaks[bl - 1])\n throw new Error('Invalid Jalaali year ' + jy)\n\n // Find the limiting years for the Jalaali year jy.\n for (i = 1; i < bl; i += 1) {\n jm = breaks[i]\n jump = jm - jp\n if (jy < jm)\n break\n leapJ = leapJ + div(jump, 33) * 8 + div(mod(jump, 33), 4)\n jp = jm\n }\n n = jy - jp\n\n // Find the number of leap years from AD 621 to the beginning\n // of the current Jalaali year in the Persian calendar.\n leapJ = leapJ + div(n, 33) * 8 + div(mod(n, 33) + 3, 4)\n if (mod(jump, 33) === 4 && jump - n === 4)\n leapJ += 1\n\n // And the same in the Gregorian calendar (until the year gy).\n leapG = div(gy, 4) - div((div(gy, 100) + 1) * 3, 4) - 150\n\n // Determine the Gregorian date of Farvardin the 1st.\n march = 20 + leapJ - leapG\n\n // return with gy and march when we don't need leap\n if (withoutLeap) return { gy: gy, march: march };\n\n\n // Find how many years have passed since the last leap year.\n if (jump - n < 6)\n n = n - jump + div(jump + 4, 33) * 33\n leap = mod(mod(n + 1, 33) - 1, 4)\n if (leap === -1) {\n leap = 4\n }\n\n return { leap: leap\n , gy: gy\n , march: march\n }\n}\n\n/*\n Converts a date of the Jalaali calendar to the Julian Day number.\n\n @param jy Jalaali year (1 to 3100)\n @param jm Jalaali month (1 to 12)\n @param jd Jalaali day (1 to 29/31)\n @return Julian Day number\n*/\nfunction j2d(jy, jm, jd) {\n var r = jalCal(jy, true)\n return g2d(r.gy, 3, r.march) + (jm - 1) * 31 - div(jm, 7) * (jm - 7) + jd - 1\n}\n\n/*\n Converts the Julian Day number to a date in the Jalaali calendar.\n\n @param jdn Julian Day number\n @return\n jy: Jalaali year (1 to 3100)\n jm: Jalaali month (1 to 12)\n jd: Jalaali day (1 to 29/31)\n*/\nfunction d2j(jdn) {\n var gy = d2g(jdn).gy // Calculate Gregorian year (gy).\n , jy = gy - 621\n , r = jalCal(jy, false)\n , jdn1f = g2d(gy, 3, r.march)\n , jd\n , jm\n , k\n\n // Find number of days that passed since 1 Farvardin.\n k = jdn - jdn1f\n if (k >= 0) {\n if (k <= 185) {\n // The first 6 months.\n jm = 1 + div(k, 31)\n jd = mod(k, 31) + 1\n return { jy: jy\n , jm: jm\n , jd: jd\n }\n } else {\n // The remaining months.\n k -= 186\n }\n } else {\n // Previous Jalaali year.\n jy -= 1\n k += 179\n if (r.leap === 1)\n k += 1\n }\n jm = 7 + div(k, 30)\n jd = mod(k, 30) + 1\n return { jy: jy\n , jm: jm\n , jd: jd\n }\n}\n\n/*\n Calculates the Julian Day number from Gregorian or Julian\n calendar dates. This integer number corresponds to the noon of\n the date (i.e. 12 hours of Universal Time).\n The procedure was tested to be good since 1 March, -100100 (of both\n calendars) up to a few million years into the future.\n\n @param gy Calendar year (years BC numbered 0, -1, -2, ...)\n @param gm Calendar month (1 to 12)\n @param gd Calendar day of the month (1 to 28/29/30/31)\n @return Julian Day number\n*/\nfunction g2d(gy, gm, gd) {\n var d = div((gy + div(gm - 8, 6) + 100100) * 1461, 4)\n + div(153 * mod(gm + 9, 12) + 2, 5)\n + gd - 34840408\n d = d - div(div(gy + 100100 + div(gm - 8, 6), 100) * 3, 4) + 752\n return d\n}\n\n/*\n Calculates Gregorian and Julian calendar dates from the Julian Day number\n (jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both\n calendars) to some millions years ahead of the present.\n\n @param jdn Julian Day number\n @return\n gy: Calendar year (years BC numbered 0, -1, -2, ...)\n gm: Calendar month (1 to 12)\n gd: Calendar day of the month M (1 to 28/29/30/31)\n*/\nfunction d2g(jdn) {\n var j\n , i\n , gd\n , gm\n , gy\n j = 4 * jdn + 139361631\n j = j + div(div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908\n i = div(mod(j, 1461), 4) * 5 + 308\n gd = div(mod(i, 153), 5) + 1\n gm = mod(div(i, 153), 12) + 1\n gy = div(j, 1461) - 100100 + div(8 - gm, 6)\n return { gy: gy\n , gm: gm\n , gd: gd\n }\n}\n\n/**\n * Return Saturday and Friday day of current week(week start in Saturday)\n * @param {number} jy jalaali year\n * @param {number} jm jalaali month\n * @param {number} jd jalaali day\n * @returns Saturday and Friday of current week\n */\nfunction jalaaliWeek(jy, jm, jd) {\n var dayOfWeek = jalaaliToDateObject(jy, jm, jd).getDay();\n\n var startDayDifference = dayOfWeek == 6 ? 0 : -(dayOfWeek+1);\n var endDayDifference = 6+startDayDifference;\n\n return {\n saturday: d2j(j2d(jy, jm, jd+startDayDifference)),\n friday: d2j(j2d(jy, jm, jd+endDayDifference))\n }\n}\n\n/**\n * Convert Jalaali calendar dates to javascript Date object\n * @param {number} jy jalaali year\n * @param {number} jm jalaali month\n * @param {number} jd jalaali day\n * @param {number} [h] hours\n * @param {number} [m] minutes\n * @param {number} [s] seconds\n * @param {number} [ms] milliseconds\n * @returns Date object of the jalaali calendar dates\n */\nfunction jalaaliToDateObject(\n jy,\n jm,\n jd,\n h,\n m,\n s,\n ms\n) {\n var gregorianCalenderDate = toGregorian(jy, jm, jd);\n\n return new Date(\n gregorianCalenderDate.gy,\n gregorianCalenderDate.gm - 1,\n gregorianCalenderDate.gd,\n h || 0,\n m || 0,\n s || 0,\n ms || 0\n );\n}\n\n/*\n Utility helper functions.\n*/\n\nfunction div(a, b) {\n return ~~(a / b)\n}\n\nfunction mod(a, b) {\n return a - ~~(a / b) * b\n}\n","\nmodule.exports = jMoment;\n\nvar moment = require(\"moment/moment\");\nrequire(\"moment/locale/fa\");\n\n/************************************\n Constants\n ************************************/\n\nvar formattingTokens = /(\\[[^\\[]*\\])|(\\\\)?j(Mo|MM?M?M?|Do|DDDo|DD?D?D?|w[o|w]?|YYYYY|YYYY|YY|gg(ggg?)?|)|(\\\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g\n , localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LT|LL?L?L?|l{1,4})/g\n , parseTokenOneOrTwoDigits = /\\d\\d?/\n , parseTokenOneToThreeDigits = /\\d{1,3}/\n , parseTokenThreeDigits = /\\d{3}/\n , parseTokenFourDigits = /\\d{1,4}/\n , parseTokenSixDigits = /[+\\-]?\\d{1,6}/\n , parseTokenWord = /[0-9]*[\"a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+|[\\u0600-\\u06FF\\/]+(\\s*?[\\u0600-\\u06FF]+){1,2}/i\n , parseTokenTimezone = /Z|[\\+\\-]\\d\\d:?\\d\\d/i\n , parseTokenT = /T/i\n , parseTokenTimestampMs = /[\\+\\-]?\\d+(\\.\\d{1,3})?/\n\n , unitAliases = {\n jm: \"jmonth\"\n , jmonths: \"jmonth\"\n , jy: \"jyear\"\n , jyears: \"jyear\"\n }\n\n , formatFunctions = {}\n\n , ordinalizeTokens = \"DDD w M D\".split(\" \")\n , paddedTokens = \"M D w\".split(\" \");\n\nvar CalendarSystems = {\n Jalali: 1,\n Gregorian: 2,\n}\nvar formatTokenFunctions = {\n jM: function () {\n return this.jMonth() + 1;\n },\n jMMM: function (format) {\n return this.localeData().jMonthsShort(this, format);\n },\n jMMMM: function (format) {\n return this.localeData().jMonths(this, format);\n },\n jD: function () {\n return this.jDate();\n },\n jDDD: function () {\n return this.jDayOfYear();\n },\n jw: function () {\n return this.jWeek();\n },\n jYY: function () {\n return leftZeroFill(this.jYear() % 100, 2);\n },\n jYYYY: function () {\n return leftZeroFill(this.jYear(), 4);\n },\n jYYYYY: function () {\n return leftZeroFill(this.jYear(), 5);\n },\n jgg: function () {\n return leftZeroFill(this.jWeekYear() % 100, 2);\n },\n jgggg: function () {\n return this.jWeekYear();\n },\n jggggg: function () {\n return leftZeroFill(this.jWeekYear(), 5);\n }\n};\n\nfunction padToken(func, count) {\n return function (a) {\n return leftZeroFill(func.call(this, a), count);\n };\n}\nfunction ordinalizeToken(func, period) {\n return function (a) {\n return this.localeData().ordinal(func.call(this, a), period);\n };\n}\n\n(function () {\n var i;\n while (ordinalizeTokens.length) {\n i = ordinalizeTokens.pop();\n formatTokenFunctions[\"j\" + i + \"o\"] = ordinalizeToken(formatTokenFunctions[\"j\" + i], i);\n }\n while (paddedTokens.length) {\n i = paddedTokens.pop();\n formatTokenFunctions[\"j\" + i + i] = padToken(formatTokenFunctions[\"j\" + i], 2);\n }\n formatTokenFunctions.jDDDD = padToken(formatTokenFunctions.jDDD, 3);\n}());\n\n/************************************\n Helpers\n ************************************/\n\nfunction extend(a, b) {\n var key;\n for (key in b)\n if (b.hasOwnProperty(key)){\n a[key] = b[key];\n }\n return a;\n}\n\n/**\n * return a string which length is as much as you need\n * @param {number} number input\n * @param {number} targetLength expected length\n * @example leftZeroFill(5,2) => 05\n **/\nfunction leftZeroFill(number, targetLength) {\n var output = number + \"\";\n while (output.length < targetLength){\n output = \"0\" + output;\n }\n return output;\n}\n\n/**\n * determine object is array or not\n * @param input\n **/\nfunction isArray(input) {\n return Object.prototype.toString.call(input) === \"[object Array]\";\n}\n\n/**\n * Changes any moment Gregorian format to Jalali system format\n * @param {string} format\n * @example toJalaliFormat(\"YYYY/MMM/DD\") => \"jYYYY/jMMM/jDD\"\n **/\nfunction toJalaliFormat(format) {\n for (var i = 0; i < format.length; i++) {\n if(!i || (format[i-1] !== \"j\" && format[i-1] !== format[i])) {\n if (format[i] === \"Y\" || format[i] === \"M\" || format[i] === \"D\" || format[i] === \"g\") {\n format = format.slice(0, i) + \"j\" + format.slice(i);\n }\n }\n }\n return format;\n}\n\n/**\n * Changes any moment Gregorian units to Jalali system units\n * @param {string} units\n * @example toJalaliUnit(\"YYYY/MMM/DD\") => \"jYYYY/jMMM/jDD\"\n **/\nfunction toJalaliUnit(units) {\n switch (units) {\n case \"week\" : return \"jWeek\";\n case \"year\" : return \"jYear\";\n case \"month\" : return \"jMonth\";\n case \"months\" : return \"jMonths\";\n case \"monthName\" : return \"jMonthsShort\";\n case \"monthsShort\" : return \"jMonthsShort\";\n }\n return units;\n}\n\n/**\n * normalize units to be comparable\n * @param {string} units\n **/\nfunction normalizeUnits(units, momentObj) {\n if (isJalali(momentObj)) {\n units = toJalaliUnit(units);\n }\n if (units) {\n var lowered = units.toLowerCase();\n if (lowered.startsWith('j')) units = unitAliases[lowered] || lowered;\n // TODO : add unit test\n if (units === \"jday\") units = \"day\";\n else if (units === \"jd\") units = \"d\";\n }\n return units;\n}\n\n/**\n * set a gregorian date to moment object\n * @param {string} momentInstance\n * @param {string} year in gregorian system\n * @param {string} month in gregorian system\n * @param {string} day in gregorian system\n **/\nfunction setDate(momentInstance, year, month, day) {\n var d = momentInstance._d;\n if (momentInstance._isUTC) {\n /*eslint-disable new-cap*/\n momentInstance._d = new Date(Date.UTC(year, month, day,\n d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()));\n /*eslint-enable new-cap*/\n } else {\n momentInstance._d = new Date(year, month, day,\n d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());\n }\n}\n\nfunction objectCreate(parent) {\n function F() {}\n F.prototype = parent;\n return new F();\n}\n\nfunction getPrototypeOf(object) {\n if (Object.getPrototypeOf){\n return Object.getPrototypeOf(object);\n }\n else if (\"\".__proto__){\n return object.__proto__;\n }\n else{\n return object.constructor.prototype;\n }\n}\n\n/************************************\n Languages\n ************************************/\nextend(getPrototypeOf(moment.localeData()),\n { _jMonths: [ \"Farvardin\"\n , \"Ordibehesht\"\n , \"Khordaad\"\n , \"Tir\"\n , \"Mordaad\"\n , \"Shahrivar\"\n , \"Mehr\"\n , \"Aabaan\"\n , \"Aazar\"\n , \"Dey\"\n , \"Bahman\"\n , \"Esfand\"\n ]\n , jMonths: function (m) {\n if (m) {\n return this._jMonths[m.jMonth()];\n } else {\n return this._jMonths;\n }\n }\n\n , _jMonthsShort: [ \"Far\"\n , \"Ord\"\n , \"Kho\"\n , \"Tir\"\n , \"Amo\"\n , \"Sha\"\n , \"Meh\"\n , \"Aab\"\n , \"Aaz\"\n , \"Dey\"\n , \"Bah\"\n , \"Esf\"\n ]\n , jMonthsShort: function (m) {\n if (m) {\n return this._jMonthsShort[m.jMonth()];\n } else {\n return this._jMonthsShort;\n }\n }\n\n , jMonthsParse: function (monthName) {\n var i\n , mom\n , regex;\n if (!this._jMonthsParse){\n this._jMonthsParse = [];\n }\n for (i = 0; i < 12; i += 1) {\n // Make the regex if we don\"t have it already.\n if (!this._jMonthsParse[i]) {\n mom = jMoment([2000, (2 + i) % 12, 25]);\n regex = \"^\" + this.jMonths(mom, \"\") + \"|^\" + this.jMonthsShort(mom, \"\");\n this._jMonthsParse[i] = new RegExp(regex.replace(\".\", \"\"), \"i\");\n }\n // Test the regex.\n if (this._jMonthsParse[i].test(monthName)){\n return i;\n }\n }\n }\n }\n);\n\n/************************************\n Formatting\n ************************************/\n\nfunction makeFormatFunction(format) {\n var array = format.match(formattingTokens)\n , length = array.length\n , i;\n\n for (i = 0; i < length; i += 1){\n if (formatTokenFunctions[array[i]]){\n array[i] = formatTokenFunctions[array[i]];\n }\n }\n return function (mom) {\n var output = \"\";\n for (i = 0; i < length; i += 1){\n output += array[i] instanceof Function ? \"[\" + array[i].call(mom, format) + \"]\" : array[i];\n }\n return output;\n };\n}\n\n/************************************\n Parsing\n ************************************/\n\nfunction getParseRegexForToken(token, config) {\n switch (token) {\n case \"jDDDD\":\n return parseTokenThreeDigits;\n case \"jYYYY\":\n return parseTokenFourDigits;\n case \"jYYYYY\":\n return parseTokenSixDigits;\n case \"jDDD\":\n return parseTokenOneToThreeDigits;\n case \"jMMM\":\n case \"jMMMM\":\n return parseTokenWord;\n case \"jMM\":\n case \"jDD\":\n case \"jYY\":\n case \"jM\":\n case \"jD\":\n return parseTokenOneOrTwoDigits;\n case \"DDDD\":\n return parseTokenThreeDigits;\n case \"YYYY\":\n return parseTokenFourDigits;\n case \"YYYYY\":\n return parseTokenSixDigits;\n case \"S\":\n case \"SS\":\n case \"SSS\":\n case \"DDD\":\n return parseTokenOneToThreeDigits;\n case \"MMM\":\n case \"MMMM\":\n case \"dd\":\n case \"ddd\":\n case \"dddd\":\n return parseTokenWord;\n case \"a\":\n case \"A\":\n return moment.localeData(config._l)._meridiemParse;\n case \"X\":\n return parseTokenTimestampMs;\n case \"Z\":\n case \"ZZ\":\n return parseTokenTimezone;\n case \"T\":\n return parseTokenT;\n case \"MM\":\n case \"DD\":\n case \"YY\":\n case \"HH\":\n case \"hh\":\n case \"mm\":\n case \"ss\":\n case \"M\":\n case \"D\":\n case \"d\":\n case \"H\":\n case \"h\":\n case \"m\":\n case \"s\":\n return parseTokenOneOrTwoDigits;\n default:\n return new RegExp(token.replace(\"\\\\\", \"\"));\n }\n}\nfunction isNull(variable) {\n return variable === null || variable === undefined;\n}\nfunction addTimeToArrayFromToken(token, input, config) {\n var a\n , datePartArray = config._a;\n\n switch (token) {\n case \"jM\":\n case \"jMM\":\n datePartArray[1] = isNull(input)? 0 : ~~input - 1;\n break;\n case \"jMMM\":\n case \"jMMMM\":\n a = moment.localeData(config._l).jMonthsParse(input);\n if (!isNull(a)){\n datePartArray[1] = a;\n }\n else{\n config._isValid = false;\n }\n break;\n case \"jD\":\n case \"jDD\":\n case \"jDDD\":\n case \"jDDDD\":\n if (!isNull(input)){\n datePartArray[2] = ~~input;\n }\n break;\n case \"jYY\":\n datePartArray[0] = ~~input + (~~input > 47 ? 1300 : 1400);\n break;\n case \"jYYYY\":\n case \"jYYYYY\":\n datePartArray[0] = ~~input;\n }\n if (isNull(input)) {\n config._isValid = false;\n }\n}\n\nfunction dateFromArray(config) {\n var g\n , j\n , jy = config._a[0]\n , jm = config._a[1]\n , jd = config._a[2];\n\n if (isNull(jy) && isNull(jm) && isNull(jd)){\n return;\n }\n jy = !isNull(jy) ? jy : 0;\n jm = !isNull(jm) ? jm : 0;\n jd = !isNull(jd) ? jd : 1;\n if (jd < 1 || jd > jMoment.jDaysInMonth(jy, jm) || jm < 0 || jm > 11){\n config._isValid = false;\n }\n g = toGregorian(jy, jm, jd);\n j = toJalali(g.gy, g.gm, g.gd);\n config._jDiff = 0;\n if (~~j.jy !== jy){\n config._jDiff += 1;\n }\n if (~~j.jm !== jm){\n config._jDiff += 1;\n }\n if (~~j.jd !== jd){\n config._jDiff += 1;\n }\n return [g.gy, g.gm, g.gd];\n}\n\nfunction makeDateFromStringAndFormat(config) {\n var tokens = config._f.match(formattingTokens)\n , string = config._i + \"\"\n , len = tokens.length\n , i\n , token\n , parsedInput;\n\n config._a = [];\n\n for (i = 0; i < len; i += 1) {\n token = tokens[i];\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];\n if (parsedInput){\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n if (formatTokenFunctions[token]){\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n }\n if (string){\n config._il = string;\n }\n return dateFromArray(config);\n}\n\nfunction makeDateFromStringAndArray(config, utc) {\n var len = config._f.length\n , i\n , format\n , tempMoment\n , bestMoment\n , currentScore\n , scoreToBeat;\n\n if (len === 0) {\n return makeMoment(new Date(NaN));\n }\n\n for (i = 0; i < len; i += 1) {\n format = config._f[i];\n currentScore = 0;\n tempMoment = makeMoment(config._i, format, config._l, config._strict, utc);\n\n if (!tempMoment.isValid()){\n continue;\n }\n\n // currentScore = compareArrays(tempMoment._a, tempMoment.toArray())\n currentScore += tempMoment._jDiff;\n if (tempMoment._il){\n currentScore += tempMoment._il.length;\n }\n if (isNull(scoreToBeat) || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempMoment;\n }\n }\n\n return bestMoment;\n}\n\nfunction removeParsedTokens(config) {\n var string = config._i + \"\"\n , input = \"\"\n , format = \"\"\n , array = config._f.match(formattingTokens)\n , len = array.length\n , i\n , match\n , parsed;\n\n for (i = 0; i < len; i += 1) {\n match = array[i];\n parsed = (getParseRegexForToken(match, config).exec(string) || [])[0];\n if (parsed){\n string = string.slice(string.indexOf(parsed) + parsed.length);\n }\n if (!(formatTokenFunctions[match] instanceof Function)) {\n format += match;\n if (parsed){\n input += parsed;\n }\n }\n }\n config._i = input;\n config._f = format;\n}\n\n/************************************\n Week of Year\n ************************************/\n\nfunction jWeekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek\n , daysToDayOfWeek = firstDayOfWeekOfYear - mom.day()\n , adjustedMoment;\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n adjustedMoment = jMoment(mom).add(daysToDayOfWeek, \"d\");\n return { week: Math.ceil(adjustedMoment.jDayOfYear() / 7)\n , year: adjustedMoment.jYear()\n };\n}\n\n/************************************\n Top Level Functions\n ************************************/\nfunction isJalali (momentObj) {\n return momentObj &&\n (momentObj.calSystem === CalendarSystems.Jalali) ||\n (moment.justUseJalali && momentObj.calSystem !== CalendarSystems.Gregorian);\n}\nfunction isInputJalali(format, momentObj, input) {\n return (moment.justUseJalali || (momentObj && momentObj.calSystem === CalendarSystems.Jalali))\n}\nfunction makeMoment(input, format, lang, strict, utc) {\n if (typeof lang === \"boolean\") {\n utc = utc || strict;\n strict = lang;\n lang = undefined;\n }\n if (moment.ISO_8601 === format) {\n format = 'YYYY-MM-DDTHH:mm:ss.SSSZ';\n }\n const inputIsJalali = isInputJalali(format, this, input);\n // var itsJalaliDate = (isJalali(this));\n if(input && (typeof input === \"string\") && !format && inputIsJalali && !moment.useGregorianParser) {\n input = input.replace(/\\//g,\"-\");\n if(/\\d{4}\\-\\d{2}\\-\\d{2}/.test(input)) {\n format = \"jYYYY-jMM-jDD\";\n } else if (/\\d{4}\\-\\d{2}\\-\\d{1}/.test(input)) {\n format = \"jYYYY-jMM-jD\";\n } else if (/\\d{4}\\-\\d{1}\\-\\d{1}/.test(input)) {\n format = \"jYYYY-jM-jD\";\n } else if (/\\d{4}\\-\\d{1}\\-\\d{2}/.test(input)) {\n format = \"jYYYY-jM-jDD\";\n } else if (/\\d{4}\\-W\\d{2}\\-\\d{2}/.test(input)) {\n format = \"jYYYY-jW-jDD\";\n } else if (/\\d{4}\\-\\d{3}/.test(input)) {\n format = \"jYYYY-jDDD\";\n } else if (/\\d{8}/.test(input)) {\n format = \"jYYYYjMMjDD\";\n } else if (/\\d{4}W\\d{2}\\d{1}/.test(input)) {\n format = \"jYYYYjWWjD\";\n } else if (/\\d{4}W\\d{2}/.test(input)) {\n format = \"jYYYYjWW\";\n } else if (/\\d{4}\\d{3}/.test(input)) {\n format = \"jYYYYjDDD\";\n }\n }\n if (format && inputIsJalali){\n format = toJalaliFormat(format);\n }\n if (format && typeof format === \"string\"){\n format = fixFormat(format, moment);\n }\n\n var config =\n { _i: input\n , _f: format\n , _l: lang\n , _strict: strict\n , _isUTC: utc\n }\n , date\n , m\n , jm\n , origInput = input\n , origFormat = format;\n if (format) {\n if (isArray(format)) {\n return makeDateFromStringAndArray(config, utc);\n } else {\n date = makeDateFromStringAndFormat(config);\n removeParsedTokens(config);\n if (date) {\n format = \"YYYY-MM-DD-\" + config._f;\n input = leftZeroFill(date[0], 4) + \"-\"\n + leftZeroFill(date[1] + 1, 2) + \"-\"\n + leftZeroFill(date[2], 2) + \"-\"\n + config._i;\n }\n }\n }\n if (utc){\n m = moment.utc(input, format, lang, strict);\n }\n else{\n m = moment(input, format, lang, strict);\n }\n if (config._isValid === false || (input && input._isAMomentObject && !input._isValid)){\n m._isValid = false;\n }\n m._jDiff = config._jDiff || 0;\n jm = objectCreate(jMoment.fn);\n extend(jm, m);\n if (strict && jm.isValid()) {\n jm._isValid = jm.format(origFormat) === origInput;\n }\n if (input && input.calSystem) {\n jm.calSystem = input.calSystem;\n }\n return jm;\n}\n\nfunction jMoment(input, format, lang, strict) {\n return makeMoment(input, format, lang, strict, false);\n}\n\nextend(jMoment, moment);\njMoment.fn = objectCreate(moment.fn);\n\njMoment.utc = function (input, format, lang, strict) {\n return makeMoment(input, format, lang, strict, true);\n};\n\njMoment.unix = function (input) {\n return makeMoment(input * 1000);\n};\n\n/************************************\n jMoment Prototype\n ************************************/\n\nfunction fixFormat(format, _moment) {\n var i = 5;\n var replace = function (input) {\n return _moment.localeData().longDateFormat(input) || input;\n };\n while (i > 0 && localFormattingTokens.test(format)) {\n i -= 1;\n format = format.replace(localFormattingTokens, replace);\n }\n return format;\n}\n\njMoment.fn.format = function (format) {\n\tformat = format || jMoment.defaultFormat;\n if (format) {\n if (isJalali(this)) {\n format = toJalaliFormat(format);\n }\n format = fixFormat(format, this);\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n format = formatFunctions[format](this);\n }\n var formatted = moment.fn.format.call(this, format);\n return formatted;\n};\n\njMoment.fn.year = function (input) {\n if (isJalali(this)) return jMoment.fn.jYear.call(this,input);\n else return moment.fn.year.call(this, input);\n};\njMoment.fn.jYear = function (input) {\n var lastDay\n , j\n , g;\n if (typeof input === \"number\") {\n j = getJalaliOf(this);\n lastDay = Math.min(j.jd, jMoment.jDaysInMonth(input, j.jm));\n g = toGregorian(input, j.jm, lastDay);\n setDate(this, g.gy, g.gm, g.gd);\n moment.updateOffset(this);\n return this;\n } else {\n return getJalaliOf(this).jy;\n }\n};\n\njMoment.fn.month = function (input) {\n if (isJalali(this)) return jMoment.fn.jMonth.call(this,input);\n else return moment.fn.month.call(this, input);\n};\njMoment.fn.jMonth = function (input) {\n var lastDay\n , j\n , g;\n if (!isNull(input)) {\n if (typeof input === \"string\") {\n input = this.localeData().jMonthsParse(input);\n if (typeof input !== \"number\"){\n return this;\n }\n }\n j = getJalaliOf(this);\n lastDay = Math.min(j.jd, jMoment.jDaysInMonth(j.jy, input));\n this.jYear(j.jy + div(input, 12));\n input = mod(input, 12);\n if (input < 0) {\n input += 12;\n this.jYear(this.jYear() - 1);\n }\n g = toGregorian(this.jYear(), input, lastDay);\n setDate(this, g.gy, g.gm, g.gd);\n moment.updateOffset(this);\n return this;\n } else {\n return getJalaliOf(this).jm;\n }\n};\n\njMoment.fn.date = function (input) {\n if (isJalali(this)) return jMoment.fn.jDate.call(this,input);\n else return moment.fn.date.call(this, input);\n};\nfunction getJalaliOf (momentObj) {\n var d = momentObj._d;\n if (momentObj._isUTC) {\n return toJalali(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());\n } else {\n return toJalali(d.getFullYear(), d.getMonth(), d.getDate());\n }\n}\njMoment.fn.jDate = function (input) {\n var j\n , g;\n if (typeof input === \"number\") {\n j = getJalaliOf(this);\n g = toGregorian(j.jy, j.jm, input);\n setDate(this, g.gy, g.gm, g.gd);\n moment.updateOffset(this);\n return this;\n } else {\n return getJalaliOf(this).jd;\n }\n};\n\njMoment.fn.jDay = function (input) {\n if (typeof input === \"number\") {\n return moment.fn.day.call(this, input - 1);\n } else {\n return (moment.fn.day.call(this) + 1) % 7;\n }\n};\njMoment.fn.diff = function (input, unitOfTime, asFloat) {\n //code taken and adjusted for jalali calendar from original moment diff module https://github.com/moment/moment/blob/develop/src/lib/moment/diff.js\n if (!isJalali(this))\n return moment.fn.diff.call(this, input, unitOfTime, asFloat);\n\n var output;\n switch (unitOfTime) {\n case \"year\":\n output = monthDiff(this, input) / 12;\n break;\n case \"month\":\n output = monthDiff(this, input);\n break;\n case \"quarter\":\n output = monthDiff(this, input) / 3;\n break;\n default:\n output = moment.fn.diff.call(this, input, unitOfTime, asFloat);\n }\n\n return asFloat ? output : (output < 0 ? Math.ceil(output) || 0 : Math.floor(output));\n\n function monthDiff(a, b) {\n if (a.date() < b.date()) {\n // end-of-month calculations work correct when the start month has more\n // days than the end month.\n return -monthDiff(b, a);\n }\n // difference in months\n var wholeMonthDiff = (b.jYear() - a.jYear()) * 12 + (b.jMonth() - a.jMonth()),\n // b is in (anchor - 1 month, anchor + 1 month)\n anchor = a.clone().add(wholeMonthDiff, \"months\"),\n anchor2,\n adjust\n\n if (b - anchor < 0) {\n anchor2 = a.clone().add(wholeMonthDiff - 1, \"months\");\n // linear across the month\n adjust = (b - anchor) / (anchor - anchor2);\n } else {\n anchor2 = a.clone().add(wholeMonthDiff + 1, \"months\");\n // linear across the month\n adjust = (b - anchor) / (anchor2 - anchor);\n }\n\n //check for negative zero, return zero if negative zero\n return -(wholeMonthDiff + adjust) || 0;\n }\n}\n\njMoment.fn.dayOfYear = function (input) {\n if (isJalali(this)) return jMoment.fn.jDayOfYear.call(this,input);\n else return moment.fn.dayOfYear.call(this, input);\n};\njMoment.fn.jDayOfYear = function (input) {\n var dayOfYear = Math.round((jMoment(this).startOf(\"day\") - jMoment(this).startOf(\"jYear\")) / 864e5) + 1;\n return isNull(input) ? dayOfYear : this.add(input - dayOfYear, \"d\");\n};\n\njMoment.fn.week = function (input) {\n if (isJalali(this)) return jMoment.fn.jWeek.call(this,input);\n else return moment.fn.week.call(this, input);\n};\njMoment.fn.jWeek = function (input) {\n var week = jWeekOfYear(this, 6, 12).week;\n return isNull(input) ? week : this.add((input - week) * 7, \"d\");\n};\n\njMoment.fn.weekYear = function (input) {\n if (isJalali(this)) return jMoment.fn.jWeekYear.call(this,input);\n else return moment.fn.weekYear.call(this, input);\n};\njMoment.fn.jWeekYear = function (input) {\n var year = jWeekOfYear(this, 6, 12).year;\n return isNull(input) ? year : this.add(input - year, \"jyear\");\n};\n\njMoment.fn.add = function (val, units) {\n var temp;\n if (!isNull(units) && !isNaN(+units)) {\n temp = val;\n val = units;\n units = temp;\n }\n units = normalizeUnits(units, this);\n if (units === 'jweek' || units==='isoweek') { units = 'week' }\n if (units === \"jyear\") {\n this.jYear(this.jYear() + val);\n } else if (units === \"jmonth\") {\n this.jMonth(this.jMonth() + val);\n } else {\n moment.fn.add.call(this, val, units);\n }\n return this;\n};\n\njMoment.fn.subtract = function (val, units) {\n var temp;\n if (!isNull(units) && !isNaN(+units)) {\n temp = val;\n val = units;\n units = temp;\n }\n units = normalizeUnits(units, this);\n if (units === \"jyear\") {\n this.jYear(this.jYear() - val);\n } else if (units === \"jmonth\") {\n this.jMonth(this.jMonth() - val);\n } else {\n moment.fn.subtract.call(this, val, units);\n }\n return this;\n};\n\njMoment.fn.startOf = function (units) {\n var nunit = normalizeUnits(units, this);\n if( nunit === \"jweek\"){\n return this.startOf(\"day\").subtract(this.jDay() , \"day\");\n }\n if (nunit === \"jyear\") {\n this.jMonth(0);\n nunit = \"jmonth\";\n }\n if (nunit === \"jmonth\") {\n this.jDate(1);\n nunit = \"day\";\n }\n if (nunit === \"day\") {\n this.hours(0);\n this.minutes(0);\n this.seconds(0);\n this.milliseconds(0);\n return this;\n } else {\n return moment.fn.startOf.call(this, units);\n }\n};\n\njMoment.fn.endOf = function (units) {\n units = normalizeUnits(units, this);\n if (units === undefined || units === \"milisecond\") {\n return this;\n }\n return this.startOf(units).add(1, units).subtract(1, \"ms\");\n};\n\njMoment.fn.isSame = function (other, units) {\n units = normalizeUnits(units, this);\n if (units === \"jyear\" || units === \"jmonth\") {\n return moment.fn.isSame.call(this.clone().startOf(units), other.clone().startOf(units));\n }\n return moment.fn.isSame.call(this, other, units);\n};\n\njMoment.fn.isBefore = function (other, units) {\n units = normalizeUnits(units, this);\n if (units === \"jyear\" || units === \"jmonth\") {\n return moment.fn.isBefore.call(this.clone().startOf(units), other.clone().startOf(units));\n }\n return moment.fn.isBefore.call(this, other, units);\n};\n\njMoment.fn.isAfter = function (other, units) {\n units = normalizeUnits(units, this);\n if (units === \"jyear\" || units === \"jmonth\") {\n return moment.fn.isAfter.call(this.clone().startOf(units), other.clone().startOf(units));\n }\n return moment.fn.isAfter.call(this, other, units);\n};\n\njMoment.fn.clone = function () {\n return jMoment(this);\n};\n\njMoment.fn.doAsJalali = function () {\n this.calSystem = CalendarSystems.Jalali;\n return this;\n};\njMoment.fn.doAsGregorian = function () {\n this.calSystem = CalendarSystems.Gregorian;\n return this;\n};\n\njMoment.fn.jYears = jMoment.fn.jYear;\njMoment.fn.jMonths = jMoment.fn.jMonth;\njMoment.fn.jDates = jMoment.fn.jDate;\njMoment.fn.jWeeks = jMoment.fn.jWeek;\n\njMoment.fn.daysInMonth = function() {\n if (isJalali(this)) {\n return this.jDaysInMonth();\n }\n return moment.fn.daysInMonth.call(this);\n};\njMoment.fn.jDaysInMonth = function () {\n var month = this.jMonth();\n var year = this.jYear();\n if (month < 6) {\n return 31;\n } else if (month < 11) {\n return 30;\n } else if (jMoment.jIsLeapYear(year)) {\n return 30;\n } else {\n return 29;\n }\n};\n\njMoment.fn.isLeapYear = function() {\n if (isJalali(this)) {\n return this.jIsLeapYear();\n }\n return moment.fn.isLeapYear.call(this);\n};\njMoment.fn.jIsLeapYear = function () {\n var year = this.jYear();\n return isLeapJalaliYear(year);\n};\njMoment.fn.locale = function(locale) {\n if (locale && moment.changeCalendarSystemByItsLocale) {\n if (locale === \"fa\") {\n this.doAsJalali();\n } else {\n this.doAsGregorian();\n }\n }\n return moment.fn.locale.call(this, locale);\n};\n/************************************\n jMoment Statics\n ************************************/\njMoment.locale = function(locale, options) {\n if (locale && moment.changeCalendarSystemByItsLocale) {\n if (locale === \"fa\") {\n this.useJalaliSystemPrimarily(options);\n } else {\n this.useJalaliSystemSecondary();\n }\n }\n return moment.locale.call(this, locale);\n};\n\njMoment.from = function(date, locale, format) {\n var lastLocale = jMoment.locale();\n jMoment.locale(locale);\n var m = jMoment(date, format);\n m.locale(lastLocale);\n jMoment.locale(lastLocale);\n return m;\n};\n\njMoment.bindCalendarSystemAndLocale = function () {\n moment.changeCalendarSystemByItsLocale = true;\n};\njMoment.unBindCalendarSystemAndLocale = function () {\n moment.changeCalendarSystemByItsLocale = false;\n};\n\njMoment.useJalaliSystemPrimarily = function (options) {\n moment.justUseJalali = true;\n var useGregorianParser = false;\n if (options) {\n useGregorianParser = options.useGregorianParser;\n }\n moment.useGregorianParser = useGregorianParser;\n};\njMoment.useJalaliSystemSecondary = function () {\n moment.justUseJalali = false;\n};\n\njMoment.jDaysInMonth = function (year, month) {\n year += div(month, 12);\n month = mod(month, 12);\n if (month < 0) {\n month += 12;\n year -= 1;\n }\n if (month < 6) {\n return 31;\n } else if (month < 11) {\n return 30;\n } else if (jMoment.jIsLeapYear(year)) {\n return 30;\n } else {\n return 29;\n }\n};\n\njMoment.jIsLeapYear = isLeapJalaliYear;\n\nmoment.updateLocale(\"fa\", {\n months: (\"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر\").split(\"_\")\n , monthsShort: (\"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر\").split(\"_\")\n , weekdays: (\"یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_جمعه_شنبه\").split(\"_\")\n , weekdaysShort: (\"یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_جمعه_شنبه\").split(\"_\")\n , weekdaysMin: \"ی_د_س_چ_پ_ج_ش\".split(\"_\")\n , longDateFormat:\n { LT: \"HH:mm\"\n , L: \"jYYYY/jMM/jDD\"\n , LL: \"jD jMMMM jYYYY\"\n , LLL: \"jD jMMMM jYYYY LT\"\n , LLLL: \"dddd، jD jMMMM jYYYY LT\"\n }\n , calendar:\n { sameDay: \"[امروز ساعت] LT\"\n , nextDay: \"[فردا ساعت] LT\"\n , nextWeek: \"dddd [ساعت] LT\"\n , lastDay: \"[دیروز ساعت] LT\"\n , lastWeek: \"dddd [ی پیش ساعت] LT\"\n , sameElse: \"L\"\n }\n , relativeTime:\n { future: \"در %s\"\n , past: \"%s پیش\"\n , s: \"چند ثانیه\"\n , m: \"1 دقیقه\"\n , mm: \"%d دقیقه\"\n , h: \"1 ساعت\"\n , hh: \"%d ساعت\"\n , d: \"1 روز\"\n , dd: \"%d روز\"\n , M: \"1 ماه\"\n , MM: \"%d ماه\"\n , y: \"1 سال\"\n , yy: \"%d سال\"\n }\n , ordinal: \"%dم\",\n preparse: function (string) {\n return string;\n },\n postformat: function (string) {\n return string;\n }\n , week:\n { dow: 6 // Saturday is the first day of the week.\n , doy: 12 // The week that contains Jan 1st is the first week of the year.\n }\n , meridiem: function (hour) {\n return hour < 12 ? \"ق.ظ\" : \"ب.ظ\";\n }\n , jMonths: (\"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند\").split(\"_\")\n , jMonthsShort: \"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند\".split(\"_\")\n });\njMoment.bindCalendarSystemAndLocale();\nmoment.locale(\"en\");\n\njMoment.jConvert = { toJalali: toJalali\n , toGregorian: toGregorian\n};\n\n/************************************\n Jalali Conversion\n ************************************/\n\nfunction toJalali(gy, gm, gd) {\n var j = convertToJalali(gy, gm + 1, gd);\n j.jm -= 1;\n return j;\n}\n\nfunction toGregorian(jy, jm, jd) {\n var g = convertToGregorian(jy, jm + 1, jd);\n g.gm -= 1;\n return g;\n}\n\n/*\n Utility helper functions.\n */\n\nfunction div(a, b) {\n return ~~(a / b);\n}\n\nfunction mod(a, b) {\n return a - ~~(a / b) * b;\n}\n\n/*\n Converts a Gregorian date to Jalali.\n */\nfunction convertToJalali(gy, gm, gd) {\n if (Object.prototype.toString.call(gy) === \"[object Date]\") {\n gd = gy.getDate();\n gm = gy.getMonth() + 1;\n gy = gy.getFullYear();\n }\n return d2j(g2d(gy, gm, gd));\n}\n\n/*\n Converts a Jalali date to Gregorian.\n */\nfunction convertToGregorian(jy, jm, jd) {\n return d2g(j2d(jy, jm, jd));\n}\n\n/*\n Is this a leap year or not?\n */\nfunction isLeapJalaliYear(jy) {\n return jalCal(jy).leap === 0;\n}\n\n/*\n This function determines if the Jalali (Persian) year is\n leap (366-day long) or is the common year (365 days), and\n finds the day in March (Gregorian calendar) of the first\n day of the Jalali year (jy).\n @param jy Jalali calendar year (-61 to 3177)\n @return\n leap: number of years since the last leap year (0 to 4)\n gy: Gregorian year of the beginning of Jalali year\n march: the March day of Farvardin the 1st (1st day of jy)\n @see: http://www.astro.uni.torun.pl/~kb/Papers/EMP/PersianC-EMP.htm\n @see: http://www.fourmilab.ch/documents/calendar/\n */\nfunction jalCal(jy) {\n // Jalali years starting the 33-year rule.\n var breaks = [ -61, 9, 38, 199, 426, 686, 756, 818, 1111, 1181, 1210\n , 1635, 2060, 2097, 2192, 2262, 2324, 2394, 2456, 3178\n ]\n , bl = breaks.length\n , gy = jy + 621\n , leapJ = -14\n , jp = breaks[0]\n , jm\n , jump\n , leap\n , leapG\n , march\n , n\n , i;\n\n if (jy < jp || jy >= breaks[bl - 1])\n throw new Error(\"Invalid Jalali year \" + jy);\n\n // Find the limiting years for the Jalali year jy.\n for (i = 1; i < bl; i += 1) {\n jm = breaks[i];\n jump = jm - jp;\n if (jy < jm)\n break;\n leapJ = leapJ + div(jump, 33) * 8 + div(mod(jump, 33), 4);\n jp = jm;\n }\n n = jy - jp;\n\n // Find the number of leap years from AD 621 to the beginning\n // of the current Jalali year in the Persian calendar.\n leapJ = leapJ + div(n, 33) * 8 + div(mod(n, 33) + 3, 4);\n if (mod(jump, 33) === 4 && jump - n === 4)\n leapJ += 1;\n\n // And the same in the Gregorian calendar (until the year gy).\n leapG = div(gy, 4) - div((div(gy, 100) + 1) * 3, 4) - 150;\n\n // Determine the Gregorian date of Farvardin the 1st.\n march = 20 + leapJ - leapG;\n\n // Find how many years have passed since the last leap year.\n if (jump - n < 6)\n n = n - jump + div(jump + 4, 33) * 33;\n leap = mod(mod(n + 1, 33) - 1, 4);\n if (leap === -1) {\n leap = 4;\n }\n\n return { leap: leap\n , gy: gy\n , march: march\n };\n}\n\n/*\n Converts a date of the Jalali calendar to the Julian Day number.\n @param jy Jalali year (1 to 3100)\n @param jm Jalali month (1 to 12)\n @param jd Jalali day (1 to 29/31)\n @return Julian Day number\n */\nfunction j2d(jy, jm, jd) {\n var r = jalCal(jy);\n return g2d(r.gy, 3, r.march) + (jm - 1) * 31 - div(jm, 7) * (jm - 7) + jd - 1;\n}\n\n/*\n Converts the Julian Day number to a date in the Jalali calendar.\n @param jdn Julian Day number\n @return\n jy: Jalali year (1 to 3100)\n jm: Jalali month (1 to 12)\n jd: Jalali day (1 to 29/31)\n */\nfunction d2j(jdn) {\n var gy = d2g(jdn).gy // Calculate Gregorian year (gy).\n , jy = gy - 621\n , r = jalCal(jy)\n , jdn1f = g2d(gy, 3, r.march)\n , jd\n , jm\n , k;\n\n // Find number of days that passed since 1 Farvardin.\n k = jdn - jdn1f;\n if (k >= 0) {\n if (k <= 185) {\n // The first 6 months.\n jm = 1 + div(k, 31);\n jd = mod(k, 31) + 1;\n return { jy: jy\n , jm: jm\n , jd: jd\n };\n } else {\n // The remaining months.\n k -= 186;\n }\n } else {\n // Previous Jalali year.\n jy -= 1;\n k += 179;\n if (r.leap === 1)\n k += 1;\n }\n jm = 7 + div(k, 30);\n jd = mod(k, 30) + 1;\n return { jy: jy\n , jm: jm\n , jd: jd\n };\n}\n\n/*\n Calculates the Julian Day number from Gregorian or Julian\n calendar dates. This integer number corresponds to the noon of\n the date (i.e. 12 hours of Universal Time).\n The procedure was tested to be good since 1 March, -100100 (of both\n calendars) up to a few million years into the future.\n @param gy Calendar year (years BC numbered 0, -1, -2, ...)\n @param gm Calendar month (1 to 12)\n @param gd Calendar day of the month (1 to 28/29/30/31)\n @return Julian Day number\n */\nfunction g2d(gy, gm, gd) {\n var d = div((gy + div(gm - 8, 6) + 100100) * 1461, 4)\n + div(153 * mod(gm + 9, 12) + 2, 5)\n + gd - 34840408;\n d = d - div(div(gy + 100100 + div(gm - 8, 6), 100) * 3, 4) + 752;\n return d;\n}\n\n/*\n Calculates Gregorian and Julian calendar dates from the Julian Day number\n (jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both\n calendars) to some millions years ahead of the present.\n @param jdn Julian Day number\n @return\n gy: Calendar year (years BC numbered 0, -1, -2, ...)\n gm: Calendar month (1 to 12)\n gd: Calendar day of the month M (1 to 28/29/30/31)\n */\nfunction d2g(jdn) {\n var j\n , i\n , gd\n , gm\n , gy;\n j = 4 * jdn + 139361631;\n j = j + div(div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908;\n i = div(mod(j, 1461), 4) * 5 + 308;\n gd = div(mod(i, 153), 5) + 1;\n gm = mod(div(i, 153), 12) + 1;\n gy = div(j, 1461) - 100100 + div(8 - gm, 6);\n return { gy: gy\n , gm: gm\n , gd: gd\n };\n}\n","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeCeil = Math.ceil,\n nativeMax = Math.max;\n\n/**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\nfunction baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n}\n\n/**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\nfunction createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\n/**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n * `start` is specified without an `end` or `step`. If `end` is not specified,\n * it's set to `start` with `start` then set to `0`.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.rangeRight\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(-4);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\nvar range = createRange();\n\nmodule.exports = range;\n","\nmodule.exports = jMoment\n\nvar moment = require('moment')\n , jalaali = require('jalaali-js')\n\n/************************************\n Constants\n************************************/\n\nvar formattingTokens = /(\\[[^\\[]*\\])|(\\\\)?j(Mo|MM?M?M?|Do|DDDo|DD?D?D?|w[o|w]?|YYYYY|YYYY|YY|gg(ggg?)?|)|(\\\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g\n , localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS?|LL?L?L?|l{1,4})/g\n\n , parseTokenOneOrTwoDigits = /\\d\\d?/\n , parseTokenOneToThreeDigits = /\\d{1,3}/\n , parseTokenThreeDigits = /\\d{3}/\n , parseTokenFourDigits = /\\d{1,4}/\n , parseTokenSixDigits = /[+\\-]?\\d{1,6}/\n , parseTokenWord = /[0-9]*['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+|[\\u0600-\\u06FF\\/]+(\\s*?[\\u0600-\\u06FF]+){1,2}/i\n , parseTokenTimezone = /Z|[\\+\\-]\\d\\d:?\\d\\d/i\n , parseTokenT = /T/i\n , parseTokenTimestampMs = /[\\+\\-]?\\d+(\\.\\d{1,3})?/\n , symbolMap = {\n '1': '۱',\n '2': '۲',\n '3': '۳',\n '4': '۴',\n '5': '۵',\n '6': '۶',\n '7': '۷',\n '8': '۸',\n '9': '۹',\n '0': '۰'\n }\n , numberMap = {\n '۱': '1',\n '۲': '2',\n '۳': '3',\n '۴': '4',\n '۵': '5',\n '۶': '6',\n '۷': '7',\n '۸': '8',\n '۹': '9',\n '۰': '0'\n }\n\n\n , unitAliases =\n { jm: 'jmonth'\n , jmonths: 'jmonth'\n , jy: 'jyear'\n , jyears: 'jyear'\n }\n\n , formatFunctions = {}\n\n , ordinalizeTokens = 'DDD w M D'.split(' ')\n , paddedTokens = 'M D w'.split(' ')\n\n , formatTokenFunctions =\n { jM: function () {\n return this.jMonth() + 1\n }\n , jMMM: function (format) {\n return this.localeData().jMonthsShort(this, format)\n }\n , jMMMM: function (format) {\n return this.localeData().jMonths(this, format)\n }\n , jD: function () {\n return this.jDate()\n }\n , jDDD: function () {\n return this.jDayOfYear()\n }\n , jw: function () {\n return this.jWeek()\n }\n , jYY: function () {\n return leftZeroFill(this.jYear() % 100, 2)\n }\n , jYYYY: function () {\n return leftZeroFill(this.jYear(), 4)\n }\n , jYYYYY: function () {\n return leftZeroFill(this.jYear(), 5)\n }\n , jgg: function () {\n return leftZeroFill(this.jWeekYear() % 100, 2)\n }\n , jgggg: function () {\n return this.jWeekYear()\n }\n , jggggg: function () {\n return leftZeroFill(this.jWeekYear(), 5)\n }\n }\n\nfunction padToken(func, count) {\n return function (a) {\n return leftZeroFill(func.call(this, a), count)\n }\n}\nfunction ordinalizeToken(func, period) {\n return function (a) {\n return this.localeData().ordinal(func.call(this, a), period)\n }\n}\n\n(function () {\n var i\n while (ordinalizeTokens.length) {\n i = ordinalizeTokens.pop()\n formatTokenFunctions['j' + i + 'o'] = ordinalizeToken(formatTokenFunctions['j' + i], i)\n }\n while (paddedTokens.length) {\n i = paddedTokens.pop()\n formatTokenFunctions['j' + i + i] = padToken(formatTokenFunctions['j' + i], 2)\n }\n formatTokenFunctions.jDDDD = padToken(formatTokenFunctions.jDDD, 3)\n}())\n\n/************************************\n Helpers\n************************************/\n\nfunction extend(a, b) {\n var key\n for (key in b)\n if (b.hasOwnProperty(key))\n a[key] = b[key]\n return a\n}\n\nfunction leftZeroFill(number, targetLength) {\n var output = number + ''\n while (output.length < targetLength)\n output = '0' + output\n return output\n}\n\nfunction isArray(input) {\n return Object.prototype.toString.call(input) === '[object Array]'\n}\n\n// function compareArrays(array1, array2) {\n// var len = Math.min(array1.length, array2.length)\n// , lengthDiff = Math.abs(array1.length - array2.length)\n// , diffs = 0\n// , i\n// for (i = 0; i < len; i += 1)\n// if (~~array1[i] !== ~~array2[i])\n// diffs += 1\n// return diffs + lengthDiff\n// }\n\nfunction normalizeUnits(units) {\n if (units) {\n var lowered = units.toLowerCase()\n units = unitAliases[lowered] || lowered\n }\n return units\n}\n\nfunction setDate(m, year, month, date) {\n var d = m._d\n if (isNaN(year)) {\n m._isValid = false\n }\n if (m._isUTC) {\n /*eslint-disable new-cap*/\n m._d = new Date(Date.UTC(year, month, date,\n d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()))\n /*eslint-enable new-cap*/\n } else {\n m._d = new Date(year, month, date,\n d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds())\n }\n}\n\nfunction objectCreate(parent) {\n function F() {}\n F.prototype = parent\n return new F()\n}\n\nfunction getPrototypeOf(object) {\n if (Object.getPrototypeOf)\n return Object.getPrototypeOf(object)\n else if (''.__proto__)\n return object.__proto__\n else\n return object.constructor.prototype\n}\n\n/************************************\n Languages\n************************************/\nextend(getPrototypeOf(moment.localeData()),\n { _jMonths: [ 'Farvardin'\n , 'Ordibehesht'\n , 'Khordaad'\n , 'Tir'\n , 'Amordaad'\n , 'Shahrivar'\n , 'Mehr'\n , 'Aabaan'\n , 'Aazar'\n , 'Dey'\n , 'Bahman'\n , 'Esfand'\n ]\n , jMonths: function (m) {\n return this._jMonths[m.jMonth()]\n }\n\n , _jMonthsShort: [ 'Far'\n , 'Ord'\n , 'Kho'\n , 'Tir'\n , 'Amo'\n , 'Sha'\n , 'Meh'\n , 'Aab'\n , 'Aaz'\n , 'Dey'\n , 'Bah'\n , 'Esf'\n ]\n , jMonthsShort: function (m) {\n return this._jMonthsShort[m.jMonth()]\n }\n\n , jMonthsParse: function (monthName) {\n var i\n , mom\n , regex\n if (!this._jMonthsParse)\n this._jMonthsParse = []\n for (i = 0; i < 12; i += 1) {\n // Make the regex if we don't have it already.\n if (!this._jMonthsParse[i]) {\n mom = jMoment([2000, (2 + i) % 12, 25])\n regex = '^' + this.jMonths(mom, '') + '|^' + this.jMonthsShort(mom, '')\n this._jMonthsParse[i] = new RegExp(regex.replace('.', ''), 'i')\n }\n // Test the regex.\n if (this._jMonthsParse[i].test(monthName))\n return i\n }\n }\n }\n)\n\n/************************************\n Formatting\n************************************/\n\nfunction makeFormatFunction(format) {\n var array = format.match(formattingTokens)\n , length = array.length\n , i\n\n for (i = 0; i < length; i += 1)\n if (formatTokenFunctions[array[i]])\n array[i] = formatTokenFunctions[array[i]]\n\n return function (mom) {\n var output = ''\n for (i = 0; i < length; i += 1)\n output += array[i] instanceof Function ? '[' + array[i].call(mom, format) + ']' : array[i]\n return output\n }\n}\n\n/************************************\n Parsing\n************************************/\n\nfunction getParseRegexForToken(token, config) {\n switch (token) {\n case 'jDDDD':\n return parseTokenThreeDigits\n case 'jYYYY':\n return parseTokenFourDigits\n case 'jYYYYY':\n return parseTokenSixDigits\n case 'jDDD':\n return parseTokenOneToThreeDigits\n case 'jMMM':\n case 'jMMMM':\n return parseTokenWord\n case 'jMM':\n case 'jDD':\n case 'jYY':\n case 'jM':\n case 'jD':\n return parseTokenOneOrTwoDigits\n case 'DDDD':\n return parseTokenThreeDigits\n case 'YYYY':\n return parseTokenFourDigits\n case 'YYYYY':\n return parseTokenSixDigits\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord\n case 'a':\n case 'A':\n return moment.localeData(config._l)._meridiemParse\n case 'X':\n return parseTokenTimestampMs\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone\n case 'T':\n return parseTokenT\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits\n default:\n return new RegExp(token.replace('\\\\', ''))\n }\n}\n\nfunction addTimeToArrayFromToken(token, input, config) {\n var a\n , datePartArray = config._a\n\n switch (token) {\n case 'jM':\n case 'jMM':\n datePartArray[1] = input == null ? 0 : ~~input - 1\n break\n case 'jMMM':\n case 'jMMMM':\n a = moment.localeData(config._l).jMonthsParse(input)\n if (a != null)\n datePartArray[1] = a\n else\n config._isValid = false\n break\n case 'jD':\n case 'jDD':\n case 'jDDD':\n case 'jDDDD':\n if (input != null)\n datePartArray[2] = ~~input\n break\n case 'jYY':\n datePartArray[0] = ~~input + (~~input > 47 ? 1300 : 1400)\n break\n case 'jYYYY':\n case 'jYYYYY':\n datePartArray[0] = ~~input\n }\n if (input == null)\n config._isValid = false\n}\n\nfunction dateFromArray(config) {\n var g\n , j\n , jy = config._a[0]\n , jm = config._a[1]\n , jd = config._a[2]\n\n if ((jy == null) && (jm == null) && (jd == null))\n return [0, 0, 1]\n jy = jy != null ? jy : 0\n jm = jm != null ? jm : 0\n jd = jd != null ? jd : 1\n if (jd < 1 || jd > jMoment.jDaysInMonth(jy, jm) || jm < 0 || jm > 11)\n config._isValid = false\n g = toGregorian(jy, jm, jd)\n j = toJalaali(g.gy, g.gm, g.gd)\n if (isNaN(g.gy))\n config._isValid = false\n config._jDiff = 0\n if (~~j.jy !== jy)\n config._jDiff += 1\n if (~~j.jm !== jm)\n config._jDiff += 1\n if (~~j.jd !== jd)\n config._jDiff += 1\n return [g.gy, g.gm, g.gd]\n}\n\nfunction makeDateFromStringAndFormat(config) {\n var tokens = config._f.match(formattingTokens)\n , string = config._i + ''\n , len = tokens.length\n , i\n , token\n , parsedInput\n\n config._a = []\n\n for (i = 0; i < len; i += 1) {\n token = tokens[i]\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0]\n if (parsedInput)\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length)\n if (formatTokenFunctions[token])\n addTimeToArrayFromToken(token, parsedInput, config)\n }\n if (string)\n config._il = string\n return dateFromArray(config)\n}\n\nfunction makeDateFromStringAndArray(config, utc) {\n var len = config._f.length\n , i\n , format\n , tempMoment\n , bestMoment\n , currentScore\n , scoreToBeat\n\n if (len === 0) {\n return makeMoment(new Date(NaN))\n }\n\n for (i = 0; i < len; i += 1) {\n format = config._f[i]\n currentScore = 0\n tempMoment = makeMoment(config._i, format, config._l, config._strict, utc)\n\n if (!tempMoment.isValid()) continue\n\n // currentScore = compareArrays(tempMoment._a, tempMoment.toArray())\n currentScore += tempMoment._jDiff\n if (tempMoment._il)\n currentScore += tempMoment._il.length\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore\n bestMoment = tempMoment\n }\n }\n\n return bestMoment\n}\n\nfunction removeParsedTokens(config) {\n var string = config._i + ''\n , input = ''\n , format = ''\n , array = config._f.match(formattingTokens)\n , len = array.length\n , i\n , match\n , parsed\n\n for (i = 0; i < len; i += 1) {\n match = array[i]\n parsed = (getParseRegexForToken(match, config).exec(string) || [])[0]\n if (parsed)\n string = string.slice(string.indexOf(parsed) + parsed.length)\n if (!(formatTokenFunctions[match] instanceof Function)) {\n format += match\n if (parsed)\n input += parsed\n }\n }\n config._i = input\n config._f = format\n}\n\n/************************************\n Week of Year\n************************************/\n\nfunction jWeekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek\n , daysToDayOfWeek = firstDayOfWeekOfYear - mom.day()\n , adjustedMoment\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7\n }\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7\n }\n adjustedMoment = jMoment(mom).add(daysToDayOfWeek, 'd')\n return { week: Math.ceil(adjustedMoment.jDayOfYear() / 7)\n , year: adjustedMoment.jYear()\n }\n}\n\n/************************************\n Top Level Functions\n************************************/\nvar maxTimestamp = 57724432199999\n\nfunction makeMoment(input, format, lang, strict, utc) {\n if (typeof lang === 'boolean') {\n strict = lang\n lang = undefined\n }\n\n if (format && typeof format === 'string')\n format = fixFormat(format, moment)\n\n var config =\n { _i: input\n , _f: format\n , _l: lang\n , _strict: strict\n , _isUTC: utc\n }\n , date\n , m\n , jm\n , origInput = input\n , origFormat = format\n if (format) {\n if (isArray(format)) {\n return makeDateFromStringAndArray(config, utc)\n } else {\n date = makeDateFromStringAndFormat(config)\n removeParsedTokens(config)\n format = 'YYYY-MM-DD-' + config._f\n input = leftZeroFill(date[0], 4) + '-'\n + leftZeroFill(date[1] + 1, 2) + '-'\n + leftZeroFill(date[2], 2) + '-'\n + config._i\n }\n }\n if (utc)\n m = moment.utc(input, format, lang, strict)\n else\n m = moment(input, format, lang, strict)\n if (config._isValid === false)\n m._isValid = false\n m._jDiff = config._jDiff || 0\n jm = objectCreate(jMoment.fn)\n extend(jm, m)\n if (strict && format && jm.isValid()) {\n jm._isValid = jm.format(origFormat) === origInput\n }\n if (m._d.getTime() > maxTimestamp) {\n jm._isValid = false\n }\n return jm\n}\n\nfunction jMoment(input, format, lang, strict) {\n return makeMoment(input, format, lang, strict, false)\n}\n\nextend(jMoment, moment)\njMoment.fn = objectCreate(moment.fn)\n\njMoment.utc = function (input, format, lang, strict) {\n return makeMoment(input, format, lang, strict, true)\n}\n\njMoment.unix = function (input) {\n return makeMoment(input * 1000)\n}\n\n/************************************\n jMoment Prototype\n************************************/\n\nfunction fixFormat(format, _moment) {\n var i = 5\n var replace = function (input) {\n return _moment.localeData().longDateFormat(input) || input\n }\n while (i > 0 && localFormattingTokens.test(format)) {\n i -= 1\n format = format.replace(localFormattingTokens, replace)\n }\n return format\n}\n\njMoment.fn.format = function (format) {\n\n if (format) {\n format = fixFormat(format, this)\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format)\n }\n format = formatFunctions[format](this)\n }\n return moment.fn.format.call(this, format)\n}\n\njMoment.fn.jYear = function (input) {\n var lastDay\n , j\n , g\n if (typeof input === 'number') {\n j = toJalaali(this.year(), this.month(), this.date())\n lastDay = Math.min(j.jd, jMoment.jDaysInMonth(input, j.jm))\n g = toGregorian(input, j.jm, lastDay)\n setDate(this, g.gy, g.gm, g.gd)\n moment.updateOffset(this)\n return this\n } else {\n return toJalaali(this.year(), this.month(), this.date()).jy\n }\n}\n\njMoment.fn.jMonth = function (input) {\n var lastDay\n , j\n , g\n if (input != null) {\n if (typeof input === 'string') {\n input = this.localeData().jMonthsParse(input)\n if (typeof input !== 'number')\n return this\n }\n j = toJalaali(this.year(), this.month(), this.date())\n lastDay = Math.min(j.jd, jMoment.jDaysInMonth(j.jy, input))\n this.jYear(j.jy + div(input, 12))\n input = mod(input, 12)\n if (input < 0) {\n input += 12\n this.jYear(this.jYear() - 1)\n }\n g = toGregorian(this.jYear(), input, lastDay)\n setDate(this, g.gy, g.gm, g.gd)\n moment.updateOffset(this)\n return this\n } else {\n return toJalaali(this.year(), this.month(), this.date()).jm\n }\n}\n\njMoment.fn.jDate = function (input) {\n var j\n , g\n if (typeof input === 'number') {\n j = toJalaali(this.year(), this.month(), this.date())\n g = toGregorian(j.jy, j.jm, input)\n setDate(this, g.gy, g.gm, g.gd)\n moment.updateOffset(this)\n return this\n } else {\n return toJalaali(this.year(), this.month(), this.date()).jd\n }\n}\n\njMoment.fn.jDayOfYear = function (input) {\n var dayOfYear = Math.round((jMoment(this).startOf('day') - jMoment(this).startOf('jYear')) / 864e5) + 1\n return input == null ? dayOfYear : this.add(input - dayOfYear, 'd')\n}\n\njMoment.fn.jWeek = function (input) {\n var week = jWeekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).week\n return input == null ? week : this.add((input - week) * 7, 'd')\n}\n\njMoment.fn.jWeekYear = function (input) {\n var year = jWeekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year\n return input == null ? year : this.add(input - year, 'y')\n}\n\njMoment.fn.add = function (val, units) {\n var temp\n if (units !== null && !isNaN(+units)) {\n temp = val\n val = units\n units = temp\n }\n units = normalizeUnits(units)\n if (units === 'jyear') {\n this.jYear(this.jYear() + val)\n } else if (units === 'jmonth') {\n this.jMonth(this.jMonth() + val)\n } else {\n moment.fn.add.call(this, val, units)\n if (isNaN(this.jYear())) {\n this._isValid = false\n }\n }\n return this\n}\n\njMoment.fn.subtract = function (val, units) {\n var temp\n if (units !== null && !isNaN(+units)) {\n temp = val\n val = units\n units = temp\n }\n units = normalizeUnits(units)\n if (units === 'jyear') {\n this.jYear(this.jYear() - val)\n } else if (units === 'jmonth') {\n this.jMonth(this.jMonth() - val)\n } else {\n moment.fn.subtract.call(this, val, units)\n }\n return this\n}\n\njMoment.fn.startOf = function (units) {\n units = normalizeUnits(units)\n if (units === 'jyear' || units === 'jmonth') {\n if (units === 'jyear') {\n this.jMonth(0)\n }\n this.jDate(1)\n this.hours(0)\n this.minutes(0)\n this.seconds(0)\n this.milliseconds(0)\n return this\n } else {\n return moment.fn.startOf.call(this, units)\n }\n}\n\njMoment.fn.endOf = function (units) {\n units = normalizeUnits(units)\n if (units === undefined || units === 'milisecond') {\n return this\n }\n return this.startOf(units).add(1, (units === 'isoweek' ? 'week' : units)).subtract(1, 'ms')\n}\n\njMoment.fn.isSame = function (other, units) {\n units = normalizeUnits(units)\n if (units === 'jyear' || units === 'jmonth') {\n return moment.fn.isSame.call(this.startOf(units), other.startOf(units))\n }\n return moment.fn.isSame.call(this, other, units)\n}\n\njMoment.fn.clone = function () {\n return jMoment(this)\n}\n\njMoment.fn.jYears = jMoment.fn.jYear\njMoment.fn.jMonths = jMoment.fn.jMonth\njMoment.fn.jDates = jMoment.fn.jDate\njMoment.fn.jWeeks = jMoment.fn.jWeek\n\n/************************************\n jMoment Statics\n************************************/\n\njMoment.jDaysInMonth = function (year, month) {\n year += div(month, 12)\n month = mod(month, 12)\n if (month < 0) {\n month += 12\n year -= 1\n }\n if (month < 6) {\n return 31\n } else if (month < 11) {\n return 30\n } else if (jMoment.jIsLeapYear(year)) {\n return 30\n } else {\n return 29\n }\n}\n\njMoment.jIsLeapYear = jalaali.isLeapJalaaliYear\n\njMoment.loadPersian = function (args) {\n var usePersianDigits = args !== undefined && args.hasOwnProperty('usePersianDigits') ? args.usePersianDigits : false\n var dialect = args !== undefined && args.hasOwnProperty('dialect') ? args.dialect : 'persian'\n moment.locale('fa')\n moment.updateLocale('fa'\n , { months: ('ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر').split('_')\n , monthsShort: ('ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر').split('_')\n , weekdays:\n {\n 'persian': ('یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_آدینه_شنبه').split('_'),\n 'persian-modern': ('یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_جمعه_شنبه').split('_')\n }[dialect]\n , weekdaysShort:\n {\n 'persian': ('یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_آدینه_شنبه').split('_'),\n 'persian-modern': ('یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_جمعه_شنبه').split('_')\n }[dialect]\n , weekdaysMin:\n {\n 'persian': 'ی_د_س_چ_پ_آ_ش'.split('_'),\n 'persian-modern': 'ی_د_س_چ_پ_ج_ش'.split('_')\n }[dialect]\n , longDateFormat:\n { LT: 'HH:mm'\n , L: 'jYYYY/jMM/jDD'\n , LL: 'jD jMMMM jYYYY'\n , LLL: 'jD jMMMM jYYYY LT'\n , LLLL: 'dddd، jD jMMMM jYYYY LT'\n }\n , calendar:\n { sameDay: '[امروز ساعت] LT'\n , nextDay: '[فردا ساعت] LT'\n , nextWeek: 'dddd [ساعت] LT'\n , lastDay: '[دیروز ساعت] LT'\n , lastWeek: 'dddd [ی پیش ساعت] LT'\n , sameElse: 'L'\n }\n , relativeTime:\n { future: 'در %s'\n , past: '%s پیش'\n , s: 'چند ثانیه'\n , m: '1 دقیقه'\n , mm: '%d دقیقه'\n , h: '1 ساعت'\n , hh: '%d ساعت'\n , d: '1 روز'\n , dd: '%d روز'\n , M: '1 ماه'\n , MM: '%d ماه'\n , y: '1 سال'\n , yy: '%d سال'\n }\n , preparse: function (string) {\n if (usePersianDigits) {\n return string.replace(/[۰-۹]/g, function (match) {\n return numberMap[match]\n }).replace(/،/g, ',')\n }\n return string\n }\n , postformat: function (string) {\n if (usePersianDigits) {\n return string.replace(/\\d/g, function (match) {\n return symbolMap[match]\n }).replace(/,/g, '،')\n }\n return string\n }\n , ordinal: '%dم'\n , week:\n { dow: 6 // Saturday is the first day of the week.\n , doy: 12 // The week that contains Jan 1st is the first week of the year.\n }\n , meridiem: function (hour) {\n return hour < 12 ? 'ق.ظ' : 'ب.ظ'\n }\n , jMonths:\n {\n 'persian': ('فروردین_اردیبهشت_خرداد_تیر_امرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند').split('_'),\n 'persian-modern': ('فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند').split('_')\n }[dialect]\n , jMonthsShort:\n {\n 'persian': 'فرو_ارد_خرد_تیر_امر_شهر_مهر_آبا_آذر_دی_بهم_اسف'.split('_'),\n 'persian-modern': 'فرو_ارد_خرد_تیر_مرد_شهر_مهر_آبا_آذر_دی_بهم_اسف'.split('_')\n }[dialect]\n }\n )\n}\n\njMoment.jConvert = { toJalaali: toJalaali\n , toGregorian: toGregorian\n }\n\n/************************************\n Jalaali Conversion\n************************************/\n\nfunction toJalaali(gy, gm, gd) {\n try {\n var j = jalaali.toJalaali(gy, gm + 1, gd)\n j.jm -= 1\n return j\n } catch (e) {\n return {\n jy: NaN\n , jm: NaN\n , jd: NaN\n }\n }\n}\n\nfunction toGregorian(jy, jm, jd) {\n try {\n var g = jalaali.toGregorian(jy, jm + 1, jd)\n g.gm -= 1\n return g\n } catch (e) {\n return {\n gy: NaN\n , gm: NaN\n , gd: NaN\n }\n }\n}\n\n/*\n Utility helper functions.\n*/\n\nfunction div(a, b) {\n return ~~(a / b)\n}\n\nfunction mod(a, b) {\n return a - ~~(a / b) * b\n}\n","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"moment\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"moment-range\", [\"moment\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"moment-range\"] = factory(require(\"moment\"));\n\telse\n\t\troot[\"moment-range\"] = factory(root[\"moment\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"moment\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"moment-range\", [\"moment\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"moment-range\"] = factory(require(\"moment\"));\n\telse\n\t\troot[\"moment-range\"] = factory(root[\"moment\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _undefined = __webpack_require__(5)(); // Support ES3 engines\n\nmodule.exports = function (val) {\n return (val !== _undefined) && (val !== null);\n};\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(18)() ? Symbol : __webpack_require__(20);\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.DateRange = undefined;\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nexports.extendMoment = extendMoment;\n\nvar _moment = __webpack_require__(2);\n\nvar _moment2 = _interopRequireDefault(_moment);\n\nvar _es6Symbol = __webpack_require__(1);\n\nvar _es6Symbol2 = _interopRequireDefault(_es6Symbol);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n//-----------------------------------------------------------------------------\n// Constants\n//-----------------------------------------------------------------------------\n\nvar INTERVALS = {\n year: true,\n quarter: true,\n month: true,\n week: true,\n day: true,\n hour: true,\n minute: true,\n second: true\n};\n\n//-----------------------------------------------------------------------------\n// Date Ranges\n//-----------------------------------------------------------------------------\n\nvar DateRange = exports.DateRange = function () {\n function DateRange(start, end) {\n _classCallCheck(this, DateRange);\n\n var s = start;\n var e = end;\n\n if (arguments.length === 1 || end === undefined) {\n if ((typeof start === 'undefined' ? 'undefined' : _typeof(start)) === 'object' && start.length === 2) {\n var _start = _slicedToArray(start, 2);\n\n s = _start[0];\n e = _start[1];\n } else if (typeof start === 'string') {\n var _isoSplit = isoSplit(start);\n\n var _isoSplit2 = _slicedToArray(_isoSplit, 2);\n\n s = _isoSplit2[0];\n e = _isoSplit2[1];\n }\n }\n\n this.start = s || s === 0 ? (0, _moment2.default)(s) : (0, _moment2.default)(-8640000000000000);\n this.end = e || e === 0 ? (0, _moment2.default)(e) : (0, _moment2.default)(8640000000000000);\n }\n\n _createClass(DateRange, [{\n key: 'adjacent',\n value: function adjacent(other) {\n var sameStartEnd = this.start.isSame(other.end);\n var sameEndStart = this.end.isSame(other.start);\n\n return sameStartEnd && other.start.valueOf() <= this.start.valueOf() || sameEndStart && other.end.valueOf() >= this.end.valueOf();\n }\n }, {\n key: 'add',\n value: function add(other) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { adjacent: false };\n\n if (this.overlaps(other, options)) {\n return new this.constructor(_moment2.default.min(this.start, other.start), _moment2.default.max(this.end, other.end));\n }\n\n return null;\n }\n }, {\n key: 'by',\n value: function by(interval) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { excludeEnd: false, step: 1 };\n\n var range = this;\n\n return _defineProperty({}, _es6Symbol2.default.iterator, function () {\n var step = options.step || 1;\n var diff = Math.abs(range.start.diff(range.end, interval)) / step;\n var excludeEnd = options.excludeEnd || false;\n var iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeEnd = options.exclusive;\n }\n\n return {\n next: function next() {\n var current = range.start.clone().add(iteration * step, interval);\n var done = excludeEnd ? !(iteration < diff) : !(iteration <= diff);\n\n iteration++;\n\n return {\n done: done,\n value: done ? undefined : current\n };\n }\n };\n });\n }\n }, {\n key: 'byRange',\n value: function byRange(interval) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { excludeEnd: false, step: 1 };\n\n var range = this;\n var step = options.step || 1;\n var diff = this.valueOf() / interval.valueOf() / step;\n var unit = Math.floor(diff);\n var excludeEnd = options.excludeEnd || false;\n var iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeEnd = options.exclusive;\n }\n\n return _defineProperty({}, _es6Symbol2.default.iterator, function () {\n if (unit === Infinity) {\n return { done: true };\n }\n\n return {\n next: function next() {\n var current = (0, _moment2.default)(range.start.valueOf() + interval.valueOf() * iteration * step);\n var done = unit === diff && excludeEnd ? !(iteration < unit) : !(iteration <= unit);\n\n iteration++;\n\n return {\n done: done,\n value: done ? undefined : current\n };\n }\n };\n });\n }\n }, {\n key: 'center',\n value: function center() {\n var center = this.start.valueOf() + this.diff() / 2;\n\n return (0, _moment2.default)(center);\n }\n }, {\n key: 'clone',\n value: function clone() {\n return new this.constructor(this.start.clone(), this.end.clone());\n }\n }, {\n key: 'contains',\n value: function contains(other) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { excludeStart: false, excludeEnd: false };\n\n var start = this.start.valueOf();\n var end = this.end.valueOf();\n var oStart = other.valueOf();\n var oEnd = other.valueOf();\n var excludeStart = options.excludeStart || false;\n var excludeEnd = options.excludeEnd || false;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeStart = excludeEnd = options.exclusive;\n }\n\n if (other instanceof DateRange) {\n oStart = other.start.valueOf();\n oEnd = other.end.valueOf();\n }\n\n var startInRange = start < oStart || start <= oStart && !excludeStart;\n var endInRange = end > oEnd || end >= oEnd && !excludeEnd;\n\n return startInRange && endInRange;\n }\n }, {\n key: 'diff',\n value: function diff(unit, precise) {\n return this.end.diff(this.start, unit, precise);\n }\n }, {\n key: 'duration',\n value: function duration(unit, precise) {\n return this.diff(unit, precise);\n }\n }, {\n key: 'intersect',\n value: function intersect(other) {\n var start = this.start.valueOf();\n var end = this.end.valueOf();\n var otherStart = other.start.valueOf();\n var otherEnd = other.end.valueOf();\n var isZeroLength = start == end;\n var isOtherZeroLength = otherStart == otherEnd;\n\n // Zero-length ranges\n if (isZeroLength) {\n var point = start;\n\n if (point == otherStart || point == otherEnd) {\n return null;\n } else if (point > otherStart && point < otherEnd) {\n return this.clone();\n }\n } else if (isOtherZeroLength) {\n var _point = otherStart;\n\n if (_point == start || _point == end) {\n return null;\n } else if (_point > start && _point < end) {\n return new this.constructor(_point, _point);\n }\n }\n\n // Non zero-length ranges\n if (start <= otherStart && otherStart < end && end < otherEnd) {\n return new this.constructor(otherStart, end);\n } else if (otherStart < start && start < otherEnd && otherEnd <= end) {\n return new this.constructor(start, otherEnd);\n } else if (otherStart < start && start <= end && end < otherEnd) {\n return this.clone();\n } else if (start <= otherStart && otherStart <= otherEnd && otherEnd <= end) {\n return new this.constructor(otherStart, otherEnd);\n }\n\n return null;\n }\n }, {\n key: 'isEqual',\n value: function isEqual(other) {\n return this.start.isSame(other.start) && this.end.isSame(other.end);\n }\n }, {\n key: 'isSame',\n value: function isSame(other) {\n return this.isEqual(other);\n }\n }, {\n key: 'overlaps',\n value: function overlaps(other) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { adjacent: false };\n\n var intersects = this.intersect(other) !== null;\n\n if (options.adjacent && !intersects) {\n return this.adjacent(other);\n }\n\n return intersects;\n }\n }, {\n key: 'reverseBy',\n value: function reverseBy(interval) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { excludeStart: false, step: 1 };\n\n var range = this;\n\n return _defineProperty({}, _es6Symbol2.default.iterator, function () {\n var step = options.step || 1;\n var diff = Math.abs(range.start.diff(range.end, interval)) / step;\n var excludeStart = options.excludeStart || false;\n var iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeStart = options.exclusive;\n }\n\n return {\n next: function next() {\n var current = range.end.clone().subtract(iteration * step, interval);\n var done = excludeStart ? !(iteration < diff) : !(iteration <= diff);\n\n iteration++;\n\n return {\n done: done,\n value: done ? undefined : current\n };\n }\n };\n });\n }\n }, {\n key: 'reverseByRange',\n value: function reverseByRange(interval) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { excludeStart: false, step: 1 };\n\n var range = this;\n var step = options.step || 1;\n var diff = this.valueOf() / interval.valueOf() / step;\n var unit = Math.floor(diff);\n var excludeStart = options.excludeStart || false;\n var iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeStart = options.exclusive;\n }\n\n return _defineProperty({}, _es6Symbol2.default.iterator, function () {\n if (unit === Infinity) {\n return { done: true };\n }\n\n return {\n next: function next() {\n var current = (0, _moment2.default)(range.end.valueOf() - interval.valueOf() * iteration * step);\n var done = unit === diff && excludeStart ? !(iteration < unit) : !(iteration <= unit);\n\n iteration++;\n\n return {\n done: done,\n value: done ? undefined : current\n };\n }\n };\n });\n }\n }, {\n key: 'snapTo',\n value: function snapTo(interval) {\n var r = this.clone();\n\n // Snap if not open-ended range\n if (!r.start.isSame((0, _moment2.default)(-8640000000000000))) {\n r.start = r.start.startOf(interval);\n }\n if (!r.end.isSame((0, _moment2.default)(8640000000000000))) {\n r.end = r.end.endOf(interval);\n }\n\n return r;\n }\n }, {\n key: 'subtract',\n value: function subtract(other) {\n var start = this.start.valueOf();\n var end = this.end.valueOf();\n var oStart = other.start.valueOf();\n var oEnd = other.end.valueOf();\n\n if (this.intersect(other) === null) {\n return [this];\n } else if (oStart <= start && start < end && end <= oEnd) {\n return [];\n } else if (oStart <= start && start < oEnd && oEnd < end) {\n return [new this.constructor(oEnd, end)];\n } else if (start < oStart && oStart < end && end <= oEnd) {\n return [new this.constructor(start, oStart)];\n } else if (start < oStart && oStart < oEnd && oEnd < end) {\n return [new this.constructor(start, oStart), new this.constructor(oEnd, end)];\n } else if (start < oStart && oStart < end && oEnd < end) {\n return [new this.constructor(start, oStart), new this.constructor(oStart, end)];\n }\n\n return [];\n }\n }, {\n key: 'toDate',\n value: function toDate() {\n return [this.start.toDate(), this.end.toDate()];\n }\n }, {\n key: 'toString',\n value: function toString() {\n return this.start.format() + '/' + this.end.format();\n }\n }, {\n key: 'valueOf',\n value: function valueOf() {\n return this.end.valueOf() - this.start.valueOf();\n }\n }]);\n\n return DateRange;\n}();\n\n//-----------------------------------------------------------------------------\n// Moment Extensions\n//-----------------------------------------------------------------------------\n\nfunction extendMoment(moment) {\n /**\n * Build a date range.\n */\n moment.range = function range(start, end) {\n var m = this;\n\n if (typeof start === 'string' && INTERVALS.hasOwnProperty(start)) {\n return new DateRange(moment(m).startOf(start), moment(m).endOf(start));\n }\n\n return new DateRange(start, end);\n };\n\n /**\n * Build a date range between a date (or now) and a specified interval.\n * @param {String} interval The type of interval\n * @param {Number} [count=1] The number of intervals (positive or negative)\n * @param {Moment|Date} [date=moment()] The date to use\n * @return {DateRange}\n */\n moment.rangeFromInterval = function (interval) {\n var count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var date = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : moment();\n\n if (!moment.isMoment(date)) date = moment(date);\n if (!date.isValid()) throw new Error('Invalid date.');\n\n var dateWithInterval = date.clone().add(count, interval);\n\n // Handle negative interval counts by assembling the dates in chronological order.\n var dates = [];\n dates.push(moment.min(date, dateWithInterval));\n dates.push(moment.max(date, dateWithInterval));\n\n return new DateRange(dates);\n };\n\n /**\n * Uses moment.parseZone on both the start and end of the given time interval\n * to preserve the time zones on the resulting DateRange object.\n * @param {string} isoTimeInterval the timeInterval to be parsed\n * @return {DateRange} constructed using moments that will preserve the time zones\n */\n moment.rangeFromISOString = function (isoTimeInterval) {\n var momentStrings = isoSplit(isoTimeInterval);\n var start = moment.parseZone(momentStrings[0]);\n var end = moment.parseZone(momentStrings[1]);\n return new DateRange(start, end);\n };\n\n moment.parseZoneRange = moment.rangeFromISOString; // DEPRECATED 4.0.0\n\n /**\n * Alias of static constructor.\n */\n moment.fn.range = moment.range;\n\n /**\n * Expose constructor\n */\n moment.range.constructor = DateRange;\n\n /**\n * Check if the current object is a date range.\n */\n moment.isRange = function (range) {\n return range instanceof DateRange;\n };\n\n /**\n * Check if the current moment is within a given date range.\n */\n moment.fn.within = function (range) {\n return range.contains(this.toDate());\n };\n\n return moment;\n}\n\n//-----------------------------------------------------------------------------\n// Utility Functions\n//-----------------------------------------------------------------------------\n\n/**\n * Splits an iso string into two strings.\n */\nfunction isoSplit(isoString) {\n return isoString.split('/');\n}\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar assign = __webpack_require__(6)\n , normalizeOpts = __webpack_require__(13)\n , isCallable = __webpack_require__(9)\n , contains = __webpack_require__(15)\n\n , d;\n\nd = module.exports = function (dscr, value/*, options*/) {\n\tvar c, e, w, options, desc;\n\tif ((arguments.length < 2) || (typeof dscr !== 'string')) {\n\t\toptions = value;\n\t\tvalue = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[2];\n\t}\n\tif (dscr == null) {\n\t\tc = w = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t\tw = contains.call(dscr, 'w');\n\t}\n\n\tdesc = { value: value, configurable: c, enumerable: e, writable: w };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\nd.gs = function (dscr, get, set/*, options*/) {\n\tvar c, e, options, desc;\n\tif (typeof dscr !== 'string') {\n\t\toptions = set;\n\t\tset = get;\n\t\tget = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[3];\n\t}\n\tif (get == null) {\n\t\tget = undefined;\n\t} else if (!isCallable(get)) {\n\t\toptions = get;\n\t\tget = set = undefined;\n\t} else if (set == null) {\n\t\tset = undefined;\n\t} else if (!isCallable(set)) {\n\t\toptions = set;\n\t\tset = undefined;\n\t}\n\tif (dscr == null) {\n\t\tc = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t}\n\n\tdesc = { get: get, set: set, configurable: c, enumerable: e };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n// eslint-disable-next-line no-empty-function\nmodule.exports = function () {};\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(7)()\n\t? Object.assign\n\t: __webpack_require__(8);\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n\tvar assign = Object.assign, obj;\n\tif (typeof assign !== \"function\") return false;\n\tobj = { foo: \"raz\" };\n\tassign(obj, { bar: \"dwa\" }, { trzy: \"trzy\" });\n\treturn (obj.foo + obj.bar + obj.trzy) === \"razdwatrzy\";\n};\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar keys = __webpack_require__(10)\n , value = __webpack_require__(14)\n , max = Math.max;\n\nmodule.exports = function (dest, src /*, …srcn*/) {\n\tvar error, i, length = max(arguments.length, 2), assign;\n\tdest = Object(value(dest));\n\tassign = function (key) {\n\t\ttry {\n\t\t\tdest[key] = src[key];\n\t\t} catch (e) {\n\t\t\tif (!error) error = e;\n\t\t}\n\t};\n\tfor (i = 1; i < length; ++i) {\n\t\tsrc = arguments[i];\n\t\tkeys(src).forEach(assign);\n\t}\n\tif (error !== undefined) throw error;\n\treturn dest;\n};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n// Deprecated\n\n\n\nmodule.exports = function (obj) {\n return typeof obj === \"function\";\n};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(11)() ? Object.keys : __webpack_require__(12);\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n\ttry {\n\t\tObject.keys(\"primitive\");\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isValue = __webpack_require__(0);\n\nvar keys = Object.keys;\n\nmodule.exports = function (object) { return keys(isValue(object) ? Object(object) : object); };\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isValue = __webpack_require__(0);\n\nvar forEach = Array.prototype.forEach, create = Object.create;\n\nvar process = function (src, obj) {\n\tvar key;\n\tfor (key in src) obj[key] = src[key];\n};\n\n// eslint-disable-next-line no-unused-vars\nmodule.exports = function (opts1 /*, …options*/) {\n\tvar result = create(null);\n\tforEach.call(arguments, function (options) {\n\t\tif (!isValue(options)) return;\n\t\tprocess(Object(options), result);\n\t});\n\treturn result;\n};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isValue = __webpack_require__(0);\n\nmodule.exports = function (value) {\n\tif (!isValue(value)) throw new TypeError(\"Cannot use null or undefined\");\n\treturn value;\n};\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(16)()\n\t? String.prototype.contains\n\t: __webpack_require__(17);\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar str = \"razdwatrzy\";\n\nmodule.exports = function () {\n\tif (typeof str.contains !== \"function\") return false;\n\treturn (str.contains(\"dwa\") === true) && (str.contains(\"foo\") === false);\n};\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar indexOf = String.prototype.indexOf;\n\nmodule.exports = function (searchString/*, position*/) {\n\treturn indexOf.call(this, searchString, arguments[1]) > -1;\n};\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar validTypes = { object: true, symbol: true };\n\nmodule.exports = function () {\n\tvar symbol;\n\tif (typeof Symbol !== 'function') return false;\n\tsymbol = Symbol('test symbol');\n\ttry { String(symbol); } catch (e) { return false; }\n\n\t// Return 'true' also for polyfills\n\tif (!validTypes[typeof Symbol.iterator]) return false;\n\tif (!validTypes[typeof Symbol.toPrimitive]) return false;\n\tif (!validTypes[typeof Symbol.toStringTag]) return false;\n\n\treturn true;\n};\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (x) {\n\tif (!x) return false;\n\tif (typeof x === 'symbol') return true;\n\tif (!x.constructor) return false;\n\tif (x.constructor.name !== 'Symbol') return false;\n\treturn (x[x.constructor.toStringTag] === 'Symbol');\n};\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n// ES2015 Symbol polyfill for environments that do not (or partially) support it\n\n\n\nvar d = __webpack_require__(4)\n , validateSymbol = __webpack_require__(21)\n\n , create = Object.create, defineProperties = Object.defineProperties\n , defineProperty = Object.defineProperty, objPrototype = Object.prototype\n , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)\n , isNativeSafe;\n\nif (typeof Symbol === 'function') {\n\tNativeSymbol = Symbol;\n\ttry {\n\t\tString(NativeSymbol());\n\t\tisNativeSafe = true;\n\t} catch (ignore) {}\n}\n\nvar generateName = (function () {\n\tvar created = create(null);\n\treturn function (desc) {\n\t\tvar postfix = 0, name, ie11BugWorkaround;\n\t\twhile (created[desc + (postfix || '')]) ++postfix;\n\t\tdesc += (postfix || '');\n\t\tcreated[desc] = true;\n\t\tname = '@@' + desc;\n\t\tdefineProperty(objPrototype, name, d.gs(null, function (value) {\n\t\t\t// For IE11 issue see:\n\t\t\t// https://connect.microsoft.com/IE/feedbackdetail/view/1928508/\n\t\t\t// ie11-broken-getters-on-dom-objects\n\t\t\t// https://github.com/medikoo/es6-symbol/issues/12\n\t\t\tif (ie11BugWorkaround) return;\n\t\t\tie11BugWorkaround = true;\n\t\t\tdefineProperty(this, name, d(value));\n\t\t\tie11BugWorkaround = false;\n\t\t}));\n\t\treturn name;\n\t};\n}());\n\n// Internal constructor (not one exposed) for creating Symbol instances.\n// This one is used to ensure that `someSymbol instanceof Symbol` always return false\nHiddenSymbol = function Symbol(description) {\n\tif (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');\n\treturn SymbolPolyfill(description);\n};\n\n// Exposed `Symbol` constructor\n// (returns instances of HiddenSymbol)\nmodule.exports = SymbolPolyfill = function Symbol(description) {\n\tvar symbol;\n\tif (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');\n\tif (isNativeSafe) return NativeSymbol(description);\n\tsymbol = create(HiddenSymbol.prototype);\n\tdescription = (description === undefined ? '' : String(description));\n\treturn defineProperties(symbol, {\n\t\t__description__: d('', description),\n\t\t__name__: d('', generateName(description))\n\t});\n};\ndefineProperties(SymbolPolyfill, {\n\tfor: d(function (key) {\n\t\tif (globalSymbols[key]) return globalSymbols[key];\n\t\treturn (globalSymbols[key] = SymbolPolyfill(String(key)));\n\t}),\n\tkeyFor: d(function (s) {\n\t\tvar key;\n\t\tvalidateSymbol(s);\n\t\tfor (key in globalSymbols) if (globalSymbols[key] === s) return key;\n\t}),\n\n\t// To ensure proper interoperability with other native functions (e.g. Array.from)\n\t// fallback to eventual native implementation of given symbol\n\thasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),\n\tisConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||\n\t\tSymbolPolyfill('isConcatSpreadable')),\n\titerator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),\n\tmatch: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),\n\treplace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),\n\tsearch: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),\n\tspecies: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),\n\tsplit: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),\n\ttoPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),\n\ttoStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),\n\tunscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))\n});\n\n// Internal tweaks for real symbol producer\ndefineProperties(HiddenSymbol.prototype, {\n\tconstructor: d(SymbolPolyfill),\n\ttoString: d('', function () { return this.__name__; })\n});\n\n// Proper implementation of methods exposed on Symbol.prototype\n// They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype\ndefineProperties(SymbolPolyfill.prototype, {\n\ttoString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),\n\tvalueOf: d(function () { return validateSymbol(this); })\n});\ndefineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {\n\tvar symbol = validateSymbol(this);\n\tif (typeof symbol === 'symbol') return symbol;\n\treturn symbol.toString();\n}));\ndefineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));\n\n// Proper implementaton of toPrimitive and toStringTag for returned symbol instances\ndefineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,\n\td('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));\n\n// Note: It's important to define `toPrimitive` as last one, as some implementations\n// implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)\n// And that may invoke error in definition flow:\n// See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149\ndefineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,\n\td('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isSymbol = __webpack_require__(19);\n\nmodule.exports = function (value) {\n\tif (!isSymbol(value)) throw new TypeError(value + \" is not a symbol\");\n\treturn value;\n};\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// moment-range.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0448466c1b97963b6919","\"use strict\";\n\nvar _undefined = require(\"../function/noop\")(); // Support ES3 engines\n\nmodule.exports = function (val) {\n return (val !== _undefined) && (val !== null);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/is-value.js\n// module id = 0\n// module chunks = 0","'use strict';\n\nmodule.exports = require('./is-implemented')() ? Symbol : require('./polyfill');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es6-symbol/index.js\n// module id = 1\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"moment\"\n// module id = 2\n// module chunks = 0","import moment from 'moment';\nimport Symbol from 'es6-symbol';\n\n\n//-----------------------------------------------------------------------------\n// Constants\n//-----------------------------------------------------------------------------\n\nconst INTERVALS = {\n year: true,\n quarter: true,\n month: true,\n week: true,\n day: true,\n hour: true,\n minute: true,\n second: true\n};\n\n\n//-----------------------------------------------------------------------------\n// Date Ranges\n//-----------------------------------------------------------------------------\n\nexport class DateRange {\n constructor(start, end) {\n let s = start;\n let e = end;\n\n if (arguments.length === 1 || end === undefined) {\n if (typeof start === 'object' && start.length === 2) {\n [s, e] = start;\n }\n else if (typeof start === 'string') {\n [s, e] = isoSplit(start);\n }\n }\n\n this.start = s || s === 0 ? moment(s) : moment(-8640000000000000);\n this.end = e || e === 0 ? moment(e) : moment(8640000000000000);\n }\n\n adjacent(other) {\n const sameStartEnd = this.start.isSame(other.end);\n const sameEndStart = this.end.isSame(other.start);\n\n return (sameStartEnd && (other.start.valueOf() <= this.start.valueOf())) || (sameEndStart && (other.end.valueOf() >= this.end.valueOf()));\n }\n\n add(other, options = { adjacent: false }) {\n if (this.overlaps(other, options)) {\n return new this.constructor(moment.min(this.start, other.start), moment.max(this.end, other.end));\n }\n\n return null;\n }\n\n by(interval, options = { excludeEnd: false, step: 1 }) {\n const range = this;\n\n return {\n [Symbol.iterator]() {\n const step = options.step || 1;\n const diff = Math.abs(range.start.diff(range.end, interval)) / step;\n let excludeEnd = options.excludeEnd || false;\n let iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeEnd = options.exclusive;\n }\n\n return {\n next() {\n const current = range.start.clone().add((iteration * step), interval);\n const done = excludeEnd\n ? !(iteration < diff)\n : !(iteration <= diff);\n\n iteration++;\n\n return {\n done,\n value: (done ? undefined : current)\n };\n }\n };\n }\n };\n }\n\n byRange(interval, options = { excludeEnd: false, step: 1 }) {\n const range = this;\n const step = options.step || 1;\n const diff = this.valueOf() / interval.valueOf() / step;\n const unit = Math.floor(diff);\n let excludeEnd = options.excludeEnd || false;\n let iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeEnd = options.exclusive;\n }\n\n return {\n [Symbol.iterator]() {\n if (unit === Infinity) {\n return { done: true };\n }\n\n return {\n next() {\n const current = moment(range.start.valueOf() + (interval.valueOf() * iteration * step));\n const done = ((unit === diff) && excludeEnd)\n ? !(iteration < unit)\n : !(iteration <= unit);\n\n iteration++;\n\n return {\n done,\n value: (done ? undefined : current)\n };\n }\n };\n }\n };\n }\n\n center() {\n const center = this.start.valueOf() + this.diff() / 2;\n\n return moment(center);\n }\n\n clone() {\n return new this.constructor(this.start.clone(), this.end.clone());\n }\n\n contains(other, options = { excludeStart: false, excludeEnd: false }) {\n const start = this.start.valueOf();\n const end = this.end.valueOf();\n let oStart = other.valueOf();\n let oEnd = other.valueOf();\n let excludeStart = options.excludeStart || false;\n let excludeEnd = options.excludeEnd || false;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeStart = excludeEnd = options.exclusive;\n }\n\n if (other instanceof DateRange) {\n oStart = other.start.valueOf();\n oEnd = other.end.valueOf();\n }\n\n const startInRange = (start < oStart) || ((start <= oStart) && !excludeStart);\n const endInRange = (end > oEnd) || ((end >= oEnd) && !excludeEnd);\n\n return (startInRange && endInRange);\n }\n\n diff(unit, precise) {\n return this.end.diff(this.start, unit, precise);\n }\n\n duration(unit, precise) {\n return this.diff(unit, precise);\n }\n\n intersect(other) {\n const start = this.start.valueOf();\n const end = this.end.valueOf();\n const otherStart = other.start.valueOf();\n const otherEnd = other.end.valueOf();\n const isZeroLength = (start == end);\n const isOtherZeroLength = (otherStart == otherEnd);\n\n // Zero-length ranges\n if (isZeroLength) {\n const point = start;\n\n if ((point == otherStart) || (point == otherEnd)) {\n return null;\n }\n else if ((point > otherStart) && (point < otherEnd)) {\n return this.clone();\n }\n }\n else if (isOtherZeroLength) {\n const point = otherStart;\n\n if ((point == start) || (point == end)) {\n return null;\n }\n else if ((point > start) && (point < end)) {\n return new this.constructor(point, point);\n }\n }\n\n // Non zero-length ranges\n if ((start <= otherStart) && (otherStart < end) && (end < otherEnd)) {\n return new this.constructor(otherStart, end);\n }\n else if ((otherStart < start) && (start < otherEnd) && (otherEnd <= end)) {\n return new this.constructor(start, otherEnd);\n }\n else if ((otherStart < start) && (start <= end) && (end < otherEnd)) {\n return this.clone();\n }\n else if ((start <= otherStart) && (otherStart <= otherEnd) && (otherEnd <= end)) {\n return new this.constructor(otherStart, otherEnd);\n }\n\n return null;\n }\n\n isEqual(other) {\n return this.start.isSame(other.start) && this.end.isSame(other.end);\n }\n\n isSame(other) {\n return this.isEqual(other);\n }\n\n overlaps(other, options = { adjacent: false }) {\n const intersects = (this.intersect(other) !== null);\n\n if (options.adjacent && !intersects) {\n return this.adjacent(other);\n }\n\n return intersects;\n }\n\n reverseBy(interval, options = { excludeStart: false, step: 1 }) {\n const range = this;\n\n return {\n [Symbol.iterator]() {\n const step = options.step || 1;\n const diff = Math.abs(range.start.diff(range.end, interval)) / step;\n let excludeStart = options.excludeStart || false;\n let iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeStart = options.exclusive;\n }\n\n return {\n next() {\n const current = range.end.clone().subtract((iteration * step), interval);\n const done = excludeStart\n ? !(iteration < diff)\n : !(iteration <= diff);\n\n iteration++;\n\n return {\n done,\n value: (done ? undefined : current)\n };\n }\n };\n }\n };\n }\n\n reverseByRange(interval, options = { excludeStart: false, step: 1 }) {\n const range = this;\n const step = options.step || 1;\n const diff = this.valueOf() / interval.valueOf() / step;\n const unit = Math.floor(diff);\n let excludeStart = options.excludeStart || false;\n let iteration = 0;\n\n if (options.hasOwnProperty('exclusive')) {\n excludeStart = options.exclusive;\n }\n\n return {\n [Symbol.iterator]() {\n if (unit === Infinity) {\n return { done: true };\n }\n\n return {\n next() {\n const current = moment(range.end.valueOf() - (interval.valueOf() * iteration * step));\n const done = ((unit === diff) && excludeStart)\n ? !(iteration < unit)\n : !(iteration <= unit);\n\n iteration++;\n\n return {\n done,\n value: (done ? undefined : current)\n };\n }\n };\n }\n };\n }\n\n snapTo(interval) {\n const r = this.clone();\n\n // Snap if not open-ended range\n if (!r.start.isSame(moment(-8640000000000000))) {\n r.start = r.start.startOf(interval);\n }\n if (!r.end.isSame(moment(8640000000000000))) {\n r.end = r.end.endOf(interval);\n }\n\n return r;\n }\n\n subtract(other) {\n const start = this.start.valueOf();\n const end = this.end.valueOf();\n const oStart = other.start.valueOf();\n const oEnd = other.end.valueOf();\n\n if (this.intersect(other) === null) {\n return [this];\n }\n else if ((oStart <= start) && (start < end) && (end <= oEnd)) {\n return [];\n }\n else if ((oStart <= start) && (start < oEnd) && (oEnd < end)) {\n return [new this.constructor(oEnd, end)];\n }\n else if ((start < oStart) && (oStart < end) && (end <= oEnd)) {\n return [new this.constructor(start, oStart)];\n }\n else if ((start < oStart) && (oStart < oEnd) && (oEnd < end)) {\n return [new this.constructor(start, oStart), new this.constructor(oEnd, end)];\n }\n else if ((start < oStart) && (oStart < end) && (oEnd < end)) {\n return [new this.constructor(start, oStart), new this.constructor(oStart, end)];\n }\n\n return [];\n }\n\n toDate() {\n return [this.start.toDate(), this.end.toDate()];\n }\n\n toString() {\n return this.start.format() + '/' + this.end.format();\n }\n\n valueOf() {\n return this.end.valueOf() - this.start.valueOf();\n }\n\n}\n\n\n//-----------------------------------------------------------------------------\n// Moment Extensions\n//-----------------------------------------------------------------------------\n\nexport function extendMoment(moment) {\n /**\n * Build a date range.\n */\n moment.range = function range(start, end) {\n const m = this;\n\n if (typeof start === 'string' && INTERVALS.hasOwnProperty(start)) {\n return new DateRange(moment(m).startOf(start), moment(m).endOf(start));\n }\n\n return new DateRange(start, end);\n };\n\n /**\n * Build a date range between a date (or now) and a specified interval.\n * @param {String} interval The type of interval\n * @param {Number} [count=1] The number of intervals (positive or negative)\n * @param {Moment|Date} [date=moment()] The date to use\n * @return {DateRange}\n */\n moment.rangeFromInterval = function(interval, count = 1, date = moment()) {\n if (!moment.isMoment(date)) date = moment(date);\n if (!date.isValid()) throw new Error('Invalid date.');\n\n const dateWithInterval = date.clone().add(count, interval);\n\n // Handle negative interval counts by assembling the dates in chronological order.\n const dates = [];\n dates.push(moment.min(date, dateWithInterval));\n dates.push(moment.max(date, dateWithInterval));\n\n return new DateRange(dates);\n };\n\n /**\n * Uses moment.parseZone on both the start and end of the given time interval\n * to preserve the time zones on the resulting DateRange object.\n * @param {string} isoTimeInterval the timeInterval to be parsed\n * @return {DateRange} constructed using moments that will preserve the time zones\n */\n moment.rangeFromISOString = function(isoTimeInterval) {\n const momentStrings = isoSplit(isoTimeInterval);\n const start = moment.parseZone(momentStrings[0]);\n const end = moment.parseZone(momentStrings[1]);\n return new DateRange(start, end);\n };\n\n moment.parseZoneRange = moment.rangeFromISOString; // DEPRECATED 4.0.0\n\n /**\n * Alias of static constructor.\n */\n moment.fn.range = moment.range;\n\n /**\n * Expose constructor\n */\n moment.range.constructor = DateRange;\n\n /**\n * Check if the current object is a date range.\n */\n moment.isRange = function(range) {\n return range instanceof DateRange;\n };\n\n /**\n * Check if the current moment is within a given date range.\n */\n moment.fn.within = function(range) {\n return range.contains(this.toDate());\n };\n\n return moment;\n}\n\n\n//-----------------------------------------------------------------------------\n// Utility Functions\n//-----------------------------------------------------------------------------\n\n/**\n * Splits an iso string into two strings.\n */\nfunction isoSplit(isoString) {\n return isoString.split('/');\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/moment-range.js","'use strict';\n\nvar assign = require('es5-ext/object/assign')\n , normalizeOpts = require('es5-ext/object/normalize-options')\n , isCallable = require('es5-ext/object/is-callable')\n , contains = require('es5-ext/string/#/contains')\n\n , d;\n\nd = module.exports = function (dscr, value/*, options*/) {\n\tvar c, e, w, options, desc;\n\tif ((arguments.length < 2) || (typeof dscr !== 'string')) {\n\t\toptions = value;\n\t\tvalue = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[2];\n\t}\n\tif (dscr == null) {\n\t\tc = w = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t\tw = contains.call(dscr, 'w');\n\t}\n\n\tdesc = { value: value, configurable: c, enumerable: e, writable: w };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\nd.gs = function (dscr, get, set/*, options*/) {\n\tvar c, e, options, desc;\n\tif (typeof dscr !== 'string') {\n\t\toptions = set;\n\t\tset = get;\n\t\tget = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[3];\n\t}\n\tif (get == null) {\n\t\tget = undefined;\n\t} else if (!isCallable(get)) {\n\t\toptions = get;\n\t\tget = set = undefined;\n\t} else if (set == null) {\n\t\tset = undefined;\n\t} else if (!isCallable(set)) {\n\t\toptions = set;\n\t\tset = undefined;\n\t}\n\tif (dscr == null) {\n\t\tc = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t}\n\n\tdesc = { get: get, set: set, configurable: c, enumerable: e };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/d/index.js\n// module id = 4\n// module chunks = 0","\"use strict\";\n\n// eslint-disable-next-line no-empty-function\nmodule.exports = function () {};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/function/noop.js\n// module id = 5\n// module chunks = 0","\"use strict\";\n\nmodule.exports = require(\"./is-implemented\")()\n\t? Object.assign\n\t: require(\"./shim\");\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/index.js\n// module id = 6\n// module chunks = 0","\"use strict\";\n\nmodule.exports = function () {\n\tvar assign = Object.assign, obj;\n\tif (typeof assign !== \"function\") return false;\n\tobj = { foo: \"raz\" };\n\tassign(obj, { bar: \"dwa\" }, { trzy: \"trzy\" });\n\treturn (obj.foo + obj.bar + obj.trzy) === \"razdwatrzy\";\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/is-implemented.js\n// module id = 7\n// module chunks = 0","\"use strict\";\n\nvar keys = require(\"../keys\")\n , value = require(\"../valid-value\")\n , max = Math.max;\n\nmodule.exports = function (dest, src /*, …srcn*/) {\n\tvar error, i, length = max(arguments.length, 2), assign;\n\tdest = Object(value(dest));\n\tassign = function (key) {\n\t\ttry {\n\t\t\tdest[key] = src[key];\n\t\t} catch (e) {\n\t\t\tif (!error) error = e;\n\t\t}\n\t};\n\tfor (i = 1; i < length; ++i) {\n\t\tsrc = arguments[i];\n\t\tkeys(src).forEach(assign);\n\t}\n\tif (error !== undefined) throw error;\n\treturn dest;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/assign/shim.js\n// module id = 8\n// module chunks = 0","// Deprecated\n\n\"use strict\";\n\nmodule.exports = function (obj) {\n return typeof obj === \"function\";\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/is-callable.js\n// module id = 9\n// module chunks = 0","\"use strict\";\n\nmodule.exports = require(\"./is-implemented\")() ? Object.keys : require(\"./shim\");\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/index.js\n// module id = 10\n// module chunks = 0","\"use strict\";\n\nmodule.exports = function () {\n\ttry {\n\t\tObject.keys(\"primitive\");\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/is-implemented.js\n// module id = 11\n// module chunks = 0","\"use strict\";\n\nvar isValue = require(\"../is-value\");\n\nvar keys = Object.keys;\n\nmodule.exports = function (object) { return keys(isValue(object) ? Object(object) : object); };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/keys/shim.js\n// module id = 12\n// module chunks = 0","\"use strict\";\n\nvar isValue = require(\"./is-value\");\n\nvar forEach = Array.prototype.forEach, create = Object.create;\n\nvar process = function (src, obj) {\n\tvar key;\n\tfor (key in src) obj[key] = src[key];\n};\n\n// eslint-disable-next-line no-unused-vars\nmodule.exports = function (opts1 /*, …options*/) {\n\tvar result = create(null);\n\tforEach.call(arguments, function (options) {\n\t\tif (!isValue(options)) return;\n\t\tprocess(Object(options), result);\n\t});\n\treturn result;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/normalize-options.js\n// module id = 13\n// module chunks = 0","\"use strict\";\n\nvar isValue = require(\"./is-value\");\n\nmodule.exports = function (value) {\n\tif (!isValue(value)) throw new TypeError(\"Cannot use null or undefined\");\n\treturn value;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/object/valid-value.js\n// module id = 14\n// module chunks = 0","\"use strict\";\n\nmodule.exports = require(\"./is-implemented\")()\n\t? String.prototype.contains\n\t: require(\"./shim\");\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/index.js\n// module id = 15\n// module chunks = 0","\"use strict\";\n\nvar str = \"razdwatrzy\";\n\nmodule.exports = function () {\n\tif (typeof str.contains !== \"function\") return false;\n\treturn (str.contains(\"dwa\") === true) && (str.contains(\"foo\") === false);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/is-implemented.js\n// module id = 16\n// module chunks = 0","\"use strict\";\n\nvar indexOf = String.prototype.indexOf;\n\nmodule.exports = function (searchString/*, position*/) {\n\treturn indexOf.call(this, searchString, arguments[1]) > -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es5-ext/string/#/contains/shim.js\n// module id = 17\n// module chunks = 0","'use strict';\n\nvar validTypes = { object: true, symbol: true };\n\nmodule.exports = function () {\n\tvar symbol;\n\tif (typeof Symbol !== 'function') return false;\n\tsymbol = Symbol('test symbol');\n\ttry { String(symbol); } catch (e) { return false; }\n\n\t// Return 'true' also for polyfills\n\tif (!validTypes[typeof Symbol.iterator]) return false;\n\tif (!validTypes[typeof Symbol.toPrimitive]) return false;\n\tif (!validTypes[typeof Symbol.toStringTag]) return false;\n\n\treturn true;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es6-symbol/is-implemented.js\n// module id = 18\n// module chunks = 0","'use strict';\n\nmodule.exports = function (x) {\n\tif (!x) return false;\n\tif (typeof x === 'symbol') return true;\n\tif (!x.constructor) return false;\n\tif (x.constructor.name !== 'Symbol') return false;\n\treturn (x[x.constructor.toStringTag] === 'Symbol');\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es6-symbol/is-symbol.js\n// module id = 19\n// module chunks = 0","// ES2015 Symbol polyfill for environments that do not (or partially) support it\n\n'use strict';\n\nvar d = require('d')\n , validateSymbol = require('./validate-symbol')\n\n , create = Object.create, defineProperties = Object.defineProperties\n , defineProperty = Object.defineProperty, objPrototype = Object.prototype\n , NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null)\n , isNativeSafe;\n\nif (typeof Symbol === 'function') {\n\tNativeSymbol = Symbol;\n\ttry {\n\t\tString(NativeSymbol());\n\t\tisNativeSafe = true;\n\t} catch (ignore) {}\n}\n\nvar generateName = (function () {\n\tvar created = create(null);\n\treturn function (desc) {\n\t\tvar postfix = 0, name, ie11BugWorkaround;\n\t\twhile (created[desc + (postfix || '')]) ++postfix;\n\t\tdesc += (postfix || '');\n\t\tcreated[desc] = true;\n\t\tname = '@@' + desc;\n\t\tdefineProperty(objPrototype, name, d.gs(null, function (value) {\n\t\t\t// For IE11 issue see:\n\t\t\t// https://connect.microsoft.com/IE/feedbackdetail/view/1928508/\n\t\t\t// ie11-broken-getters-on-dom-objects\n\t\t\t// https://github.com/medikoo/es6-symbol/issues/12\n\t\t\tif (ie11BugWorkaround) return;\n\t\t\tie11BugWorkaround = true;\n\t\t\tdefineProperty(this, name, d(value));\n\t\t\tie11BugWorkaround = false;\n\t\t}));\n\t\treturn name;\n\t};\n}());\n\n// Internal constructor (not one exposed) for creating Symbol instances.\n// This one is used to ensure that `someSymbol instanceof Symbol` always return false\nHiddenSymbol = function Symbol(description) {\n\tif (this instanceof HiddenSymbol) throw new TypeError('Symbol is not a constructor');\n\treturn SymbolPolyfill(description);\n};\n\n// Exposed `Symbol` constructor\n// (returns instances of HiddenSymbol)\nmodule.exports = SymbolPolyfill = function Symbol(description) {\n\tvar symbol;\n\tif (this instanceof Symbol) throw new TypeError('Symbol is not a constructor');\n\tif (isNativeSafe) return NativeSymbol(description);\n\tsymbol = create(HiddenSymbol.prototype);\n\tdescription = (description === undefined ? '' : String(description));\n\treturn defineProperties(symbol, {\n\t\t__description__: d('', description),\n\t\t__name__: d('', generateName(description))\n\t});\n};\ndefineProperties(SymbolPolyfill, {\n\tfor: d(function (key) {\n\t\tif (globalSymbols[key]) return globalSymbols[key];\n\t\treturn (globalSymbols[key] = SymbolPolyfill(String(key)));\n\t}),\n\tkeyFor: d(function (s) {\n\t\tvar key;\n\t\tvalidateSymbol(s);\n\t\tfor (key in globalSymbols) if (globalSymbols[key] === s) return key;\n\t}),\n\n\t// To ensure proper interoperability with other native functions (e.g. Array.from)\n\t// fallback to eventual native implementation of given symbol\n\thasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),\n\tisConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||\n\t\tSymbolPolyfill('isConcatSpreadable')),\n\titerator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),\n\tmatch: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),\n\treplace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),\n\tsearch: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),\n\tspecies: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),\n\tsplit: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),\n\ttoPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),\n\ttoStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),\n\tunscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))\n});\n\n// Internal tweaks for real symbol producer\ndefineProperties(HiddenSymbol.prototype, {\n\tconstructor: d(SymbolPolyfill),\n\ttoString: d('', function () { return this.__name__; })\n});\n\n// Proper implementation of methods exposed on Symbol.prototype\n// They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype\ndefineProperties(SymbolPolyfill.prototype, {\n\ttoString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),\n\tvalueOf: d(function () { return validateSymbol(this); })\n});\ndefineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {\n\tvar symbol = validateSymbol(this);\n\tif (typeof symbol === 'symbol') return symbol;\n\treturn symbol.toString();\n}));\ndefineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));\n\n// Proper implementaton of toPrimitive and toStringTag for returned symbol instances\ndefineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag,\n\td('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));\n\n// Note: It's important to define `toPrimitive` as last one, as some implementations\n// implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)\n// And that may invoke error in definition flow:\n// See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149\ndefineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,\n\td('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es6-symbol/polyfill.js\n// module id = 20\n// module chunks = 0","'use strict';\n\nvar isSymbol = require('./is-symbol');\n\nmodule.exports = function (value) {\n\tif (!isSymbol(value)) throw new TypeError(value + \" is not a symbol\");\n\treturn value;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/es6-symbol/validate-symbol.js\n// module id = 21\n// module chunks = 0","//! moment.js locale configuration\n//! locale : Persian [fa]\n//! author : Ebrahim Byagowi : https://github.com/ebraminio\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var symbolMap = {\n 1: '۱',\n 2: '۲',\n 3: '۳',\n 4: '۴',\n 5: '۵',\n 6: '۶',\n 7: '۷',\n 8: '۸',\n 9: '۹',\n 0: '۰',\n },\n numberMap = {\n '۱': '1',\n '۲': '2',\n '۳': '3',\n '۴': '4',\n '۵': '5',\n '۶': '6',\n '۷': '7',\n '۸': '8',\n '۹': '9',\n '۰': '0',\n };\n\n var fa = moment.defineLocale('fa', {\n months: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split(\n '_'\n ),\n monthsShort:\n 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split(\n '_'\n ),\n weekdays:\n 'یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_جمعه_شنبه'.split(\n '_'\n ),\n weekdaysShort:\n 'یک\\u200cشنبه_دوشنبه_سه\\u200cشنبه_چهارشنبه_پنج\\u200cشنبه_جمعه_شنبه'.split(\n '_'\n ),\n weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'HH:mm',\n LTS: 'HH:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd, D MMMM YYYY HH:mm',\n },\n meridiemParse: /قبل از ظهر|بعد از ظهر/,\n isPM: function (input) {\n return /بعد از ظهر/.test(input);\n },\n meridiem: function (hour, minute, isLower) {\n if (hour < 12) {\n return 'قبل از ظهر';\n } else {\n return 'بعد از ظهر';\n }\n },\n calendar: {\n sameDay: '[امروز ساعت] LT',\n nextDay: '[فردا ساعت] LT',\n nextWeek: 'dddd [ساعت] LT',\n lastDay: '[دیروز ساعت] LT',\n lastWeek: 'dddd [پیش] [ساعت] LT',\n sameElse: 'L',\n },\n relativeTime: {\n future: 'در %s',\n past: '%s پیش',\n s: 'چند ثانیه',\n ss: '%d ثانیه',\n m: 'یک دقیقه',\n mm: '%d دقیقه',\n h: 'یک ساعت',\n hh: '%d ساعت',\n d: 'یک روز',\n dd: '%d روز',\n M: 'یک ماه',\n MM: '%d ماه',\n y: 'یک سال',\n yy: '%d سال',\n },\n preparse: function (string) {\n return string\n .replace(/[۰-۹]/g, function (match) {\n return numberMap[match];\n })\n .replace(/،/g, ',');\n },\n postformat: function (string) {\n return string\n .replace(/\\d/g, function (match) {\n return symbolMap[match];\n })\n .replace(/,/g, '،');\n },\n dayOfMonthOrdinalParse: /\\d{1,2}م/,\n ordinal: '%dم',\n week: {\n dow: 6, // Saturday is the first day of the week.\n doy: 12, // The week that contains Jan 12th is the first week of the year.\n },\n });\n\n return fa;\n\n})));\n","//! moment.js\n//! version : 2.29.4\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.moment = factory()\n}(this, (function () { 'use strict';\n\n var hookCallback;\n\n function hooks() {\n return hookCallback.apply(null, arguments);\n }\n\n // This is done to register the method called with moment()\n // without creating circular dependencies.\n function setHookCallback(callback) {\n hookCallback = callback;\n }\n\n function isArray(input) {\n return (\n input instanceof Array ||\n Object.prototype.toString.call(input) === '[object Array]'\n );\n }\n\n function isObject(input) {\n // IE8 will treat undefined and null as object if it wasn't for\n // input != null\n return (\n input != null &&\n Object.prototype.toString.call(input) === '[object Object]'\n );\n }\n\n function hasOwnProp(a, b) {\n return Object.prototype.hasOwnProperty.call(a, b);\n }\n\n function isObjectEmpty(obj) {\n if (Object.getOwnPropertyNames) {\n return Object.getOwnPropertyNames(obj).length === 0;\n } else {\n var k;\n for (k in obj) {\n if (hasOwnProp(obj, k)) {\n return false;\n }\n }\n return true;\n }\n }\n\n function isUndefined(input) {\n return input === void 0;\n }\n\n function isNumber(input) {\n return (\n typeof input === 'number' ||\n Object.prototype.toString.call(input) === '[object Number]'\n );\n }\n\n function isDate(input) {\n return (\n input instanceof Date ||\n Object.prototype.toString.call(input) === '[object Date]'\n );\n }\n\n function map(arr, fn) {\n var res = [],\n i,\n arrLen = arr.length;\n for (i = 0; i < arrLen; ++i) {\n res.push(fn(arr[i], i));\n }\n return res;\n }\n\n function extend(a, b) {\n for (var i in b) {\n if (hasOwnProp(b, i)) {\n a[i] = b[i];\n }\n }\n\n if (hasOwnProp(b, 'toString')) {\n a.toString = b.toString;\n }\n\n if (hasOwnProp(b, 'valueOf')) {\n a.valueOf = b.valueOf;\n }\n\n return a;\n }\n\n function createUTC(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, true).utc();\n }\n\n function defaultParsingFlags() {\n // We need to deep clone this object.\n return {\n empty: false,\n unusedTokens: [],\n unusedInput: [],\n overflow: -2,\n charsLeftOver: 0,\n nullInput: false,\n invalidEra: null,\n invalidMonth: null,\n invalidFormat: false,\n userInvalidated: false,\n iso: false,\n parsedDateParts: [],\n era: null,\n meridiem: null,\n rfc2822: false,\n weekdayMismatch: false,\n };\n }\n\n function getParsingFlags(m) {\n if (m._pf == null) {\n m._pf = defaultParsingFlags();\n }\n return m._pf;\n }\n\n var some;\n if (Array.prototype.some) {\n some = Array.prototype.some;\n } else {\n some = function (fun) {\n var t = Object(this),\n len = t.length >>> 0,\n i;\n\n for (i = 0; i < len; i++) {\n if (i in t && fun.call(this, t[i], i, t)) {\n return true;\n }\n }\n\n return false;\n };\n }\n\n function isValid(m) {\n if (m._isValid == null) {\n var flags = getParsingFlags(m),\n parsedParts = some.call(flags.parsedDateParts, function (i) {\n return i != null;\n }),\n isNowValid =\n !isNaN(m._d.getTime()) &&\n flags.overflow < 0 &&\n !flags.empty &&\n !flags.invalidEra &&\n !flags.invalidMonth &&\n !flags.invalidWeekday &&\n !flags.weekdayMismatch &&\n !flags.nullInput &&\n !flags.invalidFormat &&\n !flags.userInvalidated &&\n (!flags.meridiem || (flags.meridiem && parsedParts));\n\n if (m._strict) {\n isNowValid =\n isNowValid &&\n flags.charsLeftOver === 0 &&\n flags.unusedTokens.length === 0 &&\n flags.bigHour === undefined;\n }\n\n if (Object.isFrozen == null || !Object.isFrozen(m)) {\n m._isValid = isNowValid;\n } else {\n return isNowValid;\n }\n }\n return m._isValid;\n }\n\n function createInvalid(flags) {\n var m = createUTC(NaN);\n if (flags != null) {\n extend(getParsingFlags(m), flags);\n } else {\n getParsingFlags(m).userInvalidated = true;\n }\n\n return m;\n }\n\n // Plugins that add properties should also add the key here (null value),\n // so we can properly clone ourselves.\n var momentProperties = (hooks.momentProperties = []),\n updateInProgress = false;\n\n function copyConfig(to, from) {\n var i,\n prop,\n val,\n momentPropertiesLen = momentProperties.length;\n\n if (!isUndefined(from._isAMomentObject)) {\n to._isAMomentObject = from._isAMomentObject;\n }\n if (!isUndefined(from._i)) {\n to._i = from._i;\n }\n if (!isUndefined(from._f)) {\n to._f = from._f;\n }\n if (!isUndefined(from._l)) {\n to._l = from._l;\n }\n if (!isUndefined(from._strict)) {\n to._strict = from._strict;\n }\n if (!isUndefined(from._tzm)) {\n to._tzm = from._tzm;\n }\n if (!isUndefined(from._isUTC)) {\n to._isUTC = from._isUTC;\n }\n if (!isUndefined(from._offset)) {\n to._offset = from._offset;\n }\n if (!isUndefined(from._pf)) {\n to._pf = getParsingFlags(from);\n }\n if (!isUndefined(from._locale)) {\n to._locale = from._locale;\n }\n\n if (momentPropertiesLen > 0) {\n for (i = 0; i < momentPropertiesLen; i++) {\n prop = momentProperties[i];\n val = from[prop];\n if (!isUndefined(val)) {\n to[prop] = val;\n }\n }\n }\n\n return to;\n }\n\n // Moment prototype object\n function Moment(config) {\n copyConfig(this, config);\n this._d = new Date(config._d != null ? config._d.getTime() : NaN);\n if (!this.isValid()) {\n this._d = new Date(NaN);\n }\n // Prevent infinite loop in case updateOffset creates new moment\n // objects.\n if (updateInProgress === false) {\n updateInProgress = true;\n hooks.updateOffset(this);\n updateInProgress = false;\n }\n }\n\n function isMoment(obj) {\n return (\n obj instanceof Moment || (obj != null && obj._isAMomentObject != null)\n );\n }\n\n function warn(msg) {\n if (\n hooks.suppressDeprecationWarnings === false &&\n typeof console !== 'undefined' &&\n console.warn\n ) {\n console.warn('Deprecation warning: ' + msg);\n }\n }\n\n function deprecate(msg, fn) {\n var firstTime = true;\n\n return extend(function () {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(null, msg);\n }\n if (firstTime) {\n var args = [],\n arg,\n i,\n key,\n argLen = arguments.length;\n for (i = 0; i < argLen; i++) {\n arg = '';\n if (typeof arguments[i] === 'object') {\n arg += '\\n[' + i + '] ';\n for (key in arguments[0]) {\n if (hasOwnProp(arguments[0], key)) {\n arg += key + ': ' + arguments[0][key] + ', ';\n }\n }\n arg = arg.slice(0, -2); // Remove trailing comma and space\n } else {\n arg = arguments[i];\n }\n args.push(arg);\n }\n warn(\n msg +\n '\\nArguments: ' +\n Array.prototype.slice.call(args).join('') +\n '\\n' +\n new Error().stack\n );\n firstTime = false;\n }\n return fn.apply(this, arguments);\n }, fn);\n }\n\n var deprecations = {};\n\n function deprecateSimple(name, msg) {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(name, msg);\n }\n if (!deprecations[name]) {\n warn(msg);\n deprecations[name] = true;\n }\n }\n\n hooks.suppressDeprecationWarnings = false;\n hooks.deprecationHandler = null;\n\n function isFunction(input) {\n return (\n (typeof Function !== 'undefined' && input instanceof Function) ||\n Object.prototype.toString.call(input) === '[object Function]'\n );\n }\n\n function set(config) {\n var prop, i;\n for (i in config) {\n if (hasOwnProp(config, i)) {\n prop = config[i];\n if (isFunction(prop)) {\n this[i] = prop;\n } else {\n this['_' + i] = prop;\n }\n }\n }\n this._config = config;\n // Lenient ordinal parsing accepts just a number in addition to\n // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n this._dayOfMonthOrdinalParseLenient = new RegExp(\n (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +\n '|' +\n /\\d{1,2}/.source\n );\n }\n\n function mergeConfigs(parentConfig, childConfig) {\n var res = extend({}, parentConfig),\n prop;\n for (prop in childConfig) {\n if (hasOwnProp(childConfig, prop)) {\n if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {\n res[prop] = {};\n extend(res[prop], parentConfig[prop]);\n extend(res[prop], childConfig[prop]);\n } else if (childConfig[prop] != null) {\n res[prop] = childConfig[prop];\n } else {\n delete res[prop];\n }\n }\n }\n for (prop in parentConfig) {\n if (\n hasOwnProp(parentConfig, prop) &&\n !hasOwnProp(childConfig, prop) &&\n isObject(parentConfig[prop])\n ) {\n // make sure changes to properties don't modify parent config\n res[prop] = extend({}, res[prop]);\n }\n }\n return res;\n }\n\n function Locale(config) {\n if (config != null) {\n this.set(config);\n }\n }\n\n var keys;\n\n if (Object.keys) {\n keys = Object.keys;\n } else {\n keys = function (obj) {\n var i,\n res = [];\n for (i in obj) {\n if (hasOwnProp(obj, i)) {\n res.push(i);\n }\n }\n return res;\n };\n }\n\n var defaultCalendar = {\n sameDay: '[Today at] LT',\n nextDay: '[Tomorrow at] LT',\n nextWeek: 'dddd [at] LT',\n lastDay: '[Yesterday at] LT',\n lastWeek: '[Last] dddd [at] LT',\n sameElse: 'L',\n };\n\n function calendar(key, mom, now) {\n var output = this._calendar[key] || this._calendar['sameElse'];\n return isFunction(output) ? output.call(mom, now) : output;\n }\n\n function zeroFill(number, targetLength, forceSign) {\n var absNumber = '' + Math.abs(number),\n zerosToFill = targetLength - absNumber.length,\n sign = number >= 0;\n return (\n (sign ? (forceSign ? '+' : '') : '-') +\n Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +\n absNumber\n );\n }\n\n var formattingTokens =\n /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,\n localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,\n formatFunctions = {},\n formatTokenFunctions = {};\n\n // token: 'M'\n // padded: ['MM', 2]\n // ordinal: 'Mo'\n // callback: function () { this.month() + 1 }\n function addFormatToken(token, padded, ordinal, callback) {\n var func = callback;\n if (typeof callback === 'string') {\n func = function () {\n return this[callback]();\n };\n }\n if (token) {\n formatTokenFunctions[token] = func;\n }\n if (padded) {\n formatTokenFunctions[padded[0]] = function () {\n return zeroFill(func.apply(this, arguments), padded[1], padded[2]);\n };\n }\n if (ordinal) {\n formatTokenFunctions[ordinal] = function () {\n return this.localeData().ordinal(\n func.apply(this, arguments),\n token\n );\n };\n }\n }\n\n function removeFormattingTokens(input) {\n if (input.match(/\\[[\\s\\S]/)) {\n return input.replace(/^\\[|\\]$/g, '');\n }\n return input.replace(/\\\\/g, '');\n }\n\n function makeFormatFunction(format) {\n var array = format.match(formattingTokens),\n i,\n length;\n\n for (i = 0, length = array.length; i < length; i++) {\n if (formatTokenFunctions[array[i]]) {\n array[i] = formatTokenFunctions[array[i]];\n } else {\n array[i] = removeFormattingTokens(array[i]);\n }\n }\n\n return function (mom) {\n var output = '',\n i;\n for (i = 0; i < length; i++) {\n output += isFunction(array[i])\n ? array[i].call(mom, format)\n : array[i];\n }\n return output;\n };\n }\n\n // format date using native date object\n function formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n\n format = expandFormat(format, m.localeData());\n formatFunctions[format] =\n formatFunctions[format] || makeFormatFunction(format);\n\n return formatFunctions[format](m);\n }\n\n function expandFormat(format, locale) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return locale.longDateFormat(input) || input;\n }\n\n localFormattingTokens.lastIndex = 0;\n while (i >= 0 && localFormattingTokens.test(format)) {\n format = format.replace(\n localFormattingTokens,\n replaceLongDateFormatTokens\n );\n localFormattingTokens.lastIndex = 0;\n i -= 1;\n }\n\n return format;\n }\n\n var defaultLongDateFormat = {\n LTS: 'h:mm:ss A',\n LT: 'h:mm A',\n L: 'MM/DD/YYYY',\n LL: 'MMMM D, YYYY',\n LLL: 'MMMM D, YYYY h:mm A',\n LLLL: 'dddd, MMMM D, YYYY h:mm A',\n };\n\n function longDateFormat(key) {\n var format = this._longDateFormat[key],\n formatUpper = this._longDateFormat[key.toUpperCase()];\n\n if (format || !formatUpper) {\n return format;\n }\n\n this._longDateFormat[key] = formatUpper\n .match(formattingTokens)\n .map(function (tok) {\n if (\n tok === 'MMMM' ||\n tok === 'MM' ||\n tok === 'DD' ||\n tok === 'dddd'\n ) {\n return tok.slice(1);\n }\n return tok;\n })\n .join('');\n\n return this._longDateFormat[key];\n }\n\n var defaultInvalidDate = 'Invalid date';\n\n function invalidDate() {\n return this._invalidDate;\n }\n\n var defaultOrdinal = '%d',\n defaultDayOfMonthOrdinalParse = /\\d{1,2}/;\n\n function ordinal(number) {\n return this._ordinal.replace('%d', number);\n }\n\n var defaultRelativeTime = {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n w: 'a week',\n ww: '%d weeks',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years',\n };\n\n function relativeTime(number, withoutSuffix, string, isFuture) {\n var output = this._relativeTime[string];\n return isFunction(output)\n ? output(number, withoutSuffix, string, isFuture)\n : output.replace(/%d/i, number);\n }\n\n function pastFuture(diff, output) {\n var format = this._relativeTime[diff > 0 ? 'future' : 'past'];\n return isFunction(format) ? format(output) : format.replace(/%s/i, output);\n }\n\n var aliases = {};\n\n function addUnitAlias(unit, shorthand) {\n var lowerCase = unit.toLowerCase();\n aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;\n }\n\n function normalizeUnits(units) {\n return typeof units === 'string'\n ? aliases[units] || aliases[units.toLowerCase()]\n : undefined;\n }\n\n function normalizeObjectUnits(inputObject) {\n var normalizedInput = {},\n normalizedProp,\n prop;\n\n for (prop in inputObject) {\n if (hasOwnProp(inputObject, prop)) {\n normalizedProp = normalizeUnits(prop);\n if (normalizedProp) {\n normalizedInput[normalizedProp] = inputObject[prop];\n }\n }\n }\n\n return normalizedInput;\n }\n\n var priorities = {};\n\n function addUnitPriority(unit, priority) {\n priorities[unit] = priority;\n }\n\n function getPrioritizedUnits(unitsObj) {\n var units = [],\n u;\n for (u in unitsObj) {\n if (hasOwnProp(unitsObj, u)) {\n units.push({ unit: u, priority: priorities[u] });\n }\n }\n units.sort(function (a, b) {\n return a.priority - b.priority;\n });\n return units;\n }\n\n function isLeapYear(year) {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n }\n\n function absFloor(number) {\n if (number < 0) {\n // -0 -> 0\n return Math.ceil(number) || 0;\n } else {\n return Math.floor(number);\n }\n }\n\n function toInt(argumentForCoercion) {\n var coercedNumber = +argumentForCoercion,\n value = 0;\n\n if (coercedNumber !== 0 && isFinite(coercedNumber)) {\n value = absFloor(coercedNumber);\n }\n\n return value;\n }\n\n function makeGetSet(unit, keepTime) {\n return function (value) {\n if (value != null) {\n set$1(this, unit, value);\n hooks.updateOffset(this, keepTime);\n return this;\n } else {\n return get(this, unit);\n }\n };\n }\n\n function get(mom, unit) {\n return mom.isValid()\n ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()\n : NaN;\n }\n\n function set$1(mom, unit, value) {\n if (mom.isValid() && !isNaN(value)) {\n if (\n unit === 'FullYear' &&\n isLeapYear(mom.year()) &&\n mom.month() === 1 &&\n mom.date() === 29\n ) {\n value = toInt(value);\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](\n value,\n mom.month(),\n daysInMonth(value, mom.month())\n );\n } else {\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);\n }\n }\n }\n\n // MOMENTS\n\n function stringGet(units) {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units]();\n }\n return this;\n }\n\n function stringSet(units, value) {\n if (typeof units === 'object') {\n units = normalizeObjectUnits(units);\n var prioritized = getPrioritizedUnits(units),\n i,\n prioritizedLen = prioritized.length;\n for (i = 0; i < prioritizedLen; i++) {\n this[prioritized[i].unit](units[prioritized[i].unit]);\n }\n } else {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units](value);\n }\n }\n return this;\n }\n\n var match1 = /\\d/, // 0 - 9\n match2 = /\\d\\d/, // 00 - 99\n match3 = /\\d{3}/, // 000 - 999\n match4 = /\\d{4}/, // 0000 - 9999\n match6 = /[+-]?\\d{6}/, // -999999 - 999999\n match1to2 = /\\d\\d?/, // 0 - 99\n match3to4 = /\\d\\d\\d\\d?/, // 999 - 9999\n match5to6 = /\\d\\d\\d\\d\\d\\d?/, // 99999 - 999999\n match1to3 = /\\d{1,3}/, // 0 - 999\n match1to4 = /\\d{1,4}/, // 0 - 9999\n match1to6 = /[+-]?\\d{1,6}/, // -999999 - 999999\n matchUnsigned = /\\d+/, // 0 - inf\n matchSigned = /[+-]?\\d+/, // -inf - inf\n matchOffset = /Z|[+-]\\d\\d:?\\d\\d/gi, // +00:00 -00:00 +0000 -0000 or Z\n matchShortOffset = /Z|[+-]\\d\\d(?::?\\d\\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z\n matchTimestamp = /[+-]?\\d+(\\.\\d{1,3})?/, // 123456789 123456789.123\n // any word (or two) characters or numbers including two/three word month in arabic.\n // includes scottish gaelic two word and hyphenated months\n matchWord =\n /[0-9]{0,256}['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFF07\\uFF10-\\uFFEF]{1,256}|[\\u0600-\\u06FF\\/]{1,256}(\\s*?[\\u0600-\\u06FF]{1,256}){1,2}/i,\n regexes;\n\n regexes = {};\n\n function addRegexToken(token, regex, strictRegex) {\n regexes[token] = isFunction(regex)\n ? regex\n : function (isStrict, localeData) {\n return isStrict && strictRegex ? strictRegex : regex;\n };\n }\n\n function getParseRegexForToken(token, config) {\n if (!hasOwnProp(regexes, token)) {\n return new RegExp(unescapeFormat(token));\n }\n\n return regexes[token](config._strict, config._locale);\n }\n\n // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript\n function unescapeFormat(s) {\n return regexEscape(\n s\n .replace('\\\\', '')\n .replace(\n /\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g,\n function (matched, p1, p2, p3, p4) {\n return p1 || p2 || p3 || p4;\n }\n )\n );\n }\n\n function regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n }\n\n var tokens = {};\n\n function addParseToken(token, callback) {\n var i,\n func = callback,\n tokenLen;\n if (typeof token === 'string') {\n token = [token];\n }\n if (isNumber(callback)) {\n func = function (input, array) {\n array[callback] = toInt(input);\n };\n }\n tokenLen = token.length;\n for (i = 0; i < tokenLen; i++) {\n tokens[token[i]] = func;\n }\n }\n\n function addWeekParseToken(token, callback) {\n addParseToken(token, function (input, array, config, token) {\n config._w = config._w || {};\n callback(input, config._w, config, token);\n });\n }\n\n function addTimeToArrayFromToken(token, input, config) {\n if (input != null && hasOwnProp(tokens, token)) {\n tokens[token](input, config._a, config, token);\n }\n }\n\n var YEAR = 0,\n MONTH = 1,\n DATE = 2,\n HOUR = 3,\n MINUTE = 4,\n SECOND = 5,\n MILLISECOND = 6,\n WEEK = 7,\n WEEKDAY = 8;\n\n function mod(n, x) {\n return ((n % x) + x) % x;\n }\n\n var indexOf;\n\n if (Array.prototype.indexOf) {\n indexOf = Array.prototype.indexOf;\n } else {\n indexOf = function (o) {\n // I know\n var i;\n for (i = 0; i < this.length; ++i) {\n if (this[i] === o) {\n return i;\n }\n }\n return -1;\n };\n }\n\n function daysInMonth(year, month) {\n if (isNaN(year) || isNaN(month)) {\n return NaN;\n }\n var modMonth = mod(month, 12);\n year += (month - modMonth) / 12;\n return modMonth === 1\n ? isLeapYear(year)\n ? 29\n : 28\n : 31 - ((modMonth % 7) % 2);\n }\n\n // FORMATTING\n\n addFormatToken('M', ['MM', 2], 'Mo', function () {\n return this.month() + 1;\n });\n\n addFormatToken('MMM', 0, 0, function (format) {\n return this.localeData().monthsShort(this, format);\n });\n\n addFormatToken('MMMM', 0, 0, function (format) {\n return this.localeData().months(this, format);\n });\n\n // ALIASES\n\n addUnitAlias('month', 'M');\n\n // PRIORITY\n\n addUnitPriority('month', 8);\n\n // PARSING\n\n addRegexToken('M', match1to2);\n addRegexToken('MM', match1to2, match2);\n addRegexToken('MMM', function (isStrict, locale) {\n return locale.monthsShortRegex(isStrict);\n });\n addRegexToken('MMMM', function (isStrict, locale) {\n return locale.monthsRegex(isStrict);\n });\n\n addParseToken(['M', 'MM'], function (input, array) {\n array[MONTH] = toInt(input) - 1;\n });\n\n addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {\n var month = config._locale.monthsParse(input, token, config._strict);\n // if we didn't find a month name, mark the date as invalid.\n if (month != null) {\n array[MONTH] = month;\n } else {\n getParsingFlags(config).invalidMonth = input;\n }\n });\n\n // LOCALES\n\n var defaultLocaleMonths =\n 'January_February_March_April_May_June_July_August_September_October_November_December'.split(\n '_'\n ),\n defaultLocaleMonthsShort =\n 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),\n MONTHS_IN_FORMAT = /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?/,\n defaultMonthsShortRegex = matchWord,\n defaultMonthsRegex = matchWord;\n\n function localeMonths(m, format) {\n if (!m) {\n return isArray(this._months)\n ? this._months\n : this._months['standalone'];\n }\n return isArray(this._months)\n ? this._months[m.month()]\n : this._months[\n (this._months.isFormat || MONTHS_IN_FORMAT).test(format)\n ? 'format'\n : 'standalone'\n ][m.month()];\n }\n\n function localeMonthsShort(m, format) {\n if (!m) {\n return isArray(this._monthsShort)\n ? this._monthsShort\n : this._monthsShort['standalone'];\n }\n return isArray(this._monthsShort)\n ? this._monthsShort[m.month()]\n : this._monthsShort[\n MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'\n ][m.month()];\n }\n\n function handleStrictParse(monthName, format, strict) {\n var i,\n ii,\n mom,\n llc = monthName.toLocaleLowerCase();\n if (!this._monthsParse) {\n // this is not used\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n for (i = 0; i < 12; ++i) {\n mom = createUTC([2000, i]);\n this._shortMonthsParse[i] = this.monthsShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n\n function localeMonthsParse(monthName, format, strict) {\n var i, mom, regex;\n\n if (this._monthsParseExact) {\n return handleStrictParse.call(this, monthName, format, strict);\n }\n\n if (!this._monthsParse) {\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n }\n\n // TODO: add sorting\n // Sorting makes sure if one month (or abbr) is a prefix of another\n // see sorting in computeMonthsParse\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n if (strict && !this._longMonthsParse[i]) {\n this._longMonthsParse[i] = new RegExp(\n '^' + this.months(mom, '').replace('.', '') + '$',\n 'i'\n );\n this._shortMonthsParse[i] = new RegExp(\n '^' + this.monthsShort(mom, '').replace('.', '') + '$',\n 'i'\n );\n }\n if (!strict && !this._monthsParse[i]) {\n regex =\n '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');\n this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'MMMM' &&\n this._longMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'MMM' &&\n this._shortMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (!strict && this._monthsParse[i].test(monthName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function setMonth(mom, value) {\n var dayOfMonth;\n\n if (!mom.isValid()) {\n // No op\n return mom;\n }\n\n if (typeof value === 'string') {\n if (/^\\d+$/.test(value)) {\n value = toInt(value);\n } else {\n value = mom.localeData().monthsParse(value);\n // TODO: Another silent failure?\n if (!isNumber(value)) {\n return mom;\n }\n }\n }\n\n dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);\n return mom;\n }\n\n function getSetMonth(value) {\n if (value != null) {\n setMonth(this, value);\n hooks.updateOffset(this, true);\n return this;\n } else {\n return get(this, 'Month');\n }\n }\n\n function getDaysInMonth() {\n return daysInMonth(this.year(), this.month());\n }\n\n function monthsShortRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsShortStrictRegex;\n } else {\n return this._monthsShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsShortRegex')) {\n this._monthsShortRegex = defaultMonthsShortRegex;\n }\n return this._monthsShortStrictRegex && isStrict\n ? this._monthsShortStrictRegex\n : this._monthsShortRegex;\n }\n }\n\n function monthsRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsStrictRegex;\n } else {\n return this._monthsRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsRegex')) {\n this._monthsRegex = defaultMonthsRegex;\n }\n return this._monthsStrictRegex && isStrict\n ? this._monthsStrictRegex\n : this._monthsRegex;\n }\n }\n\n function computeMonthsParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom;\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n shortPieces.push(this.monthsShort(mom, ''));\n longPieces.push(this.months(mom, ''));\n mixedPieces.push(this.months(mom, ''));\n mixedPieces.push(this.monthsShort(mom, ''));\n }\n // Sorting makes sure if one month (or abbr) is a prefix of another it\n // will match the longer piece.\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n for (i = 0; i < 12; i++) {\n shortPieces[i] = regexEscape(shortPieces[i]);\n longPieces[i] = regexEscape(longPieces[i]);\n }\n for (i = 0; i < 24; i++) {\n mixedPieces[i] = regexEscape(mixedPieces[i]);\n }\n\n this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._monthsShortRegex = this._monthsRegex;\n this._monthsStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._monthsShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n addFormatToken('Y', 0, 0, function () {\n var y = this.year();\n return y <= 9999 ? zeroFill(y, 4) : '+' + y;\n });\n\n addFormatToken(0, ['YY', 2], 0, function () {\n return this.year() % 100;\n });\n\n addFormatToken(0, ['YYYY', 4], 0, 'year');\n addFormatToken(0, ['YYYYY', 5], 0, 'year');\n addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');\n\n // ALIASES\n\n addUnitAlias('year', 'y');\n\n // PRIORITIES\n\n addUnitPriority('year', 1);\n\n // PARSING\n\n addRegexToken('Y', matchSigned);\n addRegexToken('YY', match1to2, match2);\n addRegexToken('YYYY', match1to4, match4);\n addRegexToken('YYYYY', match1to6, match6);\n addRegexToken('YYYYYY', match1to6, match6);\n\n addParseToken(['YYYYY', 'YYYYYY'], YEAR);\n addParseToken('YYYY', function (input, array) {\n array[YEAR] =\n input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);\n });\n addParseToken('YY', function (input, array) {\n array[YEAR] = hooks.parseTwoDigitYear(input);\n });\n addParseToken('Y', function (input, array) {\n array[YEAR] = parseInt(input, 10);\n });\n\n // HELPERS\n\n function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n }\n\n // HOOKS\n\n hooks.parseTwoDigitYear = function (input) {\n return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);\n };\n\n // MOMENTS\n\n var getSetYear = makeGetSet('FullYear', true);\n\n function getIsLeapYear() {\n return isLeapYear(this.year());\n }\n\n function createDate(y, m, d, h, M, s, ms) {\n // can't just apply() to create a date:\n // https://stackoverflow.com/q/181348\n var date;\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n date = new Date(y + 400, m, d, h, M, s, ms);\n if (isFinite(date.getFullYear())) {\n date.setFullYear(y);\n }\n } else {\n date = new Date(y, m, d, h, M, s, ms);\n }\n\n return date;\n }\n\n function createUTCDate(y) {\n var date, args;\n // the Date.UTC function remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n args = Array.prototype.slice.call(arguments);\n // preserve leap years using a full 400 year cycle, then reset\n args[0] = y + 400;\n date = new Date(Date.UTC.apply(null, args));\n if (isFinite(date.getUTCFullYear())) {\n date.setUTCFullYear(y);\n }\n } else {\n date = new Date(Date.UTC.apply(null, arguments));\n }\n\n return date;\n }\n\n // start-of-first-week - start-of-year\n function firstWeekOffset(year, dow, doy) {\n var // first-week day -- which january is always in the first week (4 for iso, 1 for other)\n fwd = 7 + dow - doy,\n // first-week day local weekday -- which local weekday is fwd\n fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;\n\n return -fwdlw + fwd - 1;\n }\n\n // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday\n function dayOfYearFromWeeks(year, week, weekday, dow, doy) {\n var localWeekday = (7 + weekday - dow) % 7,\n weekOffset = firstWeekOffset(year, dow, doy),\n dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,\n resYear,\n resDayOfYear;\n\n if (dayOfYear <= 0) {\n resYear = year - 1;\n resDayOfYear = daysInYear(resYear) + dayOfYear;\n } else if (dayOfYear > daysInYear(year)) {\n resYear = year + 1;\n resDayOfYear = dayOfYear - daysInYear(year);\n } else {\n resYear = year;\n resDayOfYear = dayOfYear;\n }\n\n return {\n year: resYear,\n dayOfYear: resDayOfYear,\n };\n }\n\n function weekOfYear(mom, dow, doy) {\n var weekOffset = firstWeekOffset(mom.year(), dow, doy),\n week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,\n resWeek,\n resYear;\n\n if (week < 1) {\n resYear = mom.year() - 1;\n resWeek = week + weeksInYear(resYear, dow, doy);\n } else if (week > weeksInYear(mom.year(), dow, doy)) {\n resWeek = week - weeksInYear(mom.year(), dow, doy);\n resYear = mom.year() + 1;\n } else {\n resYear = mom.year();\n resWeek = week;\n }\n\n return {\n week: resWeek,\n year: resYear,\n };\n }\n\n function weeksInYear(year, dow, doy) {\n var weekOffset = firstWeekOffset(year, dow, doy),\n weekOffsetNext = firstWeekOffset(year + 1, dow, doy);\n return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;\n }\n\n // FORMATTING\n\n addFormatToken('w', ['ww', 2], 'wo', 'week');\n addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');\n\n // ALIASES\n\n addUnitAlias('week', 'w');\n addUnitAlias('isoWeek', 'W');\n\n // PRIORITIES\n\n addUnitPriority('week', 5);\n addUnitPriority('isoWeek', 5);\n\n // PARSING\n\n addRegexToken('w', match1to2);\n addRegexToken('ww', match1to2, match2);\n addRegexToken('W', match1to2);\n addRegexToken('WW', match1to2, match2);\n\n addWeekParseToken(\n ['w', 'ww', 'W', 'WW'],\n function (input, week, config, token) {\n week[token.substr(0, 1)] = toInt(input);\n }\n );\n\n // HELPERS\n\n // LOCALES\n\n function localeWeek(mom) {\n return weekOfYear(mom, this._week.dow, this._week.doy).week;\n }\n\n var defaultLocaleWeek = {\n dow: 0, // Sunday is the first day of the week.\n doy: 6, // The week that contains Jan 6th is the first week of the year.\n };\n\n function localeFirstDayOfWeek() {\n return this._week.dow;\n }\n\n function localeFirstDayOfYear() {\n return this._week.doy;\n }\n\n // MOMENTS\n\n function getSetWeek(input) {\n var week = this.localeData().week(this);\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n\n function getSetISOWeek(input) {\n var week = weekOfYear(this, 1, 4).week;\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('d', 0, 'do', 'day');\n\n addFormatToken('dd', 0, 0, function (format) {\n return this.localeData().weekdaysMin(this, format);\n });\n\n addFormatToken('ddd', 0, 0, function (format) {\n return this.localeData().weekdaysShort(this, format);\n });\n\n addFormatToken('dddd', 0, 0, function (format) {\n return this.localeData().weekdays(this, format);\n });\n\n addFormatToken('e', 0, 0, 'weekday');\n addFormatToken('E', 0, 0, 'isoWeekday');\n\n // ALIASES\n\n addUnitAlias('day', 'd');\n addUnitAlias('weekday', 'e');\n addUnitAlias('isoWeekday', 'E');\n\n // PRIORITY\n addUnitPriority('day', 11);\n addUnitPriority('weekday', 11);\n addUnitPriority('isoWeekday', 11);\n\n // PARSING\n\n addRegexToken('d', match1to2);\n addRegexToken('e', match1to2);\n addRegexToken('E', match1to2);\n addRegexToken('dd', function (isStrict, locale) {\n return locale.weekdaysMinRegex(isStrict);\n });\n addRegexToken('ddd', function (isStrict, locale) {\n return locale.weekdaysShortRegex(isStrict);\n });\n addRegexToken('dddd', function (isStrict, locale) {\n return locale.weekdaysRegex(isStrict);\n });\n\n addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {\n var weekday = config._locale.weekdaysParse(input, token, config._strict);\n // if we didn't get a weekday name, mark the date as invalid\n if (weekday != null) {\n week.d = weekday;\n } else {\n getParsingFlags(config).invalidWeekday = input;\n }\n });\n\n addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {\n week[token] = toInt(input);\n });\n\n // HELPERS\n\n function parseWeekday(input, locale) {\n if (typeof input !== 'string') {\n return input;\n }\n\n if (!isNaN(input)) {\n return parseInt(input, 10);\n }\n\n input = locale.weekdaysParse(input);\n if (typeof input === 'number') {\n return input;\n }\n\n return null;\n }\n\n function parseIsoWeekday(input, locale) {\n if (typeof input === 'string') {\n return locale.weekdaysParse(input) % 7 || 7;\n }\n return isNaN(input) ? null : input;\n }\n\n // LOCALES\n function shiftWeekdays(ws, n) {\n return ws.slice(n, 7).concat(ws.slice(0, n));\n }\n\n var defaultLocaleWeekdays =\n 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),\n defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),\n defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),\n defaultWeekdaysRegex = matchWord,\n defaultWeekdaysShortRegex = matchWord,\n defaultWeekdaysMinRegex = matchWord;\n\n function localeWeekdays(m, format) {\n var weekdays = isArray(this._weekdays)\n ? this._weekdays\n : this._weekdays[\n m && m !== true && this._weekdays.isFormat.test(format)\n ? 'format'\n : 'standalone'\n ];\n return m === true\n ? shiftWeekdays(weekdays, this._week.dow)\n : m\n ? weekdays[m.day()]\n : weekdays;\n }\n\n function localeWeekdaysShort(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysShort, this._week.dow)\n : m\n ? this._weekdaysShort[m.day()]\n : this._weekdaysShort;\n }\n\n function localeWeekdaysMin(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysMin, this._week.dow)\n : m\n ? this._weekdaysMin[m.day()]\n : this._weekdaysMin;\n }\n\n function handleStrictParse$1(weekdayName, format, strict) {\n var i,\n ii,\n mom,\n llc = weekdayName.toLocaleLowerCase();\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._minWeekdaysParse = [];\n\n for (i = 0; i < 7; ++i) {\n mom = createUTC([2000, 1]).day(i);\n this._minWeekdaysParse[i] = this.weekdaysMin(\n mom,\n ''\n ).toLocaleLowerCase();\n this._shortWeekdaysParse[i] = this.weekdaysShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n\n function localeWeekdaysParse(weekdayName, format, strict) {\n var i, mom, regex;\n\n if (this._weekdaysParseExact) {\n return handleStrictParse$1.call(this, weekdayName, format, strict);\n }\n\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._minWeekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._fullWeekdaysParse = [];\n }\n\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n\n mom = createUTC([2000, 1]).day(i);\n if (strict && !this._fullWeekdaysParse[i]) {\n this._fullWeekdaysParse[i] = new RegExp(\n '^' + this.weekdays(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._shortWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysShort(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._minWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysMin(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n }\n if (!this._weekdaysParse[i]) {\n regex =\n '^' +\n this.weekdays(mom, '') +\n '|^' +\n this.weekdaysShort(mom, '') +\n '|^' +\n this.weekdaysMin(mom, '');\n this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'dddd' &&\n this._fullWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'ddd' &&\n this._shortWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'dd' &&\n this._minWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function getSetDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();\n if (input != null) {\n input = parseWeekday(input, this.localeData());\n return this.add(input - day, 'd');\n } else {\n return day;\n }\n }\n\n function getSetLocaleDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;\n return input == null ? weekday : this.add(input - weekday, 'd');\n }\n\n function getSetISODayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n\n // behaves the same as moment#day except\n // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)\n // as a setter, sunday should belong to the previous week.\n\n if (input != null) {\n var weekday = parseIsoWeekday(input, this.localeData());\n return this.day(this.day() % 7 ? weekday : weekday - 7);\n } else {\n return this.day() || 7;\n }\n }\n\n function weekdaysRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysStrictRegex;\n } else {\n return this._weekdaysRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n this._weekdaysRegex = defaultWeekdaysRegex;\n }\n return this._weekdaysStrictRegex && isStrict\n ? this._weekdaysStrictRegex\n : this._weekdaysRegex;\n }\n }\n\n function weekdaysShortRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysShortStrictRegex;\n } else {\n return this._weekdaysShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysShortRegex')) {\n this._weekdaysShortRegex = defaultWeekdaysShortRegex;\n }\n return this._weekdaysShortStrictRegex && isStrict\n ? this._weekdaysShortStrictRegex\n : this._weekdaysShortRegex;\n }\n }\n\n function weekdaysMinRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysMinStrictRegex;\n } else {\n return this._weekdaysMinRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysMinRegex')) {\n this._weekdaysMinRegex = defaultWeekdaysMinRegex;\n }\n return this._weekdaysMinStrictRegex && isStrict\n ? this._weekdaysMinStrictRegex\n : this._weekdaysMinRegex;\n }\n }\n\n function computeWeekdaysParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var minPieces = [],\n shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n minp,\n shortp,\n longp;\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, 1]).day(i);\n minp = regexEscape(this.weekdaysMin(mom, ''));\n shortp = regexEscape(this.weekdaysShort(mom, ''));\n longp = regexEscape(this.weekdays(mom, ''));\n minPieces.push(minp);\n shortPieces.push(shortp);\n longPieces.push(longp);\n mixedPieces.push(minp);\n mixedPieces.push(shortp);\n mixedPieces.push(longp);\n }\n // Sorting makes sure if one weekday (or abbr) is a prefix of another it\n // will match the longer piece.\n minPieces.sort(cmpLenRev);\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n\n this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._weekdaysShortRegex = this._weekdaysRegex;\n this._weekdaysMinRegex = this._weekdaysRegex;\n\n this._weekdaysStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysMinStrictRegex = new RegExp(\n '^(' + minPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n function hFormat() {\n return this.hours() % 12 || 12;\n }\n\n function kFormat() {\n return this.hours() || 24;\n }\n\n addFormatToken('H', ['HH', 2], 0, 'hour');\n addFormatToken('h', ['hh', 2], 0, hFormat);\n addFormatToken('k', ['kk', 2], 0, kFormat);\n\n addFormatToken('hmm', 0, 0, function () {\n return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);\n });\n\n addFormatToken('hmmss', 0, 0, function () {\n return (\n '' +\n hFormat.apply(this) +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n });\n\n addFormatToken('Hmm', 0, 0, function () {\n return '' + this.hours() + zeroFill(this.minutes(), 2);\n });\n\n addFormatToken('Hmmss', 0, 0, function () {\n return (\n '' +\n this.hours() +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n });\n\n function meridiem(token, lowercase) {\n addFormatToken(token, 0, 0, function () {\n return this.localeData().meridiem(\n this.hours(),\n this.minutes(),\n lowercase\n );\n });\n }\n\n meridiem('a', true);\n meridiem('A', false);\n\n // ALIASES\n\n addUnitAlias('hour', 'h');\n\n // PRIORITY\n addUnitPriority('hour', 13);\n\n // PARSING\n\n function matchMeridiem(isStrict, locale) {\n return locale._meridiemParse;\n }\n\n addRegexToken('a', matchMeridiem);\n addRegexToken('A', matchMeridiem);\n addRegexToken('H', match1to2);\n addRegexToken('h', match1to2);\n addRegexToken('k', match1to2);\n addRegexToken('HH', match1to2, match2);\n addRegexToken('hh', match1to2, match2);\n addRegexToken('kk', match1to2, match2);\n\n addRegexToken('hmm', match3to4);\n addRegexToken('hmmss', match5to6);\n addRegexToken('Hmm', match3to4);\n addRegexToken('Hmmss', match5to6);\n\n addParseToken(['H', 'HH'], HOUR);\n addParseToken(['k', 'kk'], function (input, array, config) {\n var kInput = toInt(input);\n array[HOUR] = kInput === 24 ? 0 : kInput;\n });\n addParseToken(['a', 'A'], function (input, array, config) {\n config._isPm = config._locale.isPM(input);\n config._meridiem = input;\n });\n addParseToken(['h', 'hh'], function (input, array, config) {\n array[HOUR] = toInt(input);\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('Hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n });\n addParseToken('Hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n });\n\n // LOCALES\n\n function localeIsPM(input) {\n // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays\n // Using charAt should be more compatible.\n return (input + '').toLowerCase().charAt(0) === 'p';\n }\n\n var defaultLocaleMeridiemParse = /[ap]\\.?m?\\.?/i,\n // Setting the hour should keep the time, because the user explicitly\n // specified which hour they want. So trying to maintain the same hour (in\n // a new timezone) makes sense. Adding/subtracting hours does not follow\n // this rule.\n getSetHour = makeGetSet('Hours', true);\n\n function localeMeridiem(hours, minutes, isLower) {\n if (hours > 11) {\n return isLower ? 'pm' : 'PM';\n } else {\n return isLower ? 'am' : 'AM';\n }\n }\n\n var baseConfig = {\n calendar: defaultCalendar,\n longDateFormat: defaultLongDateFormat,\n invalidDate: defaultInvalidDate,\n ordinal: defaultOrdinal,\n dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,\n relativeTime: defaultRelativeTime,\n\n months: defaultLocaleMonths,\n monthsShort: defaultLocaleMonthsShort,\n\n week: defaultLocaleWeek,\n\n weekdays: defaultLocaleWeekdays,\n weekdaysMin: defaultLocaleWeekdaysMin,\n weekdaysShort: defaultLocaleWeekdaysShort,\n\n meridiemParse: defaultLocaleMeridiemParse,\n };\n\n // internal storage for locale config files\n var locales = {},\n localeFamilies = {},\n globalLocale;\n\n function commonPrefix(arr1, arr2) {\n var i,\n minl = Math.min(arr1.length, arr2.length);\n for (i = 0; i < minl; i += 1) {\n if (arr1[i] !== arr2[i]) {\n return i;\n }\n }\n return minl;\n }\n\n function normalizeLocale(key) {\n return key ? key.toLowerCase().replace('_', '-') : key;\n }\n\n // pick the locale from the array\n // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each\n // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root\n function chooseLocale(names) {\n var i = 0,\n j,\n next,\n locale,\n split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (\n next &&\n next.length >= j &&\n commonPrefix(split, next) >= j - 1\n ) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return globalLocale;\n }\n\n function isLocaleNameSane(name) {\n // Prevent names that look like filesystem paths, i.e contain '/' or '\\'\n return name.match('^[^/\\\\\\\\]*$') != null;\n }\n\n function loadLocale(name) {\n var oldLocale = null,\n aliasedRequire;\n // TODO: Find a better way to register and load all the locales in Node\n if (\n locales[name] === undefined &&\n typeof module !== 'undefined' &&\n module &&\n module.exports &&\n isLocaleNameSane(name)\n ) {\n try {\n oldLocale = globalLocale._abbr;\n aliasedRequire = require;\n aliasedRequire('./locale/' + name);\n getSetGlobalLocale(oldLocale);\n } catch (e) {\n // mark as not found to avoid repeating expensive file require call causing high CPU\n // when trying to find en-US, en_US, en-us for every format call\n locales[name] = null; // null means not found\n }\n }\n return locales[name];\n }\n\n // This function will load locale and then set the global locale. If\n // no arguments are passed in, it will simply return the current global\n // locale key.\n function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn(\n 'Locale ' + key + ' not found. Did you forget to load it?'\n );\n }\n }\n }\n\n return globalLocale._abbr;\n }\n\n function defineLocale(name, config) {\n if (config !== null) {\n var locale,\n parentConfig = baseConfig;\n config.abbr = name;\n if (locales[name] != null) {\n deprecateSimple(\n 'defineLocaleOverride',\n 'use moment.updateLocale(localeName, config) to change ' +\n 'an existing locale. moment.defineLocale(localeName, ' +\n 'config) should only be used for creating a new locale ' +\n 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'\n );\n parentConfig = locales[name]._config;\n } else if (config.parentLocale != null) {\n if (locales[config.parentLocale] != null) {\n parentConfig = locales[config.parentLocale]._config;\n } else {\n locale = loadLocale(config.parentLocale);\n if (locale != null) {\n parentConfig = locale._config;\n } else {\n if (!localeFamilies[config.parentLocale]) {\n localeFamilies[config.parentLocale] = [];\n }\n localeFamilies[config.parentLocale].push({\n name: name,\n config: config,\n });\n return null;\n }\n }\n }\n locales[name] = new Locale(mergeConfigs(parentConfig, config));\n\n if (localeFamilies[name]) {\n localeFamilies[name].forEach(function (x) {\n defineLocale(x.name, x.config);\n });\n }\n\n // backwards compat for now: also set the locale\n // make sure we set the locale AFTER all child locales have been\n // created, so we won't end up with the child locale set.\n getSetGlobalLocale(name);\n\n return locales[name];\n } else {\n // useful for testing\n delete locales[name];\n return null;\n }\n }\n\n function updateLocale(name, config) {\n if (config != null) {\n var locale,\n tmpLocale,\n parentConfig = baseConfig;\n\n if (locales[name] != null && locales[name].parentLocale != null) {\n // Update existing child locale in-place to avoid memory-leaks\n locales[name].set(mergeConfigs(locales[name]._config, config));\n } else {\n // MERGE\n tmpLocale = loadLocale(name);\n if (tmpLocale != null) {\n parentConfig = tmpLocale._config;\n }\n config = mergeConfigs(parentConfig, config);\n if (tmpLocale == null) {\n // updateLocale is called for creating a new locale\n // Set abbr so it will have a name (getters return\n // undefined otherwise).\n config.abbr = name;\n }\n locale = new Locale(config);\n locale.parentLocale = locales[name];\n locales[name] = locale;\n }\n\n // backwards compat for now: also set the locale\n getSetGlobalLocale(name);\n } else {\n // pass null for config to unupdate, useful for tests\n if (locales[name] != null) {\n if (locales[name].parentLocale != null) {\n locales[name] = locales[name].parentLocale;\n if (name === getSetGlobalLocale()) {\n getSetGlobalLocale(name);\n }\n } else if (locales[name] != null) {\n delete locales[name];\n }\n }\n }\n return locales[name];\n }\n\n // returns locale data\n function getLocale(key) {\n var locale;\n\n if (key && key._locale && key._locale._abbr) {\n key = key._locale._abbr;\n }\n\n if (!key) {\n return globalLocale;\n }\n\n if (!isArray(key)) {\n //short-circuit everything else\n locale = loadLocale(key);\n if (locale) {\n return locale;\n }\n key = [key];\n }\n\n return chooseLocale(key);\n }\n\n function listLocales() {\n return keys(locales);\n }\n\n function checkOverflow(m) {\n var overflow,\n a = m._a;\n\n if (a && getParsingFlags(m).overflow === -2) {\n overflow =\n a[MONTH] < 0 || a[MONTH] > 11\n ? MONTH\n : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])\n ? DATE\n : a[HOUR] < 0 ||\n a[HOUR] > 24 ||\n (a[HOUR] === 24 &&\n (a[MINUTE] !== 0 ||\n a[SECOND] !== 0 ||\n a[MILLISECOND] !== 0))\n ? HOUR\n : a[MINUTE] < 0 || a[MINUTE] > 59\n ? MINUTE\n : a[SECOND] < 0 || a[SECOND] > 59\n ? SECOND\n : a[MILLISECOND] < 0 || a[MILLISECOND] > 999\n ? MILLISECOND\n : -1;\n\n if (\n getParsingFlags(m)._overflowDayOfYear &&\n (overflow < YEAR || overflow > DATE)\n ) {\n overflow = DATE;\n }\n if (getParsingFlags(m)._overflowWeeks && overflow === -1) {\n overflow = WEEK;\n }\n if (getParsingFlags(m)._overflowWeekday && overflow === -1) {\n overflow = WEEKDAY;\n }\n\n getParsingFlags(m).overflow = overflow;\n }\n\n return m;\n }\n\n // iso 8601 regex\n // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\n var extendedIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [\n ['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/],\n ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/],\n ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/],\n ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false],\n ['YYYY-DDD', /\\d{4}-\\d{3}/],\n ['YYYY-MM', /\\d{4}-\\d\\d/, false],\n ['YYYYYYMMDD', /[+-]\\d{10}/],\n ['YYYYMMDD', /\\d{8}/],\n ['GGGG[W]WWE', /\\d{4}W\\d{3}/],\n ['GGGG[W]WW', /\\d{4}W\\d{2}/, false],\n ['YYYYDDD', /\\d{7}/],\n ['YYYYMM', /\\d{6}/, false],\n ['YYYY', /\\d{4}/, false],\n ],\n // iso time formats and regexes\n isoTimes = [\n ['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/],\n ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/],\n ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/],\n ['HH:mm', /\\d\\d:\\d\\d/],\n ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/],\n ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/],\n ['HHmmss', /\\d\\d\\d\\d\\d\\d/],\n ['HHmm', /\\d\\d\\d\\d/],\n ['HH', /\\d\\d/],\n ],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n };\n\n // date from iso format\n function configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat,\n isoDatesLen = isoDates.length,\n isoTimesLen = isoTimes.length;\n\n if (match) {\n getParsingFlags(config).iso = true;\n for (i = 0, l = isoDatesLen; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimesLen; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }\n\n function extractFromRFC2822Strings(\n yearStr,\n monthStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr\n ) {\n var result = [\n untruncateYear(yearStr),\n defaultLocaleMonthsShort.indexOf(monthStr),\n parseInt(dayStr, 10),\n parseInt(hourStr, 10),\n parseInt(minuteStr, 10),\n ];\n\n if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }\n\n return result;\n }\n\n function untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n }\n\n function preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, ' ')\n .replace(/(\\s\\s+)/g, ' ')\n .replace(/^\\s\\s*/, '')\n .replace(/\\s\\s*$/, '');\n }\n\n function checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(\n parsedInput[0],\n parsedInput[1],\n parsedInput[2]\n ).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n }\n\n function calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n }\n\n // date and time from ref 2822 format\n function configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(\n match[4],\n match[3],\n match[2],\n match[5],\n match[6],\n match[7]\n );\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }\n\n config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);\n\n config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n\n getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n }\n\n // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\n function configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }\n\n configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n }\n\n hooks.createFromInputFallback = deprecate(\n 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +\n 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +\n 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',\n function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n }\n );\n\n // Pick the first defined of two or three arguments.\n function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }\n\n function currentDateArray(config) {\n // hooks is actually the exported moment object\n var nowValue = new Date(hooks.now());\n if (config._useUTC) {\n return [\n nowValue.getUTCFullYear(),\n nowValue.getUTCMonth(),\n nowValue.getUTCDate(),\n ];\n }\n return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];\n }\n\n // convert an array to a date.\n // the array should mirror the parameters below\n // note: all values past the year are optional and will default to the lowest possible value.\n // [year, month, day , hour, minute, second, millisecond]\n function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n expectedWeekday,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (\n config._dayOfYear > daysInYear(yearToUse) ||\n config._dayOfYear === 0\n ) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] =\n config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (\n config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0\n ) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(\n null,\n input\n );\n expectedWeekday = config._useUTC\n ? config._d.getUTCDay()\n : config._d.getDay();\n\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (\n config._w &&\n typeof config._w.d !== 'undefined' &&\n config._w.d !== expectedWeekday\n ) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n }\n\n function dayOfYearFromWeekInfo(config) {\n var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;\n\n w = config._w;\n if (w.GG != null || w.W != null || w.E != null) {\n dow = 1;\n doy = 4;\n\n // TODO: We need to take the current isoWeekYear, but that depends on\n // how we interpret now (local, utc, fixed offset). So create\n // a now version of current config (take local/utc/offset flags, and\n // create now).\n weekYear = defaults(\n w.GG,\n config._a[YEAR],\n weekOfYear(createLocal(), 1, 4).year\n );\n week = defaults(w.W, 1);\n weekday = defaults(w.E, 1);\n if (weekday < 1 || weekday > 7) {\n weekdayOverflow = true;\n }\n } else {\n dow = config._locale._week.dow;\n doy = config._locale._week.doy;\n\n curWeek = weekOfYear(createLocal(), dow, doy);\n\n weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);\n\n // Default to current week.\n week = defaults(w.w, curWeek.week);\n\n if (w.d != null) {\n // weekday -- low day numbers are considered next week\n weekday = w.d;\n if (weekday < 0 || weekday > 6) {\n weekdayOverflow = true;\n }\n } else if (w.e != null) {\n // local weekday -- counting starts from beginning of week\n weekday = w.e + dow;\n if (w.e < 0 || w.e > 6) {\n weekdayOverflow = true;\n }\n } else {\n // default to beginning of week\n weekday = dow;\n }\n }\n if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {\n getParsingFlags(config)._overflowWeeks = true;\n } else if (weekdayOverflow != null) {\n getParsingFlags(config)._overflowWeekday = true;\n } else {\n temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);\n config._a[YEAR] = temp.year;\n config._dayOfYear = temp.dayOfYear;\n }\n }\n\n // constant that refers to the ISO standard\n hooks.ISO_8601 = function () {};\n\n // constant that refers to the RFC 2822 form\n hooks.RFC_2822 = function () {};\n\n // date from string and format string\n function configFromStringAndFormat(config) {\n // TODO: Move this to another part of the creation flow to prevent circular deps\n if (config._f === hooks.ISO_8601) {\n configFromISO(config);\n return;\n }\n if (config._f === hooks.RFC_2822) {\n configFromRFC2822(config);\n return;\n }\n config._a = [];\n getParsingFlags(config).empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i,\n parsedInput,\n tokens,\n token,\n skipped,\n stringLength = string.length,\n totalParsedInputLength = 0,\n era,\n tokenLen;\n\n tokens =\n expandFormat(config._f, config._locale).match(formattingTokens) || [];\n tokenLen = tokens.length;\n for (i = 0; i < tokenLen; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) ||\n [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n getParsingFlags(config).unusedInput.push(skipped);\n }\n string = string.slice(\n string.indexOf(parsedInput) + parsedInput.length\n );\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n getParsingFlags(config).empty = false;\n } else {\n getParsingFlags(config).unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n } else if (config._strict && !parsedInput) {\n getParsingFlags(config).unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n getParsingFlags(config).charsLeftOver =\n stringLength - totalParsedInputLength;\n if (string.length > 0) {\n getParsingFlags(config).unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (\n config._a[HOUR] <= 12 &&\n getParsingFlags(config).bigHour === true &&\n config._a[HOUR] > 0\n ) {\n getParsingFlags(config).bigHour = undefined;\n }\n\n getParsingFlags(config).parsedDateParts = config._a.slice(0);\n getParsingFlags(config).meridiem = config._meridiem;\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(\n config._locale,\n config._a[HOUR],\n config._meridiem\n );\n\n // handle era\n era = getParsingFlags(config).era;\n if (era !== null) {\n config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);\n }\n\n configFromArray(config);\n checkOverflow(config);\n }\n\n function meridiemFixWrap(locale, hour, meridiem) {\n var isPm;\n\n if (meridiem == null) {\n // nothing to do\n return hour;\n }\n if (locale.meridiemHour != null) {\n return locale.meridiemHour(hour, meridiem);\n } else if (locale.isPM != null) {\n // Fallback\n isPm = locale.isPM(meridiem);\n if (isPm && hour < 12) {\n hour += 12;\n }\n if (!isPm && hour === 12) {\n hour = 0;\n }\n return hour;\n } else {\n // this is not supposed to happen\n return hour;\n }\n }\n\n // date from string and array of format strings\n function configFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n scoreToBeat,\n i,\n currentScore,\n validFormatFound,\n bestFormatIsValid = false,\n configfLen = config._f.length;\n\n if (configfLen === 0) {\n getParsingFlags(config).invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < configfLen; i++) {\n currentScore = 0;\n validFormatFound = false;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._f = config._f[i];\n configFromStringAndFormat(tempConfig);\n\n if (isValid(tempConfig)) {\n validFormatFound = true;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += getParsingFlags(tempConfig).charsLeftOver;\n\n //or tokens\n currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;\n\n getParsingFlags(tempConfig).score = currentScore;\n\n if (!bestFormatIsValid) {\n if (\n scoreToBeat == null ||\n currentScore < scoreToBeat ||\n validFormatFound\n ) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n if (validFormatFound) {\n bestFormatIsValid = true;\n }\n }\n } else {\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }\n\n function configFromObject(config) {\n if (config._d) {\n return;\n }\n\n var i = normalizeObjectUnits(config._i),\n dayOrDate = i.day === undefined ? i.date : i.day;\n config._a = map(\n [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],\n function (obj) {\n return obj && parseInt(obj, 10);\n }\n );\n\n configFromArray(config);\n }\n\n function createFromConfig(config) {\n var res = new Moment(checkOverflow(prepareConfig(config)));\n if (res._nextDay) {\n // Adding is smart enough around DST\n res.add(1, 'd');\n res._nextDay = undefined;\n }\n\n return res;\n }\n\n function prepareConfig(config) {\n var input = config._i,\n format = config._f;\n\n config._locale = config._locale || getLocale(config._l);\n\n if (input === null || (format === undefined && input === '')) {\n return createInvalid({ nullInput: true });\n }\n\n if (typeof input === 'string') {\n config._i = input = config._locale.preparse(input);\n }\n\n if (isMoment(input)) {\n return new Moment(checkOverflow(input));\n } else if (isDate(input)) {\n config._d = input;\n } else if (isArray(format)) {\n configFromStringAndArray(config);\n } else if (format) {\n configFromStringAndFormat(config);\n } else {\n configFromInput(config);\n }\n\n if (!isValid(config)) {\n config._d = null;\n }\n\n return config;\n }\n\n function configFromInput(config) {\n var input = config._i;\n if (isUndefined(input)) {\n config._d = new Date(hooks.now());\n } else if (isDate(input)) {\n config._d = new Date(input.valueOf());\n } else if (typeof input === 'string') {\n configFromString(config);\n } else if (isArray(input)) {\n config._a = map(input.slice(0), function (obj) {\n return parseInt(obj, 10);\n });\n configFromArray(config);\n } else if (isObject(input)) {\n configFromObject(config);\n } else if (isNumber(input)) {\n // from milliseconds\n config._d = new Date(input);\n } else {\n hooks.createFromInputFallback(config);\n }\n }\n\n function createLocalOrUTC(input, format, locale, strict, isUTC) {\n var c = {};\n\n if (format === true || format === false) {\n strict = format;\n format = undefined;\n }\n\n if (locale === true || locale === false) {\n strict = locale;\n locale = undefined;\n }\n\n if (\n (isObject(input) && isObjectEmpty(input)) ||\n (isArray(input) && input.length === 0)\n ) {\n input = undefined;\n }\n // object construction must be done this way.\n // https://github.com/moment/moment/issues/1423\n c._isAMomentObject = true;\n c._useUTC = c._isUTC = isUTC;\n c._l = locale;\n c._i = input;\n c._f = format;\n c._strict = strict;\n\n return createFromConfig(c);\n }\n\n function createLocal(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, false);\n }\n\n var prototypeMin = deprecate(\n 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other < this ? this : other;\n } else {\n return createInvalid();\n }\n }\n ),\n prototypeMax = deprecate(\n 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other > this ? this : other;\n } else {\n return createInvalid();\n }\n }\n );\n\n // Pick a moment m from moments so that m[fn](other) is true for all\n // other. This relies on the function fn to be transitive.\n //\n // moments should either be an array of moment objects or an array, whose\n // first element is an array of moment objects.\n function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }\n\n // TODO: Use [].sort instead?\n function min() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n }\n\n function max() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isAfter', args);\n }\n\n var now = function () {\n return Date.now ? Date.now() : +new Date();\n };\n\n var ordering = [\n 'year',\n 'quarter',\n 'month',\n 'week',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'millisecond',\n ];\n\n function isDurationValid(m) {\n var key,\n unitHasDecimal = false,\n i,\n orderLen = ordering.length;\n for (key in m) {\n if (\n hasOwnProp(m, key) &&\n !(\n indexOf.call(ordering, key) !== -1 &&\n (m[key] == null || !isNaN(m[key]))\n )\n ) {\n return false;\n }\n }\n\n for (i = 0; i < orderLen; ++i) {\n if (m[ordering[i]]) {\n if (unitHasDecimal) {\n return false; // only allow non-integers for smallest unit\n }\n if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {\n unitHasDecimal = true;\n }\n }\n }\n\n return true;\n }\n\n function isValid$1() {\n return this._isValid;\n }\n\n function createInvalid$1() {\n return createDuration(NaN);\n }\n\n function Duration(duration) {\n var normalizedInput = normalizeObjectUnits(duration),\n years = normalizedInput.year || 0,\n quarters = normalizedInput.quarter || 0,\n months = normalizedInput.month || 0,\n weeks = normalizedInput.week || normalizedInput.isoWeek || 0,\n days = normalizedInput.day || 0,\n hours = normalizedInput.hour || 0,\n minutes = normalizedInput.minute || 0,\n seconds = normalizedInput.second || 0,\n milliseconds = normalizedInput.millisecond || 0;\n\n this._isValid = isDurationValid(normalizedInput);\n\n // representation for dateAddRemove\n this._milliseconds =\n +milliseconds +\n seconds * 1e3 + // 1000\n minutes * 6e4 + // 1000 * 60\n hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978\n // Because of dateAddRemove treats 24 hours as different from a\n // day when working around DST, we need to store them separately\n this._days = +days + weeks * 7;\n // It is impossible to translate months into days without knowing\n // which months you are are talking about, so we have to store\n // it separately.\n this._months = +months + quarters * 3 + years * 12;\n\n this._data = {};\n\n this._locale = getLocale();\n\n this._bubble();\n }\n\n function isDuration(obj) {\n return obj instanceof Duration;\n }\n\n function absRound(number) {\n if (number < 0) {\n return Math.round(-1 * number) * -1;\n } else {\n return Math.round(number);\n }\n }\n\n // compare two arrays, return the number of differences\n function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (\n (dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))\n ) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }\n\n // FORMATTING\n\n function offset(token, separator) {\n addFormatToken(token, 0, 0, function () {\n var offset = this.utcOffset(),\n sign = '+';\n if (offset < 0) {\n offset = -offset;\n sign = '-';\n }\n return (\n sign +\n zeroFill(~~(offset / 60), 2) +\n separator +\n zeroFill(~~offset % 60, 2)\n );\n });\n }\n\n offset('Z', ':');\n offset('ZZ', '');\n\n // PARSING\n\n addRegexToken('Z', matchShortOffset);\n addRegexToken('ZZ', matchShortOffset);\n addParseToken(['Z', 'ZZ'], function (input, array, config) {\n config._useUTC = true;\n config._tzm = offsetFromString(matchShortOffset, input);\n });\n\n // HELPERS\n\n // timezone chunker\n // '+10:00' > ['10', '00']\n // '-1530' > ['-15', '30']\n var chunkOffset = /([\\+\\-]|\\d\\d)/gi;\n\n function offsetFromString(matcher, string) {\n var matches = (string || '').match(matcher),\n chunk,\n parts,\n minutes;\n\n if (matches === null) {\n return null;\n }\n\n chunk = matches[matches.length - 1] || [];\n parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];\n minutes = +(parts[1] * 60) + toInt(parts[2]);\n\n return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;\n }\n\n // Return a moment from input, that is local/utc/zone equivalent to model.\n function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff =\n (isMoment(input) || isDate(input)\n ? input.valueOf()\n : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }\n\n function getDateOffset(m) {\n // On Firefox.24 Date#getTimezoneOffset returns a floating point.\n // https://github.com/moment/moment/pull/1871\n return -Math.round(m._d.getTimezoneOffset());\n }\n\n // HOOKS\n\n // This function will be called whenever a moment is mutated.\n // It is intended to keep the offset in sync with the timezone.\n hooks.updateOffset = function () {};\n\n // MOMENTS\n\n // keepLocalTime = true means only change the timezone, without\n // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->\n // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset\n // +0200, so we adjust the time as needed, to be valid.\n //\n // Keeping the time actually adds/subtracts (one hour)\n // from the actual represented time. That is why we call updateOffset\n // a second time. In case it wants us to change the offset again\n // _changeInProgress == true case, then we have to adjust, because\n // there is no such time in the given timezone.\n function getSetOffset(input, keepLocalTime, keepMinutes) {\n var offset = this._offset || 0,\n localAdjust;\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n if (input != null) {\n if (typeof input === 'string') {\n input = offsetFromString(matchShortOffset, input);\n if (input === null) {\n return this;\n }\n } else if (Math.abs(input) < 16 && !keepMinutes) {\n input = input * 60;\n }\n if (!this._isUTC && keepLocalTime) {\n localAdjust = getDateOffset(this);\n }\n this._offset = input;\n this._isUTC = true;\n if (localAdjust != null) {\n this.add(localAdjust, 'm');\n }\n if (offset !== input) {\n if (!keepLocalTime || this._changeInProgress) {\n addSubtract(\n this,\n createDuration(input - offset, 'm'),\n 1,\n false\n );\n } else if (!this._changeInProgress) {\n this._changeInProgress = true;\n hooks.updateOffset(this, true);\n this._changeInProgress = null;\n }\n }\n return this;\n } else {\n return this._isUTC ? offset : getDateOffset(this);\n }\n }\n\n function getSetZone(input, keepLocalTime) {\n if (input != null) {\n if (typeof input !== 'string') {\n input = -input;\n }\n\n this.utcOffset(input, keepLocalTime);\n\n return this;\n } else {\n return -this.utcOffset();\n }\n }\n\n function setOffsetToUTC(keepLocalTime) {\n return this.utcOffset(0, keepLocalTime);\n }\n\n function setOffsetToLocal(keepLocalTime) {\n if (this._isUTC) {\n this.utcOffset(0, keepLocalTime);\n this._isUTC = false;\n\n if (keepLocalTime) {\n this.subtract(getDateOffset(this), 'm');\n }\n }\n return this;\n }\n\n function setOffsetToParsedOffset() {\n if (this._tzm != null) {\n this.utcOffset(this._tzm, false, true);\n } else if (typeof this._i === 'string') {\n var tZone = offsetFromString(matchOffset, this._i);\n if (tZone != null) {\n this.utcOffset(tZone);\n } else {\n this.utcOffset(0, true);\n }\n }\n return this;\n }\n\n function hasAlignedHourOffset(input) {\n if (!this.isValid()) {\n return false;\n }\n input = input ? createLocal(input).utcOffset() : 0;\n\n return (this.utcOffset() - input) % 60 === 0;\n }\n\n function isDaylightSavingTime() {\n return (\n this.utcOffset() > this.clone().month(0).utcOffset() ||\n this.utcOffset() > this.clone().month(5).utcOffset()\n );\n }\n\n function isDaylightSavingTimeShifted() {\n if (!isUndefined(this._isDSTShifted)) {\n return this._isDSTShifted;\n }\n\n var c = {},\n other;\n\n copyConfig(c, this);\n c = prepareConfig(c);\n\n if (c._a) {\n other = c._isUTC ? createUTC(c._a) : createLocal(c._a);\n this._isDSTShifted =\n this.isValid() && compareArrays(c._a, other.toArray()) > 0;\n } else {\n this._isDSTShifted = false;\n }\n\n return this._isDSTShifted;\n }\n\n function isLocal() {\n return this.isValid() ? !this._isUTC : false;\n }\n\n function isUtcOffset() {\n return this.isValid() ? this._isUTC : false;\n }\n\n function isUtc() {\n return this.isValid() ? this._isUTC && this._offset === 0 : false;\n }\n\n // ASP.NET json date format regex\n var aspNetRegex = /^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,\n // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html\n // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere\n // and further modified to allow for strings containing both week and day\n isoRegex =\n /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\n function createDuration(input, key) {\n var duration = input,\n // matching against regexp is expensive, do it on demand\n match = null,\n sign,\n ret,\n diffRes;\n\n if (isDuration(input)) {\n duration = {\n ms: input._milliseconds,\n d: input._days,\n M: input._months,\n };\n } else if (isNumber(input) || !isNaN(+input)) {\n duration = {};\n if (key) {\n duration[key] = +input;\n } else {\n duration.milliseconds = +input;\n }\n } else if ((match = aspNetRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: 0,\n d: toInt(match[DATE]) * sign,\n h: toInt(match[HOUR]) * sign,\n m: toInt(match[MINUTE]) * sign,\n s: toInt(match[SECOND]) * sign,\n ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match\n };\n } else if ((match = isoRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: parseIso(match[2], sign),\n M: parseIso(match[3], sign),\n w: parseIso(match[4], sign),\n d: parseIso(match[5], sign),\n h: parseIso(match[6], sign),\n m: parseIso(match[7], sign),\n s: parseIso(match[8], sign),\n };\n } else if (duration == null) {\n // checks for null or undefined\n duration = {};\n } else if (\n typeof duration === 'object' &&\n ('from' in duration || 'to' in duration)\n ) {\n diffRes = momentsDifference(\n createLocal(duration.from),\n createLocal(duration.to)\n );\n\n duration = {};\n duration.ms = diffRes.milliseconds;\n duration.M = diffRes.months;\n }\n\n ret = new Duration(duration);\n\n if (isDuration(input) && hasOwnProp(input, '_locale')) {\n ret._locale = input._locale;\n }\n\n if (isDuration(input) && hasOwnProp(input, '_isValid')) {\n ret._isValid = input._isValid;\n }\n\n return ret;\n }\n\n createDuration.fn = Duration.prototype;\n createDuration.invalid = createInvalid$1;\n\n function parseIso(inp, sign) {\n // We'd normally use ~~inp for this, but unfortunately it also\n // converts floats to ints.\n // inp may be undefined, so careful calling replace on it.\n var res = inp && parseFloat(inp.replace(',', '.'));\n // apply sign while we're at it\n return (isNaN(res) ? 0 : res) * sign;\n }\n\n function positiveMomentsDifference(base, other) {\n var res = {};\n\n res.months =\n other.month() - base.month() + (other.year() - base.year()) * 12;\n if (base.clone().add(res.months, 'M').isAfter(other)) {\n --res.months;\n }\n\n res.milliseconds = +other - +base.clone().add(res.months, 'M');\n\n return res;\n }\n\n function momentsDifference(base, other) {\n var res;\n if (!(base.isValid() && other.isValid())) {\n return { milliseconds: 0, months: 0 };\n }\n\n other = cloneWithOffset(other, base);\n if (base.isBefore(other)) {\n res = positiveMomentsDifference(base, other);\n } else {\n res = positiveMomentsDifference(other, base);\n res.milliseconds = -res.milliseconds;\n res.months = -res.months;\n }\n\n return res;\n }\n\n // TODO: remove 'name' arg after deprecation is removed\n function createAdder(direction, name) {\n return function (val, period) {\n var dur, tmp;\n //invert the arguments, but complain about it\n if (period !== null && !isNaN(+period)) {\n deprecateSimple(\n name,\n 'moment().' +\n name +\n '(period, number) is deprecated. Please use moment().' +\n name +\n '(number, period). ' +\n 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'\n );\n tmp = val;\n val = period;\n period = tmp;\n }\n\n dur = createDuration(val, period);\n addSubtract(this, dur, direction);\n return this;\n };\n }\n\n function addSubtract(mom, duration, isAdding, updateOffset) {\n var milliseconds = duration._milliseconds,\n days = absRound(duration._days),\n months = absRound(duration._months);\n\n if (!mom.isValid()) {\n // No op\n return;\n }\n\n updateOffset = updateOffset == null ? true : updateOffset;\n\n if (months) {\n setMonth(mom, get(mom, 'Month') + months * isAdding);\n }\n if (days) {\n set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);\n }\n if (milliseconds) {\n mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);\n }\n if (updateOffset) {\n hooks.updateOffset(mom, days || months);\n }\n }\n\n var add = createAdder(1, 'add'),\n subtract = createAdder(-1, 'subtract');\n\n function isString(input) {\n return typeof input === 'string' || input instanceof String;\n }\n\n // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined\n function isMomentInput(input) {\n return (\n isMoment(input) ||\n isDate(input) ||\n isString(input) ||\n isNumber(input) ||\n isNumberOrStringArray(input) ||\n isMomentInputObject(input) ||\n input === null ||\n input === undefined\n );\n }\n\n function isMomentInputObject(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'years',\n 'year',\n 'y',\n 'months',\n 'month',\n 'M',\n 'days',\n 'day',\n 'd',\n 'dates',\n 'date',\n 'D',\n 'hours',\n 'hour',\n 'h',\n 'minutes',\n 'minute',\n 'm',\n 'seconds',\n 'second',\n 's',\n 'milliseconds',\n 'millisecond',\n 'ms',\n ],\n i,\n property,\n propertyLen = properties.length;\n\n for (i = 0; i < propertyLen; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n }\n\n function isNumberOrStringArray(input) {\n var arrayTest = isArray(input),\n dataTypeTest = false;\n if (arrayTest) {\n dataTypeTest =\n input.filter(function (item) {\n return !isNumber(item) && isString(input);\n }).length === 0;\n }\n return arrayTest && dataTypeTest;\n }\n\n function isCalendarSpec(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'sameDay',\n 'nextDay',\n 'lastDay',\n 'nextWeek',\n 'lastWeek',\n 'sameElse',\n ],\n i,\n property;\n\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n }\n\n function getCalendarFormat(myMoment, now) {\n var diff = myMoment.diff(now, 'days', true);\n return diff < -6\n ? 'sameElse'\n : diff < -1\n ? 'lastWeek'\n : diff < 0\n ? 'lastDay'\n : diff < 1\n ? 'sameDay'\n : diff < 2\n ? 'nextDay'\n : diff < 7\n ? 'nextWeek'\n : 'sameElse';\n }\n\n function calendar$1(time, formats) {\n // Support for single parameter, formats only overload to the calendar function\n if (arguments.length === 1) {\n if (!arguments[0]) {\n time = undefined;\n formats = undefined;\n } else if (isMomentInput(arguments[0])) {\n time = arguments[0];\n formats = undefined;\n } else if (isCalendarSpec(arguments[0])) {\n formats = arguments[0];\n time = undefined;\n }\n }\n // We want to compare the start of today, vs this.\n // Getting start-of-today depends on whether we're local/utc/offset or not.\n var now = time || createLocal(),\n sod = cloneWithOffset(now, this).startOf('day'),\n format = hooks.calendarFormat(this, sod) || 'sameElse',\n output =\n formats &&\n (isFunction(formats[format])\n ? formats[format].call(this, now)\n : formats[format]);\n\n return this.format(\n output || this.localeData().calendar(format, this, createLocal(now))\n );\n }\n\n function clone() {\n return new Moment(this);\n }\n\n function isAfter(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() > localInput.valueOf();\n } else {\n return localInput.valueOf() < this.clone().startOf(units).valueOf();\n }\n }\n\n function isBefore(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() < localInput.valueOf();\n } else {\n return this.clone().endOf(units).valueOf() < localInput.valueOf();\n }\n }\n\n function isBetween(from, to, units, inclusivity) {\n var localFrom = isMoment(from) ? from : createLocal(from),\n localTo = isMoment(to) ? to : createLocal(to);\n if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {\n return false;\n }\n inclusivity = inclusivity || '()';\n return (\n (inclusivity[0] === '('\n ? this.isAfter(localFrom, units)\n : !this.isBefore(localFrom, units)) &&\n (inclusivity[1] === ')'\n ? this.isBefore(localTo, units)\n : !this.isAfter(localTo, units))\n );\n }\n\n function isSame(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input),\n inputMs;\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() === localInput.valueOf();\n } else {\n inputMs = localInput.valueOf();\n return (\n this.clone().startOf(units).valueOf() <= inputMs &&\n inputMs <= this.clone().endOf(units).valueOf()\n );\n }\n }\n\n function isSameOrAfter(input, units) {\n return this.isSame(input, units) || this.isAfter(input, units);\n }\n\n function isSameOrBefore(input, units) {\n return this.isSame(input, units) || this.isBefore(input, units);\n }\n\n function diff(input, units, asFloat) {\n var that, zoneDelta, output;\n\n if (!this.isValid()) {\n return NaN;\n }\n\n that = cloneWithOffset(input, this);\n\n if (!that.isValid()) {\n return NaN;\n }\n\n zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;\n\n units = normalizeUnits(units);\n\n switch (units) {\n case 'year':\n output = monthDiff(this, that) / 12;\n break;\n case 'month':\n output = monthDiff(this, that);\n break;\n case 'quarter':\n output = monthDiff(this, that) / 3;\n break;\n case 'second':\n output = (this - that) / 1e3;\n break; // 1000\n case 'minute':\n output = (this - that) / 6e4;\n break; // 1000 * 60\n case 'hour':\n output = (this - that) / 36e5;\n break; // 1000 * 60 * 60\n case 'day':\n output = (this - that - zoneDelta) / 864e5;\n break; // 1000 * 60 * 60 * 24, negate dst\n case 'week':\n output = (this - that - zoneDelta) / 6048e5;\n break; // 1000 * 60 * 60 * 24 * 7, negate dst\n default:\n output = this - that;\n }\n\n return asFloat ? output : absFloor(output);\n }\n\n function monthDiff(a, b) {\n if (a.date() < b.date()) {\n // end-of-month calculations work correct when the start month has more\n // days than the end month.\n return -monthDiff(b, a);\n }\n // difference in months\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),\n // b is in (anchor - 1 month, anchor + 1 month)\n anchor = a.clone().add(wholeMonthDiff, 'months'),\n anchor2,\n adjust;\n\n if (b - anchor < 0) {\n anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor - anchor2);\n } else {\n anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor2 - anchor);\n }\n\n //check for negative zero, return zero if negative zero\n return -(wholeMonthDiff + adjust) || 0;\n }\n\n hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';\n hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';\n\n function toString() {\n return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');\n }\n\n function toISOString(keepOffset) {\n if (!this.isValid()) {\n return null;\n }\n var utc = keepOffset !== true,\n m = utc ? this.clone().utc() : this;\n if (m.year() < 0 || m.year() > 9999) {\n return formatMoment(\n m,\n utc\n ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'\n : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n if (isFunction(Date.prototype.toISOString)) {\n // native implementation is ~50x faster, use it when we can\n if (utc) {\n return this.toDate().toISOString();\n } else {\n return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)\n .toISOString()\n .replace('Z', formatMoment(m, 'Z'));\n }\n }\n return formatMoment(\n m,\n utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n\n /**\n * Return a human readable representation of a moment that can\n * also be evaluated to get a new moment which is the same\n *\n * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects\n */\n function inspect() {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment',\n zone = '',\n prefix,\n year,\n datetime,\n suffix;\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n prefix = '[' + func + '(\"]';\n year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';\n datetime = '-MM-DD[T]HH:mm:ss.SSS';\n suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }\n\n function format(inputString) {\n if (!inputString) {\n inputString = this.isUtc()\n ? hooks.defaultFormatUtc\n : hooks.defaultFormat;\n }\n var output = formatMoment(this, inputString);\n return this.localeData().postformat(output);\n }\n\n function from(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ to: this, from: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n\n function fromNow(withoutSuffix) {\n return this.from(createLocal(), withoutSuffix);\n }\n\n function to(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ from: this, to: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n\n function toNow(withoutSuffix) {\n return this.to(createLocal(), withoutSuffix);\n }\n\n // If passed a locale key, it will set the locale for this\n // instance. Otherwise, it will return the locale configuration\n // variables for this instance.\n function locale(key) {\n var newLocaleData;\n\n if (key === undefined) {\n return this._locale._abbr;\n } else {\n newLocaleData = getLocale(key);\n if (newLocaleData != null) {\n this._locale = newLocaleData;\n }\n return this;\n }\n }\n\n var lang = deprecate(\n 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',\n function (key) {\n if (key === undefined) {\n return this.localeData();\n } else {\n return this.locale(key);\n }\n }\n );\n\n function localeData() {\n return this._locale;\n }\n\n var MS_PER_SECOND = 1000,\n MS_PER_MINUTE = 60 * MS_PER_SECOND,\n MS_PER_HOUR = 60 * MS_PER_MINUTE,\n MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;\n\n // actual modulo - handles negative numbers (for dates before 1970):\n function mod$1(dividend, divisor) {\n return ((dividend % divisor) + divisor) % divisor;\n }\n\n function localStartOfDate(y, m, d) {\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return new Date(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return new Date(y, m, d).valueOf();\n }\n }\n\n function utcStartOfDate(y, m, d) {\n // Date.UTC remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return Date.UTC(y, m, d);\n }\n }\n\n function startOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year(), 0, 1);\n break;\n case 'quarter':\n time = startOfDate(\n this.year(),\n this.month() - (this.month() % 3),\n 1\n );\n break;\n case 'month':\n time = startOfDate(this.year(), this.month(), 1);\n break;\n case 'week':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday()\n );\n break;\n case 'isoWeek':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1)\n );\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date());\n break;\n case 'hour':\n time = this._d.valueOf();\n time -= mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n );\n break;\n case 'minute':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_MINUTE);\n break;\n case 'second':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_SECOND);\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n\n function endOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year() + 1, 0, 1) - 1;\n break;\n case 'quarter':\n time =\n startOfDate(\n this.year(),\n this.month() - (this.month() % 3) + 3,\n 1\n ) - 1;\n break;\n case 'month':\n time = startOfDate(this.year(), this.month() + 1, 1) - 1;\n break;\n case 'week':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday() + 7\n ) - 1;\n break;\n case 'isoWeek':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1) + 7\n ) - 1;\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;\n break;\n case 'hour':\n time = this._d.valueOf();\n time +=\n MS_PER_HOUR -\n mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n ) -\n 1;\n break;\n case 'minute':\n time = this._d.valueOf();\n time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;\n break;\n case 'second':\n time = this._d.valueOf();\n time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n\n function valueOf() {\n return this._d.valueOf() - (this._offset || 0) * 60000;\n }\n\n function unix() {\n return Math.floor(this.valueOf() / 1000);\n }\n\n function toDate() {\n return new Date(this.valueOf());\n }\n\n function toArray() {\n var m = this;\n return [\n m.year(),\n m.month(),\n m.date(),\n m.hour(),\n m.minute(),\n m.second(),\n m.millisecond(),\n ];\n }\n\n function toObject() {\n var m = this;\n return {\n years: m.year(),\n months: m.month(),\n date: m.date(),\n hours: m.hours(),\n minutes: m.minutes(),\n seconds: m.seconds(),\n milliseconds: m.milliseconds(),\n };\n }\n\n function toJSON() {\n // new Date(NaN).toJSON() === null\n return this.isValid() ? this.toISOString() : null;\n }\n\n function isValid$2() {\n return isValid(this);\n }\n\n function parsingFlags() {\n return extend({}, getParsingFlags(this));\n }\n\n function invalidAt() {\n return getParsingFlags(this).overflow;\n }\n\n function creationData() {\n return {\n input: this._i,\n format: this._f,\n locale: this._locale,\n isUTC: this._isUTC,\n strict: this._strict,\n };\n }\n\n addFormatToken('N', 0, 0, 'eraAbbr');\n addFormatToken('NN', 0, 0, 'eraAbbr');\n addFormatToken('NNN', 0, 0, 'eraAbbr');\n addFormatToken('NNNN', 0, 0, 'eraName');\n addFormatToken('NNNNN', 0, 0, 'eraNarrow');\n\n addFormatToken('y', ['y', 1], 'yo', 'eraYear');\n addFormatToken('y', ['yy', 2], 0, 'eraYear');\n addFormatToken('y', ['yyy', 3], 0, 'eraYear');\n addFormatToken('y', ['yyyy', 4], 0, 'eraYear');\n\n addRegexToken('N', matchEraAbbr);\n addRegexToken('NN', matchEraAbbr);\n addRegexToken('NNN', matchEraAbbr);\n addRegexToken('NNNN', matchEraName);\n addRegexToken('NNNNN', matchEraNarrow);\n\n addParseToken(\n ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],\n function (input, array, config, token) {\n var era = config._locale.erasParse(input, token, config._strict);\n if (era) {\n getParsingFlags(config).era = era;\n } else {\n getParsingFlags(config).invalidEra = input;\n }\n }\n );\n\n addRegexToken('y', matchUnsigned);\n addRegexToken('yy', matchUnsigned);\n addRegexToken('yyy', matchUnsigned);\n addRegexToken('yyyy', matchUnsigned);\n addRegexToken('yo', matchEraYearOrdinal);\n\n addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);\n addParseToken(['yo'], function (input, array, config, token) {\n var match;\n if (config._locale._eraYearOrdinalRegex) {\n match = input.match(config._locale._eraYearOrdinalRegex);\n }\n\n if (config._locale.eraYearOrdinalParse) {\n array[YEAR] = config._locale.eraYearOrdinalParse(input, match);\n } else {\n array[YEAR] = parseInt(input, 10);\n }\n });\n\n function localeEras(m, format) {\n var i,\n l,\n date,\n eras = this._eras || getLocale('en')._eras;\n for (i = 0, l = eras.length; i < l; ++i) {\n switch (typeof eras[i].since) {\n case 'string':\n // truncate time\n date = hooks(eras[i].since).startOf('day');\n eras[i].since = date.valueOf();\n break;\n }\n\n switch (typeof eras[i].until) {\n case 'undefined':\n eras[i].until = +Infinity;\n break;\n case 'string':\n // truncate time\n date = hooks(eras[i].until).startOf('day').valueOf();\n eras[i].until = date.valueOf();\n break;\n }\n }\n return eras;\n }\n\n function localeErasParse(eraName, format, strict) {\n var i,\n l,\n eras = this.eras(),\n name,\n abbr,\n narrow;\n eraName = eraName.toUpperCase();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n name = eras[i].name.toUpperCase();\n abbr = eras[i].abbr.toUpperCase();\n narrow = eras[i].narrow.toUpperCase();\n\n if (strict) {\n switch (format) {\n case 'N':\n case 'NN':\n case 'NNN':\n if (abbr === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNN':\n if (name === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNNN':\n if (narrow === eraName) {\n return eras[i];\n }\n break;\n }\n } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {\n return eras[i];\n }\n }\n }\n\n function localeErasConvertYear(era, year) {\n var dir = era.since <= era.until ? +1 : -1;\n if (year === undefined) {\n return hooks(era.since).year();\n } else {\n return hooks(era.since).year() + (year - era.offset) * dir;\n }\n }\n\n function getEraName() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].name;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].name;\n }\n }\n\n return '';\n }\n\n function getEraNarrow() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].narrow;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].narrow;\n }\n }\n\n return '';\n }\n\n function getEraAbbr() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].abbr;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].abbr;\n }\n }\n\n return '';\n }\n\n function getEraYear() {\n var i,\n l,\n dir,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n dir = eras[i].since <= eras[i].until ? +1 : -1;\n\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (\n (eras[i].since <= val && val <= eras[i].until) ||\n (eras[i].until <= val && val <= eras[i].since)\n ) {\n return (\n (this.year() - hooks(eras[i].since).year()) * dir +\n eras[i].offset\n );\n }\n }\n\n return this.year();\n }\n\n function erasNameRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNameRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNameRegex : this._erasRegex;\n }\n\n function erasAbbrRegex(isStrict) {\n if (!hasOwnProp(this, '_erasAbbrRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasAbbrRegex : this._erasRegex;\n }\n\n function erasNarrowRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNarrowRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNarrowRegex : this._erasRegex;\n }\n\n function matchEraAbbr(isStrict, locale) {\n return locale.erasAbbrRegex(isStrict);\n }\n\n function matchEraName(isStrict, locale) {\n return locale.erasNameRegex(isStrict);\n }\n\n function matchEraNarrow(isStrict, locale) {\n return locale.erasNarrowRegex(isStrict);\n }\n\n function matchEraYearOrdinal(isStrict, locale) {\n return locale._eraYearOrdinalRegex || matchUnsigned;\n }\n\n function computeErasParse() {\n var abbrPieces = [],\n namePieces = [],\n narrowPieces = [],\n mixedPieces = [],\n i,\n l,\n eras = this.eras();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n namePieces.push(regexEscape(eras[i].name));\n abbrPieces.push(regexEscape(eras[i].abbr));\n narrowPieces.push(regexEscape(eras[i].narrow));\n\n mixedPieces.push(regexEscape(eras[i].name));\n mixedPieces.push(regexEscape(eras[i].abbr));\n mixedPieces.push(regexEscape(eras[i].narrow));\n }\n\n this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');\n this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');\n this._erasNarrowRegex = new RegExp(\n '^(' + narrowPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n addFormatToken(0, ['gg', 2], 0, function () {\n return this.weekYear() % 100;\n });\n\n addFormatToken(0, ['GG', 2], 0, function () {\n return this.isoWeekYear() % 100;\n });\n\n function addWeekYearFormatToken(token, getter) {\n addFormatToken(0, [token, token.length], 0, getter);\n }\n\n addWeekYearFormatToken('gggg', 'weekYear');\n addWeekYearFormatToken('ggggg', 'weekYear');\n addWeekYearFormatToken('GGGG', 'isoWeekYear');\n addWeekYearFormatToken('GGGGG', 'isoWeekYear');\n\n // ALIASES\n\n addUnitAlias('weekYear', 'gg');\n addUnitAlias('isoWeekYear', 'GG');\n\n // PRIORITY\n\n addUnitPriority('weekYear', 1);\n addUnitPriority('isoWeekYear', 1);\n\n // PARSING\n\n addRegexToken('G', matchSigned);\n addRegexToken('g', matchSigned);\n addRegexToken('GG', match1to2, match2);\n addRegexToken('gg', match1to2, match2);\n addRegexToken('GGGG', match1to4, match4);\n addRegexToken('gggg', match1to4, match4);\n addRegexToken('GGGGG', match1to6, match6);\n addRegexToken('ggggg', match1to6, match6);\n\n addWeekParseToken(\n ['gggg', 'ggggg', 'GGGG', 'GGGGG'],\n function (input, week, config, token) {\n week[token.substr(0, 2)] = toInt(input);\n }\n );\n\n addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {\n week[token] = hooks.parseTwoDigitYear(input);\n });\n\n // MOMENTS\n\n function getSetWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.week(),\n this.weekday(),\n this.localeData()._week.dow,\n this.localeData()._week.doy\n );\n }\n\n function getSetISOWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.isoWeek(),\n this.isoWeekday(),\n 1,\n 4\n );\n }\n\n function getISOWeeksInYear() {\n return weeksInYear(this.year(), 1, 4);\n }\n\n function getISOWeeksInISOWeekYear() {\n return weeksInYear(this.isoWeekYear(), 1, 4);\n }\n\n function getWeeksInYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);\n }\n\n function getWeeksInWeekYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);\n }\n\n function getSetWeekYearHelper(input, week, weekday, dow, doy) {\n var weeksTarget;\n if (input == null) {\n return weekOfYear(this, dow, doy).year;\n } else {\n weeksTarget = weeksInYear(input, dow, doy);\n if (week > weeksTarget) {\n week = weeksTarget;\n }\n return setWeekAll.call(this, input, week, weekday, dow, doy);\n }\n }\n\n function setWeekAll(weekYear, week, weekday, dow, doy) {\n var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),\n date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);\n\n this.year(date.getUTCFullYear());\n this.month(date.getUTCMonth());\n this.date(date.getUTCDate());\n return this;\n }\n\n // FORMATTING\n\n addFormatToken('Q', 0, 'Qo', 'quarter');\n\n // ALIASES\n\n addUnitAlias('quarter', 'Q');\n\n // PRIORITY\n\n addUnitPriority('quarter', 7);\n\n // PARSING\n\n addRegexToken('Q', match1);\n addParseToken('Q', function (input, array) {\n array[MONTH] = (toInt(input) - 1) * 3;\n });\n\n // MOMENTS\n\n function getSetQuarter(input) {\n return input == null\n ? Math.ceil((this.month() + 1) / 3)\n : this.month((input - 1) * 3 + (this.month() % 3));\n }\n\n // FORMATTING\n\n addFormatToken('D', ['DD', 2], 'Do', 'date');\n\n // ALIASES\n\n addUnitAlias('date', 'D');\n\n // PRIORITY\n addUnitPriority('date', 9);\n\n // PARSING\n\n addRegexToken('D', match1to2);\n addRegexToken('DD', match1to2, match2);\n addRegexToken('Do', function (isStrict, locale) {\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n return isStrict\n ? locale._dayOfMonthOrdinalParse || locale._ordinalParse\n : locale._dayOfMonthOrdinalParseLenient;\n });\n\n addParseToken(['D', 'DD'], DATE);\n addParseToken('Do', function (input, array) {\n array[DATE] = toInt(input.match(match1to2)[0]);\n });\n\n // MOMENTS\n\n var getSetDayOfMonth = makeGetSet('Date', true);\n\n // FORMATTING\n\n addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');\n\n // ALIASES\n\n addUnitAlias('dayOfYear', 'DDD');\n\n // PRIORITY\n addUnitPriority('dayOfYear', 4);\n\n // PARSING\n\n addRegexToken('DDD', match1to3);\n addRegexToken('DDDD', match3);\n addParseToken(['DDD', 'DDDD'], function (input, array, config) {\n config._dayOfYear = toInt(input);\n });\n\n // HELPERS\n\n // MOMENTS\n\n function getSetDayOfYear(input) {\n var dayOfYear =\n Math.round(\n (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5\n ) + 1;\n return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('m', ['mm', 2], 0, 'minute');\n\n // ALIASES\n\n addUnitAlias('minute', 'm');\n\n // PRIORITY\n\n addUnitPriority('minute', 14);\n\n // PARSING\n\n addRegexToken('m', match1to2);\n addRegexToken('mm', match1to2, match2);\n addParseToken(['m', 'mm'], MINUTE);\n\n // MOMENTS\n\n var getSetMinute = makeGetSet('Minutes', false);\n\n // FORMATTING\n\n addFormatToken('s', ['ss', 2], 0, 'second');\n\n // ALIASES\n\n addUnitAlias('second', 's');\n\n // PRIORITY\n\n addUnitPriority('second', 15);\n\n // PARSING\n\n addRegexToken('s', match1to2);\n addRegexToken('ss', match1to2, match2);\n addParseToken(['s', 'ss'], SECOND);\n\n // MOMENTS\n\n var getSetSecond = makeGetSet('Seconds', false);\n\n // FORMATTING\n\n addFormatToken('S', 0, 0, function () {\n return ~~(this.millisecond() / 100);\n });\n\n addFormatToken(0, ['SS', 2], 0, function () {\n return ~~(this.millisecond() / 10);\n });\n\n addFormatToken(0, ['SSS', 3], 0, 'millisecond');\n addFormatToken(0, ['SSSS', 4], 0, function () {\n return this.millisecond() * 10;\n });\n addFormatToken(0, ['SSSSS', 5], 0, function () {\n return this.millisecond() * 100;\n });\n addFormatToken(0, ['SSSSSS', 6], 0, function () {\n return this.millisecond() * 1000;\n });\n addFormatToken(0, ['SSSSSSS', 7], 0, function () {\n return this.millisecond() * 10000;\n });\n addFormatToken(0, ['SSSSSSSS', 8], 0, function () {\n return this.millisecond() * 100000;\n });\n addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {\n return this.millisecond() * 1000000;\n });\n\n // ALIASES\n\n addUnitAlias('millisecond', 'ms');\n\n // PRIORITY\n\n addUnitPriority('millisecond', 16);\n\n // PARSING\n\n addRegexToken('S', match1to3, match1);\n addRegexToken('SS', match1to3, match2);\n addRegexToken('SSS', match1to3, match3);\n\n var token, getSetMillisecond;\n for (token = 'SSSS'; token.length <= 9; token += 'S') {\n addRegexToken(token, matchUnsigned);\n }\n\n function parseMs(input, array) {\n array[MILLISECOND] = toInt(('0.' + input) * 1000);\n }\n\n for (token = 'S'; token.length <= 9; token += 'S') {\n addParseToken(token, parseMs);\n }\n\n getSetMillisecond = makeGetSet('Milliseconds', false);\n\n // FORMATTING\n\n addFormatToken('z', 0, 0, 'zoneAbbr');\n addFormatToken('zz', 0, 0, 'zoneName');\n\n // MOMENTS\n\n function getZoneAbbr() {\n return this._isUTC ? 'UTC' : '';\n }\n\n function getZoneName() {\n return this._isUTC ? 'Coordinated Universal Time' : '';\n }\n\n var proto = Moment.prototype;\n\n proto.add = add;\n proto.calendar = calendar$1;\n proto.clone = clone;\n proto.diff = diff;\n proto.endOf = endOf;\n proto.format = format;\n proto.from = from;\n proto.fromNow = fromNow;\n proto.to = to;\n proto.toNow = toNow;\n proto.get = stringGet;\n proto.invalidAt = invalidAt;\n proto.isAfter = isAfter;\n proto.isBefore = isBefore;\n proto.isBetween = isBetween;\n proto.isSame = isSame;\n proto.isSameOrAfter = isSameOrAfter;\n proto.isSameOrBefore = isSameOrBefore;\n proto.isValid = isValid$2;\n proto.lang = lang;\n proto.locale = locale;\n proto.localeData = localeData;\n proto.max = prototypeMax;\n proto.min = prototypeMin;\n proto.parsingFlags = parsingFlags;\n proto.set = stringSet;\n proto.startOf = startOf;\n proto.subtract = subtract;\n proto.toArray = toArray;\n proto.toObject = toObject;\n proto.toDate = toDate;\n proto.toISOString = toISOString;\n proto.inspect = inspect;\n if (typeof Symbol !== 'undefined' && Symbol.for != null) {\n proto[Symbol.for('nodejs.util.inspect.custom')] = function () {\n return 'Moment<' + this.format() + '>';\n };\n }\n proto.toJSON = toJSON;\n proto.toString = toString;\n proto.unix = unix;\n proto.valueOf = valueOf;\n proto.creationData = creationData;\n proto.eraName = getEraName;\n proto.eraNarrow = getEraNarrow;\n proto.eraAbbr = getEraAbbr;\n proto.eraYear = getEraYear;\n proto.year = getSetYear;\n proto.isLeapYear = getIsLeapYear;\n proto.weekYear = getSetWeekYear;\n proto.isoWeekYear = getSetISOWeekYear;\n proto.quarter = proto.quarters = getSetQuarter;\n proto.month = getSetMonth;\n proto.daysInMonth = getDaysInMonth;\n proto.week = proto.weeks = getSetWeek;\n proto.isoWeek = proto.isoWeeks = getSetISOWeek;\n proto.weeksInYear = getWeeksInYear;\n proto.weeksInWeekYear = getWeeksInWeekYear;\n proto.isoWeeksInYear = getISOWeeksInYear;\n proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;\n proto.date = getSetDayOfMonth;\n proto.day = proto.days = getSetDayOfWeek;\n proto.weekday = getSetLocaleDayOfWeek;\n proto.isoWeekday = getSetISODayOfWeek;\n proto.dayOfYear = getSetDayOfYear;\n proto.hour = proto.hours = getSetHour;\n proto.minute = proto.minutes = getSetMinute;\n proto.second = proto.seconds = getSetSecond;\n proto.millisecond = proto.milliseconds = getSetMillisecond;\n proto.utcOffset = getSetOffset;\n proto.utc = setOffsetToUTC;\n proto.local = setOffsetToLocal;\n proto.parseZone = setOffsetToParsedOffset;\n proto.hasAlignedHourOffset = hasAlignedHourOffset;\n proto.isDST = isDaylightSavingTime;\n proto.isLocal = isLocal;\n proto.isUtcOffset = isUtcOffset;\n proto.isUtc = isUtc;\n proto.isUTC = isUtc;\n proto.zoneAbbr = getZoneAbbr;\n proto.zoneName = getZoneName;\n proto.dates = deprecate(\n 'dates accessor is deprecated. Use date instead.',\n getSetDayOfMonth\n );\n proto.months = deprecate(\n 'months accessor is deprecated. Use month instead',\n getSetMonth\n );\n proto.years = deprecate(\n 'years accessor is deprecated. Use year instead',\n getSetYear\n );\n proto.zone = deprecate(\n 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',\n getSetZone\n );\n proto.isDSTShifted = deprecate(\n 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',\n isDaylightSavingTimeShifted\n );\n\n function createUnix(input) {\n return createLocal(input * 1000);\n }\n\n function createInZone() {\n return createLocal.apply(null, arguments).parseZone();\n }\n\n function preParsePostFormat(string) {\n return string;\n }\n\n var proto$1 = Locale.prototype;\n\n proto$1.calendar = calendar;\n proto$1.longDateFormat = longDateFormat;\n proto$1.invalidDate = invalidDate;\n proto$1.ordinal = ordinal;\n proto$1.preparse = preParsePostFormat;\n proto$1.postformat = preParsePostFormat;\n proto$1.relativeTime = relativeTime;\n proto$1.pastFuture = pastFuture;\n proto$1.set = set;\n proto$1.eras = localeEras;\n proto$1.erasParse = localeErasParse;\n proto$1.erasConvertYear = localeErasConvertYear;\n proto$1.erasAbbrRegex = erasAbbrRegex;\n proto$1.erasNameRegex = erasNameRegex;\n proto$1.erasNarrowRegex = erasNarrowRegex;\n\n proto$1.months = localeMonths;\n proto$1.monthsShort = localeMonthsShort;\n proto$1.monthsParse = localeMonthsParse;\n proto$1.monthsRegex = monthsRegex;\n proto$1.monthsShortRegex = monthsShortRegex;\n proto$1.week = localeWeek;\n proto$1.firstDayOfYear = localeFirstDayOfYear;\n proto$1.firstDayOfWeek = localeFirstDayOfWeek;\n\n proto$1.weekdays = localeWeekdays;\n proto$1.weekdaysMin = localeWeekdaysMin;\n proto$1.weekdaysShort = localeWeekdaysShort;\n proto$1.weekdaysParse = localeWeekdaysParse;\n\n proto$1.weekdaysRegex = weekdaysRegex;\n proto$1.weekdaysShortRegex = weekdaysShortRegex;\n proto$1.weekdaysMinRegex = weekdaysMinRegex;\n\n proto$1.isPM = localeIsPM;\n proto$1.meridiem = localeMeridiem;\n\n function get$1(format, index, field, setter) {\n var locale = getLocale(),\n utc = createUTC().set(setter, index);\n return locale[field](utc, format);\n }\n\n function listMonthsImpl(format, index, field) {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n\n if (index != null) {\n return get$1(format, index, field, 'month');\n }\n\n var i,\n out = [];\n for (i = 0; i < 12; i++) {\n out[i] = get$1(format, i, field, 'month');\n }\n return out;\n }\n\n // ()\n // (5)\n // (fmt, 5)\n // (fmt)\n // (true)\n // (true, 5)\n // (true, fmt, 5)\n // (true, fmt)\n function listWeekdaysImpl(localeSorted, format, index, field) {\n if (typeof localeSorted === 'boolean') {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n } else {\n format = localeSorted;\n index = format;\n localeSorted = false;\n\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n }\n\n var locale = getLocale(),\n shift = localeSorted ? locale._week.dow : 0,\n i,\n out = [];\n\n if (index != null) {\n return get$1(format, (index + shift) % 7, field, 'day');\n }\n\n for (i = 0; i < 7; i++) {\n out[i] = get$1(format, (i + shift) % 7, field, 'day');\n }\n return out;\n }\n\n function listMonths(format, index) {\n return listMonthsImpl(format, index, 'months');\n }\n\n function listMonthsShort(format, index) {\n return listMonthsImpl(format, index, 'monthsShort');\n }\n\n function listWeekdays(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdays');\n }\n\n function listWeekdaysShort(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');\n }\n\n function listWeekdaysMin(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');\n }\n\n getSetGlobalLocale('en', {\n eras: [\n {\n since: '0001-01-01',\n until: +Infinity,\n offset: 1,\n name: 'Anno Domini',\n narrow: 'AD',\n abbr: 'AD',\n },\n {\n since: '0000-12-31',\n until: -Infinity,\n offset: 1,\n name: 'Before Christ',\n narrow: 'BC',\n abbr: 'BC',\n },\n ],\n dayOfMonthOrdinalParse: /\\d{1,2}(th|st|nd|rd)/,\n ordinal: function (number) {\n var b = number % 10,\n output =\n toInt((number % 100) / 10) === 1\n ? 'th'\n : b === 1\n ? 'st'\n : b === 2\n ? 'nd'\n : b === 3\n ? 'rd'\n : 'th';\n return number + output;\n },\n });\n\n // Side effect imports\n\n hooks.lang = deprecate(\n 'moment.lang is deprecated. Use moment.locale instead.',\n getSetGlobalLocale\n );\n hooks.langData = deprecate(\n 'moment.langData is deprecated. Use moment.localeData instead.',\n getLocale\n );\n\n var mathAbs = Math.abs;\n\n function abs() {\n var data = this._data;\n\n this._milliseconds = mathAbs(this._milliseconds);\n this._days = mathAbs(this._days);\n this._months = mathAbs(this._months);\n\n data.milliseconds = mathAbs(data.milliseconds);\n data.seconds = mathAbs(data.seconds);\n data.minutes = mathAbs(data.minutes);\n data.hours = mathAbs(data.hours);\n data.months = mathAbs(data.months);\n data.years = mathAbs(data.years);\n\n return this;\n }\n\n function addSubtract$1(duration, input, value, direction) {\n var other = createDuration(input, value);\n\n duration._milliseconds += direction * other._milliseconds;\n duration._days += direction * other._days;\n duration._months += direction * other._months;\n\n return duration._bubble();\n }\n\n // supports only 2.0-style add(1, 's') or add(duration)\n function add$1(input, value) {\n return addSubtract$1(this, input, value, 1);\n }\n\n // supports only 2.0-style subtract(1, 's') or subtract(duration)\n function subtract$1(input, value) {\n return addSubtract$1(this, input, value, -1);\n }\n\n function absCeil(number) {\n if (number < 0) {\n return Math.floor(number);\n } else {\n return Math.ceil(number);\n }\n }\n\n function bubble() {\n var milliseconds = this._milliseconds,\n days = this._days,\n months = this._months,\n data = this._data,\n seconds,\n minutes,\n hours,\n years,\n monthsFromDays;\n\n // if we have a mix of positive and negative values, bubble down first\n // check: https://github.com/moment/moment/issues/2166\n if (\n !(\n (milliseconds >= 0 && days >= 0 && months >= 0) ||\n (milliseconds <= 0 && days <= 0 && months <= 0)\n )\n ) {\n milliseconds += absCeil(monthsToDays(months) + days) * 864e5;\n days = 0;\n months = 0;\n }\n\n // The following code bubbles up values, see the tests for\n // examples of what that means.\n data.milliseconds = milliseconds % 1000;\n\n seconds = absFloor(milliseconds / 1000);\n data.seconds = seconds % 60;\n\n minutes = absFloor(seconds / 60);\n data.minutes = minutes % 60;\n\n hours = absFloor(minutes / 60);\n data.hours = hours % 24;\n\n days += absFloor(hours / 24);\n\n // convert days to months\n monthsFromDays = absFloor(daysToMonths(days));\n months += monthsFromDays;\n days -= absCeil(monthsToDays(monthsFromDays));\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n data.days = days;\n data.months = months;\n data.years = years;\n\n return this;\n }\n\n function daysToMonths(days) {\n // 400 years have 146097 days (taking into account leap year rules)\n // 400 years have 12 months === 4800\n return (days * 4800) / 146097;\n }\n\n function monthsToDays(months) {\n // the reverse of daysToMonths\n return (months * 146097) / 4800;\n }\n\n function as(units) {\n if (!this.isValid()) {\n return NaN;\n }\n var days,\n months,\n milliseconds = this._milliseconds;\n\n units = normalizeUnits(units);\n\n if (units === 'month' || units === 'quarter' || units === 'year') {\n days = this._days + milliseconds / 864e5;\n months = this._months + daysToMonths(days);\n switch (units) {\n case 'month':\n return months;\n case 'quarter':\n return months / 3;\n case 'year':\n return months / 12;\n }\n } else {\n // handle milliseconds separately because of floating point math errors (issue #1867)\n days = this._days + Math.round(monthsToDays(this._months));\n switch (units) {\n case 'week':\n return days / 7 + milliseconds / 6048e5;\n case 'day':\n return days + milliseconds / 864e5;\n case 'hour':\n return days * 24 + milliseconds / 36e5;\n case 'minute':\n return days * 1440 + milliseconds / 6e4;\n case 'second':\n return days * 86400 + milliseconds / 1000;\n // Math.floor prevents floating point math errors here\n case 'millisecond':\n return Math.floor(days * 864e5) + milliseconds;\n default:\n throw new Error('Unknown unit ' + units);\n }\n }\n }\n\n // TODO: Use this.as('ms')?\n function valueOf$1() {\n if (!this.isValid()) {\n return NaN;\n }\n return (\n this._milliseconds +\n this._days * 864e5 +\n (this._months % 12) * 2592e6 +\n toInt(this._months / 12) * 31536e6\n );\n }\n\n function makeAs(alias) {\n return function () {\n return this.as(alias);\n };\n }\n\n var asMilliseconds = makeAs('ms'),\n asSeconds = makeAs('s'),\n asMinutes = makeAs('m'),\n asHours = makeAs('h'),\n asDays = makeAs('d'),\n asWeeks = makeAs('w'),\n asMonths = makeAs('M'),\n asQuarters = makeAs('Q'),\n asYears = makeAs('y');\n\n function clone$1() {\n return createDuration(this);\n }\n\n function get$2(units) {\n units = normalizeUnits(units);\n return this.isValid() ? this[units + 's']() : NaN;\n }\n\n function makeGetter(name) {\n return function () {\n return this.isValid() ? this._data[name] : NaN;\n };\n }\n\n var milliseconds = makeGetter('milliseconds'),\n seconds = makeGetter('seconds'),\n minutes = makeGetter('minutes'),\n hours = makeGetter('hours'),\n days = makeGetter('days'),\n months = makeGetter('months'),\n years = makeGetter('years');\n\n function weeks() {\n return absFloor(this.days() / 7);\n }\n\n var round = Math.round,\n thresholds = {\n ss: 44, // a few seconds to seconds\n s: 45, // seconds to minute\n m: 45, // minutes to hour\n h: 22, // hours to day\n d: 26, // days to month/week\n w: null, // weeks to month\n M: 11, // months to year\n };\n\n // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize\n function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {\n return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);\n }\n\n function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {\n var duration = createDuration(posNegDuration).abs(),\n seconds = round(duration.as('s')),\n minutes = round(duration.as('m')),\n hours = round(duration.as('h')),\n days = round(duration.as('d')),\n months = round(duration.as('M')),\n weeks = round(duration.as('w')),\n years = round(duration.as('y')),\n a =\n (seconds <= thresholds.ss && ['s', seconds]) ||\n (seconds < thresholds.s && ['ss', seconds]) ||\n (minutes <= 1 && ['m']) ||\n (minutes < thresholds.m && ['mm', minutes]) ||\n (hours <= 1 && ['h']) ||\n (hours < thresholds.h && ['hh', hours]) ||\n (days <= 1 && ['d']) ||\n (days < thresholds.d && ['dd', days]);\n\n if (thresholds.w != null) {\n a =\n a ||\n (weeks <= 1 && ['w']) ||\n (weeks < thresholds.w && ['ww', weeks]);\n }\n a = a ||\n (months <= 1 && ['M']) ||\n (months < thresholds.M && ['MM', months]) ||\n (years <= 1 && ['y']) || ['yy', years];\n\n a[2] = withoutSuffix;\n a[3] = +posNegDuration > 0;\n a[4] = locale;\n return substituteTimeAgo.apply(null, a);\n }\n\n // This function allows you to set the rounding function for relative time strings\n function getSetRelativeTimeRounding(roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof roundingFunction === 'function') {\n round = roundingFunction;\n return true;\n }\n return false;\n }\n\n // This function allows you to set a threshold for relative time strings\n function getSetRelativeTimeThreshold(threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshold === 's') {\n thresholds.ss = limit - 1;\n }\n return true;\n }\n\n function humanize(argWithSuffix, argThresholds) {\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var withSuffix = false,\n th = thresholds,\n locale,\n output;\n\n if (typeof argWithSuffix === 'object') {\n argThresholds = argWithSuffix;\n argWithSuffix = false;\n }\n if (typeof argWithSuffix === 'boolean') {\n withSuffix = argWithSuffix;\n }\n if (typeof argThresholds === 'object') {\n th = Object.assign({}, thresholds, argThresholds);\n if (argThresholds.s != null && argThresholds.ss == null) {\n th.ss = argThresholds.s - 1;\n }\n }\n\n locale = this.localeData();\n output = relativeTime$1(this, !withSuffix, th, locale);\n\n if (withSuffix) {\n output = locale.pastFuture(+this, output);\n }\n\n return locale.postformat(output);\n }\n\n var abs$1 = Math.abs;\n\n function sign(x) {\n return (x > 0) - (x < 0) || +x;\n }\n\n function toISOString$1() {\n // for ISO strings we do not use the normal bubbling rules:\n // * milliseconds bubble up until they become hours\n // * days do not bubble at all\n // * months bubble up until they become years\n // This is because there is no context-free conversion between hours and days\n // (think of clock changes)\n // and also not between days and months (28-31 days per month)\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var seconds = abs$1(this._milliseconds) / 1000,\n days = abs$1(this._days),\n months = abs$1(this._months),\n minutes,\n hours,\n years,\n s,\n total = this.asSeconds(),\n totalSign,\n ymSign,\n daysSign,\n hmsSign;\n\n if (!total) {\n // this is the same as C#'s (Noda) and python (isodate)...\n // but not other JS (goog.date)\n return 'P0D';\n }\n\n // 3600 seconds -> 60 minutes -> 1 hour\n minutes = absFloor(seconds / 60);\n hours = absFloor(minutes / 60);\n seconds %= 60;\n minutes %= 60;\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js\n s = seconds ? seconds.toFixed(3).replace(/\\.?0+$/, '') : '';\n\n totalSign = total < 0 ? '-' : '';\n ymSign = sign(this._months) !== sign(total) ? '-' : '';\n daysSign = sign(this._days) !== sign(total) ? '-' : '';\n hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';\n\n return (\n totalSign +\n 'P' +\n (years ? ymSign + years + 'Y' : '') +\n (months ? ymSign + months + 'M' : '') +\n (days ? daysSign + days + 'D' : '') +\n (hours || minutes || seconds ? 'T' : '') +\n (hours ? hmsSign + hours + 'H' : '') +\n (minutes ? hmsSign + minutes + 'M' : '') +\n (seconds ? hmsSign + s + 'S' : '')\n );\n }\n\n var proto$2 = Duration.prototype;\n\n proto$2.isValid = isValid$1;\n proto$2.abs = abs;\n proto$2.add = add$1;\n proto$2.subtract = subtract$1;\n proto$2.as = as;\n proto$2.asMilliseconds = asMilliseconds;\n proto$2.asSeconds = asSeconds;\n proto$2.asMinutes = asMinutes;\n proto$2.asHours = asHours;\n proto$2.asDays = asDays;\n proto$2.asWeeks = asWeeks;\n proto$2.asMonths = asMonths;\n proto$2.asQuarters = asQuarters;\n proto$2.asYears = asYears;\n proto$2.valueOf = valueOf$1;\n proto$2._bubble = bubble;\n proto$2.clone = clone$1;\n proto$2.get = get$2;\n proto$2.milliseconds = milliseconds;\n proto$2.seconds = seconds;\n proto$2.minutes = minutes;\n proto$2.hours = hours;\n proto$2.days = days;\n proto$2.weeks = weeks;\n proto$2.months = months;\n proto$2.years = years;\n proto$2.humanize = humanize;\n proto$2.toISOString = toISOString$1;\n proto$2.toString = toISOString$1;\n proto$2.toJSON = toISOString$1;\n proto$2.locale = locale;\n proto$2.localeData = localeData;\n\n proto$2.toIsoString = deprecate(\n 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',\n toISOString$1\n );\n proto$2.lang = lang;\n\n // FORMATTING\n\n addFormatToken('X', 0, 0, 'unix');\n addFormatToken('x', 0, 0, 'valueOf');\n\n // PARSING\n\n addRegexToken('x', matchSigned);\n addRegexToken('X', matchTimestamp);\n addParseToken('X', function (input, array, config) {\n config._d = new Date(parseFloat(input) * 1000);\n });\n addParseToken('x', function (input, array, config) {\n config._d = new Date(toInt(input));\n });\n\n //! moment.js\n\n hooks.version = '2.29.4';\n\n setHookCallback(createLocal);\n\n hooks.fn = proto;\n hooks.min = min;\n hooks.max = max;\n hooks.now = now;\n hooks.utc = createUTC;\n hooks.unix = createUnix;\n hooks.months = listMonths;\n hooks.isDate = isDate;\n hooks.locale = getSetGlobalLocale;\n hooks.invalid = createInvalid;\n hooks.duration = createDuration;\n hooks.isMoment = isMoment;\n hooks.weekdays = listWeekdays;\n hooks.parseZone = createInZone;\n hooks.localeData = getLocale;\n hooks.isDuration = isDuration;\n hooks.monthsShort = listMonthsShort;\n hooks.weekdaysMin = listWeekdaysMin;\n hooks.defineLocale = defineLocale;\n hooks.updateLocale = updateLocale;\n hooks.locales = listLocales;\n hooks.weekdaysShort = listWeekdaysShort;\n hooks.normalizeUnits = normalizeUnits;\n hooks.relativeTimeRounding = getSetRelativeTimeRounding;\n hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;\n hooks.calendarFormat = getCalendarFormat;\n hooks.prototype = proto;\n\n // currently HTML5 input type only supports 24-hour formats\n hooks.HTML5_FMT = {\n DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // \n DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // \n DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // \n DATE: 'YYYY-MM-DD', // \n TIME: 'HH:mm', // \n TIME_SECONDS: 'HH:mm:ss', // \n TIME_MS: 'HH:mm:ss.SSS', // \n WEEK: 'GGGG-[W]WW', // \n MONTH: 'YYYY-MM', // \n };\n\n return hooks;\n\n})));\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","if performance? and performance.now\n module.exports = -> performance.now()\nelse if process? and process.hrtime\n module.exports = -> (getNanoSeconds() - nodeLoadTime) / 1e6\n hrtime = process.hrtime\n getNanoSeconds = ->\n hr = hrtime()\n hr[0] * 1e9 + hr[1]\n moduleLoadTime = getNanoSeconds()\n upTime = process.uptime() * 1e9\n nodeLoadTime = moduleLoadTime - upTime\nelse if Date.now\n module.exports = -> Date.now() - loadTime\n loadTime = Date.now()\nelse\n module.exports = -> new Date().getTime() - loadTime\n loadTime = new Date().getTime()\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","var now = require('performance-now')\n , root = typeof window === 'undefined' ? global : window\n , vendors = ['moz', 'webkit']\n , suffix = 'AnimationFrame'\n , raf = root['request' + suffix]\n , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]\n\nfor(var i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + 'Request' + suffix]\n caf = root[vendors[i] + 'Cancel' + suffix]\n || root[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n var last = 0\n , id = 0\n , queue = []\n , frameDuration = 1000 / 60\n\n raf = function(callback) {\n if(queue.length === 0) {\n var _now = now()\n , next = Math.max(0, frameDuration - (_now - last))\n last = next + _now\n setTimeout(function() {\n var cp = queue.slice(0)\n // Clear queue here to prevent\n // callbacks from appending listeners\n // to the current frame's queue\n queue.length = 0\n for(var i = 0; i < cp.length; i++) {\n if(!cp[i].cancelled) {\n try{\n cp[i].callback(last)\n } catch(e) {\n setTimeout(function() { throw e }, 0)\n }\n }\n }\n }, Math.round(next))\n }\n queue.push({\n handle: ++id,\n callback: callback,\n cancelled: false\n })\n return id\n }\n\n caf = function(handle) {\n for(var i = 0; i < queue.length; i++) {\n if(queue[i].handle === handle) {\n queue[i].cancelled = true\n }\n }\n }\n}\n\nmodule.exports = function(fn) {\n // Wrap in a new function to prevent\n // `cancel` potentially being assigned\n // to the native rAF function\n return raf.call(root, fn)\n}\nmodule.exports.cancel = function() {\n caf.apply(root, arguments)\n}\nmodule.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf\n object.cancelAnimationFrame = caf\n}\n","export default function contains(root, n) {\n var node = n;\n\n while (node) {\n if (node === root) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}","import addDOMEventListener from 'add-dom-event-listener';\nimport ReactDOM from 'react-dom';\nexport default function addEventListenerWrap(target, eventType, cb, option) {\n /* eslint camelcase: 2 */\n var callback = ReactDOM.unstable_batchedUpdates ? function run(e) {\n ReactDOM.unstable_batchedUpdates(cb, e);\n } : cb;\n return addDOMEventListener(target, eventType, callback, option);\n}","let vendorPrefix;\n\nconst jsCssMap = {\n Webkit: '-webkit-',\n Moz: '-moz-',\n // IE did it wrong again ...\n ms: '-ms-',\n O: '-o-',\n};\n\nfunction getVendorPrefix() {\n if (vendorPrefix !== undefined) {\n return vendorPrefix;\n }\n vendorPrefix = '';\n const style = document.createElement('p').style;\n const testProp = 'Transform';\n for (const key in jsCssMap) {\n if (key + testProp in style) {\n vendorPrefix = key;\n }\n }\n return vendorPrefix;\n}\n\nfunction getTransitionName() {\n return getVendorPrefix()\n ? `${getVendorPrefix()}TransitionProperty`\n : 'transitionProperty';\n}\n\nexport function getTransformName() {\n return getVendorPrefix() ? `${getVendorPrefix()}Transform` : 'transform';\n}\n\nexport function setTransitionProperty(node, value) {\n const name = getTransitionName();\n if (name) {\n node.style[name] = value;\n if (name !== 'transitionProperty') {\n node.style.transitionProperty = value;\n }\n }\n}\n\nfunction setTransform(node, value) {\n const name = getTransformName();\n if (name) {\n node.style[name] = value;\n if (name !== 'transform') {\n node.style.transform = value;\n }\n }\n}\n\nexport function getTransitionProperty(node) {\n return node.style.transitionProperty || node.style[getTransitionName()];\n}\n\nexport function getTransformXY(node) {\n const style = window.getComputedStyle(node, null);\n const transform =\n style.getPropertyValue('transform') ||\n style.getPropertyValue(getTransformName());\n if (transform && transform !== 'none') {\n const matrix = transform.replace(/[^0-9\\-.,]/g, '').split(',');\n return {\n x: parseFloat(matrix[12] || matrix[4], 0),\n y: parseFloat(matrix[13] || matrix[5], 0),\n };\n }\n return {\n x: 0,\n y: 0,\n };\n}\n\nconst matrix2d = /matrix\\((.*)\\)/;\nconst matrix3d = /matrix3d\\((.*)\\)/;\n\nexport function setTransformXY(node, xy) {\n const style = window.getComputedStyle(node, null);\n const transform =\n style.getPropertyValue('transform') ||\n style.getPropertyValue(getTransformName());\n if (transform && transform !== 'none') {\n let arr;\n let match2d = transform.match(matrix2d);\n if (match2d) {\n match2d = match2d[1];\n arr = match2d.split(',').map(item => {\n return parseFloat(item, 10);\n });\n arr[4] = xy.x;\n arr[5] = xy.y;\n setTransform(node, `matrix(${arr.join(',')})`);\n } else {\n const match3d = transform.match(matrix3d)[1];\n arr = match3d.split(',').map(item => {\n return parseFloat(item, 10);\n });\n arr[12] = xy.x;\n arr[13] = xy.y;\n setTransform(node, `matrix3d(${arr.join(',')})`);\n }\n } else {\n setTransform(\n node,\n `translateX(${xy.x}px) translateY(${xy.y}px) translateZ(0)`,\n );\n }\n}\n","import {\n setTransitionProperty,\n getTransitionProperty,\n getTransformXY,\n setTransformXY,\n getTransformName,\n} from './propertyUtils';\n\nconst RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nlet getComputedStyleX;\n\n// https://stackoverflow.com/a/3485654/3040605\nfunction forceRelayout(elem) {\n const originalStyle = elem.style.display;\n elem.style.display = 'none';\n elem.offsetHeight; // eslint-disable-line\n elem.style.display = originalStyle;\n}\n\nfunction css(el, name, v) {\n let value = v;\n if (typeof name === 'object') {\n for (const i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value = `${value}px`;\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\nfunction getClientPosition(elem) {\n let box;\n let x;\n let y;\n const doc = elem.ownerDocument;\n const body = doc.body;\n const docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = Math.floor(box.left);\n y = Math.floor(box.top);\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y,\n };\n}\n\nfunction getScroll(w, top) {\n let ret = w[`page${top ? 'Y' : 'X'}Offset`];\n const method = `scroll${top ? 'Top' : 'Left'}`;\n if (typeof ret !== 'number') {\n const d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n const pos = getClientPosition(el);\n const doc = el.ownerDocument;\n const w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj !== null && obj !== undefined && obj == obj.window;\n}\n\nfunction getDocument(node) {\n if (isWindow(node)) {\n return node.document;\n }\n if (node.nodeType === 9) {\n return node;\n }\n return node.ownerDocument;\n}\n\nfunction _getComputedStyle(elem, name, cs) {\n let computedStyle = cs;\n let val = '';\n const d = getDocument(elem);\n computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nconst _RE_NUM_NO_PX = new RegExp(`^(${RE_NUM})(?!px)[a-z%]+$`, 'i');\nconst RE_POS = /^(top|right|bottom|left)$/;\nconst CURRENT_STYLE = 'currentStyle';\nconst RUNTIME_STYLE = 'runtimeStyle';\nconst LEFT = 'left';\nconst PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n let ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n const style = elem.style;\n const left = style[LEFT];\n const rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle\n ? _getComputedStyle\n : _getComputedStyleIE;\n}\n\nfunction getOffsetDirection(dir, option) {\n if (dir === 'left') {\n return option.useCssRight ? 'right' : dir;\n }\n return option.useCssBottom ? 'bottom' : dir;\n}\n\nfunction oppositeOffsetDirection(dir) {\n if (dir === 'left') {\n return 'right';\n } else if (dir === 'right') {\n return 'left';\n } else if (dir === 'top') {\n return 'bottom';\n } else if (dir === 'bottom') {\n return 'top';\n }\n}\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setLeftTop(elem, offset, option) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n let presetH = -999;\n let presetV = -999;\n const horizontalProperty = getOffsetDirection('left', option);\n const verticalProperty = getOffsetDirection('top', option);\n const oppositeHorizontalProperty = oppositeOffsetDirection(\n horizontalProperty,\n );\n const oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);\n\n if (horizontalProperty !== 'left') {\n presetH = 999;\n }\n\n if (verticalProperty !== 'top') {\n presetV = 999;\n }\n let originalTransition = '';\n const originalOffset = getOffset(elem);\n if ('left' in offset || 'top' in offset) {\n originalTransition = getTransitionProperty(elem) || '';\n setTransitionProperty(elem, 'none');\n }\n if ('left' in offset) {\n elem.style[oppositeHorizontalProperty] = '';\n elem.style[horizontalProperty] = `${presetH}px`;\n }\n if ('top' in offset) {\n elem.style[oppositeVerticalProperty] = '';\n elem.style[verticalProperty] = `${presetV}px`;\n }\n // force relayout\n forceRelayout(elem);\n const old = getOffset(elem);\n const originalStyle = {};\n for (const key in offset) {\n if (offset.hasOwnProperty(key)) {\n const dir = getOffsetDirection(key, option);\n const preset = key === 'left' ? presetH : presetV;\n const off = originalOffset[key] - old[key];\n if (dir === key) {\n originalStyle[dir] = preset + off;\n } else {\n originalStyle[dir] = preset - off;\n }\n }\n }\n css(elem, originalStyle);\n // force relayout\n forceRelayout(elem);\n if ('left' in offset || 'top' in offset) {\n setTransitionProperty(elem, originalTransition);\n }\n const ret = {};\n for (const key in offset) {\n if (offset.hasOwnProperty(key)) {\n const dir = getOffsetDirection(key, option);\n const off = offset[key] - originalOffset[key];\n if (key === dir) {\n ret[dir] = originalStyle[dir] + off;\n } else {\n ret[dir] = originalStyle[dir] - off;\n }\n }\n }\n css(elem, ret);\n}\n\nfunction setTransform(elem, offset) {\n const originalOffset = getOffset(elem);\n const originalXY = getTransformXY(elem);\n const resultXY = { x: originalXY.x, y: originalXY.y };\n if ('left' in offset) {\n resultXY.x = originalXY.x + offset.left - originalOffset.left;\n }\n if ('top' in offset) {\n resultXY.y = originalXY.y + offset.top - originalOffset.top;\n }\n setTransformXY(elem, resultXY);\n}\n\nfunction setOffset(elem, offset, option) {\n if (option.ignoreShake) {\n const oriOffset = getOffset(elem);\n\n const oLeft = oriOffset.left.toFixed(0);\n const oTop = oriOffset.top.toFixed(0);\n const tLeft = offset.left.toFixed(0);\n const tTop = offset.top.toFixed(0);\n\n if (oLeft === tLeft && oTop === tTop) {\n return;\n }\n }\n\n if (option.useCssRight || option.useCssBottom) {\n setLeftTop(elem, offset, option);\n } else if (\n option.useCssTransform &&\n getTransformName() in document.body.style\n ) {\n setTransform(elem, offset, option);\n } else {\n setLeftTop(elem, offset, option);\n }\n}\n\nfunction each(arr, fn) {\n for (let i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nconst BOX_MODELS = ['margin', 'border', 'padding'];\nconst CONTENT_INDEX = -1;\nconst PADDING_INDEX = 2;\nconst BORDER_INDEX = 1;\nconst MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n const old = {};\n const style = elem.style;\n let name;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n let value = 0;\n let prop;\n let j;\n let i;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n let cssProp;\n if (prop === 'border') {\n cssProp = `${prop}${which[i]}Width`;\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\nconst domUtils = {\n getParent(element) {\n let parent = element;\n do {\n if (parent.nodeType === 11 && parent.host) {\n parent = parent.host;\n } else {\n parent = parent.parentNode;\n }\n } while (parent && parent.nodeType !== 1 && parent.nodeType !== 9);\n return parent;\n },\n};\n\neach(['Width', 'Height'], name => {\n domUtils[`doc${name}`] = refWin => {\n const d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement[`scroll${name}`],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body[`scroll${name}`],\n domUtils[`viewport${name}`](d),\n );\n };\n\n domUtils[`viewport${name}`] = win => {\n // pc browser includes scrollbar in window.innerWidth\n const prop = `client${name}`;\n const doc = win.document;\n const body = doc.body;\n const documentElement = doc.documentElement;\n const documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return (\n (doc.compatMode === 'CSS1Compat' && documentElementProp) ||\n (body && body[prop]) ||\n documentElementProp\n );\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, ex) {\n let extra = ex;\n if (isWindow(elem)) {\n return name === 'width'\n ? domUtils.viewportWidth(elem)\n : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width'\n ? domUtils.docWidth(elem)\n : domUtils.docHeight(elem);\n }\n const which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n let borderBoxValue =\n name === 'width'\n ? Math.floor(elem.getBoundingClientRect().width)\n : Math.floor(elem.getBoundingClientRect().height);\n const isBorderBox = isBorderBoxFn(elem);\n let cssBoxValue = 0;\n if (\n borderBoxValue === null ||\n borderBoxValue === undefined ||\n borderBoxValue <= 0\n ) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (\n cssBoxValue === null ||\n cssBoxValue === undefined ||\n Number(cssBoxValue) < 0\n ) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = Math.floor(parseFloat(cssBoxValue)) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n const borderBoxValueOrIsBorderBox =\n borderBoxValue !== undefined || isBorderBox;\n const val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which);\n }\n return cssBoxValue;\n } else if (borderBoxValueOrIsBorderBox) {\n if (extra === BORDER_INDEX) {\n return val;\n }\n return (\n val +\n (extra === PADDING_INDEX\n ? -getPBMWidth(elem, ['border'], which)\n : getPBMWidth(elem, ['margin'], which))\n );\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which);\n}\n\nconst cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block',\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(...args) {\n let val;\n const elem = args[0];\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, () => {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\neach(['width', 'height'], name => {\n const first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils[`outer${first}`] = (el, includeMargin) => {\n return (\n el &&\n getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX)\n );\n };\n const which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = (elem, v) => {\n let val = v;\n if (val !== undefined) {\n if (elem) {\n const isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\nfunction mix(to, from) {\n for (const i in from) {\n if (from.hasOwnProperty(i)) {\n to[i] = from[i];\n }\n }\n return to;\n}\n\nconst utils = {\n getWindow(node) {\n if (node && node.document && node.setTimeout) {\n return node;\n }\n const doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n getDocument,\n offset(el, value, option) {\n if (typeof value !== 'undefined') {\n setOffset(el, value, option || {});\n } else {\n return getOffset(el);\n }\n },\n isWindow,\n each,\n css,\n clone(obj) {\n let i;\n const ret = {};\n for (i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n const overflow = obj.overflow;\n if (overflow) {\n for (i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n mix,\n getWindowScrollLeft(w) {\n return getScrollLeft(w);\n },\n getWindowScrollTop(w) {\n return getScrollTop(w);\n },\n merge(...args) {\n const ret = {};\n for (let i = 0; i < args.length; i++) {\n utils.mix(ret, args[i]);\n }\n return ret;\n },\n viewportWidth: 0,\n viewportHeight: 0,\n};\n\nmix(utils, domUtils);\n\nexport default utils;\n","import utils from './utils';\n\n/**\n * 得到会导致元素显示不全的祖先元素\n */\nconst { getParent } = utils;\n\nfunction getOffsetParent(element) {\n if (utils.isWindow(element) || element.nodeType === 9) {\n return null;\n }\n // ie 这个也不是完全可行\n /*\n \n
\n 元素 6 高 100px 宽 50px
\n
\n
\n */\n // element.offsetParent does the right thing in ie7 and below. Return parent with layout!\n // In other browsers it only includes elements with position absolute, relative or\n // fixed, not elements with overflow set to auto or scroll.\n // if (UA.ie && ieMode < 8) {\n // return element.offsetParent;\n // }\n // 统一的 offsetParent 方法\n const doc = utils.getDocument(element);\n const body = doc.body;\n let parent;\n let positionStyle = utils.css(element, 'position');\n const skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';\n\n if (!skipStatic) {\n return element.nodeName.toLowerCase() === 'html'\n ? null\n : getParent(element);\n }\n\n for (\n parent = getParent(element);\n parent && parent !== body && parent.nodeType !== 9;\n parent = getParent(parent)\n ) {\n positionStyle = utils.css(parent, 'position');\n if (positionStyle !== 'static') {\n return parent;\n }\n }\n return null;\n}\n\nexport default getOffsetParent;\n","import utils from './utils';\n\nconst { getParent } = utils;\n\nexport default function isAncestorFixed(element) {\n if (utils.isWindow(element) || element.nodeType === 9) {\n return false;\n }\n\n const doc = utils.getDocument(element);\n const body = doc.body;\n let parent = null;\n for (\n parent = getParent(element);\n // 修复元素位于 document.documentElement 下导致崩溃问题\n parent && parent !== body && parent !== doc;\n parent = getParent(parent)\n ) {\n const positionStyle = utils.css(parent, 'position');\n if (positionStyle === 'fixed') {\n return true;\n }\n }\n return false;\n}\n","import utils from './utils';\nimport getOffsetParent from './getOffsetParent';\nimport isAncestorFixed from './isAncestorFixed';\n\n/**\n * 获得元素的显示部分的区域\n */\nfunction getVisibleRectForElement(element, alwaysByViewport) {\n const visibleRect = {\n left: 0,\n right: Infinity,\n top: 0,\n bottom: Infinity,\n };\n let el = getOffsetParent(element);\n const doc = utils.getDocument(element);\n const win = doc.defaultView || doc.parentWindow;\n const body = doc.body;\n const documentElement = doc.documentElement;\n\n // Determine the size of the visible rect by climbing the dom accounting for\n // all scrollable containers.\n while (el) {\n // clientWidth is zero for inline block elements in ie.\n if (\n (navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&\n // body may have overflow set on it, yet we still get the entire\n // viewport. In some browsers, el.offsetParent may be\n // document.documentElement, so check for that too.\n (el !== body &&\n el !== documentElement &&\n utils.css(el, 'overflow') !== 'visible')\n ) {\n const pos = utils.offset(el);\n // add border\n pos.left += el.clientLeft;\n pos.top += el.clientTop;\n visibleRect.top = Math.max(visibleRect.top, pos.top);\n visibleRect.right = Math.min(\n visibleRect.right,\n // consider area without scrollBar\n pos.left + el.clientWidth,\n );\n visibleRect.bottom = Math.min(\n visibleRect.bottom,\n pos.top + el.clientHeight,\n );\n visibleRect.left = Math.max(visibleRect.left, pos.left);\n } else if (el === body || el === documentElement) {\n break;\n }\n el = getOffsetParent(el);\n }\n\n // Set element position to fixed\n // make sure absolute element itself don't affect it's visible area\n // https://github.com/ant-design/ant-design/issues/7601\n let originalPosition = null;\n if (!utils.isWindow(element) && element.nodeType !== 9) {\n originalPosition = element.style.position;\n const position = utils.css(element, 'position');\n if (position === 'absolute') {\n element.style.position = 'fixed';\n }\n }\n\n const scrollX = utils.getWindowScrollLeft(win);\n const scrollY = utils.getWindowScrollTop(win);\n const viewportWidth = utils.viewportWidth(win);\n const viewportHeight = utils.viewportHeight(win);\n let documentWidth = documentElement.scrollWidth;\n let documentHeight = documentElement.scrollHeight;\n\n // scrollXXX on html is sync with body which means overflow: hidden on body gets wrong scrollXXX.\n // We should cut this ourself.\n const bodyStyle = window.getComputedStyle(body);\n if (bodyStyle.overflowX === 'hidden') {\n documentWidth = win.innerWidth;\n }\n if (bodyStyle.overflowY === 'hidden') {\n documentHeight = win.innerHeight;\n }\n\n // Reset element position after calculate the visible area\n if (element.style) {\n element.style.position = originalPosition;\n }\n\n if (alwaysByViewport || isAncestorFixed(element)) {\n // Clip by viewport's size.\n visibleRect.left = Math.max(visibleRect.left, scrollX);\n visibleRect.top = Math.max(visibleRect.top, scrollY);\n visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);\n visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);\n } else {\n // Clip by document's size.\n const maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);\n visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);\n\n const maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);\n visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);\n }\n\n return visibleRect.top >= 0 &&\n visibleRect.left >= 0 &&\n visibleRect.bottom > visibleRect.top &&\n visibleRect.right > visibleRect.left\n ? visibleRect\n : null;\n}\n\nexport default getVisibleRectForElement;\n","import utils from './utils';\n\nfunction getRegion(node) {\n let offset;\n let w;\n let h;\n if (!utils.isWindow(node) && node.nodeType !== 9) {\n offset = utils.offset(node);\n w = utils.outerWidth(node);\n h = utils.outerHeight(node);\n } else {\n const win = utils.getWindow(node);\n offset = {\n left: utils.getWindowScrollLeft(win),\n top: utils.getWindowScrollTop(win),\n };\n w = utils.viewportWidth(win);\n h = utils.viewportHeight(win);\n }\n offset.width = w;\n offset.height = h;\n return offset;\n}\n\nexport default getRegion;\n","/**\n * 获取 node 上的 align 对齐点 相对于页面的坐标\n */\n\nfunction getAlignOffset(region, align) {\n const V = align.charAt(0);\n const H = align.charAt(1);\n const w = region.width;\n const h = region.height;\n\n let x = region.left;\n let y = region.top;\n\n if (V === 'c') {\n y += h / 2;\n } else if (V === 'b') {\n y += h;\n }\n\n if (H === 'c') {\n x += w / 2;\n } else if (H === 'r') {\n x += w;\n }\n\n return {\n left: x,\n top: y,\n };\n}\n\nexport default getAlignOffset;\n","import getAlignOffset from './getAlignOffset';\n\nfunction getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {\n const p1 = getAlignOffset(refNodeRegion, points[1]);\n const p2 = getAlignOffset(elRegion, points[0]);\n const diff = [p2.left - p1.left, p2.top - p1.top];\n\n return {\n left: Math.round(elRegion.left - diff[0] + offset[0] - targetOffset[0]),\n top: Math.round(elRegion.top - diff[1] + offset[1] - targetOffset[1]),\n };\n}\n\nexport default getElFuturePos;\n","/**\n * align dom node flexibly\n * @author yiminghe@gmail.com\n */\n\nimport utils from '../utils';\nimport getVisibleRectForElement from '../getVisibleRectForElement';\nimport adjustForViewport from '../adjustForViewport';\nimport getRegion from '../getRegion';\nimport getElFuturePos from '../getElFuturePos';\n\n// http://yiminghe.iteye.com/blog/1124720\n\nfunction isFailX(elFuturePos, elRegion, visibleRect) {\n return (\n elFuturePos.left < visibleRect.left ||\n elFuturePos.left + elRegion.width > visibleRect.right\n );\n}\n\nfunction isFailY(elFuturePos, elRegion, visibleRect) {\n return (\n elFuturePos.top < visibleRect.top ||\n elFuturePos.top + elRegion.height > visibleRect.bottom\n );\n}\n\nfunction isCompleteFailX(elFuturePos, elRegion, visibleRect) {\n return (\n elFuturePos.left > visibleRect.right ||\n elFuturePos.left + elRegion.width < visibleRect.left\n );\n}\n\nfunction isCompleteFailY(elFuturePos, elRegion, visibleRect) {\n return (\n elFuturePos.top > visibleRect.bottom ||\n elFuturePos.top + elRegion.height < visibleRect.top\n );\n}\n\nfunction flip(points, reg, map) {\n const ret = [];\n utils.each(points, p => {\n ret.push(\n p.replace(reg, m => {\n return map[m];\n }),\n );\n });\n return ret;\n}\n\nfunction flipOffset(offset, index) {\n offset[index] = -offset[index];\n return offset;\n}\n\nfunction convertOffset(str, offsetLen) {\n let n;\n if (/%$/.test(str)) {\n n = (parseInt(str.substring(0, str.length - 1), 10) / 100) * offsetLen;\n } else {\n n = parseInt(str, 10);\n }\n return n || 0;\n}\n\nfunction normalizeOffset(offset, el) {\n offset[0] = convertOffset(offset[0], el.width);\n offset[1] = convertOffset(offset[1], el.height);\n}\n\n/**\n * @param el\n * @param tgtRegion 参照节点所占的区域: { left, top, width, height }\n * @param align\n */\nfunction doAlign(el, tgtRegion, align, isTgtRegionVisible) {\n let points = align.points;\n let offset = align.offset || [0, 0];\n let targetOffset = align.targetOffset || [0, 0];\n let overflow = align.overflow;\n const source = align.source || el;\n offset = [].concat(offset);\n targetOffset = [].concat(targetOffset);\n overflow = overflow || {};\n const newOverflowCfg = {};\n let fail = 0;\n const alwaysByViewport = !!(overflow && overflow.alwaysByViewport);\n // 当前节点可以被放置的显示区域\n const visibleRect = getVisibleRectForElement(source, alwaysByViewport);\n // 当前节点所占的区域, left/top/width/height\n const elRegion = getRegion(source);\n // 将 offset 转换成数值,支持百分比\n normalizeOffset(offset, elRegion);\n normalizeOffset(targetOffset, tgtRegion);\n // 当前节点将要被放置的位置\n let elFuturePos = getElFuturePos(\n elRegion,\n tgtRegion,\n points,\n offset,\n targetOffset,\n );\n // 当前节点将要所处的区域\n let newElRegion = utils.merge(elRegion, elFuturePos);\n\n // 如果可视区域不能完全放置当前节点时允许调整\n if (\n visibleRect &&\n (overflow.adjustX || overflow.adjustY) &&\n isTgtRegionVisible\n ) {\n if (overflow.adjustX) {\n // 如果横向不能放下\n if (isFailX(elFuturePos, elRegion, visibleRect)) {\n // 对齐位置反下\n const newPoints = flip(points, /[lr]/gi, {\n l: 'r',\n r: 'l',\n });\n // 偏移量也反下\n const newOffset = flipOffset(offset, 0);\n const newTargetOffset = flipOffset(targetOffset, 0);\n const newElFuturePos = getElFuturePos(\n elRegion,\n tgtRegion,\n newPoints,\n newOffset,\n newTargetOffset,\n );\n\n if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {\n fail = 1;\n points = newPoints;\n offset = newOffset;\n targetOffset = newTargetOffset;\n }\n }\n }\n\n if (overflow.adjustY) {\n // 如果纵向不能放下\n if (isFailY(elFuturePos, elRegion, visibleRect)) {\n // 对齐位置反下\n const newPoints = flip(points, /[tb]/gi, {\n t: 'b',\n b: 't',\n });\n // 偏移量也反下\n const newOffset = flipOffset(offset, 1);\n const newTargetOffset = flipOffset(targetOffset, 1);\n const newElFuturePos = getElFuturePos(\n elRegion,\n tgtRegion,\n newPoints,\n newOffset,\n newTargetOffset,\n );\n\n if (!isCompleteFailY(newElFuturePos, elRegion, visibleRect)) {\n fail = 1;\n points = newPoints;\n offset = newOffset;\n targetOffset = newTargetOffset;\n }\n }\n }\n\n // 如果失败,重新计算当前节点将要被放置的位置\n if (fail) {\n elFuturePos = getElFuturePos(\n elRegion,\n tgtRegion,\n points,\n offset,\n targetOffset,\n );\n utils.mix(newElRegion, elFuturePos);\n }\n const isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);\n const isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);\n // 检查反下后的位置是否可以放下了,如果仍然放不下:\n // 1. 复原修改过的定位参数\n if (isStillFailX || isStillFailY) {\n let newPoints = points;\n\n // 重置对应部分的翻转逻辑\n if (isStillFailX) {\n newPoints = flip(points, /[lr]/gi, {\n l: 'r',\n r: 'l',\n });\n }\n if (isStillFailY) {\n newPoints = flip(points, /[tb]/gi, {\n t: 'b',\n b: 't',\n });\n }\n\n points = newPoints;\n\n offset = align.offset || [0, 0];\n targetOffset = align.targetOffset || [0, 0];\n }\n // 2. 只有指定了可以调整当前方向才调整\n newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;\n newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;\n\n // 确实要调整,甚至可能会调整高度宽度\n if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {\n newElRegion = adjustForViewport(\n elFuturePos,\n elRegion,\n visibleRect,\n newOverflowCfg,\n );\n }\n }\n\n // need judge to in case set fixed with in css on height auto element\n if (newElRegion.width !== elRegion.width) {\n utils.css(\n source,\n 'width',\n utils.width(source) + newElRegion.width - elRegion.width,\n );\n }\n\n if (newElRegion.height !== elRegion.height) {\n utils.css(\n source,\n 'height',\n utils.height(source) + newElRegion.height - elRegion.height,\n );\n }\n\n // https://github.com/kissyteam/kissy/issues/190\n // 相对于屏幕位置没变,而 left/top 变了\n // 例如
\n utils.offset(\n source,\n {\n left: newElRegion.left,\n top: newElRegion.top,\n },\n {\n useCssRight: align.useCssRight,\n useCssBottom: align.useCssBottom,\n useCssTransform: align.useCssTransform,\n ignoreShake: align.ignoreShake,\n },\n );\n\n return {\n points,\n offset,\n targetOffset,\n overflow: newOverflowCfg,\n };\n}\n\nexport default doAlign;\n/**\n * 2012-04-26 yiminghe@gmail.com\n * - 优化智能对齐算法\n * - 慎用 resizeXX\n *\n * 2011-07-13 yiminghe@gmail.com note:\n * - 增加智能对齐,以及大小调整选项\n **/\n","import utils from './utils';\n\nfunction adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {\n const pos = utils.clone(elFuturePos);\n const size = {\n width: elRegion.width,\n height: elRegion.height,\n };\n\n if (overflow.adjustX && pos.left < visibleRect.left) {\n pos.left = visibleRect.left;\n }\n\n // Left edge inside and right edge outside viewport, try to resize it.\n if (\n overflow.resizeWidth &&\n pos.left >= visibleRect.left &&\n pos.left + size.width > visibleRect.right\n ) {\n size.width -= pos.left + size.width - visibleRect.right;\n }\n\n // Right edge outside viewport, try to move it.\n if (overflow.adjustX && pos.left + size.width > visibleRect.right) {\n // 保证左边界和可视区域左边界对齐\n pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);\n }\n\n // Top edge outside viewport, try to move it.\n if (overflow.adjustY && pos.top < visibleRect.top) {\n pos.top = visibleRect.top;\n }\n\n // Top edge inside and bottom edge outside viewport, try to resize it.\n if (\n overflow.resizeHeight &&\n pos.top >= visibleRect.top &&\n pos.top + size.height > visibleRect.bottom\n ) {\n size.height -= pos.top + size.height - visibleRect.bottom;\n }\n\n // Bottom edge outside viewport, try to move it.\n if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {\n // 保证上边界和可视区域上边界对齐\n pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);\n }\n\n return utils.mix(pos, size);\n}\n\nexport default adjustForViewport;\n","import doAlign from './align';\nimport getOffsetParent from '../getOffsetParent';\nimport getVisibleRectForElement from '../getVisibleRectForElement';\nimport getRegion from '../getRegion';\n\nfunction isOutOfVisibleRect(target, alwaysByViewport) {\n const visibleRect = getVisibleRectForElement(target, alwaysByViewport);\n const targetRegion = getRegion(target);\n\n return (\n !visibleRect ||\n targetRegion.left + targetRegion.width <= visibleRect.left ||\n targetRegion.top + targetRegion.height <= visibleRect.top ||\n targetRegion.left >= visibleRect.right ||\n targetRegion.top >= visibleRect.bottom\n );\n}\n\nfunction alignElement(el, refNode, align) {\n const target = align.target || refNode;\n const refNodeRegion = getRegion(target);\n\n const isTargetNotOutOfVisible = !isOutOfVisibleRect(\n target,\n align.overflow && align.overflow.alwaysByViewport,\n );\n\n return doAlign(el, refNodeRegion, align, isTargetNotOutOfVisible);\n}\n\nalignElement.__getOffsetParent = getOffsetParent;\n\nalignElement.__getVisibleRectForElement = getVisibleRectForElement;\n\nexport default alignElement;\n","import contains from 'rc-util/es/Dom/contains';\n\nexport function buffer(fn, ms) {\n var timer = void 0;\n\n function clear() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n }\n\n function bufferFn() {\n clear();\n timer = setTimeout(fn, ms);\n }\n\n bufferFn.clear = clear;\n\n return bufferFn;\n}\n\nexport function isSamePoint(prev, next) {\n if (prev === next) return true;\n if (!prev || !next) return false;\n\n if ('pageX' in next && 'pageY' in next) {\n return prev.pageX === next.pageX && prev.pageY === next.pageY;\n }\n\n if ('clientX' in next && 'clientY' in next) {\n return prev.clientX === next.clientX && prev.clientY === next.clientY;\n }\n\n return false;\n}\n\nexport function isWindow(obj) {\n return obj && typeof obj === 'object' && obj.window === obj;\n}\n\nexport function isSimilarValue(val1, val2) {\n var int1 = Math.floor(val1);\n var int2 = Math.floor(val2);\n return Math.abs(int1 - int2) <= 1;\n}\n\nexport function restoreFocus(activeElement, container) {\n // Focus back if is in the container\n if (activeElement !== document.activeElement && contains(container, activeElement)) {\n activeElement.focus();\n }\n}","import _classCallCheck from 'babel-runtime/helpers/classCallCheck';\nimport _createClass from 'babel-runtime/helpers/createClass';\nimport _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';\nimport _inherits from 'babel-runtime/helpers/inherits';\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport { alignElement, alignPoint } from 'dom-align';\nimport addEventListener from 'rc-util/es/Dom/addEventListener';\n\nimport { isWindow, buffer, isSamePoint, isSimilarValue, restoreFocus } from './util';\n\nfunction getElement(func) {\n if (typeof func !== 'function' || !func) return null;\n return func();\n}\n\nfunction getPoint(point) {\n if (typeof point !== 'object' || !point) return null;\n return point;\n}\n\nvar Align = function (_Component) {\n _inherits(Align, _Component);\n\n function Align() {\n var _ref;\n\n var _temp, _this, _ret;\n\n _classCallCheck(this, Align);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Align.__proto__ || Object.getPrototypeOf(Align)).call.apply(_ref, [this].concat(args))), _this), _this.forceAlign = function () {\n var _this$props = _this.props,\n disabled = _this$props.disabled,\n target = _this$props.target,\n align = _this$props.align,\n onAlign = _this$props.onAlign;\n\n if (!disabled && target) {\n var source = ReactDOM.findDOMNode(_this);\n\n var result = void 0;\n var element = getElement(target);\n var point = getPoint(target);\n\n // IE lose focus after element realign\n // We should record activeElement and restore later\n var activeElement = document.activeElement;\n\n if (element) {\n result = alignElement(source, element, align);\n } else if (point) {\n result = alignPoint(source, point, align);\n }\n\n restoreFocus(activeElement, source);\n\n if (onAlign) {\n onAlign(source, result);\n }\n }\n }, _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n _createClass(Align, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n var props = this.props;\n // if parent ref not attached .... use document.getElementById\n this.forceAlign();\n if (!props.disabled && props.monitorWindowResize) {\n this.startMonitorWindowResize();\n }\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps) {\n var reAlign = false;\n var props = this.props;\n\n if (!props.disabled) {\n var source = ReactDOM.findDOMNode(this);\n var sourceRect = source ? source.getBoundingClientRect() : null;\n\n if (prevProps.disabled) {\n reAlign = true;\n } else {\n var lastElement = getElement(prevProps.target);\n var currentElement = getElement(props.target);\n var lastPoint = getPoint(prevProps.target);\n var currentPoint = getPoint(props.target);\n\n if (isWindow(lastElement) && isWindow(currentElement)) {\n // Skip if is window\n reAlign = false;\n } else if (lastElement !== currentElement || // Element change\n lastElement && !currentElement && currentPoint || // Change from element to point\n lastPoint && currentPoint && currentElement || // Change from point to element\n currentPoint && !isSamePoint(lastPoint, currentPoint)) {\n reAlign = true;\n }\n\n // If source element size changed\n var preRect = this.sourceRect || {};\n if (!reAlign && source && (!isSimilarValue(preRect.width, sourceRect.width) || !isSimilarValue(preRect.height, sourceRect.height))) {\n reAlign = true;\n }\n }\n\n this.sourceRect = sourceRect;\n }\n\n if (reAlign) {\n this.forceAlign();\n }\n\n if (props.monitorWindowResize && !props.disabled) {\n this.startMonitorWindowResize();\n } else {\n this.stopMonitorWindowResize();\n }\n }\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this.stopMonitorWindowResize();\n }\n }, {\n key: 'startMonitorWindowResize',\n value: function startMonitorWindowResize() {\n if (!this.resizeHandler) {\n this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime);\n this.resizeHandler = addEventListener(window, 'resize', this.bufferMonitor);\n }\n }\n }, {\n key: 'stopMonitorWindowResize',\n value: function stopMonitorWindowResize() {\n if (this.resizeHandler) {\n this.bufferMonitor.clear();\n this.resizeHandler.remove();\n this.resizeHandler = null;\n }\n }\n }, {\n key: 'render',\n value: function render() {\n var _this2 = this;\n\n var _props = this.props,\n childrenProps = _props.childrenProps,\n children = _props.children;\n\n var child = React.Children.only(children);\n if (childrenProps) {\n var newProps = {};\n var propList = Object.keys(childrenProps);\n propList.forEach(function (prop) {\n newProps[prop] = _this2.props[childrenProps[prop]];\n });\n\n return React.cloneElement(child, newProps);\n }\n return child;\n }\n }]);\n\n return Align;\n}(Component);\n\nAlign.propTypes = {\n childrenProps: PropTypes.object,\n align: PropTypes.object.isRequired,\n target: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({\n clientX: PropTypes.number,\n clientY: PropTypes.number,\n pageX: PropTypes.number,\n pageY: PropTypes.number\n })]),\n onAlign: PropTypes.func,\n monitorBufferTime: PropTypes.number,\n monitorWindowResize: PropTypes.bool,\n disabled: PropTypes.bool,\n children: PropTypes.any\n};\nAlign.defaultProps = {\n target: function target() {\n return window;\n },\n monitorBufferTime: 50,\n monitorWindowResize: false,\n disabled: false\n};\n\n\nexport default Align;","import utils from '../utils';\nimport doAlign from './align';\n\n/**\n * `tgtPoint`: { pageX, pageY } or { clientX, clientY }.\n * If client position provided, will internal convert to page position.\n */\n\nfunction alignPoint(el, tgtPoint, align) {\n let pageX;\n let pageY;\n\n const doc = utils.getDocument(el);\n const win = doc.defaultView || doc.parentWindow;\n\n const scrollX = utils.getWindowScrollLeft(win);\n const scrollY = utils.getWindowScrollTop(win);\n const viewportWidth = utils.viewportWidth(win);\n const viewportHeight = utils.viewportHeight(win);\n\n if ('pageX' in tgtPoint) {\n pageX = tgtPoint.pageX;\n } else {\n pageX = scrollX + tgtPoint.clientX;\n }\n\n if ('pageY' in tgtPoint) {\n pageY = tgtPoint.pageY;\n } else {\n pageY = scrollY + tgtPoint.clientY;\n }\n\n const tgtRegion = {\n left: pageX,\n top: pageY,\n width: 0,\n height: 0,\n };\n\n const pointInView =\n pageX >= 0 &&\n pageX <= scrollX + viewportWidth &&\n (pageY >= 0 && pageY <= scrollY + viewportHeight);\n\n // Provide default target point\n const points = [align.points[0], 'cc'];\n\n return doAlign(el, tgtRegion, { ...align, points }, pointInView);\n}\n\nexport default alignPoint;\n","// export this package's api\nimport Align from './Align';\n\nexport default Align;","import React from 'react';\n\nvar unsafeLifecyclesPolyfill = function unsafeLifecyclesPolyfill(Component) {\n var prototype = Component.prototype;\n\n if (!prototype || !prototype.isReactComponent) {\n throw new Error('Can only polyfill class components');\n } // only handle componentWillReceiveProps\n\n\n if (typeof prototype.componentWillReceiveProps !== 'function') {\n return Component;\n } // In React 16.9, React.Profiler was introduced together with UNSAFE_componentWillReceiveProps\n // https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#performance-measurements-with-reactprofiler\n\n\n if (!React.Profiler) {\n return Component;\n } // Here polyfill get started\n\n\n prototype.UNSAFE_componentWillReceiveProps = prototype.componentWillReceiveProps;\n delete prototype.componentWillReceiveProps;\n return Component;\n};\n\nexport default unsafeLifecyclesPolyfill;","import React from 'react';\n\nexport function toArrayChildren(children) {\n var ret = [];\n React.Children.forEach(children, function (child) {\n ret.push(child);\n });\n return ret;\n}\n\nexport function findChildInChildrenByKey(children, key) {\n var ret = null;\n if (children) {\n children.forEach(function (child) {\n if (ret) {\n return;\n }\n if (child && child.key === key) {\n ret = child;\n }\n });\n }\n return ret;\n}\n\nexport function findShownChildInChildrenByKey(children, key, showProp) {\n var ret = null;\n if (children) {\n children.forEach(function (child) {\n if (child && child.key === key && child.props[showProp]) {\n if (ret) {\n throw new Error('two child with same key for children');\n }\n ret = child;\n }\n });\n }\n return ret;\n}\n\nexport function findHiddenChildInChildrenByKey(children, key, showProp) {\n var found = 0;\n if (children) {\n children.forEach(function (child) {\n if (found) {\n return;\n }\n found = child && child.key === key && !child.props[showProp];\n });\n }\n return found;\n}\n\nexport function isSameChildren(c1, c2, showProp) {\n var same = c1.length === c2.length;\n if (same) {\n c1.forEach(function (child, index) {\n var child2 = c2[index];\n if (child && child2) {\n if (child && !child2 || !child && child2) {\n same = false;\n } else if (child.key !== child2.key) {\n same = false;\n } else if (showProp && child.props[showProp] !== child2.props[showProp]) {\n same = false;\n }\n }\n });\n }\n return same;\n}\n\nexport function mergeChildren(prev, next) {\n var ret = [];\n\n // For each key of `next`, the list of keys to insert before that key in\n // the combined list\n var nextChildrenPending = {};\n var pendingChildren = [];\n prev.forEach(function (child) {\n if (child && findChildInChildrenByKey(next, child.key)) {\n if (pendingChildren.length) {\n nextChildrenPending[child.key] = pendingChildren;\n pendingChildren = [];\n }\n } else {\n pendingChildren.push(child);\n }\n });\n\n next.forEach(function (child) {\n if (child && Object.prototype.hasOwnProperty.call(nextChildrenPending, child.key)) {\n ret = ret.concat(nextChildrenPending[child.key]);\n }\n ret.push(child);\n });\n\n ret = ret.concat(pendingChildren);\n\n return ret;\n}","var START_EVENT_NAME_MAP = {\n transitionstart: {\n transition: 'transitionstart',\n WebkitTransition: 'webkitTransitionStart',\n MozTransition: 'mozTransitionStart',\n OTransition: 'oTransitionStart',\n msTransition: 'MSTransitionStart'\n },\n\n animationstart: {\n animation: 'animationstart',\n WebkitAnimation: 'webkitAnimationStart',\n MozAnimation: 'mozAnimationStart',\n OAnimation: 'oAnimationStart',\n msAnimation: 'MSAnimationStart'\n }\n};\n\nvar END_EVENT_NAME_MAP = {\n transitionend: {\n transition: 'transitionend',\n WebkitTransition: 'webkitTransitionEnd',\n MozTransition: 'mozTransitionEnd',\n OTransition: 'oTransitionEnd',\n msTransition: 'MSTransitionEnd'\n },\n\n animationend: {\n animation: 'animationend',\n WebkitAnimation: 'webkitAnimationEnd',\n MozAnimation: 'mozAnimationEnd',\n OAnimation: 'oAnimationEnd',\n msAnimation: 'MSAnimationEnd'\n }\n};\n\nvar startEvents = [];\nvar endEvents = [];\n\nfunction detectEvents() {\n var testEl = document.createElement('div');\n var style = testEl.style;\n\n if (!('AnimationEvent' in window)) {\n delete START_EVENT_NAME_MAP.animationstart.animation;\n delete END_EVENT_NAME_MAP.animationend.animation;\n }\n\n if (!('TransitionEvent' in window)) {\n delete START_EVENT_NAME_MAP.transitionstart.transition;\n delete END_EVENT_NAME_MAP.transitionend.transition;\n }\n\n function process(EVENT_NAME_MAP, events) {\n for (var baseEventName in EVENT_NAME_MAP) {\n if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {\n var baseEvents = EVENT_NAME_MAP[baseEventName];\n for (var styleName in baseEvents) {\n if (styleName in style) {\n events.push(baseEvents[styleName]);\n break;\n }\n }\n }\n }\n }\n\n process(START_EVENT_NAME_MAP, startEvents);\n process(END_EVENT_NAME_MAP, endEvents);\n}\n\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n detectEvents();\n}\n\nfunction addEventListener(node, eventName, eventListener) {\n node.addEventListener(eventName, eventListener, false);\n}\n\nfunction removeEventListener(node, eventName, eventListener) {\n node.removeEventListener(eventName, eventListener, false);\n}\n\nvar TransitionEvents = {\n // Start events\n startEvents: startEvents,\n\n addStartEventListener: function addStartEventListener(node, eventListener) {\n if (startEvents.length === 0) {\n window.setTimeout(eventListener, 0);\n return;\n }\n startEvents.forEach(function (startEvent) {\n addEventListener(node, startEvent, eventListener);\n });\n },\n removeStartEventListener: function removeStartEventListener(node, eventListener) {\n if (startEvents.length === 0) {\n return;\n }\n startEvents.forEach(function (startEvent) {\n removeEventListener(node, startEvent, eventListener);\n });\n },\n\n\n // End events\n endEvents: endEvents,\n\n addEndEventListener: function addEndEventListener(node, eventListener) {\n if (endEvents.length === 0) {\n window.setTimeout(eventListener, 0);\n return;\n }\n endEvents.forEach(function (endEvent) {\n addEventListener(node, endEvent, eventListener);\n });\n },\n removeEndEventListener: function removeEndEventListener(node, eventListener) {\n if (endEvents.length === 0) {\n return;\n }\n endEvents.forEach(function (endEvent) {\n removeEventListener(node, endEvent, eventListener);\n });\n }\n};\n\nexport default TransitionEvents;","var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nimport Event from './Event';\n\nvar isCssAnimationSupported = Event.endEvents.length !== 0;\nvar capitalPrefixes = ['Webkit', 'Moz', 'O',\n// ms is special .... !\n'ms'];\nvar prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];\n\nfunction getStyleProperty(node, name) {\n // old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle\n var style = window.getComputedStyle(node, null);\n var ret = '';\n for (var i = 0; i < prefixes.length; i++) {\n ret = style.getPropertyValue(prefixes[i] + name);\n if (ret) {\n break;\n }\n }\n return ret;\n}\n\nfunction fixBrowserByTimeout(node) {\n if (isCssAnimationSupported) {\n var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;\n var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;\n var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;\n var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;\n var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);\n // sometimes, browser bug\n node.rcEndAnimTimeout = setTimeout(function () {\n node.rcEndAnimTimeout = null;\n if (node.rcEndListener) {\n node.rcEndListener();\n }\n }, time * 1000 + 200);\n }\n}\n\nfunction clearBrowserBugTimeout(node) {\n if (node.rcEndAnimTimeout) {\n clearTimeout(node.rcEndAnimTimeout);\n node.rcEndAnimTimeout = null;\n }\n}\n\nvar cssAnimation = function cssAnimation(node, transitionName, endCallback) {\n var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';\n var className = nameIsObj ? transitionName.name : transitionName;\n var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';\n var end = endCallback;\n var start = void 0;\n var active = void 0;\n\n if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {\n end = endCallback.end;\n start = endCallback.start;\n active = endCallback.active;\n }\n\n if (node.rcEndListener) {\n node.rcEndListener();\n }\n\n node.rcEndListener = function (e) {\n if (e && e.target !== node) {\n return;\n }\n\n if (node.rcAnimTimeout) {\n clearTimeout(node.rcAnimTimeout);\n node.rcAnimTimeout = null;\n }\n\n clearBrowserBugTimeout(node);\n\n node.classList.remove(className);\n node.classList.remove(activeClassName);\n\n Event.removeEndEventListener(node, node.rcEndListener);\n node.rcEndListener = null;\n\n // Usually this optional end is used for informing an owner of\n // a leave animation and telling it to remove the child.\n if (end) {\n end();\n }\n };\n\n Event.addEndEventListener(node, node.rcEndListener);\n\n if (start) {\n start();\n }\n node.classList.add(className);\n\n node.rcAnimTimeout = setTimeout(function () {\n node.rcAnimTimeout = null;\n node.classList.add(activeClassName);\n if (active) {\n active();\n }\n fixBrowserByTimeout(node);\n }, 0);\n\n return {\n stop: function stop() {\n if (node.rcEndListener) {\n node.rcEndListener();\n }\n }\n };\n};\n\ncssAnimation.style = function (node, style, callback) {\n if (node.rcEndListener) {\n node.rcEndListener();\n }\n\n node.rcEndListener = function (e) {\n if (e && e.target !== node) {\n return;\n }\n\n if (node.rcAnimTimeout) {\n clearTimeout(node.rcAnimTimeout);\n node.rcAnimTimeout = null;\n }\n\n clearBrowserBugTimeout(node);\n\n Event.removeEndEventListener(node, node.rcEndListener);\n node.rcEndListener = null;\n\n // Usually this optional callback is used for informing an owner of\n // a leave animation and telling it to remove the child.\n if (callback) {\n callback();\n }\n };\n\n Event.addEndEventListener(node, node.rcEndListener);\n\n node.rcAnimTimeout = setTimeout(function () {\n for (var s in style) {\n if (style.hasOwnProperty(s)) {\n node.style[s] = style[s];\n }\n }\n node.rcAnimTimeout = null;\n fixBrowserByTimeout(node);\n }, 0);\n};\n\ncssAnimation.setTransition = function (node, p, value) {\n var property = p;\n var v = value;\n if (value === undefined) {\n v = property;\n property = '';\n }\n property = property || '';\n capitalPrefixes.forEach(function (prefix) {\n node.style[prefix + 'Transition' + property] = v;\n });\n};\n\ncssAnimation.isCssAnimationSupported = isCssAnimationSupported;\n\nexport { isCssAnimationSupported };\n\nexport default cssAnimation;","var util = {\n isAppearSupported: function isAppearSupported(props) {\n return props.transitionName && props.transitionAppear || props.animation.appear;\n },\n isEnterSupported: function isEnterSupported(props) {\n return props.transitionName && props.transitionEnter || props.animation.enter;\n },\n isLeaveSupported: function isLeaveSupported(props) {\n return props.transitionName && props.transitionLeave || props.animation.leave;\n },\n allowAppearCallback: function allowAppearCallback(props) {\n return props.transitionAppear || props.animation.appear;\n },\n allowEnterCallback: function allowEnterCallback(props) {\n return props.transitionEnter || props.animation.enter;\n },\n allowLeaveCallback: function allowLeaveCallback(props) {\n return props.transitionLeave || props.animation.leave;\n }\n};\nexport default util;","var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint react/prop-types: 0 */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport cssAnimate, { isCssAnimationSupported } from '@ant-design/css-animation';\nimport animUtil from './util/animate';\n\nvar transitionMap = {\n enter: 'transitionEnter',\n appear: 'transitionAppear',\n leave: 'transitionLeave'\n};\n\nvar AnimateChild = function (_React$Component) {\n _inherits(AnimateChild, _React$Component);\n\n function AnimateChild() {\n _classCallCheck(this, AnimateChild);\n\n return _possibleConstructorReturn(this, (AnimateChild.__proto__ || Object.getPrototypeOf(AnimateChild)).apply(this, arguments));\n }\n\n _createClass(AnimateChild, [{\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n this.stop();\n }\n }, {\n key: 'componentWillEnter',\n value: function componentWillEnter(done) {\n if (animUtil.isEnterSupported(this.props)) {\n this.transition('enter', done);\n } else {\n done();\n }\n }\n }, {\n key: 'componentWillAppear',\n value: function componentWillAppear(done) {\n if (animUtil.isAppearSupported(this.props)) {\n this.transition('appear', done);\n } else {\n done();\n }\n }\n }, {\n key: 'componentWillLeave',\n value: function componentWillLeave(done) {\n if (animUtil.isLeaveSupported(this.props)) {\n this.transition('leave', done);\n } else {\n // always sync, do not interupt with react component life cycle\n // update hidden -> animate hidden ->\n // didUpdate -> animate leave -> unmount (if animate is none)\n done();\n }\n }\n }, {\n key: 'transition',\n value: function transition(animationType, finishCallback) {\n var _this2 = this;\n\n var node = ReactDOM.findDOMNode(this);\n var props = this.props;\n var transitionName = props.transitionName;\n var nameIsObj = typeof transitionName === 'object';\n this.stop();\n var end = function end() {\n _this2.stopper = null;\n finishCallback();\n };\n if ((isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {\n var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;\n var activeName = name + '-active';\n if (nameIsObj && transitionName[animationType + 'Active']) {\n activeName = transitionName[animationType + 'Active'];\n }\n this.stopper = cssAnimate(node, {\n name: name,\n active: activeName\n }, end);\n } else {\n this.stopper = props.animation[animationType](node, end);\n }\n }\n }, {\n key: 'stop',\n value: function stop() {\n var stopper = this.stopper;\n if (stopper) {\n this.stopper = null;\n stopper.stop();\n }\n }\n }, {\n key: 'render',\n value: function render() {\n return this.props.children;\n }\n }]);\n\n return AnimateChild;\n}(React.Component);\n\nexport default AnimateChild;","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/* eslint react/prop-types: 0 */\nimport React from 'react';\nimport unsafeLifecyclesPolyfill from 'rc-util/es/unsafeLifecyclesPolyfill';\nimport { toArrayChildren, mergeChildren, findShownChildInChildrenByKey, findChildInChildrenByKey, isSameChildren } from './ChildrenUtils';\nimport AnimateChild from './AnimateChild';\nimport animUtil from './util/animate';\n\nvar defaultKey = 'rc_animate_' + Date.now();\n\nfunction getChildrenFromProps(props) {\n var children = props.children;\n if (React.isValidElement(children)) {\n if (!children.key) {\n return React.cloneElement(children, {\n key: defaultKey\n });\n }\n }\n return children;\n}\n\nfunction noop() {}\n\nvar Animate = function (_React$Component) {\n _inherits(Animate, _React$Component);\n\n function Animate(props) {\n _classCallCheck(this, Animate);\n\n var _this = _possibleConstructorReturn(this, (Animate.__proto__ || Object.getPrototypeOf(Animate)).call(this, props));\n\n _initialiseProps.call(_this);\n\n _this.currentlyAnimatingKeys = {};\n _this.keysToEnter = [];\n _this.keysToLeave = [];\n\n _this.state = {\n children: toArrayChildren(getChildrenFromProps(props))\n };\n\n _this.childrenRefs = {};\n return _this;\n } // eslint-disable-line\n\n _createClass(Animate, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n var _this2 = this;\n\n var showProp = this.props.showProp;\n var children = this.state.children;\n if (showProp) {\n children = children.filter(function (child) {\n return !!child.props[showProp];\n });\n }\n children.forEach(function (child) {\n if (child) {\n _this2.performAppear(child.key);\n }\n });\n }\n }, {\n key: 'componentWillReceiveProps',\n value: function componentWillReceiveProps(nextProps) {\n var _this3 = this;\n\n this.nextProps = nextProps;\n var nextChildren = toArrayChildren(getChildrenFromProps(nextProps));\n var props = this.props;\n // exclusive needs immediate response\n if (props.exclusive) {\n Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {\n _this3.stop(key);\n });\n }\n var showProp = props.showProp;\n var currentlyAnimatingKeys = this.currentlyAnimatingKeys;\n // last props children if exclusive\n var currentChildren = props.exclusive ? toArrayChildren(getChildrenFromProps(props)) : this.state.children;\n // in case destroy in showProp mode\n var newChildren = [];\n if (showProp) {\n currentChildren.forEach(function (currentChild) {\n var nextChild = currentChild && findChildInChildrenByKey(nextChildren, currentChild.key);\n var newChild = void 0;\n if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) {\n newChild = React.cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true));\n } else {\n newChild = nextChild;\n }\n if (newChild) {\n newChildren.push(newChild);\n }\n });\n nextChildren.forEach(function (nextChild) {\n if (!nextChild || !findChildInChildrenByKey(currentChildren, nextChild.key)) {\n newChildren.push(nextChild);\n }\n });\n } else {\n newChildren = mergeChildren(currentChildren, nextChildren);\n }\n\n // need render to avoid update\n this.setState({\n children: newChildren\n });\n\n nextChildren.forEach(function (child) {\n var key = child && child.key;\n if (child && currentlyAnimatingKeys[key]) {\n return;\n }\n var hasPrev = child && findChildInChildrenByKey(currentChildren, key);\n if (showProp) {\n var showInNext = child.props[showProp];\n if (hasPrev) {\n var showInNow = findShownChildInChildrenByKey(currentChildren, key, showProp);\n if (!showInNow && showInNext) {\n _this3.keysToEnter.push(key);\n }\n } else if (showInNext) {\n _this3.keysToEnter.push(key);\n }\n } else if (!hasPrev) {\n _this3.keysToEnter.push(key);\n }\n });\n\n currentChildren.forEach(function (child) {\n var key = child && child.key;\n if (child && currentlyAnimatingKeys[key]) {\n return;\n }\n var hasNext = child && findChildInChildrenByKey(nextChildren, key);\n if (showProp) {\n var showInNow = child.props[showProp];\n if (hasNext) {\n var showInNext = findShownChildInChildrenByKey(nextChildren, key, showProp);\n if (!showInNext && showInNow) {\n _this3.keysToLeave.push(key);\n }\n } else if (showInNow) {\n _this3.keysToLeave.push(key);\n }\n } else if (!hasNext) {\n _this3.keysToLeave.push(key);\n }\n });\n }\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate() {\n var keysToEnter = this.keysToEnter;\n this.keysToEnter = [];\n keysToEnter.forEach(this.performEnter);\n var keysToLeave = this.keysToLeave;\n this.keysToLeave = [];\n keysToLeave.forEach(this.performLeave);\n }\n }, {\n key: 'isValidChildByKey',\n value: function isValidChildByKey(currentChildren, key) {\n var showProp = this.props.showProp;\n if (showProp) {\n return findShownChildInChildrenByKey(currentChildren, key, showProp);\n }\n return findChildInChildrenByKey(currentChildren, key);\n }\n }, {\n key: 'stop',\n value: function stop(key) {\n delete this.currentlyAnimatingKeys[key];\n var component = this.childrenRefs[key];\n if (component) {\n component.stop();\n }\n }\n }, {\n key: 'render',\n value: function render() {\n var _this4 = this;\n\n var props = this.props;\n this.nextProps = props;\n var stateChildren = this.state.children;\n var children = null;\n if (stateChildren) {\n children = stateChildren.map(function (child) {\n if (child === null || child === undefined) {\n return child;\n }\n if (!child.key) {\n throw new Error('must set key for children');\n }\n return React.createElement(\n AnimateChild,\n {\n key: child.key,\n ref: function ref(node) {\n _this4.childrenRefs[child.key] = node;\n },\n animation: props.animation,\n transitionName: props.transitionName,\n transitionEnter: props.transitionEnter,\n transitionAppear: props.transitionAppear,\n transitionLeave: props.transitionLeave\n },\n child\n );\n });\n }\n var Component = props.component;\n if (Component) {\n var passedProps = props;\n if (typeof Component === 'string') {\n passedProps = _extends({\n className: props.className,\n style: props.style\n }, props.componentProps);\n }\n return React.createElement(\n Component,\n passedProps,\n children\n );\n }\n return children[0] || null;\n }\n }]);\n\n return Animate;\n}(React.Component);\n\nAnimate.isAnimate = true;\nAnimate.defaultProps = {\n animation: {},\n component: 'span',\n componentProps: {},\n transitionEnter: true,\n transitionLeave: true,\n transitionAppear: false,\n onEnd: noop,\n onEnter: noop,\n onLeave: noop,\n onAppear: noop\n};\n\nvar _initialiseProps = function _initialiseProps() {\n var _this5 = this;\n\n this.performEnter = function (key) {\n // may already remove by exclusive\n if (_this5.childrenRefs[key]) {\n _this5.currentlyAnimatingKeys[key] = true;\n _this5.childrenRefs[key].componentWillEnter(_this5.handleDoneAdding.bind(_this5, key, 'enter'));\n }\n };\n\n this.performAppear = function (key) {\n if (_this5.childrenRefs[key]) {\n _this5.currentlyAnimatingKeys[key] = true;\n _this5.childrenRefs[key].componentWillAppear(_this5.handleDoneAdding.bind(_this5, key, 'appear'));\n }\n };\n\n this.handleDoneAdding = function (key, type) {\n var props = _this5.props;\n delete _this5.currentlyAnimatingKeys[key];\n // if update on exclusive mode, skip check\n if (props.exclusive && props !== _this5.nextProps) {\n return;\n }\n var currentChildren = toArrayChildren(getChildrenFromProps(props));\n if (!_this5.isValidChildByKey(currentChildren, key)) {\n // exclusive will not need this\n _this5.performLeave(key);\n } else if (type === 'appear') {\n if (animUtil.allowAppearCallback(props)) {\n props.onAppear(key);\n props.onEnd(key, true);\n }\n } else if (animUtil.allowEnterCallback(props)) {\n props.onEnter(key);\n props.onEnd(key, true);\n }\n };\n\n this.performLeave = function (key) {\n // may already remove by exclusive\n if (_this5.childrenRefs[key]) {\n _this5.currentlyAnimatingKeys[key] = true;\n _this5.childrenRefs[key].componentWillLeave(_this5.handleDoneLeaving.bind(_this5, key));\n }\n };\n\n this.handleDoneLeaving = function (key) {\n var props = _this5.props;\n delete _this5.currentlyAnimatingKeys[key];\n // if update on exclusive mode, skip check\n if (props.exclusive && props !== _this5.nextProps) {\n return;\n }\n var currentChildren = toArrayChildren(getChildrenFromProps(props));\n // in case state change is too fast\n if (_this5.isValidChildByKey(currentChildren, key)) {\n _this5.performEnter(key);\n } else {\n var end = function end() {\n if (animUtil.allowLeaveCallback(props)) {\n props.onLeave(key);\n props.onEnd(key, false);\n }\n };\n if (!isSameChildren(_this5.state.children, currentChildren, props.showProp)) {\n _this5.setState({\n children: currentChildren\n }, end);\n } else {\n end();\n }\n }\n };\n};\n\nexport default unsafeLifecyclesPolyfill(Animate);","import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';\nimport _classCallCheck from 'babel-runtime/helpers/classCallCheck';\nimport _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';\nimport _inherits from 'babel-runtime/helpers/inherits';\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nvar LazyRenderBox = function (_Component) {\n _inherits(LazyRenderBox, _Component);\n\n function LazyRenderBox() {\n _classCallCheck(this, LazyRenderBox);\n\n return _possibleConstructorReturn(this, _Component.apply(this, arguments));\n }\n\n LazyRenderBox.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n return nextProps.hiddenClassName || nextProps.visible;\n };\n\n LazyRenderBox.prototype.render = function render() {\n var _props = this.props,\n hiddenClassName = _props.hiddenClassName,\n visible = _props.visible,\n props = _objectWithoutProperties(_props, ['hiddenClassName', 'visible']);\n\n if (hiddenClassName || React.Children.count(props.children) > 1) {\n if (!visible && hiddenClassName) {\n props.className += ' ' + hiddenClassName;\n }\n return React.createElement('div', props);\n }\n\n return React.Children.only(props.children);\n };\n\n return LazyRenderBox;\n}(Component);\n\nLazyRenderBox.propTypes = {\n children: PropTypes.any,\n className: PropTypes.string,\n visible: PropTypes.bool,\n hiddenClassName: PropTypes.string\n};\n\n\nexport default LazyRenderBox;","import _classCallCheck from 'babel-runtime/helpers/classCallCheck';\nimport _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';\nimport _inherits from 'babel-runtime/helpers/inherits';\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport LazyRenderBox from './LazyRenderBox';\n\nvar PopupInner = function (_Component) {\n _inherits(PopupInner, _Component);\n\n function PopupInner() {\n _classCallCheck(this, PopupInner);\n\n return _possibleConstructorReturn(this, _Component.apply(this, arguments));\n }\n\n PopupInner.prototype.render = function render() {\n var props = this.props;\n var className = props.className;\n if (!props.visible) {\n className += ' ' + props.hiddenClassName;\n }\n return React.createElement(\n 'div',\n {\n className: className,\n onMouseEnter: props.onMouseEnter,\n onMouseLeave: props.onMouseLeave,\n style: props.style\n },\n React.createElement(\n LazyRenderBox,\n { className: props.prefixCls + '-content', visible: props.visible },\n props.children\n )\n );\n };\n\n return PopupInner;\n}(Component);\n\nPopupInner.propTypes = {\n hiddenClassName: PropTypes.string,\n className: PropTypes.string,\n prefixCls: PropTypes.string,\n onMouseEnter: PropTypes.func,\n onMouseLeave: PropTypes.func,\n children: PropTypes.any\n};\n\n\nexport default PopupInner;","import _extends from 'babel-runtime/helpers/extends';\nfunction isPointsEq(a1, a2, isAlignPoint) {\n if (isAlignPoint) {\n return a1[0] === a2[0];\n }\n return a1[0] === a2[0] && a1[1] === a2[1];\n}\n\nexport function getAlignFromPlacement(builtinPlacements, placementStr, align) {\n var baseAlign = builtinPlacements[placementStr] || {};\n return _extends({}, baseAlign, align);\n}\n\nexport function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {\n var points = align.points;\n for (var placement in builtinPlacements) {\n if (builtinPlacements.hasOwnProperty(placement)) {\n if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {\n return prefixCls + '-placement-' + placement;\n }\n }\n }\n return '';\n}\n\nexport function saveRef(name, component) {\n this[name] = component;\n}","import _extends from 'babel-runtime/helpers/extends';\nimport _classCallCheck from 'babel-runtime/helpers/classCallCheck';\nimport _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';\nimport _inherits from 'babel-runtime/helpers/inherits';\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport Align from 'rc-align';\nimport Animate from 'rc-animate';\nimport raf from 'raf';\nimport PopupInner from './PopupInner';\nimport LazyRenderBox from './LazyRenderBox';\nimport { saveRef } from './utils';\n\nvar Popup = function (_Component) {\n _inherits(Popup, _Component);\n\n function Popup(props) {\n _classCallCheck(this, Popup);\n\n var _this = _possibleConstructorReturn(this, _Component.call(this, props));\n\n _initialiseProps.call(_this);\n\n _this.state = {\n // Used for stretch\n stretchChecked: false,\n targetWidth: undefined,\n targetHeight: undefined\n };\n\n _this.savePopupRef = saveRef.bind(_this, 'popupInstance');\n _this.saveAlignRef = saveRef.bind(_this, 'alignInstance');\n return _this;\n }\n\n Popup.prototype.componentDidMount = function componentDidMount() {\n this.rootNode = this.getPopupDomNode();\n this.setStretchSize();\n };\n\n Popup.prototype.componentDidUpdate = function componentDidUpdate() {\n this.setStretchSize();\n };\n\n // Record size if stretch needed\n\n\n Popup.prototype.getPopupDomNode = function getPopupDomNode() {\n return ReactDOM.findDOMNode(this.popupInstance);\n };\n\n // `target` on `rc-align` can accept as a function to get the bind element or a point.\n // ref: https://www.npmjs.com/package/rc-align\n\n\n Popup.prototype.getMaskTransitionName = function getMaskTransitionName() {\n var props = this.props;\n var transitionName = props.maskTransitionName;\n var animation = props.maskAnimation;\n if (!transitionName && animation) {\n transitionName = props.prefixCls + '-' + animation;\n }\n return transitionName;\n };\n\n Popup.prototype.getTransitionName = function getTransitionName() {\n var props = this.props;\n var transitionName = props.transitionName;\n if (!transitionName && props.animation) {\n transitionName = props.prefixCls + '-' + props.animation;\n }\n return transitionName;\n };\n\n Popup.prototype.getClassName = function getClassName(currentAlignClassName) {\n return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName;\n };\n\n Popup.prototype.getPopupElement = function getPopupElement() {\n var _this2 = this;\n\n var savePopupRef = this.savePopupRef;\n var _state = this.state,\n stretchChecked = _state.stretchChecked,\n targetHeight = _state.targetHeight,\n targetWidth = _state.targetWidth;\n var _props = this.props,\n align = _props.align,\n visible = _props.visible,\n prefixCls = _props.prefixCls,\n style = _props.style,\n getClassNameFromAlign = _props.getClassNameFromAlign,\n destroyPopupOnHide = _props.destroyPopupOnHide,\n stretch = _props.stretch,\n children = _props.children,\n onMouseEnter = _props.onMouseEnter,\n onMouseLeave = _props.onMouseLeave;\n\n var className = this.getClassName(this.currentAlignClassName || getClassNameFromAlign(align));\n var hiddenClassName = prefixCls + '-hidden';\n\n if (!visible) {\n this.currentAlignClassName = null;\n }\n\n var sizeStyle = {};\n if (stretch) {\n // Stretch with target\n if (stretch.indexOf('height') !== -1) {\n sizeStyle.height = targetHeight;\n } else if (stretch.indexOf('minHeight') !== -1) {\n sizeStyle.minHeight = targetHeight;\n }\n if (stretch.indexOf('width') !== -1) {\n sizeStyle.width = targetWidth;\n } else if (stretch.indexOf('minWidth') !== -1) {\n sizeStyle.minWidth = targetWidth;\n }\n\n // Delay force align to makes ui smooth\n if (!stretchChecked) {\n sizeStyle.visibility = 'hidden';\n raf(function () {\n if (_this2.alignInstance) {\n _this2.alignInstance.forceAlign();\n }\n });\n }\n }\n\n var newStyle = _extends({}, sizeStyle, style, this.getZIndexStyle());\n\n var popupInnerProps = {\n className: className,\n prefixCls: prefixCls,\n ref: savePopupRef,\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n style: newStyle\n };\n\n if (destroyPopupOnHide) {\n return React.createElement(\n Animate,\n {\n component: '',\n exclusive: true,\n transitionAppear: true,\n transitionName: this.getTransitionName(),\n onLeave: this.onAnimateLeaved\n },\n visible ? React.createElement(\n Align,\n {\n target: this.getAlignTarget(),\n key: 'popup',\n ref: this.saveAlignRef,\n monitorWindowResize: true,\n align: align,\n onAlign: this.onAlign\n },\n React.createElement(\n PopupInner,\n _extends({\n visible: true\n }, popupInnerProps),\n children\n )\n ) : null\n );\n }\n\n return React.createElement(\n Animate,\n {\n component: '',\n exclusive: true,\n transitionAppear: true,\n transitionName: this.getTransitionName(),\n showProp: 'xVisible',\n onLeave: this.onAnimateLeaved\n },\n React.createElement(\n Align,\n {\n target: this.getAlignTarget(),\n key: 'popup',\n ref: this.saveAlignRef,\n monitorWindowResize: true,\n xVisible: visible,\n childrenProps: { visible: 'xVisible' },\n disabled: !visible,\n align: align,\n onAlign: this.onAlign\n },\n React.createElement(\n PopupInner,\n _extends({\n hiddenClassName: hiddenClassName\n }, popupInnerProps),\n children\n )\n )\n );\n };\n\n Popup.prototype.getZIndexStyle = function getZIndexStyle() {\n var style = {};\n var props = this.props;\n if (props.zIndex !== undefined) {\n style.zIndex = props.zIndex;\n }\n return style;\n };\n\n Popup.prototype.getMaskElement = function getMaskElement() {\n var props = this.props;\n var maskElement = void 0;\n if (props.mask) {\n var maskTransition = this.getMaskTransitionName();\n maskElement = React.createElement(LazyRenderBox, {\n style: this.getZIndexStyle(),\n key: 'mask',\n className: props.prefixCls + '-mask',\n hiddenClassName: props.prefixCls + '-mask-hidden',\n visible: props.visible\n });\n if (maskTransition) {\n maskElement = React.createElement(\n Animate,\n {\n key: 'mask',\n showProp: 'visible',\n transitionAppear: true,\n component: '',\n transitionName: maskTransition\n },\n maskElement\n );\n }\n }\n return maskElement;\n };\n\n Popup.prototype.render = function render() {\n return React.createElement(\n 'div',\n null,\n this.getMaskElement(),\n this.getPopupElement()\n );\n };\n\n return Popup;\n}(Component);\n\nPopup.propTypes = {\n visible: PropTypes.bool,\n style: PropTypes.object,\n getClassNameFromAlign: PropTypes.func,\n onAlign: PropTypes.func,\n getRootDomNode: PropTypes.func,\n onMouseEnter: PropTypes.func,\n align: PropTypes.any,\n destroyPopupOnHide: PropTypes.bool,\n className: PropTypes.string,\n prefixCls: PropTypes.string,\n onMouseLeave: PropTypes.func,\n stretch: PropTypes.string,\n children: PropTypes.node,\n point: PropTypes.shape({\n pageX: PropTypes.number,\n pageY: PropTypes.number\n })\n};\n\nvar _initialiseProps = function _initialiseProps() {\n var _this3 = this;\n\n this.onAlign = function (popupDomNode, align) {\n var props = _this3.props;\n var currentAlignClassName = props.getClassNameFromAlign(align);\n // FIX: https://github.com/react-component/trigger/issues/56\n // FIX: https://github.com/react-component/tooltip/issues/79\n if (_this3.currentAlignClassName !== currentAlignClassName) {\n _this3.currentAlignClassName = currentAlignClassName;\n popupDomNode.className = _this3.getClassName(currentAlignClassName);\n }\n props.onAlign(popupDomNode, align);\n };\n\n this.onAnimateLeaved = function () {\n var stretch = _this3.props.stretch;\n var stretchChecked = _this3.state.stretchChecked;\n\n if (stretch && stretchChecked) {\n _this3.setState({ stretchChecked: false });\n }\n };\n\n this.setStretchSize = function () {\n var getRootDomNode = _this3.props.getRootDomNode;\n var _state2 = _this3.state,\n stretchChecked = _state2.stretchChecked,\n targetHeight = _state2.targetHeight,\n targetWidth = _state2.targetWidth;\n\n\n var $ele = getRootDomNode();\n if (!$ele) return;\n\n var height = $ele.offsetHeight;\n var width = $ele.offsetWidth;\n\n if (targetHeight !== height || targetWidth !== width || !stretchChecked) {\n _this3.setState({\n stretchChecked: true,\n targetHeight: height,\n targetWidth: width\n });\n }\n };\n\n this.getTargetElement = function () {\n return _this3.props.getRootDomNode();\n };\n\n this.getAlignTarget = function () {\n var point = _this3.props.point;\n\n if (point) {\n return point;\n }\n return _this3.getTargetElement;\n };\n};\n\nexport default Popup;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\n\nvar ContainerRender = /*#__PURE__*/function (_React$Component) {\n _inherits(ContainerRender, _React$Component);\n\n var _super = _createSuper(ContainerRender);\n\n function ContainerRender() {\n var _this;\n\n _classCallCheck(this, ContainerRender);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _this.removeContainer = function () {\n if (_this.container) {\n ReactDOM.unmountComponentAtNode(_this.container);\n\n _this.container.parentNode.removeChild(_this.container);\n\n _this.container = null;\n }\n };\n\n _this.renderComponent = function (props, ready) {\n var _this$props = _this.props,\n visible = _this$props.visible,\n getComponent = _this$props.getComponent,\n forceRender = _this$props.forceRender,\n getContainer = _this$props.getContainer,\n parent = _this$props.parent;\n\n if (visible || parent._component || forceRender) {\n if (!_this.container) {\n _this.container = getContainer();\n }\n\n ReactDOM.unstable_renderSubtreeIntoContainer(parent, getComponent(props), _this.container, function callback() {\n if (ready) {\n ready.call(this);\n }\n });\n }\n };\n\n return _this;\n }\n\n _createClass(ContainerRender, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (this.props.autoMount) {\n this.renderComponent();\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n if (this.props.autoMount) {\n this.renderComponent();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.props.autoDestroy) {\n this.removeContainer();\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return this.props.children({\n renderComponent: this.renderComponent,\n removeContainer: this.removeContainer\n });\n }\n }]);\n\n return ContainerRender;\n}(React.Component);\n\nContainerRender.propTypes = {\n autoMount: PropTypes.bool,\n autoDestroy: PropTypes.bool,\n visible: PropTypes.bool,\n forceRender: PropTypes.bool,\n parent: PropTypes.any,\n getComponent: PropTypes.func.isRequired,\n getContainer: PropTypes.func.isRequired,\n children: PropTypes.func.isRequired\n};\nContainerRender.defaultProps = {\n autoMount: true,\n autoDestroy: true,\n forceRender: false\n};\nexport { ContainerRender as default };","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\n\nvar Portal = /*#__PURE__*/function (_React$Component) {\n _inherits(Portal, _React$Component);\n\n var _super = _createSuper(Portal);\n\n function Portal() {\n _classCallCheck(this, Portal);\n\n return _super.apply(this, arguments);\n }\n\n _createClass(Portal, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.createContainer();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var didUpdate = this.props.didUpdate;\n\n if (didUpdate) {\n didUpdate(prevProps);\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.removeContainer();\n }\n }, {\n key: \"createContainer\",\n value: function createContainer() {\n this._container = this.props.getContainer();\n this.forceUpdate();\n }\n }, {\n key: \"removeContainer\",\n value: function removeContainer() {\n if (this._container) {\n this._container.parentNode.removeChild(this._container);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n if (this._container) {\n return ReactDOM.createPortal(this.props.children, this._container);\n }\n\n return null;\n }\n }]);\n\n return Portal;\n}(React.Component);\n\nPortal.propTypes = {\n getContainer: PropTypes.func.isRequired,\n children: PropTypes.node.isRequired,\n didUpdate: PropTypes.func\n};\nexport { Portal as default };","import _extends from 'babel-runtime/helpers/extends';\nimport _classCallCheck from 'babel-runtime/helpers/classCallCheck';\nimport _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';\nimport _inherits from 'babel-runtime/helpers/inherits';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { findDOMNode, createPortal } from 'react-dom';\nimport contains from 'rc-util/es/Dom/contains';\nimport addEventListener from 'rc-util/es/Dom/addEventListener';\nimport Popup from './Popup';\nimport { getAlignFromPlacement, getAlignPopupClassName } from './utils';\nimport ContainerRender from 'rc-util/es/ContainerRender';\nimport Portal from 'rc-util/es/Portal';\nimport classNames from 'classnames';\nimport unsafeLifecyclesPolyfill from 'rc-util/es/unsafeLifecyclesPolyfill';\n\nfunction noop() {}\n\nfunction returnEmptyString() {\n return '';\n}\n\nfunction returnDocument() {\n return window.document;\n}\n\nvar ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur', 'onContextMenu'];\n\nvar IS_REACT_16 = !!createPortal;\n\nvar Trigger = function (_React$Component) {\n _inherits(Trigger, _React$Component);\n\n function Trigger(props) {\n _classCallCheck(this, Trigger);\n\n var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));\n\n _initialiseProps.call(_this);\n\n var popupVisible = void 0;\n if ('popupVisible' in props) {\n popupVisible = !!props.popupVisible;\n } else {\n popupVisible = !!props.defaultPopupVisible;\n }\n\n _this.prevPopupVisible = popupVisible;\n\n _this.state = {\n popupVisible: popupVisible\n };\n\n ALL_HANDLERS.forEach(function (h) {\n _this['fire' + h] = function (e) {\n _this.fireEvents(h, e);\n };\n });\n return _this;\n }\n\n Trigger.prototype.componentDidMount = function componentDidMount() {\n this.componentDidUpdate({}, {\n popupVisible: this.state.popupVisible\n });\n };\n\n Trigger.prototype.componentWillReceiveProps = function componentWillReceiveProps(_ref) {\n var popupVisible = _ref.popupVisible;\n\n if (popupVisible !== undefined) {\n this.setState({\n popupVisible: popupVisible\n });\n }\n };\n\n Trigger.prototype.componentDidUpdate = function componentDidUpdate(_, prevState) {\n var props = this.props;\n var state = this.state;\n var triggerAfterPopupVisibleChange = function triggerAfterPopupVisibleChange() {\n if (prevState.popupVisible !== state.popupVisible) {\n props.afterPopupVisibleChange(state.popupVisible);\n }\n };\n if (!IS_REACT_16) {\n this.renderComponent(null, triggerAfterPopupVisibleChange);\n }\n\n this.prevPopupVisible = prevState.popupVisible;\n\n // We must listen to `mousedown` or `touchstart`, edge case:\n // https://github.com/ant-design/ant-design/issues/5804\n // https://github.com/react-component/calendar/issues/250\n // https://github.com/react-component/trigger/issues/50\n if (state.popupVisible) {\n var currentDocument = void 0;\n if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextMenuToShow())) {\n currentDocument = props.getDocument();\n this.clickOutsideHandler = addEventListener(currentDocument, 'mousedown', this.onDocumentClick);\n }\n // always hide on mobile\n if (!this.touchOutsideHandler) {\n currentDocument = currentDocument || props.getDocument();\n this.touchOutsideHandler = addEventListener(currentDocument, 'touchstart', this.onDocumentClick);\n }\n // close popup when trigger type contains 'onContextMenu' and document is scrolling.\n if (!this.contextMenuOutsideHandler1 && this.isContextMenuToShow()) {\n currentDocument = currentDocument || props.getDocument();\n this.contextMenuOutsideHandler1 = addEventListener(currentDocument, 'scroll', this.onContextMenuClose);\n }\n // close popup when trigger type contains 'onContextMenu' and window is blur.\n if (!this.contextMenuOutsideHandler2 && this.isContextMenuToShow()) {\n this.contextMenuOutsideHandler2 = addEventListener(window, 'blur', this.onContextMenuClose);\n }\n return;\n }\n\n this.clearOutsideHandler();\n };\n\n Trigger.prototype.componentWillUnmount = function componentWillUnmount() {\n this.clearDelayTimer();\n this.clearOutsideHandler();\n };\n\n Trigger.prototype.getPopupDomNode = function getPopupDomNode() {\n // for test\n if (this._component && this._component.getPopupDomNode) {\n return this._component.getPopupDomNode();\n }\n return null;\n };\n\n Trigger.prototype.getPopupAlign = function getPopupAlign() {\n var props = this.props;\n var popupPlacement = props.popupPlacement,\n popupAlign = props.popupAlign,\n builtinPlacements = props.builtinPlacements;\n\n if (popupPlacement && builtinPlacements) {\n return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);\n }\n return popupAlign;\n };\n\n /**\n * @param popupVisible Show or not the popup element\n * @param event SyntheticEvent, used for `pointAlign`\n */\n Trigger.prototype.setPopupVisible = function setPopupVisible(popupVisible, event) {\n var alignPoint = this.props.alignPoint;\n\n\n this.clearDelayTimer();\n\n if (this.state.popupVisible !== popupVisible) {\n if (!('popupVisible' in this.props)) {\n this.setState({ popupVisible: popupVisible });\n }\n this.props.onPopupVisibleChange(popupVisible);\n }\n\n // Always record the point position since mouseEnterDelay will delay the show\n if (alignPoint && event) {\n this.setPoint(event);\n }\n };\n\n Trigger.prototype.delaySetPopupVisible = function delaySetPopupVisible(visible, delayS, event) {\n var _this2 = this;\n\n var delay = delayS * 1000;\n this.clearDelayTimer();\n if (delay) {\n var point = event ? { pageX: event.pageX, pageY: event.pageY } : null;\n this.delayTimer = setTimeout(function () {\n _this2.setPopupVisible(visible, point);\n _this2.clearDelayTimer();\n }, delay);\n } else {\n this.setPopupVisible(visible, event);\n }\n };\n\n Trigger.prototype.clearDelayTimer = function clearDelayTimer() {\n if (this.delayTimer) {\n clearTimeout(this.delayTimer);\n this.delayTimer = null;\n }\n };\n\n Trigger.prototype.clearOutsideHandler = function clearOutsideHandler() {\n if (this.clickOutsideHandler) {\n this.clickOutsideHandler.remove();\n this.clickOutsideHandler = null;\n }\n\n if (this.contextMenuOutsideHandler1) {\n this.contextMenuOutsideHandler1.remove();\n this.contextMenuOutsideHandler1 = null;\n }\n\n if (this.contextMenuOutsideHandler2) {\n this.contextMenuOutsideHandler2.remove();\n this.contextMenuOutsideHandler2 = null;\n }\n\n if (this.touchOutsideHandler) {\n this.touchOutsideHandler.remove();\n this.touchOutsideHandler = null;\n }\n };\n\n Trigger.prototype.createTwoChains = function createTwoChains(event) {\n var childPros = this.props.children.props;\n var props = this.props;\n if (childPros[event] && props[event]) {\n return this['fire' + event];\n }\n return childPros[event] || props[event];\n };\n\n Trigger.prototype.isClickToShow = function isClickToShow() {\n var _props = this.props,\n action = _props.action,\n showAction = _props.showAction;\n\n return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;\n };\n\n Trigger.prototype.isContextMenuToShow = function isContextMenuToShow() {\n var _props2 = this.props,\n action = _props2.action,\n showAction = _props2.showAction;\n\n return action.indexOf('contextMenu') !== -1 || showAction.indexOf('contextMenu') !== -1;\n };\n\n Trigger.prototype.isClickToHide = function isClickToHide() {\n var _props3 = this.props,\n action = _props3.action,\n hideAction = _props3.hideAction;\n\n return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;\n };\n\n Trigger.prototype.isMouseEnterToShow = function isMouseEnterToShow() {\n var _props4 = this.props,\n action = _props4.action,\n showAction = _props4.showAction;\n\n return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;\n };\n\n Trigger.prototype.isMouseLeaveToHide = function isMouseLeaveToHide() {\n var _props5 = this.props,\n action = _props5.action,\n hideAction = _props5.hideAction;\n\n return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;\n };\n\n Trigger.prototype.isFocusToShow = function isFocusToShow() {\n var _props6 = this.props,\n action = _props6.action,\n showAction = _props6.showAction;\n\n return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;\n };\n\n Trigger.prototype.isBlurToHide = function isBlurToHide() {\n var _props7 = this.props,\n action = _props7.action,\n hideAction = _props7.hideAction;\n\n return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;\n };\n\n Trigger.prototype.forcePopupAlign = function forcePopupAlign() {\n if (this.state.popupVisible && this._component && this._component.alignInstance) {\n this._component.alignInstance.forceAlign();\n }\n };\n\n Trigger.prototype.fireEvents = function fireEvents(type, e) {\n var childCallback = this.props.children.props[type];\n if (childCallback) {\n childCallback(e);\n }\n var callback = this.props[type];\n if (callback) {\n callback(e);\n }\n };\n\n Trigger.prototype.close = function close() {\n this.setPopupVisible(false);\n };\n\n Trigger.prototype.render = function render() {\n var _this3 = this;\n\n var popupVisible = this.state.popupVisible;\n var _props8 = this.props,\n children = _props8.children,\n forceRender = _props8.forceRender,\n alignPoint = _props8.alignPoint,\n className = _props8.className;\n\n var child = React.Children.only(children);\n var newChildProps = { key: 'trigger' };\n\n if (this.isContextMenuToShow()) {\n newChildProps.onContextMenu = this.onContextMenu;\n } else {\n newChildProps.onContextMenu = this.createTwoChains('onContextMenu');\n }\n\n if (this.isClickToHide() || this.isClickToShow()) {\n newChildProps.onClick = this.onClick;\n newChildProps.onMouseDown = this.onMouseDown;\n newChildProps.onTouchStart = this.onTouchStart;\n } else {\n newChildProps.onClick = this.createTwoChains('onClick');\n newChildProps.onMouseDown = this.createTwoChains('onMouseDown');\n newChildProps.onTouchStart = this.createTwoChains('onTouchStart');\n }\n if (this.isMouseEnterToShow()) {\n newChildProps.onMouseEnter = this.onMouseEnter;\n if (alignPoint) {\n newChildProps.onMouseMove = this.onMouseMove;\n }\n } else {\n newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');\n }\n if (this.isMouseLeaveToHide()) {\n newChildProps.onMouseLeave = this.onMouseLeave;\n } else {\n newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');\n }\n if (this.isFocusToShow() || this.isBlurToHide()) {\n newChildProps.onFocus = this.onFocus;\n newChildProps.onBlur = this.onBlur;\n } else {\n newChildProps.onFocus = this.createTwoChains('onFocus');\n newChildProps.onBlur = this.createTwoChains('onBlur');\n }\n\n var childrenClassName = classNames(child && child.props && child.props.className, className);\n if (childrenClassName) {\n newChildProps.className = childrenClassName;\n }\n var trigger = React.cloneElement(child, newChildProps);\n\n if (!IS_REACT_16) {\n return React.createElement(\n ContainerRender,\n {\n parent: this,\n visible: popupVisible,\n autoMount: false,\n forceRender: forceRender,\n getComponent: this.getComponent,\n getContainer: this.getContainer\n },\n function (_ref2) {\n var renderComponent = _ref2.renderComponent;\n\n _this3.renderComponent = renderComponent;\n return trigger;\n }\n );\n }\n\n var portal = void 0;\n // prevent unmounting after it's rendered\n if (popupVisible || this._component || forceRender) {\n portal = React.createElement(\n Portal,\n {\n key: 'portal',\n getContainer: this.getContainer,\n didUpdate: this.handlePortalUpdate\n },\n this.getComponent()\n );\n }\n\n return [trigger, portal];\n };\n\n return Trigger;\n}(React.Component);\n\nTrigger.propTypes = {\n children: PropTypes.any,\n action: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),\n showAction: PropTypes.any,\n hideAction: PropTypes.any,\n getPopupClassNameFromAlign: PropTypes.any,\n onPopupVisibleChange: PropTypes.func,\n afterPopupVisibleChange: PropTypes.func,\n popup: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,\n popupStyle: PropTypes.object,\n prefixCls: PropTypes.string,\n popupClassName: PropTypes.string,\n className: PropTypes.string,\n popupPlacement: PropTypes.string,\n builtinPlacements: PropTypes.object,\n popupTransitionName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n popupAnimation: PropTypes.any,\n mouseEnterDelay: PropTypes.number,\n mouseLeaveDelay: PropTypes.number,\n zIndex: PropTypes.number,\n focusDelay: PropTypes.number,\n blurDelay: PropTypes.number,\n getPopupContainer: PropTypes.func,\n getDocument: PropTypes.func,\n forceRender: PropTypes.bool,\n destroyPopupOnHide: PropTypes.bool,\n mask: PropTypes.bool,\n maskClosable: PropTypes.bool,\n onPopupAlign: PropTypes.func,\n popupAlign: PropTypes.object,\n popupVisible: PropTypes.bool,\n defaultPopupVisible: PropTypes.bool,\n maskTransitionName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n maskAnimation: PropTypes.string,\n stretch: PropTypes.string,\n alignPoint: PropTypes.bool // Maybe we can support user pass position in the future\n};\nTrigger.defaultProps = {\n prefixCls: 'rc-trigger-popup',\n getPopupClassNameFromAlign: returnEmptyString,\n getDocument: returnDocument,\n onPopupVisibleChange: noop,\n afterPopupVisibleChange: noop,\n onPopupAlign: noop,\n popupClassName: '',\n mouseEnterDelay: 0,\n mouseLeaveDelay: 0.1,\n focusDelay: 0,\n blurDelay: 0.15,\n popupStyle: {},\n destroyPopupOnHide: false,\n popupAlign: {},\n defaultPopupVisible: false,\n mask: false,\n maskClosable: true,\n action: [],\n showAction: [],\n hideAction: []\n};\n\nvar _initialiseProps = function _initialiseProps() {\n var _this4 = this;\n\n this.onMouseEnter = function (e) {\n var mouseEnterDelay = _this4.props.mouseEnterDelay;\n\n _this4.fireEvents('onMouseEnter', e);\n _this4.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e);\n };\n\n this.onMouseMove = function (e) {\n _this4.fireEvents('onMouseMove', e);\n _this4.setPoint(e);\n };\n\n this.onMouseLeave = function (e) {\n _this4.fireEvents('onMouseLeave', e);\n _this4.delaySetPopupVisible(false, _this4.props.mouseLeaveDelay);\n };\n\n this.onPopupMouseEnter = function () {\n _this4.clearDelayTimer();\n };\n\n this.onPopupMouseLeave = function (e) {\n // https://github.com/react-component/trigger/pull/13\n // react bug?\n if (e.relatedTarget && !e.relatedTarget.setTimeout && _this4._component && _this4._component.getPopupDomNode && contains(_this4._component.getPopupDomNode(), e.relatedTarget)) {\n return;\n }\n _this4.delaySetPopupVisible(false, _this4.props.mouseLeaveDelay);\n };\n\n this.onFocus = function (e) {\n _this4.fireEvents('onFocus', e);\n // incase focusin and focusout\n _this4.clearDelayTimer();\n if (_this4.isFocusToShow()) {\n _this4.focusTime = Date.now();\n _this4.delaySetPopupVisible(true, _this4.props.focusDelay);\n }\n };\n\n this.onMouseDown = function (e) {\n _this4.fireEvents('onMouseDown', e);\n _this4.preClickTime = Date.now();\n };\n\n this.onTouchStart = function (e) {\n _this4.fireEvents('onTouchStart', e);\n _this4.preTouchTime = Date.now();\n };\n\n this.onBlur = function (e) {\n _this4.fireEvents('onBlur', e);\n _this4.clearDelayTimer();\n if (_this4.isBlurToHide()) {\n _this4.delaySetPopupVisible(false, _this4.props.blurDelay);\n }\n };\n\n this.onContextMenu = function (e) {\n e.preventDefault();\n _this4.fireEvents('onContextMenu', e);\n _this4.setPopupVisible(true, e);\n };\n\n this.onContextMenuClose = function () {\n if (_this4.isContextMenuToShow()) {\n _this4.close();\n }\n };\n\n this.onClick = function (event) {\n _this4.fireEvents('onClick', event);\n // focus will trigger click\n if (_this4.focusTime) {\n var preTime = void 0;\n if (_this4.preClickTime && _this4.preTouchTime) {\n preTime = Math.min(_this4.preClickTime, _this4.preTouchTime);\n } else if (_this4.preClickTime) {\n preTime = _this4.preClickTime;\n } else if (_this4.preTouchTime) {\n preTime = _this4.preTouchTime;\n }\n if (Math.abs(preTime - _this4.focusTime) < 20) {\n return;\n }\n _this4.focusTime = 0;\n }\n _this4.preClickTime = 0;\n _this4.preTouchTime = 0;\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n var nextVisible = !_this4.state.popupVisible;\n if (_this4.isClickToHide() && !nextVisible || nextVisible && _this4.isClickToShow()) {\n _this4.setPopupVisible(!_this4.state.popupVisible, event);\n }\n };\n\n this.onDocumentClick = function (event) {\n if (_this4.props.mask && !_this4.props.maskClosable) {\n return;\n }\n var target = event.target;\n var root = findDOMNode(_this4);\n var popupNode = _this4.getPopupDomNode();\n if (!contains(root, target) && !contains(popupNode, target)) {\n _this4.close();\n }\n };\n\n this.getRootDomNode = function () {\n return findDOMNode(_this4);\n };\n\n this.getPopupClassNameFromAlign = function (align) {\n var className = [];\n var _props9 = _this4.props,\n popupPlacement = _props9.popupPlacement,\n builtinPlacements = _props9.builtinPlacements,\n prefixCls = _props9.prefixCls,\n alignPoint = _props9.alignPoint,\n getPopupClassNameFromAlign = _props9.getPopupClassNameFromAlign;\n\n if (popupPlacement && builtinPlacements) {\n className.push(getAlignPopupClassName(builtinPlacements, prefixCls, align, alignPoint));\n }\n if (getPopupClassNameFromAlign) {\n className.push(getPopupClassNameFromAlign(align));\n }\n return className.join(' ');\n };\n\n this.getComponent = function () {\n var _props10 = _this4.props,\n prefixCls = _props10.prefixCls,\n destroyPopupOnHide = _props10.destroyPopupOnHide,\n popupClassName = _props10.popupClassName,\n action = _props10.action,\n onPopupAlign = _props10.onPopupAlign,\n popupAnimation = _props10.popupAnimation,\n popupTransitionName = _props10.popupTransitionName,\n popupStyle = _props10.popupStyle,\n mask = _props10.mask,\n maskAnimation = _props10.maskAnimation,\n maskTransitionName = _props10.maskTransitionName,\n zIndex = _props10.zIndex,\n popup = _props10.popup,\n stretch = _props10.stretch,\n alignPoint = _props10.alignPoint;\n var _state = _this4.state,\n popupVisible = _state.popupVisible,\n point = _state.point;\n\n\n var align = _this4.getPopupAlign();\n\n var mouseProps = {};\n if (_this4.isMouseEnterToShow()) {\n mouseProps.onMouseEnter = _this4.onPopupMouseEnter;\n }\n if (_this4.isMouseLeaveToHide()) {\n mouseProps.onMouseLeave = _this4.onPopupMouseLeave;\n }\n\n return React.createElement(\n Popup,\n _extends({\n prefixCls: prefixCls,\n destroyPopupOnHide: destroyPopupOnHide,\n visible: popupVisible,\n point: alignPoint && point,\n className: popupClassName,\n action: action,\n align: align,\n onAlign: onPopupAlign,\n animation: popupAnimation,\n getClassNameFromAlign: _this4.getPopupClassNameFromAlign\n }, mouseProps, {\n stretch: stretch,\n getRootDomNode: _this4.getRootDomNode,\n style: popupStyle,\n mask: mask,\n zIndex: zIndex,\n transitionName: popupTransitionName,\n maskAnimation: maskAnimation,\n maskTransitionName: maskTransitionName,\n ref: _this4.savePopup\n }),\n typeof popup === 'function' ? popup() : popup\n );\n };\n\n this.getContainer = function () {\n var props = _this4.props;\n\n var popupContainer = document.createElement('div');\n // Make sure default popup container will never cause scrollbar appearing\n // https://github.com/react-component/trigger/issues/41\n popupContainer.style.position = 'absolute';\n popupContainer.style.top = '0';\n popupContainer.style.left = '0';\n popupContainer.style.width = '100%';\n var mountNode = props.getPopupContainer ? props.getPopupContainer(findDOMNode(_this4)) : props.getDocument().body;\n mountNode.appendChild(popupContainer);\n return popupContainer;\n };\n\n this.setPoint = function (point) {\n var alignPoint = _this4.props.alignPoint;\n\n if (!alignPoint || !point) return;\n\n _this4.setState({\n point: {\n pageX: point.pageX,\n pageY: point.pageY\n }\n });\n };\n\n this.handlePortalUpdate = function () {\n if (_this4.prevPopupVisible !== _this4.state.popupVisible) {\n _this4.props.afterPopupVisibleChange(_this4.state.popupVisible);\n }\n };\n\n this.savePopup = function (node) {\n _this4._component = node;\n };\n};\n\nexport default unsafeLifecyclesPolyfill(Trigger);","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('moment-jalaali'), require('react'), require('prop-types'), require('react-tether'), require('classnames'), require('react-onclickoutside'), require('lodash.range'), require('rc-trigger'), require('react-dom')) :\n typeof define === 'function' && define.amd ? define(['exports', 'moment-jalaali', 'react', 'prop-types', 'react-tether', 'classnames', 'react-onclickoutside', 'lodash.range', 'rc-trigger', 'react-dom'], factory) :\n (global = global || self, factory(global.DatePicker = {}, global.momentJalaali, global.React, global.PropTypes, global.TetherComponent, global.classnames, global.onClickOutside, global.range, global.Trigger, global.ReactDom));\n}(this, (function (exports, momentJalaali, React, PropTypes, TetherComponent, classnames, onClickOutside, range, Trigger, ReactDom) { 'use strict';\n\n momentJalaali = momentJalaali && Object.prototype.hasOwnProperty.call(momentJalaali, 'default') ? momentJalaali['default'] : momentJalaali;\n var React__default = 'default' in React ? React['default'] : React;\n PropTypes = PropTypes && Object.prototype.hasOwnProperty.call(PropTypes, 'default') ? PropTypes['default'] : PropTypes;\n TetherComponent = TetherComponent && Object.prototype.hasOwnProperty.call(TetherComponent, 'default') ? TetherComponent['default'] : TetherComponent;\n classnames = classnames && Object.prototype.hasOwnProperty.call(classnames, 'default') ? classnames['default'] : classnames;\n onClickOutside = onClickOutside && Object.prototype.hasOwnProperty.call(onClickOutside, 'default') ? onClickOutside['default'] : onClickOutside;\n range = range && Object.prototype.hasOwnProperty.call(range, 'default') ? range['default'] : range;\n Trigger = Trigger && Object.prototype.hasOwnProperty.call(Trigger, 'default') ? Trigger['default'] : Trigger;\n ReactDom = ReactDom && Object.prototype.hasOwnProperty.call(ReactDom, 'default') ? ReactDom['default'] : ReactDom;\n\n function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n }\n\n var css_248z = \".calendarContainer{position:relative;border-radius:4px;-webkit-box-shadow:0 3px 15px rgba(0,0,0,.2);box-shadow:0 3px 15px rgba(0,0,0,.2);width:320px;margin:auto;text-align:center;padding:15px;background-color:#fff}.calendarContainer *{-webkit-box-sizing:border-box;box-sizing:border-box}.calendarContainer .dayPickerContainer:after,.calendarContainer .daysOfWeek:after,.calendarContainer .monthsList:after{content:'';display:block;clear:both}.datepicker-input{-webkit-box-sizing:border-box;box-sizing:border-box}.calendarContainer .heading{height:auto;font-weight:700;margin-bottom:10px}.calendarContainer .heading>button{background:0 0;margin:5px 0;border:none;text-align:center;line-height:30px;width:36px;height:32px;cursor:pointer}.calendarContainer .heading>button:hover{background-color:#f2f2f2}.calendarContainer .heading svg{width:10px;fill:#777}.calendarContainer .heading .next,.calendarContainer .heading .prev{width:42px;height:42px;border-radius:50%;margin:0}.calendarContainer .heading .prev{float:right}.calendarContainer .heading .next{float:left}.calendarContainer .heading .title{height:auto;border-radius:4px;width:auto;margin:0 5px;border:1px solid #f7f7f7;text-align:center;display:inline-block;font-weight:400;padding:4px 15px 5px 15px;line-height:1.5;font-size:1.2em;max-height:none}.jalaali.calendarContainer .heading .title{padding:4px 15px 7px 15px}.calendarContainer .dayWrapper{float:left;width:14.28571429%;margin-top:5px;position:relative}.calendarContainer .dayWrapper button{border:none;background:0 0;outline:0;width:100%;cursor:pointer;width:40px;height:40px;border-radius:50%;font-size:1.1em;padding:0;line-height:1.5;padding:0 0 1px 0}.jalaali.calendarContainer .dayWrapper button{padding:0 0 1px 0}.calendarContainer .dayWrapper:not(.selected) button:hover{background-color:#d6f1ff}.calendarContainer .dayWrapper button[disabled]{color:#aaa;cursor:not-allowed;background-color:#ebebeb}.calendarContainer .dayWrapper button.selected{background-color:#337ab7;color:#fff}.calendarContainer .dayWrapper:not(.currentMonth) button{opacity:.5}.calendarContainer .daysOfWeek{margin-bottom:5px;padding-bottom:5px;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;color:#919191}.calendarContainer .daysOfWeek>div{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;width:42px}.calendarContainer .monthsList{clear:both;width:100%}.calendarContainer .monthsList button{width:33.33333332%;height:25%;float:right;border:1px solid #f9f9f9;outline:0;font-size:1em;background:#fff;padding:10px 0;cursor:pointer}.calendarContainer .monthsList button:hover{background:#eee;cursor:pointer}.calendarContainer .yearsList{clear:both;width:100%;max-height:200px;overflow-y:scroll}.calendarContainer .yearsList button{width:20%;height:25%;float:right;border:1px solid #f9f9f9;outline:0;font-size:1em;background:#fff;padding:10px 0;cursor:pointer}.calendarContainer .yearsList button:hover{background:#eee;cursor:pointer}.calendarContainer .selected button,.calendarContainer .selected button:active,.calendarContainer .selected button:focus,.calendarContainer .selected button:hover :not([disabled]){background-color:#4285f4;color:#fff}.calendarContainer.jalaali{direction:rtl}.calendarContainer.jalaali .dayWrapper{float:right}.time-picker-container{margin-bottom:10}.time-picker-container>.time-label{float:left;line-height:30px;width:50%;text-align:center}.time-picker-container>.time-picker-panel{float:right;width:50%}.time-picker-container.jalaali>.time-label{float:right}.time-picker-container.jalaali>.time-picker-panel{float:left}.rc-time-picker{border-radius:4px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;width:110px;border:1px solid #f7f7f7;font-size:1.2em}.rc-time-picker *{-webkit-box-sizing:border-box;box-sizing:border-box}.rc-time-picker-input{margin:4px 0;padding:0 15px 1px 15px;direction:ltr;text-align:center;width:100%;position:relative;display:inline-block;cursor:pointer;font-size:1em;line-height:1.5;border:none;background-image:none;background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.jalaali.calendarContainer .rc-time-picker-input{padding:0 15px 3px 15px}.rc-time-picker-input:focus{-webkit-box-shadow:none;box-shadow:none;border:none;background-color:#f2f2f2}.rc-time-picker:hover{background-color:#f2f2f2}.rc-time-picker-panel{z-index:2001;width:170px;position:absolute;-webkit-box-sizing:border-box;box-sizing:border-box}.rc-time-picker-panel *{-webkit-box-sizing:border-box;box-sizing:border-box}.rc-time-picker-panel-inner{display:inline-block;position:relative;outline:0;list-style:none;font-size:12px;text-align:left;background-color:#fff;border-radius:3px;-webkit-box-shadow:0 1px 5px #ccc;box-shadow:0 1px 5px #ccc;background-clip:padding-box;border:1px solid #ccc;line-height:1.5}.rc-time-picker-panel-input{margin:0;padding:0;width:100%;cursor:default;line-height:1.5;outline:0;border:1px solid transparent;padding:4px 0;font-size:1.4em;text-align:center;font-family:inherit}.rc-time-picker-panel-input,.rc-time-picker-panel-input:hover{-webkit-box-shadow:none;box-shadow:none;border:none}.rc-time-picker-panel-input-wrap{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;padding:6px;border-bottom:1px solid #e9e9e9}.rc-time-picker-panel-input-invalid{border-color:red}.rc-time-picker-panel-clear-btn{position:absolute;right:6px;cursor:pointer;overflow:hidden;width:20px;height:20px;text-align:center;line-height:20px;top:6px;margin:0}.rc-time-picker-panel-clear-btn:after{content:'x';font-size:12px;color:#aaa;display:inline-block;line-height:1;width:20px;-webkit-transition:color .3s ease;transition:color .3s ease}.rc-time-picker-panel-clear-btn:hover:after{color:#666}.rc-time-picker-panel-select{float:left;font-size:12px;border:1px solid #e9e9e9;border-width:0 1px;margin-left:-1px;-webkit-box-sizing:border-box;box-sizing:border-box;width:56px;overflow:hidden;position:relative}.rc-time-picker-panel-select-active{overflow-y:auto}.rc-time-picker-panel-select:first-child{border-left:0;margin-left:0}.rc-time-picker-panel-select:last-child{border-right:0}.rc-time-picker-panel-select ul{list-style:none;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;width:100%;max-height:144px;overflow-x:hidden;overflow-y:scroll}.rc-time-picker-panel-select li{list-style:none;-webkit-box-sizing:content-box;box-sizing:content-box;margin:0;padding:0 0 0 16px;width:100%;height:24px;line-height:24px;text-align:left;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.rc-time-picker-panel-select li:hover{background:#edfaff}li.rc-time-picker-panel-select-option-selected{background:#edfaff;color:#2db7f5}li.rc-time-picker-panel-select-option-disabled{color:#bfbfbf}li.rc-time-picker-panel-select-option-disabled:hover{background:0 0;cursor:not-allowed}.tether-element.tether-element-attached-top.tether-element-attached-center.tether-target-attached-bottom.tether-target-attached-center.tether-enabled{z-index:2000}.calendarContainer *,.datepicker-input{font-family:inherit}.today button{border:3px solid #4285f4!important}.jalaali.calendarContainer .selectToday{padding:4px 0 6px 0}.calendarButton{display:block;width:100%;background:#4285f4;color:#fff;outline:0;border-radius:5px;border:0;cursor:pointer;padding:5px 0 7px 0;-webkit-transition:.2s all ease-in-out;transition:.2s all ease-in-out;-webkit-transition-property:background;transition-property:background}.calendarButton:hover{background:#1266f1}.toggleButton{margin-bottom:1rem}.selectToday{margin-top:1rem}.highLightDot-container{text-align:center;bottom:0;width:100%;position:absolute;cursor:pointer;direction:ltr}.highLightDot-container .highLightDot{border:1px solid #fff;display:inline-block;width:7px;height:7px;border-radius:50%}.highLightDot-container .highLightDot:not(:first-child){margin-left:2px}.disabled{cursor:not-allowed}button[disabled],button[disabled]:hover{color:#aaa;cursor:not-allowed;background-color:#ebebeb}\";\n styleInject(css_248z);\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n var classCallCheck = _classCallCheck;\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n var createClass = _createClass;\n\n function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n }\n\n var assertThisInitialized = _assertThisInitialized;\n\n function createCommonjsModule(fn, module) {\n \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n }\n\n var setPrototypeOf = createCommonjsModule(function (module) {\n function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n }\n\n module.exports = _setPrototypeOf;\n });\n\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n }\n\n var inherits = _inherits;\n\n var _typeof_1 = createCommonjsModule(function (module) {\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n module.exports = _typeof;\n });\n\n function _possibleConstructorReturn(self, call) {\n if (call && (_typeof_1(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n }\n\n var possibleConstructorReturn = _possibleConstructorReturn;\n\n var getPrototypeOf = createCommonjsModule(function (module) {\n function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n }\n\n module.exports = _getPrototypeOf;\n });\n\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n }\n\n var defineProperty = _defineProperty;\n\n var latinToPersianMap = ['۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹', '۰'];\n var latinNumbers = [/1/g, /2/g, /3/g, /4/g, /5/g, /6/g, /7/g, /8/g, /9/g, /0/g];\n\n function prepareNumber(input) {\n var string;\n\n if (typeof input === 'number') {\n string = input.toString();\n } else if (typeof input === 'undefined') {\n string = '';\n } else {\n string = input;\n }\n\n return string;\n }\n\n function latinToPersian(string) {\n var result = string;\n\n for (var index = 0; index < 10; index++) {\n result = result.replace(latinNumbers[index], latinToPersianMap[index]);\n }\n\n return result;\n }\n\n function persianNumber(input) {\n return latinToPersian(prepareNumber(input));\n }\n\n var leftArrow = {\n __html: ''\n };\n var rightArrow = {\n __html: ''\n };\n\n function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var Heading = /*#__PURE__*/function (_Component) {\n inherits(Heading, _Component);\n\n var _super = _createSuper(Heading);\n\n function Heading() {\n classCallCheck(this, Heading);\n\n return _super.apply(this, arguments);\n }\n\n createClass(Heading, [{\n key: \"handleMonthClick\",\n value: function handleMonthClick(event) {\n var setCalendarMode = this.context.setCalendarMode;\n event.preventDefault();\n setCalendarMode('monthSelector');\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$context = this.context,\n nextMonth = _this$context.nextMonth,\n prevMonth = _this$context.prevMonth;\n var _this$props = this.props,\n month = _this$props.month,\n styles = _this$props.styles;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: styles.heading\n }, /*#__PURE__*/React__default.createElement(\"button\", {\n className: styles.title,\n onClick: this.handleMonthClick.bind(this)\n }, this.props.isGregorian ? month.locale('en').format('MMMM YYYY') : persianNumber(month.locale('fa').format('jMMMM jYYYY'))), this.props.timePicker, !this.props.isGregorian && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(\"button\", {\n type: \"button\",\n title: \"\\u0645\\u0627\\u0647 \\u0642\\u0628\\u0644\",\n className: styles.prev,\n onClick: prevMonth,\n dangerouslySetInnerHTML: rightArrow\n }), /*#__PURE__*/React__default.createElement(\"button\", {\n type: \"button\",\n title: \"\\u0645\\u0627\\u0647 \\u0628\\u0639\\u062F\",\n className: styles.next,\n onClick: nextMonth,\n dangerouslySetInnerHTML: leftArrow\n })), this.props.isGregorian && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(\"button\", {\n type: \"button\",\n title: \"previous month\",\n className: styles.next,\n onClick: prevMonth,\n dangerouslySetInnerHTML: leftArrow\n }), /*#__PURE__*/React__default.createElement(\"button\", {\n type: \"button\",\n title: \"next month\",\n className: styles.prev,\n onClick: nextMonth,\n dangerouslySetInnerHTML: rightArrow\n })));\n }\n }]);\n\n return Heading;\n }(React.Component);\n\n defineProperty(Heading, \"propTypes\", {\n month: PropTypes.object.isRequired,\n isGregorian: PropTypes.bool\n });\n\n defineProperty(Heading, \"contextTypes\", {\n styles: PropTypes.object,\n nextMonth: PropTypes.func.isRequired,\n prevMonth: PropTypes.func.isRequired,\n setCalendarMode: PropTypes.func.isRequired\n });\n\n function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$1() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var dayOfWeekNamesJalaali = ['ش', 'ی', 'د', 'س', 'چ', 'پ', 'ج'];\n var dayOfWeekNamesGregorian = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];\n\n var DaysOfWeek = /*#__PURE__*/function (_Component) {\n inherits(DaysOfWeek, _Component);\n\n var _super = _createSuper$1(DaysOfWeek);\n\n function DaysOfWeek() {\n classCallCheck(this, DaysOfWeek);\n\n return _super.apply(this, arguments);\n }\n\n createClass(DaysOfWeek, [{\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n styles = _this$props.styles,\n isGregorian = _this$props.isGregorian;\n var dayOfWeekNames = isGregorian ? dayOfWeekNamesGregorian : dayOfWeekNamesJalaali;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: styles.daysOfWeek\n }, dayOfWeekNames.map(function (name, key) {\n return /*#__PURE__*/React__default.createElement(\"div\", {\n key: key\n }, name);\n }));\n }\n }]);\n\n return DaysOfWeek;\n }(React.Component);\n\n defineProperty(DaysOfWeek, \"propTypes\", {\n styles: PropTypes.object,\n isGregorian: PropTypes.bool\n });\n\n function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$2() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var MonthsViewHeading = /*#__PURE__*/function (_Component) {\n inherits(MonthsViewHeading, _Component);\n\n var _super = _createSuper$2(MonthsViewHeading);\n\n function MonthsViewHeading() {\n classCallCheck(this, MonthsViewHeading);\n\n return _super.apply(this, arguments);\n }\n\n createClass(MonthsViewHeading, [{\n key: \"handleYearClick\",\n value: function handleYearClick(event) {\n var setCalendarMode = this.context.setCalendarMode;\n event.preventDefault();\n setCalendarMode('yearSelector');\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n year = _this$props.year,\n styles = _this$props.styles,\n type = _this$props.type,\n isGregorian = _this$props.isGregorian,\n disableYearSelector = _this$props.disableYearSelector;\n var yearFormat = isGregorian ? 'YYYY' : 'jYYYY';\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: styles.heading\n }, /*#__PURE__*/React__default.createElement(\"button\", {\n disabled: disableYearSelector,\n className: styles.title,\n onClick: this.handleYearClick.bind(this)\n }, isGregorian ? year.format(yearFormat) : persianNumber(year.format(yearFormat))), /*#__PURE__*/React__default.createElement(\"button\", {\n type: \"button\",\n title: isGregorian ? 'next year' : 'سال قبل',\n style: styles.navButton,\n className: styles.prev,\n onClick: isGregorian ? this.props.onNextYear : this.props.onPrevYear,\n dangerouslySetInnerHTML: rightArrow\n }), /*#__PURE__*/React__default.createElement(\"button\", {\n type: \"button\",\n title: isGregorian ? 'previous year' : 'سال بعد',\n style: styles.navButton,\n className: styles.next,\n onClick: isGregorian ? this.props.onPrevYear : this.props.onNextYear,\n dangerouslySetInnerHTML: leftArrow\n }));\n }\n }]);\n\n return MonthsViewHeading;\n }(React.Component);\n\n defineProperty(MonthsViewHeading, \"propTypes\", {\n year: PropTypes.object.isRequired,\n onNextYear: PropTypes.func.isRequired,\n onPrevYear: PropTypes.func.isRequired,\n isGregorian: PropTypes.bool,\n disableYearSelector: PropTypes.bool\n });\n\n defineProperty(MonthsViewHeading, \"contextTypes\", {\n styles: PropTypes.object,\n type: PropTypes.number,\n setCalendarMode: PropTypes.func.isRequired\n });\n\n function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$3() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var monthsJalaali = ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'];\n var monthsGregorian = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n\n var MonthSelector = /*#__PURE__*/function (_Component) {\n inherits(MonthSelector, _Component);\n\n var _super = _createSuper$3(MonthSelector);\n\n function MonthSelector() {\n var _this;\n\n classCallCheck(this, MonthSelector);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n defineProperty(assertThisInitialized(_this), \"state\", {\n year: _this.props.selectedMonth\n });\n\n return _this;\n }\n\n createClass(MonthSelector, [{\n key: \"nextYear\",\n value: function nextYear() {\n this.setState({\n year: this.state.year.clone().add(1, 'year')\n });\n }\n }, {\n key: \"prevYear\",\n value: function prevYear() {\n this.setState({\n year: this.state.year.clone().subtract(1, 'year')\n });\n }\n }, {\n key: \"handleClick\",\n value: function handleClick(key) {\n var _this$context = this.context,\n setMonth = _this$context.setMonth,\n setCalendarMode = _this$context.setCalendarMode;\n var isGregorian = this.props.isGregorian;\n var monthYearFormat = isGregorian ? 'M-YYYY' : 'jM-jYYYY';\n setMonth(momentJalaali(key, monthYearFormat));\n setCalendarMode('days');\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var year = this.state.year;\n var _this$props = this.props,\n selectedMonth = _this$props.selectedMonth,\n styles = _this$props.styles,\n isGregorian = _this$props.isGregorian,\n disableYearSelector = _this$props.disableYearSelector;\n var yearFormat = isGregorian ? 'YYYY' : 'jYYYY';\n var monthYearFormat = isGregorian ? 'M-YYYY' : 'jM-jYYYY';\n var months = isGregorian ? monthsGregorian : monthsJalaali;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: \"month-selector\"\n }, /*#__PURE__*/React__default.createElement(MonthsViewHeading, {\n isGregorian: isGregorian,\n styles: styles,\n year: year,\n onNextYear: this.nextYear.bind(this),\n onPrevYear: this.prevYear.bind(this),\n disableYearSelector: disableYearSelector\n }), /*#__PURE__*/React__default.createElement(\"div\", {\n className: styles.monthsList\n }, months.map(function (name, key) {\n var buttonFingerprint = \"\".concat(key + 1, \"-\").concat(year.format(yearFormat));\n var selectedMonthFingerprint = selectedMonth.format(monthYearFormat);\n var isCurrent = selectedMonthFingerprint === buttonFingerprint;\n var className = classnames(styles.monthWrapper, defineProperty({}, styles.selected, isCurrent));\n return /*#__PURE__*/React__default.createElement(\"div\", {\n key: key,\n className: className\n }, /*#__PURE__*/React__default.createElement(\"button\", {\n onClick: _this2.handleClick.bind(_this2, buttonFingerprint)\n }, name));\n })));\n }\n }]);\n\n return MonthSelector;\n }(React.Component);\n\n defineProperty(MonthSelector, \"propTypes\", {\n styles: PropTypes.object,\n selectedMonth: PropTypes.object.isRequired,\n isGregorian: PropTypes.bool,\n disableYearSelector: PropTypes.bool\n });\n\n defineProperty(MonthSelector, \"contextTypes\", {\n setCalendarMode: PropTypes.func.isRequired,\n setMonth: PropTypes.func.isRequired\n });\n\n function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$4() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var yearsJalaali = range(momentJalaali(new Date()).jYear() + 100, 1300);\n var yearsGregorian = range(momentJalaali(new Date()).year() + 100, 1920);\n\n var YearSelector = /*#__PURE__*/function (_Component) {\n inherits(YearSelector, _Component);\n\n var _super = _createSuper$4(YearSelector);\n\n function YearSelector(props) {\n var _this;\n\n classCallCheck(this, YearSelector);\n\n _this = _super.call(this, props);\n\n defineProperty(assertThisInitialized(_this), \"state\", {\n year: _this.props.selectedYear,\n month: _this.props.selectedMonth\n });\n\n defineProperty(assertThisInitialized(_this), \"getOffsetTop\", function (element) {\n var offsetTop = 0;\n\n while (element) {\n console.log(element.scrollTop);\n offsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n\n return offsetTop;\n });\n\n defineProperty(assertThisInitialized(_this), \"scrollToCurrentYearPositionRef\", function () {\n var marginTop = 160;\n\n _this.yearsContainerRef.current.scrollTo({\n top: _this.getOffsetTop(_this.currentYearPositionRef.current) - marginTop,\n behavior: 'smooth' // optional\n\n });\n });\n\n _this.currentYearPositionRef = React__default.createRef();\n _this.yearsContainerRef = React__default.createRef();\n return _this;\n }\n\n createClass(YearSelector, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.scrollToCurrentYearPositionRef();\n }\n }, {\n key: \"nextYear\",\n value: function nextYear() {\n this.setState({\n year: this.state.year.clone().add(1, 'year')\n });\n }\n }, {\n key: \"prevYear\",\n value: function prevYear() {\n this.setState({\n year: this.state.year.clone().subtract(1, 'year')\n });\n }\n }, {\n key: \"handleClick\",\n value: function handleClick(key) {\n var _this$context = this.context,\n setMonth = _this$context.setMonth,\n setCalendarMode = _this$context.setCalendarMode;\n var isGregorian = this.props.isGregorian;\n var monthYearFormat = isGregorian ? 'M-YYYY' : 'jM-jYYYY';\n setMonth(momentJalaali(key, monthYearFormat));\n setCalendarMode('days');\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var _this$state = this.state,\n year = _this$state.year,\n month = _this$state.month;\n var _this$props = this.props,\n styles = _this$props.styles,\n isGregorian = _this$props.isGregorian;\n var yearFormat = isGregorian ? 'YYYY' : 'jYYYY';\n var monthFormat = isGregorian ? 'M' : 'jM';\n var years = isGregorian ? yearsGregorian : yearsJalaali;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: \"month-selector\"\n }, /*#__PURE__*/React__default.createElement(MonthsViewHeading, {\n isGregorian: isGregorian,\n styles: styles,\n year: year,\n onNextYear: this.nextYear.bind(this),\n onPrevYear: this.prevYear.bind(this)\n }), /*#__PURE__*/React__default.createElement(\"div\", {\n ref: this.yearsContainerRef,\n className: styles.yearsList\n }, years.map(function (yearItem, key) {\n var buttonFingerprint = \"\".concat(month.format(monthFormat), \"-\").concat(years[key]);\n var isCurrent = Number(year.format(yearFormat)) === years[key];\n var isCurrentYearPosition = Number(year.format(yearFormat)) === years[key];\n var currentYearClass = classnames(styles.yearWrapper, defineProperty({}, styles.selected, isCurrent));\n return /*#__PURE__*/React__default.createElement(\"div\", {\n key: key,\n className: currentYearClass\n }, /*#__PURE__*/React__default.createElement(\"button\", {\n ref: isCurrentYearPosition && _this2.currentYearPositionRef,\n onClick: _this2.handleClick.bind(_this2, buttonFingerprint)\n }, yearItem));\n })));\n }\n }]);\n\n return YearSelector;\n }(React.Component);\n\n defineProperty(YearSelector, \"propTypes\", {\n styles: PropTypes.object,\n selectedYear: PropTypes.object.isRequired,\n selectedMonth: PropTypes.object.isRequired,\n isGregorian: PropTypes.bool\n });\n\n defineProperty(YearSelector, \"contextTypes\", {\n setCalendarMode: PropTypes.func.isRequired,\n setMonth: PropTypes.func.isRequired\n });\n\n var _extends_1 = createCommonjsModule(function (module) {\n function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n }\n\n module.exports = _extends;\n });\n\n function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n }\n\n var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;\n\n function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n }\n\n var objectWithoutProperties = _objectWithoutProperties;\n\n function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$5() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var Day = /*#__PURE__*/function (_Component) {\n inherits(Day, _Component);\n\n var _super = _createSuper$5(Day);\n\n function Day() {\n classCallCheck(this, Day);\n\n return _super.apply(this, arguments);\n }\n\n createClass(Day, [{\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps) {\n return nextProps.selected !== this.props.selected || nextProps.disabled !== this.props.disabled || nextProps.isCurrentMonth !== this.props.isCurrentMonth;\n }\n }, {\n key: \"handleClick\",\n value: function handleClick(event) {\n event.preventDefault();\n event.stopPropagation();\n event.nativeEvent.stopImmediatePropagation();\n var _this$props = this.props,\n disabled = _this$props.disabled,\n onClick = _this$props.onClick,\n day = _this$props.day;\n if (disabled) return;\n\n if (onClick) {\n onClick(day);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _classnames;\n\n var _this$props2 = this.props,\n day = _this$props2.day,\n disabled = _this$props2.disabled,\n selected = _this$props2.selected,\n isCurrentMonth = _this$props2.isCurrentMonth,\n onClick = _this$props2.onClick,\n styles = _this$props2.styles,\n isGregorian = _this$props2.isGregorian,\n isToday = _this$props2.isToday,\n colors = _this$props2.colors,\n rest = objectWithoutProperties(_this$props2, [\"day\", \"disabled\", \"selected\", \"isCurrentMonth\", \"onClick\", \"styles\", \"isGregorian\", \"isToday\", \"colors\"]);\n\n var className = classnames(styles.dayWrapper, (_classnames = {}, defineProperty(_classnames, styles.selected, selected), defineProperty(_classnames, styles.currentMonth, isCurrentMonth), defineProperty(_classnames, styles.today, isToday), defineProperty(_classnames, styles.disabled, disabled), _classnames));\n var highlightDotContainer = classnames(\"highLightDot-container\", defineProperty({}, styles.disabled, disabled));\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: className\n }, /*#__PURE__*/React__default.createElement(\"button\", _extends_1({\n type: \"button\",\n onClick: this.handleClick.bind(this),\n disabled: disabled\n }, rest), isGregorian ? day.format('D') : persianNumber(day.format('jD'))), /*#__PURE__*/React__default.createElement(\"div\", {\n className: highlightDotContainer,\n onClick: this.handleClick.bind(this)\n }, colors.map(function (x, i) {\n return /*#__PURE__*/React__default.createElement(\"span\", {\n key: i,\n className: \"highLightDot\",\n style: {\n backgroundColor: x\n }\n });\n })));\n }\n }]);\n\n return Day;\n }(React.Component);\n\n defineProperty(Day, \"propTypes\", {\n day: PropTypes.object.isRequired,\n isCurrentMonth: PropTypes.bool,\n disabled: PropTypes.bool,\n selected: PropTypes.bool,\n onClick: PropTypes.func,\n isGregorian: PropTypes.bool\n });\n\n /**\r\n * Get days of a month that should be shown on a month page\r\n *\r\n * @param month A moment object\r\n * @returns {Array}\r\n */\n function getDaysOfMonth(month, isGregorian) {\n var days = [];\n var monthFormat = isGregorian ? 'Month' : 'jMonth';\n var dayOffset = isGregorian ? 0 : 1;\n var current = month.clone().startOf(monthFormat);\n var end = month.clone().endOf(monthFormat); // Set start to the first day of week in the last month\n\n current.subtract((current.day() + dayOffset) % 7, 'days'); // Set end to the last day of week in the next month\n\n end.add(6 - (end.day() + dayOffset) % 7, 'days');\n\n while (current.isBefore(end)) {\n days.push(current.clone());\n current.add(1, 'days');\n }\n\n return days;\n }\n function addZero(val) {\n val = Number(val);\n if (val < 10) return \"0\".concat(val);\n return val;\n }\n function checkToday(compare) {\n var today = new Date();\n var todayString = String(today.getFullYear()) + addZero(String(today.getMonth() + 1)) + addZero(String(today.getDate()));\n return compare === todayString;\n }\n\n var defaultStyles = {\n calendarContainer: 'calendarContainer',\n heading: 'heading',\n prev: 'prev',\n next: 'next',\n title: 'title',\n dayWrapper: 'dayWrapper',\n currentMonth: 'currentMonth',\n daysOfWeek: 'daysOfWeek',\n yearsList: 'yearsList',\n monthsList: 'monthsList',\n selected: 'selected',\n today: 'today',\n dayPickerContainer: 'dayPickerContainer',\n disabled: 'disabled'\n };\n\n var MomentRange = require('moment-range');\n\n var extendedMoment = MomentRange.extendMoment(momentJalaali);\n\n var RangesList = /*#__PURE__*/function () {\n function RangesList(ranges) {\n var _this = this;\n\n classCallCheck(this, RangesList);\n\n this.ranges = [];\n\n if (ranges) {\n ranges.forEach(function (item) {\n _this.validateRangeObject(item);\n\n var range = extendedMoment.range(item.start, item.end); // include start\n\n var start = range.start.add(-1, 'days');\n\n _this.ranges.push({\n color: item.color,\n range: range,\n disabled: !!item.disabled\n });\n });\n }\n }\n\n createClass(RangesList, [{\n key: \"getDayState\",\n value: function getDayState(day) {\n var disabled = this.ranges.some(function (x) {\n return x.disabled && x.range.contains(day);\n });\n var colors = this.ranges.filter(function (x) {\n return x.color && x.range.contains(day);\n }).map(function (x) {\n return x.color;\n });\n return {\n disabled: disabled,\n colors: colors\n };\n }\n }, {\n key: \"validateRangeObject\",\n value: function validateRangeObject(range) {\n if (!('start' in range)) throw \"'start' property is a required property of 'range' object.\\n range object: \".concat(JSON.stringify(range));\n if (!('end' in range)) throw \"'end' property is a required property of 'range' object.\\n range object: \".concat(JSON.stringify(range));\n }\n }]);\n\n return RangesList;\n }();\n\n function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$6() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n var Calendar = /*#__PURE__*/function (_Component) {\n inherits(Calendar, _Component);\n\n var _super = _createSuper$6(Calendar);\n\n function Calendar() {\n var _this;\n\n classCallCheck(this, Calendar);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n defineProperty(assertThisInitialized(_this), \"state\", {\n year: _this.props.defaultYear || _this.props.selectedDay || momentJalaali(_this.props.min),\n month: _this.props.defaultMonth || _this.props.selectedDay || momentJalaali(_this.props.min),\n selectedDay: _this.props.selectedDay || _this.props.value || momentJalaali(),\n mode: 'days',\n isGregorian: _this.props.isGregorian,\n ranges: new RangesList(_this.props.ranges)\n });\n\n defineProperty(assertThisInitialized(_this), \"setMode\", function (mode) {\n _this.setState({\n mode: mode\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"setYear\", function (year) {\n var onYearChange = _this.props.onYearChange;\n\n _this.setState({\n year: year\n });\n\n if (onYearChange) {\n onYearChange(year);\n }\n });\n\n defineProperty(assertThisInitialized(_this), \"setMonth\", function (month) {\n var onMonthChange = _this.props.onMonthChange;\n\n _this.setState({\n month: month\n });\n\n if (onMonthChange) {\n onMonthChange(month);\n }\n });\n\n defineProperty(assertThisInitialized(_this), \"setType\", function (type) {\n _this.setState({\n type: type\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"nextMonth\", function () {\n var isGregorian = _this.state.isGregorian;\n var monthFormat = isGregorian ? 'Month' : 'jMonth';\n\n _this.setState({\n month: _this.state.month.clone().add(1, monthFormat)\n }, function () {\n return _this.props.onMonthChange && _this.props.onMonthChange(_this.state.month);\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"prevMonth\", function () {\n var isGregorian = _this.state.isGregorian;\n var monthFormat = isGregorian ? 'Month' : 'jMonth';\n\n _this.setState({\n month: _this.state.month.clone().subtract(1, monthFormat)\n }, function () {\n return _this.props.onMonthChange && _this.props.onMonthChange(_this.state.month);\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"selectDay\", function (selectedDay) {\n var _this$state = _this.state,\n month = _this$state.month,\n isGregorian = _this$state.isGregorian;\n var yearMonthFormat = isGregorian ? 'YYYYMM' : 'jYYYYjMM';\n\n if (!selectedDay) {\n _this.setState({\n year: _this.props.defaultYear || _this.props.selectedDay || momentJalaali(_this.props.min),\n month: _this.props.defaultMonth || _this.props.selectedDay || momentJalaali(_this.props.min),\n selectedDay: null\n });\n\n return;\n } // Because there's no `m1.isSame(m2, 'jMonth')`\n\n\n if (selectedDay.format(yearMonthFormat) !== month.format(yearMonthFormat)) {\n _this.setState({\n month: selectedDay\n });\n }\n\n _this.setState({\n selectedDay: selectedDay\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"handleClickOnDay\", function (selectedDay) {\n var _this$props = _this.props,\n onSelect = _this$props.onSelect,\n onChange = _this$props.onChange;\n\n _this.selectDay(selectedDay);\n\n if (onSelect) {\n onSelect(selectedDay);\n }\n\n if (onChange) onChange(selectedDay);\n });\n\n defineProperty(assertThisInitialized(_this), \"handleClickOutside\", function (event) {\n if (_this.props.onClickOutside) {\n _this.props.onClickOutside(event);\n }\n });\n\n defineProperty(assertThisInitialized(_this), \"days\", null);\n\n defineProperty(assertThisInitialized(_this), \"lastRenderedMonth\", null);\n\n defineProperty(assertThisInitialized(_this), \"renderMonthSelector\", function () {\n var _this$state2 = _this.state,\n month = _this$state2.month,\n isGregorian = _this$state2.isGregorian;\n var _this$props2 = _this.props,\n styles = _this$props2.styles,\n disableYearSelector = _this$props2.disableYearSelector;\n return /*#__PURE__*/React__default.createElement(MonthSelector, {\n disableYearSelector: disableYearSelector,\n styles: styles,\n isGregorian: isGregorian,\n selectedMonth: month\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"renderYearSelector\", function () {\n var _this$state3 = _this.state,\n year = _this$state3.year,\n month = _this$state3.month,\n isGregorian = _this$state3.isGregorian;\n var styles = _this.props.styles;\n return /*#__PURE__*/React__default.createElement(YearSelector, {\n styles: styles,\n isGregorian: isGregorian,\n selectedYear: year,\n selectedMonth: month\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"renderDays\", function () {\n var _this$state4 = _this.state,\n month = _this$state4.month,\n selectedDay = _this$state4.selectedDay,\n isGregorian = _this$state4.isGregorian;\n var _this$props3 = _this.props,\n children = _this$props3.children,\n min = _this$props3.min,\n max = _this$props3.max,\n styles = _this$props3.styles,\n outsideClickIgnoreClass = _this$props3.outsideClickIgnoreClass;\n var days;\n\n if (_this.lastRenderedMonth === month) {\n days = _this.days;\n } else {\n days = getDaysOfMonth(month, isGregorian);\n _this.days = days;\n _this.lastRenderedMonth = month;\n }\n\n var monthFormat = isGregorian ? 'MM' : 'jMM';\n var dateFormat = isGregorian ? 'YYYYMMDD' : 'jYYYYjMMjDD';\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: _this.props.calendarClass\n }, children, /*#__PURE__*/React__default.createElement(Heading, {\n timePicker: _this.props.timePicker,\n isGregorian: isGregorian,\n styles: styles,\n month: month\n }), /*#__PURE__*/React__default.createElement(DaysOfWeek, {\n styles: styles,\n isGregorian: isGregorian\n }), /*#__PURE__*/React__default.createElement(\"div\", {\n className: styles.dayPickerContainer\n }, days.map(function (day) {\n var isCurrentMonth = day.format(monthFormat) === month.format(monthFormat);\n var selected = selectedDay ? selectedDay.isSame(day, 'day') : false;\n var key = day.format(dateFormat);\n var isToday = checkToday(day.format('YYYYMMDD')); // disabling by old min-max props\n\n var disabled = (min ? day.isBefore(min) : false) || (max ? day.isAfter(max) : false); // new method for disabling and highlighting the ranges of days\n\n var dayState = _this.state.ranges.getDayState(day);\n\n return /*#__PURE__*/React__default.createElement(Day, {\n isGregorian: isGregorian,\n key: key,\n onClick: _this.handleClickOnDay,\n day: day,\n isToday: isToday,\n colors: dayState.colors,\n disabled: disabled || dayState.disabled // disabled by old method or new range method\n ,\n selected: selected,\n isCurrentMonth: isCurrentMonth,\n styles: styles\n });\n })));\n });\n\n return _this;\n }\n\n createClass(Calendar, [{\n key: \"getChildContext\",\n value: function getChildContext() {\n return {\n nextMonth: this.nextMonth.bind(this),\n prevMonth: this.prevMonth.bind(this),\n setCalendarMode: this.setMode.bind(this),\n setYear: this.setYear.bind(this),\n setMonth: this.setMonth.bind(this),\n setType: this.setMonth.bind(this)\n };\n }\n }, {\n key: \"UNSAFE_componentWillReceiveProps\",\n value: function UNSAFE_componentWillReceiveProps(_ref) {\n var selectedDay = _ref.selectedDay,\n defaultYear = _ref.defaultYear,\n defaultMonth = _ref.defaultMonth,\n min = _ref.min,\n isGregorian = _ref.isGregorian,\n ranges = _ref.ranges;\n\n if (typeof isGregorian !== 'undefined' && isGregorian !== this.state.isGregorian) {\n this.setState({\n isGregorian: isGregorian\n });\n }\n\n if (this.props.selectedDay !== selectedDay) {\n this.selectDay(selectedDay || momentJalaali());\n } else if (defaultYear && this.props.defaultYear !== defaultYear && this.state.year === this.props.defaultYear) {\n this.setYear(defaultYear);\n } else if (defaultMonth && this.props.defaultMonth !== defaultMonth && this.state.month === this.props.defaultMonth) {\n this.setMonth(defaultMonth);\n } else if (min && this.props.min !== min && this.state.month.isSame(this.props.min)) {\n this.setMonth(min.clone());\n }\n\n if (JSON.stringify(this.props.ranges) !== JSON.stringify(ranges)) {\n this.setState({\n ranges: new RangesList(ranges)\n });\n }\n }\n }, {\n key: \"changeCalendarMode\",\n value: function changeCalendarMode() {\n this.props.toggleMode();\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var _this$props4 = this.props,\n selectedDay = _this$props4.selectedDay,\n min = _this$props4.min,\n max = _this$props4.max,\n onClickOutside = _this$props4.onClickOutside,\n outsideClickIgnoreClass = _this$props4.outsideClickIgnoreClass,\n styles = _this$props4.styles,\n className = _this$props4.className,\n showTodayButton = _this$props4.showTodayButton;\n var _this$state5 = this.state,\n mode = _this$state5.mode,\n isGregorian = _this$state5.isGregorian;\n var jalaaliClassName = isGregorian ? '' : 'jalaali ';\n var today = momentJalaali();\n today.set({\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n }); // check today state -----------\n // disabling by old min-max props\n\n var disabled = (min ? today.isBefore(min) : false) || (max ? today.isAfter(max) : false); // new method for disabling and highlighting the ranges of days\n\n var dayState = this.state.ranges.getDayState(today);\n var isTodayDisabled = disabled || dayState.disabled; // ------------------------------\n\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: \"\".concat(styles.calendarContainer, \" \").concat(jalaaliClassName).concat(className)\n }, this.props.showToggleButton && /*#__PURE__*/React__default.createElement(\"button\", {\n className: \"calendarButton toggleButton\",\n type: \"button\",\n onClick: this.changeCalendarMode.bind(this)\n }, isGregorian ? this.props.toggleButtonText[0] : this.props.toggleButtonText[1]), mode === 'days' && this.renderDays(), mode === 'monthSelector' && this.renderMonthSelector(), mode === 'yearSelector' && this.renderYearSelector(), showTodayButton && /*#__PURE__*/React__default.createElement(\"button\", {\n type: \"button\",\n className: \"calendarButton selectToday\",\n onClick: function onClick() {\n return _this2.handleClickOnDay(today);\n },\n disabled: isTodayDisabled\n }, isGregorian ? 'today' : 'امروز'));\n }\n }]);\n\n return Calendar;\n }(React.Component);\n\n defineProperty(Calendar, \"propTypes\", {\n min: PropTypes.object,\n max: PropTypes.object,\n styles: PropTypes.object,\n selectedDay: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n defaultYear: PropTypes.object,\n defaultMonth: PropTypes.object,\n onSelect: PropTypes.func,\n onYearChange: PropTypes.func,\n onMonthChange: PropTypes.func,\n onClickOutside: PropTypes.func,\n containerProps: PropTypes.object,\n isGregorian: PropTypes.bool,\n calendarClass: PropTypes.string,\n showToggleButton: PropTypes.bool,\n toggleButtonText: PropTypes.any,\n showTodayButton: PropTypes.bool,\n disableYearSelector: PropTypes.bool\n });\n\n defineProperty(Calendar, \"childContextTypes\", {\n nextMonth: PropTypes.func.isRequired,\n prevMonth: PropTypes.func.isRequired,\n setCalendarMode: PropTypes.func.isRequired,\n setYear: PropTypes.func.isRequired,\n setMonth: PropTypes.func.isRequired,\n setType: PropTypes.func.isRequired\n });\n\n defineProperty(Calendar, \"defaultProps\", {\n styles: defaultStyles,\n containerProps: {},\n isGregorian: true,\n showToggleButton: false,\n showTodayButton: true,\n toggleButtonText: ['تاریخ شمسی', 'تاریخ میلادی']\n });\n\n var Calendar$1 = onClickOutside(Calendar);\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n\n var arrayLikeToArray = _arrayLikeToArray;\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n }\n\n var arrayWithoutHoles = _arrayWithoutHoles;\n\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n }\n\n var iterableToArray = _iterableToArray;\n\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n }\n\n var unsupportedIterableToArray = _unsupportedIterableToArray;\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var nonIterableSpread = _nonIterableSpread;\n\n function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n }\n\n var toConsumableArray = _toConsumableArray;\n\n function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$7() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var Header = /*#__PURE__*/function (_React$Component) {\n inherits(Header, _React$Component);\n\n var _super = _createSuper$7(Header);\n\n function Header(props) {\n var _this;\n\n classCallCheck(this, Header);\n\n _this = _super.call(this, props);\n var _this$props = _this.props,\n value = _this$props.value,\n format = _this$props.format;\n _this.state = {\n str: value && value.format(format) || '',\n invalid: false\n };\n _this.onClear = _this.onClear.bind(assertThisInitialized(_this));\n _this.onInputChange = _this.onInputChange.bind(assertThisInitialized(_this));\n _this.onKeyDown = _this.onKeyDown.bind(assertThisInitialized(_this));\n return _this;\n }\n\n createClass(Header, [{\n key: \"UNSAFE_componentWillReceiveProps\",\n value: function UNSAFE_componentWillReceiveProps(nextProps) {\n var value = nextProps.value,\n format = nextProps.format;\n this.setState({\n str: value && value.format(format) || '',\n invalid: false\n });\n }\n }, {\n key: \"onInputChange\",\n value: function onInputChange(event) {\n var str = event.target.value;\n this.setState({\n str: str\n });\n var _this$props2 = this.props,\n format = _this$props2.format,\n hourOptions = _this$props2.hourOptions,\n minuteOptions = _this$props2.minuteOptions,\n secondOptions = _this$props2.secondOptions,\n disabledHours = _this$props2.disabledHours,\n disabledMinutes = _this$props2.disabledMinutes,\n disabledSeconds = _this$props2.disabledSeconds,\n onChange = _this$props2.onChange,\n allowEmpty = _this$props2.allowEmpty;\n\n if (str) {\n var originalValue = this.props.value;\n var value = this.getProtoValue().clone();\n var parsed = momentJalaali(str, format, true);\n\n if (!parsed.isValid()) {\n this.setState({\n invalid: true\n });\n return;\n }\n\n value.hour(parsed.hour()).minute(parsed.minute()).second(parsed.second()); // if time value not allowed, response warning.\n\n if (hourOptions.indexOf(value.hour()) < 0 || minuteOptions.indexOf(value.minute()) < 0 || secondOptions.indexOf(value.second()) < 0) {\n this.setState({\n invalid: true\n });\n return;\n } // if time value is disabled, response warning.\n\n\n var disabledHourOptions = disabledHours();\n var disabledMinuteOptions = disabledMinutes(value.hour());\n var disabledSecondOptions = disabledSeconds(value.hour(), value.minute());\n\n if (disabledHourOptions && disabledHourOptions.indexOf(value.hour()) >= 0 || disabledMinuteOptions && disabledMinuteOptions.indexOf(value.minute()) >= 0 || disabledSecondOptions && disabledSecondOptions.indexOf(value.second()) >= 0) {\n this.setState({\n invalid: true\n });\n return;\n }\n\n if (originalValue) {\n if (originalValue.hour() !== value.hour() || originalValue.minute() !== value.minute() || originalValue.second() !== value.second()) {\n // keep other fields for rc-calendar\n var changedValue = originalValue.clone();\n changedValue.hour(value.hour());\n changedValue.minute(value.minute());\n changedValue.second(value.second());\n onChange(changedValue);\n }\n } else if (originalValue !== value) {\n onChange(value);\n }\n } else if (allowEmpty) {\n onChange(null);\n } else {\n this.setState({\n invalid: true\n });\n return;\n }\n\n this.setState({\n invalid: false\n });\n }\n }, {\n key: \"onKeyDown\",\n value: function onKeyDown(e) {\n if (e.keyCode === 27) {\n this.props.onEsc();\n }\n }\n }, {\n key: \"onClear\",\n value: function onClear() {\n this.setState({\n str: ''\n });\n this.props.onClear();\n }\n }, {\n key: \"getClearButton\",\n value: function getClearButton() {\n var _this$props3 = this.props,\n prefixCls = _this$props3.prefixCls,\n allowEmpty = _this$props3.allowEmpty;\n\n if (!allowEmpty) {\n return null;\n }\n\n return /*#__PURE__*/React__default.createElement(\"a\", {\n className: \"\".concat(prefixCls, \"-clear-btn\"),\n role: \"button\",\n title: this.props.clearText,\n onMouseDown: this.onClear\n });\n }\n }, {\n key: \"getProtoValue\",\n value: function getProtoValue() {\n return this.props.value || this.props.defaultOpenValue;\n }\n }, {\n key: \"getInput\",\n value: function getInput() {\n var _this2 = this;\n\n var _this$props4 = this.props,\n prefixCls = _this$props4.prefixCls,\n placeholder = _this$props4.placeholder,\n name = _this$props4.name;\n var _this$state = this.state,\n invalid = _this$state.invalid,\n str = _this$state.str;\n var invalidClass = invalid ? \"\".concat(prefixCls, \"-input-invalid\") : '';\n return /*#__PURE__*/React__default.createElement(\"input\", {\n className: \"\".concat(prefixCls, \"-input \").concat(invalidClass),\n ref: function ref(inst) {\n _this2.input = inst;\n },\n onKeyDown: this.onKeyDown,\n value: str,\n placeholder: placeholder,\n name: name,\n onChange: this.onInputChange\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var prefixCls = this.props.prefixCls;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-input-wrap\")\n }, this.getInput(), this.getClearButton());\n }\n }]);\n\n return Header;\n }(React__default.Component);\n\n defineProperty(Header, \"propTypes\", {\n format: PropTypes.string,\n prefixCls: PropTypes.string,\n disabledDate: PropTypes.func,\n placeholder: PropTypes.string,\n name: PropTypes.string,\n clearText: PropTypes.string,\n value: PropTypes.object,\n hourOptions: PropTypes.array,\n minuteOptions: PropTypes.array,\n secondOptions: PropTypes.array,\n disabledHours: PropTypes.func,\n disabledMinutes: PropTypes.func,\n disabledSeconds: PropTypes.func,\n onChange: PropTypes.func,\n onClear: PropTypes.func,\n onEsc: PropTypes.func,\n allowEmpty: PropTypes.bool,\n defaultOpenValue: PropTypes.object,\n currentSelectPanel: PropTypes.string\n });\n\n function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$8() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var scrollTo = function scrollTo(element, to, duration) {\n var requestAnimationFrame = window.requestAnimationFrame || function requestAnimationFrameTimeout() {\n return setTimeout(arguments[0], 10);\n }; // jump to target if duration zero\n\n\n if (duration <= 0) {\n element.scrollTop = to;\n return;\n }\n\n var difference = to - element.scrollTop;\n var perTick = difference / duration * 10;\n requestAnimationFrame(function () {\n element.scrollTop += perTick;\n if (element.scrollTop === to) return;\n scrollTo(element, to, duration - 10);\n });\n };\n\n var Select = /*#__PURE__*/function (_React$Component) {\n inherits(Select, _React$Component);\n\n var _super = _createSuper$8(Select);\n\n function Select() {\n var _this;\n\n classCallCheck(this, Select);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n defineProperty(assertThisInitialized(_this), \"onSelect\", function (value) {\n var _this$props = _this.props,\n onSelect = _this$props.onSelect,\n type = _this$props.type;\n\n _this.props.onSelect(type, value);\n });\n\n defineProperty(assertThisInitialized(_this), \"getOptions\", function () {\n var _this$props2 = _this.props,\n options = _this$props2.options,\n selectedIndex = _this$props2.selectedIndex,\n prefixCls = _this$props2.prefixCls;\n return options.map(function (item, index) {\n var _classnames;\n\n var cls = classnames((_classnames = {}, defineProperty(_classnames, \"\".concat(prefixCls, \"-select-option-selected\"), selectedIndex === index), defineProperty(_classnames, \"\".concat(prefixCls, \"-select-option-disabled\"), item.disabled), _classnames));\n var onclick = null;\n\n if (!item.disabled) {\n var value = +item.value;\n\n if (Number.isNaN(value)) {\n value = item.value;\n }\n\n onclick = _this.onSelect.bind(assertThisInitialized(_this), value);\n }\n\n return /*#__PURE__*/React__default.createElement(\"li\", {\n className: cls,\n key: index,\n onClick: onclick,\n disabled: item.disabled\n }, typeof item.label !== 'undefined' ? item.label : item.value);\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"scrollToSelected\", function (duration) {\n // move to selected item\n var select = ReactDom.findDOMNode(assertThisInitialized(_this));\n var list = ReactDom.findDOMNode(_this.list);\n var index = _this.props.selectedIndex;\n\n if (index < 0) {\n index = 0;\n }\n\n var topOption = list.children[index];\n var to = topOption.offsetTop;\n scrollTo(select, to, duration);\n });\n\n return _this;\n }\n\n createClass(Select, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n // jump to selected option\n this.scrollToSelected(0);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n // smooth scroll to selected option\n if (prevProps.selectedIndex !== this.props.selectedIndex) {\n this.scrollToSelected(120);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n if (this.props.options.length === 0) {\n return null;\n }\n\n var prefixCls = this.props.prefixCls;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-select\"),\n onMouseEnter: this.props.onMouseEnter\n }, /*#__PURE__*/React__default.createElement(\"ul\", {\n ref: function ref(inst) {\n _this2.list = inst;\n }\n }, this.getOptions()));\n }\n }]);\n\n return Select;\n }(React__default.Component);\n\n defineProperty(Select, \"propTypes\", {\n prefixCls: PropTypes.string,\n options: PropTypes.array,\n selectedIndex: PropTypes.number,\n type: PropTypes.string,\n onSelect: PropTypes.func,\n onMouseEnter: PropTypes.func\n });\n\n function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\n function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$9() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var pad = function pad(value) {\n return value < 10 ? \"0\".concat(value) : \"\".concat(value);\n };\n\n var formatOption = function formatOption(option, disabledOptions) {\n var value = pad(option);\n var disabled = false;\n\n if (disabledOptions && disabledOptions.indexOf(option) >= 0) {\n disabled = true;\n }\n\n return {\n value: value,\n disabled: disabled\n };\n };\n\n var Combobox = /*#__PURE__*/function (_React$Component) {\n inherits(Combobox, _React$Component);\n\n var _super = _createSuper$9(Combobox);\n\n function Combobox() {\n var _this;\n\n classCallCheck(this, Combobox);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n defineProperty(assertThisInitialized(_this), \"onItemChange\", function (type, itemValue) {\n var _this$props = _this.props,\n onChange = _this$props.onChange,\n defaultOpenValue = _this$props.defaultOpenValue;\n var value = (_this.props.value || defaultOpenValue).clone();\n\n if (type === 'hour') {\n value.hour(itemValue);\n } else if (type === 'minute') {\n value.minute(itemValue);\n } else if (type === 'second') {\n value.second(itemValue);\n } else {\n var actualPeriod = value.format('A');\n\n if (actualPeriod !== itemValue) {\n var hour24style = value.hour();\n var hour12style = hour24style < 12 ? hour24style : hour24style - 12;\n\n if (itemValue === 'PM') {\n value.hour(hour12style + 12);\n } else {\n value.hour(hour12style);\n }\n }\n }\n\n onChange(value);\n });\n\n defineProperty(assertThisInitialized(_this), \"onEnterSelectPanel\", function (range) {\n _this.props.onCurrentSelectPanelChange(range);\n });\n\n defineProperty(assertThisInitialized(_this), \"getHourSelect\", function (hour) {\n var _this$props2 = _this.props,\n prefixCls = _this$props2.prefixCls,\n showAMPM = _this$props2.showAMPM,\n disabledHours = _this$props2.disabledHours,\n showHour = _this$props2.showHour;\n\n if (!showHour) {\n return null;\n }\n\n var disabledOptions = disabledHours();\n var hourOptions = _this.props.hourOptions;\n var formattedOptions = hourOptions.map(function (option) {\n return formatOption(option, disabledOptions);\n });\n\n if (showAMPM) {\n hourOptions = hourOptions.filter(function (value) {\n return hour < 12 ? value < 12 : value >= 12;\n });\n formattedOptions = formattedOptions.map(function (option) {\n return _objectSpread(_objectSpread({}, option), {}, {\n label: option.value <= 12 ? option.value : pad(option.value - 12)\n });\n }).filter(function (_ref) {\n var value = _ref.value;\n return hour < 12 ? Number(value) < 12 : Number(value) >= 12;\n });\n }\n\n return /*#__PURE__*/React__default.createElement(Select, {\n prefixCls: prefixCls,\n options: formattedOptions,\n selectedIndex: hourOptions.indexOf(hour),\n type: \"hour\",\n onSelect: _this.onItemChange,\n onMouseEnter: _this.onEnterSelectPanel.bind(assertThisInitialized(_this), 'hour')\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"getMinuteSelect\", function (minute) {\n var _this$props3 = _this.props,\n prefixCls = _this$props3.prefixCls,\n minuteOptions = _this$props3.minuteOptions,\n disabledMinutes = _this$props3.disabledMinutes,\n defaultOpenValue = _this$props3.defaultOpenValue;\n var value = _this.props.value || defaultOpenValue;\n var disabledOptions = disabledMinutes(value.hour());\n return /*#__PURE__*/React__default.createElement(Select, {\n prefixCls: prefixCls,\n options: minuteOptions.map(function (option) {\n return formatOption(option, disabledOptions);\n }),\n selectedIndex: minuteOptions.indexOf(minute),\n type: \"minute\",\n onSelect: _this.onItemChange,\n onMouseEnter: _this.onEnterSelectPanel.bind(assertThisInitialized(_this), 'minute')\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"getSecondSelect\", function (second) {\n var _this$props4 = _this.props,\n prefixCls = _this$props4.prefixCls,\n secondOptions = _this$props4.secondOptions,\n disabledSeconds = _this$props4.disabledSeconds,\n showSecond = _this$props4.showSecond,\n defaultOpenValue = _this$props4.defaultOpenValue;\n\n if (!showSecond) {\n return null;\n }\n\n var value = _this.props.value || defaultOpenValue;\n var disabledOptions = disabledSeconds(value.hour(), value.minute());\n return /*#__PURE__*/React__default.createElement(Select, {\n prefixCls: prefixCls,\n options: secondOptions.map(function (option) {\n return formatOption(option, disabledOptions);\n }),\n selectedIndex: secondOptions.indexOf(second),\n type: \"second\",\n onSelect: _this.onItemChange,\n onMouseEnter: _this.onEnterSelectPanel.bind(assertThisInitialized(_this), 'second')\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"getAMPMSelect\", function (period) {\n var _this$props5 = _this.props,\n prefixCls = _this$props5.prefixCls,\n showAMPM = _this$props5.showAMPM,\n defaultOpenValue = _this$props5.defaultOpenValue,\n isGregorian = _this$props5.isGregorian;\n\n if (!showAMPM) {\n return null;\n }\n\n var options = [{\n value: 'AM',\n label: isGregorian ? 'AM' : 'ق.ظ'\n }, {\n value: 'PM',\n label: isGregorian ? 'PM' : 'ب.ظ'\n }];\n return /*#__PURE__*/React__default.createElement(Select, {\n prefixCls: prefixCls,\n options: options,\n selectedIndex: period === 'AM' ? 0 : 1,\n type: \"period\",\n onSelect: _this.onItemChange,\n onMouseEnter: _this.onEnterSelectPanel.bind(assertThisInitialized(_this), 'period')\n });\n });\n\n return _this;\n }\n\n createClass(Combobox, [{\n key: \"render\",\n value: function render() {\n var _this$props6 = this.props,\n prefixCls = _this$props6.prefixCls,\n defaultOpenValue = _this$props6.defaultOpenValue;\n var value = this.props.value || defaultOpenValue;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-combobox\")\n }, this.getHourSelect(value.hour()), this.getMinuteSelect(value.minute()), this.getSecondSelect(value.second()), this.getAMPMSelect(value.hour() < 12 ? 'AM' : 'PM'));\n }\n }]);\n\n return Combobox;\n }(React__default.Component);\n\n defineProperty(Combobox, \"propTypes\", {\n format: PropTypes.string,\n defaultOpenValue: PropTypes.object,\n prefixCls: PropTypes.string,\n value: PropTypes.object,\n onChange: PropTypes.func,\n showHour: PropTypes.bool,\n showSecond: PropTypes.bool,\n hourOptions: PropTypes.array,\n minuteOptions: PropTypes.array,\n secondOptions: PropTypes.array,\n disabledHours: PropTypes.func,\n disabledMinutes: PropTypes.func,\n disabledSeconds: PropTypes.func,\n onCurrentSelectPanelChange: PropTypes.func,\n isGregorian: PropTypes.bool\n });\n\n function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$a() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n function noop() {}\n\n function generateOptions(length, disabledOptions, hideDisabledOptions) {\n var arr = [];\n\n for (var value = 0; value < length; value++) {\n if (!disabledOptions || disabledOptions.indexOf(value) < 0 || !hideDisabledOptions) {\n arr.push(value);\n }\n }\n\n return arr;\n }\n\n var Panel = /*#__PURE__*/function (_React$Component) {\n inherits(Panel, _React$Component);\n\n var _super = _createSuper$a(Panel);\n\n function Panel(props) {\n var _this;\n\n classCallCheck(this, Panel);\n\n _this = _super.call(this, props);\n\n defineProperty(assertThisInitialized(_this), \"onChange\", function (newValue) {\n _this.setState({\n value: newValue\n });\n\n _this.props.onChange(newValue);\n });\n\n defineProperty(assertThisInitialized(_this), \"onClear\", function () {\n _this.props.onClear();\n });\n\n defineProperty(assertThisInitialized(_this), \"onCurrentSelectPanelChange\", function (currentSelectPanel) {\n _this.setState({\n currentSelectPanel: currentSelectPanel\n });\n });\n\n _this.state = {\n value: _this.props.value,\n selectionRange: []\n };\n return _this;\n }\n\n createClass(Panel, [{\n key: \"UNSAFE_componentWillReceiveProps\",\n value: function UNSAFE_componentWillReceiveProps(nextProps) {\n var value = nextProps.value;\n\n if (value) {\n this.setState({\n value: value\n });\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n isGregorian = _this$props.isGregorian,\n formatter = _this$props.formatter,\n prefixCls = _this$props.prefixCls,\n className = _this$props.className,\n placeholder = _this$props.placeholder,\n name = _this$props.name,\n disabledHours = _this$props.disabledHours,\n disabledMinutes = _this$props.disabledMinutes,\n disabledSeconds = _this$props.disabledSeconds,\n hideDisabledOptions = _this$props.hideDisabledOptions,\n allowEmpty = _this$props.allowEmpty,\n showHour = _this$props.showHour,\n showSecond = _this$props.showSecond,\n showAMPM = _this$props.showAMPM,\n format = _this$props.format,\n defaultOpenValue = _this$props.defaultOpenValue,\n clearText = _this$props.clearText,\n onEsc = _this$props.onEsc;\n var _this$state = this.state,\n value = _this$state.value,\n currentSelectPanel = _this$state.currentSelectPanel;\n var disabledHourOptions = disabledHours();\n var disabledMinuteOptions = disabledMinutes(value ? value.hour() : null);\n var disabledSecondOptions = disabledSeconds(value ? value.hour() : null, value ? value.minute() : null);\n var hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions);\n var minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions);\n var secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions);\n return /*#__PURE__*/React__default.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-inner \").concat(className)\n }, /*#__PURE__*/React__default.createElement(Header, {\n clearText: clearText,\n prefixCls: prefixCls,\n defaultOpenValue: defaultOpenValue,\n value: value,\n currentSelectPanel: currentSelectPanel,\n onEsc: onEsc,\n format: format,\n placeholder: placeholder,\n name: name,\n hourOptions: hourOptions,\n minuteOptions: minuteOptions,\n secondOptions: secondOptions,\n disabledHours: disabledHours,\n disabledMinutes: disabledMinutes,\n disabledSeconds: disabledSeconds,\n onChange: this.onChange,\n onClear: this.onClear,\n allowEmpty: allowEmpty\n }), /*#__PURE__*/React__default.createElement(Combobox, {\n isGregorian: isGregorian,\n formatter: formatter,\n prefixCls: prefixCls,\n value: value,\n defaultOpenValue: defaultOpenValue,\n format: format,\n onChange: this.onChange,\n showAMPM: showAMPM,\n showHour: showHour,\n showSecond: showSecond,\n hourOptions: hourOptions,\n minuteOptions: minuteOptions,\n secondOptions: secondOptions,\n disabledHours: disabledHours,\n disabledMinutes: disabledMinutes,\n disabledSeconds: disabledSeconds,\n onCurrentSelectPanelChange: this.onCurrentSelectPanelChange\n }));\n }\n }]);\n\n return Panel;\n }(React__default.Component);\n\n defineProperty(Panel, \"propTypes\", {\n clearText: PropTypes.string,\n prefixCls: PropTypes.string,\n defaultOpenValue: PropTypes.object,\n value: PropTypes.object,\n placeholder: PropTypes.string,\n name: PropTypes.string,\n format: PropTypes.string,\n disabledHours: PropTypes.func,\n disabledMinutes: PropTypes.func,\n disabledSeconds: PropTypes.func,\n hideDisabledOptions: PropTypes.bool,\n onChange: PropTypes.func,\n onEsc: PropTypes.func,\n allowEmpty: PropTypes.bool,\n showHour: PropTypes.bool,\n showSecond: PropTypes.bool,\n onClear: PropTypes.func,\n showAMPM: PropTypes.bool,\n isGregorian: PropTypes.bool\n });\n\n defineProperty(Panel, \"defaultProps\", {\n prefixCls: 'rc-time-picker-panel',\n onChange: noop,\n onClear: noop,\n defaultOpenValue: momentJalaali()\n });\n\n var autoAdjustOverflow = {\n adjustX: 1,\n adjustY: 1\n };\n var targetOffset = [0, 0];\n var placements = {\n bottomLeft: {\n points: ['tl', 'tl'],\n overflow: autoAdjustOverflow,\n offset: [0, -3],\n targetOffset: targetOffset\n },\n bottomRight: {\n points: ['tr', 'tr'],\n overflow: autoAdjustOverflow,\n offset: [0, -3],\n targetOffset: targetOffset\n },\n topRight: {\n points: ['br', 'br'],\n overflow: autoAdjustOverflow,\n offset: [0, 3],\n targetOffset: targetOffset\n },\n topLeft: {\n points: ['bl', 'bl'],\n overflow: autoAdjustOverflow,\n offset: [0, 3],\n targetOffset: targetOffset\n }\n };\n\n function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$b(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$b() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n function noop$1() {}\n\n function refFn(field, component) {\n this[field] = component;\n }\n\n var Picker = /*#__PURE__*/function (_React$Component) {\n inherits(Picker, _React$Component);\n\n var _super = _createSuper$b(Picker);\n\n function Picker(props) {\n var _this;\n\n classCallCheck(this, Picker);\n\n _this = _super.call(this, props);\n\n defineProperty(assertThisInitialized(_this), \"setOpen\", function (open, callback) {\n var _this$props = _this.props,\n onOpen = _this$props.onOpen,\n onClose = _this$props.onClose;\n\n if (_this.state.open !== open) {\n _this.setState({\n open: open\n }, callback);\n\n var event = {\n open: open\n };\n\n if (open) {\n onOpen(event);\n } else {\n onClose(event);\n }\n }\n });\n\n defineProperty(assertThisInitialized(_this), \"onPanelChange\", function (value) {\n _this.setValue(value);\n });\n\n defineProperty(assertThisInitialized(_this), \"onPanelClear\", function () {\n _this.setValue(null);\n\n _this.setOpen(false);\n });\n\n defineProperty(assertThisInitialized(_this), \"onVisibleChange\", function (open) {\n _this.setOpen(open);\n });\n\n defineProperty(assertThisInitialized(_this), \"onEsc\", function () {\n _this.setOpen(false);\n\n _this.picker.focus();\n });\n\n defineProperty(assertThisInitialized(_this), \"onKeyDown\", function (e) {\n if (e.keyCode === 40) {\n _this.setOpen(true);\n }\n });\n\n defineProperty(assertThisInitialized(_this), \"setValue\", function (value) {\n if (!('value' in _this.props)) {\n _this.setState({\n value: value\n });\n }\n\n _this.props.onChange(value);\n });\n\n defineProperty(assertThisInitialized(_this), \"getFormat\", function () {\n var format = _this.props.format;\n\n if (_this.props.format) {\n format = _this.props.format;\n } else if (!_this.props.showSecond) {\n format = 'HH:mm';\n } else if (!_this.props.showHour) {\n format = 'mm:ss';\n } else {\n format = 'HH:mm:ss';\n }\n\n if (_this.props.showAMPM) {\n format = \"\".concat(format.replace('HH', 'hh'), \" A\");\n }\n\n return format;\n });\n\n defineProperty(assertThisInitialized(_this), \"getPanelElement\", function () {\n var _this$props2 = _this.props,\n prefixCls = _this$props2.prefixCls,\n placeholder = _this$props2.placeholder,\n name = _this$props2.name,\n disabledHours = _this$props2.disabledHours,\n disabledMinutes = _this$props2.disabledMinutes,\n disabledSeconds = _this$props2.disabledSeconds,\n hideDisabledOptions = _this$props2.hideDisabledOptions,\n allowEmpty = _this$props2.allowEmpty,\n showHour = _this$props2.showHour,\n showSecond = _this$props2.showSecond,\n showAMPM = _this$props2.showAMPM,\n defaultOpenValue = _this$props2.defaultOpenValue,\n clearText = _this$props2.clearText,\n isGregorian = _this$props2.isGregorian;\n return /*#__PURE__*/React__default.createElement(Panel, {\n isGregorian: isGregorian,\n clearText: clearText,\n prefixCls: \"\".concat(prefixCls, \"-panel\"),\n ref: function ref(refs) {\n _this.savePanelRef = refs;\n },\n value: _this.state.value,\n onChange: _this.onPanelChange,\n onClear: _this.onPanelClear,\n defaultOpenValue: defaultOpenValue,\n showHour: showHour,\n onEsc: _this.onEsc,\n showSecond: showSecond,\n showAMPM: showAMPM,\n allowEmpty: true,\n format: _this.getFormat(),\n placeholder: placeholder,\n name: name,\n disabledHours: disabledHours,\n disabledMinutes: disabledMinutes,\n disabledSeconds: disabledSeconds,\n hideDisabledOptions: hideDisabledOptions\n });\n });\n\n _this.savePanelRef = refFn.bind(assertThisInitialized(_this), 'panelInstance');\n\n var _this$props3 = _this.props,\n defaultOpen = _this$props3.defaultOpen,\n defaultValue = _this$props3.defaultValue,\n _this$props3$open = _this$props3.open,\n _open = _this$props3$open === void 0 ? defaultOpen : _this$props3$open,\n _this$props3$value = _this$props3.value,\n _value = _this$props3$value === void 0 ? defaultValue : _this$props3$value;\n\n _this.state = {\n open: _open,\n value: _value\n };\n return _this;\n }\n\n createClass(Picker, [{\n key: \"UNSAFE_componentWillReceiveProps\",\n value: function UNSAFE_componentWillReceiveProps(nextProps) {\n var value = nextProps.value,\n open = nextProps.open;\n\n if ('value' in nextProps) {\n this.setState({\n value: value\n });\n }\n\n if (open !== undefined) {\n this.setState({\n open: open\n });\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var _this$props4 = this.props,\n panelClassName = _this$props4.panelClassName,\n prefixCls = _this$props4.prefixCls,\n placeholder = _this$props4.placeholder,\n name = _this$props4.name,\n placement = _this$props4.placement,\n align = _this$props4.align,\n disabled = _this$props4.disabled,\n transitionName = _this$props4.transitionName,\n style = _this$props4.style,\n className = _this$props4.className,\n showHour = _this$props4.showHour,\n showSecond = _this$props4.showSecond,\n getPopupContainer = _this$props4.getPopupContainer;\n var _this$state = this.state,\n open = _this$state.open,\n value = _this$state.value;\n var popupClassName;\n\n if (!showHour || !showSecond) {\n popupClassName = \"\".concat(prefixCls, \"-panel-narrow\");\n }\n\n return /*#__PURE__*/React__default.createElement(Trigger, {\n prefixCls: \"\".concat(prefixCls, \"-panel \").concat(panelClassName),\n popupClassName: popupClassName,\n popup: this.getPanelElement(),\n popupAlign: align,\n builtinPlacements: placements,\n popupPlacement: placement,\n action: disabled ? [] : ['click'],\n destroyPopupOnHide: true,\n getPopupContainer: getPopupContainer,\n popupTransitionName: transitionName,\n popupVisible: open,\n onPopupVisibleChange: this.onVisibleChange\n }, /*#__PURE__*/React__default.createElement(\"span\", {\n className: \"\".concat(prefixCls, \" \").concat(className),\n style: style\n }, /*#__PURE__*/React__default.createElement(\"input\", {\n className: \"\".concat(prefixCls, \"-input\"),\n ref: function ref(refs) {\n _this2.picker = refs;\n },\n type: \"text\",\n placeholder: placeholder,\n name: name,\n readOnly: true,\n onKeyDown: this.onKeyDown,\n disabled: disabled,\n value: value && value.format(this.getFormat()) || ''\n }), /*#__PURE__*/React__default.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n })));\n }\n }]);\n\n return Picker;\n }(React__default.Component);\n\n defineProperty(Picker, \"propTypes\", {\n prefixCls: PropTypes.string,\n clearText: PropTypes.string,\n value: PropTypes.object,\n defaultOpenValue: PropTypes.object,\n disabled: PropTypes.bool,\n allowEmpty: PropTypes.bool,\n defaultValue: PropTypes.object,\n open: PropTypes.bool,\n defaultOpen: PropTypes.bool,\n align: PropTypes.object,\n placement: PropTypes.any,\n transitionName: PropTypes.string,\n getPopupContainer: PropTypes.func,\n placeholder: PropTypes.string,\n name: PropTypes.string,\n format: PropTypes.string,\n showHour: PropTypes.bool,\n style: PropTypes.object,\n className: PropTypes.string,\n showSecond: PropTypes.bool,\n disabledHours: PropTypes.func,\n disabledMinutes: PropTypes.func,\n disabledSeconds: PropTypes.func,\n hideDisabledOptions: PropTypes.bool,\n onChange: PropTypes.func,\n onOpen: PropTypes.func,\n onClose: PropTypes.func,\n showAMPM: PropTypes.bool,\n panelClassName: PropTypes.string,\n isGregorian: PropTypes.bool\n });\n\n defineProperty(Picker, \"defaultProps\", {\n clearText: 'clear',\n prefixCls: 'rc-time-picker',\n defaultOpen: false,\n style: {},\n className: '',\n align: {},\n defaultOpenValue: momentJalaali(),\n allowEmpty: true,\n showHour: true,\n showSecond: true,\n disabledHours: noop$1,\n disabledMinutes: noop$1,\n disabledSeconds: noop$1,\n hideDisabledOptions: false,\n placement: 'bottomLeft',\n onChange: noop$1,\n onOpen: noop$1,\n onClose: noop$1\n });\n\n function _createSuper$c(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$c(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$c() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\n var disabledMinutes = function disabledMinutes() {\n return toConsumableArray(Array(60)).map(function (v, i) {\n return i;\n }).filter(function (v) {\n return v % 5 !== 0;\n });\n };\n\n var MyTimePicker = /*#__PURE__*/function (_Component) {\n inherits(MyTimePicker, _Component);\n\n var _super = _createSuper$c(MyTimePicker);\n\n function MyTimePicker() {\n classCallCheck(this, MyTimePicker);\n\n return _super.apply(this, arguments);\n }\n\n createClass(MyTimePicker, [{\n key: \"handleChange\",\n value: function handleChange(value) {\n var _this$props = this.props,\n momentValue = _this$props.momentValue,\n min = _this$props.min;\n var newValue;\n\n if (momentValue) {\n newValue = momentValue.clone();\n } else if (min && min.isAfter(momentJalaali())) {\n newValue = min.clone();\n } else {\n newValue = momentJalaali(value);\n }\n\n newValue.hour(value ? value.hour() : null);\n newValue.minute(value ? value.minute() : null);\n this.props.setMomentValue(newValue);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props2 = this.props,\n momentValue = _this$props2.momentValue,\n isGregorian = _this$props2.isGregorian,\n outsideClickIgnoreClass = _this$props2.outsideClickIgnoreClass;\n return /*#__PURE__*/React__default.createElement(Picker, {\n showAMPM: true,\n isGregorian: isGregorian,\n showSecond: false,\n allowEmpty: false,\n value: momentValue,\n className: outsideClickIgnoreClass,\n popupClassName: outsideClickIgnoreClass,\n panelClassName: \"\".concat(outsideClickIgnoreClass, \" time-picker-panel\"),\n onChange: this.handleChange.bind(this),\n disabledMinutes: disabledMinutes,\n formatter: function formatter(value) {\n return persianNumber(value);\n },\n hideDisabledOptions: true\n });\n }\n }]);\n\n return MyTimePicker;\n }(React.Component);\n\n defineProperty(MyTimePicker, \"propTypes\", {\n momentValue: PropTypes.object,\n setMomentValue: PropTypes.func,\n isGregorian: PropTypes.bool\n });\n\n defineProperty(MyTimePicker, \"defaultProps\", {\n momentValue: momentJalaali()\n });\n\n function _createSuper$d(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$d(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }\n\n function _isNativeReflectConstruct$d() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n var outsideClickIgnoreClass = 'ignore--click--outside';\n\n var DatePicker = /*#__PURE__*/function (_Component) {\n inherits(DatePicker, _Component);\n\n var _super = _createSuper$d(DatePicker);\n\n function DatePicker(props) {\n var _this;\n\n classCallCheck(this, DatePicker);\n\n _this = _super.call(this, props); // create a ref to store the textInput DOM element\n\n defineProperty(assertThisInitialized(_this), \"setOpen\", function (isOpen) {\n _this.setState({\n isOpen: isOpen\n });\n\n if (_this.props.onOpen) {\n _this.props.onOpen(isOpen);\n }\n });\n\n defineProperty(assertThisInitialized(_this), \"toggleMode\", function () {\n var isGregorian = !_this.state.isGregorian;\n var nextPropsInputFormat = _this.props.inputFormat;\n var nextPropsInputJalaaliFormat = _this.props.inputJalaaliFormat;\n\n _this.setState({\n isGregorian: isGregorian,\n inputValue: _this.getValue(_this.props.value, isGregorian, _this.props.timePicker)\n });\n });\n\n defineProperty(assertThisInitialized(_this), \"handleFocus\", function () {\n _this.setOpen(true);\n });\n\n defineProperty(assertThisInitialized(_this), \"renderInput\", function (ref) {\n var _this$state = _this.state,\n isOpen = _this$state.isOpen,\n inputValue = _this$state.inputValue,\n isGregorian = _this$state.isGregorian;\n var className = classnames(_this.props.className, defineProperty({}, outsideClickIgnoreClass, isOpen));\n return /*#__PURE__*/React__default.createElement(\"div\", {\n ref: ref\n }, /*#__PURE__*/React__default.createElement(\"input\", {\n placeholder: _this.props.placeholder,\n name: _this.props.name,\n className: \"datepicker-input \".concat(className),\n type: \"text\",\n ref: function ref(inst) {\n _this.input = inst;\n },\n onFocus: _this.handleFocus.bind(assertThisInitialized(_this)),\n onBlur: _this.hanldeBlur.bind(assertThisInitialized(_this)),\n onChange: _this.handleInputChange.bind(assertThisInitialized(_this)),\n onClick: _this.handleInputClick.bind(assertThisInitialized(_this)),\n value: isGregorian || !_this.props.persianDigits ? inputValue : _this.toPersianDigits(inputValue),\n readOnly: _this.props.inputReadOnly === true,\n disabled: _this.props.disabled\n }));\n });\n\n defineProperty(assertThisInitialized(_this), \"renderCalendar\", function (ref) {\n var _this$state2 = _this.state,\n momentValue = _this$state2.momentValue,\n isGregorian = _this$state2.isGregorian,\n TimePicker = _this$state2.timePickerComponent;\n var _this$props = _this.props,\n onChange = _this$props.onChange,\n min = _this$props.min,\n max = _this$props.max,\n defaultYear = _this$props.defaultYear,\n defaultMonth = _this$props.defaultMonth,\n styles = _this$props.styles,\n calendarContainerProps = _this$props.calendarContainerProps,\n ranges = _this$props.ranges,\n disableYearSelector = _this$props.disableYearSelector;\n return /*#__PURE__*/React__default.createElement(\"div\", {\n ref: ref\n }, /*#__PURE__*/React__default.createElement(Calendar$1, {\n toggleMode: _this.toggleMode,\n ranges: ranges,\n min: min,\n max: max,\n selectedDay: momentValue,\n defaultYear: defaultYear,\n defaultMonth: defaultMonth,\n onSelect: _this.handleSelectDay.bind(assertThisInitialized(_this)),\n onClickOutside: _this.handleClickOutsideCalendar.bind(assertThisInitialized(_this)),\n outsideClickIgnoreClass: outsideClickIgnoreClass,\n styles: styles,\n containerProps: calendarContainerProps,\n isGregorian: isGregorian,\n calendarClass: _this.props.calendarClass ? _this.props.calendarClass : '',\n showToggleButton: _this.props.showToggleButton,\n toggleButtonText: _this.props.toggleButtonText,\n showTodayButton: _this.props.showTodayButton,\n disableYearSelector: disableYearSelector,\n timePicker: TimePicker ? /*#__PURE__*/React__default.createElement(TimePicker, {\n outsideClickIgnoreClass: outsideClickIgnoreClass,\n isGregorian: isGregorian,\n min: min,\n max: max,\n momentValue: momentValue,\n setMomentValue: _this.setMomentValue.bind(assertThisInitialized(_this))\n }) : null\n }));\n });\n\n _this.textInput = React__default.createRef();\n _this.state = {\n isOpen: false,\n momentValue: _this.props.defaultValue || null,\n inputValue: _this.getValue(_this.props.defaultValue, _this.props.isGregorian, _this.props.timePicker),\n inputJalaaliFormat: _this.props.inputJalaaliFormat || _this.getInputFormat(false, _this.props.timePicker),\n inputFormat: _this.props.inputFormat || _this.getInputFormat(true, _this.props.timePicker),\n isGregorian: _this.props.isGregorian,\n timePicker: _this.props.timePicker,\n timePickerComponent: _this.props.timePicker ? MyTimePicker : undefined,\n setTodayOnBlur: _this.props.setTodayOnBlur\n };\n return _this;\n }\n\n createClass(DatePicker, [{\n key: \"getInputFormat\",\n value: function getInputFormat(isGregorian, timePicker) {\n if (timePicker) return isGregorian ? 'YYYY/M/D hh:mm A' : 'jYYYY/jM/jD hh:mm A';\n return isGregorian ? 'YYYY/M/D' : 'jYYYY/jM/jD';\n }\n }, {\n key: \"getValue\",\n value: function getValue(inputValue, isGregorian, timePicker) {\n if (!inputValue) return '';\n var inputFormat = this.state.inputFormat;\n var inputJalaaliFormat = this.state.inputJalaaliFormat;\n if (!inputFormat) inputFormat = this.getInputFormat(isGregorian, timePicker);\n if (!inputJalaaliFormat) inputJalaaliFormat = this.getInputFormat(isGregorian, timePicker);\n return isGregorian ? inputValue.locale('es').format(inputFormat) : inputValue.locale('fa').format(inputJalaaliFormat);\n }\n }, {\n key: \"UNSAFE_componentWillMount\",\n value: function UNSAFE_componentWillMount() {\n if (this.props.value) {\n this.setMomentValue(this.props.value);\n }\n }\n }, {\n key: \"UNSAFE_componentWillReceiveProps\",\n value: function UNSAFE_componentWillReceiveProps(nextProps) {\n if ('value' in nextProps) {\n if (nextProps.value === null) {\n this.setState({\n input: '',\n inputValue: '',\n momentValue: null\n });\n } else if (typeof nextProps.value === 'undefined' && typeof this.props.value !== 'undefined' || typeof nextProps.value !== 'undefined' && !nextProps.value.isSame(this.props.value)) {\n this.setMomentValue(nextProps.value);\n }\n }\n\n if ('isGregorian' in nextProps && nextProps.isGregorian !== this.props.isGregorian) {\n var nextPropsInputFormat = nextProps.inputFormat;\n var nextPropsInputJalaaliFormat = nextProps.inputJalaaliFormat;\n this.setState({\n isGregorian: nextProps.isGregorian,\n inputValue: this.getValue(nextProps.value, nextProps.isGregorian, nextProps.timePicker),\n inputFormat: nextPropsInputFormat || this.state.inputFormat,\n inputJalaaliFormat: nextPropsInputJalaaliFormat || this.state.inputJalaaliFormat\n });\n }\n\n if ('timePicker' in nextProps && nextProps.timePicker !== this.props.timePicker) {\n this.setState({\n timePicker: nextProps.timePicker,\n timePickerComponent: this.props.timePicker ? MyTimePicker : undefined\n });\n }\n\n if ('setTodayOnBlur' in nextProps && nextProps.setTodayOnBlur !== this.props.setTodayOnBlur) {\n this.setState({\n setTodayOnBlur: nextProps.setTodayOnBlur\n });\n }\n }\n }, {\n key: \"setMomentValue\",\n value: function setMomentValue(momentValue) {\n var _this$state3 = this.state,\n inputFormat = _this$state3.inputFormat,\n isGregorian = _this$state3.isGregorian,\n timePicker = _this$state3.timePicker;\n\n if (this.props.onChange) {\n this.props.onChange(momentValue);\n }\n\n var inputValue = this.getValue(momentValue, isGregorian, timePicker);\n this.setState({\n momentValue: momentValue,\n inputValue: inputValue\n });\n }\n }, {\n key: \"handleClickOutsideCalendar\",\n value: function handleClickOutsideCalendar() {\n this.setOpen(false);\n }\n }, {\n key: \"toEnglishDigits\",\n value: function toEnglishDigits(str) {\n if (!str) return str;\n var regex1 = /[\\u0660-\\u0669]/g;\n var regex2 = /[\\u06f0-\\u06f9]/g;\n return str.replace(regex1, function (c) {\n return c.charCodeAt(0) - 0x0660;\n }).replace(regex2, function (c) {\n return c.charCodeAt(0) - 0x06f0;\n });\n }\n }, {\n key: \"toPersianDigits\",\n value: function toPersianDigits(str) {\n if (!str) return str;\n var regex = /[0-9]/g;\n var id = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];\n return str.replace(regex, function (w) {\n return id[+w];\n });\n }\n }, {\n key: \"handleSelectDay\",\n value: function handleSelectDay(selectedDay) {\n var oldValue = this.state.momentValue;\n var momentValue = selectedDay.clone();\n\n if (oldValue) {\n momentValue = momentValue.set({\n hour: oldValue.hours(),\n minute: oldValue.minutes(),\n second: oldValue.seconds()\n });\n }\n\n this.setOpen(false);\n this.setMomentValue(momentValue);\n }\n }, {\n key: \"handleInputChange\",\n value: function handleInputChange(event) {\n var _this2 = this;\n\n var _this$state4 = this.state,\n inputFormat = _this$state4.inputFormat,\n inputJalaaliFormat = _this$state4.inputJalaaliFormat,\n isGregorian = _this$state4.isGregorian;\n var inputValue = this.toEnglishDigits(event.target.value);\n var currentInputFormat = isGregorian ? inputFormat : inputJalaaliFormat;\n var momentValue = momentJalaali(inputValue, currentInputFormat);\n var cursor = event.target.selectionStart;\n\n if (momentValue.isValid()) {\n this.setState({\n momentValue: momentValue\n });\n }\n\n this.setState({\n inputValue: inputValue\n }, function () {\n // It cause lose current cursor positon if persian digits is active\n // for example it convert 4 to ۴, so the react set cursor position to end of string\n if (_this2.props.persianDigits) _this2.input.setSelectionRange(cursor, cursor);\n });\n\n if (this.props.onInputChange) {\n this.props.onInputChange(event);\n }\n }\n }, {\n key: \"hanldeBlur\",\n value: function hanldeBlur(event) {\n if (this.props.onChange) {\n if (!event.target.value && this.state.setTodayOnBlur === false) return;\n var _this$state5 = this.state,\n inputFormat = _this$state5.inputFormat,\n inputJalaaliFormat = _this$state5.inputJalaaliFormat,\n isGregorian = _this$state5.isGregorian;\n var inputValue = this.toEnglishDigits(event.target.value);\n var currentInputFormat = isGregorian ? inputFormat : inputJalaaliFormat;\n var momentValue = momentJalaali(inputValue, currentInputFormat);\n\n if (event.target.value && momentValue.isValid()) {\n this.props.onChange(this.state.momentValue);\n } else if (this.state.setTodayOnBlur === true) {\n this.props.onChange(momentJalaali());\n }\n }\n }\n }, {\n key: \"handleInputClick\",\n value: function handleInputClick() {\n if (!this.props.disabled) {\n this.setOpen(true);\n }\n }\n }, {\n key: \"removeDate\",\n value: function removeDate() {\n var onChange = this.props.onChange;\n\n if (onChange) {\n onChange(null);\n }\n\n this.setState({\n input: '',\n inputValue: '',\n momentValue: null\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n var isOpen = this.state.isOpen;\n return /*#__PURE__*/React__default.createElement(TetherComponent, {\n ref: function ref(tether) {\n return _this3.tether = tether;\n },\n attachment: this.props.tetherAttachment ? this.props.tetherAttachment : 'top center',\n constraints: [{\n to: 'window',\n attachment: 'together'\n }],\n offset: \"-10px -10px\",\n onResize: function onResize() {\n return _this3.tether && _this3.tether.position();\n }\n /* renderTarget: This is what the item will be tethered to, make sure to attach the ref */\n ,\n renderTarget: function renderTarget(ref) {\n return _this3.renderInput(ref);\n }\n /* renderElement: If present, this item will be tethered to the the component returned by renderTarget */\n ,\n renderElement: function renderElement(ref) {\n return isOpen && _this3.renderCalendar(ref);\n }\n });\n }\n }]);\n\n return DatePicker;\n }(React.Component);\n\n defineProperty(DatePicker, \"propTypes\", {\n value: PropTypes.object,\n defaultValue: PropTypes.object,\n onChange: PropTypes.func,\n onInputChange: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n children: PropTypes.node,\n min: PropTypes.object,\n max: PropTypes.object,\n defaultYear: PropTypes.object,\n defaultMonth: PropTypes.object,\n inputFormat: PropTypes.string,\n inputJalaaliFormat: PropTypes.string,\n removable: PropTypes.bool,\n styles: PropTypes.object,\n calendarStyles: PropTypes.object,\n calendarContainerProps: PropTypes.object,\n isGregorian: PropTypes.bool,\n // jalaali or gregorian\n timePicker: PropTypes.bool,\n calendarClass: PropTypes.string,\n datePickerClass: PropTypes.string,\n tetherAttachment: PropTypes.string,\n inputReadOnly: PropTypes.bool,\n ranges: PropTypes.array,\n showToggleButton: PropTypes.bool,\n toggleButtonText: PropTypes.any,\n showTodayButton: PropTypes.bool,\n placeholder: PropTypes.string,\n name: PropTypes.string,\n persianDigits: PropTypes.bool,\n setTodayOnBlur: PropTypes.bool,\n disableYearSelector: PropTypes.bool\n });\n\n defineProperty(DatePicker, \"defaultProps\", {\n styles: undefined,\n calendarContainerProps: {},\n isGregorian: true,\n timePicker: true,\n showTodayButton: true,\n placeholder: '',\n name: '',\n persianDigits: true,\n setTodayOnBlur: true,\n disableYearSelector: false\n });\n\n momentJalaali.loadPersian({\n dialect: 'persian-modern'\n });\n\n exports.Calendar = Calendar;\n exports.default = DatePicker;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _react = _interopRequireWildcard(require(\"react\"));\n\nvar _propTypes = _interopRequireDefault(require(\"prop-types\"));\n\nvar _reactDom = _interopRequireDefault(require(\"react-dom\"));\n\nvar _tether = _interopRequireDefault(require(\"tether\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nif (!_tether.default) {\n console.error('It looks like Tether has not been included. Please load this dependency first https://github.com/HubSpot/tether');\n}\n\nvar renderElementToPropTypes = [_propTypes.default.string, _propTypes.default.shape({\n appendChild: _propTypes.default.func.isRequired\n})];\n\nvar childrenPropType = function childrenPropType(_ref, propName, componentName) {\n var children = _ref.children;\n\n var childCount = _react.Children.count(children);\n\n if (childCount > 0) {\n return new Error(\"\".concat(componentName, \" no longer uses children to render components. Please use renderTarget and renderElement instead.\"));\n }\n};\n\nvar attachmentPositions = ['auto auto', 'top left', 'top center', 'top right', 'middle left', 'middle center', 'middle right', 'bottom left', 'bottom center', 'bottom right'];\n\nvar TetherComponent =\n/*#__PURE__*/\nfunction (_Component) {\n _inherits(TetherComponent, _Component);\n\n function TetherComponent() {\n var _getPrototypeOf2;\n\n var _this;\n\n _classCallCheck(this, TetherComponent);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(TetherComponent)).call.apply(_getPrototypeOf2, [this].concat(args)));\n\n _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), \"_targetNode\", _react.default.createRef());\n\n _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), \"_elementNode\", _react.default.createRef());\n\n _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), \"_elementParentNode\", null);\n\n _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), \"_tetherInstance\", null);\n\n return _this;\n }\n\n _createClass(TetherComponent, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this._createContainer(); // The container is created after mounting\n // so we need to force an update to\n // enable tether\n // Cannot move _createContainer into the constructor\n // because of is a side effect: https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects\n\n\n this.forceUpdate();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n // If the container related props have changed, then update the container\n if (prevProps.renderElementTag !== this.props.renderElementTag || prevProps.renderElementTo !== this.props.renderElementTo) {\n this._createContainer();\n } // Verify if className props have changed\n\n\n if (this._elementParentNode && prevProps.className !== this.props.className) {\n var _this$_elementParentN, _this$_elementParentN2;\n\n // Add a bunch of checks against weird classNames\n var prevClasses = (prevProps.className || '').split(' ').filter(function (value) {\n return value.length > 0;\n });\n var currClasses = (this.props.className || '').split(' ').filter(function (value) {\n return value.length > 0;\n });\n\n (_this$_elementParentN = this._elementParentNode.classList).remove.apply(_this$_elementParentN, _toConsumableArray(prevClasses));\n\n (_this$_elementParentN2 = this._elementParentNode.classList).add.apply(_this$_elementParentN2, _toConsumableArray(currClasses));\n }\n\n this._update();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this._destroy();\n }\n }, {\n key: \"getTetherInstance\",\n value: function getTetherInstance() {\n return this._tetherInstance;\n }\n }, {\n key: \"disable\",\n value: function disable() {\n this._tetherInstance.disable();\n }\n }, {\n key: \"enable\",\n value: function enable() {\n this._tetherInstance.enable();\n }\n }, {\n key: \"on\",\n value: function on(event, handler, ctx) {\n this._tetherInstance.on(event, handler, ctx);\n }\n }, {\n key: \"once\",\n value: function once(event, handler, ctx) {\n this._tetherInstance.once(event, handler, ctx);\n }\n }, {\n key: \"off\",\n value: function off(event, handler) {\n this._tetherInstance.off(event, handler);\n }\n }, {\n key: \"position\",\n value: function position() {\n this._tetherInstance.position();\n }\n }, {\n key: \"_runRenders\",\n value: function _runRenders() {\n // To obtain the components, we run the render functions and pass in the ref\n // Later, when the component is mounted, the ref functions will be called\n // and trigger a tether update\n var targetComponent = typeof this.props.renderTarget === 'function' ? this.props.renderTarget(this._targetNode) : null;\n var elementComponent = typeof this.props.renderElement === 'function' ? this.props.renderElement(this._elementNode) : null; // Check if what has been returned is a valid react element\n\n if (!(0, _react.isValidElement)(targetComponent)) {\n targetComponent = null;\n }\n\n if (!(0, _react.isValidElement)(elementComponent)) {\n elementComponent = null;\n }\n\n return {\n targetComponent: targetComponent,\n elementComponent: elementComponent\n };\n }\n }, {\n key: \"_createTetherInstance\",\n value: function _createTetherInstance(tetherOptions) {\n if (this._tetherInstance) {\n this._destroy();\n }\n\n this._tetherInstance = new _tether.default(tetherOptions);\n\n this._registerEventListeners();\n }\n }, {\n key: \"_destroyTetherInstance\",\n value: function _destroyTetherInstance() {\n if (this._tetherInstance) {\n this._tetherInstance.destroy();\n\n this._tetherInstance = null;\n }\n }\n }, {\n key: \"_registerEventListeners\",\n value: function _registerEventListeners() {\n var _this2 = this;\n\n this.on('update', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return _this2.props.onUpdate && _this2.props.onUpdate.apply(_this2, args);\n });\n this.on('repositioned', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return _this2.props.onRepositioned && _this2.props.onRepositioned.apply(_this2, args);\n });\n }\n }, {\n key: \"_destroy\",\n value: function _destroy() {\n this._destroyTetherInstance();\n\n this._removeContainer();\n }\n }, {\n key: \"_createContainer\",\n value: function _createContainer() {\n // Create element node container if it hasn't been yet\n this._removeContainer();\n\n var _this$props = this.props,\n renderElementTag = _this$props.renderElementTag,\n className = _this$props.className; // Create a node that we can stick our content Component in\n\n this._elementParentNode = document.createElement(renderElementTag);\n this._elementParentNode.className = className || '';\n }\n }, {\n key: \"_addContainerToDOM\",\n value: function _addContainerToDOM() {\n // Append node to the render node\n if (this._elementParentNode.parentNode !== this._renderNode) {\n this._renderNode.appendChild(this._elementParentNode);\n }\n }\n }, {\n key: \"_removeContainer\",\n value: function _removeContainer() {\n if (this._elementParentNode && this._elementParentNode.parentNode) {\n this._elementParentNode.parentNode.removeChild(this._elementParentNode);\n }\n }\n }, {\n key: \"_update\",\n value: function _update() {\n // If no element component provided, bail out\n var shouldDestroy = !this._elementNode.current || !this._targetNode.current;\n\n if (shouldDestroy) {\n // Destroy Tether element if it has been created\n this._destroy();\n\n return;\n }\n\n this._updateTether();\n }\n }, {\n key: \"_updateTether\",\n value: function _updateTether() {\n var _this$props2 = this.props,\n children = _this$props2.children,\n renderElementTag = _this$props2.renderElementTag,\n renderElementTo = _this$props2.renderElementTo,\n id = _this$props2.id,\n className = _this$props2.className,\n style = _this$props2.style,\n renderTarget = _this$props2.renderTarget,\n renderElement = _this$props2.renderElement,\n options = _objectWithoutProperties(_this$props2, [\"children\", \"renderElementTag\", \"renderElementTo\", \"id\", \"className\", \"style\", \"renderTarget\", \"renderElement\"]);\n\n var tetherOptions = _objectSpread({\n target: this._targetNode.current,\n element: this._elementParentNode\n }, options);\n\n var idStr = id || '';\n\n if (this._elementParentNode.id !== idStr) {\n this._elementParentNode.id = idStr;\n }\n\n if (style) {\n var elementStyle = this._elementParentNode.style;\n Object.keys(style).forEach(function (key) {\n if (elementStyle[key] !== style[key]) {\n elementStyle[key] = style[key];\n }\n });\n }\n\n this._addContainerToDOM();\n\n if (this._tetherInstance) {\n this._tetherInstance.setOptions(tetherOptions);\n } else {\n this._createTetherInstance(tetherOptions);\n }\n\n this._tetherInstance.position();\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$_runRenders = this._runRenders(),\n targetComponent = _this$_runRenders.targetComponent,\n elementComponent = _this$_runRenders.elementComponent;\n\n if (!targetComponent) {\n return null;\n }\n\n return _react.default.createElement(_react.default.Fragment, null, targetComponent, elementComponent && this._elementParentNode && _reactDom.default.createPortal(elementComponent, this._elementParentNode));\n }\n }, {\n key: \"_renderNode\",\n get: function get() {\n var renderElementTo = this.props.renderElementTo;\n\n if (typeof renderElementTo === 'string') {\n return document.querySelector(renderElementTo);\n }\n\n return renderElementTo || document.body;\n }\n }]);\n\n return TetherComponent;\n}(_react.Component);\n\n_defineProperty(TetherComponent, \"propTypes\", {\n renderElementTag: _propTypes.default.string,\n renderElementTo: _propTypes.default.oneOfType(renderElementToPropTypes),\n attachment: _propTypes.default.oneOf(attachmentPositions).isRequired,\n targetAttachment: _propTypes.default.oneOf(attachmentPositions),\n offset: _propTypes.default.string,\n targetOffset: _propTypes.default.string,\n targetModifier: _propTypes.default.string,\n enabled: _propTypes.default.bool,\n classes: _propTypes.default.object,\n classPrefix: _propTypes.default.string,\n optimizations: _propTypes.default.object,\n constraints: _propTypes.default.array,\n id: _propTypes.default.string,\n className: _propTypes.default.string,\n style: _propTypes.default.object,\n onUpdate: _propTypes.default.func,\n onRepositioned: _propTypes.default.func,\n renderTarget: _propTypes.default.func,\n renderElement: _propTypes.default.func,\n children: childrenPropType\n});\n\n_defineProperty(TetherComponent, \"defaultProps\", {\n renderElementTag: 'div',\n renderElementTo: null\n});\n\nvar _default = TetherComponent;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _TetherComponent.default;\n }\n});\n\nvar _TetherComponent = _interopRequireDefault(require(\"./TetherComponent\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"