From 38da5b0d414597250a695f7e2bca357d24a8b29e Mon Sep 17 00:00:00 2001
From: Christoph Oberhofer
+ * [a, c, tx,
+ * b, d, ty]
+ *
+ * This is a short form for the 3x3 matrix:
+ *
+ * [a, c, tx,
+ * b, d, ty,
+ * 0, 0, 1]
+ *
+ * The last row is ignored so the array is shorter and operations are faster.
+ */
+ var mat2d = {};
+
+ /**
+ * Creates a new identity mat2d
+ *
+ * @returns {mat2d} a new 2x3 matrix
+ */
+ mat2d.create = function() {
+ var out = new glMatrix.ARRAY_TYPE(6);
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 1;
+ out[4] = 0;
+ out[5] = 0;
+ return out;
+ };
+
+ /**
+ * Creates a new mat2d initialized with values from an existing matrix
+ *
+ * @param {mat2d} a matrix to clone
+ * @returns {mat2d} a new 2x3 matrix
+ */
+ mat2d.clone = function(a) {
+ var out = new glMatrix.ARRAY_TYPE(6);
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ out[4] = a[4];
+ out[5] = a[5];
+ return out;
+ };
+
+ /**
+ * Copy the values from one mat2d to another
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the source matrix
+ * @returns {mat2d} out
+ */
+ mat2d.copy = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ out[4] = a[4];
+ out[5] = a[5];
+ return out;
+ };
+
+ /**
+ * Set a mat2d to the identity matrix
+ *
+ * @param {mat2d} out the receiving matrix
+ * @returns {mat2d} out
+ */
+ mat2d.identity = function(out) {
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 1;
+ out[4] = 0;
+ out[5] = 0;
+ return out;
+ };
+
+ /**
+ * Inverts a mat2d
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the source matrix
+ * @returns {mat2d} out
+ */
+ mat2d.invert = function(out, a) {
+ var aa = a[0], ab = a[1], ac = a[2], ad = a[3],
+ atx = a[4], aty = a[5];
+
+ var det = aa * ad - ab * ac;
+ if(!det){
+ return null;
+ }
+ det = 1.0 / det;
+
+ out[0] = ad * det;
+ out[1] = -ab * det;
+ out[2] = -ac * det;
+ out[3] = aa * det;
+ out[4] = (ac * aty - ad * atx) * det;
+ out[5] = (ab * atx - aa * aty) * det;
+ return out;
+ };
+
+ /**
+ * Calculates the determinant of a mat2d
+ *
+ * @param {mat2d} a the source matrix
+ * @returns {Number} determinant of a
+ */
+ mat2d.determinant = function (a) {
+ return a[0] * a[3] - a[1] * a[2];
+ };
+
+ /**
+ * Multiplies two mat2d's
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @returns {mat2d} out
+ */
+ mat2d.multiply = function (out, a, b) {
+ var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
+ b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
+ out[0] = a0 * b0 + a2 * b1;
+ out[1] = a1 * b0 + a3 * b1;
+ out[2] = a0 * b2 + a2 * b3;
+ out[3] = a1 * b2 + a3 * b3;
+ out[4] = a0 * b4 + a2 * b5 + a4;
+ out[5] = a1 * b4 + a3 * b5 + a5;
+ return out;
+ };
+
+ /**
+ * Alias for {@link mat2d.multiply}
+ * @function
+ */
+ mat2d.mul = mat2d.multiply;
+
+ /**
+ * Rotates a mat2d by the given angle
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the matrix to rotate
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat2d} out
+ */
+ mat2d.rotate = function (out, a, rad) {
+ var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
+ s = Math.sin(rad),
+ c = Math.cos(rad);
+ out[0] = a0 * c + a2 * s;
+ out[1] = a1 * c + a3 * s;
+ out[2] = a0 * -s + a2 * c;
+ out[3] = a1 * -s + a3 * c;
+ out[4] = a4;
+ out[5] = a5;
+ return out;
+ };
+
+ /**
+ * Scales the mat2d by the dimensions in the given vec2
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the matrix to translate
+ * @param {vec2} v the vec2 to scale the matrix by
+ * @returns {mat2d} out
+ **/
+ mat2d.scale = function(out, a, v) {
+ var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
+ v0 = v[0], v1 = v[1];
+ out[0] = a0 * v0;
+ out[1] = a1 * v0;
+ out[2] = a2 * v1;
+ out[3] = a3 * v1;
+ out[4] = a4;
+ out[5] = a5;
+ return out;
+ };
+
+ /**
+ * Translates the mat2d by the dimensions in the given vec2
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the matrix to translate
+ * @param {vec2} v the vec2 to translate the matrix by
+ * @returns {mat2d} out
+ **/
+ mat2d.translate = function(out, a, v) {
+ var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
+ v0 = v[0], v1 = v[1];
+ out[0] = a0;
+ out[1] = a1;
+ out[2] = a2;
+ out[3] = a3;
+ out[4] = a0 * v0 + a2 * v1 + a4;
+ out[5] = a1 * v0 + a3 * v1 + a5;
+ return out;
+ };
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.rotate(dest, dest, rad);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat2d} out
+ */
+ mat2d.fromRotation = function(out, rad) {
+ var s = Math.sin(rad), c = Math.cos(rad);
+ out[0] = c;
+ out[1] = s;
+ out[2] = -s;
+ out[3] = c;
+ out[4] = 0;
+ out[5] = 0;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.scale(dest, dest, vec);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat2d} out
+ */
+ mat2d.fromScaling = function(out, v) {
+ out[0] = v[0];
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = v[1];
+ out[4] = 0;
+ out[5] = 0;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.translate(dest, dest, vec);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {vec2} v Translation vector
+ * @returns {mat2d} out
+ */
+ mat2d.fromTranslation = function(out, v) {
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 1;
+ out[4] = v[0];
+ out[5] = v[1];
+ return out;
+ }
+
+ /**
+ * Returns a string representation of a mat2d
+ *
+ * @param {mat2d} a matrix to represent as a string
+ * @returns {String} string representation of the matrix
+ */
+ mat2d.str = function (a) {
+ return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' +
+ a[3] + ', ' + a[4] + ', ' + a[5] + ')';
+ };
+
+ /**
+ * Returns Frobenius norm of a mat2d
+ *
+ * @param {mat2d} a the matrix to calculate Frobenius norm of
+ * @returns {Number} Frobenius norm
+ */
+ mat2d.frob = function (a) {
+ return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))
+ };
+
+ module.exports = mat2d;
+
+
+/***/ },
+/* 13 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. */
+
+ var glMatrix = __webpack_require__(10);
+
+ /**
+ * @class 3x3 Matrix
+ * @name mat3
+ */
+ var mat3 = {};
+
+ /**
+ * Creates a new identity mat3
+ *
+ * @returns {mat3} a new 3x3 matrix
+ */
+ mat3.create = function() {
+ var out = new glMatrix.ARRAY_TYPE(9);
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 1;
+ out[5] = 0;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 1;
+ return out;
+ };
+
+ /**
+ * Copies the upper-left 3x3 values into the given mat3.
+ *
+ * @param {mat3} out the receiving 3x3 matrix
+ * @param {mat4} a the source 4x4 matrix
+ * @returns {mat3} out
+ */
+ mat3.fromMat4 = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[4];
+ out[4] = a[5];
+ out[5] = a[6];
+ out[6] = a[8];
+ out[7] = a[9];
+ out[8] = a[10];
+ return out;
+ };
+
+ /**
+ * Creates a new mat3 initialized with values from an existing matrix
+ *
+ * @param {mat3} a matrix to clone
+ * @returns {mat3} a new 3x3 matrix
+ */
+ mat3.clone = function(a) {
+ var out = new glMatrix.ARRAY_TYPE(9);
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ out[4] = a[4];
+ out[5] = a[5];
+ out[6] = a[6];
+ out[7] = a[7];
+ out[8] = a[8];
+ return out;
+ };
+
+ /**
+ * Copy the values from one mat3 to another
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the source matrix
+ * @returns {mat3} out
+ */
+ mat3.copy = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ out[4] = a[4];
+ out[5] = a[5];
+ out[6] = a[6];
+ out[7] = a[7];
+ out[8] = a[8];
+ return out;
+ };
+
+ /**
+ * Set a mat3 to the identity matrix
+ *
+ * @param {mat3} out the receiving matrix
+ * @returns {mat3} out
+ */
+ mat3.identity = function(out) {
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 1;
+ out[5] = 0;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 1;
+ return out;
+ };
+
+ /**
+ * Transpose the values of a mat3
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the source matrix
+ * @returns {mat3} out
+ */
+ mat3.transpose = function(out, a) {
+ // If we are transposing ourselves we can skip a few steps but have to cache some values
+ if (out === a) {
+ var a01 = a[1], a02 = a[2], a12 = a[5];
+ out[1] = a[3];
+ out[2] = a[6];
+ out[3] = a01;
+ out[5] = a[7];
+ out[6] = a02;
+ out[7] = a12;
+ } else {
+ out[0] = a[0];
+ out[1] = a[3];
+ out[2] = a[6];
+ out[3] = a[1];
+ out[4] = a[4];
+ out[5] = a[7];
+ out[6] = a[2];
+ out[7] = a[5];
+ out[8] = a[8];
+ }
+
+ return out;
+ };
+
+ /**
+ * Inverts a mat3
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the source matrix
+ * @returns {mat3} out
+ */
+ mat3.invert = function(out, a) {
+ var a00 = a[0], a01 = a[1], a02 = a[2],
+ a10 = a[3], a11 = a[4], a12 = a[5],
+ a20 = a[6], a21 = a[7], a22 = a[8],
+
+ b01 = a22 * a11 - a12 * a21,
+ b11 = -a22 * a10 + a12 * a20,
+ b21 = a21 * a10 - a11 * a20,
+
+ // Calculate the determinant
+ det = a00 * b01 + a01 * b11 + a02 * b21;
+
+ if (!det) {
+ return null;
+ }
+ det = 1.0 / det;
+
+ out[0] = b01 * det;
+ out[1] = (-a22 * a01 + a02 * a21) * det;
+ out[2] = (a12 * a01 - a02 * a11) * det;
+ out[3] = b11 * det;
+ out[4] = (a22 * a00 - a02 * a20) * det;
+ out[5] = (-a12 * a00 + a02 * a10) * det;
+ out[6] = b21 * det;
+ out[7] = (-a21 * a00 + a01 * a20) * det;
+ out[8] = (a11 * a00 - a01 * a10) * det;
+ return out;
+ };
+
+ /**
+ * Calculates the adjugate of a mat3
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the source matrix
+ * @returns {mat3} out
+ */
+ mat3.adjoint = function(out, a) {
+ var a00 = a[0], a01 = a[1], a02 = a[2],
+ a10 = a[3], a11 = a[4], a12 = a[5],
+ a20 = a[6], a21 = a[7], a22 = a[8];
+
+ out[0] = (a11 * a22 - a12 * a21);
+ out[1] = (a02 * a21 - a01 * a22);
+ out[2] = (a01 * a12 - a02 * a11);
+ out[3] = (a12 * a20 - a10 * a22);
+ out[4] = (a00 * a22 - a02 * a20);
+ out[5] = (a02 * a10 - a00 * a12);
+ out[6] = (a10 * a21 - a11 * a20);
+ out[7] = (a01 * a20 - a00 * a21);
+ out[8] = (a00 * a11 - a01 * a10);
+ return out;
+ };
+
+ /**
+ * Calculates the determinant of a mat3
+ *
+ * @param {mat3} a the source matrix
+ * @returns {Number} determinant of a
+ */
+ mat3.determinant = function (a) {
+ var a00 = a[0], a01 = a[1], a02 = a[2],
+ a10 = a[3], a11 = a[4], a12 = a[5],
+ a20 = a[6], a21 = a[7], a22 = a[8];
+
+ return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
+ };
+
+ /**
+ * Multiplies two mat3's
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @returns {mat3} out
+ */
+ mat3.multiply = function (out, a, b) {
+ var a00 = a[0], a01 = a[1], a02 = a[2],
+ a10 = a[3], a11 = a[4], a12 = a[5],
+ a20 = a[6], a21 = a[7], a22 = a[8],
+
+ b00 = b[0], b01 = b[1], b02 = b[2],
+ b10 = b[3], b11 = b[4], b12 = b[5],
+ b20 = b[6], b21 = b[7], b22 = b[8];
+
+ out[0] = b00 * a00 + b01 * a10 + b02 * a20;
+ out[1] = b00 * a01 + b01 * a11 + b02 * a21;
+ out[2] = b00 * a02 + b01 * a12 + b02 * a22;
+
+ out[3] = b10 * a00 + b11 * a10 + b12 * a20;
+ out[4] = b10 * a01 + b11 * a11 + b12 * a21;
+ out[5] = b10 * a02 + b11 * a12 + b12 * a22;
+
+ out[6] = b20 * a00 + b21 * a10 + b22 * a20;
+ out[7] = b20 * a01 + b21 * a11 + b22 * a21;
+ out[8] = b20 * a02 + b21 * a12 + b22 * a22;
+ return out;
+ };
+
+ /**
+ * Alias for {@link mat3.multiply}
+ * @function
+ */
+ mat3.mul = mat3.multiply;
+
+ /**
+ * Translate a mat3 by the given vector
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the matrix to translate
+ * @param {vec2} v vector to translate by
+ * @returns {mat3} out
+ */
+ mat3.translate = function(out, a, v) {
+ var a00 = a[0], a01 = a[1], a02 = a[2],
+ a10 = a[3], a11 = a[4], a12 = a[5],
+ a20 = a[6], a21 = a[7], a22 = a[8],
+ x = v[0], y = v[1];
+
+ out[0] = a00;
+ out[1] = a01;
+ out[2] = a02;
+
+ out[3] = a10;
+ out[4] = a11;
+ out[5] = a12;
+
+ out[6] = x * a00 + y * a10 + a20;
+ out[7] = x * a01 + y * a11 + a21;
+ out[8] = x * a02 + y * a12 + a22;
+ return out;
+ };
+
+ /**
+ * Rotates a mat3 by the given angle
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the matrix to rotate
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat3} out
+ */
+ mat3.rotate = function (out, a, rad) {
+ var a00 = a[0], a01 = a[1], a02 = a[2],
+ a10 = a[3], a11 = a[4], a12 = a[5],
+ a20 = a[6], a21 = a[7], a22 = a[8],
+
+ s = Math.sin(rad),
+ c = Math.cos(rad);
+
+ out[0] = c * a00 + s * a10;
+ out[1] = c * a01 + s * a11;
+ out[2] = c * a02 + s * a12;
+
+ out[3] = c * a10 - s * a00;
+ out[4] = c * a11 - s * a01;
+ out[5] = c * a12 - s * a02;
+
+ out[6] = a20;
+ out[7] = a21;
+ out[8] = a22;
+ return out;
+ };
+
+ /**
+ * Scales the mat3 by the dimensions in the given vec2
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the matrix to rotate
+ * @param {vec2} v the vec2 to scale the matrix by
+ * @returns {mat3} out
+ **/
+ mat3.scale = function(out, a, v) {
+ var x = v[0], y = v[1];
+
+ out[0] = x * a[0];
+ out[1] = x * a[1];
+ out[2] = x * a[2];
+
+ out[3] = y * a[3];
+ out[4] = y * a[4];
+ out[5] = y * a[5];
+
+ out[6] = a[6];
+ out[7] = a[7];
+ out[8] = a[8];
+ return out;
+ };
+
+ /**
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.translate(dest, dest, vec);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {vec2} v Translation vector
+ * @returns {mat3} out
+ */
+ mat3.fromTranslation = function(out, v) {
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 1;
+ out[5] = 0;
+ out[6] = v[0];
+ out[7] = v[1];
+ out[8] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.rotate(dest, dest, rad);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat3} out
+ */
+ mat3.fromRotation = function(out, rad) {
+ var s = Math.sin(rad), c = Math.cos(rad);
+
+ out[0] = c;
+ out[1] = s;
+ out[2] = 0;
+
+ out[3] = -s;
+ out[4] = c;
+ out[5] = 0;
+
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.scale(dest, dest, vec);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat3} out
+ */
+ mat3.fromScaling = function(out, v) {
+ out[0] = v[0];
+ out[1] = 0;
+ out[2] = 0;
+
+ out[3] = 0;
+ out[4] = v[1];
+ out[5] = 0;
+
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 1;
+ return out;
+ }
+
+ /**
+ * Copies the values from a mat2d into a mat3
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat2d} a the matrix to copy
+ * @returns {mat3} out
+ **/
+ mat3.fromMat2d = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = 0;
+
+ out[3] = a[2];
+ out[4] = a[3];
+ out[5] = 0;
+
+ out[6] = a[4];
+ out[7] = a[5];
+ out[8] = 1;
+ return out;
+ };
+
+ /**
+ * Calculates a 3x3 matrix from the given quaternion
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {quat} q Quaternion to create matrix from
+ *
+ * @returns {mat3} out
+ */
+ mat3.fromQuat = function (out, q) {
+ var x = q[0], y = q[1], z = q[2], w = q[3],
+ x2 = x + x,
+ y2 = y + y,
+ z2 = z + z,
+
+ xx = x * x2,
+ yx = y * x2,
+ yy = y * y2,
+ zx = z * x2,
+ zy = z * y2,
+ zz = z * z2,
+ wx = w * x2,
+ wy = w * y2,
+ wz = w * z2;
+
+ out[0] = 1 - yy - zz;
+ out[3] = yx - wz;
+ out[6] = zx + wy;
+
+ out[1] = yx + wz;
+ out[4] = 1 - xx - zz;
+ out[7] = zy - wx;
+
+ out[2] = zx - wy;
+ out[5] = zy + wx;
+ out[8] = 1 - xx - yy;
+
+ return out;
+ };
+
+ /**
+ * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {mat4} a Mat4 to derive the normal matrix from
+ *
+ * @returns {mat3} out
+ */
+ mat3.normalFromMat4 = function (out, a) {
+ var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
+ a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
+ a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
+ a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ // Calculate the determinant
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ if (!det) {
+ return null;
+ }
+ det = 1.0 / det;
+
+ out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
+ out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
+ out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
+
+ out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
+ out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
+ out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
+
+ out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
+ out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
+ out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
+
+ return out;
+ };
+
+ /**
+ * Returns a string representation of a mat3
+ *
+ * @param {mat3} mat matrix to represent as a string
+ * @returns {String} string representation of the matrix
+ */
+ mat3.str = function (a) {
+ return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' +
+ a[3] + ', ' + a[4] + ', ' + a[5] + ', ' +
+ a[6] + ', ' + a[7] + ', ' + a[8] + ')';
+ };
+
+ /**
+ * Returns Frobenius norm of a mat3
+ *
+ * @param {mat3} a the matrix to calculate Frobenius norm of
+ * @returns {Number} Frobenius norm
+ */
+ mat3.frob = function (a) {
+ return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))
+ };
+
+
+ module.exports = mat3;
+
+
+/***/ },
+/* 14 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. */
+
+ var glMatrix = __webpack_require__(10);
+
+ /**
+ * @class 4x4 Matrix
+ * @name mat4
+ */
+ var mat4 = {};
+
+ /**
+ * Creates a new identity mat4
+ *
+ * @returns {mat4} a new 4x4 matrix
+ */
+ mat4.create = function() {
+ var out = new glMatrix.ARRAY_TYPE(16);
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = 1;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = 1;
+ out[11] = 0;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+ return out;
+ };
+
+ /**
+ * Creates a new mat4 initialized with values from an existing matrix
+ *
+ * @param {mat4} a matrix to clone
+ * @returns {mat4} a new 4x4 matrix
+ */
+ mat4.clone = function(a) {
+ var out = new glMatrix.ARRAY_TYPE(16);
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ out[4] = a[4];
+ out[5] = a[5];
+ out[6] = a[6];
+ out[7] = a[7];
+ out[8] = a[8];
+ out[9] = a[9];
+ out[10] = a[10];
+ out[11] = a[11];
+ out[12] = a[12];
+ out[13] = a[13];
+ out[14] = a[14];
+ out[15] = a[15];
+ return out;
+ };
+
+ /**
+ * Copy the values from one mat4 to another
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the source matrix
+ * @returns {mat4} out
+ */
+ mat4.copy = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ out[4] = a[4];
+ out[5] = a[5];
+ out[6] = a[6];
+ out[7] = a[7];
+ out[8] = a[8];
+ out[9] = a[9];
+ out[10] = a[10];
+ out[11] = a[11];
+ out[12] = a[12];
+ out[13] = a[13];
+ out[14] = a[14];
+ out[15] = a[15];
+ return out;
+ };
+
+ /**
+ * Set a mat4 to the identity matrix
+ *
+ * @param {mat4} out the receiving matrix
+ * @returns {mat4} out
+ */
+ mat4.identity = function(out) {
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = 1;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = 1;
+ out[11] = 0;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+ return out;
+ };
+
+ /**
+ * Transpose the values of a mat4
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the source matrix
+ * @returns {mat4} out
+ */
+ mat4.transpose = function(out, a) {
+ // If we are transposing ourselves we can skip a few steps but have to cache some values
+ if (out === a) {
+ var a01 = a[1], a02 = a[2], a03 = a[3],
+ a12 = a[6], a13 = a[7],
+ a23 = a[11];
+
+ out[1] = a[4];
+ out[2] = a[8];
+ out[3] = a[12];
+ out[4] = a01;
+ out[6] = a[9];
+ out[7] = a[13];
+ out[8] = a02;
+ out[9] = a12;
+ out[11] = a[14];
+ out[12] = a03;
+ out[13] = a13;
+ out[14] = a23;
+ } else {
+ out[0] = a[0];
+ out[1] = a[4];
+ out[2] = a[8];
+ out[3] = a[12];
+ out[4] = a[1];
+ out[5] = a[5];
+ out[6] = a[9];
+ out[7] = a[13];
+ out[8] = a[2];
+ out[9] = a[6];
+ out[10] = a[10];
+ out[11] = a[14];
+ out[12] = a[3];
+ out[13] = a[7];
+ out[14] = a[11];
+ out[15] = a[15];
+ }
+
+ return out;
+ };
+
+ /**
+ * Inverts a mat4
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the source matrix
+ * @returns {mat4} out
+ */
+ mat4.invert = function(out, a) {
+ var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
+ a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
+ a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
+ a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32,
+
+ // Calculate the determinant
+ det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+
+ if (!det) {
+ return null;
+ }
+ det = 1.0 / det;
+
+ out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
+ out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
+ out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
+ out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
+ out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
+ out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
+ out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
+ out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
+ out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
+ out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
+ out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
+ out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
+ out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
+ out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
+ out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
+ out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
+
+ return out;
+ };
+
+ /**
+ * Calculates the adjugate of a mat4
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the source matrix
+ * @returns {mat4} out
+ */
+ mat4.adjoint = function(out, a) {
+ var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
+ a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
+ a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
+ a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
+
+ out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));
+ out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));
+ out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));
+ out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));
+ out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));
+ out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));
+ out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));
+ out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));
+ out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));
+ out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));
+ out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));
+ out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));
+ out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));
+ out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));
+ out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));
+ out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));
+ return out;
+ };
+
+ /**
+ * Calculates the determinant of a mat4
+ *
+ * @param {mat4} a the source matrix
+ * @returns {Number} determinant of a
+ */
+ mat4.determinant = function (a) {
+ var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
+ a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
+ a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
+ a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
+
+ b00 = a00 * a11 - a01 * a10,
+ b01 = a00 * a12 - a02 * a10,
+ b02 = a00 * a13 - a03 * a10,
+ b03 = a01 * a12 - a02 * a11,
+ b04 = a01 * a13 - a03 * a11,
+ b05 = a02 * a13 - a03 * a12,
+ b06 = a20 * a31 - a21 * a30,
+ b07 = a20 * a32 - a22 * a30,
+ b08 = a20 * a33 - a23 * a30,
+ b09 = a21 * a32 - a22 * a31,
+ b10 = a21 * a33 - a23 * a31,
+ b11 = a22 * a33 - a23 * a32;
+
+ // Calculate the determinant
+ return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
+ };
+
+ /**
+ * Multiplies two mat4's
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @returns {mat4} out
+ */
+ mat4.multiply = function (out, a, b) {
+ var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
+ a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
+ a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
+ a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
+
+ // Cache only the current line of the second matrix
+ var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
+ out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
+ out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
+ out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
+ out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
+
+ b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];
+ out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
+ out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
+ out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
+ out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
+
+ b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];
+ out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
+ out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
+ out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
+ out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
+
+ b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];
+ out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
+ out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
+ out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
+ out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
+ return out;
+ };
+
+ /**
+ * Alias for {@link mat4.multiply}
+ * @function
+ */
+ mat4.mul = mat4.multiply;
+
+ /**
+ * Translate a mat4 by the given vector
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to translate
+ * @param {vec3} v vector to translate by
+ * @returns {mat4} out
+ */
+ mat4.translate = function (out, a, v) {
+ var x = v[0], y = v[1], z = v[2],
+ a00, a01, a02, a03,
+ a10, a11, a12, a13,
+ a20, a21, a22, a23;
+
+ if (a === out) {
+ out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
+ out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
+ out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
+ out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
+ } else {
+ a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];
+ a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];
+ a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];
+
+ out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;
+ out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;
+ out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;
+
+ out[12] = a00 * x + a10 * y + a20 * z + a[12];
+ out[13] = a01 * x + a11 * y + a21 * z + a[13];
+ out[14] = a02 * x + a12 * y + a22 * z + a[14];
+ out[15] = a03 * x + a13 * y + a23 * z + a[15];
+ }
+
+ return out;
+ };
+
+ /**
+ * Scales the mat4 by the dimensions in the given vec3
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to scale
+ * @param {vec3} v the vec3 to scale the matrix by
+ * @returns {mat4} out
+ **/
+ mat4.scale = function(out, a, v) {
+ var x = v[0], y = v[1], z = v[2];
+
+ out[0] = a[0] * x;
+ out[1] = a[1] * x;
+ out[2] = a[2] * x;
+ out[3] = a[3] * x;
+ out[4] = a[4] * y;
+ out[5] = a[5] * y;
+ out[6] = a[6] * y;
+ out[7] = a[7] * y;
+ out[8] = a[8] * z;
+ out[9] = a[9] * z;
+ out[10] = a[10] * z;
+ out[11] = a[11] * z;
+ out[12] = a[12];
+ out[13] = a[13];
+ out[14] = a[14];
+ out[15] = a[15];
+ return out;
+ };
+
+ /**
+ * Rotates a mat4 by the given angle around the given axis
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to rotate
+ * @param {Number} rad the angle to rotate the matrix by
+ * @param {vec3} axis the axis to rotate around
+ * @returns {mat4} out
+ */
+ mat4.rotate = function (out, a, rad, axis) {
+ var x = axis[0], y = axis[1], z = axis[2],
+ len = Math.sqrt(x * x + y * y + z * z),
+ s, c, t,
+ a00, a01, a02, a03,
+ a10, a11, a12, a13,
+ a20, a21, a22, a23,
+ b00, b01, b02,
+ b10, b11, b12,
+ b20, b21, b22;
+
+ if (Math.abs(len) < glMatrix.EPSILON) { return null; }
+
+ len = 1 / len;
+ x *= len;
+ y *= len;
+ z *= len;
+
+ s = Math.sin(rad);
+ c = Math.cos(rad);
+ t = 1 - c;
+
+ a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];
+ a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];
+ a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];
+
+ // Construct the elements of the rotation matrix
+ b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;
+ b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;
+ b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;
+
+ // Perform rotation-specific matrix multiplication
+ out[0] = a00 * b00 + a10 * b01 + a20 * b02;
+ out[1] = a01 * b00 + a11 * b01 + a21 * b02;
+ out[2] = a02 * b00 + a12 * b01 + a22 * b02;
+ out[3] = a03 * b00 + a13 * b01 + a23 * b02;
+ out[4] = a00 * b10 + a10 * b11 + a20 * b12;
+ out[5] = a01 * b10 + a11 * b11 + a21 * b12;
+ out[6] = a02 * b10 + a12 * b11 + a22 * b12;
+ out[7] = a03 * b10 + a13 * b11 + a23 * b12;
+ out[8] = a00 * b20 + a10 * b21 + a20 * b22;
+ out[9] = a01 * b20 + a11 * b21 + a21 * b22;
+ out[10] = a02 * b20 + a12 * b21 + a22 * b22;
+ out[11] = a03 * b20 + a13 * b21 + a23 * b22;
+
+ if (a !== out) { // If the source and destination differ, copy the unchanged last row
+ out[12] = a[12];
+ out[13] = a[13];
+ out[14] = a[14];
+ out[15] = a[15];
+ }
+ return out;
+ };
+
+ /**
+ * Rotates a matrix by the given angle around the X axis
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to rotate
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
+ */
+ mat4.rotateX = function (out, a, rad) {
+ var s = Math.sin(rad),
+ c = Math.cos(rad),
+ a10 = a[4],
+ a11 = a[5],
+ a12 = a[6],
+ a13 = a[7],
+ a20 = a[8],
+ a21 = a[9],
+ a22 = a[10],
+ a23 = a[11];
+
+ if (a !== out) { // If the source and destination differ, copy the unchanged rows
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ out[12] = a[12];
+ out[13] = a[13];
+ out[14] = a[14];
+ out[15] = a[15];
+ }
+
+ // Perform axis-specific matrix multiplication
+ out[4] = a10 * c + a20 * s;
+ out[5] = a11 * c + a21 * s;
+ out[6] = a12 * c + a22 * s;
+ out[7] = a13 * c + a23 * s;
+ out[8] = a20 * c - a10 * s;
+ out[9] = a21 * c - a11 * s;
+ out[10] = a22 * c - a12 * s;
+ out[11] = a23 * c - a13 * s;
+ return out;
+ };
+
+ /**
+ * Rotates a matrix by the given angle around the Y axis
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to rotate
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
+ */
+ mat4.rotateY = function (out, a, rad) {
+ var s = Math.sin(rad),
+ c = Math.cos(rad),
+ a00 = a[0],
+ a01 = a[1],
+ a02 = a[2],
+ a03 = a[3],
+ a20 = a[8],
+ a21 = a[9],
+ a22 = a[10],
+ a23 = a[11];
+
+ if (a !== out) { // If the source and destination differ, copy the unchanged rows
+ out[4] = a[4];
+ out[5] = a[5];
+ out[6] = a[6];
+ out[7] = a[7];
+ out[12] = a[12];
+ out[13] = a[13];
+ out[14] = a[14];
+ out[15] = a[15];
+ }
+
+ // Perform axis-specific matrix multiplication
+ out[0] = a00 * c - a20 * s;
+ out[1] = a01 * c - a21 * s;
+ out[2] = a02 * c - a22 * s;
+ out[3] = a03 * c - a23 * s;
+ out[8] = a00 * s + a20 * c;
+ out[9] = a01 * s + a21 * c;
+ out[10] = a02 * s + a22 * c;
+ out[11] = a03 * s + a23 * c;
+ return out;
+ };
+
+ /**
+ * Rotates a matrix by the given angle around the Z axis
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to rotate
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
+ */
+ mat4.rotateZ = function (out, a, rad) {
+ var s = Math.sin(rad),
+ c = Math.cos(rad),
+ a00 = a[0],
+ a01 = a[1],
+ a02 = a[2],
+ a03 = a[3],
+ a10 = a[4],
+ a11 = a[5],
+ a12 = a[6],
+ a13 = a[7];
+
+ if (a !== out) { // If the source and destination differ, copy the unchanged last row
+ out[8] = a[8];
+ out[9] = a[9];
+ out[10] = a[10];
+ out[11] = a[11];
+ out[12] = a[12];
+ out[13] = a[13];
+ out[14] = a[14];
+ out[15] = a[15];
+ }
+
+ // Perform axis-specific matrix multiplication
+ out[0] = a00 * c + a10 * s;
+ out[1] = a01 * c + a11 * s;
+ out[2] = a02 * c + a12 * s;
+ out[3] = a03 * c + a13 * s;
+ out[4] = a10 * c - a00 * s;
+ out[5] = a11 * c - a01 * s;
+ out[6] = a12 * c - a02 * s;
+ out[7] = a13 * c - a03 * s;
+ return out;
+ };
+
+ /**
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, dest, vec);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {vec3} v Translation vector
+ * @returns {mat4} out
+ */
+ mat4.fromTranslation = function(out, v) {
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = 1;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = 1;
+ out[11] = 0;
+ out[12] = v[0];
+ out[13] = v[1];
+ out[14] = v[2];
+ out[15] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.scale(dest, dest, vec);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {vec3} v Scaling vector
+ * @returns {mat4} out
+ */
+ mat4.fromScaling = function(out, v) {
+ out[0] = v[0];
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = v[1];
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = v[2];
+ out[11] = 0;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from a given angle around a given axis
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.rotate(dest, dest, rad, axis);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {Number} rad the angle to rotate the matrix by
+ * @param {vec3} axis the axis to rotate around
+ * @returns {mat4} out
+ */
+ mat4.fromRotation = function(out, rad, axis) {
+ var x = axis[0], y = axis[1], z = axis[2],
+ len = Math.sqrt(x * x + y * y + z * z),
+ s, c, t;
+
+ if (Math.abs(len) < glMatrix.EPSILON) { return null; }
+
+ len = 1 / len;
+ x *= len;
+ y *= len;
+ z *= len;
+
+ s = Math.sin(rad);
+ c = Math.cos(rad);
+ t = 1 - c;
+
+ // Perform rotation-specific matrix multiplication
+ out[0] = x * x * t + c;
+ out[1] = y * x * t + z * s;
+ out[2] = z * x * t - y * s;
+ out[3] = 0;
+ out[4] = x * y * t - z * s;
+ out[5] = y * y * t + c;
+ out[6] = z * y * t + x * s;
+ out[7] = 0;
+ out[8] = x * z * t + y * s;
+ out[9] = y * z * t - x * s;
+ out[10] = z * z * t + c;
+ out[11] = 0;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from the given angle around the X axis
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.rotateX(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
+ */
+ mat4.fromXRotation = function(out, rad) {
+ var s = Math.sin(rad),
+ c = Math.cos(rad);
+
+ // Perform axis-specific matrix multiplication
+ out[0] = 1;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = c;
+ out[6] = s;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = -s;
+ out[10] = c;
+ out[11] = 0;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from the given angle around the Y axis
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.rotateY(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
+ */
+ mat4.fromYRotation = function(out, rad) {
+ var s = Math.sin(rad),
+ c = Math.cos(rad);
+
+ // Perform axis-specific matrix multiplication
+ out[0] = c;
+ out[1] = 0;
+ out[2] = -s;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = 1;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = s;
+ out[9] = 0;
+ out[10] = c;
+ out[11] = 0;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from the given angle around the Z axis
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.rotateZ(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {Number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
+ */
+ mat4.fromZRotation = function(out, rad) {
+ var s = Math.sin(rad),
+ c = Math.cos(rad);
+
+ // Perform axis-specific matrix multiplication
+ out[0] = c;
+ out[1] = s;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = -s;
+ out[5] = c;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = 1;
+ out[11] = 0;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+ return out;
+ }
+
+ /**
+ * Creates a matrix from a quaternion rotation and vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {quat4} q Rotation quaternion
+ * @param {vec3} v Translation vector
+ * @returns {mat4} out
+ */
+ mat4.fromRotationTranslation = function (out, q, v) {
+ // Quaternion math
+ var x = q[0], y = q[1], z = q[2], w = q[3],
+ x2 = x + x,
+ y2 = y + y,
+ z2 = z + z,
+
+ xx = x * x2,
+ xy = x * y2,
+ xz = x * z2,
+ yy = y * y2,
+ yz = y * z2,
+ zz = z * z2,
+ wx = w * x2,
+ wy = w * y2,
+ wz = w * z2;
+
+ out[0] = 1 - (yy + zz);
+ out[1] = xy + wz;
+ out[2] = xz - wy;
+ out[3] = 0;
+ out[4] = xy - wz;
+ out[5] = 1 - (xx + zz);
+ out[6] = yz + wx;
+ out[7] = 0;
+ out[8] = xz + wy;
+ out[9] = yz - wx;
+ out[10] = 1 - (xx + yy);
+ out[11] = 0;
+ out[12] = v[0];
+ out[13] = v[1];
+ out[14] = v[2];
+ out[15] = 1;
+
+ return out;
+ };
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {quat4} q Rotation quaternion
+ * @param {vec3} v Translation vector
+ * @param {vec3} s Scaling vector
+ * @returns {mat4} out
+ */
+ mat4.fromRotationTranslationScale = function (out, q, v, s) {
+ // Quaternion math
+ var x = q[0], y = q[1], z = q[2], w = q[3],
+ x2 = x + x,
+ y2 = y + y,
+ z2 = z + z,
+
+ xx = x * x2,
+ xy = x * y2,
+ xz = x * z2,
+ yy = y * y2,
+ yz = y * z2,
+ zz = z * z2,
+ wx = w * x2,
+ wy = w * y2,
+ wz = w * z2,
+ sx = s[0],
+ sy = s[1],
+ sz = s[2];
+
+ out[0] = (1 - (yy + zz)) * sx;
+ out[1] = (xy + wz) * sx;
+ out[2] = (xz - wy) * sx;
+ out[3] = 0;
+ out[4] = (xy - wz) * sy;
+ out[5] = (1 - (xx + zz)) * sy;
+ out[6] = (yz + wx) * sy;
+ out[7] = 0;
+ out[8] = (xz + wy) * sz;
+ out[9] = (yz - wx) * sz;
+ out[10] = (1 - (xx + yy)) * sz;
+ out[11] = 0;
+ out[12] = v[0];
+ out[13] = v[1];
+ out[14] = v[2];
+ out[15] = 1;
+
+ return out;
+ };
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * mat4.translate(dest, origin);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
+ * mat4.translate(dest, negativeOrigin);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {quat4} q Rotation quaternion
+ * @param {vec3} v Translation vector
+ * @param {vec3} s Scaling vector
+ * @param {vec3} o The origin vector around which to scale and rotate
+ * @returns {mat4} out
+ */
+ mat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {
+ // Quaternion math
+ var x = q[0], y = q[1], z = q[2], w = q[3],
+ x2 = x + x,
+ y2 = y + y,
+ z2 = z + z,
+
+ xx = x * x2,
+ xy = x * y2,
+ xz = x * z2,
+ yy = y * y2,
+ yz = y * z2,
+ zz = z * z2,
+ wx = w * x2,
+ wy = w * y2,
+ wz = w * z2,
+
+ sx = s[0],
+ sy = s[1],
+ sz = s[2],
+
+ ox = o[0],
+ oy = o[1],
+ oz = o[2];
+
+ out[0] = (1 - (yy + zz)) * sx;
+ out[1] = (xy + wz) * sx;
+ out[2] = (xz - wy) * sx;
+ out[3] = 0;
+ out[4] = (xy - wz) * sy;
+ out[5] = (1 - (xx + zz)) * sy;
+ out[6] = (yz + wx) * sy;
+ out[7] = 0;
+ out[8] = (xz + wy) * sz;
+ out[9] = (yz - wx) * sz;
+ out[10] = (1 - (xx + yy)) * sz;
+ out[11] = 0;
+ out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);
+ out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);
+ out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);
+ out[15] = 1;
+
+ return out;
+ };
+
+ mat4.fromQuat = function (out, q) {
+ var x = q[0], y = q[1], z = q[2], w = q[3],
+ x2 = x + x,
+ y2 = y + y,
+ z2 = z + z,
+
+ xx = x * x2,
+ yx = y * x2,
+ yy = y * y2,
+ zx = z * x2,
+ zy = z * y2,
+ zz = z * z2,
+ wx = w * x2,
+ wy = w * y2,
+ wz = w * z2;
+
+ out[0] = 1 - yy - zz;
+ out[1] = yx + wz;
+ out[2] = zx - wy;
+ out[3] = 0;
+
+ out[4] = yx - wz;
+ out[5] = 1 - xx - zz;
+ out[6] = zy + wx;
+ out[7] = 0;
+
+ out[8] = zx + wy;
+ out[9] = zy - wx;
+ out[10] = 1 - xx - yy;
+ out[11] = 0;
+
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = 0;
+ out[15] = 1;
+
+ return out;
+ };
+
+ /**
+ * Generates a frustum matrix with the given bounds
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {Number} left Left bound of the frustum
+ * @param {Number} right Right bound of the frustum
+ * @param {Number} bottom Bottom bound of the frustum
+ * @param {Number} top Top bound of the frustum
+ * @param {Number} near Near bound of the frustum
+ * @param {Number} far Far bound of the frustum
+ * @returns {mat4} out
+ */
+ mat4.frustum = function (out, left, right, bottom, top, near, far) {
+ var rl = 1 / (right - left),
+ tb = 1 / (top - bottom),
+ nf = 1 / (near - far);
+ out[0] = (near * 2) * rl;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = (near * 2) * tb;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = (right + left) * rl;
+ out[9] = (top + bottom) * tb;
+ out[10] = (far + near) * nf;
+ out[11] = -1;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = (far * near * 2) * nf;
+ out[15] = 0;
+ return out;
+ };
+
+ /**
+ * Generates a perspective projection matrix with the given bounds
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {number} fovy Vertical field of view in radians
+ * @param {number} aspect Aspect ratio. typically viewport width/height
+ * @param {number} near Near bound of the frustum
+ * @param {number} far Far bound of the frustum
+ * @returns {mat4} out
+ */
+ mat4.perspective = function (out, fovy, aspect, near, far) {
+ var f = 1.0 / Math.tan(fovy / 2),
+ nf = 1 / (near - far);
+ out[0] = f / aspect;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = f;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = (far + near) * nf;
+ out[11] = -1;
+ out[12] = 0;
+ out[13] = 0;
+ out[14] = (2 * far * near) * nf;
+ out[15] = 0;
+ return out;
+ };
+
+ /**
+ * Generates a perspective projection matrix with the given field of view.
+ * This is primarily useful for generating projection matrices to be used
+ * with the still experiemental WebVR API.
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
+ * @param {number} near Near bound of the frustum
+ * @param {number} far Far bound of the frustum
+ * @returns {mat4} out
+ */
+ mat4.perspectiveFromFieldOfView = function (out, fov, near, far) {
+ var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),
+ downTan = Math.tan(fov.downDegrees * Math.PI/180.0),
+ leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),
+ rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),
+ xScale = 2.0 / (leftTan + rightTan),
+ yScale = 2.0 / (upTan + downTan);
+
+ out[0] = xScale;
+ out[1] = 0.0;
+ out[2] = 0.0;
+ out[3] = 0.0;
+ out[4] = 0.0;
+ out[5] = yScale;
+ out[6] = 0.0;
+ out[7] = 0.0;
+ out[8] = -((leftTan - rightTan) * xScale * 0.5);
+ out[9] = ((upTan - downTan) * yScale * 0.5);
+ out[10] = far / (near - far);
+ out[11] = -1.0;
+ out[12] = 0.0;
+ out[13] = 0.0;
+ out[14] = (far * near) / (near - far);
+ out[15] = 0.0;
+ return out;
+ }
+
+ /**
+ * Generates a orthogonal projection matrix with the given bounds
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {number} left Left bound of the frustum
+ * @param {number} right Right bound of the frustum
+ * @param {number} bottom Bottom bound of the frustum
+ * @param {number} top Top bound of the frustum
+ * @param {number} near Near bound of the frustum
+ * @param {number} far Far bound of the frustum
+ * @returns {mat4} out
+ */
+ mat4.ortho = function (out, left, right, bottom, top, near, far) {
+ var lr = 1 / (left - right),
+ bt = 1 / (bottom - top),
+ nf = 1 / (near - far);
+ out[0] = -2 * lr;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = -2 * bt;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = 2 * nf;
+ out[11] = 0;
+ out[12] = (left + right) * lr;
+ out[13] = (top + bottom) * bt;
+ out[14] = (far + near) * nf;
+ out[15] = 1;
+ return out;
+ };
+
+ /**
+ * Generates a look-at matrix with the given eye position, focal point, and up axis
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {vec3} eye Position of the viewer
+ * @param {vec3} center Point the viewer is looking at
+ * @param {vec3} up vec3 pointing up
+ * @returns {mat4} out
+ */
+ mat4.lookAt = function (out, eye, center, up) {
+ var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,
+ eyex = eye[0],
+ eyey = eye[1],
+ eyez = eye[2],
+ upx = up[0],
+ upy = up[1],
+ upz = up[2],
+ centerx = center[0],
+ centery = center[1],
+ centerz = center[2];
+
+ if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&
+ Math.abs(eyey - centery) < glMatrix.EPSILON &&
+ Math.abs(eyez - centerz) < glMatrix.EPSILON) {
+ return mat4.identity(out);
+ }
+
+ z0 = eyex - centerx;
+ z1 = eyey - centery;
+ z2 = eyez - centerz;
+
+ len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);
+ z0 *= len;
+ z1 *= len;
+ z2 *= len;
+
+ x0 = upy * z2 - upz * z1;
+ x1 = upz * z0 - upx * z2;
+ x2 = upx * z1 - upy * z0;
+ len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);
+ if (!len) {
+ x0 = 0;
+ x1 = 0;
+ x2 = 0;
+ } else {
+ len = 1 / len;
+ x0 *= len;
+ x1 *= len;
+ x2 *= len;
+ }
+
+ y0 = z1 * x2 - z2 * x1;
+ y1 = z2 * x0 - z0 * x2;
+ y2 = z0 * x1 - z1 * x0;
+
+ len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);
+ if (!len) {
+ y0 = 0;
+ y1 = 0;
+ y2 = 0;
+ } else {
+ len = 1 / len;
+ y0 *= len;
+ y1 *= len;
+ y2 *= len;
+ }
+
+ out[0] = x0;
+ out[1] = y0;
+ out[2] = z0;
+ out[3] = 0;
+ out[4] = x1;
+ out[5] = y1;
+ out[6] = z1;
+ out[7] = 0;
+ out[8] = x2;
+ out[9] = y2;
+ out[10] = z2;
+ out[11] = 0;
+ out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);
+ out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);
+ out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);
+ out[15] = 1;
+
+ return out;
+ };
+
+ /**
+ * Returns a string representation of a mat4
+ *
+ * @param {mat4} mat matrix to represent as a string
+ * @returns {String} string representation of the matrix
+ */
+ mat4.str = function (a) {
+ return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +
+ a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +
+ a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' +
+ a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';
+ };
+
+ /**
+ * Returns Frobenius norm of a mat4
+ *
+ * @param {mat4} a the matrix to calculate Frobenius norm of
+ * @returns {Number} Frobenius norm
+ */
+ mat4.frob = function (a) {
+ return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))
+ };
+
+
+ module.exports = mat4;
+
+
+/***/ },
+/* 15 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. */
+
+ var glMatrix = __webpack_require__(10);
+ var mat3 = __webpack_require__(13);
+ var vec3 = __webpack_require__(16);
+ var vec4 = __webpack_require__(17);
+
+ /**
+ * @class Quaternion
+ * @name quat
+ */
+ var quat = {};
+
+ /**
+ * Creates a new identity quat
+ *
+ * @returns {quat} a new quaternion
+ */
+ quat.create = function() {
+ var out = new glMatrix.ARRAY_TYPE(4);
+ out[0] = 0;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 1;
+ return out;
+ };
+
+ /**
+ * Sets a quaternion to represent the shortest rotation from one
+ * vector to another.
+ *
+ * Both vectors are assumed to be unit length.
+ *
+ * @param {quat} out the receiving quaternion.
+ * @param {vec3} a the initial vector
+ * @param {vec3} b the destination vector
+ * @returns {quat} out
+ */
+ quat.rotationTo = (function() {
+ var tmpvec3 = vec3.create();
+ var xUnitVec3 = vec3.fromValues(1,0,0);
+ var yUnitVec3 = vec3.fromValues(0,1,0);
+
+ return function(out, a, b) {
+ var dot = vec3.dot(a, b);
+ if (dot < -0.999999) {
+ vec3.cross(tmpvec3, xUnitVec3, a);
+ if (vec3.length(tmpvec3) < 0.000001)
+ vec3.cross(tmpvec3, yUnitVec3, a);
+ vec3.normalize(tmpvec3, tmpvec3);
+ quat.setAxisAngle(out, tmpvec3, Math.PI);
+ return out;
+ } else if (dot > 0.999999) {
+ out[0] = 0;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 1;
+ return out;
+ } else {
+ vec3.cross(tmpvec3, a, b);
+ out[0] = tmpvec3[0];
+ out[1] = tmpvec3[1];
+ out[2] = tmpvec3[2];
+ out[3] = 1 + dot;
+ return quat.normalize(out, out);
+ }
+ };
+ })();
+
+ /**
+ * Sets the specified quaternion with values corresponding to the given
+ * axes. Each axis is a vec3 and is expected to be unit length and
+ * perpendicular to all other specified axes.
+ *
+ * @param {vec3} view the vector representing the viewing direction
+ * @param {vec3} right the vector representing the local "right" direction
+ * @param {vec3} up the vector representing the local "up" direction
+ * @returns {quat} out
+ */
+ quat.setAxes = (function() {
+ var matr = mat3.create();
+
+ return function(out, view, right, up) {
+ matr[0] = right[0];
+ matr[3] = right[1];
+ matr[6] = right[2];
+
+ matr[1] = up[0];
+ matr[4] = up[1];
+ matr[7] = up[2];
+
+ matr[2] = -view[0];
+ matr[5] = -view[1];
+ matr[8] = -view[2];
+
+ return quat.normalize(out, quat.fromMat3(out, matr));
+ };
+ })();
+
+ /**
+ * Creates a new quat initialized with values from an existing quaternion
+ *
+ * @param {quat} a quaternion to clone
+ * @returns {quat} a new quaternion
+ * @function
+ */
+ quat.clone = vec4.clone;
+
+ /**
+ * Creates a new quat initialized with the given values
+ *
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @param {Number} z Z component
+ * @param {Number} w W component
+ * @returns {quat} a new quaternion
+ * @function
+ */
+ quat.fromValues = vec4.fromValues;
+
+ /**
+ * Copy the values from one quat to another
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the source quaternion
+ * @returns {quat} out
+ * @function
+ */
+ quat.copy = vec4.copy;
+
+ /**
+ * Set the components of a quat to the given values
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @param {Number} z Z component
+ * @param {Number} w W component
+ * @returns {quat} out
+ * @function
+ */
+ quat.set = vec4.set;
+
+ /**
+ * Set a quat to the identity quaternion
+ *
+ * @param {quat} out the receiving quaternion
+ * @returns {quat} out
+ */
+ quat.identity = function(out) {
+ out[0] = 0;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 1;
+ return out;
+ };
+
+ /**
+ * Sets a quat from the given angle and rotation axis,
+ * then returns it.
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {vec3} axis the axis around which to rotate
+ * @param {Number} rad the angle in radians
+ * @returns {quat} out
+ **/
+ quat.setAxisAngle = function(out, axis, rad) {
+ rad = rad * 0.5;
+ var s = Math.sin(rad);
+ out[0] = s * axis[0];
+ out[1] = s * axis[1];
+ out[2] = s * axis[2];
+ out[3] = Math.cos(rad);
+ return out;
+ };
+
+ /**
+ * Adds two quat's
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @returns {quat} out
+ * @function
+ */
+ quat.add = vec4.add;
+
+ /**
+ * Multiplies two quat's
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @returns {quat} out
+ */
+ quat.multiply = function(out, a, b) {
+ var ax = a[0], ay = a[1], az = a[2], aw = a[3],
+ bx = b[0], by = b[1], bz = b[2], bw = b[3];
+
+ out[0] = ax * bw + aw * bx + ay * bz - az * by;
+ out[1] = ay * bw + aw * by + az * bx - ax * bz;
+ out[2] = az * bw + aw * bz + ax * by - ay * bx;
+ out[3] = aw * bw - ax * bx - ay * by - az * bz;
+ return out;
+ };
+
+ /**
+ * Alias for {@link quat.multiply}
+ * @function
+ */
+ quat.mul = quat.multiply;
+
+ /**
+ * Scales a quat by a scalar number
+ *
+ * @param {quat} out the receiving vector
+ * @param {quat} a the vector to scale
+ * @param {Number} b amount to scale the vector by
+ * @returns {quat} out
+ * @function
+ */
+ quat.scale = vec4.scale;
+
+ /**
+ * Rotates a quaternion by the given angle about the X axis
+ *
+ * @param {quat} out quat receiving operation result
+ * @param {quat} a quat to rotate
+ * @param {number} rad angle (in radians) to rotate
+ * @returns {quat} out
+ */
+ quat.rotateX = function (out, a, rad) {
+ rad *= 0.5;
+
+ var ax = a[0], ay = a[1], az = a[2], aw = a[3],
+ bx = Math.sin(rad), bw = Math.cos(rad);
+
+ out[0] = ax * bw + aw * bx;
+ out[1] = ay * bw + az * bx;
+ out[2] = az * bw - ay * bx;
+ out[3] = aw * bw - ax * bx;
+ return out;
+ };
+
+ /**
+ * Rotates a quaternion by the given angle about the Y axis
+ *
+ * @param {quat} out quat receiving operation result
+ * @param {quat} a quat to rotate
+ * @param {number} rad angle (in radians) to rotate
+ * @returns {quat} out
+ */
+ quat.rotateY = function (out, a, rad) {
+ rad *= 0.5;
+
+ var ax = a[0], ay = a[1], az = a[2], aw = a[3],
+ by = Math.sin(rad), bw = Math.cos(rad);
+
+ out[0] = ax * bw - az * by;
+ out[1] = ay * bw + aw * by;
+ out[2] = az * bw + ax * by;
+ out[3] = aw * bw - ay * by;
+ return out;
+ };
+
+ /**
+ * Rotates a quaternion by the given angle about the Z axis
+ *
+ * @param {quat} out quat receiving operation result
+ * @param {quat} a quat to rotate
+ * @param {number} rad angle (in radians) to rotate
+ * @returns {quat} out
+ */
+ quat.rotateZ = function (out, a, rad) {
+ rad *= 0.5;
+
+ var ax = a[0], ay = a[1], az = a[2], aw = a[3],
+ bz = Math.sin(rad), bw = Math.cos(rad);
+
+ out[0] = ax * bw + ay * bz;
+ out[1] = ay * bw - ax * bz;
+ out[2] = az * bw + aw * bz;
+ out[3] = aw * bw - az * bz;
+ return out;
+ };
+
+ /**
+ * Calculates the W component of a quat from the X, Y, and Z components.
+ * Assumes that quaternion is 1 unit in length.
+ * Any existing W component will be ignored.
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a quat to calculate W component of
+ * @returns {quat} out
+ */
+ quat.calculateW = function (out, a) {
+ var x = a[0], y = a[1], z = a[2];
+
+ out[0] = x;
+ out[1] = y;
+ out[2] = z;
+ out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));
+ return out;
+ };
+
+ /**
+ * Calculates the dot product of two quat's
+ *
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @returns {Number} dot product of a and b
+ * @function
+ */
+ quat.dot = vec4.dot;
+
+ /**
+ * Performs a linear interpolation between two quat's
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @param {Number} t interpolation amount between the two inputs
+ * @returns {quat} out
+ * @function
+ */
+ quat.lerp = vec4.lerp;
+
+ /**
+ * Performs a spherical linear interpolation between two quat
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @param {Number} t interpolation amount between the two inputs
+ * @returns {quat} out
+ */
+ quat.slerp = function (out, a, b, t) {
+ // benchmarks:
+ // http://jsperf.com/quaternion-slerp-implementations
+
+ var ax = a[0], ay = a[1], az = a[2], aw = a[3],
+ bx = b[0], by = b[1], bz = b[2], bw = b[3];
+
+ var omega, cosom, sinom, scale0, scale1;
+
+ // calc cosine
+ cosom = ax * bx + ay * by + az * bz + aw * bw;
+ // adjust signs (if necessary)
+ if ( cosom < 0.0 ) {
+ cosom = -cosom;
+ bx = - bx;
+ by = - by;
+ bz = - bz;
+ bw = - bw;
+ }
+ // calculate coefficients
+ if ( (1.0 - cosom) > 0.000001 ) {
+ // standard case (slerp)
+ omega = Math.acos(cosom);
+ sinom = Math.sin(omega);
+ scale0 = Math.sin((1.0 - t) * omega) / sinom;
+ scale1 = Math.sin(t * omega) / sinom;
+ } else {
+ // "from" and "to" quaternions are very close
+ // ... so we can do a linear interpolation
+ scale0 = 1.0 - t;
+ scale1 = t;
+ }
+ // calculate final values
+ out[0] = scale0 * ax + scale1 * bx;
+ out[1] = scale0 * ay + scale1 * by;
+ out[2] = scale0 * az + scale1 * bz;
+ out[3] = scale0 * aw + scale1 * bw;
+
+ return out;
+ };
+
+ /**
+ * Performs a spherical linear interpolation with two control points
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @param {quat} c the third operand
+ * @param {quat} d the fourth operand
+ * @param {Number} t interpolation amount
+ * @returns {quat} out
+ */
+ quat.sqlerp = (function () {
+ var temp1 = quat.create();
+ var temp2 = quat.create();
+
+ return function (out, a, b, c, d, t) {
+ quat.slerp(temp1, a, d, t);
+ quat.slerp(temp2, b, c, t);
+ quat.slerp(out, temp1, temp2, 2 * t * (1 - t));
+
+ return out;
+ };
+ }());
+
+ /**
+ * Calculates the inverse of a quat
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a quat to calculate inverse of
+ * @returns {quat} out
+ */
+ quat.invert = function(out, a) {
+ var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
+ dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,
+ invDot = dot ? 1.0/dot : 0;
+
+ // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0
+
+ out[0] = -a0*invDot;
+ out[1] = -a1*invDot;
+ out[2] = -a2*invDot;
+ out[3] = a3*invDot;
+ return out;
+ };
+
+ /**
+ * Calculates the conjugate of a quat
+ * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a quat to calculate conjugate of
+ * @returns {quat} out
+ */
+ quat.conjugate = function (out, a) {
+ out[0] = -a[0];
+ out[1] = -a[1];
+ out[2] = -a[2];
+ out[3] = a[3];
+ return out;
+ };
+
+ /**
+ * Calculates the length of a quat
+ *
+ * @param {quat} a vector to calculate length of
+ * @returns {Number} length of a
+ * @function
+ */
+ quat.length = vec4.length;
+
+ /**
+ * Alias for {@link quat.length}
+ * @function
+ */
+ quat.len = quat.length;
+
+ /**
+ * Calculates the squared length of a quat
+ *
+ * @param {quat} a vector to calculate squared length of
+ * @returns {Number} squared length of a
+ * @function
+ */
+ quat.squaredLength = vec4.squaredLength;
+
+ /**
+ * Alias for {@link quat.squaredLength}
+ * @function
+ */
+ quat.sqrLen = quat.squaredLength;
+
+ /**
+ * Normalize a quat
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a quaternion to normalize
+ * @returns {quat} out
+ * @function
+ */
+ quat.normalize = vec4.normalize;
+
+ /**
+ * Creates a quaternion from the given 3x3 rotation matrix.
+ *
+ * NOTE: The resultant quaternion is not normalized, so you should be sure
+ * to renormalize the quaternion yourself where necessary.
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {mat3} m rotation matrix
+ * @returns {quat} out
+ * @function
+ */
+ quat.fromMat3 = function(out, m) {
+ // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
+ // article "Quaternion Calculus and Fast Animation".
+ var fTrace = m[0] + m[4] + m[8];
+ var fRoot;
+
+ if ( fTrace > 0.0 ) {
+ // |w| > 1/2, may as well choose w > 1/2
+ fRoot = Math.sqrt(fTrace + 1.0); // 2w
+ out[3] = 0.5 * fRoot;
+ fRoot = 0.5/fRoot; // 1/(4w)
+ out[0] = (m[5]-m[7])*fRoot;
+ out[1] = (m[6]-m[2])*fRoot;
+ out[2] = (m[1]-m[3])*fRoot;
+ } else {
+ // |w| <= 1/2
+ var i = 0;
+ if ( m[4] > m[0] )
+ i = 1;
+ if ( m[8] > m[i*3+i] )
+ i = 2;
+ var j = (i+1)%3;
+ var k = (i+2)%3;
+
+ fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);
+ out[i] = 0.5 * fRoot;
+ fRoot = 0.5 / fRoot;
+ out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;
+ out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;
+ out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;
+ }
+
+ return out;
+ };
+
+ /**
+ * Returns a string representation of a quatenion
+ *
+ * @param {quat} vec vector to represent as a string
+ * @returns {String} string representation of the vector
+ */
+ quat.str = function (a) {
+ return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
+ };
+
+ module.exports = quat;
+
+
+/***/ },
+/* 16 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. */
+
+ var glMatrix = __webpack_require__(10);
+
+ /**
+ * @class 3 Dimensional Vector
+ * @name vec3
+ */
+ var vec3 = {};
+
+ /**
+ * Creates a new, empty vec3
+ *
+ * @returns {vec3} a new 3D vector
+ */
+ vec3.create = function() {
+ var out = new glMatrix.ARRAY_TYPE(3);
+ out[0] = 0;
+ out[1] = 0;
+ out[2] = 0;
+ return out;
+ };
+
+ /**
+ * Creates a new vec3 initialized with values from an existing vector
+ *
+ * @param {vec3} a vector to clone
+ * @returns {vec3} a new 3D vector
+ */
+ vec3.clone = function(a) {
+ var out = new glMatrix.ARRAY_TYPE(3);
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ return out;
+ };
+
+ /**
+ * Creates a new vec3 initialized with the given values
+ *
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @param {Number} z Z component
+ * @returns {vec3} a new 3D vector
+ */
+ vec3.fromValues = function(x, y, z) {
+ var out = new glMatrix.ARRAY_TYPE(3);
+ out[0] = x;
+ out[1] = y;
+ out[2] = z;
+ return out;
+ };
+
+ /**
+ * Copy the values from one vec3 to another
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the source vector
+ * @returns {vec3} out
+ */
+ vec3.copy = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ return out;
+ };
+
+ /**
+ * Set the components of a vec3 to the given values
+ *
+ * @param {vec3} out the receiving vector
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @param {Number} z Z component
+ * @returns {vec3} out
+ */
+ vec3.set = function(out, x, y, z) {
+ out[0] = x;
+ out[1] = y;
+ out[2] = z;
+ return out;
+ };
+
+ /**
+ * Adds two vec3's
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {vec3} out
+ */
+ vec3.add = function(out, a, b) {
+ out[0] = a[0] + b[0];
+ out[1] = a[1] + b[1];
+ out[2] = a[2] + b[2];
+ return out;
+ };
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {vec3} out
+ */
+ vec3.subtract = function(out, a, b) {
+ out[0] = a[0] - b[0];
+ out[1] = a[1] - b[1];
+ out[2] = a[2] - b[2];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec3.subtract}
+ * @function
+ */
+ vec3.sub = vec3.subtract;
+
+ /**
+ * Multiplies two vec3's
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {vec3} out
+ */
+ vec3.multiply = function(out, a, b) {
+ out[0] = a[0] * b[0];
+ out[1] = a[1] * b[1];
+ out[2] = a[2] * b[2];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec3.multiply}
+ * @function
+ */
+ vec3.mul = vec3.multiply;
+
+ /**
+ * Divides two vec3's
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {vec3} out
+ */
+ vec3.divide = function(out, a, b) {
+ out[0] = a[0] / b[0];
+ out[1] = a[1] / b[1];
+ out[2] = a[2] / b[2];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec3.divide}
+ * @function
+ */
+ vec3.div = vec3.divide;
+
+ /**
+ * Returns the minimum of two vec3's
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {vec3} out
+ */
+ vec3.min = function(out, a, b) {
+ out[0] = Math.min(a[0], b[0]);
+ out[1] = Math.min(a[1], b[1]);
+ out[2] = Math.min(a[2], b[2]);
+ return out;
+ };
+
+ /**
+ * Returns the maximum of two vec3's
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {vec3} out
+ */
+ vec3.max = function(out, a, b) {
+ out[0] = Math.max(a[0], b[0]);
+ out[1] = Math.max(a[1], b[1]);
+ out[2] = Math.max(a[2], b[2]);
+ return out;
+ };
+
+ /**
+ * Scales a vec3 by a scalar number
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the vector to scale
+ * @param {Number} b amount to scale the vector by
+ * @returns {vec3} out
+ */
+ vec3.scale = function(out, a, b) {
+ out[0] = a[0] * b;
+ out[1] = a[1] * b;
+ out[2] = a[2] * b;
+ return out;
+ };
+
+ /**
+ * Adds two vec3's after scaling the second operand by a scalar value
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {Number} scale the amount to scale b by before adding
+ * @returns {vec3} out
+ */
+ vec3.scaleAndAdd = function(out, a, b, scale) {
+ out[0] = a[0] + (b[0] * scale);
+ out[1] = a[1] + (b[1] * scale);
+ out[2] = a[2] + (b[2] * scale);
+ return out;
+ };
+
+ /**
+ * Calculates the euclidian distance between two vec3's
+ *
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {Number} distance between a and b
+ */
+ vec3.distance = function(a, b) {
+ var x = b[0] - a[0],
+ y = b[1] - a[1],
+ z = b[2] - a[2];
+ return Math.sqrt(x*x + y*y + z*z);
+ };
+
+ /**
+ * Alias for {@link vec3.distance}
+ * @function
+ */
+ vec3.dist = vec3.distance;
+
+ /**
+ * Calculates the squared euclidian distance between two vec3's
+ *
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {Number} squared distance between a and b
+ */
+ vec3.squaredDistance = function(a, b) {
+ var x = b[0] - a[0],
+ y = b[1] - a[1],
+ z = b[2] - a[2];
+ return x*x + y*y + z*z;
+ };
+
+ /**
+ * Alias for {@link vec3.squaredDistance}
+ * @function
+ */
+ vec3.sqrDist = vec3.squaredDistance;
+
+ /**
+ * Calculates the length of a vec3
+ *
+ * @param {vec3} a vector to calculate length of
+ * @returns {Number} length of a
+ */
+ vec3.length = function (a) {
+ var x = a[0],
+ y = a[1],
+ z = a[2];
+ return Math.sqrt(x*x + y*y + z*z);
+ };
+
+ /**
+ * Alias for {@link vec3.length}
+ * @function
+ */
+ vec3.len = vec3.length;
+
+ /**
+ * Calculates the squared length of a vec3
+ *
+ * @param {vec3} a vector to calculate squared length of
+ * @returns {Number} squared length of a
+ */
+ vec3.squaredLength = function (a) {
+ var x = a[0],
+ y = a[1],
+ z = a[2];
+ return x*x + y*y + z*z;
+ };
+
+ /**
+ * Alias for {@link vec3.squaredLength}
+ * @function
+ */
+ vec3.sqrLen = vec3.squaredLength;
+
+ /**
+ * Negates the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to negate
+ * @returns {vec3} out
+ */
+ vec3.negate = function(out, a) {
+ out[0] = -a[0];
+ out[1] = -a[1];
+ out[2] = -a[2];
+ return out;
+ };
+
+ /**
+ * Returns the inverse of the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to invert
+ * @returns {vec3} out
+ */
+ vec3.inverse = function(out, a) {
+ out[0] = 1.0 / a[0];
+ out[1] = 1.0 / a[1];
+ out[2] = 1.0 / a[2];
+ return out;
+ };
+
+ /**
+ * Normalize a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to normalize
+ * @returns {vec3} out
+ */
+ vec3.normalize = function(out, a) {
+ var x = a[0],
+ y = a[1],
+ z = a[2];
+ var len = x*x + y*y + z*z;
+ if (len > 0) {
+ //TODO: evaluate use of glm_invsqrt here?
+ len = 1 / Math.sqrt(len);
+ out[0] = a[0] * len;
+ out[1] = a[1] * len;
+ out[2] = a[2] * len;
+ }
+ return out;
+ };
+
+ /**
+ * Calculates the dot product of two vec3's
+ *
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {Number} dot product of a and b
+ */
+ vec3.dot = function (a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+ };
+
+ /**
+ * Computes the cross product of two vec3's
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @returns {vec3} out
+ */
+ vec3.cross = function(out, a, b) {
+ var ax = a[0], ay = a[1], az = a[2],
+ bx = b[0], by = b[1], bz = b[2];
+
+ out[0] = ay * bz - az * by;
+ out[1] = az * bx - ax * bz;
+ out[2] = ax * by - ay * bx;
+ return out;
+ };
+
+ /**
+ * Performs a linear interpolation between two vec3's
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {Number} t interpolation amount between the two inputs
+ * @returns {vec3} out
+ */
+ vec3.lerp = function (out, a, b, t) {
+ var ax = a[0],
+ ay = a[1],
+ az = a[2];
+ out[0] = ax + t * (b[0] - ax);
+ out[1] = ay + t * (b[1] - ay);
+ out[2] = az + t * (b[2] - az);
+ return out;
+ };
+
+ /**
+ * Performs a hermite interpolation with two control points
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {vec3} c the third operand
+ * @param {vec3} d the fourth operand
+ * @param {Number} t interpolation amount between the two inputs
+ * @returns {vec3} out
+ */
+ vec3.hermite = function (out, a, b, c, d, t) {
+ var factorTimes2 = t * t,
+ factor1 = factorTimes2 * (2 * t - 3) + 1,
+ factor2 = factorTimes2 * (t - 2) + t,
+ factor3 = factorTimes2 * (t - 1),
+ factor4 = factorTimes2 * (3 - 2 * t);
+
+ out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
+ out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
+ out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
+
+ return out;
+ };
+
+ /**
+ * Performs a bezier interpolation with two control points
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {vec3} c the third operand
+ * @param {vec3} d the fourth operand
+ * @param {Number} t interpolation amount between the two inputs
+ * @returns {vec3} out
+ */
+ vec3.bezier = function (out, a, b, c, d, t) {
+ var inverseFactor = 1 - t,
+ inverseFactorTimesTwo = inverseFactor * inverseFactor,
+ factorTimes2 = t * t,
+ factor1 = inverseFactorTimesTwo * inverseFactor,
+ factor2 = 3 * t * inverseFactorTimesTwo,
+ factor3 = 3 * factorTimes2 * inverseFactor,
+ factor4 = factorTimes2 * t;
+
+ out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
+ out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
+ out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
+
+ return out;
+ };
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param {vec3} out the receiving vector
+ * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns {vec3} out
+ */
+ vec3.random = function (out, scale) {
+ scale = scale || 1.0;
+
+ var r = glMatrix.RANDOM() * 2.0 * Math.PI;
+ var z = (glMatrix.RANDOM() * 2.0) - 1.0;
+ var zScale = Math.sqrt(1.0-z*z) * scale;
+
+ out[0] = Math.cos(r) * zScale;
+ out[1] = Math.sin(r) * zScale;
+ out[2] = z * scale;
+ return out;
+ };
+
+ /**
+ * Transforms the vec3 with a mat4.
+ * 4th vector component is implicitly '1'
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the vector to transform
+ * @param {mat4} m matrix to transform with
+ * @returns {vec3} out
+ */
+ vec3.transformMat4 = function(out, a, m) {
+ var x = a[0], y = a[1], z = a[2],
+ w = m[3] * x + m[7] * y + m[11] * z + m[15];
+ w = w || 1.0;
+ out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
+ out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
+ out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
+ return out;
+ };
+
+ /**
+ * Transforms the vec3 with a mat3.
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the vector to transform
+ * @param {mat4} m the 3x3 matrix to transform with
+ * @returns {vec3} out
+ */
+ vec3.transformMat3 = function(out, a, m) {
+ var x = a[0], y = a[1], z = a[2];
+ out[0] = x * m[0] + y * m[3] + z * m[6];
+ out[1] = x * m[1] + y * m[4] + z * m[7];
+ out[2] = x * m[2] + y * m[5] + z * m[8];
+ return out;
+ };
+
+ /**
+ * Transforms the vec3 with a quat
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the vector to transform
+ * @param {quat} q quaternion to transform with
+ * @returns {vec3} out
+ */
+ vec3.transformQuat = function(out, a, q) {
+ // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations
+
+ var x = a[0], y = a[1], z = a[2],
+ qx = q[0], qy = q[1], qz = q[2], qw = q[3],
+
+ // calculate quat * vec
+ ix = qw * x + qy * z - qz * y,
+ iy = qw * y + qz * x - qx * z,
+ iz = qw * z + qx * y - qy * x,
+ iw = -qx * x - qy * y - qz * z;
+
+ // calculate result * inverse quat
+ out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
+ out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
+ out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
+ return out;
+ };
+
+ /**
+ * Rotate a 3D vector around the x-axis
+ * @param {vec3} out The receiving vec3
+ * @param {vec3} a The vec3 point to rotate
+ * @param {vec3} b The origin of the rotation
+ * @param {Number} c The angle of rotation
+ * @returns {vec3} out
+ */
+ vec3.rotateX = function(out, a, b, c){
+ var p = [], r=[];
+ //Translate point to the origin
+ p[0] = a[0] - b[0];
+ p[1] = a[1] - b[1];
+ p[2] = a[2] - b[2];
+
+ //perform rotation
+ r[0] = p[0];
+ r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);
+ r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);
+
+ //translate to correct position
+ out[0] = r[0] + b[0];
+ out[1] = r[1] + b[1];
+ out[2] = r[2] + b[2];
+
+ return out;
+ };
+
+ /**
+ * Rotate a 3D vector around the y-axis
+ * @param {vec3} out The receiving vec3
+ * @param {vec3} a The vec3 point to rotate
+ * @param {vec3} b The origin of the rotation
+ * @param {Number} c The angle of rotation
+ * @returns {vec3} out
+ */
+ vec3.rotateY = function(out, a, b, c){
+ var p = [], r=[];
+ //Translate point to the origin
+ p[0] = a[0] - b[0];
+ p[1] = a[1] - b[1];
+ p[2] = a[2] - b[2];
+
+ //perform rotation
+ r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);
+ r[1] = p[1];
+ r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);
+
+ //translate to correct position
+ out[0] = r[0] + b[0];
+ out[1] = r[1] + b[1];
+ out[2] = r[2] + b[2];
+
+ return out;
+ };
+
+ /**
+ * Rotate a 3D vector around the z-axis
+ * @param {vec3} out The receiving vec3
+ * @param {vec3} a The vec3 point to rotate
+ * @param {vec3} b The origin of the rotation
+ * @param {Number} c The angle of rotation
+ * @returns {vec3} out
+ */
+ vec3.rotateZ = function(out, a, b, c){
+ var p = [], r=[];
+ //Translate point to the origin
+ p[0] = a[0] - b[0];
+ p[1] = a[1] - b[1];
+ p[2] = a[2] - b[2];
+
+ //perform rotation
+ r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);
+ r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);
+ r[2] = p[2];
+
+ //translate to correct position
+ out[0] = r[0] + b[0];
+ out[1] = r[1] + b[1];
+ out[2] = r[2] + b[2];
+
+ return out;
+ };
+
+ /**
+ * Perform some operation over an array of vec3s.
+ *
+ * @param {Array} a the array of vectors to iterate over
+ * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
+ * @param {Number} offset Number of elements to skip at the beginning of the array
+ * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
+ * @param {Function} fn Function to call for each vector in the array
+ * @param {Object} [arg] additional argument to pass to fn
+ * @returns {Array} a
+ * @function
+ */
+ vec3.forEach = (function() {
+ var vec = vec3.create();
+
+ return function(a, stride, offset, count, fn, arg) {
+ var i, l;
+ if(!stride) {
+ stride = 3;
+ }
+
+ if(!offset) {
+ offset = 0;
+ }
+
+ if(count) {
+ l = Math.min((count * stride) + offset, a.length);
+ } else {
+ l = a.length;
+ }
+
+ for(i = offset; i < l; i += stride) {
+ vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];
+ fn(vec, vec, arg);
+ a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];
+ }
+
+ return a;
+ };
+ })();
+
+ /**
+ * Get the angle between two 3D vectors
+ * @param {vec3} a The first operand
+ * @param {vec3} b The second operand
+ * @returns {Number} The angle in radians
+ */
+ vec3.angle = function(a, b) {
+
+ var tempA = vec3.fromValues(a[0], a[1], a[2]);
+ var tempB = vec3.fromValues(b[0], b[1], b[2]);
+
+ vec3.normalize(tempA, tempA);
+ vec3.normalize(tempB, tempB);
+
+ var cosine = vec3.dot(tempA, tempB);
+
+ if(cosine > 1.0){
+ return 0;
+ } else {
+ return Math.acos(cosine);
+ }
+ };
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param {vec3} vec vector to represent as a string
+ * @returns {String} string representation of the vector
+ */
+ vec3.str = function (a) {
+ return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';
+ };
+
+ module.exports = vec3;
+
+
+/***/ },
+/* 17 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. */
+
+ var glMatrix = __webpack_require__(10);
+
+ /**
+ * @class 4 Dimensional Vector
+ * @name vec4
+ */
+ var vec4 = {};
+
+ /**
+ * Creates a new, empty vec4
+ *
+ * @returns {vec4} a new 4D vector
+ */
+ vec4.create = function() {
+ var out = new glMatrix.ARRAY_TYPE(4);
+ out[0] = 0;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ return out;
+ };
+
+ /**
+ * Creates a new vec4 initialized with values from an existing vector
+ *
+ * @param {vec4} a vector to clone
+ * @returns {vec4} a new 4D vector
+ */
+ vec4.clone = function(a) {
+ var out = new glMatrix.ARRAY_TYPE(4);
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ return out;
+ };
+
+ /**
+ * Creates a new vec4 initialized with the given values
+ *
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @param {Number} z Z component
+ * @param {Number} w W component
+ * @returns {vec4} a new 4D vector
+ */
+ vec4.fromValues = function(x, y, z, w) {
+ var out = new glMatrix.ARRAY_TYPE(4);
+ out[0] = x;
+ out[1] = y;
+ out[2] = z;
+ out[3] = w;
+ return out;
+ };
+
+ /**
+ * Copy the values from one vec4 to another
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the source vector
+ * @returns {vec4} out
+ */
+ vec4.copy = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ out[2] = a[2];
+ out[3] = a[3];
+ return out;
+ };
+
+ /**
+ * Set the components of a vec4 to the given values
+ *
+ * @param {vec4} out the receiving vector
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @param {Number} z Z component
+ * @param {Number} w W component
+ * @returns {vec4} out
+ */
+ vec4.set = function(out, x, y, z, w) {
+ out[0] = x;
+ out[1] = y;
+ out[2] = z;
+ out[3] = w;
+ return out;
+ };
+
+ /**
+ * Adds two vec4's
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {vec4} out
+ */
+ vec4.add = function(out, a, b) {
+ out[0] = a[0] + b[0];
+ out[1] = a[1] + b[1];
+ out[2] = a[2] + b[2];
+ out[3] = a[3] + b[3];
+ return out;
+ };
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {vec4} out
+ */
+ vec4.subtract = function(out, a, b) {
+ out[0] = a[0] - b[0];
+ out[1] = a[1] - b[1];
+ out[2] = a[2] - b[2];
+ out[3] = a[3] - b[3];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec4.subtract}
+ * @function
+ */
+ vec4.sub = vec4.subtract;
+
+ /**
+ * Multiplies two vec4's
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {vec4} out
+ */
+ vec4.multiply = function(out, a, b) {
+ out[0] = a[0] * b[0];
+ out[1] = a[1] * b[1];
+ out[2] = a[2] * b[2];
+ out[3] = a[3] * b[3];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec4.multiply}
+ * @function
+ */
+ vec4.mul = vec4.multiply;
+
+ /**
+ * Divides two vec4's
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {vec4} out
+ */
+ vec4.divide = function(out, a, b) {
+ out[0] = a[0] / b[0];
+ out[1] = a[1] / b[1];
+ out[2] = a[2] / b[2];
+ out[3] = a[3] / b[3];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec4.divide}
+ * @function
+ */
+ vec4.div = vec4.divide;
+
+ /**
+ * Returns the minimum of two vec4's
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {vec4} out
+ */
+ vec4.min = function(out, a, b) {
+ out[0] = Math.min(a[0], b[0]);
+ out[1] = Math.min(a[1], b[1]);
+ out[2] = Math.min(a[2], b[2]);
+ out[3] = Math.min(a[3], b[3]);
+ return out;
+ };
+
+ /**
+ * Returns the maximum of two vec4's
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {vec4} out
+ */
+ vec4.max = function(out, a, b) {
+ out[0] = Math.max(a[0], b[0]);
+ out[1] = Math.max(a[1], b[1]);
+ out[2] = Math.max(a[2], b[2]);
+ out[3] = Math.max(a[3], b[3]);
+ return out;
+ };
+
+ /**
+ * Scales a vec4 by a scalar number
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the vector to scale
+ * @param {Number} b amount to scale the vector by
+ * @returns {vec4} out
+ */
+ vec4.scale = function(out, a, b) {
+ out[0] = a[0] * b;
+ out[1] = a[1] * b;
+ out[2] = a[2] * b;
+ out[3] = a[3] * b;
+ return out;
+ };
+
+ /**
+ * Adds two vec4's after scaling the second operand by a scalar value
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @param {Number} scale the amount to scale b by before adding
+ * @returns {vec4} out
+ */
+ vec4.scaleAndAdd = function(out, a, b, scale) {
+ out[0] = a[0] + (b[0] * scale);
+ out[1] = a[1] + (b[1] * scale);
+ out[2] = a[2] + (b[2] * scale);
+ out[3] = a[3] + (b[3] * scale);
+ return out;
+ };
+
+ /**
+ * Calculates the euclidian distance between two vec4's
+ *
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {Number} distance between a and b
+ */
+ vec4.distance = function(a, b) {
+ var x = b[0] - a[0],
+ y = b[1] - a[1],
+ z = b[2] - a[2],
+ w = b[3] - a[3];
+ return Math.sqrt(x*x + y*y + z*z + w*w);
+ };
+
+ /**
+ * Alias for {@link vec4.distance}
+ * @function
+ */
+ vec4.dist = vec4.distance;
+
+ /**
+ * Calculates the squared euclidian distance between two vec4's
+ *
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {Number} squared distance between a and b
+ */
+ vec4.squaredDistance = function(a, b) {
+ var x = b[0] - a[0],
+ y = b[1] - a[1],
+ z = b[2] - a[2],
+ w = b[3] - a[3];
+ return x*x + y*y + z*z + w*w;
+ };
+
+ /**
+ * Alias for {@link vec4.squaredDistance}
+ * @function
+ */
+ vec4.sqrDist = vec4.squaredDistance;
+
+ /**
+ * Calculates the length of a vec4
+ *
+ * @param {vec4} a vector to calculate length of
+ * @returns {Number} length of a
+ */
+ vec4.length = function (a) {
+ var x = a[0],
+ y = a[1],
+ z = a[2],
+ w = a[3];
+ return Math.sqrt(x*x + y*y + z*z + w*w);
+ };
+
+ /**
+ * Alias for {@link vec4.length}
+ * @function
+ */
+ vec4.len = vec4.length;
+
+ /**
+ * Calculates the squared length of a vec4
+ *
+ * @param {vec4} a vector to calculate squared length of
+ * @returns {Number} squared length of a
+ */
+ vec4.squaredLength = function (a) {
+ var x = a[0],
+ y = a[1],
+ z = a[2],
+ w = a[3];
+ return x*x + y*y + z*z + w*w;
+ };
+
+ /**
+ * Alias for {@link vec4.squaredLength}
+ * @function
+ */
+ vec4.sqrLen = vec4.squaredLength;
+
+ /**
+ * Negates the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to negate
+ * @returns {vec4} out
+ */
+ vec4.negate = function(out, a) {
+ out[0] = -a[0];
+ out[1] = -a[1];
+ out[2] = -a[2];
+ out[3] = -a[3];
+ return out;
+ };
+
+ /**
+ * Returns the inverse of the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to invert
+ * @returns {vec4} out
+ */
+ vec4.inverse = function(out, a) {
+ out[0] = 1.0 / a[0];
+ out[1] = 1.0 / a[1];
+ out[2] = 1.0 / a[2];
+ out[3] = 1.0 / a[3];
+ return out;
+ };
+
+ /**
+ * Normalize a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to normalize
+ * @returns {vec4} out
+ */
+ vec4.normalize = function(out, a) {
+ var x = a[0],
+ y = a[1],
+ z = a[2],
+ w = a[3];
+ var len = x*x + y*y + z*z + w*w;
+ if (len > 0) {
+ len = 1 / Math.sqrt(len);
+ out[0] = x * len;
+ out[1] = y * len;
+ out[2] = z * len;
+ out[3] = w * len;
+ }
+ return out;
+ };
+
+ /**
+ * Calculates the dot product of two vec4's
+ *
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @returns {Number} dot product of a and b
+ */
+ vec4.dot = function (a, b) {
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+ };
+
+ /**
+ * Performs a linear interpolation between two vec4's
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the first operand
+ * @param {vec4} b the second operand
+ * @param {Number} t interpolation amount between the two inputs
+ * @returns {vec4} out
+ */
+ vec4.lerp = function (out, a, b, t) {
+ var ax = a[0],
+ ay = a[1],
+ az = a[2],
+ aw = a[3];
+ out[0] = ax + t * (b[0] - ax);
+ out[1] = ay + t * (b[1] - ay);
+ out[2] = az + t * (b[2] - az);
+ out[3] = aw + t * (b[3] - aw);
+ return out;
+ };
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param {vec4} out the receiving vector
+ * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns {vec4} out
+ */
+ vec4.random = function (out, scale) {
+ scale = scale || 1.0;
+
+ //TODO: This is a pretty awful way of doing this. Find something better.
+ out[0] = glMatrix.RANDOM();
+ out[1] = glMatrix.RANDOM();
+ out[2] = glMatrix.RANDOM();
+ out[3] = glMatrix.RANDOM();
+ vec4.normalize(out, out);
+ vec4.scale(out, out, scale);
+ return out;
+ };
+
+ /**
+ * Transforms the vec4 with a mat4.
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the vector to transform
+ * @param {mat4} m matrix to transform with
+ * @returns {vec4} out
+ */
+ vec4.transformMat4 = function(out, a, m) {
+ var x = a[0], y = a[1], z = a[2], w = a[3];
+ out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
+ out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
+ out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
+ out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
+ return out;
+ };
+
+ /**
+ * Transforms the vec4 with a quat
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a the vector to transform
+ * @param {quat} q quaternion to transform with
+ * @returns {vec4} out
+ */
+ vec4.transformQuat = function(out, a, q) {
+ var x = a[0], y = a[1], z = a[2],
+ qx = q[0], qy = q[1], qz = q[2], qw = q[3],
+
+ // calculate quat * vec
+ ix = qw * x + qy * z - qz * y,
+ iy = qw * y + qz * x - qx * z,
+ iz = qw * z + qx * y - qy * x,
+ iw = -qx * x - qy * y - qz * z;
+
+ // calculate result * inverse quat
+ out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
+ out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
+ out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
+ out[3] = a[3];
+ return out;
+ };
+
+ /**
+ * Perform some operation over an array of vec4s.
+ *
+ * @param {Array} a the array of vectors to iterate over
+ * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
+ * @param {Number} offset Number of elements to skip at the beginning of the array
+ * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
+ * @param {Function} fn Function to call for each vector in the array
+ * @param {Object} [arg] additional argument to pass to fn
+ * @returns {Array} a
+ * @function
+ */
+ vec4.forEach = (function() {
+ var vec = vec4.create();
+
+ return function(a, stride, offset, count, fn, arg) {
+ var i, l;
+ if(!stride) {
+ stride = 4;
+ }
+
+ if(!offset) {
+ offset = 0;
+ }
+
+ if(count) {
+ l = Math.min((count * stride) + offset, a.length);
+ } else {
+ l = a.length;
+ }
+
+ for(i = offset; i < l; i += stride) {
+ vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];
+ fn(vec, vec, arg);
+ a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];
+ }
+
+ return a;
+ };
+ })();
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param {vec4} vec vector to represent as a string
+ * @returns {String} string representation of the vector
+ */
+ vec4.str = function (a) {
+ return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
+ };
+
+ module.exports = vec4;
+
+
+/***/ },
+/* 18 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. */
+
+ var glMatrix = __webpack_require__(10);
+
+ /**
+ * @class 2 Dimensional Vector
+ * @name vec2
+ */
+ var vec2 = {};
+
+ /**
+ * Creates a new, empty vec2
+ *
+ * @returns {vec2} a new 2D vector
+ */
+ vec2.create = function() {
+ var out = new glMatrix.ARRAY_TYPE(2);
+ out[0] = 0;
+ out[1] = 0;
+ return out;
+ };
+
+ /**
+ * Creates a new vec2 initialized with values from an existing vector
+ *
+ * @param {vec2} a vector to clone
+ * @returns {vec2} a new 2D vector
+ */
+ vec2.clone = function(a) {
+ var out = new glMatrix.ARRAY_TYPE(2);
+ out[0] = a[0];
+ out[1] = a[1];
+ return out;
+ };
+
+ /**
+ * Creates a new vec2 initialized with the given values
+ *
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @returns {vec2} a new 2D vector
+ */
+ vec2.fromValues = function(x, y) {
+ var out = new glMatrix.ARRAY_TYPE(2);
+ out[0] = x;
+ out[1] = y;
+ return out;
+ };
+
+ /**
+ * Copy the values from one vec2 to another
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the source vector
+ * @returns {vec2} out
+ */
+ vec2.copy = function(out, a) {
+ out[0] = a[0];
+ out[1] = a[1];
+ return out;
+ };
+
+ /**
+ * Set the components of a vec2 to the given values
+ *
+ * @param {vec2} out the receiving vector
+ * @param {Number} x X component
+ * @param {Number} y Y component
+ * @returns {vec2} out
+ */
+ vec2.set = function(out, x, y) {
+ out[0] = x;
+ out[1] = y;
+ return out;
+ };
+
+ /**
+ * Adds two vec2's
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {vec2} out
+ */
+ vec2.add = function(out, a, b) {
+ out[0] = a[0] + b[0];
+ out[1] = a[1] + b[1];
+ return out;
+ };
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {vec2} out
+ */
+ vec2.subtract = function(out, a, b) {
+ out[0] = a[0] - b[0];
+ out[1] = a[1] - b[1];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec2.subtract}
+ * @function
+ */
+ vec2.sub = vec2.subtract;
+
+ /**
+ * Multiplies two vec2's
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {vec2} out
+ */
+ vec2.multiply = function(out, a, b) {
+ out[0] = a[0] * b[0];
+ out[1] = a[1] * b[1];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec2.multiply}
+ * @function
+ */
+ vec2.mul = vec2.multiply;
+
+ /**
+ * Divides two vec2's
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {vec2} out
+ */
+ vec2.divide = function(out, a, b) {
+ out[0] = a[0] / b[0];
+ out[1] = a[1] / b[1];
+ return out;
+ };
+
+ /**
+ * Alias for {@link vec2.divide}
+ * @function
+ */
+ vec2.div = vec2.divide;
+
+ /**
+ * Returns the minimum of two vec2's
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {vec2} out
+ */
+ vec2.min = function(out, a, b) {
+ out[0] = Math.min(a[0], b[0]);
+ out[1] = Math.min(a[1], b[1]);
+ return out;
+ };
+
+ /**
+ * Returns the maximum of two vec2's
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {vec2} out
+ */
+ vec2.max = function(out, a, b) {
+ out[0] = Math.max(a[0], b[0]);
+ out[1] = Math.max(a[1], b[1]);
+ return out;
+ };
+
+ /**
+ * Scales a vec2 by a scalar number
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the vector to scale
+ * @param {Number} b amount to scale the vector by
+ * @returns {vec2} out
+ */
+ vec2.scale = function(out, a, b) {
+ out[0] = a[0] * b;
+ out[1] = a[1] * b;
+ return out;
+ };
+
+ /**
+ * Adds two vec2's after scaling the second operand by a scalar value
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @param {Number} scale the amount to scale b by before adding
+ * @returns {vec2} out
+ */
+ vec2.scaleAndAdd = function(out, a, b, scale) {
+ out[0] = a[0] + (b[0] * scale);
+ out[1] = a[1] + (b[1] * scale);
+ return out;
+ };
+
+ /**
+ * Calculates the euclidian distance between two vec2's
+ *
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {Number} distance between a and b
+ */
+ vec2.distance = function(a, b) {
+ var x = b[0] - a[0],
+ y = b[1] - a[1];
+ return Math.sqrt(x*x + y*y);
+ };
+
+ /**
+ * Alias for {@link vec2.distance}
+ * @function
+ */
+ vec2.dist = vec2.distance;
+
+ /**
+ * Calculates the squared euclidian distance between two vec2's
+ *
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {Number} squared distance between a and b
+ */
+ vec2.squaredDistance = function(a, b) {
+ var x = b[0] - a[0],
+ y = b[1] - a[1];
+ return x*x + y*y;
+ };
+
+ /**
+ * Alias for {@link vec2.squaredDistance}
+ * @function
+ */
+ vec2.sqrDist = vec2.squaredDistance;
+
+ /**
+ * Calculates the length of a vec2
+ *
+ * @param {vec2} a vector to calculate length of
+ * @returns {Number} length of a
+ */
+ vec2.length = function (a) {
+ var x = a[0],
+ y = a[1];
+ return Math.sqrt(x*x + y*y);
+ };
+
+ /**
+ * Alias for {@link vec2.length}
+ * @function
+ */
+ vec2.len = vec2.length;
+
+ /**
+ * Calculates the squared length of a vec2
+ *
+ * @param {vec2} a vector to calculate squared length of
+ * @returns {Number} squared length of a
+ */
+ vec2.squaredLength = function (a) {
+ var x = a[0],
+ y = a[1];
+ return x*x + y*y;
+ };
+
+ /**
+ * Alias for {@link vec2.squaredLength}
+ * @function
+ */
+ vec2.sqrLen = vec2.squaredLength;
+
+ /**
+ * Negates the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to negate
+ * @returns {vec2} out
+ */
+ vec2.negate = function(out, a) {
+ out[0] = -a[0];
+ out[1] = -a[1];
+ return out;
+ };
+
+ /**
+ * Returns the inverse of the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to invert
+ * @returns {vec2} out
+ */
+ vec2.inverse = function(out, a) {
+ out[0] = 1.0 / a[0];
+ out[1] = 1.0 / a[1];
+ return out;
+ };
+
+ /**
+ * Normalize a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to normalize
+ * @returns {vec2} out
+ */
+ vec2.normalize = function(out, a) {
+ var x = a[0],
+ y = a[1];
+ var len = x*x + y*y;
+ if (len > 0) {
+ //TODO: evaluate use of glm_invsqrt here?
+ len = 1 / Math.sqrt(len);
+ out[0] = a[0] * len;
+ out[1] = a[1] * len;
+ }
+ return out;
+ };
+
+ /**
+ * Calculates the dot product of two vec2's
+ *
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {Number} dot product of a and b
+ */
+ vec2.dot = function (a, b) {
+ return a[0] * b[0] + a[1] * b[1];
+ };
+
+ /**
+ * Computes the cross product of two vec2's
+ * Note that the cross product must by definition produce a 3D vector
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @returns {vec3} out
+ */
+ vec2.cross = function(out, a, b) {
+ var z = a[0] * b[1] - a[1] * b[0];
+ out[0] = out[1] = 0;
+ out[2] = z;
+ return out;
+ };
+
+ /**
+ * Performs a linear interpolation between two vec2's
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the first operand
+ * @param {vec2} b the second operand
+ * @param {Number} t interpolation amount between the two inputs
+ * @returns {vec2} out
+ */
+ vec2.lerp = function (out, a, b, t) {
+ var ax = a[0],
+ ay = a[1];
+ out[0] = ax + t * (b[0] - ax);
+ out[1] = ay + t * (b[1] - ay);
+ return out;
+ };
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param {vec2} out the receiving vector
+ * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns {vec2} out
+ */
+ vec2.random = function (out, scale) {
+ scale = scale || 1.0;
+ var r = glMatrix.RANDOM() * 2.0 * Math.PI;
+ out[0] = Math.cos(r) * scale;
+ out[1] = Math.sin(r) * scale;
+ return out;
+ };
+
+ /**
+ * Transforms the vec2 with a mat2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the vector to transform
+ * @param {mat2} m matrix to transform with
+ * @returns {vec2} out
+ */
+ vec2.transformMat2 = function(out, a, m) {
+ var x = a[0],
+ y = a[1];
+ out[0] = m[0] * x + m[2] * y;
+ out[1] = m[1] * x + m[3] * y;
+ return out;
+ };
+
+ /**
+ * Transforms the vec2 with a mat2d
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the vector to transform
+ * @param {mat2d} m matrix to transform with
+ * @returns {vec2} out
+ */
+ vec2.transformMat2d = function(out, a, m) {
+ var x = a[0],
+ y = a[1];
+ out[0] = m[0] * x + m[2] * y + m[4];
+ out[1] = m[1] * x + m[3] * y + m[5];
+ return out;
+ };
+
+ /**
+ * Transforms the vec2 with a mat3
+ * 3rd vector component is implicitly '1'
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the vector to transform
+ * @param {mat3} m matrix to transform with
+ * @returns {vec2} out
+ */
+ vec2.transformMat3 = function(out, a, m) {
+ var x = a[0],
+ y = a[1];
+ out[0] = m[0] * x + m[3] * y + m[6];
+ out[1] = m[1] * x + m[4] * y + m[7];
+ return out;
+ };
+
+ /**
+ * Transforms the vec2 with a mat4
+ * 3rd vector component is implicitly '0'
+ * 4th vector component is implicitly '1'
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a the vector to transform
+ * @param {mat4} m matrix to transform with
+ * @returns {vec2} out
+ */
+ vec2.transformMat4 = function(out, a, m) {
+ var x = a[0],
+ y = a[1];
+ out[0] = m[0] * x + m[4] * y + m[12];
+ out[1] = m[1] * x + m[5] * y + m[13];
+ return out;
+ };
+
+ /**
+ * Perform some operation over an array of vec2s.
+ *
+ * @param {Array} a the array of vectors to iterate over
+ * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
+ * @param {Number} offset Number of elements to skip at the beginning of the array
+ * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
+ * @param {Function} fn Function to call for each vector in the array
+ * @param {Object} [arg] additional argument to pass to fn
+ * @returns {Array} a
+ * @function
+ */
+ vec2.forEach = (function() {
+ var vec = vec2.create();
+
+ return function(a, stride, offset, count, fn, arg) {
+ var i, l;
+ if(!stride) {
+ stride = 2;
+ }
+
+ if(!offset) {
+ offset = 0;
+ }
+
+ if(count) {
+ l = Math.min((count * stride) + offset, a.length);
+ } else {
+ l = a.length;
+ }
+
+ for(i = offset; i < l; i += stride) {
+ vec[0] = a[i]; vec[1] = a[i+1];
+ fn(vec, vec, arg);
+ a[i] = vec[0]; a[i+1] = vec[1];
+ }
+
+ return a;
+ };
+ })();
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param {vec2} vec vector to represent as a string
+ * @returns {String} string representation of the vector
+ */
+ vec2.str = function (a) {
+ return 'vec2(' + a[0] + ', ' + a[1] + ')';
+ };
+
+ module.exports = vec2;
+
+
+/***/ },
+/* 19 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports["default"] = {
+ init: function init(arr, val) {
+ var l = arr.length;
+ while (l--) {
+ arr[l] = val;
+ }
+ },
+
+ /**
+ * Shuffles the content of an array
+ * @return {Array} the array itself shuffled
+ */
+ shuffle: function shuffle(arr) {
+ var i = arr.length - 1,
+ j,
+ x;
+ for (i; i >= 0; i--) {
+ j = Math.floor(Math.random() * i);
+ x = arr[i];
+ arr[i] = arr[j];
+ arr[j] = x;
+ }
+ return arr;
+ },
+
+ toPointList: function toPointList(arr) {
+ var i,
+ j,
+ row = [],
+ rows = [];
+ for (i = 0; i < arr.length; i++) {
+ row = [];
+ for (j = 0; j < arr[i].length; j++) {
+ row[j] = arr[i][j];
+ }
+ rows[i] = "[" + row.join(",") + "]";
+ }
+ return "[" + rows.join(",\r\n") + "]";
+ },
+
+ /**
+ * returns the elements which's score is bigger than the threshold
+ * @return {Array} the reduced array
+ */
+ threshold: function threshold(arr, _threshold, scoreFunc) {
+ var i,
+ queue = [];
+ for (i = 0; i < arr.length; i++) {
+ if (scoreFunc.apply(arr, [arr[i]]) >= _threshold) {
+ queue.push(arr[i]);
+ }
+ }
+ return queue;
+ },
+
+ maxIndex: function maxIndex(arr) {
+ var i,
+ max = 0;
+ for (i = 0; i < arr.length; i++) {
+ if (arr[i] > arr[max]) {
+ max = i;
+ }
+ }
+ return max;
+ },
+
+ max: function max(arr) {
+ var i,
+ max = 0;
+ for (i = 0; i < arr.length; i++) {
+ if (arr[i] > max) {
+ max = arr[i];
+ }
+ }
+ return max;
+ },
+
+ sum: function sum(arr) {
+ var length = arr.length,
+ sum = 0;
+
+ while (length--) {
+ sum += arr[length];
+ }
+ return sum;
+ }
+ };
+ module.exports = exports["default"];
+
+/***/ },
+/* 20 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* jshint undef: true, unused: true, browser:true, devel: true */
+ /* global define */
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _image_wrapper = __webpack_require__(5);
+
+ var _image_wrapper2 = _interopRequireDefault(_image_wrapper);
+
+ var _cv_utils = __webpack_require__(7);
+
+ var _cv_utils2 = _interopRequireDefault(_cv_utils);
+
+ var _rasterizer = __webpack_require__(21);
+
+ var _rasterizer2 = _interopRequireDefault(_rasterizer);
+
+ var _tracer = __webpack_require__(22);
+
+ var _tracer2 = _interopRequireDefault(_tracer);
+
+ var _skeletonizer2 = __webpack_require__(23);
+
+ var _skeletonizer3 = _interopRequireDefault(_skeletonizer2);
+
+ var _array_helper = __webpack_require__(19);
+
+ var _array_helper2 = _interopRequireDefault(_array_helper);
+
+ var _image_debug = __webpack_require__(24);
+
+ var _image_debug2 = _interopRequireDefault(_image_debug);
+
+ var _glMatrix = __webpack_require__(9);
+
+ var _glMatrix2 = _interopRequireDefault(_glMatrix);
+
+ var _config,
+ _currentImageWrapper,
+ _skelImageWrapper,
+ _subImageWrapper,
+ _labelImageWrapper,
+ _patchGrid,
+ _patchLabelGrid,
+ _imageToPatchGrid,
+ _binaryImageWrapper,
+ _patchSize,
+ _canvasContainer = {
+ ctx: {
+ binary: null
+ },
+ dom: {
+ binary: null
+ }
+ },
+ _numPatches = { x: 0, y: 0 },
+ _inputImageWrapper,
+ _skeletonizer,
+ vec2 = _glMatrix2['default'].vec2,
+ mat2 = _glMatrix2['default'].mat2,
+ self = typeof window !== 'undefined' ? window : self;
+
+ function initBuffers() {
+ var skeletonImageData;
+
+ if (_config.halfSample) {
+ _currentImageWrapper = new _image_wrapper2['default']({
+ x: _inputImageWrapper.size.x / 2 | 0,
+ y: _inputImageWrapper.size.y / 2 | 0
+ });
+ } else {
+ _currentImageWrapper = _inputImageWrapper;
+ }
+
+ _patchSize = _cv_utils2['default'].calculatePatchSize(_config.patchSize, _currentImageWrapper.size);
+
+ _numPatches.x = _currentImageWrapper.size.x / _patchSize.x | 0;
+ _numPatches.y = _currentImageWrapper.size.y / _patchSize.y | 0;
+
+ _binaryImageWrapper = new _image_wrapper2['default'](_currentImageWrapper.size, undefined, Uint8Array, false);
+
+ _labelImageWrapper = new _image_wrapper2['default'](_patchSize, undefined, Array, true);
+
+ skeletonImageData = new ArrayBuffer(64 * 1024);
+ _subImageWrapper = new _image_wrapper2['default'](_patchSize, new Uint8Array(skeletonImageData, 0, _patchSize.x * _patchSize.y));
+ _skelImageWrapper = new _image_wrapper2['default'](_patchSize, new Uint8Array(skeletonImageData, _patchSize.x * _patchSize.y * 3, _patchSize.x * _patchSize.y), undefined, true);
+ _skeletonizer = (0, _skeletonizer3['default'])(self, {
+ size: _patchSize.x
+ }, skeletonImageData);
+
+ _imageToPatchGrid = new _image_wrapper2['default']({
+ x: _currentImageWrapper.size.x / _subImageWrapper.size.x | 0,
+ y: _currentImageWrapper.size.y / _subImageWrapper.size.y | 0
+ }, undefined, Array, true);
+ _patchGrid = new _image_wrapper2['default'](_imageToPatchGrid.size, undefined, undefined, true);
+ _patchLabelGrid = new _image_wrapper2['default'](_imageToPatchGrid.size, undefined, Int32Array, true);
+ }
+
+ function initCanvas() {
+ if (_config.useWorker || typeof document === 'undefined') {
+ return;
+ }
+ _canvasContainer.dom.binary = document.createElement("canvas");
+ _canvasContainer.dom.binary.className = "binaryBuffer";
+ if (_config.showCanvas === true) {
+ document.querySelector("#debug").appendChild(_canvasContainer.dom.binary);
+ }
+ _canvasContainer.ctx.binary = _canvasContainer.dom.binary.getContext("2d");
+ _canvasContainer.dom.binary.width = _binaryImageWrapper.size.x;
+ _canvasContainer.dom.binary.height = _binaryImageWrapper.size.y;
+ }
+
+ /**
+ * Creates a bounding box which encloses all the given patches
+ * @returns {Array} The minimal bounding box
+ */
+ function boxFromPatches(patches) {
+ var overAvg,
+ i,
+ j,
+ patch,
+ transMat,
+ minx = _binaryImageWrapper.size.x,
+ miny = _binaryImageWrapper.size.y,
+ maxx = -_binaryImageWrapper.size.x,
+ maxy = -_binaryImageWrapper.size.y,
+ box,
+ scale;
+
+ // draw all patches which are to be taken into consideration
+ overAvg = 0;
+ for (i = 0; i < patches.length; i++) {
+ patch = patches[i];
+ overAvg += patch.rad;
+ if (_config.showPatches) {
+ _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: "red" });
+ }
+ }
+
+ overAvg /= patches.length;
+ overAvg = (overAvg * 180 / Math.PI + 90) % 180 - 90;
+ if (overAvg < 0) {
+ overAvg += 180;
+ }
+
+ overAvg = (180 - overAvg) * Math.PI / 180;
+ transMat = mat2.clone([Math.cos(overAvg), Math.sin(overAvg), -Math.sin(overAvg), Math.cos(overAvg)]);
+
+ // iterate over patches and rotate by angle
+ for (i = 0; i < patches.length; i++) {
+ patch = patches[i];
+ for (j = 0; j < 4; j++) {
+ vec2.transformMat2(patch.box[j], patch.box[j], transMat);
+ }
+
+ if (_config.boxFromPatches.showTransformed) {
+ _image_debug2['default'].drawPath(patch.box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#99ff00', lineWidth: 2 });
+ }
+ }
+
+ // find bounding box
+ for (i = 0; i < patches.length; i++) {
+ patch = patches[i];
+ for (j = 0; j < 4; j++) {
+ if (patch.box[j][0] < minx) {
+ minx = patch.box[j][0];
+ }
+ if (patch.box[j][0] > maxx) {
+ maxx = patch.box[j][0];
+ }
+ if (patch.box[j][1] < miny) {
+ miny = patch.box[j][1];
+ }
+ if (patch.box[j][1] > maxy) {
+ maxy = patch.box[j][1];
+ }
+ }
+ }
+
+ box = [[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]];
+
+ if (_config.boxFromPatches.showTransformedBox) {
+ _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#ff0000', lineWidth: 2 });
+ }
+
+ scale = _config.halfSample ? 2 : 1;
+ // reverse rotation;
+ transMat = mat2.invert(transMat, transMat);
+ for (j = 0; j < 4; j++) {
+ vec2.transformMat2(box[j], box[j], transMat);
+ }
+
+ if (_config.boxFromPatches.showBB) {
+ _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#ff0000', lineWidth: 2 });
+ }
+
+ for (j = 0; j < 4; j++) {
+ vec2.scale(box[j], box[j], scale);
+ }
+
+ return box;
+ }
+
+ /**
+ * Creates a binary image of the current image
+ */
+ function binarizeImage() {
+ _cv_utils2['default'].otsuThreshold(_currentImageWrapper, _binaryImageWrapper);
+ _binaryImageWrapper.zeroBorder();
+ if (_config.showCanvas) {
+ _binaryImageWrapper.show(_canvasContainer.dom.binary, 255);
+ }
+ }
+
+ /**
+ * Iterate over the entire image
+ * extract patches
+ */
+ function findPatches() {
+ var i,
+ j,
+ x,
+ y,
+ moments,
+ patchesFound = [],
+ rasterizer,
+ rasterResult,
+ patch;
+ for (i = 0; i < _numPatches.x; i++) {
+ for (j = 0; j < _numPatches.y; j++) {
+
+ x = _subImageWrapper.size.x * i;
+ y = _subImageWrapper.size.y * j;
+
+ // seperate parts
+ skeletonize(x, y);
+
+ // Rasterize, find individual bars
+ _skelImageWrapper.zeroBorder();
+ _array_helper2['default'].init(_labelImageWrapper.data, 0);
+ rasterizer = _rasterizer2['default'].create(_skelImageWrapper, _labelImageWrapper);
+ rasterResult = rasterizer.rasterize(0);
+
+ if (_config.showLabels) {
+ _labelImageWrapper.overlay(_canvasContainer.dom.binary, Math.floor(360 / rasterResult.count), { x: x, y: y });
+ }
+
+ // calculate moments from the skeletonized patch
+ moments = _labelImageWrapper.moments(rasterResult.count);
+
+ // extract eligible patches
+ patchesFound = patchesFound.concat(describePatch(moments, [i, j], x, y));
+ }
+ }
+
+ if (_config.showFoundPatches) {
+ for (i = 0; i < patchesFound.length; i++) {
+ patch = patchesFound[i];
+ _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: "#99ff00", lineWidth: 2 });
+ }
+ }
+
+ return patchesFound;
+ }
+
+ /**
+ * Finds those connected areas which contain at least 6 patches
+ * and returns them ordered DESC by the number of contained patches
+ * @param {Number} maxLabel
+ */
+ function findBiggestConnectedAreas(maxLabel) {
+ var i,
+ sum,
+ labelHist = [],
+ topLabels = [];
+
+ for (i = 0; i < maxLabel; i++) {
+ labelHist.push(0);
+ }
+ sum = _patchLabelGrid.data.length;
+ while (sum--) {
+ if (_patchLabelGrid.data[sum] > 0) {
+ labelHist[_patchLabelGrid.data[sum] - 1]++;
+ }
+ }
+
+ labelHist = labelHist.map(function (val, idx) {
+ return {
+ val: val,
+ label: idx + 1
+ };
+ });
+
+ labelHist.sort(function (a, b) {
+ return b.val - a.val;
+ });
+
+ // extract top areas with at least 6 patches present
+ topLabels = labelHist.filter(function (el) {
+ return el.val >= 5;
+ });
+
+ return topLabels;
+ }
+
+ /**
+ *
+ */
+ function findBoxes(topLabels, maxLabel) {
+ var i,
+ j,
+ sum,
+ patches = [],
+ patch,
+ box,
+ boxes = [],
+ hsv = [0, 1, 1],
+ rgb = [0, 0, 0];
+
+ for (i = 0; i < topLabels.length; i++) {
+ sum = _patchLabelGrid.data.length;
+ patches.length = 0;
+ while (sum--) {
+ if (_patchLabelGrid.data[sum] === topLabels[i].label) {
+ patch = _imageToPatchGrid.data[sum];
+ patches.push(patch);
+ }
+ }
+ box = boxFromPatches(patches);
+ if (box) {
+ boxes.push(box);
+
+ // draw patch-labels if requested
+ if (_config.showRemainingPatchLabels) {
+ for (j = 0; j < patches.length; j++) {
+ patch = patches[j];
+ hsv[0] = topLabels[i].label / (maxLabel + 1) * 360;
+ _cv_utils2['default'].hsv2rgb(hsv, rgb);
+ _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: "rgb(" + rgb.join(",") + ")", lineWidth: 2 });
+ }
+ }
+ }
+ }
+ return boxes;
+ }
+
+ /**
+ * Find similar moments (via cluster)
+ * @param {Object} moments
+ */
+ function similarMoments(moments) {
+ var clusters = _cv_utils2['default'].cluster(moments, 0.90);
+ var topCluster = _cv_utils2['default'].topGeneric(clusters, 1, function (e) {
+ return e.getPoints().length;
+ });
+ var points = [],
+ result = [];
+ if (topCluster.length === 1) {
+ points = topCluster[0].item.getPoints();
+ for (var i = 0; i < points.length; i++) {
+ result.push(points[i].point);
+ }
+ }
+ return result;
+ }
+
+ function skeletonize(x, y) {
+ _binaryImageWrapper.subImageAsCopy(_subImageWrapper, _cv_utils2['default'].imageRef(x, y));
+ _skeletonizer.skeletonize();
+
+ // Show skeleton if requested
+ if (_config.showSkeleton) {
+ _skelImageWrapper.overlay(_canvasContainer.dom.binary, 360, _cv_utils2['default'].imageRef(x, y));
+ }
+ }
+
+ /**
+ * Extracts and describes those patches which seem to contain a barcode pattern
+ * @param {Array} moments
+ * @param {Object} patchPos,
+ * @param {Number} x
+ * @param {Number} y
+ * @returns {Array} list of patches
+ */
+ function describePatch(moments, patchPos, x, y) {
+ var k,
+ avg,
+ sum = 0,
+ eligibleMoments = [],
+ matchingMoments,
+ patch,
+ patchesFound = [],
+ minComponentWeight = Math.ceil(_patchSize.x / 3);
+
+ if (moments.length >= 2) {
+ // only collect moments which's area covers at least minComponentWeight pixels.
+ for (k = 0; k < moments.length; k++) {
+ if (moments[k].m00 > minComponentWeight) {
+ eligibleMoments.push(moments[k]);
+ }
+ }
+
+ // if at least 2 moments are found which have at least minComponentWeights covered
+ if (eligibleMoments.length >= 2) {
+ sum = eligibleMoments.length;
+ matchingMoments = similarMoments(eligibleMoments);
+ avg = 0;
+ // determine the similarity of the moments
+ for (k = 0; k < matchingMoments.length; k++) {
+ avg += matchingMoments[k].rad;
+ }
+
+ // Only two of the moments are allowed not to fit into the equation
+ // add the patch to the set
+ if (matchingMoments.length > 1 && matchingMoments.length >= eligibleMoments.length / 4 * 3 && matchingMoments.length > moments.length / 4) {
+ avg /= matchingMoments.length;
+ patch = {
+ index: patchPos[1] * _numPatches.x + patchPos[0],
+ pos: {
+ x: x,
+ y: y
+ },
+ box: [vec2.clone([x, y]), vec2.clone([x + _subImageWrapper.size.x, y]), vec2.clone([x + _subImageWrapper.size.x, y + _subImageWrapper.size.y]), vec2.clone([x, y + _subImageWrapper.size.y])],
+ moments: matchingMoments,
+ rad: avg,
+ vec: vec2.clone([Math.cos(avg), Math.sin(avg)])
+ };
+ patchesFound.push(patch);
+ }
+ }
+ }
+ return patchesFound;
+ }
+
+ /**
+ * finds patches which are connected and share the same orientation
+ * @param {Object} patchesFound
+ */
+ function rasterizeAngularSimilarity(patchesFound) {
+ var label = 0,
+ threshold = 0.95,
+ currIdx = 0,
+ j,
+ patch,
+ hsv = [0, 1, 1],
+ rgb = [0, 0, 0];
+
+ function notYetProcessed() {
+ var i;
+ for (i = 0; i < _patchLabelGrid.data.length; i++) {
+ if (_patchLabelGrid.data[i] === 0 && _patchGrid.data[i] === 1) {
+ return i;
+ }
+ }
+ return _patchLabelGrid.length;
+ }
+
+ function trace(currentIdx) {
+ var x,
+ y,
+ currentPatch,
+ patch,
+ idx,
+ dir,
+ current = {
+ x: currentIdx % _patchLabelGrid.size.x,
+ y: currentIdx / _patchLabelGrid.size.x | 0
+ },
+ similarity;
+
+ if (currentIdx < _patchLabelGrid.data.length) {
+ currentPatch = _imageToPatchGrid.data[currentIdx];
+ // assign label
+ _patchLabelGrid.data[currentIdx] = label;
+ for (dir = 0; dir < _tracer2['default'].searchDirections.length; dir++) {
+ y = current.y + _tracer2['default'].searchDirections[dir][0];
+ x = current.x + _tracer2['default'].searchDirections[dir][1];
+ idx = y * _patchLabelGrid.size.x + x;
+
+ // continue if patch empty
+ if (_patchGrid.data[idx] === 0) {
+ _patchLabelGrid.data[idx] = Number.MAX_VALUE;
+ continue;
+ }
+
+ patch = _imageToPatchGrid.data[idx];
+ if (_patchLabelGrid.data[idx] === 0) {
+ similarity = Math.abs(vec2.dot(patch.vec, currentPatch.vec));
+ if (similarity > threshold) {
+ trace(idx);
+ }
+ }
+ }
+ }
+ }
+
+ // prepare for finding the right patches
+ _array_helper2['default'].init(_patchGrid.data, 0);
+ _array_helper2['default'].init(_patchLabelGrid.data, 0);
+ _array_helper2['default'].init(_imageToPatchGrid.data, null);
+
+ for (j = 0; j < patchesFound.length; j++) {
+ patch = patchesFound[j];
+ _imageToPatchGrid.data[patch.index] = patch;
+ _patchGrid.data[patch.index] = 1;
+ }
+
+ // rasterize the patches found to determine area
+ _patchGrid.zeroBorder();
+
+ while ((currIdx = notYetProcessed()) < _patchLabelGrid.data.length) {
+ label++;
+ trace(currIdx);
+ }
+
+ // draw patch-labels if requested
+ if (_config.showPatchLabels) {
+ for (j = 0; j < _patchLabelGrid.data.length; j++) {
+ if (_patchLabelGrid.data[j] > 0 && _patchLabelGrid.data[j] <= label) {
+ patch = _imageToPatchGrid.data[j];
+ hsv[0] = _patchLabelGrid.data[j] / (label + 1) * 360;
+ _cv_utils2['default'].hsv2rgb(hsv, rgb);
+ _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: "rgb(" + rgb.join(",") + ")", lineWidth: 2 });
+ }
+ }
+ }
+
+ return label;
+ }
+
+ exports['default'] = {
+ init: function init(inputImageWrapper, config) {
+ _config = config;
+ _inputImageWrapper = inputImageWrapper;
+
+ initBuffers();
+ initCanvas();
+ },
+
+ locate: function locate() {
+ var patchesFound, topLabels, boxes;
+
+ if (_config.halfSample) {
+ _cv_utils2['default'].halfSample(_inputImageWrapper, _currentImageWrapper);
+ }
+
+ binarizeImage();
+ patchesFound = findPatches();
+ // return unless 5% or more patches are found
+ if (patchesFound.length < _numPatches.x * _numPatches.y * 0.05) {
+ return null;
+ }
+
+ // rasterrize area by comparing angular similarity;
+ var maxLabel = rasterizeAngularSimilarity(patchesFound);
+ if (maxLabel < 1) {
+ return null;
+ }
+
+ // search for area with the most patches (biggest connected area)
+ topLabels = findBiggestConnectedAreas(maxLabel);
+ if (topLabels.length === 0) {
+ return null;
+ }
+
+ boxes = findBoxes(topLabels, maxLabel);
+ return boxes;
+ },
+
+ checkImageConstraints: function checkImageConstraints(inputStream, config) {
+ var patchSize,
+ width = inputStream.getWidth(),
+ height = inputStream.getHeight(),
+ halfSample = config.halfSample ? 0.5 : 1,
+ size,
+ area;
+
+ // calculate width and height based on area
+ if (inputStream.getConfig().area) {
+ area = _cv_utils2['default'].computeImageArea(width, height, inputStream.getConfig().area);
+ inputStream.setTopRight({ x: area.sx, y: area.sy });
+ inputStream.setCanvasSize({ x: width, y: height });
+ width = area.sw;
+ height = area.sh;
+ }
+
+ size = {
+ x: Math.floor(width * halfSample),
+ y: Math.floor(height * halfSample)
+ };
+
+ patchSize = _cv_utils2['default'].calculatePatchSize(config.patchSize, size);
+ console.log("Patch-Size: " + JSON.stringify(patchSize));
+
+ inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / halfSample) * patchSize.x));
+ inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / halfSample) * patchSize.y));
+
+ if (inputStream.getWidth() % patchSize.x === 0 && inputStream.getHeight() % patchSize.y === 0) {
+ return true;
+ }
+
+ throw new Error("Image dimensions do not comply with the current settings: Width (" + width + " )and height (" + height + ") must a multiple of " + patchSize.x);
+ }
+ };
+ module.exports = exports['default'];
+
+/***/ },
+/* 21 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _tracer = __webpack_require__(22);
+
+ var _tracer2 = _interopRequireDefault(_tracer);
+
+ /**
+ * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization
+ */
+ var Rasterizer = {
+ createContour2D: function createContour2D() {
+ return {
+ dir: null,
+ index: null,
+ firstVertex: null,
+ insideContours: null,
+ nextpeer: null,
+ prevpeer: null
+ };
+ },
+ CONTOUR_DIR: {
+ CW_DIR: 0,
+ CCW_DIR: 1,
+ UNKNOWN_DIR: 2
+ },
+ DIR: {
+ OUTSIDE_EDGE: -32767,
+ INSIDE_EDGE: -32766
+ },
+ create: function create(imageWrapper, labelWrapper) {
+ var imageData = imageWrapper.data,
+ labelData = labelWrapper.data,
+ width = imageWrapper.size.x,
+ height = imageWrapper.size.y,
+ tracer = _tracer2["default"].create(imageWrapper, labelWrapper);
+
+ return {
+ rasterize: function rasterize(depthlabel) {
+ var color,
+ bc,
+ lc,
+ labelindex,
+ cx,
+ cy,
+ colorMap = [],
+ vertex,
+ p,
+ cc,
+ sc,
+ pos,
+ connectedCount = 0,
+ i;
+
+ for (i = 0; i < 400; i++) {
+ colorMap[i] = 0;
+ }
+
+ colorMap[0] = imageData[0];
+ cc = null;
+ for (cy = 1; cy < height - 1; cy++) {
+ labelindex = 0;
+ bc = colorMap[0];
+ for (cx = 1; cx < width - 1; cx++) {
+ pos = cy * width + cx;
+ if (labelData[pos] === 0) {
+ color = imageData[pos];
+ if (color !== bc) {
+ if (labelindex === 0) {
+ lc = connectedCount + 1;
+ colorMap[lc] = color;
+ bc = color;
+ vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE);
+ if (vertex !== null) {
+ connectedCount++;
+ labelindex = lc;
+ p = Rasterizer.createContour2D();
+ p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;
+ p.index = labelindex;
+ p.firstVertex = vertex;
+ p.nextpeer = cc;
+ p.insideContours = null;
+ if (cc !== null) {
+ cc.prevpeer = p;
+ }
+ cc = p;
+ }
+ } else {
+ vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex);
+ if (vertex !== null) {
+ p = Rasterizer.createContour2D();
+ p.firstVertex = vertex;
+ p.insideContours = null;
+ if (depthlabel === 0) {
+ p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR;
+ } else {
+ p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;
+ }
+ p.index = depthlabel;
+ sc = cc;
+ while (sc !== null && sc.index !== labelindex) {
+ sc = sc.nextpeer;
+ }
+ if (sc !== null) {
+ p.nextpeer = sc.insideContours;
+ if (sc.insideContours !== null) {
+ sc.insideContours.prevpeer = p;
+ }
+ sc.insideContours = p;
+ }
+ }
+ }
+ } else {
+ labelData[pos] = labelindex;
+ }
+ } else if (labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {
+ labelindex = 0;
+ if (labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {
+ bc = imageData[pos];
+ } else {
+ bc = colorMap[0];
+ }
+ } else {
+ labelindex = labelData[pos];
+ bc = colorMap[labelindex];
+ }
+ }
+ }
+ sc = cc;
+ while (sc !== null) {
+ sc.index = depthlabel;
+ sc = sc.nextpeer;
+ }
+ return {
+ cc: cc,
+ count: connectedCount
+ };
+ },
+ debug: {
+ drawContour: function drawContour(canvas, firstContour) {
+ var ctx = canvas.getContext("2d"),
+ pq = firstContour,
+ iq,
+ q,
+ p;
+
+ ctx.strokeStyle = "red";
+ ctx.fillStyle = "red";
+ ctx.lineWidth = 1;
+
+ if (pq !== null) {
+ iq = pq.insideContours;
+ } else {
+ iq = null;
+ }
+
+ while (pq !== null) {
+ if (iq !== null) {
+ q = iq;
+ iq = iq.nextpeer;
+ } else {
+ q = pq;
+ pq = pq.nextpeer;
+ if (pq !== null) {
+ iq = pq.insideContours;
+ } else {
+ iq = null;
+ }
+ }
+
+ switch (q.dir) {
+ case Rasterizer.CONTOUR_DIR.CW_DIR:
+ ctx.strokeStyle = "red";
+ break;
+ case Rasterizer.CONTOUR_DIR.CCW_DIR:
+ ctx.strokeStyle = "blue";
+ break;
+ case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:
+ ctx.strokeStyle = "green";
+ break;
+ }
+
+ p = q.firstVertex;
+ ctx.beginPath();
+ ctx.moveTo(p.x, p.y);
+ do {
+ p = p.next;
+ ctx.lineTo(p.x, p.y);
+ } while (p !== q.firstVertex);
+ ctx.stroke();
+ }
+ }
+ }
+ };
+ }
+ };
+
+ exports["default"] = Rasterizer;
+ module.exports = exports["default"];
+
+/***/ },
+/* 22 */
+/***/ function(module, exports) {
+
+ /**
+ * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization
+ */
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ var Tracer = {
+ searchDirections: [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]],
+ create: function create(imageWrapper, labelWrapper) {
+ var imageData = imageWrapper.data,
+ labelData = labelWrapper.data,
+ searchDirections = this.searchDirections,
+ width = imageWrapper.size.x,
+ pos;
+
+ function _trace(current, color, label, edgelabel) {
+ var i, y, x;
+
+ for (i = 0; i < 7; i++) {
+ y = current.cy + searchDirections[current.dir][0];
+ x = current.cx + searchDirections[current.dir][1];
+ pos = y * width + x;
+ if (imageData[pos] === color && (labelData[pos] === 0 || labelData[pos] === label)) {
+ labelData[pos] = label;
+ current.cy = y;
+ current.cx = x;
+ return true;
+ } else {
+ if (labelData[pos] === 0) {
+ labelData[pos] = edgelabel;
+ }
+ current.dir = (current.dir + 1) % 8;
+ }
+ }
+ return false;
+ }
+
+ function vertex2D(x, y, dir) {
+ return {
+ dir: dir,
+ x: x,
+ y: y,
+ next: null,
+ prev: null
+ };
+ }
+
+ function _contourTracing(sy, sx, label, color, edgelabel) {
+ var Fv = null,
+ Cv,
+ P,
+ ldir,
+ current = {
+ cx: sx,
+ cy: sy,
+ dir: 0
+ };
+
+ if (_trace(current, color, label, edgelabel)) {
+ Fv = vertex2D(sx, sy, current.dir);
+ Cv = Fv;
+ ldir = current.dir;
+ P = vertex2D(current.cx, current.cy, 0);
+ P.prev = Cv;
+ Cv.next = P;
+ P.next = null;
+ Cv = P;
+ do {
+ current.dir = (current.dir + 6) % 8;
+ _trace(current, color, label, edgelabel);
+ if (ldir != current.dir) {
+ Cv.dir = current.dir;
+ P = vertex2D(current.cx, current.cy, 0);
+ P.prev = Cv;
+ Cv.next = P;
+ P.next = null;
+ Cv = P;
+ } else {
+ Cv.dir = ldir;
+ Cv.x = current.cx;
+ Cv.y = current.cy;
+ }
+ ldir = current.dir;
+ } while (current.cx != sx || current.cy != sy);
+ Fv.prev = Cv.prev;
+ Cv.prev.next = Fv;
+ }
+ return Fv;
+ }
+
+ return {
+ trace: function trace(current, color, label, edgelabel) {
+ return _trace(current, color, label, edgelabel);
+ },
+ contourTracing: function contourTracing(sy, sx, label, color, edgelabel) {
+ return _contourTracing(sy, sx, label, color, edgelabel);
+ }
+ };
+ }
+ };
+
+ exports["default"] = Tracer;
+ module.exports = exports["default"];
+
+/***/ },
+/* 23 */
+/***/ function(module, exports) {
+
+ /* @preserve ASM BEGIN */
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ function Skeletonizer(stdlib, foreign, buffer) {
+ "use asm";
+
+ var images = new stdlib.Uint8Array(buffer),
+ size = foreign.size | 0,
+ imul = stdlib.Math.imul;
+
+ function erode(inImagePtr, outImagePtr) {
+ inImagePtr = inImagePtr | 0;
+ outImagePtr = outImagePtr | 0;
+
+ var v = 0,
+ u = 0,
+ sum = 0,
+ yStart1 = 0,
+ yStart2 = 0,
+ xStart1 = 0,
+ xStart2 = 0,
+ offset = 0;
+
+ for (v = 1; (v | 0) < (size - 1 | 0); v = v + 1 | 0) {
+ offset = offset + size | 0;
+ for (u = 1; (u | 0) < (size - 1 | 0); u = u + 1 | 0) {
+ yStart1 = offset - size | 0;
+ yStart2 = offset + size | 0;
+ xStart1 = u - 1 | 0;
+ xStart2 = u + 1 | 0;
+ sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0;
+ if ((sum | 0) == (5 | 0)) {
+ images[outImagePtr + offset + u | 0] = 1;
+ } else {
+ images[outImagePtr + offset + u | 0] = 0;
+ }
+ }
+ }
+ return;
+ }
+
+ function subtract(aImagePtr, bImagePtr, outImagePtr) {
+ aImagePtr = aImagePtr | 0;
+ bImagePtr = bImagePtr | 0;
+ outImagePtr = outImagePtr | 0;
+
+ var length = 0;
+
+ length = imul(size, size) | 0;
+
+ while ((length | 0) > 0) {
+ length = length - 1 | 0;
+ images[outImagePtr + length | 0] = (images[aImagePtr + length | 0] | 0) - (images[bImagePtr + length | 0] | 0) | 0;
+ }
+ }
+
+ function bitwiseOr(aImagePtr, bImagePtr, outImagePtr) {
+ aImagePtr = aImagePtr | 0;
+ bImagePtr = bImagePtr | 0;
+ outImagePtr = outImagePtr | 0;
+
+ var length = 0;
+
+ length = imul(size, size) | 0;
+
+ while ((length | 0) > 0) {
+ length = length - 1 | 0;
+ images[outImagePtr + length | 0] = images[aImagePtr + length | 0] | 0 | (images[bImagePtr + length | 0] | 0) | 0;
+ }
+ }
+
+ function countNonZero(imagePtr) {
+ imagePtr = imagePtr | 0;
+
+ var sum = 0,
+ length = 0;
+
+ length = imul(size, size) | 0;
+
+ while ((length | 0) > 0) {
+ length = length - 1 | 0;
+ sum = (sum | 0) + (images[imagePtr + length | 0] | 0) | 0;
+ }
+
+ return sum | 0;
+ }
+
+ function init(imagePtr, value) {
+ imagePtr = imagePtr | 0;
+ value = value | 0;
+
+ var length = 0;
+
+ length = imul(size, size) | 0;
+
+ while ((length | 0) > 0) {
+ length = length - 1 | 0;
+ images[imagePtr + length | 0] = value;
+ }
+ }
+
+ function dilate(inImagePtr, outImagePtr) {
+ inImagePtr = inImagePtr | 0;
+ outImagePtr = outImagePtr | 0;
+
+ var v = 0,
+ u = 0,
+ sum = 0,
+ yStart1 = 0,
+ yStart2 = 0,
+ xStart1 = 0,
+ xStart2 = 0,
+ offset = 0;
+
+ for (v = 1; (v | 0) < (size - 1 | 0); v = v + 1 | 0) {
+ offset = offset + size | 0;
+ for (u = 1; (u | 0) < (size - 1 | 0); u = u + 1 | 0) {
+ yStart1 = offset - size | 0;
+ yStart2 = offset + size | 0;
+ xStart1 = u - 1 | 0;
+ xStart2 = u + 1 | 0;
+ sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0;
+ if ((sum | 0) > (0 | 0)) {
+ images[outImagePtr + offset + u | 0] = 1;
+ } else {
+ images[outImagePtr + offset + u | 0] = 0;
+ }
+ }
+ }
+ return;
+ }
+
+ function memcpy(srcImagePtr, dstImagePtr) {
+ srcImagePtr = srcImagePtr | 0;
+ dstImagePtr = dstImagePtr | 0;
+
+ var length = 0;
+
+ length = imul(size, size) | 0;
+
+ while ((length | 0) > 0) {
+ length = length - 1 | 0;
+ images[dstImagePtr + length | 0] = images[srcImagePtr + length | 0] | 0;
+ }
+ }
+
+ function zeroBorder(imagePtr) {
+ imagePtr = imagePtr | 0;
+
+ var x = 0,
+ y = 0;
+
+ for (x = 0; (x | 0) < (size - 1 | 0); x = x + 1 | 0) {
+ images[imagePtr + x | 0] = 0;
+ images[imagePtr + y | 0] = 0;
+ y = y + size - 1 | 0;
+ images[imagePtr + y | 0] = 0;
+ y = y + 1 | 0;
+ }
+ for (x = 0; (x | 0) < (size | 0); x = x + 1 | 0) {
+ images[imagePtr + y | 0] = 0;
+ y = y + 1 | 0;
+ }
+ }
+
+ function skeletonize() {
+ var subImagePtr = 0,
+ erodedImagePtr = 0,
+ tempImagePtr = 0,
+ skelImagePtr = 0,
+ sum = 0,
+ done = 0;
+
+ erodedImagePtr = imul(size, size) | 0;
+ tempImagePtr = erodedImagePtr + erodedImagePtr | 0;
+ skelImagePtr = tempImagePtr + erodedImagePtr | 0;
+
+ // init skel-image
+ init(skelImagePtr, 0);
+ zeroBorder(subImagePtr);
+
+ do {
+ erode(subImagePtr, erodedImagePtr);
+ dilate(erodedImagePtr, tempImagePtr);
+ subtract(subImagePtr, tempImagePtr, tempImagePtr);
+ bitwiseOr(skelImagePtr, tempImagePtr, skelImagePtr);
+ memcpy(erodedImagePtr, subImagePtr);
+ sum = countNonZero(subImagePtr) | 0;
+ done = (sum | 0) == 0 | 0;
+ } while (!done);
+ }
+
+ return {
+ skeletonize: skeletonize
+ };
+ }
+ /* @preserve ASM END */
+
+ exports["default"] = Skeletonizer;
+ module.exports = exports["default"];
+
+/***/ },
+/* 24 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports["default"] = {
+ drawRect: function drawRect(pos, size, ctx, style) {
+ ctx.strokeStyle = style.color;
+ ctx.fillStyle = style.color;
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.strokeRect(pos.x, pos.y, size.x, size.y);
+ },
+ drawPath: function drawPath(path, def, ctx, style) {
+ ctx.strokeStyle = style.color;
+ ctx.fillStyle = style.color;
+ ctx.lineWidth = style.lineWidth;
+ ctx.beginPath();
+ ctx.moveTo(path[0][def.x], path[0][def.y]);
+ for (var j = 1; j < path.length; j++) {
+ ctx.lineTo(path[j][def.x], path[j][def.y]);
+ }
+ ctx.closePath();
+ ctx.stroke();
+ },
+ drawImage: function drawImage(imageData, size, ctx) {
+ var canvasData = ctx.getImageData(0, 0, size.x, size.y),
+ data = canvasData.data,
+ imageDataPos = imageData.length,
+ canvasDataPos = data.length,
+ value;
+
+ if (canvasDataPos / imageDataPos !== 4) {
+ return false;
+ }
+ while (imageDataPos--) {
+ value = imageData[imageDataPos];
+ data[--canvasDataPos] = 255;
+ data[--canvasDataPos] = value;
+ data[--canvasDataPos] = value;
+ data[--canvasDataPos] = value;
+ }
+ ctx.putImageData(canvasData, 0, 0);
+ return true;
+ }
+ };
+ module.exports = exports["default"];
+
+/***/ },
+/* 25 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _bresenham = __webpack_require__(26);
+
+ var _bresenham2 = _interopRequireDefault(_bresenham);
+
+ var _image_debug = __webpack_require__(24);
+
+ var _image_debug2 = _interopRequireDefault(_image_debug);
+
+ var _code_128_reader = __webpack_require__(27);
+
+ var _code_128_reader2 = _interopRequireDefault(_code_128_reader);
+
+ var _ean_reader = __webpack_require__(29);
+
+ var _ean_reader2 = _interopRequireDefault(_ean_reader);
+
+ var _code_39_reader = __webpack_require__(30);
+
+ var _code_39_reader2 = _interopRequireDefault(_code_39_reader);
+
+ var _code_39_vin_reader = __webpack_require__(31);
+
+ var _code_39_vin_reader2 = _interopRequireDefault(_code_39_vin_reader);
+
+ var _codabar_reader = __webpack_require__(32);
+
+ var _codabar_reader2 = _interopRequireDefault(_codabar_reader);
+
+ var _upc_reader = __webpack_require__(33);
+
+ var _upc_reader2 = _interopRequireDefault(_upc_reader);
+
+ var _ean_8_reader = __webpack_require__(34);
+
+ var _ean_8_reader2 = _interopRequireDefault(_ean_8_reader);
+
+ var _upc_e_reader = __webpack_require__(35);
+
+ var _upc_e_reader2 = _interopRequireDefault(_upc_e_reader);
+
+ var _i2of5_reader = __webpack_require__(36);
+
+ var _i2of5_reader2 = _interopRequireDefault(_i2of5_reader);
+
+ var readers = {
+ code_128_reader: _code_128_reader2['default'],
+ ean_reader: _ean_reader2['default'],
+ ean_8_reader: _ean_8_reader2['default'],
+ code_39_reader: _code_39_reader2['default'],
+ code_39_vin_reader: _code_39_vin_reader2['default'],
+ codabar_reader: _codabar_reader2['default'],
+ upc_reader: _upc_reader2['default'],
+ upc_e_reader: _upc_e_reader2['default'],
+ i2of5_reader: _i2of5_reader2['default']
+ };
+ exports['default'] = {
+ create: function create(config, inputImageWrapper) {
+ var _canvas = {
+ ctx: {
+ frequency: null,
+ pattern: null,
+ overlay: null
+ },
+ dom: {
+ frequency: null,
+ pattern: null,
+ overlay: null
+ }
+ },
+ _barcodeReaders = [];
+
+ initCanvas();
+ initReaders();
+ initConfig();
+
+ function initCanvas() {
+ if (typeof document !== 'undefined') {
+ var $debug = document.querySelector("#debug.detection");
+ _canvas.dom.frequency = document.querySelector("canvas.frequency");
+ if (!_canvas.dom.frequency) {
+ _canvas.dom.frequency = document.createElement("canvas");
+ _canvas.dom.frequency.className = "frequency";
+ if ($debug) {
+ $debug.appendChild(_canvas.dom.frequency);
+ }
+ }
+ _canvas.ctx.frequency = _canvas.dom.frequency.getContext("2d");
+
+ _canvas.dom.pattern = document.querySelector("canvas.patternBuffer");
+ if (!_canvas.dom.pattern) {
+ _canvas.dom.pattern = document.createElement("canvas");
+ _canvas.dom.pattern.className = "patternBuffer";
+ if ($debug) {
+ $debug.appendChild(_canvas.dom.pattern);
+ }
+ }
+ _canvas.ctx.pattern = _canvas.dom.pattern.getContext("2d");
+
+ _canvas.dom.overlay = document.querySelector("canvas.drawingBuffer");
+ if (_canvas.dom.overlay) {
+ _canvas.ctx.overlay = _canvas.dom.overlay.getContext("2d");
+ }
+ }
+ }
+
+ function initReaders() {
+ config.readers.forEach(function (readerConfig) {
+ var reader,
+ config = {};
+
+ if (typeof readerConfig === 'object') {
+ reader = readerConfig.format;
+ config = readerConfig.config;
+ } else if (typeof readerConfig === 'string') {
+ reader = readerConfig;
+ }
+ _barcodeReaders.push(new readers[reader](config));
+ });
+ console.log("Registered Readers: " + _barcodeReaders.map(function (reader) {
+ return JSON.stringify({ format: reader.FORMAT, config: reader.config });
+ }).join(', '));
+ }
+
+ function initConfig() {
+ if (typeof document !== 'undefined') {
+ var i,
+ vis = [{
+ node: _canvas.dom.frequency,
+ prop: config.showFrequency
+ }, {
+ node: _canvas.dom.pattern,
+ prop: config.showPattern
+ }];
+
+ for (i = 0; i < vis.length; i++) {
+ if (vis[i].prop === true) {
+ vis[i].node.style.display = "block";
+ } else {
+ vis[i].node.style.display = "none";
+ }
+ }
+ }
+ }
+
+ /**
+ * extend the line on both ends
+ * @param {Array} line
+ * @param {Number} angle
+ */
+ function getExtendedLine(line, angle, ext) {
+ function extendLine(amount) {
+ var extension = {
+ y: amount * Math.sin(angle),
+ x: amount * Math.cos(angle)
+ };
+
+ line[0].y -= extension.y;
+ line[0].x -= extension.x;
+ line[1].y += extension.y;
+ line[1].x += extension.x;
+ }
+
+ // check if inside image
+ extendLine(ext);
+ while (ext > 1 && (!inputImageWrapper.inImageWithBorder(line[0], 0) || !inputImageWrapper.inImageWithBorder(line[1], 0))) {
+ ext -= Math.ceil(ext / 2);
+ extendLine(-ext);
+ }
+ return line;
+ }
+
+ function getLine(box) {
+ return [{
+ x: (box[1][0] - box[0][0]) / 2 + box[0][0],
+ y: (box[1][1] - box[0][1]) / 2 + box[0][1]
+ }, {
+ x: (box[3][0] - box[2][0]) / 2 + box[2][0],
+ y: (box[3][1] - box[2][1]) / 2 + box[2][1]
+ }];
+ }
+
+ function tryDecode(line) {
+ var result = null,
+ i,
+ barcodeLine = _bresenham2['default'].getBarcodeLine(inputImageWrapper, line[0], line[1]);
+
+ if (config.showFrequency) {
+ _image_debug2['default'].drawPath(line, { x: 'x', y: 'y' }, _canvas.ctx.overlay, { color: 'red', lineWidth: 3 });
+ _bresenham2['default'].debug.printFrequency(barcodeLine.line, _canvas.dom.frequency);
+ }
+ _bresenham2['default'].toBinaryLine(barcodeLine);
+ if (config.showPattern) {
+ _bresenham2['default'].debug.printPattern(barcodeLine.line, _canvas.dom.pattern);
+ }
+
+ for (i = 0; i < _barcodeReaders.length && result === null; i++) {
+ result = _barcodeReaders[i].decodePattern(barcodeLine.line);
+ }
+ if (result === null) {
+ return null;
+ }
+ return {
+ codeResult: result,
+ barcodeLine: barcodeLine
+ };
+ }
+
+ /**
+ * This method slices the given area apart and tries to detect a barcode-pattern
+ * for each slice. It returns the decoded barcode, or null if nothing was found
+ * @param {Array} box
+ * @param {Array} line
+ * @param {Number} lineAngle
+ */
+ function tryDecodeBruteForce(box, line, lineAngle) {
+ var sideLength = Math.sqrt(Math.pow(box[1][0] - box[0][0], 2) + Math.pow(box[1][1] - box[0][1], 2)),
+ i,
+ slices = 16,
+ result = null,
+ dir,
+ extension,
+ xdir = Math.sin(lineAngle),
+ ydir = Math.cos(lineAngle);
+
+ for (i = 1; i < slices && result === null; i++) {
+ // move line perpendicular to angle
+ dir = sideLength / slices * i * (i % 2 === 0 ? -1 : 1);
+ extension = {
+ y: dir * xdir,
+ x: dir * ydir
+ };
+ line[0].y += extension.x;
+ line[0].x -= extension.y;
+ line[1].y += extension.x;
+ line[1].x -= extension.y;
+
+ result = tryDecode(line);
+ }
+ return result;
+ }
+
+ function getLineLength(line) {
+ return Math.sqrt(Math.pow(Math.abs(line[1].y - line[0].y), 2) + Math.pow(Math.abs(line[1].x - line[0].x), 2));
+ }
+
+ /**
+ * With the help of the configured readers (Code128 or EAN) this function tries to detect a
+ * valid barcode pattern within the given area.
+ * @param {Object} box The area to search in
+ * @returns {Object} the result {codeResult, line, angle, pattern, threshold}
+ */
+ function _decodeFromBoundingBox(box) {
+ var line,
+ lineAngle,
+ ctx = _canvas.ctx.overlay,
+ result,
+ lineLength;
+
+ if (config.drawBoundingBox && ctx) {
+ _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, ctx, { color: "blue", lineWidth: 2 });
+ }
+
+ line = getLine(box);
+ lineLength = getLineLength(line);
+ lineAngle = Math.atan2(line[1].y - line[0].y, line[1].x - line[0].x);
+ line = getExtendedLine(line, lineAngle, Math.floor(lineLength * 0.1));
+ if (line === null) {
+ return null;
+ }
+
+ result = tryDecode(line);
+ if (result === null) {
+ result = tryDecodeBruteForce(box, line, lineAngle);
+ }
+
+ if (result === null) {
+ return null;
+ }
+
+ if (result && config.drawScanline && ctx) {
+ _image_debug2['default'].drawPath(line, { x: 'x', y: 'y' }, ctx, { color: 'red', lineWidth: 3 });
+ }
+
+ return {
+ codeResult: result.codeResult,
+ line: line,
+ angle: lineAngle,
+ pattern: result.barcodeLine.line,
+ threshold: result.barcodeLine.threshold
+ };
+ }
+
+ return {
+ decodeFromBoundingBox: function decodeFromBoundingBox(box) {
+ return _decodeFromBoundingBox(box);
+ },
+ decodeFromBoundingBoxes: function decodeFromBoundingBoxes(boxes) {
+ var i, result;
+ for (i = 0; i < boxes.length; i++) {
+ result = _decodeFromBoundingBox(boxes[i]);
+ if (result && result.codeResult) {
+ result.box = boxes[i];
+ return result;
+ }
+ }
+ },
+ setReaders: function setReaders(readers) {
+ config.readers = readers;
+ _barcodeReaders.length = 0;
+ initReaders();
+ }
+ };
+ }
+ };
+ module.exports = exports['default'];
+
+/***/ },
+/* 26 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _cv_utils = __webpack_require__(7);
+
+ var _cv_utils2 = _interopRequireDefault(_cv_utils);
+
+ var _image_wrapper = __webpack_require__(5);
+
+ var _image_wrapper2 = _interopRequireDefault(_image_wrapper);
+
+ var Bresenham = {};
+
+ var Slope = {
+ DIR: {
+ UP: 1,
+ DOWN: -1
+ }
+ };
+ /**
+ * Scans a line of the given image from point p1 to p2 and returns a result object containing
+ * gray-scale values (0-255) of the underlying pixels in addition to the min
+ * and max values.
+ * @param {Object} imageWrapper
+ * @param {Object} p1 The start point {x,y}
+ * @param {Object} p2 The end point {x,y}
+ * @returns {line, min, max}
+ */
+ Bresenham.getBarcodeLine = function (imageWrapper, p1, p2) {
+ var x0 = p1.x | 0,
+ y0 = p1.y | 0,
+ x1 = p2.x | 0,
+ y1 = p2.y | 0,
+ steep = Math.abs(y1 - y0) > Math.abs(x1 - x0),
+ deltax,
+ deltay,
+ error,
+ ystep,
+ y,
+ tmp,
+ x,
+ line = [],
+ imageData = imageWrapper.data,
+ width = imageWrapper.size.x,
+ sum = 0,
+ val,
+ min = 255,
+ max = 0;
+
+ function read(a, b) {
+ val = imageData[b * width + a];
+ sum += val;
+ min = val < min ? val : min;
+ max = val > max ? val : max;
+ line.push(val);
+ }
+
+ if (steep) {
+ tmp = x0;
+ x0 = y0;
+ y0 = tmp;
+
+ tmp = x1;
+ x1 = y1;
+ y1 = tmp;
+ }
+ if (x0 > x1) {
+ tmp = x0;
+ x0 = x1;
+ x1 = tmp;
+
+ tmp = y0;
+ y0 = y1;
+ y1 = tmp;
+ }
+ deltax = x1 - x0;
+ deltay = Math.abs(y1 - y0);
+ error = deltax / 2 | 0;
+ y = y0;
+ ystep = y0 < y1 ? 1 : -1;
+ for (x = x0; x < x1; x++) {
+ if (steep) {
+ read(y, x);
+ } else {
+ read(x, y);
+ }
+ error = error - deltay;
+ if (error < 0) {
+ y = y + ystep;
+ error = error + deltax;
+ }
+ }
+
+ return {
+ line: line,
+ min: min,
+ max: max
+ };
+ };
+
+ Bresenham.toOtsuBinaryLine = function (result) {
+ var line = result.line,
+ image = new _image_wrapper2['default']({ x: line.length - 1, y: 1 }, line),
+ threshold = _cv_utils2['default'].determineOtsuThreshold(image, 5);
+
+ line = _cv_utils2['default'].sharpenLine(line);
+ _cv_utils2['default'].thresholdImage(image, threshold);
+
+ return {
+ line: line,
+ threshold: threshold
+ };
+ };
+
+ /**
+ * Converts the result from getBarcodeLine into a binary representation
+ * also considering the frequency and slope of the signal for more robust results
+ * @param {Object} result {line, min, max}
+ */
+ Bresenham.toBinaryLine = function (result) {
+
+ var min = result.min,
+ max = result.max,
+ line = result.line,
+ slope,
+ slope2,
+ center = min + (max - min) / 2,
+ extrema = [],
+ currentDir,
+ dir,
+ threshold = (max - min) / 12,
+ rThreshold = -threshold,
+ i,
+ j;
+
+ // 1. find extrema
+ currentDir = line[0] > center ? Slope.DIR.UP : Slope.DIR.DOWN;
+ extrema.push({
+ pos: 0,
+ val: line[0]
+ });
+ for (i = 0; i < line.length - 2; i++) {
+ slope = line[i + 1] - line[i];
+ slope2 = line[i + 2] - line[i + 1];
+ if (slope + slope2 < rThreshold && line[i + 1] < center * 1.5) {
+ dir = Slope.DIR.DOWN;
+ } else if (slope + slope2 > threshold && line[i + 1] > center * 0.5) {
+ dir = Slope.DIR.UP;
+ } else {
+ dir = currentDir;
+ }
+
+ if (currentDir !== dir) {
+ extrema.push({
+ pos: i,
+ val: line[i]
+ });
+ currentDir = dir;
+ }
+ }
+ extrema.push({
+ pos: line.length,
+ val: line[line.length - 1]
+ });
+
+ for (j = extrema[0].pos; j < extrema[1].pos; j++) {
+ line[j] = line[j] > center ? 0 : 1;
+ }
+
+ // iterate over extrema and convert to binary based on avg between minmax
+ for (i = 1; i < extrema.length - 1; i++) {
+ if (extrema[i + 1].val > extrema[i].val) {
+ threshold = extrema[i].val + (extrema[i + 1].val - extrema[i].val) / 3 * 2 | 0;
+ } else {
+ threshold = extrema[i + 1].val + (extrema[i].val - extrema[i + 1].val) / 3 | 0;
+ }
+
+ for (j = extrema[i].pos; j < extrema[i + 1].pos; j++) {
+ line[j] = line[j] > threshold ? 0 : 1;
+ }
+ }
+
+ return {
+ line: line,
+ threshold: threshold
+ };
+ };
+
+ /**
+ * Used for development only
+ */
+ Bresenham.debug = {
+ printFrequency: function printFrequency(line, canvas) {
+ var i,
+ ctx = canvas.getContext("2d");
+ canvas.width = line.length;
+ canvas.height = 256;
+
+ ctx.beginPath();
+ ctx.strokeStyle = "blue";
+ for (i = 0; i < line.length; i++) {
+ ctx.moveTo(i, 255);
+ ctx.lineTo(i, 255 - line[i]);
+ }
+ ctx.stroke();
+ ctx.closePath();
+ },
+
+ printPattern: function printPattern(line, canvas) {
+ var ctx = canvas.getContext("2d"),
+ i;
+
+ canvas.width = line.length;
+ ctx.fillColor = "black";
+ for (i = 0; i < line.length; i++) {
+ if (line[i] === 1) {
+ ctx.fillRect(i, 0, 1, 100);
+ }
+ }
+ }
+ };
+
+ exports['default'] = Bresenham;
+ module.exports = exports['default'];
+
+/***/ },
+/* 27 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _barcode_reader = __webpack_require__(28);
+
+ var _barcode_reader2 = _interopRequireDefault(_barcode_reader);
+
+ function Code128Reader() {
+ _barcode_reader2["default"].call(this);
+ }
+
+ var properties = {
+ CODE_SHIFT: { value: 98 },
+ CODE_C: { value: 99 },
+ CODE_B: { value: 100 },
+ CODE_A: { value: 101 },
+ START_CODE_A: { value: 103 },
+ START_CODE_B: { value: 104 },
+ START_CODE_C: { value: 105 },
+ STOP_CODE: { value: 106 },
+ MODULO: { value: 11 },
+ CODE_PATTERN: { value: [[2, 1, 2, 2, 2, 2], [2, 2, 2, 1, 2, 2], [2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 3], [1, 2, 1, 3, 2, 2], [1, 3, 1, 2, 2, 2], [1, 2, 2, 2, 1, 3], [1, 2, 2, 3, 1, 2], [1, 3, 2, 2, 1, 2], [2, 2, 1, 2, 1, 3], [2, 2, 1, 3, 1, 2], [2, 3, 1, 2, 1, 2], [1, 1, 2, 2, 3, 2], [1, 2, 2, 1, 3, 2], [1, 2, 2, 2, 3, 1], [1, 1, 3, 2, 2, 2], [1, 2, 3, 1, 2, 2], [1, 2, 3, 2, 2, 1], [2, 2, 3, 2, 1, 1], [2, 2, 1, 1, 3, 2], [2, 2, 1, 2, 3, 1], [2, 1, 3, 2, 1, 2], [2, 2, 3, 1, 1, 2], [3, 1, 2, 1, 3, 1], [3, 1, 1, 2, 2, 2], [3, 2, 1, 1, 2, 2], [3, 2, 1, 2, 2, 1], [3, 1, 2, 2, 1, 2], [3, 2, 2, 1, 1, 2], [3, 2, 2, 2, 1, 1], [2, 1, 2, 1, 2, 3], [2, 1, 2, 3, 2, 1], [2, 3, 2, 1, 2, 1], [1, 1, 1, 3, 2, 3], [1, 3, 1, 1, 2, 3], [1, 3, 1, 3, 2, 1], [1, 1, 2, 3, 1, 3], [1, 3, 2, 1, 1, 3], [1, 3, 2, 3, 1, 1], [2, 1, 1, 3, 1, 3], [2, 3, 1, 1, 1, 3], [2, 3, 1, 3, 1, 1], [1, 1, 2, 1, 3, 3], [1, 1, 2, 3, 3, 1], [1, 3, 2, 1, 3, 1], [1, 1, 3, 1, 2, 3], [1, 1, 3, 3, 2, 1], [1, 3, 3, 1, 2, 1], [3, 1, 3, 1, 2, 1], [2, 1, 1, 3, 3, 1], [2, 3, 1, 1, 3, 1], [2, 1, 3, 1, 1, 3], [2, 1, 3, 3, 1, 1], [2, 1, 3, 1, 3, 1], [3, 1, 1, 1, 2, 3], [3, 1, 1, 3, 2, 1], [3, 3, 1, 1, 2, 1], [3, 1, 2, 1, 1, 3], [3, 1, 2, 3, 1, 1], [3, 3, 2, 1, 1, 1], [3, 1, 4, 1, 1, 1], [2, 2, 1, 4, 1, 1], [4, 3, 1, 1, 1, 1], [1, 1, 1, 2, 2, 4], [1, 1, 1, 4, 2, 2], [1, 2, 1, 1, 2, 4], [1, 2, 1, 4, 2, 1], [1, 4, 1, 1, 2, 2], [1, 4, 1, 2, 2, 1], [1, 1, 2, 2, 1, 4], [1, 1, 2, 4, 1, 2], [1, 2, 2, 1, 1, 4], [1, 2, 2, 4, 1, 1], [1, 4, 2, 1, 1, 2], [1, 4, 2, 2, 1, 1], [2, 4, 1, 2, 1, 1], [2, 2, 1, 1, 1, 4], [4, 1, 3, 1, 1, 1], [2, 4, 1, 1, 1, 2], [1, 3, 4, 1, 1, 1], [1, 1, 1, 2, 4, 2], [1, 2, 1, 1, 4, 2], [1, 2, 1, 2, 4, 1], [1, 1, 4, 2, 1, 2], [1, 2, 4, 1, 1, 2], [1, 2, 4, 2, 1, 1], [4, 1, 1, 2, 1, 2], [4, 2, 1, 1, 1, 2], [4, 2, 1, 2, 1, 1], [2, 1, 2, 1, 4, 1], [2, 1, 4, 1, 2, 1], [4, 1, 2, 1, 2, 1], [1, 1, 1, 1, 4, 3], [1, 1, 1, 3, 4, 1], [1, 3, 1, 1, 4, 1], [1, 1, 4, 1, 1, 3], [1, 1, 4, 3, 1, 1], [4, 1, 1, 1, 1, 3], [4, 1, 1, 3, 1, 1], [1, 1, 3, 1, 4, 1], [1, 1, 4, 1, 3, 1], [3, 1, 1, 1, 4, 1], [4, 1, 1, 1, 3, 1], [2, 1, 1, 4, 1, 2], [2, 1, 1, 2, 1, 4], [2, 1, 1, 2, 3, 2], [2, 3, 3, 1, 1, 1, 2]] },
+ SINGLE_CODE_ERROR: { value: 1 },
+ AVG_CODE_ERROR: { value: 0.5 },
+ FORMAT: { value: "code_128", writeable: false }
+ };
+
+ Code128Reader.prototype = Object.create(_barcode_reader2["default"].prototype, properties);
+ Code128Reader.prototype.constructor = Code128Reader;
+
+ Code128Reader.prototype._decodeCode = function (start) {
+ var counter = [0, 0, 0, 0, 0, 0],
+ i,
+ self = this,
+ offset = start,
+ isWhite = !self._row[offset],
+ counterPos = 0,
+ bestMatch = {
+ error: Number.MAX_VALUE,
+ code: -1,
+ start: start,
+ end: start
+ },
+ code,
+ error,
+ normalized;
+
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ if (counterPos === counter.length - 1) {
+ normalized = self._normalize(counter);
+ if (normalized) {
+ for (code = 0; code < self.CODE_PATTERN.length; code++) {
+ error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
+ if (error < bestMatch.error) {
+ bestMatch.code = code;
+ bestMatch.error = error;
+ }
+ }
+ bestMatch.end = i;
+ return bestMatch;
+ }
+ } else {
+ counterPos++;
+ }
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ return null;
+ };
+
+ Code128Reader.prototype._findStart = function () {
+ var counter = [0, 0, 0, 0, 0, 0],
+ i,
+ self = this,
+ offset = self._nextSet(self._row),
+ isWhite = false,
+ counterPos = 0,
+ bestMatch = {
+ error: Number.MAX_VALUE,
+ code: -1,
+ start: 0,
+ end: 0
+ },
+ code,
+ error,
+ j,
+ sum,
+ normalized;
+
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ if (counterPos === counter.length - 1) {
+ sum = 0;
+ for (j = 0; j < counter.length; j++) {
+ sum += counter[j];
+ }
+ normalized = self._normalize(counter);
+ if (normalized) {
+ for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {
+ error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
+ if (error < bestMatch.error) {
+ bestMatch.code = code;
+ bestMatch.error = error;
+ }
+ }
+ if (bestMatch.error < self.AVG_CODE_ERROR) {
+ bestMatch.start = i - sum;
+ bestMatch.end = i;
+ return bestMatch;
+ }
+ }
+
+ for (j = 0; j < 4; j++) {
+ counter[j] = counter[j + 2];
+ }
+ counter[4] = 0;
+ counter[5] = 0;
+ counterPos--;
+ } else {
+ counterPos++;
+ }
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ return null;
+ };
+
+ Code128Reader.prototype._decode = function () {
+ var self = this,
+ startInfo = self._findStart(),
+ code = null,
+ done = false,
+ result = [],
+ multiplier = 0,
+ checksum = 0,
+ codeset,
+ rawResult = [],
+ decodedCodes = [],
+ shiftNext = false,
+ unshift,
+ lastCharacterWasPrintable;
+
+ if (startInfo === null) {
+ return null;
+ }
+ code = {
+ code: startInfo.code,
+ start: startInfo.start,
+ end: startInfo.end
+ };
+ decodedCodes.push(code);
+ checksum = code.code;
+ switch (code.code) {
+ case self.START_CODE_A:
+ codeset = self.CODE_A;
+ break;
+ case self.START_CODE_B:
+ codeset = self.CODE_B;
+ break;
+ case self.START_CODE_C:
+ codeset = self.CODE_C;
+ break;
+ default:
+ return null;
+ }
+
+ while (!done) {
+ unshift = shiftNext;
+ shiftNext = false;
+ code = self._decodeCode(code.end);
+ if (code !== null) {
+ if (code.code !== self.STOP_CODE) {
+ rawResult.push(code.code);
+ multiplier++;
+ checksum += multiplier * code.code;
+ }
+ decodedCodes.push(code);
+
+ switch (codeset) {
+ case self.CODE_A:
+ if (code.code < 64) {
+ result.push(String.fromCharCode(32 + code.code));
+ } else if (code.code < 96) {
+ result.push(String.fromCharCode(code.code - 64));
+ } else {
+ switch (code.code) {
+ case self.CODE_SHIFT:
+ shiftNext = true;
+ codeset = self.CODE_B;
+ break;
+ case self.CODE_B:
+ codeset = self.CODE_B;
+ break;
+ case self.CODE_C:
+ codeset = self.CODE_C;
+ break;
+ case self.STOP_CODE:
+ done = true;
+ break;
+ }
+ }
+ break;
+ case self.CODE_B:
+ if (code.code < 96) {
+ result.push(String.fromCharCode(32 + code.code));
+ } else {
+ if (code.code != self.STOP_CODE) {
+ lastCharacterWasPrintable = false;
+ }
+ switch (code.code) {
+ case self.CODE_SHIFT:
+ shiftNext = true;
+ codeset = self.CODE_A;
+ break;
+ case self.CODE_A:
+ codeset = self.CODE_A;
+ break;
+ case self.CODE_C:
+ codeset = self.CODE_C;
+ break;
+ case self.STOP_CODE:
+ done = true;
+ break;
+ }
+ }
+ break;
+ case self.CODE_C:
+ if (code.code < 100) {
+ result.push(code.code < 10 ? "0" + code.code : code.code);
+ }
+ switch (code.code) {
+ case self.CODE_A:
+ codeset = self.CODE_A;
+ break;
+ case self.CODE_B:
+ codeset = self.CODE_B;
+ break;
+ case self.STOP_CODE:
+ done = true;
+ break;
+ }
+ break;
+ }
+ } else {
+ done = true;
+ }
+ if (unshift) {
+ codeset = codeset == self.CODE_A ? self.CODE_B : self.CODE_A;
+ }
+ }
+
+ if (code === null) {
+ return null;
+ }
+
+ // find end bar
+ code.end = self._nextUnset(self._row, code.end);
+ if (!self._verifyTrailingWhitespace(code)) {
+ return null;
+ }
+
+ // checksum
+ // Does not work correctly yet!!! startcode - endcode?
+ checksum -= multiplier * rawResult[rawResult.length - 1];
+ if (checksum % 103 != rawResult[rawResult.length - 1]) {
+ return null;
+ }
+
+ if (!result.length) {
+ return null;
+ }
+
+ // remove last code from result (checksum)
+ result.splice(result.length - 1, 1);
+
+ return {
+ code: result.join(""),
+ start: startInfo.start,
+ end: code.end,
+ codeset: codeset,
+ startInfo: startInfo,
+ decodedCodes: decodedCodes,
+ endInfo: code
+ };
+ };
+
+ _barcode_reader2["default"].prototype._verifyTrailingWhitespace = function (endInfo) {
+ var self = this,
+ trailingWhitespaceEnd;
+
+ trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;
+ if (trailingWhitespaceEnd < self._row.length) {
+ if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {
+ return endInfo;
+ }
+ }
+ return null;
+ };
+
+ exports["default"] = Code128Reader;
+ module.exports = exports["default"];
+
+/***/ },
+/* 28 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+ function BarcodeReader(config) {
+ this._row = [];
+ this.config = config || {};
+ return this;
+ }
+
+ BarcodeReader.prototype._nextUnset = function (line, start) {
+ var i;
+
+ if (start === undefined) {
+ start = 0;
+ }
+ for (i = start; i < line.length; i++) {
+ if (!line[i]) {
+ return i;
+ }
+ }
+ return line.length;
+ };
+
+ BarcodeReader.prototype._matchPattern = function (counter, code) {
+ var i,
+ error = 0,
+ singleError = 0,
+ modulo = this.MODULO,
+ maxSingleError = this.SINGLE_CODE_ERROR || 1;
+
+ for (i = 0; i < counter.length; i++) {
+ singleError = Math.abs(code[i] - counter[i]);
+ if (singleError > maxSingleError) {
+ return Number.MAX_VALUE;
+ }
+ error += singleError;
+ }
+ return error / modulo;
+ };
+
+ BarcodeReader.prototype._nextSet = function (line, offset) {
+ var i;
+
+ offset = offset || 0;
+ for (i = offset; i < line.length; i++) {
+ if (line[i]) {
+ return i;
+ }
+ }
+ return line.length;
+ };
+
+ BarcodeReader.prototype._normalize = function (counter, modulo) {
+ var i,
+ self = this,
+ sum = 0,
+ ratio,
+ numOnes = 0,
+ normalized = [],
+ norm = 0;
+
+ if (!modulo) {
+ modulo = self.MODULO;
+ }
+ for (i = 0; i < counter.length; i++) {
+ if (counter[i] === 1) {
+ numOnes++;
+ } else {
+ sum += counter[i];
+ }
+ }
+ ratio = sum / (modulo - numOnes);
+ if (ratio > 1.0) {
+ for (i = 0; i < counter.length; i++) {
+ norm = counter[i] === 1 ? counter[i] : counter[i] / ratio;
+ normalized.push(norm);
+ }
+ } else {
+ ratio = (sum + numOnes) / modulo;
+ for (i = 0; i < counter.length; i++) {
+ norm = counter[i] / ratio;
+ normalized.push(norm);
+ }
+ }
+ return normalized;
+ };
+
+ BarcodeReader.prototype._matchTrace = function (cmpCounter, epsilon) {
+ var counter = [],
+ i,
+ self = this,
+ offset = self._nextSet(self._row),
+ isWhite = !self._row[offset],
+ counterPos = 0,
+ bestMatch = {
+ error: Number.MAX_VALUE,
+ code: -1,
+ start: 0
+ },
+ error;
+
+ if (cmpCounter) {
+ for (i = 0; i < cmpCounter.length; i++) {
+ counter.push(0);
+ }
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ if (counterPos === counter.length - 1) {
+ error = self._matchPattern(counter, cmpCounter);
+
+ if (error < epsilon) {
+ bestMatch.start = i - offset;
+ bestMatch.end = i;
+ bestMatch.counter = counter;
+ return bestMatch;
+ } else {
+ return null;
+ }
+ } else {
+ counterPos++;
+ }
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ } else {
+ counter.push(0);
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ counterPos++;
+ counter.push(0);
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ }
+
+ // if cmpCounter was not given
+ bestMatch.start = offset;
+ bestMatch.end = self._row.length - 1;
+ bestMatch.counter = counter;
+ return bestMatch;
+ };
+
+ BarcodeReader.prototype.decodePattern = function (pattern) {
+ var self = this,
+ result;
+
+ self._row = pattern;
+ result = self._decode();
+ if (result === null) {
+ self._row.reverse();
+ result = self._decode();
+ if (result) {
+ result.direction = BarcodeReader.DIRECTION.REVERSE;
+ result.start = self._row.length - result.start;
+ result.end = self._row.length - result.end;
+ }
+ } else {
+ result.direction = BarcodeReader.DIRECTION.FORWARD;
+ }
+ if (result) {
+ result.format = self.FORMAT;
+ }
+ return result;
+ };
+
+ BarcodeReader.prototype._matchRange = function (start, end, value) {
+ var i;
+
+ start = start < 0 ? 0 : start;
+ for (i = start; i < end; i++) {
+ if (this._row[i] !== value) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ BarcodeReader.prototype._fillCounters = function (offset, end, isWhite) {
+ var self = this,
+ counterPos = 0,
+ i,
+ counters = [];
+
+ isWhite = typeof isWhite !== 'undefined' ? isWhite : true;
+ offset = typeof offset !== 'undefined' ? offset : self._nextUnset(self._row);
+ end = end || self._row.length;
+
+ counters[counterPos] = 0;
+ for (i = offset; i < end; i++) {
+ if (self._row[i] ^ isWhite) {
+ counters[counterPos]++;
+ } else {
+ counterPos++;
+ counters[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ return counters;
+ };
+
+ Object.defineProperty(BarcodeReader.prototype, "FORMAT", {
+ value: 'unknown',
+ writeable: false
+ });
+
+ BarcodeReader.DIRECTION = {
+ FORWARD: 1,
+ REVERSE: -1
+ };
+
+ BarcodeReader.Exception = {
+ StartNotFoundException: "Start-Info was not found!",
+ CodeNotFoundException: "Code could not be found!",
+ PatternNotFoundException: "Pattern could not be found!"
+ };
+
+ BarcodeReader.CONFIG_KEYS = {};
+
+ exports['default'] = BarcodeReader;
+ module.exports = exports['default'];
+
+/***/ },
+/* 29 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _barcode_reader = __webpack_require__(28);
+
+ var _barcode_reader2 = _interopRequireDefault(_barcode_reader);
+
+ function EANReader(opts) {
+ _barcode_reader2["default"].call(this, opts);
+ }
+
+ var properties = {
+ CODE_L_START: { value: 0 },
+ MODULO: { value: 7 },
+ CODE_G_START: { value: 10 },
+ START_PATTERN: { value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7] },
+ STOP_PATTERN: { value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7] },
+ MIDDLE_PATTERN: { value: [1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7] },
+ CODE_PATTERN: { value: [[3, 2, 1, 1], [2, 2, 2, 1], [2, 1, 2, 2], [1, 4, 1, 1], [1, 1, 3, 2], [1, 2, 3, 1], [1, 1, 1, 4], [1, 3, 1, 2], [1, 2, 1, 3], [3, 1, 1, 2], [1, 1, 2, 3], [1, 2, 2, 2], [2, 2, 1, 2], [1, 1, 4, 1], [2, 3, 1, 1], [1, 3, 2, 1], [4, 1, 1, 1], [2, 1, 3, 1], [3, 1, 2, 1], [2, 1, 1, 3]] },
+ CODE_FREQUENCY: { value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26] },
+ SINGLE_CODE_ERROR: { value: 0.67 },
+ AVG_CODE_ERROR: { value: 0.27 },
+ FORMAT: { value: "ean_13", writeable: false }
+ };
+
+ EANReader.prototype = Object.create(_barcode_reader2["default"].prototype, properties);
+ EANReader.prototype.constructor = EANReader;
+
+ EANReader.prototype._decodeCode = function (start, coderange) {
+ var counter = [0, 0, 0, 0],
+ i,
+ self = this,
+ offset = start,
+ isWhite = !self._row[offset],
+ counterPos = 0,
+ bestMatch = {
+ error: Number.MAX_VALUE,
+ code: -1,
+ start: start,
+ end: start
+ },
+ code,
+ error,
+ normalized;
+
+ if (!coderange) {
+ coderange = self.CODE_PATTERN.length;
+ }
+
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ if (counterPos === counter.length - 1) {
+ normalized = self._normalize(counter);
+ if (normalized) {
+ for (code = 0; code < coderange; code++) {
+ error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
+ if (error < bestMatch.error) {
+ bestMatch.code = code;
+ bestMatch.error = error;
+ }
+ }
+ bestMatch.end = i;
+ if (bestMatch.error > self.AVG_CODE_ERROR) {
+ return null;
+ }
+ return bestMatch;
+ }
+ } else {
+ counterPos++;
+ }
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ return null;
+ };
+
+ EANReader.prototype._findPattern = function (pattern, offset, isWhite, tryHarder, epsilon) {
+ var counter = [],
+ self = this,
+ i,
+ counterPos = 0,
+ bestMatch = {
+ error: Number.MAX_VALUE,
+ code: -1,
+ start: 0,
+ end: 0
+ },
+ error,
+ j,
+ sum,
+ normalized;
+
+ if (!offset) {
+ offset = self._nextSet(self._row);
+ }
+
+ if (isWhite === undefined) {
+ isWhite = false;
+ }
+
+ if (tryHarder === undefined) {
+ tryHarder = true;
+ }
+
+ if (epsilon === undefined) {
+ epsilon = self.AVG_CODE_ERROR;
+ }
+
+ for (i = 0; i < pattern.length; i++) {
+ counter[i] = 0;
+ }
+
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ if (counterPos === counter.length - 1) {
+ sum = 0;
+ for (j = 0; j < counter.length; j++) {
+ sum += counter[j];
+ }
+ normalized = self._normalize(counter);
+ if (normalized) {
+ error = self._matchPattern(normalized, pattern);
+
+ if (error < epsilon) {
+ bestMatch.error = error;
+ bestMatch.start = i - sum;
+ bestMatch.end = i;
+ return bestMatch;
+ }
+ }
+ if (tryHarder) {
+ for (j = 0; j < counter.length - 2; j++) {
+ counter[j] = counter[j + 2];
+ }
+ counter[counter.length - 2] = 0;
+ counter[counter.length - 1] = 0;
+ counterPos--;
+ } else {
+ return null;
+ }
+ } else {
+ counterPos++;
+ }
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ return null;
+ };
+
+ EANReader.prototype._findStart = function () {
+ var self = this,
+ leadingWhitespaceStart,
+ offset = self._nextSet(self._row),
+ startInfo;
+
+ while (!startInfo) {
+ startInfo = self._findPattern(self.START_PATTERN, offset);
+ if (!startInfo) {
+ return null;
+ }
+ leadingWhitespaceStart = startInfo.start - (startInfo.end - startInfo.start);
+ if (leadingWhitespaceStart >= 0) {
+ if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {
+ return startInfo;
+ }
+ }
+ offset = startInfo.end;
+ startInfo = null;
+ }
+ };
+
+ EANReader.prototype._verifyTrailingWhitespace = function (endInfo) {
+ var self = this,
+ trailingWhitespaceEnd;
+
+ trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start);
+ if (trailingWhitespaceEnd < self._row.length) {
+ if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {
+ return endInfo;
+ }
+ }
+ return null;
+ };
+
+ EANReader.prototype._findEnd = function (offset, isWhite) {
+ var self = this,
+ endInfo = self._findPattern(self.STOP_PATTERN, offset, isWhite, false);
+
+ return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;
+ };
+
+ EANReader.prototype._calculateFirstDigit = function (codeFrequency) {
+ var i,
+ self = this;
+
+ for (i = 0; i < self.CODE_FREQUENCY.length; i++) {
+ if (codeFrequency === self.CODE_FREQUENCY[i]) {
+ return i;
+ }
+ }
+ return null;
+ };
+
+ EANReader.prototype._decodePayload = function (code, result, decodedCodes) {
+ var i,
+ self = this,
+ codeFrequency = 0x0,
+ firstDigit;
+
+ for (i = 0; i < 6; i++) {
+ code = self._decodeCode(code.end);
+ if (!code) {
+ return null;
+ }
+ if (code.code >= self.CODE_G_START) {
+ code.code = code.code - self.CODE_G_START;
+ codeFrequency |= 1 << 5 - i;
+ } else {
+ codeFrequency |= 0 << 5 - i;
+ }
+ result.push(code.code);
+ decodedCodes.push(code);
+ }
+
+ firstDigit = self._calculateFirstDigit(codeFrequency);
+ if (firstDigit === null) {
+ return null;
+ }
+ result.unshift(firstDigit);
+
+ code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);
+ if (code === null) {
+ return null;
+ }
+ decodedCodes.push(code);
+
+ for (i = 0; i < 6; i++) {
+ code = self._decodeCode(code.end, self.CODE_G_START);
+ if (!code) {
+ return null;
+ }
+ decodedCodes.push(code);
+ result.push(code.code);
+ }
+
+ return code;
+ };
+
+ EANReader.prototype._decode = function () {
+ var startInfo,
+ self = this,
+ code,
+ result = [],
+ decodedCodes = [];
+
+ startInfo = self._findStart();
+ if (!startInfo) {
+ return null;
+ }
+ code = {
+ code: startInfo.code,
+ start: startInfo.start,
+ end: startInfo.end
+ };
+ decodedCodes.push(code);
+ code = self._decodePayload(code, result, decodedCodes);
+ if (!code) {
+ return null;
+ }
+ code = self._findEnd(code.end, false);
+ if (!code) {
+ return null;
+ }
+
+ decodedCodes.push(code);
+
+ // Checksum
+ if (!self._checksum(result)) {
+ return null;
+ }
+
+ return {
+ code: result.join(""),
+ start: startInfo.start,
+ end: code.end,
+ codeset: "",
+ startInfo: startInfo,
+ decodedCodes: decodedCodes
+ };
+ };
+
+ EANReader.prototype._checksum = function (result) {
+ var sum = 0,
+ i;
+
+ for (i = result.length - 2; i >= 0; i -= 2) {
+ sum += result[i];
+ }
+ sum *= 3;
+ for (i = result.length - 1; i >= 0; i -= 2) {
+ sum += result[i];
+ }
+ return sum % 10 === 0;
+ };
+
+ exports["default"] = EANReader;
+ module.exports = exports["default"];
+
+/***/ },
+/* 30 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _barcode_reader = __webpack_require__(28);
+
+ var _barcode_reader2 = _interopRequireDefault(_barcode_reader);
+
+ var _array_helper = __webpack_require__(19);
+
+ var _array_helper2 = _interopRequireDefault(_array_helper);
+
+ function Code39Reader() {
+ _barcode_reader2['default'].call(this);
+ }
+
+ var properties = {
+ ALPHABETH_STRING: { value: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%" },
+ ALPHABET: { value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 45, 46, 32, 42, 36, 47, 43, 37] },
+ CHARACTER_ENCODINGS: { value: [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A] },
+ ASTERISK: { value: 0x094 },
+ FORMAT: { value: "code_39", writeable: false }
+ };
+
+ Code39Reader.prototype = Object.create(_barcode_reader2['default'].prototype, properties);
+ Code39Reader.prototype.constructor = Code39Reader;
+
+ Code39Reader.prototype._toCounters = function (start, counter) {
+ var self = this,
+ numCounters = counter.length,
+ end = self._row.length,
+ isWhite = !self._row[start],
+ i,
+ counterPos = 0;
+
+ _array_helper2['default'].init(counter, 0);
+
+ for (i = start; i < end; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ counterPos++;
+ if (counterPos === numCounters) {
+ break;
+ } else {
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ }
+
+ return counter;
+ };
+
+ Code39Reader.prototype._decode = function () {
+ var self = this,
+ counters = [0, 0, 0, 0, 0, 0, 0, 0, 0],
+ result = [],
+ start = self._findStart(),
+ decodedChar,
+ lastStart,
+ pattern,
+ nextStart;
+
+ if (!start) {
+ return null;
+ }
+ nextStart = self._nextSet(self._row, start.end);
+
+ do {
+ counters = self._toCounters(nextStart, counters);
+ pattern = self._toPattern(counters);
+ if (pattern < 0) {
+ return null;
+ }
+ decodedChar = self._patternToChar(pattern);
+ if (decodedChar < 0) {
+ return null;
+ }
+ result.push(decodedChar);
+ lastStart = nextStart;
+ nextStart += _array_helper2['default'].sum(counters);
+ nextStart = self._nextSet(self._row, nextStart);
+ } while (decodedChar !== '*');
+ result.pop();
+
+ if (!result.length) {
+ return null;
+ }
+
+ if (!self._verifyTrailingWhitespace(lastStart, nextStart, counters)) {
+ return null;
+ }
+
+ return {
+ code: result.join(""),
+ start: start.start,
+ end: nextStart,
+ startInfo: start,
+ decodedCodes: result
+ };
+ };
+
+ Code39Reader.prototype._verifyTrailingWhitespace = function (lastStart, nextStart, counters) {
+ var trailingWhitespaceEnd,
+ patternSize = _array_helper2['default'].sum(counters);
+
+ trailingWhitespaceEnd = nextStart - lastStart - patternSize;
+ if (trailingWhitespaceEnd * 3 >= patternSize) {
+ return true;
+ }
+ return false;
+ };
+
+ Code39Reader.prototype._patternToChar = function (pattern) {
+ var i,
+ self = this;
+
+ for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {
+ if (self.CHARACTER_ENCODINGS[i] === pattern) {
+ return String.fromCharCode(self.ALPHABET[i]);
+ }
+ }
+ };
+
+ Code39Reader.prototype._findNextWidth = function (counters, current) {
+ var i,
+ minWidth = Number.MAX_VALUE;
+
+ for (i = 0; i < counters.length; i++) {
+ if (counters[i] < minWidth && counters[i] > current) {
+ minWidth = counters[i];
+ }
+ }
+
+ return minWidth;
+ };
+
+ Code39Reader.prototype._toPattern = function (counters) {
+ var numCounters = counters.length,
+ maxNarrowWidth = 0,
+ numWideBars = numCounters,
+ wideBarWidth = 0,
+ self = this,
+ pattern,
+ i;
+
+ while (numWideBars > 3) {
+ maxNarrowWidth = self._findNextWidth(counters, maxNarrowWidth);
+ numWideBars = 0;
+ pattern = 0;
+ for (i = 0; i < numCounters; i++) {
+ if (counters[i] > maxNarrowWidth) {
+ pattern |= 1 << numCounters - 1 - i;
+ numWideBars++;
+ wideBarWidth += counters[i];
+ }
+ }
+
+ if (numWideBars === 3) {
+ for (i = 0; i < numCounters && numWideBars > 0; i++) {
+ if (counters[i] > maxNarrowWidth) {
+ numWideBars--;
+ if (counters[i] * 2 >= wideBarWidth) {
+ return -1;
+ }
+ }
+ }
+ return pattern;
+ }
+ }
+ return -1;
+ };
+
+ Code39Reader.prototype._findStart = function () {
+ var self = this,
+ offset = self._nextSet(self._row),
+ patternStart = offset,
+ counter = [0, 0, 0, 0, 0, 0, 0, 0, 0],
+ counterPos = 0,
+ isWhite = false,
+ i,
+ j,
+ whiteSpaceMustStart;
+
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ if (counterPos === counter.length - 1) {
+
+ // find start pattern
+ if (self._toPattern(counter) === self.ASTERISK) {
+ whiteSpaceMustStart = Math.floor(Math.max(0, patternStart - (i - patternStart) / 4));
+ if (self._matchRange(whiteSpaceMustStart, patternStart, 0)) {
+ return {
+ start: patternStart,
+ end: i
+ };
+ }
+ }
+
+ patternStart += counter[0] + counter[1];
+ for (j = 0; j < 7; j++) {
+ counter[j] = counter[j + 2];
+ }
+ counter[7] = 0;
+ counter[8] = 0;
+ counterPos--;
+ } else {
+ counterPos++;
+ }
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ return null;
+ };
+
+ exports['default'] = Code39Reader;
+ module.exports = exports['default'];
+
+/***/ },
+/* 31 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _code_39_reader = __webpack_require__(30);
+
+ var _code_39_reader2 = _interopRequireDefault(_code_39_reader);
+
+ function Code39VINReader() {
+ _code_39_reader2['default'].call(this);
+ }
+
+ var patterns = {
+ IOQ: /[IOQ]/g,
+ AZ09: /[A-Z0-9]{17}/
+ };
+
+ Code39VINReader.prototype = Object.create(_code_39_reader2['default'].prototype);
+ Code39VINReader.prototype.constructor = Code39VINReader;
+
+ // Cribbed from:
+ // /~https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/VINResultParser.java
+ Code39VINReader.prototype._decode = function () {
+ var result = _code_39_reader2['default'].prototype._decode.apply(this);
+ if (!result) {
+ return null;
+ }
+
+ var code = result.code;
+
+ if (!code) {
+ return;
+ }
+
+ code = code.replace(patterns.IOQ, '');
+
+ if (!code.match(patterns.AZ09)) {
+ console.log('Failed AZ09 pattern code:', code);
+ return null;
+ }
+
+ if (!this._checkChecksum(code)) {
+ return null;
+ }
+
+ result.code = code;
+ return result;
+ };
+
+ Code39VINReader.prototype._checkChecksum = function (code) {
+ // TODO
+ return !!code;
+ };
+
+ exports['default'] = Code39VINReader;
+ module.exports = exports['default'];
+
+/***/ },
+/* 32 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _barcode_reader = __webpack_require__(28);
+
+ var _barcode_reader2 = _interopRequireDefault(_barcode_reader);
+
+ function CodabarReader() {
+ _barcode_reader2["default"].call(this);
+ this._counters = [];
+ }
+
+ var properties = {
+ ALPHABETH_STRING: { value: "0123456789-$:/.+ABCD" },
+ ALPHABET: { value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 36, 58, 47, 46, 43, 65, 66, 67, 68] },
+ CHARACTER_ENCODINGS: { value: [0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E] },
+ START_END: { value: [0x01A, 0x029, 0x00B, 0x00E] },
+ MIN_ENCODED_CHARS: { value: 4 },
+ MAX_ACCEPTABLE: { value: 2.0 },
+ PADDING: { value: 1.5 },
+ FORMAT: { value: "codabar", writeable: false }
+ };
+
+ CodabarReader.prototype = Object.create(_barcode_reader2["default"].prototype, properties);
+ CodabarReader.prototype.constructor = CodabarReader;
+
+ CodabarReader.prototype._decode = function () {
+ var self = this,
+ result = [],
+ start,
+ decodedChar,
+ pattern,
+ nextStart,
+ end;
+
+ this._counters = self._fillCounters();
+ start = self._findStart();
+ if (!start) {
+ return null;
+ }
+ nextStart = start.startCounter;
+
+ do {
+ pattern = self._toPattern(nextStart);
+ if (pattern < 0) {
+ return null;
+ }
+ decodedChar = self._patternToChar(pattern);
+ if (decodedChar < 0) {
+ return null;
+ }
+ result.push(decodedChar);
+ nextStart += 8;
+ if (result.length > 1 && self._isStartEnd(pattern)) {
+ break;
+ }
+ } while (nextStart < self._counters.length);
+
+ // verify end
+ if (result.length - 2 < self.MIN_ENCODED_CHARS || !self._isStartEnd(pattern)) {
+ return null;
+ }
+
+ // verify end white space
+ if (!self._verifyWhitespace(start.startCounter, nextStart - 8)) {
+ return null;
+ }
+
+ if (!self._validateResult(result, start.startCounter)) {
+ return null;
+ }
+
+ nextStart = nextStart > self._counters.length ? self._counters.length : nextStart;
+ end = start.start + self._sumCounters(start.startCounter, nextStart - 8);
+
+ return {
+ code: result.join(""),
+ start: start.start,
+ end: end,
+ startInfo: start,
+ decodedCodes: result
+ };
+ };
+
+ CodabarReader.prototype._verifyWhitespace = function (startCounter, endCounter) {
+ if (startCounter - 1 <= 0 || this._counters[startCounter - 1] >= this._calculatePatternLength(startCounter) / 2.0) {
+ if (endCounter + 8 >= this._counters.length || this._counters[endCounter + 7] >= this._calculatePatternLength(endCounter) / 2.0) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ CodabarReader.prototype._calculatePatternLength = function (offset) {
+ var i,
+ sum = 0;
+
+ for (i = offset; i < offset + 7; i++) {
+ sum += this._counters[i];
+ }
+
+ return sum;
+ };
+
+ CodabarReader.prototype._thresholdResultPattern = function (result, startCounter) {
+ var self = this,
+ categorization = {
+ space: {
+ narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE },
+ wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE }
+ },
+ bar: {
+ narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE },
+ wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE }
+ }
+ },
+ kind,
+ cat,
+ i,
+ j,
+ pos = startCounter,
+ pattern;
+
+ for (i = 0; i < result.length; i++) {
+ pattern = self._charToPattern(result[i]);
+ for (j = 6; j >= 0; j--) {
+ kind = (j & 1) === 2 ? categorization.bar : categorization.space;
+ cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;
+ cat.size += self._counters[pos + j];
+ cat.counts++;
+ pattern >>= 1;
+ }
+ pos += 8;
+ }
+
+ ["space", "bar"].forEach(function (key) {
+ var kind = categorization[key];
+ kind.wide.min = Math.floor((kind.narrow.size / kind.narrow.counts + kind.wide.size / kind.wide.counts) / 2);
+ kind.narrow.max = Math.ceil(kind.wide.min);
+ kind.wide.max = Math.ceil((kind.wide.size * self.MAX_ACCEPTABLE + self.PADDING) / kind.wide.counts);
+ });
+
+ return categorization;
+ };
+
+ CodabarReader.prototype._charToPattern = function (char) {
+ var self = this,
+ charCode = char.charCodeAt(0),
+ i;
+
+ for (i = 0; i < self.ALPHABET.length; i++) {
+ if (self.ALPHABET[i] === charCode) {
+ return self.CHARACTER_ENCODINGS[i];
+ }
+ }
+ return 0x0;
+ };
+
+ CodabarReader.prototype._validateResult = function (result, startCounter) {
+ var self = this,
+ thresholds = self._thresholdResultPattern(result, startCounter),
+ i,
+ j,
+ kind,
+ cat,
+ size,
+ pos = startCounter,
+ pattern;
+
+ for (i = 0; i < result.length; i++) {
+ pattern = self._charToPattern(result[i]);
+ for (j = 6; j >= 0; j--) {
+ kind = (j & 1) === 0 ? thresholds.bar : thresholds.space;
+ cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;
+ size = self._counters[pos + j];
+ if (size < cat.min || size > cat.max) {
+ return false;
+ }
+ pattern >>= 1;
+ }
+ pos += 8;
+ }
+ return true;
+ };
+
+ CodabarReader.prototype._patternToChar = function (pattern) {
+ var i,
+ self = this;
+
+ for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {
+ if (self.CHARACTER_ENCODINGS[i] === pattern) {
+ return String.fromCharCode(self.ALPHABET[i]);
+ }
+ }
+ return -1;
+ };
+
+ CodabarReader.prototype._computeAlternatingThreshold = function (offset, end) {
+ var i,
+ min = Number.MAX_VALUE,
+ max = 0,
+ counter;
+
+ for (i = offset; i < end; i += 2) {
+ counter = this._counters[i];
+ if (counter > max) {
+ max = counter;
+ }
+ if (counter < min) {
+ min = counter;
+ }
+ }
+
+ return (min + max) / 2.0 | 0;
+ };
+
+ CodabarReader.prototype._toPattern = function (offset) {
+ var numCounters = 7,
+ end = offset + numCounters,
+ barThreshold,
+ spaceThreshold,
+ bitmask = 1 << numCounters - 1,
+ pattern = 0,
+ i,
+ threshold;
+
+ if (end > this._counters.length) {
+ return -1;
+ }
+
+ barThreshold = this._computeAlternatingThreshold(offset, end);
+ spaceThreshold = this._computeAlternatingThreshold(offset + 1, end);
+
+ for (i = 0; i < numCounters; i++) {
+ threshold = (i & 1) === 0 ? barThreshold : spaceThreshold;
+ if (this._counters[offset + i] > threshold) {
+ pattern |= bitmask;
+ }
+ bitmask >>= 1;
+ }
+
+ return pattern;
+ };
+
+ CodabarReader.prototype._isStartEnd = function (pattern) {
+ var i;
+
+ for (i = 0; i < this.START_END.length; i++) {
+ if (this.START_END[i] === pattern) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ CodabarReader.prototype._sumCounters = function (start, end) {
+ var i,
+ sum = 0;
+
+ for (i = start; i < end; i++) {
+ sum += this._counters[i];
+ }
+ return sum;
+ };
+
+ CodabarReader.prototype._findStart = function () {
+ var self = this,
+ i,
+ pattern,
+ start = self._nextUnset(self._row),
+ end;
+
+ for (i = 1; i < this._counters.length; i++) {
+ pattern = self._toPattern(i);
+ if (pattern !== -1 && self._isStartEnd(pattern)) {
+ // TODO: Look for whitespace ahead
+ start += self._sumCounters(0, i);
+ end = start + self._sumCounters(i, i + 8);
+ return {
+ start: start,
+ end: end,
+ startCounter: i,
+ endCounter: i + 8
+ };
+ }
+ }
+ };
+
+ exports["default"] = CodabarReader;
+ module.exports = exports["default"];
+
+/***/ },
+/* 33 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _ean_reader = __webpack_require__(29);
+
+ var _ean_reader2 = _interopRequireDefault(_ean_reader);
+
+ function UPCReader() {
+ _ean_reader2["default"].call(this);
+ }
+
+ var properties = {
+ FORMAT: { value: "upc_a", writeable: false }
+ };
+
+ UPCReader.prototype = Object.create(_ean_reader2["default"].prototype, properties);
+ UPCReader.prototype.constructor = UPCReader;
+
+ UPCReader.prototype._decode = function () {
+ var result = _ean_reader2["default"].prototype._decode.call(this);
+
+ if (result && result.code && result.code.length === 13 && result.code.charAt(0) === "0") {
+
+ result.code = result.code.substring(1);
+ return result;
+ }
+ return null;
+ };
+
+ exports["default"] = _ean_reader2["default"];
+ module.exports = exports["default"];
+
+/***/ },
+/* 34 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _ean_reader = __webpack_require__(29);
+
+ var _ean_reader2 = _interopRequireDefault(_ean_reader);
+
+ function EAN8Reader() {
+ _ean_reader2["default"].call(this);
+ }
+
+ var properties = {
+ FORMAT: { value: "ean_8", writeable: false }
+ };
+
+ EAN8Reader.prototype = Object.create(_ean_reader2["default"].prototype, properties);
+ EAN8Reader.prototype.constructor = EAN8Reader;
+
+ EAN8Reader.prototype._decodePayload = function (code, result, decodedCodes) {
+ var i,
+ self = this;
+
+ for (i = 0; i < 4; i++) {
+ code = self._decodeCode(code.end, self.CODE_G_START);
+ if (!code) {
+ return null;
+ }
+ result.push(code.code);
+ decodedCodes.push(code);
+ }
+
+ code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);
+ if (code === null) {
+ return null;
+ }
+ decodedCodes.push(code);
+
+ for (i = 0; i < 4; i++) {
+ code = self._decodeCode(code.end, self.CODE_G_START);
+ if (!code) {
+ return null;
+ }
+ decodedCodes.push(code);
+ result.push(code.code);
+ }
+
+ return code;
+ };
+
+ exports["default"] = EAN8Reader;
+ module.exports = exports["default"];
+
+/***/ },
+/* 35 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _ean_reader = __webpack_require__(29);
+
+ var _ean_reader2 = _interopRequireDefault(_ean_reader);
+
+ function UPCEReader() {
+ _ean_reader2["default"].call(this);
+ }
+
+ var properties = {
+ CODE_FREQUENCY: { value: [[56, 52, 50, 49, 44, 38, 35, 42, 41, 37], [7, 11, 13, 14, 19, 25, 28, 21, 22, 26]] },
+ STOP_PATTERN: { value: [1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7] },
+ FORMAT: { value: "upc_e", writeable: false }
+ };
+
+ UPCEReader.prototype = Object.create(_ean_reader2["default"].prototype, properties);
+ UPCEReader.prototype.constructor = UPCEReader;
+
+ UPCEReader.prototype._decodePayload = function (code, result, decodedCodes) {
+ var i,
+ self = this,
+ codeFrequency = 0x0;
+
+ for (i = 0; i < 6; i++) {
+ code = self._decodeCode(code.end);
+ if (!code) {
+ return null;
+ }
+ if (code.code >= self.CODE_G_START) {
+ code.code = code.code - self.CODE_G_START;
+ codeFrequency |= 1 << 5 - i;
+ }
+ result.push(code.code);
+ decodedCodes.push(code);
+ }
+ if (!self._determineParity(codeFrequency, result)) {
+ return null;
+ }
+
+ return code;
+ };
+
+ UPCEReader.prototype._determineParity = function (codeFrequency, result) {
+ var self = this,
+ i,
+ nrSystem;
+
+ for (nrSystem = 0; nrSystem < self.CODE_FREQUENCY.length; nrSystem++) {
+ for (i = 0; i < self.CODE_FREQUENCY[nrSystem].length; i++) {
+ if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {
+ result.unshift(nrSystem);
+ result.push(i);
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ UPCEReader.prototype._convertToUPCA = function (result) {
+ var upca = [result[0]],
+ lastDigit = result[result.length - 2];
+
+ if (lastDigit <= 2) {
+ upca = upca.concat(result.slice(1, 3)).concat([lastDigit, 0, 0, 0, 0]).concat(result.slice(3, 6));
+ } else if (lastDigit === 3) {
+ upca = upca.concat(result.slice(1, 4)).concat([0, 0, 0, 0, 0]).concat(result.slice(4, 6));
+ } else if (lastDigit === 4) {
+ upca = upca.concat(result.slice(1, 5)).concat([0, 0, 0, 0, 0, result[5]]);
+ } else {
+ upca = upca.concat(result.slice(1, 6)).concat([0, 0, 0, 0, lastDigit]);
+ }
+
+ upca.push(result[result.length - 1]);
+ return upca;
+ };
+
+ UPCEReader.prototype._checksum = function (result) {
+ return _ean_reader2["default"].prototype._checksum.call(this, this._convertToUPCA(result));
+ };
+
+ UPCEReader.prototype._findEnd = function (offset, isWhite) {
+ isWhite = true;
+ return _ean_reader2["default"].prototype._findEnd.call(this, offset, isWhite);
+ };
+
+ UPCEReader.prototype._verifyTrailingWhitespace = function (endInfo) {
+ var self = this,
+ trailingWhitespaceEnd;
+
+ trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;
+ if (trailingWhitespaceEnd < self._row.length) {
+ if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {
+ return endInfo;
+ }
+ }
+ };
+
+ exports["default"] = UPCEReader;
+ module.exports = exports["default"];
+
+/***/ },
+/* 36 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _barcode_reader = __webpack_require__(28);
+
+ var _barcode_reader2 = _interopRequireDefault(_barcode_reader);
+
+ var merge = __webpack_require__(37);
+
+ function I2of5Reader(opts) {
+ opts = merge(getDefaulConfig(), opts);
+ _barcode_reader2['default'].call(this, opts);
+ this.barSpaceRatio = [1, 1];
+ if (opts.normalizeBarSpaceWidth) {
+ this.SINGLE_CODE_ERROR = 0.38;
+ this.AVG_CODE_ERROR = 0.09;
+ }
+ }
+
+ function getDefaulConfig() {
+ var config = {};
+
+ Object.keys(I2of5Reader.CONFIG_KEYS).forEach(function (key) {
+ config[key] = I2of5Reader.CONFIG_KEYS[key]['default'];
+ });
+ return config;
+ }
+
+ var N = 1,
+ W = 3,
+ properties = {
+ MODULO: { value: 10 },
+ START_PATTERN: { value: [N * 2.5, N * 2.5, N * 2.5, N * 2.5] },
+ STOP_PATTERN: { value: [N * 2, N * 2, W * 2] },
+ CODE_PATTERN: { value: [[N, N, W, W, N], [W, N, N, N, W], [N, W, N, N, W], [W, W, N, N, N], [N, N, W, N, W], [W, N, W, N, N], [N, W, W, N, N], [N, N, N, W, W], [W, N, N, W, N], [N, W, N, W, N]] },
+ SINGLE_CODE_ERROR: { value: 0.78, writable: true },
+ AVG_CODE_ERROR: { value: 0.38, writable: true },
+ MAX_CORRECTION_FACTOR: { value: 5 },
+ FORMAT: { value: "i2of5" }
+ };
+
+ I2of5Reader.prototype = Object.create(_barcode_reader2['default'].prototype, properties);
+ I2of5Reader.prototype.constructor = I2of5Reader;
+
+ I2of5Reader.prototype._matchPattern = function (counter, code) {
+ if (this.config.normalizeBarSpaceWidth) {
+ var i,
+ counterSum = [0, 0],
+ codeSum = [0, 0],
+ correction = [0, 0],
+ correctionRatio = this.MAX_CORRECTION_FACTOR,
+ correctionRatioInverse = 1 / correctionRatio;
+
+ for (i = 0; i < counter.length; i++) {
+ counterSum[i % 2] += counter[i];
+ codeSum[i % 2] += code[i];
+ }
+ correction[0] = codeSum[0] / counterSum[0];
+ correction[1] = codeSum[1] / counterSum[1];
+
+ correction[0] = Math.max(Math.min(correction[0], correctionRatio), correctionRatioInverse);
+ correction[1] = Math.max(Math.min(correction[1], correctionRatio), correctionRatioInverse);
+ this.barSpaceRatio = correction;
+ for (i = 0; i < counter.length; i++) {
+ counter[i] *= this.barSpaceRatio[i % 2];
+ }
+ }
+ return _barcode_reader2['default'].prototype._matchPattern.call(this, counter, code);
+ };
+
+ I2of5Reader.prototype._findPattern = function (pattern, offset, isWhite, tryHarder) {
+ var counter = [],
+ self = this,
+ i,
+ counterPos = 0,
+ bestMatch = {
+ error: Number.MAX_VALUE,
+ code: -1,
+ start: 0,
+ end: 0
+ },
+ error,
+ j,
+ sum,
+ normalized,
+ epsilon = self.AVG_CODE_ERROR;
+
+ isWhite = isWhite || false;
+ tryHarder = tryHarder || false;
+
+ if (!offset) {
+ offset = self._nextSet(self._row);
+ }
+
+ for (i = 0; i < pattern.length; i++) {
+ counter[i] = 0;
+ }
+
+ for (i = offset; i < self._row.length; i++) {
+ if (self._row[i] ^ isWhite) {
+ counter[counterPos]++;
+ } else {
+ if (counterPos === counter.length - 1) {
+ sum = 0;
+ for (j = 0; j < counter.length; j++) {
+ sum += counter[j];
+ }
+ normalized = self._normalize(counter);
+ if (normalized) {
+ error = self._matchPattern(normalized, pattern);
+
+ if (error < epsilon) {
+ bestMatch.error = error;
+ bestMatch.start = i - sum;
+ bestMatch.end = i;
+ return bestMatch;
+ }
+ }
+ if (tryHarder) {
+ for (j = 0; j < counter.length - 2; j++) {
+ counter[j] = counter[j + 2];
+ }
+ counter[counter.length - 2] = 0;
+ counter[counter.length - 1] = 0;
+ counterPos--;
+ } else {
+ return null;
+ }
+ } else {
+ counterPos++;
+ }
+ counter[counterPos] = 1;
+ isWhite = !isWhite;
+ }
+ }
+ return null;
+ };
+
+ I2of5Reader.prototype._findStart = function () {
+ var self = this,
+ leadingWhitespaceStart,
+ offset = self._nextSet(self._row),
+ startInfo,
+ narrowBarWidth = 1;
+
+ while (!startInfo) {
+ startInfo = self._findPattern(self.START_PATTERN, offset, false, true);
+ if (!startInfo) {
+ return null;
+ }
+ narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / 4);
+ leadingWhitespaceStart = startInfo.start - narrowBarWidth * 10;
+ if (leadingWhitespaceStart >= 0) {
+ if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {
+ return startInfo;
+ }
+ }
+ offset = startInfo.end;
+ startInfo = null;
+ }
+ };
+
+ I2of5Reader.prototype._verifyTrailingWhitespace = function (endInfo) {
+ var self = this,
+ trailingWhitespaceEnd;
+
+ trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;
+ if (trailingWhitespaceEnd < self._row.length) {
+ if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {
+ return endInfo;
+ }
+ }
+ return null;
+ };
+
+ I2of5Reader.prototype._findEnd = function () {
+ var self = this,
+ endInfo,
+ tmp;
+
+ self._row.reverse();
+ endInfo = self._findPattern(self.STOP_PATTERN);
+ self._row.reverse();
+
+ if (endInfo === null) {
+ return null;
+ }
+
+ // reverse numbers
+ tmp = endInfo.start;
+ endInfo.start = self._row.length - endInfo.end;
+ endInfo.end = self._row.length - tmp;
+
+ return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;
+ };
+
+ I2of5Reader.prototype._decodePair = function (counterPair) {
+ var i,
+ code,
+ codes = [],
+ self = this;
+
+ for (i = 0; i < counterPair.length; i++) {
+ code = self._decodeCode(counterPair[i]);
+ if (!code) {
+ return null;
+ }
+ codes.push(code);
+ }
+ return codes;
+ };
+
+ I2of5Reader.prototype._decodeCode = function (counter) {
+ var j,
+ self = this,
+ sum = 0,
+ normalized,
+ error,
+ epsilon = self.AVG_CODE_ERROR,
+ code,
+ bestMatch = {
+ error: Number.MAX_VALUE,
+ code: -1,
+ start: 0,
+ end: 0
+ };
+
+ for (j = 0; j < counter.length; j++) {
+ sum += counter[j];
+ }
+ normalized = self._normalize(counter);
+ if (normalized) {
+ for (code = 0; code < self.CODE_PATTERN.length; code++) {
+ error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
+ if (error < bestMatch.error) {
+ bestMatch.code = code;
+ bestMatch.error = error;
+ }
+ }
+ if (bestMatch.error < epsilon) {
+ return bestMatch;
+ }
+ }
+ return null;
+ };
+
+ I2of5Reader.prototype._decodePayload = function (counters, result, decodedCodes) {
+ var i,
+ self = this,
+ pos = 0,
+ counterLength = counters.length,
+ counterPair = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],
+ codes;
+
+ while (pos < counterLength) {
+ for (i = 0; i < 5; i++) {
+ counterPair[0][i] = counters[pos] * this.barSpaceRatio[0];
+ counterPair[1][i] = counters[pos + 1] * this.barSpaceRatio[1];
+ pos += 2;
+ }
+ codes = self._decodePair(counterPair);
+ if (!codes) {
+ return null;
+ }
+ for (i = 0; i < codes.length; i++) {
+ result.push(codes[i].code + "");
+ decodedCodes.push(codes[i]);
+ }
+ }
+ return codes;
+ };
+
+ I2of5Reader.prototype._verifyCounterLength = function (counters) {
+ return counters.length % 10 === 0;
+ };
+
+ I2of5Reader.prototype._decode = function () {
+ var startInfo,
+ endInfo,
+ self = this,
+ code,
+ result = [],
+ decodedCodes = [],
+ counters;
+
+ startInfo = self._findStart();
+ if (!startInfo) {
+ return null;
+ }
+ decodedCodes.push(startInfo);
+
+ endInfo = self._findEnd();
+ if (!endInfo) {
+ return null;
+ }
+
+ counters = self._fillCounters(startInfo.end, endInfo.start, false);
+ if (!self._verifyCounterLength(counters)) {
+ return null;
+ }
+ code = self._decodePayload(counters, result, decodedCodes);
+ if (!code) {
+ return null;
+ }
+ if (result.length % 2 !== 0 || result.length < 6) {
+ return null;
+ }
+
+ decodedCodes.push(endInfo);
+ return {
+ code: result.join(""),
+ start: startInfo.start,
+ end: endInfo.end,
+ startInfo: startInfo,
+ decodedCodes: decodedCodes
+ };
+ };
+
+ I2of5Reader.CONFIG_KEYS = {
+ normalizeBarSpaceWidth: {
+ 'type': 'boolean',
+ 'default': false,
+ 'description': 'If true, the reader tries to normalize the' + 'width-difference between bars and spaces'
+ }
+ };
+
+ exports['default'] = I2of5Reader;
+ module.exports = exports['default'];
+
+/***/ },
+/* 37 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var baseMerge = __webpack_require__(38),
+ createAssigner = __webpack_require__(65);
+
+ /**
+ * Recursively merges own enumerable properties of the source object(s), that
+ * don't resolve to `undefined` into the destination object. Subsequent sources
+ * overwrite property assignments of previous sources. If `customizer` is
+ * provided it's invoked to produce the merged values of the destination and
+ * source properties. If `customizer` returns `undefined` merging is handled
+ * by the method instead. The `customizer` is bound to `thisArg` and invoked
+ * with five arguments: (objectValue, sourceValue, key, object, source).
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @param {*} [thisArg] The `this` binding of `customizer`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var users = {
+ * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
+ * };
+ *
+ * var ages = {
+ * 'data': [{ 'age': 36 }, { 'age': 40 }]
+ * };
+ *
+ * _.merge(users, ages);
+ * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
+ *
+ * // using a customizer callback
+ * var object = {
+ * 'fruits': ['apple'],
+ * 'vegetables': ['beet']
+ * };
+ *
+ * var other = {
+ * 'fruits': ['banana'],
+ * 'vegetables': ['carrot']
+ * };
+ *
+ * _.merge(object, other, function(a, b) {
+ * if (_.isArray(a)) {
+ * return a.concat(b);
+ * }
+ * });
+ * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
+ */
+ var merge = createAssigner(baseMerge);
+
+ module.exports = merge;
+
+
+/***/ },
+/* 38 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var arrayEach = __webpack_require__(39),
+ baseMergeDeep = __webpack_require__(40),
+ isArray = __webpack_require__(48),
+ isArrayLike = __webpack_require__(43),
+ isObject = __webpack_require__(52),
+ isObjectLike = __webpack_require__(47),
+ isTypedArray = __webpack_require__(60),
+ keys = __webpack_require__(63);
+
+ /**
+ * The base implementation of `_.merge` without support for argument juggling,
+ * multiple sources, and `this` binding `customizer` functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @param {Function} [customizer] The function to customize merged values.
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
+ * @param {Array} [stackB=[]] Associates values with source counterparts.
+ * @returns {Object} Returns `object`.
+ */
+ function baseMerge(object, source, customizer, stackA, stackB) {
+ if (!isObject(object)) {
+ return object;
+ }
+ var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
+ props = isSrcArr ? undefined : keys(source);
+
+ arrayEach(props || source, function(srcValue, key) {
+ if (props) {
+ key = srcValue;
+ srcValue = source[key];
+ }
+ if (isObjectLike(srcValue)) {
+ stackA || (stackA = []);
+ stackB || (stackB = []);
+ baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
+ }
+ else {
+ var value = object[key],
+ result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
+ isCommon = result === undefined;
+
+ if (isCommon) {
+ result = srcValue;
+ }
+ if ((result !== undefined || (isSrcArr && !(key in object))) &&
+ (isCommon || (result === result ? (result !== value) : (value === value)))) {
+ object[key] = result;
+ }
+ }
+ });
+ return object;
+ }
+
+ module.exports = baseMerge;
+
+
+/***/ },
+/* 39 */
+/***/ function(module, exports) {
+
+ /**
+ * A specialized version of `_.forEach` for arrays without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEach(array, iteratee) {
+ var index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ if (iteratee(array[index], index, array) === false) {
+ break;
+ }
+ }
+ return array;
+ }
+
+ module.exports = arrayEach;
+
+
+/***/ },
+/* 40 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var arrayCopy = __webpack_require__(41),
+ isArguments = __webpack_require__(42),
+ isArray = __webpack_require__(48),
+ isArrayLike = __webpack_require__(43),
+ isPlainObject = __webpack_require__(53),
+ isTypedArray = __webpack_require__(60),
+ toPlainObject = __webpack_require__(61);
+
+ /**
+ * A specialized version of `baseMerge` for arrays and objects which performs
+ * deep merges and tracks traversed objects enabling objects with circular
+ * references to be merged.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @param {string} key The key of the value to merge.
+ * @param {Function} mergeFunc The function to merge values.
+ * @param {Function} [customizer] The function to customize merged values.
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
+ * @param {Array} [stackB=[]] Associates values with source counterparts.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
+ var length = stackA.length,
+ srcValue = source[key];
+
+ while (length--) {
+ if (stackA[length] == srcValue) {
+ object[key] = stackB[length];
+ return;
+ }
+ }
+ var value = object[key],
+ result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
+ isCommon = result === undefined;
+
+ if (isCommon) {
+ result = srcValue;
+ if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
+ result = isArray(value)
+ ? value
+ : (isArrayLike(value) ? arrayCopy(value) : []);
+ }
+ else if (isPlainObject(srcValue) || isArguments(srcValue)) {
+ result = isArguments(value)
+ ? toPlainObject(value)
+ : (isPlainObject(value) ? value : {});
+ }
+ else {
+ isCommon = false;
+ }
+ }
+ // Add the source value to the stack of traversed objects and associate
+ // it with its merged value.
+ stackA.push(srcValue);
+ stackB.push(result);
+
+ if (isCommon) {
+ // Recursively merge objects and arrays (susceptible to call stack limits).
+ object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
+ } else if (result === result ? (result !== value) : (value === value)) {
+ object[key] = result;
+ }
+ }
+
+ module.exports = baseMergeDeep;
+
+
+/***/ },
+/* 41 */
+/***/ function(module, exports) {
+
+ /**
+ * Copies the values of `source` to `array`.
+ *
+ * @private
+ * @param {Array} source The array to copy values from.
+ * @param {Array} [array=[]] The array to copy values to.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayCopy(source, array) {
+ var index = -1,
+ length = source.length;
+
+ array || (array = Array(length));
+ while (++index < length) {
+ array[index] = source[index];
+ }
+ return array;
+ }
+
+ module.exports = arrayCopy;
+
+
+/***/ },
+/* 42 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isArrayLike = __webpack_require__(43),
+ isObjectLike = __webpack_require__(47);
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /** Native method references. */
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
+
+ /**
+ * Checks if `value` is classified as an `arguments` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isArguments(function() { return arguments; }());
+ * // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
+ */
+ function isArguments(value) {
+ return isObjectLike(value) && isArrayLike(value) &&
+ hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
+ }
+
+ module.exports = isArguments;
+
+
+/***/ },
+/* 43 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var getLength = __webpack_require__(44),
+ isLength = __webpack_require__(46);
+
+ /**
+ * Checks if `value` is array-like.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+ */
+ function isArrayLike(value) {
+ return value != null && isLength(getLength(value));
+ }
+
+ module.exports = isArrayLike;
+
+
+/***/ },
+/* 44 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var baseProperty = __webpack_require__(45);
+
+ /**
+ * Gets the "length" property value of `object`.
+ *
+ * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
+ * that affects Safari on at least iOS 8.1-8.3 ARM64.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {*} Returns the "length" value.
+ */
+ var getLength = baseProperty('length');
+
+ module.exports = getLength;
+
+
+/***/ },
+/* 45 */
+/***/ function(module, exports) {
+
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
+ module.exports = baseProperty;
+
+
+/***/ },
+/* 46 */
+/***/ function(module, exports) {
+
+ /**
+ * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
+ * of an array-like value.
+ */
+ var MAX_SAFE_INTEGER = 9007199254740991;
+
+ /**
+ * Checks if `value` is a valid array-like length.
+ *
+ * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ */
+ function isLength(value) {
+ return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+ }
+
+ module.exports = isLength;
+
+
+/***/ },
+/* 47 */
+/***/ function(module, exports) {
+
+ /**
+ * Checks if `value` is object-like.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ */
+ function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+ }
+
+ module.exports = isObjectLike;
+
+
+/***/ },
+/* 48 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var getNative = __webpack_require__(49),
+ isLength = __webpack_require__(46),
+ isObjectLike = __webpack_require__(47);
+
+ /** `Object#toString` result references. */
+ var arrayTag = '[object Array]';
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objToString = objectProto.toString;
+
+ /* Native method references for those with the same name as other `lodash` methods. */
+ var nativeIsArray = getNative(Array, 'isArray');
+
+ /**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(function() { return arguments; }());
+ * // => false
+ */
+ var isArray = nativeIsArray || function(value) {
+ return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
+ };
+
+ module.exports = isArray;
+
+
+/***/ },
+/* 49 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isNative = __webpack_require__(50);
+
+ /**
+ * Gets the native function at `key` of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {string} key The key of the method to get.
+ * @returns {*} Returns the function if it's native, else `undefined`.
+ */
+ function getNative(object, key) {
+ var value = object == null ? undefined : object[key];
+ return isNative(value) ? value : undefined;
+ }
+
+ module.exports = getNative;
+
+
+/***/ },
+/* 50 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isFunction = __webpack_require__(51),
+ isObjectLike = __webpack_require__(47);
+
+ /** Used to detect host constructors (Safari > 5). */
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to resolve the decompiled source of functions. */
+ var fnToString = Function.prototype.toString;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /** Used to detect if a method is native. */
+ var reIsNative = RegExp('^' +
+ fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
+ );
+
+ /**
+ * Checks if `value` is a native function.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
+ * @example
+ *
+ * _.isNative(Array.prototype.push);
+ * // => true
+ *
+ * _.isNative(_);
+ * // => false
+ */
+ function isNative(value) {
+ if (value == null) {
+ return false;
+ }
+ if (isFunction(value)) {
+ return reIsNative.test(fnToString.call(value));
+ }
+ return isObjectLike(value) && reIsHostCtor.test(value);
+ }
+
+ module.exports = isNative;
+
+
+/***/ },
+/* 51 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isObject = __webpack_require__(52);
+
+ /** `Object#toString` result references. */
+ var funcTag = '[object Function]';
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objToString = objectProto.toString;
+
+ /**
+ * Checks if `value` is classified as a `Function` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isFunction(_);
+ * // => true
+ *
+ * _.isFunction(/abc/);
+ * // => false
+ */
+ function isFunction(value) {
+ // The use of `Object#toString` avoids issues with the `typeof` operator
+ // in older versions of Chrome and Safari which return 'function' for regexes
+ // and Safari 8 which returns 'object' for typed array constructors.
+ return isObject(value) && objToString.call(value) == funcTag;
+ }
+
+ module.exports = isFunction;
+
+
+/***/ },
+/* 52 */
+/***/ function(module, exports) {
+
+ /**
+ * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
+ * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(1);
+ * // => false
+ */
+ function isObject(value) {
+ // Avoid a V8 JIT bug in Chrome 19-20.
+ // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
+ var type = typeof value;
+ return !!value && (type == 'object' || type == 'function');
+ }
+
+ module.exports = isObject;
+
+
+/***/ },
+/* 53 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var baseForIn = __webpack_require__(54),
+ isArguments = __webpack_require__(42),
+ isObjectLike = __webpack_require__(47);
+
+ /** `Object#toString` result references. */
+ var objectTag = '[object Object]';
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objToString = objectProto.toString;
+
+ /**
+ * Checks if `value` is a plain object, that is, an object created by the
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
+ *
+ * **Note:** This method assumes objects created by the `Object` constructor
+ * have no inherited enumerable properties.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * _.isPlainObject(new Foo);
+ * // => false
+ *
+ * _.isPlainObject([1, 2, 3]);
+ * // => false
+ *
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
+ * // => true
+ *
+ * _.isPlainObject(Object.create(null));
+ * // => true
+ */
+ function isPlainObject(value) {
+ var Ctor;
+
+ // Exit early for non `Object` objects.
+ if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
+ (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
+ return false;
+ }
+ // IE < 9 iterates inherited properties before own properties. If the first
+ // iterated property is an object's own property then there are no inherited
+ // enumerable properties.
+ var result;
+ // In most environments an object's own properties are iterated before
+ // its inherited properties. If the last iterated property is an object's
+ // own property then there are no inherited enumerable properties.
+ baseForIn(value, function(subValue, key) {
+ result = key;
+ });
+ return result === undefined || hasOwnProperty.call(value, result);
+ }
+
+ module.exports = isPlainObject;
+
+
+/***/ },
+/* 54 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var baseFor = __webpack_require__(55),
+ keysIn = __webpack_require__(58);
+
+ /**
+ * The base implementation of `_.forIn` without support for callback
+ * shorthands and `this` binding.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+ function baseForIn(object, iteratee) {
+ return baseFor(object, iteratee, keysIn);
+ }
+
+ module.exports = baseForIn;
+
+
+/***/ },
+/* 55 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var createBaseFor = __webpack_require__(56);
+
+ /**
+ * The base implementation of `baseForIn` and `baseForOwn` which iterates
+ * over `object` properties returned by `keysFunc` invoking `iteratee` for
+ * each property. Iteratee functions may exit iteration early by explicitly
+ * returning `false`.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
+ */
+ var baseFor = createBaseFor();
+
+ module.exports = baseFor;
+
+
+/***/ },
+/* 56 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var toObject = __webpack_require__(57);
+
+ /**
+ * Creates a base function for `_.forIn` or `_.forInRight`.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+ function createBaseFor(fromRight) {
+ return function(object, iteratee, keysFunc) {
+ var iterable = toObject(object),
+ props = keysFunc(object),
+ length = props.length,
+ index = fromRight ? length : -1;
+
+ while ((fromRight ? index-- : ++index < length)) {
+ var key = props[index];
+ if (iteratee(iterable[key], key, iterable) === false) {
+ break;
+ }
+ }
+ return object;
+ };
+ }
+
+ module.exports = createBaseFor;
+
+
+/***/ },
+/* 57 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isObject = __webpack_require__(52);
+
+ /**
+ * Converts `value` to an object if it's not one.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {Object} Returns the object.
+ */
+ function toObject(value) {
+ return isObject(value) ? value : Object(value);
+ }
+
+ module.exports = toObject;
+
+
+/***/ },
+/* 58 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isArguments = __webpack_require__(42),
+ isArray = __webpack_require__(48),
+ isIndex = __webpack_require__(59),
+ isLength = __webpack_require__(46),
+ isObject = __webpack_require__(52);
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /**
+ * Creates an array of the own and inherited enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keysIn(new Foo);
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
+ */
+ function keysIn(object) {
+ if (object == null) {
+ return [];
+ }
+ if (!isObject(object)) {
+ object = Object(object);
+ }
+ var length = object.length;
+ length = (length && isLength(length) &&
+ (isArray(object) || isArguments(object)) && length) || 0;
+
+ var Ctor = object.constructor,
+ index = -1,
+ isProto = typeof Ctor == 'function' && Ctor.prototype === object,
+ result = Array(length),
+ skipIndexes = length > 0;
+
+ while (++index < length) {
+ result[index] = (index + '');
+ }
+ for (var key in object) {
+ if (!(skipIndexes && isIndex(key, length)) &&
+ !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ module.exports = keysIn;
+
+
+/***/ },
+/* 59 */
+/***/ function(module, exports) {
+
+ /** Used to detect unsigned integer values. */
+ var reIsUint = /^\d+$/;
+
+ /**
+ * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
+ * of an array-like value.
+ */
+ var MAX_SAFE_INTEGER = 9007199254740991;
+
+ /**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+ function isIndex(value, length) {
+ value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return value > -1 && value % 1 == 0 && value < length;
+ }
+
+ module.exports = isIndex;
+
+
+/***/ },
+/* 60 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isLength = __webpack_require__(46),
+ isObjectLike = __webpack_require__(47);
+
+ /** `Object#toString` result references. */
+ var argsTag = '[object Arguments]',
+ arrayTag = '[object Array]',
+ boolTag = '[object Boolean]',
+ dateTag = '[object Date]',
+ errorTag = '[object Error]',
+ funcTag = '[object Function]',
+ mapTag = '[object Map]',
+ numberTag = '[object Number]',
+ objectTag = '[object Object]',
+ regexpTag = '[object RegExp]',
+ setTag = '[object Set]',
+ stringTag = '[object String]',
+ weakMapTag = '[object WeakMap]';
+
+ var arrayBufferTag = '[object ArrayBuffer]',
+ float32Tag = '[object Float32Array]',
+ float64Tag = '[object Float64Array]',
+ int8Tag = '[object Int8Array]',
+ int16Tag = '[object Int16Array]',
+ int32Tag = '[object Int32Array]',
+ uint8Tag = '[object Uint8Array]',
+ uint8ClampedTag = '[object Uint8ClampedArray]',
+ uint16Tag = '[object Uint16Array]',
+ uint32Tag = '[object Uint32Array]';
+
+ /** Used to identify `toStringTag` values of typed arrays. */
+ var typedArrayTags = {};
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
+ typedArrayTags[uint32Tag] = true;
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
+ typedArrayTags[dateTag] = typedArrayTags[errorTag] =
+ typedArrayTags[funcTag] = typedArrayTags[mapTag] =
+ typedArrayTags[numberTag] = typedArrayTags[objectTag] =
+ typedArrayTags[regexpTag] = typedArrayTags[setTag] =
+ typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objToString = objectProto.toString;
+
+ /**
+ * Checks if `value` is classified as a typed array.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isTypedArray(new Uint8Array);
+ * // => true
+ *
+ * _.isTypedArray([]);
+ * // => false
+ */
+ function isTypedArray(value) {
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
+ }
+
+ module.exports = isTypedArray;
+
+
+/***/ },
+/* 61 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var baseCopy = __webpack_require__(62),
+ keysIn = __webpack_require__(58);
+
+ /**
+ * Converts `value` to a plain object flattening inherited enumerable
+ * properties of `value` to own properties of the plain object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {Object} Returns the converted plain object.
+ * @example
+ *
+ * function Foo() {
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.assign({ 'a': 1 }, new Foo);
+ * // => { 'a': 1, 'b': 2 }
+ *
+ * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
+ * // => { 'a': 1, 'b': 2, 'c': 3 }
+ */
+ function toPlainObject(value) {
+ return baseCopy(value, keysIn(value));
+ }
+
+ module.exports = toPlainObject;
+
+
+/***/ },
+/* 62 */
+/***/ function(module, exports) {
+
+ /**
+ * Copies properties of `source` to `object`.
+ *
+ * @private
+ * @param {Object} source The object to copy properties from.
+ * @param {Array} props The property names to copy.
+ * @param {Object} [object={}] The object to copy properties to.
+ * @returns {Object} Returns `object`.
+ */
+ function baseCopy(source, props, object) {
+ object || (object = {});
+
+ var index = -1,
+ length = props.length;
+
+ while (++index < length) {
+ var key = props[index];
+ object[key] = source[key];
+ }
+ return object;
+ }
+
+ module.exports = baseCopy;
+
+
+/***/ },
+/* 63 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var getNative = __webpack_require__(49),
+ isArrayLike = __webpack_require__(43),
+ isObject = __webpack_require__(52),
+ shimKeys = __webpack_require__(64);
+
+ /* Native method references for those with the same name as other `lodash` methods. */
+ var nativeKeys = getNative(Object, 'keys');
+
+ /**
+ * Creates an array of the own enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects. See the
+ * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
+ * for more details.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keys(new Foo);
+ * // => ['a', 'b'] (iteration order is not guaranteed)
+ *
+ * _.keys('hi');
+ * // => ['0', '1']
+ */
+ var keys = !nativeKeys ? shimKeys : function(object) {
+ var Ctor = object == null ? undefined : object.constructor;
+ if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
+ (typeof object != 'function' && isArrayLike(object))) {
+ return shimKeys(object);
+ }
+ return isObject(object) ? nativeKeys(object) : [];
+ };
+
+ module.exports = keys;
+
+
+/***/ },
+/* 64 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isArguments = __webpack_require__(42),
+ isArray = __webpack_require__(48),
+ isIndex = __webpack_require__(59),
+ isLength = __webpack_require__(46),
+ keysIn = __webpack_require__(58);
+
+ /** Used for native method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /**
+ * A fallback implementation of `Object.keys` which creates an array of the
+ * own enumerable property names of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+ function shimKeys(object) {
+ var props = keysIn(object),
+ propsLength = props.length,
+ length = propsLength && object.length;
+
+ var allowIndexes = !!length && isLength(length) &&
+ (isArray(object) || isArguments(object));
+
+ var index = -1,
+ result = [];
+
+ while (++index < propsLength) {
+ var key = props[index];
+ if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ module.exports = shimKeys;
+
+
+/***/ },
+/* 65 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var bindCallback = __webpack_require__(66),
+ isIterateeCall = __webpack_require__(68),
+ restParam = __webpack_require__(69);
+
+ /**
+ * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
+ *
+ * @private
+ * @param {Function} assigner The function to assign values.
+ * @returns {Function} Returns the new assigner function.
+ */
+ function createAssigner(assigner) {
+ return restParam(function(object, sources) {
+ var index = -1,
+ length = object == null ? 0 : sources.length,
+ customizer = length > 2 ? sources[length - 2] : undefined,
+ guard = length > 2 ? sources[2] : undefined,
+ thisArg = length > 1 ? sources[length - 1] : undefined;
+
+ if (typeof customizer == 'function') {
+ customizer = bindCallback(customizer, thisArg, 5);
+ length -= 2;
+ } else {
+ customizer = typeof thisArg == 'function' ? thisArg : undefined;
+ length -= (customizer ? 1 : 0);
+ }
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+ customizer = length < 3 ? undefined : customizer;
+ length = 1;
+ }
+ while (++index < length) {
+ var source = sources[index];
+ if (source) {
+ assigner(object, source, customizer);
+ }
+ }
+ return object;
+ });
+ }
+
+ module.exports = createAssigner;
+
+
+/***/ },
+/* 66 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var identity = __webpack_require__(67);
+
+ /**
+ * A specialized version of `baseCallback` which only supports `this` binding
+ * and specifying the number of arguments to provide to `func`.
+ *
+ * @private
+ * @param {Function} func The function to bind.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {number} [argCount] The number of arguments to provide to `func`.
+ * @returns {Function} Returns the callback.
+ */
+ function bindCallback(func, thisArg, argCount) {
+ if (typeof func != 'function') {
+ return identity;
+ }
+ if (thisArg === undefined) {
+ return func;
+ }
+ switch (argCount) {
+ case 1: return function(value) {
+ return func.call(thisArg, value);
+ };
+ case 3: return function(value, index, collection) {
+ return func.call(thisArg, value, index, collection);
+ };
+ case 4: return function(accumulator, value, index, collection) {
+ return func.call(thisArg, accumulator, value, index, collection);
+ };
+ case 5: return function(value, other, key, object, source) {
+ return func.call(thisArg, value, other, key, object, source);
+ };
+ }
+ return function() {
+ return func.apply(thisArg, arguments);
+ };
+ }
+
+ module.exports = bindCallback;
+
+
+/***/ },
+/* 67 */
+/***/ function(module, exports) {
+
+ /**
+ * This method returns the first argument provided to it.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {*} value Any value.
+ * @returns {*} Returns `value`.
+ * @example
+ *
+ * var object = { 'user': 'fred' };
+ *
+ * _.identity(object) === object;
+ * // => true
+ */
+ function identity(value) {
+ return value;
+ }
+
+ module.exports = identity;
+
+
+/***/ },
+/* 68 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var isArrayLike = __webpack_require__(43),
+ isIndex = __webpack_require__(59),
+ isObject = __webpack_require__(52);
+
+ /**
+ * Checks if the provided arguments are from an iteratee call.
+ *
+ * @private
+ * @param {*} value The potential iteratee value argument.
+ * @param {*} index The potential iteratee index or key argument.
+ * @param {*} object The potential iteratee object argument.
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
+ */
+ function isIterateeCall(value, index, object) {
+ if (!isObject(object)) {
+ return false;
+ }
+ var type = typeof index;
+ if (type == 'number'
+ ? (isArrayLike(object) && isIndex(index, object.length))
+ : (type == 'string' && index in object)) {
+ var other = object[index];
+ return value === value ? (value === other) : (other !== other);
+ }
+ return false;
+ }
+
+ module.exports = isIterateeCall;
+
+
+/***/ },
+/* 69 */
+/***/ function(module, exports) {
+
+ /** Used as the `TypeError` message for "Functions" methods. */
+ var FUNC_ERROR_TEXT = 'Expected a function';
+
+ /* Native method references for those with the same name as other `lodash` methods. */
+ var nativeMax = Math.max;
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of the
+ * created function and arguments from `start` and beyond provided as an array.
+ *
+ * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var say = _.restParam(function(what, names) {
+ * return what + ' ' + _.initial(names).join(', ') +
+ * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
+ * });
+ *
+ * say('hello', 'fred', 'barney', 'pebbles');
+ * // => 'hello fred, barney, & pebbles'
+ */
+ function restParam(func, start) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ rest = Array(length);
+
+ while (++index < length) {
+ rest[index] = args[start + index];
+ }
+ switch (start) {
+ case 0: return func.call(this, rest);
+ case 1: return func.call(this, args[0], rest);
+ case 2: return func.call(this, args[0], args[1], rest);
+ }
+ var otherArgs = Array(start + 1);
+ index = -1;
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = rest;
+ return func.apply(this, otherArgs);
+ };
+ }
+
+ module.exports = restParam;
+
+
+/***/ },
+/* 70 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+
+ var _cv_utils = __webpack_require__(7);
+
+ var _cv_utils2 = _interopRequireDefault(_cv_utils);
+
+ var FrameGrabber = {};
+
+ FrameGrabber.create = function (inputStream, canvas) {
+ var _that = {},
+ _streamConfig = inputStream.getConfig(),
+ _video_size = _cv_utils2["default"].imageRef(inputStream.getRealWidth(), inputStream.getRealHeight()),
+ _canvasSize = inputStream.getCanvasSize(),
+ _size = _cv_utils2["default"].imageRef(inputStream.getWidth(), inputStream.getHeight()),
+ topRight = inputStream.getTopRight(),
+ _sx = topRight.x,
+ _sy = topRight.y,
+ _canvas,
+ _ctx = null,
+ _data = null;
+
+ _canvas = canvas ? canvas : document.createElement("canvas");
+ _canvas.width = _canvasSize.x;
+ _canvas.height = _canvasSize.y;
+ _ctx = _canvas.getContext("2d");
+ _data = new Uint8Array(_size.x * _size.y);
+ console.log("FrameGrabber", JSON.stringify({
+ size: _size,
+ topRight: topRight,
+ videoSize: _video_size,
+ canvasSize: _canvasSize
+ }));
+
+ /**
+ * Uses the given array as frame-buffer
+ */
+ _that.attachData = function (data) {
+ _data = data;
+ };
+
+ /**
+ * Returns the used frame-buffer
+ */
+ _that.getData = function () {
+ return _data;
+ };
+
+ /**
+ * Fetches a frame from the input-stream and puts into the frame-buffer.
+ * The image-data is converted to gray-scale and then half-sampled if configured.
+ */
+ _that.grab = function () {
+ var doHalfSample = _streamConfig.halfSample,
+ frame = inputStream.getFrame(),
+ ctxData;
+ if (frame) {
+ _ctx.drawImage(frame, 0, 0, _canvasSize.x, _canvasSize.y);
+ ctxData = _ctx.getImageData(_sx, _sy, _size.x, _size.y).data;
+ if (doHalfSample) {
+ _cv_utils2["default"].grayAndHalfSampleFromCanvasData(ctxData, _size, _data);
+ } else {
+ _cv_utils2["default"].computeGray(ctxData, _data, _streamConfig);
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ _that.getSize = function () {
+ return _size;
+ };
+
+ return _that;
+ };
+
+ exports["default"] = FrameGrabber;
+ module.exports = exports["default"];
+
+/***/ },
+/* 71 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+ exports["default"] = {
+ inputStream: {
+ name: "Live",
+ type: "LiveStream",
+ constraints: {
+ width: 640,
+ height: 480,
+ minAspectRatio: 0,
+ maxAspectRatio: 100,
+ facing: "environment" // or user
+ },
+ area: {
+ top: "0%",
+ right: "0%",
+ left: "0%",
+ bottom: "0%"
+ },
+ singleChannel: false // true: only the red color-channel is read
+ },
+ tracking: false,
+ debug: false,
+ controls: false,
+ locate: true,
+ numOfWorkers: 4,
+ visual: {
+ show: true
+ },
+ decoder: {
+ drawBoundingBox: false,
+ showFrequency: false,
+ drawScanline: false,
+ showPattern: false,
+ readers: ['code_128_reader']
+ },
+ locator: {
+ halfSample: true,
+ patchSize: "medium", // x-small, small, medium, large, x-large
+ showCanvas: false,
+ showPatches: false,
+ showFoundPatches: false,
+ showSkeleton: false,
+ showLabels: false,
+ showPatchLabels: false,
+ showRemainingPatchLabels: false,
+ boxFromPatches: {
+ showTransformed: false,
+ showTransformedBox: false,
+ showBB: false
+ }
+ }
+ };
+ module.exports = exports["default"];
+
+/***/ },
+/* 72 */
+/***/ function(module, exports) {
+
+ "use strict";
+
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+
+ exports["default"] = (function () {
+ var events = {};
+
+ function getEvent(eventName) {
+ if (!events[eventName]) {
+ events[eventName] = {
+ subscribers: []
+ };
+ }
+ return events[eventName];
+ }
+
+ function clearEvents() {
+ events = {};
+ }
+
+ function publishSubscription(subscription, data) {
+ if (subscription.async) {
+ setTimeout(function () {
+ subscription.callback(data);
+ }, 4);
+ } else {
+ subscription.callback(data);
+ }
+ }
+
+ function _subscribe(event, callback, async) {
+ var subscription;
+
+ if (typeof callback === "function") {
+ subscription = {
+ callback: callback,
+ async: async
+ };
+ } else {
+ subscription = callback;
+ if (!subscription.callback) {
+ throw "Callback was not specified on options";
+ }
+ }
+
+ getEvent(event).subscribers.push(subscription);
+ }
+
+ return {
+ subscribe: function subscribe(event, callback, async) {
+ return _subscribe(event, callback, async);
+ },
+ publish: function publish(eventName, data) {
+ var event = getEvent(eventName),
+ subscribers = event.subscribers;
+
+ event.subscribers = subscribers.filter(function (subscriber) {
+ publishSubscription(subscriber, data);
+ return !subscriber.once;
+ });
+ },
+ once: function once(event, callback, async) {
+ _subscribe(event, {
+ callback: callback,
+ async: async,
+ once: true
+ });
+ },
+ unsubscribe: function unsubscribe(eventName, callback) {
+ var event;
+
+ if (eventName) {
+ event = getEvent(eventName);
+ if (event && callback) {
+ event.subscribers = event.subscribers.filter(function (subscriber) {
+ return subscriber.callback !== callback;
+ });
+ } else {
+ event.subscribers = [];
+ }
+ } else {
+ clearEvents();
+ }
+ }
+ };
+ })();
+
+ ;
+ module.exports = exports["default"];
+
+/***/ },
+/* 73 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+ var merge = __webpack_require__(37);
+
+ var streamRef, loadedDataHandler;
+
+ /**
+ * Wraps browser-specific getUserMedia
+ * @param {Object} constraints
+ * @param {Object} success Callback
+ * @param {Object} failure Callback
+ */
+ function getUserMedia(constraints, success, failure) {
+ if (typeof navigator.getUserMedia !== 'undefined') {
+ navigator.getUserMedia(constraints, function (stream) {
+ streamRef = stream;
+ var videoSrc = window.URL && window.URL.createObjectURL(stream) || stream;
+ success.apply(null, [videoSrc]);
+ }, failure);
+ } else {
+ failure(new TypeError("getUserMedia not available"));
+ }
+ }
+
+ function loadedData(video, callback) {
+ var attempts = 10;
+
+ function checkVideo() {
+ if (attempts > 0) {
+ if (video.videoWidth > 0 && video.videoHeight > 0) {
+ console.log(video.videoWidth + "px x " + video.videoHeight + "px");
+ callback();
+ } else {
+ window.setTimeout(checkVideo, 500);
+ }
+ } else {
+ callback('Unable to play video stream. Is webcam working?');
+ }
+ attempts--;
+ }
+ checkVideo();
+ }
+
+ /**
+ * Tries to attach the camera-stream to a given video-element
+ * and calls the callback function when the content is ready
+ * @param {Object} constraints
+ * @param {Object} video
+ * @param {Object} callback
+ */
+ function initCamera(constraints, video, callback) {
+ getUserMedia(constraints, function (src) {
+ video.src = src;
+ if (loadedDataHandler) {
+ video.removeEventListener("loadeddata", loadedDataHandler, false);
+ }
+ loadedDataHandler = loadedData.bind(null, video, callback);
+ video.addEventListener('loadeddata', loadedDataHandler, false);
+ video.play();
+ }, function (e) {
+ callback(e);
+ });
+ }
+
+ /**
+ * Normalizes the incoming constraints to satisfy the current browser
+ * @param config
+ * @param cb Callback which is called whenever constraints are created
+ * @returns {*}
+ */
+ function normalizeConstraints(config, cb) {
+ var constraints = {
+ audio: false,
+ video: true
+ },
+ videoConstraints = merge({
+ width: 640,
+ height: 480,
+ minAspectRatio: 0,
+ maxAspectRatio: 100,
+ facing: "environment"
+ }, config);
+
+ if (typeof MediaStreamTrack !== 'undefined' && typeof MediaStreamTrack.getSources !== 'undefined') {
+ MediaStreamTrack.getSources(function (sourceInfos) {
+ var videoSourceId;
+ for (var i = 0; i != sourceInfos.length; ++i) {
+ var sourceInfo = sourceInfos[i];
+ if (sourceInfo.kind == "video" && sourceInfo.facing == videoConstraints.facing) {
+ videoSourceId = sourceInfo.id;
+ }
+ }
+ constraints.video = {
+ mandatory: {
+ minWidth: videoConstraints.width,
+ minHeight: videoConstraints.height,
+ minAspectRatio: videoConstraints.minAspectRatio,
+ maxAspectRatio: videoConstraints.maxAspectRatio
+ },
+ optional: [{
+ sourceId: videoSourceId
+ }]
+ };
+ return cb(constraints);
+ });
+ } else {
+ constraints.video = {
+ mediaSource: "camera",
+ width: { min: videoConstraints.width, max: videoConstraints.width },
+ height: { min: videoConstraints.height, max: videoConstraints.height },
+ require: ["width", "height"]
+ };
+ return cb(constraints);
+ }
+ }
+
+ /**
+ * Requests the back-facing camera of the user. The callback is called
+ * whenever the stream is ready to be consumed, or if an error occures.
+ * @param {Object} video
+ * @param {Object} callback
+ */
+ function _request(video, videoConstraints, callback) {
+ normalizeConstraints(videoConstraints, function (constraints) {
+ initCamera(constraints, video, callback);
+ });
+ }
+
+ exports['default'] = {
+ request: function request(video, constraints, callback) {
+ _request(video, constraints, callback);
+ },
+ release: function release() {
+ var tracks = streamRef && streamRef.getVideoTracks();
+ if (tracks.length) {
+ tracks[0].stop();
+ }
+ streamRef = null;
+ }
+ };
+ module.exports = exports['default'];
+
+/***/ },
+/* 74 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ Object.defineProperty(exports, '__esModule', {
+ value: true
+ });
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _image_debug = __webpack_require__(24);
+
+ var _image_debug2 = _interopRequireDefault(_image_debug);
+
+ function contains(codeResult, list) {
+ if (list) {
+ return list.some(function (item) {
+ return Object.keys(item).every(function (key) {
+ return item[key] === codeResult[key];
+ });
+ });
+ }
+ return false;
+ }
+
+ function passesFilter(codeResult, filter) {
+ if (typeof filter === 'function') {
+ return filter(codeResult);
+ }
+ return true;
+ }
+
+ exports['default'] = {
+ create: function create(config) {
+ var canvas = document.createElement("canvas"),
+ ctx = canvas.getContext("2d"),
+ results = [],
+ capacity = config.capacity || 20,
+ capture = config.capture === true;
+
+ function matchesConstraints(codeResult) {
+ return capacity && codeResult && !contains(codeResult, config.blacklist) && passesFilter(codeResult, config.filter);
+ }
+
+ return {
+ addResult: function addResult(data, imageSize, codeResult) {
+ var result = {};
+
+ if (matchesConstraints(codeResult)) {
+ capacity--;
+ result.codeResult = codeResult;
+ if (capture) {
+ canvas.width = imageSize.x;
+ canvas.height = imageSize.y;
+ _image_debug2['default'].drawImage(data, imageSize, ctx);
+ result.frame = canvas.toDataURL();
+ }
+ results.push(result);
+ }
+ },
+ getResults: function getResults() {
+ return results;
+ }
+ };
+ }
+ };
+ module.exports = exports['default'];
+
+/***/ }
+/******/ ])
});
-
-/* jshint undef: true, unused: true, browser:true, devel: true */
-/* global define */
-
-define('input_stream',["image_loader"], function(ImageLoader) {
- "use strict";
-
- var InputStream = {};
- InputStream.createVideoStream = function(video) {
- var that = {},
- _config = null,
- _eventNames = ['canrecord', 'ended'],
- _eventHandlers = {},
- _calculatedWidth,
- _calculatedHeight,
- _topRight = {x: 0, y: 0},
- _canvasSize = {x: 0, y: 0};
-
- function initSize() {
- var width = video.videoWidth,
- height = video.videoHeight;
-
- _calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;
- _calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;
-
- _canvasSize.x = _calculatedWidth;
- _canvasSize.y = _calculatedHeight;
- }
-
- that.getRealWidth = function() {
- return video.videoWidth;
- };
-
- that.getRealHeight = function() {
- return video.videoHeight;
- };
-
- that.getWidth = function() {
- return _calculatedWidth;
- };
-
- that.getHeight = function() {
- return _calculatedHeight;
- };
-
- that.setWidth = function(width) {
- _calculatedWidth = width;
- };
-
- that.setHeight = function(height) {
- _calculatedHeight = height;
- };
-
- that.setInputStream = function(config) {
- _config = config;
- video.src = (typeof config.src !== 'undefined') ? config.src : '';
- };
-
- that.ended = function() {
- return video.ended;
- };
-
- that.getConfig = function() {
- return _config;
- };
-
- that.setAttribute = function(name, value) {
- video.setAttribute(name, value);
- };
-
- that.pause = function() {
- video.pause();
- };
-
- that.play = function() {
- video.play();
- };
-
- that.setCurrentTime = function(time) {
- if (_config.type !== "LiveStream")
- video.currentTime = time;
- };
-
- that.addEventListener = function(event, f, bool) {
- if (_eventNames.indexOf(event) !== -1) {
- if (!_eventHandlers[event]) {
- _eventHandlers[event] = [];
- }
- _eventHandlers[event].push(f);
- } else {
- video.addEventListener(event, f, bool);
- }
- };
-
- that.clearEventHandlers = function() {
- _eventNames.forEach(function(eventName) {
- var handlers = _eventHandlers[eventName];
- if (handlers && handlers.length > 0) {
- handlers.forEach(function(handler) {
- video.removeEventListener(eventName, handler);
- });
- }
- });
- };
-
- that.trigger = function(eventName, args) {
- var j,
- handlers = _eventHandlers[eventName];
-
- if (eventName === 'canrecord') {
- initSize();
- }
- if (handlers && handlers.length > 0) {
- for ( j = 0; j < handlers.length; j++) {
- handlers[j].apply(that, args);
- }
- }
- };
-
- that.setTopRight = function(topRight) {
- _topRight.x = topRight.x;
- _topRight.y = topRight.y;
- };
-
- that.getTopRight = function() {
- return _topRight;
- };
-
- that.setCanvasSize = function(size) {
- _canvasSize.x = size.x;
- _canvasSize.y = size.y;
- };
-
- that.getCanvasSize = function() {
- return _canvasSize;
- };
-
- that.getFrame = function() {
- return video;
- };
-
- return that;
- };
-
- InputStream.createLiveStream = function(video) {
- video.setAttribute("autoplay", true);
- var that = InputStream.createVideoStream(video);
-
- that.ended = function() {
- return false;
- };
-
- return that;
- };
-
- InputStream.createImageStream = function() {
- var that = {};
- var _config = null;
-
- var width = 0,
- height = 0,
- frameIdx = 0,
- paused = true,
- loaded = false,
- imgArray = null,
- size = 0,
- offset = 1,
- baseUrl = null,
- ended = false,
- calculatedWidth,
- calculatedHeight,
- _eventNames = ['canrecord', 'ended'],
- _eventHandlers = {},
- _topRight = {x: 0, y: 0},
- _canvasSize = {x: 0, y: 0};
-
- function loadImages() {
- loaded = false;
- ImageLoader.load(baseUrl, function(imgs) {
- imgArray = imgs;
- width = imgs[0].width;
- height = imgs[0].height;
- calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;
- calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;
- _canvasSize.x = calculatedWidth;
- _canvasSize.y = calculatedHeight;
- loaded = true;
- frameIdx = 0;
- setTimeout(function() {
- publishEvent("canrecord", []);
- }, 0);
- }, offset, size, _config.sequence);
- }
-
- function publishEvent(eventName, args) {
- var j,
- handlers = _eventHandlers[eventName];
-
- if (handlers && handlers.length > 0) {
- for ( j = 0; j < handlers.length; j++) {
- handlers[j].apply(that, args);
- }
- }
- }
-
-
- that.trigger = publishEvent;
-
- that.getWidth = function() {
- return calculatedWidth;
- };
-
- that.getHeight = function() {
- return calculatedHeight;
- };
-
- that.setWidth = function(width) {
- calculatedWidth = width;
- };
-
- that.setHeight = function(height) {
- calculatedHeight = height;
- };
-
- that.getRealWidth = function() {
- return width;
- };
-
- that.getRealHeight = function() {
- return height;
- };
-
- that.setInputStream = function(stream) {
- _config = stream;
- if (stream.sequence === false) {
- baseUrl = stream.src;
- size = 1;
- } else {
- baseUrl = stream.src;
- size = stream.length;
- }
- loadImages();
- };
-
- that.ended = function() {
- return ended;
- };
-
- that.setAttribute = function() {};
-
- that.getConfig = function() {
- return _config;
- };
-
- that.pause = function() {
- paused = true;
- };
-
- that.play = function() {
- paused = false;
- };
-
- that.setCurrentTime = function(time) {
- frameIdx = time;
- };
-
- that.addEventListener = function(event, f) {
- if (_eventNames.indexOf(event) !== -1) {
- if (!_eventHandlers[event]) {
- _eventHandlers[event] = [];
- }
- _eventHandlers[event].push(f);
- }
- };
-
- that.setTopRight = function(topRight) {
- _topRight.x = topRight.x;
- _topRight.y = topRight.y;
- };
-
- that.getTopRight = function() {
- return _topRight;
- };
-
- that.setCanvasSize = function(size) {
- _canvasSize.x = size.x;
- _canvasSize.y = size.y;
- };
-
- that.getCanvasSize = function() {
- return _canvasSize;
- };
-
- that.getFrame = function() {
- var frame;
-
- if (!loaded){
- return null;
- }
- if (!paused) {
- frame = imgArray[frameIdx];
- if (frameIdx < (size - 1)) {
- frameIdx++;
- } else {
- setTimeout(function() {
- ended = true;
- publishEvent("ended", []);
- }, 0);
- }
- }
- return frame;
- };
-
- return that;
- };
-
- return (InputStream);
-});
-
-/*
- * typedefs.js
- * Normalizes browser-specific prefixes
- */
-
-glMatrixArrayType = Float32Array;
-if (typeof window !== 'undefined') {
- window.requestAnimFrame = (function () {
- return window.requestAnimationFrame ||
- window.webkitRequestAnimationFrame ||
- window.mozRequestAnimationFrame ||
- window.oRequestAnimationFrame ||
- window.msRequestAnimationFrame ||
- function (/* function FrameRequestCallback */ callback, /* DOMElement Element */ element) {
- window.setTimeout(callback, 1000 / 60);
- };
- })();
-
- navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
- window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
-}
-Math.imul = Math.imul || function(a, b) {
- var ah = (a >>> 16) & 0xffff,
- al = a & 0xffff,
- bh = (b >>> 16) & 0xffff,
- bl = b & 0xffff;
- // the shift by 0 fixes the sign on the high part
- // the final |0 converts the unsigned value into a signed value
- return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
-};
-define("typedefs", (function (global) {
- return function () {
- var ret, fn;
- return ret || global.typedefs;
- };
-}(this)));
-
-/* jshint undef: true, unused: true, browser:true, devel: true */
-/* global define */
-
-define('subImage',["typedefs"], function() {
- "use strict";
-
- /**
- * Construct representing a part of another {ImageWrapper}. Shares data
- * between the parent and the child.
- * @param from {ImageRef} The position where to start the {SubImage} from. (top-left corner)
- * @param size {ImageRef} The size of the resulting image
- * @param I {ImageWrapper} The {ImageWrapper} to share from
- * @returns {SubImage} A shared part of the original image
- */
- function SubImage(from, size, I) {
- if (!I) {
- I = {
- data : null,
- size : size
- };
- }
- this.data = I.data;
- this.originalSize = I.size;
- this.I = I;
-
- this.from = from;
- this.size = size;
- }
-
- /**
- * Displays the {SubImage} in a given canvas
- * @param canvas {Canvas} The canvas element to write to
- * @param scale {Number} Scale which is applied to each pixel-value
- */
- SubImage.prototype.show = function(canvas, scale) {
- var ctx,
- frame,
- data,
- current,
- y,
- x,
- pixel;
-
- if (!scale) {
- scale = 1.0;
- }
- ctx = canvas.getContext('2d');
- canvas.width = this.size.x;
- canvas.height = this.size.y;
- frame = ctx.getImageData(0, 0, canvas.width, canvas.height);
- data = frame.data;
- current = 0;
- for (y = 0; y < this.size.y; y++) {
- for (x = 0; x < this.size.x; x++) {
- pixel = y * this.size.x + x;
- current = this.get(x, y) * scale;
- data[pixel * 4 + 0] = current;
- data[pixel * 4 + 1] = current;
- data[pixel * 4 + 2] = current;
- data[pixel * 4 + 3] = 255;
- }
- }
- frame.data = data;
- ctx.putImageData(frame, 0, 0);
- };
-
- /**
- * Retrieves a given pixel position from the {SubImage}
- * @param x {Number} The x-position
- * @param y {Number} The y-position
- * @returns {Number} The grayscale value at the pixel-position
- */
- SubImage.prototype.get = function(x, y) {
- return this.data[(this.from.y + y) * this.originalSize.x + this.from.x + x];
- };
-
- /**
- * Updates the underlying data from a given {ImageWrapper}
- * @param image {ImageWrapper} The updated image
- */
- SubImage.prototype.updateData = function(image) {
- this.originalSize = image.size;
- this.data = image.data;
- };
-
- /**
- * Updates the position of the shared area
- * @param from {x,y} The new location
- * @returns {SubImage} returns {this} for possible chaining
- */
- SubImage.prototype.updateFrom = function(from) {
- this.from = from;
- return this;
- };
-
- return (SubImage);
-});
-/**
- * @fileoverview gl-matrix - High performance matrix and vector operations
- * @author Brandon Jones
- * @author Colin MacKenzie IV
- * @version 2.3.0
- */
-
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-!function(t,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define('gl-matrix',n);else{var r=n();for(var a in r)("object"==typeof exports?exports:t)[a]=r[a]}}(this,function(){return function(t){function n(a){if(r[a])return r[a].exports;var e=r[a]={exports:{},id:a,loaded:!1};return t[a].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){n.glMatrix=r(1),n.mat2=r(2),n.mat2d=r(3),n.mat3=r(4),n.mat4=r(5),n.quat=r(6),n.vec2=r(9),n.vec3=r(7),n.vec4=r(8)},function(t,n){var r={};r.EPSILON=1e-6,r.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,r.RANDOM=Math.random,r.setMatrixArrayType=function(t){GLMAT_ARRAY_TYPE=t};var a=Math.PI/180;r.toRadian=function(t){return t*a},t.exports=r},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.clone=function(t){var n=new a.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.transpose=function(t,n){if(t===n){var r=n[1];t[1]=n[2],t[2]=r}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*u-e*a;return o?(o=1/o,t[0]=u*o,t[1]=-a*o,t[2]=-e*o,t[3]=r*o,t):null},e.adjoint=function(t,n){var r=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=r,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],c=r[1],f=r[2],s=r[3];return t[0]=a*i+u*c,t[1]=e*i+o*c,t[2]=a*f+u*s,t[3]=e*f+o*s,t},e.mul=e.multiply,e.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),c=Math.cos(r);return t[0]=a*c+u*i,t[1]=e*c+o*i,t[2]=a*-i+u*c,t[3]=e*-i+o*c,t},e.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],c=r[1];return t[0]=a*i,t[1]=e*i,t[2]=u*c,t[3]=o*c,t},e.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t},e.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,n,r,a){return t[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-t[2]*r[1],[t,n,r]},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.clone=function(t){var n=new a.ARRAY_TYPE(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=r*u-a*e;return c?(c=1/c,t[0]=u*c,t[1]=-a*c,t[2]=-e*c,t[3]=r*c,t[4]=(e*i-u*o)*c,t[5]=(a*o-r*i)*c,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=r[0],s=r[1],h=r[2],M=r[3],l=r[4],v=r[5];return t[0]=a*f+u*s,t[1]=e*f+o*s,t[2]=a*h+u*M,t[3]=e*h+o*M,t[4]=a*l+u*v+i,t[5]=e*l+o*v+c,t},e.mul=e.multiply,e.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=Math.sin(r),s=Math.cos(r);return t[0]=a*s+u*f,t[1]=e*s+o*f,t[2]=a*-f+u*s,t[3]=e*-f+o*s,t[4]=i,t[5]=c,t},e.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=r[0],s=r[1];return t[0]=a*f,t[1]=e*f,t[2]=u*s,t[3]=o*s,t[4]=i,t[5]=c,t},e.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=r[0],s=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=a*f+u*s+i,t[5]=e*f+o*s+c,t},e.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t[4]=0,t[5]=0,t},e.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=n[0],t[5]=n[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat4=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},e.clone=function(t){var n=new a.ARRAY_TYPE(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[5];t[1]=n[3],t[2]=n[6],t[3]=r,t[5]=n[7],t[6]=a,t[7]=e}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=s*o-i*f,M=-s*u+i*c,l=f*u-o*c,v=r*h+a*M+e*l;return v?(v=1/v,t[0]=h*v,t[1]=(-s*a+e*f)*v,t[2]=(i*a-e*o)*v,t[3]=M*v,t[4]=(s*r-e*c)*v,t[5]=(-i*r+e*u)*v,t[6]=l*v,t[7]=(-f*r+a*c)*v,t[8]=(o*r-a*u)*v,t):null},e.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8];return t[0]=o*s-i*f,t[1]=e*f-a*s,t[2]=a*i-e*o,t[3]=i*c-u*s,t[4]=r*s-e*c,t[5]=e*u-r*i,t[6]=u*f-o*c,t[7]=a*c-r*f,t[8]=r*o-a*u,t},e.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],c=t[7],f=t[8];return n*(f*u-o*c)+r*(-f*e+o*i)+a*(c*e-u*i)},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=r[0],l=r[1],v=r[2],m=r[3],p=r[4],d=r[5],A=r[6],R=r[7],w=r[8];return t[0]=M*a+l*o+v*f,t[1]=M*e+l*i+v*s,t[2]=M*u+l*c+v*h,t[3]=m*a+p*o+d*f,t[4]=m*e+p*i+d*s,t[5]=m*u+p*c+d*h,t[6]=A*a+R*o+w*f,t[7]=A*e+R*i+w*s,t[8]=A*u+R*c+w*h,t},e.mul=e.multiply,e.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=r[0],l=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=i,t[5]=c,t[6]=M*a+l*o+f,t[7]=M*e+l*i+s,t[8]=M*u+l*c+h,t},e.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=Math.sin(r),l=Math.cos(r);return t[0]=l*a+M*o,t[1]=l*e+M*i,t[2]=l*u+M*c,t[3]=l*o-M*a,t[4]=l*i-M*e,t[5]=l*c-M*u,t[6]=f,t[7]=s,t[8]=h,t},e.scale=function(t,n,r){var a=r[0],e=r[1];return t[0]=a*n[0],t[1]=a*n[1],t[2]=a*n[2],t[3]=e*n[3],t[4]=e*n[4],t[5]=e*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},e.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=n[0],t[7]=n[1],t[8]=1,t},e.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=0,t[3]=-r,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},e.fromQuat=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,c=e+e,f=r*o,s=a*o,h=a*i,M=e*o,l=e*i,v=e*c,m=u*o,p=u*i,d=u*c;return t[0]=1-h-v,t[3]=s-d,t[6]=M+p,t[1]=s+d,t[4]=1-f-v,t[7]=l-m,t[2]=M-p,t[5]=l+m,t[8]=1-f-h,t},e.normalFromMat4=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=n[9],M=n[10],l=n[11],v=n[12],m=n[13],p=n[14],d=n[15],A=r*i-a*o,R=r*c-e*o,w=r*f-u*o,q=a*c-e*i,Y=a*f-u*i,g=e*f-u*c,y=s*m-h*v,x=s*p-M*v,P=s*d-l*v,E=h*p-M*m,T=h*d-l*m,b=M*d-l*p,D=A*b-R*T+w*E+q*P-Y*x+g*y;return D?(D=1/D,t[0]=(i*b-c*T+f*E)*D,t[1]=(c*P-o*b-f*x)*D,t[2]=(o*T-i*P+f*y)*D,t[3]=(e*T-a*b-u*E)*D,t[4]=(r*b-e*P+u*x)*D,t[5]=(a*P-r*T-u*y)*D,t[6]=(m*g-p*Y+d*q)*D,t[7]=(p*w-v*g-d*R)*D,t[8]=(v*Y-m*w+d*A)*D,t):null},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.clone=function(t){var n=new a.ARRAY_TYPE(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[3],u=n[6],o=n[7],i=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=r,t[6]=n[9],t[7]=n[13],t[8]=a,t[9]=u,t[11]=n[14],t[12]=e,t[13]=o,t[14]=i}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=n[9],M=n[10],l=n[11],v=n[12],m=n[13],p=n[14],d=n[15],A=r*i-a*o,R=r*c-e*o,w=r*f-u*o,q=a*c-e*i,Y=a*f-u*i,g=e*f-u*c,y=s*m-h*v,x=s*p-M*v,P=s*d-l*v,E=h*p-M*m,T=h*d-l*m,b=M*d-l*p,D=A*b-R*T+w*E+q*P-Y*x+g*y;return D?(D=1/D,t[0]=(i*b-c*T+f*E)*D,t[1]=(e*T-a*b-u*E)*D,t[2]=(m*g-p*Y+d*q)*D,t[3]=(M*Y-h*g-l*q)*D,t[4]=(c*P-o*b-f*x)*D,t[5]=(r*b-e*P+u*x)*D,t[6]=(p*w-v*g-d*R)*D,t[7]=(s*g-M*w+l*R)*D,t[8]=(o*T-i*P+f*y)*D,t[9]=(a*P-r*T-u*y)*D,t[10]=(v*Y-m*w+d*A)*D,t[11]=(h*w-s*Y-l*A)*D,t[12]=(i*x-o*E-c*y)*D,t[13]=(r*E-a*x+e*y)*D,t[14]=(m*R-v*q-p*A)*D,t[15]=(s*q-h*R+M*A)*D,t):null},e.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=n[9],M=n[10],l=n[11],v=n[12],m=n[13],p=n[14],d=n[15];return t[0]=i*(M*d-l*p)-h*(c*d-f*p)+m*(c*l-f*M),t[1]=-(a*(M*d-l*p)-h*(e*d-u*p)+m*(e*l-u*M)),t[2]=a*(c*d-f*p)-i*(e*d-u*p)+m*(e*f-u*c),t[3]=-(a*(c*l-f*M)-i*(e*l-u*M)+h*(e*f-u*c)),t[4]=-(o*(M*d-l*p)-s*(c*d-f*p)+v*(c*l-f*M)),t[5]=r*(M*d-l*p)-s*(e*d-u*p)+v*(e*l-u*M),t[6]=-(r*(c*d-f*p)-o*(e*d-u*p)+v*(e*f-u*c)),t[7]=r*(c*l-f*M)-o*(e*l-u*M)+s*(e*f-u*c),t[8]=o*(h*d-l*m)-s*(i*d-f*m)+v*(i*l-f*h),t[9]=-(r*(h*d-l*m)-s*(a*d-u*m)+v*(a*l-u*h)),t[10]=r*(i*d-f*m)-o*(a*d-u*m)+v*(a*f-u*i),t[11]=-(r*(i*l-f*h)-o*(a*l-u*h)+s*(a*f-u*i)),t[12]=-(o*(h*p-M*m)-s*(i*p-c*m)+v*(i*M-c*h)),t[13]=r*(h*p-M*m)-s*(a*p-e*m)+v*(a*M-e*h),t[14]=-(r*(i*p-c*m)-o*(a*p-e*m)+v*(a*c-e*i)),t[15]=r*(i*M-c*h)-o*(a*M-e*h)+s*(a*c-e*i),t},e.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],c=t[7],f=t[8],s=t[9],h=t[10],M=t[11],l=t[12],v=t[13],m=t[14],p=t[15],d=n*o-r*u,A=n*i-a*u,R=n*c-e*u,w=r*i-a*o,q=r*c-e*o,Y=a*c-e*i,g=f*v-s*l,y=f*m-h*l,x=f*p-M*l,P=s*m-h*v,E=s*p-M*v,T=h*p-M*m;return d*T-A*E+R*P+w*x-q*y+Y*g},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=n[9],l=n[10],v=n[11],m=n[12],p=n[13],d=n[14],A=n[15],R=r[0],w=r[1],q=r[2],Y=r[3];return t[0]=R*a+w*i+q*h+Y*m,t[1]=R*e+w*c+q*M+Y*p,t[2]=R*u+w*f+q*l+Y*d,t[3]=R*o+w*s+q*v+Y*A,R=r[4],w=r[5],q=r[6],Y=r[7],t[4]=R*a+w*i+q*h+Y*m,t[5]=R*e+w*c+q*M+Y*p,t[6]=R*u+w*f+q*l+Y*d,t[7]=R*o+w*s+q*v+Y*A,R=r[8],w=r[9],q=r[10],Y=r[11],t[8]=R*a+w*i+q*h+Y*m,t[9]=R*e+w*c+q*M+Y*p,t[10]=R*u+w*f+q*l+Y*d,t[11]=R*o+w*s+q*v+Y*A,R=r[12],w=r[13],q=r[14],Y=r[15],t[12]=R*a+w*i+q*h+Y*m,t[13]=R*e+w*c+q*M+Y*p,t[14]=R*u+w*f+q*l+Y*d,t[15]=R*o+w*s+q*v+Y*A,t},e.mul=e.multiply,e.translate=function(t,n,r){var a,e,u,o,i,c,f,s,h,M,l,v,m=r[0],p=r[1],d=r[2];return n===t?(t[12]=n[0]*m+n[4]*p+n[8]*d+n[12],t[13]=n[1]*m+n[5]*p+n[9]*d+n[13],t[14]=n[2]*m+n[6]*p+n[10]*d+n[14],t[15]=n[3]*m+n[7]*p+n[11]*d+n[15]):(a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=n[9],l=n[10],v=n[11],t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=i,t[5]=c,t[6]=f,t[7]=s,t[8]=h,t[9]=M,t[10]=l,t[11]=v,t[12]=a*m+i*p+h*d+n[12],t[13]=e*m+c*p+M*d+n[13],t[14]=u*m+f*p+l*d+n[14],t[15]=o*m+s*p+v*d+n[15]),t},e.scale=function(t,n,r){var a=r[0],e=r[1],u=r[2];return t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a,t[3]=n[3]*a,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*u,t[9]=n[9]*u,t[10]=n[10]*u,t[11]=n[11]*u,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},e.rotate=function(t,n,r,e){var u,o,i,c,f,s,h,M,l,v,m,p,d,A,R,w,q,Y,g,y,x,P,E,T,b=e[0],D=e[1],L=e[2],_=Math.sqrt(b*b+D*D+L*L);return Math.abs(_)\n\t * [a, c, tx,\n\t * b, d, ty]\n\t *
\n\t * This is a short form for the 3x3 matrix:\n\t * \n\t * [a, c, tx,\n\t * b, d, ty,\n\t * 0, 0, 1]\n\t *
\n\t * The last row is ignored so the array is shorter and operations are faster.\n\t */\n\tvar mat2d = {};\n\t\n\t/**\n\t * Creates a new identity mat2d\n\t *\n\t * @returns {mat2d} a new 2x3 matrix\n\t */\n\tmat2d.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(6);\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new mat2d initialized with values from an existing matrix\n\t *\n\t * @param {mat2d} a matrix to clone\n\t * @returns {mat2d} a new 2x3 matrix\n\t */\n\tmat2d.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(6);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one mat2d to another\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the source matrix\n\t * @returns {mat2d} out\n\t */\n\tmat2d.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set a mat2d to the identity matrix\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @returns {mat2d} out\n\t */\n\tmat2d.identity = function(out) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Inverts a mat2d\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the source matrix\n\t * @returns {mat2d} out\n\t */\n\tmat2d.invert = function(out, a) {\n\t var aa = a[0], ab = a[1], ac = a[2], ad = a[3],\n\t atx = a[4], aty = a[5];\n\t\n\t var det = aa * ad - ab * ac;\n\t if(!det){\n\t return null;\n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = ad * det;\n\t out[1] = -ab * det;\n\t out[2] = -ac * det;\n\t out[3] = aa * det;\n\t out[4] = (ac * aty - ad * atx) * det;\n\t out[5] = (ab * atx - aa * aty) * det;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the determinant of a mat2d\n\t *\n\t * @param {mat2d} a the source matrix\n\t * @returns {Number} determinant of a\n\t */\n\tmat2d.determinant = function (a) {\n\t return a[0] * a[3] - a[1] * a[2];\n\t};\n\t\n\t/**\n\t * Multiplies two mat2d's\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the first operand\n\t * @param {mat2d} b the second operand\n\t * @returns {mat2d} out\n\t */\n\tmat2d.multiply = function (out, a, b) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];\n\t out[0] = a0 * b0 + a2 * b1;\n\t out[1] = a1 * b0 + a3 * b1;\n\t out[2] = a0 * b2 + a2 * b3;\n\t out[3] = a1 * b2 + a3 * b3;\n\t out[4] = a0 * b4 + a2 * b5 + a4;\n\t out[5] = a1 * b4 + a3 * b5 + a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link mat2d.multiply}\n\t * @function\n\t */\n\tmat2d.mul = mat2d.multiply;\n\t\n\t/**\n\t * Rotates a mat2d by the given angle\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat2d} out\n\t */\n\tmat2d.rotate = function (out, a, rad) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t out[0] = a0 * c + a2 * s;\n\t out[1] = a1 * c + a3 * s;\n\t out[2] = a0 * -s + a2 * c;\n\t out[3] = a1 * -s + a3 * c;\n\t out[4] = a4;\n\t out[5] = a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales the mat2d by the dimensions in the given vec2\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the matrix to translate\n\t * @param {vec2} v the vec2 to scale the matrix by\n\t * @returns {mat2d} out\n\t **/\n\tmat2d.scale = function(out, a, v) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t v0 = v[0], v1 = v[1];\n\t out[0] = a0 * v0;\n\t out[1] = a1 * v0;\n\t out[2] = a2 * v1;\n\t out[3] = a3 * v1;\n\t out[4] = a4;\n\t out[5] = a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Translates the mat2d by the dimensions in the given vec2\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the matrix to translate\n\t * @param {vec2} v the vec2 to translate the matrix by\n\t * @returns {mat2d} out\n\t **/\n\tmat2d.translate = function(out, a, v) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t v0 = v[0], v1 = v[1];\n\t out[0] = a0;\n\t out[1] = a1;\n\t out[2] = a2;\n\t out[3] = a3;\n\t out[4] = a0 * v0 + a2 * v1 + a4;\n\t out[5] = a1 * v0 + a3 * v1 + a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a given angle\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat2d.identity(dest);\n\t * mat2d.rotate(dest, dest, rad);\n\t *\n\t * @param {mat2d} out mat2d receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat2d} out\n\t */\n\tmat2d.fromRotation = function(out, rad) {\n\t var s = Math.sin(rad), c = Math.cos(rad);\n\t out[0] = c;\n\t out[1] = s;\n\t out[2] = -s;\n\t out[3] = c;\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector scaling\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat2d.identity(dest);\n\t * mat2d.scale(dest, dest, vec);\n\t *\n\t * @param {mat2d} out mat2d receiving operation result\n\t * @param {vec2} v Scaling vector\n\t * @returns {mat2d} out\n\t */\n\tmat2d.fromScaling = function(out, v) {\n\t out[0] = v[0];\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = v[1];\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat2d.identity(dest);\n\t * mat2d.translate(dest, dest, vec);\n\t *\n\t * @param {mat2d} out mat2d receiving operation result\n\t * @param {vec2} v Translation vector\n\t * @returns {mat2d} out\n\t */\n\tmat2d.fromTranslation = function(out, v) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t out[4] = v[0];\n\t out[5] = v[1];\n\t return out;\n\t}\n\t\n\t/**\n\t * Returns a string representation of a mat2d\n\t *\n\t * @param {mat2d} a matrix to represent as a string\n\t * @returns {String} string representation of the matrix\n\t */\n\tmat2d.str = function (a) {\n\t return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n\t a[3] + ', ' + a[4] + ', ' + a[5] + ')';\n\t};\n\t\n\t/**\n\t * Returns Frobenius norm of a mat2d\n\t *\n\t * @param {mat2d} a the matrix to calculate Frobenius norm of\n\t * @returns {Number} Frobenius norm\n\t */\n\tmat2d.frob = function (a) { \n\t return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))\n\t}; \n\t\n\tmodule.exports = mat2d;\n\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 3x3 Matrix\n\t * @name mat3\n\t */\n\tvar mat3 = {};\n\t\n\t/**\n\t * Creates a new identity mat3\n\t *\n\t * @returns {mat3} a new 3x3 matrix\n\t */\n\tmat3.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(9);\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 1;\n\t out[5] = 0;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copies the upper-left 3x3 values into the given mat3.\n\t *\n\t * @param {mat3} out the receiving 3x3 matrix\n\t * @param {mat4} a the source 4x4 matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.fromMat4 = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[4];\n\t out[4] = a[5];\n\t out[5] = a[6];\n\t out[6] = a[8];\n\t out[7] = a[9];\n\t out[8] = a[10];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new mat3 initialized with values from an existing matrix\n\t *\n\t * @param {mat3} a matrix to clone\n\t * @returns {mat3} a new 3x3 matrix\n\t */\n\tmat3.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(9);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one mat3 to another\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set a mat3 to the identity matrix\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.identity = function(out) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 1;\n\t out[5] = 0;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transpose the values of a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.transpose = function(out, a) {\n\t // If we are transposing ourselves we can skip a few steps but have to cache some values\n\t if (out === a) {\n\t var a01 = a[1], a02 = a[2], a12 = a[5];\n\t out[1] = a[3];\n\t out[2] = a[6];\n\t out[3] = a01;\n\t out[5] = a[7];\n\t out[6] = a02;\n\t out[7] = a12;\n\t } else {\n\t out[0] = a[0];\n\t out[1] = a[3];\n\t out[2] = a[6];\n\t out[3] = a[1];\n\t out[4] = a[4];\n\t out[5] = a[7];\n\t out[6] = a[2];\n\t out[7] = a[5];\n\t out[8] = a[8];\n\t }\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Inverts a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.invert = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t\n\t b01 = a22 * a11 - a12 * a21,\n\t b11 = -a22 * a10 + a12 * a20,\n\t b21 = a21 * a10 - a11 * a20,\n\t\n\t // Calculate the determinant\n\t det = a00 * b01 + a01 * b11 + a02 * b21;\n\t\n\t if (!det) { \n\t return null; \n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = b01 * det;\n\t out[1] = (-a22 * a01 + a02 * a21) * det;\n\t out[2] = (a12 * a01 - a02 * a11) * det;\n\t out[3] = b11 * det;\n\t out[4] = (a22 * a00 - a02 * a20) * det;\n\t out[5] = (-a12 * a00 + a02 * a10) * det;\n\t out[6] = b21 * det;\n\t out[7] = (-a21 * a00 + a01 * a20) * det;\n\t out[8] = (a11 * a00 - a01 * a10) * det;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the adjugate of a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.adjoint = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8];\n\t\n\t out[0] = (a11 * a22 - a12 * a21);\n\t out[1] = (a02 * a21 - a01 * a22);\n\t out[2] = (a01 * a12 - a02 * a11);\n\t out[3] = (a12 * a20 - a10 * a22);\n\t out[4] = (a00 * a22 - a02 * a20);\n\t out[5] = (a02 * a10 - a00 * a12);\n\t out[6] = (a10 * a21 - a11 * a20);\n\t out[7] = (a01 * a20 - a00 * a21);\n\t out[8] = (a00 * a11 - a01 * a10);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the determinant of a mat3\n\t *\n\t * @param {mat3} a the source matrix\n\t * @returns {Number} determinant of a\n\t */\n\tmat3.determinant = function (a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8];\n\t\n\t return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n\t};\n\t\n\t/**\n\t * Multiplies two mat3's\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the first operand\n\t * @param {mat3} b the second operand\n\t * @returns {mat3} out\n\t */\n\tmat3.multiply = function (out, a, b) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t\n\t b00 = b[0], b01 = b[1], b02 = b[2],\n\t b10 = b[3], b11 = b[4], b12 = b[5],\n\t b20 = b[6], b21 = b[7], b22 = b[8];\n\t\n\t out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n\t out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n\t out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n\t\n\t out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n\t out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n\t out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n\t\n\t out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n\t out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n\t out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link mat3.multiply}\n\t * @function\n\t */\n\tmat3.mul = mat3.multiply;\n\t\n\t/**\n\t * Translate a mat3 by the given vector\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the matrix to translate\n\t * @param {vec2} v vector to translate by\n\t * @returns {mat3} out\n\t */\n\tmat3.translate = function(out, a, v) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t x = v[0], y = v[1];\n\t\n\t out[0] = a00;\n\t out[1] = a01;\n\t out[2] = a02;\n\t\n\t out[3] = a10;\n\t out[4] = a11;\n\t out[5] = a12;\n\t\n\t out[6] = x * a00 + y * a10 + a20;\n\t out[7] = x * a01 + y * a11 + a21;\n\t out[8] = x * a02 + y * a12 + a22;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a mat3 by the given angle\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat3} out\n\t */\n\tmat3.rotate = function (out, a, rad) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t\n\t s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t\n\t out[0] = c * a00 + s * a10;\n\t out[1] = c * a01 + s * a11;\n\t out[2] = c * a02 + s * a12;\n\t\n\t out[3] = c * a10 - s * a00;\n\t out[4] = c * a11 - s * a01;\n\t out[5] = c * a12 - s * a02;\n\t\n\t out[6] = a20;\n\t out[7] = a21;\n\t out[8] = a22;\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales the mat3 by the dimensions in the given vec2\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the matrix to rotate\n\t * @param {vec2} v the vec2 to scale the matrix by\n\t * @returns {mat3} out\n\t **/\n\tmat3.scale = function(out, a, v) {\n\t var x = v[0], y = v[1];\n\t\n\t out[0] = x * a[0];\n\t out[1] = x * a[1];\n\t out[2] = x * a[2];\n\t\n\t out[3] = y * a[3];\n\t out[4] = y * a[4];\n\t out[5] = y * a[5];\n\t\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat3.identity(dest);\n\t * mat3.translate(dest, dest, vec);\n\t *\n\t * @param {mat3} out mat3 receiving operation result\n\t * @param {vec2} v Translation vector\n\t * @returns {mat3} out\n\t */\n\tmat3.fromTranslation = function(out, v) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 1;\n\t out[5] = 0;\n\t out[6] = v[0];\n\t out[7] = v[1];\n\t out[8] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a given angle\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat3.identity(dest);\n\t * mat3.rotate(dest, dest, rad);\n\t *\n\t * @param {mat3} out mat3 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat3} out\n\t */\n\tmat3.fromRotation = function(out, rad) {\n\t var s = Math.sin(rad), c = Math.cos(rad);\n\t\n\t out[0] = c;\n\t out[1] = s;\n\t out[2] = 0;\n\t\n\t out[3] = -s;\n\t out[4] = c;\n\t out[5] = 0;\n\t\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector scaling\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat3.identity(dest);\n\t * mat3.scale(dest, dest, vec);\n\t *\n\t * @param {mat3} out mat3 receiving operation result\n\t * @param {vec2} v Scaling vector\n\t * @returns {mat3} out\n\t */\n\tmat3.fromScaling = function(out, v) {\n\t out[0] = v[0];\n\t out[1] = 0;\n\t out[2] = 0;\n\t\n\t out[3] = 0;\n\t out[4] = v[1];\n\t out[5] = 0;\n\t\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Copies the values from a mat2d into a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat2d} a the matrix to copy\n\t * @returns {mat3} out\n\t **/\n\tmat3.fromMat2d = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = 0;\n\t\n\t out[3] = a[2];\n\t out[4] = a[3];\n\t out[5] = 0;\n\t\n\t out[6] = a[4];\n\t out[7] = a[5];\n\t out[8] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t* Calculates a 3x3 matrix from the given quaternion\n\t*\n\t* @param {mat3} out mat3 receiving operation result\n\t* @param {quat} q Quaternion to create matrix from\n\t*\n\t* @returns {mat3} out\n\t*/\n\tmat3.fromQuat = function (out, q) {\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t yx = y * x2,\n\t yy = y * y2,\n\t zx = z * x2,\n\t zy = z * y2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2;\n\t\n\t out[0] = 1 - yy - zz;\n\t out[3] = yx - wz;\n\t out[6] = zx + wy;\n\t\n\t out[1] = yx + wz;\n\t out[4] = 1 - xx - zz;\n\t out[7] = zy - wx;\n\t\n\t out[2] = zx - wy;\n\t out[5] = zy + wx;\n\t out[8] = 1 - xx - yy;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n\t*\n\t* @param {mat3} out mat3 receiving operation result\n\t* @param {mat4} a Mat4 to derive the normal matrix from\n\t*\n\t* @returns {mat3} out\n\t*/\n\tmat3.normalFromMat4 = function (out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\n\t b00 = a00 * a11 - a01 * a10,\n\t b01 = a00 * a12 - a02 * a10,\n\t b02 = a00 * a13 - a03 * a10,\n\t b03 = a01 * a12 - a02 * a11,\n\t b04 = a01 * a13 - a03 * a11,\n\t b05 = a02 * a13 - a03 * a12,\n\t b06 = a20 * a31 - a21 * a30,\n\t b07 = a20 * a32 - a22 * a30,\n\t b08 = a20 * a33 - a23 * a30,\n\t b09 = a21 * a32 - a22 * a31,\n\t b10 = a21 * a33 - a23 * a31,\n\t b11 = a22 * a33 - a23 * a32,\n\t\n\t // Calculate the determinant\n\t det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\t\n\t if (!det) { \n\t return null; \n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n\t out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n\t out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\t\n\t out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n\t out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n\t out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\t\n\t out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n\t out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n\t out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns a string representation of a mat3\n\t *\n\t * @param {mat3} mat matrix to represent as a string\n\t * @returns {String} string representation of the matrix\n\t */\n\tmat3.str = function (a) {\n\t return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n\t a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + \n\t a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n\t};\n\t\n\t/**\n\t * Returns Frobenius norm of a mat3\n\t *\n\t * @param {mat3} a the matrix to calculate Frobenius norm of\n\t * @returns {Number} Frobenius norm\n\t */\n\tmat3.frob = function (a) {\n\t return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))\n\t};\n\t\n\t\n\tmodule.exports = mat3;\n\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 4x4 Matrix\n\t * @name mat4\n\t */\n\tvar mat4 = {};\n\t\n\t/**\n\t * Creates a new identity mat4\n\t *\n\t * @returns {mat4} a new 4x4 matrix\n\t */\n\tmat4.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(16);\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new mat4 initialized with values from an existing matrix\n\t *\n\t * @param {mat4} a matrix to clone\n\t * @returns {mat4} a new 4x4 matrix\n\t */\n\tmat4.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(16);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t out[9] = a[9];\n\t out[10] = a[10];\n\t out[11] = a[11];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one mat4 to another\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t out[9] = a[9];\n\t out[10] = a[10];\n\t out[11] = a[11];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set a mat4 to the identity matrix\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.identity = function(out) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transpose the values of a mat4\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.transpose = function(out, a) {\n\t // If we are transposing ourselves we can skip a few steps but have to cache some values\n\t if (out === a) {\n\t var a01 = a[1], a02 = a[2], a03 = a[3],\n\t a12 = a[6], a13 = a[7],\n\t a23 = a[11];\n\t\n\t out[1] = a[4];\n\t out[2] = a[8];\n\t out[3] = a[12];\n\t out[4] = a01;\n\t out[6] = a[9];\n\t out[7] = a[13];\n\t out[8] = a02;\n\t out[9] = a12;\n\t out[11] = a[14];\n\t out[12] = a03;\n\t out[13] = a13;\n\t out[14] = a23;\n\t } else {\n\t out[0] = a[0];\n\t out[1] = a[4];\n\t out[2] = a[8];\n\t out[3] = a[12];\n\t out[4] = a[1];\n\t out[5] = a[5];\n\t out[6] = a[9];\n\t out[7] = a[13];\n\t out[8] = a[2];\n\t out[9] = a[6];\n\t out[10] = a[10];\n\t out[11] = a[14];\n\t out[12] = a[3];\n\t out[13] = a[7];\n\t out[14] = a[11];\n\t out[15] = a[15];\n\t }\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Inverts a mat4\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.invert = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\n\t b00 = a00 * a11 - a01 * a10,\n\t b01 = a00 * a12 - a02 * a10,\n\t b02 = a00 * a13 - a03 * a10,\n\t b03 = a01 * a12 - a02 * a11,\n\t b04 = a01 * a13 - a03 * a11,\n\t b05 = a02 * a13 - a03 * a12,\n\t b06 = a20 * a31 - a21 * a30,\n\t b07 = a20 * a32 - a22 * a30,\n\t b08 = a20 * a33 - a23 * a30,\n\t b09 = a21 * a32 - a22 * a31,\n\t b10 = a21 * a33 - a23 * a31,\n\t b11 = a22 * a33 - a23 * a32,\n\t\n\t // Calculate the determinant\n\t det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\t\n\t if (!det) { \n\t return null; \n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n\t out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n\t out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n\t out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n\t out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n\t out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n\t out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n\t out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n\t out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\t out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\t out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\t out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n\t out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n\t out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n\t out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n\t out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the adjugate of a mat4\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.adjoint = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\t\n\t out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));\n\t out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n\t out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));\n\t out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n\t out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n\t out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));\n\t out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n\t out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));\n\t out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));\n\t out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n\t out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));\n\t out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n\t out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n\t out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));\n\t out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n\t out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the determinant of a mat4\n\t *\n\t * @param {mat4} a the source matrix\n\t * @returns {Number} determinant of a\n\t */\n\tmat4.determinant = function (a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\n\t b00 = a00 * a11 - a01 * a10,\n\t b01 = a00 * a12 - a02 * a10,\n\t b02 = a00 * a13 - a03 * a10,\n\t b03 = a01 * a12 - a02 * a11,\n\t b04 = a01 * a13 - a03 * a11,\n\t b05 = a02 * a13 - a03 * a12,\n\t b06 = a20 * a31 - a21 * a30,\n\t b07 = a20 * a32 - a22 * a30,\n\t b08 = a20 * a33 - a23 * a30,\n\t b09 = a21 * a32 - a22 * a31,\n\t b10 = a21 * a33 - a23 * a31,\n\t b11 = a22 * a33 - a23 * a32;\n\t\n\t // Calculate the determinant\n\t return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\t};\n\t\n\t/**\n\t * Multiplies two mat4's\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the first operand\n\t * @param {mat4} b the second operand\n\t * @returns {mat4} out\n\t */\n\tmat4.multiply = function (out, a, b) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\t\n\t // Cache only the current line of the second matrix\n\t var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; \n\t out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t\n\t b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n\t out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t\n\t b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n\t out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t\n\t b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n\t out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link mat4.multiply}\n\t * @function\n\t */\n\tmat4.mul = mat4.multiply;\n\t\n\t/**\n\t * Translate a mat4 by the given vector\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to translate\n\t * @param {vec3} v vector to translate by\n\t * @returns {mat4} out\n\t */\n\tmat4.translate = function (out, a, v) {\n\t var x = v[0], y = v[1], z = v[2],\n\t a00, a01, a02, a03,\n\t a10, a11, a12, a13,\n\t a20, a21, a22, a23;\n\t\n\t if (a === out) {\n\t out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n\t out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n\t out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n\t out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n\t } else {\n\t a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n\t a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n\t a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\t\n\t out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n\t out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n\t out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\t\n\t out[12] = a00 * x + a10 * y + a20 * z + a[12];\n\t out[13] = a01 * x + a11 * y + a21 * z + a[13];\n\t out[14] = a02 * x + a12 * y + a22 * z + a[14];\n\t out[15] = a03 * x + a13 * y + a23 * z + a[15];\n\t }\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales the mat4 by the dimensions in the given vec3\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to scale\n\t * @param {vec3} v the vec3 to scale the matrix by\n\t * @returns {mat4} out\n\t **/\n\tmat4.scale = function(out, a, v) {\n\t var x = v[0], y = v[1], z = v[2];\n\t\n\t out[0] = a[0] * x;\n\t out[1] = a[1] * x;\n\t out[2] = a[2] * x;\n\t out[3] = a[3] * x;\n\t out[4] = a[4] * y;\n\t out[5] = a[5] * y;\n\t out[6] = a[6] * y;\n\t out[7] = a[7] * y;\n\t out[8] = a[8] * z;\n\t out[9] = a[9] * z;\n\t out[10] = a[10] * z;\n\t out[11] = a[11] * z;\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a mat4 by the given angle around the given axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @param {vec3} axis the axis to rotate around\n\t * @returns {mat4} out\n\t */\n\tmat4.rotate = function (out, a, rad, axis) {\n\t var x = axis[0], y = axis[1], z = axis[2],\n\t len = Math.sqrt(x * x + y * y + z * z),\n\t s, c, t,\n\t a00, a01, a02, a03,\n\t a10, a11, a12, a13,\n\t a20, a21, a22, a23,\n\t b00, b01, b02,\n\t b10, b11, b12,\n\t b20, b21, b22;\n\t\n\t if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n\t \n\t len = 1 / len;\n\t x *= len;\n\t y *= len;\n\t z *= len;\n\t\n\t s = Math.sin(rad);\n\t c = Math.cos(rad);\n\t t = 1 - c;\n\t\n\t a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n\t a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n\t a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\t\n\t // Construct the elements of the rotation matrix\n\t b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;\n\t b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;\n\t b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;\n\t\n\t // Perform rotation-specific matrix multiplication\n\t out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n\t out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n\t out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n\t out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n\t out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n\t out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n\t out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n\t out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n\t out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n\t out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n\t out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\t out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged last row\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a matrix by the given angle around the X axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.rotateX = function (out, a, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad),\n\t a10 = a[4],\n\t a11 = a[5],\n\t a12 = a[6],\n\t a13 = a[7],\n\t a20 = a[8],\n\t a21 = a[9],\n\t a22 = a[10],\n\t a23 = a[11];\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged rows\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t\n\t // Perform axis-specific matrix multiplication\n\t out[4] = a10 * c + a20 * s;\n\t out[5] = a11 * c + a21 * s;\n\t out[6] = a12 * c + a22 * s;\n\t out[7] = a13 * c + a23 * s;\n\t out[8] = a20 * c - a10 * s;\n\t out[9] = a21 * c - a11 * s;\n\t out[10] = a22 * c - a12 * s;\n\t out[11] = a23 * c - a13 * s;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a matrix by the given angle around the Y axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.rotateY = function (out, a, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad),\n\t a00 = a[0],\n\t a01 = a[1],\n\t a02 = a[2],\n\t a03 = a[3],\n\t a20 = a[8],\n\t a21 = a[9],\n\t a22 = a[10],\n\t a23 = a[11];\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged rows\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t\n\t // Perform axis-specific matrix multiplication\n\t out[0] = a00 * c - a20 * s;\n\t out[1] = a01 * c - a21 * s;\n\t out[2] = a02 * c - a22 * s;\n\t out[3] = a03 * c - a23 * s;\n\t out[8] = a00 * s + a20 * c;\n\t out[9] = a01 * s + a21 * c;\n\t out[10] = a02 * s + a22 * c;\n\t out[11] = a03 * s + a23 * c;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a matrix by the given angle around the Z axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.rotateZ = function (out, a, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad),\n\t a00 = a[0],\n\t a01 = a[1],\n\t a02 = a[2],\n\t a03 = a[3],\n\t a10 = a[4],\n\t a11 = a[5],\n\t a12 = a[6],\n\t a13 = a[7];\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged last row\n\t out[8] = a[8];\n\t out[9] = a[9];\n\t out[10] = a[10];\n\t out[11] = a[11];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t\n\t // Perform axis-specific matrix multiplication\n\t out[0] = a00 * c + a10 * s;\n\t out[1] = a01 * c + a11 * s;\n\t out[2] = a02 * c + a12 * s;\n\t out[3] = a03 * c + a13 * s;\n\t out[4] = a10 * c - a00 * s;\n\t out[5] = a11 * c - a01 * s;\n\t out[6] = a12 * c - a02 * s;\n\t out[7] = a13 * c - a03 * s;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, dest, vec);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {vec3} v Translation vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromTranslation = function(out, v) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = v[0];\n\t out[13] = v[1];\n\t out[14] = v[2];\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector scaling\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.scale(dest, dest, vec);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {vec3} v Scaling vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromScaling = function(out, v) {\n\t out[0] = v[0];\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = v[1];\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = v[2];\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a given angle around a given axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotate(dest, dest, rad, axis);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @param {vec3} axis the axis to rotate around\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotation = function(out, rad, axis) {\n\t var x = axis[0], y = axis[1], z = axis[2],\n\t len = Math.sqrt(x * x + y * y + z * z),\n\t s, c, t;\n\t \n\t if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n\t \n\t len = 1 / len;\n\t x *= len;\n\t y *= len;\n\t z *= len;\n\t \n\t s = Math.sin(rad);\n\t c = Math.cos(rad);\n\t t = 1 - c;\n\t \n\t // Perform rotation-specific matrix multiplication\n\t out[0] = x * x * t + c;\n\t out[1] = y * x * t + z * s;\n\t out[2] = z * x * t - y * s;\n\t out[3] = 0;\n\t out[4] = x * y * t - z * s;\n\t out[5] = y * y * t + c;\n\t out[6] = z * y * t + x * s;\n\t out[7] = 0;\n\t out[8] = x * z * t + y * s;\n\t out[9] = y * z * t - x * s;\n\t out[10] = z * z * t + c;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from the given angle around the X axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotateX(dest, dest, rad);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.fromXRotation = function(out, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t \n\t // Perform axis-specific matrix multiplication\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = c;\n\t out[6] = s;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = -s;\n\t out[10] = c;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from the given angle around the Y axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotateY(dest, dest, rad);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.fromYRotation = function(out, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t \n\t // Perform axis-specific matrix multiplication\n\t out[0] = c;\n\t out[1] = 0;\n\t out[2] = -s;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = s;\n\t out[9] = 0;\n\t out[10] = c;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from the given angle around the Z axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotateZ(dest, dest, rad);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.fromZRotation = function(out, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t \n\t // Perform axis-specific matrix multiplication\n\t out[0] = c;\n\t out[1] = s;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = -s;\n\t out[5] = c;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a quaternion rotation and vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, vec);\n\t * var quatMat = mat4.create();\n\t * quat4.toMat4(quat, quatMat);\n\t * mat4.multiply(dest, quatMat);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {quat4} q Rotation quaternion\n\t * @param {vec3} v Translation vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotationTranslation = function (out, q, v) {\n\t // Quaternion math\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t xy = x * y2,\n\t xz = x * z2,\n\t yy = y * y2,\n\t yz = y * z2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2;\n\t\n\t out[0] = 1 - (yy + zz);\n\t out[1] = xy + wz;\n\t out[2] = xz - wy;\n\t out[3] = 0;\n\t out[4] = xy - wz;\n\t out[5] = 1 - (xx + zz);\n\t out[6] = yz + wx;\n\t out[7] = 0;\n\t out[8] = xz + wy;\n\t out[9] = yz - wx;\n\t out[10] = 1 - (xx + yy);\n\t out[11] = 0;\n\t out[12] = v[0];\n\t out[13] = v[1];\n\t out[14] = v[2];\n\t out[15] = 1;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a quaternion rotation, vector translation and vector scale\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, vec);\n\t * var quatMat = mat4.create();\n\t * quat4.toMat4(quat, quatMat);\n\t * mat4.multiply(dest, quatMat);\n\t * mat4.scale(dest, scale)\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {quat4} q Rotation quaternion\n\t * @param {vec3} v Translation vector\n\t * @param {vec3} s Scaling vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotationTranslationScale = function (out, q, v, s) {\n\t // Quaternion math\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t xy = x * y2,\n\t xz = x * z2,\n\t yy = y * y2,\n\t yz = y * z2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2,\n\t sx = s[0],\n\t sy = s[1],\n\t sz = s[2];\n\t\n\t out[0] = (1 - (yy + zz)) * sx;\n\t out[1] = (xy + wz) * sx;\n\t out[2] = (xz - wy) * sx;\n\t out[3] = 0;\n\t out[4] = (xy - wz) * sy;\n\t out[5] = (1 - (xx + zz)) * sy;\n\t out[6] = (yz + wx) * sy;\n\t out[7] = 0;\n\t out[8] = (xz + wy) * sz;\n\t out[9] = (yz - wx) * sz;\n\t out[10] = (1 - (xx + yy)) * sz;\n\t out[11] = 0;\n\t out[12] = v[0];\n\t out[13] = v[1];\n\t out[14] = v[2];\n\t out[15] = 1;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, vec);\n\t * mat4.translate(dest, origin);\n\t * var quatMat = mat4.create();\n\t * quat4.toMat4(quat, quatMat);\n\t * mat4.multiply(dest, quatMat);\n\t * mat4.scale(dest, scale)\n\t * mat4.translate(dest, negativeOrigin);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {quat4} q Rotation quaternion\n\t * @param {vec3} v Translation vector\n\t * @param {vec3} s Scaling vector\n\t * @param {vec3} o The origin vector around which to scale and rotate\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {\n\t // Quaternion math\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t xy = x * y2,\n\t xz = x * z2,\n\t yy = y * y2,\n\t yz = y * z2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2,\n\t \n\t sx = s[0],\n\t sy = s[1],\n\t sz = s[2],\n\t\n\t ox = o[0],\n\t oy = o[1],\n\t oz = o[2];\n\t \n\t out[0] = (1 - (yy + zz)) * sx;\n\t out[1] = (xy + wz) * sx;\n\t out[2] = (xz - wy) * sx;\n\t out[3] = 0;\n\t out[4] = (xy - wz) * sy;\n\t out[5] = (1 - (xx + zz)) * sy;\n\t out[6] = (yz + wx) * sy;\n\t out[7] = 0;\n\t out[8] = (xz + wy) * sz;\n\t out[9] = (yz - wx) * sz;\n\t out[10] = (1 - (xx + yy)) * sz;\n\t out[11] = 0;\n\t out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);\n\t out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);\n\t out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);\n\t out[15] = 1;\n\t \n\t return out;\n\t};\n\t\n\tmat4.fromQuat = function (out, q) {\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t yx = y * x2,\n\t yy = y * y2,\n\t zx = z * x2,\n\t zy = z * y2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2;\n\t\n\t out[0] = 1 - yy - zz;\n\t out[1] = yx + wz;\n\t out[2] = zx - wy;\n\t out[3] = 0;\n\t\n\t out[4] = yx - wz;\n\t out[5] = 1 - xx - zz;\n\t out[6] = zy + wx;\n\t out[7] = 0;\n\t\n\t out[8] = zx + wy;\n\t out[9] = zy - wx;\n\t out[10] = 1 - xx - yy;\n\t out[11] = 0;\n\t\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a frustum matrix with the given bounds\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {Number} left Left bound of the frustum\n\t * @param {Number} right Right bound of the frustum\n\t * @param {Number} bottom Bottom bound of the frustum\n\t * @param {Number} top Top bound of the frustum\n\t * @param {Number} near Near bound of the frustum\n\t * @param {Number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.frustum = function (out, left, right, bottom, top, near, far) {\n\t var rl = 1 / (right - left),\n\t tb = 1 / (top - bottom),\n\t nf = 1 / (near - far);\n\t out[0] = (near * 2) * rl;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = (near * 2) * tb;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = (right + left) * rl;\n\t out[9] = (top + bottom) * tb;\n\t out[10] = (far + near) * nf;\n\t out[11] = -1;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = (far * near * 2) * nf;\n\t out[15] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a perspective projection matrix with the given bounds\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {number} fovy Vertical field of view in radians\n\t * @param {number} aspect Aspect ratio. typically viewport width/height\n\t * @param {number} near Near bound of the frustum\n\t * @param {number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.perspective = function (out, fovy, aspect, near, far) {\n\t var f = 1.0 / Math.tan(fovy / 2),\n\t nf = 1 / (near - far);\n\t out[0] = f / aspect;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = f;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = (far + near) * nf;\n\t out[11] = -1;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = (2 * far * near) * nf;\n\t out[15] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a perspective projection matrix with the given field of view.\n\t * This is primarily useful for generating projection matrices to be used\n\t * with the still experiemental WebVR API.\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n\t * @param {number} near Near bound of the frustum\n\t * @param {number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.perspectiveFromFieldOfView = function (out, fov, near, far) {\n\t var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),\n\t downTan = Math.tan(fov.downDegrees * Math.PI/180.0),\n\t leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),\n\t rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),\n\t xScale = 2.0 / (leftTan + rightTan),\n\t yScale = 2.0 / (upTan + downTan);\n\t\n\t out[0] = xScale;\n\t out[1] = 0.0;\n\t out[2] = 0.0;\n\t out[3] = 0.0;\n\t out[4] = 0.0;\n\t out[5] = yScale;\n\t out[6] = 0.0;\n\t out[7] = 0.0;\n\t out[8] = -((leftTan - rightTan) * xScale * 0.5);\n\t out[9] = ((upTan - downTan) * yScale * 0.5);\n\t out[10] = far / (near - far);\n\t out[11] = -1.0;\n\t out[12] = 0.0;\n\t out[13] = 0.0;\n\t out[14] = (far * near) / (near - far);\n\t out[15] = 0.0;\n\t return out;\n\t}\n\t\n\t/**\n\t * Generates a orthogonal projection matrix with the given bounds\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {number} left Left bound of the frustum\n\t * @param {number} right Right bound of the frustum\n\t * @param {number} bottom Bottom bound of the frustum\n\t * @param {number} top Top bound of the frustum\n\t * @param {number} near Near bound of the frustum\n\t * @param {number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.ortho = function (out, left, right, bottom, top, near, far) {\n\t var lr = 1 / (left - right),\n\t bt = 1 / (bottom - top),\n\t nf = 1 / (near - far);\n\t out[0] = -2 * lr;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = -2 * bt;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 2 * nf;\n\t out[11] = 0;\n\t out[12] = (left + right) * lr;\n\t out[13] = (top + bottom) * bt;\n\t out[14] = (far + near) * nf;\n\t out[15] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a look-at matrix with the given eye position, focal point, and up axis\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {vec3} eye Position of the viewer\n\t * @param {vec3} center Point the viewer is looking at\n\t * @param {vec3} up vec3 pointing up\n\t * @returns {mat4} out\n\t */\n\tmat4.lookAt = function (out, eye, center, up) {\n\t var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,\n\t eyex = eye[0],\n\t eyey = eye[1],\n\t eyez = eye[2],\n\t upx = up[0],\n\t upy = up[1],\n\t upz = up[2],\n\t centerx = center[0],\n\t centery = center[1],\n\t centerz = center[2];\n\t\n\t if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&\n\t Math.abs(eyey - centery) < glMatrix.EPSILON &&\n\t Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n\t return mat4.identity(out);\n\t }\n\t\n\t z0 = eyex - centerx;\n\t z1 = eyey - centery;\n\t z2 = eyez - centerz;\n\t\n\t len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n\t z0 *= len;\n\t z1 *= len;\n\t z2 *= len;\n\t\n\t x0 = upy * z2 - upz * z1;\n\t x1 = upz * z0 - upx * z2;\n\t x2 = upx * z1 - upy * z0;\n\t len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n\t if (!len) {\n\t x0 = 0;\n\t x1 = 0;\n\t x2 = 0;\n\t } else {\n\t len = 1 / len;\n\t x0 *= len;\n\t x1 *= len;\n\t x2 *= len;\n\t }\n\t\n\t y0 = z1 * x2 - z2 * x1;\n\t y1 = z2 * x0 - z0 * x2;\n\t y2 = z0 * x1 - z1 * x0;\n\t\n\t len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n\t if (!len) {\n\t y0 = 0;\n\t y1 = 0;\n\t y2 = 0;\n\t } else {\n\t len = 1 / len;\n\t y0 *= len;\n\t y1 *= len;\n\t y2 *= len;\n\t }\n\t\n\t out[0] = x0;\n\t out[1] = y0;\n\t out[2] = z0;\n\t out[3] = 0;\n\t out[4] = x1;\n\t out[5] = y1;\n\t out[6] = z1;\n\t out[7] = 0;\n\t out[8] = x2;\n\t out[9] = y2;\n\t out[10] = z2;\n\t out[11] = 0;\n\t out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n\t out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n\t out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n\t out[15] = 1;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns a string representation of a mat4\n\t *\n\t * @param {mat4} mat matrix to represent as a string\n\t * @returns {String} string representation of the matrix\n\t */\n\tmat4.str = function (a) {\n\t return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +\n\t a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +\n\t a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + \n\t a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n\t};\n\t\n\t/**\n\t * Returns Frobenius norm of a mat4\n\t *\n\t * @param {mat4} a the matrix to calculate Frobenius norm of\n\t * @returns {Number} Frobenius norm\n\t */\n\tmat4.frob = function (a) {\n\t return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))\n\t};\n\t\n\t\n\tmodule.exports = mat4;\n\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\tvar mat3 = __webpack_require__(13);\n\tvar vec3 = __webpack_require__(16);\n\tvar vec4 = __webpack_require__(17);\n\t\n\t/**\n\t * @class Quaternion\n\t * @name quat\n\t */\n\tvar quat = {};\n\t\n\t/**\n\t * Creates a new identity quat\n\t *\n\t * @returns {quat} a new quaternion\n\t */\n\tquat.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Sets a quaternion to represent the shortest rotation from one\n\t * vector to another.\n\t *\n\t * Both vectors are assumed to be unit length.\n\t *\n\t * @param {quat} out the receiving quaternion.\n\t * @param {vec3} a the initial vector\n\t * @param {vec3} b the destination vector\n\t * @returns {quat} out\n\t */\n\tquat.rotationTo = (function() {\n\t var tmpvec3 = vec3.create();\n\t var xUnitVec3 = vec3.fromValues(1,0,0);\n\t var yUnitVec3 = vec3.fromValues(0,1,0);\n\t\n\t return function(out, a, b) {\n\t var dot = vec3.dot(a, b);\n\t if (dot < -0.999999) {\n\t vec3.cross(tmpvec3, xUnitVec3, a);\n\t if (vec3.length(tmpvec3) < 0.000001)\n\t vec3.cross(tmpvec3, yUnitVec3, a);\n\t vec3.normalize(tmpvec3, tmpvec3);\n\t quat.setAxisAngle(out, tmpvec3, Math.PI);\n\t return out;\n\t } else if (dot > 0.999999) {\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t return out;\n\t } else {\n\t vec3.cross(tmpvec3, a, b);\n\t out[0] = tmpvec3[0];\n\t out[1] = tmpvec3[1];\n\t out[2] = tmpvec3[2];\n\t out[3] = 1 + dot;\n\t return quat.normalize(out, out);\n\t }\n\t };\n\t})();\n\t\n\t/**\n\t * Sets the specified quaternion with values corresponding to the given\n\t * axes. Each axis is a vec3 and is expected to be unit length and\n\t * perpendicular to all other specified axes.\n\t *\n\t * @param {vec3} view the vector representing the viewing direction\n\t * @param {vec3} right the vector representing the local \"right\" direction\n\t * @param {vec3} up the vector representing the local \"up\" direction\n\t * @returns {quat} out\n\t */\n\tquat.setAxes = (function() {\n\t var matr = mat3.create();\n\t\n\t return function(out, view, right, up) {\n\t matr[0] = right[0];\n\t matr[3] = right[1];\n\t matr[6] = right[2];\n\t\n\t matr[1] = up[0];\n\t matr[4] = up[1];\n\t matr[7] = up[2];\n\t\n\t matr[2] = -view[0];\n\t matr[5] = -view[1];\n\t matr[8] = -view[2];\n\t\n\t return quat.normalize(out, quat.fromMat3(out, matr));\n\t };\n\t})();\n\t\n\t/**\n\t * Creates a new quat initialized with values from an existing quaternion\n\t *\n\t * @param {quat} a quaternion to clone\n\t * @returns {quat} a new quaternion\n\t * @function\n\t */\n\tquat.clone = vec4.clone;\n\t\n\t/**\n\t * Creates a new quat initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {quat} a new quaternion\n\t * @function\n\t */\n\tquat.fromValues = vec4.fromValues;\n\t\n\t/**\n\t * Copy the values from one quat to another\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the source quaternion\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.copy = vec4.copy;\n\t\n\t/**\n\t * Set the components of a quat to the given values\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.set = vec4.set;\n\t\n\t/**\n\t * Set a quat to the identity quaternion\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @returns {quat} out\n\t */\n\tquat.identity = function(out) {\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Sets a quat from the given angle and rotation axis,\n\t * then returns it.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {vec3} axis the axis around which to rotate\n\t * @param {Number} rad the angle in radians\n\t * @returns {quat} out\n\t **/\n\tquat.setAxisAngle = function(out, axis, rad) {\n\t rad = rad * 0.5;\n\t var s = Math.sin(rad);\n\t out[0] = s * axis[0];\n\t out[1] = s * axis[1];\n\t out[2] = s * axis[2];\n\t out[3] = Math.cos(rad);\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two quat's\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.add = vec4.add;\n\t\n\t/**\n\t * Multiplies two quat's\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @returns {quat} out\n\t */\n\tquat.multiply = function(out, a, b) {\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\t\n\t out[0] = ax * bw + aw * bx + ay * bz - az * by;\n\t out[1] = ay * bw + aw * by + az * bx - ax * bz;\n\t out[2] = az * bw + aw * bz + ax * by - ay * bx;\n\t out[3] = aw * bw - ax * bx - ay * by - az * bz;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link quat.multiply}\n\t * @function\n\t */\n\tquat.mul = quat.multiply;\n\t\n\t/**\n\t * Scales a quat by a scalar number\n\t *\n\t * @param {quat} out the receiving vector\n\t * @param {quat} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.scale = vec4.scale;\n\t\n\t/**\n\t * Rotates a quaternion by the given angle about the X axis\n\t *\n\t * @param {quat} out quat receiving operation result\n\t * @param {quat} a quat to rotate\n\t * @param {number} rad angle (in radians) to rotate\n\t * @returns {quat} out\n\t */\n\tquat.rotateX = function (out, a, rad) {\n\t rad *= 0.5; \n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bx = Math.sin(rad), bw = Math.cos(rad);\n\t\n\t out[0] = ax * bw + aw * bx;\n\t out[1] = ay * bw + az * bx;\n\t out[2] = az * bw - ay * bx;\n\t out[3] = aw * bw - ax * bx;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a quaternion by the given angle about the Y axis\n\t *\n\t * @param {quat} out quat receiving operation result\n\t * @param {quat} a quat to rotate\n\t * @param {number} rad angle (in radians) to rotate\n\t * @returns {quat} out\n\t */\n\tquat.rotateY = function (out, a, rad) {\n\t rad *= 0.5; \n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t by = Math.sin(rad), bw = Math.cos(rad);\n\t\n\t out[0] = ax * bw - az * by;\n\t out[1] = ay * bw + aw * by;\n\t out[2] = az * bw + ax * by;\n\t out[3] = aw * bw - ay * by;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a quaternion by the given angle about the Z axis\n\t *\n\t * @param {quat} out quat receiving operation result\n\t * @param {quat} a quat to rotate\n\t * @param {number} rad angle (in radians) to rotate\n\t * @returns {quat} out\n\t */\n\tquat.rotateZ = function (out, a, rad) {\n\t rad *= 0.5; \n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bz = Math.sin(rad), bw = Math.cos(rad);\n\t\n\t out[0] = ax * bw + ay * bz;\n\t out[1] = ay * bw - ax * bz;\n\t out[2] = az * bw + aw * bz;\n\t out[3] = aw * bw - az * bz;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the W component of a quat from the X, Y, and Z components.\n\t * Assumes that quaternion is 1 unit in length.\n\t * Any existing W component will be ignored.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quat to calculate W component of\n\t * @returns {quat} out\n\t */\n\tquat.calculateW = function (out, a) {\n\t var x = a[0], y = a[1], z = a[2];\n\t\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two quat's\n\t *\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @returns {Number} dot product of a and b\n\t * @function\n\t */\n\tquat.dot = vec4.dot;\n\t\n\t/**\n\t * Performs a linear interpolation between two quat's\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.lerp = vec4.lerp;\n\t\n\t/**\n\t * Performs a spherical linear interpolation between two quat\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {quat} out\n\t */\n\tquat.slerp = function (out, a, b, t) {\n\t // benchmarks:\n\t // http://jsperf.com/quaternion-slerp-implementations\n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\t\n\t var omega, cosom, sinom, scale0, scale1;\n\t\n\t // calc cosine\n\t cosom = ax * bx + ay * by + az * bz + aw * bw;\n\t // adjust signs (if necessary)\n\t if ( cosom < 0.0 ) {\n\t cosom = -cosom;\n\t bx = - bx;\n\t by = - by;\n\t bz = - bz;\n\t bw = - bw;\n\t }\n\t // calculate coefficients\n\t if ( (1.0 - cosom) > 0.000001 ) {\n\t // standard case (slerp)\n\t omega = Math.acos(cosom);\n\t sinom = Math.sin(omega);\n\t scale0 = Math.sin((1.0 - t) * omega) / sinom;\n\t scale1 = Math.sin(t * omega) / sinom;\n\t } else { \n\t // \"from\" and \"to\" quaternions are very close \n\t // ... so we can do a linear interpolation\n\t scale0 = 1.0 - t;\n\t scale1 = t;\n\t }\n\t // calculate final values\n\t out[0] = scale0 * ax + scale1 * bx;\n\t out[1] = scale0 * ay + scale1 * by;\n\t out[2] = scale0 * az + scale1 * bz;\n\t out[3] = scale0 * aw + scale1 * bw;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a spherical linear interpolation with two control points\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @param {quat} c the third operand\n\t * @param {quat} d the fourth operand\n\t * @param {Number} t interpolation amount\n\t * @returns {quat} out\n\t */\n\tquat.sqlerp = (function () {\n\t var temp1 = quat.create();\n\t var temp2 = quat.create();\n\t \n\t return function (out, a, b, c, d, t) {\n\t quat.slerp(temp1, a, d, t);\n\t quat.slerp(temp2, b, c, t);\n\t quat.slerp(out, temp1, temp2, 2 * t * (1 - t));\n\t \n\t return out;\n\t };\n\t}());\n\t\n\t/**\n\t * Calculates the inverse of a quat\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quat to calculate inverse of\n\t * @returns {quat} out\n\t */\n\tquat.invert = function(out, a) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n\t dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,\n\t invDot = dot ? 1.0/dot : 0;\n\t \n\t // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\t\n\t out[0] = -a0*invDot;\n\t out[1] = -a1*invDot;\n\t out[2] = -a2*invDot;\n\t out[3] = a3*invDot;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the conjugate of a quat\n\t * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quat to calculate conjugate of\n\t * @returns {quat} out\n\t */\n\tquat.conjugate = function (out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t out[2] = -a[2];\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the length of a quat\n\t *\n\t * @param {quat} a vector to calculate length of\n\t * @returns {Number} length of a\n\t * @function\n\t */\n\tquat.length = vec4.length;\n\t\n\t/**\n\t * Alias for {@link quat.length}\n\t * @function\n\t */\n\tquat.len = quat.length;\n\t\n\t/**\n\t * Calculates the squared length of a quat\n\t *\n\t * @param {quat} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t * @function\n\t */\n\tquat.squaredLength = vec4.squaredLength;\n\t\n\t/**\n\t * Alias for {@link quat.squaredLength}\n\t * @function\n\t */\n\tquat.sqrLen = quat.squaredLength;\n\t\n\t/**\n\t * Normalize a quat\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quaternion to normalize\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.normalize = vec4.normalize;\n\t\n\t/**\n\t * Creates a quaternion from the given 3x3 rotation matrix.\n\t *\n\t * NOTE: The resultant quaternion is not normalized, so you should be sure\n\t * to renormalize the quaternion yourself where necessary.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {mat3} m rotation matrix\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.fromMat3 = function(out, m) {\n\t // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n\t // article \"Quaternion Calculus and Fast Animation\".\n\t var fTrace = m[0] + m[4] + m[8];\n\t var fRoot;\n\t\n\t if ( fTrace > 0.0 ) {\n\t // |w| > 1/2, may as well choose w > 1/2\n\t fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\t out[3] = 0.5 * fRoot;\n\t fRoot = 0.5/fRoot; // 1/(4w)\n\t out[0] = (m[5]-m[7])*fRoot;\n\t out[1] = (m[6]-m[2])*fRoot;\n\t out[2] = (m[1]-m[3])*fRoot;\n\t } else {\n\t // |w| <= 1/2\n\t var i = 0;\n\t if ( m[4] > m[0] )\n\t i = 1;\n\t if ( m[8] > m[i*3+i] )\n\t i = 2;\n\t var j = (i+1)%3;\n\t var k = (i+2)%3;\n\t \n\t fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);\n\t out[i] = 0.5 * fRoot;\n\t fRoot = 0.5 / fRoot;\n\t out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;\n\t out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;\n\t out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;\n\t }\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Returns a string representation of a quatenion\n\t *\n\t * @param {quat} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tquat.str = function (a) {\n\t return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n\t};\n\t\n\tmodule.exports = quat;\n\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 3 Dimensional Vector\n\t * @name vec3\n\t */\n\tvar vec3 = {};\n\t\n\t/**\n\t * Creates a new, empty vec3\n\t *\n\t * @returns {vec3} a new 3D vector\n\t */\n\tvec3.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(3);\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec3 initialized with values from an existing vector\n\t *\n\t * @param {vec3} a vector to clone\n\t * @returns {vec3} a new 3D vector\n\t */\n\tvec3.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(3);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec3 initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @returns {vec3} a new 3D vector\n\t */\n\tvec3.fromValues = function(x, y, z) {\n\t var out = new glMatrix.ARRAY_TYPE(3);\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one vec3 to another\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the source vector\n\t * @returns {vec3} out\n\t */\n\tvec3.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set the components of a vec3 to the given values\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @returns {vec3} out\n\t */\n\tvec3.set = function(out, x, y, z) {\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.add = function(out, a, b) {\n\t out[0] = a[0] + b[0];\n\t out[1] = a[1] + b[1];\n\t out[2] = a[2] + b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Subtracts vector b from vector a\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.subtract = function(out, a, b) {\n\t out[0] = a[0] - b[0];\n\t out[1] = a[1] - b[1];\n\t out[2] = a[2] - b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.subtract}\n\t * @function\n\t */\n\tvec3.sub = vec3.subtract;\n\t\n\t/**\n\t * Multiplies two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.multiply = function(out, a, b) {\n\t out[0] = a[0] * b[0];\n\t out[1] = a[1] * b[1];\n\t out[2] = a[2] * b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.multiply}\n\t * @function\n\t */\n\tvec3.mul = vec3.multiply;\n\t\n\t/**\n\t * Divides two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.divide = function(out, a, b) {\n\t out[0] = a[0] / b[0];\n\t out[1] = a[1] / b[1];\n\t out[2] = a[2] / b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.divide}\n\t * @function\n\t */\n\tvec3.div = vec3.divide;\n\t\n\t/**\n\t * Returns the minimum of two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.min = function(out, a, b) {\n\t out[0] = Math.min(a[0], b[0]);\n\t out[1] = Math.min(a[1], b[1]);\n\t out[2] = Math.min(a[2], b[2]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the maximum of two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.max = function(out, a, b) {\n\t out[0] = Math.max(a[0], b[0]);\n\t out[1] = Math.max(a[1], b[1]);\n\t out[2] = Math.max(a[2], b[2]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales a vec3 by a scalar number\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {vec3} out\n\t */\n\tvec3.scale = function(out, a, b) {\n\t out[0] = a[0] * b;\n\t out[1] = a[1] * b;\n\t out[2] = a[2] * b;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec3's after scaling the second operand by a scalar value\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {Number} scale the amount to scale b by before adding\n\t * @returns {vec3} out\n\t */\n\tvec3.scaleAndAdd = function(out, a, b, scale) {\n\t out[0] = a[0] + (b[0] * scale);\n\t out[1] = a[1] + (b[1] * scale);\n\t out[2] = a[2] + (b[2] * scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the euclidian distance between two vec3's\n\t *\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {Number} distance between a and b\n\t */\n\tvec3.distance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2];\n\t return Math.sqrt(x*x + y*y + z*z);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.distance}\n\t * @function\n\t */\n\tvec3.dist = vec3.distance;\n\t\n\t/**\n\t * Calculates the squared euclidian distance between two vec3's\n\t *\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {Number} squared distance between a and b\n\t */\n\tvec3.squaredDistance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2];\n\t return x*x + y*y + z*z;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.squaredDistance}\n\t * @function\n\t */\n\tvec3.sqrDist = vec3.squaredDistance;\n\t\n\t/**\n\t * Calculates the length of a vec3\n\t *\n\t * @param {vec3} a vector to calculate length of\n\t * @returns {Number} length of a\n\t */\n\tvec3.length = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2];\n\t return Math.sqrt(x*x + y*y + z*z);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.length}\n\t * @function\n\t */\n\tvec3.len = vec3.length;\n\t\n\t/**\n\t * Calculates the squared length of a vec3\n\t *\n\t * @param {vec3} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t */\n\tvec3.squaredLength = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2];\n\t return x*x + y*y + z*z;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.squaredLength}\n\t * @function\n\t */\n\tvec3.sqrLen = vec3.squaredLength;\n\t\n\t/**\n\t * Negates the components of a vec3\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a vector to negate\n\t * @returns {vec3} out\n\t */\n\tvec3.negate = function(out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t out[2] = -a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the inverse of the components of a vec3\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a vector to invert\n\t * @returns {vec3} out\n\t */\n\tvec3.inverse = function(out, a) {\n\t out[0] = 1.0 / a[0];\n\t out[1] = 1.0 / a[1];\n\t out[2] = 1.0 / a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Normalize a vec3\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a vector to normalize\n\t * @returns {vec3} out\n\t */\n\tvec3.normalize = function(out, a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2];\n\t var len = x*x + y*y + z*z;\n\t if (len > 0) {\n\t //TODO: evaluate use of glm_invsqrt here?\n\t len = 1 / Math.sqrt(len);\n\t out[0] = a[0] * len;\n\t out[1] = a[1] * len;\n\t out[2] = a[2] * len;\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two vec3's\n\t *\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {Number} dot product of a and b\n\t */\n\tvec3.dot = function (a, b) {\n\t return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n\t};\n\t\n\t/**\n\t * Computes the cross product of two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.cross = function(out, a, b) {\n\t var ax = a[0], ay = a[1], az = a[2],\n\t bx = b[0], by = b[1], bz = b[2];\n\t\n\t out[0] = ay * bz - az * by;\n\t out[1] = az * bx - ax * bz;\n\t out[2] = ax * by - ay * bx;\n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a linear interpolation between two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec3} out\n\t */\n\tvec3.lerp = function (out, a, b, t) {\n\t var ax = a[0],\n\t ay = a[1],\n\t az = a[2];\n\t out[0] = ax + t * (b[0] - ax);\n\t out[1] = ay + t * (b[1] - ay);\n\t out[2] = az + t * (b[2] - az);\n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a hermite interpolation with two control points\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {vec3} c the third operand\n\t * @param {vec3} d the fourth operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec3} out\n\t */\n\tvec3.hermite = function (out, a, b, c, d, t) {\n\t var factorTimes2 = t * t,\n\t factor1 = factorTimes2 * (2 * t - 3) + 1,\n\t factor2 = factorTimes2 * (t - 2) + t,\n\t factor3 = factorTimes2 * (t - 1),\n\t factor4 = factorTimes2 * (3 - 2 * t);\n\t \n\t out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n\t out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n\t out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a bezier interpolation with two control points\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {vec3} c the third operand\n\t * @param {vec3} d the fourth operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec3} out\n\t */\n\tvec3.bezier = function (out, a, b, c, d, t) {\n\t var inverseFactor = 1 - t,\n\t inverseFactorTimesTwo = inverseFactor * inverseFactor,\n\t factorTimes2 = t * t,\n\t factor1 = inverseFactorTimesTwo * inverseFactor,\n\t factor2 = 3 * t * inverseFactorTimesTwo,\n\t factor3 = 3 * factorTimes2 * inverseFactor,\n\t factor4 = factorTimes2 * t;\n\t \n\t out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n\t out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n\t out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a random vector with the given scale\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n\t * @returns {vec3} out\n\t */\n\tvec3.random = function (out, scale) {\n\t scale = scale || 1.0;\n\t\n\t var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n\t var z = (glMatrix.RANDOM() * 2.0) - 1.0;\n\t var zScale = Math.sqrt(1.0-z*z) * scale;\n\t\n\t out[0] = Math.cos(r) * zScale;\n\t out[1] = Math.sin(r) * zScale;\n\t out[2] = z * scale;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec3 with a mat4.\n\t * 4th vector component is implicitly '1'\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to transform\n\t * @param {mat4} m matrix to transform with\n\t * @returns {vec3} out\n\t */\n\tvec3.transformMat4 = function(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2],\n\t w = m[3] * x + m[7] * y + m[11] * z + m[15];\n\t w = w || 1.0;\n\t out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n\t out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n\t out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec3 with a mat3.\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to transform\n\t * @param {mat4} m the 3x3 matrix to transform with\n\t * @returns {vec3} out\n\t */\n\tvec3.transformMat3 = function(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2];\n\t out[0] = x * m[0] + y * m[3] + z * m[6];\n\t out[1] = x * m[1] + y * m[4] + z * m[7];\n\t out[2] = x * m[2] + y * m[5] + z * m[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec3 with a quat\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to transform\n\t * @param {quat} q quaternion to transform with\n\t * @returns {vec3} out\n\t */\n\tvec3.transformQuat = function(out, a, q) {\n\t // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations\n\t\n\t var x = a[0], y = a[1], z = a[2],\n\t qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\t\n\t // calculate quat * vec\n\t ix = qw * x + qy * z - qz * y,\n\t iy = qw * y + qz * x - qx * z,\n\t iz = qw * z + qx * y - qy * x,\n\t iw = -qx * x - qy * y - qz * z;\n\t\n\t // calculate result * inverse quat\n\t out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n\t out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n\t out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotate a 3D vector around the x-axis\n\t * @param {vec3} out The receiving vec3\n\t * @param {vec3} a The vec3 point to rotate\n\t * @param {vec3} b The origin of the rotation\n\t * @param {Number} c The angle of rotation\n\t * @returns {vec3} out\n\t */\n\tvec3.rotateX = function(out, a, b, c){\n\t var p = [], r=[];\n\t\t //Translate point to the origin\n\t\t p[0] = a[0] - b[0];\n\t\t p[1] = a[1] - b[1];\n\t \tp[2] = a[2] - b[2];\n\t\n\t\t //perform rotation\n\t\t r[0] = p[0];\n\t\t r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);\n\t\t r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);\n\t\n\t\t //translate to correct position\n\t\t out[0] = r[0] + b[0];\n\t\t out[1] = r[1] + b[1];\n\t\t out[2] = r[2] + b[2];\n\t\n\t \treturn out;\n\t};\n\t\n\t/**\n\t * Rotate a 3D vector around the y-axis\n\t * @param {vec3} out The receiving vec3\n\t * @param {vec3} a The vec3 point to rotate\n\t * @param {vec3} b The origin of the rotation\n\t * @param {Number} c The angle of rotation\n\t * @returns {vec3} out\n\t */\n\tvec3.rotateY = function(out, a, b, c){\n\t \tvar p = [], r=[];\n\t \t//Translate point to the origin\n\t \tp[0] = a[0] - b[0];\n\t \tp[1] = a[1] - b[1];\n\t \tp[2] = a[2] - b[2];\n\t \n\t \t//perform rotation\n\t \tr[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);\n\t \tr[1] = p[1];\n\t \tr[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);\n\t \n\t \t//translate to correct position\n\t \tout[0] = r[0] + b[0];\n\t \tout[1] = r[1] + b[1];\n\t \tout[2] = r[2] + b[2];\n\t \n\t \treturn out;\n\t};\n\t\n\t/**\n\t * Rotate a 3D vector around the z-axis\n\t * @param {vec3} out The receiving vec3\n\t * @param {vec3} a The vec3 point to rotate\n\t * @param {vec3} b The origin of the rotation\n\t * @param {Number} c The angle of rotation\n\t * @returns {vec3} out\n\t */\n\tvec3.rotateZ = function(out, a, b, c){\n\t \tvar p = [], r=[];\n\t \t//Translate point to the origin\n\t \tp[0] = a[0] - b[0];\n\t \tp[1] = a[1] - b[1];\n\t \tp[2] = a[2] - b[2];\n\t \n\t \t//perform rotation\n\t \tr[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);\n\t \tr[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);\n\t \tr[2] = p[2];\n\t \n\t \t//translate to correct position\n\t \tout[0] = r[0] + b[0];\n\t \tout[1] = r[1] + b[1];\n\t \tout[2] = r[2] + b[2];\n\t \n\t \treturn out;\n\t};\n\t\n\t/**\n\t * Perform some operation over an array of vec3s.\n\t *\n\t * @param {Array} a the array of vectors to iterate over\n\t * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n\t * @param {Number} offset Number of elements to skip at the beginning of the array\n\t * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n\t * @param {Function} fn Function to call for each vector in the array\n\t * @param {Object} [arg] additional argument to pass to fn\n\t * @returns {Array} a\n\t * @function\n\t */\n\tvec3.forEach = (function() {\n\t var vec = vec3.create();\n\t\n\t return function(a, stride, offset, count, fn, arg) {\n\t var i, l;\n\t if(!stride) {\n\t stride = 3;\n\t }\n\t\n\t if(!offset) {\n\t offset = 0;\n\t }\n\t \n\t if(count) {\n\t l = Math.min((count * stride) + offset, a.length);\n\t } else {\n\t l = a.length;\n\t }\n\t\n\t for(i = offset; i < l; i += stride) {\n\t vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];\n\t fn(vec, vec, arg);\n\t a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];\n\t }\n\t \n\t return a;\n\t };\n\t})();\n\t\n\t/**\n\t * Get the angle between two 3D vectors\n\t * @param {vec3} a The first operand\n\t * @param {vec3} b The second operand\n\t * @returns {Number} The angle in radians\n\t */\n\tvec3.angle = function(a, b) {\n\t \n\t var tempA = vec3.fromValues(a[0], a[1], a[2]);\n\t var tempB = vec3.fromValues(b[0], b[1], b[2]);\n\t \n\t vec3.normalize(tempA, tempA);\n\t vec3.normalize(tempB, tempB);\n\t \n\t var cosine = vec3.dot(tempA, tempB);\n\t\n\t if(cosine > 1.0){\n\t return 0;\n\t } else {\n\t return Math.acos(cosine);\n\t } \n\t};\n\t\n\t/**\n\t * Returns a string representation of a vector\n\t *\n\t * @param {vec3} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tvec3.str = function (a) {\n\t return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n\t};\n\t\n\tmodule.exports = vec3;\n\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 4 Dimensional Vector\n\t * @name vec4\n\t */\n\tvar vec4 = {};\n\t\n\t/**\n\t * Creates a new, empty vec4\n\t *\n\t * @returns {vec4} a new 4D vector\n\t */\n\tvec4.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec4 initialized with values from an existing vector\n\t *\n\t * @param {vec4} a vector to clone\n\t * @returns {vec4} a new 4D vector\n\t */\n\tvec4.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec4 initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {vec4} a new 4D vector\n\t */\n\tvec4.fromValues = function(x, y, z, w) {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t out[3] = w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one vec4 to another\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the source vector\n\t * @returns {vec4} out\n\t */\n\tvec4.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set the components of a vec4 to the given values\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {vec4} out\n\t */\n\tvec4.set = function(out, x, y, z, w) {\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t out[3] = w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.add = function(out, a, b) {\n\t out[0] = a[0] + b[0];\n\t out[1] = a[1] + b[1];\n\t out[2] = a[2] + b[2];\n\t out[3] = a[3] + b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Subtracts vector b from vector a\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.subtract = function(out, a, b) {\n\t out[0] = a[0] - b[0];\n\t out[1] = a[1] - b[1];\n\t out[2] = a[2] - b[2];\n\t out[3] = a[3] - b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.subtract}\n\t * @function\n\t */\n\tvec4.sub = vec4.subtract;\n\t\n\t/**\n\t * Multiplies two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.multiply = function(out, a, b) {\n\t out[0] = a[0] * b[0];\n\t out[1] = a[1] * b[1];\n\t out[2] = a[2] * b[2];\n\t out[3] = a[3] * b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.multiply}\n\t * @function\n\t */\n\tvec4.mul = vec4.multiply;\n\t\n\t/**\n\t * Divides two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.divide = function(out, a, b) {\n\t out[0] = a[0] / b[0];\n\t out[1] = a[1] / b[1];\n\t out[2] = a[2] / b[2];\n\t out[3] = a[3] / b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.divide}\n\t * @function\n\t */\n\tvec4.div = vec4.divide;\n\t\n\t/**\n\t * Returns the minimum of two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.min = function(out, a, b) {\n\t out[0] = Math.min(a[0], b[0]);\n\t out[1] = Math.min(a[1], b[1]);\n\t out[2] = Math.min(a[2], b[2]);\n\t out[3] = Math.min(a[3], b[3]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the maximum of two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.max = function(out, a, b) {\n\t out[0] = Math.max(a[0], b[0]);\n\t out[1] = Math.max(a[1], b[1]);\n\t out[2] = Math.max(a[2], b[2]);\n\t out[3] = Math.max(a[3], b[3]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales a vec4 by a scalar number\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {vec4} out\n\t */\n\tvec4.scale = function(out, a, b) {\n\t out[0] = a[0] * b;\n\t out[1] = a[1] * b;\n\t out[2] = a[2] * b;\n\t out[3] = a[3] * b;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec4's after scaling the second operand by a scalar value\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @param {Number} scale the amount to scale b by before adding\n\t * @returns {vec4} out\n\t */\n\tvec4.scaleAndAdd = function(out, a, b, scale) {\n\t out[0] = a[0] + (b[0] * scale);\n\t out[1] = a[1] + (b[1] * scale);\n\t out[2] = a[2] + (b[2] * scale);\n\t out[3] = a[3] + (b[3] * scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the euclidian distance between two vec4's\n\t *\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {Number} distance between a and b\n\t */\n\tvec4.distance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2],\n\t w = b[3] - a[3];\n\t return Math.sqrt(x*x + y*y + z*z + w*w);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.distance}\n\t * @function\n\t */\n\tvec4.dist = vec4.distance;\n\t\n\t/**\n\t * Calculates the squared euclidian distance between two vec4's\n\t *\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {Number} squared distance between a and b\n\t */\n\tvec4.squaredDistance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2],\n\t w = b[3] - a[3];\n\t return x*x + y*y + z*z + w*w;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.squaredDistance}\n\t * @function\n\t */\n\tvec4.sqrDist = vec4.squaredDistance;\n\t\n\t/**\n\t * Calculates the length of a vec4\n\t *\n\t * @param {vec4} a vector to calculate length of\n\t * @returns {Number} length of a\n\t */\n\tvec4.length = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2],\n\t w = a[3];\n\t return Math.sqrt(x*x + y*y + z*z + w*w);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.length}\n\t * @function\n\t */\n\tvec4.len = vec4.length;\n\t\n\t/**\n\t * Calculates the squared length of a vec4\n\t *\n\t * @param {vec4} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t */\n\tvec4.squaredLength = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2],\n\t w = a[3];\n\t return x*x + y*y + z*z + w*w;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.squaredLength}\n\t * @function\n\t */\n\tvec4.sqrLen = vec4.squaredLength;\n\t\n\t/**\n\t * Negates the components of a vec4\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a vector to negate\n\t * @returns {vec4} out\n\t */\n\tvec4.negate = function(out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t out[2] = -a[2];\n\t out[3] = -a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the inverse of the components of a vec4\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a vector to invert\n\t * @returns {vec4} out\n\t */\n\tvec4.inverse = function(out, a) {\n\t out[0] = 1.0 / a[0];\n\t out[1] = 1.0 / a[1];\n\t out[2] = 1.0 / a[2];\n\t out[3] = 1.0 / a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Normalize a vec4\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a vector to normalize\n\t * @returns {vec4} out\n\t */\n\tvec4.normalize = function(out, a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2],\n\t w = a[3];\n\t var len = x*x + y*y + z*z + w*w;\n\t if (len > 0) {\n\t len = 1 / Math.sqrt(len);\n\t out[0] = x * len;\n\t out[1] = y * len;\n\t out[2] = z * len;\n\t out[3] = w * len;\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two vec4's\n\t *\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {Number} dot product of a and b\n\t */\n\tvec4.dot = function (a, b) {\n\t return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n\t};\n\t\n\t/**\n\t * Performs a linear interpolation between two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec4} out\n\t */\n\tvec4.lerp = function (out, a, b, t) {\n\t var ax = a[0],\n\t ay = a[1],\n\t az = a[2],\n\t aw = a[3];\n\t out[0] = ax + t * (b[0] - ax);\n\t out[1] = ay + t * (b[1] - ay);\n\t out[2] = az + t * (b[2] - az);\n\t out[3] = aw + t * (b[3] - aw);\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a random vector with the given scale\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n\t * @returns {vec4} out\n\t */\n\tvec4.random = function (out, scale) {\n\t scale = scale || 1.0;\n\t\n\t //TODO: This is a pretty awful way of doing this. Find something better.\n\t out[0] = glMatrix.RANDOM();\n\t out[1] = glMatrix.RANDOM();\n\t out[2] = glMatrix.RANDOM();\n\t out[3] = glMatrix.RANDOM();\n\t vec4.normalize(out, out);\n\t vec4.scale(out, out, scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec4 with a mat4.\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the vector to transform\n\t * @param {mat4} m matrix to transform with\n\t * @returns {vec4} out\n\t */\n\tvec4.transformMat4 = function(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2], w = a[3];\n\t out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n\t out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n\t out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n\t out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec4 with a quat\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the vector to transform\n\t * @param {quat} q quaternion to transform with\n\t * @returns {vec4} out\n\t */\n\tvec4.transformQuat = function(out, a, q) {\n\t var x = a[0], y = a[1], z = a[2],\n\t qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\t\n\t // calculate quat * vec\n\t ix = qw * x + qy * z - qz * y,\n\t iy = qw * y + qz * x - qx * z,\n\t iz = qw * z + qx * y - qy * x,\n\t iw = -qx * x - qy * y - qz * z;\n\t\n\t // calculate result * inverse quat\n\t out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n\t out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n\t out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Perform some operation over an array of vec4s.\n\t *\n\t * @param {Array} a the array of vectors to iterate over\n\t * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n\t * @param {Number} offset Number of elements to skip at the beginning of the array\n\t * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n\t * @param {Function} fn Function to call for each vector in the array\n\t * @param {Object} [arg] additional argument to pass to fn\n\t * @returns {Array} a\n\t * @function\n\t */\n\tvec4.forEach = (function() {\n\t var vec = vec4.create();\n\t\n\t return function(a, stride, offset, count, fn, arg) {\n\t var i, l;\n\t if(!stride) {\n\t stride = 4;\n\t }\n\t\n\t if(!offset) {\n\t offset = 0;\n\t }\n\t \n\t if(count) {\n\t l = Math.min((count * stride) + offset, a.length);\n\t } else {\n\t l = a.length;\n\t }\n\t\n\t for(i = offset; i < l; i += stride) {\n\t vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];\n\t fn(vec, vec, arg);\n\t a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];\n\t }\n\t \n\t return a;\n\t };\n\t})();\n\t\n\t/**\n\t * Returns a string representation of a vector\n\t *\n\t * @param {vec4} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tvec4.str = function (a) {\n\t return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n\t};\n\t\n\tmodule.exports = vec4;\n\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 2 Dimensional Vector\n\t * @name vec2\n\t */\n\tvar vec2 = {};\n\t\n\t/**\n\t * Creates a new, empty vec2\n\t *\n\t * @returns {vec2} a new 2D vector\n\t */\n\tvec2.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(2);\n\t out[0] = 0;\n\t out[1] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec2 initialized with values from an existing vector\n\t *\n\t * @param {vec2} a vector to clone\n\t * @returns {vec2} a new 2D vector\n\t */\n\tvec2.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(2);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec2 initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @returns {vec2} a new 2D vector\n\t */\n\tvec2.fromValues = function(x, y) {\n\t var out = new glMatrix.ARRAY_TYPE(2);\n\t out[0] = x;\n\t out[1] = y;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one vec2 to another\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the source vector\n\t * @returns {vec2} out\n\t */\n\tvec2.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set the components of a vec2 to the given values\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @returns {vec2} out\n\t */\n\tvec2.set = function(out, x, y) {\n\t out[0] = x;\n\t out[1] = y;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.add = function(out, a, b) {\n\t out[0] = a[0] + b[0];\n\t out[1] = a[1] + b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Subtracts vector b from vector a\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.subtract = function(out, a, b) {\n\t out[0] = a[0] - b[0];\n\t out[1] = a[1] - b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.subtract}\n\t * @function\n\t */\n\tvec2.sub = vec2.subtract;\n\t\n\t/**\n\t * Multiplies two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.multiply = function(out, a, b) {\n\t out[0] = a[0] * b[0];\n\t out[1] = a[1] * b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.multiply}\n\t * @function\n\t */\n\tvec2.mul = vec2.multiply;\n\t\n\t/**\n\t * Divides two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.divide = function(out, a, b) {\n\t out[0] = a[0] / b[0];\n\t out[1] = a[1] / b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.divide}\n\t * @function\n\t */\n\tvec2.div = vec2.divide;\n\t\n\t/**\n\t * Returns the minimum of two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.min = function(out, a, b) {\n\t out[0] = Math.min(a[0], b[0]);\n\t out[1] = Math.min(a[1], b[1]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the maximum of two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.max = function(out, a, b) {\n\t out[0] = Math.max(a[0], b[0]);\n\t out[1] = Math.max(a[1], b[1]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales a vec2 by a scalar number\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {vec2} out\n\t */\n\tvec2.scale = function(out, a, b) {\n\t out[0] = a[0] * b;\n\t out[1] = a[1] * b;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec2's after scaling the second operand by a scalar value\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @param {Number} scale the amount to scale b by before adding\n\t * @returns {vec2} out\n\t */\n\tvec2.scaleAndAdd = function(out, a, b, scale) {\n\t out[0] = a[0] + (b[0] * scale);\n\t out[1] = a[1] + (b[1] * scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the euclidian distance between two vec2's\n\t *\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {Number} distance between a and b\n\t */\n\tvec2.distance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1];\n\t return Math.sqrt(x*x + y*y);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.distance}\n\t * @function\n\t */\n\tvec2.dist = vec2.distance;\n\t\n\t/**\n\t * Calculates the squared euclidian distance between two vec2's\n\t *\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {Number} squared distance between a and b\n\t */\n\tvec2.squaredDistance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1];\n\t return x*x + y*y;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.squaredDistance}\n\t * @function\n\t */\n\tvec2.sqrDist = vec2.squaredDistance;\n\t\n\t/**\n\t * Calculates the length of a vec2\n\t *\n\t * @param {vec2} a vector to calculate length of\n\t * @returns {Number} length of a\n\t */\n\tvec2.length = function (a) {\n\t var x = a[0],\n\t y = a[1];\n\t return Math.sqrt(x*x + y*y);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.length}\n\t * @function\n\t */\n\tvec2.len = vec2.length;\n\t\n\t/**\n\t * Calculates the squared length of a vec2\n\t *\n\t * @param {vec2} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t */\n\tvec2.squaredLength = function (a) {\n\t var x = a[0],\n\t y = a[1];\n\t return x*x + y*y;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.squaredLength}\n\t * @function\n\t */\n\tvec2.sqrLen = vec2.squaredLength;\n\t\n\t/**\n\t * Negates the components of a vec2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a vector to negate\n\t * @returns {vec2} out\n\t */\n\tvec2.negate = function(out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the inverse of the components of a vec2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a vector to invert\n\t * @returns {vec2} out\n\t */\n\tvec2.inverse = function(out, a) {\n\t out[0] = 1.0 / a[0];\n\t out[1] = 1.0 / a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Normalize a vec2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a vector to normalize\n\t * @returns {vec2} out\n\t */\n\tvec2.normalize = function(out, a) {\n\t var x = a[0],\n\t y = a[1];\n\t var len = x*x + y*y;\n\t if (len > 0) {\n\t //TODO: evaluate use of glm_invsqrt here?\n\t len = 1 / Math.sqrt(len);\n\t out[0] = a[0] * len;\n\t out[1] = a[1] * len;\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two vec2's\n\t *\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {Number} dot product of a and b\n\t */\n\tvec2.dot = function (a, b) {\n\t return a[0] * b[0] + a[1] * b[1];\n\t};\n\t\n\t/**\n\t * Computes the cross product of two vec2's\n\t * Note that the cross product must by definition produce a 3D vector\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec2.cross = function(out, a, b) {\n\t var z = a[0] * b[1] - a[1] * b[0];\n\t out[0] = out[1] = 0;\n\t out[2] = z;\n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a linear interpolation between two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec2} out\n\t */\n\tvec2.lerp = function (out, a, b, t) {\n\t var ax = a[0],\n\t ay = a[1];\n\t out[0] = ax + t * (b[0] - ax);\n\t out[1] = ay + t * (b[1] - ay);\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a random vector with the given scale\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n\t * @returns {vec2} out\n\t */\n\tvec2.random = function (out, scale) {\n\t scale = scale || 1.0;\n\t var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n\t out[0] = Math.cos(r) * scale;\n\t out[1] = Math.sin(r) * scale;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat2} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat2 = function(out, a, m) {\n\t var x = a[0],\n\t y = a[1];\n\t out[0] = m[0] * x + m[2] * y;\n\t out[1] = m[1] * x + m[3] * y;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat2d\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat2d} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat2d = function(out, a, m) {\n\t var x = a[0],\n\t y = a[1];\n\t out[0] = m[0] * x + m[2] * y + m[4];\n\t out[1] = m[1] * x + m[3] * y + m[5];\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat3\n\t * 3rd vector component is implicitly '1'\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat3} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat3 = function(out, a, m) {\n\t var x = a[0],\n\t y = a[1];\n\t out[0] = m[0] * x + m[3] * y + m[6];\n\t out[1] = m[1] * x + m[4] * y + m[7];\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat4\n\t * 3rd vector component is implicitly '0'\n\t * 4th vector component is implicitly '1'\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat4} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat4 = function(out, a, m) {\n\t var x = a[0], \n\t y = a[1];\n\t out[0] = m[0] * x + m[4] * y + m[12];\n\t out[1] = m[1] * x + m[5] * y + m[13];\n\t return out;\n\t};\n\t\n\t/**\n\t * Perform some operation over an array of vec2s.\n\t *\n\t * @param {Array} a the array of vectors to iterate over\n\t * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n\t * @param {Number} offset Number of elements to skip at the beginning of the array\n\t * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n\t * @param {Function} fn Function to call for each vector in the array\n\t * @param {Object} [arg] additional argument to pass to fn\n\t * @returns {Array} a\n\t * @function\n\t */\n\tvec2.forEach = (function() {\n\t var vec = vec2.create();\n\t\n\t return function(a, stride, offset, count, fn, arg) {\n\t var i, l;\n\t if(!stride) {\n\t stride = 2;\n\t }\n\t\n\t if(!offset) {\n\t offset = 0;\n\t }\n\t \n\t if(count) {\n\t l = Math.min((count * stride) + offset, a.length);\n\t } else {\n\t l = a.length;\n\t }\n\t\n\t for(i = offset; i < l; i += stride) {\n\t vec[0] = a[i]; vec[1] = a[i+1];\n\t fn(vec, vec, arg);\n\t a[i] = vec[0]; a[i+1] = vec[1];\n\t }\n\t \n\t return a;\n\t };\n\t})();\n\t\n\t/**\n\t * Returns a string representation of a vector\n\t *\n\t * @param {vec2} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tvec2.str = function (a) {\n\t return 'vec2(' + a[0] + ', ' + a[1] + ')';\n\t};\n\t\n\tmodule.exports = vec2;\n\n\n/***/ },\n/* 19 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports[\"default\"] = {\n\t init: function init(arr, val) {\n\t var l = arr.length;\n\t while (l--) {\n\t arr[l] = val;\n\t }\n\t },\n\t\n\t /**\n\t * Shuffles the content of an array\n\t * @return {Array} the array itself shuffled\n\t */\n\t shuffle: function shuffle(arr) {\n\t var i = arr.length - 1,\n\t j,\n\t x;\n\t for (i; i >= 0; i--) {\n\t j = Math.floor(Math.random() * i);\n\t x = arr[i];\n\t arr[i] = arr[j];\n\t arr[j] = x;\n\t }\n\t return arr;\n\t },\n\t\n\t toPointList: function toPointList(arr) {\n\t var i,\n\t j,\n\t row = [],\n\t rows = [];\n\t for (i = 0; i < arr.length; i++) {\n\t row = [];\n\t for (j = 0; j < arr[i].length; j++) {\n\t row[j] = arr[i][j];\n\t }\n\t rows[i] = \"[\" + row.join(\",\") + \"]\";\n\t }\n\t return \"[\" + rows.join(\",\\r\\n\") + \"]\";\n\t },\n\t\n\t /**\n\t * returns the elements which's score is bigger than the threshold\n\t * @return {Array} the reduced array\n\t */\n\t threshold: function threshold(arr, _threshold, scoreFunc) {\n\t var i,\n\t queue = [];\n\t for (i = 0; i < arr.length; i++) {\n\t if (scoreFunc.apply(arr, [arr[i]]) >= _threshold) {\n\t queue.push(arr[i]);\n\t }\n\t }\n\t return queue;\n\t },\n\t\n\t maxIndex: function maxIndex(arr) {\n\t var i,\n\t max = 0;\n\t for (i = 0; i < arr.length; i++) {\n\t if (arr[i] > arr[max]) {\n\t max = i;\n\t }\n\t }\n\t return max;\n\t },\n\t\n\t max: function max(arr) {\n\t var i,\n\t max = 0;\n\t for (i = 0; i < arr.length; i++) {\n\t if (arr[i] > max) {\n\t max = arr[i];\n\t }\n\t }\n\t return max;\n\t },\n\t\n\t sum: function sum(arr) {\n\t var length = arr.length,\n\t sum = 0;\n\t\n\t while (length--) {\n\t sum += arr[length];\n\t }\n\t return sum;\n\t }\n\t};\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* jshint undef: true, unused: true, browser:true, devel: true */\n\t/* global define */\n\t\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _image_wrapper = __webpack_require__(5);\n\t\n\tvar _image_wrapper2 = _interopRequireDefault(_image_wrapper);\n\t\n\tvar _cv_utils = __webpack_require__(7);\n\t\n\tvar _cv_utils2 = _interopRequireDefault(_cv_utils);\n\t\n\tvar _rasterizer = __webpack_require__(21);\n\t\n\tvar _rasterizer2 = _interopRequireDefault(_rasterizer);\n\t\n\tvar _tracer = __webpack_require__(22);\n\t\n\tvar _tracer2 = _interopRequireDefault(_tracer);\n\t\n\tvar _skeletonizer2 = __webpack_require__(23);\n\t\n\tvar _skeletonizer3 = _interopRequireDefault(_skeletonizer2);\n\t\n\tvar _array_helper = __webpack_require__(19);\n\t\n\tvar _array_helper2 = _interopRequireDefault(_array_helper);\n\t\n\tvar _image_debug = __webpack_require__(24);\n\t\n\tvar _image_debug2 = _interopRequireDefault(_image_debug);\n\t\n\tvar _glMatrix = __webpack_require__(9);\n\t\n\tvar _glMatrix2 = _interopRequireDefault(_glMatrix);\n\t\n\tvar _config,\n\t _currentImageWrapper,\n\t _skelImageWrapper,\n\t _subImageWrapper,\n\t _labelImageWrapper,\n\t _patchGrid,\n\t _patchLabelGrid,\n\t _imageToPatchGrid,\n\t _binaryImageWrapper,\n\t _patchSize,\n\t _canvasContainer = {\n\t ctx: {\n\t binary: null\n\t },\n\t dom: {\n\t binary: null\n\t }\n\t},\n\t _numPatches = { x: 0, y: 0 },\n\t _inputImageWrapper,\n\t _skeletonizer,\n\t vec2 = _glMatrix2['default'].vec2,\n\t mat2 = _glMatrix2['default'].mat2,\n\t self = typeof window !== 'undefined' ? window : self;\n\t\n\tfunction initBuffers() {\n\t var skeletonImageData;\n\t\n\t if (_config.halfSample) {\n\t _currentImageWrapper = new _image_wrapper2['default']({\n\t x: _inputImageWrapper.size.x / 2 | 0,\n\t y: _inputImageWrapper.size.y / 2 | 0\n\t });\n\t } else {\n\t _currentImageWrapper = _inputImageWrapper;\n\t }\n\t\n\t _patchSize = _cv_utils2['default'].calculatePatchSize(_config.patchSize, _currentImageWrapper.size);\n\t\n\t _numPatches.x = _currentImageWrapper.size.x / _patchSize.x | 0;\n\t _numPatches.y = _currentImageWrapper.size.y / _patchSize.y | 0;\n\t\n\t _binaryImageWrapper = new _image_wrapper2['default'](_currentImageWrapper.size, undefined, Uint8Array, false);\n\t\n\t _labelImageWrapper = new _image_wrapper2['default'](_patchSize, undefined, Array, true);\n\t\n\t skeletonImageData = new ArrayBuffer(64 * 1024);\n\t _subImageWrapper = new _image_wrapper2['default'](_patchSize, new Uint8Array(skeletonImageData, 0, _patchSize.x * _patchSize.y));\n\t _skelImageWrapper = new _image_wrapper2['default'](_patchSize, new Uint8Array(skeletonImageData, _patchSize.x * _patchSize.y * 3, _patchSize.x * _patchSize.y), undefined, true);\n\t _skeletonizer = (0, _skeletonizer3['default'])(self, {\n\t size: _patchSize.x\n\t }, skeletonImageData);\n\t\n\t _imageToPatchGrid = new _image_wrapper2['default']({\n\t x: _currentImageWrapper.size.x / _subImageWrapper.size.x | 0,\n\t y: _currentImageWrapper.size.y / _subImageWrapper.size.y | 0\n\t }, undefined, Array, true);\n\t _patchGrid = new _image_wrapper2['default'](_imageToPatchGrid.size, undefined, undefined, true);\n\t _patchLabelGrid = new _image_wrapper2['default'](_imageToPatchGrid.size, undefined, Int32Array, true);\n\t}\n\t\n\tfunction initCanvas() {\n\t if (_config.useWorker || typeof document === 'undefined') {\n\t return;\n\t }\n\t _canvasContainer.dom.binary = document.createElement(\"canvas\");\n\t _canvasContainer.dom.binary.className = \"binaryBuffer\";\n\t if (_config.showCanvas === true) {\n\t document.querySelector(\"#debug\").appendChild(_canvasContainer.dom.binary);\n\t }\n\t _canvasContainer.ctx.binary = _canvasContainer.dom.binary.getContext(\"2d\");\n\t _canvasContainer.dom.binary.width = _binaryImageWrapper.size.x;\n\t _canvasContainer.dom.binary.height = _binaryImageWrapper.size.y;\n\t}\n\t\n\t/**\n\t * Creates a bounding box which encloses all the given patches\n\t * @returns {Array} The minimal bounding box\n\t */\n\tfunction boxFromPatches(patches) {\n\t var overAvg,\n\t i,\n\t j,\n\t patch,\n\t transMat,\n\t minx = _binaryImageWrapper.size.x,\n\t miny = _binaryImageWrapper.size.y,\n\t maxx = -_binaryImageWrapper.size.x,\n\t maxy = -_binaryImageWrapper.size.y,\n\t box,\n\t scale;\n\t\n\t // draw all patches which are to be taken into consideration\n\t overAvg = 0;\n\t for (i = 0; i < patches.length; i++) {\n\t patch = patches[i];\n\t overAvg += patch.rad;\n\t if (_config.showPatches) {\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"red\" });\n\t }\n\t }\n\t\n\t overAvg /= patches.length;\n\t overAvg = (overAvg * 180 / Math.PI + 90) % 180 - 90;\n\t if (overAvg < 0) {\n\t overAvg += 180;\n\t }\n\t\n\t overAvg = (180 - overAvg) * Math.PI / 180;\n\t transMat = mat2.clone([Math.cos(overAvg), Math.sin(overAvg), -Math.sin(overAvg), Math.cos(overAvg)]);\n\t\n\t // iterate over patches and rotate by angle\n\t for (i = 0; i < patches.length; i++) {\n\t patch = patches[i];\n\t for (j = 0; j < 4; j++) {\n\t vec2.transformMat2(patch.box[j], patch.box[j], transMat);\n\t }\n\t\n\t if (_config.boxFromPatches.showTransformed) {\n\t _image_debug2['default'].drawPath(patch.box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#99ff00', lineWidth: 2 });\n\t }\n\t }\n\t\n\t // find bounding box\n\t for (i = 0; i < patches.length; i++) {\n\t patch = patches[i];\n\t for (j = 0; j < 4; j++) {\n\t if (patch.box[j][0] < minx) {\n\t minx = patch.box[j][0];\n\t }\n\t if (patch.box[j][0] > maxx) {\n\t maxx = patch.box[j][0];\n\t }\n\t if (patch.box[j][1] < miny) {\n\t miny = patch.box[j][1];\n\t }\n\t if (patch.box[j][1] > maxy) {\n\t maxy = patch.box[j][1];\n\t }\n\t }\n\t }\n\t\n\t box = [[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]];\n\t\n\t if (_config.boxFromPatches.showTransformedBox) {\n\t _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#ff0000', lineWidth: 2 });\n\t }\n\t\n\t scale = _config.halfSample ? 2 : 1;\n\t // reverse rotation;\n\t transMat = mat2.invert(transMat, transMat);\n\t for (j = 0; j < 4; j++) {\n\t vec2.transformMat2(box[j], box[j], transMat);\n\t }\n\t\n\t if (_config.boxFromPatches.showBB) {\n\t _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#ff0000', lineWidth: 2 });\n\t }\n\t\n\t for (j = 0; j < 4; j++) {\n\t vec2.scale(box[j], box[j], scale);\n\t }\n\t\n\t return box;\n\t}\n\t\n\t/**\n\t * Creates a binary image of the current image\n\t */\n\tfunction binarizeImage() {\n\t _cv_utils2['default'].otsuThreshold(_currentImageWrapper, _binaryImageWrapper);\n\t _binaryImageWrapper.zeroBorder();\n\t if (_config.showCanvas) {\n\t _binaryImageWrapper.show(_canvasContainer.dom.binary, 255);\n\t }\n\t}\n\t\n\t/**\n\t * Iterate over the entire image\n\t * extract patches\n\t */\n\tfunction findPatches() {\n\t var i,\n\t j,\n\t x,\n\t y,\n\t moments,\n\t patchesFound = [],\n\t rasterizer,\n\t rasterResult,\n\t patch;\n\t for (i = 0; i < _numPatches.x; i++) {\n\t for (j = 0; j < _numPatches.y; j++) {\n\t\n\t x = _subImageWrapper.size.x * i;\n\t y = _subImageWrapper.size.y * j;\n\t\n\t // seperate parts\n\t skeletonize(x, y);\n\t\n\t // Rasterize, find individual bars\n\t _skelImageWrapper.zeroBorder();\n\t _array_helper2['default'].init(_labelImageWrapper.data, 0);\n\t rasterizer = _rasterizer2['default'].create(_skelImageWrapper, _labelImageWrapper);\n\t rasterResult = rasterizer.rasterize(0);\n\t\n\t if (_config.showLabels) {\n\t _labelImageWrapper.overlay(_canvasContainer.dom.binary, Math.floor(360 / rasterResult.count), { x: x, y: y });\n\t }\n\t\n\t // calculate moments from the skeletonized patch\n\t moments = _labelImageWrapper.moments(rasterResult.count);\n\t\n\t // extract eligible patches\n\t patchesFound = patchesFound.concat(describePatch(moments, [i, j], x, y));\n\t }\n\t }\n\t\n\t if (_config.showFoundPatches) {\n\t for (i = 0; i < patchesFound.length; i++) {\n\t patch = patchesFound[i];\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"#99ff00\", lineWidth: 2 });\n\t }\n\t }\n\t\n\t return patchesFound;\n\t}\n\t\n\t/**\n\t * Finds those connected areas which contain at least 6 patches\n\t * and returns them ordered DESC by the number of contained patches\n\t * @param {Number} maxLabel\n\t */\n\tfunction findBiggestConnectedAreas(maxLabel) {\n\t var i,\n\t sum,\n\t labelHist = [],\n\t topLabels = [];\n\t\n\t for (i = 0; i < maxLabel; i++) {\n\t labelHist.push(0);\n\t }\n\t sum = _patchLabelGrid.data.length;\n\t while (sum--) {\n\t if (_patchLabelGrid.data[sum] > 0) {\n\t labelHist[_patchLabelGrid.data[sum] - 1]++;\n\t }\n\t }\n\t\n\t labelHist = labelHist.map(function (val, idx) {\n\t return {\n\t val: val,\n\t label: idx + 1\n\t };\n\t });\n\t\n\t labelHist.sort(function (a, b) {\n\t return b.val - a.val;\n\t });\n\t\n\t // extract top areas with at least 6 patches present\n\t topLabels = labelHist.filter(function (el) {\n\t return el.val >= 5;\n\t });\n\t\n\t return topLabels;\n\t}\n\t\n\t/**\n\t *\n\t */\n\tfunction findBoxes(topLabels, maxLabel) {\n\t var i,\n\t j,\n\t sum,\n\t patches = [],\n\t patch,\n\t box,\n\t boxes = [],\n\t hsv = [0, 1, 1],\n\t rgb = [0, 0, 0];\n\t\n\t for (i = 0; i < topLabels.length; i++) {\n\t sum = _patchLabelGrid.data.length;\n\t patches.length = 0;\n\t while (sum--) {\n\t if (_patchLabelGrid.data[sum] === topLabels[i].label) {\n\t patch = _imageToPatchGrid.data[sum];\n\t patches.push(patch);\n\t }\n\t }\n\t box = boxFromPatches(patches);\n\t if (box) {\n\t boxes.push(box);\n\t\n\t // draw patch-labels if requested\n\t if (_config.showRemainingPatchLabels) {\n\t for (j = 0; j < patches.length; j++) {\n\t patch = patches[j];\n\t hsv[0] = topLabels[i].label / (maxLabel + 1) * 360;\n\t _cv_utils2['default'].hsv2rgb(hsv, rgb);\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2 });\n\t }\n\t }\n\t }\n\t }\n\t return boxes;\n\t}\n\t\n\t/**\n\t * Find similar moments (via cluster)\n\t * @param {Object} moments\n\t */\n\tfunction similarMoments(moments) {\n\t var clusters = _cv_utils2['default'].cluster(moments, 0.90);\n\t var topCluster = _cv_utils2['default'].topGeneric(clusters, 1, function (e) {\n\t return e.getPoints().length;\n\t });\n\t var points = [],\n\t result = [];\n\t if (topCluster.length === 1) {\n\t points = topCluster[0].item.getPoints();\n\t for (var i = 0; i < points.length; i++) {\n\t result.push(points[i].point);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tfunction skeletonize(x, y) {\n\t _binaryImageWrapper.subImageAsCopy(_subImageWrapper, _cv_utils2['default'].imageRef(x, y));\n\t _skeletonizer.skeletonize();\n\t\n\t // Show skeleton if requested\n\t if (_config.showSkeleton) {\n\t _skelImageWrapper.overlay(_canvasContainer.dom.binary, 360, _cv_utils2['default'].imageRef(x, y));\n\t }\n\t}\n\t\n\t/**\n\t * Extracts and describes those patches which seem to contain a barcode pattern\n\t * @param {Array} moments\n\t * @param {Object} patchPos,\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @returns {Array} list of patches\n\t */\n\tfunction describePatch(moments, patchPos, x, y) {\n\t var k,\n\t avg,\n\t sum = 0,\n\t eligibleMoments = [],\n\t matchingMoments,\n\t patch,\n\t patchesFound = [],\n\t minComponentWeight = Math.ceil(_patchSize.x / 3);\n\t\n\t if (moments.length >= 2) {\n\t // only collect moments which's area covers at least minComponentWeight pixels.\n\t for (k = 0; k < moments.length; k++) {\n\t if (moments[k].m00 > minComponentWeight) {\n\t eligibleMoments.push(moments[k]);\n\t }\n\t }\n\t\n\t // if at least 2 moments are found which have at least minComponentWeights covered\n\t if (eligibleMoments.length >= 2) {\n\t sum = eligibleMoments.length;\n\t matchingMoments = similarMoments(eligibleMoments);\n\t avg = 0;\n\t // determine the similarity of the moments\n\t for (k = 0; k < matchingMoments.length; k++) {\n\t avg += matchingMoments[k].rad;\n\t }\n\t\n\t // Only two of the moments are allowed not to fit into the equation\n\t // add the patch to the set\n\t if (matchingMoments.length > 1 && matchingMoments.length >= eligibleMoments.length / 4 * 3 && matchingMoments.length > moments.length / 4) {\n\t avg /= matchingMoments.length;\n\t patch = {\n\t index: patchPos[1] * _numPatches.x + patchPos[0],\n\t pos: {\n\t x: x,\n\t y: y\n\t },\n\t box: [vec2.clone([x, y]), vec2.clone([x + _subImageWrapper.size.x, y]), vec2.clone([x + _subImageWrapper.size.x, y + _subImageWrapper.size.y]), vec2.clone([x, y + _subImageWrapper.size.y])],\n\t moments: matchingMoments,\n\t rad: avg,\n\t vec: vec2.clone([Math.cos(avg), Math.sin(avg)])\n\t };\n\t patchesFound.push(patch);\n\t }\n\t }\n\t }\n\t return patchesFound;\n\t}\n\t\n\t/**\n\t * finds patches which are connected and share the same orientation\n\t * @param {Object} patchesFound\n\t */\n\tfunction rasterizeAngularSimilarity(patchesFound) {\n\t var label = 0,\n\t threshold = 0.95,\n\t currIdx = 0,\n\t j,\n\t patch,\n\t hsv = [0, 1, 1],\n\t rgb = [0, 0, 0];\n\t\n\t function notYetProcessed() {\n\t var i;\n\t for (i = 0; i < _patchLabelGrid.data.length; i++) {\n\t if (_patchLabelGrid.data[i] === 0 && _patchGrid.data[i] === 1) {\n\t return i;\n\t }\n\t }\n\t return _patchLabelGrid.length;\n\t }\n\t\n\t function trace(currentIdx) {\n\t var x,\n\t y,\n\t currentPatch,\n\t patch,\n\t idx,\n\t dir,\n\t current = {\n\t x: currentIdx % _patchLabelGrid.size.x,\n\t y: currentIdx / _patchLabelGrid.size.x | 0\n\t },\n\t similarity;\n\t\n\t if (currentIdx < _patchLabelGrid.data.length) {\n\t currentPatch = _imageToPatchGrid.data[currentIdx];\n\t // assign label\n\t _patchLabelGrid.data[currentIdx] = label;\n\t for (dir = 0; dir < _tracer2['default'].searchDirections.length; dir++) {\n\t y = current.y + _tracer2['default'].searchDirections[dir][0];\n\t x = current.x + _tracer2['default'].searchDirections[dir][1];\n\t idx = y * _patchLabelGrid.size.x + x;\n\t\n\t // continue if patch empty\n\t if (_patchGrid.data[idx] === 0) {\n\t _patchLabelGrid.data[idx] = Number.MAX_VALUE;\n\t continue;\n\t }\n\t\n\t patch = _imageToPatchGrid.data[idx];\n\t if (_patchLabelGrid.data[idx] === 0) {\n\t similarity = Math.abs(vec2.dot(patch.vec, currentPatch.vec));\n\t if (similarity > threshold) {\n\t trace(idx);\n\t }\n\t }\n\t }\n\t }\n\t }\n\t\n\t // prepare for finding the right patches\n\t _array_helper2['default'].init(_patchGrid.data, 0);\n\t _array_helper2['default'].init(_patchLabelGrid.data, 0);\n\t _array_helper2['default'].init(_imageToPatchGrid.data, null);\n\t\n\t for (j = 0; j < patchesFound.length; j++) {\n\t patch = patchesFound[j];\n\t _imageToPatchGrid.data[patch.index] = patch;\n\t _patchGrid.data[patch.index] = 1;\n\t }\n\t\n\t // rasterize the patches found to determine area\n\t _patchGrid.zeroBorder();\n\t\n\t while ((currIdx = notYetProcessed()) < _patchLabelGrid.data.length) {\n\t label++;\n\t trace(currIdx);\n\t }\n\t\n\t // draw patch-labels if requested\n\t if (_config.showPatchLabels) {\n\t for (j = 0; j < _patchLabelGrid.data.length; j++) {\n\t if (_patchLabelGrid.data[j] > 0 && _patchLabelGrid.data[j] <= label) {\n\t patch = _imageToPatchGrid.data[j];\n\t hsv[0] = _patchLabelGrid.data[j] / (label + 1) * 360;\n\t _cv_utils2['default'].hsv2rgb(hsv, rgb);\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2 });\n\t }\n\t }\n\t }\n\t\n\t return label;\n\t}\n\t\n\texports['default'] = {\n\t init: function init(inputImageWrapper, config) {\n\t _config = config;\n\t _inputImageWrapper = inputImageWrapper;\n\t\n\t initBuffers();\n\t initCanvas();\n\t },\n\t\n\t locate: function locate() {\n\t var patchesFound, topLabels, boxes;\n\t\n\t if (_config.halfSample) {\n\t _cv_utils2['default'].halfSample(_inputImageWrapper, _currentImageWrapper);\n\t }\n\t\n\t binarizeImage();\n\t patchesFound = findPatches();\n\t // return unless 5% or more patches are found\n\t if (patchesFound.length < _numPatches.x * _numPatches.y * 0.05) {\n\t return null;\n\t }\n\t\n\t // rasterrize area by comparing angular similarity;\n\t var maxLabel = rasterizeAngularSimilarity(patchesFound);\n\t if (maxLabel < 1) {\n\t return null;\n\t }\n\t\n\t // search for area with the most patches (biggest connected area)\n\t topLabels = findBiggestConnectedAreas(maxLabel);\n\t if (topLabels.length === 0) {\n\t return null;\n\t }\n\t\n\t boxes = findBoxes(topLabels, maxLabel);\n\t return boxes;\n\t },\n\t\n\t checkImageConstraints: function checkImageConstraints(inputStream, config) {\n\t var patchSize,\n\t width = inputStream.getWidth(),\n\t height = inputStream.getHeight(),\n\t halfSample = config.halfSample ? 0.5 : 1,\n\t size,\n\t area;\n\t\n\t // calculate width and height based on area\n\t if (inputStream.getConfig().area) {\n\t area = _cv_utils2['default'].computeImageArea(width, height, inputStream.getConfig().area);\n\t inputStream.setTopRight({ x: area.sx, y: area.sy });\n\t inputStream.setCanvasSize({ x: width, y: height });\n\t width = area.sw;\n\t height = area.sh;\n\t }\n\t\n\t size = {\n\t x: Math.floor(width * halfSample),\n\t y: Math.floor(height * halfSample)\n\t };\n\t\n\t patchSize = _cv_utils2['default'].calculatePatchSize(config.patchSize, size);\n\t console.log(\"Patch-Size: \" + JSON.stringify(patchSize));\n\t\n\t inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / halfSample) * patchSize.x));\n\t inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / halfSample) * patchSize.y));\n\t\n\t if (inputStream.getWidth() % patchSize.x === 0 && inputStream.getHeight() % patchSize.y === 0) {\n\t return true;\n\t }\n\t\n\t throw new Error(\"Image dimensions do not comply with the current settings: Width (\" + width + \" )and height (\" + height + \") must a multiple of \" + patchSize.x);\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 21 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _tracer = __webpack_require__(22);\n\t\n\tvar _tracer2 = _interopRequireDefault(_tracer);\n\t\n\t/**\n\t * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n\t */\n\tvar Rasterizer = {\n\t createContour2D: function createContour2D() {\n\t return {\n\t dir: null,\n\t index: null,\n\t firstVertex: null,\n\t insideContours: null,\n\t nextpeer: null,\n\t prevpeer: null\n\t };\n\t },\n\t CONTOUR_DIR: {\n\t CW_DIR: 0,\n\t CCW_DIR: 1,\n\t UNKNOWN_DIR: 2\n\t },\n\t DIR: {\n\t OUTSIDE_EDGE: -32767,\n\t INSIDE_EDGE: -32766\n\t },\n\t create: function create(imageWrapper, labelWrapper) {\n\t var imageData = imageWrapper.data,\n\t labelData = labelWrapper.data,\n\t width = imageWrapper.size.x,\n\t height = imageWrapper.size.y,\n\t tracer = _tracer2[\"default\"].create(imageWrapper, labelWrapper);\n\t\n\t return {\n\t rasterize: function rasterize(depthlabel) {\n\t var color,\n\t bc,\n\t lc,\n\t labelindex,\n\t cx,\n\t cy,\n\t colorMap = [],\n\t vertex,\n\t p,\n\t cc,\n\t sc,\n\t pos,\n\t connectedCount = 0,\n\t i;\n\t\n\t for (i = 0; i < 400; i++) {\n\t colorMap[i] = 0;\n\t }\n\t\n\t colorMap[0] = imageData[0];\n\t cc = null;\n\t for (cy = 1; cy < height - 1; cy++) {\n\t labelindex = 0;\n\t bc = colorMap[0];\n\t for (cx = 1; cx < width - 1; cx++) {\n\t pos = cy * width + cx;\n\t if (labelData[pos] === 0) {\n\t color = imageData[pos];\n\t if (color !== bc) {\n\t if (labelindex === 0) {\n\t lc = connectedCount + 1;\n\t colorMap[lc] = color;\n\t bc = color;\n\t vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE);\n\t if (vertex !== null) {\n\t connectedCount++;\n\t labelindex = lc;\n\t p = Rasterizer.createContour2D();\n\t p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n\t p.index = labelindex;\n\t p.firstVertex = vertex;\n\t p.nextpeer = cc;\n\t p.insideContours = null;\n\t if (cc !== null) {\n\t cc.prevpeer = p;\n\t }\n\t cc = p;\n\t }\n\t } else {\n\t vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex);\n\t if (vertex !== null) {\n\t p = Rasterizer.createContour2D();\n\t p.firstVertex = vertex;\n\t p.insideContours = null;\n\t if (depthlabel === 0) {\n\t p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR;\n\t } else {\n\t p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n\t }\n\t p.index = depthlabel;\n\t sc = cc;\n\t while (sc !== null && sc.index !== labelindex) {\n\t sc = sc.nextpeer;\n\t }\n\t if (sc !== null) {\n\t p.nextpeer = sc.insideContours;\n\t if (sc.insideContours !== null) {\n\t sc.insideContours.prevpeer = p;\n\t }\n\t sc.insideContours = p;\n\t }\n\t }\n\t }\n\t } else {\n\t labelData[pos] = labelindex;\n\t }\n\t } else if (labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n\t labelindex = 0;\n\t if (labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n\t bc = imageData[pos];\n\t } else {\n\t bc = colorMap[0];\n\t }\n\t } else {\n\t labelindex = labelData[pos];\n\t bc = colorMap[labelindex];\n\t }\n\t }\n\t }\n\t sc = cc;\n\t while (sc !== null) {\n\t sc.index = depthlabel;\n\t sc = sc.nextpeer;\n\t }\n\t return {\n\t cc: cc,\n\t count: connectedCount\n\t };\n\t },\n\t debug: {\n\t drawContour: function drawContour(canvas, firstContour) {\n\t var ctx = canvas.getContext(\"2d\"),\n\t pq = firstContour,\n\t iq,\n\t q,\n\t p;\n\t\n\t ctx.strokeStyle = \"red\";\n\t ctx.fillStyle = \"red\";\n\t ctx.lineWidth = 1;\n\t\n\t if (pq !== null) {\n\t iq = pq.insideContours;\n\t } else {\n\t iq = null;\n\t }\n\t\n\t while (pq !== null) {\n\t if (iq !== null) {\n\t q = iq;\n\t iq = iq.nextpeer;\n\t } else {\n\t q = pq;\n\t pq = pq.nextpeer;\n\t if (pq !== null) {\n\t iq = pq.insideContours;\n\t } else {\n\t iq = null;\n\t }\n\t }\n\t\n\t switch (q.dir) {\n\t case Rasterizer.CONTOUR_DIR.CW_DIR:\n\t ctx.strokeStyle = \"red\";\n\t break;\n\t case Rasterizer.CONTOUR_DIR.CCW_DIR:\n\t ctx.strokeStyle = \"blue\";\n\t break;\n\t case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:\n\t ctx.strokeStyle = \"green\";\n\t break;\n\t }\n\t\n\t p = q.firstVertex;\n\t ctx.beginPath();\n\t ctx.moveTo(p.x, p.y);\n\t do {\n\t p = p.next;\n\t ctx.lineTo(p.x, p.y);\n\t } while (p !== q.firstVertex);\n\t ctx.stroke();\n\t }\n\t }\n\t }\n\t };\n\t }\n\t};\n\t\n\texports[\"default\"] = Rasterizer;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\t/**\n\t * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n\t */\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar Tracer = {\n\t searchDirections: [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]],\n\t create: function create(imageWrapper, labelWrapper) {\n\t var imageData = imageWrapper.data,\n\t labelData = labelWrapper.data,\n\t searchDirections = this.searchDirections,\n\t width = imageWrapper.size.x,\n\t pos;\n\t\n\t function _trace(current, color, label, edgelabel) {\n\t var i, y, x;\n\t\n\t for (i = 0; i < 7; i++) {\n\t y = current.cy + searchDirections[current.dir][0];\n\t x = current.cx + searchDirections[current.dir][1];\n\t pos = y * width + x;\n\t if (imageData[pos] === color && (labelData[pos] === 0 || labelData[pos] === label)) {\n\t labelData[pos] = label;\n\t current.cy = y;\n\t current.cx = x;\n\t return true;\n\t } else {\n\t if (labelData[pos] === 0) {\n\t labelData[pos] = edgelabel;\n\t }\n\t current.dir = (current.dir + 1) % 8;\n\t }\n\t }\n\t return false;\n\t }\n\t\n\t function vertex2D(x, y, dir) {\n\t return {\n\t dir: dir,\n\t x: x,\n\t y: y,\n\t next: null,\n\t prev: null\n\t };\n\t }\n\t\n\t function _contourTracing(sy, sx, label, color, edgelabel) {\n\t var Fv = null,\n\t Cv,\n\t P,\n\t ldir,\n\t current = {\n\t cx: sx,\n\t cy: sy,\n\t dir: 0\n\t };\n\t\n\t if (_trace(current, color, label, edgelabel)) {\n\t Fv = vertex2D(sx, sy, current.dir);\n\t Cv = Fv;\n\t ldir = current.dir;\n\t P = vertex2D(current.cx, current.cy, 0);\n\t P.prev = Cv;\n\t Cv.next = P;\n\t P.next = null;\n\t Cv = P;\n\t do {\n\t current.dir = (current.dir + 6) % 8;\n\t _trace(current, color, label, edgelabel);\n\t if (ldir != current.dir) {\n\t Cv.dir = current.dir;\n\t P = vertex2D(current.cx, current.cy, 0);\n\t P.prev = Cv;\n\t Cv.next = P;\n\t P.next = null;\n\t Cv = P;\n\t } else {\n\t Cv.dir = ldir;\n\t Cv.x = current.cx;\n\t Cv.y = current.cy;\n\t }\n\t ldir = current.dir;\n\t } while (current.cx != sx || current.cy != sy);\n\t Fv.prev = Cv.prev;\n\t Cv.prev.next = Fv;\n\t }\n\t return Fv;\n\t }\n\t\n\t return {\n\t trace: function trace(current, color, label, edgelabel) {\n\t return _trace(current, color, label, edgelabel);\n\t },\n\t contourTracing: function contourTracing(sy, sx, label, color, edgelabel) {\n\t return _contourTracing(sy, sx, label, color, edgelabel);\n\t }\n\t };\n\t }\n\t};\n\t\n\texports[\"default\"] = Tracer;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 23 */\n/***/ function(module, exports) {\n\n\t/* @preserve ASM BEGIN */\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tfunction Skeletonizer(stdlib, foreign, buffer) {\n\t \"use asm\";\n\t\n\t var images = new stdlib.Uint8Array(buffer),\n\t size = foreign.size | 0,\n\t imul = stdlib.Math.imul;\n\t\n\t function erode(inImagePtr, outImagePtr) {\n\t inImagePtr = inImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var v = 0,\n\t u = 0,\n\t sum = 0,\n\t yStart1 = 0,\n\t yStart2 = 0,\n\t xStart1 = 0,\n\t xStart2 = 0,\n\t offset = 0;\n\t\n\t for (v = 1; (v | 0) < (size - 1 | 0); v = v + 1 | 0) {\n\t offset = offset + size | 0;\n\t for (u = 1; (u | 0) < (size - 1 | 0); u = u + 1 | 0) {\n\t yStart1 = offset - size | 0;\n\t yStart2 = offset + size | 0;\n\t xStart1 = u - 1 | 0;\n\t xStart2 = u + 1 | 0;\n\t sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0;\n\t if ((sum | 0) == (5 | 0)) {\n\t images[outImagePtr + offset + u | 0] = 1;\n\t } else {\n\t images[outImagePtr + offset + u | 0] = 0;\n\t }\n\t }\n\t }\n\t return;\n\t }\n\t\n\t function subtract(aImagePtr, bImagePtr, outImagePtr) {\n\t aImagePtr = aImagePtr | 0;\n\t bImagePtr = bImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[outImagePtr + length | 0] = (images[aImagePtr + length | 0] | 0) - (images[bImagePtr + length | 0] | 0) | 0;\n\t }\n\t }\n\t\n\t function bitwiseOr(aImagePtr, bImagePtr, outImagePtr) {\n\t aImagePtr = aImagePtr | 0;\n\t bImagePtr = bImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[outImagePtr + length | 0] = images[aImagePtr + length | 0] | 0 | (images[bImagePtr + length | 0] | 0) | 0;\n\t }\n\t }\n\t\n\t function countNonZero(imagePtr) {\n\t imagePtr = imagePtr | 0;\n\t\n\t var sum = 0,\n\t length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t sum = (sum | 0) + (images[imagePtr + length | 0] | 0) | 0;\n\t }\n\t\n\t return sum | 0;\n\t }\n\t\n\t function init(imagePtr, value) {\n\t imagePtr = imagePtr | 0;\n\t value = value | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[imagePtr + length | 0] = value;\n\t }\n\t }\n\t\n\t function dilate(inImagePtr, outImagePtr) {\n\t inImagePtr = inImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var v = 0,\n\t u = 0,\n\t sum = 0,\n\t yStart1 = 0,\n\t yStart2 = 0,\n\t xStart1 = 0,\n\t xStart2 = 0,\n\t offset = 0;\n\t\n\t for (v = 1; (v | 0) < (size - 1 | 0); v = v + 1 | 0) {\n\t offset = offset + size | 0;\n\t for (u = 1; (u | 0) < (size - 1 | 0); u = u + 1 | 0) {\n\t yStart1 = offset - size | 0;\n\t yStart2 = offset + size | 0;\n\t xStart1 = u - 1 | 0;\n\t xStart2 = u + 1 | 0;\n\t sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0;\n\t if ((sum | 0) > (0 | 0)) {\n\t images[outImagePtr + offset + u | 0] = 1;\n\t } else {\n\t images[outImagePtr + offset + u | 0] = 0;\n\t }\n\t }\n\t }\n\t return;\n\t }\n\t\n\t function memcpy(srcImagePtr, dstImagePtr) {\n\t srcImagePtr = srcImagePtr | 0;\n\t dstImagePtr = dstImagePtr | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[dstImagePtr + length | 0] = images[srcImagePtr + length | 0] | 0;\n\t }\n\t }\n\t\n\t function zeroBorder(imagePtr) {\n\t imagePtr = imagePtr | 0;\n\t\n\t var x = 0,\n\t y = 0;\n\t\n\t for (x = 0; (x | 0) < (size - 1 | 0); x = x + 1 | 0) {\n\t images[imagePtr + x | 0] = 0;\n\t images[imagePtr + y | 0] = 0;\n\t y = y + size - 1 | 0;\n\t images[imagePtr + y | 0] = 0;\n\t y = y + 1 | 0;\n\t }\n\t for (x = 0; (x | 0) < (size | 0); x = x + 1 | 0) {\n\t images[imagePtr + y | 0] = 0;\n\t y = y + 1 | 0;\n\t }\n\t }\n\t\n\t function skeletonize() {\n\t var subImagePtr = 0,\n\t erodedImagePtr = 0,\n\t tempImagePtr = 0,\n\t skelImagePtr = 0,\n\t sum = 0,\n\t done = 0;\n\t\n\t erodedImagePtr = imul(size, size) | 0;\n\t tempImagePtr = erodedImagePtr + erodedImagePtr | 0;\n\t skelImagePtr = tempImagePtr + erodedImagePtr | 0;\n\t\n\t // init skel-image\n\t init(skelImagePtr, 0);\n\t zeroBorder(subImagePtr);\n\t\n\t do {\n\t erode(subImagePtr, erodedImagePtr);\n\t dilate(erodedImagePtr, tempImagePtr);\n\t subtract(subImagePtr, tempImagePtr, tempImagePtr);\n\t bitwiseOr(skelImagePtr, tempImagePtr, skelImagePtr);\n\t memcpy(erodedImagePtr, subImagePtr);\n\t sum = countNonZero(subImagePtr) | 0;\n\t done = (sum | 0) == 0 | 0;\n\t } while (!done);\n\t }\n\t\n\t return {\n\t skeletonize: skeletonize\n\t };\n\t}\n\t/* @preserve ASM END */\n\t\n\texports[\"default\"] = Skeletonizer;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports[\"default\"] = {\n\t drawRect: function drawRect(pos, size, ctx, style) {\n\t ctx.strokeStyle = style.color;\n\t ctx.fillStyle = style.color;\n\t ctx.lineWidth = 1;\n\t ctx.beginPath();\n\t ctx.strokeRect(pos.x, pos.y, size.x, size.y);\n\t },\n\t drawPath: function drawPath(path, def, ctx, style) {\n\t ctx.strokeStyle = style.color;\n\t ctx.fillStyle = style.color;\n\t ctx.lineWidth = style.lineWidth;\n\t ctx.beginPath();\n\t ctx.moveTo(path[0][def.x], path[0][def.y]);\n\t for (var j = 1; j < path.length; j++) {\n\t ctx.lineTo(path[j][def.x], path[j][def.y]);\n\t }\n\t ctx.closePath();\n\t ctx.stroke();\n\t },\n\t drawImage: function drawImage(imageData, size, ctx) {\n\t var canvasData = ctx.getImageData(0, 0, size.x, size.y),\n\t data = canvasData.data,\n\t imageDataPos = imageData.length,\n\t canvasDataPos = data.length,\n\t value;\n\t\n\t if (canvasDataPos / imageDataPos !== 4) {\n\t return false;\n\t }\n\t while (imageDataPos--) {\n\t value = imageData[imageDataPos];\n\t data[--canvasDataPos] = 255;\n\t data[--canvasDataPos] = value;\n\t data[--canvasDataPos] = value;\n\t data[--canvasDataPos] = value;\n\t }\n\t ctx.putImageData(canvasData, 0, 0);\n\t return true;\n\t }\n\t};\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _bresenham = __webpack_require__(26);\n\t\n\tvar _bresenham2 = _interopRequireDefault(_bresenham);\n\t\n\tvar _image_debug = __webpack_require__(24);\n\t\n\tvar _image_debug2 = _interopRequireDefault(_image_debug);\n\t\n\tvar _code_128_reader = __webpack_require__(27);\n\t\n\tvar _code_128_reader2 = _interopRequireDefault(_code_128_reader);\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tvar _code_39_reader = __webpack_require__(30);\n\t\n\tvar _code_39_reader2 = _interopRequireDefault(_code_39_reader);\n\t\n\tvar _code_39_vin_reader = __webpack_require__(31);\n\t\n\tvar _code_39_vin_reader2 = _interopRequireDefault(_code_39_vin_reader);\n\t\n\tvar _codabar_reader = __webpack_require__(32);\n\t\n\tvar _codabar_reader2 = _interopRequireDefault(_codabar_reader);\n\t\n\tvar _upc_reader = __webpack_require__(33);\n\t\n\tvar _upc_reader2 = _interopRequireDefault(_upc_reader);\n\t\n\tvar _ean_8_reader = __webpack_require__(34);\n\t\n\tvar _ean_8_reader2 = _interopRequireDefault(_ean_8_reader);\n\t\n\tvar _upc_e_reader = __webpack_require__(35);\n\t\n\tvar _upc_e_reader2 = _interopRequireDefault(_upc_e_reader);\n\t\n\tvar _i2of5_reader = __webpack_require__(36);\n\t\n\tvar _i2of5_reader2 = _interopRequireDefault(_i2of5_reader);\n\t\n\tvar readers = {\n\t code_128_reader: _code_128_reader2['default'],\n\t ean_reader: _ean_reader2['default'],\n\t ean_8_reader: _ean_8_reader2['default'],\n\t code_39_reader: _code_39_reader2['default'],\n\t code_39_vin_reader: _code_39_vin_reader2['default'],\n\t codabar_reader: _codabar_reader2['default'],\n\t upc_reader: _upc_reader2['default'],\n\t upc_e_reader: _upc_e_reader2['default'],\n\t i2of5_reader: _i2of5_reader2['default']\n\t};\n\texports['default'] = {\n\t create: function create(config, inputImageWrapper) {\n\t var _canvas = {\n\t ctx: {\n\t frequency: null,\n\t pattern: null,\n\t overlay: null\n\t },\n\t dom: {\n\t frequency: null,\n\t pattern: null,\n\t overlay: null\n\t }\n\t },\n\t _barcodeReaders = [];\n\t\n\t initCanvas();\n\t initReaders();\n\t initConfig();\n\t\n\t function initCanvas() {\n\t if (typeof document !== 'undefined') {\n\t var $debug = document.querySelector(\"#debug.detection\");\n\t _canvas.dom.frequency = document.querySelector(\"canvas.frequency\");\n\t if (!_canvas.dom.frequency) {\n\t _canvas.dom.frequency = document.createElement(\"canvas\");\n\t _canvas.dom.frequency.className = \"frequency\";\n\t if ($debug) {\n\t $debug.appendChild(_canvas.dom.frequency);\n\t }\n\t }\n\t _canvas.ctx.frequency = _canvas.dom.frequency.getContext(\"2d\");\n\t\n\t _canvas.dom.pattern = document.querySelector(\"canvas.patternBuffer\");\n\t if (!_canvas.dom.pattern) {\n\t _canvas.dom.pattern = document.createElement(\"canvas\");\n\t _canvas.dom.pattern.className = \"patternBuffer\";\n\t if ($debug) {\n\t $debug.appendChild(_canvas.dom.pattern);\n\t }\n\t }\n\t _canvas.ctx.pattern = _canvas.dom.pattern.getContext(\"2d\");\n\t\n\t _canvas.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n\t if (_canvas.dom.overlay) {\n\t _canvas.ctx.overlay = _canvas.dom.overlay.getContext(\"2d\");\n\t }\n\t }\n\t }\n\t\n\t function initReaders() {\n\t config.readers.forEach(function (readerConfig) {\n\t var reader,\n\t config = {};\n\t\n\t if (typeof readerConfig === 'object') {\n\t reader = readerConfig.format;\n\t config = readerConfig.config;\n\t } else if (typeof readerConfig === 'string') {\n\t reader = readerConfig;\n\t }\n\t _barcodeReaders.push(new readers[reader](config));\n\t });\n\t console.log(\"Registered Readers: \" + _barcodeReaders.map(function (reader) {\n\t return JSON.stringify({ format: reader.FORMAT, config: reader.config });\n\t }).join(', '));\n\t }\n\t\n\t function initConfig() {\n\t if (typeof document !== 'undefined') {\n\t var i,\n\t vis = [{\n\t node: _canvas.dom.frequency,\n\t prop: config.showFrequency\n\t }, {\n\t node: _canvas.dom.pattern,\n\t prop: config.showPattern\n\t }];\n\t\n\t for (i = 0; i < vis.length; i++) {\n\t if (vis[i].prop === true) {\n\t vis[i].node.style.display = \"block\";\n\t } else {\n\t vis[i].node.style.display = \"none\";\n\t }\n\t }\n\t }\n\t }\n\t\n\t /**\n\t * extend the line on both ends\n\t * @param {Array} line\n\t * @param {Number} angle\n\t */\n\t function getExtendedLine(line, angle, ext) {\n\t function extendLine(amount) {\n\t var extension = {\n\t y: amount * Math.sin(angle),\n\t x: amount * Math.cos(angle)\n\t };\n\t\n\t line[0].y -= extension.y;\n\t line[0].x -= extension.x;\n\t line[1].y += extension.y;\n\t line[1].x += extension.x;\n\t }\n\t\n\t // check if inside image\n\t extendLine(ext);\n\t while (ext > 1 && (!inputImageWrapper.inImageWithBorder(line[0], 0) || !inputImageWrapper.inImageWithBorder(line[1], 0))) {\n\t ext -= Math.ceil(ext / 2);\n\t extendLine(-ext);\n\t }\n\t return line;\n\t }\n\t\n\t function getLine(box) {\n\t return [{\n\t x: (box[1][0] - box[0][0]) / 2 + box[0][0],\n\t y: (box[1][1] - box[0][1]) / 2 + box[0][1]\n\t }, {\n\t x: (box[3][0] - box[2][0]) / 2 + box[2][0],\n\t y: (box[3][1] - box[2][1]) / 2 + box[2][1]\n\t }];\n\t }\n\t\n\t function tryDecode(line) {\n\t var result = null,\n\t i,\n\t barcodeLine = _bresenham2['default'].getBarcodeLine(inputImageWrapper, line[0], line[1]);\n\t\n\t if (config.showFrequency) {\n\t _image_debug2['default'].drawPath(line, { x: 'x', y: 'y' }, _canvas.ctx.overlay, { color: 'red', lineWidth: 3 });\n\t _bresenham2['default'].debug.printFrequency(barcodeLine.line, _canvas.dom.frequency);\n\t }\n\t _bresenham2['default'].toBinaryLine(barcodeLine);\n\t if (config.showPattern) {\n\t _bresenham2['default'].debug.printPattern(barcodeLine.line, _canvas.dom.pattern);\n\t }\n\t\n\t for (i = 0; i < _barcodeReaders.length && result === null; i++) {\n\t result = _barcodeReaders[i].decodePattern(barcodeLine.line);\n\t }\n\t if (result === null) {\n\t return null;\n\t }\n\t return {\n\t codeResult: result,\n\t barcodeLine: barcodeLine\n\t };\n\t }\n\t\n\t /**\n\t * This method slices the given area apart and tries to detect a barcode-pattern\n\t * for each slice. It returns the decoded barcode, or null if nothing was found\n\t * @param {Array} box\n\t * @param {Array} line\n\t * @param {Number} lineAngle\n\t */\n\t function tryDecodeBruteForce(box, line, lineAngle) {\n\t var sideLength = Math.sqrt(Math.pow(box[1][0] - box[0][0], 2) + Math.pow(box[1][1] - box[0][1], 2)),\n\t i,\n\t slices = 16,\n\t result = null,\n\t dir,\n\t extension,\n\t xdir = Math.sin(lineAngle),\n\t ydir = Math.cos(lineAngle);\n\t\n\t for (i = 1; i < slices && result === null; i++) {\n\t // move line perpendicular to angle\n\t dir = sideLength / slices * i * (i % 2 === 0 ? -1 : 1);\n\t extension = {\n\t y: dir * xdir,\n\t x: dir * ydir\n\t };\n\t line[0].y += extension.x;\n\t line[0].x -= extension.y;\n\t line[1].y += extension.x;\n\t line[1].x -= extension.y;\n\t\n\t result = tryDecode(line);\n\t }\n\t return result;\n\t }\n\t\n\t function getLineLength(line) {\n\t return Math.sqrt(Math.pow(Math.abs(line[1].y - line[0].y), 2) + Math.pow(Math.abs(line[1].x - line[0].x), 2));\n\t }\n\t\n\t /**\n\t * With the help of the configured readers (Code128 or EAN) this function tries to detect a\n\t * valid barcode pattern within the given area.\n\t * @param {Object} box The area to search in\n\t * @returns {Object} the result {codeResult, line, angle, pattern, threshold}\n\t */\n\t function _decodeFromBoundingBox(box) {\n\t var line,\n\t lineAngle,\n\t ctx = _canvas.ctx.overlay,\n\t result,\n\t lineLength;\n\t\n\t if (config.drawBoundingBox && ctx) {\n\t _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, ctx, { color: \"blue\", lineWidth: 2 });\n\t }\n\t\n\t line = getLine(box);\n\t lineLength = getLineLength(line);\n\t lineAngle = Math.atan2(line[1].y - line[0].y, line[1].x - line[0].x);\n\t line = getExtendedLine(line, lineAngle, Math.floor(lineLength * 0.1));\n\t if (line === null) {\n\t return null;\n\t }\n\t\n\t result = tryDecode(line);\n\t if (result === null) {\n\t result = tryDecodeBruteForce(box, line, lineAngle);\n\t }\n\t\n\t if (result === null) {\n\t return null;\n\t }\n\t\n\t if (result && config.drawScanline && ctx) {\n\t _image_debug2['default'].drawPath(line, { x: 'x', y: 'y' }, ctx, { color: 'red', lineWidth: 3 });\n\t }\n\t\n\t return {\n\t codeResult: result.codeResult,\n\t line: line,\n\t angle: lineAngle,\n\t pattern: result.barcodeLine.line,\n\t threshold: result.barcodeLine.threshold\n\t };\n\t }\n\t\n\t return {\n\t decodeFromBoundingBox: function decodeFromBoundingBox(box) {\n\t return _decodeFromBoundingBox(box);\n\t },\n\t decodeFromBoundingBoxes: function decodeFromBoundingBoxes(boxes) {\n\t var i, result;\n\t for (i = 0; i < boxes.length; i++) {\n\t result = _decodeFromBoundingBox(boxes[i]);\n\t if (result && result.codeResult) {\n\t result.box = boxes[i];\n\t return result;\n\t }\n\t }\n\t },\n\t setReaders: function setReaders(readers) {\n\t config.readers = readers;\n\t _barcodeReaders.length = 0;\n\t initReaders();\n\t }\n\t };\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _cv_utils = __webpack_require__(7);\n\t\n\tvar _cv_utils2 = _interopRequireDefault(_cv_utils);\n\t\n\tvar _image_wrapper = __webpack_require__(5);\n\t\n\tvar _image_wrapper2 = _interopRequireDefault(_image_wrapper);\n\t\n\tvar Bresenham = {};\n\t\n\tvar Slope = {\n\t DIR: {\n\t UP: 1,\n\t DOWN: -1\n\t }\n\t};\n\t/**\n\t * Scans a line of the given image from point p1 to p2 and returns a result object containing\n\t * gray-scale values (0-255) of the underlying pixels in addition to the min\n\t * and max values.\n\t * @param {Object} imageWrapper\n\t * @param {Object} p1 The start point {x,y}\n\t * @param {Object} p2 The end point {x,y}\n\t * @returns {line, min, max}\n\t */\n\tBresenham.getBarcodeLine = function (imageWrapper, p1, p2) {\n\t var x0 = p1.x | 0,\n\t y0 = p1.y | 0,\n\t x1 = p2.x | 0,\n\t y1 = p2.y | 0,\n\t steep = Math.abs(y1 - y0) > Math.abs(x1 - x0),\n\t deltax,\n\t deltay,\n\t error,\n\t ystep,\n\t y,\n\t tmp,\n\t x,\n\t line = [],\n\t imageData = imageWrapper.data,\n\t width = imageWrapper.size.x,\n\t sum = 0,\n\t val,\n\t min = 255,\n\t max = 0;\n\t\n\t function read(a, b) {\n\t val = imageData[b * width + a];\n\t sum += val;\n\t min = val < min ? val : min;\n\t max = val > max ? val : max;\n\t line.push(val);\n\t }\n\t\n\t if (steep) {\n\t tmp = x0;\n\t x0 = y0;\n\t y0 = tmp;\n\t\n\t tmp = x1;\n\t x1 = y1;\n\t y1 = tmp;\n\t }\n\t if (x0 > x1) {\n\t tmp = x0;\n\t x0 = x1;\n\t x1 = tmp;\n\t\n\t tmp = y0;\n\t y0 = y1;\n\t y1 = tmp;\n\t }\n\t deltax = x1 - x0;\n\t deltay = Math.abs(y1 - y0);\n\t error = deltax / 2 | 0;\n\t y = y0;\n\t ystep = y0 < y1 ? 1 : -1;\n\t for (x = x0; x < x1; x++) {\n\t if (steep) {\n\t read(y, x);\n\t } else {\n\t read(x, y);\n\t }\n\t error = error - deltay;\n\t if (error < 0) {\n\t y = y + ystep;\n\t error = error + deltax;\n\t }\n\t }\n\t\n\t return {\n\t line: line,\n\t min: min,\n\t max: max\n\t };\n\t};\n\t\n\tBresenham.toOtsuBinaryLine = function (result) {\n\t var line = result.line,\n\t image = new _image_wrapper2['default']({ x: line.length - 1, y: 1 }, line),\n\t threshold = _cv_utils2['default'].determineOtsuThreshold(image, 5);\n\t\n\t line = _cv_utils2['default'].sharpenLine(line);\n\t _cv_utils2['default'].thresholdImage(image, threshold);\n\t\n\t return {\n\t line: line,\n\t threshold: threshold\n\t };\n\t};\n\t\n\t/**\n\t * Converts the result from getBarcodeLine into a binary representation\n\t * also considering the frequency and slope of the signal for more robust results\n\t * @param {Object} result {line, min, max}\n\t */\n\tBresenham.toBinaryLine = function (result) {\n\t\n\t var min = result.min,\n\t max = result.max,\n\t line = result.line,\n\t slope,\n\t slope2,\n\t center = min + (max - min) / 2,\n\t extrema = [],\n\t currentDir,\n\t dir,\n\t threshold = (max - min) / 12,\n\t rThreshold = -threshold,\n\t i,\n\t j;\n\t\n\t // 1. find extrema\n\t currentDir = line[0] > center ? Slope.DIR.UP : Slope.DIR.DOWN;\n\t extrema.push({\n\t pos: 0,\n\t val: line[0]\n\t });\n\t for (i = 0; i < line.length - 2; i++) {\n\t slope = line[i + 1] - line[i];\n\t slope2 = line[i + 2] - line[i + 1];\n\t if (slope + slope2 < rThreshold && line[i + 1] < center * 1.5) {\n\t dir = Slope.DIR.DOWN;\n\t } else if (slope + slope2 > threshold && line[i + 1] > center * 0.5) {\n\t dir = Slope.DIR.UP;\n\t } else {\n\t dir = currentDir;\n\t }\n\t\n\t if (currentDir !== dir) {\n\t extrema.push({\n\t pos: i,\n\t val: line[i]\n\t });\n\t currentDir = dir;\n\t }\n\t }\n\t extrema.push({\n\t pos: line.length,\n\t val: line[line.length - 1]\n\t });\n\t\n\t for (j = extrema[0].pos; j < extrema[1].pos; j++) {\n\t line[j] = line[j] > center ? 0 : 1;\n\t }\n\t\n\t // iterate over extrema and convert to binary based on avg between minmax\n\t for (i = 1; i < extrema.length - 1; i++) {\n\t if (extrema[i + 1].val > extrema[i].val) {\n\t threshold = extrema[i].val + (extrema[i + 1].val - extrema[i].val) / 3 * 2 | 0;\n\t } else {\n\t threshold = extrema[i + 1].val + (extrema[i].val - extrema[i + 1].val) / 3 | 0;\n\t }\n\t\n\t for (j = extrema[i].pos; j < extrema[i + 1].pos; j++) {\n\t line[j] = line[j] > threshold ? 0 : 1;\n\t }\n\t }\n\t\n\t return {\n\t line: line,\n\t threshold: threshold\n\t };\n\t};\n\t\n\t/**\n\t * Used for development only\n\t */\n\tBresenham.debug = {\n\t printFrequency: function printFrequency(line, canvas) {\n\t var i,\n\t ctx = canvas.getContext(\"2d\");\n\t canvas.width = line.length;\n\t canvas.height = 256;\n\t\n\t ctx.beginPath();\n\t ctx.strokeStyle = \"blue\";\n\t for (i = 0; i < line.length; i++) {\n\t ctx.moveTo(i, 255);\n\t ctx.lineTo(i, 255 - line[i]);\n\t }\n\t ctx.stroke();\n\t ctx.closePath();\n\t },\n\t\n\t printPattern: function printPattern(line, canvas) {\n\t var ctx = canvas.getContext(\"2d\"),\n\t i;\n\t\n\t canvas.width = line.length;\n\t ctx.fillColor = \"black\";\n\t for (i = 0; i < line.length; i++) {\n\t if (line[i] === 1) {\n\t ctx.fillRect(i, 0, 1, 100);\n\t }\n\t }\n\t }\n\t};\n\t\n\texports['default'] = Bresenham;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tfunction Code128Reader() {\n\t _barcode_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t CODE_SHIFT: { value: 98 },\n\t CODE_C: { value: 99 },\n\t CODE_B: { value: 100 },\n\t CODE_A: { value: 101 },\n\t START_CODE_A: { value: 103 },\n\t START_CODE_B: { value: 104 },\n\t START_CODE_C: { value: 105 },\n\t STOP_CODE: { value: 106 },\n\t MODULO: { value: 11 },\n\t CODE_PATTERN: { value: [[2, 1, 2, 2, 2, 2], [2, 2, 2, 1, 2, 2], [2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 3], [1, 2, 1, 3, 2, 2], [1, 3, 1, 2, 2, 2], [1, 2, 2, 2, 1, 3], [1, 2, 2, 3, 1, 2], [1, 3, 2, 2, 1, 2], [2, 2, 1, 2, 1, 3], [2, 2, 1, 3, 1, 2], [2, 3, 1, 2, 1, 2], [1, 1, 2, 2, 3, 2], [1, 2, 2, 1, 3, 2], [1, 2, 2, 2, 3, 1], [1, 1, 3, 2, 2, 2], [1, 2, 3, 1, 2, 2], [1, 2, 3, 2, 2, 1], [2, 2, 3, 2, 1, 1], [2, 2, 1, 1, 3, 2], [2, 2, 1, 2, 3, 1], [2, 1, 3, 2, 1, 2], [2, 2, 3, 1, 1, 2], [3, 1, 2, 1, 3, 1], [3, 1, 1, 2, 2, 2], [3, 2, 1, 1, 2, 2], [3, 2, 1, 2, 2, 1], [3, 1, 2, 2, 1, 2], [3, 2, 2, 1, 1, 2], [3, 2, 2, 2, 1, 1], [2, 1, 2, 1, 2, 3], [2, 1, 2, 3, 2, 1], [2, 3, 2, 1, 2, 1], [1, 1, 1, 3, 2, 3], [1, 3, 1, 1, 2, 3], [1, 3, 1, 3, 2, 1], [1, 1, 2, 3, 1, 3], [1, 3, 2, 1, 1, 3], [1, 3, 2, 3, 1, 1], [2, 1, 1, 3, 1, 3], [2, 3, 1, 1, 1, 3], [2, 3, 1, 3, 1, 1], [1, 1, 2, 1, 3, 3], [1, 1, 2, 3, 3, 1], [1, 3, 2, 1, 3, 1], [1, 1, 3, 1, 2, 3], [1, 1, 3, 3, 2, 1], [1, 3, 3, 1, 2, 1], [3, 1, 3, 1, 2, 1], [2, 1, 1, 3, 3, 1], [2, 3, 1, 1, 3, 1], [2, 1, 3, 1, 1, 3], [2, 1, 3, 3, 1, 1], [2, 1, 3, 1, 3, 1], [3, 1, 1, 1, 2, 3], [3, 1, 1, 3, 2, 1], [3, 3, 1, 1, 2, 1], [3, 1, 2, 1, 1, 3], [3, 1, 2, 3, 1, 1], [3, 3, 2, 1, 1, 1], [3, 1, 4, 1, 1, 1], [2, 2, 1, 4, 1, 1], [4, 3, 1, 1, 1, 1], [1, 1, 1, 2, 2, 4], [1, 1, 1, 4, 2, 2], [1, 2, 1, 1, 2, 4], [1, 2, 1, 4, 2, 1], [1, 4, 1, 1, 2, 2], [1, 4, 1, 2, 2, 1], [1, 1, 2, 2, 1, 4], [1, 1, 2, 4, 1, 2], [1, 2, 2, 1, 1, 4], [1, 2, 2, 4, 1, 1], [1, 4, 2, 1, 1, 2], [1, 4, 2, 2, 1, 1], [2, 4, 1, 2, 1, 1], [2, 2, 1, 1, 1, 4], [4, 1, 3, 1, 1, 1], [2, 4, 1, 1, 1, 2], [1, 3, 4, 1, 1, 1], [1, 1, 1, 2, 4, 2], [1, 2, 1, 1, 4, 2], [1, 2, 1, 2, 4, 1], [1, 1, 4, 2, 1, 2], [1, 2, 4, 1, 1, 2], [1, 2, 4, 2, 1, 1], [4, 1, 1, 2, 1, 2], [4, 2, 1, 1, 1, 2], [4, 2, 1, 2, 1, 1], [2, 1, 2, 1, 4, 1], [2, 1, 4, 1, 2, 1], [4, 1, 2, 1, 2, 1], [1, 1, 1, 1, 4, 3], [1, 1, 1, 3, 4, 1], [1, 3, 1, 1, 4, 1], [1, 1, 4, 1, 1, 3], [1, 1, 4, 3, 1, 1], [4, 1, 1, 1, 1, 3], [4, 1, 1, 3, 1, 1], [1, 1, 3, 1, 4, 1], [1, 1, 4, 1, 3, 1], [3, 1, 1, 1, 4, 1], [4, 1, 1, 1, 3, 1], [2, 1, 1, 4, 1, 2], [2, 1, 1, 2, 1, 4], [2, 1, 1, 2, 3, 2], [2, 3, 3, 1, 1, 1, 2]] },\n\t SINGLE_CODE_ERROR: { value: 1 },\n\t AVG_CODE_ERROR: { value: 0.5 },\n\t FORMAT: { value: \"code_128\", writeable: false }\n\t};\n\t\n\tCode128Reader.prototype = Object.create(_barcode_reader2[\"default\"].prototype, properties);\n\tCode128Reader.prototype.constructor = Code128Reader;\n\t\n\tCode128Reader.prototype._decodeCode = function (start) {\n\t var counter = [0, 0, 0, 0, 0, 0],\n\t i,\n\t self = this,\n\t offset = start,\n\t isWhite = !self._row[offset],\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: start,\n\t end: start\n\t },\n\t code,\n\t error,\n\t normalized;\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = 0; code < self.CODE_PATTERN.length; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tCode128Reader.prototype._findStart = function () {\n\t var counter = [0, 0, 0, 0, 0, 0],\n\t i,\n\t self = this,\n\t offset = self._nextSet(self._row),\n\t isWhite = false,\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t },\n\t code,\n\t error,\n\t j,\n\t sum,\n\t normalized;\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t sum = 0;\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t if (bestMatch.error < self.AVG_CODE_ERROR) {\n\t bestMatch.start = i - sum;\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t }\n\t\n\t for (j = 0; j < 4; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[4] = 0;\n\t counter[5] = 0;\n\t counterPos--;\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tCode128Reader.prototype._decode = function () {\n\t var self = this,\n\t startInfo = self._findStart(),\n\t code = null,\n\t done = false,\n\t result = [],\n\t multiplier = 0,\n\t checksum = 0,\n\t codeset,\n\t rawResult = [],\n\t decodedCodes = [],\n\t shiftNext = false,\n\t unshift,\n\t lastCharacterWasPrintable;\n\t\n\t if (startInfo === null) {\n\t return null;\n\t }\n\t code = {\n\t code: startInfo.code,\n\t start: startInfo.start,\n\t end: startInfo.end\n\t };\n\t decodedCodes.push(code);\n\t checksum = code.code;\n\t switch (code.code) {\n\t case self.START_CODE_A:\n\t codeset = self.CODE_A;\n\t break;\n\t case self.START_CODE_B:\n\t codeset = self.CODE_B;\n\t break;\n\t case self.START_CODE_C:\n\t codeset = self.CODE_C;\n\t break;\n\t default:\n\t return null;\n\t }\n\t\n\t while (!done) {\n\t unshift = shiftNext;\n\t shiftNext = false;\n\t code = self._decodeCode(code.end);\n\t if (code !== null) {\n\t if (code.code !== self.STOP_CODE) {\n\t rawResult.push(code.code);\n\t multiplier++;\n\t checksum += multiplier * code.code;\n\t }\n\t decodedCodes.push(code);\n\t\n\t switch (codeset) {\n\t case self.CODE_A:\n\t if (code.code < 64) {\n\t result.push(String.fromCharCode(32 + code.code));\n\t } else if (code.code < 96) {\n\t result.push(String.fromCharCode(code.code - 64));\n\t } else {\n\t switch (code.code) {\n\t case self.CODE_SHIFT:\n\t shiftNext = true;\n\t codeset = self.CODE_B;\n\t break;\n\t case self.CODE_B:\n\t codeset = self.CODE_B;\n\t break;\n\t case self.CODE_C:\n\t codeset = self.CODE_C;\n\t break;\n\t case self.STOP_CODE:\n\t done = true;\n\t break;\n\t }\n\t }\n\t break;\n\t case self.CODE_B:\n\t if (code.code < 96) {\n\t result.push(String.fromCharCode(32 + code.code));\n\t } else {\n\t if (code.code != self.STOP_CODE) {\n\t lastCharacterWasPrintable = false;\n\t }\n\t switch (code.code) {\n\t case self.CODE_SHIFT:\n\t shiftNext = true;\n\t codeset = self.CODE_A;\n\t break;\n\t case self.CODE_A:\n\t codeset = self.CODE_A;\n\t break;\n\t case self.CODE_C:\n\t codeset = self.CODE_C;\n\t break;\n\t case self.STOP_CODE:\n\t done = true;\n\t break;\n\t }\n\t }\n\t break;\n\t case self.CODE_C:\n\t if (code.code < 100) {\n\t result.push(code.code < 10 ? \"0\" + code.code : code.code);\n\t }\n\t switch (code.code) {\n\t case self.CODE_A:\n\t codeset = self.CODE_A;\n\t break;\n\t case self.CODE_B:\n\t codeset = self.CODE_B;\n\t break;\n\t case self.STOP_CODE:\n\t done = true;\n\t break;\n\t }\n\t break;\n\t }\n\t } else {\n\t done = true;\n\t }\n\t if (unshift) {\n\t codeset = codeset == self.CODE_A ? self.CODE_B : self.CODE_A;\n\t }\n\t }\n\t\n\t if (code === null) {\n\t return null;\n\t }\n\t\n\t // find end bar\n\t code.end = self._nextUnset(self._row, code.end);\n\t if (!self._verifyTrailingWhitespace(code)) {\n\t return null;\n\t }\n\t\n\t // checksum\n\t // Does not work correctly yet!!! startcode - endcode?\n\t checksum -= multiplier * rawResult[rawResult.length - 1];\n\t if (checksum % 103 != rawResult[rawResult.length - 1]) {\n\t return null;\n\t }\n\t\n\t if (!result.length) {\n\t return null;\n\t }\n\t\n\t // remove last code from result (checksum)\n\t result.splice(result.length - 1, 1);\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: startInfo.start,\n\t end: code.end,\n\t codeset: codeset,\n\t startInfo: startInfo,\n\t decodedCodes: decodedCodes,\n\t endInfo: code\n\t };\n\t};\n\t\n\t_barcode_reader2[\"default\"].prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\texports[\"default\"] = Code128Reader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 28 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\tfunction BarcodeReader(config) {\n\t this._row = [];\n\t this.config = config || {};\n\t return this;\n\t}\n\t\n\tBarcodeReader.prototype._nextUnset = function (line, start) {\n\t var i;\n\t\n\t if (start === undefined) {\n\t start = 0;\n\t }\n\t for (i = start; i < line.length; i++) {\n\t if (!line[i]) {\n\t return i;\n\t }\n\t }\n\t return line.length;\n\t};\n\t\n\tBarcodeReader.prototype._matchPattern = function (counter, code) {\n\t var i,\n\t error = 0,\n\t singleError = 0,\n\t modulo = this.MODULO,\n\t maxSingleError = this.SINGLE_CODE_ERROR || 1;\n\t\n\t for (i = 0; i < counter.length; i++) {\n\t singleError = Math.abs(code[i] - counter[i]);\n\t if (singleError > maxSingleError) {\n\t return Number.MAX_VALUE;\n\t }\n\t error += singleError;\n\t }\n\t return error / modulo;\n\t};\n\t\n\tBarcodeReader.prototype._nextSet = function (line, offset) {\n\t var i;\n\t\n\t offset = offset || 0;\n\t for (i = offset; i < line.length; i++) {\n\t if (line[i]) {\n\t return i;\n\t }\n\t }\n\t return line.length;\n\t};\n\t\n\tBarcodeReader.prototype._normalize = function (counter, modulo) {\n\t var i,\n\t self = this,\n\t sum = 0,\n\t ratio,\n\t numOnes = 0,\n\t normalized = [],\n\t norm = 0;\n\t\n\t if (!modulo) {\n\t modulo = self.MODULO;\n\t }\n\t for (i = 0; i < counter.length; i++) {\n\t if (counter[i] === 1) {\n\t numOnes++;\n\t } else {\n\t sum += counter[i];\n\t }\n\t }\n\t ratio = sum / (modulo - numOnes);\n\t if (ratio > 1.0) {\n\t for (i = 0; i < counter.length; i++) {\n\t norm = counter[i] === 1 ? counter[i] : counter[i] / ratio;\n\t normalized.push(norm);\n\t }\n\t } else {\n\t ratio = (sum + numOnes) / modulo;\n\t for (i = 0; i < counter.length; i++) {\n\t norm = counter[i] / ratio;\n\t normalized.push(norm);\n\t }\n\t }\n\t return normalized;\n\t};\n\t\n\tBarcodeReader.prototype._matchTrace = function (cmpCounter, epsilon) {\n\t var counter = [],\n\t i,\n\t self = this,\n\t offset = self._nextSet(self._row),\n\t isWhite = !self._row[offset],\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0\n\t },\n\t error;\n\t\n\t if (cmpCounter) {\n\t for (i = 0; i < cmpCounter.length; i++) {\n\t counter.push(0);\n\t }\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t error = self._matchPattern(counter, cmpCounter);\n\t\n\t if (error < epsilon) {\n\t bestMatch.start = i - offset;\n\t bestMatch.end = i;\n\t bestMatch.counter = counter;\n\t return bestMatch;\n\t } else {\n\t return null;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t } else {\n\t counter.push(0);\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t counterPos++;\n\t counter.push(0);\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t }\n\t\n\t // if cmpCounter was not given\n\t bestMatch.start = offset;\n\t bestMatch.end = self._row.length - 1;\n\t bestMatch.counter = counter;\n\t return bestMatch;\n\t};\n\t\n\tBarcodeReader.prototype.decodePattern = function (pattern) {\n\t var self = this,\n\t result;\n\t\n\t self._row = pattern;\n\t result = self._decode();\n\t if (result === null) {\n\t self._row.reverse();\n\t result = self._decode();\n\t if (result) {\n\t result.direction = BarcodeReader.DIRECTION.REVERSE;\n\t result.start = self._row.length - result.start;\n\t result.end = self._row.length - result.end;\n\t }\n\t } else {\n\t result.direction = BarcodeReader.DIRECTION.FORWARD;\n\t }\n\t if (result) {\n\t result.format = self.FORMAT;\n\t }\n\t return result;\n\t};\n\t\n\tBarcodeReader.prototype._matchRange = function (start, end, value) {\n\t var i;\n\t\n\t start = start < 0 ? 0 : start;\n\t for (i = start; i < end; i++) {\n\t if (this._row[i] !== value) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t};\n\t\n\tBarcodeReader.prototype._fillCounters = function (offset, end, isWhite) {\n\t var self = this,\n\t counterPos = 0,\n\t i,\n\t counters = [];\n\t\n\t isWhite = typeof isWhite !== 'undefined' ? isWhite : true;\n\t offset = typeof offset !== 'undefined' ? offset : self._nextUnset(self._row);\n\t end = end || self._row.length;\n\t\n\t counters[counterPos] = 0;\n\t for (i = offset; i < end; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counters[counterPos]++;\n\t } else {\n\t counterPos++;\n\t counters[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return counters;\n\t};\n\t\n\tObject.defineProperty(BarcodeReader.prototype, \"FORMAT\", {\n\t value: 'unknown',\n\t writeable: false\n\t});\n\t\n\tBarcodeReader.DIRECTION = {\n\t FORWARD: 1,\n\t REVERSE: -1\n\t};\n\t\n\tBarcodeReader.Exception = {\n\t StartNotFoundException: \"Start-Info was not found!\",\n\t CodeNotFoundException: \"Code could not be found!\",\n\t PatternNotFoundException: \"Pattern could not be found!\"\n\t};\n\t\n\tBarcodeReader.CONFIG_KEYS = {};\n\t\n\texports['default'] = BarcodeReader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tfunction EANReader(opts) {\n\t _barcode_reader2[\"default\"].call(this, opts);\n\t}\n\t\n\tvar properties = {\n\t CODE_L_START: { value: 0 },\n\t MODULO: { value: 7 },\n\t CODE_G_START: { value: 10 },\n\t START_PATTERN: { value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7] },\n\t STOP_PATTERN: { value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7] },\n\t MIDDLE_PATTERN: { value: [1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7] },\n\t CODE_PATTERN: { value: [[3, 2, 1, 1], [2, 2, 2, 1], [2, 1, 2, 2], [1, 4, 1, 1], [1, 1, 3, 2], [1, 2, 3, 1], [1, 1, 1, 4], [1, 3, 1, 2], [1, 2, 1, 3], [3, 1, 1, 2], [1, 1, 2, 3], [1, 2, 2, 2], [2, 2, 1, 2], [1, 1, 4, 1], [2, 3, 1, 1], [1, 3, 2, 1], [4, 1, 1, 1], [2, 1, 3, 1], [3, 1, 2, 1], [2, 1, 1, 3]] },\n\t CODE_FREQUENCY: { value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26] },\n\t SINGLE_CODE_ERROR: { value: 0.67 },\n\t AVG_CODE_ERROR: { value: 0.27 },\n\t FORMAT: { value: \"ean_13\", writeable: false }\n\t};\n\t\n\tEANReader.prototype = Object.create(_barcode_reader2[\"default\"].prototype, properties);\n\tEANReader.prototype.constructor = EANReader;\n\t\n\tEANReader.prototype._decodeCode = function (start, coderange) {\n\t var counter = [0, 0, 0, 0],\n\t i,\n\t self = this,\n\t offset = start,\n\t isWhite = !self._row[offset],\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: start,\n\t end: start\n\t },\n\t code,\n\t error,\n\t normalized;\n\t\n\t if (!coderange) {\n\t coderange = self.CODE_PATTERN.length;\n\t }\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = 0; code < coderange; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t bestMatch.end = i;\n\t if (bestMatch.error > self.AVG_CODE_ERROR) {\n\t return null;\n\t }\n\t return bestMatch;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._findPattern = function (pattern, offset, isWhite, tryHarder, epsilon) {\n\t var counter = [],\n\t self = this,\n\t i,\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t },\n\t error,\n\t j,\n\t sum,\n\t normalized;\n\t\n\t if (!offset) {\n\t offset = self._nextSet(self._row);\n\t }\n\t\n\t if (isWhite === undefined) {\n\t isWhite = false;\n\t }\n\t\n\t if (tryHarder === undefined) {\n\t tryHarder = true;\n\t }\n\t\n\t if (epsilon === undefined) {\n\t epsilon = self.AVG_CODE_ERROR;\n\t }\n\t\n\t for (i = 0; i < pattern.length; i++) {\n\t counter[i] = 0;\n\t }\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t sum = 0;\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t error = self._matchPattern(normalized, pattern);\n\t\n\t if (error < epsilon) {\n\t bestMatch.error = error;\n\t bestMatch.start = i - sum;\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t }\n\t if (tryHarder) {\n\t for (j = 0; j < counter.length - 2; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[counter.length - 2] = 0;\n\t counter[counter.length - 1] = 0;\n\t counterPos--;\n\t } else {\n\t return null;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._findStart = function () {\n\t var self = this,\n\t leadingWhitespaceStart,\n\t offset = self._nextSet(self._row),\n\t startInfo;\n\t\n\t while (!startInfo) {\n\t startInfo = self._findPattern(self.START_PATTERN, offset);\n\t if (!startInfo) {\n\t return null;\n\t }\n\t leadingWhitespaceStart = startInfo.start - (startInfo.end - startInfo.start);\n\t if (leadingWhitespaceStart >= 0) {\n\t if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n\t return startInfo;\n\t }\n\t }\n\t offset = startInfo.end;\n\t startInfo = null;\n\t }\n\t};\n\t\n\tEANReader.prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start);\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._findEnd = function (offset, isWhite) {\n\t var self = this,\n\t endInfo = self._findPattern(self.STOP_PATTERN, offset, isWhite, false);\n\t\n\t return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n\t};\n\t\n\tEANReader.prototype._calculateFirstDigit = function (codeFrequency) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < self.CODE_FREQUENCY.length; i++) {\n\t if (codeFrequency === self.CODE_FREQUENCY[i]) {\n\t return i;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._decodePayload = function (code, result, decodedCodes) {\n\t var i,\n\t self = this,\n\t codeFrequency = 0x0,\n\t firstDigit;\n\t\n\t for (i = 0; i < 6; i++) {\n\t code = self._decodeCode(code.end);\n\t if (!code) {\n\t return null;\n\t }\n\t if (code.code >= self.CODE_G_START) {\n\t code.code = code.code - self.CODE_G_START;\n\t codeFrequency |= 1 << 5 - i;\n\t } else {\n\t codeFrequency |= 0 << 5 - i;\n\t }\n\t result.push(code.code);\n\t decodedCodes.push(code);\n\t }\n\t\n\t firstDigit = self._calculateFirstDigit(codeFrequency);\n\t if (firstDigit === null) {\n\t return null;\n\t }\n\t result.unshift(firstDigit);\n\t\n\t code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n\t if (code === null) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t\n\t for (i = 0; i < 6; i++) {\n\t code = self._decodeCode(code.end, self.CODE_G_START);\n\t if (!code) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t result.push(code.code);\n\t }\n\t\n\t return code;\n\t};\n\t\n\tEANReader.prototype._decode = function () {\n\t var startInfo,\n\t self = this,\n\t code,\n\t result = [],\n\t decodedCodes = [];\n\t\n\t startInfo = self._findStart();\n\t if (!startInfo) {\n\t return null;\n\t }\n\t code = {\n\t code: startInfo.code,\n\t start: startInfo.start,\n\t end: startInfo.end\n\t };\n\t decodedCodes.push(code);\n\t code = self._decodePayload(code, result, decodedCodes);\n\t if (!code) {\n\t return null;\n\t }\n\t code = self._findEnd(code.end, false);\n\t if (!code) {\n\t return null;\n\t }\n\t\n\t decodedCodes.push(code);\n\t\n\t // Checksum\n\t if (!self._checksum(result)) {\n\t return null;\n\t }\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: startInfo.start,\n\t end: code.end,\n\t codeset: \"\",\n\t startInfo: startInfo,\n\t decodedCodes: decodedCodes\n\t };\n\t};\n\t\n\tEANReader.prototype._checksum = function (result) {\n\t var sum = 0,\n\t i;\n\t\n\t for (i = result.length - 2; i >= 0; i -= 2) {\n\t sum += result[i];\n\t }\n\t sum *= 3;\n\t for (i = result.length - 1; i >= 0; i -= 2) {\n\t sum += result[i];\n\t }\n\t return sum % 10 === 0;\n\t};\n\t\n\texports[\"default\"] = EANReader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tvar _array_helper = __webpack_require__(19);\n\t\n\tvar _array_helper2 = _interopRequireDefault(_array_helper);\n\t\n\tfunction Code39Reader() {\n\t _barcode_reader2['default'].call(this);\n\t}\n\t\n\tvar properties = {\n\t ALPHABETH_STRING: { value: \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%\" },\n\t ALPHABET: { value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 45, 46, 32, 42, 36, 47, 43, 37] },\n\t CHARACTER_ENCODINGS: { value: [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A] },\n\t ASTERISK: { value: 0x094 },\n\t FORMAT: { value: \"code_39\", writeable: false }\n\t};\n\t\n\tCode39Reader.prototype = Object.create(_barcode_reader2['default'].prototype, properties);\n\tCode39Reader.prototype.constructor = Code39Reader;\n\t\n\tCode39Reader.prototype._toCounters = function (start, counter) {\n\t var self = this,\n\t numCounters = counter.length,\n\t end = self._row.length,\n\t isWhite = !self._row[start],\n\t i,\n\t counterPos = 0;\n\t\n\t _array_helper2['default'].init(counter, 0);\n\t\n\t for (i = start; i < end; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t counterPos++;\n\t if (counterPos === numCounters) {\n\t break;\n\t } else {\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t }\n\t\n\t return counter;\n\t};\n\t\n\tCode39Reader.prototype._decode = function () {\n\t var self = this,\n\t counters = [0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t result = [],\n\t start = self._findStart(),\n\t decodedChar,\n\t lastStart,\n\t pattern,\n\t nextStart;\n\t\n\t if (!start) {\n\t return null;\n\t }\n\t nextStart = self._nextSet(self._row, start.end);\n\t\n\t do {\n\t counters = self._toCounters(nextStart, counters);\n\t pattern = self._toPattern(counters);\n\t if (pattern < 0) {\n\t return null;\n\t }\n\t decodedChar = self._patternToChar(pattern);\n\t if (decodedChar < 0) {\n\t return null;\n\t }\n\t result.push(decodedChar);\n\t lastStart = nextStart;\n\t nextStart += _array_helper2['default'].sum(counters);\n\t nextStart = self._nextSet(self._row, nextStart);\n\t } while (decodedChar !== '*');\n\t result.pop();\n\t\n\t if (!result.length) {\n\t return null;\n\t }\n\t\n\t if (!self._verifyTrailingWhitespace(lastStart, nextStart, counters)) {\n\t return null;\n\t }\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: start.start,\n\t end: nextStart,\n\t startInfo: start,\n\t decodedCodes: result\n\t };\n\t};\n\t\n\tCode39Reader.prototype._verifyTrailingWhitespace = function (lastStart, nextStart, counters) {\n\t var trailingWhitespaceEnd,\n\t patternSize = _array_helper2['default'].sum(counters);\n\t\n\t trailingWhitespaceEnd = nextStart - lastStart - patternSize;\n\t if (trailingWhitespaceEnd * 3 >= patternSize) {\n\t return true;\n\t }\n\t return false;\n\t};\n\t\n\tCode39Reader.prototype._patternToChar = function (pattern) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n\t if (self.CHARACTER_ENCODINGS[i] === pattern) {\n\t return String.fromCharCode(self.ALPHABET[i]);\n\t }\n\t }\n\t};\n\t\n\tCode39Reader.prototype._findNextWidth = function (counters, current) {\n\t var i,\n\t minWidth = Number.MAX_VALUE;\n\t\n\t for (i = 0; i < counters.length; i++) {\n\t if (counters[i] < minWidth && counters[i] > current) {\n\t minWidth = counters[i];\n\t }\n\t }\n\t\n\t return minWidth;\n\t};\n\t\n\tCode39Reader.prototype._toPattern = function (counters) {\n\t var numCounters = counters.length,\n\t maxNarrowWidth = 0,\n\t numWideBars = numCounters,\n\t wideBarWidth = 0,\n\t self = this,\n\t pattern,\n\t i;\n\t\n\t while (numWideBars > 3) {\n\t maxNarrowWidth = self._findNextWidth(counters, maxNarrowWidth);\n\t numWideBars = 0;\n\t pattern = 0;\n\t for (i = 0; i < numCounters; i++) {\n\t if (counters[i] > maxNarrowWidth) {\n\t pattern |= 1 << numCounters - 1 - i;\n\t numWideBars++;\n\t wideBarWidth += counters[i];\n\t }\n\t }\n\t\n\t if (numWideBars === 3) {\n\t for (i = 0; i < numCounters && numWideBars > 0; i++) {\n\t if (counters[i] > maxNarrowWidth) {\n\t numWideBars--;\n\t if (counters[i] * 2 >= wideBarWidth) {\n\t return -1;\n\t }\n\t }\n\t }\n\t return pattern;\n\t }\n\t }\n\t return -1;\n\t};\n\t\n\tCode39Reader.prototype._findStart = function () {\n\t var self = this,\n\t offset = self._nextSet(self._row),\n\t patternStart = offset,\n\t counter = [0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t counterPos = 0,\n\t isWhite = false,\n\t i,\n\t j,\n\t whiteSpaceMustStart;\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t\n\t // find start pattern\n\t if (self._toPattern(counter) === self.ASTERISK) {\n\t whiteSpaceMustStart = Math.floor(Math.max(0, patternStart - (i - patternStart) / 4));\n\t if (self._matchRange(whiteSpaceMustStart, patternStart, 0)) {\n\t return {\n\t start: patternStart,\n\t end: i\n\t };\n\t }\n\t }\n\t\n\t patternStart += counter[0] + counter[1];\n\t for (j = 0; j < 7; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[7] = 0;\n\t counter[8] = 0;\n\t counterPos--;\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\texports['default'] = Code39Reader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _code_39_reader = __webpack_require__(30);\n\t\n\tvar _code_39_reader2 = _interopRequireDefault(_code_39_reader);\n\t\n\tfunction Code39VINReader() {\n\t _code_39_reader2['default'].call(this);\n\t}\n\t\n\tvar patterns = {\n\t IOQ: /[IOQ]/g,\n\t AZ09: /[A-Z0-9]{17}/\n\t};\n\t\n\tCode39VINReader.prototype = Object.create(_code_39_reader2['default'].prototype);\n\tCode39VINReader.prototype.constructor = Code39VINReader;\n\t\n\t// Cribbed from:\n\t// /~https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/VINResultParser.java\n\tCode39VINReader.prototype._decode = function () {\n\t var result = _code_39_reader2['default'].prototype._decode.apply(this);\n\t if (!result) {\n\t return null;\n\t }\n\t\n\t var code = result.code;\n\t\n\t if (!code) {\n\t return;\n\t }\n\t\n\t code = code.replace(patterns.IOQ, '');\n\t\n\t if (!code.match(patterns.AZ09)) {\n\t console.log('Failed AZ09 pattern code:', code);\n\t return null;\n\t }\n\t\n\t if (!this._checkChecksum(code)) {\n\t return null;\n\t }\n\t\n\t result.code = code;\n\t return result;\n\t};\n\t\n\tCode39VINReader.prototype._checkChecksum = function (code) {\n\t // TODO\n\t return !!code;\n\t};\n\t\n\texports['default'] = Code39VINReader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tfunction CodabarReader() {\n\t _barcode_reader2[\"default\"].call(this);\n\t this._counters = [];\n\t}\n\t\n\tvar properties = {\n\t ALPHABETH_STRING: { value: \"0123456789-$:/.+ABCD\" },\n\t ALPHABET: { value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 36, 58, 47, 46, 43, 65, 66, 67, 68] },\n\t CHARACTER_ENCODINGS: { value: [0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E] },\n\t START_END: { value: [0x01A, 0x029, 0x00B, 0x00E] },\n\t MIN_ENCODED_CHARS: { value: 4 },\n\t MAX_ACCEPTABLE: { value: 2.0 },\n\t PADDING: { value: 1.5 },\n\t FORMAT: { value: \"codabar\", writeable: false }\n\t};\n\t\n\tCodabarReader.prototype = Object.create(_barcode_reader2[\"default\"].prototype, properties);\n\tCodabarReader.prototype.constructor = CodabarReader;\n\t\n\tCodabarReader.prototype._decode = function () {\n\t var self = this,\n\t result = [],\n\t start,\n\t decodedChar,\n\t pattern,\n\t nextStart,\n\t end;\n\t\n\t this._counters = self._fillCounters();\n\t start = self._findStart();\n\t if (!start) {\n\t return null;\n\t }\n\t nextStart = start.startCounter;\n\t\n\t do {\n\t pattern = self._toPattern(nextStart);\n\t if (pattern < 0) {\n\t return null;\n\t }\n\t decodedChar = self._patternToChar(pattern);\n\t if (decodedChar < 0) {\n\t return null;\n\t }\n\t result.push(decodedChar);\n\t nextStart += 8;\n\t if (result.length > 1 && self._isStartEnd(pattern)) {\n\t break;\n\t }\n\t } while (nextStart < self._counters.length);\n\t\n\t // verify end\n\t if (result.length - 2 < self.MIN_ENCODED_CHARS || !self._isStartEnd(pattern)) {\n\t return null;\n\t }\n\t\n\t // verify end white space\n\t if (!self._verifyWhitespace(start.startCounter, nextStart - 8)) {\n\t return null;\n\t }\n\t\n\t if (!self._validateResult(result, start.startCounter)) {\n\t return null;\n\t }\n\t\n\t nextStart = nextStart > self._counters.length ? self._counters.length : nextStart;\n\t end = start.start + self._sumCounters(start.startCounter, nextStart - 8);\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: start.start,\n\t end: end,\n\t startInfo: start,\n\t decodedCodes: result\n\t };\n\t};\n\t\n\tCodabarReader.prototype._verifyWhitespace = function (startCounter, endCounter) {\n\t if (startCounter - 1 <= 0 || this._counters[startCounter - 1] >= this._calculatePatternLength(startCounter) / 2.0) {\n\t if (endCounter + 8 >= this._counters.length || this._counters[endCounter + 7] >= this._calculatePatternLength(endCounter) / 2.0) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t};\n\t\n\tCodabarReader.prototype._calculatePatternLength = function (offset) {\n\t var i,\n\t sum = 0;\n\t\n\t for (i = offset; i < offset + 7; i++) {\n\t sum += this._counters[i];\n\t }\n\t\n\t return sum;\n\t};\n\t\n\tCodabarReader.prototype._thresholdResultPattern = function (result, startCounter) {\n\t var self = this,\n\t categorization = {\n\t space: {\n\t narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE },\n\t wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE }\n\t },\n\t bar: {\n\t narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE },\n\t wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE }\n\t }\n\t },\n\t kind,\n\t cat,\n\t i,\n\t j,\n\t pos = startCounter,\n\t pattern;\n\t\n\t for (i = 0; i < result.length; i++) {\n\t pattern = self._charToPattern(result[i]);\n\t for (j = 6; j >= 0; j--) {\n\t kind = (j & 1) === 2 ? categorization.bar : categorization.space;\n\t cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n\t cat.size += self._counters[pos + j];\n\t cat.counts++;\n\t pattern >>= 1;\n\t }\n\t pos += 8;\n\t }\n\t\n\t [\"space\", \"bar\"].forEach(function (key) {\n\t var kind = categorization[key];\n\t kind.wide.min = Math.floor((kind.narrow.size / kind.narrow.counts + kind.wide.size / kind.wide.counts) / 2);\n\t kind.narrow.max = Math.ceil(kind.wide.min);\n\t kind.wide.max = Math.ceil((kind.wide.size * self.MAX_ACCEPTABLE + self.PADDING) / kind.wide.counts);\n\t });\n\t\n\t return categorization;\n\t};\n\t\n\tCodabarReader.prototype._charToPattern = function (char) {\n\t var self = this,\n\t charCode = char.charCodeAt(0),\n\t i;\n\t\n\t for (i = 0; i < self.ALPHABET.length; i++) {\n\t if (self.ALPHABET[i] === charCode) {\n\t return self.CHARACTER_ENCODINGS[i];\n\t }\n\t }\n\t return 0x0;\n\t};\n\t\n\tCodabarReader.prototype._validateResult = function (result, startCounter) {\n\t var self = this,\n\t thresholds = self._thresholdResultPattern(result, startCounter),\n\t i,\n\t j,\n\t kind,\n\t cat,\n\t size,\n\t pos = startCounter,\n\t pattern;\n\t\n\t for (i = 0; i < result.length; i++) {\n\t pattern = self._charToPattern(result[i]);\n\t for (j = 6; j >= 0; j--) {\n\t kind = (j & 1) === 0 ? thresholds.bar : thresholds.space;\n\t cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n\t size = self._counters[pos + j];\n\t if (size < cat.min || size > cat.max) {\n\t return false;\n\t }\n\t pattern >>= 1;\n\t }\n\t pos += 8;\n\t }\n\t return true;\n\t};\n\t\n\tCodabarReader.prototype._patternToChar = function (pattern) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n\t if (self.CHARACTER_ENCODINGS[i] === pattern) {\n\t return String.fromCharCode(self.ALPHABET[i]);\n\t }\n\t }\n\t return -1;\n\t};\n\t\n\tCodabarReader.prototype._computeAlternatingThreshold = function (offset, end) {\n\t var i,\n\t min = Number.MAX_VALUE,\n\t max = 0,\n\t counter;\n\t\n\t for (i = offset; i < end; i += 2) {\n\t counter = this._counters[i];\n\t if (counter > max) {\n\t max = counter;\n\t }\n\t if (counter < min) {\n\t min = counter;\n\t }\n\t }\n\t\n\t return (min + max) / 2.0 | 0;\n\t};\n\t\n\tCodabarReader.prototype._toPattern = function (offset) {\n\t var numCounters = 7,\n\t end = offset + numCounters,\n\t barThreshold,\n\t spaceThreshold,\n\t bitmask = 1 << numCounters - 1,\n\t pattern = 0,\n\t i,\n\t threshold;\n\t\n\t if (end > this._counters.length) {\n\t return -1;\n\t }\n\t\n\t barThreshold = this._computeAlternatingThreshold(offset, end);\n\t spaceThreshold = this._computeAlternatingThreshold(offset + 1, end);\n\t\n\t for (i = 0; i < numCounters; i++) {\n\t threshold = (i & 1) === 0 ? barThreshold : spaceThreshold;\n\t if (this._counters[offset + i] > threshold) {\n\t pattern |= bitmask;\n\t }\n\t bitmask >>= 1;\n\t }\n\t\n\t return pattern;\n\t};\n\t\n\tCodabarReader.prototype._isStartEnd = function (pattern) {\n\t var i;\n\t\n\t for (i = 0; i < this.START_END.length; i++) {\n\t if (this.START_END[i] === pattern) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t};\n\t\n\tCodabarReader.prototype._sumCounters = function (start, end) {\n\t var i,\n\t sum = 0;\n\t\n\t for (i = start; i < end; i++) {\n\t sum += this._counters[i];\n\t }\n\t return sum;\n\t};\n\t\n\tCodabarReader.prototype._findStart = function () {\n\t var self = this,\n\t i,\n\t pattern,\n\t start = self._nextUnset(self._row),\n\t end;\n\t\n\t for (i = 1; i < this._counters.length; i++) {\n\t pattern = self._toPattern(i);\n\t if (pattern !== -1 && self._isStartEnd(pattern)) {\n\t // TODO: Look for whitespace ahead\n\t start += self._sumCounters(0, i);\n\t end = start + self._sumCounters(i, i + 8);\n\t return {\n\t start: start,\n\t end: end,\n\t startCounter: i,\n\t endCounter: i + 8\n\t };\n\t }\n\t }\n\t};\n\t\n\texports[\"default\"] = CodabarReader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tfunction UPCReader() {\n\t _ean_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t FORMAT: { value: \"upc_a\", writeable: false }\n\t};\n\t\n\tUPCReader.prototype = Object.create(_ean_reader2[\"default\"].prototype, properties);\n\tUPCReader.prototype.constructor = UPCReader;\n\t\n\tUPCReader.prototype._decode = function () {\n\t var result = _ean_reader2[\"default\"].prototype._decode.call(this);\n\t\n\t if (result && result.code && result.code.length === 13 && result.code.charAt(0) === \"0\") {\n\t\n\t result.code = result.code.substring(1);\n\t return result;\n\t }\n\t return null;\n\t};\n\t\n\texports[\"default\"] = _ean_reader2[\"default\"];\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tfunction EAN8Reader() {\n\t _ean_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t FORMAT: { value: \"ean_8\", writeable: false }\n\t};\n\t\n\tEAN8Reader.prototype = Object.create(_ean_reader2[\"default\"].prototype, properties);\n\tEAN8Reader.prototype.constructor = EAN8Reader;\n\t\n\tEAN8Reader.prototype._decodePayload = function (code, result, decodedCodes) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < 4; i++) {\n\t code = self._decodeCode(code.end, self.CODE_G_START);\n\t if (!code) {\n\t return null;\n\t }\n\t result.push(code.code);\n\t decodedCodes.push(code);\n\t }\n\t\n\t code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n\t if (code === null) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t\n\t for (i = 0; i < 4; i++) {\n\t code = self._decodeCode(code.end, self.CODE_G_START);\n\t if (!code) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t result.push(code.code);\n\t }\n\t\n\t return code;\n\t};\n\t\n\texports[\"default\"] = EAN8Reader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tfunction UPCEReader() {\n\t _ean_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t CODE_FREQUENCY: { value: [[56, 52, 50, 49, 44, 38, 35, 42, 41, 37], [7, 11, 13, 14, 19, 25, 28, 21, 22, 26]] },\n\t STOP_PATTERN: { value: [1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7] },\n\t FORMAT: { value: \"upc_e\", writeable: false }\n\t};\n\t\n\tUPCEReader.prototype = Object.create(_ean_reader2[\"default\"].prototype, properties);\n\tUPCEReader.prototype.constructor = UPCEReader;\n\t\n\tUPCEReader.prototype._decodePayload = function (code, result, decodedCodes) {\n\t var i,\n\t self = this,\n\t codeFrequency = 0x0;\n\t\n\t for (i = 0; i < 6; i++) {\n\t code = self._decodeCode(code.end);\n\t if (!code) {\n\t return null;\n\t }\n\t if (code.code >= self.CODE_G_START) {\n\t code.code = code.code - self.CODE_G_START;\n\t codeFrequency |= 1 << 5 - i;\n\t }\n\t result.push(code.code);\n\t decodedCodes.push(code);\n\t }\n\t if (!self._determineParity(codeFrequency, result)) {\n\t return null;\n\t }\n\t\n\t return code;\n\t};\n\t\n\tUPCEReader.prototype._determineParity = function (codeFrequency, result) {\n\t var self = this,\n\t i,\n\t nrSystem;\n\t\n\t for (nrSystem = 0; nrSystem < self.CODE_FREQUENCY.length; nrSystem++) {\n\t for (i = 0; i < self.CODE_FREQUENCY[nrSystem].length; i++) {\n\t if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {\n\t result.unshift(nrSystem);\n\t result.push(i);\n\t return true;\n\t }\n\t }\n\t }\n\t return false;\n\t};\n\t\n\tUPCEReader.prototype._convertToUPCA = function (result) {\n\t var upca = [result[0]],\n\t lastDigit = result[result.length - 2];\n\t\n\t if (lastDigit <= 2) {\n\t upca = upca.concat(result.slice(1, 3)).concat([lastDigit, 0, 0, 0, 0]).concat(result.slice(3, 6));\n\t } else if (lastDigit === 3) {\n\t upca = upca.concat(result.slice(1, 4)).concat([0, 0, 0, 0, 0]).concat(result.slice(4, 6));\n\t } else if (lastDigit === 4) {\n\t upca = upca.concat(result.slice(1, 5)).concat([0, 0, 0, 0, 0, result[5]]);\n\t } else {\n\t upca = upca.concat(result.slice(1, 6)).concat([0, 0, 0, 0, lastDigit]);\n\t }\n\t\n\t upca.push(result[result.length - 1]);\n\t return upca;\n\t};\n\t\n\tUPCEReader.prototype._checksum = function (result) {\n\t return _ean_reader2[\"default\"].prototype._checksum.call(this, this._convertToUPCA(result));\n\t};\n\t\n\tUPCEReader.prototype._findEnd = function (offset, isWhite) {\n\t isWhite = true;\n\t return _ean_reader2[\"default\"].prototype._findEnd.call(this, offset, isWhite);\n\t};\n\t\n\tUPCEReader.prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t};\n\t\n\texports[\"default\"] = UPCEReader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tvar merge = __webpack_require__(37);\n\t\n\tfunction I2of5Reader(opts) {\n\t opts = merge(getDefaulConfig(), opts);\n\t _barcode_reader2['default'].call(this, opts);\n\t this.barSpaceRatio = [1, 1];\n\t if (opts.normalizeBarSpaceWidth) {\n\t this.SINGLE_CODE_ERROR = 0.38;\n\t this.AVG_CODE_ERROR = 0.09;\n\t }\n\t}\n\t\n\tfunction getDefaulConfig() {\n\t var config = {};\n\t\n\t Object.keys(I2of5Reader.CONFIG_KEYS).forEach(function (key) {\n\t config[key] = I2of5Reader.CONFIG_KEYS[key]['default'];\n\t });\n\t return config;\n\t}\n\t\n\tvar N = 1,\n\t W = 3,\n\t properties = {\n\t MODULO: { value: 10 },\n\t START_PATTERN: { value: [N * 2.5, N * 2.5, N * 2.5, N * 2.5] },\n\t STOP_PATTERN: { value: [N * 2, N * 2, W * 2] },\n\t CODE_PATTERN: { value: [[N, N, W, W, N], [W, N, N, N, W], [N, W, N, N, W], [W, W, N, N, N], [N, N, W, N, W], [W, N, W, N, N], [N, W, W, N, N], [N, N, N, W, W], [W, N, N, W, N], [N, W, N, W, N]] },\n\t SINGLE_CODE_ERROR: { value: 0.78, writable: true },\n\t AVG_CODE_ERROR: { value: 0.38, writable: true },\n\t MAX_CORRECTION_FACTOR: { value: 5 },\n\t FORMAT: { value: \"i2of5\" }\n\t};\n\t\n\tI2of5Reader.prototype = Object.create(_barcode_reader2['default'].prototype, properties);\n\tI2of5Reader.prototype.constructor = I2of5Reader;\n\t\n\tI2of5Reader.prototype._matchPattern = function (counter, code) {\n\t if (this.config.normalizeBarSpaceWidth) {\n\t var i,\n\t counterSum = [0, 0],\n\t codeSum = [0, 0],\n\t correction = [0, 0],\n\t correctionRatio = this.MAX_CORRECTION_FACTOR,\n\t correctionRatioInverse = 1 / correctionRatio;\n\t\n\t for (i = 0; i < counter.length; i++) {\n\t counterSum[i % 2] += counter[i];\n\t codeSum[i % 2] += code[i];\n\t }\n\t correction[0] = codeSum[0] / counterSum[0];\n\t correction[1] = codeSum[1] / counterSum[1];\n\t\n\t correction[0] = Math.max(Math.min(correction[0], correctionRatio), correctionRatioInverse);\n\t correction[1] = Math.max(Math.min(correction[1], correctionRatio), correctionRatioInverse);\n\t this.barSpaceRatio = correction;\n\t for (i = 0; i < counter.length; i++) {\n\t counter[i] *= this.barSpaceRatio[i % 2];\n\t }\n\t }\n\t return _barcode_reader2['default'].prototype._matchPattern.call(this, counter, code);\n\t};\n\t\n\tI2of5Reader.prototype._findPattern = function (pattern, offset, isWhite, tryHarder) {\n\t var counter = [],\n\t self = this,\n\t i,\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t },\n\t error,\n\t j,\n\t sum,\n\t normalized,\n\t epsilon = self.AVG_CODE_ERROR;\n\t\n\t isWhite = isWhite || false;\n\t tryHarder = tryHarder || false;\n\t\n\t if (!offset) {\n\t offset = self._nextSet(self._row);\n\t }\n\t\n\t for (i = 0; i < pattern.length; i++) {\n\t counter[i] = 0;\n\t }\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t sum = 0;\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t error = self._matchPattern(normalized, pattern);\n\t\n\t if (error < epsilon) {\n\t bestMatch.error = error;\n\t bestMatch.start = i - sum;\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t }\n\t if (tryHarder) {\n\t for (j = 0; j < counter.length - 2; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[counter.length - 2] = 0;\n\t counter[counter.length - 1] = 0;\n\t counterPos--;\n\t } else {\n\t return null;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tI2of5Reader.prototype._findStart = function () {\n\t var self = this,\n\t leadingWhitespaceStart,\n\t offset = self._nextSet(self._row),\n\t startInfo,\n\t narrowBarWidth = 1;\n\t\n\t while (!startInfo) {\n\t startInfo = self._findPattern(self.START_PATTERN, offset, false, true);\n\t if (!startInfo) {\n\t return null;\n\t }\n\t narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / 4);\n\t leadingWhitespaceStart = startInfo.start - narrowBarWidth * 10;\n\t if (leadingWhitespaceStart >= 0) {\n\t if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n\t return startInfo;\n\t }\n\t }\n\t offset = startInfo.end;\n\t startInfo = null;\n\t }\n\t};\n\t\n\tI2of5Reader.prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tI2of5Reader.prototype._findEnd = function () {\n\t var self = this,\n\t endInfo,\n\t tmp;\n\t\n\t self._row.reverse();\n\t endInfo = self._findPattern(self.STOP_PATTERN);\n\t self._row.reverse();\n\t\n\t if (endInfo === null) {\n\t return null;\n\t }\n\t\n\t // reverse numbers\n\t tmp = endInfo.start;\n\t endInfo.start = self._row.length - endInfo.end;\n\t endInfo.end = self._row.length - tmp;\n\t\n\t return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n\t};\n\t\n\tI2of5Reader.prototype._decodePair = function (counterPair) {\n\t var i,\n\t code,\n\t codes = [],\n\t self = this;\n\t\n\t for (i = 0; i < counterPair.length; i++) {\n\t code = self._decodeCode(counterPair[i]);\n\t if (!code) {\n\t return null;\n\t }\n\t codes.push(code);\n\t }\n\t return codes;\n\t};\n\t\n\tI2of5Reader.prototype._decodeCode = function (counter) {\n\t var j,\n\t self = this,\n\t sum = 0,\n\t normalized,\n\t error,\n\t epsilon = self.AVG_CODE_ERROR,\n\t code,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t };\n\t\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = 0; code < self.CODE_PATTERN.length; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t if (bestMatch.error < epsilon) {\n\t return bestMatch;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tI2of5Reader.prototype._decodePayload = function (counters, result, decodedCodes) {\n\t var i,\n\t self = this,\n\t pos = 0,\n\t counterLength = counters.length,\n\t counterPair = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],\n\t codes;\n\t\n\t while (pos < counterLength) {\n\t for (i = 0; i < 5; i++) {\n\t counterPair[0][i] = counters[pos] * this.barSpaceRatio[0];\n\t counterPair[1][i] = counters[pos + 1] * this.barSpaceRatio[1];\n\t pos += 2;\n\t }\n\t codes = self._decodePair(counterPair);\n\t if (!codes) {\n\t return null;\n\t }\n\t for (i = 0; i < codes.length; i++) {\n\t result.push(codes[i].code + \"\");\n\t decodedCodes.push(codes[i]);\n\t }\n\t }\n\t return codes;\n\t};\n\t\n\tI2of5Reader.prototype._verifyCounterLength = function (counters) {\n\t return counters.length % 10 === 0;\n\t};\n\t\n\tI2of5Reader.prototype._decode = function () {\n\t var startInfo,\n\t endInfo,\n\t self = this,\n\t code,\n\t result = [],\n\t decodedCodes = [],\n\t counters;\n\t\n\t startInfo = self._findStart();\n\t if (!startInfo) {\n\t return null;\n\t }\n\t decodedCodes.push(startInfo);\n\t\n\t endInfo = self._findEnd();\n\t if (!endInfo) {\n\t return null;\n\t }\n\t\n\t counters = self._fillCounters(startInfo.end, endInfo.start, false);\n\t if (!self._verifyCounterLength(counters)) {\n\t return null;\n\t }\n\t code = self._decodePayload(counters, result, decodedCodes);\n\t if (!code) {\n\t return null;\n\t }\n\t if (result.length % 2 !== 0 || result.length < 6) {\n\t return null;\n\t }\n\t\n\t decodedCodes.push(endInfo);\n\t return {\n\t code: result.join(\"\"),\n\t start: startInfo.start,\n\t end: endInfo.end,\n\t startInfo: startInfo,\n\t decodedCodes: decodedCodes\n\t };\n\t};\n\t\n\tI2of5Reader.CONFIG_KEYS = {\n\t normalizeBarSpaceWidth: {\n\t 'type': 'boolean',\n\t 'default': false,\n\t 'description': 'If true, the reader tries to normalize the' + 'width-difference between bars and spaces'\n\t }\n\t};\n\t\n\texports['default'] = I2of5Reader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseMerge = __webpack_require__(38),\n\t createAssigner = __webpack_require__(65);\n\t\n\t/**\n\t * Recursively merges own enumerable properties of the source object(s), that\n\t * don't resolve to `undefined` into the destination object. Subsequent sources\n\t * overwrite property assignments of previous sources. If `customizer` is\n\t * provided it's invoked to produce the merged values of the destination and\n\t * source properties. If `customizer` returns `undefined` merging is handled\n\t * by the method instead. The `customizer` is bound to `thisArg` and invoked\n\t * with five arguments: (objectValue, sourceValue, key, object, source).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The destination object.\n\t * @param {...Object} [sources] The source objects.\n\t * @param {Function} [customizer] The function to customize assigned values.\n\t * @param {*} [thisArg] The `this` binding of `customizer`.\n\t * @returns {Object} Returns `object`.\n\t * @example\n\t *\n\t * var users = {\n\t * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n\t * };\n\t *\n\t * var ages = {\n\t * 'data': [{ 'age': 36 }, { 'age': 40 }]\n\t * };\n\t *\n\t * _.merge(users, ages);\n\t * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n\t *\n\t * // using a customizer callback\n\t * var object = {\n\t * 'fruits': ['apple'],\n\t * 'vegetables': ['beet']\n\t * };\n\t *\n\t * var other = {\n\t * 'fruits': ['banana'],\n\t * 'vegetables': ['carrot']\n\t * };\n\t *\n\t * _.merge(object, other, function(a, b) {\n\t * if (_.isArray(a)) {\n\t * return a.concat(b);\n\t * }\n\t * });\n\t * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n\t */\n\tvar merge = createAssigner(baseMerge);\n\t\n\tmodule.exports = merge;\n\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar arrayEach = __webpack_require__(39),\n\t baseMergeDeep = __webpack_require__(40),\n\t isArray = __webpack_require__(48),\n\t isArrayLike = __webpack_require__(43),\n\t isObject = __webpack_require__(52),\n\t isObjectLike = __webpack_require__(47),\n\t isTypedArray = __webpack_require__(60),\n\t keys = __webpack_require__(63);\n\t\n\t/**\n\t * The base implementation of `_.merge` without support for argument juggling,\n\t * multiple sources, and `this` binding `customizer` functions.\n\t *\n\t * @private\n\t * @param {Object} object The destination object.\n\t * @param {Object} source The source object.\n\t * @param {Function} [customizer] The function to customize merged values.\n\t * @param {Array} [stackA=[]] Tracks traversed source objects.\n\t * @param {Array} [stackB=[]] Associates values with source counterparts.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction baseMerge(object, source, customizer, stackA, stackB) {\n\t if (!isObject(object)) {\n\t return object;\n\t }\n\t var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n\t props = isSrcArr ? undefined : keys(source);\n\t\n\t arrayEach(props || source, function(srcValue, key) {\n\t if (props) {\n\t key = srcValue;\n\t srcValue = source[key];\n\t }\n\t if (isObjectLike(srcValue)) {\n\t stackA || (stackA = []);\n\t stackB || (stackB = []);\n\t baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n\t }\n\t else {\n\t var value = object[key],\n\t result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n\t isCommon = result === undefined;\n\t\n\t if (isCommon) {\n\t result = srcValue;\n\t }\n\t if ((result !== undefined || (isSrcArr && !(key in object))) &&\n\t (isCommon || (result === result ? (result !== value) : (value === value)))) {\n\t object[key] = result;\n\t }\n\t }\n\t });\n\t return object;\n\t}\n\t\n\tmodule.exports = baseMerge;\n\n\n/***/ },\n/* 39 */\n/***/ function(module, exports) {\n\n\t/**\n\t * A specialized version of `_.forEach` for arrays without support for callback\n\t * shorthands and `this` binding.\n\t *\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Array} Returns `array`.\n\t */\n\tfunction arrayEach(array, iteratee) {\n\t var index = -1,\n\t length = array.length;\n\t\n\t while (++index < length) {\n\t if (iteratee(array[index], index, array) === false) {\n\t break;\n\t }\n\t }\n\t return array;\n\t}\n\t\n\tmodule.exports = arrayEach;\n\n\n/***/ },\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar arrayCopy = __webpack_require__(41),\n\t isArguments = __webpack_require__(42),\n\t isArray = __webpack_require__(48),\n\t isArrayLike = __webpack_require__(43),\n\t isPlainObject = __webpack_require__(53),\n\t isTypedArray = __webpack_require__(60),\n\t toPlainObject = __webpack_require__(61);\n\t\n\t/**\n\t * A specialized version of `baseMerge` for arrays and objects which performs\n\t * deep merges and tracks traversed objects enabling objects with circular\n\t * references to be merged.\n\t *\n\t * @private\n\t * @param {Object} object The destination object.\n\t * @param {Object} source The source object.\n\t * @param {string} key The key of the value to merge.\n\t * @param {Function} mergeFunc The function to merge values.\n\t * @param {Function} [customizer] The function to customize merged values.\n\t * @param {Array} [stackA=[]] Tracks traversed source objects.\n\t * @param {Array} [stackB=[]] Associates values with source counterparts.\n\t * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n\t */\n\tfunction baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n\t var length = stackA.length,\n\t srcValue = source[key];\n\t\n\t while (length--) {\n\t if (stackA[length] == srcValue) {\n\t object[key] = stackB[length];\n\t return;\n\t }\n\t }\n\t var value = object[key],\n\t result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n\t isCommon = result === undefined;\n\t\n\t if (isCommon) {\n\t result = srcValue;\n\t if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n\t result = isArray(value)\n\t ? value\n\t : (isArrayLike(value) ? arrayCopy(value) : []);\n\t }\n\t else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n\t result = isArguments(value)\n\t ? toPlainObject(value)\n\t : (isPlainObject(value) ? value : {});\n\t }\n\t else {\n\t isCommon = false;\n\t }\n\t }\n\t // Add the source value to the stack of traversed objects and associate\n\t // it with its merged value.\n\t stackA.push(srcValue);\n\t stackB.push(result);\n\t\n\t if (isCommon) {\n\t // Recursively merge objects and arrays (susceptible to call stack limits).\n\t object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n\t } else if (result === result ? (result !== value) : (value === value)) {\n\t object[key] = result;\n\t }\n\t}\n\t\n\tmodule.exports = baseMergeDeep;\n\n\n/***/ },\n/* 41 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Copies the values of `source` to `array`.\n\t *\n\t * @private\n\t * @param {Array} source The array to copy values from.\n\t * @param {Array} [array=[]] The array to copy values to.\n\t * @returns {Array} Returns `array`.\n\t */\n\tfunction arrayCopy(source, array) {\n\t var index = -1,\n\t length = source.length;\n\t\n\t array || (array = Array(length));\n\t while (++index < length) {\n\t array[index] = source[index];\n\t }\n\t return array;\n\t}\n\t\n\tmodule.exports = arrayCopy;\n\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArrayLike = __webpack_require__(43),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/** Native method references. */\n\tvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\t\n\t/**\n\t * Checks if `value` is classified as an `arguments` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArguments(function() { return arguments; }());\n\t * // => true\n\t *\n\t * _.isArguments([1, 2, 3]);\n\t * // => false\n\t */\n\tfunction isArguments(value) {\n\t return isObjectLike(value) && isArrayLike(value) &&\n\t hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n\t}\n\t\n\tmodule.exports = isArguments;\n\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar getLength = __webpack_require__(44),\n\t isLength = __webpack_require__(46);\n\t\n\t/**\n\t * Checks if `value` is array-like.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null && isLength(getLength(value));\n\t}\n\t\n\tmodule.exports = isArrayLike;\n\n\n/***/ },\n/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseProperty = __webpack_require__(45);\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\tmodule.exports = getLength;\n\n\n/***/ },\n/* 45 */\n/***/ function(module, exports) {\n\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\tmodule.exports = baseProperty;\n\n\n/***/ },\n/* 46 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n\t * of an array-like value.\n\t */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\tmodule.exports = isLength;\n\n\n/***/ },\n/* 47 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Checks if `value` is object-like.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n\t */\n\tfunction isObjectLike(value) {\n\t return !!value && typeof value == 'object';\n\t}\n\t\n\tmodule.exports = isObjectLike;\n\n\n/***/ },\n/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar getNative = __webpack_require__(49),\n\t isLength = __webpack_require__(46),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** `Object#toString` result references. */\n\tvar arrayTag = '[object Array]';\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/* Native method references for those with the same name as other `lodash` methods. */\n\tvar nativeIsArray = getNative(Array, 'isArray');\n\t\n\t/**\n\t * Checks if `value` is classified as an `Array` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArray([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArray(function() { return arguments; }());\n\t * // => false\n\t */\n\tvar isArray = nativeIsArray || function(value) {\n\t return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n\t};\n\t\n\tmodule.exports = isArray;\n\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isNative = __webpack_require__(50);\n\t\n\t/**\n\t * Gets the native function at `key` of `object`.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {string} key The key of the method to get.\n\t * @returns {*} Returns the function if it's native, else `undefined`.\n\t */\n\tfunction getNative(object, key) {\n\t var value = object == null ? undefined : object[key];\n\t return isNative(value) ? value : undefined;\n\t}\n\t\n\tmodule.exports = getNative;\n\n\n/***/ },\n/* 50 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isFunction = __webpack_require__(51),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** Used to detect host constructors (Safari > 5). */\n\tvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to resolve the decompiled source of functions. */\n\tvar fnToString = Function.prototype.toString;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/** Used to detect if a method is native. */\n\tvar reIsNative = RegExp('^' +\n\t fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n\t .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n\t);\n\t\n\t/**\n\t * Checks if `value` is a native function.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n\t * @example\n\t *\n\t * _.isNative(Array.prototype.push);\n\t * // => true\n\t *\n\t * _.isNative(_);\n\t * // => false\n\t */\n\tfunction isNative(value) {\n\t if (value == null) {\n\t return false;\n\t }\n\t if (isFunction(value)) {\n\t return reIsNative.test(fnToString.call(value));\n\t }\n\t return isObjectLike(value) && reIsHostCtor.test(value);\n\t}\n\t\n\tmodule.exports = isNative;\n\n\n/***/ },\n/* 51 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isObject = __webpack_require__(52);\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]';\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in older versions of Chrome and Safari which return 'function' for regexes\n\t // and Safari 8 which returns 'object' for typed array constructors.\n\t return isObject(value) && objToString.call(value) == funcTag;\n\t}\n\t\n\tmodule.exports = isFunction;\n\n\n/***/ },\n/* 52 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(1);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t // Avoid a V8 JIT bug in Chrome 19-20.\n\t // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\tmodule.exports = isObject;\n\n\n/***/ },\n/* 53 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseForIn = __webpack_require__(54),\n\t isArguments = __webpack_require__(42),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** `Object#toString` result references. */\n\tvar objectTag = '[object Object]';\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/**\n\t * Checks if `value` is a plain object, that is, an object created by the\n\t * `Object` constructor or one with a `[[Prototype]]` of `null`.\n\t *\n\t * **Note:** This method assumes objects created by the `Object` constructor\n\t * have no inherited enumerable properties.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * }\n\t *\n\t * _.isPlainObject(new Foo);\n\t * // => false\n\t *\n\t * _.isPlainObject([1, 2, 3]);\n\t * // => false\n\t *\n\t * _.isPlainObject({ 'x': 0, 'y': 0 });\n\t * // => true\n\t *\n\t * _.isPlainObject(Object.create(null));\n\t * // => true\n\t */\n\tfunction isPlainObject(value) {\n\t var Ctor;\n\t\n\t // Exit early for non `Object` objects.\n\t if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n\t (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n\t return false;\n\t }\n\t // IE < 9 iterates inherited properties before own properties. If the first\n\t // iterated property is an object's own property then there are no inherited\n\t // enumerable properties.\n\t var result;\n\t // In most environments an object's own properties are iterated before\n\t // its inherited properties. If the last iterated property is an object's\n\t // own property then there are no inherited enumerable properties.\n\t baseForIn(value, function(subValue, key) {\n\t result = key;\n\t });\n\t return result === undefined || hasOwnProperty.call(value, result);\n\t}\n\t\n\tmodule.exports = isPlainObject;\n\n\n/***/ },\n/* 54 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseFor = __webpack_require__(55),\n\t keysIn = __webpack_require__(58);\n\t\n\t/**\n\t * The base implementation of `_.forIn` without support for callback\n\t * shorthands and `this` binding.\n\t *\n\t * @private\n\t * @param {Object} object The object to iterate over.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction baseForIn(object, iteratee) {\n\t return baseFor(object, iteratee, keysIn);\n\t}\n\t\n\tmodule.exports = baseForIn;\n\n\n/***/ },\n/* 55 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar createBaseFor = __webpack_require__(56);\n\t\n\t/**\n\t * The base implementation of `baseForIn` and `baseForOwn` which iterates\n\t * over `object` properties returned by `keysFunc` invoking `iteratee` for\n\t * each property. Iteratee functions may exit iteration early by explicitly\n\t * returning `false`.\n\t *\n\t * @private\n\t * @param {Object} object The object to iterate over.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @param {Function} keysFunc The function to get the keys of `object`.\n\t * @returns {Object} Returns `object`.\n\t */\n\tvar baseFor = createBaseFor();\n\t\n\tmodule.exports = baseFor;\n\n\n/***/ },\n/* 56 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toObject = __webpack_require__(57);\n\t\n\t/**\n\t * Creates a base function for `_.forIn` or `_.forInRight`.\n\t *\n\t * @private\n\t * @param {boolean} [fromRight] Specify iterating from right to left.\n\t * @returns {Function} Returns the new base function.\n\t */\n\tfunction createBaseFor(fromRight) {\n\t return function(object, iteratee, keysFunc) {\n\t var iterable = toObject(object),\n\t props = keysFunc(object),\n\t length = props.length,\n\t index = fromRight ? length : -1;\n\t\n\t while ((fromRight ? index-- : ++index < length)) {\n\t var key = props[index];\n\t if (iteratee(iterable[key], key, iterable) === false) {\n\t break;\n\t }\n\t }\n\t return object;\n\t };\n\t}\n\t\n\tmodule.exports = createBaseFor;\n\n\n/***/ },\n/* 57 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isObject = __webpack_require__(52);\n\t\n\t/**\n\t * Converts `value` to an object if it's not one.\n\t *\n\t * @private\n\t * @param {*} value The value to process.\n\t * @returns {Object} Returns the object.\n\t */\n\tfunction toObject(value) {\n\t return isObject(value) ? value : Object(value);\n\t}\n\t\n\tmodule.exports = toObject;\n\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArguments = __webpack_require__(42),\n\t isArray = __webpack_require__(48),\n\t isIndex = __webpack_require__(59),\n\t isLength = __webpack_require__(46),\n\t isObject = __webpack_require__(52);\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Creates an array of the own and inherited enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keysIn(new Foo);\n\t * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n\t */\n\tfunction keysIn(object) {\n\t if (object == null) {\n\t return [];\n\t }\n\t if (!isObject(object)) {\n\t object = Object(object);\n\t }\n\t var length = object.length;\n\t length = (length && isLength(length) &&\n\t (isArray(object) || isArguments(object)) && length) || 0;\n\t\n\t var Ctor = object.constructor,\n\t index = -1,\n\t isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n\t result = Array(length),\n\t skipIndexes = length > 0;\n\t\n\t while (++index < length) {\n\t result[index] = (index + '');\n\t }\n\t for (var key in object) {\n\t if (!(skipIndexes && isIndex(key, length)) &&\n\t !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = keysIn;\n\n\n/***/ },\n/* 59 */\n/***/ function(module, exports) {\n\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^\\d+$/;\n\t\n\t/**\n\t * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n\t * of an array-like value.\n\t */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\tmodule.exports = isIndex;\n\n\n/***/ },\n/* 60 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isLength = __webpack_require__(46),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** `Object#toString` result references. */\n\tvar argsTag = '[object Arguments]',\n\t arrayTag = '[object Array]',\n\t boolTag = '[object Boolean]',\n\t dateTag = '[object Date]',\n\t errorTag = '[object Error]',\n\t funcTag = '[object Function]',\n\t mapTag = '[object Map]',\n\t numberTag = '[object Number]',\n\t objectTag = '[object Object]',\n\t regexpTag = '[object RegExp]',\n\t setTag = '[object Set]',\n\t stringTag = '[object String]',\n\t weakMapTag = '[object WeakMap]';\n\t\n\tvar arrayBufferTag = '[object ArrayBuffer]',\n\t float32Tag = '[object Float32Array]',\n\t float64Tag = '[object Float64Array]',\n\t int8Tag = '[object Int8Array]',\n\t int16Tag = '[object Int16Array]',\n\t int32Tag = '[object Int32Array]',\n\t uint8Tag = '[object Uint8Array]',\n\t uint8ClampedTag = '[object Uint8ClampedArray]',\n\t uint16Tag = '[object Uint16Array]',\n\t uint32Tag = '[object Uint32Array]';\n\t\n\t/** Used to identify `toStringTag` values of typed arrays. */\n\tvar typedArrayTags = {};\n\ttypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n\ttypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n\ttypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n\ttypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n\ttypedArrayTags[uint32Tag] = true;\n\ttypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n\ttypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n\ttypedArrayTags[dateTag] = typedArrayTags[errorTag] =\n\ttypedArrayTags[funcTag] = typedArrayTags[mapTag] =\n\ttypedArrayTags[numberTag] = typedArrayTags[objectTag] =\n\ttypedArrayTags[regexpTag] = typedArrayTags[setTag] =\n\ttypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/**\n\t * Checks if `value` is classified as a typed array.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isTypedArray(new Uint8Array);\n\t * // => true\n\t *\n\t * _.isTypedArray([]);\n\t * // => false\n\t */\n\tfunction isTypedArray(value) {\n\t return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n\t}\n\t\n\tmodule.exports = isTypedArray;\n\n\n/***/ },\n/* 61 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseCopy = __webpack_require__(62),\n\t keysIn = __webpack_require__(58);\n\t\n\t/**\n\t * Converts `value` to a plain object flattening inherited enumerable\n\t * properties of `value` to own properties of the plain object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to convert.\n\t * @returns {Object} Returns the converted plain object.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.assign({ 'a': 1 }, new Foo);\n\t * // => { 'a': 1, 'b': 2 }\n\t *\n\t * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n\t * // => { 'a': 1, 'b': 2, 'c': 3 }\n\t */\n\tfunction toPlainObject(value) {\n\t return baseCopy(value, keysIn(value));\n\t}\n\t\n\tmodule.exports = toPlainObject;\n\n\n/***/ },\n/* 62 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Copies properties of `source` to `object`.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction baseCopy(source, props, object) {\n\t object || (object = {});\n\t\n\t var index = -1,\n\t length = props.length;\n\t\n\t while (++index < length) {\n\t var key = props[index];\n\t object[key] = source[key];\n\t }\n\t return object;\n\t}\n\t\n\tmodule.exports = baseCopy;\n\n\n/***/ },\n/* 63 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar getNative = __webpack_require__(49),\n\t isArrayLike = __webpack_require__(43),\n\t isObject = __webpack_require__(52),\n\t shimKeys = __webpack_require__(64);\n\t\n\t/* Native method references for those with the same name as other `lodash` methods. */\n\tvar nativeKeys = getNative(Object, 'keys');\n\t\n\t/**\n\t * Creates an array of the own enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects. See the\n\t * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n\t * for more details.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keys(new Foo);\n\t * // => ['a', 'b'] (iteration order is not guaranteed)\n\t *\n\t * _.keys('hi');\n\t * // => ['0', '1']\n\t */\n\tvar keys = !nativeKeys ? shimKeys : function(object) {\n\t var Ctor = object == null ? undefined : object.constructor;\n\t if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n\t (typeof object != 'function' && isArrayLike(object))) {\n\t return shimKeys(object);\n\t }\n\t return isObject(object) ? nativeKeys(object) : [];\n\t};\n\t\n\tmodule.exports = keys;\n\n\n/***/ },\n/* 64 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArguments = __webpack_require__(42),\n\t isArray = __webpack_require__(48),\n\t isIndex = __webpack_require__(59),\n\t isLength = __webpack_require__(46),\n\t keysIn = __webpack_require__(58);\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * A fallback implementation of `Object.keys` which creates an array of the\n\t * own enumerable property names of `object`.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t */\n\tfunction shimKeys(object) {\n\t var props = keysIn(object),\n\t propsLength = props.length,\n\t length = propsLength && object.length;\n\t\n\t var allowIndexes = !!length && isLength(length) &&\n\t (isArray(object) || isArguments(object));\n\t\n\t var index = -1,\n\t result = [];\n\t\n\t while (++index < propsLength) {\n\t var key = props[index];\n\t if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = shimKeys;\n\n\n/***/ },\n/* 65 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar bindCallback = __webpack_require__(66),\n\t isIterateeCall = __webpack_require__(68),\n\t restParam = __webpack_require__(69);\n\t\n\t/**\n\t * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n\t *\n\t * @private\n\t * @param {Function} assigner The function to assign values.\n\t * @returns {Function} Returns the new assigner function.\n\t */\n\tfunction createAssigner(assigner) {\n\t return restParam(function(object, sources) {\n\t var index = -1,\n\t length = object == null ? 0 : sources.length,\n\t customizer = length > 2 ? sources[length - 2] : undefined,\n\t guard = length > 2 ? sources[2] : undefined,\n\t thisArg = length > 1 ? sources[length - 1] : undefined;\n\t\n\t if (typeof customizer == 'function') {\n\t customizer = bindCallback(customizer, thisArg, 5);\n\t length -= 2;\n\t } else {\n\t customizer = typeof thisArg == 'function' ? thisArg : undefined;\n\t length -= (customizer ? 1 : 0);\n\t }\n\t if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n\t customizer = length < 3 ? undefined : customizer;\n\t length = 1;\n\t }\n\t while (++index < length) {\n\t var source = sources[index];\n\t if (source) {\n\t assigner(object, source, customizer);\n\t }\n\t }\n\t return object;\n\t });\n\t}\n\t\n\tmodule.exports = createAssigner;\n\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar identity = __webpack_require__(67);\n\t\n\t/**\n\t * A specialized version of `baseCallback` which only supports `this` binding\n\t * and specifying the number of arguments to provide to `func`.\n\t *\n\t * @private\n\t * @param {Function} func The function to bind.\n\t * @param {*} thisArg The `this` binding of `func`.\n\t * @param {number} [argCount] The number of arguments to provide to `func`.\n\t * @returns {Function} Returns the callback.\n\t */\n\tfunction bindCallback(func, thisArg, argCount) {\n\t if (typeof func != 'function') {\n\t return identity;\n\t }\n\t if (thisArg === undefined) {\n\t return func;\n\t }\n\t switch (argCount) {\n\t case 1: return function(value) {\n\t return func.call(thisArg, value);\n\t };\n\t case 3: return function(value, index, collection) {\n\t return func.call(thisArg, value, index, collection);\n\t };\n\t case 4: return function(accumulator, value, index, collection) {\n\t return func.call(thisArg, accumulator, value, index, collection);\n\t };\n\t case 5: return function(value, other, key, object, source) {\n\t return func.call(thisArg, value, other, key, object, source);\n\t };\n\t }\n\t return function() {\n\t return func.apply(thisArg, arguments);\n\t };\n\t}\n\t\n\tmodule.exports = bindCallback;\n\n\n/***/ },\n/* 67 */\n/***/ function(module, exports) {\n\n\t/**\n\t * This method returns the first argument provided to it.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Utility\n\t * @param {*} value Any value.\n\t * @returns {*} Returns `value`.\n\t * @example\n\t *\n\t * var object = { 'user': 'fred' };\n\t *\n\t * _.identity(object) === object;\n\t * // => true\n\t */\n\tfunction identity(value) {\n\t return value;\n\t}\n\t\n\tmodule.exports = identity;\n\n\n/***/ },\n/* 68 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArrayLike = __webpack_require__(43),\n\t isIndex = __webpack_require__(59),\n\t isObject = __webpack_require__(52);\n\t\n\t/**\n\t * Checks if the provided arguments are from an iteratee call.\n\t *\n\t * @private\n\t * @param {*} value The potential iteratee value argument.\n\t * @param {*} index The potential iteratee index or key argument.\n\t * @param {*} object The potential iteratee object argument.\n\t * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n\t */\n\tfunction isIterateeCall(value, index, object) {\n\t if (!isObject(object)) {\n\t return false;\n\t }\n\t var type = typeof index;\n\t if (type == 'number'\n\t ? (isArrayLike(object) && isIndex(index, object.length))\n\t : (type == 'string' && index in object)) {\n\t var other = object[index];\n\t return value === value ? (value === other) : (other !== other);\n\t }\n\t return false;\n\t}\n\t\n\tmodule.exports = isIterateeCall;\n\n\n/***/ },\n/* 69 */\n/***/ function(module, exports) {\n\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/* Native method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Creates a function that invokes `func` with the `this` binding of the\n\t * created function and arguments from `start` and beyond provided as an array.\n\t *\n\t * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to apply a rest parameter to.\n\t * @param {number} [start=func.length-1] The start position of the rest parameter.\n\t * @returns {Function} Returns the new function.\n\t * @example\n\t *\n\t * var say = _.restParam(function(what, names) {\n\t * return what + ' ' + _.initial(names).join(', ') +\n\t * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n\t * });\n\t *\n\t * say('hello', 'fred', 'barney', 'pebbles');\n\t * // => 'hello fred, barney, & pebbles'\n\t */\n\tfunction restParam(func, start) {\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n\t return function() {\n\t var args = arguments,\n\t index = -1,\n\t length = nativeMax(args.length - start, 0),\n\t rest = Array(length);\n\t\n\t while (++index < length) {\n\t rest[index] = args[start + index];\n\t }\n\t switch (start) {\n\t case 0: return func.call(this, rest);\n\t case 1: return func.call(this, args[0], rest);\n\t case 2: return func.call(this, args[0], args[1], rest);\n\t }\n\t var otherArgs = Array(start + 1);\n\t index = -1;\n\t while (++index < start) {\n\t otherArgs[index] = args[index];\n\t }\n\t otherArgs[start] = rest;\n\t return func.apply(this, otherArgs);\n\t };\n\t}\n\t\n\tmodule.exports = restParam;\n\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _cv_utils = __webpack_require__(7);\n\t\n\tvar _cv_utils2 = _interopRequireDefault(_cv_utils);\n\t\n\tvar FrameGrabber = {};\n\t\n\tFrameGrabber.create = function (inputStream, canvas) {\n\t var _that = {},\n\t _streamConfig = inputStream.getConfig(),\n\t _video_size = _cv_utils2[\"default\"].imageRef(inputStream.getRealWidth(), inputStream.getRealHeight()),\n\t _canvasSize = inputStream.getCanvasSize(),\n\t _size = _cv_utils2[\"default\"].imageRef(inputStream.getWidth(), inputStream.getHeight()),\n\t topRight = inputStream.getTopRight(),\n\t _sx = topRight.x,\n\t _sy = topRight.y,\n\t _canvas,\n\t _ctx = null,\n\t _data = null;\n\t\n\t _canvas = canvas ? canvas : document.createElement(\"canvas\");\n\t _canvas.width = _canvasSize.x;\n\t _canvas.height = _canvasSize.y;\n\t _ctx = _canvas.getContext(\"2d\");\n\t _data = new Uint8Array(_size.x * _size.y);\n\t console.log(\"FrameGrabber\", JSON.stringify({\n\t size: _size,\n\t topRight: topRight,\n\t videoSize: _video_size,\n\t canvasSize: _canvasSize\n\t }));\n\t\n\t /**\n\t * Uses the given array as frame-buffer\n\t */\n\t _that.attachData = function (data) {\n\t _data = data;\n\t };\n\t\n\t /**\n\t * Returns the used frame-buffer\n\t */\n\t _that.getData = function () {\n\t return _data;\n\t };\n\t\n\t /**\n\t * Fetches a frame from the input-stream and puts into the frame-buffer.\n\t * The image-data is converted to gray-scale and then half-sampled if configured.\n\t */\n\t _that.grab = function () {\n\t var doHalfSample = _streamConfig.halfSample,\n\t frame = inputStream.getFrame(),\n\t ctxData;\n\t if (frame) {\n\t _ctx.drawImage(frame, 0, 0, _canvasSize.x, _canvasSize.y);\n\t ctxData = _ctx.getImageData(_sx, _sy, _size.x, _size.y).data;\n\t if (doHalfSample) {\n\t _cv_utils2[\"default\"].grayAndHalfSampleFromCanvasData(ctxData, _size, _data);\n\t } else {\n\t _cv_utils2[\"default\"].computeGray(ctxData, _data, _streamConfig);\n\t }\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t };\n\t\n\t _that.getSize = function () {\n\t return _size;\n\t };\n\t\n\t return _that;\n\t};\n\t\n\texports[\"default\"] = FrameGrabber;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 71 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports[\"default\"] = {\n\t inputStream: {\n\t name: \"Live\",\n\t type: \"LiveStream\",\n\t constraints: {\n\t width: 640,\n\t height: 480,\n\t minAspectRatio: 0,\n\t maxAspectRatio: 100,\n\t facing: \"environment\" // or user\n\t },\n\t area: {\n\t top: \"0%\",\n\t right: \"0%\",\n\t left: \"0%\",\n\t bottom: \"0%\"\n\t },\n\t singleChannel: false // true: only the red color-channel is read\n\t },\n\t tracking: false,\n\t debug: false,\n\t controls: false,\n\t locate: true,\n\t numOfWorkers: 4,\n\t visual: {\n\t show: true\n\t },\n\t decoder: {\n\t drawBoundingBox: false,\n\t showFrequency: false,\n\t drawScanline: false,\n\t showPattern: false,\n\t readers: ['code_128_reader']\n\t },\n\t locator: {\n\t halfSample: true,\n\t patchSize: \"medium\", // x-small, small, medium, large, x-large\n\t showCanvas: false,\n\t showPatches: false,\n\t showFoundPatches: false,\n\t showSkeleton: false,\n\t showLabels: false,\n\t showPatchLabels: false,\n\t showRemainingPatchLabels: false,\n\t boxFromPatches: {\n\t showTransformed: false,\n\t showTransformedBox: false,\n\t showBB: false\n\t }\n\t }\n\t};\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 72 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\texports[\"default\"] = (function () {\n\t var events = {};\n\t\n\t function getEvent(eventName) {\n\t if (!events[eventName]) {\n\t events[eventName] = {\n\t subscribers: []\n\t };\n\t }\n\t return events[eventName];\n\t }\n\t\n\t function clearEvents() {\n\t events = {};\n\t }\n\t\n\t function publishSubscription(subscription, data) {\n\t if (subscription.async) {\n\t setTimeout(function () {\n\t subscription.callback(data);\n\t }, 4);\n\t } else {\n\t subscription.callback(data);\n\t }\n\t }\n\t\n\t function _subscribe(event, callback, async) {\n\t var subscription;\n\t\n\t if (typeof callback === \"function\") {\n\t subscription = {\n\t callback: callback,\n\t async: async\n\t };\n\t } else {\n\t subscription = callback;\n\t if (!subscription.callback) {\n\t throw \"Callback was not specified on options\";\n\t }\n\t }\n\t\n\t getEvent(event).subscribers.push(subscription);\n\t }\n\t\n\t return {\n\t subscribe: function subscribe(event, callback, async) {\n\t return _subscribe(event, callback, async);\n\t },\n\t publish: function publish(eventName, data) {\n\t var event = getEvent(eventName),\n\t subscribers = event.subscribers;\n\t\n\t event.subscribers = subscribers.filter(function (subscriber) {\n\t publishSubscription(subscriber, data);\n\t return !subscriber.once;\n\t });\n\t },\n\t once: function once(event, callback, async) {\n\t _subscribe(event, {\n\t callback: callback,\n\t async: async,\n\t once: true\n\t });\n\t },\n\t unsubscribe: function unsubscribe(eventName, callback) {\n\t var event;\n\t\n\t if (eventName) {\n\t event = getEvent(eventName);\n\t if (event && callback) {\n\t event.subscribers = event.subscribers.filter(function (subscriber) {\n\t return subscriber.callback !== callback;\n\t });\n\t } else {\n\t event.subscribers = [];\n\t }\n\t } else {\n\t clearEvents();\n\t }\n\t }\n\t };\n\t})();\n\t\n\t;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 73 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\tvar merge = __webpack_require__(37);\n\t\n\tvar streamRef, loadedDataHandler;\n\t\n\t/**\n\t * Wraps browser-specific getUserMedia\n\t * @param {Object} constraints\n\t * @param {Object} success Callback\n\t * @param {Object} failure Callback\n\t */\n\tfunction getUserMedia(constraints, success, failure) {\n\t if (typeof navigator.getUserMedia !== 'undefined') {\n\t navigator.getUserMedia(constraints, function (stream) {\n\t streamRef = stream;\n\t var videoSrc = window.URL && window.URL.createObjectURL(stream) || stream;\n\t success.apply(null, [videoSrc]);\n\t }, failure);\n\t } else {\n\t failure(new TypeError(\"getUserMedia not available\"));\n\t }\n\t}\n\t\n\tfunction loadedData(video, callback) {\n\t var attempts = 10;\n\t\n\t function checkVideo() {\n\t if (attempts > 0) {\n\t if (video.videoWidth > 0 && video.videoHeight > 0) {\n\t console.log(video.videoWidth + \"px x \" + video.videoHeight + \"px\");\n\t callback();\n\t } else {\n\t window.setTimeout(checkVideo, 500);\n\t }\n\t } else {\n\t callback('Unable to play video stream. Is webcam working?');\n\t }\n\t attempts--;\n\t }\n\t checkVideo();\n\t}\n\t\n\t/**\n\t * Tries to attach the camera-stream to a given video-element\n\t * and calls the callback function when the content is ready\n\t * @param {Object} constraints\n\t * @param {Object} video\n\t * @param {Object} callback\n\t */\n\tfunction initCamera(constraints, video, callback) {\n\t getUserMedia(constraints, function (src) {\n\t video.src = src;\n\t if (loadedDataHandler) {\n\t video.removeEventListener(\"loadeddata\", loadedDataHandler, false);\n\t }\n\t loadedDataHandler = loadedData.bind(null, video, callback);\n\t video.addEventListener('loadeddata', loadedDataHandler, false);\n\t video.play();\n\t }, function (e) {\n\t callback(e);\n\t });\n\t}\n\t\n\t/**\n\t * Normalizes the incoming constraints to satisfy the current browser\n\t * @param config\n\t * @param cb Callback which is called whenever constraints are created\n\t * @returns {*}\n\t */\n\tfunction normalizeConstraints(config, cb) {\n\t var constraints = {\n\t audio: false,\n\t video: true\n\t },\n\t videoConstraints = merge({\n\t width: 640,\n\t height: 480,\n\t minAspectRatio: 0,\n\t maxAspectRatio: 100,\n\t facing: \"environment\"\n\t }, config);\n\t\n\t if (typeof MediaStreamTrack !== 'undefined' && typeof MediaStreamTrack.getSources !== 'undefined') {\n\t MediaStreamTrack.getSources(function (sourceInfos) {\n\t var videoSourceId;\n\t for (var i = 0; i != sourceInfos.length; ++i) {\n\t var sourceInfo = sourceInfos[i];\n\t if (sourceInfo.kind == \"video\" && sourceInfo.facing == videoConstraints.facing) {\n\t videoSourceId = sourceInfo.id;\n\t }\n\t }\n\t constraints.video = {\n\t mandatory: {\n\t minWidth: videoConstraints.width,\n\t minHeight: videoConstraints.height,\n\t minAspectRatio: videoConstraints.minAspectRatio,\n\t maxAspectRatio: videoConstraints.maxAspectRatio\n\t },\n\t optional: [{\n\t sourceId: videoSourceId\n\t }]\n\t };\n\t return cb(constraints);\n\t });\n\t } else {\n\t constraints.video = {\n\t mediaSource: \"camera\",\n\t width: { min: videoConstraints.width, max: videoConstraints.width },\n\t height: { min: videoConstraints.height, max: videoConstraints.height },\n\t require: [\"width\", \"height\"]\n\t };\n\t return cb(constraints);\n\t }\n\t}\n\t\n\t/**\n\t * Requests the back-facing camera of the user. The callback is called\n\t * whenever the stream is ready to be consumed, or if an error occures.\n\t * @param {Object} video\n\t * @param {Object} callback\n\t */\n\tfunction _request(video, videoConstraints, callback) {\n\t normalizeConstraints(videoConstraints, function (constraints) {\n\t initCamera(constraints, video, callback);\n\t });\n\t}\n\t\n\texports['default'] = {\n\t request: function request(video, constraints, callback) {\n\t _request(video, constraints, callback);\n\t },\n\t release: function release() {\n\t var tracks = streamRef && streamRef.getVideoTracks();\n\t if (tracks.length) {\n\t tracks[0].stop();\n\t }\n\t streamRef = null;\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _image_debug = __webpack_require__(24);\n\t\n\tvar _image_debug2 = _interopRequireDefault(_image_debug);\n\t\n\tfunction contains(codeResult, list) {\n\t if (list) {\n\t return list.some(function (item) {\n\t return Object.keys(item).every(function (key) {\n\t return item[key] === codeResult[key];\n\t });\n\t });\n\t }\n\t return false;\n\t}\n\t\n\tfunction passesFilter(codeResult, filter) {\n\t if (typeof filter === 'function') {\n\t return filter(codeResult);\n\t }\n\t return true;\n\t}\n\t\n\texports['default'] = {\n\t create: function create(config) {\n\t var canvas = document.createElement(\"canvas\"),\n\t ctx = canvas.getContext(\"2d\"),\n\t results = [],\n\t capacity = config.capacity || 20,\n\t capture = config.capture === true;\n\t\n\t function matchesConstraints(codeResult) {\n\t return capacity && codeResult && !contains(codeResult, config.blacklist) && passesFilter(codeResult, config.filter);\n\t }\n\t\n\t return {\n\t addResult: function addResult(data, imageSize, codeResult) {\n\t var result = {};\n\t\n\t if (matchesConstraints(codeResult)) {\n\t capacity--;\n\t result.codeResult = codeResult;\n\t if (capture) {\n\t canvas.width = imageSize.x;\n\t canvas.height = imageSize.y;\n\t _image_debug2['default'].drawImage(data, imageSize, ctx);\n\t result.frame = canvas.toDataURL();\n\t }\n\t results.push(result);\n\t }\n\t },\n\t getResults: function getResults() {\n\t return results;\n\t }\n\t };\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** quagga.min.js\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap bbe7819afe77c7859a4a\n **/","import TypeDefs from './typedefs';\nimport InputStream from './input_stream';\nimport ImageWrapper from './image_wrapper';\nimport BarcodeLocator from './barcode_locator';\nimport BarcodeDecoder from './barcode_decoder';\nimport FrameGrabber from './frame_grabber';\nimport Config from './config';\nimport Events from './events';\nimport CameraAccess from './camera_access';\nimport ImageDebug from './image_debug';\nimport {vec2} from 'gl-matrix';\nimport ResultCollector from './result_collector';\n\nconst merge = require('lodash/object/merge');\n\nvar _inputStream,\n _framegrabber,\n _stopped,\n _canvasContainer = {\n ctx : {\n image : null,\n overlay : null\n },\n dom : {\n image : null,\n overlay : null\n }\n },\n _inputImageWrapper,\n _boxSize,\n _decoder,\n _workerPool = [],\n _onUIThread = true,\n _resultCollector,\n _config = {};\n\nfunction initializeData(imageWrapper) {\n initBuffers(imageWrapper);\n _decoder = BarcodeDecoder.create(_config.decoder, _inputImageWrapper);\n}\n\nfunction initConfig() {\n if (typeof document !== \"undefined\") {\n var vis = [{\n node: document.querySelector(\"div[data-controls]\"),\n prop: _config.controls\n }, {\n node: _canvasContainer.dom.overlay,\n prop: _config.visual.show\n }];\n\n for (var i = 0; i < vis.length; i++) {\n if (vis[i].node) {\n if (vis[i].prop === true) {\n vis[i].node.style.display = \"block\";\n } else {\n vis[i].node.style.display = \"none\";\n }\n }\n }\n }\n}\n\nfunction initInputStream(cb) {\n var video;\n if (_config.inputStream.type == \"VideoStream\") {\n video = document.createElement(\"video\");\n _inputStream = InputStream.createVideoStream(video);\n } else if (_config.inputStream.type == \"ImageStream\") {\n _inputStream = InputStream.createImageStream();\n } else if (_config.inputStream.type == \"LiveStream\") {\n var $viewport = document.querySelector(\"#interactive.viewport\");\n if ($viewport) {\n video = $viewport.querySelector(\"video\");\n if (!video) {\n video = document.createElement(\"video\");\n $viewport.appendChild(video);\n }\n }\n _inputStream = InputStream.createLiveStream(video);\n CameraAccess.request(video, _config.inputStream.constraints, function(err) {\n if (!err) {\n _inputStream.trigger(\"canrecord\");\n } else {\n return cb(err);\n }\n });\n }\n\n _inputStream.setAttribute(\"preload\", \"auto\");\n _inputStream.setAttribute(\"autoplay\", true);\n _inputStream.setInputStream(_config.inputStream);\n _inputStream.addEventListener(\"canrecord\", canRecord.bind(undefined, cb));\n}\n\nfunction canRecord(cb) {\n BarcodeLocator.checkImageConstraints(_inputStream, _config.locator);\n initCanvas();\n _framegrabber = FrameGrabber.create(_inputStream, _canvasContainer.dom.image);\n initConfig();\n\n if (_config.numOfWorkers > 0) {\n initWorkers(function() {\n console.log(\"Workers created\");\n ready(cb);\n });\n } else {\n initializeData();\n ready(cb);\n }\n}\n\nfunction ready(cb){\n _inputStream.play();\n cb();\n}\n\nfunction initCanvas() {\n if (typeof document !== \"undefined\") {\n var $viewport = document.querySelector(\"#interactive.viewport\");\n _canvasContainer.dom.image = document.querySelector(\"canvas.imgBuffer\");\n if (!_canvasContainer.dom.image) {\n _canvasContainer.dom.image = document.createElement(\"canvas\");\n _canvasContainer.dom.image.className = \"imgBuffer\";\n if ($viewport && _config.inputStream.type == \"ImageStream\") {\n $viewport.appendChild(_canvasContainer.dom.image);\n }\n }\n _canvasContainer.ctx.image = _canvasContainer.dom.image.getContext(\"2d\");\n _canvasContainer.dom.image.width = _inputStream.getCanvasSize().x;\n _canvasContainer.dom.image.height = _inputStream.getCanvasSize().y;\n\n _canvasContainer.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n if (!_canvasContainer.dom.overlay) {\n _canvasContainer.dom.overlay = document.createElement(\"canvas\");\n _canvasContainer.dom.overlay.className = \"drawingBuffer\";\n if ($viewport) {\n $viewport.appendChild(_canvasContainer.dom.overlay);\n }\n var clearFix = document.createElement(\"br\");\n clearFix.setAttribute(\"clear\", \"all\");\n if ($viewport) {\n $viewport.appendChild(clearFix);\n }\n }\n _canvasContainer.ctx.overlay = _canvasContainer.dom.overlay.getContext(\"2d\");\n _canvasContainer.dom.overlay.width = _inputStream.getCanvasSize().x;\n _canvasContainer.dom.overlay.height = _inputStream.getCanvasSize().y;\n }\n}\n\nfunction initBuffers(imageWrapper) {\n if (imageWrapper) {\n _inputImageWrapper = imageWrapper;\n } else {\n _inputImageWrapper = new ImageWrapper({\n x : _inputStream.getWidth(),\n y : _inputStream.getHeight()\n });\n }\n\n console.log(_inputImageWrapper.size);\n _boxSize = [\n vec2.clone([0, 0]),\n vec2.clone([0, _inputImageWrapper.size.y]),\n vec2.clone([_inputImageWrapper.size.x, _inputImageWrapper.size.y]),\n vec2.clone([_inputImageWrapper.size.x, 0])\n ];\n BarcodeLocator.init(_inputImageWrapper, _config.locator);\n}\n\nfunction getBoundingBoxes() {\n if (_config.locate) {\n return BarcodeLocator.locate();\n } else {\n return [[\n vec2.clone(_boxSize[0]),\n vec2.clone(_boxSize[1]),\n vec2.clone(_boxSize[2]),\n vec2.clone(_boxSize[3])]];\n }\n}\n\nfunction transformResult(result) {\n var topRight = _inputStream.getTopRight(),\n xOffset = topRight.x,\n yOffset = topRight.y,\n i;\n\n if (!result || (xOffset === 0 && yOffset === 0)) {\n return;\n }\n\n\n if (result.line && result.line.length === 2) {\n moveLine(result.line);\n }\n if (result.boxes && result.boxes.length > 0) {\n for (i = 0; i < result.boxes.length; i++) {\n moveBox(result.boxes[i]);\n }\n }\n\n function moveBox(box) {\n var corner = box.length;\n\n while(corner--) {\n box[corner][0] += xOffset;\n box[corner][1] += yOffset;\n }\n }\n\n function moveLine(line) {\n line[0].x += xOffset;\n line[0].y += yOffset;\n line[1].x += xOffset;\n line[1].y += yOffset;\n }\n}\n\nfunction publishResult(result, imageData) {\n if (_onUIThread) {\n transformResult(result);\n if (imageData && result && result.codeResult) {\n if (_resultCollector) {\n _resultCollector.addResult(imageData, _inputStream.getCanvasSize(), result.codeResult);\n }\n }\n }\n\n Events.publish(\"processed\", result);\n if (result && result.codeResult) {\n Events.publish(\"detected\", result);\n }\n}\n\nfunction locateAndDecode() {\n var result,\n boxes;\n\n boxes = getBoundingBoxes();\n if (boxes) {\n result = _decoder.decodeFromBoundingBoxes(boxes);\n result = result || {};\n result.boxes = boxes;\n publishResult(result, _inputImageWrapper.data);\n } else {\n publishResult();\n }\n}\n\nfunction update() {\n var availableWorker;\n\n if (_onUIThread) {\n if (_workerPool.length > 0) {\n availableWorker = _workerPool.filter(function(workerThread) {\n return !workerThread.busy;\n })[0];\n if (availableWorker) {\n _framegrabber.attachData(availableWorker.imageData);\n } else {\n return; // all workers are busy\n }\n } else {\n _framegrabber.attachData(_inputImageWrapper.data);\n }\n if (_framegrabber.grab()) {\n if (availableWorker) {\n availableWorker.busy = true;\n availableWorker.worker.postMessage({\n cmd: 'process',\n imageData: availableWorker.imageData\n }, [availableWorker.imageData.buffer]);\n } else {\n locateAndDecode();\n }\n }\n } else {\n locateAndDecode();\n }\n}\n\nfunction start() {\n _stopped = false;\n ( function frame() {\n if (!_stopped) {\n update();\n if (_onUIThread && _config.inputStream.type == \"LiveStream\") {\n window.requestAnimFrame(frame);\n }\n }\n }());\n}\n\nfunction initWorkers(cb) {\n var i;\n _workerPool = [];\n\n for (i = 0; i < _config.numOfWorkers; i++) {\n initWorker(workerInitialized);\n }\n\n function workerInitialized(workerThread) {\n _workerPool.push(workerThread);\n if (_workerPool.length >= _config.numOfWorkers){\n cb();\n }\n }\n}\n\nfunction initWorker(cb) {\n var blobURL,\n workerThread = {\n worker: undefined,\n imageData: new Uint8Array(_inputStream.getWidth() * _inputStream.getHeight()),\n busy: true\n };\n\n blobURL = generateWorkerBlob();\n workerThread.worker = new Worker(blobURL);\n\n workerThread.worker.onmessage = function(e) {\n if (e.data.event === 'initialized') {\n URL.revokeObjectURL(blobURL);\n workerThread.busy = false;\n workerThread.imageData = new Uint8Array(e.data.imageData);\n console.log(\"Worker initialized\");\n return cb(workerThread);\n } else if (e.data.event === 'processed') {\n workerThread.imageData = new Uint8Array(e.data.imageData);\n workerThread.busy = false;\n publishResult(e.data.result, workerThread.imageData);\n } else if (e.data.event === 'error') {\n console.log(\"Worker error: \" + e.data.message);\n }\n };\n\n workerThread.worker.postMessage({\n cmd: 'init',\n size: {x: _inputStream.getWidth(), y: _inputStream.getHeight()},\n imageData: workerThread.imageData,\n config: _config\n }, [workerThread.imageData.buffer]);\n}\n\n\nfunction workerInterface(factory) {\n window = self;\n if (factory) {\n /* jshint ignore:start */\n var Quagga = factory();\n if (!Quagga) {\n self.postMessage({'event': 'error', message: 'Quagga could not be created'});\n return;\n }\n /* jshint ignore:end */\n }\n /* jshint ignore:start */\n var imageWrapper;\n\n self.onmessage = function(e) {\n if (e.data.cmd === 'init') {\n var config = e.data.config;\n config.numOfWorkers = 0;\n imageWrapper = new Quagga.ImageWrapper({\n x : e.data.size.x,\n y : e.data.size.y\n }, new Uint8Array(e.data.imageData));\n Quagga.init(config, ready, imageWrapper);\n Quagga.onProcessed(onProcessed);\n } else if (e.data.cmd === 'process') {\n imageWrapper.data = new Uint8Array(e.data.imageData);\n Quagga.start();\n } else if (e.data.cmd === 'setReaders') {\n Quagga.setReaders(e.data.readers);\n }\n };\n\n function onProcessed(result) {\n self.postMessage({'event': 'processed', imageData: imageWrapper.data, result: result}, [imageWrapper.data.buffer]);\n }\n\n function ready() {\n self.postMessage({'event': 'initialized', imageData: imageWrapper.data}, [imageWrapper.data.buffer]);\n }\n /* jshint ignore:end */\n}\n\nfunction generateWorkerBlob() {\n var blob,\n factorySource;\n\n /* jshint ignore:start */\n if (typeof __factorySource__ !== 'undefined') {\n factorySource = __factorySource__;\n }\n /* jshint ignore:end */\n\n blob = new Blob(['(' + workerInterface.toString() + ')(' + factorySource + ');'],\n {type : 'text/javascript'});\n\n return window.URL.createObjectURL(blob);\n}\n\nfunction setReaders(readers) {\n if (_decoder) {\n _decoder.setReaders(readers);\n } else if (_onUIThread && _workerPool.length > 0) {\n _workerPool.forEach(function(workerThread) {\n workerThread.worker.postMessage({cmd: 'setReaders', readers: readers});\n });\n }\n}\n\nexport default {\n init : function(config, cb, imageWrapper) {\n _config = merge({}, Config, config);\n if (imageWrapper) {\n _onUIThread = false;\n initializeData(imageWrapper);\n return cb();\n } else {\n initInputStream(cb);\n }\n },\n start : function() {\n start();\n },\n stop : function() {\n _stopped = true;\n _workerPool.forEach(function(workerThread) {\n workerThread.worker.terminate();\n console.log(\"Worker terminated!\");\n });\n _workerPool.length = 0;\n if (_config.inputStream.type === \"LiveStream\") {\n CameraAccess.release();\n _inputStream.clearEventHandlers();\n }\n },\n pause: function() {\n _stopped = true;\n },\n onDetected : function(callback) {\n Events.subscribe(\"detected\", callback);\n },\n offDetected: function(callback) {\n Events.unsubscribe(\"detected\", callback);\n },\n onProcessed: function(callback) {\n Events.subscribe(\"processed\", callback);\n },\n offProcessed: function(callback) {\n Events.unsubscribe(\"processed\", callback);\n },\n setReaders: function(readers) {\n setReaders(readers);\n },\n registerResultCollector: function(resultCollector) {\n if (resultCollector && typeof resultCollector.addResult === 'function') {\n _resultCollector = resultCollector;\n }\n },\n canvas : _canvasContainer,\n decodeSingle : function(config, resultCallback) {\n config = merge({\n inputStream: {\n type : \"ImageStream\",\n sequence : false,\n size: 800,\n src: config.src\n },\n numOfWorkers: 1,\n locator: {\n halfSample: false\n }\n }, config);\n this.init(config, function() {\n Events.once(\"processed\", function(result) {\n _stopped = true;\n resultCallback.call(null, result);\n }, true);\n start();\n });\n },\n ImageWrapper: ImageWrapper,\n ImageDebug: ImageDebug,\n ResultCollector: ResultCollector\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/quagga.js\n **/","/*\n * typedefs.js\n * Normalizes browser-specific prefixes\n */\n\n if (typeof window !== 'undefined') {\n window.requestAnimFrame = (function () {\n return window.requestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.oRequestAnimationFrame ||\n window.msRequestAnimationFrame ||\n function (/* function FrameRequestCallback */ callback, /* DOMElement Element */ element) {\n window.setTimeout(callback, 1000 / 60);\n };\n })();\n\n navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;\n }\n Math.imul = Math.imul || function(a, b) {\n var ah = (a >>> 16) & 0xffff,\n al = a & 0xffff,\n bh = (b >>> 16) & 0xffff,\n bl = b & 0xffff;\n // the shift by 0 fixes the sign on the high part\n // the final |0 converts the unsigned value into a signed value\n return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);\n };\n\nexport default {\n \n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/typedefs.js\n **/","import ImageLoader from './image_loader';\n\nvar InputStream = {};\nInputStream.createVideoStream = function(video) {\n var that = {},\n _config = null,\n _eventNames = ['canrecord', 'ended'],\n _eventHandlers = {},\n _calculatedWidth,\n _calculatedHeight,\n _topRight = {x: 0, y: 0},\n _canvasSize = {x: 0, y: 0};\n\n function initSize() {\n var width = video.videoWidth,\n height = video.videoHeight;\n\n _calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;\n _calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;\n\n _canvasSize.x = _calculatedWidth;\n _canvasSize.y = _calculatedHeight;\n }\n\n that.getRealWidth = function() {\n return video.videoWidth;\n };\n\n that.getRealHeight = function() {\n return video.videoHeight;\n };\n\n that.getWidth = function() {\n return _calculatedWidth;\n };\n\n that.getHeight = function() {\n return _calculatedHeight;\n };\n\n that.setWidth = function(width) {\n _calculatedWidth = width;\n };\n\n that.setHeight = function(height) {\n _calculatedHeight = height;\n };\n\n that.setInputStream = function(config) {\n _config = config;\n video.src = (typeof config.src !== 'undefined') ? config.src : '';\n };\n\n that.ended = function() {\n return video.ended;\n };\n\n that.getConfig = function() {\n return _config;\n };\n\n that.setAttribute = function(name, value) {\n video.setAttribute(name, value);\n };\n\n that.pause = function() {\n video.pause();\n };\n\n that.play = function() {\n video.play();\n };\n\n that.setCurrentTime = function(time) {\n if (_config.type !== \"LiveStream\")\n video.currentTime = time;\n };\n\n that.addEventListener = function(event, f, bool) {\n if (_eventNames.indexOf(event) !== -1) {\n if (!_eventHandlers[event]) {\n _eventHandlers[event] = [];\n }\n _eventHandlers[event].push(f);\n } else {\n video.addEventListener(event, f, bool);\n }\n };\n\n that.clearEventHandlers = function() {\n _eventNames.forEach(function(eventName) {\n var handlers = _eventHandlers[eventName];\n if (handlers && handlers.length > 0) {\n handlers.forEach(function(handler) {\n video.removeEventListener(eventName, handler);\n });\n }\n });\n };\n\n that.trigger = function(eventName, args) {\n var j,\n handlers = _eventHandlers[eventName];\n\n if (eventName === 'canrecord') {\n initSize();\n }\n if (handlers && handlers.length > 0) {\n for ( j = 0; j < handlers.length; j++) {\n handlers[j].apply(that, args);\n }\n }\n };\n\n that.setTopRight = function(topRight) {\n _topRight.x = topRight.x;\n _topRight.y = topRight.y;\n };\n\n that.getTopRight = function() {\n return _topRight;\n };\n\n that.setCanvasSize = function(size) {\n _canvasSize.x = size.x;\n _canvasSize.y = size.y;\n };\n\n that.getCanvasSize = function() {\n return _canvasSize;\n };\n\n that.getFrame = function() {\n return video;\n };\n\n return that;\n};\n\nInputStream.createLiveStream = function(video) {\n video.setAttribute(\"autoplay\", true);\n var that = InputStream.createVideoStream(video);\n\n that.ended = function() {\n return false;\n };\n\n return that;\n};\n\nInputStream.createImageStream = function() {\n var that = {};\n var _config = null;\n\n var width = 0,\n height = 0,\n frameIdx = 0,\n paused = true,\n loaded = false,\n imgArray = null,\n size = 0,\n offset = 1,\n baseUrl = null,\n ended = false,\n calculatedWidth,\n calculatedHeight,\n _eventNames = ['canrecord', 'ended'],\n _eventHandlers = {},\n _topRight = {x: 0, y: 0},\n _canvasSize = {x: 0, y: 0};\n\n function loadImages() {\n loaded = false;\n ImageLoader.load(baseUrl, function(imgs) {\n imgArray = imgs;\n width = imgs[0].width;\n height = imgs[0].height;\n calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;\n calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;\n _canvasSize.x = calculatedWidth;\n _canvasSize.y = calculatedHeight;\n loaded = true;\n frameIdx = 0;\n setTimeout(function() {\n publishEvent(\"canrecord\", []);\n }, 0);\n }, offset, size, _config.sequence);\n }\n\n function publishEvent(eventName, args) {\n var j,\n handlers = _eventHandlers[eventName];\n\n if (handlers && handlers.length > 0) {\n for ( j = 0; j < handlers.length; j++) {\n handlers[j].apply(that, args);\n }\n }\n }\n\n\n that.trigger = publishEvent;\n\n that.getWidth = function() {\n return calculatedWidth;\n };\n\n that.getHeight = function() {\n return calculatedHeight;\n };\n\n that.setWidth = function(width) {\n calculatedWidth = width;\n };\n\n that.setHeight = function(height) {\n calculatedHeight = height;\n };\n\n that.getRealWidth = function() {\n return width;\n };\n\n that.getRealHeight = function() {\n return height;\n };\n\n that.setInputStream = function(stream) {\n _config = stream;\n if (stream.sequence === false) {\n baseUrl = stream.src;\n size = 1;\n } else {\n baseUrl = stream.src;\n size = stream.length;\n }\n loadImages();\n };\n\n that.ended = function() {\n return ended;\n };\n\n that.setAttribute = function() {};\n\n that.getConfig = function() {\n return _config;\n };\n\n that.pause = function() {\n paused = true;\n };\n\n that.play = function() {\n paused = false;\n };\n\n that.setCurrentTime = function(time) {\n frameIdx = time;\n };\n\n that.addEventListener = function(event, f) {\n if (_eventNames.indexOf(event) !== -1) {\n if (!_eventHandlers[event]) {\n _eventHandlers[event] = [];\n }\n _eventHandlers[event].push(f);\n }\n };\n\n that.setTopRight = function(topRight) {\n _topRight.x = topRight.x;\n _topRight.y = topRight.y;\n };\n\n that.getTopRight = function() {\n return _topRight;\n };\n\n that.setCanvasSize = function(size) {\n _canvasSize.x = size.x;\n _canvasSize.y = size.y;\n };\n\n that.getCanvasSize = function() {\n return _canvasSize;\n };\n\n that.getFrame = function() {\n var frame;\n\n if (!loaded){\n return null;\n }\n if (!paused) {\n frame = imgArray[frameIdx];\n if (frameIdx < (size - 1)) {\n frameIdx++;\n } else {\n setTimeout(function() {\n ended = true;\n publishEvent(\"ended\", []);\n }, 0);\n }\n }\n return frame;\n };\n\n return that;\n};\n\nexport default InputStream;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/input_stream.js\n **/","var ImageLoader = {};\nImageLoader.load = function(directory, callback, offset, size, sequence) {\n var htmlImagesSrcArray = new Array(size),\n htmlImagesArray = new Array(htmlImagesSrcArray.length),\n i,\n img,\n num;\n\n if (sequence === false) {\n htmlImagesSrcArray[0] = directory;\n } else {\n for ( i = 0; i < htmlImagesSrcArray.length; i++) {\n num = (offset + i);\n htmlImagesSrcArray[i] = directory + \"image-\" + (\"00\" + num).slice(-3) + \".jpg\";\n }\n }\n htmlImagesArray.notLoaded = [];\n htmlImagesArray.addImage = function(img) {\n htmlImagesArray.notLoaded.push(img);\n };\n htmlImagesArray.loaded = function(loadedImg) {\n var notloadedImgs = htmlImagesArray.notLoaded;\n for (var x = 0; x < notloadedImgs.length; x++) {\n if (notloadedImgs[x] == loadedImg) {\n notloadedImgs.splice(x, 1);\n for (var y = 0; y < htmlImagesSrcArray.length; y++) {\n var imgName = htmlImagesSrcArray[y].substr(htmlImagesSrcArray[y].lastIndexOf(\"/\"));\n if (loadedImg.src.lastIndexOf(imgName) != -1) {\n htmlImagesArray[y] = loadedImg;\n break;\n }\n }\n break;\n }\n }\n if (notloadedImgs.length === 0) {\n console.log(\"Images loaded\");\n callback.apply(null, [htmlImagesArray]);\n }\n };\n\n for ( i = 0; i < htmlImagesSrcArray.length; i++) {\n img = new Image();\n htmlImagesArray.addImage(img);\n addOnloadHandler(img, htmlImagesArray);\n img.src = htmlImagesSrcArray[i];\n }\n};\n\nfunction addOnloadHandler(img, htmlImagesArray) {\n img.onload = function() {\n htmlImagesArray.loaded(this);\n };\n}\n\nexport default (ImageLoader);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_loader.js\n **/","import SubImage from './subImage';\nimport CVUtils from './cv_utils';\nimport ArrayHelper from './array_helper';\nimport {vec2, mat2} from 'gl-matrix';\n\n/**\n * Represents a basic image combining the data and size.\n * In addition, some methods for manipulation are contained.\n * @param size {x,y} The size of the image in pixel\n * @param data {Array} If given, a flat array containing the pixel data\n * @param ArrayType {Type} If given, the desired DataType of the Array (may be typed/non-typed)\n * @param initialize {Boolean} Indicating if the array should be initialized on creation.\n * @returns {ImageWrapper}\n */\nfunction ImageWrapper(size, data, ArrayType, initialize) {\n if (!data) {\n if (ArrayType) {\n this.data = new ArrayType(size.x * size.y);\n if (ArrayType === Array && initialize) {\n ArrayHelper.init(this.data, 0);\n }\n } else {\n this.data = new Uint8Array(size.x * size.y);\n if (Uint8Array === Array && initialize) {\n ArrayHelper.init(this.data, 0);\n }\n }\n\n } else {\n this.data = data;\n }\n this.size = size;\n}\n\n/**\n * tests if a position is within the image with a given offset\n * @param imgRef {x, y} The location to test\n * @param border Number the padding value in pixel\n * @returns {Boolean} true if location inside the image's border, false otherwise\n * @see cvd/image.h\n */\nImageWrapper.prototype.inImageWithBorder = function(imgRef, border) {\n return (imgRef.x >= border) && (imgRef.y >= border) && (imgRef.x < (this.size.x - border)) && (imgRef.y < (this.size.y - border));\n};\n\n/**\n * Transforms an image according to the given affine-transformation matrix.\n * @param inImg ImageWrapper a image containing the information to be extracted.\n * @param outImg ImageWrapper the image to be filled. The whole image out image is filled by the in image.\n * @param M mat2 the matrix used to map point in the out matrix to those in the in matrix\n * @param inOrig vec2 origin in the in image\n * @param outOrig vec2 origin in the out image\n * @returns Number the number of pixels not in the in image\n * @see cvd/vision.h\n */\nImageWrapper.transform = function(inImg, outImg, M, inOrig, outOrig) {\n var w = outImg.size.x, h = outImg.size.y, iw = inImg.size.x, ih = inImg.size.y;\n var across = vec2.clone([M[0], M[2]]);\n var down = vec2.clone([M[1], M[3]]);\n var defaultValue = 0;\n\n var p0 = vec2.subtract(inOrig, mat2.xVec2(M, outOrig, vec2.clone()), vec2.clone());\n\n var min_x = p0[0], min_y = p0[1];\n var max_x = min_x, max_y = min_y;\n var p, i, j;\n\n var sampleFunc = ImageWrapper.sample;\n\n if (across[0] < 0)\n min_x += w * across[0];\n else\n max_x += w * across[0];\n\n if (down[0] < 0)\n min_x += h * down[0];\n else\n max_x += h * down[0];\n\n if (across[1] < 0)\n min_y += w * across[1];\n else\n max_y += w * across[1];\n\n if (down[1] < 0)\n min_y += h * down[1];\n else\n max_y += h * down[1];\n\n var carrigeReturn = vec2.subtract(down, vec2.scale(across, w, vec2.clone()), vec2.clone());\n\n if (min_x >= 0 && min_y >= 0 && max_x < iw - 1 && max_y < ih - 1) {\n p = p0;\n for ( i = 0; i < h; ++i, vec2.add(p, carrigeReturn))\n for ( j = 0; j < w; ++j, vec2.add(p, across))\n outImg.set(j, i, sampleFunc(inImg, p[0], p[1]));\n return 0;\n } else {\n var x_bound = iw - 1;\n var y_bound = ih - 1;\n var count = 0;\n p = p0;\n for ( i = 0; i < h; ++i, vec2.add(p, carrigeReturn)) {\n for ( j = 0; j < w; ++j, vec2.add(p, across)) {\n if (0 <= p[0] && 0 <= p[1] && p[0] < x_bound && p[1] < y_bound) {\n outImg.set(j, i, sampleFunc(inImg, p[0], p[1]));\n } else {\n outImg.set(j, i, defaultValue); ++count;\n }\n }\n }\n return count;\n }\n};\n\n/**\n * Performs bilinear sampling\n * @param inImg Image to extract sample from\n * @param x the x-coordinate\n * @param y the y-coordinate\n * @returns the sampled value\n * @see cvd/vision.h\n */\nImageWrapper.sample = function(inImg, x, y) {\n var lx = Math.floor(x);\n var ly = Math.floor(y);\n var w = inImg.size.x;\n var base = ly * inImg.size.x + lx;\n var a = inImg.data[base + 0];\n var b = inImg.data[base + 1];\n var c = inImg.data[base + w];\n var d = inImg.data[base + w + 1];\n var e = a - b;\n x -= lx;\n y -= ly;\n\n var result = Math.floor(x * (y * (e - c + d) - e) + y * (c - a) + a);\n return result;\n};\n\n/**\n * Initializes a given array. Sets each element to zero.\n * @param array {Array} The array to initialize\n */\nImageWrapper.clearArray = function(array) {\n var l = array.length;\n while (l--) {\n array[l] = 0;\n }\n};\n\n/**\n * Creates a {SubImage} from the current image ({this}).\n * @param from {ImageRef} The position where to start the {SubImage} from. (top-left corner)\n * @param size {ImageRef} The size of the resulting image\n * @returns {SubImage} A shared part of the original image\n */\nImageWrapper.prototype.subImage = function(from, size) {\n return new SubImage(from, size, this);\n};\n\n/**\n * Creates an {ImageWrapper) and copies the needed underlying image-data area\n * @param imageWrapper {ImageWrapper} The target {ImageWrapper} where the data should be copied\n * @param from {ImageRef} The location where to copy from (top-left location)\n */\nImageWrapper.prototype.subImageAsCopy = function(imageWrapper, from) {\n var sizeY = imageWrapper.size.y, sizeX = imageWrapper.size.x;\n var x, y;\n for ( x = 0; x < sizeX; x++) {\n for ( y = 0; y < sizeY; y++) {\n imageWrapper.data[y * sizeX + x] = this.data[(from.y + y) * this.size.x + from.x + x];\n }\n }\n};\n\nImageWrapper.prototype.copyTo = function(imageWrapper) {\n var length = this.data.length, srcData = this.data, dstData = imageWrapper.data;\n\n while (length--) {\n dstData[length] = srcData[length];\n }\n};\n\n/**\n * Retrieves a given pixel position from the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nImageWrapper.prototype.get = function(x, y) {\n return this.data[y * this.size.x + x];\n};\n\n/**\n * Retrieves a given pixel position from the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nImageWrapper.prototype.getSafe = function(x, y) {\n var i;\n\n if (!this.indexMapping) {\n this.indexMapping = {\n x : [],\n y : []\n };\n for (i = 0; i < this.size.x; i++) {\n this.indexMapping.x[i] = i;\n this.indexMapping.x[i + this.size.x] = i;\n }\n for (i = 0; i < this.size.y; i++) {\n this.indexMapping.y[i] = i;\n this.indexMapping.y[i + this.size.y] = i;\n }\n }\n return this.data[(this.indexMapping.y[y + this.size.y]) * this.size.x + this.indexMapping.x[x + this.size.x]];\n};\n\n/**\n * Sets a given pixel position in the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @param value {Number} The grayscale value to set\n * @returns {ImageWrapper} The Image itself (for possible chaining)\n */\nImageWrapper.prototype.set = function(x, y, value) {\n this.data[y * this.size.x + x] = value;\n return this;\n};\n\n/**\n * Sets the border of the image (1 pixel) to zero\n */\nImageWrapper.prototype.zeroBorder = function() {\n var i, width = this.size.x, height = this.size.y, data = this.data;\n for ( i = 0; i < width; i++) {\n data[i] = data[(height - 1) * width + i] = 0;\n }\n for ( i = 1; i < height - 1; i++) {\n data[i * width] = data[i * width + (width - 1)] = 0;\n }\n};\n\n/**\n * Inverts a binary image in place\n */\nImageWrapper.prototype.invert = function() {\n var data = this.data, length = data.length;\n\n while (length--) {\n data[length] = data[length] ? 0 : 1;\n }\n\n};\n\nImageWrapper.prototype.convolve = function(kernel) {\n var x, y, kx, ky, kSize = (kernel.length / 2) | 0, accu = 0;\n for ( y = 0; y < this.size.y; y++) {\n for ( x = 0; x < this.size.x; x++) {\n accu = 0;\n for ( ky = -kSize; ky <= kSize; ky++) {\n for ( kx = -kSize; kx <= kSize; kx++) {\n accu += kernel[ky+kSize][kx + kSize] * this.getSafe(x + kx, y + ky);\n }\n }\n this.data[y * this.size.x + x] = accu;\n }\n }\n};\n\nImageWrapper.prototype.moments = function(labelcount) {\n var data = this.data,\n x,\n y,\n height = this.size.y,\n width = this.size.x,\n val,\n ysq,\n labelsum = [],\n i,\n label,\n mu11,\n mu02,\n mu20,\n x_,\n y_,\n tmp,\n result = [],\n PI = Math.PI,\n PI_4 = PI / 4;\n\n if (labelcount <= 0) {\n return result;\n }\n\n for ( i = 0; i < labelcount; i++) {\n labelsum[i] = {\n m00 : 0,\n m01 : 0,\n m10 : 0,\n m11 : 0,\n m02 : 0,\n m20 : 0,\n theta : 0,\n rad : 0\n };\n }\n\n for ( y = 0; y < height; y++) {\n ysq = y * y;\n for ( x = 0; x < width; x++) {\n val = data[y * width + x];\n if (val > 0) {\n label = labelsum[val - 1];\n label.m00 += 1;\n label.m01 += y;\n label.m10 += x;\n label.m11 += x * y;\n label.m02 += ysq;\n label.m20 += x * x;\n }\n }\n }\n\n for ( i = 0; i < labelcount; i++) {\n label = labelsum[i];\n if (!isNaN(label.m00) && label.m00 !== 0) {\n x_ = label.m10 / label.m00;\n y_ = label.m01 / label.m00;\n mu11 = label.m11 / label.m00 - x_ * y_;\n mu02 = label.m02 / label.m00 - y_ * y_;\n mu20 = label.m20 / label.m00 - x_ * x_;\n tmp = (mu02 - mu20) / (2 * mu11);\n tmp = 0.5 * Math.atan(tmp) + (mu11 >= 0 ? PI_4 : -PI_4 ) + PI;\n label.theta = (tmp * 180 / PI + 90) % 180 - 90;\n if (label.theta < 0) {\n label.theta += 180;\n }\n label.rad = tmp > PI ? tmp - PI : tmp;\n label.vec = vec2.clone([Math.cos(tmp), Math.sin(tmp)]);\n result.push(label);\n }\n }\n\n return result;\n};\n\n/**\n * Displays the {ImageWrapper} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nImageWrapper.prototype.show = function(canvas, scale) {\n var ctx,\n frame,\n data,\n current,\n pixel,\n x,\n y;\n\n if (!scale) {\n scale = 1.0;\n }\n ctx = canvas.getContext('2d');\n canvas.width = this.size.x;\n canvas.height = this.size.y;\n frame = ctx.getImageData(0, 0, canvas.width, canvas.height);\n data = frame.data;\n current = 0;\n for (y = 0; y < this.size.y; y++) {\n for (x = 0; x < this.size.x; x++) {\n pixel = y * this.size.x + x;\n current = this.get(x, y) * scale;\n data[pixel * 4 + 0] = current;\n data[pixel * 4 + 1] = current;\n data[pixel * 4 + 2] = current;\n data[pixel * 4 + 3] = 255;\n }\n }\n //frame.data = data;\n ctx.putImageData(frame, 0, 0);\n};\n\n/**\n * Displays the {SubImage} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nImageWrapper.prototype.overlay = function(canvas, scale, from) {\n if (!scale || scale < 0 || scale > 360) {\n scale = 360;\n }\n var hsv = [0, 1, 1];\n var rgb = [0, 0, 0];\n var whiteRgb = [255, 255, 255];\n var blackRgb = [0, 0, 0];\n var result = [];\n var ctx = canvas.getContext('2d');\n var frame = ctx.getImageData(from.x, from.y, this.size.x, this.size.y);\n var data = frame.data;\n var length = this.data.length;\n while (length--) {\n hsv[0] = this.data[length] * scale;\n result = hsv[0] <= 0 ? whiteRgb : hsv[0] >= 360 ? blackRgb : CVUtils.hsv2rgb(hsv, rgb);\n data[length * 4 + 0] = result[0];\n data[length * 4 + 1] = result[1];\n data[length * 4 + 2] = result[2];\n data[length * 4 + 3] = 255;\n }\n ctx.putImageData(frame, from.x, from.y);\n};\n\nexport default ImageWrapper;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_wrapper.js\n **/","/**\n * Construct representing a part of another {ImageWrapper}. Shares data\n * between the parent and the child.\n * @param from {ImageRef} The position where to start the {SubImage} from. (top-left corner)\n * @param size {ImageRef} The size of the resulting image\n * @param I {ImageWrapper} The {ImageWrapper} to share from\n * @returns {SubImage} A shared part of the original image\n */\nfunction SubImage(from, size, I) {\n if (!I) {\n I = {\n data : null,\n size : size\n };\n }\n this.data = I.data;\n this.originalSize = I.size;\n this.I = I;\n\n this.from = from;\n this.size = size;\n}\n\n/**\n * Displays the {SubImage} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nSubImage.prototype.show = function(canvas, scale) {\n var ctx,\n frame,\n data,\n current,\n y,\n x,\n pixel;\n\n if (!scale) {\n scale = 1.0;\n }\n ctx = canvas.getContext('2d');\n canvas.width = this.size.x;\n canvas.height = this.size.y;\n frame = ctx.getImageData(0, 0, canvas.width, canvas.height);\n data = frame.data;\n current = 0;\n for (y = 0; y < this.size.y; y++) {\n for (x = 0; x < this.size.x; x++) {\n pixel = y * this.size.x + x;\n current = this.get(x, y) * scale;\n data[pixel * 4 + 0] = current;\n data[pixel * 4 + 1] = current;\n data[pixel * 4 + 2] = current;\n data[pixel * 4 + 3] = 255;\n }\n }\n frame.data = data;\n ctx.putImageData(frame, 0, 0);\n};\n\n/**\n * Retrieves a given pixel position from the {SubImage}\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nSubImage.prototype.get = function(x, y) {\n return this.data[(this.from.y + y) * this.originalSize.x + this.from.x + x];\n};\n\n/**\n * Updates the underlying data from a given {ImageWrapper}\n * @param image {ImageWrapper} The updated image\n */\nSubImage.prototype.updateData = function(image) {\n this.originalSize = image.size;\n this.data = image.data;\n};\n\n/**\n * Updates the position of the shared area\n * @param from {x,y} The new location\n * @returns {SubImage} returns {this} for possible chaining\n */\nSubImage.prototype.updateFrom = function(from) {\n this.from = from;\n return this;\n};\n\nexport default (SubImage);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/subImage.js\n **/","import Cluster2 from './cluster';\nimport ArrayHelper from './array_helper';\nimport {vec2, vec3} from 'gl-matrix';\n\nvar CVUtils = {};\n\n/**\n * @param x x-coordinate\n * @param y y-coordinate\n * @return ImageReference {x,y} Coordinate\n */\nCVUtils.imageRef = function(x, y) {\n var that = {\n x : x,\n y : y,\n toVec2 : function() {\n return vec2.clone([this.x, this.y]);\n },\n toVec3 : function() {\n return vec3.clone([this.x, this.y, 1]);\n },\n round : function() {\n this.x = this.x > 0.0 ? Math.floor(this.x + 0.5) : Math.floor(this.x - 0.5);\n this.y = this.y > 0.0 ? Math.floor(this.y + 0.5) : Math.floor(this.y - 0.5);\n return this;\n }\n };\n return that;\n};\n\n/**\n * Computes an integral image of a given grayscale image.\n * @param imageDataContainer {ImageDataContainer} the image to be integrated\n */\nCVUtils.computeIntegralImage2 = function(imageWrapper, integralWrapper) {\n var imageData = imageWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0, posA = 0, posB = 0, posC = 0, posD = 0, x, y;\n\n // sum up first column\n posB = width;\n sum = 0;\n for ( y = 1; y < height; y++) {\n sum += imageData[posA];\n integralImageData[posB] += sum;\n posA += width;\n posB += width;\n }\n\n posA = 0;\n posB = 1;\n sum = 0;\n for ( x = 1; x < width; x++) {\n sum += imageData[posA];\n integralImageData[posB] += sum;\n posA++;\n posB++;\n }\n\n for ( y = 1; y < height; y++) {\n posA = y * width + 1;\n posB = (y - 1) * width + 1;\n posC = y * width;\n posD = (y - 1) * width;\n for ( x = 1; x < width; x++) {\n integralImageData[posA] += imageData[posA] + integralImageData[posB] + integralImageData[posC] - integralImageData[posD];\n posA++;\n posB++;\n posC++;\n posD++;\n }\n }\n};\n\nCVUtils.computeIntegralImage = function(imageWrapper, integralWrapper) {\n var imageData = imageWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0;\n\n // sum up first row\n for (var i = 0; i < width; i++) {\n sum += imageData[i];\n integralImageData[i] = sum;\n }\n\n for (var v = 1; v < height; v++) {\n sum = 0;\n for (var u = 0; u < width; u++) {\n sum += imageData[v * width + u];\n integralImageData[((v) * width) + u] = sum + integralImageData[(v - 1) * width + u];\n }\n }\n};\n\nCVUtils.thresholdImage = function(imageWrapper, threshold, targetWrapper) {\n if (!targetWrapper) {\n targetWrapper = imageWrapper;\n }\n var imageData = imageWrapper.data, length = imageData.length, targetData = targetWrapper.data;\n\n while (length--) {\n targetData[length] = imageData[length] < threshold ? 1 : 0;\n }\n};\n\nCVUtils.computeHistogram = function(imageWrapper, bitsPerPixel) {\n if (!bitsPerPixel) {\n bitsPerPixel = 8;\n }\n var imageData = imageWrapper.data,\n length = imageData.length,\n bitShift = 8 - bitsPerPixel,\n bucketCnt = 1 << bitsPerPixel,\n hist = new Int32Array(bucketCnt);\n\n while (length--) {\n hist[imageData[length] >> bitShift]++;\n }\n return hist;\n};\n\nCVUtils.sharpenLine = function(line) {\n var i,\n length = line.length,\n left = line[0],\n center = line[1],\n right;\n\n for (i = 1; i < length - 1; i++) {\n right = line[i + 1];\n // -1 4 -1 kernel\n line[i-1] = (((center * 2) - left - right)) & 255;\n left = center;\n center = right;\n }\n return line;\n};\n\nCVUtils.determineOtsuThreshold = function(imageWrapper, bitsPerPixel) {\n if (!bitsPerPixel) {\n bitsPerPixel = 8;\n }\n var hist,\n threshold,\n bitShift = 8 - bitsPerPixel;\n\n function px(init, end) {\n var sum = 0, i;\n for ( i = init; i <= end; i++) {\n sum += hist[i];\n }\n return sum;\n }\n\n function mx(init, end) {\n var i, sum = 0;\n\n for ( i = init; i <= end; i++) {\n sum += i * hist[i];\n }\n\n return sum;\n }\n\n function determineThreshold() {\n var vet = [0], p1, p2, p12, k, m1, m2, m12,\n max = (1 << bitsPerPixel) - 1;\n\n hist = CVUtils.computeHistogram(imageWrapper, bitsPerPixel);\n for ( k = 1; k < max; k++) {\n p1 = px(0, k);\n p2 = px(k + 1, max);\n p12 = p1 * p2;\n if (p12 === 0) {\n p12 = 1;\n }\n m1 = mx(0, k) * p2;\n m2 = mx(k + 1, max) * p1;\n m12 = m1 - m2;\n vet[k] = m12 * m12 / p12;\n }\n return ArrayHelper.maxIndex(vet);\n }\n\n threshold = determineThreshold();\n return threshold << bitShift;\n};\n\nCVUtils.otsuThreshold = function(imageWrapper, targetWrapper) {\n var threshold = CVUtils.determineOtsuThreshold(imageWrapper);\n\n CVUtils.thresholdImage(imageWrapper, threshold, targetWrapper);\n return threshold;\n};\n\n// local thresholding\nCVUtils.computeBinaryImage = function(imageWrapper, integralWrapper, targetWrapper) {\n CVUtils.computeIntegralImage(imageWrapper, integralWrapper);\n\n if (!targetWrapper) {\n targetWrapper = imageWrapper;\n }\n var imageData = imageWrapper.data;\n var targetData = targetWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0, v, u, kernel = 3, A, B, C, D, avg, size = (kernel * 2 + 1) * (kernel * 2 + 1);\n\n // clear out top & bottom-border\n for ( v = 0; v <= kernel; v++) {\n for ( u = 0; u < width; u++) {\n targetData[((v) * width) + u] = 0;\n targetData[(((height - 1) - v) * width) + u] = 0;\n }\n }\n\n // clear out left & right border\n for ( v = kernel; v < height - kernel; v++) {\n for ( u = 0; u <= kernel; u++) {\n targetData[((v) * width) + u] = 0;\n targetData[((v) * width) + (width - 1 - u)] = 0;\n }\n }\n\n for ( v = kernel + 1; v < height - kernel - 1; v++) {\n for ( u = kernel + 1; u < width - kernel; u++) {\n A = integralImageData[(v - kernel - 1) * width + (u - kernel - 1)];\n B = integralImageData[(v - kernel - 1) * width + (u + kernel)];\n C = integralImageData[(v + kernel) * width + (u - kernel - 1)];\n D = integralImageData[(v + kernel) * width + (u + kernel)];\n sum = D - C - B + A;\n avg = sum / (size);\n targetData[v * width + u] = imageData[v * width + u] > (avg + 5) ? 0 : 1;\n }\n }\n};\n\nCVUtils.cluster = function(points, threshold, property) {\n var i, k, cluster, point, clusters = [];\n\n if (!property) {\n property = \"rad\";\n }\n\n function addToCluster(point) {\n var found = false;\n for ( k = 0; k < clusters.length; k++) {\n cluster = clusters[k];\n if (cluster.fits(point)) {\n cluster.add(point);\n found = true;\n }\n }\n return found;\n }\n\n // iterate over each cloud\n for ( i = 0; i < points.length; i++) {\n point = Cluster2.createPoint(points[i], i, property);\n if (!addToCluster(point)) {\n clusters.push(Cluster2.create(point, threshold));\n }\n }\n\n return clusters;\n\n};\n\nCVUtils.Tracer = {\n trace : function(points, vec) {\n var iteration, maxIterations = 10, top = [], result = [], centerPos = 0, currentPos = 0;\n\n function trace(idx, forward) {\n var from, to, toIdx, predictedPos, thresholdX = 1, thresholdY = Math.abs(vec[1] / 10), found = false;\n\n function match(pos, predicted) {\n if (pos.x > (predicted.x - thresholdX) && pos.x < (predicted.x + thresholdX) && pos.y > (predicted.y - thresholdY) && pos.y < (predicted.y + thresholdY)) {\n return true;\n } else {\n return false;\n }\n }\n\n // check if the next index is within the vec specifications\n // if not, check as long as the threshold is met\n\n from = points[idx];\n if (forward) {\n predictedPos = {\n x : from.x + vec[0],\n y : from.y + vec[1]\n };\n } else {\n predictedPos = {\n x : from.x - vec[0],\n y : from.y - vec[1]\n };\n }\n\n toIdx = forward ? idx + 1 : idx - 1;\n to = points[toIdx];\n while (to && ( found = match(to, predictedPos)) !== true && (Math.abs(to.y - from.y) < vec[1])) {\n toIdx = forward ? toIdx + 1 : toIdx - 1;\n to = points[toIdx];\n }\n\n return found ? toIdx : null;\n }\n\n for ( iteration = 0; iteration < maxIterations; iteration++) {\n // randomly select point to start with\n centerPos = Math.floor(Math.random() * points.length);\n\n // trace forward\n top = [];\n currentPos = centerPos;\n top.push(points[currentPos]);\n while (( currentPos = trace(currentPos, true)) !== null) {\n top.push(points[currentPos]);\n }\n if (centerPos > 0) {\n currentPos = centerPos;\n while (( currentPos = trace(currentPos, false)) !== null) {\n top.push(points[currentPos]);\n }\n }\n\n if (top.length > result.length) {\n result = top;\n }\n }\n\n return result;\n\n }\n};\n\nCVUtils.DILATE = 1;\nCVUtils.ERODE = 2;\n\nCVUtils.dilate = function(inImageWrapper, outImageWrapper) {\n var v, u, inImageData = inImageWrapper.data, outImageData = outImageWrapper.data, height = inImageWrapper.size.y, width = inImageWrapper.size.x, sum, yStart1, yStart2, xStart1, xStart2;\n\n for ( v = 1; v < height - 1; v++) {\n for ( u = 1; u < width - 1; u++) {\n yStart1 = v - 1;\n yStart2 = v + 1;\n xStart1 = u - 1;\n xStart2 = u + 1;\n sum = inImageData[yStart1 * width + xStart1]/* + inImageData[yStart1*width+u] */ + inImageData[yStart1 * width + xStart2] +\n /* inImageData[v*width+xStart1] + */\n inImageData[v * width + u] + /* inImageData[v*width+xStart2] +*/\n inImageData[yStart2 * width + xStart1]/* + inImageData[yStart2*width+u]*/ + inImageData[yStart2 * width + xStart2];\n outImageData[v * width + u] = sum > 0 ? 1 : 0;\n }\n }\n};\n\nCVUtils.erode = function(inImageWrapper, outImageWrapper) {\n var v, u, inImageData = inImageWrapper.data, outImageData = outImageWrapper.data, height = inImageWrapper.size.y, width = inImageWrapper.size.x, sum, yStart1, yStart2, xStart1, xStart2;\n\n for ( v = 1; v < height - 1; v++) {\n for ( u = 1; u < width - 1; u++) {\n yStart1 = v - 1;\n yStart2 = v + 1;\n xStart1 = u - 1;\n xStart2 = u + 1;\n sum = inImageData[yStart1 * width + xStart1]/* + inImageData[yStart1*width+u] */ + inImageData[yStart1 * width + xStart2] +\n /* inImageData[v*width+xStart1] + */\n inImageData[v * width + u] + /* inImageData[v*width+xStart2] +*/\n inImageData[yStart2 * width + xStart1]/* + inImageData[yStart2*width+u]*/ + inImageData[yStart2 * width + xStart2];\n outImageData[v * width + u] = sum === 5 ? 1 : 0;\n }\n }\n};\n\nCVUtils.subtract = function(aImageWrapper, bImageWrapper, resultImageWrapper) {\n if (!resultImageWrapper) {\n resultImageWrapper = aImageWrapper;\n }\n var length = aImageWrapper.data.length, aImageData = aImageWrapper.data, bImageData = bImageWrapper.data, cImageData = resultImageWrapper.data;\n\n while (length--) {\n cImageData[length] = aImageData[length] - bImageData[length];\n }\n};\n\nCVUtils.bitwiseOr = function(aImageWrapper, bImageWrapper, resultImageWrapper) {\n if (!resultImageWrapper) {\n resultImageWrapper = aImageWrapper;\n }\n var length = aImageWrapper.data.length, aImageData = aImageWrapper.data, bImageData = bImageWrapper.data, cImageData = resultImageWrapper.data;\n\n while (length--) {\n cImageData[length] = aImageData[length] || bImageData[length];\n }\n};\n\nCVUtils.countNonZero = function(imageWrapper) {\n var length = imageWrapper.data.length, data = imageWrapper.data, sum = 0;\n\n while (length--) {\n sum += data[length];\n }\n return sum;\n};\n\nCVUtils.topGeneric = function(list, top, scoreFunc) {\n var i, minIdx = 0, min = 0, queue = [], score, hit, pos;\n\n for ( i = 0; i < top; i++) {\n queue[i] = {\n score : 0,\n item : null\n };\n }\n\n for ( i = 0; i < list.length; i++) {\n score = scoreFunc.apply(this, [list[i]]);\n if (score > min) {\n hit = queue[minIdx];\n hit.score = score;\n hit.item = list[i];\n min = Number.MAX_VALUE;\n for ( pos = 0; pos < top; pos++) {\n if (queue[pos].score < min) {\n min = queue[pos].score;\n minIdx = pos;\n }\n }\n }\n }\n\n return queue;\n};\n\nCVUtils.grayArrayFromImage = function(htmlImage, offsetX, ctx, array) {\n ctx.drawImage(htmlImage, offsetX, 0, htmlImage.width, htmlImage.height);\n var ctxData = ctx.getImageData(offsetX, 0, htmlImage.width, htmlImage.height).data;\n CVUtils.computeGray(ctxData, array);\n};\n\nCVUtils.grayArrayFromContext = function(ctx, size, offset, array) {\n var ctxData = ctx.getImageData(offset.x, offset.y, size.x, size.y).data;\n CVUtils.computeGray(ctxData, array);\n};\n\nCVUtils.grayAndHalfSampleFromCanvasData = function(canvasData, size, outArray) {\n var topRowIdx = 0;\n var bottomRowIdx = size.x;\n var endIdx = Math.floor(canvasData.length / 4);\n var outWidth = size.x / 2;\n var outImgIdx = 0;\n var inWidth = size.x;\n var i;\n\n while (bottomRowIdx < endIdx) {\n for ( i = 0; i < outWidth; i++) {\n outArray[outImgIdx] = Math.floor(((0.299 * canvasData[topRowIdx * 4 + 0] + 0.587 * canvasData[topRowIdx * 4 + 1] + 0.114 * canvasData[topRowIdx * 4 + 2]) + (0.299 * canvasData[(topRowIdx + 1) * 4 + 0] + 0.587 * canvasData[(topRowIdx + 1) * 4 + 1] + 0.114 * canvasData[(topRowIdx + 1) * 4 + 2]) + (0.299 * canvasData[(bottomRowIdx) * 4 + 0] + 0.587 * canvasData[(bottomRowIdx) * 4 + 1] + 0.114 * canvasData[(bottomRowIdx) * 4 + 2]) + (0.299 * canvasData[(bottomRowIdx + 1) * 4 + 0] + 0.587 * canvasData[(bottomRowIdx + 1) * 4 + 1] + 0.114 * canvasData[(bottomRowIdx + 1) * 4 + 2])) / 4);\n outImgIdx++;\n topRowIdx = topRowIdx + 2;\n bottomRowIdx = bottomRowIdx + 2;\n }\n topRowIdx = topRowIdx + inWidth;\n bottomRowIdx = bottomRowIdx + inWidth;\n }\n\n};\n\nCVUtils.computeGray = function(imageData, outArray, config) {\n var l = (imageData.length / 4) | 0,\n i,\n singleChannel = config && config.singleChannel === true;\n\n if (singleChannel) {\n for (i = 0; i < l; i++) {\n outArray[i] = imageData[i * 4 + 0];\n }\n } else {\n for (i = 0; i < l; i++) {\n outArray[i] = Math.floor(0.299 * imageData[i * 4 + 0] + 0.587 * imageData[i * 4 + 1] + 0.114 * imageData[i * 4 + 2]);\n }\n }\n};\n\nCVUtils.loadImageArray = function(src, callback, canvas) {\n if (!canvas)\n canvas = document.createElement('canvas');\n var img = new Image();\n img.callback = callback;\n img.onload = function() {\n canvas.width = this.width;\n canvas.height = this.height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(this, 0, 0);\n var array = new Uint8Array(this.width * this.height);\n ctx.drawImage(this, 0, 0);\n var data = ctx.getImageData(0, 0, this.width, this.height).data;\n CVUtils.computeGray(data, array);\n this.callback(array, {\n x : this.width,\n y : this.height\n }, this);\n };\n img.src = src;\n};\n\n/**\n * @param inImg {ImageWrapper} input image to be sampled\n * @param outImg {ImageWrapper} to be stored in\n */\nCVUtils.halfSample = function(inImgWrapper, outImgWrapper) {\n var inImg = inImgWrapper.data;\n var inWidth = inImgWrapper.size.x;\n var outImg = outImgWrapper.data;\n var topRowIdx = 0;\n var bottomRowIdx = inWidth;\n var endIdx = inImg.length;\n var outWidth = inWidth / 2;\n var outImgIdx = 0;\n while (bottomRowIdx < endIdx) {\n for (var i = 0; i < outWidth; i++) {\n outImg[outImgIdx] = Math.floor((inImg[topRowIdx] + inImg[topRowIdx + 1] + inImg[bottomRowIdx] + inImg[bottomRowIdx + 1]) / 4);\n outImgIdx++;\n topRowIdx = topRowIdx + 2;\n bottomRowIdx = bottomRowIdx + 2;\n }\n topRowIdx = topRowIdx + inWidth;\n bottomRowIdx = bottomRowIdx + inWidth;\n }\n};\n\nCVUtils.hsv2rgb = function(hsv, rgb) {\n var h = hsv[0], s = hsv[1], v = hsv[2], c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c, r = 0, g = 0, b = 0;\n rgb = rgb || [0, 0, 0];\n\n if (h < 60) {\n r = c;\n g = x;\n } else if (h < 120) {\n r = x;\n g = c;\n } else if (h < 180) {\n g = c;\n b = x;\n } else if (h < 240) {\n g = x;\n b = c;\n } else if (h < 300) {\n r = x;\n b = c;\n } else if (h < 360) {\n r = c;\n b = x;\n }\n rgb[0] = ((r + m) * 255) | 0;\n rgb[1] = ((g + m) * 255) | 0;\n rgb[2] = ((b + m) * 255) | 0;\n return rgb;\n};\n\nCVUtils._computeDivisors = function(n) {\n var largeDivisors = [],\n divisors = [],\n i;\n\n for (i = 1; i < Math.sqrt(n) + 1; i++) {\n if (n % i === 0) {\n divisors.push(i);\n if (i !== n/i) {\n largeDivisors.unshift(Math.floor(n/i));\n }\n }\n }\n return divisors.concat(largeDivisors);\n};\n\nCVUtils._computeIntersection = function(arr1, arr2) {\n var i = 0,\n j = 0,\n result = [];\n\n while (i < arr1.length && j < arr2.length) {\n if (arr1[i] === arr2[j]) {\n result.push(arr1[i]);\n i++;\n j++;\n } else if (arr1[i] > arr2[j]) {\n j++;\n } else {\n i++;\n }\n }\n return result;\n};\n\nCVUtils.calculatePatchSize = function(patchSize, imgSize) {\n var divisorsX = this._computeDivisors(imgSize.x),\n divisorsY = this._computeDivisors(imgSize.y),\n wideSide = Math.max(imgSize.x, imgSize.y),\n common = this._computeIntersection(divisorsX, divisorsY),\n nrOfPatchesList = [8, 10, 15, 20, 32, 60, 80],\n nrOfPatchesMap = {\n \"x-small\": 5,\n \"small\": 4,\n \"medium\": 3,\n \"large\": 2,\n \"x-large\": 1\n },\n nrOfPatchesIdx = nrOfPatchesMap[patchSize] || nrOfPatchesMap.medium,\n nrOfPatches = nrOfPatchesList[nrOfPatchesIdx],\n desiredPatchSize = Math.floor(wideSide/nrOfPatches),\n optimalPatchSize;\n\n function findPatchSizeForDivisors(divisors) {\n var i = 0,\n found = divisors[Math.floor(divisors.length/2)];\n\n while(i < (divisors.length - 1) && divisors[i] < desiredPatchSize) {\n i++;\n }\n if (i > 0) {\n if (Math.abs(divisors[i] - desiredPatchSize) > Math.abs(divisors[i-1] - desiredPatchSize)) {\n found = divisors[i-1];\n } else {\n found = divisors[i];\n }\n }\n if (desiredPatchSize / found < nrOfPatchesList[nrOfPatchesIdx+1] / nrOfPatchesList[nrOfPatchesIdx] &&\n desiredPatchSize / found > nrOfPatchesList[nrOfPatchesIdx-1]/nrOfPatchesList[nrOfPatchesIdx] ) {\n return {x: found, y: found};\n }\n return null;\n }\n\n optimalPatchSize = findPatchSizeForDivisors(common);\n if (!optimalPatchSize) {\n optimalPatchSize = findPatchSizeForDivisors(this._computeDivisors(wideSide));\n if (!optimalPatchSize) {\n optimalPatchSize = findPatchSizeForDivisors((this._computeDivisors(desiredPatchSize * nrOfPatches)));\n }\n }\n return optimalPatchSize;\n};\n\nCVUtils._parseCSSDimensionValues = function(value) {\n var dimension = {\n value: parseFloat(value),\n unit: value.indexOf(\"%\") === value.length-1 ? \"%\" : \"%\"\n };\n\n return dimension;\n};\n\nCVUtils._dimensionsConverters = {\n top: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.height * (dimension.value / 100));\n }\n },\n right: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.width - (context.width * (dimension.value / 100)));\n }\n },\n bottom: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.height - (context.height * (dimension.value / 100)));\n }\n },\n left: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.width * (dimension.value / 100));\n }\n }\n};\n\nCVUtils.computeImageArea = function(inputWidth, inputHeight, area) {\n var context = {width: inputWidth, height: inputHeight};\n\n var parsedArea = Object.keys(area).reduce(function(result, key) {\n var value = area[key],\n parsed = CVUtils._parseCSSDimensionValues(value),\n calculated = CVUtils._dimensionsConverters[key](parsed, context);\n\n result[key] = calculated;\n return result;\n }, {});\n\n return {\n sx: parsedArea.left,\n sy: parsedArea.top,\n sw: parsedArea.right - parsedArea.left,\n sh: parsedArea.bottom - parsedArea.top\n };\n};\n\nexport default CVUtils;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/cv_utils.js\n **/","import {vec2} from 'gl-matrix';\n /**\n * Creates a cluster for grouping similar orientations of datapoints\n */\nexport default {\n create : function(point, threshold) {\n var points = [], center = {\n rad : 0,\n vec : vec2.clone([0, 0])\n }, pointMap = {};\n\n function init() {\n add(point);\n updateCenter();\n }\n\n function add(point) {\n pointMap[point.id] = point;\n points.push(point);\n }\n\n function updateCenter() {\n var i, sum = 0;\n for ( i = 0; i < points.length; i++) {\n sum += points[i].rad;\n }\n center.rad = sum / points.length;\n center.vec = vec2.clone([Math.cos(center.rad), Math.sin(center.rad)]);\n }\n\n init();\n\n return {\n add : function(point) {\n if (!pointMap[point.id]) {\n add(point);\n updateCenter();\n }\n },\n fits : function(point) {\n // check cosine similarity to center-angle\n var similarity = Math.abs(vec2.dot(point.point.vec, center.vec));\n if (similarity > threshold) {\n return true;\n }\n return false;\n },\n getPoints : function() {\n return points;\n },\n getCenter : function() {\n return center;\n }\n };\n },\n createPoint : function(point, id, property) {\n return {\n rad : point[property],\n point : point,\n id : id\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/cluster.js\n **/","/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.0\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n// END HEADER\n\nexports.glMatrix = require(\"./gl-matrix/common.js\");\nexports.mat2 = require(\"./gl-matrix/mat2.js\");\nexports.mat2d = require(\"./gl-matrix/mat2d.js\");\nexports.mat3 = require(\"./gl-matrix/mat3.js\");\nexports.mat4 = require(\"./gl-matrix/mat4.js\");\nexports.quat = require(\"./gl-matrix/quat.js\");\nexports.vec2 = require(\"./gl-matrix/vec2.js\");\nexports.vec3 = require(\"./gl-matrix/vec3.js\");\nexports.vec4 = require(\"./gl-matrix/vec4.js\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix.js\n ** module id = 9\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n/**\n * @class Common utilities\n * @name glMatrix\n */\nvar glMatrix = {};\n\n// Constants\nglMatrix.EPSILON = 0.000001;\nglMatrix.ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;\nglMatrix.RANDOM = Math.random;\n\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Type} type Array type, such as Float32Array or Array\n */\nglMatrix.setMatrixArrayType = function(type) {\n GLMAT_ARRAY_TYPE = type;\n}\n\nvar degree = Math.PI / 180;\n\n/**\n* Convert Degree To Radian\n*\n* @param {Number} Angle in Degrees\n*/\nglMatrix.toRadian = function(a){\n return a * degree;\n}\n\nmodule.exports = glMatrix;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/common.js\n ** module id = 10\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2x2 Matrix\n * @name mat2\n */\nvar mat2 = {};\n\n/**\n * Creates a new identity mat2\n *\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param {mat2} a matrix to clone\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Copy the values from one mat2 to another\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set a mat2 to the identity matrix\n *\n * @param {mat2} out the receiving matrix\n * @returns {mat2} out\n */\nmat2.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n\n // Calculate the determinant\n det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n \n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.adjoint = function(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2\n *\n * @param {mat2} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2.determinant = function (a) {\n return a[0] * a[3] - a[2] * a[1];\n};\n\n/**\n * Multiplies two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the first operand\n * @param {mat2} b the second operand\n * @returns {mat2} out\n */\nmat2.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n};\n\n/**\n * Alias for {@link mat2.multiply}\n * @function\n */\nmat2.mul = mat2.multiply;\n\n/**\n * Rotates a mat2 by the given angle\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n};\n\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2} out\n **/\nmat2.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n};\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.fromRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat2} out\n */\nmat2.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2\n *\n * @param {mat2} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat2.str = function (a) {\n return 'mat2(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param {mat2} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))\n};\n\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param {mat2} L the lower triangular matrix \n * @param {mat2} D the diagonal matrix \n * @param {mat2} U the upper triangular matrix \n * @param {mat2} a the input matrix to factorize\n */\n\nmat2.LDU = function (L, D, U, a) { \n L[2] = a[2]/a[0]; \n U[0] = a[0]; \n U[1] = a[1]; \n U[3] = a[3] - L[2] * U[1]; \n return [L, D, U]; \n}; \n\n\nmodule.exports = mat2;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat2.js\n ** module id = 11\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2x3 Matrix\n * @name mat2d\n * \n * @description \n * A mat2d contains six elements defined as:\n * \n * [a, c, tx,\n * b, d, ty]\n *
\n * This is a short form for the 3x3 matrix:\n * \n * [a, c, tx,\n * b, d, ty,\n * 0, 0, 1]\n *
\n * The last row is ignored so the array is shorter and operations are faster.\n */\nvar mat2d = {};\n\n/**\n * Creates a new identity mat2d\n *\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.create = function() {\n var out = new glMatrix.ARRAY_TYPE(6);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param {mat2d} a matrix to clone\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(6);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Copy the values from one mat2d to another\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Set a mat2d to the identity matrix\n *\n * @param {mat2d} out the receiving matrix\n * @returns {mat2d} out\n */\nmat2d.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Inverts a mat2d\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.invert = function(out, a) {\n var aa = a[0], ab = a[1], ac = a[2], ad = a[3],\n atx = a[4], aty = a[5];\n\n var det = aa * ad - ab * ac;\n if(!det){\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2d\n *\n * @param {mat2d} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2d.determinant = function (a) {\n return a[0] * a[3] - a[1] * a[2];\n};\n\n/**\n * Multiplies two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the first operand\n * @param {mat2d} b the second operand\n * @returns {mat2d} out\n */\nmat2d.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n};\n\n/**\n * Alias for {@link mat2d.multiply}\n * @function\n */\nmat2d.mul = mat2d.multiply;\n\n/**\n * Rotates a mat2d by the given angle\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2d} out\n **/\nmat2d.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to translate the matrix by\n * @returns {mat2d} out\n **/\nmat2d.translate = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n};\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.rotate(dest, dest, rad);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.fromRotation = function(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.scale(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat2d} out\n */\nmat2d.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.translate(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {vec2} v Translation vector\n * @returns {mat2d} out\n */\nmat2d.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2d\n *\n * @param {mat2d} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat2d.str = function (a) {\n return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n a[3] + ', ' + a[4] + ', ' + a[5] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param {mat2d} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2d.frob = function (a) { \n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))\n}; \n\nmodule.exports = mat2d;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat2d.js\n ** module id = 12\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 3x3 Matrix\n * @name mat3\n */\nvar mat3 = {};\n\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.create = function() {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {mat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\nmat3.fromMat4 = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n};\n\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {mat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\nmat3.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b01 = a22 * a11 - a12 * a21,\n b11 = -a22 * a10 + a12 * a20,\n b21 = a21 * a10 - a11 * a20,\n\n // Calculate the determinant\n det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n out[0] = (a11 * a22 - a12 * a21);\n out[1] = (a02 * a21 - a01 * a22);\n out[2] = (a01 * a12 - a02 * a11);\n out[3] = (a12 * a20 - a10 * a22);\n out[4] = (a00 * a22 - a02 * a20);\n out[5] = (a02 * a10 - a00 * a12);\n out[6] = (a10 * a21 - a11 * a20);\n out[7] = (a01 * a20 - a00 * a21);\n out[8] = (a00 * a11 - a01 * a10);\n return out;\n};\n\n/**\n * Calculates the determinant of a mat3\n *\n * @param {mat3} a the source matrix\n * @returns {Number} determinant of a\n */\nmat3.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n};\n\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the first operand\n * @param {mat3} b the second operand\n * @returns {mat3} out\n */\nmat3.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b00 = b[0], b01 = b[1], b02 = b[2],\n b10 = b[3], b11 = b[4], b12 = b[5],\n b20 = b[6], b21 = b[7], b22 = b[8];\n\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n};\n\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\nmat3.mul = mat3.multiply;\n\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to translate\n * @param {vec2} v vector to translate by\n * @returns {mat3} out\n */\nmat3.translate = function(out, a, v) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n x = v[0], y = v[1];\n\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n};\n\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.rotate = function (out, a, rad) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n s = Math.sin(rad),\n c = Math.cos(rad);\n\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n};\n\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\nmat3.scale = function(out, a, v) {\n var x = v[0], y = v[1];\n\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {vec2} v Translation vector\n * @returns {mat3} out\n */\nmat3.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.fromRotation = function(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat3} out\n */\nmat3.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat2d} a the matrix to copy\n * @returns {mat3} out\n **/\nmat3.fromMat2d = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n};\n\n/**\n* Calculates a 3x3 matrix from the given quaternion\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {quat} q Quaternion to create matrix from\n*\n* @returns {mat3} out\n*/\nmat3.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n\n return out;\n};\n\n/**\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {mat4} a Mat4 to derive the normal matrix from\n*\n* @returns {mat3} out\n*/\nmat3.normalFromMat4 = function (out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\n return out;\n};\n\n/**\n * Returns a string representation of a mat3\n *\n * @param {mat3} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat3.str = function (a) {\n return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + \n a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {mat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat3.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))\n};\n\n\nmodule.exports = mat3;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat3.js\n ** module id = 13\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 4x4 Matrix\n * @name mat4\n */\nvar mat4 = {};\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.create = function() {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {mat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\nmat4.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a03 = a[3],\n a12 = a[6], a13 = a[7],\n a23 = a[11];\n\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));\n out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));\n return out;\n};\n\n/**\n * Calculates the determinant of a mat4\n *\n * @param {mat4} a the source matrix\n * @returns {Number} determinant of a\n */\nmat4.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n};\n\n/**\n * Multiplies two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the first operand\n * @param {mat4} b the second operand\n * @returns {mat4} out\n */\nmat4.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n // Cache only the current line of the second matrix\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; \n out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n return out;\n};\n\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\nmat4.mul = mat4.multiply;\n\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to translate\n * @param {vec3} v vector to translate by\n * @returns {mat4} out\n */\nmat4.translate = function (out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n};\n\n/**\n * Scales the mat4 by the dimensions in the given vec3\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to scale\n * @param {vec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nmat4.scale = function(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.rotate = function (out, a, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t,\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23,\n b00, b01, b02,\n b10, b11, b12,\n b20, b21, b22;\n\n if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n \n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n // Construct the elements of the rotation matrix\n b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;\n b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;\n b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;\n\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateX = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateY = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateZ = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n};\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {vec3} v Scaling vector\n * @returns {mat4} out\n */\nmat4.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.fromRotation = function(out, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t;\n \n if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n \n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n \n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n \n // Perform rotation-specific matrix multiplication\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromXRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromYRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromZRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslation = function (out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n \n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @param {vec3} s Scaling vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslationScale = function (out, q, v, s) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2,\n sx = s[0],\n sy = s[1],\n sz = s[2];\n\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n \n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @param {vec3} s Scaling vector\n * @param {vec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\nmat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2,\n \n sx = s[0],\n sy = s[1],\n sz = s[2],\n\n ox = o[0],\n oy = o[1],\n oz = o[2];\n \n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);\n out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);\n out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);\n out[15] = 1;\n \n return out;\n};\n\nmat4.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.frustum = function (out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left),\n tb = 1 / (top - bottom),\n nf = 1 / (near - far);\n out[0] = (near * 2) * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = (near * 2) * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (far * near * 2) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspective = function (out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (2 * far * near) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspectiveFromFieldOfView = function (out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),\n downTan = Math.tan(fov.downDegrees * Math.PI/180.0),\n leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),\n rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n}\n\n/**\n * Generates a orthogonal projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.ortho = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {vec3} eye Position of the viewer\n * @param {vec3} center Point the viewer is looking at\n * @param {vec3} up vec3 pointing up\n * @returns {mat4} out\n */\nmat4.lookAt = function (out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,\n eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2],\n centerx = center[0],\n centery = center[1],\n centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&\n Math.abs(eyey - centery) < glMatrix.EPSILON &&\n Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return mat4.identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Returns a string representation of a mat4\n *\n * @param {mat4} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat4.str = function (a) {\n return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +\n a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +\n a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + \n a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {mat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat4.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))\n};\n\n\nmodule.exports = mat4;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat4.js\n ** module id = 14\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\nvar mat3 = require(\"./mat3.js\");\nvar vec3 = require(\"./vec3.js\");\nvar vec4 = require(\"./vec4.js\");\n\n/**\n * @class Quaternion\n * @name quat\n */\nvar quat = {};\n\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\nquat.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {vec3} a the initial vector\n * @param {vec3} b the destination vector\n * @returns {quat} out\n */\nquat.rotationTo = (function() {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1,0,0);\n var yUnitVec3 = vec3.fromValues(0,1,0);\n\n return function(out, a, b) {\n var dot = vec3.dot(a, b);\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.length(tmpvec3) < 0.000001)\n vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n quat.setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return quat.normalize(out, out);\n }\n };\n})();\n\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {vec3} view the vector representing the viewing direction\n * @param {vec3} right the vector representing the local \"right\" direction\n * @param {vec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\nquat.setAxes = (function() {\n var matr = mat3.create();\n\n return function(out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n\n return quat.normalize(out, quat.fromMat3(out, matr));\n };\n})();\n\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {quat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\nquat.clone = vec4.clone;\n\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\nquat.fromValues = vec4.fromValues;\n\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the source quaternion\n * @returns {quat} out\n * @function\n */\nquat.copy = vec4.copy;\n\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\nquat.set = vec4.set;\n\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\nquat.identity = function(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {vec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\nquat.setAxisAngle = function(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n};\n\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n * @function\n */\nquat.add = vec4.add;\n\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n */\nquat.multiply = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n};\n\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\nquat.mul = quat.multiply;\n\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {quat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\nquat.scale = vec4.scale;\n\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateX = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateY = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n by = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateZ = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bz = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n};\n\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate W component of\n * @returns {quat} out\n */\nquat.calculateW = function (out, a) {\n var x = a[0], y = a[1], z = a[2];\n\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n};\n\n/**\n * Calculates the dot product of two quat's\n *\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\nquat.dot = vec4.dot;\n\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n * @function\n */\nquat.lerp = vec4.lerp;\n\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n */\nquat.slerp = function (out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n var omega, cosom, sinom, scale0, scale1;\n\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if ( cosom < 0.0 ) {\n cosom = -cosom;\n bx = - bx;\n by = - by;\n bz = - bz;\n bw = - bw;\n }\n // calculate coefficients\n if ( (1.0 - cosom) > 0.000001 ) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else { \n // \"from\" and \"to\" quaternions are very close \n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n \n return out;\n};\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {quat} c the third operand\n * @param {quat} d the fourth operand\n * @param {Number} t interpolation amount\n * @returns {quat} out\n */\nquat.sqlerp = (function () {\n var temp1 = quat.create();\n var temp2 = quat.create();\n \n return function (out, a, b, c, d, t) {\n quat.slerp(temp1, a, d, t);\n quat.slerp(temp2, b, c, t);\n quat.slerp(out, temp1, temp2, 2 * t * (1 - t));\n \n return out;\n };\n}());\n\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate inverse of\n * @returns {quat} out\n */\nquat.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,\n invDot = dot ? 1.0/dot : 0;\n \n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0*invDot;\n out[1] = -a1*invDot;\n out[2] = -a2*invDot;\n out[3] = a3*invDot;\n return out;\n};\n\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate conjugate of\n * @returns {quat} out\n */\nquat.conjugate = function (out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Calculates the length of a quat\n *\n * @param {quat} a vector to calculate length of\n * @returns {Number} length of a\n * @function\n */\nquat.length = vec4.length;\n\n/**\n * Alias for {@link quat.length}\n * @function\n */\nquat.len = quat.length;\n\n/**\n * Calculates the squared length of a quat\n *\n * @param {quat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\nquat.squaredLength = vec4.squaredLength;\n\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\nquat.sqrLen = quat.squaredLength;\n\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\nquat.normalize = vec4.normalize;\n\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {mat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\nquat.fromMat3 = function(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if ( fTrace > 0.0 ) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5/fRoot; // 1/(4w)\n out[0] = (m[5]-m[7])*fRoot;\n out[1] = (m[6]-m[2])*fRoot;\n out[2] = (m[1]-m[3])*fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if ( m[4] > m[0] )\n i = 1;\n if ( m[8] > m[i*3+i] )\n i = 2;\n var j = (i+1)%3;\n var k = (i+2)%3;\n \n fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;\n out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;\n out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;\n }\n \n return out;\n};\n\n/**\n * Returns a string representation of a quatenion\n *\n * @param {quat} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nquat.str = function (a) {\n return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\nmodule.exports = quat;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/quat.js\n ** module id = 15\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 3 Dimensional Vector\n * @name vec3\n */\nvar vec3 = {};\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\nvec3.create = function() {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {vec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\nvec3.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\nvec3.fromValues = function(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the source vector\n * @returns {vec3} out\n */\nvec3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\nvec3.set = function(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\nvec3.sub = vec3.subtract;\n\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\nvec3.mul = vec3.multiply;\n\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\nvec3.div = vec3.divide;\n\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n};\n\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\nvec3.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n};\n\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\nvec3.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} distance between a and b\n */\nvec3.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\nvec3.dist = vec3.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec3.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\nvec3.sqrDist = vec3.squaredDistance;\n\n/**\n * Calculates the length of a vec3\n *\n * @param {vec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec3.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.length}\n * @function\n */\nvec3.len = vec3.length;\n\n/**\n * Calculates the squared length of a vec3\n *\n * @param {vec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec3.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\nvec3.sqrLen = vec3.squaredLength;\n\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to negate\n * @returns {vec3} out\n */\nvec3.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to invert\n * @returns {vec3} out\n */\nvec3.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n};\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to normalize\n * @returns {vec3} out\n */\nvec3.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var len = x*x + y*y + z*z;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec3.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n};\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.cross = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2],\n bx = b[0], by = b[1], bz = b[2];\n\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n};\n\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {vec3} c the third operand\n * @param {vec3} d the fourth operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.hermite = function (out, a, b, c, d, t) {\n var factorTimes2 = t * t,\n factor1 = factorTimes2 * (2 * t - 3) + 1,\n factor2 = factorTimes2 * (t - 2) + t,\n factor3 = factorTimes2 * (t - 1),\n factor4 = factorTimes2 * (3 - 2 * t);\n \n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n \n return out;\n};\n\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {vec3} c the third operand\n * @param {vec3} d the fourth operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.bezier = function (out, a, b, c, d, t) {\n var inverseFactor = 1 - t,\n inverseFactorTimesTwo = inverseFactor * inverseFactor,\n factorTimes2 = t * t,\n factor1 = inverseFactorTimesTwo * inverseFactor,\n factor2 = 3 * t * inverseFactorTimesTwo,\n factor3 = 3 * factorTimes2 * inverseFactor,\n factor4 = factorTimes2 * t;\n \n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n \n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\nvec3.random = function (out, scale) {\n scale = scale || 1.0;\n\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = (glMatrix.RANDOM() * 2.0) - 1.0;\n var zScale = Math.sqrt(1.0-z*z) * scale;\n\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2],\n w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat3 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n};\n\n/**\n * Transforms the vec3 with a quat\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec3} out\n */\nvec3.transformQuat = function(out, a, q) {\n // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations\n\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n};\n\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateX = function(out, a, b, c){\n var p = [], r=[];\n\t //Translate point to the origin\n\t p[0] = a[0] - b[0];\n\t p[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n\n\t //perform rotation\n\t r[0] = p[0];\n\t r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);\n\t r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);\n\n\t //translate to correct position\n\t out[0] = r[0] + b[0];\n\t out[1] = r[1] + b[1];\n\t out[2] = r[2] + b[2];\n\n \treturn out;\n};\n\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateY = function(out, a, b, c){\n \tvar p = [], r=[];\n \t//Translate point to the origin\n \tp[0] = a[0] - b[0];\n \tp[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n \n \t//perform rotation\n \tr[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);\n \tr[1] = p[1];\n \tr[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);\n \n \t//translate to correct position\n \tout[0] = r[0] + b[0];\n \tout[1] = r[1] + b[1];\n \tout[2] = r[2] + b[2];\n \n \treturn out;\n};\n\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateZ = function(out, a, b, c){\n \tvar p = [], r=[];\n \t//Translate point to the origin\n \tp[0] = a[0] - b[0];\n \tp[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n \n \t//perform rotation\n \tr[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);\n \tr[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);\n \tr[2] = p[2];\n \n \t//translate to correct position\n \tout[0] = r[0] + b[0];\n \tout[1] = r[1] + b[1];\n \tout[2] = r[2] + b[2];\n \n \treturn out;\n};\n\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec3.forEach = (function() {\n var vec = vec3.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 3;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];\n }\n \n return a;\n };\n})();\n\n/**\n * Get the angle between two 3D vectors\n * @param {vec3} a The first operand\n * @param {vec3} b The second operand\n * @returns {Number} The angle in radians\n */\nvec3.angle = function(a, b) {\n \n var tempA = vec3.fromValues(a[0], a[1], a[2]);\n var tempB = vec3.fromValues(b[0], b[1], b[2]);\n \n vec3.normalize(tempA, tempA);\n vec3.normalize(tempB, tempB);\n \n var cosine = vec3.dot(tempA, tempB);\n\n if(cosine > 1.0){\n return 0;\n } else {\n return Math.acos(cosine);\n } \n};\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec3} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec3.str = function (a) {\n return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n};\n\nmodule.exports = vec3;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec3.js\n ** module id = 16\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 4 Dimensional Vector\n * @name vec4\n */\nvar vec4 = {};\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\nvec4.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {vec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\nvec4.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\nvec4.fromValues = function(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the source vector\n * @returns {vec4} out\n */\nvec4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\nvec4.set = function(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\nvec4.sub = vec4.subtract;\n\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\nvec4.mul = vec4.multiply;\n\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\nvec4.div = vec4.divide;\n\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n};\n\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\nvec4.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n};\n\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\nvec4.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n out[3] = a[3] + (b[3] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} distance between a and b\n */\nvec4.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\nvec4.dist = vec4.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec4.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\nvec4.sqrDist = vec4.squaredDistance;\n\n/**\n * Calculates the length of a vec4\n *\n * @param {vec4} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec4.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.length}\n * @function\n */\nvec4.len = vec4.length;\n\n/**\n * Calculates the squared length of a vec4\n *\n * @param {vec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec4.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\nvec4.sqrLen = vec4.squaredLength;\n\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to negate\n * @returns {vec4} out\n */\nvec4.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to invert\n * @returns {vec4} out\n */\nvec4.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n};\n\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to normalize\n * @returns {vec4} out\n */\nvec4.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var len = x*x + y*y + z*z + w*w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec4.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n};\n\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec4} out\n */\nvec4.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\nvec4.random = function (out, scale) {\n scale = scale || 1.0;\n\n //TODO: This is a pretty awful way of doing this. Find something better.\n out[0] = glMatrix.RANDOM();\n out[1] = glMatrix.RANDOM();\n out[2] = glMatrix.RANDOM();\n out[3] = glMatrix.RANDOM();\n vec4.normalize(out, out);\n vec4.scale(out, out, scale);\n return out;\n};\n\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec4} out\n */\nvec4.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n};\n\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec4} out\n */\nvec4.transformQuat = function(out, a, q) {\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec4.forEach = (function() {\n var vec = vec4.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 4;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];\n }\n \n return a;\n };\n})();\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec4} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec4.str = function (a) {\n return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\nmodule.exports = vec4;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec4.js\n ** module id = 17\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2 Dimensional Vector\n * @name vec2\n */\nvar vec2 = {};\n\n/**\n * Creates a new, empty vec2\n *\n * @returns {vec2} a new 2D vector\n */\nvec2.create = function() {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = 0;\n out[1] = 0;\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param {vec2} a vector to clone\n * @returns {vec2} a new 2D vector\n */\nvec2.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} a new 2D vector\n */\nvec2.fromValues = function(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Copy the values from one vec2 to another\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the source vector\n * @returns {vec2} out\n */\nvec2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {vec2} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} out\n */\nvec2.set = function(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Adds two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\nvec2.sub = vec2.subtract;\n\n/**\n * Multiplies two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\nvec2.mul = vec2.multiply;\n\n/**\n * Divides two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\nvec2.div = vec2.divide;\n\n/**\n * Returns the minimum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n};\n\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec2} out\n */\nvec2.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n};\n\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec2} out\n */\nvec2.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} distance between a and b\n */\nvec2.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\nvec2.dist = vec2.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec2.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\nvec2.sqrDist = vec2.squaredDistance;\n\n/**\n * Calculates the length of a vec2\n *\n * @param {vec2} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec2.length = function (a) {\n var x = a[0],\n y = a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.length}\n * @function\n */\nvec2.len = vec2.length;\n\n/**\n * Calculates the squared length of a vec2\n *\n * @param {vec2} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec2.squaredLength = function (a) {\n var x = a[0],\n y = a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\nvec2.sqrLen = vec2.squaredLength;\n\n/**\n * Negates the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to negate\n * @returns {vec2} out\n */\nvec2.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to invert\n * @returns {vec2} out\n */\nvec2.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n};\n\n/**\n * Normalize a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to normalize\n * @returns {vec2} out\n */\nvec2.normalize = function(out, a) {\n var x = a[0],\n y = a[1];\n var len = x*x + y*y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec2.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1];\n};\n\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec3} out\n */\nvec2.cross = function(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec2} out\n */\nvec2.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec2} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec2} out\n */\nvec2.random = function (out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2d} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2d = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat3} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat3 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat4 = function(out, a, m) {\n var x = a[0], \n y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec2.forEach = (function() {\n var vec = vec2.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 2;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1];\n }\n \n return a;\n };\n})();\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec2} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec2.str = function (a) {\n return 'vec2(' + a[0] + ', ' + a[1] + ')';\n};\n\nmodule.exports = vec2;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec2.js\n ** module id = 18\n ** module chunks = 0\n **/","export default {\n init : function(arr, val) {\n var l = arr.length;\n while (l--) {\n arr[l] = val;\n }\n },\n\n /**\n * Shuffles the content of an array\n * @return {Array} the array itself shuffled\n */\n shuffle : function(arr) {\n var i = arr.length - 1, j, x;\n for (i; i >= 0; i--) {\n j = Math.floor(Math.random() * i);\n x = arr[i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n },\n\n toPointList : function(arr) {\n var i, j, row = [], rows = [];\n for ( i = 0; i < arr.length; i++) {\n row = [];\n for ( j = 0; j < arr[i].length; j++) {\n row[j] = arr[i][j];\n }\n rows[i] = \"[\" + row.join(\",\") + \"]\";\n }\n return \"[\" + rows.join(\",\\r\\n\") + \"]\";\n },\n\n /**\n * returns the elements which's score is bigger than the threshold\n * @return {Array} the reduced array\n */\n threshold : function(arr, threshold, scoreFunc) {\n var i, queue = [];\n for ( i = 0; i < arr.length; i++) {\n if (scoreFunc.apply(arr, [arr[i]]) >= threshold) {\n queue.push(arr[i]);\n }\n }\n return queue;\n },\n\n maxIndex : function(arr) {\n var i, max = 0;\n for ( i = 0; i < arr.length; i++) {\n if (arr[i] > arr[max]) {\n max = i;\n }\n }\n return max;\n },\n\n max : function(arr) {\n var i, max = 0;\n for ( i = 0; i < arr.length; i++) {\n if (arr[i] > max) {\n max = arr[i];\n }\n }\n return max;\n },\n\n sum: function(arr) {\n var length = arr.length,\n sum = 0;\n\n while(length--) {\n sum += arr[length];\n }\n return sum;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/array_helper.js\n **/","/* jshint undef: true, unused: true, browser:true, devel: true */\n/* global define */\n\nimport ImageWrapper from './image_wrapper';\nimport CVUtils from './cv_utils';\nimport Rasterizer from './rasterizer';\nimport Tracer from './tracer';\nimport skeletonizer from './skeletonizer';\nimport ArrayHelper from './array_helper';\nimport ImageDebug from './image_debug';\nimport glMatrix from 'gl-matrix';\n\nvar _config,\n _currentImageWrapper,\n _skelImageWrapper,\n _subImageWrapper,\n _labelImageWrapper,\n _patchGrid,\n _patchLabelGrid,\n _imageToPatchGrid,\n _binaryImageWrapper,\n _patchSize,\n _canvasContainer = {\n ctx : {\n binary : null\n },\n dom : {\n binary : null\n }\n },\n _numPatches = {x: 0, y: 0},\n _inputImageWrapper,\n _skeletonizer,\n vec2 = glMatrix.vec2,\n mat2 = glMatrix.mat2,\n self = (typeof window !== 'undefined') ? window : self;\n\nfunction initBuffers() {\n var skeletonImageData;\n\n if (_config.halfSample) {\n _currentImageWrapper = new ImageWrapper({\n x : _inputImageWrapper.size.x / 2 | 0,\n y : _inputImageWrapper.size.y / 2 | 0\n });\n } else {\n _currentImageWrapper = _inputImageWrapper;\n }\n\n _patchSize = CVUtils.calculatePatchSize(_config.patchSize, _currentImageWrapper.size);\n\n _numPatches.x = _currentImageWrapper.size.x / _patchSize.x | 0;\n _numPatches.y = _currentImageWrapper.size.y / _patchSize.y | 0;\n\n _binaryImageWrapper = new ImageWrapper(_currentImageWrapper.size, undefined, Uint8Array, false);\n\n _labelImageWrapper = new ImageWrapper(_patchSize, undefined, Array, true);\n\n skeletonImageData = new ArrayBuffer(64*1024);\n _subImageWrapper = new ImageWrapper(_patchSize, new Uint8Array(skeletonImageData, 0, _patchSize.x * _patchSize.y));\n _skelImageWrapper = new ImageWrapper(_patchSize, new Uint8Array(skeletonImageData, _patchSize.x * _patchSize.y * 3, _patchSize.x * _patchSize.y), undefined, true);\n _skeletonizer = skeletonizer(self, {\n size : _patchSize.x\n }, skeletonImageData);\n\n _imageToPatchGrid = new ImageWrapper({\n x : (_currentImageWrapper.size.x / _subImageWrapper.size.x) | 0,\n y : (_currentImageWrapper.size.y / _subImageWrapper.size.y) | 0\n }, undefined, Array, true);\n _patchGrid = new ImageWrapper(_imageToPatchGrid.size, undefined, undefined, true);\n _patchLabelGrid = new ImageWrapper(_imageToPatchGrid.size, undefined, Int32Array, true);\n}\n\nfunction initCanvas() {\n if (_config.useWorker || typeof document === 'undefined') {\n return;\n }\n _canvasContainer.dom.binary = document.createElement(\"canvas\");\n _canvasContainer.dom.binary.className = \"binaryBuffer\";\n if (_config.showCanvas === true) {\n document.querySelector(\"#debug\").appendChild(_canvasContainer.dom.binary);\n }\n _canvasContainer.ctx.binary = _canvasContainer.dom.binary.getContext(\"2d\");\n _canvasContainer.dom.binary.width = _binaryImageWrapper.size.x;\n _canvasContainer.dom.binary.height = _binaryImageWrapper.size.y;\n}\n\n/**\n * Creates a bounding box which encloses all the given patches\n * @returns {Array} The minimal bounding box\n */\nfunction boxFromPatches(patches) {\n var overAvg, i, j, patch, transMat, minx = _binaryImageWrapper.size.x, miny = _binaryImageWrapper.size.y, maxx = -_binaryImageWrapper.size.x, maxy = -_binaryImageWrapper.size.y, box, scale;\n\n // draw all patches which are to be taken into consideration\n overAvg = 0;\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n overAvg += patch.rad;\n if (_config.showPatches) {\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"red\"});\n }\n }\n\n overAvg /= patches.length;\n overAvg = (overAvg * 180 / Math.PI + 90) % 180 - 90;\n if (overAvg < 0) {\n overAvg += 180;\n }\n\n overAvg = (180 - overAvg) * Math.PI / 180;\n transMat = mat2.clone([Math.cos(overAvg), Math.sin(overAvg), -Math.sin(overAvg), Math.cos(overAvg)]);\n\n // iterate over patches and rotate by angle\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n for ( j = 0; j < 4; j++) {\n vec2.transformMat2(patch.box[j], patch.box[j], transMat);\n }\n\n if (_config.boxFromPatches.showTransformed) {\n ImageDebug.drawPath(patch.box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#99ff00', lineWidth: 2});\n }\n }\n\n // find bounding box\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n for ( j = 0; j < 4; j++) {\n if (patch.box[j][0] < minx) {\n minx = patch.box[j][0];\n }\n if (patch.box[j][0] > maxx) {\n maxx = patch.box[j][0];\n }\n if (patch.box[j][1] < miny) {\n miny = patch.box[j][1];\n }\n if (patch.box[j][1] > maxy) {\n maxy = patch.box[j][1];\n }\n }\n }\n\n box = [[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]];\n\n if (_config.boxFromPatches.showTransformedBox) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});\n }\n\n scale = _config.halfSample ? 2 : 1;\n // reverse rotation;\n transMat = mat2.invert(transMat, transMat);\n for ( j = 0; j < 4; j++) {\n vec2.transformMat2(box[j], box[j], transMat);\n }\n\n if (_config.boxFromPatches.showBB) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});\n }\n\n for ( j = 0; j < 4; j++) {\n vec2.scale(box[j], box[j], scale);\n }\n\n return box;\n}\n\n/**\n * Creates a binary image of the current image\n */\nfunction binarizeImage() {\n CVUtils.otsuThreshold(_currentImageWrapper, _binaryImageWrapper);\n _binaryImageWrapper.zeroBorder();\n if (_config.showCanvas) {\n _binaryImageWrapper.show(_canvasContainer.dom.binary, 255);\n }\n}\n\n/**\n * Iterate over the entire image\n * extract patches\n */\nfunction findPatches() {\n var i,\n j,\n x,\n y,\n moments,\n patchesFound = [],\n rasterizer,\n rasterResult,\n patch;\n for ( i = 0; i < _numPatches.x; i++) {\n for ( j = 0; j < _numPatches.y; j++) {\n\n x = _subImageWrapper.size.x * i;\n y = _subImageWrapper.size.y * j;\n\n // seperate parts\n skeletonize(x, y);\n\n // Rasterize, find individual bars\n _skelImageWrapper.zeroBorder();\n ArrayHelper.init(_labelImageWrapper.data, 0);\n rasterizer = Rasterizer.create(_skelImageWrapper, _labelImageWrapper);\n rasterResult = rasterizer.rasterize(0);\n\n if (_config.showLabels) {\n _labelImageWrapper.overlay(_canvasContainer.dom.binary, Math.floor(360 / rasterResult.count), {x : x, y : y});\n }\n\n // calculate moments from the skeletonized patch\n moments = _labelImageWrapper.moments(rasterResult.count);\n\n // extract eligible patches\n patchesFound = patchesFound.concat(describePatch(moments, [i, j], x, y));\n }\n }\n\n if (_config.showFoundPatches) {\n for ( i = 0; i < patchesFound.length; i++) {\n patch = patchesFound[i];\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"#99ff00\", lineWidth: 2});\n }\n }\n\n return patchesFound;\n}\n\n/**\n * Finds those connected areas which contain at least 6 patches\n * and returns them ordered DESC by the number of contained patches\n * @param {Number} maxLabel\n */\nfunction findBiggestConnectedAreas(maxLabel){\n var i,\n sum,\n labelHist = [],\n topLabels = [];\n\n for ( i = 0; i < maxLabel; i++) {\n labelHist.push(0);\n }\n sum = _patchLabelGrid.data.length;\n while (sum--) {\n if (_patchLabelGrid.data[sum] > 0) {\n labelHist[_patchLabelGrid.data[sum] - 1]++;\n }\n }\n\n labelHist = labelHist.map(function(val, idx) {\n return {\n val : val,\n label : idx + 1\n };\n });\n\n labelHist.sort(function(a, b) {\n return b.val - a.val;\n });\n\n // extract top areas with at least 6 patches present\n topLabels = labelHist.filter(function(el) {\n return el.val >= 5;\n });\n\n return topLabels;\n}\n\n/**\n *\n */\nfunction findBoxes(topLabels, maxLabel) {\n var i,\n j,\n sum,\n patches = [],\n patch,\n box,\n boxes = [],\n hsv = [0, 1, 1],\n rgb = [0, 0, 0];\n\n for ( i = 0; i < topLabels.length; i++) {\n sum = _patchLabelGrid.data.length;\n patches.length = 0;\n while (sum--) {\n if (_patchLabelGrid.data[sum] === topLabels[i].label) {\n patch = _imageToPatchGrid.data[sum];\n patches.push(patch);\n }\n }\n box = boxFromPatches(patches);\n if (box) {\n boxes.push(box);\n\n // draw patch-labels if requested\n if (_config.showRemainingPatchLabels) {\n for ( j = 0; j < patches.length; j++) {\n patch = patches[j];\n hsv[0] = (topLabels[i].label / (maxLabel + 1)) * 360;\n CVUtils.hsv2rgb(hsv, rgb);\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2});\n }\n }\n }\n }\n return boxes;\n}\n\n/**\n * Find similar moments (via cluster)\n * @param {Object} moments\n */\nfunction similarMoments(moments) {\n var clusters = CVUtils.cluster(moments, 0.90);\n var topCluster = CVUtils.topGeneric(clusters, 1, function(e) {\n return e.getPoints().length;\n });\n var points = [], result = [];\n if (topCluster.length === 1) {\n points = topCluster[0].item.getPoints();\n for (var i = 0; i < points.length; i++) {\n result.push(points[i].point);\n }\n }\n return result;\n}\n\nfunction skeletonize(x, y) {\n _binaryImageWrapper.subImageAsCopy(_subImageWrapper, CVUtils.imageRef(x, y));\n _skeletonizer.skeletonize();\n\n // Show skeleton if requested\n if (_config.showSkeleton) {\n _skelImageWrapper.overlay(_canvasContainer.dom.binary, 360, CVUtils.imageRef(x, y));\n }\n}\n\n/**\n * Extracts and describes those patches which seem to contain a barcode pattern\n * @param {Array} moments\n * @param {Object} patchPos,\n * @param {Number} x\n * @param {Number} y\n * @returns {Array} list of patches\n */\nfunction describePatch(moments, patchPos, x, y) {\n var k,\n avg,\n sum = 0,\n eligibleMoments = [],\n matchingMoments,\n patch,\n patchesFound = [],\n minComponentWeight = Math.ceil(_patchSize.x/3);\n\n if (moments.length >= 2) {\n // only collect moments which's area covers at least minComponentWeight pixels.\n for ( k = 0; k < moments.length; k++) {\n if (moments[k].m00 > minComponentWeight) {\n eligibleMoments.push(moments[k]);\n }\n }\n\n // if at least 2 moments are found which have at least minComponentWeights covered\n if (eligibleMoments.length >= 2) {\n sum = eligibleMoments.length;\n matchingMoments = similarMoments(eligibleMoments);\n avg = 0;\n // determine the similarity of the moments\n for ( k = 0; k < matchingMoments.length; k++) {\n avg += matchingMoments[k].rad;\n }\n\n // Only two of the moments are allowed not to fit into the equation\n // add the patch to the set\n if (matchingMoments.length > 1 && matchingMoments.length >= (eligibleMoments.length / 4) * 3 && matchingMoments.length > moments.length / 4) {\n avg /= matchingMoments.length;\n patch = {\n index : patchPos[1] * _numPatches.x + patchPos[0],\n pos : {\n x : x,\n y : y\n },\n box : [vec2.clone([x, y]), vec2.clone([x + _subImageWrapper.size.x, y]), vec2.clone([x + _subImageWrapper.size.x, y + _subImageWrapper.size.y]), vec2.clone([x, y + _subImageWrapper.size.y])],\n moments : matchingMoments,\n rad : avg,\n vec : vec2.clone([Math.cos(avg), Math.sin(avg)])\n };\n patchesFound.push(patch);\n }\n }\n }\n return patchesFound;\n}\n\n/**\n * finds patches which are connected and share the same orientation\n * @param {Object} patchesFound\n */\nfunction rasterizeAngularSimilarity(patchesFound) {\n var label = 0,\n threshold = 0.95,\n currIdx = 0,\n j,\n patch,\n hsv = [0, 1, 1],\n rgb = [0, 0, 0];\n\n function notYetProcessed() {\n var i;\n for ( i = 0; i < _patchLabelGrid.data.length; i++) {\n if (_patchLabelGrid.data[i] === 0 && _patchGrid.data[i] === 1) {\n return i;\n }\n }\n return _patchLabelGrid.length;\n }\n\n function trace(currentIdx) {\n var x, y, currentPatch, patch, idx, dir, current = {\n x : currentIdx % _patchLabelGrid.size.x,\n y : (currentIdx / _patchLabelGrid.size.x) | 0\n }, similarity;\n\n if (currentIdx < _patchLabelGrid.data.length) {\n currentPatch = _imageToPatchGrid.data[currentIdx];\n // assign label\n _patchLabelGrid.data[currentIdx] = label;\n for ( dir = 0; dir < Tracer.searchDirections.length; dir++) {\n y = current.y + Tracer.searchDirections[dir][0];\n x = current.x + Tracer.searchDirections[dir][1];\n idx = y * _patchLabelGrid.size.x + x;\n\n // continue if patch empty\n if (_patchGrid.data[idx] === 0) {\n _patchLabelGrid.data[idx] = Number.MAX_VALUE;\n continue;\n }\n\n patch = _imageToPatchGrid.data[idx];\n if (_patchLabelGrid.data[idx] === 0) {\n similarity = Math.abs(vec2.dot(patch.vec, currentPatch.vec));\n if (similarity > threshold) {\n trace(idx);\n }\n }\n }\n }\n }\n\n // prepare for finding the right patches\n ArrayHelper.init(_patchGrid.data, 0);\n ArrayHelper.init(_patchLabelGrid.data, 0);\n ArrayHelper.init(_imageToPatchGrid.data, null);\n\n for ( j = 0; j < patchesFound.length; j++) {\n patch = patchesFound[j];\n _imageToPatchGrid.data[patch.index] = patch;\n _patchGrid.data[patch.index] = 1;\n }\n\n // rasterize the patches found to determine area\n _patchGrid.zeroBorder();\n\n while (( currIdx = notYetProcessed()) < _patchLabelGrid.data.length) {\n label++;\n trace(currIdx);\n }\n\n // draw patch-labels if requested\n if (_config.showPatchLabels) {\n for ( j = 0; j < _patchLabelGrid.data.length; j++) {\n if (_patchLabelGrid.data[j] > 0 && _patchLabelGrid.data[j] <= label) {\n patch = _imageToPatchGrid.data[j];\n hsv[0] = (_patchLabelGrid.data[j] / (label + 1)) * 360;\n CVUtils.hsv2rgb(hsv, rgb);\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2});\n }\n }\n }\n\n return label;\n}\n\nexport default {\n init : function(inputImageWrapper, config) {\n _config = config;\n _inputImageWrapper = inputImageWrapper;\n\n initBuffers();\n initCanvas();\n },\n\n locate : function() {\n var patchesFound,\n topLabels,\n boxes;\n\n if (_config.halfSample) {\n CVUtils.halfSample(_inputImageWrapper, _currentImageWrapper);\n }\n\n binarizeImage();\n patchesFound = findPatches();\n // return unless 5% or more patches are found\n if (patchesFound.length < _numPatches.x * _numPatches.y * 0.05) {\n return null;\n }\n\n // rasterrize area by comparing angular similarity;\n var maxLabel = rasterizeAngularSimilarity(patchesFound);\n if (maxLabel < 1) {\n return null;\n }\n\n // search for area with the most patches (biggest connected area)\n topLabels = findBiggestConnectedAreas(maxLabel);\n if (topLabels.length === 0) {\n return null;\n }\n\n boxes = findBoxes(topLabels, maxLabel);\n return boxes;\n },\n\n checkImageConstraints: function(inputStream, config) {\n var patchSize,\n width = inputStream.getWidth(),\n height = inputStream.getHeight(),\n halfSample = config.halfSample ? 0.5 : 1,\n size,\n area;\n\n // calculate width and height based on area\n if (inputStream.getConfig().area) {\n area = CVUtils.computeImageArea(width, height, inputStream.getConfig().area);\n inputStream.setTopRight({x: area.sx, y: area.sy});\n inputStream.setCanvasSize({x: width, y: height});\n width = area.sw;\n height = area.sh;\n }\n\n size = {\n x: Math.floor(width * halfSample),\n y: Math.floor(height * halfSample)\n };\n\n patchSize = CVUtils.calculatePatchSize(config.patchSize, size);\n console.log(\"Patch-Size: \" + JSON.stringify(patchSize));\n\n inputStream.setWidth(Math.floor(Math.floor(size.x/patchSize.x)*(1/halfSample)*patchSize.x));\n inputStream.setHeight(Math.floor(Math.floor(size.y/patchSize.y)*(1/halfSample)*patchSize.y));\n\n if ((inputStream.getWidth() % patchSize.x) === 0 && (inputStream.getHeight() % patchSize.y) === 0) {\n return true;\n }\n\n throw new Error(\"Image dimensions do not comply with the current settings: Width (\" +\n width + \" )and height (\" + height +\n \") must a multiple of \" + patchSize.x);\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_locator.js\n **/","import Tracer from './tracer';\n\n/**\n * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n */\nvar Rasterizer = {\n createContour2D : function() {\n return {\n dir : null,\n index : null,\n firstVertex : null,\n insideContours : null,\n nextpeer : null,\n prevpeer : null\n };\n },\n CONTOUR_DIR : {\n CW_DIR : 0,\n CCW_DIR : 1,\n UNKNOWN_DIR : 2\n },\n DIR : {\n OUTSIDE_EDGE : -32767,\n INSIDE_EDGE : -32766\n },\n create : function(imageWrapper, labelWrapper) {\n var imageData = imageWrapper.data,\n labelData = labelWrapper.data,\n width = imageWrapper.size.x,\n height = imageWrapper.size.y,\n tracer = Tracer.create(imageWrapper, labelWrapper);\n\n return {\n rasterize : function(depthlabel) {\n var color,\n bc,\n lc,\n labelindex,\n cx,\n cy,\n colorMap = [],\n vertex,\n p,\n cc,\n sc,\n pos,\n connectedCount = 0,\n i;\n\n for ( i = 0; i < 400; i++) {\n colorMap[i] = 0;\n }\n\n colorMap[0] = imageData[0];\n cc = null;\n for ( cy = 1; cy < height - 1; cy++) {\n labelindex = 0;\n bc = colorMap[0];\n for ( cx = 1; cx < width - 1; cx++) {\n pos = cy * width + cx;\n if (labelData[pos] === 0) {\n color = imageData[pos];\n if (color !== bc) {\n if (labelindex === 0) {\n lc = connectedCount + 1;\n colorMap[lc] = color;\n bc = color;\n vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE);\n if (vertex !== null) {\n connectedCount++;\n labelindex = lc;\n p = Rasterizer.createContour2D();\n p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n p.index = labelindex;\n p.firstVertex = vertex;\n p.nextpeer = cc;\n p.insideContours = null;\n if (cc !== null) {\n cc.prevpeer = p;\n }\n cc = p;\n }\n } else {\n vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex);\n if (vertex !== null) {\n p = Rasterizer.createContour2D();\n p.firstVertex = vertex;\n p.insideContours = null;\n if (depthlabel === 0) {\n p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR;\n } else {\n p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n }\n p.index = depthlabel;\n sc = cc;\n while ((sc !== null) && sc.index !== labelindex) {\n sc = sc.nextpeer;\n }\n if (sc !== null) {\n p.nextpeer = sc.insideContours;\n if (sc.insideContours !== null) {\n sc.insideContours.prevpeer = p;\n }\n sc.insideContours = p;\n }\n }\n }\n } else {\n labelData[pos] = labelindex;\n }\n } else if (labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n labelindex = 0;\n if (labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n bc = imageData[pos];\n } else {\n bc = colorMap[0];\n }\n } else {\n labelindex = labelData[pos];\n bc = colorMap[labelindex];\n }\n }\n }\n sc = cc;\n while (sc !== null) {\n sc.index = depthlabel;\n sc = sc.nextpeer;\n }\n return {\n cc : cc,\n count : connectedCount\n };\n },\n debug: {\n drawContour : function(canvas, firstContour) {\n var ctx = canvas.getContext(\"2d\"),\n pq = firstContour,\n iq,\n q,\n p;\n\n ctx.strokeStyle = \"red\";\n ctx.fillStyle = \"red\";\n ctx.lineWidth = 1;\n\n if (pq !== null) {\n iq = pq.insideContours;\n } else {\n iq = null;\n }\n\n while (pq !== null) {\n if (iq !== null) {\n q = iq;\n iq = iq.nextpeer;\n } else {\n q = pq;\n pq = pq.nextpeer;\n if (pq !== null) {\n iq = pq.insideContours;\n } else {\n iq = null;\n }\n }\n\n switch(q.dir) {\n case Rasterizer.CONTOUR_DIR.CW_DIR:\n ctx.strokeStyle = \"red\";\n break;\n case Rasterizer.CONTOUR_DIR.CCW_DIR:\n ctx.strokeStyle = \"blue\";\n break;\n case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:\n ctx.strokeStyle = \"green\";\n break;\n }\n\n p = q.firstVertex;\n ctx.beginPath();\n ctx.moveTo(p.x, p.y);\n do {\n p = p.next;\n ctx.lineTo(p.x, p.y);\n } while(p !== q.firstVertex);\n ctx.stroke();\n }\n }\n }\n };\n }\n};\n\nexport default Rasterizer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/rasterizer.js\n **/","/**\n * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n */\nvar Tracer = {\n searchDirections : [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]],\n create : function(imageWrapper, labelWrapper) {\n var imageData = imageWrapper.data,\n labelData = labelWrapper.data,\n searchDirections = this.searchDirections,\n width = imageWrapper.size.x,\n pos;\n\n function trace(current, color, label, edgelabel) {\n var i,\n y,\n x;\n\n for ( i = 0; i < 7; i++) {\n y = current.cy + searchDirections[current.dir][0];\n x = current.cx + searchDirections[current.dir][1];\n pos = y * width + x;\n if ((imageData[pos] === color) && ((labelData[pos] === 0) || (labelData[pos] === label))) {\n labelData[pos] = label;\n current.cy = y;\n current.cx = x;\n return true;\n } else {\n if (labelData[pos] === 0) {\n labelData[pos] = edgelabel;\n }\n current.dir = (current.dir + 1) % 8;\n }\n }\n return false;\n }\n\n function vertex2D(x, y, dir) {\n return {\n dir : dir,\n x : x,\n y : y,\n next : null,\n prev : null\n };\n }\n\n function contourTracing(sy, sx, label, color, edgelabel) {\n var Fv = null,\n Cv,\n P,\n ldir,\n current = {\n cx : sx,\n cy : sy,\n dir : 0\n };\n\n if (trace(current, color, label, edgelabel)) {\n Fv = vertex2D(sx, sy, current.dir);\n Cv = Fv;\n ldir = current.dir;\n P = vertex2D(current.cx, current.cy, 0);\n P.prev = Cv;\n Cv.next = P;\n P.next = null;\n Cv = P;\n do {\n current.dir = (current.dir + 6) % 8;\n trace(current, color, label, edgelabel);\n if (ldir != current.dir) {\n Cv.dir = current.dir;\n P = vertex2D(current.cx, current.cy, 0);\n P.prev = Cv;\n Cv.next = P;\n P.next = null;\n Cv = P;\n } else {\n Cv.dir = ldir;\n Cv.x = current.cx;\n Cv.y = current.cy;\n }\n ldir = current.dir;\n } while(current.cx != sx || current.cy != sy);\n Fv.prev = Cv.prev;\n Cv.prev.next = Fv;\n }\n return Fv;\n }\n\n return {\n trace : function(current, color, label, edgelabel) {\n return trace(current, color, label, edgelabel);\n },\n contourTracing : function(sy, sx, label, color, edgelabel) {\n return contourTracing(sy, sx, label, color, edgelabel);\n }\n };\n }\n};\n\nexport default (Tracer);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/tracer.js\n **/","/* @preserve ASM BEGIN */\nfunction Skeletonizer(stdlib, foreign, buffer) {\n \"use asm\";\n\n var images = new stdlib.Uint8Array(buffer),\n size = foreign.size | 0,\n imul = stdlib.Math.imul;\n\n function erode(inImagePtr, outImagePtr) {\n inImagePtr = inImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var v = 0,\n u = 0,\n sum = 0,\n yStart1 = 0,\n yStart2 = 0,\n xStart1 = 0,\n xStart2 = 0,\n offset = 0;\n\n for ( v = 1; (v | 0) < ((size - 1) | 0); v = (v + 1) | 0) {\n offset = (offset + size) | 0;\n for ( u = 1; (u | 0) < ((size - 1) | 0); u = (u + 1) | 0) {\n yStart1 = (offset - size) | 0;\n yStart2 = (offset + size) | 0;\n xStart1 = (u - 1) | 0;\n xStart2 = (u + 1) | 0;\n sum = ((images[(inImagePtr + yStart1 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart1 + xStart2) | 0] | 0) + (images[(inImagePtr + offset + u) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart2) | 0] | 0)) | 0;\n if ((sum | 0) == (5 | 0)) {\n images[(outImagePtr + offset + u) | 0] = 1;\n } else {\n images[(outImagePtr + offset + u) | 0] = 0;\n }\n }\n }\n return;\n }\n\n function subtract(aImagePtr, bImagePtr, outImagePtr) {\n aImagePtr = aImagePtr | 0;\n bImagePtr = bImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(outImagePtr + length) | 0] = ((images[(aImagePtr + length) | 0] | 0) - (images[(bImagePtr + length) | 0] | 0)) | 0;\n }\n }\n\n function bitwiseOr(aImagePtr, bImagePtr, outImagePtr) {\n aImagePtr = aImagePtr | 0;\n bImagePtr = bImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(outImagePtr + length) | 0] = ((images[(aImagePtr + length) | 0] | 0) | (images[(bImagePtr + length) | 0] | 0)) | 0;\n }\n }\n\n function countNonZero(imagePtr) {\n imagePtr = imagePtr | 0;\n\n var sum = 0,\n length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n sum = ((sum | 0) + (images[(imagePtr + length) | 0] | 0)) | 0;\n }\n\n return (sum | 0);\n }\n\n function init(imagePtr, value) {\n imagePtr = imagePtr | 0;\n value = value | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(imagePtr + length) | 0] = value;\n }\n }\n\n function dilate(inImagePtr, outImagePtr) {\n inImagePtr = inImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var v = 0,\n u = 0,\n sum = 0,\n yStart1 = 0,\n yStart2 = 0,\n xStart1 = 0,\n xStart2 = 0,\n offset = 0;\n\n for ( v = 1; (v | 0) < ((size - 1) | 0); v = (v + 1) | 0) {\n offset = (offset + size) | 0;\n for ( u = 1; (u | 0) < ((size - 1) | 0); u = (u + 1) | 0) {\n yStart1 = (offset - size) | 0;\n yStart2 = (offset + size) | 0;\n xStart1 = (u - 1) | 0;\n xStart2 = (u + 1) | 0;\n sum = ((images[(inImagePtr + yStart1 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart1 + xStart2) | 0] | 0) + (images[(inImagePtr + offset + u) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart2) | 0] | 0)) | 0;\n if ((sum | 0) > (0 | 0)) {\n images[(outImagePtr + offset + u) | 0] = 1;\n } else {\n images[(outImagePtr + offset + u) | 0] = 0;\n }\n }\n }\n return;\n }\n\n function memcpy(srcImagePtr, dstImagePtr) {\n srcImagePtr = srcImagePtr | 0;\n dstImagePtr = dstImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(dstImagePtr + length) | 0] = (images[(srcImagePtr + length) | 0] | 0);\n }\n }\n\n function zeroBorder(imagePtr) {\n imagePtr = imagePtr | 0;\n\n var x = 0,\n y = 0;\n\n for ( x = 0; (x | 0) < ((size - 1) | 0); x = (x + 1) | 0) {\n images[(imagePtr + x) | 0] = 0;\n images[(imagePtr + y) | 0] = 0;\n y = ((y + size) - 1) | 0;\n images[(imagePtr + y) | 0] = 0;\n y = (y + 1) | 0;\n }\n for ( x = 0; (x | 0) < (size | 0); x = (x + 1) | 0) {\n images[(imagePtr + y) | 0] = 0;\n y = (y + 1) | 0;\n }\n }\n\n function skeletonize() {\n var subImagePtr = 0,\n erodedImagePtr = 0,\n tempImagePtr = 0,\n skelImagePtr = 0,\n sum = 0,\n done = 0;\n\n erodedImagePtr = imul(size, size) | 0;\n tempImagePtr = (erodedImagePtr + erodedImagePtr) | 0;\n skelImagePtr = (tempImagePtr + erodedImagePtr) | 0;\n\n // init skel-image\n init(skelImagePtr, 0);\n zeroBorder(subImagePtr);\n\n do {\n erode(subImagePtr, erodedImagePtr);\n dilate(erodedImagePtr, tempImagePtr);\n subtract(subImagePtr, tempImagePtr, tempImagePtr);\n bitwiseOr(skelImagePtr, tempImagePtr, skelImagePtr);\n memcpy(erodedImagePtr, subImagePtr);\n sum = countNonZero(subImagePtr) | 0;\n done = ((sum | 0) == 0 | 0);\n } while(!done);\n }\n\n return {\n skeletonize : skeletonize\n };\n}\n/* @preserve ASM END */\n\nexport default Skeletonizer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/skeletonizer.js\n **/","export default {\n drawRect: function(pos, size, ctx, style){\n ctx.strokeStyle = style.color;\n ctx.fillStyle = style.color;\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.strokeRect(pos.x, pos.y, size.x, size.y);\n },\n drawPath: function(path, def, ctx, style) {\n ctx.strokeStyle = style.color;\n ctx.fillStyle = style.color;\n ctx.lineWidth = style.lineWidth;\n ctx.beginPath();\n ctx.moveTo(path[0][def.x], path[0][def.y]);\n for (var j = 1; j < path.length; j++) {\n ctx.lineTo(path[j][def.x], path[j][def.y]);\n }\n ctx.closePath();\n ctx.stroke();\n },\n drawImage: function(imageData, size, ctx) {\n var canvasData = ctx.getImageData(0, 0, size.x, size.y),\n data = canvasData.data,\n imageDataPos = imageData.length,\n canvasDataPos = data.length,\n value;\n\n if (canvasDataPos/imageDataPos !== 4) {\n return false;\n }\n while(imageDataPos--){\n value = imageData[imageDataPos];\n data[--canvasDataPos] = 255;\n data[--canvasDataPos] = value;\n data[--canvasDataPos] = value;\n data[--canvasDataPos] = value;\n }\n ctx.putImageData(canvasData, 0, 0);\n return true;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_debug.js\n **/","import Bresenham from './bresenham';\nimport ImageDebug from './image_debug';\nimport Code128Reader from './code_128_reader';\nimport EANReader from './ean_reader';\nimport Code39Reader from './code_39_reader';\nimport Code39VINReader from './code_39_vin_reader';\nimport CodabarReader from './codabar_reader';\nimport UPCReader from './upc_reader';\nimport EAN8Reader from './ean_8_reader';\nimport UPCEReader from './upc_e_reader';\nimport I2of5Reader from './i2of5_reader';\n\nvar readers = {\n code_128_reader: Code128Reader,\n ean_reader: EANReader,\n ean_8_reader: EAN8Reader,\n code_39_reader: Code39Reader,\n code_39_vin_reader: Code39VINReader,\n codabar_reader: CodabarReader,\n upc_reader: UPCReader,\n upc_e_reader: UPCEReader,\n i2of5_reader: I2of5Reader\n};\nexport default {\n create : function(config, inputImageWrapper) {\n var _canvas = {\n ctx : {\n frequency : null,\n pattern : null,\n overlay : null\n },\n dom : {\n frequency : null,\n pattern : null,\n overlay : null\n }\n },\n _barcodeReaders = [];\n\n initCanvas();\n initReaders();\n initConfig();\n\n function initCanvas() {\n if (typeof document !== 'undefined') {\n var $debug = document.querySelector(\"#debug.detection\");\n _canvas.dom.frequency = document.querySelector(\"canvas.frequency\");\n if (!_canvas.dom.frequency) {\n _canvas.dom.frequency = document.createElement(\"canvas\");\n _canvas.dom.frequency.className = \"frequency\";\n if($debug) {\n $debug.appendChild(_canvas.dom.frequency);\n }\n }\n _canvas.ctx.frequency = _canvas.dom.frequency.getContext(\"2d\");\n\n _canvas.dom.pattern = document.querySelector(\"canvas.patternBuffer\");\n if (!_canvas.dom.pattern) {\n _canvas.dom.pattern = document.createElement(\"canvas\");\n _canvas.dom.pattern.className = \"patternBuffer\";\n if($debug) {\n $debug.appendChild(_canvas.dom.pattern);\n }\n }\n _canvas.ctx.pattern = _canvas.dom.pattern.getContext(\"2d\");\n\n _canvas.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n if (_canvas.dom.overlay) {\n _canvas.ctx.overlay = _canvas.dom.overlay.getContext(\"2d\");\n }\n }\n }\n\n function initReaders() {\n config.readers.forEach(function(readerConfig) {\n var reader,\n config = {};\n\n if (typeof readerConfig === 'object') {\n reader = readerConfig.format;\n config = readerConfig.config;\n } else if (typeof readerConfig === 'string') {\n reader = readerConfig;\n }\n _barcodeReaders.push(new readers[reader](config));\n });\n console.log(\"Registered Readers: \" + _barcodeReaders\n .map(function(reader) {return JSON.stringify({format: reader.FORMAT, config: reader.config});})\n .join(', '));\n }\n\n function initConfig() {\n if (typeof document !== 'undefined') {\n var i,\n vis = [{\n node : _canvas.dom.frequency,\n prop : config.showFrequency\n }, {\n node : _canvas.dom.pattern,\n prop : config.showPattern\n }];\n\n for (i = 0; i < vis.length; i++) {\n if (vis[i].prop === true) {\n vis[i].node.style.display = \"block\";\n } else {\n vis[i].node.style.display = \"none\";\n }\n }\n }\n }\n\n /**\n * extend the line on both ends\n * @param {Array} line\n * @param {Number} angle\n */\n function getExtendedLine(line, angle, ext) {\n function extendLine(amount) {\n var extension = {\n y : amount * Math.sin(angle),\n x : amount * Math.cos(angle)\n };\n\n line[0].y -= extension.y;\n line[0].x -= extension.x;\n line[1].y += extension.y;\n line[1].x += extension.x;\n }\n\n // check if inside image\n extendLine(ext);\n while (ext > 1 && (!inputImageWrapper.inImageWithBorder(line[0], 0) || !inputImageWrapper.inImageWithBorder(line[1], 0))) {\n ext -= Math.ceil(ext/2);\n extendLine(-ext);\n }\n return line;\n }\n\n function getLine(box) {\n return [{\n x : (box[1][0] - box[0][0]) / 2 + box[0][0],\n y : (box[1][1] - box[0][1]) / 2 + box[0][1]\n }, {\n x : (box[3][0] - box[2][0]) / 2 + box[2][0],\n y : (box[3][1] - box[2][1]) / 2 + box[2][1]\n }];\n }\n\n function tryDecode(line) {\n var result = null,\n i,\n barcodeLine = Bresenham.getBarcodeLine(inputImageWrapper, line[0], line[1]);\n\n if (config.showFrequency) {\n ImageDebug.drawPath(line, {x: 'x', y: 'y'}, _canvas.ctx.overlay, {color: 'red', lineWidth: 3});\n Bresenham.debug.printFrequency(barcodeLine.line, _canvas.dom.frequency);\n }\n Bresenham.toBinaryLine(barcodeLine);\n if (config.showPattern) {\n Bresenham.debug.printPattern(barcodeLine.line, _canvas.dom.pattern);\n }\n\n for ( i = 0; i < _barcodeReaders.length && result === null; i++) {\n result = _barcodeReaders[i].decodePattern(barcodeLine.line);\n }\n if(result === null){\n return null;\n }\n return {\n codeResult: result,\n barcodeLine: barcodeLine\n };\n\n }\n\n /**\n * This method slices the given area apart and tries to detect a barcode-pattern\n * for each slice. It returns the decoded barcode, or null if nothing was found\n * @param {Array} box\n * @param {Array} line\n * @param {Number} lineAngle\n */\n function tryDecodeBruteForce(box, line, lineAngle) {\n var sideLength = Math.sqrt(Math.pow(box[1][0] - box[0][0], 2) + Math.pow((box[1][1] - box[0][1]), 2)),\n i,\n slices = 16,\n result = null,\n dir,\n extension,\n xdir = Math.sin(lineAngle),\n ydir = Math.cos(lineAngle);\n\n for ( i = 1; i < slices && result === null; i++) {\n // move line perpendicular to angle\n dir = sideLength / slices * i * (i % 2 === 0 ? -1 : 1);\n extension = {\n y : dir * xdir,\n x : dir * ydir\n };\n line[0].y += extension.x;\n line[0].x -= extension.y;\n line[1].y += extension.x;\n line[1].x -= extension.y;\n\n result = tryDecode(line);\n }\n return result;\n }\n\n function getLineLength(line) {\n return Math.sqrt(\n Math.pow(Math.abs(line[1].y - line[0].y), 2) +\n Math.pow(Math.abs(line[1].x - line[0].x), 2));\n }\n\n /**\n * With the help of the configured readers (Code128 or EAN) this function tries to detect a\n * valid barcode pattern within the given area.\n * @param {Object} box The area to search in\n * @returns {Object} the result {codeResult, line, angle, pattern, threshold}\n */\n function decodeFromBoundingBox(box) {\n var line,\n lineAngle,\n ctx = _canvas.ctx.overlay,\n result,\n lineLength;\n\n if (config.drawBoundingBox && ctx) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, ctx, {color: \"blue\", lineWidth: 2});\n }\n\n line = getLine(box);\n lineLength = getLineLength(line);\n lineAngle = Math.atan2(line[1].y - line[0].y, line[1].x - line[0].x);\n line = getExtendedLine(line, lineAngle, Math.floor(lineLength*0.1));\n if(line === null){\n return null;\n }\n\n result = tryDecode(line);\n if(result === null) {\n result = tryDecodeBruteForce(box, line, lineAngle);\n }\n\n if(result === null) {\n return null;\n }\n\n if (result && config.drawScanline && ctx) {\n ImageDebug.drawPath(line, {x: 'x', y: 'y'}, ctx, {color: 'red', lineWidth: 3});\n }\n\n return {\n codeResult : result.codeResult,\n line : line,\n angle : lineAngle,\n pattern : result.barcodeLine.line,\n threshold : result.barcodeLine.threshold\n };\n }\n\n return {\n decodeFromBoundingBox : function(box) {\n return decodeFromBoundingBox(box);\n },\n decodeFromBoundingBoxes : function(boxes) {\n var i, result;\n for ( i = 0; i < boxes.length; i++) {\n result = decodeFromBoundingBox(boxes[i]);\n if (result && result.codeResult) {\n result.box = boxes[i];\n return result;\n }\n }\n },\n setReaders: function(readers) {\n config.readers = readers;\n _barcodeReaders.length = 0;\n initReaders();\n }\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_decoder.js\n **/","import CVUtils from './cv_utils';\nimport ImageWrapper from './image_wrapper';\n\nvar Bresenham = {};\n\nvar Slope = {\n DIR : {\n UP : 1,\n DOWN : -1\n }\n};\n/**\n * Scans a line of the given image from point p1 to p2 and returns a result object containing\n * gray-scale values (0-255) of the underlying pixels in addition to the min\n * and max values.\n * @param {Object} imageWrapper\n * @param {Object} p1 The start point {x,y}\n * @param {Object} p2 The end point {x,y}\n * @returns {line, min, max}\n */\nBresenham.getBarcodeLine = function(imageWrapper, p1, p2) {\n var x0 = p1.x | 0,\n y0 = p1.y | 0,\n x1 = p2.x | 0,\n y1 = p2.y | 0,\n steep = Math.abs(y1 - y0) > Math.abs(x1 - x0),\n deltax,\n deltay,\n error,\n ystep,\n y,\n tmp,\n x,\n line = [],\n imageData = imageWrapper.data,\n width = imageWrapper.size.x,\n sum = 0,\n val,\n min = 255,\n max = 0;\n\n function read(a, b) {\n val = imageData[b * width + a];\n sum += val;\n min = val < min ? val : min;\n max = val > max ? val : max;\n line.push(val);\n }\n\n if (steep) {\n tmp = x0;\n x0 = y0;\n y0 = tmp;\n\n tmp = x1;\n x1 = y1;\n y1 = tmp;\n }\n if (x0 > x1) {\n tmp = x0;\n x0 = x1;\n x1 = tmp;\n\n tmp = y0;\n y0 = y1;\n y1 = tmp;\n }\n deltax = x1 - x0;\n deltay = Math.abs(y1 - y0);\n error = (deltax / 2) | 0;\n y = y0;\n ystep = y0 < y1 ? 1 : -1;\n for ( x = x0; x < x1; x++) {\n if(steep){\n read(y, x);\n } else {\n read(x, y);\n }\n error = error - deltay;\n if (error < 0) {\n y = y + ystep;\n error = error + deltax;\n }\n }\n\n return {\n line : line,\n min : min,\n max : max\n };\n};\n\nBresenham.toOtsuBinaryLine = function(result) {\n var line = result.line,\n image = new ImageWrapper({x: line.length - 1, y: 1}, line),\n threshold = CVUtils.determineOtsuThreshold(image, 5);\n\n line = CVUtils.sharpenLine(line);\n CVUtils.thresholdImage(image, threshold);\n\n return {\n line: line,\n threshold: threshold\n };\n};\n\n/**\n * Converts the result from getBarcodeLine into a binary representation\n * also considering the frequency and slope of the signal for more robust results\n * @param {Object} result {line, min, max}\n */\nBresenham.toBinaryLine = function(result) {\n\n var min = result.min,\n max = result.max,\n line = result.line,\n slope,\n slope2,\n center = min + (max - min) / 2,\n extrema = [],\n currentDir,\n dir,\n threshold = (max - min) / 12,\n rThreshold = -threshold,\n i,\n j;\n\n // 1. find extrema\n currentDir = line[0] > center ? Slope.DIR.UP : Slope.DIR.DOWN;\n extrema.push({\n pos : 0,\n val : line[0]\n });\n for ( i = 0; i < line.length - 2; i++) {\n slope = (line[i + 1] - line[i]);\n slope2 = (line[i + 2] - line[i + 1]);\n if ((slope + slope2) < rThreshold && line[i + 1] < (center*1.5)) {\n dir = Slope.DIR.DOWN;\n } else if ((slope + slope2) > threshold && line[i + 1] > (center*0.5)) {\n dir = Slope.DIR.UP;\n } else {\n dir = currentDir;\n }\n\n if (currentDir !== dir) {\n extrema.push({\n pos : i,\n val : line[i]\n });\n currentDir = dir;\n }\n }\n extrema.push({\n pos : line.length,\n val : line[line.length - 1]\n });\n\n for ( j = extrema[0].pos; j < extrema[1].pos; j++) {\n line[j] = line[j] > center ? 0 : 1;\n }\n\n // iterate over extrema and convert to binary based on avg between minmax\n for ( i = 1; i < extrema.length - 1; i++) {\n if (extrema[i + 1].val > extrema[i].val) {\n threshold = (extrema[i].val + ((extrema[i + 1].val - extrema[i].val) / 3) * 2) | 0;\n } else {\n threshold = (extrema[i + 1].val + ((extrema[i].val - extrema[i + 1].val) / 3)) | 0;\n }\n\n for ( j = extrema[i].pos; j < extrema[i + 1].pos; j++) {\n line[j] = line[j] > threshold ? 0 : 1;\n }\n }\n\n return {\n line : line,\n threshold : threshold\n };\n};\n\n/**\n * Used for development only\n */\nBresenham.debug = {\n printFrequency: function(line, canvas) {\n var i,\n ctx = canvas.getContext(\"2d\");\n canvas.width = line.length;\n canvas.height = 256;\n\n ctx.beginPath();\n ctx.strokeStyle = \"blue\";\n for ( i = 0; i < line.length; i++) {\n ctx.moveTo(i, 255);\n ctx.lineTo(i, 255 - line[i]);\n }\n ctx.stroke();\n ctx.closePath();\n },\n\n printPattern: function(line, canvas) {\n var ctx = canvas.getContext(\"2d\"), i;\n\n canvas.width = line.length;\n ctx.fillColor = \"black\";\n for ( i = 0; i < line.length; i++) {\n if (line[i] === 1) {\n ctx.fillRect(i, 0, 1, 100);\n }\n }\n }\n};\n\nexport default Bresenham;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/bresenham.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction Code128Reader() {\n BarcodeReader.call(this);\n}\n\nvar properties = {\n CODE_SHIFT : {value: 98},\n CODE_C : {value: 99},\n CODE_B : {value: 100},\n CODE_A : {value: 101},\n START_CODE_A : {value: 103},\n START_CODE_B : {value: 104},\n START_CODE_C : {value: 105},\n STOP_CODE : {value: 106},\n MODULO : {value: 11},\n CODE_PATTERN : {value: [\n [2, 1, 2, 2, 2, 2],\n [2, 2, 2, 1, 2, 2],\n [2, 2, 2, 2, 2, 1],\n [1, 2, 1, 2, 2, 3],\n [1, 2, 1, 3, 2, 2],\n [1, 3, 1, 2, 2, 2],\n [1, 2, 2, 2, 1, 3],\n [1, 2, 2, 3, 1, 2],\n [1, 3, 2, 2, 1, 2],\n [2, 2, 1, 2, 1, 3],\n [2, 2, 1, 3, 1, 2],\n [2, 3, 1, 2, 1, 2],\n [1,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1, 2, 2, 4],\n [1, 1, 1, 4, 2, 2],\n [1, 2, 1, 1, 2, 4],\n [1, 2, 1, 4, 2, 1],\n [1, 4, 1, 1, 2, 2],\n [1, 4, 1, 2, 2, 1],\n [1, 1, 2, 2, 1, 4],\n [1, 1, 2, 4, 1, 2],\n [1, 2, 2, 1, 1, 4],\n [1, 2, 2, 4, 1, 1],\n [1, 4, 2, 1, 1, 2],\n [1, 4, 2, 2, 1, 1],\n [2, 4, 1, 2, 1, 1],\n [2, 2, 1, 1, 1, 4],\n [4, 1, 3, 1, 1, 1],\n [2, 4, 1, 1, 1, 2],\n [1, 3, 4, 1, 1, 1],\n [1, 1, 1, 2, 4, 2],\n [1, 2, 1, 1, 4, 2],\n [1, 2, 1, 2, 4, 1],\n [1, 1, 4, 2, 1, 2],\n [1, 2, 4, 1, 1, 2],\n [1, 2, 4, 2, 1, 1],\n [4, 1, 1, 2, 1, 2],\n [4, 2, 1, 1, 1, 2],\n [4, 2, 1, 2, 1, 1],\n [2, 1, 2, 1, 4, 1],\n [2, 1, 4, 1, 2, 1],\n [4, 1, 2, 1, 2, 1],\n [1, 1, 1, 1, 4, 3],\n [1, 1, 1, 3, 4, 1],\n [1, 3, 1, 1, 4, 1],\n [1, 1, 4, 1, 1, 3],\n [1, 1, 4, 3, 1, 1],\n [4, 1, 1, 1, 1, 3],\n [4, 1, 1, 3, 1, 1],\n [1, 1, 3, 1, 4, 1],\n [1, 1, 4, 1, 3, 1],\n [3, 1, 1, 1, 4, 1],\n [4, 1, 1, 1, 3, 1],\n [2, 1, 1, 4, 1, 2],\n [2, 1, 1, 2, 1, 4],\n [2, 1, 1, 2, 3, 2],\n [2, 3, 3, 1, 1, 1, 2]\n ]},\n SINGLE_CODE_ERROR: {value: 1},\n AVG_CODE_ERROR: {value: 0.5},\n FORMAT: {value: \"code_128\", writeable: false}\n};\n\nCode128Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nCode128Reader.prototype.constructor = Code128Reader;\n\nCode128Reader.prototype._decodeCode = function(start) {\n var counter = [0, 0, 0, 0, 0, 0],\n i,\n self = this,\n offset = start,\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : start,\n end : start\n },\n code,\n error,\n normalized;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < self.CODE_PATTERN.length; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n bestMatch.end = i;\n return bestMatch;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nCode128Reader.prototype._findStart = function() {\n var counter = [0, 0, 0, 0, 0, 0],\n i,\n self = this,\n offset = self._nextSet(self._row),\n isWhite = false,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n code,\n error,\n j,\n sum,\n normalized;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n if (bestMatch.error < self.AVG_CODE_ERROR) {\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n\n for ( j = 0; j < 4; j++) {\n counter[j] = counter[j + 2];\n }\n counter[4] = 0;\n counter[5] = 0;\n counterPos--;\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nCode128Reader.prototype._decode = function() {\n var self = this,\n startInfo = self._findStart(),\n code = null,\n done = false,\n result = [],\n multiplier = 0,\n checksum = 0,\n codeset,\n rawResult = [],\n decodedCodes = [],\n shiftNext = false,\n unshift,\n lastCharacterWasPrintable;\n\n if (startInfo === null) {\n return null;\n }\n code = {\n code : startInfo.code,\n start : startInfo.start,\n end : startInfo.end\n };\n decodedCodes.push(code);\n checksum = code.code;\n switch(code.code) {\n case self.START_CODE_A:\n codeset = self.CODE_A;\n break;\n case self.START_CODE_B:\n codeset = self.CODE_B;\n break;\n case self.START_CODE_C:\n codeset = self.CODE_C;\n break;\n default:\n return null;\n }\n\n while (!done) {\n unshift = shiftNext;\n shiftNext = false;\n code = self._decodeCode(code.end);\n if (code !== null) {\n if (code.code !== self.STOP_CODE) {\n rawResult.push(code.code);\n multiplier++;\n checksum += multiplier * code.code;\n }\n decodedCodes.push(code);\n\n switch(codeset) {\n case self.CODE_A:\n if (code.code < 64) {\n result.push(String.fromCharCode(32 + code.code));\n } else if (code.code < 96) {\n result.push(String.fromCharCode(code.code - 64));\n } else {\n switch (code.code) {\n case self.CODE_SHIFT:\n shiftNext = true;\n codeset = self.CODE_B;\n break;\n case self.CODE_B:\n codeset = self.CODE_B;\n break;\n case self.CODE_C:\n codeset = self.CODE_C;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n }\n break;\n case self.CODE_B:\n if (code.code < 96) {\n result.push(String.fromCharCode(32 + code.code));\n } else {\n if (code.code != self.STOP_CODE) {\n lastCharacterWasPrintable = false;\n }\n switch (code.code) {\n case self.CODE_SHIFT:\n shiftNext = true;\n codeset = self.CODE_A;\n break;\n case self.CODE_A:\n codeset = self.CODE_A;\n break;\n case self.CODE_C:\n codeset = self.CODE_C;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n }\n break;\n case self.CODE_C:\n if (code.code < 100) {\n result.push(code.code < 10 ? \"0\" + code.code : code.code);\n }\n switch (code.code) {\n case self.CODE_A:\n codeset = self.CODE_A;\n break;\n case self.CODE_B:\n codeset = self.CODE_B;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n break;\n }\n } else {\n done = true;\n }\n if (unshift) {\n codeset = codeset == self.CODE_A ? self.CODE_B : self.CODE_A;\n }\n }\n\n if (code === null) {\n return null;\n }\n\n // find end bar\n code.end = self._nextUnset(self._row, code.end);\n if(!self._verifyTrailingWhitespace(code)){\n return null;\n }\n\n // checksum\n // Does not work correctly yet!!! startcode - endcode?\n checksum -= multiplier * rawResult[rawResult.length - 1];\n if (checksum % 103 != rawResult[rawResult.length - 1]) {\n return null;\n }\n\n if (!result.length) {\n return null;\n }\n\n // remove last code from result (checksum)\n result.splice(result.length - 1, 1);\n\n\n\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : code.end,\n codeset : codeset,\n startInfo : startInfo,\n decodedCodes : decodedCodes,\n endInfo : code\n };\n};\n\n\nBarcodeReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start) / 2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nexport default Code128Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_128_reader.js\n **/","function BarcodeReader(config) {\n this._row = [];\n this.config = config || {};\n return this;\n}\n\nBarcodeReader.prototype._nextUnset = function(line, start) {\n var i;\n\n if (start === undefined) {\n start = 0;\n }\n for (i = start; i < line.length; i++) {\n if (!line[i]) {\n return i;\n }\n }\n return line.length;\n};\n\nBarcodeReader.prototype._matchPattern = function(counter, code) {\n var i,\n error = 0,\n singleError = 0,\n modulo = this.MODULO,\n maxSingleError = this.SINGLE_CODE_ERROR || 1;\n\n for (i = 0; i < counter.length; i++) {\n singleError = Math.abs(code[i] - counter[i]);\n if (singleError > maxSingleError) {\n return Number.MAX_VALUE;\n }\n error += singleError;\n }\n return error/modulo;\n};\n\nBarcodeReader.prototype._nextSet = function(line, offset) {\n var i;\n\n offset = offset || 0;\n for (i = offset; i < line.length; i++) {\n if (line[i]) {\n return i;\n }\n }\n return line.length;\n};\n\nBarcodeReader.prototype._normalize = function(counter, modulo) {\n var i,\n self = this,\n sum = 0,\n ratio,\n numOnes = 0,\n normalized = [],\n norm = 0;\n\n if (!modulo) {\n modulo = self.MODULO;\n }\n for (i = 0; i < counter.length; i++) {\n if (counter[i] === 1) {\n numOnes++;\n } else {\n sum += counter[i];\n }\n }\n ratio = sum / (modulo - numOnes);\n if (ratio > 1.0) {\n for (i = 0; i < counter.length; i++) {\n norm = counter[i] === 1 ? counter[i] : counter[i] / ratio;\n normalized.push(norm);\n }\n } else {\n ratio = (sum + numOnes)/modulo;\n for (i = 0; i < counter.length; i++) {\n norm = counter[i] / ratio;\n normalized.push(norm);\n }\n }\n return normalized;\n};\n\nBarcodeReader.prototype._matchTrace = function(cmpCounter, epsilon) {\n var counter = [],\n i,\n self = this,\n offset = self._nextSet(self._row),\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0\n },\n error;\n\n if (cmpCounter) {\n for ( i = 0; i < cmpCounter.length; i++) {\n counter.push(0);\n }\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n error = self._matchPattern(counter, cmpCounter);\n\n if (error < epsilon) {\n bestMatch.start = i - offset;\n bestMatch.end = i;\n bestMatch.counter = counter;\n return bestMatch;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n } else {\n counter.push(0);\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n counterPos++;\n counter.push(0);\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n }\n\n // if cmpCounter was not given\n bestMatch.start = offset;\n bestMatch.end = self._row.length - 1;\n bestMatch.counter = counter;\n return bestMatch;\n};\n\nBarcodeReader.prototype.decodePattern = function(pattern) {\n var self = this,\n result;\n\n self._row = pattern;\n result = self._decode();\n if (result === null) {\n self._row.reverse();\n result = self._decode();\n if (result) {\n result.direction = BarcodeReader.DIRECTION.REVERSE;\n result.start = self._row.length - result.start;\n result.end = self._row.length - result.end;\n }\n } else {\n result.direction = BarcodeReader.DIRECTION.FORWARD;\n }\n if (result) {\n result.format = self.FORMAT;\n }\n return result;\n};\n\nBarcodeReader.prototype._matchRange = function(start, end, value) {\n var i;\n\n start = start < 0 ? 0 : start;\n for (i = start; i < end; i++) {\n if (this._row[i] !== value) {\n return false;\n }\n }\n return true;\n};\n\nBarcodeReader.prototype._fillCounters = function(offset, end, isWhite) {\n var self = this,\n counterPos = 0,\n i,\n counters = [];\n\n isWhite = (typeof isWhite !== 'undefined') ? isWhite : true;\n offset = (typeof offset !== 'undefined') ? offset : self._nextUnset(self._row);\n end = end || self._row.length;\n\n counters[counterPos] = 0;\n for (i = offset; i < end; i++) {\n if (self._row[i] ^ isWhite) {\n counters[counterPos]++;\n } else {\n counterPos++;\n counters[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return counters;\n};\n\nObject.defineProperty(BarcodeReader.prototype, \"FORMAT\", {\n value: 'unknown',\n writeable: false\n});\n\nBarcodeReader.DIRECTION = {\n FORWARD : 1,\n REVERSE : -1\n};\n\nBarcodeReader.Exception = {\n StartNotFoundException : \"Start-Info was not found!\",\n CodeNotFoundException : \"Code could not be found!\",\n PatternNotFoundException : \"Pattern could not be found!\"\n};\n\nBarcodeReader.CONFIG_KEYS = {};\n\nexport default BarcodeReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_reader.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction EANReader(opts) {\n BarcodeReader.call(this, opts);\n}\n\nvar properties = {\n CODE_L_START : {value: 0},\n MODULO : {value: 7},\n CODE_G_START : {value: 10},\n START_PATTERN : {value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7]},\n STOP_PATTERN : {value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7]},\n MIDDLE_PATTERN : {value: [1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7]},\n CODE_PATTERN : {value: [\n [3, 2, 1, 1],\n [2, 2, 2, 1],\n [2, 1, 2, 2],\n [1, 4, 1, 1],\n [1, 1, 3, 2],\n [1, 2, 3, 1],\n [1, 1, 1, 4],\n [1, 3, 1, 2],\n [1, 2, 1, 3],\n [3, 1, 1, 2],\n [1, 1, 2, 3],\n [1, 2, 2, 2],\n [2, 2, 1, 2],\n [1, 1, 4, 1],\n [2, 3, 1, 1],\n [1, 3, 2, 1],\n [4, 1, 1, 1],\n [2, 1, 3, 1],\n [3, 1, 2, 1],\n [2, 1, 1, 3]\n ]},\n CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},\n SINGLE_CODE_ERROR: {value: 0.67},\n AVG_CODE_ERROR: {value: 0.27},\n FORMAT: {value: \"ean_13\", writeable: false}\n};\n\nEANReader.prototype = Object.create(BarcodeReader.prototype, properties);\nEANReader.prototype.constructor = EANReader;\n\nEANReader.prototype._decodeCode = function(start, coderange) {\n var counter = [0, 0, 0, 0],\n i,\n self = this,\n offset = start,\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : start,\n end : start\n },\n code,\n error,\n normalized;\n\n if (!coderange) {\n coderange = self.CODE_PATTERN.length;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < coderange; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n bestMatch.end = i;\n if (bestMatch.error > self.AVG_CODE_ERROR) {\n return null;\n }\n return bestMatch;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nEANReader.prototype._findPattern = function(pattern, offset, isWhite, tryHarder, epsilon) {\n var counter = [],\n self = this,\n i,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n error,\n j,\n sum,\n normalized;\n\n if (!offset) {\n offset = self._nextSet(self._row);\n }\n\n if (isWhite === undefined) {\n isWhite = false;\n }\n\n if (tryHarder === undefined) {\n tryHarder = true;\n }\n\n if ( epsilon === undefined) {\n epsilon = self.AVG_CODE_ERROR;\n }\n\n for ( i = 0; i < pattern.length; i++) {\n counter[i] = 0;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n error = self._matchPattern(normalized, pattern);\n\n if (error < epsilon) {\n bestMatch.error = error;\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n if (tryHarder) {\n for ( j = 0; j < counter.length - 2; j++) {\n counter[j] = counter[j + 2];\n }\n counter[counter.length - 2] = 0;\n counter[counter.length - 1] = 0;\n counterPos--;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nEANReader.prototype._findStart = function() {\n var self = this,\n leadingWhitespaceStart,\n offset = self._nextSet(self._row),\n startInfo;\n\n while(!startInfo) {\n startInfo = self._findPattern(self.START_PATTERN, offset);\n if (!startInfo) {\n return null;\n }\n leadingWhitespaceStart = startInfo.start - (startInfo.end - startInfo.start);\n if (leadingWhitespaceStart >= 0) {\n if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n return startInfo;\n }\n }\n offset = startInfo.end;\n startInfo = null;\n }\n};\n\nEANReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nEANReader.prototype._findEnd = function(offset, isWhite) {\n var self = this,\n endInfo = self._findPattern(self.STOP_PATTERN, offset, isWhite, false);\n\n return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n};\n\nEANReader.prototype._calculateFirstDigit = function(codeFrequency) {\n var i,\n self = this;\n\n for ( i = 0; i < self.CODE_FREQUENCY.length; i++) {\n if (codeFrequency === self.CODE_FREQUENCY[i]) {\n return i;\n }\n }\n return null;\n};\n\nEANReader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this,\n codeFrequency = 0x0,\n firstDigit;\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end);\n if (!code) {\n return null;\n }\n if (code.code >= self.CODE_G_START) {\n code.code = code.code - self.CODE_G_START;\n codeFrequency |= 1 << (5 - i);\n } else {\n codeFrequency |= 0 << (5 - i);\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n\n firstDigit = self._calculateFirstDigit(codeFrequency);\n if (firstDigit === null) {\n return null;\n }\n result.unshift(firstDigit);\n\n code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n if (code === null) {\n return null;\n }\n decodedCodes.push(code);\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n decodedCodes.push(code);\n result.push(code.code);\n }\n\n return code;\n};\n\nEANReader.prototype._decode = function() {\n var startInfo,\n self = this,\n code,\n result = [],\n decodedCodes = [];\n\n startInfo = self._findStart();\n if (!startInfo) {\n return null;\n }\n code = {\n code : startInfo.code,\n start : startInfo.start,\n end : startInfo.end\n };\n decodedCodes.push(code);\n code = self._decodePayload(code, result, decodedCodes);\n if (!code) {\n return null;\n }\n code = self._findEnd(code.end, false);\n if (!code){\n return null;\n }\n\n decodedCodes.push(code);\n\n // Checksum\n if (!self._checksum(result)) {\n return null;\n }\n\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : code.end,\n codeset : \"\",\n startInfo : startInfo,\n decodedCodes : decodedCodes\n };\n};\n\nEANReader.prototype._checksum = function(result) {\n var sum = 0, i;\n\n for ( i = result.length - 2; i >= 0; i -= 2) {\n sum += result[i];\n }\n sum *= 3;\n for ( i = result.length - 1; i >= 0; i -= 2) {\n sum += result[i];\n }\n return sum % 10 === 0;\n};\n\nexport default (EANReader);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ean_reader.js\n **/","import BarcodeReader from './barcode_reader';\nimport ArrayHelper from './array_helper';\n\nfunction Code39Reader() {\n BarcodeReader.call(this);\n}\n\nvar properties = {\n ALPHABETH_STRING: {value: \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%\"},\n ALPHABET: {value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 45, 46, 32, 42, 36, 47, 43, 37]},\n CHARACTER_ENCODINGS: {value: [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A]},\n ASTERISK: {value: 0x094},\n FORMAT: {value: \"code_39\", writeable: false}\n};\n\nCode39Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nCode39Reader.prototype.constructor = Code39Reader;\n\nCode39Reader.prototype._toCounters = function(start, counter) {\n var self = this,\n numCounters = counter.length,\n end = self._row.length,\n isWhite = !self._row[start],\n i,\n counterPos = 0;\n\n ArrayHelper.init(counter, 0);\n\n for ( i = start; i < end; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n counterPos++;\n if (counterPos === numCounters) {\n break;\n } else {\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n }\n\n return counter;\n};\n\nCode39Reader.prototype._decode = function() {\n var self = this,\n counters = [0,0,0,0,0,0,0,0,0],\n result = [],\n start = self._findStart(),\n decodedChar,\n lastStart,\n pattern,\n nextStart;\n\n if (!start) {\n return null;\n }\n nextStart = self._nextSet(self._row, start.end);\n\n do {\n counters = self._toCounters(nextStart, counters);\n pattern = self._toPattern(counters);\n if (pattern < 0) {\n return null;\n }\n decodedChar = self._patternToChar(pattern);\n if (decodedChar < 0){\n return null;\n }\n result.push(decodedChar);\n lastStart = nextStart;\n nextStart += ArrayHelper.sum(counters);\n nextStart = self._nextSet(self._row, nextStart);\n } while(decodedChar !== '*');\n result.pop();\n\n if (!result.length) {\n return null;\n }\n\n if(!self._verifyTrailingWhitespace(lastStart, nextStart, counters)) {\n return null;\n }\n\n return {\n code : result.join(\"\"),\n start : start.start,\n end : nextStart,\n startInfo : start,\n decodedCodes : result\n };\n};\n\nCode39Reader.prototype._verifyTrailingWhitespace = function(lastStart, nextStart, counters) {\n var trailingWhitespaceEnd,\n patternSize = ArrayHelper.sum(counters);\n\n trailingWhitespaceEnd = nextStart - lastStart - patternSize;\n if ((trailingWhitespaceEnd * 3) >= patternSize) {\n return true;\n }\n return false;\n};\n\nCode39Reader.prototype._patternToChar = function(pattern) {\n var i,\n self = this;\n\n for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n if (self.CHARACTER_ENCODINGS[i] === pattern) {\n return String.fromCharCode(self.ALPHABET[i]);\n }\n }\n};\n\nCode39Reader.prototype._findNextWidth = function(counters, current) {\n var i,\n minWidth = Number.MAX_VALUE;\n\n for (i = 0; i < counters.length; i++) {\n if (counters[i] < minWidth && counters[i] > current) {\n minWidth = counters[i];\n }\n }\n\n return minWidth;\n};\n\nCode39Reader.prototype._toPattern = function(counters) {\n var numCounters = counters.length,\n maxNarrowWidth = 0,\n numWideBars = numCounters,\n wideBarWidth = 0,\n self = this,\n pattern,\n i;\n\n while(numWideBars > 3) {\n maxNarrowWidth = self._findNextWidth(counters, maxNarrowWidth);\n numWideBars = 0;\n pattern = 0;\n for (i = 0; i < numCounters; i++) {\n if (counters[i] > maxNarrowWidth) {\n pattern |= 1 << (numCounters - 1 - i);\n numWideBars++;\n wideBarWidth += counters[i];\n }\n }\n\n if (numWideBars === 3) {\n for (i = 0; i < numCounters && numWideBars > 0; i++) {\n if (counters[i] > maxNarrowWidth) {\n numWideBars--;\n if ((counters[i] * 2) >= wideBarWidth) {\n return -1;\n }\n }\n }\n return pattern;\n }\n }\n return -1;\n};\n\nCode39Reader.prototype._findStart = function() {\n var self = this,\n offset = self._nextSet(self._row),\n patternStart = offset,\n counter = [0,0,0,0,0,0,0,0,0],\n counterPos = 0,\n isWhite = false,\n i,\n j,\n whiteSpaceMustStart;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n\n // find start pattern\n if (self._toPattern(counter) === self.ASTERISK) {\n whiteSpaceMustStart = Math.floor(Math.max(0, patternStart - ((i - patternStart) / 4)));\n if (self._matchRange(whiteSpaceMustStart, patternStart, 0)) {\n return {\n start: patternStart,\n end: i\n };\n }\n }\n\n patternStart += counter[0] + counter[1];\n for ( j = 0; j < 7; j++) {\n counter[j] = counter[j + 2];\n }\n counter[7] = 0;\n counter[8] = 0;\n counterPos--;\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nexport default Code39Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_39_reader.js\n **/","import Code39Reader from './code_39_reader';\n\nfunction Code39VINReader() {\n Code39Reader.call(this);\n}\n\nvar patterns = {\n IOQ: /[IOQ]/g,\n AZ09: /[A-Z0-9]{17}/\n};\n\nCode39VINReader.prototype = Object.create(Code39Reader.prototype);\nCode39VINReader.prototype.constructor = Code39VINReader;\n\n// Cribbed from:\n// /~https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/VINResultParser.java\nCode39VINReader.prototype._decode = function() {\n var result = Code39Reader.prototype._decode.apply(this);\n if (!result) {\n return null;\n }\n\n var code = result.code;\n\n if (!code) {\n return;\n }\n\n code = code.replace(patterns.IOQ, '');\n\n if (!code.match(patterns.AZ09)) {\n console.log('Failed AZ09 pattern code:', code);\n return null;\n }\n\n if (!this._checkChecksum(code)) {\n return null;\n }\n\n result.code = code;\n return result;\n};\n\nCode39VINReader.prototype._checkChecksum = function(code) {\n // TODO\n return !!code;\n};\n\nexport default Code39VINReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_39_vin_reader.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction CodabarReader() {\n BarcodeReader.call(this);\n this._counters = [];\n}\n\nvar properties = {\n ALPHABETH_STRING: {value: \"0123456789-$:/.+ABCD\"},\n ALPHABET: {value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 36, 58, 47, 46, 43, 65, 66, 67, 68]},\n CHARACTER_ENCODINGS: {value: [0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E]},\n START_END: {value: [0x01A, 0x029, 0x00B, 0x00E]},\n MIN_ENCODED_CHARS: {value: 4},\n MAX_ACCEPTABLE: {value: 2.0},\n PADDING: {value: 1.5},\n FORMAT: {value: \"codabar\", writeable: false}\n};\n\nCodabarReader.prototype = Object.create(BarcodeReader.prototype, properties);\nCodabarReader.prototype.constructor = CodabarReader;\n\nCodabarReader.prototype._decode = function() {\n var self = this,\n result = [],\n start,\n decodedChar,\n pattern,\n nextStart,\n end;\n\n this._counters = self._fillCounters();\n start = self._findStart();\n if (!start) {\n return null;\n }\n nextStart = start.startCounter;\n\n do {\n pattern = self._toPattern(nextStart);\n if (pattern < 0) {\n return null;\n }\n decodedChar = self._patternToChar(pattern);\n if (decodedChar < 0){\n return null;\n }\n result.push(decodedChar);\n nextStart += 8;\n if (result.length > 1 && self._isStartEnd(pattern)) {\n break;\n }\n } while(nextStart < self._counters.length);\n\n // verify end\n if ((result.length - 2) < self.MIN_ENCODED_CHARS || !self._isStartEnd(pattern)) {\n return null;\n }\n\n // verify end white space\n if (!self._verifyWhitespace(start.startCounter, nextStart - 8)){\n return null;\n }\n\n if (!self._validateResult(result, start.startCounter)){\n return null;\n }\n\n nextStart = nextStart > self._counters.length ? self._counters.length : nextStart;\n end = start.start + self._sumCounters(start.startCounter, nextStart - 8);\n\n return {\n code : result.join(\"\"),\n start : start.start,\n end : end,\n startInfo : start,\n decodedCodes : result\n };\n};\n\nCodabarReader.prototype._verifyWhitespace = function(startCounter, endCounter) {\n if ((startCounter - 1 <= 0) || this._counters[startCounter-1] >= (this._calculatePatternLength(startCounter) / 2.0)) {\n if ((endCounter + 8 >= this._counters.length) || this._counters[endCounter+7] >= (this._calculatePatternLength(endCounter) / 2.0)) {\n return true;\n }\n }\n return false;\n};\n\nCodabarReader.prototype._calculatePatternLength = function(offset) {\n var i,\n sum = 0;\n\n for (i = offset; i < offset + 7; i++) {\n sum += this._counters[i];\n }\n\n return sum;\n};\n\nCodabarReader.prototype._thresholdResultPattern = function(result, startCounter){\n var self = this,\n categorization = {\n space: {\n narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE},\n wide: {size: 0, counts: 0, min: 0, max: Number.MAX_VALUE}\n },\n bar: {\n narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE},\n wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE}\n }\n },\n kind,\n cat,\n i,\n j,\n pos = startCounter,\n pattern;\n\n for (i = 0; i < result.length; i++){\n pattern = self._charToPattern(result[i]);\n for (j = 6; j >= 0; j--) {\n kind = (j & 1) === 2 ? categorization.bar : categorization.space;\n cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n cat.size += self._counters[pos + j];\n cat.counts++;\n pattern >>= 1;\n }\n pos += 8;\n }\n\n [\"space\", \"bar\"].forEach(function(key) {\n var kind = categorization[key];\n kind.wide.min = Math.floor((kind.narrow.size/kind.narrow.counts + kind.wide.size / kind.wide.counts) / 2);\n kind.narrow.max = Math.ceil(kind.wide.min);\n kind.wide.max = Math.ceil((kind.wide.size * self.MAX_ACCEPTABLE + self.PADDING) / kind.wide.counts);\n });\n\n return categorization;\n};\n\nCodabarReader.prototype._charToPattern = function(char) {\n var self = this,\n charCode = char.charCodeAt(0),\n i;\n\n for (i = 0; i < self.ALPHABET.length; i++) {\n if (self.ALPHABET[i] === charCode){\n return self.CHARACTER_ENCODINGS[i];\n }\n }\n return 0x0;\n};\n\nCodabarReader.prototype._validateResult = function(result, startCounter) {\n var self = this,\n thresholds = self._thresholdResultPattern(result, startCounter),\n i,\n j,\n kind,\n cat,\n size,\n pos = startCounter,\n pattern;\n\n for (i = 0; i < result.length; i++) {\n pattern = self._charToPattern(result[i]);\n for (j = 6; j >= 0; j--) {\n kind = (j & 1) === 0 ? thresholds.bar : thresholds.space;\n cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n size = self._counters[pos + j];\n if (size < cat.min || size > cat.max) {\n return false;\n }\n pattern >>= 1;\n }\n pos += 8;\n }\n return true;\n};\n\nCodabarReader.prototype._patternToChar = function(pattern) {\n var i,\n self = this;\n\n for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n if (self.CHARACTER_ENCODINGS[i] === pattern) {\n return String.fromCharCode(self.ALPHABET[i]);\n }\n }\n return -1;\n};\n\nCodabarReader.prototype._computeAlternatingThreshold = function(offset, end) {\n var i,\n min = Number.MAX_VALUE,\n max = 0,\n counter;\n\n for (i = offset; i < end; i += 2){\n counter = this._counters[i];\n if (counter > max) {\n max = counter;\n }\n if (counter < min) {\n min = counter;\n }\n }\n\n return ((min + max) / 2.0) | 0;\n};\n\nCodabarReader.prototype._toPattern = function(offset) {\n var numCounters = 7,\n end = offset + numCounters,\n barThreshold,\n spaceThreshold,\n bitmask = 1 << (numCounters - 1),\n pattern = 0,\n i,\n threshold;\n\n if (end > this._counters.length) {\n return -1;\n }\n\n barThreshold = this._computeAlternatingThreshold(offset, end);\n spaceThreshold = this._computeAlternatingThreshold(offset + 1, end);\n\n for (i = 0; i < numCounters; i++){\n threshold = (i & 1) === 0 ? barThreshold : spaceThreshold;\n if (this._counters[offset + i] > threshold) {\n pattern |= bitmask;\n }\n bitmask >>= 1;\n }\n\n return pattern;\n};\n\nCodabarReader.prototype._isStartEnd = function(pattern) {\n var i;\n\n for (i = 0; i < this.START_END.length; i++) {\n if (this.START_END[i] === pattern) {\n return true;\n }\n }\n return false;\n};\n\nCodabarReader.prototype._sumCounters = function(start, end) {\n var i,\n sum = 0;\n\n for (i = start; i < end; i++) {\n sum += this._counters[i];\n }\n return sum;\n};\n\nCodabarReader.prototype._findStart = function() {\n var self = this,\n i,\n pattern,\n start = self._nextUnset(self._row),\n end;\n\n for (i = 1; i < this._counters.length; i++) {\n pattern = self._toPattern(i);\n if (pattern !== -1 && self._isStartEnd(pattern)) {\n // TODO: Look for whitespace ahead\n start += self._sumCounters(0, i);\n end = start + self._sumCounters(i, i + 8);\n return {\n start: start,\n end: end,\n startCounter: i,\n endCounter: i + 8\n };\n }\n }\n};\n\nexport default CodabarReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/codabar_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction UPCReader() {\n EANReader.call(this);\n}\n\nvar properties = {\n FORMAT: {value: \"upc_a\", writeable: false}\n};\n\nUPCReader.prototype = Object.create(EANReader.prototype, properties);\nUPCReader.prototype.constructor = UPCReader;\n\nUPCReader.prototype._decode = function() {\n var result = EANReader.prototype._decode.call(this);\n\n if (result && result.code && result.code.length === 13 && result.code.charAt(0) === \"0\") {\n\n result.code = result.code.substring(1);\n return result;\n }\n return null;\n};\n\nexport default EANReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/upc_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction EAN8Reader() {\n EANReader.call(this);\n}\n\nvar properties = {\n FORMAT: {value: \"ean_8\", writeable: false}\n};\n\nEAN8Reader.prototype = Object.create(EANReader.prototype, properties);\nEAN8Reader.prototype.constructor = EAN8Reader;\n\nEAN8Reader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this;\n\n for ( i = 0; i < 4; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n\n code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n if (code === null) {\n return null;\n }\n decodedCodes.push(code);\n\n for ( i = 0; i < 4; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n decodedCodes.push(code);\n result.push(code.code);\n }\n\n return code;\n};\n\nexport default EAN8Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ean_8_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction UPCEReader() {\n EANReader.call(this);\n}\n\nvar properties = {\n CODE_FREQUENCY : {value: [\n [ 56, 52, 50, 49, 44, 38, 35, 42, 41, 37 ],\n [7, 11, 13, 14, 19, 25, 28, 21, 22, 26]]},\n STOP_PATTERN: { value: [1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7]},\n FORMAT: {value: \"upc_e\", writeable: false}\n};\n\nUPCEReader.prototype = Object.create(EANReader.prototype, properties);\nUPCEReader.prototype.constructor = UPCEReader;\n\nUPCEReader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this,\n codeFrequency = 0x0;\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end);\n if (!code) {\n return null;\n }\n if (code.code >= self.CODE_G_START) {\n code.code = code.code - self.CODE_G_START;\n codeFrequency |= 1 << (5 - i);\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n if (!self._determineParity(codeFrequency, result)) {\n return null;\n }\n\n return code;\n};\n\nUPCEReader.prototype._determineParity = function(codeFrequency, result) {\n var self =this,\n i,\n nrSystem;\n\n for (nrSystem = 0; nrSystem < self.CODE_FREQUENCY.length; nrSystem++){\n for ( i = 0; i < self.CODE_FREQUENCY[nrSystem].length; i++) {\n if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {\n result.unshift(nrSystem);\n result.push(i);\n return true;\n }\n }\n }\n return false;\n};\n\nUPCEReader.prototype._convertToUPCA = function(result) {\n var upca = [result[0]],\n lastDigit = result[result.length - 2];\n\n if (lastDigit <= 2) {\n upca = upca.concat(result.slice(1, 3))\n .concat([lastDigit, 0, 0, 0, 0])\n .concat(result.slice(3, 6));\n } else if (lastDigit === 3) {\n upca = upca.concat(result.slice(1, 4))\n .concat([0 ,0, 0, 0, 0])\n .concat(result.slice(4,6));\n } else if (lastDigit === 4) {\n upca = upca.concat(result.slice(1, 5))\n .concat([0, 0, 0, 0, 0, result[5]]);\n } else {\n upca = upca.concat(result.slice(1, 6))\n .concat([0, 0, 0, 0, lastDigit]);\n }\n\n upca.push(result[result.length - 1]);\n return upca;\n};\n\nUPCEReader.prototype._checksum = function(result) {\n return EANReader.prototype._checksum.call(this, this._convertToUPCA(result));\n};\n\nUPCEReader.prototype._findEnd = function(offset, isWhite) {\n isWhite = true;\n return EANReader.prototype._findEnd.call(this, offset, isWhite);\n};\n\nUPCEReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start)/2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n};\n\nexport default UPCEReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/upc_e_reader.js\n **/","import BarcodeReader from './barcode_reader';\nconst merge = require('lodash/object/merge');\n\nfunction I2of5Reader(opts) {\n opts = merge(getDefaulConfig(), opts);\n BarcodeReader.call(this, opts);\n this.barSpaceRatio = [1, 1];\n if (opts.normalizeBarSpaceWidth) {\n this.SINGLE_CODE_ERROR = 0.38;\n this.AVG_CODE_ERROR = 0.09;\n }\n}\n\nfunction getDefaulConfig() {\n var config = {};\n\n Object.keys(I2of5Reader.CONFIG_KEYS).forEach(function(key) {\n config[key] = I2of5Reader.CONFIG_KEYS[key]['default'];\n });\n return config;\n}\n\nvar N = 1,\n W = 3,\n properties = {\n MODULO : {value: 10},\n START_PATTERN : {value: [N*2.5, N*2.5, N*2.5, N*2.5]},\n STOP_PATTERN : {value: [N*2, N*2, W*2]},\n CODE_PATTERN : {value: [\n [N, N, W, W, N],\n [W, N, N, N, W],\n [N, W, N, N, W],\n [W, W, N, N, N],\n [N, N, W, N, W],\n [W, N, W, N, N],\n [N, W, W, N, N],\n [N, N, N, W, W],\n [W, N, N, W, N],\n [N, W, N, W, N]\n ]},\n SINGLE_CODE_ERROR: {value: 0.78, writable: true},\n AVG_CODE_ERROR: {value: 0.38, writable: true},\n MAX_CORRECTION_FACTOR: {value: 5},\n FORMAT: {value: \"i2of5\"}\n};\n\nI2of5Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nI2of5Reader.prototype.constructor = I2of5Reader;\n\nI2of5Reader.prototype._matchPattern = function(counter, code) {\n if (this.config.normalizeBarSpaceWidth) {\n var i,\n counterSum = [0, 0],\n codeSum = [0, 0],\n correction = [0, 0],\n correctionRatio = this.MAX_CORRECTION_FACTOR,\n correctionRatioInverse = 1 / correctionRatio;\n\n for (i = 0; i < counter.length; i++) {\n counterSum[i % 2] += counter[i];\n codeSum[i % 2] += code[i];\n }\n correction[0] = codeSum[0] / counterSum[0];\n correction[1] = codeSum[1] / counterSum[1];\n\n correction[0] = Math.max(Math.min(correction[0], correctionRatio), correctionRatioInverse);\n correction[1] = Math.max(Math.min(correction[1], correctionRatio), correctionRatioInverse);\n this.barSpaceRatio = correction;\n for (i = 0; i < counter.length; i++) {\n counter[i] *= this.barSpaceRatio[i % 2];\n }\n }\n return BarcodeReader.prototype._matchPattern.call(this, counter, code);\n};\n\nI2of5Reader.prototype._findPattern = function(pattern, offset, isWhite, tryHarder) {\n var counter = [],\n self = this,\n i,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n error,\n j,\n sum,\n normalized,\n epsilon = self.AVG_CODE_ERROR;\n\n isWhite = isWhite || false;\n tryHarder = tryHarder || false;\n\n if (!offset) {\n offset = self._nextSet(self._row);\n }\n\n for ( i = 0; i < pattern.length; i++) {\n counter[i] = 0;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n error = self._matchPattern(normalized, pattern);\n\n if (error < epsilon) {\n bestMatch.error = error;\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n if (tryHarder) {\n for (j = 0; j < counter.length - 2; j++) {\n counter[j] = counter[j + 2];\n }\n counter[counter.length - 2] = 0;\n counter[counter.length - 1] = 0;\n counterPos--;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._findStart = function() {\n var self = this,\n leadingWhitespaceStart,\n offset = self._nextSet(self._row),\n startInfo,\n narrowBarWidth = 1;\n\n while(!startInfo) {\n startInfo = self._findPattern(self.START_PATTERN, offset, false, true);\n if (!startInfo) {\n return null;\n }\n narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / 4);\n leadingWhitespaceStart = startInfo.start - narrowBarWidth*10;\n if (leadingWhitespaceStart >= 0) {\n if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n return startInfo;\n }\n }\n offset = startInfo.end;\n startInfo = null;\n }\n};\n\nI2of5Reader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start) / 2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._findEnd = function() {\n var self = this,\n endInfo,\n tmp;\n\n self._row.reverse();\n endInfo = self._findPattern(self.STOP_PATTERN);\n self._row.reverse();\n\n if (endInfo === null) {\n return null;\n }\n\n // reverse numbers\n tmp = endInfo.start;\n endInfo.start = self._row.length - endInfo.end;\n endInfo.end = self._row.length - tmp;\n\n return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n};\n\nI2of5Reader.prototype._decodePair = function(counterPair) {\n var i,\n code,\n codes = [],\n self = this;\n\n for (i = 0; i < counterPair.length; i++) {\n code = self._decodeCode(counterPair[i]);\n if (!code) {\n return null;\n }\n codes.push(code);\n }\n return codes;\n};\n\nI2of5Reader.prototype._decodeCode = function(counter) {\n var j,\n self = this,\n sum = 0,\n normalized,\n error,\n epsilon = self.AVG_CODE_ERROR,\n code,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n };\n\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < self.CODE_PATTERN.length; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n if (bestMatch.error < epsilon) {\n return bestMatch;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._decodePayload = function(counters, result, decodedCodes) {\n var i,\n self = this,\n pos = 0,\n counterLength = counters.length,\n counterPair = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],\n codes;\n\n while (pos < counterLength) {\n for (i = 0; i < 5; i++) {\n counterPair[0][i] = counters[pos]*this.barSpaceRatio[0];\n counterPair[1][i] = counters[pos + 1]*this.barSpaceRatio[1];\n pos += 2;\n }\n codes = self._decodePair(counterPair);\n if (!codes) {\n return null;\n }\n for (i = 0; i < codes.length; i++) {\n result.push(codes[i].code + \"\");\n decodedCodes.push(codes[i]);\n }\n }\n return codes;\n};\n\nI2of5Reader.prototype._verifyCounterLength = function(counters) {\n return (counters.length % 10 === 0);\n};\n\nI2of5Reader.prototype._decode = function() {\n var startInfo,\n endInfo,\n self = this,\n code,\n result = [],\n decodedCodes = [],\n counters;\n\n startInfo = self._findStart();\n if (!startInfo) {\n return null;\n }\n decodedCodes.push(startInfo);\n\n endInfo = self._findEnd();\n if (!endInfo) {\n return null;\n }\n\n counters = self._fillCounters(startInfo.end, endInfo.start, false);\n if (!self._verifyCounterLength(counters)) {\n return null;\n }\n code = self._decodePayload(counters, result, decodedCodes);\n if (!code) {\n return null;\n }\n if (result.length % 2 !== 0 ||\n result.length < 6) {\n return null;\n }\n\n decodedCodes.push(endInfo);\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : endInfo.end,\n startInfo : startInfo,\n decodedCodes : decodedCodes\n };\n};\n\nI2of5Reader.CONFIG_KEYS = {\n normalizeBarSpaceWidth: {\n 'type': 'boolean',\n 'default': false,\n 'description': 'If true, the reader tries to normalize the' +\n 'width-difference between bars and spaces'\n }\n};\n\nexport default I2of5Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/i2of5_reader.js\n **/","var baseMerge = require('../internal/baseMerge'),\n createAssigner = require('../internal/createAssigner');\n\n/**\n * Recursively merges own enumerable properties of the source object(s), that\n * don't resolve to `undefined` into the destination object. Subsequent sources\n * overwrite property assignments of previous sources. If `customizer` is\n * provided it's invoked to produce the merged values of the destination and\n * source properties. If `customizer` returns `undefined` merging is handled\n * by the method instead. The `customizer` is bound to `thisArg` and invoked\n * with five arguments: (objectValue, sourceValue, key, object, source).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var users = {\n * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n * };\n *\n * var ages = {\n * 'data': [{ 'age': 36 }, { 'age': 40 }]\n * };\n *\n * _.merge(users, ages);\n * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n *\n * // using a customizer callback\n * var object = {\n * 'fruits': ['apple'],\n * 'vegetables': ['beet']\n * };\n *\n * var other = {\n * 'fruits': ['banana'],\n * 'vegetables': ['carrot']\n * };\n *\n * _.merge(object, other, function(a, b) {\n * if (_.isArray(a)) {\n * return a.concat(b);\n * }\n * });\n * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n */\nvar merge = createAssigner(baseMerge);\n\nmodule.exports = merge;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/merge.js\n ** module id = 37\n ** module chunks = 0\n **/","var arrayEach = require('./arrayEach'),\n baseMergeDeep = require('./baseMergeDeep'),\n isArray = require('../lang/isArray'),\n isArrayLike = require('./isArrayLike'),\n isObject = require('../lang/isObject'),\n isObjectLike = require('./isObjectLike'),\n isTypedArray = require('../lang/isTypedArray'),\n keys = require('../object/keys');\n\n/**\n * The base implementation of `_.merge` without support for argument juggling,\n * multiple sources, and `this` binding `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {Object} Returns `object`.\n */\nfunction baseMerge(object, source, customizer, stackA, stackB) {\n if (!isObject(object)) {\n return object;\n }\n var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n props = isSrcArr ? undefined : keys(source);\n\n arrayEach(props || source, function(srcValue, key) {\n if (props) {\n key = srcValue;\n srcValue = source[key];\n }\n if (isObjectLike(srcValue)) {\n stackA || (stackA = []);\n stackB || (stackB = []);\n baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n }\n else {\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n }\n if ((result !== undefined || (isSrcArr && !(key in object))) &&\n (isCommon || (result === result ? (result !== value) : (value === value)))) {\n object[key] = result;\n }\n }\n });\n return object;\n}\n\nmodule.exports = baseMerge;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseMerge.js\n ** module id = 38\n ** module chunks = 0\n **/","/**\n * A specialized version of `_.forEach` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/arrayEach.js\n ** module id = 39\n ** module chunks = 0\n **/","var arrayCopy = require('./arrayCopy'),\n isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isArrayLike = require('./isArrayLike'),\n isPlainObject = require('../lang/isPlainObject'),\n isTypedArray = require('../lang/isTypedArray'),\n toPlainObject = require('../lang/toPlainObject');\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n var length = stackA.length,\n srcValue = source[key];\n\n while (length--) {\n if (stackA[length] == srcValue) {\n object[key] = stackB[length];\n return;\n }\n }\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n result = isArray(value)\n ? value\n : (isArrayLike(value) ? arrayCopy(value) : []);\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n result = isArguments(value)\n ? toPlainObject(value)\n : (isPlainObject(value) ? value : {});\n }\n else {\n isCommon = false;\n }\n }\n // Add the source value to the stack of traversed objects and associate\n // it with its merged value.\n stackA.push(srcValue);\n stackB.push(result);\n\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n } else if (result === result ? (result !== value) : (value === value)) {\n object[key] = result;\n }\n}\n\nmodule.exports = baseMergeDeep;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseMergeDeep.js\n ** module id = 40\n ** module chunks = 0\n **/","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction arrayCopy(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = arrayCopy;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/arrayCopy.js\n ** module id = 41\n ** module chunks = 0\n **/","var isArrayLike = require('../internal/isArrayLike'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Native method references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is classified as an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n return isObjectLike(value) && isArrayLike(value) &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n}\n\nmodule.exports = isArguments;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isArguments.js\n ** module id = 42\n ** module chunks = 0\n **/","var getLength = require('./getLength'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\nfunction isArrayLike(value) {\n return value != null && isLength(getLength(value));\n}\n\nmodule.exports = isArrayLike;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isArrayLike.js\n ** module id = 43\n ** module chunks = 0\n **/","var baseProperty = require('./baseProperty');\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\nmodule.exports = getLength;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/getLength.js\n ** module id = 44\n ** module chunks = 0\n **/","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseProperty.js\n ** module id = 45\n ** module chunks = 0\n **/","/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isLength.js\n ** module id = 46\n ** module chunks = 0\n **/","/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isObjectLike.js\n ** module id = 47\n ** module chunks = 0\n **/","var getNative = require('../internal/getNative'),\n isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\nmodule.exports = isArray;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isArray.js\n ** module id = 48\n ** module chunks = 0\n **/","var isNative = require('../lang/isNative');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/getNative.js\n ** module id = 49\n ** module chunks = 0\n **/","var isFunction = require('./isFunction'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isNative;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isNative.js\n ** module id = 50\n ** module chunks = 0\n **/","var isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, 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 older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 which returns 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\nmodule.exports = isFunction;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isFunction.js\n ** module id = 51\n ** module chunks = 0\n **/","/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isObject.js\n ** module id = 52\n ** module chunks = 0\n **/","var baseForIn = require('../internal/baseForIn'),\n isArguments = require('./isArguments'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * **Note:** This method assumes objects created by the `Object` constructor\n * have no inherited enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n var Ctor;\n\n // Exit early for non `Object` objects.\n if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n return false;\n }\n // IE < 9 iterates inherited properties before own properties. If the first\n // iterated property is an object's own property then there are no inherited\n // enumerable properties.\n var result;\n // In most environments an object's own properties are iterated before\n // its inherited properties. If the last iterated property is an object's\n // own property then there are no inherited enumerable properties.\n baseForIn(value, function(subValue, key) {\n result = key;\n });\n return result === undefined || hasOwnProperty.call(value, result);\n}\n\nmodule.exports = isPlainObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isPlainObject.js\n ** module id = 53\n ** module chunks = 0\n **/","var baseFor = require('./baseFor'),\n keysIn = require('../object/keysIn');\n\n/**\n * The base implementation of `_.forIn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForIn(object, iteratee) {\n return baseFor(object, iteratee, keysIn);\n}\n\nmodule.exports = baseForIn;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseForIn.js\n ** module id = 54\n ** module chunks = 0\n **/","var createBaseFor = require('./createBaseFor');\n\n/**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseFor.js\n ** module id = 55\n ** module chunks = 0\n **/","var toObject = require('./toObject');\n\n/**\n * Creates a base function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var iterable = toObject(object),\n props = keysFunc(object),\n length = props.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n var key = props[index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/createBaseFor.js\n ** module id = 56\n ** module chunks = 0\n **/","var isObject = require('../lang/isObject');\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/toObject.js\n ** module id = 57\n ** module chunks = 0\n **/","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('../internal/isIndex'),\n isLength = require('../internal/isLength'),\n isObject = require('../lang/isObject');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n if (object == null) {\n return [];\n }\n if (!isObject(object)) {\n object = Object(object);\n }\n var length = object.length;\n length = (length && isLength(length) &&\n (isArray(object) || isArguments(object)) && length) || 0;\n\n var Ctor = object.constructor,\n index = -1,\n isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n result = Array(length),\n skipIndexes = length > 0;\n\n while (++index < length) {\n result[index] = (index + '');\n }\n for (var key in object) {\n if (!(skipIndexes && isIndex(key, length)) &&\n !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keysIn;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/keysIn.js\n ** module id = 58\n ** module chunks = 0\n **/","/** Used to detect unsigned integer values. */\nvar reIsUint = /^\\d+$/;\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\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 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\nmodule.exports = isIndex;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isIndex.js\n ** module id = 59\n ** module chunks = 0\n **/","var isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nfunction isTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n}\n\nmodule.exports = isTypedArray;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isTypedArray.js\n ** module id = 60\n ** module chunks = 0\n **/","var baseCopy = require('../internal/baseCopy'),\n keysIn = require('../object/keysIn');\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable\n * properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return baseCopy(value, keysIn(value));\n}\n\nmodule.exports = toPlainObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/toPlainObject.js\n ** module id = 61\n ** module chunks = 0\n **/","/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction baseCopy(source, props, object) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n object[key] = source[key];\n }\n return object;\n}\n\nmodule.exports = baseCopy;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseCopy.js\n ** module id = 62\n ** module chunks = 0\n **/","var getNative = require('../internal/getNative'),\n isArrayLike = require('../internal/isArrayLike'),\n isObject = require('../lang/isObject'),\n shimKeys = require('../internal/shimKeys');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = getNative(Object, 'keys');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nvar keys = !nativeKeys ? shimKeys : function(object) {\n var Ctor = object == null ? undefined : object.constructor;\n if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n (typeof object != 'function' && isArrayLike(object))) {\n return shimKeys(object);\n }\n return isObject(object) ? nativeKeys(object) : [];\n};\n\nmodule.exports = keys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/keys.js\n ** module id = 63\n ** module chunks = 0\n **/","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('./isIndex'),\n isLength = require('./isLength'),\n keysIn = require('../object/keysIn');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction shimKeys(object) {\n var props = keysIn(object),\n propsLength = props.length,\n length = propsLength && object.length;\n\n var allowIndexes = !!length && isLength(length) &&\n (isArray(object) || isArguments(object));\n\n var index = -1,\n result = [];\n\n while (++index < propsLength) {\n var key = props[index];\n if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = shimKeys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/shimKeys.js\n ** module id = 64\n ** module chunks = 0\n **/","var bindCallback = require('./bindCallback'),\n isIterateeCall = require('./isIterateeCall'),\n restParam = require('../function/restParam');\n\n/**\n * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return restParam(function(object, sources) {\n var index = -1,\n length = object == null ? 0 : sources.length,\n customizer = length > 2 ? sources[length - 2] : undefined,\n guard = length > 2 ? sources[2] : undefined,\n thisArg = length > 1 ? sources[length - 1] : undefined;\n\n if (typeof customizer == 'function') {\n customizer = bindCallback(customizer, thisArg, 5);\n length -= 2;\n } else {\n customizer = typeof thisArg == 'function' ? thisArg : undefined;\n length -= (customizer ? 1 : 0);\n }\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/createAssigner.js\n ** module id = 65\n ** module chunks = 0\n **/","var identity = require('../utility/identity');\n\n/**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction bindCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n if (thisArg === undefined) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n case 5: return function(value, other, key, object, source) {\n return func.call(thisArg, value, other, key, object, source);\n };\n }\n return function() {\n return func.apply(thisArg, arguments);\n };\n}\n\nmodule.exports = bindCallback;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/bindCallback.js\n ** module id = 66\n ** module chunks = 0\n **/","/**\n * This method returns the first argument provided to it.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'user': 'fred' };\n *\n * _.identity(object) === object;\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/utility/identity.js\n ** module id = 67\n ** module chunks = 0\n **/","var isArrayLike = require('./isArrayLike'),\n isIndex = require('./isIndex'),\n isObject = require('../lang/isObject');\n\n/**\n * Checks if the provided 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, 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 var other = object[index];\n return value === value ? (value === other) : (other !== other);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isIterateeCall.js\n ** module id = 68\n ** module chunks = 0\n **/","/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction restParam(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n rest = Array(length);\n\n while (++index < length) {\n rest[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, args[0], rest);\n case 2: return func.call(this, args[0], args[1], rest);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = rest;\n return func.apply(this, otherArgs);\n };\n}\n\nmodule.exports = restParam;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/function/restParam.js\n ** module id = 69\n ** module chunks = 0\n **/","import CVUtils from './cv_utils';\n\nvar FrameGrabber = {};\n\nFrameGrabber.create = function(inputStream, canvas) {\n var _that = {},\n _streamConfig = inputStream.getConfig(),\n _video_size = CVUtils.imageRef(inputStream.getRealWidth(), inputStream.getRealHeight()),\n _canvasSize = inputStream.getCanvasSize(),\n _size = CVUtils.imageRef(inputStream.getWidth(), inputStream.getHeight()),\n topRight = inputStream.getTopRight(),\n _sx = topRight.x,\n _sy = topRight.y,\n _canvas,\n _ctx = null,\n _data = null;\n\n _canvas = canvas ? canvas : document.createElement(\"canvas\");\n _canvas.width = _canvasSize.x;\n _canvas.height = _canvasSize.y;\n _ctx = _canvas.getContext(\"2d\");\n _data = new Uint8Array(_size.x * _size.y);\n console.log(\"FrameGrabber\", JSON.stringify({\n size: _size,\n topRight: topRight,\n videoSize: _video_size,\n canvasSize: _canvasSize\n }));\n\n /**\n * Uses the given array as frame-buffer\n */\n _that.attachData = function(data) {\n _data = data;\n };\n\n /**\n * Returns the used frame-buffer\n */\n _that.getData = function() {\n return _data;\n };\n\n /**\n * Fetches a frame from the input-stream and puts into the frame-buffer.\n * The image-data is converted to gray-scale and then half-sampled if configured.\n */\n _that.grab = function() {\n var doHalfSample = _streamConfig.halfSample,\n frame = inputStream.getFrame(),\n ctxData;\n if (frame) {\n _ctx.drawImage(frame, 0, 0, _canvasSize.x, _canvasSize.y);\n ctxData = _ctx.getImageData(_sx, _sy, _size.x, _size.y).data;\n if(doHalfSample){\n CVUtils.grayAndHalfSampleFromCanvasData(ctxData, _size, _data);\n } else {\n CVUtils.computeGray(ctxData, _data, _streamConfig);\n }\n return true;\n } else {\n return false;\n }\n };\n\n _that.getSize = function() {\n return _size;\n };\n\n return _that;\n};\n\nexport default FrameGrabber;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/frame_grabber.js\n **/","export default {\n inputStream: {\n name: \"Live\",\n type: \"LiveStream\",\n constraints: {\n width: 640,\n height: 480,\n minAspectRatio: 0,\n maxAspectRatio: 100,\n facing: \"environment\" // or user\n },\n area: {\n top: \"0%\",\n right: \"0%\",\n left: \"0%\",\n bottom: \"0%\"\n },\n singleChannel: false // true: only the red color-channel is read\n },\n tracking: false,\n debug: false,\n controls: false,\n locate: true,\n numOfWorkers: 4,\n visual: {\n show: true\n },\n decoder: {\n drawBoundingBox: false,\n showFrequency: false,\n drawScanline: false,\n showPattern: false,\n readers: [\n 'code_128_reader'\n ]\n },\n locator: {\n halfSample: true,\n patchSize: \"medium\", // x-small, small, medium, large, x-large\n showCanvas: false,\n showPatches: false,\n showFoundPatches: false,\n showSkeleton: false,\n showLabels: false,\n showPatchLabels: false,\n showRemainingPatchLabels: false,\n boxFromPatches: {\n showTransformed: false,\n showTransformedBox: false,\n showBB: false\n }\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/config.js\n **/","export default function() {\n var events = {};\n\n function getEvent(eventName) {\n if (!events[eventName]) {\n events[eventName] = {\n subscribers : []\n };\n }\n return events[eventName];\n }\n\n function clearEvents(){\n events = {};\n }\n\n function publishSubscription(subscription, data) {\n if (subscription.async) {\n setTimeout(function() {\n subscription.callback(data);\n }, 4);\n } else {\n subscription.callback(data);\n }\n }\n\n function subscribe(event, callback, async) {\n var subscription;\n\n if ( typeof callback === \"function\") {\n subscription = {\n callback : callback,\n async : async\n };\n } else {\n subscription = callback;\n if (!subscription.callback) {\n throw \"Callback was not specified on options\";\n }\n }\n\n getEvent(event).subscribers.push(subscription);\n }\n\n return {\n subscribe : function(event, callback, async) {\n return subscribe(event, callback, async);\n },\n publish : function(eventName, data) {\n var event = getEvent(eventName),\n subscribers = event.subscribers;\n\n event.subscribers = subscribers.filter(function(subscriber) {\n publishSubscription(subscriber, data);\n return !subscriber.once;\n });\n },\n once: function(event, callback, async) {\n subscribe(event, {\n callback: callback,\n async: async,\n once: true\n });\n },\n unsubscribe: function(eventName, callback) {\n var event;\n\n if (eventName) {\n event = getEvent(eventName);\n if (event && callback) {\n event.subscribers = event.subscribers.filter(function(subscriber){\n return subscriber.callback !== callback;\n });\n } else {\n event.subscribers = [];\n }\n } else {\n clearEvents();\n }\n }\n };\n}();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/events.js\n **/","const merge = require('lodash/object/merge');\n\nvar streamRef,\n loadedDataHandler;\n\n/**\n * Wraps browser-specific getUserMedia\n * @param {Object} constraints\n * @param {Object} success Callback\n * @param {Object} failure Callback\n */\nfunction getUserMedia(constraints, success, failure) {\n if (typeof navigator.getUserMedia !== 'undefined') {\n navigator.getUserMedia(constraints, function (stream) {\n streamRef = stream;\n var videoSrc = (window.URL && window.URL.createObjectURL(stream)) || stream;\n success.apply(null, [videoSrc]);\n }, failure);\n } else {\n failure(new TypeError(\"getUserMedia not available\"));\n }\n}\n\nfunction loadedData(video, callback) {\n var attempts = 10;\n\n function checkVideo() {\n if (attempts > 0) {\n if (video.videoWidth > 0 && video.videoHeight > 0) {\n console.log(video.videoWidth + \"px x \" + video.videoHeight + \"px\");\n callback();\n } else {\n window.setTimeout(checkVideo, 500);\n }\n } else {\n callback('Unable to play video stream. Is webcam working?');\n }\n attempts--;\n }\n checkVideo();\n}\n\n/**\n * Tries to attach the camera-stream to a given video-element\n * and calls the callback function when the content is ready\n * @param {Object} constraints\n * @param {Object} video\n * @param {Object} callback\n */\nfunction initCamera(constraints, video, callback) {\n getUserMedia(constraints, function(src) {\n video.src = src;\n if (loadedDataHandler) {\n video.removeEventListener(\"loadeddata\", loadedDataHandler, false);\n }\n loadedDataHandler = loadedData.bind(null, video, callback);\n video.addEventListener('loadeddata', loadedDataHandler, false);\n video.play();\n }, function(e) {\n callback(e);\n });\n}\n\n/**\n * Normalizes the incoming constraints to satisfy the current browser\n * @param config\n * @param cb Callback which is called whenever constraints are created\n * @returns {*}\n */\nfunction normalizeConstraints(config, cb) {\n var constraints = {\n audio: false,\n video: true\n },\n videoConstraints = merge({\n width: 640,\n height: 480,\n minAspectRatio: 0,\n maxAspectRatio: 100,\n facing: \"environment\"\n }, config);\n\n if ( typeof MediaStreamTrack !== 'undefined' && typeof MediaStreamTrack.getSources !== 'undefined') {\n MediaStreamTrack.getSources(function(sourceInfos) {\n var videoSourceId;\n for (var i = 0; i != sourceInfos.length; ++i) {\n var sourceInfo = sourceInfos[i];\n if (sourceInfo.kind == \"video\" && sourceInfo.facing == videoConstraints.facing) {\n videoSourceId = sourceInfo.id;\n }\n }\n constraints.video = {\n mandatory: {\n minWidth: videoConstraints.width,\n minHeight: videoConstraints.height,\n minAspectRatio: videoConstraints.minAspectRatio,\n maxAspectRatio: videoConstraints.maxAspectRatio\n },\n optional: [{\n sourceId: videoSourceId\n }]\n };\n return cb(constraints);\n });\n } else {\n constraints.video = {\n mediaSource: \"camera\",\n width: { min: videoConstraints.width, max: videoConstraints.width },\n height: { min: videoConstraints.height, max: videoConstraints.height },\n require: [\"width\", \"height\"]\n };\n return cb(constraints);\n }\n}\n\n/**\n * Requests the back-facing camera of the user. The callback is called\n * whenever the stream is ready to be consumed, or if an error occures.\n * @param {Object} video\n * @param {Object} callback\n */\nfunction request(video, videoConstraints, callback) {\n normalizeConstraints(videoConstraints, function(constraints) {\n initCamera(constraints, video, callback);\n });\n}\n\nexport default {\n request : function(video, constraints, callback) {\n request(video, constraints, callback);\n },\n release : function() {\n var tracks = streamRef && streamRef.getVideoTracks();\n if (tracks.length) {\n tracks[0].stop();\n }\n streamRef = null;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/camera_access.js\n **/","import ImageDebug from './image_debug';\n\nfunction contains(codeResult, list) {\n if (list) {\n return list.some(function (item) {\n return Object.keys(item).every(function (key) {\n return item[key] === codeResult[key];\n });\n });\n }\n return false;\n}\n\nfunction passesFilter(codeResult, filter) {\n if (typeof filter === 'function') {\n return filter(codeResult);\n }\n return true;\n}\n\nexport default {\n create: function(config) {\n var canvas = document.createElement(\"canvas\"),\n ctx = canvas.getContext(\"2d\"),\n results = [],\n capacity = config.capacity || 20,\n capture = config.capture === true;\n\n function matchesConstraints(codeResult) {\n return capacity && codeResult && !contains(codeResult, config.blacklist) && passesFilter(codeResult, config.filter);\n }\n\n return {\n addResult: function(data, imageSize, codeResult) {\n var result = {};\n\n if (matchesConstraints(codeResult)) {\n capacity--;\n result.codeResult = codeResult;\n if (capture) {\n canvas.width = imageSize.x;\n canvas.height = imageSize.y;\n ImageDebug.drawImage(data, imageSize, ctx);\n result.frame = canvas.toDataURL();\n }\n results.push(result);\n }\n },\n getResults: function() {\n return results;\n }\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/result_collector.js\n **/"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/quagga.min.js b/dist/quagga.min.js
index 75431ff6..4b4e446e 100644
--- a/dist/quagga.min.js
+++ b/dist/quagga.min.js
@@ -1,10 +1,7 @@
-/*! quagga 2015-09-15 */
-!function(a,b){var c=b.toString();"undefined"!=typeof module?module.exports=b(c):a.Quagga=b(c)}(this,function(a){/**
- * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/almond for details
- */
-var b,c,d;return function(a){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.concat(a),k=0;k\n\t * [a, c, tx,\n\t * b, d, ty]\n\t *
\n\t * This is a short form for the 3x3 matrix:\n\t * \n\t * [a, c, tx,\n\t * b, d, ty,\n\t * 0, 0, 1]\n\t *
\n\t * The last row is ignored so the array is shorter and operations are faster.\n\t */\n\tvar mat2d = {};\n\t\n\t/**\n\t * Creates a new identity mat2d\n\t *\n\t * @returns {mat2d} a new 2x3 matrix\n\t */\n\tmat2d.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(6);\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new mat2d initialized with values from an existing matrix\n\t *\n\t * @param {mat2d} a matrix to clone\n\t * @returns {mat2d} a new 2x3 matrix\n\t */\n\tmat2d.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(6);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one mat2d to another\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the source matrix\n\t * @returns {mat2d} out\n\t */\n\tmat2d.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set a mat2d to the identity matrix\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @returns {mat2d} out\n\t */\n\tmat2d.identity = function(out) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Inverts a mat2d\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the source matrix\n\t * @returns {mat2d} out\n\t */\n\tmat2d.invert = function(out, a) {\n\t var aa = a[0], ab = a[1], ac = a[2], ad = a[3],\n\t atx = a[4], aty = a[5];\n\t\n\t var det = aa * ad - ab * ac;\n\t if(!det){\n\t return null;\n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = ad * det;\n\t out[1] = -ab * det;\n\t out[2] = -ac * det;\n\t out[3] = aa * det;\n\t out[4] = (ac * aty - ad * atx) * det;\n\t out[5] = (ab * atx - aa * aty) * det;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the determinant of a mat2d\n\t *\n\t * @param {mat2d} a the source matrix\n\t * @returns {Number} determinant of a\n\t */\n\tmat2d.determinant = function (a) {\n\t return a[0] * a[3] - a[1] * a[2];\n\t};\n\t\n\t/**\n\t * Multiplies two mat2d's\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the first operand\n\t * @param {mat2d} b the second operand\n\t * @returns {mat2d} out\n\t */\n\tmat2d.multiply = function (out, a, b) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];\n\t out[0] = a0 * b0 + a2 * b1;\n\t out[1] = a1 * b0 + a3 * b1;\n\t out[2] = a0 * b2 + a2 * b3;\n\t out[3] = a1 * b2 + a3 * b3;\n\t out[4] = a0 * b4 + a2 * b5 + a4;\n\t out[5] = a1 * b4 + a3 * b5 + a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link mat2d.multiply}\n\t * @function\n\t */\n\tmat2d.mul = mat2d.multiply;\n\t\n\t/**\n\t * Rotates a mat2d by the given angle\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat2d} out\n\t */\n\tmat2d.rotate = function (out, a, rad) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t out[0] = a0 * c + a2 * s;\n\t out[1] = a1 * c + a3 * s;\n\t out[2] = a0 * -s + a2 * c;\n\t out[3] = a1 * -s + a3 * c;\n\t out[4] = a4;\n\t out[5] = a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales the mat2d by the dimensions in the given vec2\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the matrix to translate\n\t * @param {vec2} v the vec2 to scale the matrix by\n\t * @returns {mat2d} out\n\t **/\n\tmat2d.scale = function(out, a, v) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t v0 = v[0], v1 = v[1];\n\t out[0] = a0 * v0;\n\t out[1] = a1 * v0;\n\t out[2] = a2 * v1;\n\t out[3] = a3 * v1;\n\t out[4] = a4;\n\t out[5] = a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Translates the mat2d by the dimensions in the given vec2\n\t *\n\t * @param {mat2d} out the receiving matrix\n\t * @param {mat2d} a the matrix to translate\n\t * @param {vec2} v the vec2 to translate the matrix by\n\t * @returns {mat2d} out\n\t **/\n\tmat2d.translate = function(out, a, v) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n\t v0 = v[0], v1 = v[1];\n\t out[0] = a0;\n\t out[1] = a1;\n\t out[2] = a2;\n\t out[3] = a3;\n\t out[4] = a0 * v0 + a2 * v1 + a4;\n\t out[5] = a1 * v0 + a3 * v1 + a5;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a given angle\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat2d.identity(dest);\n\t * mat2d.rotate(dest, dest, rad);\n\t *\n\t * @param {mat2d} out mat2d receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat2d} out\n\t */\n\tmat2d.fromRotation = function(out, rad) {\n\t var s = Math.sin(rad), c = Math.cos(rad);\n\t out[0] = c;\n\t out[1] = s;\n\t out[2] = -s;\n\t out[3] = c;\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector scaling\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat2d.identity(dest);\n\t * mat2d.scale(dest, dest, vec);\n\t *\n\t * @param {mat2d} out mat2d receiving operation result\n\t * @param {vec2} v Scaling vector\n\t * @returns {mat2d} out\n\t */\n\tmat2d.fromScaling = function(out, v) {\n\t out[0] = v[0];\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = v[1];\n\t out[4] = 0;\n\t out[5] = 0;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat2d.identity(dest);\n\t * mat2d.translate(dest, dest, vec);\n\t *\n\t * @param {mat2d} out mat2d receiving operation result\n\t * @param {vec2} v Translation vector\n\t * @returns {mat2d} out\n\t */\n\tmat2d.fromTranslation = function(out, v) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t out[4] = v[0];\n\t out[5] = v[1];\n\t return out;\n\t}\n\t\n\t/**\n\t * Returns a string representation of a mat2d\n\t *\n\t * @param {mat2d} a matrix to represent as a string\n\t * @returns {String} string representation of the matrix\n\t */\n\tmat2d.str = function (a) {\n\t return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n\t a[3] + ', ' + a[4] + ', ' + a[5] + ')';\n\t};\n\t\n\t/**\n\t * Returns Frobenius norm of a mat2d\n\t *\n\t * @param {mat2d} a the matrix to calculate Frobenius norm of\n\t * @returns {Number} Frobenius norm\n\t */\n\tmat2d.frob = function (a) { \n\t return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))\n\t}; \n\t\n\tmodule.exports = mat2d;\n\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 3x3 Matrix\n\t * @name mat3\n\t */\n\tvar mat3 = {};\n\t\n\t/**\n\t * Creates a new identity mat3\n\t *\n\t * @returns {mat3} a new 3x3 matrix\n\t */\n\tmat3.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(9);\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 1;\n\t out[5] = 0;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copies the upper-left 3x3 values into the given mat3.\n\t *\n\t * @param {mat3} out the receiving 3x3 matrix\n\t * @param {mat4} a the source 4x4 matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.fromMat4 = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[4];\n\t out[4] = a[5];\n\t out[5] = a[6];\n\t out[6] = a[8];\n\t out[7] = a[9];\n\t out[8] = a[10];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new mat3 initialized with values from an existing matrix\n\t *\n\t * @param {mat3} a matrix to clone\n\t * @returns {mat3} a new 3x3 matrix\n\t */\n\tmat3.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(9);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one mat3 to another\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set a mat3 to the identity matrix\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.identity = function(out) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 1;\n\t out[5] = 0;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transpose the values of a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.transpose = function(out, a) {\n\t // If we are transposing ourselves we can skip a few steps but have to cache some values\n\t if (out === a) {\n\t var a01 = a[1], a02 = a[2], a12 = a[5];\n\t out[1] = a[3];\n\t out[2] = a[6];\n\t out[3] = a01;\n\t out[5] = a[7];\n\t out[6] = a02;\n\t out[7] = a12;\n\t } else {\n\t out[0] = a[0];\n\t out[1] = a[3];\n\t out[2] = a[6];\n\t out[3] = a[1];\n\t out[4] = a[4];\n\t out[5] = a[7];\n\t out[6] = a[2];\n\t out[7] = a[5];\n\t out[8] = a[8];\n\t }\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Inverts a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.invert = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t\n\t b01 = a22 * a11 - a12 * a21,\n\t b11 = -a22 * a10 + a12 * a20,\n\t b21 = a21 * a10 - a11 * a20,\n\t\n\t // Calculate the determinant\n\t det = a00 * b01 + a01 * b11 + a02 * b21;\n\t\n\t if (!det) { \n\t return null; \n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = b01 * det;\n\t out[1] = (-a22 * a01 + a02 * a21) * det;\n\t out[2] = (a12 * a01 - a02 * a11) * det;\n\t out[3] = b11 * det;\n\t out[4] = (a22 * a00 - a02 * a20) * det;\n\t out[5] = (-a12 * a00 + a02 * a10) * det;\n\t out[6] = b21 * det;\n\t out[7] = (-a21 * a00 + a01 * a20) * det;\n\t out[8] = (a11 * a00 - a01 * a10) * det;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the adjugate of a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the source matrix\n\t * @returns {mat3} out\n\t */\n\tmat3.adjoint = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8];\n\t\n\t out[0] = (a11 * a22 - a12 * a21);\n\t out[1] = (a02 * a21 - a01 * a22);\n\t out[2] = (a01 * a12 - a02 * a11);\n\t out[3] = (a12 * a20 - a10 * a22);\n\t out[4] = (a00 * a22 - a02 * a20);\n\t out[5] = (a02 * a10 - a00 * a12);\n\t out[6] = (a10 * a21 - a11 * a20);\n\t out[7] = (a01 * a20 - a00 * a21);\n\t out[8] = (a00 * a11 - a01 * a10);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the determinant of a mat3\n\t *\n\t * @param {mat3} a the source matrix\n\t * @returns {Number} determinant of a\n\t */\n\tmat3.determinant = function (a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8];\n\t\n\t return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n\t};\n\t\n\t/**\n\t * Multiplies two mat3's\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the first operand\n\t * @param {mat3} b the second operand\n\t * @returns {mat3} out\n\t */\n\tmat3.multiply = function (out, a, b) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t\n\t b00 = b[0], b01 = b[1], b02 = b[2],\n\t b10 = b[3], b11 = b[4], b12 = b[5],\n\t b20 = b[6], b21 = b[7], b22 = b[8];\n\t\n\t out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n\t out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n\t out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n\t\n\t out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n\t out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n\t out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n\t\n\t out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n\t out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n\t out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link mat3.multiply}\n\t * @function\n\t */\n\tmat3.mul = mat3.multiply;\n\t\n\t/**\n\t * Translate a mat3 by the given vector\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the matrix to translate\n\t * @param {vec2} v vector to translate by\n\t * @returns {mat3} out\n\t */\n\tmat3.translate = function(out, a, v) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t x = v[0], y = v[1];\n\t\n\t out[0] = a00;\n\t out[1] = a01;\n\t out[2] = a02;\n\t\n\t out[3] = a10;\n\t out[4] = a11;\n\t out[5] = a12;\n\t\n\t out[6] = x * a00 + y * a10 + a20;\n\t out[7] = x * a01 + y * a11 + a21;\n\t out[8] = x * a02 + y * a12 + a22;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a mat3 by the given angle\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat3} out\n\t */\n\tmat3.rotate = function (out, a, rad) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2],\n\t a10 = a[3], a11 = a[4], a12 = a[5],\n\t a20 = a[6], a21 = a[7], a22 = a[8],\n\t\n\t s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t\n\t out[0] = c * a00 + s * a10;\n\t out[1] = c * a01 + s * a11;\n\t out[2] = c * a02 + s * a12;\n\t\n\t out[3] = c * a10 - s * a00;\n\t out[4] = c * a11 - s * a01;\n\t out[5] = c * a12 - s * a02;\n\t\n\t out[6] = a20;\n\t out[7] = a21;\n\t out[8] = a22;\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales the mat3 by the dimensions in the given vec2\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat3} a the matrix to rotate\n\t * @param {vec2} v the vec2 to scale the matrix by\n\t * @returns {mat3} out\n\t **/\n\tmat3.scale = function(out, a, v) {\n\t var x = v[0], y = v[1];\n\t\n\t out[0] = x * a[0];\n\t out[1] = x * a[1];\n\t out[2] = x * a[2];\n\t\n\t out[3] = y * a[3];\n\t out[4] = y * a[4];\n\t out[5] = y * a[5];\n\t\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat3.identity(dest);\n\t * mat3.translate(dest, dest, vec);\n\t *\n\t * @param {mat3} out mat3 receiving operation result\n\t * @param {vec2} v Translation vector\n\t * @returns {mat3} out\n\t */\n\tmat3.fromTranslation = function(out, v) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 1;\n\t out[5] = 0;\n\t out[6] = v[0];\n\t out[7] = v[1];\n\t out[8] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a given angle\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat3.identity(dest);\n\t * mat3.rotate(dest, dest, rad);\n\t *\n\t * @param {mat3} out mat3 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat3} out\n\t */\n\tmat3.fromRotation = function(out, rad) {\n\t var s = Math.sin(rad), c = Math.cos(rad);\n\t\n\t out[0] = c;\n\t out[1] = s;\n\t out[2] = 0;\n\t\n\t out[3] = -s;\n\t out[4] = c;\n\t out[5] = 0;\n\t\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector scaling\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat3.identity(dest);\n\t * mat3.scale(dest, dest, vec);\n\t *\n\t * @param {mat3} out mat3 receiving operation result\n\t * @param {vec2} v Scaling vector\n\t * @returns {mat3} out\n\t */\n\tmat3.fromScaling = function(out, v) {\n\t out[0] = v[0];\n\t out[1] = 0;\n\t out[2] = 0;\n\t\n\t out[3] = 0;\n\t out[4] = v[1];\n\t out[5] = 0;\n\t\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Copies the values from a mat2d into a mat3\n\t *\n\t * @param {mat3} out the receiving matrix\n\t * @param {mat2d} a the matrix to copy\n\t * @returns {mat3} out\n\t **/\n\tmat3.fromMat2d = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = 0;\n\t\n\t out[3] = a[2];\n\t out[4] = a[3];\n\t out[5] = 0;\n\t\n\t out[6] = a[4];\n\t out[7] = a[5];\n\t out[8] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t* Calculates a 3x3 matrix from the given quaternion\n\t*\n\t* @param {mat3} out mat3 receiving operation result\n\t* @param {quat} q Quaternion to create matrix from\n\t*\n\t* @returns {mat3} out\n\t*/\n\tmat3.fromQuat = function (out, q) {\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t yx = y * x2,\n\t yy = y * y2,\n\t zx = z * x2,\n\t zy = z * y2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2;\n\t\n\t out[0] = 1 - yy - zz;\n\t out[3] = yx - wz;\n\t out[6] = zx + wy;\n\t\n\t out[1] = yx + wz;\n\t out[4] = 1 - xx - zz;\n\t out[7] = zy - wx;\n\t\n\t out[2] = zx - wy;\n\t out[5] = zy + wx;\n\t out[8] = 1 - xx - yy;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n\t*\n\t* @param {mat3} out mat3 receiving operation result\n\t* @param {mat4} a Mat4 to derive the normal matrix from\n\t*\n\t* @returns {mat3} out\n\t*/\n\tmat3.normalFromMat4 = function (out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\n\t b00 = a00 * a11 - a01 * a10,\n\t b01 = a00 * a12 - a02 * a10,\n\t b02 = a00 * a13 - a03 * a10,\n\t b03 = a01 * a12 - a02 * a11,\n\t b04 = a01 * a13 - a03 * a11,\n\t b05 = a02 * a13 - a03 * a12,\n\t b06 = a20 * a31 - a21 * a30,\n\t b07 = a20 * a32 - a22 * a30,\n\t b08 = a20 * a33 - a23 * a30,\n\t b09 = a21 * a32 - a22 * a31,\n\t b10 = a21 * a33 - a23 * a31,\n\t b11 = a22 * a33 - a23 * a32,\n\t\n\t // Calculate the determinant\n\t det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\t\n\t if (!det) { \n\t return null; \n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n\t out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n\t out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\t\n\t out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n\t out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n\t out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\t\n\t out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n\t out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n\t out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns a string representation of a mat3\n\t *\n\t * @param {mat3} mat matrix to represent as a string\n\t * @returns {String} string representation of the matrix\n\t */\n\tmat3.str = function (a) {\n\t return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n\t a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + \n\t a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n\t};\n\t\n\t/**\n\t * Returns Frobenius norm of a mat3\n\t *\n\t * @param {mat3} a the matrix to calculate Frobenius norm of\n\t * @returns {Number} Frobenius norm\n\t */\n\tmat3.frob = function (a) {\n\t return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))\n\t};\n\t\n\t\n\tmodule.exports = mat3;\n\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 4x4 Matrix\n\t * @name mat4\n\t */\n\tvar mat4 = {};\n\t\n\t/**\n\t * Creates a new identity mat4\n\t *\n\t * @returns {mat4} a new 4x4 matrix\n\t */\n\tmat4.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(16);\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new mat4 initialized with values from an existing matrix\n\t *\n\t * @param {mat4} a matrix to clone\n\t * @returns {mat4} a new 4x4 matrix\n\t */\n\tmat4.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(16);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t out[9] = a[9];\n\t out[10] = a[10];\n\t out[11] = a[11];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one mat4 to another\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[8] = a[8];\n\t out[9] = a[9];\n\t out[10] = a[10];\n\t out[11] = a[11];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set a mat4 to the identity matrix\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.identity = function(out) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transpose the values of a mat4\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.transpose = function(out, a) {\n\t // If we are transposing ourselves we can skip a few steps but have to cache some values\n\t if (out === a) {\n\t var a01 = a[1], a02 = a[2], a03 = a[3],\n\t a12 = a[6], a13 = a[7],\n\t a23 = a[11];\n\t\n\t out[1] = a[4];\n\t out[2] = a[8];\n\t out[3] = a[12];\n\t out[4] = a01;\n\t out[6] = a[9];\n\t out[7] = a[13];\n\t out[8] = a02;\n\t out[9] = a12;\n\t out[11] = a[14];\n\t out[12] = a03;\n\t out[13] = a13;\n\t out[14] = a23;\n\t } else {\n\t out[0] = a[0];\n\t out[1] = a[4];\n\t out[2] = a[8];\n\t out[3] = a[12];\n\t out[4] = a[1];\n\t out[5] = a[5];\n\t out[6] = a[9];\n\t out[7] = a[13];\n\t out[8] = a[2];\n\t out[9] = a[6];\n\t out[10] = a[10];\n\t out[11] = a[14];\n\t out[12] = a[3];\n\t out[13] = a[7];\n\t out[14] = a[11];\n\t out[15] = a[15];\n\t }\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Inverts a mat4\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.invert = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\n\t b00 = a00 * a11 - a01 * a10,\n\t b01 = a00 * a12 - a02 * a10,\n\t b02 = a00 * a13 - a03 * a10,\n\t b03 = a01 * a12 - a02 * a11,\n\t b04 = a01 * a13 - a03 * a11,\n\t b05 = a02 * a13 - a03 * a12,\n\t b06 = a20 * a31 - a21 * a30,\n\t b07 = a20 * a32 - a22 * a30,\n\t b08 = a20 * a33 - a23 * a30,\n\t b09 = a21 * a32 - a22 * a31,\n\t b10 = a21 * a33 - a23 * a31,\n\t b11 = a22 * a33 - a23 * a32,\n\t\n\t // Calculate the determinant\n\t det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\t\n\t if (!det) { \n\t return null; \n\t }\n\t det = 1.0 / det;\n\t\n\t out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n\t out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n\t out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n\t out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n\t out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n\t out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n\t out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n\t out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n\t out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\t out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\t out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\t out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n\t out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n\t out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n\t out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n\t out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the adjugate of a mat4\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the source matrix\n\t * @returns {mat4} out\n\t */\n\tmat4.adjoint = function(out, a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\t\n\t out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));\n\t out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n\t out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));\n\t out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n\t out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n\t out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));\n\t out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n\t out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));\n\t out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));\n\t out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n\t out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));\n\t out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n\t out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n\t out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));\n\t out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n\t out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the determinant of a mat4\n\t *\n\t * @param {mat4} a the source matrix\n\t * @returns {Number} determinant of a\n\t */\n\tmat4.determinant = function (a) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\n\t b00 = a00 * a11 - a01 * a10,\n\t b01 = a00 * a12 - a02 * a10,\n\t b02 = a00 * a13 - a03 * a10,\n\t b03 = a01 * a12 - a02 * a11,\n\t b04 = a01 * a13 - a03 * a11,\n\t b05 = a02 * a13 - a03 * a12,\n\t b06 = a20 * a31 - a21 * a30,\n\t b07 = a20 * a32 - a22 * a30,\n\t b08 = a20 * a33 - a23 * a30,\n\t b09 = a21 * a32 - a22 * a31,\n\t b10 = a21 * a33 - a23 * a31,\n\t b11 = a22 * a33 - a23 * a32;\n\t\n\t // Calculate the determinant\n\t return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\t};\n\t\n\t/**\n\t * Multiplies two mat4's\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the first operand\n\t * @param {mat4} b the second operand\n\t * @returns {mat4} out\n\t */\n\tmat4.multiply = function (out, a, b) {\n\t var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\t\n\t // Cache only the current line of the second matrix\n\t var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; \n\t out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t\n\t b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n\t out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t\n\t b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n\t out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t\n\t b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n\t out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n\t out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n\t out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n\t out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link mat4.multiply}\n\t * @function\n\t */\n\tmat4.mul = mat4.multiply;\n\t\n\t/**\n\t * Translate a mat4 by the given vector\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to translate\n\t * @param {vec3} v vector to translate by\n\t * @returns {mat4} out\n\t */\n\tmat4.translate = function (out, a, v) {\n\t var x = v[0], y = v[1], z = v[2],\n\t a00, a01, a02, a03,\n\t a10, a11, a12, a13,\n\t a20, a21, a22, a23;\n\t\n\t if (a === out) {\n\t out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n\t out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n\t out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n\t out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n\t } else {\n\t a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n\t a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n\t a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\t\n\t out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n\t out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n\t out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\t\n\t out[12] = a00 * x + a10 * y + a20 * z + a[12];\n\t out[13] = a01 * x + a11 * y + a21 * z + a[13];\n\t out[14] = a02 * x + a12 * y + a22 * z + a[14];\n\t out[15] = a03 * x + a13 * y + a23 * z + a[15];\n\t }\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales the mat4 by the dimensions in the given vec3\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to scale\n\t * @param {vec3} v the vec3 to scale the matrix by\n\t * @returns {mat4} out\n\t **/\n\tmat4.scale = function(out, a, v) {\n\t var x = v[0], y = v[1], z = v[2];\n\t\n\t out[0] = a[0] * x;\n\t out[1] = a[1] * x;\n\t out[2] = a[2] * x;\n\t out[3] = a[3] * x;\n\t out[4] = a[4] * y;\n\t out[5] = a[5] * y;\n\t out[6] = a[6] * y;\n\t out[7] = a[7] * y;\n\t out[8] = a[8] * z;\n\t out[9] = a[9] * z;\n\t out[10] = a[10] * z;\n\t out[11] = a[11] * z;\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a mat4 by the given angle around the given axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @param {vec3} axis the axis to rotate around\n\t * @returns {mat4} out\n\t */\n\tmat4.rotate = function (out, a, rad, axis) {\n\t var x = axis[0], y = axis[1], z = axis[2],\n\t len = Math.sqrt(x * x + y * y + z * z),\n\t s, c, t,\n\t a00, a01, a02, a03,\n\t a10, a11, a12, a13,\n\t a20, a21, a22, a23,\n\t b00, b01, b02,\n\t b10, b11, b12,\n\t b20, b21, b22;\n\t\n\t if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n\t \n\t len = 1 / len;\n\t x *= len;\n\t y *= len;\n\t z *= len;\n\t\n\t s = Math.sin(rad);\n\t c = Math.cos(rad);\n\t t = 1 - c;\n\t\n\t a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n\t a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n\t a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\t\n\t // Construct the elements of the rotation matrix\n\t b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;\n\t b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;\n\t b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;\n\t\n\t // Perform rotation-specific matrix multiplication\n\t out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n\t out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n\t out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n\t out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n\t out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n\t out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n\t out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n\t out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n\t out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n\t out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n\t out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\t out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged last row\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a matrix by the given angle around the X axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.rotateX = function (out, a, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad),\n\t a10 = a[4],\n\t a11 = a[5],\n\t a12 = a[6],\n\t a13 = a[7],\n\t a20 = a[8],\n\t a21 = a[9],\n\t a22 = a[10],\n\t a23 = a[11];\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged rows\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t\n\t // Perform axis-specific matrix multiplication\n\t out[4] = a10 * c + a20 * s;\n\t out[5] = a11 * c + a21 * s;\n\t out[6] = a12 * c + a22 * s;\n\t out[7] = a13 * c + a23 * s;\n\t out[8] = a20 * c - a10 * s;\n\t out[9] = a21 * c - a11 * s;\n\t out[10] = a22 * c - a12 * s;\n\t out[11] = a23 * c - a13 * s;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a matrix by the given angle around the Y axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.rotateY = function (out, a, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad),\n\t a00 = a[0],\n\t a01 = a[1],\n\t a02 = a[2],\n\t a03 = a[3],\n\t a20 = a[8],\n\t a21 = a[9],\n\t a22 = a[10],\n\t a23 = a[11];\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged rows\n\t out[4] = a[4];\n\t out[5] = a[5];\n\t out[6] = a[6];\n\t out[7] = a[7];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t\n\t // Perform axis-specific matrix multiplication\n\t out[0] = a00 * c - a20 * s;\n\t out[1] = a01 * c - a21 * s;\n\t out[2] = a02 * c - a22 * s;\n\t out[3] = a03 * c - a23 * s;\n\t out[8] = a00 * s + a20 * c;\n\t out[9] = a01 * s + a21 * c;\n\t out[10] = a02 * s + a22 * c;\n\t out[11] = a03 * s + a23 * c;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a matrix by the given angle around the Z axis\n\t *\n\t * @param {mat4} out the receiving matrix\n\t * @param {mat4} a the matrix to rotate\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.rotateZ = function (out, a, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad),\n\t a00 = a[0],\n\t a01 = a[1],\n\t a02 = a[2],\n\t a03 = a[3],\n\t a10 = a[4],\n\t a11 = a[5],\n\t a12 = a[6],\n\t a13 = a[7];\n\t\n\t if (a !== out) { // If the source and destination differ, copy the unchanged last row\n\t out[8] = a[8];\n\t out[9] = a[9];\n\t out[10] = a[10];\n\t out[11] = a[11];\n\t out[12] = a[12];\n\t out[13] = a[13];\n\t out[14] = a[14];\n\t out[15] = a[15];\n\t }\n\t\n\t // Perform axis-specific matrix multiplication\n\t out[0] = a00 * c + a10 * s;\n\t out[1] = a01 * c + a11 * s;\n\t out[2] = a02 * c + a12 * s;\n\t out[3] = a03 * c + a13 * s;\n\t out[4] = a10 * c - a00 * s;\n\t out[5] = a11 * c - a01 * s;\n\t out[6] = a12 * c - a02 * s;\n\t out[7] = a13 * c - a03 * s;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, dest, vec);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {vec3} v Translation vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromTranslation = function(out, v) {\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = v[0];\n\t out[13] = v[1];\n\t out[14] = v[2];\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a vector scaling\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.scale(dest, dest, vec);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {vec3} v Scaling vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromScaling = function(out, v) {\n\t out[0] = v[0];\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = v[1];\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = v[2];\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a given angle around a given axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotate(dest, dest, rad, axis);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @param {vec3} axis the axis to rotate around\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotation = function(out, rad, axis) {\n\t var x = axis[0], y = axis[1], z = axis[2],\n\t len = Math.sqrt(x * x + y * y + z * z),\n\t s, c, t;\n\t \n\t if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n\t \n\t len = 1 / len;\n\t x *= len;\n\t y *= len;\n\t z *= len;\n\t \n\t s = Math.sin(rad);\n\t c = Math.cos(rad);\n\t t = 1 - c;\n\t \n\t // Perform rotation-specific matrix multiplication\n\t out[0] = x * x * t + c;\n\t out[1] = y * x * t + z * s;\n\t out[2] = z * x * t - y * s;\n\t out[3] = 0;\n\t out[4] = x * y * t - z * s;\n\t out[5] = y * y * t + c;\n\t out[6] = z * y * t + x * s;\n\t out[7] = 0;\n\t out[8] = x * z * t + y * s;\n\t out[9] = y * z * t - x * s;\n\t out[10] = z * z * t + c;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from the given angle around the X axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotateX(dest, dest, rad);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.fromXRotation = function(out, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t \n\t // Perform axis-specific matrix multiplication\n\t out[0] = 1;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = c;\n\t out[6] = s;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = -s;\n\t out[10] = c;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from the given angle around the Y axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotateY(dest, dest, rad);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.fromYRotation = function(out, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t \n\t // Perform axis-specific matrix multiplication\n\t out[0] = c;\n\t out[1] = 0;\n\t out[2] = -s;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = 1;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = s;\n\t out[9] = 0;\n\t out[10] = c;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from the given angle around the Z axis\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.rotateZ(dest, dest, rad);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {Number} rad the angle to rotate the matrix by\n\t * @returns {mat4} out\n\t */\n\tmat4.fromZRotation = function(out, rad) {\n\t var s = Math.sin(rad),\n\t c = Math.cos(rad);\n\t \n\t // Perform axis-specific matrix multiplication\n\t out[0] = c;\n\t out[1] = s;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = -s;\n\t out[5] = c;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 1;\n\t out[11] = 0;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t return out;\n\t}\n\t\n\t/**\n\t * Creates a matrix from a quaternion rotation and vector translation\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, vec);\n\t * var quatMat = mat4.create();\n\t * quat4.toMat4(quat, quatMat);\n\t * mat4.multiply(dest, quatMat);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {quat4} q Rotation quaternion\n\t * @param {vec3} v Translation vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotationTranslation = function (out, q, v) {\n\t // Quaternion math\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t xy = x * y2,\n\t xz = x * z2,\n\t yy = y * y2,\n\t yz = y * z2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2;\n\t\n\t out[0] = 1 - (yy + zz);\n\t out[1] = xy + wz;\n\t out[2] = xz - wy;\n\t out[3] = 0;\n\t out[4] = xy - wz;\n\t out[5] = 1 - (xx + zz);\n\t out[6] = yz + wx;\n\t out[7] = 0;\n\t out[8] = xz + wy;\n\t out[9] = yz - wx;\n\t out[10] = 1 - (xx + yy);\n\t out[11] = 0;\n\t out[12] = v[0];\n\t out[13] = v[1];\n\t out[14] = v[2];\n\t out[15] = 1;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a quaternion rotation, vector translation and vector scale\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, vec);\n\t * var quatMat = mat4.create();\n\t * quat4.toMat4(quat, quatMat);\n\t * mat4.multiply(dest, quatMat);\n\t * mat4.scale(dest, scale)\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {quat4} q Rotation quaternion\n\t * @param {vec3} v Translation vector\n\t * @param {vec3} s Scaling vector\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotationTranslationScale = function (out, q, v, s) {\n\t // Quaternion math\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t xy = x * y2,\n\t xz = x * z2,\n\t yy = y * y2,\n\t yz = y * z2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2,\n\t sx = s[0],\n\t sy = s[1],\n\t sz = s[2];\n\t\n\t out[0] = (1 - (yy + zz)) * sx;\n\t out[1] = (xy + wz) * sx;\n\t out[2] = (xz - wy) * sx;\n\t out[3] = 0;\n\t out[4] = (xy - wz) * sy;\n\t out[5] = (1 - (xx + zz)) * sy;\n\t out[6] = (yz + wx) * sy;\n\t out[7] = 0;\n\t out[8] = (xz + wy) * sz;\n\t out[9] = (yz - wx) * sz;\n\t out[10] = (1 - (xx + yy)) * sz;\n\t out[11] = 0;\n\t out[12] = v[0];\n\t out[13] = v[1];\n\t out[14] = v[2];\n\t out[15] = 1;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n\t * This is equivalent to (but much faster than):\n\t *\n\t * mat4.identity(dest);\n\t * mat4.translate(dest, vec);\n\t * mat4.translate(dest, origin);\n\t * var quatMat = mat4.create();\n\t * quat4.toMat4(quat, quatMat);\n\t * mat4.multiply(dest, quatMat);\n\t * mat4.scale(dest, scale)\n\t * mat4.translate(dest, negativeOrigin);\n\t *\n\t * @param {mat4} out mat4 receiving operation result\n\t * @param {quat4} q Rotation quaternion\n\t * @param {vec3} v Translation vector\n\t * @param {vec3} s Scaling vector\n\t * @param {vec3} o The origin vector around which to scale and rotate\n\t * @returns {mat4} out\n\t */\n\tmat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {\n\t // Quaternion math\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t xy = x * y2,\n\t xz = x * z2,\n\t yy = y * y2,\n\t yz = y * z2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2,\n\t \n\t sx = s[0],\n\t sy = s[1],\n\t sz = s[2],\n\t\n\t ox = o[0],\n\t oy = o[1],\n\t oz = o[2];\n\t \n\t out[0] = (1 - (yy + zz)) * sx;\n\t out[1] = (xy + wz) * sx;\n\t out[2] = (xz - wy) * sx;\n\t out[3] = 0;\n\t out[4] = (xy - wz) * sy;\n\t out[5] = (1 - (xx + zz)) * sy;\n\t out[6] = (yz + wx) * sy;\n\t out[7] = 0;\n\t out[8] = (xz + wy) * sz;\n\t out[9] = (yz - wx) * sz;\n\t out[10] = (1 - (xx + yy)) * sz;\n\t out[11] = 0;\n\t out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);\n\t out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);\n\t out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);\n\t out[15] = 1;\n\t \n\t return out;\n\t};\n\t\n\tmat4.fromQuat = function (out, q) {\n\t var x = q[0], y = q[1], z = q[2], w = q[3],\n\t x2 = x + x,\n\t y2 = y + y,\n\t z2 = z + z,\n\t\n\t xx = x * x2,\n\t yx = y * x2,\n\t yy = y * y2,\n\t zx = z * x2,\n\t zy = z * y2,\n\t zz = z * z2,\n\t wx = w * x2,\n\t wy = w * y2,\n\t wz = w * z2;\n\t\n\t out[0] = 1 - yy - zz;\n\t out[1] = yx + wz;\n\t out[2] = zx - wy;\n\t out[3] = 0;\n\t\n\t out[4] = yx - wz;\n\t out[5] = 1 - xx - zz;\n\t out[6] = zy + wx;\n\t out[7] = 0;\n\t\n\t out[8] = zx + wy;\n\t out[9] = zy - wx;\n\t out[10] = 1 - xx - yy;\n\t out[11] = 0;\n\t\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = 0;\n\t out[15] = 1;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a frustum matrix with the given bounds\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {Number} left Left bound of the frustum\n\t * @param {Number} right Right bound of the frustum\n\t * @param {Number} bottom Bottom bound of the frustum\n\t * @param {Number} top Top bound of the frustum\n\t * @param {Number} near Near bound of the frustum\n\t * @param {Number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.frustum = function (out, left, right, bottom, top, near, far) {\n\t var rl = 1 / (right - left),\n\t tb = 1 / (top - bottom),\n\t nf = 1 / (near - far);\n\t out[0] = (near * 2) * rl;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = (near * 2) * tb;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = (right + left) * rl;\n\t out[9] = (top + bottom) * tb;\n\t out[10] = (far + near) * nf;\n\t out[11] = -1;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = (far * near * 2) * nf;\n\t out[15] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a perspective projection matrix with the given bounds\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {number} fovy Vertical field of view in radians\n\t * @param {number} aspect Aspect ratio. typically viewport width/height\n\t * @param {number} near Near bound of the frustum\n\t * @param {number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.perspective = function (out, fovy, aspect, near, far) {\n\t var f = 1.0 / Math.tan(fovy / 2),\n\t nf = 1 / (near - far);\n\t out[0] = f / aspect;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = f;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = (far + near) * nf;\n\t out[11] = -1;\n\t out[12] = 0;\n\t out[13] = 0;\n\t out[14] = (2 * far * near) * nf;\n\t out[15] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a perspective projection matrix with the given field of view.\n\t * This is primarily useful for generating projection matrices to be used\n\t * with the still experiemental WebVR API.\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n\t * @param {number} near Near bound of the frustum\n\t * @param {number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.perspectiveFromFieldOfView = function (out, fov, near, far) {\n\t var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),\n\t downTan = Math.tan(fov.downDegrees * Math.PI/180.0),\n\t leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),\n\t rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),\n\t xScale = 2.0 / (leftTan + rightTan),\n\t yScale = 2.0 / (upTan + downTan);\n\t\n\t out[0] = xScale;\n\t out[1] = 0.0;\n\t out[2] = 0.0;\n\t out[3] = 0.0;\n\t out[4] = 0.0;\n\t out[5] = yScale;\n\t out[6] = 0.0;\n\t out[7] = 0.0;\n\t out[8] = -((leftTan - rightTan) * xScale * 0.5);\n\t out[9] = ((upTan - downTan) * yScale * 0.5);\n\t out[10] = far / (near - far);\n\t out[11] = -1.0;\n\t out[12] = 0.0;\n\t out[13] = 0.0;\n\t out[14] = (far * near) / (near - far);\n\t out[15] = 0.0;\n\t return out;\n\t}\n\t\n\t/**\n\t * Generates a orthogonal projection matrix with the given bounds\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {number} left Left bound of the frustum\n\t * @param {number} right Right bound of the frustum\n\t * @param {number} bottom Bottom bound of the frustum\n\t * @param {number} top Top bound of the frustum\n\t * @param {number} near Near bound of the frustum\n\t * @param {number} far Far bound of the frustum\n\t * @returns {mat4} out\n\t */\n\tmat4.ortho = function (out, left, right, bottom, top, near, far) {\n\t var lr = 1 / (left - right),\n\t bt = 1 / (bottom - top),\n\t nf = 1 / (near - far);\n\t out[0] = -2 * lr;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t out[4] = 0;\n\t out[5] = -2 * bt;\n\t out[6] = 0;\n\t out[7] = 0;\n\t out[8] = 0;\n\t out[9] = 0;\n\t out[10] = 2 * nf;\n\t out[11] = 0;\n\t out[12] = (left + right) * lr;\n\t out[13] = (top + bottom) * bt;\n\t out[14] = (far + near) * nf;\n\t out[15] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a look-at matrix with the given eye position, focal point, and up axis\n\t *\n\t * @param {mat4} out mat4 frustum matrix will be written into\n\t * @param {vec3} eye Position of the viewer\n\t * @param {vec3} center Point the viewer is looking at\n\t * @param {vec3} up vec3 pointing up\n\t * @returns {mat4} out\n\t */\n\tmat4.lookAt = function (out, eye, center, up) {\n\t var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,\n\t eyex = eye[0],\n\t eyey = eye[1],\n\t eyez = eye[2],\n\t upx = up[0],\n\t upy = up[1],\n\t upz = up[2],\n\t centerx = center[0],\n\t centery = center[1],\n\t centerz = center[2];\n\t\n\t if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&\n\t Math.abs(eyey - centery) < glMatrix.EPSILON &&\n\t Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n\t return mat4.identity(out);\n\t }\n\t\n\t z0 = eyex - centerx;\n\t z1 = eyey - centery;\n\t z2 = eyez - centerz;\n\t\n\t len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n\t z0 *= len;\n\t z1 *= len;\n\t z2 *= len;\n\t\n\t x0 = upy * z2 - upz * z1;\n\t x1 = upz * z0 - upx * z2;\n\t x2 = upx * z1 - upy * z0;\n\t len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n\t if (!len) {\n\t x0 = 0;\n\t x1 = 0;\n\t x2 = 0;\n\t } else {\n\t len = 1 / len;\n\t x0 *= len;\n\t x1 *= len;\n\t x2 *= len;\n\t }\n\t\n\t y0 = z1 * x2 - z2 * x1;\n\t y1 = z2 * x0 - z0 * x2;\n\t y2 = z0 * x1 - z1 * x0;\n\t\n\t len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n\t if (!len) {\n\t y0 = 0;\n\t y1 = 0;\n\t y2 = 0;\n\t } else {\n\t len = 1 / len;\n\t y0 *= len;\n\t y1 *= len;\n\t y2 *= len;\n\t }\n\t\n\t out[0] = x0;\n\t out[1] = y0;\n\t out[2] = z0;\n\t out[3] = 0;\n\t out[4] = x1;\n\t out[5] = y1;\n\t out[6] = z1;\n\t out[7] = 0;\n\t out[8] = x2;\n\t out[9] = y2;\n\t out[10] = z2;\n\t out[11] = 0;\n\t out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n\t out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n\t out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n\t out[15] = 1;\n\t\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns a string representation of a mat4\n\t *\n\t * @param {mat4} mat matrix to represent as a string\n\t * @returns {String} string representation of the matrix\n\t */\n\tmat4.str = function (a) {\n\t return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +\n\t a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +\n\t a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + \n\t a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n\t};\n\t\n\t/**\n\t * Returns Frobenius norm of a mat4\n\t *\n\t * @param {mat4} a the matrix to calculate Frobenius norm of\n\t * @returns {Number} Frobenius norm\n\t */\n\tmat4.frob = function (a) {\n\t return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))\n\t};\n\t\n\t\n\tmodule.exports = mat4;\n\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\tvar mat3 = __webpack_require__(13);\n\tvar vec3 = __webpack_require__(16);\n\tvar vec4 = __webpack_require__(17);\n\t\n\t/**\n\t * @class Quaternion\n\t * @name quat\n\t */\n\tvar quat = {};\n\t\n\t/**\n\t * Creates a new identity quat\n\t *\n\t * @returns {quat} a new quaternion\n\t */\n\tquat.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Sets a quaternion to represent the shortest rotation from one\n\t * vector to another.\n\t *\n\t * Both vectors are assumed to be unit length.\n\t *\n\t * @param {quat} out the receiving quaternion.\n\t * @param {vec3} a the initial vector\n\t * @param {vec3} b the destination vector\n\t * @returns {quat} out\n\t */\n\tquat.rotationTo = (function() {\n\t var tmpvec3 = vec3.create();\n\t var xUnitVec3 = vec3.fromValues(1,0,0);\n\t var yUnitVec3 = vec3.fromValues(0,1,0);\n\t\n\t return function(out, a, b) {\n\t var dot = vec3.dot(a, b);\n\t if (dot < -0.999999) {\n\t vec3.cross(tmpvec3, xUnitVec3, a);\n\t if (vec3.length(tmpvec3) < 0.000001)\n\t vec3.cross(tmpvec3, yUnitVec3, a);\n\t vec3.normalize(tmpvec3, tmpvec3);\n\t quat.setAxisAngle(out, tmpvec3, Math.PI);\n\t return out;\n\t } else if (dot > 0.999999) {\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t return out;\n\t } else {\n\t vec3.cross(tmpvec3, a, b);\n\t out[0] = tmpvec3[0];\n\t out[1] = tmpvec3[1];\n\t out[2] = tmpvec3[2];\n\t out[3] = 1 + dot;\n\t return quat.normalize(out, out);\n\t }\n\t };\n\t})();\n\t\n\t/**\n\t * Sets the specified quaternion with values corresponding to the given\n\t * axes. Each axis is a vec3 and is expected to be unit length and\n\t * perpendicular to all other specified axes.\n\t *\n\t * @param {vec3} view the vector representing the viewing direction\n\t * @param {vec3} right the vector representing the local \"right\" direction\n\t * @param {vec3} up the vector representing the local \"up\" direction\n\t * @returns {quat} out\n\t */\n\tquat.setAxes = (function() {\n\t var matr = mat3.create();\n\t\n\t return function(out, view, right, up) {\n\t matr[0] = right[0];\n\t matr[3] = right[1];\n\t matr[6] = right[2];\n\t\n\t matr[1] = up[0];\n\t matr[4] = up[1];\n\t matr[7] = up[2];\n\t\n\t matr[2] = -view[0];\n\t matr[5] = -view[1];\n\t matr[8] = -view[2];\n\t\n\t return quat.normalize(out, quat.fromMat3(out, matr));\n\t };\n\t})();\n\t\n\t/**\n\t * Creates a new quat initialized with values from an existing quaternion\n\t *\n\t * @param {quat} a quaternion to clone\n\t * @returns {quat} a new quaternion\n\t * @function\n\t */\n\tquat.clone = vec4.clone;\n\t\n\t/**\n\t * Creates a new quat initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {quat} a new quaternion\n\t * @function\n\t */\n\tquat.fromValues = vec4.fromValues;\n\t\n\t/**\n\t * Copy the values from one quat to another\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the source quaternion\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.copy = vec4.copy;\n\t\n\t/**\n\t * Set the components of a quat to the given values\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.set = vec4.set;\n\t\n\t/**\n\t * Set a quat to the identity quaternion\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @returns {quat} out\n\t */\n\tquat.identity = function(out) {\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 1;\n\t return out;\n\t};\n\t\n\t/**\n\t * Sets a quat from the given angle and rotation axis,\n\t * then returns it.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {vec3} axis the axis around which to rotate\n\t * @param {Number} rad the angle in radians\n\t * @returns {quat} out\n\t **/\n\tquat.setAxisAngle = function(out, axis, rad) {\n\t rad = rad * 0.5;\n\t var s = Math.sin(rad);\n\t out[0] = s * axis[0];\n\t out[1] = s * axis[1];\n\t out[2] = s * axis[2];\n\t out[3] = Math.cos(rad);\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two quat's\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.add = vec4.add;\n\t\n\t/**\n\t * Multiplies two quat's\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @returns {quat} out\n\t */\n\tquat.multiply = function(out, a, b) {\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\t\n\t out[0] = ax * bw + aw * bx + ay * bz - az * by;\n\t out[1] = ay * bw + aw * by + az * bx - ax * bz;\n\t out[2] = az * bw + aw * bz + ax * by - ay * bx;\n\t out[3] = aw * bw - ax * bx - ay * by - az * bz;\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link quat.multiply}\n\t * @function\n\t */\n\tquat.mul = quat.multiply;\n\t\n\t/**\n\t * Scales a quat by a scalar number\n\t *\n\t * @param {quat} out the receiving vector\n\t * @param {quat} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.scale = vec4.scale;\n\t\n\t/**\n\t * Rotates a quaternion by the given angle about the X axis\n\t *\n\t * @param {quat} out quat receiving operation result\n\t * @param {quat} a quat to rotate\n\t * @param {number} rad angle (in radians) to rotate\n\t * @returns {quat} out\n\t */\n\tquat.rotateX = function (out, a, rad) {\n\t rad *= 0.5; \n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bx = Math.sin(rad), bw = Math.cos(rad);\n\t\n\t out[0] = ax * bw + aw * bx;\n\t out[1] = ay * bw + az * bx;\n\t out[2] = az * bw - ay * bx;\n\t out[3] = aw * bw - ax * bx;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a quaternion by the given angle about the Y axis\n\t *\n\t * @param {quat} out quat receiving operation result\n\t * @param {quat} a quat to rotate\n\t * @param {number} rad angle (in radians) to rotate\n\t * @returns {quat} out\n\t */\n\tquat.rotateY = function (out, a, rad) {\n\t rad *= 0.5; \n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t by = Math.sin(rad), bw = Math.cos(rad);\n\t\n\t out[0] = ax * bw - az * by;\n\t out[1] = ay * bw + aw * by;\n\t out[2] = az * bw + ax * by;\n\t out[3] = aw * bw - ay * by;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotates a quaternion by the given angle about the Z axis\n\t *\n\t * @param {quat} out quat receiving operation result\n\t * @param {quat} a quat to rotate\n\t * @param {number} rad angle (in radians) to rotate\n\t * @returns {quat} out\n\t */\n\tquat.rotateZ = function (out, a, rad) {\n\t rad *= 0.5; \n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bz = Math.sin(rad), bw = Math.cos(rad);\n\t\n\t out[0] = ax * bw + ay * bz;\n\t out[1] = ay * bw - ax * bz;\n\t out[2] = az * bw + aw * bz;\n\t out[3] = aw * bw - az * bz;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the W component of a quat from the X, Y, and Z components.\n\t * Assumes that quaternion is 1 unit in length.\n\t * Any existing W component will be ignored.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quat to calculate W component of\n\t * @returns {quat} out\n\t */\n\tquat.calculateW = function (out, a) {\n\t var x = a[0], y = a[1], z = a[2];\n\t\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two quat's\n\t *\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @returns {Number} dot product of a and b\n\t * @function\n\t */\n\tquat.dot = vec4.dot;\n\t\n\t/**\n\t * Performs a linear interpolation between two quat's\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.lerp = vec4.lerp;\n\t\n\t/**\n\t * Performs a spherical linear interpolation between two quat\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {quat} out\n\t */\n\tquat.slerp = function (out, a, b, t) {\n\t // benchmarks:\n\t // http://jsperf.com/quaternion-slerp-implementations\n\t\n\t var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n\t bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\t\n\t var omega, cosom, sinom, scale0, scale1;\n\t\n\t // calc cosine\n\t cosom = ax * bx + ay * by + az * bz + aw * bw;\n\t // adjust signs (if necessary)\n\t if ( cosom < 0.0 ) {\n\t cosom = -cosom;\n\t bx = - bx;\n\t by = - by;\n\t bz = - bz;\n\t bw = - bw;\n\t }\n\t // calculate coefficients\n\t if ( (1.0 - cosom) > 0.000001 ) {\n\t // standard case (slerp)\n\t omega = Math.acos(cosom);\n\t sinom = Math.sin(omega);\n\t scale0 = Math.sin((1.0 - t) * omega) / sinom;\n\t scale1 = Math.sin(t * omega) / sinom;\n\t } else { \n\t // \"from\" and \"to\" quaternions are very close \n\t // ... so we can do a linear interpolation\n\t scale0 = 1.0 - t;\n\t scale1 = t;\n\t }\n\t // calculate final values\n\t out[0] = scale0 * ax + scale1 * bx;\n\t out[1] = scale0 * ay + scale1 * by;\n\t out[2] = scale0 * az + scale1 * bz;\n\t out[3] = scale0 * aw + scale1 * bw;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a spherical linear interpolation with two control points\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a the first operand\n\t * @param {quat} b the second operand\n\t * @param {quat} c the third operand\n\t * @param {quat} d the fourth operand\n\t * @param {Number} t interpolation amount\n\t * @returns {quat} out\n\t */\n\tquat.sqlerp = (function () {\n\t var temp1 = quat.create();\n\t var temp2 = quat.create();\n\t \n\t return function (out, a, b, c, d, t) {\n\t quat.slerp(temp1, a, d, t);\n\t quat.slerp(temp2, b, c, t);\n\t quat.slerp(out, temp1, temp2, 2 * t * (1 - t));\n\t \n\t return out;\n\t };\n\t}());\n\t\n\t/**\n\t * Calculates the inverse of a quat\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quat to calculate inverse of\n\t * @returns {quat} out\n\t */\n\tquat.invert = function(out, a) {\n\t var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n\t dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,\n\t invDot = dot ? 1.0/dot : 0;\n\t \n\t // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\t\n\t out[0] = -a0*invDot;\n\t out[1] = -a1*invDot;\n\t out[2] = -a2*invDot;\n\t out[3] = a3*invDot;\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the conjugate of a quat\n\t * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quat to calculate conjugate of\n\t * @returns {quat} out\n\t */\n\tquat.conjugate = function (out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t out[2] = -a[2];\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the length of a quat\n\t *\n\t * @param {quat} a vector to calculate length of\n\t * @returns {Number} length of a\n\t * @function\n\t */\n\tquat.length = vec4.length;\n\t\n\t/**\n\t * Alias for {@link quat.length}\n\t * @function\n\t */\n\tquat.len = quat.length;\n\t\n\t/**\n\t * Calculates the squared length of a quat\n\t *\n\t * @param {quat} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t * @function\n\t */\n\tquat.squaredLength = vec4.squaredLength;\n\t\n\t/**\n\t * Alias for {@link quat.squaredLength}\n\t * @function\n\t */\n\tquat.sqrLen = quat.squaredLength;\n\t\n\t/**\n\t * Normalize a quat\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {quat} a quaternion to normalize\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.normalize = vec4.normalize;\n\t\n\t/**\n\t * Creates a quaternion from the given 3x3 rotation matrix.\n\t *\n\t * NOTE: The resultant quaternion is not normalized, so you should be sure\n\t * to renormalize the quaternion yourself where necessary.\n\t *\n\t * @param {quat} out the receiving quaternion\n\t * @param {mat3} m rotation matrix\n\t * @returns {quat} out\n\t * @function\n\t */\n\tquat.fromMat3 = function(out, m) {\n\t // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n\t // article \"Quaternion Calculus and Fast Animation\".\n\t var fTrace = m[0] + m[4] + m[8];\n\t var fRoot;\n\t\n\t if ( fTrace > 0.0 ) {\n\t // |w| > 1/2, may as well choose w > 1/2\n\t fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\t out[3] = 0.5 * fRoot;\n\t fRoot = 0.5/fRoot; // 1/(4w)\n\t out[0] = (m[5]-m[7])*fRoot;\n\t out[1] = (m[6]-m[2])*fRoot;\n\t out[2] = (m[1]-m[3])*fRoot;\n\t } else {\n\t // |w| <= 1/2\n\t var i = 0;\n\t if ( m[4] > m[0] )\n\t i = 1;\n\t if ( m[8] > m[i*3+i] )\n\t i = 2;\n\t var j = (i+1)%3;\n\t var k = (i+2)%3;\n\t \n\t fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);\n\t out[i] = 0.5 * fRoot;\n\t fRoot = 0.5 / fRoot;\n\t out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;\n\t out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;\n\t out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;\n\t }\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Returns a string representation of a quatenion\n\t *\n\t * @param {quat} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tquat.str = function (a) {\n\t return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n\t};\n\t\n\tmodule.exports = quat;\n\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 3 Dimensional Vector\n\t * @name vec3\n\t */\n\tvar vec3 = {};\n\t\n\t/**\n\t * Creates a new, empty vec3\n\t *\n\t * @returns {vec3} a new 3D vector\n\t */\n\tvec3.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(3);\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec3 initialized with values from an existing vector\n\t *\n\t * @param {vec3} a vector to clone\n\t * @returns {vec3} a new 3D vector\n\t */\n\tvec3.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(3);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec3 initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @returns {vec3} a new 3D vector\n\t */\n\tvec3.fromValues = function(x, y, z) {\n\t var out = new glMatrix.ARRAY_TYPE(3);\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one vec3 to another\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the source vector\n\t * @returns {vec3} out\n\t */\n\tvec3.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set the components of a vec3 to the given values\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @returns {vec3} out\n\t */\n\tvec3.set = function(out, x, y, z) {\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.add = function(out, a, b) {\n\t out[0] = a[0] + b[0];\n\t out[1] = a[1] + b[1];\n\t out[2] = a[2] + b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Subtracts vector b from vector a\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.subtract = function(out, a, b) {\n\t out[0] = a[0] - b[0];\n\t out[1] = a[1] - b[1];\n\t out[2] = a[2] - b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.subtract}\n\t * @function\n\t */\n\tvec3.sub = vec3.subtract;\n\t\n\t/**\n\t * Multiplies two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.multiply = function(out, a, b) {\n\t out[0] = a[0] * b[0];\n\t out[1] = a[1] * b[1];\n\t out[2] = a[2] * b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.multiply}\n\t * @function\n\t */\n\tvec3.mul = vec3.multiply;\n\t\n\t/**\n\t * Divides two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.divide = function(out, a, b) {\n\t out[0] = a[0] / b[0];\n\t out[1] = a[1] / b[1];\n\t out[2] = a[2] / b[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.divide}\n\t * @function\n\t */\n\tvec3.div = vec3.divide;\n\t\n\t/**\n\t * Returns the minimum of two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.min = function(out, a, b) {\n\t out[0] = Math.min(a[0], b[0]);\n\t out[1] = Math.min(a[1], b[1]);\n\t out[2] = Math.min(a[2], b[2]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the maximum of two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.max = function(out, a, b) {\n\t out[0] = Math.max(a[0], b[0]);\n\t out[1] = Math.max(a[1], b[1]);\n\t out[2] = Math.max(a[2], b[2]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales a vec3 by a scalar number\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {vec3} out\n\t */\n\tvec3.scale = function(out, a, b) {\n\t out[0] = a[0] * b;\n\t out[1] = a[1] * b;\n\t out[2] = a[2] * b;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec3's after scaling the second operand by a scalar value\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {Number} scale the amount to scale b by before adding\n\t * @returns {vec3} out\n\t */\n\tvec3.scaleAndAdd = function(out, a, b, scale) {\n\t out[0] = a[0] + (b[0] * scale);\n\t out[1] = a[1] + (b[1] * scale);\n\t out[2] = a[2] + (b[2] * scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the euclidian distance between two vec3's\n\t *\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {Number} distance between a and b\n\t */\n\tvec3.distance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2];\n\t return Math.sqrt(x*x + y*y + z*z);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.distance}\n\t * @function\n\t */\n\tvec3.dist = vec3.distance;\n\t\n\t/**\n\t * Calculates the squared euclidian distance between two vec3's\n\t *\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {Number} squared distance between a and b\n\t */\n\tvec3.squaredDistance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2];\n\t return x*x + y*y + z*z;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.squaredDistance}\n\t * @function\n\t */\n\tvec3.sqrDist = vec3.squaredDistance;\n\t\n\t/**\n\t * Calculates the length of a vec3\n\t *\n\t * @param {vec3} a vector to calculate length of\n\t * @returns {Number} length of a\n\t */\n\tvec3.length = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2];\n\t return Math.sqrt(x*x + y*y + z*z);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.length}\n\t * @function\n\t */\n\tvec3.len = vec3.length;\n\t\n\t/**\n\t * Calculates the squared length of a vec3\n\t *\n\t * @param {vec3} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t */\n\tvec3.squaredLength = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2];\n\t return x*x + y*y + z*z;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec3.squaredLength}\n\t * @function\n\t */\n\tvec3.sqrLen = vec3.squaredLength;\n\t\n\t/**\n\t * Negates the components of a vec3\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a vector to negate\n\t * @returns {vec3} out\n\t */\n\tvec3.negate = function(out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t out[2] = -a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the inverse of the components of a vec3\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a vector to invert\n\t * @returns {vec3} out\n\t */\n\tvec3.inverse = function(out, a) {\n\t out[0] = 1.0 / a[0];\n\t out[1] = 1.0 / a[1];\n\t out[2] = 1.0 / a[2];\n\t return out;\n\t};\n\t\n\t/**\n\t * Normalize a vec3\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a vector to normalize\n\t * @returns {vec3} out\n\t */\n\tvec3.normalize = function(out, a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2];\n\t var len = x*x + y*y + z*z;\n\t if (len > 0) {\n\t //TODO: evaluate use of glm_invsqrt here?\n\t len = 1 / Math.sqrt(len);\n\t out[0] = a[0] * len;\n\t out[1] = a[1] * len;\n\t out[2] = a[2] * len;\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two vec3's\n\t *\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {Number} dot product of a and b\n\t */\n\tvec3.dot = function (a, b) {\n\t return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n\t};\n\t\n\t/**\n\t * Computes the cross product of two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec3.cross = function(out, a, b) {\n\t var ax = a[0], ay = a[1], az = a[2],\n\t bx = b[0], by = b[1], bz = b[2];\n\t\n\t out[0] = ay * bz - az * by;\n\t out[1] = az * bx - ax * bz;\n\t out[2] = ax * by - ay * bx;\n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a linear interpolation between two vec3's\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec3} out\n\t */\n\tvec3.lerp = function (out, a, b, t) {\n\t var ax = a[0],\n\t ay = a[1],\n\t az = a[2];\n\t out[0] = ax + t * (b[0] - ax);\n\t out[1] = ay + t * (b[1] - ay);\n\t out[2] = az + t * (b[2] - az);\n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a hermite interpolation with two control points\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {vec3} c the third operand\n\t * @param {vec3} d the fourth operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec3} out\n\t */\n\tvec3.hermite = function (out, a, b, c, d, t) {\n\t var factorTimes2 = t * t,\n\t factor1 = factorTimes2 * (2 * t - 3) + 1,\n\t factor2 = factorTimes2 * (t - 2) + t,\n\t factor3 = factorTimes2 * (t - 1),\n\t factor4 = factorTimes2 * (3 - 2 * t);\n\t \n\t out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n\t out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n\t out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a bezier interpolation with two control points\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the first operand\n\t * @param {vec3} b the second operand\n\t * @param {vec3} c the third operand\n\t * @param {vec3} d the fourth operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec3} out\n\t */\n\tvec3.bezier = function (out, a, b, c, d, t) {\n\t var inverseFactor = 1 - t,\n\t inverseFactorTimesTwo = inverseFactor * inverseFactor,\n\t factorTimes2 = t * t,\n\t factor1 = inverseFactorTimesTwo * inverseFactor,\n\t factor2 = 3 * t * inverseFactorTimesTwo,\n\t factor3 = 3 * factorTimes2 * inverseFactor,\n\t factor4 = factorTimes2 * t;\n\t \n\t out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n\t out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n\t out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n\t \n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a random vector with the given scale\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n\t * @returns {vec3} out\n\t */\n\tvec3.random = function (out, scale) {\n\t scale = scale || 1.0;\n\t\n\t var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n\t var z = (glMatrix.RANDOM() * 2.0) - 1.0;\n\t var zScale = Math.sqrt(1.0-z*z) * scale;\n\t\n\t out[0] = Math.cos(r) * zScale;\n\t out[1] = Math.sin(r) * zScale;\n\t out[2] = z * scale;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec3 with a mat4.\n\t * 4th vector component is implicitly '1'\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to transform\n\t * @param {mat4} m matrix to transform with\n\t * @returns {vec3} out\n\t */\n\tvec3.transformMat4 = function(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2],\n\t w = m[3] * x + m[7] * y + m[11] * z + m[15];\n\t w = w || 1.0;\n\t out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n\t out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n\t out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec3 with a mat3.\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to transform\n\t * @param {mat4} m the 3x3 matrix to transform with\n\t * @returns {vec3} out\n\t */\n\tvec3.transformMat3 = function(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2];\n\t out[0] = x * m[0] + y * m[3] + z * m[6];\n\t out[1] = x * m[1] + y * m[4] + z * m[7];\n\t out[2] = x * m[2] + y * m[5] + z * m[8];\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec3 with a quat\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec3} a the vector to transform\n\t * @param {quat} q quaternion to transform with\n\t * @returns {vec3} out\n\t */\n\tvec3.transformQuat = function(out, a, q) {\n\t // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations\n\t\n\t var x = a[0], y = a[1], z = a[2],\n\t qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\t\n\t // calculate quat * vec\n\t ix = qw * x + qy * z - qz * y,\n\t iy = qw * y + qz * x - qx * z,\n\t iz = qw * z + qx * y - qy * x,\n\t iw = -qx * x - qy * y - qz * z;\n\t\n\t // calculate result * inverse quat\n\t out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n\t out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n\t out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n\t return out;\n\t};\n\t\n\t/**\n\t * Rotate a 3D vector around the x-axis\n\t * @param {vec3} out The receiving vec3\n\t * @param {vec3} a The vec3 point to rotate\n\t * @param {vec3} b The origin of the rotation\n\t * @param {Number} c The angle of rotation\n\t * @returns {vec3} out\n\t */\n\tvec3.rotateX = function(out, a, b, c){\n\t var p = [], r=[];\n\t\t //Translate point to the origin\n\t\t p[0] = a[0] - b[0];\n\t\t p[1] = a[1] - b[1];\n\t \tp[2] = a[2] - b[2];\n\t\n\t\t //perform rotation\n\t\t r[0] = p[0];\n\t\t r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);\n\t\t r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);\n\t\n\t\t //translate to correct position\n\t\t out[0] = r[0] + b[0];\n\t\t out[1] = r[1] + b[1];\n\t\t out[2] = r[2] + b[2];\n\t\n\t \treturn out;\n\t};\n\t\n\t/**\n\t * Rotate a 3D vector around the y-axis\n\t * @param {vec3} out The receiving vec3\n\t * @param {vec3} a The vec3 point to rotate\n\t * @param {vec3} b The origin of the rotation\n\t * @param {Number} c The angle of rotation\n\t * @returns {vec3} out\n\t */\n\tvec3.rotateY = function(out, a, b, c){\n\t \tvar p = [], r=[];\n\t \t//Translate point to the origin\n\t \tp[0] = a[0] - b[0];\n\t \tp[1] = a[1] - b[1];\n\t \tp[2] = a[2] - b[2];\n\t \n\t \t//perform rotation\n\t \tr[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);\n\t \tr[1] = p[1];\n\t \tr[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);\n\t \n\t \t//translate to correct position\n\t \tout[0] = r[0] + b[0];\n\t \tout[1] = r[1] + b[1];\n\t \tout[2] = r[2] + b[2];\n\t \n\t \treturn out;\n\t};\n\t\n\t/**\n\t * Rotate a 3D vector around the z-axis\n\t * @param {vec3} out The receiving vec3\n\t * @param {vec3} a The vec3 point to rotate\n\t * @param {vec3} b The origin of the rotation\n\t * @param {Number} c The angle of rotation\n\t * @returns {vec3} out\n\t */\n\tvec3.rotateZ = function(out, a, b, c){\n\t \tvar p = [], r=[];\n\t \t//Translate point to the origin\n\t \tp[0] = a[0] - b[0];\n\t \tp[1] = a[1] - b[1];\n\t \tp[2] = a[2] - b[2];\n\t \n\t \t//perform rotation\n\t \tr[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);\n\t \tr[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);\n\t \tr[2] = p[2];\n\t \n\t \t//translate to correct position\n\t \tout[0] = r[0] + b[0];\n\t \tout[1] = r[1] + b[1];\n\t \tout[2] = r[2] + b[2];\n\t \n\t \treturn out;\n\t};\n\t\n\t/**\n\t * Perform some operation over an array of vec3s.\n\t *\n\t * @param {Array} a the array of vectors to iterate over\n\t * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n\t * @param {Number} offset Number of elements to skip at the beginning of the array\n\t * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n\t * @param {Function} fn Function to call for each vector in the array\n\t * @param {Object} [arg] additional argument to pass to fn\n\t * @returns {Array} a\n\t * @function\n\t */\n\tvec3.forEach = (function() {\n\t var vec = vec3.create();\n\t\n\t return function(a, stride, offset, count, fn, arg) {\n\t var i, l;\n\t if(!stride) {\n\t stride = 3;\n\t }\n\t\n\t if(!offset) {\n\t offset = 0;\n\t }\n\t \n\t if(count) {\n\t l = Math.min((count * stride) + offset, a.length);\n\t } else {\n\t l = a.length;\n\t }\n\t\n\t for(i = offset; i < l; i += stride) {\n\t vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];\n\t fn(vec, vec, arg);\n\t a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];\n\t }\n\t \n\t return a;\n\t };\n\t})();\n\t\n\t/**\n\t * Get the angle between two 3D vectors\n\t * @param {vec3} a The first operand\n\t * @param {vec3} b The second operand\n\t * @returns {Number} The angle in radians\n\t */\n\tvec3.angle = function(a, b) {\n\t \n\t var tempA = vec3.fromValues(a[0], a[1], a[2]);\n\t var tempB = vec3.fromValues(b[0], b[1], b[2]);\n\t \n\t vec3.normalize(tempA, tempA);\n\t vec3.normalize(tempB, tempB);\n\t \n\t var cosine = vec3.dot(tempA, tempB);\n\t\n\t if(cosine > 1.0){\n\t return 0;\n\t } else {\n\t return Math.acos(cosine);\n\t } \n\t};\n\t\n\t/**\n\t * Returns a string representation of a vector\n\t *\n\t * @param {vec3} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tvec3.str = function (a) {\n\t return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n\t};\n\t\n\tmodule.exports = vec3;\n\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 4 Dimensional Vector\n\t * @name vec4\n\t */\n\tvar vec4 = {};\n\t\n\t/**\n\t * Creates a new, empty vec4\n\t *\n\t * @returns {vec4} a new 4D vector\n\t */\n\tvec4.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = 0;\n\t out[1] = 0;\n\t out[2] = 0;\n\t out[3] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec4 initialized with values from an existing vector\n\t *\n\t * @param {vec4} a vector to clone\n\t * @returns {vec4} a new 4D vector\n\t */\n\tvec4.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec4 initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {vec4} a new 4D vector\n\t */\n\tvec4.fromValues = function(x, y, z, w) {\n\t var out = new glMatrix.ARRAY_TYPE(4);\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t out[3] = w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one vec4 to another\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the source vector\n\t * @returns {vec4} out\n\t */\n\tvec4.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t out[2] = a[2];\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set the components of a vec4 to the given values\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @param {Number} z Z component\n\t * @param {Number} w W component\n\t * @returns {vec4} out\n\t */\n\tvec4.set = function(out, x, y, z, w) {\n\t out[0] = x;\n\t out[1] = y;\n\t out[2] = z;\n\t out[3] = w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.add = function(out, a, b) {\n\t out[0] = a[0] + b[0];\n\t out[1] = a[1] + b[1];\n\t out[2] = a[2] + b[2];\n\t out[3] = a[3] + b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Subtracts vector b from vector a\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.subtract = function(out, a, b) {\n\t out[0] = a[0] - b[0];\n\t out[1] = a[1] - b[1];\n\t out[2] = a[2] - b[2];\n\t out[3] = a[3] - b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.subtract}\n\t * @function\n\t */\n\tvec4.sub = vec4.subtract;\n\t\n\t/**\n\t * Multiplies two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.multiply = function(out, a, b) {\n\t out[0] = a[0] * b[0];\n\t out[1] = a[1] * b[1];\n\t out[2] = a[2] * b[2];\n\t out[3] = a[3] * b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.multiply}\n\t * @function\n\t */\n\tvec4.mul = vec4.multiply;\n\t\n\t/**\n\t * Divides two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.divide = function(out, a, b) {\n\t out[0] = a[0] / b[0];\n\t out[1] = a[1] / b[1];\n\t out[2] = a[2] / b[2];\n\t out[3] = a[3] / b[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.divide}\n\t * @function\n\t */\n\tvec4.div = vec4.divide;\n\t\n\t/**\n\t * Returns the minimum of two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.min = function(out, a, b) {\n\t out[0] = Math.min(a[0], b[0]);\n\t out[1] = Math.min(a[1], b[1]);\n\t out[2] = Math.min(a[2], b[2]);\n\t out[3] = Math.min(a[3], b[3]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the maximum of two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {vec4} out\n\t */\n\tvec4.max = function(out, a, b) {\n\t out[0] = Math.max(a[0], b[0]);\n\t out[1] = Math.max(a[1], b[1]);\n\t out[2] = Math.max(a[2], b[2]);\n\t out[3] = Math.max(a[3], b[3]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales a vec4 by a scalar number\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {vec4} out\n\t */\n\tvec4.scale = function(out, a, b) {\n\t out[0] = a[0] * b;\n\t out[1] = a[1] * b;\n\t out[2] = a[2] * b;\n\t out[3] = a[3] * b;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec4's after scaling the second operand by a scalar value\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @param {Number} scale the amount to scale b by before adding\n\t * @returns {vec4} out\n\t */\n\tvec4.scaleAndAdd = function(out, a, b, scale) {\n\t out[0] = a[0] + (b[0] * scale);\n\t out[1] = a[1] + (b[1] * scale);\n\t out[2] = a[2] + (b[2] * scale);\n\t out[3] = a[3] + (b[3] * scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the euclidian distance between two vec4's\n\t *\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {Number} distance between a and b\n\t */\n\tvec4.distance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2],\n\t w = b[3] - a[3];\n\t return Math.sqrt(x*x + y*y + z*z + w*w);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.distance}\n\t * @function\n\t */\n\tvec4.dist = vec4.distance;\n\t\n\t/**\n\t * Calculates the squared euclidian distance between two vec4's\n\t *\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {Number} squared distance between a and b\n\t */\n\tvec4.squaredDistance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1],\n\t z = b[2] - a[2],\n\t w = b[3] - a[3];\n\t return x*x + y*y + z*z + w*w;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.squaredDistance}\n\t * @function\n\t */\n\tvec4.sqrDist = vec4.squaredDistance;\n\t\n\t/**\n\t * Calculates the length of a vec4\n\t *\n\t * @param {vec4} a vector to calculate length of\n\t * @returns {Number} length of a\n\t */\n\tvec4.length = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2],\n\t w = a[3];\n\t return Math.sqrt(x*x + y*y + z*z + w*w);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.length}\n\t * @function\n\t */\n\tvec4.len = vec4.length;\n\t\n\t/**\n\t * Calculates the squared length of a vec4\n\t *\n\t * @param {vec4} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t */\n\tvec4.squaredLength = function (a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2],\n\t w = a[3];\n\t return x*x + y*y + z*z + w*w;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec4.squaredLength}\n\t * @function\n\t */\n\tvec4.sqrLen = vec4.squaredLength;\n\t\n\t/**\n\t * Negates the components of a vec4\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a vector to negate\n\t * @returns {vec4} out\n\t */\n\tvec4.negate = function(out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t out[2] = -a[2];\n\t out[3] = -a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the inverse of the components of a vec4\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a vector to invert\n\t * @returns {vec4} out\n\t */\n\tvec4.inverse = function(out, a) {\n\t out[0] = 1.0 / a[0];\n\t out[1] = 1.0 / a[1];\n\t out[2] = 1.0 / a[2];\n\t out[3] = 1.0 / a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Normalize a vec4\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a vector to normalize\n\t * @returns {vec4} out\n\t */\n\tvec4.normalize = function(out, a) {\n\t var x = a[0],\n\t y = a[1],\n\t z = a[2],\n\t w = a[3];\n\t var len = x*x + y*y + z*z + w*w;\n\t if (len > 0) {\n\t len = 1 / Math.sqrt(len);\n\t out[0] = x * len;\n\t out[1] = y * len;\n\t out[2] = z * len;\n\t out[3] = w * len;\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two vec4's\n\t *\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @returns {Number} dot product of a and b\n\t */\n\tvec4.dot = function (a, b) {\n\t return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n\t};\n\t\n\t/**\n\t * Performs a linear interpolation between two vec4's\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the first operand\n\t * @param {vec4} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec4} out\n\t */\n\tvec4.lerp = function (out, a, b, t) {\n\t var ax = a[0],\n\t ay = a[1],\n\t az = a[2],\n\t aw = a[3];\n\t out[0] = ax + t * (b[0] - ax);\n\t out[1] = ay + t * (b[1] - ay);\n\t out[2] = az + t * (b[2] - az);\n\t out[3] = aw + t * (b[3] - aw);\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a random vector with the given scale\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n\t * @returns {vec4} out\n\t */\n\tvec4.random = function (out, scale) {\n\t scale = scale || 1.0;\n\t\n\t //TODO: This is a pretty awful way of doing this. Find something better.\n\t out[0] = glMatrix.RANDOM();\n\t out[1] = glMatrix.RANDOM();\n\t out[2] = glMatrix.RANDOM();\n\t out[3] = glMatrix.RANDOM();\n\t vec4.normalize(out, out);\n\t vec4.scale(out, out, scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec4 with a mat4.\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the vector to transform\n\t * @param {mat4} m matrix to transform with\n\t * @returns {vec4} out\n\t */\n\tvec4.transformMat4 = function(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2], w = a[3];\n\t out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n\t out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n\t out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n\t out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec4 with a quat\n\t *\n\t * @param {vec4} out the receiving vector\n\t * @param {vec4} a the vector to transform\n\t * @param {quat} q quaternion to transform with\n\t * @returns {vec4} out\n\t */\n\tvec4.transformQuat = function(out, a, q) {\n\t var x = a[0], y = a[1], z = a[2],\n\t qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\t\n\t // calculate quat * vec\n\t ix = qw * x + qy * z - qz * y,\n\t iy = qw * y + qz * x - qx * z,\n\t iz = qw * z + qx * y - qy * x,\n\t iw = -qx * x - qy * y - qz * z;\n\t\n\t // calculate result * inverse quat\n\t out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n\t out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n\t out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n\t out[3] = a[3];\n\t return out;\n\t};\n\t\n\t/**\n\t * Perform some operation over an array of vec4s.\n\t *\n\t * @param {Array} a the array of vectors to iterate over\n\t * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n\t * @param {Number} offset Number of elements to skip at the beginning of the array\n\t * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n\t * @param {Function} fn Function to call for each vector in the array\n\t * @param {Object} [arg] additional argument to pass to fn\n\t * @returns {Array} a\n\t * @function\n\t */\n\tvec4.forEach = (function() {\n\t var vec = vec4.create();\n\t\n\t return function(a, stride, offset, count, fn, arg) {\n\t var i, l;\n\t if(!stride) {\n\t stride = 4;\n\t }\n\t\n\t if(!offset) {\n\t offset = 0;\n\t }\n\t \n\t if(count) {\n\t l = Math.min((count * stride) + offset, a.length);\n\t } else {\n\t l = a.length;\n\t }\n\t\n\t for(i = offset; i < l; i += stride) {\n\t vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];\n\t fn(vec, vec, arg);\n\t a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];\n\t }\n\t \n\t return a;\n\t };\n\t})();\n\t\n\t/**\n\t * Returns a string representation of a vector\n\t *\n\t * @param {vec4} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tvec4.str = function (a) {\n\t return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n\t};\n\t\n\tmodule.exports = vec4;\n\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE. */\n\t\n\tvar glMatrix = __webpack_require__(10);\n\t\n\t/**\n\t * @class 2 Dimensional Vector\n\t * @name vec2\n\t */\n\tvar vec2 = {};\n\t\n\t/**\n\t * Creates a new, empty vec2\n\t *\n\t * @returns {vec2} a new 2D vector\n\t */\n\tvec2.create = function() {\n\t var out = new glMatrix.ARRAY_TYPE(2);\n\t out[0] = 0;\n\t out[1] = 0;\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec2 initialized with values from an existing vector\n\t *\n\t * @param {vec2} a vector to clone\n\t * @returns {vec2} a new 2D vector\n\t */\n\tvec2.clone = function(a) {\n\t var out = new glMatrix.ARRAY_TYPE(2);\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Creates a new vec2 initialized with the given values\n\t *\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @returns {vec2} a new 2D vector\n\t */\n\tvec2.fromValues = function(x, y) {\n\t var out = new glMatrix.ARRAY_TYPE(2);\n\t out[0] = x;\n\t out[1] = y;\n\t return out;\n\t};\n\t\n\t/**\n\t * Copy the values from one vec2 to another\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the source vector\n\t * @returns {vec2} out\n\t */\n\tvec2.copy = function(out, a) {\n\t out[0] = a[0];\n\t out[1] = a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Set the components of a vec2 to the given values\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {Number} x X component\n\t * @param {Number} y Y component\n\t * @returns {vec2} out\n\t */\n\tvec2.set = function(out, x, y) {\n\t out[0] = x;\n\t out[1] = y;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.add = function(out, a, b) {\n\t out[0] = a[0] + b[0];\n\t out[1] = a[1] + b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Subtracts vector b from vector a\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.subtract = function(out, a, b) {\n\t out[0] = a[0] - b[0];\n\t out[1] = a[1] - b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.subtract}\n\t * @function\n\t */\n\tvec2.sub = vec2.subtract;\n\t\n\t/**\n\t * Multiplies two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.multiply = function(out, a, b) {\n\t out[0] = a[0] * b[0];\n\t out[1] = a[1] * b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.multiply}\n\t * @function\n\t */\n\tvec2.mul = vec2.multiply;\n\t\n\t/**\n\t * Divides two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.divide = function(out, a, b) {\n\t out[0] = a[0] / b[0];\n\t out[1] = a[1] / b[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.divide}\n\t * @function\n\t */\n\tvec2.div = vec2.divide;\n\t\n\t/**\n\t * Returns the minimum of two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.min = function(out, a, b) {\n\t out[0] = Math.min(a[0], b[0]);\n\t out[1] = Math.min(a[1], b[1]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the maximum of two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec2} out\n\t */\n\tvec2.max = function(out, a, b) {\n\t out[0] = Math.max(a[0], b[0]);\n\t out[1] = Math.max(a[1], b[1]);\n\t return out;\n\t};\n\t\n\t/**\n\t * Scales a vec2 by a scalar number\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to scale\n\t * @param {Number} b amount to scale the vector by\n\t * @returns {vec2} out\n\t */\n\tvec2.scale = function(out, a, b) {\n\t out[0] = a[0] * b;\n\t out[1] = a[1] * b;\n\t return out;\n\t};\n\t\n\t/**\n\t * Adds two vec2's after scaling the second operand by a scalar value\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @param {Number} scale the amount to scale b by before adding\n\t * @returns {vec2} out\n\t */\n\tvec2.scaleAndAdd = function(out, a, b, scale) {\n\t out[0] = a[0] + (b[0] * scale);\n\t out[1] = a[1] + (b[1] * scale);\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the euclidian distance between two vec2's\n\t *\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {Number} distance between a and b\n\t */\n\tvec2.distance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1];\n\t return Math.sqrt(x*x + y*y);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.distance}\n\t * @function\n\t */\n\tvec2.dist = vec2.distance;\n\t\n\t/**\n\t * Calculates the squared euclidian distance between two vec2's\n\t *\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {Number} squared distance between a and b\n\t */\n\tvec2.squaredDistance = function(a, b) {\n\t var x = b[0] - a[0],\n\t y = b[1] - a[1];\n\t return x*x + y*y;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.squaredDistance}\n\t * @function\n\t */\n\tvec2.sqrDist = vec2.squaredDistance;\n\t\n\t/**\n\t * Calculates the length of a vec2\n\t *\n\t * @param {vec2} a vector to calculate length of\n\t * @returns {Number} length of a\n\t */\n\tvec2.length = function (a) {\n\t var x = a[0],\n\t y = a[1];\n\t return Math.sqrt(x*x + y*y);\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.length}\n\t * @function\n\t */\n\tvec2.len = vec2.length;\n\t\n\t/**\n\t * Calculates the squared length of a vec2\n\t *\n\t * @param {vec2} a vector to calculate squared length of\n\t * @returns {Number} squared length of a\n\t */\n\tvec2.squaredLength = function (a) {\n\t var x = a[0],\n\t y = a[1];\n\t return x*x + y*y;\n\t};\n\t\n\t/**\n\t * Alias for {@link vec2.squaredLength}\n\t * @function\n\t */\n\tvec2.sqrLen = vec2.squaredLength;\n\t\n\t/**\n\t * Negates the components of a vec2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a vector to negate\n\t * @returns {vec2} out\n\t */\n\tvec2.negate = function(out, a) {\n\t out[0] = -a[0];\n\t out[1] = -a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Returns the inverse of the components of a vec2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a vector to invert\n\t * @returns {vec2} out\n\t */\n\tvec2.inverse = function(out, a) {\n\t out[0] = 1.0 / a[0];\n\t out[1] = 1.0 / a[1];\n\t return out;\n\t};\n\t\n\t/**\n\t * Normalize a vec2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a vector to normalize\n\t * @returns {vec2} out\n\t */\n\tvec2.normalize = function(out, a) {\n\t var x = a[0],\n\t y = a[1];\n\t var len = x*x + y*y;\n\t if (len > 0) {\n\t //TODO: evaluate use of glm_invsqrt here?\n\t len = 1 / Math.sqrt(len);\n\t out[0] = a[0] * len;\n\t out[1] = a[1] * len;\n\t }\n\t return out;\n\t};\n\t\n\t/**\n\t * Calculates the dot product of two vec2's\n\t *\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {Number} dot product of a and b\n\t */\n\tvec2.dot = function (a, b) {\n\t return a[0] * b[0] + a[1] * b[1];\n\t};\n\t\n\t/**\n\t * Computes the cross product of two vec2's\n\t * Note that the cross product must by definition produce a 3D vector\n\t *\n\t * @param {vec3} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @returns {vec3} out\n\t */\n\tvec2.cross = function(out, a, b) {\n\t var z = a[0] * b[1] - a[1] * b[0];\n\t out[0] = out[1] = 0;\n\t out[2] = z;\n\t return out;\n\t};\n\t\n\t/**\n\t * Performs a linear interpolation between two vec2's\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the first operand\n\t * @param {vec2} b the second operand\n\t * @param {Number} t interpolation amount between the two inputs\n\t * @returns {vec2} out\n\t */\n\tvec2.lerp = function (out, a, b, t) {\n\t var ax = a[0],\n\t ay = a[1];\n\t out[0] = ax + t * (b[0] - ax);\n\t out[1] = ay + t * (b[1] - ay);\n\t return out;\n\t};\n\t\n\t/**\n\t * Generates a random vector with the given scale\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n\t * @returns {vec2} out\n\t */\n\tvec2.random = function (out, scale) {\n\t scale = scale || 1.0;\n\t var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n\t out[0] = Math.cos(r) * scale;\n\t out[1] = Math.sin(r) * scale;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat2\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat2} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat2 = function(out, a, m) {\n\t var x = a[0],\n\t y = a[1];\n\t out[0] = m[0] * x + m[2] * y;\n\t out[1] = m[1] * x + m[3] * y;\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat2d\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat2d} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat2d = function(out, a, m) {\n\t var x = a[0],\n\t y = a[1];\n\t out[0] = m[0] * x + m[2] * y + m[4];\n\t out[1] = m[1] * x + m[3] * y + m[5];\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat3\n\t * 3rd vector component is implicitly '1'\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat3} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat3 = function(out, a, m) {\n\t var x = a[0],\n\t y = a[1];\n\t out[0] = m[0] * x + m[3] * y + m[6];\n\t out[1] = m[1] * x + m[4] * y + m[7];\n\t return out;\n\t};\n\t\n\t/**\n\t * Transforms the vec2 with a mat4\n\t * 3rd vector component is implicitly '0'\n\t * 4th vector component is implicitly '1'\n\t *\n\t * @param {vec2} out the receiving vector\n\t * @param {vec2} a the vector to transform\n\t * @param {mat4} m matrix to transform with\n\t * @returns {vec2} out\n\t */\n\tvec2.transformMat4 = function(out, a, m) {\n\t var x = a[0], \n\t y = a[1];\n\t out[0] = m[0] * x + m[4] * y + m[12];\n\t out[1] = m[1] * x + m[5] * y + m[13];\n\t return out;\n\t};\n\t\n\t/**\n\t * Perform some operation over an array of vec2s.\n\t *\n\t * @param {Array} a the array of vectors to iterate over\n\t * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n\t * @param {Number} offset Number of elements to skip at the beginning of the array\n\t * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n\t * @param {Function} fn Function to call for each vector in the array\n\t * @param {Object} [arg] additional argument to pass to fn\n\t * @returns {Array} a\n\t * @function\n\t */\n\tvec2.forEach = (function() {\n\t var vec = vec2.create();\n\t\n\t return function(a, stride, offset, count, fn, arg) {\n\t var i, l;\n\t if(!stride) {\n\t stride = 2;\n\t }\n\t\n\t if(!offset) {\n\t offset = 0;\n\t }\n\t \n\t if(count) {\n\t l = Math.min((count * stride) + offset, a.length);\n\t } else {\n\t l = a.length;\n\t }\n\t\n\t for(i = offset; i < l; i += stride) {\n\t vec[0] = a[i]; vec[1] = a[i+1];\n\t fn(vec, vec, arg);\n\t a[i] = vec[0]; a[i+1] = vec[1];\n\t }\n\t \n\t return a;\n\t };\n\t})();\n\t\n\t/**\n\t * Returns a string representation of a vector\n\t *\n\t * @param {vec2} vec vector to represent as a string\n\t * @returns {String} string representation of the vector\n\t */\n\tvec2.str = function (a) {\n\t return 'vec2(' + a[0] + ', ' + a[1] + ')';\n\t};\n\t\n\tmodule.exports = vec2;\n\n\n/***/ },\n/* 19 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports[\"default\"] = {\n\t init: function init(arr, val) {\n\t var l = arr.length;\n\t while (l--) {\n\t arr[l] = val;\n\t }\n\t },\n\t\n\t /**\n\t * Shuffles the content of an array\n\t * @return {Array} the array itself shuffled\n\t */\n\t shuffle: function shuffle(arr) {\n\t var i = arr.length - 1,\n\t j,\n\t x;\n\t for (i; i >= 0; i--) {\n\t j = Math.floor(Math.random() * i);\n\t x = arr[i];\n\t arr[i] = arr[j];\n\t arr[j] = x;\n\t }\n\t return arr;\n\t },\n\t\n\t toPointList: function toPointList(arr) {\n\t var i,\n\t j,\n\t row = [],\n\t rows = [];\n\t for (i = 0; i < arr.length; i++) {\n\t row = [];\n\t for (j = 0; j < arr[i].length; j++) {\n\t row[j] = arr[i][j];\n\t }\n\t rows[i] = \"[\" + row.join(\",\") + \"]\";\n\t }\n\t return \"[\" + rows.join(\",\\r\\n\") + \"]\";\n\t },\n\t\n\t /**\n\t * returns the elements which's score is bigger than the threshold\n\t * @return {Array} the reduced array\n\t */\n\t threshold: function threshold(arr, _threshold, scoreFunc) {\n\t var i,\n\t queue = [];\n\t for (i = 0; i < arr.length; i++) {\n\t if (scoreFunc.apply(arr, [arr[i]]) >= _threshold) {\n\t queue.push(arr[i]);\n\t }\n\t }\n\t return queue;\n\t },\n\t\n\t maxIndex: function maxIndex(arr) {\n\t var i,\n\t max = 0;\n\t for (i = 0; i < arr.length; i++) {\n\t if (arr[i] > arr[max]) {\n\t max = i;\n\t }\n\t }\n\t return max;\n\t },\n\t\n\t max: function max(arr) {\n\t var i,\n\t max = 0;\n\t for (i = 0; i < arr.length; i++) {\n\t if (arr[i] > max) {\n\t max = arr[i];\n\t }\n\t }\n\t return max;\n\t },\n\t\n\t sum: function sum(arr) {\n\t var length = arr.length,\n\t sum = 0;\n\t\n\t while (length--) {\n\t sum += arr[length];\n\t }\n\t return sum;\n\t }\n\t};\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* jshint undef: true, unused: true, browser:true, devel: true */\n\t/* global define */\n\t\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _image_wrapper = __webpack_require__(5);\n\t\n\tvar _image_wrapper2 = _interopRequireDefault(_image_wrapper);\n\t\n\tvar _cv_utils = __webpack_require__(7);\n\t\n\tvar _cv_utils2 = _interopRequireDefault(_cv_utils);\n\t\n\tvar _rasterizer = __webpack_require__(21);\n\t\n\tvar _rasterizer2 = _interopRequireDefault(_rasterizer);\n\t\n\tvar _tracer = __webpack_require__(22);\n\t\n\tvar _tracer2 = _interopRequireDefault(_tracer);\n\t\n\tvar _skeletonizer2 = __webpack_require__(23);\n\t\n\tvar _skeletonizer3 = _interopRequireDefault(_skeletonizer2);\n\t\n\tvar _array_helper = __webpack_require__(19);\n\t\n\tvar _array_helper2 = _interopRequireDefault(_array_helper);\n\t\n\tvar _image_debug = __webpack_require__(24);\n\t\n\tvar _image_debug2 = _interopRequireDefault(_image_debug);\n\t\n\tvar _glMatrix = __webpack_require__(9);\n\t\n\tvar _glMatrix2 = _interopRequireDefault(_glMatrix);\n\t\n\tvar _config,\n\t _currentImageWrapper,\n\t _skelImageWrapper,\n\t _subImageWrapper,\n\t _labelImageWrapper,\n\t _patchGrid,\n\t _patchLabelGrid,\n\t _imageToPatchGrid,\n\t _binaryImageWrapper,\n\t _patchSize,\n\t _canvasContainer = {\n\t ctx: {\n\t binary: null\n\t },\n\t dom: {\n\t binary: null\n\t }\n\t},\n\t _numPatches = { x: 0, y: 0 },\n\t _inputImageWrapper,\n\t _skeletonizer,\n\t vec2 = _glMatrix2['default'].vec2,\n\t mat2 = _glMatrix2['default'].mat2,\n\t self = typeof window !== 'undefined' ? window : self;\n\t\n\tfunction initBuffers() {\n\t var skeletonImageData;\n\t\n\t if (_config.halfSample) {\n\t _currentImageWrapper = new _image_wrapper2['default']({\n\t x: _inputImageWrapper.size.x / 2 | 0,\n\t y: _inputImageWrapper.size.y / 2 | 0\n\t });\n\t } else {\n\t _currentImageWrapper = _inputImageWrapper;\n\t }\n\t\n\t _patchSize = _cv_utils2['default'].calculatePatchSize(_config.patchSize, _currentImageWrapper.size);\n\t\n\t _numPatches.x = _currentImageWrapper.size.x / _patchSize.x | 0;\n\t _numPatches.y = _currentImageWrapper.size.y / _patchSize.y | 0;\n\t\n\t _binaryImageWrapper = new _image_wrapper2['default'](_currentImageWrapper.size, undefined, Uint8Array, false);\n\t\n\t _labelImageWrapper = new _image_wrapper2['default'](_patchSize, undefined, Array, true);\n\t\n\t skeletonImageData = new ArrayBuffer(64 * 1024);\n\t _subImageWrapper = new _image_wrapper2['default'](_patchSize, new Uint8Array(skeletonImageData, 0, _patchSize.x * _patchSize.y));\n\t _skelImageWrapper = new _image_wrapper2['default'](_patchSize, new Uint8Array(skeletonImageData, _patchSize.x * _patchSize.y * 3, _patchSize.x * _patchSize.y), undefined, true);\n\t _skeletonizer = (0, _skeletonizer3['default'])(self, {\n\t size: _patchSize.x\n\t }, skeletonImageData);\n\t\n\t _imageToPatchGrid = new _image_wrapper2['default']({\n\t x: _currentImageWrapper.size.x / _subImageWrapper.size.x | 0,\n\t y: _currentImageWrapper.size.y / _subImageWrapper.size.y | 0\n\t }, undefined, Array, true);\n\t _patchGrid = new _image_wrapper2['default'](_imageToPatchGrid.size, undefined, undefined, true);\n\t _patchLabelGrid = new _image_wrapper2['default'](_imageToPatchGrid.size, undefined, Int32Array, true);\n\t}\n\t\n\tfunction initCanvas() {\n\t if (_config.useWorker || typeof document === 'undefined') {\n\t return;\n\t }\n\t _canvasContainer.dom.binary = document.createElement(\"canvas\");\n\t _canvasContainer.dom.binary.className = \"binaryBuffer\";\n\t if (_config.showCanvas === true) {\n\t document.querySelector(\"#debug\").appendChild(_canvasContainer.dom.binary);\n\t }\n\t _canvasContainer.ctx.binary = _canvasContainer.dom.binary.getContext(\"2d\");\n\t _canvasContainer.dom.binary.width = _binaryImageWrapper.size.x;\n\t _canvasContainer.dom.binary.height = _binaryImageWrapper.size.y;\n\t}\n\t\n\t/**\n\t * Creates a bounding box which encloses all the given patches\n\t * @returns {Array} The minimal bounding box\n\t */\n\tfunction boxFromPatches(patches) {\n\t var overAvg,\n\t i,\n\t j,\n\t patch,\n\t transMat,\n\t minx = _binaryImageWrapper.size.x,\n\t miny = _binaryImageWrapper.size.y,\n\t maxx = -_binaryImageWrapper.size.x,\n\t maxy = -_binaryImageWrapper.size.y,\n\t box,\n\t scale;\n\t\n\t // draw all patches which are to be taken into consideration\n\t overAvg = 0;\n\t for (i = 0; i < patches.length; i++) {\n\t patch = patches[i];\n\t overAvg += patch.rad;\n\t if (_config.showPatches) {\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"red\" });\n\t }\n\t }\n\t\n\t overAvg /= patches.length;\n\t overAvg = (overAvg * 180 / Math.PI + 90) % 180 - 90;\n\t if (overAvg < 0) {\n\t overAvg += 180;\n\t }\n\t\n\t overAvg = (180 - overAvg) * Math.PI / 180;\n\t transMat = mat2.clone([Math.cos(overAvg), Math.sin(overAvg), -Math.sin(overAvg), Math.cos(overAvg)]);\n\t\n\t // iterate over patches and rotate by angle\n\t for (i = 0; i < patches.length; i++) {\n\t patch = patches[i];\n\t for (j = 0; j < 4; j++) {\n\t vec2.transformMat2(patch.box[j], patch.box[j], transMat);\n\t }\n\t\n\t if (_config.boxFromPatches.showTransformed) {\n\t _image_debug2['default'].drawPath(patch.box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#99ff00', lineWidth: 2 });\n\t }\n\t }\n\t\n\t // find bounding box\n\t for (i = 0; i < patches.length; i++) {\n\t patch = patches[i];\n\t for (j = 0; j < 4; j++) {\n\t if (patch.box[j][0] < minx) {\n\t minx = patch.box[j][0];\n\t }\n\t if (patch.box[j][0] > maxx) {\n\t maxx = patch.box[j][0];\n\t }\n\t if (patch.box[j][1] < miny) {\n\t miny = patch.box[j][1];\n\t }\n\t if (patch.box[j][1] > maxy) {\n\t maxy = patch.box[j][1];\n\t }\n\t }\n\t }\n\t\n\t box = [[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]];\n\t\n\t if (_config.boxFromPatches.showTransformedBox) {\n\t _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#ff0000', lineWidth: 2 });\n\t }\n\t\n\t scale = _config.halfSample ? 2 : 1;\n\t // reverse rotation;\n\t transMat = mat2.invert(transMat, transMat);\n\t for (j = 0; j < 4; j++) {\n\t vec2.transformMat2(box[j], box[j], transMat);\n\t }\n\t\n\t if (_config.boxFromPatches.showBB) {\n\t _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, _canvasContainer.ctx.binary, { color: '#ff0000', lineWidth: 2 });\n\t }\n\t\n\t for (j = 0; j < 4; j++) {\n\t vec2.scale(box[j], box[j], scale);\n\t }\n\t\n\t return box;\n\t}\n\t\n\t/**\n\t * Creates a binary image of the current image\n\t */\n\tfunction binarizeImage() {\n\t _cv_utils2['default'].otsuThreshold(_currentImageWrapper, _binaryImageWrapper);\n\t _binaryImageWrapper.zeroBorder();\n\t if (_config.showCanvas) {\n\t _binaryImageWrapper.show(_canvasContainer.dom.binary, 255);\n\t }\n\t}\n\t\n\t/**\n\t * Iterate over the entire image\n\t * extract patches\n\t */\n\tfunction findPatches() {\n\t var i,\n\t j,\n\t x,\n\t y,\n\t moments,\n\t patchesFound = [],\n\t rasterizer,\n\t rasterResult,\n\t patch;\n\t for (i = 0; i < _numPatches.x; i++) {\n\t for (j = 0; j < _numPatches.y; j++) {\n\t\n\t x = _subImageWrapper.size.x * i;\n\t y = _subImageWrapper.size.y * j;\n\t\n\t // seperate parts\n\t skeletonize(x, y);\n\t\n\t // Rasterize, find individual bars\n\t _skelImageWrapper.zeroBorder();\n\t _array_helper2['default'].init(_labelImageWrapper.data, 0);\n\t rasterizer = _rasterizer2['default'].create(_skelImageWrapper, _labelImageWrapper);\n\t rasterResult = rasterizer.rasterize(0);\n\t\n\t if (_config.showLabels) {\n\t _labelImageWrapper.overlay(_canvasContainer.dom.binary, Math.floor(360 / rasterResult.count), { x: x, y: y });\n\t }\n\t\n\t // calculate moments from the skeletonized patch\n\t moments = _labelImageWrapper.moments(rasterResult.count);\n\t\n\t // extract eligible patches\n\t patchesFound = patchesFound.concat(describePatch(moments, [i, j], x, y));\n\t }\n\t }\n\t\n\t if (_config.showFoundPatches) {\n\t for (i = 0; i < patchesFound.length; i++) {\n\t patch = patchesFound[i];\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"#99ff00\", lineWidth: 2 });\n\t }\n\t }\n\t\n\t return patchesFound;\n\t}\n\t\n\t/**\n\t * Finds those connected areas which contain at least 6 patches\n\t * and returns them ordered DESC by the number of contained patches\n\t * @param {Number} maxLabel\n\t */\n\tfunction findBiggestConnectedAreas(maxLabel) {\n\t var i,\n\t sum,\n\t labelHist = [],\n\t topLabels = [];\n\t\n\t for (i = 0; i < maxLabel; i++) {\n\t labelHist.push(0);\n\t }\n\t sum = _patchLabelGrid.data.length;\n\t while (sum--) {\n\t if (_patchLabelGrid.data[sum] > 0) {\n\t labelHist[_patchLabelGrid.data[sum] - 1]++;\n\t }\n\t }\n\t\n\t labelHist = labelHist.map(function (val, idx) {\n\t return {\n\t val: val,\n\t label: idx + 1\n\t };\n\t });\n\t\n\t labelHist.sort(function (a, b) {\n\t return b.val - a.val;\n\t });\n\t\n\t // extract top areas with at least 6 patches present\n\t topLabels = labelHist.filter(function (el) {\n\t return el.val >= 5;\n\t });\n\t\n\t return topLabels;\n\t}\n\t\n\t/**\n\t *\n\t */\n\tfunction findBoxes(topLabels, maxLabel) {\n\t var i,\n\t j,\n\t sum,\n\t patches = [],\n\t patch,\n\t box,\n\t boxes = [],\n\t hsv = [0, 1, 1],\n\t rgb = [0, 0, 0];\n\t\n\t for (i = 0; i < topLabels.length; i++) {\n\t sum = _patchLabelGrid.data.length;\n\t patches.length = 0;\n\t while (sum--) {\n\t if (_patchLabelGrid.data[sum] === topLabels[i].label) {\n\t patch = _imageToPatchGrid.data[sum];\n\t patches.push(patch);\n\t }\n\t }\n\t box = boxFromPatches(patches);\n\t if (box) {\n\t boxes.push(box);\n\t\n\t // draw patch-labels if requested\n\t if (_config.showRemainingPatchLabels) {\n\t for (j = 0; j < patches.length; j++) {\n\t patch = patches[j];\n\t hsv[0] = topLabels[i].label / (maxLabel + 1) * 360;\n\t _cv_utils2['default'].hsv2rgb(hsv, rgb);\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2 });\n\t }\n\t }\n\t }\n\t }\n\t return boxes;\n\t}\n\t\n\t/**\n\t * Find similar moments (via cluster)\n\t * @param {Object} moments\n\t */\n\tfunction similarMoments(moments) {\n\t var clusters = _cv_utils2['default'].cluster(moments, 0.90);\n\t var topCluster = _cv_utils2['default'].topGeneric(clusters, 1, function (e) {\n\t return e.getPoints().length;\n\t });\n\t var points = [],\n\t result = [];\n\t if (topCluster.length === 1) {\n\t points = topCluster[0].item.getPoints();\n\t for (var i = 0; i < points.length; i++) {\n\t result.push(points[i].point);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tfunction skeletonize(x, y) {\n\t _binaryImageWrapper.subImageAsCopy(_subImageWrapper, _cv_utils2['default'].imageRef(x, y));\n\t _skeletonizer.skeletonize();\n\t\n\t // Show skeleton if requested\n\t if (_config.showSkeleton) {\n\t _skelImageWrapper.overlay(_canvasContainer.dom.binary, 360, _cv_utils2['default'].imageRef(x, y));\n\t }\n\t}\n\t\n\t/**\n\t * Extracts and describes those patches which seem to contain a barcode pattern\n\t * @param {Array} moments\n\t * @param {Object} patchPos,\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @returns {Array} list of patches\n\t */\n\tfunction describePatch(moments, patchPos, x, y) {\n\t var k,\n\t avg,\n\t sum = 0,\n\t eligibleMoments = [],\n\t matchingMoments,\n\t patch,\n\t patchesFound = [],\n\t minComponentWeight = Math.ceil(_patchSize.x / 3);\n\t\n\t if (moments.length >= 2) {\n\t // only collect moments which's area covers at least minComponentWeight pixels.\n\t for (k = 0; k < moments.length; k++) {\n\t if (moments[k].m00 > minComponentWeight) {\n\t eligibleMoments.push(moments[k]);\n\t }\n\t }\n\t\n\t // if at least 2 moments are found which have at least minComponentWeights covered\n\t if (eligibleMoments.length >= 2) {\n\t sum = eligibleMoments.length;\n\t matchingMoments = similarMoments(eligibleMoments);\n\t avg = 0;\n\t // determine the similarity of the moments\n\t for (k = 0; k < matchingMoments.length; k++) {\n\t avg += matchingMoments[k].rad;\n\t }\n\t\n\t // Only two of the moments are allowed not to fit into the equation\n\t // add the patch to the set\n\t if (matchingMoments.length > 1 && matchingMoments.length >= eligibleMoments.length / 4 * 3 && matchingMoments.length > moments.length / 4) {\n\t avg /= matchingMoments.length;\n\t patch = {\n\t index: patchPos[1] * _numPatches.x + patchPos[0],\n\t pos: {\n\t x: x,\n\t y: y\n\t },\n\t box: [vec2.clone([x, y]), vec2.clone([x + _subImageWrapper.size.x, y]), vec2.clone([x + _subImageWrapper.size.x, y + _subImageWrapper.size.y]), vec2.clone([x, y + _subImageWrapper.size.y])],\n\t moments: matchingMoments,\n\t rad: avg,\n\t vec: vec2.clone([Math.cos(avg), Math.sin(avg)])\n\t };\n\t patchesFound.push(patch);\n\t }\n\t }\n\t }\n\t return patchesFound;\n\t}\n\t\n\t/**\n\t * finds patches which are connected and share the same orientation\n\t * @param {Object} patchesFound\n\t */\n\tfunction rasterizeAngularSimilarity(patchesFound) {\n\t var label = 0,\n\t threshold = 0.95,\n\t currIdx = 0,\n\t j,\n\t patch,\n\t hsv = [0, 1, 1],\n\t rgb = [0, 0, 0];\n\t\n\t function notYetProcessed() {\n\t var i;\n\t for (i = 0; i < _patchLabelGrid.data.length; i++) {\n\t if (_patchLabelGrid.data[i] === 0 && _patchGrid.data[i] === 1) {\n\t return i;\n\t }\n\t }\n\t return _patchLabelGrid.length;\n\t }\n\t\n\t function trace(currentIdx) {\n\t var x,\n\t y,\n\t currentPatch,\n\t patch,\n\t idx,\n\t dir,\n\t current = {\n\t x: currentIdx % _patchLabelGrid.size.x,\n\t y: currentIdx / _patchLabelGrid.size.x | 0\n\t },\n\t similarity;\n\t\n\t if (currentIdx < _patchLabelGrid.data.length) {\n\t currentPatch = _imageToPatchGrid.data[currentIdx];\n\t // assign label\n\t _patchLabelGrid.data[currentIdx] = label;\n\t for (dir = 0; dir < _tracer2['default'].searchDirections.length; dir++) {\n\t y = current.y + _tracer2['default'].searchDirections[dir][0];\n\t x = current.x + _tracer2['default'].searchDirections[dir][1];\n\t idx = y * _patchLabelGrid.size.x + x;\n\t\n\t // continue if patch empty\n\t if (_patchGrid.data[idx] === 0) {\n\t _patchLabelGrid.data[idx] = Number.MAX_VALUE;\n\t continue;\n\t }\n\t\n\t patch = _imageToPatchGrid.data[idx];\n\t if (_patchLabelGrid.data[idx] === 0) {\n\t similarity = Math.abs(vec2.dot(patch.vec, currentPatch.vec));\n\t if (similarity > threshold) {\n\t trace(idx);\n\t }\n\t }\n\t }\n\t }\n\t }\n\t\n\t // prepare for finding the right patches\n\t _array_helper2['default'].init(_patchGrid.data, 0);\n\t _array_helper2['default'].init(_patchLabelGrid.data, 0);\n\t _array_helper2['default'].init(_imageToPatchGrid.data, null);\n\t\n\t for (j = 0; j < patchesFound.length; j++) {\n\t patch = patchesFound[j];\n\t _imageToPatchGrid.data[patch.index] = patch;\n\t _patchGrid.data[patch.index] = 1;\n\t }\n\t\n\t // rasterize the patches found to determine area\n\t _patchGrid.zeroBorder();\n\t\n\t while ((currIdx = notYetProcessed()) < _patchLabelGrid.data.length) {\n\t label++;\n\t trace(currIdx);\n\t }\n\t\n\t // draw patch-labels if requested\n\t if (_config.showPatchLabels) {\n\t for (j = 0; j < _patchLabelGrid.data.length; j++) {\n\t if (_patchLabelGrid.data[j] > 0 && _patchLabelGrid.data[j] <= label) {\n\t patch = _imageToPatchGrid.data[j];\n\t hsv[0] = _patchLabelGrid.data[j] / (label + 1) * 360;\n\t _cv_utils2['default'].hsv2rgb(hsv, rgb);\n\t _image_debug2['default'].drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, { color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2 });\n\t }\n\t }\n\t }\n\t\n\t return label;\n\t}\n\t\n\texports['default'] = {\n\t init: function init(inputImageWrapper, config) {\n\t _config = config;\n\t _inputImageWrapper = inputImageWrapper;\n\t\n\t initBuffers();\n\t initCanvas();\n\t },\n\t\n\t locate: function locate() {\n\t var patchesFound, topLabels, boxes;\n\t\n\t if (_config.halfSample) {\n\t _cv_utils2['default'].halfSample(_inputImageWrapper, _currentImageWrapper);\n\t }\n\t\n\t binarizeImage();\n\t patchesFound = findPatches();\n\t // return unless 5% or more patches are found\n\t if (patchesFound.length < _numPatches.x * _numPatches.y * 0.05) {\n\t return null;\n\t }\n\t\n\t // rasterrize area by comparing angular similarity;\n\t var maxLabel = rasterizeAngularSimilarity(patchesFound);\n\t if (maxLabel < 1) {\n\t return null;\n\t }\n\t\n\t // search for area with the most patches (biggest connected area)\n\t topLabels = findBiggestConnectedAreas(maxLabel);\n\t if (topLabels.length === 0) {\n\t return null;\n\t }\n\t\n\t boxes = findBoxes(topLabels, maxLabel);\n\t return boxes;\n\t },\n\t\n\t checkImageConstraints: function checkImageConstraints(inputStream, config) {\n\t var patchSize,\n\t width = inputStream.getWidth(),\n\t height = inputStream.getHeight(),\n\t halfSample = config.halfSample ? 0.5 : 1,\n\t size,\n\t area;\n\t\n\t // calculate width and height based on area\n\t if (inputStream.getConfig().area) {\n\t area = _cv_utils2['default'].computeImageArea(width, height, inputStream.getConfig().area);\n\t inputStream.setTopRight({ x: area.sx, y: area.sy });\n\t inputStream.setCanvasSize({ x: width, y: height });\n\t width = area.sw;\n\t height = area.sh;\n\t }\n\t\n\t size = {\n\t x: Math.floor(width * halfSample),\n\t y: Math.floor(height * halfSample)\n\t };\n\t\n\t patchSize = _cv_utils2['default'].calculatePatchSize(config.patchSize, size);\n\t console.log(\"Patch-Size: \" + JSON.stringify(patchSize));\n\t\n\t inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / halfSample) * patchSize.x));\n\t inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / halfSample) * patchSize.y));\n\t\n\t if (inputStream.getWidth() % patchSize.x === 0 && inputStream.getHeight() % patchSize.y === 0) {\n\t return true;\n\t }\n\t\n\t throw new Error(\"Image dimensions do not comply with the current settings: Width (\" + width + \" )and height (\" + height + \") must a multiple of \" + patchSize.x);\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 21 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _tracer = __webpack_require__(22);\n\t\n\tvar _tracer2 = _interopRequireDefault(_tracer);\n\t\n\t/**\n\t * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n\t */\n\tvar Rasterizer = {\n\t createContour2D: function createContour2D() {\n\t return {\n\t dir: null,\n\t index: null,\n\t firstVertex: null,\n\t insideContours: null,\n\t nextpeer: null,\n\t prevpeer: null\n\t };\n\t },\n\t CONTOUR_DIR: {\n\t CW_DIR: 0,\n\t CCW_DIR: 1,\n\t UNKNOWN_DIR: 2\n\t },\n\t DIR: {\n\t OUTSIDE_EDGE: -32767,\n\t INSIDE_EDGE: -32766\n\t },\n\t create: function create(imageWrapper, labelWrapper) {\n\t var imageData = imageWrapper.data,\n\t labelData = labelWrapper.data,\n\t width = imageWrapper.size.x,\n\t height = imageWrapper.size.y,\n\t tracer = _tracer2[\"default\"].create(imageWrapper, labelWrapper);\n\t\n\t return {\n\t rasterize: function rasterize(depthlabel) {\n\t var color,\n\t bc,\n\t lc,\n\t labelindex,\n\t cx,\n\t cy,\n\t colorMap = [],\n\t vertex,\n\t p,\n\t cc,\n\t sc,\n\t pos,\n\t connectedCount = 0,\n\t i;\n\t\n\t for (i = 0; i < 400; i++) {\n\t colorMap[i] = 0;\n\t }\n\t\n\t colorMap[0] = imageData[0];\n\t cc = null;\n\t for (cy = 1; cy < height - 1; cy++) {\n\t labelindex = 0;\n\t bc = colorMap[0];\n\t for (cx = 1; cx < width - 1; cx++) {\n\t pos = cy * width + cx;\n\t if (labelData[pos] === 0) {\n\t color = imageData[pos];\n\t if (color !== bc) {\n\t if (labelindex === 0) {\n\t lc = connectedCount + 1;\n\t colorMap[lc] = color;\n\t bc = color;\n\t vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE);\n\t if (vertex !== null) {\n\t connectedCount++;\n\t labelindex = lc;\n\t p = Rasterizer.createContour2D();\n\t p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n\t p.index = labelindex;\n\t p.firstVertex = vertex;\n\t p.nextpeer = cc;\n\t p.insideContours = null;\n\t if (cc !== null) {\n\t cc.prevpeer = p;\n\t }\n\t cc = p;\n\t }\n\t } else {\n\t vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex);\n\t if (vertex !== null) {\n\t p = Rasterizer.createContour2D();\n\t p.firstVertex = vertex;\n\t p.insideContours = null;\n\t if (depthlabel === 0) {\n\t p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR;\n\t } else {\n\t p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n\t }\n\t p.index = depthlabel;\n\t sc = cc;\n\t while (sc !== null && sc.index !== labelindex) {\n\t sc = sc.nextpeer;\n\t }\n\t if (sc !== null) {\n\t p.nextpeer = sc.insideContours;\n\t if (sc.insideContours !== null) {\n\t sc.insideContours.prevpeer = p;\n\t }\n\t sc.insideContours = p;\n\t }\n\t }\n\t }\n\t } else {\n\t labelData[pos] = labelindex;\n\t }\n\t } else if (labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n\t labelindex = 0;\n\t if (labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n\t bc = imageData[pos];\n\t } else {\n\t bc = colorMap[0];\n\t }\n\t } else {\n\t labelindex = labelData[pos];\n\t bc = colorMap[labelindex];\n\t }\n\t }\n\t }\n\t sc = cc;\n\t while (sc !== null) {\n\t sc.index = depthlabel;\n\t sc = sc.nextpeer;\n\t }\n\t return {\n\t cc: cc,\n\t count: connectedCount\n\t };\n\t },\n\t debug: {\n\t drawContour: function drawContour(canvas, firstContour) {\n\t var ctx = canvas.getContext(\"2d\"),\n\t pq = firstContour,\n\t iq,\n\t q,\n\t p;\n\t\n\t ctx.strokeStyle = \"red\";\n\t ctx.fillStyle = \"red\";\n\t ctx.lineWidth = 1;\n\t\n\t if (pq !== null) {\n\t iq = pq.insideContours;\n\t } else {\n\t iq = null;\n\t }\n\t\n\t while (pq !== null) {\n\t if (iq !== null) {\n\t q = iq;\n\t iq = iq.nextpeer;\n\t } else {\n\t q = pq;\n\t pq = pq.nextpeer;\n\t if (pq !== null) {\n\t iq = pq.insideContours;\n\t } else {\n\t iq = null;\n\t }\n\t }\n\t\n\t switch (q.dir) {\n\t case Rasterizer.CONTOUR_DIR.CW_DIR:\n\t ctx.strokeStyle = \"red\";\n\t break;\n\t case Rasterizer.CONTOUR_DIR.CCW_DIR:\n\t ctx.strokeStyle = \"blue\";\n\t break;\n\t case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:\n\t ctx.strokeStyle = \"green\";\n\t break;\n\t }\n\t\n\t p = q.firstVertex;\n\t ctx.beginPath();\n\t ctx.moveTo(p.x, p.y);\n\t do {\n\t p = p.next;\n\t ctx.lineTo(p.x, p.y);\n\t } while (p !== q.firstVertex);\n\t ctx.stroke();\n\t }\n\t }\n\t }\n\t };\n\t }\n\t};\n\t\n\texports[\"default\"] = Rasterizer;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\t/**\n\t * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n\t */\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar Tracer = {\n\t searchDirections: [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]],\n\t create: function create(imageWrapper, labelWrapper) {\n\t var imageData = imageWrapper.data,\n\t labelData = labelWrapper.data,\n\t searchDirections = this.searchDirections,\n\t width = imageWrapper.size.x,\n\t pos;\n\t\n\t function _trace(current, color, label, edgelabel) {\n\t var i, y, x;\n\t\n\t for (i = 0; i < 7; i++) {\n\t y = current.cy + searchDirections[current.dir][0];\n\t x = current.cx + searchDirections[current.dir][1];\n\t pos = y * width + x;\n\t if (imageData[pos] === color && (labelData[pos] === 0 || labelData[pos] === label)) {\n\t labelData[pos] = label;\n\t current.cy = y;\n\t current.cx = x;\n\t return true;\n\t } else {\n\t if (labelData[pos] === 0) {\n\t labelData[pos] = edgelabel;\n\t }\n\t current.dir = (current.dir + 1) % 8;\n\t }\n\t }\n\t return false;\n\t }\n\t\n\t function vertex2D(x, y, dir) {\n\t return {\n\t dir: dir,\n\t x: x,\n\t y: y,\n\t next: null,\n\t prev: null\n\t };\n\t }\n\t\n\t function _contourTracing(sy, sx, label, color, edgelabel) {\n\t var Fv = null,\n\t Cv,\n\t P,\n\t ldir,\n\t current = {\n\t cx: sx,\n\t cy: sy,\n\t dir: 0\n\t };\n\t\n\t if (_trace(current, color, label, edgelabel)) {\n\t Fv = vertex2D(sx, sy, current.dir);\n\t Cv = Fv;\n\t ldir = current.dir;\n\t P = vertex2D(current.cx, current.cy, 0);\n\t P.prev = Cv;\n\t Cv.next = P;\n\t P.next = null;\n\t Cv = P;\n\t do {\n\t current.dir = (current.dir + 6) % 8;\n\t _trace(current, color, label, edgelabel);\n\t if (ldir != current.dir) {\n\t Cv.dir = current.dir;\n\t P = vertex2D(current.cx, current.cy, 0);\n\t P.prev = Cv;\n\t Cv.next = P;\n\t P.next = null;\n\t Cv = P;\n\t } else {\n\t Cv.dir = ldir;\n\t Cv.x = current.cx;\n\t Cv.y = current.cy;\n\t }\n\t ldir = current.dir;\n\t } while (current.cx != sx || current.cy != sy);\n\t Fv.prev = Cv.prev;\n\t Cv.prev.next = Fv;\n\t }\n\t return Fv;\n\t }\n\t\n\t return {\n\t trace: function trace(current, color, label, edgelabel) {\n\t return _trace(current, color, label, edgelabel);\n\t },\n\t contourTracing: function contourTracing(sy, sx, label, color, edgelabel) {\n\t return _contourTracing(sy, sx, label, color, edgelabel);\n\t }\n\t };\n\t }\n\t};\n\t\n\texports[\"default\"] = Tracer;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 23 */\n/***/ function(module, exports) {\n\n\t/* @preserve ASM BEGIN */\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tfunction Skeletonizer(stdlib, foreign, buffer) {\n\t \"use asm\";\n\t\n\t var images = new stdlib.Uint8Array(buffer),\n\t size = foreign.size | 0,\n\t imul = stdlib.Math.imul;\n\t\n\t function erode(inImagePtr, outImagePtr) {\n\t inImagePtr = inImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var v = 0,\n\t u = 0,\n\t sum = 0,\n\t yStart1 = 0,\n\t yStart2 = 0,\n\t xStart1 = 0,\n\t xStart2 = 0,\n\t offset = 0;\n\t\n\t for (v = 1; (v | 0) < (size - 1 | 0); v = v + 1 | 0) {\n\t offset = offset + size | 0;\n\t for (u = 1; (u | 0) < (size - 1 | 0); u = u + 1 | 0) {\n\t yStart1 = offset - size | 0;\n\t yStart2 = offset + size | 0;\n\t xStart1 = u - 1 | 0;\n\t xStart2 = u + 1 | 0;\n\t sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0;\n\t if ((sum | 0) == (5 | 0)) {\n\t images[outImagePtr + offset + u | 0] = 1;\n\t } else {\n\t images[outImagePtr + offset + u | 0] = 0;\n\t }\n\t }\n\t }\n\t return;\n\t }\n\t\n\t function subtract(aImagePtr, bImagePtr, outImagePtr) {\n\t aImagePtr = aImagePtr | 0;\n\t bImagePtr = bImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[outImagePtr + length | 0] = (images[aImagePtr + length | 0] | 0) - (images[bImagePtr + length | 0] | 0) | 0;\n\t }\n\t }\n\t\n\t function bitwiseOr(aImagePtr, bImagePtr, outImagePtr) {\n\t aImagePtr = aImagePtr | 0;\n\t bImagePtr = bImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[outImagePtr + length | 0] = images[aImagePtr + length | 0] | 0 | (images[bImagePtr + length | 0] | 0) | 0;\n\t }\n\t }\n\t\n\t function countNonZero(imagePtr) {\n\t imagePtr = imagePtr | 0;\n\t\n\t var sum = 0,\n\t length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t sum = (sum | 0) + (images[imagePtr + length | 0] | 0) | 0;\n\t }\n\t\n\t return sum | 0;\n\t }\n\t\n\t function init(imagePtr, value) {\n\t imagePtr = imagePtr | 0;\n\t value = value | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[imagePtr + length | 0] = value;\n\t }\n\t }\n\t\n\t function dilate(inImagePtr, outImagePtr) {\n\t inImagePtr = inImagePtr | 0;\n\t outImagePtr = outImagePtr | 0;\n\t\n\t var v = 0,\n\t u = 0,\n\t sum = 0,\n\t yStart1 = 0,\n\t yStart2 = 0,\n\t xStart1 = 0,\n\t xStart2 = 0,\n\t offset = 0;\n\t\n\t for (v = 1; (v | 0) < (size - 1 | 0); v = v + 1 | 0) {\n\t offset = offset + size | 0;\n\t for (u = 1; (u | 0) < (size - 1 | 0); u = u + 1 | 0) {\n\t yStart1 = offset - size | 0;\n\t yStart2 = offset + size | 0;\n\t xStart1 = u - 1 | 0;\n\t xStart2 = u + 1 | 0;\n\t sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0;\n\t if ((sum | 0) > (0 | 0)) {\n\t images[outImagePtr + offset + u | 0] = 1;\n\t } else {\n\t images[outImagePtr + offset + u | 0] = 0;\n\t }\n\t }\n\t }\n\t return;\n\t }\n\t\n\t function memcpy(srcImagePtr, dstImagePtr) {\n\t srcImagePtr = srcImagePtr | 0;\n\t dstImagePtr = dstImagePtr | 0;\n\t\n\t var length = 0;\n\t\n\t length = imul(size, size) | 0;\n\t\n\t while ((length | 0) > 0) {\n\t length = length - 1 | 0;\n\t images[dstImagePtr + length | 0] = images[srcImagePtr + length | 0] | 0;\n\t }\n\t }\n\t\n\t function zeroBorder(imagePtr) {\n\t imagePtr = imagePtr | 0;\n\t\n\t var x = 0,\n\t y = 0;\n\t\n\t for (x = 0; (x | 0) < (size - 1 | 0); x = x + 1 | 0) {\n\t images[imagePtr + x | 0] = 0;\n\t images[imagePtr + y | 0] = 0;\n\t y = y + size - 1 | 0;\n\t images[imagePtr + y | 0] = 0;\n\t y = y + 1 | 0;\n\t }\n\t for (x = 0; (x | 0) < (size | 0); x = x + 1 | 0) {\n\t images[imagePtr + y | 0] = 0;\n\t y = y + 1 | 0;\n\t }\n\t }\n\t\n\t function skeletonize() {\n\t var subImagePtr = 0,\n\t erodedImagePtr = 0,\n\t tempImagePtr = 0,\n\t skelImagePtr = 0,\n\t sum = 0,\n\t done = 0;\n\t\n\t erodedImagePtr = imul(size, size) | 0;\n\t tempImagePtr = erodedImagePtr + erodedImagePtr | 0;\n\t skelImagePtr = tempImagePtr + erodedImagePtr | 0;\n\t\n\t // init skel-image\n\t init(skelImagePtr, 0);\n\t zeroBorder(subImagePtr);\n\t\n\t do {\n\t erode(subImagePtr, erodedImagePtr);\n\t dilate(erodedImagePtr, tempImagePtr);\n\t subtract(subImagePtr, tempImagePtr, tempImagePtr);\n\t bitwiseOr(skelImagePtr, tempImagePtr, skelImagePtr);\n\t memcpy(erodedImagePtr, subImagePtr);\n\t sum = countNonZero(subImagePtr) | 0;\n\t done = (sum | 0) == 0 | 0;\n\t } while (!done);\n\t }\n\t\n\t return {\n\t skeletonize: skeletonize\n\t };\n\t}\n\t/* @preserve ASM END */\n\t\n\texports[\"default\"] = Skeletonizer;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports[\"default\"] = {\n\t drawRect: function drawRect(pos, size, ctx, style) {\n\t ctx.strokeStyle = style.color;\n\t ctx.fillStyle = style.color;\n\t ctx.lineWidth = 1;\n\t ctx.beginPath();\n\t ctx.strokeRect(pos.x, pos.y, size.x, size.y);\n\t },\n\t drawPath: function drawPath(path, def, ctx, style) {\n\t ctx.strokeStyle = style.color;\n\t ctx.fillStyle = style.color;\n\t ctx.lineWidth = style.lineWidth;\n\t ctx.beginPath();\n\t ctx.moveTo(path[0][def.x], path[0][def.y]);\n\t for (var j = 1; j < path.length; j++) {\n\t ctx.lineTo(path[j][def.x], path[j][def.y]);\n\t }\n\t ctx.closePath();\n\t ctx.stroke();\n\t },\n\t drawImage: function drawImage(imageData, size, ctx) {\n\t var canvasData = ctx.getImageData(0, 0, size.x, size.y),\n\t data = canvasData.data,\n\t imageDataPos = imageData.length,\n\t canvasDataPos = data.length,\n\t value;\n\t\n\t if (canvasDataPos / imageDataPos !== 4) {\n\t return false;\n\t }\n\t while (imageDataPos--) {\n\t value = imageData[imageDataPos];\n\t data[--canvasDataPos] = 255;\n\t data[--canvasDataPos] = value;\n\t data[--canvasDataPos] = value;\n\t data[--canvasDataPos] = value;\n\t }\n\t ctx.putImageData(canvasData, 0, 0);\n\t return true;\n\t }\n\t};\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _bresenham = __webpack_require__(26);\n\t\n\tvar _bresenham2 = _interopRequireDefault(_bresenham);\n\t\n\tvar _image_debug = __webpack_require__(24);\n\t\n\tvar _image_debug2 = _interopRequireDefault(_image_debug);\n\t\n\tvar _code_128_reader = __webpack_require__(27);\n\t\n\tvar _code_128_reader2 = _interopRequireDefault(_code_128_reader);\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tvar _code_39_reader = __webpack_require__(30);\n\t\n\tvar _code_39_reader2 = _interopRequireDefault(_code_39_reader);\n\t\n\tvar _code_39_vin_reader = __webpack_require__(31);\n\t\n\tvar _code_39_vin_reader2 = _interopRequireDefault(_code_39_vin_reader);\n\t\n\tvar _codabar_reader = __webpack_require__(32);\n\t\n\tvar _codabar_reader2 = _interopRequireDefault(_codabar_reader);\n\t\n\tvar _upc_reader = __webpack_require__(33);\n\t\n\tvar _upc_reader2 = _interopRequireDefault(_upc_reader);\n\t\n\tvar _ean_8_reader = __webpack_require__(34);\n\t\n\tvar _ean_8_reader2 = _interopRequireDefault(_ean_8_reader);\n\t\n\tvar _upc_e_reader = __webpack_require__(35);\n\t\n\tvar _upc_e_reader2 = _interopRequireDefault(_upc_e_reader);\n\t\n\tvar _i2of5_reader = __webpack_require__(36);\n\t\n\tvar _i2of5_reader2 = _interopRequireDefault(_i2of5_reader);\n\t\n\tvar readers = {\n\t code_128_reader: _code_128_reader2['default'],\n\t ean_reader: _ean_reader2['default'],\n\t ean_8_reader: _ean_8_reader2['default'],\n\t code_39_reader: _code_39_reader2['default'],\n\t code_39_vin_reader: _code_39_vin_reader2['default'],\n\t codabar_reader: _codabar_reader2['default'],\n\t upc_reader: _upc_reader2['default'],\n\t upc_e_reader: _upc_e_reader2['default'],\n\t i2of5_reader: _i2of5_reader2['default']\n\t};\n\texports['default'] = {\n\t create: function create(config, inputImageWrapper) {\n\t var _canvas = {\n\t ctx: {\n\t frequency: null,\n\t pattern: null,\n\t overlay: null\n\t },\n\t dom: {\n\t frequency: null,\n\t pattern: null,\n\t overlay: null\n\t }\n\t },\n\t _barcodeReaders = [];\n\t\n\t initCanvas();\n\t initReaders();\n\t initConfig();\n\t\n\t function initCanvas() {\n\t if (typeof document !== 'undefined') {\n\t var $debug = document.querySelector(\"#debug.detection\");\n\t _canvas.dom.frequency = document.querySelector(\"canvas.frequency\");\n\t if (!_canvas.dom.frequency) {\n\t _canvas.dom.frequency = document.createElement(\"canvas\");\n\t _canvas.dom.frequency.className = \"frequency\";\n\t if ($debug) {\n\t $debug.appendChild(_canvas.dom.frequency);\n\t }\n\t }\n\t _canvas.ctx.frequency = _canvas.dom.frequency.getContext(\"2d\");\n\t\n\t _canvas.dom.pattern = document.querySelector(\"canvas.patternBuffer\");\n\t if (!_canvas.dom.pattern) {\n\t _canvas.dom.pattern = document.createElement(\"canvas\");\n\t _canvas.dom.pattern.className = \"patternBuffer\";\n\t if ($debug) {\n\t $debug.appendChild(_canvas.dom.pattern);\n\t }\n\t }\n\t _canvas.ctx.pattern = _canvas.dom.pattern.getContext(\"2d\");\n\t\n\t _canvas.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n\t if (_canvas.dom.overlay) {\n\t _canvas.ctx.overlay = _canvas.dom.overlay.getContext(\"2d\");\n\t }\n\t }\n\t }\n\t\n\t function initReaders() {\n\t config.readers.forEach(function (readerConfig) {\n\t var reader,\n\t config = {};\n\t\n\t if (typeof readerConfig === 'object') {\n\t reader = readerConfig.format;\n\t config = readerConfig.config;\n\t } else if (typeof readerConfig === 'string') {\n\t reader = readerConfig;\n\t }\n\t _barcodeReaders.push(new readers[reader](config));\n\t });\n\t console.log(\"Registered Readers: \" + _barcodeReaders.map(function (reader) {\n\t return JSON.stringify({ format: reader.FORMAT, config: reader.config });\n\t }).join(', '));\n\t }\n\t\n\t function initConfig() {\n\t if (typeof document !== 'undefined') {\n\t var i,\n\t vis = [{\n\t node: _canvas.dom.frequency,\n\t prop: config.showFrequency\n\t }, {\n\t node: _canvas.dom.pattern,\n\t prop: config.showPattern\n\t }];\n\t\n\t for (i = 0; i < vis.length; i++) {\n\t if (vis[i].prop === true) {\n\t vis[i].node.style.display = \"block\";\n\t } else {\n\t vis[i].node.style.display = \"none\";\n\t }\n\t }\n\t }\n\t }\n\t\n\t /**\n\t * extend the line on both ends\n\t * @param {Array} line\n\t * @param {Number} angle\n\t */\n\t function getExtendedLine(line, angle, ext) {\n\t function extendLine(amount) {\n\t var extension = {\n\t y: amount * Math.sin(angle),\n\t x: amount * Math.cos(angle)\n\t };\n\t\n\t line[0].y -= extension.y;\n\t line[0].x -= extension.x;\n\t line[1].y += extension.y;\n\t line[1].x += extension.x;\n\t }\n\t\n\t // check if inside image\n\t extendLine(ext);\n\t while (ext > 1 && (!inputImageWrapper.inImageWithBorder(line[0], 0) || !inputImageWrapper.inImageWithBorder(line[1], 0))) {\n\t ext -= Math.ceil(ext / 2);\n\t extendLine(-ext);\n\t }\n\t return line;\n\t }\n\t\n\t function getLine(box) {\n\t return [{\n\t x: (box[1][0] - box[0][0]) / 2 + box[0][0],\n\t y: (box[1][1] - box[0][1]) / 2 + box[0][1]\n\t }, {\n\t x: (box[3][0] - box[2][0]) / 2 + box[2][0],\n\t y: (box[3][1] - box[2][1]) / 2 + box[2][1]\n\t }];\n\t }\n\t\n\t function tryDecode(line) {\n\t var result = null,\n\t i,\n\t barcodeLine = _bresenham2['default'].getBarcodeLine(inputImageWrapper, line[0], line[1]);\n\t\n\t if (config.showFrequency) {\n\t _image_debug2['default'].drawPath(line, { x: 'x', y: 'y' }, _canvas.ctx.overlay, { color: 'red', lineWidth: 3 });\n\t _bresenham2['default'].debug.printFrequency(barcodeLine.line, _canvas.dom.frequency);\n\t }\n\t _bresenham2['default'].toBinaryLine(barcodeLine);\n\t if (config.showPattern) {\n\t _bresenham2['default'].debug.printPattern(barcodeLine.line, _canvas.dom.pattern);\n\t }\n\t\n\t for (i = 0; i < _barcodeReaders.length && result === null; i++) {\n\t result = _barcodeReaders[i].decodePattern(barcodeLine.line);\n\t }\n\t if (result === null) {\n\t return null;\n\t }\n\t return {\n\t codeResult: result,\n\t barcodeLine: barcodeLine\n\t };\n\t }\n\t\n\t /**\n\t * This method slices the given area apart and tries to detect a barcode-pattern\n\t * for each slice. It returns the decoded barcode, or null if nothing was found\n\t * @param {Array} box\n\t * @param {Array} line\n\t * @param {Number} lineAngle\n\t */\n\t function tryDecodeBruteForce(box, line, lineAngle) {\n\t var sideLength = Math.sqrt(Math.pow(box[1][0] - box[0][0], 2) + Math.pow(box[1][1] - box[0][1], 2)),\n\t i,\n\t slices = 16,\n\t result = null,\n\t dir,\n\t extension,\n\t xdir = Math.sin(lineAngle),\n\t ydir = Math.cos(lineAngle);\n\t\n\t for (i = 1; i < slices && result === null; i++) {\n\t // move line perpendicular to angle\n\t dir = sideLength / slices * i * (i % 2 === 0 ? -1 : 1);\n\t extension = {\n\t y: dir * xdir,\n\t x: dir * ydir\n\t };\n\t line[0].y += extension.x;\n\t line[0].x -= extension.y;\n\t line[1].y += extension.x;\n\t line[1].x -= extension.y;\n\t\n\t result = tryDecode(line);\n\t }\n\t return result;\n\t }\n\t\n\t function getLineLength(line) {\n\t return Math.sqrt(Math.pow(Math.abs(line[1].y - line[0].y), 2) + Math.pow(Math.abs(line[1].x - line[0].x), 2));\n\t }\n\t\n\t /**\n\t * With the help of the configured readers (Code128 or EAN) this function tries to detect a\n\t * valid barcode pattern within the given area.\n\t * @param {Object} box The area to search in\n\t * @returns {Object} the result {codeResult, line, angle, pattern, threshold}\n\t */\n\t function _decodeFromBoundingBox(box) {\n\t var line,\n\t lineAngle,\n\t ctx = _canvas.ctx.overlay,\n\t result,\n\t lineLength;\n\t\n\t if (config.drawBoundingBox && ctx) {\n\t _image_debug2['default'].drawPath(box, { x: 0, y: 1 }, ctx, { color: \"blue\", lineWidth: 2 });\n\t }\n\t\n\t line = getLine(box);\n\t lineLength = getLineLength(line);\n\t lineAngle = Math.atan2(line[1].y - line[0].y, line[1].x - line[0].x);\n\t line = getExtendedLine(line, lineAngle, Math.floor(lineLength * 0.1));\n\t if (line === null) {\n\t return null;\n\t }\n\t\n\t result = tryDecode(line);\n\t if (result === null) {\n\t result = tryDecodeBruteForce(box, line, lineAngle);\n\t }\n\t\n\t if (result === null) {\n\t return null;\n\t }\n\t\n\t if (result && config.drawScanline && ctx) {\n\t _image_debug2['default'].drawPath(line, { x: 'x', y: 'y' }, ctx, { color: 'red', lineWidth: 3 });\n\t }\n\t\n\t return {\n\t codeResult: result.codeResult,\n\t line: line,\n\t angle: lineAngle,\n\t pattern: result.barcodeLine.line,\n\t threshold: result.barcodeLine.threshold\n\t };\n\t }\n\t\n\t return {\n\t decodeFromBoundingBox: function decodeFromBoundingBox(box) {\n\t return _decodeFromBoundingBox(box);\n\t },\n\t decodeFromBoundingBoxes: function decodeFromBoundingBoxes(boxes) {\n\t var i, result;\n\t for (i = 0; i < boxes.length; i++) {\n\t result = _decodeFromBoundingBox(boxes[i]);\n\t if (result && result.codeResult) {\n\t result.box = boxes[i];\n\t return result;\n\t }\n\t }\n\t },\n\t setReaders: function setReaders(readers) {\n\t config.readers = readers;\n\t _barcodeReaders.length = 0;\n\t initReaders();\n\t }\n\t };\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _cv_utils = __webpack_require__(7);\n\t\n\tvar _cv_utils2 = _interopRequireDefault(_cv_utils);\n\t\n\tvar _image_wrapper = __webpack_require__(5);\n\t\n\tvar _image_wrapper2 = _interopRequireDefault(_image_wrapper);\n\t\n\tvar Bresenham = {};\n\t\n\tvar Slope = {\n\t DIR: {\n\t UP: 1,\n\t DOWN: -1\n\t }\n\t};\n\t/**\n\t * Scans a line of the given image from point p1 to p2 and returns a result object containing\n\t * gray-scale values (0-255) of the underlying pixels in addition to the min\n\t * and max values.\n\t * @param {Object} imageWrapper\n\t * @param {Object} p1 The start point {x,y}\n\t * @param {Object} p2 The end point {x,y}\n\t * @returns {line, min, max}\n\t */\n\tBresenham.getBarcodeLine = function (imageWrapper, p1, p2) {\n\t var x0 = p1.x | 0,\n\t y0 = p1.y | 0,\n\t x1 = p2.x | 0,\n\t y1 = p2.y | 0,\n\t steep = Math.abs(y1 - y0) > Math.abs(x1 - x0),\n\t deltax,\n\t deltay,\n\t error,\n\t ystep,\n\t y,\n\t tmp,\n\t x,\n\t line = [],\n\t imageData = imageWrapper.data,\n\t width = imageWrapper.size.x,\n\t sum = 0,\n\t val,\n\t min = 255,\n\t max = 0;\n\t\n\t function read(a, b) {\n\t val = imageData[b * width + a];\n\t sum += val;\n\t min = val < min ? val : min;\n\t max = val > max ? val : max;\n\t line.push(val);\n\t }\n\t\n\t if (steep) {\n\t tmp = x0;\n\t x0 = y0;\n\t y0 = tmp;\n\t\n\t tmp = x1;\n\t x1 = y1;\n\t y1 = tmp;\n\t }\n\t if (x0 > x1) {\n\t tmp = x0;\n\t x0 = x1;\n\t x1 = tmp;\n\t\n\t tmp = y0;\n\t y0 = y1;\n\t y1 = tmp;\n\t }\n\t deltax = x1 - x0;\n\t deltay = Math.abs(y1 - y0);\n\t error = deltax / 2 | 0;\n\t y = y0;\n\t ystep = y0 < y1 ? 1 : -1;\n\t for (x = x0; x < x1; x++) {\n\t if (steep) {\n\t read(y, x);\n\t } else {\n\t read(x, y);\n\t }\n\t error = error - deltay;\n\t if (error < 0) {\n\t y = y + ystep;\n\t error = error + deltax;\n\t }\n\t }\n\t\n\t return {\n\t line: line,\n\t min: min,\n\t max: max\n\t };\n\t};\n\t\n\tBresenham.toOtsuBinaryLine = function (result) {\n\t var line = result.line,\n\t image = new _image_wrapper2['default']({ x: line.length - 1, y: 1 }, line),\n\t threshold = _cv_utils2['default'].determineOtsuThreshold(image, 5);\n\t\n\t line = _cv_utils2['default'].sharpenLine(line);\n\t _cv_utils2['default'].thresholdImage(image, threshold);\n\t\n\t return {\n\t line: line,\n\t threshold: threshold\n\t };\n\t};\n\t\n\t/**\n\t * Converts the result from getBarcodeLine into a binary representation\n\t * also considering the frequency and slope of the signal for more robust results\n\t * @param {Object} result {line, min, max}\n\t */\n\tBresenham.toBinaryLine = function (result) {\n\t\n\t var min = result.min,\n\t max = result.max,\n\t line = result.line,\n\t slope,\n\t slope2,\n\t center = min + (max - min) / 2,\n\t extrema = [],\n\t currentDir,\n\t dir,\n\t threshold = (max - min) / 12,\n\t rThreshold = -threshold,\n\t i,\n\t j;\n\t\n\t // 1. find extrema\n\t currentDir = line[0] > center ? Slope.DIR.UP : Slope.DIR.DOWN;\n\t extrema.push({\n\t pos: 0,\n\t val: line[0]\n\t });\n\t for (i = 0; i < line.length - 2; i++) {\n\t slope = line[i + 1] - line[i];\n\t slope2 = line[i + 2] - line[i + 1];\n\t if (slope + slope2 < rThreshold && line[i + 1] < center * 1.5) {\n\t dir = Slope.DIR.DOWN;\n\t } else if (slope + slope2 > threshold && line[i + 1] > center * 0.5) {\n\t dir = Slope.DIR.UP;\n\t } else {\n\t dir = currentDir;\n\t }\n\t\n\t if (currentDir !== dir) {\n\t extrema.push({\n\t pos: i,\n\t val: line[i]\n\t });\n\t currentDir = dir;\n\t }\n\t }\n\t extrema.push({\n\t pos: line.length,\n\t val: line[line.length - 1]\n\t });\n\t\n\t for (j = extrema[0].pos; j < extrema[1].pos; j++) {\n\t line[j] = line[j] > center ? 0 : 1;\n\t }\n\t\n\t // iterate over extrema and convert to binary based on avg between minmax\n\t for (i = 1; i < extrema.length - 1; i++) {\n\t if (extrema[i + 1].val > extrema[i].val) {\n\t threshold = extrema[i].val + (extrema[i + 1].val - extrema[i].val) / 3 * 2 | 0;\n\t } else {\n\t threshold = extrema[i + 1].val + (extrema[i].val - extrema[i + 1].val) / 3 | 0;\n\t }\n\t\n\t for (j = extrema[i].pos; j < extrema[i + 1].pos; j++) {\n\t line[j] = line[j] > threshold ? 0 : 1;\n\t }\n\t }\n\t\n\t return {\n\t line: line,\n\t threshold: threshold\n\t };\n\t};\n\t\n\t/**\n\t * Used for development only\n\t */\n\tBresenham.debug = {\n\t printFrequency: function printFrequency(line, canvas) {\n\t var i,\n\t ctx = canvas.getContext(\"2d\");\n\t canvas.width = line.length;\n\t canvas.height = 256;\n\t\n\t ctx.beginPath();\n\t ctx.strokeStyle = \"blue\";\n\t for (i = 0; i < line.length; i++) {\n\t ctx.moveTo(i, 255);\n\t ctx.lineTo(i, 255 - line[i]);\n\t }\n\t ctx.stroke();\n\t ctx.closePath();\n\t },\n\t\n\t printPattern: function printPattern(line, canvas) {\n\t var ctx = canvas.getContext(\"2d\"),\n\t i;\n\t\n\t canvas.width = line.length;\n\t ctx.fillColor = \"black\";\n\t for (i = 0; i < line.length; i++) {\n\t if (line[i] === 1) {\n\t ctx.fillRect(i, 0, 1, 100);\n\t }\n\t }\n\t }\n\t};\n\t\n\texports['default'] = Bresenham;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tfunction Code128Reader() {\n\t _barcode_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t CODE_SHIFT: { value: 98 },\n\t CODE_C: { value: 99 },\n\t CODE_B: { value: 100 },\n\t CODE_A: { value: 101 },\n\t START_CODE_A: { value: 103 },\n\t START_CODE_B: { value: 104 },\n\t START_CODE_C: { value: 105 },\n\t STOP_CODE: { value: 106 },\n\t MODULO: { value: 11 },\n\t CODE_PATTERN: { value: [[2, 1, 2, 2, 2, 2], [2, 2, 2, 1, 2, 2], [2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 3], [1, 2, 1, 3, 2, 2], [1, 3, 1, 2, 2, 2], [1, 2, 2, 2, 1, 3], [1, 2, 2, 3, 1, 2], [1, 3, 2, 2, 1, 2], [2, 2, 1, 2, 1, 3], [2, 2, 1, 3, 1, 2], [2, 3, 1, 2, 1, 2], [1, 1, 2, 2, 3, 2], [1, 2, 2, 1, 3, 2], [1, 2, 2, 2, 3, 1], [1, 1, 3, 2, 2, 2], [1, 2, 3, 1, 2, 2], [1, 2, 3, 2, 2, 1], [2, 2, 3, 2, 1, 1], [2, 2, 1, 1, 3, 2], [2, 2, 1, 2, 3, 1], [2, 1, 3, 2, 1, 2], [2, 2, 3, 1, 1, 2], [3, 1, 2, 1, 3, 1], [3, 1, 1, 2, 2, 2], [3, 2, 1, 1, 2, 2], [3, 2, 1, 2, 2, 1], [3, 1, 2, 2, 1, 2], [3, 2, 2, 1, 1, 2], [3, 2, 2, 2, 1, 1], [2, 1, 2, 1, 2, 3], [2, 1, 2, 3, 2, 1], [2, 3, 2, 1, 2, 1], [1, 1, 1, 3, 2, 3], [1, 3, 1, 1, 2, 3], [1, 3, 1, 3, 2, 1], [1, 1, 2, 3, 1, 3], [1, 3, 2, 1, 1, 3], [1, 3, 2, 3, 1, 1], [2, 1, 1, 3, 1, 3], [2, 3, 1, 1, 1, 3], [2, 3, 1, 3, 1, 1], [1, 1, 2, 1, 3, 3], [1, 1, 2, 3, 3, 1], [1, 3, 2, 1, 3, 1], [1, 1, 3, 1, 2, 3], [1, 1, 3, 3, 2, 1], [1, 3, 3, 1, 2, 1], [3, 1, 3, 1, 2, 1], [2, 1, 1, 3, 3, 1], [2, 3, 1, 1, 3, 1], [2, 1, 3, 1, 1, 3], [2, 1, 3, 3, 1, 1], [2, 1, 3, 1, 3, 1], [3, 1, 1, 1, 2, 3], [3, 1, 1, 3, 2, 1], [3, 3, 1, 1, 2, 1], [3, 1, 2, 1, 1, 3], [3, 1, 2, 3, 1, 1], [3, 3, 2, 1, 1, 1], [3, 1, 4, 1, 1, 1], [2, 2, 1, 4, 1, 1], [4, 3, 1, 1, 1, 1], [1, 1, 1, 2, 2, 4], [1, 1, 1, 4, 2, 2], [1, 2, 1, 1, 2, 4], [1, 2, 1, 4, 2, 1], [1, 4, 1, 1, 2, 2], [1, 4, 1, 2, 2, 1], [1, 1, 2, 2, 1, 4], [1, 1, 2, 4, 1, 2], [1, 2, 2, 1, 1, 4], [1, 2, 2, 4, 1, 1], [1, 4, 2, 1, 1, 2], [1, 4, 2, 2, 1, 1], [2, 4, 1, 2, 1, 1], [2, 2, 1, 1, 1, 4], [4, 1, 3, 1, 1, 1], [2, 4, 1, 1, 1, 2], [1, 3, 4, 1, 1, 1], [1, 1, 1, 2, 4, 2], [1, 2, 1, 1, 4, 2], [1, 2, 1, 2, 4, 1], [1, 1, 4, 2, 1, 2], [1, 2, 4, 1, 1, 2], [1, 2, 4, 2, 1, 1], [4, 1, 1, 2, 1, 2], [4, 2, 1, 1, 1, 2], [4, 2, 1, 2, 1, 1], [2, 1, 2, 1, 4, 1], [2, 1, 4, 1, 2, 1], [4, 1, 2, 1, 2, 1], [1, 1, 1, 1, 4, 3], [1, 1, 1, 3, 4, 1], [1, 3, 1, 1, 4, 1], [1, 1, 4, 1, 1, 3], [1, 1, 4, 3, 1, 1], [4, 1, 1, 1, 1, 3], [4, 1, 1, 3, 1, 1], [1, 1, 3, 1, 4, 1], [1, 1, 4, 1, 3, 1], [3, 1, 1, 1, 4, 1], [4, 1, 1, 1, 3, 1], [2, 1, 1, 4, 1, 2], [2, 1, 1, 2, 1, 4], [2, 1, 1, 2, 3, 2], [2, 3, 3, 1, 1, 1, 2]] },\n\t SINGLE_CODE_ERROR: { value: 1 },\n\t AVG_CODE_ERROR: { value: 0.5 },\n\t FORMAT: { value: \"code_128\", writeable: false }\n\t};\n\t\n\tCode128Reader.prototype = Object.create(_barcode_reader2[\"default\"].prototype, properties);\n\tCode128Reader.prototype.constructor = Code128Reader;\n\t\n\tCode128Reader.prototype._decodeCode = function (start) {\n\t var counter = [0, 0, 0, 0, 0, 0],\n\t i,\n\t self = this,\n\t offset = start,\n\t isWhite = !self._row[offset],\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: start,\n\t end: start\n\t },\n\t code,\n\t error,\n\t normalized;\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = 0; code < self.CODE_PATTERN.length; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tCode128Reader.prototype._findStart = function () {\n\t var counter = [0, 0, 0, 0, 0, 0],\n\t i,\n\t self = this,\n\t offset = self._nextSet(self._row),\n\t isWhite = false,\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t },\n\t code,\n\t error,\n\t j,\n\t sum,\n\t normalized;\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t sum = 0;\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t if (bestMatch.error < self.AVG_CODE_ERROR) {\n\t bestMatch.start = i - sum;\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t }\n\t\n\t for (j = 0; j < 4; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[4] = 0;\n\t counter[5] = 0;\n\t counterPos--;\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tCode128Reader.prototype._decode = function () {\n\t var self = this,\n\t startInfo = self._findStart(),\n\t code = null,\n\t done = false,\n\t result = [],\n\t multiplier = 0,\n\t checksum = 0,\n\t codeset,\n\t rawResult = [],\n\t decodedCodes = [],\n\t shiftNext = false,\n\t unshift,\n\t lastCharacterWasPrintable;\n\t\n\t if (startInfo === null) {\n\t return null;\n\t }\n\t code = {\n\t code: startInfo.code,\n\t start: startInfo.start,\n\t end: startInfo.end\n\t };\n\t decodedCodes.push(code);\n\t checksum = code.code;\n\t switch (code.code) {\n\t case self.START_CODE_A:\n\t codeset = self.CODE_A;\n\t break;\n\t case self.START_CODE_B:\n\t codeset = self.CODE_B;\n\t break;\n\t case self.START_CODE_C:\n\t codeset = self.CODE_C;\n\t break;\n\t default:\n\t return null;\n\t }\n\t\n\t while (!done) {\n\t unshift = shiftNext;\n\t shiftNext = false;\n\t code = self._decodeCode(code.end);\n\t if (code !== null) {\n\t if (code.code !== self.STOP_CODE) {\n\t rawResult.push(code.code);\n\t multiplier++;\n\t checksum += multiplier * code.code;\n\t }\n\t decodedCodes.push(code);\n\t\n\t switch (codeset) {\n\t case self.CODE_A:\n\t if (code.code < 64) {\n\t result.push(String.fromCharCode(32 + code.code));\n\t } else if (code.code < 96) {\n\t result.push(String.fromCharCode(code.code - 64));\n\t } else {\n\t switch (code.code) {\n\t case self.CODE_SHIFT:\n\t shiftNext = true;\n\t codeset = self.CODE_B;\n\t break;\n\t case self.CODE_B:\n\t codeset = self.CODE_B;\n\t break;\n\t case self.CODE_C:\n\t codeset = self.CODE_C;\n\t break;\n\t case self.STOP_CODE:\n\t done = true;\n\t break;\n\t }\n\t }\n\t break;\n\t case self.CODE_B:\n\t if (code.code < 96) {\n\t result.push(String.fromCharCode(32 + code.code));\n\t } else {\n\t if (code.code != self.STOP_CODE) {\n\t lastCharacterWasPrintable = false;\n\t }\n\t switch (code.code) {\n\t case self.CODE_SHIFT:\n\t shiftNext = true;\n\t codeset = self.CODE_A;\n\t break;\n\t case self.CODE_A:\n\t codeset = self.CODE_A;\n\t break;\n\t case self.CODE_C:\n\t codeset = self.CODE_C;\n\t break;\n\t case self.STOP_CODE:\n\t done = true;\n\t break;\n\t }\n\t }\n\t break;\n\t case self.CODE_C:\n\t if (code.code < 100) {\n\t result.push(code.code < 10 ? \"0\" + code.code : code.code);\n\t }\n\t switch (code.code) {\n\t case self.CODE_A:\n\t codeset = self.CODE_A;\n\t break;\n\t case self.CODE_B:\n\t codeset = self.CODE_B;\n\t break;\n\t case self.STOP_CODE:\n\t done = true;\n\t break;\n\t }\n\t break;\n\t }\n\t } else {\n\t done = true;\n\t }\n\t if (unshift) {\n\t codeset = codeset == self.CODE_A ? self.CODE_B : self.CODE_A;\n\t }\n\t }\n\t\n\t if (code === null) {\n\t return null;\n\t }\n\t\n\t // find end bar\n\t code.end = self._nextUnset(self._row, code.end);\n\t if (!self._verifyTrailingWhitespace(code)) {\n\t return null;\n\t }\n\t\n\t // checksum\n\t // Does not work correctly yet!!! startcode - endcode?\n\t checksum -= multiplier * rawResult[rawResult.length - 1];\n\t if (checksum % 103 != rawResult[rawResult.length - 1]) {\n\t return null;\n\t }\n\t\n\t if (!result.length) {\n\t return null;\n\t }\n\t\n\t // remove last code from result (checksum)\n\t result.splice(result.length - 1, 1);\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: startInfo.start,\n\t end: code.end,\n\t codeset: codeset,\n\t startInfo: startInfo,\n\t decodedCodes: decodedCodes,\n\t endInfo: code\n\t };\n\t};\n\t\n\t_barcode_reader2[\"default\"].prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\texports[\"default\"] = Code128Reader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 28 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\tfunction BarcodeReader(config) {\n\t this._row = [];\n\t this.config = config || {};\n\t return this;\n\t}\n\t\n\tBarcodeReader.prototype._nextUnset = function (line, start) {\n\t var i;\n\t\n\t if (start === undefined) {\n\t start = 0;\n\t }\n\t for (i = start; i < line.length; i++) {\n\t if (!line[i]) {\n\t return i;\n\t }\n\t }\n\t return line.length;\n\t};\n\t\n\tBarcodeReader.prototype._matchPattern = function (counter, code) {\n\t var i,\n\t error = 0,\n\t singleError = 0,\n\t modulo = this.MODULO,\n\t maxSingleError = this.SINGLE_CODE_ERROR || 1;\n\t\n\t for (i = 0; i < counter.length; i++) {\n\t singleError = Math.abs(code[i] - counter[i]);\n\t if (singleError > maxSingleError) {\n\t return Number.MAX_VALUE;\n\t }\n\t error += singleError;\n\t }\n\t return error / modulo;\n\t};\n\t\n\tBarcodeReader.prototype._nextSet = function (line, offset) {\n\t var i;\n\t\n\t offset = offset || 0;\n\t for (i = offset; i < line.length; i++) {\n\t if (line[i]) {\n\t return i;\n\t }\n\t }\n\t return line.length;\n\t};\n\t\n\tBarcodeReader.prototype._normalize = function (counter, modulo) {\n\t var i,\n\t self = this,\n\t sum = 0,\n\t ratio,\n\t numOnes = 0,\n\t normalized = [],\n\t norm = 0;\n\t\n\t if (!modulo) {\n\t modulo = self.MODULO;\n\t }\n\t for (i = 0; i < counter.length; i++) {\n\t if (counter[i] === 1) {\n\t numOnes++;\n\t } else {\n\t sum += counter[i];\n\t }\n\t }\n\t ratio = sum / (modulo - numOnes);\n\t if (ratio > 1.0) {\n\t for (i = 0; i < counter.length; i++) {\n\t norm = counter[i] === 1 ? counter[i] : counter[i] / ratio;\n\t normalized.push(norm);\n\t }\n\t } else {\n\t ratio = (sum + numOnes) / modulo;\n\t for (i = 0; i < counter.length; i++) {\n\t norm = counter[i] / ratio;\n\t normalized.push(norm);\n\t }\n\t }\n\t return normalized;\n\t};\n\t\n\tBarcodeReader.prototype._matchTrace = function (cmpCounter, epsilon) {\n\t var counter = [],\n\t i,\n\t self = this,\n\t offset = self._nextSet(self._row),\n\t isWhite = !self._row[offset],\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0\n\t },\n\t error;\n\t\n\t if (cmpCounter) {\n\t for (i = 0; i < cmpCounter.length; i++) {\n\t counter.push(0);\n\t }\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t error = self._matchPattern(counter, cmpCounter);\n\t\n\t if (error < epsilon) {\n\t bestMatch.start = i - offset;\n\t bestMatch.end = i;\n\t bestMatch.counter = counter;\n\t return bestMatch;\n\t } else {\n\t return null;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t } else {\n\t counter.push(0);\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t counterPos++;\n\t counter.push(0);\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t }\n\t\n\t // if cmpCounter was not given\n\t bestMatch.start = offset;\n\t bestMatch.end = self._row.length - 1;\n\t bestMatch.counter = counter;\n\t return bestMatch;\n\t};\n\t\n\tBarcodeReader.prototype.decodePattern = function (pattern) {\n\t var self = this,\n\t result;\n\t\n\t self._row = pattern;\n\t result = self._decode();\n\t if (result === null) {\n\t self._row.reverse();\n\t result = self._decode();\n\t if (result) {\n\t result.direction = BarcodeReader.DIRECTION.REVERSE;\n\t result.start = self._row.length - result.start;\n\t result.end = self._row.length - result.end;\n\t }\n\t } else {\n\t result.direction = BarcodeReader.DIRECTION.FORWARD;\n\t }\n\t if (result) {\n\t result.format = self.FORMAT;\n\t }\n\t return result;\n\t};\n\t\n\tBarcodeReader.prototype._matchRange = function (start, end, value) {\n\t var i;\n\t\n\t start = start < 0 ? 0 : start;\n\t for (i = start; i < end; i++) {\n\t if (this._row[i] !== value) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t};\n\t\n\tBarcodeReader.prototype._fillCounters = function (offset, end, isWhite) {\n\t var self = this,\n\t counterPos = 0,\n\t i,\n\t counters = [];\n\t\n\t isWhite = typeof isWhite !== 'undefined' ? isWhite : true;\n\t offset = typeof offset !== 'undefined' ? offset : self._nextUnset(self._row);\n\t end = end || self._row.length;\n\t\n\t counters[counterPos] = 0;\n\t for (i = offset; i < end; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counters[counterPos]++;\n\t } else {\n\t counterPos++;\n\t counters[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return counters;\n\t};\n\t\n\tObject.defineProperty(BarcodeReader.prototype, \"FORMAT\", {\n\t value: 'unknown',\n\t writeable: false\n\t});\n\t\n\tBarcodeReader.DIRECTION = {\n\t FORWARD: 1,\n\t REVERSE: -1\n\t};\n\t\n\tBarcodeReader.Exception = {\n\t StartNotFoundException: \"Start-Info was not found!\",\n\t CodeNotFoundException: \"Code could not be found!\",\n\t PatternNotFoundException: \"Pattern could not be found!\"\n\t};\n\t\n\tBarcodeReader.CONFIG_KEYS = {};\n\t\n\texports['default'] = BarcodeReader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tfunction EANReader(opts) {\n\t _barcode_reader2[\"default\"].call(this, opts);\n\t}\n\t\n\tvar properties = {\n\t CODE_L_START: { value: 0 },\n\t MODULO: { value: 7 },\n\t CODE_G_START: { value: 10 },\n\t START_PATTERN: { value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7] },\n\t STOP_PATTERN: { value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7] },\n\t MIDDLE_PATTERN: { value: [1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7] },\n\t CODE_PATTERN: { value: [[3, 2, 1, 1], [2, 2, 2, 1], [2, 1, 2, 2], [1, 4, 1, 1], [1, 1, 3, 2], [1, 2, 3, 1], [1, 1, 1, 4], [1, 3, 1, 2], [1, 2, 1, 3], [3, 1, 1, 2], [1, 1, 2, 3], [1, 2, 2, 2], [2, 2, 1, 2], [1, 1, 4, 1], [2, 3, 1, 1], [1, 3, 2, 1], [4, 1, 1, 1], [2, 1, 3, 1], [3, 1, 2, 1], [2, 1, 1, 3]] },\n\t CODE_FREQUENCY: { value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26] },\n\t SINGLE_CODE_ERROR: { value: 0.67 },\n\t AVG_CODE_ERROR: { value: 0.27 },\n\t FORMAT: { value: \"ean_13\", writeable: false }\n\t};\n\t\n\tEANReader.prototype = Object.create(_barcode_reader2[\"default\"].prototype, properties);\n\tEANReader.prototype.constructor = EANReader;\n\t\n\tEANReader.prototype._decodeCode = function (start, coderange) {\n\t var counter = [0, 0, 0, 0],\n\t i,\n\t self = this,\n\t offset = start,\n\t isWhite = !self._row[offset],\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: start,\n\t end: start\n\t },\n\t code,\n\t error,\n\t normalized;\n\t\n\t if (!coderange) {\n\t coderange = self.CODE_PATTERN.length;\n\t }\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = 0; code < coderange; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t bestMatch.end = i;\n\t if (bestMatch.error > self.AVG_CODE_ERROR) {\n\t return null;\n\t }\n\t return bestMatch;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._findPattern = function (pattern, offset, isWhite, tryHarder, epsilon) {\n\t var counter = [],\n\t self = this,\n\t i,\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t },\n\t error,\n\t j,\n\t sum,\n\t normalized;\n\t\n\t if (!offset) {\n\t offset = self._nextSet(self._row);\n\t }\n\t\n\t if (isWhite === undefined) {\n\t isWhite = false;\n\t }\n\t\n\t if (tryHarder === undefined) {\n\t tryHarder = true;\n\t }\n\t\n\t if (epsilon === undefined) {\n\t epsilon = self.AVG_CODE_ERROR;\n\t }\n\t\n\t for (i = 0; i < pattern.length; i++) {\n\t counter[i] = 0;\n\t }\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t sum = 0;\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t error = self._matchPattern(normalized, pattern);\n\t\n\t if (error < epsilon) {\n\t bestMatch.error = error;\n\t bestMatch.start = i - sum;\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t }\n\t if (tryHarder) {\n\t for (j = 0; j < counter.length - 2; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[counter.length - 2] = 0;\n\t counter[counter.length - 1] = 0;\n\t counterPos--;\n\t } else {\n\t return null;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._findStart = function () {\n\t var self = this,\n\t leadingWhitespaceStart,\n\t offset = self._nextSet(self._row),\n\t startInfo;\n\t\n\t while (!startInfo) {\n\t startInfo = self._findPattern(self.START_PATTERN, offset);\n\t if (!startInfo) {\n\t return null;\n\t }\n\t leadingWhitespaceStart = startInfo.start - (startInfo.end - startInfo.start);\n\t if (leadingWhitespaceStart >= 0) {\n\t if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n\t return startInfo;\n\t }\n\t }\n\t offset = startInfo.end;\n\t startInfo = null;\n\t }\n\t};\n\t\n\tEANReader.prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start);\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._findEnd = function (offset, isWhite) {\n\t var self = this,\n\t endInfo = self._findPattern(self.STOP_PATTERN, offset, isWhite, false);\n\t\n\t return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n\t};\n\t\n\tEANReader.prototype._calculateFirstDigit = function (codeFrequency) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < self.CODE_FREQUENCY.length; i++) {\n\t if (codeFrequency === self.CODE_FREQUENCY[i]) {\n\t return i;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tEANReader.prototype._decodePayload = function (code, result, decodedCodes) {\n\t var i,\n\t self = this,\n\t codeFrequency = 0x0,\n\t firstDigit;\n\t\n\t for (i = 0; i < 6; i++) {\n\t code = self._decodeCode(code.end);\n\t if (!code) {\n\t return null;\n\t }\n\t if (code.code >= self.CODE_G_START) {\n\t code.code = code.code - self.CODE_G_START;\n\t codeFrequency |= 1 << 5 - i;\n\t } else {\n\t codeFrequency |= 0 << 5 - i;\n\t }\n\t result.push(code.code);\n\t decodedCodes.push(code);\n\t }\n\t\n\t firstDigit = self._calculateFirstDigit(codeFrequency);\n\t if (firstDigit === null) {\n\t return null;\n\t }\n\t result.unshift(firstDigit);\n\t\n\t code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n\t if (code === null) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t\n\t for (i = 0; i < 6; i++) {\n\t code = self._decodeCode(code.end, self.CODE_G_START);\n\t if (!code) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t result.push(code.code);\n\t }\n\t\n\t return code;\n\t};\n\t\n\tEANReader.prototype._decode = function () {\n\t var startInfo,\n\t self = this,\n\t code,\n\t result = [],\n\t decodedCodes = [];\n\t\n\t startInfo = self._findStart();\n\t if (!startInfo) {\n\t return null;\n\t }\n\t code = {\n\t code: startInfo.code,\n\t start: startInfo.start,\n\t end: startInfo.end\n\t };\n\t decodedCodes.push(code);\n\t code = self._decodePayload(code, result, decodedCodes);\n\t if (!code) {\n\t return null;\n\t }\n\t code = self._findEnd(code.end, false);\n\t if (!code) {\n\t return null;\n\t }\n\t\n\t decodedCodes.push(code);\n\t\n\t // Checksum\n\t if (!self._checksum(result)) {\n\t return null;\n\t }\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: startInfo.start,\n\t end: code.end,\n\t codeset: \"\",\n\t startInfo: startInfo,\n\t decodedCodes: decodedCodes\n\t };\n\t};\n\t\n\tEANReader.prototype._checksum = function (result) {\n\t var sum = 0,\n\t i;\n\t\n\t for (i = result.length - 2; i >= 0; i -= 2) {\n\t sum += result[i];\n\t }\n\t sum *= 3;\n\t for (i = result.length - 1; i >= 0; i -= 2) {\n\t sum += result[i];\n\t }\n\t return sum % 10 === 0;\n\t};\n\t\n\texports[\"default\"] = EANReader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tvar _array_helper = __webpack_require__(19);\n\t\n\tvar _array_helper2 = _interopRequireDefault(_array_helper);\n\t\n\tfunction Code39Reader() {\n\t _barcode_reader2['default'].call(this);\n\t}\n\t\n\tvar properties = {\n\t ALPHABETH_STRING: { value: \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%\" },\n\t ALPHABET: { value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 45, 46, 32, 42, 36, 47, 43, 37] },\n\t CHARACTER_ENCODINGS: { value: [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A] },\n\t ASTERISK: { value: 0x094 },\n\t FORMAT: { value: \"code_39\", writeable: false }\n\t};\n\t\n\tCode39Reader.prototype = Object.create(_barcode_reader2['default'].prototype, properties);\n\tCode39Reader.prototype.constructor = Code39Reader;\n\t\n\tCode39Reader.prototype._toCounters = function (start, counter) {\n\t var self = this,\n\t numCounters = counter.length,\n\t end = self._row.length,\n\t isWhite = !self._row[start],\n\t i,\n\t counterPos = 0;\n\t\n\t _array_helper2['default'].init(counter, 0);\n\t\n\t for (i = start; i < end; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t counterPos++;\n\t if (counterPos === numCounters) {\n\t break;\n\t } else {\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t }\n\t\n\t return counter;\n\t};\n\t\n\tCode39Reader.prototype._decode = function () {\n\t var self = this,\n\t counters = [0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t result = [],\n\t start = self._findStart(),\n\t decodedChar,\n\t lastStart,\n\t pattern,\n\t nextStart;\n\t\n\t if (!start) {\n\t return null;\n\t }\n\t nextStart = self._nextSet(self._row, start.end);\n\t\n\t do {\n\t counters = self._toCounters(nextStart, counters);\n\t pattern = self._toPattern(counters);\n\t if (pattern < 0) {\n\t return null;\n\t }\n\t decodedChar = self._patternToChar(pattern);\n\t if (decodedChar < 0) {\n\t return null;\n\t }\n\t result.push(decodedChar);\n\t lastStart = nextStart;\n\t nextStart += _array_helper2['default'].sum(counters);\n\t nextStart = self._nextSet(self._row, nextStart);\n\t } while (decodedChar !== '*');\n\t result.pop();\n\t\n\t if (!result.length) {\n\t return null;\n\t }\n\t\n\t if (!self._verifyTrailingWhitespace(lastStart, nextStart, counters)) {\n\t return null;\n\t }\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: start.start,\n\t end: nextStart,\n\t startInfo: start,\n\t decodedCodes: result\n\t };\n\t};\n\t\n\tCode39Reader.prototype._verifyTrailingWhitespace = function (lastStart, nextStart, counters) {\n\t var trailingWhitespaceEnd,\n\t patternSize = _array_helper2['default'].sum(counters);\n\t\n\t trailingWhitespaceEnd = nextStart - lastStart - patternSize;\n\t if (trailingWhitespaceEnd * 3 >= patternSize) {\n\t return true;\n\t }\n\t return false;\n\t};\n\t\n\tCode39Reader.prototype._patternToChar = function (pattern) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n\t if (self.CHARACTER_ENCODINGS[i] === pattern) {\n\t return String.fromCharCode(self.ALPHABET[i]);\n\t }\n\t }\n\t};\n\t\n\tCode39Reader.prototype._findNextWidth = function (counters, current) {\n\t var i,\n\t minWidth = Number.MAX_VALUE;\n\t\n\t for (i = 0; i < counters.length; i++) {\n\t if (counters[i] < minWidth && counters[i] > current) {\n\t minWidth = counters[i];\n\t }\n\t }\n\t\n\t return minWidth;\n\t};\n\t\n\tCode39Reader.prototype._toPattern = function (counters) {\n\t var numCounters = counters.length,\n\t maxNarrowWidth = 0,\n\t numWideBars = numCounters,\n\t wideBarWidth = 0,\n\t self = this,\n\t pattern,\n\t i;\n\t\n\t while (numWideBars > 3) {\n\t maxNarrowWidth = self._findNextWidth(counters, maxNarrowWidth);\n\t numWideBars = 0;\n\t pattern = 0;\n\t for (i = 0; i < numCounters; i++) {\n\t if (counters[i] > maxNarrowWidth) {\n\t pattern |= 1 << numCounters - 1 - i;\n\t numWideBars++;\n\t wideBarWidth += counters[i];\n\t }\n\t }\n\t\n\t if (numWideBars === 3) {\n\t for (i = 0; i < numCounters && numWideBars > 0; i++) {\n\t if (counters[i] > maxNarrowWidth) {\n\t numWideBars--;\n\t if (counters[i] * 2 >= wideBarWidth) {\n\t return -1;\n\t }\n\t }\n\t }\n\t return pattern;\n\t }\n\t }\n\t return -1;\n\t};\n\t\n\tCode39Reader.prototype._findStart = function () {\n\t var self = this,\n\t offset = self._nextSet(self._row),\n\t patternStart = offset,\n\t counter = [0, 0, 0, 0, 0, 0, 0, 0, 0],\n\t counterPos = 0,\n\t isWhite = false,\n\t i,\n\t j,\n\t whiteSpaceMustStart;\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t\n\t // find start pattern\n\t if (self._toPattern(counter) === self.ASTERISK) {\n\t whiteSpaceMustStart = Math.floor(Math.max(0, patternStart - (i - patternStart) / 4));\n\t if (self._matchRange(whiteSpaceMustStart, patternStart, 0)) {\n\t return {\n\t start: patternStart,\n\t end: i\n\t };\n\t }\n\t }\n\t\n\t patternStart += counter[0] + counter[1];\n\t for (j = 0; j < 7; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[7] = 0;\n\t counter[8] = 0;\n\t counterPos--;\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\texports['default'] = Code39Reader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _code_39_reader = __webpack_require__(30);\n\t\n\tvar _code_39_reader2 = _interopRequireDefault(_code_39_reader);\n\t\n\tfunction Code39VINReader() {\n\t _code_39_reader2['default'].call(this);\n\t}\n\t\n\tvar patterns = {\n\t IOQ: /[IOQ]/g,\n\t AZ09: /[A-Z0-9]{17}/\n\t};\n\t\n\tCode39VINReader.prototype = Object.create(_code_39_reader2['default'].prototype);\n\tCode39VINReader.prototype.constructor = Code39VINReader;\n\t\n\t// Cribbed from:\n\t// /~https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/VINResultParser.java\n\tCode39VINReader.prototype._decode = function () {\n\t var result = _code_39_reader2['default'].prototype._decode.apply(this);\n\t if (!result) {\n\t return null;\n\t }\n\t\n\t var code = result.code;\n\t\n\t if (!code) {\n\t return;\n\t }\n\t\n\t code = code.replace(patterns.IOQ, '');\n\t\n\t if (!code.match(patterns.AZ09)) {\n\t console.log('Failed AZ09 pattern code:', code);\n\t return null;\n\t }\n\t\n\t if (!this._checkChecksum(code)) {\n\t return null;\n\t }\n\t\n\t result.code = code;\n\t return result;\n\t};\n\t\n\tCode39VINReader.prototype._checkChecksum = function (code) {\n\t // TODO\n\t return !!code;\n\t};\n\t\n\texports['default'] = Code39VINReader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tfunction CodabarReader() {\n\t _barcode_reader2[\"default\"].call(this);\n\t this._counters = [];\n\t}\n\t\n\tvar properties = {\n\t ALPHABETH_STRING: { value: \"0123456789-$:/.+ABCD\" },\n\t ALPHABET: { value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 36, 58, 47, 46, 43, 65, 66, 67, 68] },\n\t CHARACTER_ENCODINGS: { value: [0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E] },\n\t START_END: { value: [0x01A, 0x029, 0x00B, 0x00E] },\n\t MIN_ENCODED_CHARS: { value: 4 },\n\t MAX_ACCEPTABLE: { value: 2.0 },\n\t PADDING: { value: 1.5 },\n\t FORMAT: { value: \"codabar\", writeable: false }\n\t};\n\t\n\tCodabarReader.prototype = Object.create(_barcode_reader2[\"default\"].prototype, properties);\n\tCodabarReader.prototype.constructor = CodabarReader;\n\t\n\tCodabarReader.prototype._decode = function () {\n\t var self = this,\n\t result = [],\n\t start,\n\t decodedChar,\n\t pattern,\n\t nextStart,\n\t end;\n\t\n\t this._counters = self._fillCounters();\n\t start = self._findStart();\n\t if (!start) {\n\t return null;\n\t }\n\t nextStart = start.startCounter;\n\t\n\t do {\n\t pattern = self._toPattern(nextStart);\n\t if (pattern < 0) {\n\t return null;\n\t }\n\t decodedChar = self._patternToChar(pattern);\n\t if (decodedChar < 0) {\n\t return null;\n\t }\n\t result.push(decodedChar);\n\t nextStart += 8;\n\t if (result.length > 1 && self._isStartEnd(pattern)) {\n\t break;\n\t }\n\t } while (nextStart < self._counters.length);\n\t\n\t // verify end\n\t if (result.length - 2 < self.MIN_ENCODED_CHARS || !self._isStartEnd(pattern)) {\n\t return null;\n\t }\n\t\n\t // verify end white space\n\t if (!self._verifyWhitespace(start.startCounter, nextStart - 8)) {\n\t return null;\n\t }\n\t\n\t if (!self._validateResult(result, start.startCounter)) {\n\t return null;\n\t }\n\t\n\t nextStart = nextStart > self._counters.length ? self._counters.length : nextStart;\n\t end = start.start + self._sumCounters(start.startCounter, nextStart - 8);\n\t\n\t return {\n\t code: result.join(\"\"),\n\t start: start.start,\n\t end: end,\n\t startInfo: start,\n\t decodedCodes: result\n\t };\n\t};\n\t\n\tCodabarReader.prototype._verifyWhitespace = function (startCounter, endCounter) {\n\t if (startCounter - 1 <= 0 || this._counters[startCounter - 1] >= this._calculatePatternLength(startCounter) / 2.0) {\n\t if (endCounter + 8 >= this._counters.length || this._counters[endCounter + 7] >= this._calculatePatternLength(endCounter) / 2.0) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t};\n\t\n\tCodabarReader.prototype._calculatePatternLength = function (offset) {\n\t var i,\n\t sum = 0;\n\t\n\t for (i = offset; i < offset + 7; i++) {\n\t sum += this._counters[i];\n\t }\n\t\n\t return sum;\n\t};\n\t\n\tCodabarReader.prototype._thresholdResultPattern = function (result, startCounter) {\n\t var self = this,\n\t categorization = {\n\t space: {\n\t narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE },\n\t wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE }\n\t },\n\t bar: {\n\t narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE },\n\t wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE }\n\t }\n\t },\n\t kind,\n\t cat,\n\t i,\n\t j,\n\t pos = startCounter,\n\t pattern;\n\t\n\t for (i = 0; i < result.length; i++) {\n\t pattern = self._charToPattern(result[i]);\n\t for (j = 6; j >= 0; j--) {\n\t kind = (j & 1) === 2 ? categorization.bar : categorization.space;\n\t cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n\t cat.size += self._counters[pos + j];\n\t cat.counts++;\n\t pattern >>= 1;\n\t }\n\t pos += 8;\n\t }\n\t\n\t [\"space\", \"bar\"].forEach(function (key) {\n\t var kind = categorization[key];\n\t kind.wide.min = Math.floor((kind.narrow.size / kind.narrow.counts + kind.wide.size / kind.wide.counts) / 2);\n\t kind.narrow.max = Math.ceil(kind.wide.min);\n\t kind.wide.max = Math.ceil((kind.wide.size * self.MAX_ACCEPTABLE + self.PADDING) / kind.wide.counts);\n\t });\n\t\n\t return categorization;\n\t};\n\t\n\tCodabarReader.prototype._charToPattern = function (char) {\n\t var self = this,\n\t charCode = char.charCodeAt(0),\n\t i;\n\t\n\t for (i = 0; i < self.ALPHABET.length; i++) {\n\t if (self.ALPHABET[i] === charCode) {\n\t return self.CHARACTER_ENCODINGS[i];\n\t }\n\t }\n\t return 0x0;\n\t};\n\t\n\tCodabarReader.prototype._validateResult = function (result, startCounter) {\n\t var self = this,\n\t thresholds = self._thresholdResultPattern(result, startCounter),\n\t i,\n\t j,\n\t kind,\n\t cat,\n\t size,\n\t pos = startCounter,\n\t pattern;\n\t\n\t for (i = 0; i < result.length; i++) {\n\t pattern = self._charToPattern(result[i]);\n\t for (j = 6; j >= 0; j--) {\n\t kind = (j & 1) === 0 ? thresholds.bar : thresholds.space;\n\t cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n\t size = self._counters[pos + j];\n\t if (size < cat.min || size > cat.max) {\n\t return false;\n\t }\n\t pattern >>= 1;\n\t }\n\t pos += 8;\n\t }\n\t return true;\n\t};\n\t\n\tCodabarReader.prototype._patternToChar = function (pattern) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n\t if (self.CHARACTER_ENCODINGS[i] === pattern) {\n\t return String.fromCharCode(self.ALPHABET[i]);\n\t }\n\t }\n\t return -1;\n\t};\n\t\n\tCodabarReader.prototype._computeAlternatingThreshold = function (offset, end) {\n\t var i,\n\t min = Number.MAX_VALUE,\n\t max = 0,\n\t counter;\n\t\n\t for (i = offset; i < end; i += 2) {\n\t counter = this._counters[i];\n\t if (counter > max) {\n\t max = counter;\n\t }\n\t if (counter < min) {\n\t min = counter;\n\t }\n\t }\n\t\n\t return (min + max) / 2.0 | 0;\n\t};\n\t\n\tCodabarReader.prototype._toPattern = function (offset) {\n\t var numCounters = 7,\n\t end = offset + numCounters,\n\t barThreshold,\n\t spaceThreshold,\n\t bitmask = 1 << numCounters - 1,\n\t pattern = 0,\n\t i,\n\t threshold;\n\t\n\t if (end > this._counters.length) {\n\t return -1;\n\t }\n\t\n\t barThreshold = this._computeAlternatingThreshold(offset, end);\n\t spaceThreshold = this._computeAlternatingThreshold(offset + 1, end);\n\t\n\t for (i = 0; i < numCounters; i++) {\n\t threshold = (i & 1) === 0 ? barThreshold : spaceThreshold;\n\t if (this._counters[offset + i] > threshold) {\n\t pattern |= bitmask;\n\t }\n\t bitmask >>= 1;\n\t }\n\t\n\t return pattern;\n\t};\n\t\n\tCodabarReader.prototype._isStartEnd = function (pattern) {\n\t var i;\n\t\n\t for (i = 0; i < this.START_END.length; i++) {\n\t if (this.START_END[i] === pattern) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t};\n\t\n\tCodabarReader.prototype._sumCounters = function (start, end) {\n\t var i,\n\t sum = 0;\n\t\n\t for (i = start; i < end; i++) {\n\t sum += this._counters[i];\n\t }\n\t return sum;\n\t};\n\t\n\tCodabarReader.prototype._findStart = function () {\n\t var self = this,\n\t i,\n\t pattern,\n\t start = self._nextUnset(self._row),\n\t end;\n\t\n\t for (i = 1; i < this._counters.length; i++) {\n\t pattern = self._toPattern(i);\n\t if (pattern !== -1 && self._isStartEnd(pattern)) {\n\t // TODO: Look for whitespace ahead\n\t start += self._sumCounters(0, i);\n\t end = start + self._sumCounters(i, i + 8);\n\t return {\n\t start: start,\n\t end: end,\n\t startCounter: i,\n\t endCounter: i + 8\n\t };\n\t }\n\t }\n\t};\n\t\n\texports[\"default\"] = CodabarReader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tfunction UPCReader() {\n\t _ean_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t FORMAT: { value: \"upc_a\", writeable: false }\n\t};\n\t\n\tUPCReader.prototype = Object.create(_ean_reader2[\"default\"].prototype, properties);\n\tUPCReader.prototype.constructor = UPCReader;\n\t\n\tUPCReader.prototype._decode = function () {\n\t var result = _ean_reader2[\"default\"].prototype._decode.call(this);\n\t\n\t if (result && result.code && result.code.length === 13 && result.code.charAt(0) === \"0\") {\n\t\n\t result.code = result.code.substring(1);\n\t return result;\n\t }\n\t return null;\n\t};\n\t\n\texports[\"default\"] = _ean_reader2[\"default\"];\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tfunction EAN8Reader() {\n\t _ean_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t FORMAT: { value: \"ean_8\", writeable: false }\n\t};\n\t\n\tEAN8Reader.prototype = Object.create(_ean_reader2[\"default\"].prototype, properties);\n\tEAN8Reader.prototype.constructor = EAN8Reader;\n\t\n\tEAN8Reader.prototype._decodePayload = function (code, result, decodedCodes) {\n\t var i,\n\t self = this;\n\t\n\t for (i = 0; i < 4; i++) {\n\t code = self._decodeCode(code.end, self.CODE_G_START);\n\t if (!code) {\n\t return null;\n\t }\n\t result.push(code.code);\n\t decodedCodes.push(code);\n\t }\n\t\n\t code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n\t if (code === null) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t\n\t for (i = 0; i < 4; i++) {\n\t code = self._decodeCode(code.end, self.CODE_G_START);\n\t if (!code) {\n\t return null;\n\t }\n\t decodedCodes.push(code);\n\t result.push(code.code);\n\t }\n\t\n\t return code;\n\t};\n\t\n\texports[\"default\"] = EAN8Reader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _ean_reader = __webpack_require__(29);\n\t\n\tvar _ean_reader2 = _interopRequireDefault(_ean_reader);\n\t\n\tfunction UPCEReader() {\n\t _ean_reader2[\"default\"].call(this);\n\t}\n\t\n\tvar properties = {\n\t CODE_FREQUENCY: { value: [[56, 52, 50, 49, 44, 38, 35, 42, 41, 37], [7, 11, 13, 14, 19, 25, 28, 21, 22, 26]] },\n\t STOP_PATTERN: { value: [1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7] },\n\t FORMAT: { value: \"upc_e\", writeable: false }\n\t};\n\t\n\tUPCEReader.prototype = Object.create(_ean_reader2[\"default\"].prototype, properties);\n\tUPCEReader.prototype.constructor = UPCEReader;\n\t\n\tUPCEReader.prototype._decodePayload = function (code, result, decodedCodes) {\n\t var i,\n\t self = this,\n\t codeFrequency = 0x0;\n\t\n\t for (i = 0; i < 6; i++) {\n\t code = self._decodeCode(code.end);\n\t if (!code) {\n\t return null;\n\t }\n\t if (code.code >= self.CODE_G_START) {\n\t code.code = code.code - self.CODE_G_START;\n\t codeFrequency |= 1 << 5 - i;\n\t }\n\t result.push(code.code);\n\t decodedCodes.push(code);\n\t }\n\t if (!self._determineParity(codeFrequency, result)) {\n\t return null;\n\t }\n\t\n\t return code;\n\t};\n\t\n\tUPCEReader.prototype._determineParity = function (codeFrequency, result) {\n\t var self = this,\n\t i,\n\t nrSystem;\n\t\n\t for (nrSystem = 0; nrSystem < self.CODE_FREQUENCY.length; nrSystem++) {\n\t for (i = 0; i < self.CODE_FREQUENCY[nrSystem].length; i++) {\n\t if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {\n\t result.unshift(nrSystem);\n\t result.push(i);\n\t return true;\n\t }\n\t }\n\t }\n\t return false;\n\t};\n\t\n\tUPCEReader.prototype._convertToUPCA = function (result) {\n\t var upca = [result[0]],\n\t lastDigit = result[result.length - 2];\n\t\n\t if (lastDigit <= 2) {\n\t upca = upca.concat(result.slice(1, 3)).concat([lastDigit, 0, 0, 0, 0]).concat(result.slice(3, 6));\n\t } else if (lastDigit === 3) {\n\t upca = upca.concat(result.slice(1, 4)).concat([0, 0, 0, 0, 0]).concat(result.slice(4, 6));\n\t } else if (lastDigit === 4) {\n\t upca = upca.concat(result.slice(1, 5)).concat([0, 0, 0, 0, 0, result[5]]);\n\t } else {\n\t upca = upca.concat(result.slice(1, 6)).concat([0, 0, 0, 0, lastDigit]);\n\t }\n\t\n\t upca.push(result[result.length - 1]);\n\t return upca;\n\t};\n\t\n\tUPCEReader.prototype._checksum = function (result) {\n\t return _ean_reader2[\"default\"].prototype._checksum.call(this, this._convertToUPCA(result));\n\t};\n\t\n\tUPCEReader.prototype._findEnd = function (offset, isWhite) {\n\t isWhite = true;\n\t return _ean_reader2[\"default\"].prototype._findEnd.call(this, offset, isWhite);\n\t};\n\t\n\tUPCEReader.prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t};\n\t\n\texports[\"default\"] = UPCEReader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _barcode_reader = __webpack_require__(28);\n\t\n\tvar _barcode_reader2 = _interopRequireDefault(_barcode_reader);\n\t\n\tvar merge = __webpack_require__(37);\n\t\n\tfunction I2of5Reader(opts) {\n\t opts = merge(getDefaulConfig(), opts);\n\t _barcode_reader2['default'].call(this, opts);\n\t this.barSpaceRatio = [1, 1];\n\t if (opts.normalizeBarSpaceWidth) {\n\t this.SINGLE_CODE_ERROR = 0.38;\n\t this.AVG_CODE_ERROR = 0.09;\n\t }\n\t}\n\t\n\tfunction getDefaulConfig() {\n\t var config = {};\n\t\n\t Object.keys(I2of5Reader.CONFIG_KEYS).forEach(function (key) {\n\t config[key] = I2of5Reader.CONFIG_KEYS[key]['default'];\n\t });\n\t return config;\n\t}\n\t\n\tvar N = 1,\n\t W = 3,\n\t properties = {\n\t MODULO: { value: 10 },\n\t START_PATTERN: { value: [N * 2.5, N * 2.5, N * 2.5, N * 2.5] },\n\t STOP_PATTERN: { value: [N * 2, N * 2, W * 2] },\n\t CODE_PATTERN: { value: [[N, N, W, W, N], [W, N, N, N, W], [N, W, N, N, W], [W, W, N, N, N], [N, N, W, N, W], [W, N, W, N, N], [N, W, W, N, N], [N, N, N, W, W], [W, N, N, W, N], [N, W, N, W, N]] },\n\t SINGLE_CODE_ERROR: { value: 0.78, writable: true },\n\t AVG_CODE_ERROR: { value: 0.38, writable: true },\n\t MAX_CORRECTION_FACTOR: { value: 5 },\n\t FORMAT: { value: \"i2of5\" }\n\t};\n\t\n\tI2of5Reader.prototype = Object.create(_barcode_reader2['default'].prototype, properties);\n\tI2of5Reader.prototype.constructor = I2of5Reader;\n\t\n\tI2of5Reader.prototype._matchPattern = function (counter, code) {\n\t if (this.config.normalizeBarSpaceWidth) {\n\t var i,\n\t counterSum = [0, 0],\n\t codeSum = [0, 0],\n\t correction = [0, 0],\n\t correctionRatio = this.MAX_CORRECTION_FACTOR,\n\t correctionRatioInverse = 1 / correctionRatio;\n\t\n\t for (i = 0; i < counter.length; i++) {\n\t counterSum[i % 2] += counter[i];\n\t codeSum[i % 2] += code[i];\n\t }\n\t correction[0] = codeSum[0] / counterSum[0];\n\t correction[1] = codeSum[1] / counterSum[1];\n\t\n\t correction[0] = Math.max(Math.min(correction[0], correctionRatio), correctionRatioInverse);\n\t correction[1] = Math.max(Math.min(correction[1], correctionRatio), correctionRatioInverse);\n\t this.barSpaceRatio = correction;\n\t for (i = 0; i < counter.length; i++) {\n\t counter[i] *= this.barSpaceRatio[i % 2];\n\t }\n\t }\n\t return _barcode_reader2['default'].prototype._matchPattern.call(this, counter, code);\n\t};\n\t\n\tI2of5Reader.prototype._findPattern = function (pattern, offset, isWhite, tryHarder) {\n\t var counter = [],\n\t self = this,\n\t i,\n\t counterPos = 0,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t },\n\t error,\n\t j,\n\t sum,\n\t normalized,\n\t epsilon = self.AVG_CODE_ERROR;\n\t\n\t isWhite = isWhite || false;\n\t tryHarder = tryHarder || false;\n\t\n\t if (!offset) {\n\t offset = self._nextSet(self._row);\n\t }\n\t\n\t for (i = 0; i < pattern.length; i++) {\n\t counter[i] = 0;\n\t }\n\t\n\t for (i = offset; i < self._row.length; i++) {\n\t if (self._row[i] ^ isWhite) {\n\t counter[counterPos]++;\n\t } else {\n\t if (counterPos === counter.length - 1) {\n\t sum = 0;\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t error = self._matchPattern(normalized, pattern);\n\t\n\t if (error < epsilon) {\n\t bestMatch.error = error;\n\t bestMatch.start = i - sum;\n\t bestMatch.end = i;\n\t return bestMatch;\n\t }\n\t }\n\t if (tryHarder) {\n\t for (j = 0; j < counter.length - 2; j++) {\n\t counter[j] = counter[j + 2];\n\t }\n\t counter[counter.length - 2] = 0;\n\t counter[counter.length - 1] = 0;\n\t counterPos--;\n\t } else {\n\t return null;\n\t }\n\t } else {\n\t counterPos++;\n\t }\n\t counter[counterPos] = 1;\n\t isWhite = !isWhite;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tI2of5Reader.prototype._findStart = function () {\n\t var self = this,\n\t leadingWhitespaceStart,\n\t offset = self._nextSet(self._row),\n\t startInfo,\n\t narrowBarWidth = 1;\n\t\n\t while (!startInfo) {\n\t startInfo = self._findPattern(self.START_PATTERN, offset, false, true);\n\t if (!startInfo) {\n\t return null;\n\t }\n\t narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / 4);\n\t leadingWhitespaceStart = startInfo.start - narrowBarWidth * 10;\n\t if (leadingWhitespaceStart >= 0) {\n\t if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n\t return startInfo;\n\t }\n\t }\n\t offset = startInfo.end;\n\t startInfo = null;\n\t }\n\t};\n\t\n\tI2of5Reader.prototype._verifyTrailingWhitespace = function (endInfo) {\n\t var self = this,\n\t trailingWhitespaceEnd;\n\t\n\t trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start) / 2;\n\t if (trailingWhitespaceEnd < self._row.length) {\n\t if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n\t return endInfo;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tI2of5Reader.prototype._findEnd = function () {\n\t var self = this,\n\t endInfo,\n\t tmp;\n\t\n\t self._row.reverse();\n\t endInfo = self._findPattern(self.STOP_PATTERN);\n\t self._row.reverse();\n\t\n\t if (endInfo === null) {\n\t return null;\n\t }\n\t\n\t // reverse numbers\n\t tmp = endInfo.start;\n\t endInfo.start = self._row.length - endInfo.end;\n\t endInfo.end = self._row.length - tmp;\n\t\n\t return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n\t};\n\t\n\tI2of5Reader.prototype._decodePair = function (counterPair) {\n\t var i,\n\t code,\n\t codes = [],\n\t self = this;\n\t\n\t for (i = 0; i < counterPair.length; i++) {\n\t code = self._decodeCode(counterPair[i]);\n\t if (!code) {\n\t return null;\n\t }\n\t codes.push(code);\n\t }\n\t return codes;\n\t};\n\t\n\tI2of5Reader.prototype._decodeCode = function (counter) {\n\t var j,\n\t self = this,\n\t sum = 0,\n\t normalized,\n\t error,\n\t epsilon = self.AVG_CODE_ERROR,\n\t code,\n\t bestMatch = {\n\t error: Number.MAX_VALUE,\n\t code: -1,\n\t start: 0,\n\t end: 0\n\t };\n\t\n\t for (j = 0; j < counter.length; j++) {\n\t sum += counter[j];\n\t }\n\t normalized = self._normalize(counter);\n\t if (normalized) {\n\t for (code = 0; code < self.CODE_PATTERN.length; code++) {\n\t error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n\t if (error < bestMatch.error) {\n\t bestMatch.code = code;\n\t bestMatch.error = error;\n\t }\n\t }\n\t if (bestMatch.error < epsilon) {\n\t return bestMatch;\n\t }\n\t }\n\t return null;\n\t};\n\t\n\tI2of5Reader.prototype._decodePayload = function (counters, result, decodedCodes) {\n\t var i,\n\t self = this,\n\t pos = 0,\n\t counterLength = counters.length,\n\t counterPair = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],\n\t codes;\n\t\n\t while (pos < counterLength) {\n\t for (i = 0; i < 5; i++) {\n\t counterPair[0][i] = counters[pos] * this.barSpaceRatio[0];\n\t counterPair[1][i] = counters[pos + 1] * this.barSpaceRatio[1];\n\t pos += 2;\n\t }\n\t codes = self._decodePair(counterPair);\n\t if (!codes) {\n\t return null;\n\t }\n\t for (i = 0; i < codes.length; i++) {\n\t result.push(codes[i].code + \"\");\n\t decodedCodes.push(codes[i]);\n\t }\n\t }\n\t return codes;\n\t};\n\t\n\tI2of5Reader.prototype._verifyCounterLength = function (counters) {\n\t return counters.length % 10 === 0;\n\t};\n\t\n\tI2of5Reader.prototype._decode = function () {\n\t var startInfo,\n\t endInfo,\n\t self = this,\n\t code,\n\t result = [],\n\t decodedCodes = [],\n\t counters;\n\t\n\t startInfo = self._findStart();\n\t if (!startInfo) {\n\t return null;\n\t }\n\t decodedCodes.push(startInfo);\n\t\n\t endInfo = self._findEnd();\n\t if (!endInfo) {\n\t return null;\n\t }\n\t\n\t counters = self._fillCounters(startInfo.end, endInfo.start, false);\n\t if (!self._verifyCounterLength(counters)) {\n\t return null;\n\t }\n\t code = self._decodePayload(counters, result, decodedCodes);\n\t if (!code) {\n\t return null;\n\t }\n\t if (result.length % 2 !== 0 || result.length < 6) {\n\t return null;\n\t }\n\t\n\t decodedCodes.push(endInfo);\n\t return {\n\t code: result.join(\"\"),\n\t start: startInfo.start,\n\t end: endInfo.end,\n\t startInfo: startInfo,\n\t decodedCodes: decodedCodes\n\t };\n\t};\n\t\n\tI2of5Reader.CONFIG_KEYS = {\n\t normalizeBarSpaceWidth: {\n\t 'type': 'boolean',\n\t 'default': false,\n\t 'description': 'If true, the reader tries to normalize the' + 'width-difference between bars and spaces'\n\t }\n\t};\n\t\n\texports['default'] = I2of5Reader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseMerge = __webpack_require__(38),\n\t createAssigner = __webpack_require__(65);\n\t\n\t/**\n\t * Recursively merges own enumerable properties of the source object(s), that\n\t * don't resolve to `undefined` into the destination object. Subsequent sources\n\t * overwrite property assignments of previous sources. If `customizer` is\n\t * provided it's invoked to produce the merged values of the destination and\n\t * source properties. If `customizer` returns `undefined` merging is handled\n\t * by the method instead. The `customizer` is bound to `thisArg` and invoked\n\t * with five arguments: (objectValue, sourceValue, key, object, source).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The destination object.\n\t * @param {...Object} [sources] The source objects.\n\t * @param {Function} [customizer] The function to customize assigned values.\n\t * @param {*} [thisArg] The `this` binding of `customizer`.\n\t * @returns {Object} Returns `object`.\n\t * @example\n\t *\n\t * var users = {\n\t * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n\t * };\n\t *\n\t * var ages = {\n\t * 'data': [{ 'age': 36 }, { 'age': 40 }]\n\t * };\n\t *\n\t * _.merge(users, ages);\n\t * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n\t *\n\t * // using a customizer callback\n\t * var object = {\n\t * 'fruits': ['apple'],\n\t * 'vegetables': ['beet']\n\t * };\n\t *\n\t * var other = {\n\t * 'fruits': ['banana'],\n\t * 'vegetables': ['carrot']\n\t * };\n\t *\n\t * _.merge(object, other, function(a, b) {\n\t * if (_.isArray(a)) {\n\t * return a.concat(b);\n\t * }\n\t * });\n\t * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n\t */\n\tvar merge = createAssigner(baseMerge);\n\t\n\tmodule.exports = merge;\n\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar arrayEach = __webpack_require__(39),\n\t baseMergeDeep = __webpack_require__(40),\n\t isArray = __webpack_require__(48),\n\t isArrayLike = __webpack_require__(43),\n\t isObject = __webpack_require__(52),\n\t isObjectLike = __webpack_require__(47),\n\t isTypedArray = __webpack_require__(60),\n\t keys = __webpack_require__(63);\n\t\n\t/**\n\t * The base implementation of `_.merge` without support for argument juggling,\n\t * multiple sources, and `this` binding `customizer` functions.\n\t *\n\t * @private\n\t * @param {Object} object The destination object.\n\t * @param {Object} source The source object.\n\t * @param {Function} [customizer] The function to customize merged values.\n\t * @param {Array} [stackA=[]] Tracks traversed source objects.\n\t * @param {Array} [stackB=[]] Associates values with source counterparts.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction baseMerge(object, source, customizer, stackA, stackB) {\n\t if (!isObject(object)) {\n\t return object;\n\t }\n\t var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n\t props = isSrcArr ? undefined : keys(source);\n\t\n\t arrayEach(props || source, function(srcValue, key) {\n\t if (props) {\n\t key = srcValue;\n\t srcValue = source[key];\n\t }\n\t if (isObjectLike(srcValue)) {\n\t stackA || (stackA = []);\n\t stackB || (stackB = []);\n\t baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n\t }\n\t else {\n\t var value = object[key],\n\t result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n\t isCommon = result === undefined;\n\t\n\t if (isCommon) {\n\t result = srcValue;\n\t }\n\t if ((result !== undefined || (isSrcArr && !(key in object))) &&\n\t (isCommon || (result === result ? (result !== value) : (value === value)))) {\n\t object[key] = result;\n\t }\n\t }\n\t });\n\t return object;\n\t}\n\t\n\tmodule.exports = baseMerge;\n\n\n/***/ },\n/* 39 */\n/***/ function(module, exports) {\n\n\t/**\n\t * A specialized version of `_.forEach` for arrays without support for callback\n\t * shorthands and `this` binding.\n\t *\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Array} Returns `array`.\n\t */\n\tfunction arrayEach(array, iteratee) {\n\t var index = -1,\n\t length = array.length;\n\t\n\t while (++index < length) {\n\t if (iteratee(array[index], index, array) === false) {\n\t break;\n\t }\n\t }\n\t return array;\n\t}\n\t\n\tmodule.exports = arrayEach;\n\n\n/***/ },\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar arrayCopy = __webpack_require__(41),\n\t isArguments = __webpack_require__(42),\n\t isArray = __webpack_require__(48),\n\t isArrayLike = __webpack_require__(43),\n\t isPlainObject = __webpack_require__(53),\n\t isTypedArray = __webpack_require__(60),\n\t toPlainObject = __webpack_require__(61);\n\t\n\t/**\n\t * A specialized version of `baseMerge` for arrays and objects which performs\n\t * deep merges and tracks traversed objects enabling objects with circular\n\t * references to be merged.\n\t *\n\t * @private\n\t * @param {Object} object The destination object.\n\t * @param {Object} source The source object.\n\t * @param {string} key The key of the value to merge.\n\t * @param {Function} mergeFunc The function to merge values.\n\t * @param {Function} [customizer] The function to customize merged values.\n\t * @param {Array} [stackA=[]] Tracks traversed source objects.\n\t * @param {Array} [stackB=[]] Associates values with source counterparts.\n\t * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n\t */\n\tfunction baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n\t var length = stackA.length,\n\t srcValue = source[key];\n\t\n\t while (length--) {\n\t if (stackA[length] == srcValue) {\n\t object[key] = stackB[length];\n\t return;\n\t }\n\t }\n\t var value = object[key],\n\t result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n\t isCommon = result === undefined;\n\t\n\t if (isCommon) {\n\t result = srcValue;\n\t if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n\t result = isArray(value)\n\t ? value\n\t : (isArrayLike(value) ? arrayCopy(value) : []);\n\t }\n\t else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n\t result = isArguments(value)\n\t ? toPlainObject(value)\n\t : (isPlainObject(value) ? value : {});\n\t }\n\t else {\n\t isCommon = false;\n\t }\n\t }\n\t // Add the source value to the stack of traversed objects and associate\n\t // it with its merged value.\n\t stackA.push(srcValue);\n\t stackB.push(result);\n\t\n\t if (isCommon) {\n\t // Recursively merge objects and arrays (susceptible to call stack limits).\n\t object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n\t } else if (result === result ? (result !== value) : (value === value)) {\n\t object[key] = result;\n\t }\n\t}\n\t\n\tmodule.exports = baseMergeDeep;\n\n\n/***/ },\n/* 41 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Copies the values of `source` to `array`.\n\t *\n\t * @private\n\t * @param {Array} source The array to copy values from.\n\t * @param {Array} [array=[]] The array to copy values to.\n\t * @returns {Array} Returns `array`.\n\t */\n\tfunction arrayCopy(source, array) {\n\t var index = -1,\n\t length = source.length;\n\t\n\t array || (array = Array(length));\n\t while (++index < length) {\n\t array[index] = source[index];\n\t }\n\t return array;\n\t}\n\t\n\tmodule.exports = arrayCopy;\n\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArrayLike = __webpack_require__(43),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/** Native method references. */\n\tvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\t\n\t/**\n\t * Checks if `value` is classified as an `arguments` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArguments(function() { return arguments; }());\n\t * // => true\n\t *\n\t * _.isArguments([1, 2, 3]);\n\t * // => false\n\t */\n\tfunction isArguments(value) {\n\t return isObjectLike(value) && isArrayLike(value) &&\n\t hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n\t}\n\t\n\tmodule.exports = isArguments;\n\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar getLength = __webpack_require__(44),\n\t isLength = __webpack_require__(46);\n\t\n\t/**\n\t * Checks if `value` is array-like.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null && isLength(getLength(value));\n\t}\n\t\n\tmodule.exports = isArrayLike;\n\n\n/***/ },\n/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseProperty = __webpack_require__(45);\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\tmodule.exports = getLength;\n\n\n/***/ },\n/* 45 */\n/***/ function(module, exports) {\n\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\tmodule.exports = baseProperty;\n\n\n/***/ },\n/* 46 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n\t * of an array-like value.\n\t */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\tmodule.exports = isLength;\n\n\n/***/ },\n/* 47 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Checks if `value` is object-like.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n\t */\n\tfunction isObjectLike(value) {\n\t return !!value && typeof value == 'object';\n\t}\n\t\n\tmodule.exports = isObjectLike;\n\n\n/***/ },\n/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar getNative = __webpack_require__(49),\n\t isLength = __webpack_require__(46),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** `Object#toString` result references. */\n\tvar arrayTag = '[object Array]';\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/* Native method references for those with the same name as other `lodash` methods. */\n\tvar nativeIsArray = getNative(Array, 'isArray');\n\t\n\t/**\n\t * Checks if `value` is classified as an `Array` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArray([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArray(function() { return arguments; }());\n\t * // => false\n\t */\n\tvar isArray = nativeIsArray || function(value) {\n\t return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n\t};\n\t\n\tmodule.exports = isArray;\n\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isNative = __webpack_require__(50);\n\t\n\t/**\n\t * Gets the native function at `key` of `object`.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {string} key The key of the method to get.\n\t * @returns {*} Returns the function if it's native, else `undefined`.\n\t */\n\tfunction getNative(object, key) {\n\t var value = object == null ? undefined : object[key];\n\t return isNative(value) ? value : undefined;\n\t}\n\t\n\tmodule.exports = getNative;\n\n\n/***/ },\n/* 50 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isFunction = __webpack_require__(51),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** Used to detect host constructors (Safari > 5). */\n\tvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to resolve the decompiled source of functions. */\n\tvar fnToString = Function.prototype.toString;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/** Used to detect if a method is native. */\n\tvar reIsNative = RegExp('^' +\n\t fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n\t .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n\t);\n\t\n\t/**\n\t * Checks if `value` is a native function.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n\t * @example\n\t *\n\t * _.isNative(Array.prototype.push);\n\t * // => true\n\t *\n\t * _.isNative(_);\n\t * // => false\n\t */\n\tfunction isNative(value) {\n\t if (value == null) {\n\t return false;\n\t }\n\t if (isFunction(value)) {\n\t return reIsNative.test(fnToString.call(value));\n\t }\n\t return isObjectLike(value) && reIsHostCtor.test(value);\n\t}\n\t\n\tmodule.exports = isNative;\n\n\n/***/ },\n/* 51 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isObject = __webpack_require__(52);\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]';\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in older versions of Chrome and Safari which return 'function' for regexes\n\t // and Safari 8 which returns 'object' for typed array constructors.\n\t return isObject(value) && objToString.call(value) == funcTag;\n\t}\n\t\n\tmodule.exports = isFunction;\n\n\n/***/ },\n/* 52 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(1);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t // Avoid a V8 JIT bug in Chrome 19-20.\n\t // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\tmodule.exports = isObject;\n\n\n/***/ },\n/* 53 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseForIn = __webpack_require__(54),\n\t isArguments = __webpack_require__(42),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** `Object#toString` result references. */\n\tvar objectTag = '[object Object]';\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/**\n\t * Checks if `value` is a plain object, that is, an object created by the\n\t * `Object` constructor or one with a `[[Prototype]]` of `null`.\n\t *\n\t * **Note:** This method assumes objects created by the `Object` constructor\n\t * have no inherited enumerable properties.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * }\n\t *\n\t * _.isPlainObject(new Foo);\n\t * // => false\n\t *\n\t * _.isPlainObject([1, 2, 3]);\n\t * // => false\n\t *\n\t * _.isPlainObject({ 'x': 0, 'y': 0 });\n\t * // => true\n\t *\n\t * _.isPlainObject(Object.create(null));\n\t * // => true\n\t */\n\tfunction isPlainObject(value) {\n\t var Ctor;\n\t\n\t // Exit early for non `Object` objects.\n\t if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n\t (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n\t return false;\n\t }\n\t // IE < 9 iterates inherited properties before own properties. If the first\n\t // iterated property is an object's own property then there are no inherited\n\t // enumerable properties.\n\t var result;\n\t // In most environments an object's own properties are iterated before\n\t // its inherited properties. If the last iterated property is an object's\n\t // own property then there are no inherited enumerable properties.\n\t baseForIn(value, function(subValue, key) {\n\t result = key;\n\t });\n\t return result === undefined || hasOwnProperty.call(value, result);\n\t}\n\t\n\tmodule.exports = isPlainObject;\n\n\n/***/ },\n/* 54 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseFor = __webpack_require__(55),\n\t keysIn = __webpack_require__(58);\n\t\n\t/**\n\t * The base implementation of `_.forIn` without support for callback\n\t * shorthands and `this` binding.\n\t *\n\t * @private\n\t * @param {Object} object The object to iterate over.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction baseForIn(object, iteratee) {\n\t return baseFor(object, iteratee, keysIn);\n\t}\n\t\n\tmodule.exports = baseForIn;\n\n\n/***/ },\n/* 55 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar createBaseFor = __webpack_require__(56);\n\t\n\t/**\n\t * The base implementation of `baseForIn` and `baseForOwn` which iterates\n\t * over `object` properties returned by `keysFunc` invoking `iteratee` for\n\t * each property. Iteratee functions may exit iteration early by explicitly\n\t * returning `false`.\n\t *\n\t * @private\n\t * @param {Object} object The object to iterate over.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @param {Function} keysFunc The function to get the keys of `object`.\n\t * @returns {Object} Returns `object`.\n\t */\n\tvar baseFor = createBaseFor();\n\t\n\tmodule.exports = baseFor;\n\n\n/***/ },\n/* 56 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toObject = __webpack_require__(57);\n\t\n\t/**\n\t * Creates a base function for `_.forIn` or `_.forInRight`.\n\t *\n\t * @private\n\t * @param {boolean} [fromRight] Specify iterating from right to left.\n\t * @returns {Function} Returns the new base function.\n\t */\n\tfunction createBaseFor(fromRight) {\n\t return function(object, iteratee, keysFunc) {\n\t var iterable = toObject(object),\n\t props = keysFunc(object),\n\t length = props.length,\n\t index = fromRight ? length : -1;\n\t\n\t while ((fromRight ? index-- : ++index < length)) {\n\t var key = props[index];\n\t if (iteratee(iterable[key], key, iterable) === false) {\n\t break;\n\t }\n\t }\n\t return object;\n\t };\n\t}\n\t\n\tmodule.exports = createBaseFor;\n\n\n/***/ },\n/* 57 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isObject = __webpack_require__(52);\n\t\n\t/**\n\t * Converts `value` to an object if it's not one.\n\t *\n\t * @private\n\t * @param {*} value The value to process.\n\t * @returns {Object} Returns the object.\n\t */\n\tfunction toObject(value) {\n\t return isObject(value) ? value : Object(value);\n\t}\n\t\n\tmodule.exports = toObject;\n\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArguments = __webpack_require__(42),\n\t isArray = __webpack_require__(48),\n\t isIndex = __webpack_require__(59),\n\t isLength = __webpack_require__(46),\n\t isObject = __webpack_require__(52);\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Creates an array of the own and inherited enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keysIn(new Foo);\n\t * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n\t */\n\tfunction keysIn(object) {\n\t if (object == null) {\n\t return [];\n\t }\n\t if (!isObject(object)) {\n\t object = Object(object);\n\t }\n\t var length = object.length;\n\t length = (length && isLength(length) &&\n\t (isArray(object) || isArguments(object)) && length) || 0;\n\t\n\t var Ctor = object.constructor,\n\t index = -1,\n\t isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n\t result = Array(length),\n\t skipIndexes = length > 0;\n\t\n\t while (++index < length) {\n\t result[index] = (index + '');\n\t }\n\t for (var key in object) {\n\t if (!(skipIndexes && isIndex(key, length)) &&\n\t !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = keysIn;\n\n\n/***/ },\n/* 59 */\n/***/ function(module, exports) {\n\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^\\d+$/;\n\t\n\t/**\n\t * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n\t * of an array-like value.\n\t */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\tmodule.exports = isIndex;\n\n\n/***/ },\n/* 60 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isLength = __webpack_require__(46),\n\t isObjectLike = __webpack_require__(47);\n\t\n\t/** `Object#toString` result references. */\n\tvar argsTag = '[object Arguments]',\n\t arrayTag = '[object Array]',\n\t boolTag = '[object Boolean]',\n\t dateTag = '[object Date]',\n\t errorTag = '[object Error]',\n\t funcTag = '[object Function]',\n\t mapTag = '[object Map]',\n\t numberTag = '[object Number]',\n\t objectTag = '[object Object]',\n\t regexpTag = '[object RegExp]',\n\t setTag = '[object Set]',\n\t stringTag = '[object String]',\n\t weakMapTag = '[object WeakMap]';\n\t\n\tvar arrayBufferTag = '[object ArrayBuffer]',\n\t float32Tag = '[object Float32Array]',\n\t float64Tag = '[object Float64Array]',\n\t int8Tag = '[object Int8Array]',\n\t int16Tag = '[object Int16Array]',\n\t int32Tag = '[object Int32Array]',\n\t uint8Tag = '[object Uint8Array]',\n\t uint8ClampedTag = '[object Uint8ClampedArray]',\n\t uint16Tag = '[object Uint16Array]',\n\t uint32Tag = '[object Uint32Array]';\n\t\n\t/** Used to identify `toStringTag` values of typed arrays. */\n\tvar typedArrayTags = {};\n\ttypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n\ttypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n\ttypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n\ttypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n\ttypedArrayTags[uint32Tag] = true;\n\ttypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n\ttypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n\ttypedArrayTags[dateTag] = typedArrayTags[errorTag] =\n\ttypedArrayTags[funcTag] = typedArrayTags[mapTag] =\n\ttypedArrayTags[numberTag] = typedArrayTags[objectTag] =\n\ttypedArrayTags[regexpTag] = typedArrayTags[setTag] =\n\ttypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\t\n\t/**\n\t * Checks if `value` is classified as a typed array.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isTypedArray(new Uint8Array);\n\t * // => true\n\t *\n\t * _.isTypedArray([]);\n\t * // => false\n\t */\n\tfunction isTypedArray(value) {\n\t return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n\t}\n\t\n\tmodule.exports = isTypedArray;\n\n\n/***/ },\n/* 61 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseCopy = __webpack_require__(62),\n\t keysIn = __webpack_require__(58);\n\t\n\t/**\n\t * Converts `value` to a plain object flattening inherited enumerable\n\t * properties of `value` to own properties of the plain object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to convert.\n\t * @returns {Object} Returns the converted plain object.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.assign({ 'a': 1 }, new Foo);\n\t * // => { 'a': 1, 'b': 2 }\n\t *\n\t * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n\t * // => { 'a': 1, 'b': 2, 'c': 3 }\n\t */\n\tfunction toPlainObject(value) {\n\t return baseCopy(value, keysIn(value));\n\t}\n\t\n\tmodule.exports = toPlainObject;\n\n\n/***/ },\n/* 62 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Copies properties of `source` to `object`.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction baseCopy(source, props, object) {\n\t object || (object = {});\n\t\n\t var index = -1,\n\t length = props.length;\n\t\n\t while (++index < length) {\n\t var key = props[index];\n\t object[key] = source[key];\n\t }\n\t return object;\n\t}\n\t\n\tmodule.exports = baseCopy;\n\n\n/***/ },\n/* 63 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar getNative = __webpack_require__(49),\n\t isArrayLike = __webpack_require__(43),\n\t isObject = __webpack_require__(52),\n\t shimKeys = __webpack_require__(64);\n\t\n\t/* Native method references for those with the same name as other `lodash` methods. */\n\tvar nativeKeys = getNative(Object, 'keys');\n\t\n\t/**\n\t * Creates an array of the own enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects. See the\n\t * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n\t * for more details.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keys(new Foo);\n\t * // => ['a', 'b'] (iteration order is not guaranteed)\n\t *\n\t * _.keys('hi');\n\t * // => ['0', '1']\n\t */\n\tvar keys = !nativeKeys ? shimKeys : function(object) {\n\t var Ctor = object == null ? undefined : object.constructor;\n\t if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n\t (typeof object != 'function' && isArrayLike(object))) {\n\t return shimKeys(object);\n\t }\n\t return isObject(object) ? nativeKeys(object) : [];\n\t};\n\t\n\tmodule.exports = keys;\n\n\n/***/ },\n/* 64 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArguments = __webpack_require__(42),\n\t isArray = __webpack_require__(48),\n\t isIndex = __webpack_require__(59),\n\t isLength = __webpack_require__(46),\n\t keysIn = __webpack_require__(58);\n\t\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * A fallback implementation of `Object.keys` which creates an array of the\n\t * own enumerable property names of `object`.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t */\n\tfunction shimKeys(object) {\n\t var props = keysIn(object),\n\t propsLength = props.length,\n\t length = propsLength && object.length;\n\t\n\t var allowIndexes = !!length && isLength(length) &&\n\t (isArray(object) || isArguments(object));\n\t\n\t var index = -1,\n\t result = [];\n\t\n\t while (++index < propsLength) {\n\t var key = props[index];\n\t if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = shimKeys;\n\n\n/***/ },\n/* 65 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar bindCallback = __webpack_require__(66),\n\t isIterateeCall = __webpack_require__(68),\n\t restParam = __webpack_require__(69);\n\t\n\t/**\n\t * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n\t *\n\t * @private\n\t * @param {Function} assigner The function to assign values.\n\t * @returns {Function} Returns the new assigner function.\n\t */\n\tfunction createAssigner(assigner) {\n\t return restParam(function(object, sources) {\n\t var index = -1,\n\t length = object == null ? 0 : sources.length,\n\t customizer = length > 2 ? sources[length - 2] : undefined,\n\t guard = length > 2 ? sources[2] : undefined,\n\t thisArg = length > 1 ? sources[length - 1] : undefined;\n\t\n\t if (typeof customizer == 'function') {\n\t customizer = bindCallback(customizer, thisArg, 5);\n\t length -= 2;\n\t } else {\n\t customizer = typeof thisArg == 'function' ? thisArg : undefined;\n\t length -= (customizer ? 1 : 0);\n\t }\n\t if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n\t customizer = length < 3 ? undefined : customizer;\n\t length = 1;\n\t }\n\t while (++index < length) {\n\t var source = sources[index];\n\t if (source) {\n\t assigner(object, source, customizer);\n\t }\n\t }\n\t return object;\n\t });\n\t}\n\t\n\tmodule.exports = createAssigner;\n\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar identity = __webpack_require__(67);\n\t\n\t/**\n\t * A specialized version of `baseCallback` which only supports `this` binding\n\t * and specifying the number of arguments to provide to `func`.\n\t *\n\t * @private\n\t * @param {Function} func The function to bind.\n\t * @param {*} thisArg The `this` binding of `func`.\n\t * @param {number} [argCount] The number of arguments to provide to `func`.\n\t * @returns {Function} Returns the callback.\n\t */\n\tfunction bindCallback(func, thisArg, argCount) {\n\t if (typeof func != 'function') {\n\t return identity;\n\t }\n\t if (thisArg === undefined) {\n\t return func;\n\t }\n\t switch (argCount) {\n\t case 1: return function(value) {\n\t return func.call(thisArg, value);\n\t };\n\t case 3: return function(value, index, collection) {\n\t return func.call(thisArg, value, index, collection);\n\t };\n\t case 4: return function(accumulator, value, index, collection) {\n\t return func.call(thisArg, accumulator, value, index, collection);\n\t };\n\t case 5: return function(value, other, key, object, source) {\n\t return func.call(thisArg, value, other, key, object, source);\n\t };\n\t }\n\t return function() {\n\t return func.apply(thisArg, arguments);\n\t };\n\t}\n\t\n\tmodule.exports = bindCallback;\n\n\n/***/ },\n/* 67 */\n/***/ function(module, exports) {\n\n\t/**\n\t * This method returns the first argument provided to it.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Utility\n\t * @param {*} value Any value.\n\t * @returns {*} Returns `value`.\n\t * @example\n\t *\n\t * var object = { 'user': 'fred' };\n\t *\n\t * _.identity(object) === object;\n\t * // => true\n\t */\n\tfunction identity(value) {\n\t return value;\n\t}\n\t\n\tmodule.exports = identity;\n\n\n/***/ },\n/* 68 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isArrayLike = __webpack_require__(43),\n\t isIndex = __webpack_require__(59),\n\t isObject = __webpack_require__(52);\n\t\n\t/**\n\t * Checks if the provided arguments are from an iteratee call.\n\t *\n\t * @private\n\t * @param {*} value The potential iteratee value argument.\n\t * @param {*} index The potential iteratee index or key argument.\n\t * @param {*} object The potential iteratee object argument.\n\t * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n\t */\n\tfunction isIterateeCall(value, index, object) {\n\t if (!isObject(object)) {\n\t return false;\n\t }\n\t var type = typeof index;\n\t if (type == 'number'\n\t ? (isArrayLike(object) && isIndex(index, object.length))\n\t : (type == 'string' && index in object)) {\n\t var other = object[index];\n\t return value === value ? (value === other) : (other !== other);\n\t }\n\t return false;\n\t}\n\t\n\tmodule.exports = isIterateeCall;\n\n\n/***/ },\n/* 69 */\n/***/ function(module, exports) {\n\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/* Native method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Creates a function that invokes `func` with the `this` binding of the\n\t * created function and arguments from `start` and beyond provided as an array.\n\t *\n\t * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to apply a rest parameter to.\n\t * @param {number} [start=func.length-1] The start position of the rest parameter.\n\t * @returns {Function} Returns the new function.\n\t * @example\n\t *\n\t * var say = _.restParam(function(what, names) {\n\t * return what + ' ' + _.initial(names).join(', ') +\n\t * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n\t * });\n\t *\n\t * say('hello', 'fred', 'barney', 'pebbles');\n\t * // => 'hello fred, barney, & pebbles'\n\t */\n\tfunction restParam(func, start) {\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n\t return function() {\n\t var args = arguments,\n\t index = -1,\n\t length = nativeMax(args.length - start, 0),\n\t rest = Array(length);\n\t\n\t while (++index < length) {\n\t rest[index] = args[start + index];\n\t }\n\t switch (start) {\n\t case 0: return func.call(this, rest);\n\t case 1: return func.call(this, args[0], rest);\n\t case 2: return func.call(this, args[0], args[1], rest);\n\t }\n\t var otherArgs = Array(start + 1);\n\t index = -1;\n\t while (++index < start) {\n\t otherArgs[index] = args[index];\n\t }\n\t otherArgs[start] = rest;\n\t return func.apply(this, otherArgs);\n\t };\n\t}\n\t\n\tmodule.exports = restParam;\n\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\tvar _cv_utils = __webpack_require__(7);\n\t\n\tvar _cv_utils2 = _interopRequireDefault(_cv_utils);\n\t\n\tvar FrameGrabber = {};\n\t\n\tFrameGrabber.create = function (inputStream, canvas) {\n\t var _that = {},\n\t _streamConfig = inputStream.getConfig(),\n\t _video_size = _cv_utils2[\"default\"].imageRef(inputStream.getRealWidth(), inputStream.getRealHeight()),\n\t _canvasSize = inputStream.getCanvasSize(),\n\t _size = _cv_utils2[\"default\"].imageRef(inputStream.getWidth(), inputStream.getHeight()),\n\t topRight = inputStream.getTopRight(),\n\t _sx = topRight.x,\n\t _sy = topRight.y,\n\t _canvas,\n\t _ctx = null,\n\t _data = null;\n\t\n\t _canvas = canvas ? canvas : document.createElement(\"canvas\");\n\t _canvas.width = _canvasSize.x;\n\t _canvas.height = _canvasSize.y;\n\t _ctx = _canvas.getContext(\"2d\");\n\t _data = new Uint8Array(_size.x * _size.y);\n\t console.log(\"FrameGrabber\", JSON.stringify({\n\t size: _size,\n\t topRight: topRight,\n\t videoSize: _video_size,\n\t canvasSize: _canvasSize\n\t }));\n\t\n\t /**\n\t * Uses the given array as frame-buffer\n\t */\n\t _that.attachData = function (data) {\n\t _data = data;\n\t };\n\t\n\t /**\n\t * Returns the used frame-buffer\n\t */\n\t _that.getData = function () {\n\t return _data;\n\t };\n\t\n\t /**\n\t * Fetches a frame from the input-stream and puts into the frame-buffer.\n\t * The image-data is converted to gray-scale and then half-sampled if configured.\n\t */\n\t _that.grab = function () {\n\t var doHalfSample = _streamConfig.halfSample,\n\t frame = inputStream.getFrame(),\n\t ctxData;\n\t if (frame) {\n\t _ctx.drawImage(frame, 0, 0, _canvasSize.x, _canvasSize.y);\n\t ctxData = _ctx.getImageData(_sx, _sy, _size.x, _size.y).data;\n\t if (doHalfSample) {\n\t _cv_utils2[\"default\"].grayAndHalfSampleFromCanvasData(ctxData, _size, _data);\n\t } else {\n\t _cv_utils2[\"default\"].computeGray(ctxData, _data, _streamConfig);\n\t }\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t };\n\t\n\t _that.getSize = function () {\n\t return _size;\n\t };\n\t\n\t return _that;\n\t};\n\t\n\texports[\"default\"] = FrameGrabber;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 71 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports[\"default\"] = {\n\t inputStream: {\n\t name: \"Live\",\n\t type: \"LiveStream\",\n\t constraints: {\n\t width: 640,\n\t height: 480,\n\t minAspectRatio: 0,\n\t maxAspectRatio: 100,\n\t facing: \"environment\" // or user\n\t },\n\t area: {\n\t top: \"0%\",\n\t right: \"0%\",\n\t left: \"0%\",\n\t bottom: \"0%\"\n\t },\n\t singleChannel: false // true: only the red color-channel is read\n\t },\n\t tracking: false,\n\t debug: false,\n\t controls: false,\n\t locate: true,\n\t numOfWorkers: 4,\n\t visual: {\n\t show: true\n\t },\n\t decoder: {\n\t drawBoundingBox: false,\n\t showFrequency: false,\n\t drawScanline: false,\n\t showPattern: false,\n\t readers: ['code_128_reader']\n\t },\n\t locator: {\n\t halfSample: true,\n\t patchSize: \"medium\", // x-small, small, medium, large, x-large\n\t showCanvas: false,\n\t showPatches: false,\n\t showFoundPatches: false,\n\t showSkeleton: false,\n\t showLabels: false,\n\t showPatchLabels: false,\n\t showRemainingPatchLabels: false,\n\t boxFromPatches: {\n\t showTransformed: false,\n\t showTransformedBox: false,\n\t showBB: false\n\t }\n\t }\n\t};\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 72 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\texports[\"default\"] = (function () {\n\t var events = {};\n\t\n\t function getEvent(eventName) {\n\t if (!events[eventName]) {\n\t events[eventName] = {\n\t subscribers: []\n\t };\n\t }\n\t return events[eventName];\n\t }\n\t\n\t function clearEvents() {\n\t events = {};\n\t }\n\t\n\t function publishSubscription(subscription, data) {\n\t if (subscription.async) {\n\t setTimeout(function () {\n\t subscription.callback(data);\n\t }, 4);\n\t } else {\n\t subscription.callback(data);\n\t }\n\t }\n\t\n\t function _subscribe(event, callback, async) {\n\t var subscription;\n\t\n\t if (typeof callback === \"function\") {\n\t subscription = {\n\t callback: callback,\n\t async: async\n\t };\n\t } else {\n\t subscription = callback;\n\t if (!subscription.callback) {\n\t throw \"Callback was not specified on options\";\n\t }\n\t }\n\t\n\t getEvent(event).subscribers.push(subscription);\n\t }\n\t\n\t return {\n\t subscribe: function subscribe(event, callback, async) {\n\t return _subscribe(event, callback, async);\n\t },\n\t publish: function publish(eventName, data) {\n\t var event = getEvent(eventName),\n\t subscribers = event.subscribers;\n\t\n\t event.subscribers = subscribers.filter(function (subscriber) {\n\t publishSubscription(subscriber, data);\n\t return !subscriber.once;\n\t });\n\t },\n\t once: function once(event, callback, async) {\n\t _subscribe(event, {\n\t callback: callback,\n\t async: async,\n\t once: true\n\t });\n\t },\n\t unsubscribe: function unsubscribe(eventName, callback) {\n\t var event;\n\t\n\t if (eventName) {\n\t event = getEvent(eventName);\n\t if (event && callback) {\n\t event.subscribers = event.subscribers.filter(function (subscriber) {\n\t return subscriber.callback !== callback;\n\t });\n\t } else {\n\t event.subscribers = [];\n\t }\n\t } else {\n\t clearEvents();\n\t }\n\t }\n\t };\n\t})();\n\t\n\t;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 73 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\tvar merge = __webpack_require__(37);\n\t\n\tvar streamRef, loadedDataHandler;\n\t\n\t/**\n\t * Wraps browser-specific getUserMedia\n\t * @param {Object} constraints\n\t * @param {Object} success Callback\n\t * @param {Object} failure Callback\n\t */\n\tfunction getUserMedia(constraints, success, failure) {\n\t if (typeof navigator.getUserMedia !== 'undefined') {\n\t navigator.getUserMedia(constraints, function (stream) {\n\t streamRef = stream;\n\t var videoSrc = window.URL && window.URL.createObjectURL(stream) || stream;\n\t success.apply(null, [videoSrc]);\n\t }, failure);\n\t } else {\n\t failure(new TypeError(\"getUserMedia not available\"));\n\t }\n\t}\n\t\n\tfunction loadedData(video, callback) {\n\t var attempts = 10;\n\t\n\t function checkVideo() {\n\t if (attempts > 0) {\n\t if (video.videoWidth > 0 && video.videoHeight > 0) {\n\t console.log(video.videoWidth + \"px x \" + video.videoHeight + \"px\");\n\t callback();\n\t } else {\n\t window.setTimeout(checkVideo, 500);\n\t }\n\t } else {\n\t callback('Unable to play video stream. Is webcam working?');\n\t }\n\t attempts--;\n\t }\n\t checkVideo();\n\t}\n\t\n\t/**\n\t * Tries to attach the camera-stream to a given video-element\n\t * and calls the callback function when the content is ready\n\t * @param {Object} constraints\n\t * @param {Object} video\n\t * @param {Object} callback\n\t */\n\tfunction initCamera(constraints, video, callback) {\n\t getUserMedia(constraints, function (src) {\n\t video.src = src;\n\t if (loadedDataHandler) {\n\t video.removeEventListener(\"loadeddata\", loadedDataHandler, false);\n\t }\n\t loadedDataHandler = loadedData.bind(null, video, callback);\n\t video.addEventListener('loadeddata', loadedDataHandler, false);\n\t video.play();\n\t }, function (e) {\n\t callback(e);\n\t });\n\t}\n\t\n\t/**\n\t * Normalizes the incoming constraints to satisfy the current browser\n\t * @param config\n\t * @param cb Callback which is called whenever constraints are created\n\t * @returns {*}\n\t */\n\tfunction normalizeConstraints(config, cb) {\n\t var constraints = {\n\t audio: false,\n\t video: true\n\t },\n\t videoConstraints = merge({\n\t width: 640,\n\t height: 480,\n\t minAspectRatio: 0,\n\t maxAspectRatio: 100,\n\t facing: \"environment\"\n\t }, config);\n\t\n\t if (typeof MediaStreamTrack !== 'undefined' && typeof MediaStreamTrack.getSources !== 'undefined') {\n\t MediaStreamTrack.getSources(function (sourceInfos) {\n\t var videoSourceId;\n\t for (var i = 0; i != sourceInfos.length; ++i) {\n\t var sourceInfo = sourceInfos[i];\n\t if (sourceInfo.kind == \"video\" && sourceInfo.facing == videoConstraints.facing) {\n\t videoSourceId = sourceInfo.id;\n\t }\n\t }\n\t constraints.video = {\n\t mandatory: {\n\t minWidth: videoConstraints.width,\n\t minHeight: videoConstraints.height,\n\t minAspectRatio: videoConstraints.minAspectRatio,\n\t maxAspectRatio: videoConstraints.maxAspectRatio\n\t },\n\t optional: [{\n\t sourceId: videoSourceId\n\t }]\n\t };\n\t return cb(constraints);\n\t });\n\t } else {\n\t constraints.video = {\n\t mediaSource: \"camera\",\n\t width: { min: videoConstraints.width, max: videoConstraints.width },\n\t height: { min: videoConstraints.height, max: videoConstraints.height },\n\t require: [\"width\", \"height\"]\n\t };\n\t return cb(constraints);\n\t }\n\t}\n\t\n\t/**\n\t * Requests the back-facing camera of the user. The callback is called\n\t * whenever the stream is ready to be consumed, or if an error occures.\n\t * @param {Object} video\n\t * @param {Object} callback\n\t */\n\tfunction _request(video, videoConstraints, callback) {\n\t normalizeConstraints(videoConstraints, function (constraints) {\n\t initCamera(constraints, video, callback);\n\t });\n\t}\n\t\n\texports['default'] = {\n\t request: function request(video, constraints, callback) {\n\t _request(video, constraints, callback);\n\t },\n\t release: function release() {\n\t var tracks = streamRef && streamRef.getVideoTracks();\n\t if (tracks.length) {\n\t tracks[0].stop();\n\t }\n\t streamRef = null;\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _image_debug = __webpack_require__(24);\n\t\n\tvar _image_debug2 = _interopRequireDefault(_image_debug);\n\t\n\tfunction contains(codeResult, list) {\n\t if (list) {\n\t return list.some(function (item) {\n\t return Object.keys(item).every(function (key) {\n\t return item[key] === codeResult[key];\n\t });\n\t });\n\t }\n\t return false;\n\t}\n\t\n\tfunction passesFilter(codeResult, filter) {\n\t if (typeof filter === 'function') {\n\t return filter(codeResult);\n\t }\n\t return true;\n\t}\n\t\n\texports['default'] = {\n\t create: function create(config) {\n\t var canvas = document.createElement(\"canvas\"),\n\t ctx = canvas.getContext(\"2d\"),\n\t results = [],\n\t capacity = config.capacity || 20,\n\t capture = config.capture === true;\n\t\n\t function matchesConstraints(codeResult) {\n\t return capacity && codeResult && !contains(codeResult, config.blacklist) && passesFilter(codeResult, config.filter);\n\t }\n\t\n\t return {\n\t addResult: function addResult(data, imageSize, codeResult) {\n\t var result = {};\n\t\n\t if (matchesConstraints(codeResult)) {\n\t capacity--;\n\t result.codeResult = codeResult;\n\t if (capture) {\n\t canvas.width = imageSize.x;\n\t canvas.height = imageSize.y;\n\t _image_debug2['default'].drawImage(data, imageSize, ctx);\n\t result.frame = canvas.toDataURL();\n\t }\n\t results.push(result);\n\t }\n\t },\n\t getResults: function getResults() {\n\t return results;\n\t }\n\t };\n\t }\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** quagga.min.js\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap bbe7819afe77c7859a4a\n **/","import TypeDefs from './typedefs';\nimport InputStream from './input_stream';\nimport ImageWrapper from './image_wrapper';\nimport BarcodeLocator from './barcode_locator';\nimport BarcodeDecoder from './barcode_decoder';\nimport FrameGrabber from './frame_grabber';\nimport Config from './config';\nimport Events from './events';\nimport CameraAccess from './camera_access';\nimport ImageDebug from './image_debug';\nimport {vec2} from 'gl-matrix';\nimport ResultCollector from './result_collector';\n\nconst merge = require('lodash/object/merge');\n\nvar _inputStream,\n _framegrabber,\n _stopped,\n _canvasContainer = {\n ctx : {\n image : null,\n overlay : null\n },\n dom : {\n image : null,\n overlay : null\n }\n },\n _inputImageWrapper,\n _boxSize,\n _decoder,\n _workerPool = [],\n _onUIThread = true,\n _resultCollector,\n _config = {};\n\nfunction initializeData(imageWrapper) {\n initBuffers(imageWrapper);\n _decoder = BarcodeDecoder.create(_config.decoder, _inputImageWrapper);\n}\n\nfunction initConfig() {\n if (typeof document !== \"undefined\") {\n var vis = [{\n node: document.querySelector(\"div[data-controls]\"),\n prop: _config.controls\n }, {\n node: _canvasContainer.dom.overlay,\n prop: _config.visual.show\n }];\n\n for (var i = 0; i < vis.length; i++) {\n if (vis[i].node) {\n if (vis[i].prop === true) {\n vis[i].node.style.display = \"block\";\n } else {\n vis[i].node.style.display = \"none\";\n }\n }\n }\n }\n}\n\nfunction initInputStream(cb) {\n var video;\n if (_config.inputStream.type == \"VideoStream\") {\n video = document.createElement(\"video\");\n _inputStream = InputStream.createVideoStream(video);\n } else if (_config.inputStream.type == \"ImageStream\") {\n _inputStream = InputStream.createImageStream();\n } else if (_config.inputStream.type == \"LiveStream\") {\n var $viewport = document.querySelector(\"#interactive.viewport\");\n if ($viewport) {\n video = $viewport.querySelector(\"video\");\n if (!video) {\n video = document.createElement(\"video\");\n $viewport.appendChild(video);\n }\n }\n _inputStream = InputStream.createLiveStream(video);\n CameraAccess.request(video, _config.inputStream.constraints, function(err) {\n if (!err) {\n _inputStream.trigger(\"canrecord\");\n } else {\n return cb(err);\n }\n });\n }\n\n _inputStream.setAttribute(\"preload\", \"auto\");\n _inputStream.setAttribute(\"autoplay\", true);\n _inputStream.setInputStream(_config.inputStream);\n _inputStream.addEventListener(\"canrecord\", canRecord.bind(undefined, cb));\n}\n\nfunction canRecord(cb) {\n BarcodeLocator.checkImageConstraints(_inputStream, _config.locator);\n initCanvas();\n _framegrabber = FrameGrabber.create(_inputStream, _canvasContainer.dom.image);\n initConfig();\n\n if (_config.numOfWorkers > 0) {\n initWorkers(function() {\n console.log(\"Workers created\");\n ready(cb);\n });\n } else {\n initializeData();\n ready(cb);\n }\n}\n\nfunction ready(cb){\n _inputStream.play();\n cb();\n}\n\nfunction initCanvas() {\n if (typeof document !== \"undefined\") {\n var $viewport = document.querySelector(\"#interactive.viewport\");\n _canvasContainer.dom.image = document.querySelector(\"canvas.imgBuffer\");\n if (!_canvasContainer.dom.image) {\n _canvasContainer.dom.image = document.createElement(\"canvas\");\n _canvasContainer.dom.image.className = \"imgBuffer\";\n if ($viewport && _config.inputStream.type == \"ImageStream\") {\n $viewport.appendChild(_canvasContainer.dom.image);\n }\n }\n _canvasContainer.ctx.image = _canvasContainer.dom.image.getContext(\"2d\");\n _canvasContainer.dom.image.width = _inputStream.getCanvasSize().x;\n _canvasContainer.dom.image.height = _inputStream.getCanvasSize().y;\n\n _canvasContainer.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n if (!_canvasContainer.dom.overlay) {\n _canvasContainer.dom.overlay = document.createElement(\"canvas\");\n _canvasContainer.dom.overlay.className = \"drawingBuffer\";\n if ($viewport) {\n $viewport.appendChild(_canvasContainer.dom.overlay);\n }\n var clearFix = document.createElement(\"br\");\n clearFix.setAttribute(\"clear\", \"all\");\n if ($viewport) {\n $viewport.appendChild(clearFix);\n }\n }\n _canvasContainer.ctx.overlay = _canvasContainer.dom.overlay.getContext(\"2d\");\n _canvasContainer.dom.overlay.width = _inputStream.getCanvasSize().x;\n _canvasContainer.dom.overlay.height = _inputStream.getCanvasSize().y;\n }\n}\n\nfunction initBuffers(imageWrapper) {\n if (imageWrapper) {\n _inputImageWrapper = imageWrapper;\n } else {\n _inputImageWrapper = new ImageWrapper({\n x : _inputStream.getWidth(),\n y : _inputStream.getHeight()\n });\n }\n\n console.log(_inputImageWrapper.size);\n _boxSize = [\n vec2.clone([0, 0]),\n vec2.clone([0, _inputImageWrapper.size.y]),\n vec2.clone([_inputImageWrapper.size.x, _inputImageWrapper.size.y]),\n vec2.clone([_inputImageWrapper.size.x, 0])\n ];\n BarcodeLocator.init(_inputImageWrapper, _config.locator);\n}\n\nfunction getBoundingBoxes() {\n if (_config.locate) {\n return BarcodeLocator.locate();\n } else {\n return [[\n vec2.clone(_boxSize[0]),\n vec2.clone(_boxSize[1]),\n vec2.clone(_boxSize[2]),\n vec2.clone(_boxSize[3])]];\n }\n}\n\nfunction transformResult(result) {\n var topRight = _inputStream.getTopRight(),\n xOffset = topRight.x,\n yOffset = topRight.y,\n i;\n\n if (!result || (xOffset === 0 && yOffset === 0)) {\n return;\n }\n\n\n if (result.line && result.line.length === 2) {\n moveLine(result.line);\n }\n if (result.boxes && result.boxes.length > 0) {\n for (i = 0; i < result.boxes.length; i++) {\n moveBox(result.boxes[i]);\n }\n }\n\n function moveBox(box) {\n var corner = box.length;\n\n while(corner--) {\n box[corner][0] += xOffset;\n box[corner][1] += yOffset;\n }\n }\n\n function moveLine(line) {\n line[0].x += xOffset;\n line[0].y += yOffset;\n line[1].x += xOffset;\n line[1].y += yOffset;\n }\n}\n\nfunction publishResult(result, imageData) {\n if (_onUIThread) {\n transformResult(result);\n if (imageData && result && result.codeResult) {\n if (_resultCollector) {\n _resultCollector.addResult(imageData, _inputStream.getCanvasSize(), result.codeResult);\n }\n }\n }\n\n Events.publish(\"processed\", result);\n if (result && result.codeResult) {\n Events.publish(\"detected\", result);\n }\n}\n\nfunction locateAndDecode() {\n var result,\n boxes;\n\n boxes = getBoundingBoxes();\n if (boxes) {\n result = _decoder.decodeFromBoundingBoxes(boxes);\n result = result || {};\n result.boxes = boxes;\n publishResult(result, _inputImageWrapper.data);\n } else {\n publishResult();\n }\n}\n\nfunction update() {\n var availableWorker;\n\n if (_onUIThread) {\n if (_workerPool.length > 0) {\n availableWorker = _workerPool.filter(function(workerThread) {\n return !workerThread.busy;\n })[0];\n if (availableWorker) {\n _framegrabber.attachData(availableWorker.imageData);\n } else {\n return; // all workers are busy\n }\n } else {\n _framegrabber.attachData(_inputImageWrapper.data);\n }\n if (_framegrabber.grab()) {\n if (availableWorker) {\n availableWorker.busy = true;\n availableWorker.worker.postMessage({\n cmd: 'process',\n imageData: availableWorker.imageData\n }, [availableWorker.imageData.buffer]);\n } else {\n locateAndDecode();\n }\n }\n } else {\n locateAndDecode();\n }\n}\n\nfunction start() {\n _stopped = false;\n ( function frame() {\n if (!_stopped) {\n update();\n if (_onUIThread && _config.inputStream.type == \"LiveStream\") {\n window.requestAnimFrame(frame);\n }\n }\n }());\n}\n\nfunction initWorkers(cb) {\n var i;\n _workerPool = [];\n\n for (i = 0; i < _config.numOfWorkers; i++) {\n initWorker(workerInitialized);\n }\n\n function workerInitialized(workerThread) {\n _workerPool.push(workerThread);\n if (_workerPool.length >= _config.numOfWorkers){\n cb();\n }\n }\n}\n\nfunction initWorker(cb) {\n var blobURL,\n workerThread = {\n worker: undefined,\n imageData: new Uint8Array(_inputStream.getWidth() * _inputStream.getHeight()),\n busy: true\n };\n\n blobURL = generateWorkerBlob();\n workerThread.worker = new Worker(blobURL);\n\n workerThread.worker.onmessage = function(e) {\n if (e.data.event === 'initialized') {\n URL.revokeObjectURL(blobURL);\n workerThread.busy = false;\n workerThread.imageData = new Uint8Array(e.data.imageData);\n console.log(\"Worker initialized\");\n return cb(workerThread);\n } else if (e.data.event === 'processed') {\n workerThread.imageData = new Uint8Array(e.data.imageData);\n workerThread.busy = false;\n publishResult(e.data.result, workerThread.imageData);\n } else if (e.data.event === 'error') {\n console.log(\"Worker error: \" + e.data.message);\n }\n };\n\n workerThread.worker.postMessage({\n cmd: 'init',\n size: {x: _inputStream.getWidth(), y: _inputStream.getHeight()},\n imageData: workerThread.imageData,\n config: _config\n }, [workerThread.imageData.buffer]);\n}\n\n\nfunction workerInterface(factory) {\n window = self;\n if (factory) {\n /* jshint ignore:start */\n var Quagga = factory();\n if (!Quagga) {\n self.postMessage({'event': 'error', message: 'Quagga could not be created'});\n return;\n }\n /* jshint ignore:end */\n }\n /* jshint ignore:start */\n var imageWrapper;\n\n self.onmessage = function(e) {\n if (e.data.cmd === 'init') {\n var config = e.data.config;\n config.numOfWorkers = 0;\n imageWrapper = new Quagga.ImageWrapper({\n x : e.data.size.x,\n y : e.data.size.y\n }, new Uint8Array(e.data.imageData));\n Quagga.init(config, ready, imageWrapper);\n Quagga.onProcessed(onProcessed);\n } else if (e.data.cmd === 'process') {\n imageWrapper.data = new Uint8Array(e.data.imageData);\n Quagga.start();\n } else if (e.data.cmd === 'setReaders') {\n Quagga.setReaders(e.data.readers);\n }\n };\n\n function onProcessed(result) {\n self.postMessage({'event': 'processed', imageData: imageWrapper.data, result: result}, [imageWrapper.data.buffer]);\n }\n\n function ready() {\n self.postMessage({'event': 'initialized', imageData: imageWrapper.data}, [imageWrapper.data.buffer]);\n }\n /* jshint ignore:end */\n}\n\nfunction generateWorkerBlob() {\n var blob,\n factorySource;\n\n /* jshint ignore:start */\n if (typeof __factorySource__ !== 'undefined') {\n factorySource = __factorySource__;\n }\n /* jshint ignore:end */\n\n blob = new Blob(['(' + workerInterface.toString() + ')(' + factorySource + ');'],\n {type : 'text/javascript'});\n\n return window.URL.createObjectURL(blob);\n}\n\nfunction setReaders(readers) {\n if (_decoder) {\n _decoder.setReaders(readers);\n } else if (_onUIThread && _workerPool.length > 0) {\n _workerPool.forEach(function(workerThread) {\n workerThread.worker.postMessage({cmd: 'setReaders', readers: readers});\n });\n }\n}\n\nexport default {\n init : function(config, cb, imageWrapper) {\n _config = merge({}, Config, config);\n if (imageWrapper) {\n _onUIThread = false;\n initializeData(imageWrapper);\n return cb();\n } else {\n initInputStream(cb);\n }\n },\n start : function() {\n start();\n },\n stop : function() {\n _stopped = true;\n _workerPool.forEach(function(workerThread) {\n workerThread.worker.terminate();\n console.log(\"Worker terminated!\");\n });\n _workerPool.length = 0;\n if (_config.inputStream.type === \"LiveStream\") {\n CameraAccess.release();\n _inputStream.clearEventHandlers();\n }\n },\n pause: function() {\n _stopped = true;\n },\n onDetected : function(callback) {\n Events.subscribe(\"detected\", callback);\n },\n offDetected: function(callback) {\n Events.unsubscribe(\"detected\", callback);\n },\n onProcessed: function(callback) {\n Events.subscribe(\"processed\", callback);\n },\n offProcessed: function(callback) {\n Events.unsubscribe(\"processed\", callback);\n },\n setReaders: function(readers) {\n setReaders(readers);\n },\n registerResultCollector: function(resultCollector) {\n if (resultCollector && typeof resultCollector.addResult === 'function') {\n _resultCollector = resultCollector;\n }\n },\n canvas : _canvasContainer,\n decodeSingle : function(config, resultCallback) {\n config = merge({\n inputStream: {\n type : \"ImageStream\",\n sequence : false,\n size: 800,\n src: config.src\n },\n numOfWorkers: 1,\n locator: {\n halfSample: false\n }\n }, config);\n this.init(config, function() {\n Events.once(\"processed\", function(result) {\n _stopped = true;\n resultCallback.call(null, result);\n }, true);\n start();\n });\n },\n ImageWrapper: ImageWrapper,\n ImageDebug: ImageDebug,\n ResultCollector: ResultCollector\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/quagga.js\n **/","/*\n * typedefs.js\n * Normalizes browser-specific prefixes\n */\n\n if (typeof window !== 'undefined') {\n window.requestAnimFrame = (function () {\n return window.requestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.oRequestAnimationFrame ||\n window.msRequestAnimationFrame ||\n function (/* function FrameRequestCallback */ callback, /* DOMElement Element */ element) {\n window.setTimeout(callback, 1000 / 60);\n };\n })();\n\n navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;\n }\n Math.imul = Math.imul || function(a, b) {\n var ah = (a >>> 16) & 0xffff,\n al = a & 0xffff,\n bh = (b >>> 16) & 0xffff,\n bl = b & 0xffff;\n // the shift by 0 fixes the sign on the high part\n // the final |0 converts the unsigned value into a signed value\n return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);\n };\n\nexport default {\n \n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/typedefs.js\n **/","import ImageLoader from './image_loader';\n\nvar InputStream = {};\nInputStream.createVideoStream = function(video) {\n var that = {},\n _config = null,\n _eventNames = ['canrecord', 'ended'],\n _eventHandlers = {},\n _calculatedWidth,\n _calculatedHeight,\n _topRight = {x: 0, y: 0},\n _canvasSize = {x: 0, y: 0};\n\n function initSize() {\n var width = video.videoWidth,\n height = video.videoHeight;\n\n _calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;\n _calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;\n\n _canvasSize.x = _calculatedWidth;\n _canvasSize.y = _calculatedHeight;\n }\n\n that.getRealWidth = function() {\n return video.videoWidth;\n };\n\n that.getRealHeight = function() {\n return video.videoHeight;\n };\n\n that.getWidth = function() {\n return _calculatedWidth;\n };\n\n that.getHeight = function() {\n return _calculatedHeight;\n };\n\n that.setWidth = function(width) {\n _calculatedWidth = width;\n };\n\n that.setHeight = function(height) {\n _calculatedHeight = height;\n };\n\n that.setInputStream = function(config) {\n _config = config;\n video.src = (typeof config.src !== 'undefined') ? config.src : '';\n };\n\n that.ended = function() {\n return video.ended;\n };\n\n that.getConfig = function() {\n return _config;\n };\n\n that.setAttribute = function(name, value) {\n video.setAttribute(name, value);\n };\n\n that.pause = function() {\n video.pause();\n };\n\n that.play = function() {\n video.play();\n };\n\n that.setCurrentTime = function(time) {\n if (_config.type !== \"LiveStream\")\n video.currentTime = time;\n };\n\n that.addEventListener = function(event, f, bool) {\n if (_eventNames.indexOf(event) !== -1) {\n if (!_eventHandlers[event]) {\n _eventHandlers[event] = [];\n }\n _eventHandlers[event].push(f);\n } else {\n video.addEventListener(event, f, bool);\n }\n };\n\n that.clearEventHandlers = function() {\n _eventNames.forEach(function(eventName) {\n var handlers = _eventHandlers[eventName];\n if (handlers && handlers.length > 0) {\n handlers.forEach(function(handler) {\n video.removeEventListener(eventName, handler);\n });\n }\n });\n };\n\n that.trigger = function(eventName, args) {\n var j,\n handlers = _eventHandlers[eventName];\n\n if (eventName === 'canrecord') {\n initSize();\n }\n if (handlers && handlers.length > 0) {\n for ( j = 0; j < handlers.length; j++) {\n handlers[j].apply(that, args);\n }\n }\n };\n\n that.setTopRight = function(topRight) {\n _topRight.x = topRight.x;\n _topRight.y = topRight.y;\n };\n\n that.getTopRight = function() {\n return _topRight;\n };\n\n that.setCanvasSize = function(size) {\n _canvasSize.x = size.x;\n _canvasSize.y = size.y;\n };\n\n that.getCanvasSize = function() {\n return _canvasSize;\n };\n\n that.getFrame = function() {\n return video;\n };\n\n return that;\n};\n\nInputStream.createLiveStream = function(video) {\n video.setAttribute(\"autoplay\", true);\n var that = InputStream.createVideoStream(video);\n\n that.ended = function() {\n return false;\n };\n\n return that;\n};\n\nInputStream.createImageStream = function() {\n var that = {};\n var _config = null;\n\n var width = 0,\n height = 0,\n frameIdx = 0,\n paused = true,\n loaded = false,\n imgArray = null,\n size = 0,\n offset = 1,\n baseUrl = null,\n ended = false,\n calculatedWidth,\n calculatedHeight,\n _eventNames = ['canrecord', 'ended'],\n _eventHandlers = {},\n _topRight = {x: 0, y: 0},\n _canvasSize = {x: 0, y: 0};\n\n function loadImages() {\n loaded = false;\n ImageLoader.load(baseUrl, function(imgs) {\n imgArray = imgs;\n width = imgs[0].width;\n height = imgs[0].height;\n calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;\n calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;\n _canvasSize.x = calculatedWidth;\n _canvasSize.y = calculatedHeight;\n loaded = true;\n frameIdx = 0;\n setTimeout(function() {\n publishEvent(\"canrecord\", []);\n }, 0);\n }, offset, size, _config.sequence);\n }\n\n function publishEvent(eventName, args) {\n var j,\n handlers = _eventHandlers[eventName];\n\n if (handlers && handlers.length > 0) {\n for ( j = 0; j < handlers.length; j++) {\n handlers[j].apply(that, args);\n }\n }\n }\n\n\n that.trigger = publishEvent;\n\n that.getWidth = function() {\n return calculatedWidth;\n };\n\n that.getHeight = function() {\n return calculatedHeight;\n };\n\n that.setWidth = function(width) {\n calculatedWidth = width;\n };\n\n that.setHeight = function(height) {\n calculatedHeight = height;\n };\n\n that.getRealWidth = function() {\n return width;\n };\n\n that.getRealHeight = function() {\n return height;\n };\n\n that.setInputStream = function(stream) {\n _config = stream;\n if (stream.sequence === false) {\n baseUrl = stream.src;\n size = 1;\n } else {\n baseUrl = stream.src;\n size = stream.length;\n }\n loadImages();\n };\n\n that.ended = function() {\n return ended;\n };\n\n that.setAttribute = function() {};\n\n that.getConfig = function() {\n return _config;\n };\n\n that.pause = function() {\n paused = true;\n };\n\n that.play = function() {\n paused = false;\n };\n\n that.setCurrentTime = function(time) {\n frameIdx = time;\n };\n\n that.addEventListener = function(event, f) {\n if (_eventNames.indexOf(event) !== -1) {\n if (!_eventHandlers[event]) {\n _eventHandlers[event] = [];\n }\n _eventHandlers[event].push(f);\n }\n };\n\n that.setTopRight = function(topRight) {\n _topRight.x = topRight.x;\n _topRight.y = topRight.y;\n };\n\n that.getTopRight = function() {\n return _topRight;\n };\n\n that.setCanvasSize = function(size) {\n _canvasSize.x = size.x;\n _canvasSize.y = size.y;\n };\n\n that.getCanvasSize = function() {\n return _canvasSize;\n };\n\n that.getFrame = function() {\n var frame;\n\n if (!loaded){\n return null;\n }\n if (!paused) {\n frame = imgArray[frameIdx];\n if (frameIdx < (size - 1)) {\n frameIdx++;\n } else {\n setTimeout(function() {\n ended = true;\n publishEvent(\"ended\", []);\n }, 0);\n }\n }\n return frame;\n };\n\n return that;\n};\n\nexport default InputStream;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/input_stream.js\n **/","var ImageLoader = {};\nImageLoader.load = function(directory, callback, offset, size, sequence) {\n var htmlImagesSrcArray = new Array(size),\n htmlImagesArray = new Array(htmlImagesSrcArray.length),\n i,\n img,\n num;\n\n if (sequence === false) {\n htmlImagesSrcArray[0] = directory;\n } else {\n for ( i = 0; i < htmlImagesSrcArray.length; i++) {\n num = (offset + i);\n htmlImagesSrcArray[i] = directory + \"image-\" + (\"00\" + num).slice(-3) + \".jpg\";\n }\n }\n htmlImagesArray.notLoaded = [];\n htmlImagesArray.addImage = function(img) {\n htmlImagesArray.notLoaded.push(img);\n };\n htmlImagesArray.loaded = function(loadedImg) {\n var notloadedImgs = htmlImagesArray.notLoaded;\n for (var x = 0; x < notloadedImgs.length; x++) {\n if (notloadedImgs[x] == loadedImg) {\n notloadedImgs.splice(x, 1);\n for (var y = 0; y < htmlImagesSrcArray.length; y++) {\n var imgName = htmlImagesSrcArray[y].substr(htmlImagesSrcArray[y].lastIndexOf(\"/\"));\n if (loadedImg.src.lastIndexOf(imgName) != -1) {\n htmlImagesArray[y] = loadedImg;\n break;\n }\n }\n break;\n }\n }\n if (notloadedImgs.length === 0) {\n console.log(\"Images loaded\");\n callback.apply(null, [htmlImagesArray]);\n }\n };\n\n for ( i = 0; i < htmlImagesSrcArray.length; i++) {\n img = new Image();\n htmlImagesArray.addImage(img);\n addOnloadHandler(img, htmlImagesArray);\n img.src = htmlImagesSrcArray[i];\n }\n};\n\nfunction addOnloadHandler(img, htmlImagesArray) {\n img.onload = function() {\n htmlImagesArray.loaded(this);\n };\n}\n\nexport default (ImageLoader);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_loader.js\n **/","import SubImage from './subImage';\nimport CVUtils from './cv_utils';\nimport ArrayHelper from './array_helper';\nimport {vec2, mat2} from 'gl-matrix';\n\n/**\n * Represents a basic image combining the data and size.\n * In addition, some methods for manipulation are contained.\n * @param size {x,y} The size of the image in pixel\n * @param data {Array} If given, a flat array containing the pixel data\n * @param ArrayType {Type} If given, the desired DataType of the Array (may be typed/non-typed)\n * @param initialize {Boolean} Indicating if the array should be initialized on creation.\n * @returns {ImageWrapper}\n */\nfunction ImageWrapper(size, data, ArrayType, initialize) {\n if (!data) {\n if (ArrayType) {\n this.data = new ArrayType(size.x * size.y);\n if (ArrayType === Array && initialize) {\n ArrayHelper.init(this.data, 0);\n }\n } else {\n this.data = new Uint8Array(size.x * size.y);\n if (Uint8Array === Array && initialize) {\n ArrayHelper.init(this.data, 0);\n }\n }\n\n } else {\n this.data = data;\n }\n this.size = size;\n}\n\n/**\n * tests if a position is within the image with a given offset\n * @param imgRef {x, y} The location to test\n * @param border Number the padding value in pixel\n * @returns {Boolean} true if location inside the image's border, false otherwise\n * @see cvd/image.h\n */\nImageWrapper.prototype.inImageWithBorder = function(imgRef, border) {\n return (imgRef.x >= border) && (imgRef.y >= border) && (imgRef.x < (this.size.x - border)) && (imgRef.y < (this.size.y - border));\n};\n\n/**\n * Transforms an image according to the given affine-transformation matrix.\n * @param inImg ImageWrapper a image containing the information to be extracted.\n * @param outImg ImageWrapper the image to be filled. The whole image out image is filled by the in image.\n * @param M mat2 the matrix used to map point in the out matrix to those in the in matrix\n * @param inOrig vec2 origin in the in image\n * @param outOrig vec2 origin in the out image\n * @returns Number the number of pixels not in the in image\n * @see cvd/vision.h\n */\nImageWrapper.transform = function(inImg, outImg, M, inOrig, outOrig) {\n var w = outImg.size.x, h = outImg.size.y, iw = inImg.size.x, ih = inImg.size.y;\n var across = vec2.clone([M[0], M[2]]);\n var down = vec2.clone([M[1], M[3]]);\n var defaultValue = 0;\n\n var p0 = vec2.subtract(inOrig, mat2.xVec2(M, outOrig, vec2.clone()), vec2.clone());\n\n var min_x = p0[0], min_y = p0[1];\n var max_x = min_x, max_y = min_y;\n var p, i, j;\n\n var sampleFunc = ImageWrapper.sample;\n\n if (across[0] < 0)\n min_x += w * across[0];\n else\n max_x += w * across[0];\n\n if (down[0] < 0)\n min_x += h * down[0];\n else\n max_x += h * down[0];\n\n if (across[1] < 0)\n min_y += w * across[1];\n else\n max_y += w * across[1];\n\n if (down[1] < 0)\n min_y += h * down[1];\n else\n max_y += h * down[1];\n\n var carrigeReturn = vec2.subtract(down, vec2.scale(across, w, vec2.clone()), vec2.clone());\n\n if (min_x >= 0 && min_y >= 0 && max_x < iw - 1 && max_y < ih - 1) {\n p = p0;\n for ( i = 0; i < h; ++i, vec2.add(p, carrigeReturn))\n for ( j = 0; j < w; ++j, vec2.add(p, across))\n outImg.set(j, i, sampleFunc(inImg, p[0], p[1]));\n return 0;\n } else {\n var x_bound = iw - 1;\n var y_bound = ih - 1;\n var count = 0;\n p = p0;\n for ( i = 0; i < h; ++i, vec2.add(p, carrigeReturn)) {\n for ( j = 0; j < w; ++j, vec2.add(p, across)) {\n if (0 <= p[0] && 0 <= p[1] && p[0] < x_bound && p[1] < y_bound) {\n outImg.set(j, i, sampleFunc(inImg, p[0], p[1]));\n } else {\n outImg.set(j, i, defaultValue); ++count;\n }\n }\n }\n return count;\n }\n};\n\n/**\n * Performs bilinear sampling\n * @param inImg Image to extract sample from\n * @param x the x-coordinate\n * @param y the y-coordinate\n * @returns the sampled value\n * @see cvd/vision.h\n */\nImageWrapper.sample = function(inImg, x, y) {\n var lx = Math.floor(x);\n var ly = Math.floor(y);\n var w = inImg.size.x;\n var base = ly * inImg.size.x + lx;\n var a = inImg.data[base + 0];\n var b = inImg.data[base + 1];\n var c = inImg.data[base + w];\n var d = inImg.data[base + w + 1];\n var e = a - b;\n x -= lx;\n y -= ly;\n\n var result = Math.floor(x * (y * (e - c + d) - e) + y * (c - a) + a);\n return result;\n};\n\n/**\n * Initializes a given array. Sets each element to zero.\n * @param array {Array} The array to initialize\n */\nImageWrapper.clearArray = function(array) {\n var l = array.length;\n while (l--) {\n array[l] = 0;\n }\n};\n\n/**\n * Creates a {SubImage} from the current image ({this}).\n * @param from {ImageRef} The position where to start the {SubImage} from. (top-left corner)\n * @param size {ImageRef} The size of the resulting image\n * @returns {SubImage} A shared part of the original image\n */\nImageWrapper.prototype.subImage = function(from, size) {\n return new SubImage(from, size, this);\n};\n\n/**\n * Creates an {ImageWrapper) and copies the needed underlying image-data area\n * @param imageWrapper {ImageWrapper} The target {ImageWrapper} where the data should be copied\n * @param from {ImageRef} The location where to copy from (top-left location)\n */\nImageWrapper.prototype.subImageAsCopy = function(imageWrapper, from) {\n var sizeY = imageWrapper.size.y, sizeX = imageWrapper.size.x;\n var x, y;\n for ( x = 0; x < sizeX; x++) {\n for ( y = 0; y < sizeY; y++) {\n imageWrapper.data[y * sizeX + x] = this.data[(from.y + y) * this.size.x + from.x + x];\n }\n }\n};\n\nImageWrapper.prototype.copyTo = function(imageWrapper) {\n var length = this.data.length, srcData = this.data, dstData = imageWrapper.data;\n\n while (length--) {\n dstData[length] = srcData[length];\n }\n};\n\n/**\n * Retrieves a given pixel position from the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nImageWrapper.prototype.get = function(x, y) {\n return this.data[y * this.size.x + x];\n};\n\n/**\n * Retrieves a given pixel position from the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nImageWrapper.prototype.getSafe = function(x, y) {\n var i;\n\n if (!this.indexMapping) {\n this.indexMapping = {\n x : [],\n y : []\n };\n for (i = 0; i < this.size.x; i++) {\n this.indexMapping.x[i] = i;\n this.indexMapping.x[i + this.size.x] = i;\n }\n for (i = 0; i < this.size.y; i++) {\n this.indexMapping.y[i] = i;\n this.indexMapping.y[i + this.size.y] = i;\n }\n }\n return this.data[(this.indexMapping.y[y + this.size.y]) * this.size.x + this.indexMapping.x[x + this.size.x]];\n};\n\n/**\n * Sets a given pixel position in the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @param value {Number} The grayscale value to set\n * @returns {ImageWrapper} The Image itself (for possible chaining)\n */\nImageWrapper.prototype.set = function(x, y, value) {\n this.data[y * this.size.x + x] = value;\n return this;\n};\n\n/**\n * Sets the border of the image (1 pixel) to zero\n */\nImageWrapper.prototype.zeroBorder = function() {\n var i, width = this.size.x, height = this.size.y, data = this.data;\n for ( i = 0; i < width; i++) {\n data[i] = data[(height - 1) * width + i] = 0;\n }\n for ( i = 1; i < height - 1; i++) {\n data[i * width] = data[i * width + (width - 1)] = 0;\n }\n};\n\n/**\n * Inverts a binary image in place\n */\nImageWrapper.prototype.invert = function() {\n var data = this.data, length = data.length;\n\n while (length--) {\n data[length] = data[length] ? 0 : 1;\n }\n\n};\n\nImageWrapper.prototype.convolve = function(kernel) {\n var x, y, kx, ky, kSize = (kernel.length / 2) | 0, accu = 0;\n for ( y = 0; y < this.size.y; y++) {\n for ( x = 0; x < this.size.x; x++) {\n accu = 0;\n for ( ky = -kSize; ky <= kSize; ky++) {\n for ( kx = -kSize; kx <= kSize; kx++) {\n accu += kernel[ky+kSize][kx + kSize] * this.getSafe(x + kx, y + ky);\n }\n }\n this.data[y * this.size.x + x] = accu;\n }\n }\n};\n\nImageWrapper.prototype.moments = function(labelcount) {\n var data = this.data,\n x,\n y,\n height = this.size.y,\n width = this.size.x,\n val,\n ysq,\n labelsum = [],\n i,\n label,\n mu11,\n mu02,\n mu20,\n x_,\n y_,\n tmp,\n result = [],\n PI = Math.PI,\n PI_4 = PI / 4;\n\n if (labelcount <= 0) {\n return result;\n }\n\n for ( i = 0; i < labelcount; i++) {\n labelsum[i] = {\n m00 : 0,\n m01 : 0,\n m10 : 0,\n m11 : 0,\n m02 : 0,\n m20 : 0,\n theta : 0,\n rad : 0\n };\n }\n\n for ( y = 0; y < height; y++) {\n ysq = y * y;\n for ( x = 0; x < width; x++) {\n val = data[y * width + x];\n if (val > 0) {\n label = labelsum[val - 1];\n label.m00 += 1;\n label.m01 += y;\n label.m10 += x;\n label.m11 += x * y;\n label.m02 += ysq;\n label.m20 += x * x;\n }\n }\n }\n\n for ( i = 0; i < labelcount; i++) {\n label = labelsum[i];\n if (!isNaN(label.m00) && label.m00 !== 0) {\n x_ = label.m10 / label.m00;\n y_ = label.m01 / label.m00;\n mu11 = label.m11 / label.m00 - x_ * y_;\n mu02 = label.m02 / label.m00 - y_ * y_;\n mu20 = label.m20 / label.m00 - x_ * x_;\n tmp = (mu02 - mu20) / (2 * mu11);\n tmp = 0.5 * Math.atan(tmp) + (mu11 >= 0 ? PI_4 : -PI_4 ) + PI;\n label.theta = (tmp * 180 / PI + 90) % 180 - 90;\n if (label.theta < 0) {\n label.theta += 180;\n }\n label.rad = tmp > PI ? tmp - PI : tmp;\n label.vec = vec2.clone([Math.cos(tmp), Math.sin(tmp)]);\n result.push(label);\n }\n }\n\n return result;\n};\n\n/**\n * Displays the {ImageWrapper} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nImageWrapper.prototype.show = function(canvas, scale) {\n var ctx,\n frame,\n data,\n current,\n pixel,\n x,\n y;\n\n if (!scale) {\n scale = 1.0;\n }\n ctx = canvas.getContext('2d');\n canvas.width = this.size.x;\n canvas.height = this.size.y;\n frame = ctx.getImageData(0, 0, canvas.width, canvas.height);\n data = frame.data;\n current = 0;\n for (y = 0; y < this.size.y; y++) {\n for (x = 0; x < this.size.x; x++) {\n pixel = y * this.size.x + x;\n current = this.get(x, y) * scale;\n data[pixel * 4 + 0] = current;\n data[pixel * 4 + 1] = current;\n data[pixel * 4 + 2] = current;\n data[pixel * 4 + 3] = 255;\n }\n }\n //frame.data = data;\n ctx.putImageData(frame, 0, 0);\n};\n\n/**\n * Displays the {SubImage} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nImageWrapper.prototype.overlay = function(canvas, scale, from) {\n if (!scale || scale < 0 || scale > 360) {\n scale = 360;\n }\n var hsv = [0, 1, 1];\n var rgb = [0, 0, 0];\n var whiteRgb = [255, 255, 255];\n var blackRgb = [0, 0, 0];\n var result = [];\n var ctx = canvas.getContext('2d');\n var frame = ctx.getImageData(from.x, from.y, this.size.x, this.size.y);\n var data = frame.data;\n var length = this.data.length;\n while (length--) {\n hsv[0] = this.data[length] * scale;\n result = hsv[0] <= 0 ? whiteRgb : hsv[0] >= 360 ? blackRgb : CVUtils.hsv2rgb(hsv, rgb);\n data[length * 4 + 0] = result[0];\n data[length * 4 + 1] = result[1];\n data[length * 4 + 2] = result[2];\n data[length * 4 + 3] = 255;\n }\n ctx.putImageData(frame, from.x, from.y);\n};\n\nexport default ImageWrapper;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_wrapper.js\n **/","/**\n * Construct representing a part of another {ImageWrapper}. Shares data\n * between the parent and the child.\n * @param from {ImageRef} The position where to start the {SubImage} from. (top-left corner)\n * @param size {ImageRef} The size of the resulting image\n * @param I {ImageWrapper} The {ImageWrapper} to share from\n * @returns {SubImage} A shared part of the original image\n */\nfunction SubImage(from, size, I) {\n if (!I) {\n I = {\n data : null,\n size : size\n };\n }\n this.data = I.data;\n this.originalSize = I.size;\n this.I = I;\n\n this.from = from;\n this.size = size;\n}\n\n/**\n * Displays the {SubImage} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nSubImage.prototype.show = function(canvas, scale) {\n var ctx,\n frame,\n data,\n current,\n y,\n x,\n pixel;\n\n if (!scale) {\n scale = 1.0;\n }\n ctx = canvas.getContext('2d');\n canvas.width = this.size.x;\n canvas.height = this.size.y;\n frame = ctx.getImageData(0, 0, canvas.width, canvas.height);\n data = frame.data;\n current = 0;\n for (y = 0; y < this.size.y; y++) {\n for (x = 0; x < this.size.x; x++) {\n pixel = y * this.size.x + x;\n current = this.get(x, y) * scale;\n data[pixel * 4 + 0] = current;\n data[pixel * 4 + 1] = current;\n data[pixel * 4 + 2] = current;\n data[pixel * 4 + 3] = 255;\n }\n }\n frame.data = data;\n ctx.putImageData(frame, 0, 0);\n};\n\n/**\n * Retrieves a given pixel position from the {SubImage}\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nSubImage.prototype.get = function(x, y) {\n return this.data[(this.from.y + y) * this.originalSize.x + this.from.x + x];\n};\n\n/**\n * Updates the underlying data from a given {ImageWrapper}\n * @param image {ImageWrapper} The updated image\n */\nSubImage.prototype.updateData = function(image) {\n this.originalSize = image.size;\n this.data = image.data;\n};\n\n/**\n * Updates the position of the shared area\n * @param from {x,y} The new location\n * @returns {SubImage} returns {this} for possible chaining\n */\nSubImage.prototype.updateFrom = function(from) {\n this.from = from;\n return this;\n};\n\nexport default (SubImage);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/subImage.js\n **/","import Cluster2 from './cluster';\nimport ArrayHelper from './array_helper';\nimport {vec2, vec3} from 'gl-matrix';\n\nvar CVUtils = {};\n\n/**\n * @param x x-coordinate\n * @param y y-coordinate\n * @return ImageReference {x,y} Coordinate\n */\nCVUtils.imageRef = function(x, y) {\n var that = {\n x : x,\n y : y,\n toVec2 : function() {\n return vec2.clone([this.x, this.y]);\n },\n toVec3 : function() {\n return vec3.clone([this.x, this.y, 1]);\n },\n round : function() {\n this.x = this.x > 0.0 ? Math.floor(this.x + 0.5) : Math.floor(this.x - 0.5);\n this.y = this.y > 0.0 ? Math.floor(this.y + 0.5) : Math.floor(this.y - 0.5);\n return this;\n }\n };\n return that;\n};\n\n/**\n * Computes an integral image of a given grayscale image.\n * @param imageDataContainer {ImageDataContainer} the image to be integrated\n */\nCVUtils.computeIntegralImage2 = function(imageWrapper, integralWrapper) {\n var imageData = imageWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0, posA = 0, posB = 0, posC = 0, posD = 0, x, y;\n\n // sum up first column\n posB = width;\n sum = 0;\n for ( y = 1; y < height; y++) {\n sum += imageData[posA];\n integralImageData[posB] += sum;\n posA += width;\n posB += width;\n }\n\n posA = 0;\n posB = 1;\n sum = 0;\n for ( x = 1; x < width; x++) {\n sum += imageData[posA];\n integralImageData[posB] += sum;\n posA++;\n posB++;\n }\n\n for ( y = 1; y < height; y++) {\n posA = y * width + 1;\n posB = (y - 1) * width + 1;\n posC = y * width;\n posD = (y - 1) * width;\n for ( x = 1; x < width; x++) {\n integralImageData[posA] += imageData[posA] + integralImageData[posB] + integralImageData[posC] - integralImageData[posD];\n posA++;\n posB++;\n posC++;\n posD++;\n }\n }\n};\n\nCVUtils.computeIntegralImage = function(imageWrapper, integralWrapper) {\n var imageData = imageWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0;\n\n // sum up first row\n for (var i = 0; i < width; i++) {\n sum += imageData[i];\n integralImageData[i] = sum;\n }\n\n for (var v = 1; v < height; v++) {\n sum = 0;\n for (var u = 0; u < width; u++) {\n sum += imageData[v * width + u];\n integralImageData[((v) * width) + u] = sum + integralImageData[(v - 1) * width + u];\n }\n }\n};\n\nCVUtils.thresholdImage = function(imageWrapper, threshold, targetWrapper) {\n if (!targetWrapper) {\n targetWrapper = imageWrapper;\n }\n var imageData = imageWrapper.data, length = imageData.length, targetData = targetWrapper.data;\n\n while (length--) {\n targetData[length] = imageData[length] < threshold ? 1 : 0;\n }\n};\n\nCVUtils.computeHistogram = function(imageWrapper, bitsPerPixel) {\n if (!bitsPerPixel) {\n bitsPerPixel = 8;\n }\n var imageData = imageWrapper.data,\n length = imageData.length,\n bitShift = 8 - bitsPerPixel,\n bucketCnt = 1 << bitsPerPixel,\n hist = new Int32Array(bucketCnt);\n\n while (length--) {\n hist[imageData[length] >> bitShift]++;\n }\n return hist;\n};\n\nCVUtils.sharpenLine = function(line) {\n var i,\n length = line.length,\n left = line[0],\n center = line[1],\n right;\n\n for (i = 1; i < length - 1; i++) {\n right = line[i + 1];\n // -1 4 -1 kernel\n line[i-1] = (((center * 2) - left - right)) & 255;\n left = center;\n center = right;\n }\n return line;\n};\n\nCVUtils.determineOtsuThreshold = function(imageWrapper, bitsPerPixel) {\n if (!bitsPerPixel) {\n bitsPerPixel = 8;\n }\n var hist,\n threshold,\n bitShift = 8 - bitsPerPixel;\n\n function px(init, end) {\n var sum = 0, i;\n for ( i = init; i <= end; i++) {\n sum += hist[i];\n }\n return sum;\n }\n\n function mx(init, end) {\n var i, sum = 0;\n\n for ( i = init; i <= end; i++) {\n sum += i * hist[i];\n }\n\n return sum;\n }\n\n function determineThreshold() {\n var vet = [0], p1, p2, p12, k, m1, m2, m12,\n max = (1 << bitsPerPixel) - 1;\n\n hist = CVUtils.computeHistogram(imageWrapper, bitsPerPixel);\n for ( k = 1; k < max; k++) {\n p1 = px(0, k);\n p2 = px(k + 1, max);\n p12 = p1 * p2;\n if (p12 === 0) {\n p12 = 1;\n }\n m1 = mx(0, k) * p2;\n m2 = mx(k + 1, max) * p1;\n m12 = m1 - m2;\n vet[k] = m12 * m12 / p12;\n }\n return ArrayHelper.maxIndex(vet);\n }\n\n threshold = determineThreshold();\n return threshold << bitShift;\n};\n\nCVUtils.otsuThreshold = function(imageWrapper, targetWrapper) {\n var threshold = CVUtils.determineOtsuThreshold(imageWrapper);\n\n CVUtils.thresholdImage(imageWrapper, threshold, targetWrapper);\n return threshold;\n};\n\n// local thresholding\nCVUtils.computeBinaryImage = function(imageWrapper, integralWrapper, targetWrapper) {\n CVUtils.computeIntegralImage(imageWrapper, integralWrapper);\n\n if (!targetWrapper) {\n targetWrapper = imageWrapper;\n }\n var imageData = imageWrapper.data;\n var targetData = targetWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0, v, u, kernel = 3, A, B, C, D, avg, size = (kernel * 2 + 1) * (kernel * 2 + 1);\n\n // clear out top & bottom-border\n for ( v = 0; v <= kernel; v++) {\n for ( u = 0; u < width; u++) {\n targetData[((v) * width) + u] = 0;\n targetData[(((height - 1) - v) * width) + u] = 0;\n }\n }\n\n // clear out left & right border\n for ( v = kernel; v < height - kernel; v++) {\n for ( u = 0; u <= kernel; u++) {\n targetData[((v) * width) + u] = 0;\n targetData[((v) * width) + (width - 1 - u)] = 0;\n }\n }\n\n for ( v = kernel + 1; v < height - kernel - 1; v++) {\n for ( u = kernel + 1; u < width - kernel; u++) {\n A = integralImageData[(v - kernel - 1) * width + (u - kernel - 1)];\n B = integralImageData[(v - kernel - 1) * width + (u + kernel)];\n C = integralImageData[(v + kernel) * width + (u - kernel - 1)];\n D = integralImageData[(v + kernel) * width + (u + kernel)];\n sum = D - C - B + A;\n avg = sum / (size);\n targetData[v * width + u] = imageData[v * width + u] > (avg + 5) ? 0 : 1;\n }\n }\n};\n\nCVUtils.cluster = function(points, threshold, property) {\n var i, k, cluster, point, clusters = [];\n\n if (!property) {\n property = \"rad\";\n }\n\n function addToCluster(point) {\n var found = false;\n for ( k = 0; k < clusters.length; k++) {\n cluster = clusters[k];\n if (cluster.fits(point)) {\n cluster.add(point);\n found = true;\n }\n }\n return found;\n }\n\n // iterate over each cloud\n for ( i = 0; i < points.length; i++) {\n point = Cluster2.createPoint(points[i], i, property);\n if (!addToCluster(point)) {\n clusters.push(Cluster2.create(point, threshold));\n }\n }\n\n return clusters;\n\n};\n\nCVUtils.Tracer = {\n trace : function(points, vec) {\n var iteration, maxIterations = 10, top = [], result = [], centerPos = 0, currentPos = 0;\n\n function trace(idx, forward) {\n var from, to, toIdx, predictedPos, thresholdX = 1, thresholdY = Math.abs(vec[1] / 10), found = false;\n\n function match(pos, predicted) {\n if (pos.x > (predicted.x - thresholdX) && pos.x < (predicted.x + thresholdX) && pos.y > (predicted.y - thresholdY) && pos.y < (predicted.y + thresholdY)) {\n return true;\n } else {\n return false;\n }\n }\n\n // check if the next index is within the vec specifications\n // if not, check as long as the threshold is met\n\n from = points[idx];\n if (forward) {\n predictedPos = {\n x : from.x + vec[0],\n y : from.y + vec[1]\n };\n } else {\n predictedPos = {\n x : from.x - vec[0],\n y : from.y - vec[1]\n };\n }\n\n toIdx = forward ? idx + 1 : idx - 1;\n to = points[toIdx];\n while (to && ( found = match(to, predictedPos)) !== true && (Math.abs(to.y - from.y) < vec[1])) {\n toIdx = forward ? toIdx + 1 : toIdx - 1;\n to = points[toIdx];\n }\n\n return found ? toIdx : null;\n }\n\n for ( iteration = 0; iteration < maxIterations; iteration++) {\n // randomly select point to start with\n centerPos = Math.floor(Math.random() * points.length);\n\n // trace forward\n top = [];\n currentPos = centerPos;\n top.push(points[currentPos]);\n while (( currentPos = trace(currentPos, true)) !== null) {\n top.push(points[currentPos]);\n }\n if (centerPos > 0) {\n currentPos = centerPos;\n while (( currentPos = trace(currentPos, false)) !== null) {\n top.push(points[currentPos]);\n }\n }\n\n if (top.length > result.length) {\n result = top;\n }\n }\n\n return result;\n\n }\n};\n\nCVUtils.DILATE = 1;\nCVUtils.ERODE = 2;\n\nCVUtils.dilate = function(inImageWrapper, outImageWrapper) {\n var v, u, inImageData = inImageWrapper.data, outImageData = outImageWrapper.data, height = inImageWrapper.size.y, width = inImageWrapper.size.x, sum, yStart1, yStart2, xStart1, xStart2;\n\n for ( v = 1; v < height - 1; v++) {\n for ( u = 1; u < width - 1; u++) {\n yStart1 = v - 1;\n yStart2 = v + 1;\n xStart1 = u - 1;\n xStart2 = u + 1;\n sum = inImageData[yStart1 * width + xStart1]/* + inImageData[yStart1*width+u] */ + inImageData[yStart1 * width + xStart2] +\n /* inImageData[v*width+xStart1] + */\n inImageData[v * width + u] + /* inImageData[v*width+xStart2] +*/\n inImageData[yStart2 * width + xStart1]/* + inImageData[yStart2*width+u]*/ + inImageData[yStart2 * width + xStart2];\n outImageData[v * width + u] = sum > 0 ? 1 : 0;\n }\n }\n};\n\nCVUtils.erode = function(inImageWrapper, outImageWrapper) {\n var v, u, inImageData = inImageWrapper.data, outImageData = outImageWrapper.data, height = inImageWrapper.size.y, width = inImageWrapper.size.x, sum, yStart1, yStart2, xStart1, xStart2;\n\n for ( v = 1; v < height - 1; v++) {\n for ( u = 1; u < width - 1; u++) {\n yStart1 = v - 1;\n yStart2 = v + 1;\n xStart1 = u - 1;\n xStart2 = u + 1;\n sum = inImageData[yStart1 * width + xStart1]/* + inImageData[yStart1*width+u] */ + inImageData[yStart1 * width + xStart2] +\n /* inImageData[v*width+xStart1] + */\n inImageData[v * width + u] + /* inImageData[v*width+xStart2] +*/\n inImageData[yStart2 * width + xStart1]/* + inImageData[yStart2*width+u]*/ + inImageData[yStart2 * width + xStart2];\n outImageData[v * width + u] = sum === 5 ? 1 : 0;\n }\n }\n};\n\nCVUtils.subtract = function(aImageWrapper, bImageWrapper, resultImageWrapper) {\n if (!resultImageWrapper) {\n resultImageWrapper = aImageWrapper;\n }\n var length = aImageWrapper.data.length, aImageData = aImageWrapper.data, bImageData = bImageWrapper.data, cImageData = resultImageWrapper.data;\n\n while (length--) {\n cImageData[length] = aImageData[length] - bImageData[length];\n }\n};\n\nCVUtils.bitwiseOr = function(aImageWrapper, bImageWrapper, resultImageWrapper) {\n if (!resultImageWrapper) {\n resultImageWrapper = aImageWrapper;\n }\n var length = aImageWrapper.data.length, aImageData = aImageWrapper.data, bImageData = bImageWrapper.data, cImageData = resultImageWrapper.data;\n\n while (length--) {\n cImageData[length] = aImageData[length] || bImageData[length];\n }\n};\n\nCVUtils.countNonZero = function(imageWrapper) {\n var length = imageWrapper.data.length, data = imageWrapper.data, sum = 0;\n\n while (length--) {\n sum += data[length];\n }\n return sum;\n};\n\nCVUtils.topGeneric = function(list, top, scoreFunc) {\n var i, minIdx = 0, min = 0, queue = [], score, hit, pos;\n\n for ( i = 0; i < top; i++) {\n queue[i] = {\n score : 0,\n item : null\n };\n }\n\n for ( i = 0; i < list.length; i++) {\n score = scoreFunc.apply(this, [list[i]]);\n if (score > min) {\n hit = queue[minIdx];\n hit.score = score;\n hit.item = list[i];\n min = Number.MAX_VALUE;\n for ( pos = 0; pos < top; pos++) {\n if (queue[pos].score < min) {\n min = queue[pos].score;\n minIdx = pos;\n }\n }\n }\n }\n\n return queue;\n};\n\nCVUtils.grayArrayFromImage = function(htmlImage, offsetX, ctx, array) {\n ctx.drawImage(htmlImage, offsetX, 0, htmlImage.width, htmlImage.height);\n var ctxData = ctx.getImageData(offsetX, 0, htmlImage.width, htmlImage.height).data;\n CVUtils.computeGray(ctxData, array);\n};\n\nCVUtils.grayArrayFromContext = function(ctx, size, offset, array) {\n var ctxData = ctx.getImageData(offset.x, offset.y, size.x, size.y).data;\n CVUtils.computeGray(ctxData, array);\n};\n\nCVUtils.grayAndHalfSampleFromCanvasData = function(canvasData, size, outArray) {\n var topRowIdx = 0;\n var bottomRowIdx = size.x;\n var endIdx = Math.floor(canvasData.length / 4);\n var outWidth = size.x / 2;\n var outImgIdx = 0;\n var inWidth = size.x;\n var i;\n\n while (bottomRowIdx < endIdx) {\n for ( i = 0; i < outWidth; i++) {\n outArray[outImgIdx] = Math.floor(((0.299 * canvasData[topRowIdx * 4 + 0] + 0.587 * canvasData[topRowIdx * 4 + 1] + 0.114 * canvasData[topRowIdx * 4 + 2]) + (0.299 * canvasData[(topRowIdx + 1) * 4 + 0] + 0.587 * canvasData[(topRowIdx + 1) * 4 + 1] + 0.114 * canvasData[(topRowIdx + 1) * 4 + 2]) + (0.299 * canvasData[(bottomRowIdx) * 4 + 0] + 0.587 * canvasData[(bottomRowIdx) * 4 + 1] + 0.114 * canvasData[(bottomRowIdx) * 4 + 2]) + (0.299 * canvasData[(bottomRowIdx + 1) * 4 + 0] + 0.587 * canvasData[(bottomRowIdx + 1) * 4 + 1] + 0.114 * canvasData[(bottomRowIdx + 1) * 4 + 2])) / 4);\n outImgIdx++;\n topRowIdx = topRowIdx + 2;\n bottomRowIdx = bottomRowIdx + 2;\n }\n topRowIdx = topRowIdx + inWidth;\n bottomRowIdx = bottomRowIdx + inWidth;\n }\n\n};\n\nCVUtils.computeGray = function(imageData, outArray, config) {\n var l = (imageData.length / 4) | 0,\n i,\n singleChannel = config && config.singleChannel === true;\n\n if (singleChannel) {\n for (i = 0; i < l; i++) {\n outArray[i] = imageData[i * 4 + 0];\n }\n } else {\n for (i = 0; i < l; i++) {\n outArray[i] = Math.floor(0.299 * imageData[i * 4 + 0] + 0.587 * imageData[i * 4 + 1] + 0.114 * imageData[i * 4 + 2]);\n }\n }\n};\n\nCVUtils.loadImageArray = function(src, callback, canvas) {\n if (!canvas)\n canvas = document.createElement('canvas');\n var img = new Image();\n img.callback = callback;\n img.onload = function() {\n canvas.width = this.width;\n canvas.height = this.height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(this, 0, 0);\n var array = new Uint8Array(this.width * this.height);\n ctx.drawImage(this, 0, 0);\n var data = ctx.getImageData(0, 0, this.width, this.height).data;\n CVUtils.computeGray(data, array);\n this.callback(array, {\n x : this.width,\n y : this.height\n }, this);\n };\n img.src = src;\n};\n\n/**\n * @param inImg {ImageWrapper} input image to be sampled\n * @param outImg {ImageWrapper} to be stored in\n */\nCVUtils.halfSample = function(inImgWrapper, outImgWrapper) {\n var inImg = inImgWrapper.data;\n var inWidth = inImgWrapper.size.x;\n var outImg = outImgWrapper.data;\n var topRowIdx = 0;\n var bottomRowIdx = inWidth;\n var endIdx = inImg.length;\n var outWidth = inWidth / 2;\n var outImgIdx = 0;\n while (bottomRowIdx < endIdx) {\n for (var i = 0; i < outWidth; i++) {\n outImg[outImgIdx] = Math.floor((inImg[topRowIdx] + inImg[topRowIdx + 1] + inImg[bottomRowIdx] + inImg[bottomRowIdx + 1]) / 4);\n outImgIdx++;\n topRowIdx = topRowIdx + 2;\n bottomRowIdx = bottomRowIdx + 2;\n }\n topRowIdx = topRowIdx + inWidth;\n bottomRowIdx = bottomRowIdx + inWidth;\n }\n};\n\nCVUtils.hsv2rgb = function(hsv, rgb) {\n var h = hsv[0], s = hsv[1], v = hsv[2], c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c, r = 0, g = 0, b = 0;\n rgb = rgb || [0, 0, 0];\n\n if (h < 60) {\n r = c;\n g = x;\n } else if (h < 120) {\n r = x;\n g = c;\n } else if (h < 180) {\n g = c;\n b = x;\n } else if (h < 240) {\n g = x;\n b = c;\n } else if (h < 300) {\n r = x;\n b = c;\n } else if (h < 360) {\n r = c;\n b = x;\n }\n rgb[0] = ((r + m) * 255) | 0;\n rgb[1] = ((g + m) * 255) | 0;\n rgb[2] = ((b + m) * 255) | 0;\n return rgb;\n};\n\nCVUtils._computeDivisors = function(n) {\n var largeDivisors = [],\n divisors = [],\n i;\n\n for (i = 1; i < Math.sqrt(n) + 1; i++) {\n if (n % i === 0) {\n divisors.push(i);\n if (i !== n/i) {\n largeDivisors.unshift(Math.floor(n/i));\n }\n }\n }\n return divisors.concat(largeDivisors);\n};\n\nCVUtils._computeIntersection = function(arr1, arr2) {\n var i = 0,\n j = 0,\n result = [];\n\n while (i < arr1.length && j < arr2.length) {\n if (arr1[i] === arr2[j]) {\n result.push(arr1[i]);\n i++;\n j++;\n } else if (arr1[i] > arr2[j]) {\n j++;\n } else {\n i++;\n }\n }\n return result;\n};\n\nCVUtils.calculatePatchSize = function(patchSize, imgSize) {\n var divisorsX = this._computeDivisors(imgSize.x),\n divisorsY = this._computeDivisors(imgSize.y),\n wideSide = Math.max(imgSize.x, imgSize.y),\n common = this._computeIntersection(divisorsX, divisorsY),\n nrOfPatchesList = [8, 10, 15, 20, 32, 60, 80],\n nrOfPatchesMap = {\n \"x-small\": 5,\n \"small\": 4,\n \"medium\": 3,\n \"large\": 2,\n \"x-large\": 1\n },\n nrOfPatchesIdx = nrOfPatchesMap[patchSize] || nrOfPatchesMap.medium,\n nrOfPatches = nrOfPatchesList[nrOfPatchesIdx],\n desiredPatchSize = Math.floor(wideSide/nrOfPatches),\n optimalPatchSize;\n\n function findPatchSizeForDivisors(divisors) {\n var i = 0,\n found = divisors[Math.floor(divisors.length/2)];\n\n while(i < (divisors.length - 1) && divisors[i] < desiredPatchSize) {\n i++;\n }\n if (i > 0) {\n if (Math.abs(divisors[i] - desiredPatchSize) > Math.abs(divisors[i-1] - desiredPatchSize)) {\n found = divisors[i-1];\n } else {\n found = divisors[i];\n }\n }\n if (desiredPatchSize / found < nrOfPatchesList[nrOfPatchesIdx+1] / nrOfPatchesList[nrOfPatchesIdx] &&\n desiredPatchSize / found > nrOfPatchesList[nrOfPatchesIdx-1]/nrOfPatchesList[nrOfPatchesIdx] ) {\n return {x: found, y: found};\n }\n return null;\n }\n\n optimalPatchSize = findPatchSizeForDivisors(common);\n if (!optimalPatchSize) {\n optimalPatchSize = findPatchSizeForDivisors(this._computeDivisors(wideSide));\n if (!optimalPatchSize) {\n optimalPatchSize = findPatchSizeForDivisors((this._computeDivisors(desiredPatchSize * nrOfPatches)));\n }\n }\n return optimalPatchSize;\n};\n\nCVUtils._parseCSSDimensionValues = function(value) {\n var dimension = {\n value: parseFloat(value),\n unit: value.indexOf(\"%\") === value.length-1 ? \"%\" : \"%\"\n };\n\n return dimension;\n};\n\nCVUtils._dimensionsConverters = {\n top: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.height * (dimension.value / 100));\n }\n },\n right: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.width - (context.width * (dimension.value / 100)));\n }\n },\n bottom: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.height - (context.height * (dimension.value / 100)));\n }\n },\n left: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.width * (dimension.value / 100));\n }\n }\n};\n\nCVUtils.computeImageArea = function(inputWidth, inputHeight, area) {\n var context = {width: inputWidth, height: inputHeight};\n\n var parsedArea = Object.keys(area).reduce(function(result, key) {\n var value = area[key],\n parsed = CVUtils._parseCSSDimensionValues(value),\n calculated = CVUtils._dimensionsConverters[key](parsed, context);\n\n result[key] = calculated;\n return result;\n }, {});\n\n return {\n sx: parsedArea.left,\n sy: parsedArea.top,\n sw: parsedArea.right - parsedArea.left,\n sh: parsedArea.bottom - parsedArea.top\n };\n};\n\nexport default CVUtils;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/cv_utils.js\n **/","import {vec2} from 'gl-matrix';\n /**\n * Creates a cluster for grouping similar orientations of datapoints\n */\nexport default {\n create : function(point, threshold) {\n var points = [], center = {\n rad : 0,\n vec : vec2.clone([0, 0])\n }, pointMap = {};\n\n function init() {\n add(point);\n updateCenter();\n }\n\n function add(point) {\n pointMap[point.id] = point;\n points.push(point);\n }\n\n function updateCenter() {\n var i, sum = 0;\n for ( i = 0; i < points.length; i++) {\n sum += points[i].rad;\n }\n center.rad = sum / points.length;\n center.vec = vec2.clone([Math.cos(center.rad), Math.sin(center.rad)]);\n }\n\n init();\n\n return {\n add : function(point) {\n if (!pointMap[point.id]) {\n add(point);\n updateCenter();\n }\n },\n fits : function(point) {\n // check cosine similarity to center-angle\n var similarity = Math.abs(vec2.dot(point.point.vec, center.vec));\n if (similarity > threshold) {\n return true;\n }\n return false;\n },\n getPoints : function() {\n return points;\n },\n getCenter : function() {\n return center;\n }\n };\n },\n createPoint : function(point, id, property) {\n return {\n rad : point[property],\n point : point,\n id : id\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/cluster.js\n **/","/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.0\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n// END HEADER\n\nexports.glMatrix = require(\"./gl-matrix/common.js\");\nexports.mat2 = require(\"./gl-matrix/mat2.js\");\nexports.mat2d = require(\"./gl-matrix/mat2d.js\");\nexports.mat3 = require(\"./gl-matrix/mat3.js\");\nexports.mat4 = require(\"./gl-matrix/mat4.js\");\nexports.quat = require(\"./gl-matrix/quat.js\");\nexports.vec2 = require(\"./gl-matrix/vec2.js\");\nexports.vec3 = require(\"./gl-matrix/vec3.js\");\nexports.vec4 = require(\"./gl-matrix/vec4.js\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix.js\n ** module id = 9\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n/**\n * @class Common utilities\n * @name glMatrix\n */\nvar glMatrix = {};\n\n// Constants\nglMatrix.EPSILON = 0.000001;\nglMatrix.ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;\nglMatrix.RANDOM = Math.random;\n\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Type} type Array type, such as Float32Array or Array\n */\nglMatrix.setMatrixArrayType = function(type) {\n GLMAT_ARRAY_TYPE = type;\n}\n\nvar degree = Math.PI / 180;\n\n/**\n* Convert Degree To Radian\n*\n* @param {Number} Angle in Degrees\n*/\nglMatrix.toRadian = function(a){\n return a * degree;\n}\n\nmodule.exports = glMatrix;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/common.js\n ** module id = 10\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2x2 Matrix\n * @name mat2\n */\nvar mat2 = {};\n\n/**\n * Creates a new identity mat2\n *\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param {mat2} a matrix to clone\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Copy the values from one mat2 to another\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set a mat2 to the identity matrix\n *\n * @param {mat2} out the receiving matrix\n * @returns {mat2} out\n */\nmat2.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n\n // Calculate the determinant\n det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n \n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.adjoint = function(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2\n *\n * @param {mat2} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2.determinant = function (a) {\n return a[0] * a[3] - a[2] * a[1];\n};\n\n/**\n * Multiplies two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the first operand\n * @param {mat2} b the second operand\n * @returns {mat2} out\n */\nmat2.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n};\n\n/**\n * Alias for {@link mat2.multiply}\n * @function\n */\nmat2.mul = mat2.multiply;\n\n/**\n * Rotates a mat2 by the given angle\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n};\n\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2} out\n **/\nmat2.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n};\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.fromRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat2} out\n */\nmat2.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2\n *\n * @param {mat2} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat2.str = function (a) {\n return 'mat2(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param {mat2} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))\n};\n\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param {mat2} L the lower triangular matrix \n * @param {mat2} D the diagonal matrix \n * @param {mat2} U the upper triangular matrix \n * @param {mat2} a the input matrix to factorize\n */\n\nmat2.LDU = function (L, D, U, a) { \n L[2] = a[2]/a[0]; \n U[0] = a[0]; \n U[1] = a[1]; \n U[3] = a[3] - L[2] * U[1]; \n return [L, D, U]; \n}; \n\n\nmodule.exports = mat2;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat2.js\n ** module id = 11\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2x3 Matrix\n * @name mat2d\n * \n * @description \n * A mat2d contains six elements defined as:\n * \n * [a, c, tx,\n * b, d, ty]\n *
\n * This is a short form for the 3x3 matrix:\n * \n * [a, c, tx,\n * b, d, ty,\n * 0, 0, 1]\n *
\n * The last row is ignored so the array is shorter and operations are faster.\n */\nvar mat2d = {};\n\n/**\n * Creates a new identity mat2d\n *\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.create = function() {\n var out = new glMatrix.ARRAY_TYPE(6);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param {mat2d} a matrix to clone\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(6);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Copy the values from one mat2d to another\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Set a mat2d to the identity matrix\n *\n * @param {mat2d} out the receiving matrix\n * @returns {mat2d} out\n */\nmat2d.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Inverts a mat2d\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.invert = function(out, a) {\n var aa = a[0], ab = a[1], ac = a[2], ad = a[3],\n atx = a[4], aty = a[5];\n\n var det = aa * ad - ab * ac;\n if(!det){\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2d\n *\n * @param {mat2d} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2d.determinant = function (a) {\n return a[0] * a[3] - a[1] * a[2];\n};\n\n/**\n * Multiplies two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the first operand\n * @param {mat2d} b the second operand\n * @returns {mat2d} out\n */\nmat2d.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n};\n\n/**\n * Alias for {@link mat2d.multiply}\n * @function\n */\nmat2d.mul = mat2d.multiply;\n\n/**\n * Rotates a mat2d by the given angle\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2d} out\n **/\nmat2d.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to translate the matrix by\n * @returns {mat2d} out\n **/\nmat2d.translate = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n};\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.rotate(dest, dest, rad);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.fromRotation = function(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.scale(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat2d} out\n */\nmat2d.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.translate(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {vec2} v Translation vector\n * @returns {mat2d} out\n */\nmat2d.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2d\n *\n * @param {mat2d} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat2d.str = function (a) {\n return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n a[3] + ', ' + a[4] + ', ' + a[5] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param {mat2d} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2d.frob = function (a) { \n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))\n}; \n\nmodule.exports = mat2d;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat2d.js\n ** module id = 12\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 3x3 Matrix\n * @name mat3\n */\nvar mat3 = {};\n\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.create = function() {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {mat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\nmat3.fromMat4 = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n};\n\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {mat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\nmat3.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b01 = a22 * a11 - a12 * a21,\n b11 = -a22 * a10 + a12 * a20,\n b21 = a21 * a10 - a11 * a20,\n\n // Calculate the determinant\n det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n out[0] = (a11 * a22 - a12 * a21);\n out[1] = (a02 * a21 - a01 * a22);\n out[2] = (a01 * a12 - a02 * a11);\n out[3] = (a12 * a20 - a10 * a22);\n out[4] = (a00 * a22 - a02 * a20);\n out[5] = (a02 * a10 - a00 * a12);\n out[6] = (a10 * a21 - a11 * a20);\n out[7] = (a01 * a20 - a00 * a21);\n out[8] = (a00 * a11 - a01 * a10);\n return out;\n};\n\n/**\n * Calculates the determinant of a mat3\n *\n * @param {mat3} a the source matrix\n * @returns {Number} determinant of a\n */\nmat3.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n};\n\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the first operand\n * @param {mat3} b the second operand\n * @returns {mat3} out\n */\nmat3.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b00 = b[0], b01 = b[1], b02 = b[2],\n b10 = b[3], b11 = b[4], b12 = b[5],\n b20 = b[6], b21 = b[7], b22 = b[8];\n\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n};\n\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\nmat3.mul = mat3.multiply;\n\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to translate\n * @param {vec2} v vector to translate by\n * @returns {mat3} out\n */\nmat3.translate = function(out, a, v) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n x = v[0], y = v[1];\n\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n};\n\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.rotate = function (out, a, rad) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n s = Math.sin(rad),\n c = Math.cos(rad);\n\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n};\n\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\nmat3.scale = function(out, a, v) {\n var x = v[0], y = v[1];\n\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {vec2} v Translation vector\n * @returns {mat3} out\n */\nmat3.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.fromRotation = function(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat3} out\n */\nmat3.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat2d} a the matrix to copy\n * @returns {mat3} out\n **/\nmat3.fromMat2d = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n};\n\n/**\n* Calculates a 3x3 matrix from the given quaternion\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {quat} q Quaternion to create matrix from\n*\n* @returns {mat3} out\n*/\nmat3.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n\n return out;\n};\n\n/**\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {mat4} a Mat4 to derive the normal matrix from\n*\n* @returns {mat3} out\n*/\nmat3.normalFromMat4 = function (out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\n return out;\n};\n\n/**\n * Returns a string representation of a mat3\n *\n * @param {mat3} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat3.str = function (a) {\n return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + \n a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {mat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat3.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))\n};\n\n\nmodule.exports = mat3;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat3.js\n ** module id = 13\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 4x4 Matrix\n * @name mat4\n */\nvar mat4 = {};\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.create = function() {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {mat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\nmat4.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a03 = a[3],\n a12 = a[6], a13 = a[7],\n a23 = a[11];\n\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));\n out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));\n return out;\n};\n\n/**\n * Calculates the determinant of a mat4\n *\n * @param {mat4} a the source matrix\n * @returns {Number} determinant of a\n */\nmat4.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n};\n\n/**\n * Multiplies two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the first operand\n * @param {mat4} b the second operand\n * @returns {mat4} out\n */\nmat4.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n // Cache only the current line of the second matrix\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; \n out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n return out;\n};\n\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\nmat4.mul = mat4.multiply;\n\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to translate\n * @param {vec3} v vector to translate by\n * @returns {mat4} out\n */\nmat4.translate = function (out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n};\n\n/**\n * Scales the mat4 by the dimensions in the given vec3\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to scale\n * @param {vec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nmat4.scale = function(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.rotate = function (out, a, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t,\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23,\n b00, b01, b02,\n b10, b11, b12,\n b20, b21, b22;\n\n if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n \n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n // Construct the elements of the rotation matrix\n b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;\n b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;\n b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;\n\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateX = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateY = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateZ = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n};\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {vec3} v Scaling vector\n * @returns {mat4} out\n */\nmat4.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.fromRotation = function(out, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t;\n \n if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n \n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n \n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n \n // Perform rotation-specific matrix multiplication\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromXRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromYRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromZRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslation = function (out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n \n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @param {vec3} s Scaling vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslationScale = function (out, q, v, s) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2,\n sx = s[0],\n sy = s[1],\n sz = s[2];\n\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n \n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @param {vec3} s Scaling vector\n * @param {vec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\nmat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2,\n \n sx = s[0],\n sy = s[1],\n sz = s[2],\n\n ox = o[0],\n oy = o[1],\n oz = o[2];\n \n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);\n out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);\n out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);\n out[15] = 1;\n \n return out;\n};\n\nmat4.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.frustum = function (out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left),\n tb = 1 / (top - bottom),\n nf = 1 / (near - far);\n out[0] = (near * 2) * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = (near * 2) * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (far * near * 2) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspective = function (out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (2 * far * near) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspectiveFromFieldOfView = function (out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),\n downTan = Math.tan(fov.downDegrees * Math.PI/180.0),\n leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),\n rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n}\n\n/**\n * Generates a orthogonal projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.ortho = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {vec3} eye Position of the viewer\n * @param {vec3} center Point the viewer is looking at\n * @param {vec3} up vec3 pointing up\n * @returns {mat4} out\n */\nmat4.lookAt = function (out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,\n eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2],\n centerx = center[0],\n centery = center[1],\n centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&\n Math.abs(eyey - centery) < glMatrix.EPSILON &&\n Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return mat4.identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Returns a string representation of a mat4\n *\n * @param {mat4} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat4.str = function (a) {\n return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +\n a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +\n a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + \n a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {mat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat4.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))\n};\n\n\nmodule.exports = mat4;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat4.js\n ** module id = 14\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\nvar mat3 = require(\"./mat3.js\");\nvar vec3 = require(\"./vec3.js\");\nvar vec4 = require(\"./vec4.js\");\n\n/**\n * @class Quaternion\n * @name quat\n */\nvar quat = {};\n\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\nquat.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {vec3} a the initial vector\n * @param {vec3} b the destination vector\n * @returns {quat} out\n */\nquat.rotationTo = (function() {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1,0,0);\n var yUnitVec3 = vec3.fromValues(0,1,0);\n\n return function(out, a, b) {\n var dot = vec3.dot(a, b);\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.length(tmpvec3) < 0.000001)\n vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n quat.setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return quat.normalize(out, out);\n }\n };\n})();\n\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {vec3} view the vector representing the viewing direction\n * @param {vec3} right the vector representing the local \"right\" direction\n * @param {vec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\nquat.setAxes = (function() {\n var matr = mat3.create();\n\n return function(out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n\n return quat.normalize(out, quat.fromMat3(out, matr));\n };\n})();\n\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {quat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\nquat.clone = vec4.clone;\n\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\nquat.fromValues = vec4.fromValues;\n\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the source quaternion\n * @returns {quat} out\n * @function\n */\nquat.copy = vec4.copy;\n\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\nquat.set = vec4.set;\n\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\nquat.identity = function(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {vec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\nquat.setAxisAngle = function(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n};\n\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n * @function\n */\nquat.add = vec4.add;\n\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n */\nquat.multiply = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n};\n\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\nquat.mul = quat.multiply;\n\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {quat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\nquat.scale = vec4.scale;\n\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateX = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateY = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n by = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateZ = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bz = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n};\n\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate W component of\n * @returns {quat} out\n */\nquat.calculateW = function (out, a) {\n var x = a[0], y = a[1], z = a[2];\n\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n};\n\n/**\n * Calculates the dot product of two quat's\n *\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\nquat.dot = vec4.dot;\n\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n * @function\n */\nquat.lerp = vec4.lerp;\n\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n */\nquat.slerp = function (out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n var omega, cosom, sinom, scale0, scale1;\n\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if ( cosom < 0.0 ) {\n cosom = -cosom;\n bx = - bx;\n by = - by;\n bz = - bz;\n bw = - bw;\n }\n // calculate coefficients\n if ( (1.0 - cosom) > 0.000001 ) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else { \n // \"from\" and \"to\" quaternions are very close \n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n \n return out;\n};\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {quat} c the third operand\n * @param {quat} d the fourth operand\n * @param {Number} t interpolation amount\n * @returns {quat} out\n */\nquat.sqlerp = (function () {\n var temp1 = quat.create();\n var temp2 = quat.create();\n \n return function (out, a, b, c, d, t) {\n quat.slerp(temp1, a, d, t);\n quat.slerp(temp2, b, c, t);\n quat.slerp(out, temp1, temp2, 2 * t * (1 - t));\n \n return out;\n };\n}());\n\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate inverse of\n * @returns {quat} out\n */\nquat.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,\n invDot = dot ? 1.0/dot : 0;\n \n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0*invDot;\n out[1] = -a1*invDot;\n out[2] = -a2*invDot;\n out[3] = a3*invDot;\n return out;\n};\n\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate conjugate of\n * @returns {quat} out\n */\nquat.conjugate = function (out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Calculates the length of a quat\n *\n * @param {quat} a vector to calculate length of\n * @returns {Number} length of a\n * @function\n */\nquat.length = vec4.length;\n\n/**\n * Alias for {@link quat.length}\n * @function\n */\nquat.len = quat.length;\n\n/**\n * Calculates the squared length of a quat\n *\n * @param {quat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\nquat.squaredLength = vec4.squaredLength;\n\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\nquat.sqrLen = quat.squaredLength;\n\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\nquat.normalize = vec4.normalize;\n\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {mat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\nquat.fromMat3 = function(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if ( fTrace > 0.0 ) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5/fRoot; // 1/(4w)\n out[0] = (m[5]-m[7])*fRoot;\n out[1] = (m[6]-m[2])*fRoot;\n out[2] = (m[1]-m[3])*fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if ( m[4] > m[0] )\n i = 1;\n if ( m[8] > m[i*3+i] )\n i = 2;\n var j = (i+1)%3;\n var k = (i+2)%3;\n \n fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;\n out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;\n out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;\n }\n \n return out;\n};\n\n/**\n * Returns a string representation of a quatenion\n *\n * @param {quat} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nquat.str = function (a) {\n return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\nmodule.exports = quat;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/quat.js\n ** module id = 15\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 3 Dimensional Vector\n * @name vec3\n */\nvar vec3 = {};\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\nvec3.create = function() {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {vec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\nvec3.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\nvec3.fromValues = function(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the source vector\n * @returns {vec3} out\n */\nvec3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\nvec3.set = function(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\nvec3.sub = vec3.subtract;\n\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\nvec3.mul = vec3.multiply;\n\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\nvec3.div = vec3.divide;\n\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n};\n\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\nvec3.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n};\n\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\nvec3.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} distance between a and b\n */\nvec3.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\nvec3.dist = vec3.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec3.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\nvec3.sqrDist = vec3.squaredDistance;\n\n/**\n * Calculates the length of a vec3\n *\n * @param {vec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec3.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.length}\n * @function\n */\nvec3.len = vec3.length;\n\n/**\n * Calculates the squared length of a vec3\n *\n * @param {vec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec3.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\nvec3.sqrLen = vec3.squaredLength;\n\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to negate\n * @returns {vec3} out\n */\nvec3.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to invert\n * @returns {vec3} out\n */\nvec3.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n};\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to normalize\n * @returns {vec3} out\n */\nvec3.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var len = x*x + y*y + z*z;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec3.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n};\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.cross = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2],\n bx = b[0], by = b[1], bz = b[2];\n\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n};\n\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {vec3} c the third operand\n * @param {vec3} d the fourth operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.hermite = function (out, a, b, c, d, t) {\n var factorTimes2 = t * t,\n factor1 = factorTimes2 * (2 * t - 3) + 1,\n factor2 = factorTimes2 * (t - 2) + t,\n factor3 = factorTimes2 * (t - 1),\n factor4 = factorTimes2 * (3 - 2 * t);\n \n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n \n return out;\n};\n\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {vec3} c the third operand\n * @param {vec3} d the fourth operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.bezier = function (out, a, b, c, d, t) {\n var inverseFactor = 1 - t,\n inverseFactorTimesTwo = inverseFactor * inverseFactor,\n factorTimes2 = t * t,\n factor1 = inverseFactorTimesTwo * inverseFactor,\n factor2 = 3 * t * inverseFactorTimesTwo,\n factor3 = 3 * factorTimes2 * inverseFactor,\n factor4 = factorTimes2 * t;\n \n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n \n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\nvec3.random = function (out, scale) {\n scale = scale || 1.0;\n\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = (glMatrix.RANDOM() * 2.0) - 1.0;\n var zScale = Math.sqrt(1.0-z*z) * scale;\n\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2],\n w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat3 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n};\n\n/**\n * Transforms the vec3 with a quat\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec3} out\n */\nvec3.transformQuat = function(out, a, q) {\n // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations\n\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n};\n\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateX = function(out, a, b, c){\n var p = [], r=[];\n\t //Translate point to the origin\n\t p[0] = a[0] - b[0];\n\t p[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n\n\t //perform rotation\n\t r[0] = p[0];\n\t r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);\n\t r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);\n\n\t //translate to correct position\n\t out[0] = r[0] + b[0];\n\t out[1] = r[1] + b[1];\n\t out[2] = r[2] + b[2];\n\n \treturn out;\n};\n\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateY = function(out, a, b, c){\n \tvar p = [], r=[];\n \t//Translate point to the origin\n \tp[0] = a[0] - b[0];\n \tp[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n \n \t//perform rotation\n \tr[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);\n \tr[1] = p[1];\n \tr[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);\n \n \t//translate to correct position\n \tout[0] = r[0] + b[0];\n \tout[1] = r[1] + b[1];\n \tout[2] = r[2] + b[2];\n \n \treturn out;\n};\n\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateZ = function(out, a, b, c){\n \tvar p = [], r=[];\n \t//Translate point to the origin\n \tp[0] = a[0] - b[0];\n \tp[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n \n \t//perform rotation\n \tr[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);\n \tr[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);\n \tr[2] = p[2];\n \n \t//translate to correct position\n \tout[0] = r[0] + b[0];\n \tout[1] = r[1] + b[1];\n \tout[2] = r[2] + b[2];\n \n \treturn out;\n};\n\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec3.forEach = (function() {\n var vec = vec3.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 3;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];\n }\n \n return a;\n };\n})();\n\n/**\n * Get the angle between two 3D vectors\n * @param {vec3} a The first operand\n * @param {vec3} b The second operand\n * @returns {Number} The angle in radians\n */\nvec3.angle = function(a, b) {\n \n var tempA = vec3.fromValues(a[0], a[1], a[2]);\n var tempB = vec3.fromValues(b[0], b[1], b[2]);\n \n vec3.normalize(tempA, tempA);\n vec3.normalize(tempB, tempB);\n \n var cosine = vec3.dot(tempA, tempB);\n\n if(cosine > 1.0){\n return 0;\n } else {\n return Math.acos(cosine);\n } \n};\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec3} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec3.str = function (a) {\n return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n};\n\nmodule.exports = vec3;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec3.js\n ** module id = 16\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 4 Dimensional Vector\n * @name vec4\n */\nvar vec4 = {};\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\nvec4.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {vec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\nvec4.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\nvec4.fromValues = function(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the source vector\n * @returns {vec4} out\n */\nvec4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\nvec4.set = function(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\nvec4.sub = vec4.subtract;\n\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\nvec4.mul = vec4.multiply;\n\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\nvec4.div = vec4.divide;\n\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n};\n\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\nvec4.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n};\n\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\nvec4.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n out[3] = a[3] + (b[3] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} distance between a and b\n */\nvec4.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\nvec4.dist = vec4.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec4.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\nvec4.sqrDist = vec4.squaredDistance;\n\n/**\n * Calculates the length of a vec4\n *\n * @param {vec4} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec4.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.length}\n * @function\n */\nvec4.len = vec4.length;\n\n/**\n * Calculates the squared length of a vec4\n *\n * @param {vec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec4.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\nvec4.sqrLen = vec4.squaredLength;\n\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to negate\n * @returns {vec4} out\n */\nvec4.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to invert\n * @returns {vec4} out\n */\nvec4.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n};\n\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to normalize\n * @returns {vec4} out\n */\nvec4.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var len = x*x + y*y + z*z + w*w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec4.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n};\n\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec4} out\n */\nvec4.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\nvec4.random = function (out, scale) {\n scale = scale || 1.0;\n\n //TODO: This is a pretty awful way of doing this. Find something better.\n out[0] = glMatrix.RANDOM();\n out[1] = glMatrix.RANDOM();\n out[2] = glMatrix.RANDOM();\n out[3] = glMatrix.RANDOM();\n vec4.normalize(out, out);\n vec4.scale(out, out, scale);\n return out;\n};\n\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec4} out\n */\nvec4.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n};\n\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec4} out\n */\nvec4.transformQuat = function(out, a, q) {\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec4.forEach = (function() {\n var vec = vec4.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 4;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];\n }\n \n return a;\n };\n})();\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec4} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec4.str = function (a) {\n return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\nmodule.exports = vec4;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec4.js\n ** module id = 17\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2 Dimensional Vector\n * @name vec2\n */\nvar vec2 = {};\n\n/**\n * Creates a new, empty vec2\n *\n * @returns {vec2} a new 2D vector\n */\nvec2.create = function() {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = 0;\n out[1] = 0;\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param {vec2} a vector to clone\n * @returns {vec2} a new 2D vector\n */\nvec2.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} a new 2D vector\n */\nvec2.fromValues = function(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Copy the values from one vec2 to another\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the source vector\n * @returns {vec2} out\n */\nvec2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {vec2} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} out\n */\nvec2.set = function(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Adds two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\nvec2.sub = vec2.subtract;\n\n/**\n * Multiplies two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\nvec2.mul = vec2.multiply;\n\n/**\n * Divides two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\nvec2.div = vec2.divide;\n\n/**\n * Returns the minimum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n};\n\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec2} out\n */\nvec2.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n};\n\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec2} out\n */\nvec2.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} distance between a and b\n */\nvec2.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\nvec2.dist = vec2.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec2.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\nvec2.sqrDist = vec2.squaredDistance;\n\n/**\n * Calculates the length of a vec2\n *\n * @param {vec2} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec2.length = function (a) {\n var x = a[0],\n y = a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.length}\n * @function\n */\nvec2.len = vec2.length;\n\n/**\n * Calculates the squared length of a vec2\n *\n * @param {vec2} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec2.squaredLength = function (a) {\n var x = a[0],\n y = a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\nvec2.sqrLen = vec2.squaredLength;\n\n/**\n * Negates the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to negate\n * @returns {vec2} out\n */\nvec2.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to invert\n * @returns {vec2} out\n */\nvec2.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n};\n\n/**\n * Normalize a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to normalize\n * @returns {vec2} out\n */\nvec2.normalize = function(out, a) {\n var x = a[0],\n y = a[1];\n var len = x*x + y*y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec2.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1];\n};\n\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec3} out\n */\nvec2.cross = function(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec2} out\n */\nvec2.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec2} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec2} out\n */\nvec2.random = function (out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2d} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2d = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat3} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat3 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat4 = function(out, a, m) {\n var x = a[0], \n y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec2.forEach = (function() {\n var vec = vec2.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 2;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1];\n }\n \n return a;\n };\n})();\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec2} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec2.str = function (a) {\n return 'vec2(' + a[0] + ', ' + a[1] + ')';\n};\n\nmodule.exports = vec2;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec2.js\n ** module id = 18\n ** module chunks = 0\n **/","export default {\n init : function(arr, val) {\n var l = arr.length;\n while (l--) {\n arr[l] = val;\n }\n },\n\n /**\n * Shuffles the content of an array\n * @return {Array} the array itself shuffled\n */\n shuffle : function(arr) {\n var i = arr.length - 1, j, x;\n for (i; i >= 0; i--) {\n j = Math.floor(Math.random() * i);\n x = arr[i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n },\n\n toPointList : function(arr) {\n var i, j, row = [], rows = [];\n for ( i = 0; i < arr.length; i++) {\n row = [];\n for ( j = 0; j < arr[i].length; j++) {\n row[j] = arr[i][j];\n }\n rows[i] = \"[\" + row.join(\",\") + \"]\";\n }\n return \"[\" + rows.join(\",\\r\\n\") + \"]\";\n },\n\n /**\n * returns the elements which's score is bigger than the threshold\n * @return {Array} the reduced array\n */\n threshold : function(arr, threshold, scoreFunc) {\n var i, queue = [];\n for ( i = 0; i < arr.length; i++) {\n if (scoreFunc.apply(arr, [arr[i]]) >= threshold) {\n queue.push(arr[i]);\n }\n }\n return queue;\n },\n\n maxIndex : function(arr) {\n var i, max = 0;\n for ( i = 0; i < arr.length; i++) {\n if (arr[i] > arr[max]) {\n max = i;\n }\n }\n return max;\n },\n\n max : function(arr) {\n var i, max = 0;\n for ( i = 0; i < arr.length; i++) {\n if (arr[i] > max) {\n max = arr[i];\n }\n }\n return max;\n },\n\n sum: function(arr) {\n var length = arr.length,\n sum = 0;\n\n while(length--) {\n sum += arr[length];\n }\n return sum;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/array_helper.js\n **/","/* jshint undef: true, unused: true, browser:true, devel: true */\n/* global define */\n\nimport ImageWrapper from './image_wrapper';\nimport CVUtils from './cv_utils';\nimport Rasterizer from './rasterizer';\nimport Tracer from './tracer';\nimport skeletonizer from './skeletonizer';\nimport ArrayHelper from './array_helper';\nimport ImageDebug from './image_debug';\nimport glMatrix from 'gl-matrix';\n\nvar _config,\n _currentImageWrapper,\n _skelImageWrapper,\n _subImageWrapper,\n _labelImageWrapper,\n _patchGrid,\n _patchLabelGrid,\n _imageToPatchGrid,\n _binaryImageWrapper,\n _patchSize,\n _canvasContainer = {\n ctx : {\n binary : null\n },\n dom : {\n binary : null\n }\n },\n _numPatches = {x: 0, y: 0},\n _inputImageWrapper,\n _skeletonizer,\n vec2 = glMatrix.vec2,\n mat2 = glMatrix.mat2,\n self = (typeof window !== 'undefined') ? window : self;\n\nfunction initBuffers() {\n var skeletonImageData;\n\n if (_config.halfSample) {\n _currentImageWrapper = new ImageWrapper({\n x : _inputImageWrapper.size.x / 2 | 0,\n y : _inputImageWrapper.size.y / 2 | 0\n });\n } else {\n _currentImageWrapper = _inputImageWrapper;\n }\n\n _patchSize = CVUtils.calculatePatchSize(_config.patchSize, _currentImageWrapper.size);\n\n _numPatches.x = _currentImageWrapper.size.x / _patchSize.x | 0;\n _numPatches.y = _currentImageWrapper.size.y / _patchSize.y | 0;\n\n _binaryImageWrapper = new ImageWrapper(_currentImageWrapper.size, undefined, Uint8Array, false);\n\n _labelImageWrapper = new ImageWrapper(_patchSize, undefined, Array, true);\n\n skeletonImageData = new ArrayBuffer(64*1024);\n _subImageWrapper = new ImageWrapper(_patchSize, new Uint8Array(skeletonImageData, 0, _patchSize.x * _patchSize.y));\n _skelImageWrapper = new ImageWrapper(_patchSize, new Uint8Array(skeletonImageData, _patchSize.x * _patchSize.y * 3, _patchSize.x * _patchSize.y), undefined, true);\n _skeletonizer = skeletonizer(self, {\n size : _patchSize.x\n }, skeletonImageData);\n\n _imageToPatchGrid = new ImageWrapper({\n x : (_currentImageWrapper.size.x / _subImageWrapper.size.x) | 0,\n y : (_currentImageWrapper.size.y / _subImageWrapper.size.y) | 0\n }, undefined, Array, true);\n _patchGrid = new ImageWrapper(_imageToPatchGrid.size, undefined, undefined, true);\n _patchLabelGrid = new ImageWrapper(_imageToPatchGrid.size, undefined, Int32Array, true);\n}\n\nfunction initCanvas() {\n if (_config.useWorker || typeof document === 'undefined') {\n return;\n }\n _canvasContainer.dom.binary = document.createElement(\"canvas\");\n _canvasContainer.dom.binary.className = \"binaryBuffer\";\n if (_config.showCanvas === true) {\n document.querySelector(\"#debug\").appendChild(_canvasContainer.dom.binary);\n }\n _canvasContainer.ctx.binary = _canvasContainer.dom.binary.getContext(\"2d\");\n _canvasContainer.dom.binary.width = _binaryImageWrapper.size.x;\n _canvasContainer.dom.binary.height = _binaryImageWrapper.size.y;\n}\n\n/**\n * Creates a bounding box which encloses all the given patches\n * @returns {Array} The minimal bounding box\n */\nfunction boxFromPatches(patches) {\n var overAvg, i, j, patch, transMat, minx = _binaryImageWrapper.size.x, miny = _binaryImageWrapper.size.y, maxx = -_binaryImageWrapper.size.x, maxy = -_binaryImageWrapper.size.y, box, scale;\n\n // draw all patches which are to be taken into consideration\n overAvg = 0;\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n overAvg += patch.rad;\n if (_config.showPatches) {\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"red\"});\n }\n }\n\n overAvg /= patches.length;\n overAvg = (overAvg * 180 / Math.PI + 90) % 180 - 90;\n if (overAvg < 0) {\n overAvg += 180;\n }\n\n overAvg = (180 - overAvg) * Math.PI / 180;\n transMat = mat2.clone([Math.cos(overAvg), Math.sin(overAvg), -Math.sin(overAvg), Math.cos(overAvg)]);\n\n // iterate over patches and rotate by angle\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n for ( j = 0; j < 4; j++) {\n vec2.transformMat2(patch.box[j], patch.box[j], transMat);\n }\n\n if (_config.boxFromPatches.showTransformed) {\n ImageDebug.drawPath(patch.box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#99ff00', lineWidth: 2});\n }\n }\n\n // find bounding box\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n for ( j = 0; j < 4; j++) {\n if (patch.box[j][0] < minx) {\n minx = patch.box[j][0];\n }\n if (patch.box[j][0] > maxx) {\n maxx = patch.box[j][0];\n }\n if (patch.box[j][1] < miny) {\n miny = patch.box[j][1];\n }\n if (patch.box[j][1] > maxy) {\n maxy = patch.box[j][1];\n }\n }\n }\n\n box = [[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]];\n\n if (_config.boxFromPatches.showTransformedBox) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});\n }\n\n scale = _config.halfSample ? 2 : 1;\n // reverse rotation;\n transMat = mat2.invert(transMat, transMat);\n for ( j = 0; j < 4; j++) {\n vec2.transformMat2(box[j], box[j], transMat);\n }\n\n if (_config.boxFromPatches.showBB) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});\n }\n\n for ( j = 0; j < 4; j++) {\n vec2.scale(box[j], box[j], scale);\n }\n\n return box;\n}\n\n/**\n * Creates a binary image of the current image\n */\nfunction binarizeImage() {\n CVUtils.otsuThreshold(_currentImageWrapper, _binaryImageWrapper);\n _binaryImageWrapper.zeroBorder();\n if (_config.showCanvas) {\n _binaryImageWrapper.show(_canvasContainer.dom.binary, 255);\n }\n}\n\n/**\n * Iterate over the entire image\n * extract patches\n */\nfunction findPatches() {\n var i,\n j,\n x,\n y,\n moments,\n patchesFound = [],\n rasterizer,\n rasterResult,\n patch;\n for ( i = 0; i < _numPatches.x; i++) {\n for ( j = 0; j < _numPatches.y; j++) {\n\n x = _subImageWrapper.size.x * i;\n y = _subImageWrapper.size.y * j;\n\n // seperate parts\n skeletonize(x, y);\n\n // Rasterize, find individual bars\n _skelImageWrapper.zeroBorder();\n ArrayHelper.init(_labelImageWrapper.data, 0);\n rasterizer = Rasterizer.create(_skelImageWrapper, _labelImageWrapper);\n rasterResult = rasterizer.rasterize(0);\n\n if (_config.showLabels) {\n _labelImageWrapper.overlay(_canvasContainer.dom.binary, Math.floor(360 / rasterResult.count), {x : x, y : y});\n }\n\n // calculate moments from the skeletonized patch\n moments = _labelImageWrapper.moments(rasterResult.count);\n\n // extract eligible patches\n patchesFound = patchesFound.concat(describePatch(moments, [i, j], x, y));\n }\n }\n\n if (_config.showFoundPatches) {\n for ( i = 0; i < patchesFound.length; i++) {\n patch = patchesFound[i];\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"#99ff00\", lineWidth: 2});\n }\n }\n\n return patchesFound;\n}\n\n/**\n * Finds those connected areas which contain at least 6 patches\n * and returns them ordered DESC by the number of contained patches\n * @param {Number} maxLabel\n */\nfunction findBiggestConnectedAreas(maxLabel){\n var i,\n sum,\n labelHist = [],\n topLabels = [];\n\n for ( i = 0; i < maxLabel; i++) {\n labelHist.push(0);\n }\n sum = _patchLabelGrid.data.length;\n while (sum--) {\n if (_patchLabelGrid.data[sum] > 0) {\n labelHist[_patchLabelGrid.data[sum] - 1]++;\n }\n }\n\n labelHist = labelHist.map(function(val, idx) {\n return {\n val : val,\n label : idx + 1\n };\n });\n\n labelHist.sort(function(a, b) {\n return b.val - a.val;\n });\n\n // extract top areas with at least 6 patches present\n topLabels = labelHist.filter(function(el) {\n return el.val >= 5;\n });\n\n return topLabels;\n}\n\n/**\n *\n */\nfunction findBoxes(topLabels, maxLabel) {\n var i,\n j,\n sum,\n patches = [],\n patch,\n box,\n boxes = [],\n hsv = [0, 1, 1],\n rgb = [0, 0, 0];\n\n for ( i = 0; i < topLabels.length; i++) {\n sum = _patchLabelGrid.data.length;\n patches.length = 0;\n while (sum--) {\n if (_patchLabelGrid.data[sum] === topLabels[i].label) {\n patch = _imageToPatchGrid.data[sum];\n patches.push(patch);\n }\n }\n box = boxFromPatches(patches);\n if (box) {\n boxes.push(box);\n\n // draw patch-labels if requested\n if (_config.showRemainingPatchLabels) {\n for ( j = 0; j < patches.length; j++) {\n patch = patches[j];\n hsv[0] = (topLabels[i].label / (maxLabel + 1)) * 360;\n CVUtils.hsv2rgb(hsv, rgb);\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2});\n }\n }\n }\n }\n return boxes;\n}\n\n/**\n * Find similar moments (via cluster)\n * @param {Object} moments\n */\nfunction similarMoments(moments) {\n var clusters = CVUtils.cluster(moments, 0.90);\n var topCluster = CVUtils.topGeneric(clusters, 1, function(e) {\n return e.getPoints().length;\n });\n var points = [], result = [];\n if (topCluster.length === 1) {\n points = topCluster[0].item.getPoints();\n for (var i = 0; i < points.length; i++) {\n result.push(points[i].point);\n }\n }\n return result;\n}\n\nfunction skeletonize(x, y) {\n _binaryImageWrapper.subImageAsCopy(_subImageWrapper, CVUtils.imageRef(x, y));\n _skeletonizer.skeletonize();\n\n // Show skeleton if requested\n if (_config.showSkeleton) {\n _skelImageWrapper.overlay(_canvasContainer.dom.binary, 360, CVUtils.imageRef(x, y));\n }\n}\n\n/**\n * Extracts and describes those patches which seem to contain a barcode pattern\n * @param {Array} moments\n * @param {Object} patchPos,\n * @param {Number} x\n * @param {Number} y\n * @returns {Array} list of patches\n */\nfunction describePatch(moments, patchPos, x, y) {\n var k,\n avg,\n sum = 0,\n eligibleMoments = [],\n matchingMoments,\n patch,\n patchesFound = [],\n minComponentWeight = Math.ceil(_patchSize.x/3);\n\n if (moments.length >= 2) {\n // only collect moments which's area covers at least minComponentWeight pixels.\n for ( k = 0; k < moments.length; k++) {\n if (moments[k].m00 > minComponentWeight) {\n eligibleMoments.push(moments[k]);\n }\n }\n\n // if at least 2 moments are found which have at least minComponentWeights covered\n if (eligibleMoments.length >= 2) {\n sum = eligibleMoments.length;\n matchingMoments = similarMoments(eligibleMoments);\n avg = 0;\n // determine the similarity of the moments\n for ( k = 0; k < matchingMoments.length; k++) {\n avg += matchingMoments[k].rad;\n }\n\n // Only two of the moments are allowed not to fit into the equation\n // add the patch to the set\n if (matchingMoments.length > 1 && matchingMoments.length >= (eligibleMoments.length / 4) * 3 && matchingMoments.length > moments.length / 4) {\n avg /= matchingMoments.length;\n patch = {\n index : patchPos[1] * _numPatches.x + patchPos[0],\n pos : {\n x : x,\n y : y\n },\n box : [vec2.clone([x, y]), vec2.clone([x + _subImageWrapper.size.x, y]), vec2.clone([x + _subImageWrapper.size.x, y + _subImageWrapper.size.y]), vec2.clone([x, y + _subImageWrapper.size.y])],\n moments : matchingMoments,\n rad : avg,\n vec : vec2.clone([Math.cos(avg), Math.sin(avg)])\n };\n patchesFound.push(patch);\n }\n }\n }\n return patchesFound;\n}\n\n/**\n * finds patches which are connected and share the same orientation\n * @param {Object} patchesFound\n */\nfunction rasterizeAngularSimilarity(patchesFound) {\n var label = 0,\n threshold = 0.95,\n currIdx = 0,\n j,\n patch,\n hsv = [0, 1, 1],\n rgb = [0, 0, 0];\n\n function notYetProcessed() {\n var i;\n for ( i = 0; i < _patchLabelGrid.data.length; i++) {\n if (_patchLabelGrid.data[i] === 0 && _patchGrid.data[i] === 1) {\n return i;\n }\n }\n return _patchLabelGrid.length;\n }\n\n function trace(currentIdx) {\n var x, y, currentPatch, patch, idx, dir, current = {\n x : currentIdx % _patchLabelGrid.size.x,\n y : (currentIdx / _patchLabelGrid.size.x) | 0\n }, similarity;\n\n if (currentIdx < _patchLabelGrid.data.length) {\n currentPatch = _imageToPatchGrid.data[currentIdx];\n // assign label\n _patchLabelGrid.data[currentIdx] = label;\n for ( dir = 0; dir < Tracer.searchDirections.length; dir++) {\n y = current.y + Tracer.searchDirections[dir][0];\n x = current.x + Tracer.searchDirections[dir][1];\n idx = y * _patchLabelGrid.size.x + x;\n\n // continue if patch empty\n if (_patchGrid.data[idx] === 0) {\n _patchLabelGrid.data[idx] = Number.MAX_VALUE;\n continue;\n }\n\n patch = _imageToPatchGrid.data[idx];\n if (_patchLabelGrid.data[idx] === 0) {\n similarity = Math.abs(vec2.dot(patch.vec, currentPatch.vec));\n if (similarity > threshold) {\n trace(idx);\n }\n }\n }\n }\n }\n\n // prepare for finding the right patches\n ArrayHelper.init(_patchGrid.data, 0);\n ArrayHelper.init(_patchLabelGrid.data, 0);\n ArrayHelper.init(_imageToPatchGrid.data, null);\n\n for ( j = 0; j < patchesFound.length; j++) {\n patch = patchesFound[j];\n _imageToPatchGrid.data[patch.index] = patch;\n _patchGrid.data[patch.index] = 1;\n }\n\n // rasterize the patches found to determine area\n _patchGrid.zeroBorder();\n\n while (( currIdx = notYetProcessed()) < _patchLabelGrid.data.length) {\n label++;\n trace(currIdx);\n }\n\n // draw patch-labels if requested\n if (_config.showPatchLabels) {\n for ( j = 0; j < _patchLabelGrid.data.length; j++) {\n if (_patchLabelGrid.data[j] > 0 && _patchLabelGrid.data[j] <= label) {\n patch = _imageToPatchGrid.data[j];\n hsv[0] = (_patchLabelGrid.data[j] / (label + 1)) * 360;\n CVUtils.hsv2rgb(hsv, rgb);\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2});\n }\n }\n }\n\n return label;\n}\n\nexport default {\n init : function(inputImageWrapper, config) {\n _config = config;\n _inputImageWrapper = inputImageWrapper;\n\n initBuffers();\n initCanvas();\n },\n\n locate : function() {\n var patchesFound,\n topLabels,\n boxes;\n\n if (_config.halfSample) {\n CVUtils.halfSample(_inputImageWrapper, _currentImageWrapper);\n }\n\n binarizeImage();\n patchesFound = findPatches();\n // return unless 5% or more patches are found\n if (patchesFound.length < _numPatches.x * _numPatches.y * 0.05) {\n return null;\n }\n\n // rasterrize area by comparing angular similarity;\n var maxLabel = rasterizeAngularSimilarity(patchesFound);\n if (maxLabel < 1) {\n return null;\n }\n\n // search for area with the most patches (biggest connected area)\n topLabels = findBiggestConnectedAreas(maxLabel);\n if (topLabels.length === 0) {\n return null;\n }\n\n boxes = findBoxes(topLabels, maxLabel);\n return boxes;\n },\n\n checkImageConstraints: function(inputStream, config) {\n var patchSize,\n width = inputStream.getWidth(),\n height = inputStream.getHeight(),\n halfSample = config.halfSample ? 0.5 : 1,\n size,\n area;\n\n // calculate width and height based on area\n if (inputStream.getConfig().area) {\n area = CVUtils.computeImageArea(width, height, inputStream.getConfig().area);\n inputStream.setTopRight({x: area.sx, y: area.sy});\n inputStream.setCanvasSize({x: width, y: height});\n width = area.sw;\n height = area.sh;\n }\n\n size = {\n x: Math.floor(width * halfSample),\n y: Math.floor(height * halfSample)\n };\n\n patchSize = CVUtils.calculatePatchSize(config.patchSize, size);\n console.log(\"Patch-Size: \" + JSON.stringify(patchSize));\n\n inputStream.setWidth(Math.floor(Math.floor(size.x/patchSize.x)*(1/halfSample)*patchSize.x));\n inputStream.setHeight(Math.floor(Math.floor(size.y/patchSize.y)*(1/halfSample)*patchSize.y));\n\n if ((inputStream.getWidth() % patchSize.x) === 0 && (inputStream.getHeight() % patchSize.y) === 0) {\n return true;\n }\n\n throw new Error(\"Image dimensions do not comply with the current settings: Width (\" +\n width + \" )and height (\" + height +\n \") must a multiple of \" + patchSize.x);\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_locator.js\n **/","import Tracer from './tracer';\n\n/**\n * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n */\nvar Rasterizer = {\n createContour2D : function() {\n return {\n dir : null,\n index : null,\n firstVertex : null,\n insideContours : null,\n nextpeer : null,\n prevpeer : null\n };\n },\n CONTOUR_DIR : {\n CW_DIR : 0,\n CCW_DIR : 1,\n UNKNOWN_DIR : 2\n },\n DIR : {\n OUTSIDE_EDGE : -32767,\n INSIDE_EDGE : -32766\n },\n create : function(imageWrapper, labelWrapper) {\n var imageData = imageWrapper.data,\n labelData = labelWrapper.data,\n width = imageWrapper.size.x,\n height = imageWrapper.size.y,\n tracer = Tracer.create(imageWrapper, labelWrapper);\n\n return {\n rasterize : function(depthlabel) {\n var color,\n bc,\n lc,\n labelindex,\n cx,\n cy,\n colorMap = [],\n vertex,\n p,\n cc,\n sc,\n pos,\n connectedCount = 0,\n i;\n\n for ( i = 0; i < 400; i++) {\n colorMap[i] = 0;\n }\n\n colorMap[0] = imageData[0];\n cc = null;\n for ( cy = 1; cy < height - 1; cy++) {\n labelindex = 0;\n bc = colorMap[0];\n for ( cx = 1; cx < width - 1; cx++) {\n pos = cy * width + cx;\n if (labelData[pos] === 0) {\n color = imageData[pos];\n if (color !== bc) {\n if (labelindex === 0) {\n lc = connectedCount + 1;\n colorMap[lc] = color;\n bc = color;\n vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE);\n if (vertex !== null) {\n connectedCount++;\n labelindex = lc;\n p = Rasterizer.createContour2D();\n p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n p.index = labelindex;\n p.firstVertex = vertex;\n p.nextpeer = cc;\n p.insideContours = null;\n if (cc !== null) {\n cc.prevpeer = p;\n }\n cc = p;\n }\n } else {\n vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex);\n if (vertex !== null) {\n p = Rasterizer.createContour2D();\n p.firstVertex = vertex;\n p.insideContours = null;\n if (depthlabel === 0) {\n p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR;\n } else {\n p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n }\n p.index = depthlabel;\n sc = cc;\n while ((sc !== null) && sc.index !== labelindex) {\n sc = sc.nextpeer;\n }\n if (sc !== null) {\n p.nextpeer = sc.insideContours;\n if (sc.insideContours !== null) {\n sc.insideContours.prevpeer = p;\n }\n sc.insideContours = p;\n }\n }\n }\n } else {\n labelData[pos] = labelindex;\n }\n } else if (labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n labelindex = 0;\n if (labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n bc = imageData[pos];\n } else {\n bc = colorMap[0];\n }\n } else {\n labelindex = labelData[pos];\n bc = colorMap[labelindex];\n }\n }\n }\n sc = cc;\n while (sc !== null) {\n sc.index = depthlabel;\n sc = sc.nextpeer;\n }\n return {\n cc : cc,\n count : connectedCount\n };\n },\n debug: {\n drawContour : function(canvas, firstContour) {\n var ctx = canvas.getContext(\"2d\"),\n pq = firstContour,\n iq,\n q,\n p;\n\n ctx.strokeStyle = \"red\";\n ctx.fillStyle = \"red\";\n ctx.lineWidth = 1;\n\n if (pq !== null) {\n iq = pq.insideContours;\n } else {\n iq = null;\n }\n\n while (pq !== null) {\n if (iq !== null) {\n q = iq;\n iq = iq.nextpeer;\n } else {\n q = pq;\n pq = pq.nextpeer;\n if (pq !== null) {\n iq = pq.insideContours;\n } else {\n iq = null;\n }\n }\n\n switch(q.dir) {\n case Rasterizer.CONTOUR_DIR.CW_DIR:\n ctx.strokeStyle = \"red\";\n break;\n case Rasterizer.CONTOUR_DIR.CCW_DIR:\n ctx.strokeStyle = \"blue\";\n break;\n case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:\n ctx.strokeStyle = \"green\";\n break;\n }\n\n p = q.firstVertex;\n ctx.beginPath();\n ctx.moveTo(p.x, p.y);\n do {\n p = p.next;\n ctx.lineTo(p.x, p.y);\n } while(p !== q.firstVertex);\n ctx.stroke();\n }\n }\n }\n };\n }\n};\n\nexport default Rasterizer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/rasterizer.js\n **/","/**\n * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n */\nvar Tracer = {\n searchDirections : [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]],\n create : function(imageWrapper, labelWrapper) {\n var imageData = imageWrapper.data,\n labelData = labelWrapper.data,\n searchDirections = this.searchDirections,\n width = imageWrapper.size.x,\n pos;\n\n function trace(current, color, label, edgelabel) {\n var i,\n y,\n x;\n\n for ( i = 0; i < 7; i++) {\n y = current.cy + searchDirections[current.dir][0];\n x = current.cx + searchDirections[current.dir][1];\n pos = y * width + x;\n if ((imageData[pos] === color) && ((labelData[pos] === 0) || (labelData[pos] === label))) {\n labelData[pos] = label;\n current.cy = y;\n current.cx = x;\n return true;\n } else {\n if (labelData[pos] === 0) {\n labelData[pos] = edgelabel;\n }\n current.dir = (current.dir + 1) % 8;\n }\n }\n return false;\n }\n\n function vertex2D(x, y, dir) {\n return {\n dir : dir,\n x : x,\n y : y,\n next : null,\n prev : null\n };\n }\n\n function contourTracing(sy, sx, label, color, edgelabel) {\n var Fv = null,\n Cv,\n P,\n ldir,\n current = {\n cx : sx,\n cy : sy,\n dir : 0\n };\n\n if (trace(current, color, label, edgelabel)) {\n Fv = vertex2D(sx, sy, current.dir);\n Cv = Fv;\n ldir = current.dir;\n P = vertex2D(current.cx, current.cy, 0);\n P.prev = Cv;\n Cv.next = P;\n P.next = null;\n Cv = P;\n do {\n current.dir = (current.dir + 6) % 8;\n trace(current, color, label, edgelabel);\n if (ldir != current.dir) {\n Cv.dir = current.dir;\n P = vertex2D(current.cx, current.cy, 0);\n P.prev = Cv;\n Cv.next = P;\n P.next = null;\n Cv = P;\n } else {\n Cv.dir = ldir;\n Cv.x = current.cx;\n Cv.y = current.cy;\n }\n ldir = current.dir;\n } while(current.cx != sx || current.cy != sy);\n Fv.prev = Cv.prev;\n Cv.prev.next = Fv;\n }\n return Fv;\n }\n\n return {\n trace : function(current, color, label, edgelabel) {\n return trace(current, color, label, edgelabel);\n },\n contourTracing : function(sy, sx, label, color, edgelabel) {\n return contourTracing(sy, sx, label, color, edgelabel);\n }\n };\n }\n};\n\nexport default (Tracer);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/tracer.js\n **/","/* @preserve ASM BEGIN */\nfunction Skeletonizer(stdlib, foreign, buffer) {\n \"use asm\";\n\n var images = new stdlib.Uint8Array(buffer),\n size = foreign.size | 0,\n imul = stdlib.Math.imul;\n\n function erode(inImagePtr, outImagePtr) {\n inImagePtr = inImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var v = 0,\n u = 0,\n sum = 0,\n yStart1 = 0,\n yStart2 = 0,\n xStart1 = 0,\n xStart2 = 0,\n offset = 0;\n\n for ( v = 1; (v | 0) < ((size - 1) | 0); v = (v + 1) | 0) {\n offset = (offset + size) | 0;\n for ( u = 1; (u | 0) < ((size - 1) | 0); u = (u + 1) | 0) {\n yStart1 = (offset - size) | 0;\n yStart2 = (offset + size) | 0;\n xStart1 = (u - 1) | 0;\n xStart2 = (u + 1) | 0;\n sum = ((images[(inImagePtr + yStart1 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart1 + xStart2) | 0] | 0) + (images[(inImagePtr + offset + u) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart2) | 0] | 0)) | 0;\n if ((sum | 0) == (5 | 0)) {\n images[(outImagePtr + offset + u) | 0] = 1;\n } else {\n images[(outImagePtr + offset + u) | 0] = 0;\n }\n }\n }\n return;\n }\n\n function subtract(aImagePtr, bImagePtr, outImagePtr) {\n aImagePtr = aImagePtr | 0;\n bImagePtr = bImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(outImagePtr + length) | 0] = ((images[(aImagePtr + length) | 0] | 0) - (images[(bImagePtr + length) | 0] | 0)) | 0;\n }\n }\n\n function bitwiseOr(aImagePtr, bImagePtr, outImagePtr) {\n aImagePtr = aImagePtr | 0;\n bImagePtr = bImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(outImagePtr + length) | 0] = ((images[(aImagePtr + length) | 0] | 0) | (images[(bImagePtr + length) | 0] | 0)) | 0;\n }\n }\n\n function countNonZero(imagePtr) {\n imagePtr = imagePtr | 0;\n\n var sum = 0,\n length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n sum = ((sum | 0) + (images[(imagePtr + length) | 0] | 0)) | 0;\n }\n\n return (sum | 0);\n }\n\n function init(imagePtr, value) {\n imagePtr = imagePtr | 0;\n value = value | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(imagePtr + length) | 0] = value;\n }\n }\n\n function dilate(inImagePtr, outImagePtr) {\n inImagePtr = inImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var v = 0,\n u = 0,\n sum = 0,\n yStart1 = 0,\n yStart2 = 0,\n xStart1 = 0,\n xStart2 = 0,\n offset = 0;\n\n for ( v = 1; (v | 0) < ((size - 1) | 0); v = (v + 1) | 0) {\n offset = (offset + size) | 0;\n for ( u = 1; (u | 0) < ((size - 1) | 0); u = (u + 1) | 0) {\n yStart1 = (offset - size) | 0;\n yStart2 = (offset + size) | 0;\n xStart1 = (u - 1) | 0;\n xStart2 = (u + 1) | 0;\n sum = ((images[(inImagePtr + yStart1 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart1 + xStart2) | 0] | 0) + (images[(inImagePtr + offset + u) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart2) | 0] | 0)) | 0;\n if ((sum | 0) > (0 | 0)) {\n images[(outImagePtr + offset + u) | 0] = 1;\n } else {\n images[(outImagePtr + offset + u) | 0] = 0;\n }\n }\n }\n return;\n }\n\n function memcpy(srcImagePtr, dstImagePtr) {\n srcImagePtr = srcImagePtr | 0;\n dstImagePtr = dstImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(dstImagePtr + length) | 0] = (images[(srcImagePtr + length) | 0] | 0);\n }\n }\n\n function zeroBorder(imagePtr) {\n imagePtr = imagePtr | 0;\n\n var x = 0,\n y = 0;\n\n for ( x = 0; (x | 0) < ((size - 1) | 0); x = (x + 1) | 0) {\n images[(imagePtr + x) | 0] = 0;\n images[(imagePtr + y) | 0] = 0;\n y = ((y + size) - 1) | 0;\n images[(imagePtr + y) | 0] = 0;\n y = (y + 1) | 0;\n }\n for ( x = 0; (x | 0) < (size | 0); x = (x + 1) | 0) {\n images[(imagePtr + y) | 0] = 0;\n y = (y + 1) | 0;\n }\n }\n\n function skeletonize() {\n var subImagePtr = 0,\n erodedImagePtr = 0,\n tempImagePtr = 0,\n skelImagePtr = 0,\n sum = 0,\n done = 0;\n\n erodedImagePtr = imul(size, size) | 0;\n tempImagePtr = (erodedImagePtr + erodedImagePtr) | 0;\n skelImagePtr = (tempImagePtr + erodedImagePtr) | 0;\n\n // init skel-image\n init(skelImagePtr, 0);\n zeroBorder(subImagePtr);\n\n do {\n erode(subImagePtr, erodedImagePtr);\n dilate(erodedImagePtr, tempImagePtr);\n subtract(subImagePtr, tempImagePtr, tempImagePtr);\n bitwiseOr(skelImagePtr, tempImagePtr, skelImagePtr);\n memcpy(erodedImagePtr, subImagePtr);\n sum = countNonZero(subImagePtr) | 0;\n done = ((sum | 0) == 0 | 0);\n } while(!done);\n }\n\n return {\n skeletonize : skeletonize\n };\n}\n/* @preserve ASM END */\n\nexport default Skeletonizer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/skeletonizer.js\n **/","export default {\n drawRect: function(pos, size, ctx, style){\n ctx.strokeStyle = style.color;\n ctx.fillStyle = style.color;\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.strokeRect(pos.x, pos.y, size.x, size.y);\n },\n drawPath: function(path, def, ctx, style) {\n ctx.strokeStyle = style.color;\n ctx.fillStyle = style.color;\n ctx.lineWidth = style.lineWidth;\n ctx.beginPath();\n ctx.moveTo(path[0][def.x], path[0][def.y]);\n for (var j = 1; j < path.length; j++) {\n ctx.lineTo(path[j][def.x], path[j][def.y]);\n }\n ctx.closePath();\n ctx.stroke();\n },\n drawImage: function(imageData, size, ctx) {\n var canvasData = ctx.getImageData(0, 0, size.x, size.y),\n data = canvasData.data,\n imageDataPos = imageData.length,\n canvasDataPos = data.length,\n value;\n\n if (canvasDataPos/imageDataPos !== 4) {\n return false;\n }\n while(imageDataPos--){\n value = imageData[imageDataPos];\n data[--canvasDataPos] = 255;\n data[--canvasDataPos] = value;\n data[--canvasDataPos] = value;\n data[--canvasDataPos] = value;\n }\n ctx.putImageData(canvasData, 0, 0);\n return true;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_debug.js\n **/","import Bresenham from './bresenham';\nimport ImageDebug from './image_debug';\nimport Code128Reader from './code_128_reader';\nimport EANReader from './ean_reader';\nimport Code39Reader from './code_39_reader';\nimport Code39VINReader from './code_39_vin_reader';\nimport CodabarReader from './codabar_reader';\nimport UPCReader from './upc_reader';\nimport EAN8Reader from './ean_8_reader';\nimport UPCEReader from './upc_e_reader';\nimport I2of5Reader from './i2of5_reader';\n\nvar readers = {\n code_128_reader: Code128Reader,\n ean_reader: EANReader,\n ean_8_reader: EAN8Reader,\n code_39_reader: Code39Reader,\n code_39_vin_reader: Code39VINReader,\n codabar_reader: CodabarReader,\n upc_reader: UPCReader,\n upc_e_reader: UPCEReader,\n i2of5_reader: I2of5Reader\n};\nexport default {\n create : function(config, inputImageWrapper) {\n var _canvas = {\n ctx : {\n frequency : null,\n pattern : null,\n overlay : null\n },\n dom : {\n frequency : null,\n pattern : null,\n overlay : null\n }\n },\n _barcodeReaders = [];\n\n initCanvas();\n initReaders();\n initConfig();\n\n function initCanvas() {\n if (typeof document !== 'undefined') {\n var $debug = document.querySelector(\"#debug.detection\");\n _canvas.dom.frequency = document.querySelector(\"canvas.frequency\");\n if (!_canvas.dom.frequency) {\n _canvas.dom.frequency = document.createElement(\"canvas\");\n _canvas.dom.frequency.className = \"frequency\";\n if($debug) {\n $debug.appendChild(_canvas.dom.frequency);\n }\n }\n _canvas.ctx.frequency = _canvas.dom.frequency.getContext(\"2d\");\n\n _canvas.dom.pattern = document.querySelector(\"canvas.patternBuffer\");\n if (!_canvas.dom.pattern) {\n _canvas.dom.pattern = document.createElement(\"canvas\");\n _canvas.dom.pattern.className = \"patternBuffer\";\n if($debug) {\n $debug.appendChild(_canvas.dom.pattern);\n }\n }\n _canvas.ctx.pattern = _canvas.dom.pattern.getContext(\"2d\");\n\n _canvas.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n if (_canvas.dom.overlay) {\n _canvas.ctx.overlay = _canvas.dom.overlay.getContext(\"2d\");\n }\n }\n }\n\n function initReaders() {\n config.readers.forEach(function(readerConfig) {\n var reader,\n config = {};\n\n if (typeof readerConfig === 'object') {\n reader = readerConfig.format;\n config = readerConfig.config;\n } else if (typeof readerConfig === 'string') {\n reader = readerConfig;\n }\n _barcodeReaders.push(new readers[reader](config));\n });\n console.log(\"Registered Readers: \" + _barcodeReaders\n .map(function(reader) {return JSON.stringify({format: reader.FORMAT, config: reader.config});})\n .join(', '));\n }\n\n function initConfig() {\n if (typeof document !== 'undefined') {\n var i,\n vis = [{\n node : _canvas.dom.frequency,\n prop : config.showFrequency\n }, {\n node : _canvas.dom.pattern,\n prop : config.showPattern\n }];\n\n for (i = 0; i < vis.length; i++) {\n if (vis[i].prop === true) {\n vis[i].node.style.display = \"block\";\n } else {\n vis[i].node.style.display = \"none\";\n }\n }\n }\n }\n\n /**\n * extend the line on both ends\n * @param {Array} line\n * @param {Number} angle\n */\n function getExtendedLine(line, angle, ext) {\n function extendLine(amount) {\n var extension = {\n y : amount * Math.sin(angle),\n x : amount * Math.cos(angle)\n };\n\n line[0].y -= extension.y;\n line[0].x -= extension.x;\n line[1].y += extension.y;\n line[1].x += extension.x;\n }\n\n // check if inside image\n extendLine(ext);\n while (ext > 1 && (!inputImageWrapper.inImageWithBorder(line[0], 0) || !inputImageWrapper.inImageWithBorder(line[1], 0))) {\n ext -= Math.ceil(ext/2);\n extendLine(-ext);\n }\n return line;\n }\n\n function getLine(box) {\n return [{\n x : (box[1][0] - box[0][0]) / 2 + box[0][0],\n y : (box[1][1] - box[0][1]) / 2 + box[0][1]\n }, {\n x : (box[3][0] - box[2][0]) / 2 + box[2][0],\n y : (box[3][1] - box[2][1]) / 2 + box[2][1]\n }];\n }\n\n function tryDecode(line) {\n var result = null,\n i,\n barcodeLine = Bresenham.getBarcodeLine(inputImageWrapper, line[0], line[1]);\n\n if (config.showFrequency) {\n ImageDebug.drawPath(line, {x: 'x', y: 'y'}, _canvas.ctx.overlay, {color: 'red', lineWidth: 3});\n Bresenham.debug.printFrequency(barcodeLine.line, _canvas.dom.frequency);\n }\n Bresenham.toBinaryLine(barcodeLine);\n if (config.showPattern) {\n Bresenham.debug.printPattern(barcodeLine.line, _canvas.dom.pattern);\n }\n\n for ( i = 0; i < _barcodeReaders.length && result === null; i++) {\n result = _barcodeReaders[i].decodePattern(barcodeLine.line);\n }\n if(result === null){\n return null;\n }\n return {\n codeResult: result,\n barcodeLine: barcodeLine\n };\n\n }\n\n /**\n * This method slices the given area apart and tries to detect a barcode-pattern\n * for each slice. It returns the decoded barcode, or null if nothing was found\n * @param {Array} box\n * @param {Array} line\n * @param {Number} lineAngle\n */\n function tryDecodeBruteForce(box, line, lineAngle) {\n var sideLength = Math.sqrt(Math.pow(box[1][0] - box[0][0], 2) + Math.pow((box[1][1] - box[0][1]), 2)),\n i,\n slices = 16,\n result = null,\n dir,\n extension,\n xdir = Math.sin(lineAngle),\n ydir = Math.cos(lineAngle);\n\n for ( i = 1; i < slices && result === null; i++) {\n // move line perpendicular to angle\n dir = sideLength / slices * i * (i % 2 === 0 ? -1 : 1);\n extension = {\n y : dir * xdir,\n x : dir * ydir\n };\n line[0].y += extension.x;\n line[0].x -= extension.y;\n line[1].y += extension.x;\n line[1].x -= extension.y;\n\n result = tryDecode(line);\n }\n return result;\n }\n\n function getLineLength(line) {\n return Math.sqrt(\n Math.pow(Math.abs(line[1].y - line[0].y), 2) +\n Math.pow(Math.abs(line[1].x - line[0].x), 2));\n }\n\n /**\n * With the help of the configured readers (Code128 or EAN) this function tries to detect a\n * valid barcode pattern within the given area.\n * @param {Object} box The area to search in\n * @returns {Object} the result {codeResult, line, angle, pattern, threshold}\n */\n function decodeFromBoundingBox(box) {\n var line,\n lineAngle,\n ctx = _canvas.ctx.overlay,\n result,\n lineLength;\n\n if (config.drawBoundingBox && ctx) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, ctx, {color: \"blue\", lineWidth: 2});\n }\n\n line = getLine(box);\n lineLength = getLineLength(line);\n lineAngle = Math.atan2(line[1].y - line[0].y, line[1].x - line[0].x);\n line = getExtendedLine(line, lineAngle, Math.floor(lineLength*0.1));\n if(line === null){\n return null;\n }\n\n result = tryDecode(line);\n if(result === null) {\n result = tryDecodeBruteForce(box, line, lineAngle);\n }\n\n if(result === null) {\n return null;\n }\n\n if (result && config.drawScanline && ctx) {\n ImageDebug.drawPath(line, {x: 'x', y: 'y'}, ctx, {color: 'red', lineWidth: 3});\n }\n\n return {\n codeResult : result.codeResult,\n line : line,\n angle : lineAngle,\n pattern : result.barcodeLine.line,\n threshold : result.barcodeLine.threshold\n };\n }\n\n return {\n decodeFromBoundingBox : function(box) {\n return decodeFromBoundingBox(box);\n },\n decodeFromBoundingBoxes : function(boxes) {\n var i, result;\n for ( i = 0; i < boxes.length; i++) {\n result = decodeFromBoundingBox(boxes[i]);\n if (result && result.codeResult) {\n result.box = boxes[i];\n return result;\n }\n }\n },\n setReaders: function(readers) {\n config.readers = readers;\n _barcodeReaders.length = 0;\n initReaders();\n }\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_decoder.js\n **/","import CVUtils from './cv_utils';\nimport ImageWrapper from './image_wrapper';\n\nvar Bresenham = {};\n\nvar Slope = {\n DIR : {\n UP : 1,\n DOWN : -1\n }\n};\n/**\n * Scans a line of the given image from point p1 to p2 and returns a result object containing\n * gray-scale values (0-255) of the underlying pixels in addition to the min\n * and max values.\n * @param {Object} imageWrapper\n * @param {Object} p1 The start point {x,y}\n * @param {Object} p2 The end point {x,y}\n * @returns {line, min, max}\n */\nBresenham.getBarcodeLine = function(imageWrapper, p1, p2) {\n var x0 = p1.x | 0,\n y0 = p1.y | 0,\n x1 = p2.x | 0,\n y1 = p2.y | 0,\n steep = Math.abs(y1 - y0) > Math.abs(x1 - x0),\n deltax,\n deltay,\n error,\n ystep,\n y,\n tmp,\n x,\n line = [],\n imageData = imageWrapper.data,\n width = imageWrapper.size.x,\n sum = 0,\n val,\n min = 255,\n max = 0;\n\n function read(a, b) {\n val = imageData[b * width + a];\n sum += val;\n min = val < min ? val : min;\n max = val > max ? val : max;\n line.push(val);\n }\n\n if (steep) {\n tmp = x0;\n x0 = y0;\n y0 = tmp;\n\n tmp = x1;\n x1 = y1;\n y1 = tmp;\n }\n if (x0 > x1) {\n tmp = x0;\n x0 = x1;\n x1 = tmp;\n\n tmp = y0;\n y0 = y1;\n y1 = tmp;\n }\n deltax = x1 - x0;\n deltay = Math.abs(y1 - y0);\n error = (deltax / 2) | 0;\n y = y0;\n ystep = y0 < y1 ? 1 : -1;\n for ( x = x0; x < x1; x++) {\n if(steep){\n read(y, x);\n } else {\n read(x, y);\n }\n error = error - deltay;\n if (error < 0) {\n y = y + ystep;\n error = error + deltax;\n }\n }\n\n return {\n line : line,\n min : min,\n max : max\n };\n};\n\nBresenham.toOtsuBinaryLine = function(result) {\n var line = result.line,\n image = new ImageWrapper({x: line.length - 1, y: 1}, line),\n threshold = CVUtils.determineOtsuThreshold(image, 5);\n\n line = CVUtils.sharpenLine(line);\n CVUtils.thresholdImage(image, threshold);\n\n return {\n line: line,\n threshold: threshold\n };\n};\n\n/**\n * Converts the result from getBarcodeLine into a binary representation\n * also considering the frequency and slope of the signal for more robust results\n * @param {Object} result {line, min, max}\n */\nBresenham.toBinaryLine = function(result) {\n\n var min = result.min,\n max = result.max,\n line = result.line,\n slope,\n slope2,\n center = min + (max - min) / 2,\n extrema = [],\n currentDir,\n dir,\n threshold = (max - min) / 12,\n rThreshold = -threshold,\n i,\n j;\n\n // 1. find extrema\n currentDir = line[0] > center ? Slope.DIR.UP : Slope.DIR.DOWN;\n extrema.push({\n pos : 0,\n val : line[0]\n });\n for ( i = 0; i < line.length - 2; i++) {\n slope = (line[i + 1] - line[i]);\n slope2 = (line[i + 2] - line[i + 1]);\n if ((slope + slope2) < rThreshold && line[i + 1] < (center*1.5)) {\n dir = Slope.DIR.DOWN;\n } else if ((slope + slope2) > threshold && line[i + 1] > (center*0.5)) {\n dir = Slope.DIR.UP;\n } else {\n dir = currentDir;\n }\n\n if (currentDir !== dir) {\n extrema.push({\n pos : i,\n val : line[i]\n });\n currentDir = dir;\n }\n }\n extrema.push({\n pos : line.length,\n val : line[line.length - 1]\n });\n\n for ( j = extrema[0].pos; j < extrema[1].pos; j++) {\n line[j] = line[j] > center ? 0 : 1;\n }\n\n // iterate over extrema and convert to binary based on avg between minmax\n for ( i = 1; i < extrema.length - 1; i++) {\n if (extrema[i + 1].val > extrema[i].val) {\n threshold = (extrema[i].val + ((extrema[i + 1].val - extrema[i].val) / 3) * 2) | 0;\n } else {\n threshold = (extrema[i + 1].val + ((extrema[i].val - extrema[i + 1].val) / 3)) | 0;\n }\n\n for ( j = extrema[i].pos; j < extrema[i + 1].pos; j++) {\n line[j] = line[j] > threshold ? 0 : 1;\n }\n }\n\n return {\n line : line,\n threshold : threshold\n };\n};\n\n/**\n * Used for development only\n */\nBresenham.debug = {\n printFrequency: function(line, canvas) {\n var i,\n ctx = canvas.getContext(\"2d\");\n canvas.width = line.length;\n canvas.height = 256;\n\n ctx.beginPath();\n ctx.strokeStyle = \"blue\";\n for ( i = 0; i < line.length; i++) {\n ctx.moveTo(i, 255);\n ctx.lineTo(i, 255 - line[i]);\n }\n ctx.stroke();\n ctx.closePath();\n },\n\n printPattern: function(line, canvas) {\n var ctx = canvas.getContext(\"2d\"), i;\n\n canvas.width = line.length;\n ctx.fillColor = \"black\";\n for ( i = 0; i < line.length; i++) {\n if (line[i] === 1) {\n ctx.fillRect(i, 0, 1, 100);\n }\n }\n }\n};\n\nexport default Bresenham;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/bresenham.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction Code128Reader() {\n BarcodeReader.call(this);\n}\n\nvar properties = {\n CODE_SHIFT : {value: 98},\n CODE_C : {value: 99},\n CODE_B : {value: 100},\n CODE_A : {value: 101},\n START_CODE_A : {value: 103},\n START_CODE_B : {value: 104},\n START_CODE_C : {value: 105},\n STOP_CODE : {value: 106},\n MODULO : {value: 11},\n CODE_PATTERN : {value: [\n [2, 1, 2, 2, 2, 2],\n [2, 2, 2, 1, 2, 2],\n [2, 2, 2, 2, 2, 1],\n [1, 2, 1, 2, 2, 3],\n [1, 2, 1, 3, 2, 2],\n [1, 3, 1, 2, 2, 2],\n [1, 2, 2, 2, 1, 3],\n [1, 2, 2, 3, 1, 2],\n [1, 3, 2, 2, 1, 2],\n [2, 2, 1, 2, 1, 3],\n [2, 2, 1, 3, 1, 2],\n [2, 3, 1, 2, 1, 2],\n [1, 1, 2, 2, 3, 2],\n [1, 2, 2, 1, 3, 2],\n [1, 2, 2, 2, 3, 1],\n [1, 1, 3, 2, 2, 2],\n [1, 2, 3, 1, 2, 2],\n [1, 2, 3, 2, 2, 1],\n [2, 2, 3, 2, 1, 1],\n [2, 2, 1, 1, 3, 2],\n [2, 2, 1, 2, 3, 1],\n [2, 1, 3, 2, 1, 2],\n [2, 2, 3, 1, 1, 2],\n [3, 1, 2, 1, 3, 1],\n [3, 1, 1, 2, 2, 2],\n [3, 2, 1, 1, 2, 2],\n [3, 2, 1, 2, 2, 1],\n [3, 1, 2, 2, 1, 2],\n [3, 2, 2, 1, 1, 2],\n [3, 2, 2, 2, 1, 1],\n [2, 1, 2, 1, 2, 3],\n [2, 1, 2, 3, 2, 1],\n [2, 3, 2, 1, 2, 1],\n [1, 1, 1, 3, 2, 3],\n [1, 3, 1, 1, 2, 3],\n [1, 3, 1, 3, 2, 1],\n [1, 1,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1, 1, 2],\n [4, 2, 1, 2, 1, 1],\n [2, 1, 2, 1, 4, 1],\n [2, 1, 4, 1, 2, 1],\n [4, 1, 2, 1, 2, 1],\n [1, 1, 1, 1, 4, 3],\n [1, 1, 1, 3, 4, 1],\n [1, 3, 1, 1, 4, 1],\n [1, 1, 4, 1, 1, 3],\n [1, 1, 4, 3, 1, 1],\n [4, 1, 1, 1, 1, 3],\n [4, 1, 1, 3, 1, 1],\n [1, 1, 3, 1, 4, 1],\n [1, 1, 4, 1, 3, 1],\n [3, 1, 1, 1, 4, 1],\n [4, 1, 1, 1, 3, 1],\n [2, 1, 1, 4, 1, 2],\n [2, 1, 1, 2, 1, 4],\n [2, 1, 1, 2, 3, 2],\n [2, 3, 3, 1, 1, 1, 2]\n ]},\n SINGLE_CODE_ERROR: {value: 1},\n AVG_CODE_ERROR: {value: 0.5},\n FORMAT: {value: \"code_128\", writeable: false}\n};\n\nCode128Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nCode128Reader.prototype.constructor = Code128Reader;\n\nCode128Reader.prototype._decodeCode = function(start) {\n var counter = [0, 0, 0, 0, 0, 0],\n i,\n self = this,\n offset = start,\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : start,\n end : start\n },\n code,\n error,\n normalized;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < self.CODE_PATTERN.length; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n bestMatch.end = i;\n return bestMatch;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nCode128Reader.prototype._findStart = function() {\n var counter = [0, 0, 0, 0, 0, 0],\n i,\n self = this,\n offset = self._nextSet(self._row),\n isWhite = false,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n code,\n error,\n j,\n sum,\n normalized;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n if (bestMatch.error < self.AVG_CODE_ERROR) {\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n\n for ( j = 0; j < 4; j++) {\n counter[j] = counter[j + 2];\n }\n counter[4] = 0;\n counter[5] = 0;\n counterPos--;\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nCode128Reader.prototype._decode = function() {\n var self = this,\n startInfo = self._findStart(),\n code = null,\n done = false,\n result = [],\n multiplier = 0,\n checksum = 0,\n codeset,\n rawResult = [],\n decodedCodes = [],\n shiftNext = false,\n unshift,\n lastCharacterWasPrintable;\n\n if (startInfo === null) {\n return null;\n }\n code = {\n code : startInfo.code,\n start : startInfo.start,\n end : startInfo.end\n };\n decodedCodes.push(code);\n checksum = code.code;\n switch(code.code) {\n case self.START_CODE_A:\n codeset = self.CODE_A;\n break;\n case self.START_CODE_B:\n codeset = self.CODE_B;\n break;\n case self.START_CODE_C:\n codeset = self.CODE_C;\n break;\n default:\n return null;\n }\n\n while (!done) {\n unshift = shiftNext;\n shiftNext = false;\n code = self._decodeCode(code.end);\n if (code !== null) {\n if (code.code !== self.STOP_CODE) {\n rawResult.push(code.code);\n multiplier++;\n checksum += multiplier * code.code;\n }\n decodedCodes.push(code);\n\n switch(codeset) {\n case self.CODE_A:\n if (code.code < 64) {\n result.push(String.fromCharCode(32 + code.code));\n } else if (code.code < 96) {\n result.push(String.fromCharCode(code.code - 64));\n } else {\n switch (code.code) {\n case self.CODE_SHIFT:\n shiftNext = true;\n codeset = self.CODE_B;\n break;\n case self.CODE_B:\n codeset = self.CODE_B;\n break;\n case self.CODE_C:\n codeset = self.CODE_C;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n }\n break;\n case self.CODE_B:\n if (code.code < 96) {\n result.push(String.fromCharCode(32 + code.code));\n } else {\n if (code.code != self.STOP_CODE) {\n lastCharacterWasPrintable = false;\n }\n switch (code.code) {\n case self.CODE_SHIFT:\n shiftNext = true;\n codeset = self.CODE_A;\n break;\n case self.CODE_A:\n codeset = self.CODE_A;\n break;\n case self.CODE_C:\n codeset = self.CODE_C;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n }\n break;\n case self.CODE_C:\n if (code.code < 100) {\n result.push(code.code < 10 ? \"0\" + code.code : code.code);\n }\n switch (code.code) {\n case self.CODE_A:\n codeset = self.CODE_A;\n break;\n case self.CODE_B:\n codeset = self.CODE_B;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n break;\n }\n } else {\n done = true;\n }\n if (unshift) {\n codeset = codeset == self.CODE_A ? self.CODE_B : self.CODE_A;\n }\n }\n\n if (code === null) {\n return null;\n }\n\n // find end bar\n code.end = self._nextUnset(self._row, code.end);\n if(!self._verifyTrailingWhitespace(code)){\n return null;\n }\n\n // checksum\n // Does not work correctly yet!!! startcode - endcode?\n checksum -= multiplier * rawResult[rawResult.length - 1];\n if (checksum % 103 != rawResult[rawResult.length - 1]) {\n return null;\n }\n\n if (!result.length) {\n return null;\n }\n\n // remove last code from result (checksum)\n result.splice(result.length - 1, 1);\n\n\n\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : code.end,\n codeset : codeset,\n startInfo : startInfo,\n decodedCodes : decodedCodes,\n endInfo : code\n };\n};\n\n\nBarcodeReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start) / 2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nexport default Code128Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_128_reader.js\n **/","function BarcodeReader(config) {\n this._row = [];\n this.config = config || {};\n return this;\n}\n\nBarcodeReader.prototype._nextUnset = function(line, start) {\n var i;\n\n if (start === undefined) {\n start = 0;\n }\n for (i = start; i < line.length; i++) {\n if (!line[i]) {\n return i;\n }\n }\n return line.length;\n};\n\nBarcodeReader.prototype._matchPattern = function(counter, code) {\n var i,\n error = 0,\n singleError = 0,\n modulo = this.MODULO,\n maxSingleError = this.SINGLE_CODE_ERROR || 1;\n\n for (i = 0; i < counter.length; i++) {\n singleError = Math.abs(code[i] - counter[i]);\n if (singleError > maxSingleError) {\n return Number.MAX_VALUE;\n }\n error += singleError;\n }\n return error/modulo;\n};\n\nBarcodeReader.prototype._nextSet = function(line, offset) {\n var i;\n\n offset = offset || 0;\n for (i = offset; i < line.length; i++) {\n if (line[i]) {\n return i;\n }\n }\n return line.length;\n};\n\nBarcodeReader.prototype._normalize = function(counter, modulo) {\n var i,\n self = this,\n sum = 0,\n ratio,\n numOnes = 0,\n normalized = [],\n norm = 0;\n\n if (!modulo) {\n modulo = self.MODULO;\n }\n for (i = 0; i < counter.length; i++) {\n if (counter[i] === 1) {\n numOnes++;\n } else {\n sum += counter[i];\n }\n }\n ratio = sum / (modulo - numOnes);\n if (ratio > 1.0) {\n for (i = 0; i < counter.length; i++) {\n norm = counter[i] === 1 ? counter[i] : counter[i] / ratio;\n normalized.push(norm);\n }\n } else {\n ratio = (sum + numOnes)/modulo;\n for (i = 0; i < counter.length; i++) {\n norm = counter[i] / ratio;\n normalized.push(norm);\n }\n }\n return normalized;\n};\n\nBarcodeReader.prototype._matchTrace = function(cmpCounter, epsilon) {\n var counter = [],\n i,\n self = this,\n offset = self._nextSet(self._row),\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0\n },\n error;\n\n if (cmpCounter) {\n for ( i = 0; i < cmpCounter.length; i++) {\n counter.push(0);\n }\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n error = self._matchPattern(counter, cmpCounter);\n\n if (error < epsilon) {\n bestMatch.start = i - offset;\n bestMatch.end = i;\n bestMatch.counter = counter;\n return bestMatch;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n } else {\n counter.push(0);\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n counterPos++;\n counter.push(0);\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n }\n\n // if cmpCounter was not given\n bestMatch.start = offset;\n bestMatch.end = self._row.length - 1;\n bestMatch.counter = counter;\n return bestMatch;\n};\n\nBarcodeReader.prototype.decodePattern = function(pattern) {\n var self = this,\n result;\n\n self._row = pattern;\n result = self._decode();\n if (result === null) {\n self._row.reverse();\n result = self._decode();\n if (result) {\n result.direction = BarcodeReader.DIRECTION.REVERSE;\n result.start = self._row.length - result.start;\n result.end = self._row.length - result.end;\n }\n } else {\n result.direction = BarcodeReader.DIRECTION.FORWARD;\n }\n if (result) {\n result.format = self.FORMAT;\n }\n return result;\n};\n\nBarcodeReader.prototype._matchRange = function(start, end, value) {\n var i;\n\n start = start < 0 ? 0 : start;\n for (i = start; i < end; i++) {\n if (this._row[i] !== value) {\n return false;\n }\n }\n return true;\n};\n\nBarcodeReader.prototype._fillCounters = function(offset, end, isWhite) {\n var self = this,\n counterPos = 0,\n i,\n counters = [];\n\n isWhite = (typeof isWhite !== 'undefined') ? isWhite : true;\n offset = (typeof offset !== 'undefined') ? offset : self._nextUnset(self._row);\n end = end || self._row.length;\n\n counters[counterPos] = 0;\n for (i = offset; i < end; i++) {\n if (self._row[i] ^ isWhite) {\n counters[counterPos]++;\n } else {\n counterPos++;\n counters[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return counters;\n};\n\nObject.defineProperty(BarcodeReader.prototype, \"FORMAT\", {\n value: 'unknown',\n writeable: false\n});\n\nBarcodeReader.DIRECTION = {\n FORWARD : 1,\n REVERSE : -1\n};\n\nBarcodeReader.Exception = {\n StartNotFoundException : \"Start-Info was not found!\",\n CodeNotFoundException : \"Code could not be found!\",\n PatternNotFoundException : \"Pattern could not be found!\"\n};\n\nBarcodeReader.CONFIG_KEYS = {};\n\nexport default BarcodeReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_reader.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction EANReader(opts) {\n BarcodeReader.call(this, opts);\n}\n\nvar properties = {\n CODE_L_START : {value: 0},\n MODULO : {value: 7},\n CODE_G_START : {value: 10},\n START_PATTERN : {value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7]},\n STOP_PATTERN : {value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7]},\n MIDDLE_PATTERN : {value: [1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7]},\n CODE_PATTERN : {value: [\n [3, 2, 1, 1],\n [2, 2, 2, 1],\n [2, 1, 2, 2],\n [1, 4, 1, 1],\n [1, 1, 3, 2],\n [1, 2, 3, 1],\n [1, 1, 1, 4],\n [1, 3, 1, 2],\n [1, 2, 1, 3],\n [3, 1, 1, 2],\n [1, 1, 2, 3],\n [1, 2, 2, 2],\n [2, 2, 1, 2],\n [1, 1, 4, 1],\n [2, 3, 1, 1],\n [1, 3, 2, 1],\n [4, 1, 1, 1],\n [2, 1, 3, 1],\n [3, 1, 2, 1],\n [2, 1, 1, 3]\n ]},\n CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},\n SINGLE_CODE_ERROR: {value: 0.67},\n AVG_CODE_ERROR: {value: 0.27},\n FORMAT: {value: \"ean_13\", writeable: false}\n};\n\nEANReader.prototype = Object.create(BarcodeReader.prototype, properties);\nEANReader.prototype.constructor = EANReader;\n\nEANReader.prototype._decodeCode = function(start, coderange) {\n var counter = [0, 0, 0, 0],\n i,\n self = this,\n offset = start,\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : start,\n end : start\n },\n code,\n error,\n normalized;\n\n if (!coderange) {\n coderange = self.CODE_PATTERN.length;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < coderange; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n bestMatch.end = i;\n if (bestMatch.error > self.AVG_CODE_ERROR) {\n return null;\n }\n return bestMatch;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nEANReader.prototype._findPattern = function(pattern, offset, isWhite, tryHarder, epsilon) {\n var counter = [],\n self = this,\n i,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n error,\n j,\n sum,\n normalized;\n\n if (!offset) {\n offset = self._nextSet(self._row);\n }\n\n if (isWhite === undefined) {\n isWhite = false;\n }\n\n if (tryHarder === undefined) {\n tryHarder = true;\n }\n\n if ( epsilon === undefined) {\n epsilon = self.AVG_CODE_ERROR;\n }\n\n for ( i = 0; i < pattern.length; i++) {\n counter[i] = 0;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n error = self._matchPattern(normalized, pattern);\n\n if (error < epsilon) {\n bestMatch.error = error;\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n if (tryHarder) {\n for ( j = 0; j < counter.length - 2; j++) {\n counter[j] = counter[j + 2];\n }\n counter[counter.length - 2] = 0;\n counter[counter.length - 1] = 0;\n counterPos--;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nEANReader.prototype._findStart = function() {\n var self = this,\n leadingWhitespaceStart,\n offset = self._nextSet(self._row),\n startInfo;\n\n while(!startInfo) {\n startInfo = self._findPattern(self.START_PATTERN, offset);\n if (!startInfo) {\n return null;\n }\n leadingWhitespaceStart = startInfo.start - (startInfo.end - startInfo.start);\n if (leadingWhitespaceStart >= 0) {\n if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n return startInfo;\n }\n }\n offset = startInfo.end;\n startInfo = null;\n }\n};\n\nEANReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nEANReader.prototype._findEnd = function(offset, isWhite) {\n var self = this,\n endInfo = self._findPattern(self.STOP_PATTERN, offset, isWhite, false);\n\n return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n};\n\nEANReader.prototype._calculateFirstDigit = function(codeFrequency) {\n var i,\n self = this;\n\n for ( i = 0; i < self.CODE_FREQUENCY.length; i++) {\n if (codeFrequency === self.CODE_FREQUENCY[i]) {\n return i;\n }\n }\n return null;\n};\n\nEANReader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this,\n codeFrequency = 0x0,\n firstDigit;\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end);\n if (!code) {\n return null;\n }\n if (code.code >= self.CODE_G_START) {\n code.code = code.code - self.CODE_G_START;\n codeFrequency |= 1 << (5 - i);\n } else {\n codeFrequency |= 0 << (5 - i);\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n\n firstDigit = self._calculateFirstDigit(codeFrequency);\n if (firstDigit === null) {\n return null;\n }\n result.unshift(firstDigit);\n\n code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n if (code === null) {\n return null;\n }\n decodedCodes.push(code);\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n decodedCodes.push(code);\n result.push(code.code);\n }\n\n return code;\n};\n\nEANReader.prototype._decode = function() {\n var startInfo,\n self = this,\n code,\n result = [],\n decodedCodes = [];\n\n startInfo = self._findStart();\n if (!startInfo) {\n return null;\n }\n code = {\n code : startInfo.code,\n start : startInfo.start,\n end : startInfo.end\n };\n decodedCodes.push(code);\n code = self._decodePayload(code, result, decodedCodes);\n if (!code) {\n return null;\n }\n code = self._findEnd(code.end, false);\n if (!code){\n return null;\n }\n\n decodedCodes.push(code);\n\n // Checksum\n if (!self._checksum(result)) {\n return null;\n }\n\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : code.end,\n codeset : \"\",\n startInfo : startInfo,\n decodedCodes : decodedCodes\n };\n};\n\nEANReader.prototype._checksum = function(result) {\n var sum = 0, i;\n\n for ( i = result.length - 2; i >= 0; i -= 2) {\n sum += result[i];\n }\n sum *= 3;\n for ( i = result.length - 1; i >= 0; i -= 2) {\n sum += result[i];\n }\n return sum % 10 === 0;\n};\n\nexport default (EANReader);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ean_reader.js\n **/","import BarcodeReader from './barcode_reader';\nimport ArrayHelper from './array_helper';\n\nfunction Code39Reader() {\n BarcodeReader.call(this);\n}\n\nvar properties = {\n ALPHABETH_STRING: {value: \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%\"},\n ALPHABET: {value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 45, 46, 32, 42, 36, 47, 43, 37]},\n CHARACTER_ENCODINGS: {value: [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A]},\n ASTERISK: {value: 0x094},\n FORMAT: {value: \"code_39\", writeable: false}\n};\n\nCode39Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nCode39Reader.prototype.constructor = Code39Reader;\n\nCode39Reader.prototype._toCounters = function(start, counter) {\n var self = this,\n numCounters = counter.length,\n end = self._row.length,\n isWhite = !self._row[start],\n i,\n counterPos = 0;\n\n ArrayHelper.init(counter, 0);\n\n for ( i = start; i < end; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n counterPos++;\n if (counterPos === numCounters) {\n break;\n } else {\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n }\n\n return counter;\n};\n\nCode39Reader.prototype._decode = function() {\n var self = this,\n counters = [0,0,0,0,0,0,0,0,0],\n result = [],\n start = self._findStart(),\n decodedChar,\n lastStart,\n pattern,\n nextStart;\n\n if (!start) {\n return null;\n }\n nextStart = self._nextSet(self._row, start.end);\n\n do {\n counters = self._toCounters(nextStart, counters);\n pattern = self._toPattern(counters);\n if (pattern < 0) {\n return null;\n }\n decodedChar = self._patternToChar(pattern);\n if (decodedChar < 0){\n return null;\n }\n result.push(decodedChar);\n lastStart = nextStart;\n nextStart += ArrayHelper.sum(counters);\n nextStart = self._nextSet(self._row, nextStart);\n } while(decodedChar !== '*');\n result.pop();\n\n if (!result.length) {\n return null;\n }\n\n if(!self._verifyTrailingWhitespace(lastStart, nextStart, counters)) {\n return null;\n }\n\n return {\n code : result.join(\"\"),\n start : start.start,\n end : nextStart,\n startInfo : start,\n decodedCodes : result\n };\n};\n\nCode39Reader.prototype._verifyTrailingWhitespace = function(lastStart, nextStart, counters) {\n var trailingWhitespaceEnd,\n patternSize = ArrayHelper.sum(counters);\n\n trailingWhitespaceEnd = nextStart - lastStart - patternSize;\n if ((trailingWhitespaceEnd * 3) >= patternSize) {\n return true;\n }\n return false;\n};\n\nCode39Reader.prototype._patternToChar = function(pattern) {\n var i,\n self = this;\n\n for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n if (self.CHARACTER_ENCODINGS[i] === pattern) {\n return String.fromCharCode(self.ALPHABET[i]);\n }\n }\n};\n\nCode39Reader.prototype._findNextWidth = function(counters, current) {\n var i,\n minWidth = Number.MAX_VALUE;\n\n for (i = 0; i < counters.length; i++) {\n if (counters[i] < minWidth && counters[i] > current) {\n minWidth = counters[i];\n }\n }\n\n return minWidth;\n};\n\nCode39Reader.prototype._toPattern = function(counters) {\n var numCounters = counters.length,\n maxNarrowWidth = 0,\n numWideBars = numCounters,\n wideBarWidth = 0,\n self = this,\n pattern,\n i;\n\n while(numWideBars > 3) {\n maxNarrowWidth = self._findNextWidth(counters, maxNarrowWidth);\n numWideBars = 0;\n pattern = 0;\n for (i = 0; i < numCounters; i++) {\n if (counters[i] > maxNarrowWidth) {\n pattern |= 1 << (numCounters - 1 - i);\n numWideBars++;\n wideBarWidth += counters[i];\n }\n }\n\n if (numWideBars === 3) {\n for (i = 0; i < numCounters && numWideBars > 0; i++) {\n if (counters[i] > maxNarrowWidth) {\n numWideBars--;\n if ((counters[i] * 2) >= wideBarWidth) {\n return -1;\n }\n }\n }\n return pattern;\n }\n }\n return -1;\n};\n\nCode39Reader.prototype._findStart = function() {\n var self = this,\n offset = self._nextSet(self._row),\n patternStart = offset,\n counter = [0,0,0,0,0,0,0,0,0],\n counterPos = 0,\n isWhite = false,\n i,\n j,\n whiteSpaceMustStart;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n\n // find start pattern\n if (self._toPattern(counter) === self.ASTERISK) {\n whiteSpaceMustStart = Math.floor(Math.max(0, patternStart - ((i - patternStart) / 4)));\n if (self._matchRange(whiteSpaceMustStart, patternStart, 0)) {\n return {\n start: patternStart,\n end: i\n };\n }\n }\n\n patternStart += counter[0] + counter[1];\n for ( j = 0; j < 7; j++) {\n counter[j] = counter[j + 2];\n }\n counter[7] = 0;\n counter[8] = 0;\n counterPos--;\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nexport default Code39Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_39_reader.js\n **/","import Code39Reader from './code_39_reader';\n\nfunction Code39VINReader() {\n Code39Reader.call(this);\n}\n\nvar patterns = {\n IOQ: /[IOQ]/g,\n AZ09: /[A-Z0-9]{17}/\n};\n\nCode39VINReader.prototype = Object.create(Code39Reader.prototype);\nCode39VINReader.prototype.constructor = Code39VINReader;\n\n// Cribbed from:\n// /~https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/VINResultParser.java\nCode39VINReader.prototype._decode = function() {\n var result = Code39Reader.prototype._decode.apply(this);\n if (!result) {\n return null;\n }\n\n var code = result.code;\n\n if (!code) {\n return;\n }\n\n code = code.replace(patterns.IOQ, '');\n\n if (!code.match(patterns.AZ09)) {\n console.log('Failed AZ09 pattern code:', code);\n return null;\n }\n\n if (!this._checkChecksum(code)) {\n return null;\n }\n\n result.code = code;\n return result;\n};\n\nCode39VINReader.prototype._checkChecksum = function(code) {\n // TODO\n return !!code;\n};\n\nexport default Code39VINReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_39_vin_reader.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction CodabarReader() {\n BarcodeReader.call(this);\n this._counters = [];\n}\n\nvar properties = {\n ALPHABETH_STRING: {value: \"0123456789-$:/.+ABCD\"},\n ALPHABET: {value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 36, 58, 47, 46, 43, 65, 66, 67, 68]},\n CHARACTER_ENCODINGS: {value: [0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E]},\n START_END: {value: [0x01A, 0x029, 0x00B, 0x00E]},\n MIN_ENCODED_CHARS: {value: 4},\n MAX_ACCEPTABLE: {value: 2.0},\n PADDING: {value: 1.5},\n FORMAT: {value: \"codabar\", writeable: false}\n};\n\nCodabarReader.prototype = Object.create(BarcodeReader.prototype, properties);\nCodabarReader.prototype.constructor = CodabarReader;\n\nCodabarReader.prototype._decode = function() {\n var self = this,\n result = [],\n start,\n decodedChar,\n pattern,\n nextStart,\n end;\n\n this._counters = self._fillCounters();\n start = self._findStart();\n if (!start) {\n return null;\n }\n nextStart = start.startCounter;\n\n do {\n pattern = self._toPattern(nextStart);\n if (pattern < 0) {\n return null;\n }\n decodedChar = self._patternToChar(pattern);\n if (decodedChar < 0){\n return null;\n }\n result.push(decodedChar);\n nextStart += 8;\n if (result.length > 1 && self._isStartEnd(pattern)) {\n break;\n }\n } while(nextStart < self._counters.length);\n\n // verify end\n if ((result.length - 2) < self.MIN_ENCODED_CHARS || !self._isStartEnd(pattern)) {\n return null;\n }\n\n // verify end white space\n if (!self._verifyWhitespace(start.startCounter, nextStart - 8)){\n return null;\n }\n\n if (!self._validateResult(result, start.startCounter)){\n return null;\n }\n\n nextStart = nextStart > self._counters.length ? self._counters.length : nextStart;\n end = start.start + self._sumCounters(start.startCounter, nextStart - 8);\n\n return {\n code : result.join(\"\"),\n start : start.start,\n end : end,\n startInfo : start,\n decodedCodes : result\n };\n};\n\nCodabarReader.prototype._verifyWhitespace = function(startCounter, endCounter) {\n if ((startCounter - 1 <= 0) || this._counters[startCounter-1] >= (this._calculatePatternLength(startCounter) / 2.0)) {\n if ((endCounter + 8 >= this._counters.length) || this._counters[endCounter+7] >= (this._calculatePatternLength(endCounter) / 2.0)) {\n return true;\n }\n }\n return false;\n};\n\nCodabarReader.prototype._calculatePatternLength = function(offset) {\n var i,\n sum = 0;\n\n for (i = offset; i < offset + 7; i++) {\n sum += this._counters[i];\n }\n\n return sum;\n};\n\nCodabarReader.prototype._thresholdResultPattern = function(result, startCounter){\n var self = this,\n categorization = {\n space: {\n narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE},\n wide: {size: 0, counts: 0, min: 0, max: Number.MAX_VALUE}\n },\n bar: {\n narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE},\n wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE}\n }\n },\n kind,\n cat,\n i,\n j,\n pos = startCounter,\n pattern;\n\n for (i = 0; i < result.length; i++){\n pattern = self._charToPattern(result[i]);\n for (j = 6; j >= 0; j--) {\n kind = (j & 1) === 2 ? categorization.bar : categorization.space;\n cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n cat.size += self._counters[pos + j];\n cat.counts++;\n pattern >>= 1;\n }\n pos += 8;\n }\n\n [\"space\", \"bar\"].forEach(function(key) {\n var kind = categorization[key];\n kind.wide.min = Math.floor((kind.narrow.size/kind.narrow.counts + kind.wide.size / kind.wide.counts) / 2);\n kind.narrow.max = Math.ceil(kind.wide.min);\n kind.wide.max = Math.ceil((kind.wide.size * self.MAX_ACCEPTABLE + self.PADDING) / kind.wide.counts);\n });\n\n return categorization;\n};\n\nCodabarReader.prototype._charToPattern = function(char) {\n var self = this,\n charCode = char.charCodeAt(0),\n i;\n\n for (i = 0; i < self.ALPHABET.length; i++) {\n if (self.ALPHABET[i] === charCode){\n return self.CHARACTER_ENCODINGS[i];\n }\n }\n return 0x0;\n};\n\nCodabarReader.prototype._validateResult = function(result, startCounter) {\n var self = this,\n thresholds = self._thresholdResultPattern(result, startCounter),\n i,\n j,\n kind,\n cat,\n size,\n pos = startCounter,\n pattern;\n\n for (i = 0; i < result.length; i++) {\n pattern = self._charToPattern(result[i]);\n for (j = 6; j >= 0; j--) {\n kind = (j & 1) === 0 ? thresholds.bar : thresholds.space;\n cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n size = self._counters[pos + j];\n if (size < cat.min || size > cat.max) {\n return false;\n }\n pattern >>= 1;\n }\n pos += 8;\n }\n return true;\n};\n\nCodabarReader.prototype._patternToChar = function(pattern) {\n var i,\n self = this;\n\n for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n if (self.CHARACTER_ENCODINGS[i] === pattern) {\n return String.fromCharCode(self.ALPHABET[i]);\n }\n }\n return -1;\n};\n\nCodabarReader.prototype._computeAlternatingThreshold = function(offset, end) {\n var i,\n min = Number.MAX_VALUE,\n max = 0,\n counter;\n\n for (i = offset; i < end; i += 2){\n counter = this._counters[i];\n if (counter > max) {\n max = counter;\n }\n if (counter < min) {\n min = counter;\n }\n }\n\n return ((min + max) / 2.0) | 0;\n};\n\nCodabarReader.prototype._toPattern = function(offset) {\n var numCounters = 7,\n end = offset + numCounters,\n barThreshold,\n spaceThreshold,\n bitmask = 1 << (numCounters - 1),\n pattern = 0,\n i,\n threshold;\n\n if (end > this._counters.length) {\n return -1;\n }\n\n barThreshold = this._computeAlternatingThreshold(offset, end);\n spaceThreshold = this._computeAlternatingThreshold(offset + 1, end);\n\n for (i = 0; i < numCounters; i++){\n threshold = (i & 1) === 0 ? barThreshold : spaceThreshold;\n if (this._counters[offset + i] > threshold) {\n pattern |= bitmask;\n }\n bitmask >>= 1;\n }\n\n return pattern;\n};\n\nCodabarReader.prototype._isStartEnd = function(pattern) {\n var i;\n\n for (i = 0; i < this.START_END.length; i++) {\n if (this.START_END[i] === pattern) {\n return true;\n }\n }\n return false;\n};\n\nCodabarReader.prototype._sumCounters = function(start, end) {\n var i,\n sum = 0;\n\n for (i = start; i < end; i++) {\n sum += this._counters[i];\n }\n return sum;\n};\n\nCodabarReader.prototype._findStart = function() {\n var self = this,\n i,\n pattern,\n start = self._nextUnset(self._row),\n end;\n\n for (i = 1; i < this._counters.length; i++) {\n pattern = self._toPattern(i);\n if (pattern !== -1 && self._isStartEnd(pattern)) {\n // TODO: Look for whitespace ahead\n start += self._sumCounters(0, i);\n end = start + self._sumCounters(i, i + 8);\n return {\n start: start,\n end: end,\n startCounter: i,\n endCounter: i + 8\n };\n }\n }\n};\n\nexport default CodabarReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/codabar_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction UPCReader() {\n EANReader.call(this);\n}\n\nvar properties = {\n FORMAT: {value: \"upc_a\", writeable: false}\n};\n\nUPCReader.prototype = Object.create(EANReader.prototype, properties);\nUPCReader.prototype.constructor = UPCReader;\n\nUPCReader.prototype._decode = function() {\n var result = EANReader.prototype._decode.call(this);\n\n if (result && result.code && result.code.length === 13 && result.code.charAt(0) === \"0\") {\n\n result.code = result.code.substring(1);\n return result;\n }\n return null;\n};\n\nexport default EANReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/upc_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction EAN8Reader() {\n EANReader.call(this);\n}\n\nvar properties = {\n FORMAT: {value: \"ean_8\", writeable: false}\n};\n\nEAN8Reader.prototype = Object.create(EANReader.prototype, properties);\nEAN8Reader.prototype.constructor = EAN8Reader;\n\nEAN8Reader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this;\n\n for ( i = 0; i < 4; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n\n code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n if (code === null) {\n return null;\n }\n decodedCodes.push(code);\n\n for ( i = 0; i < 4; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n decodedCodes.push(code);\n result.push(code.code);\n }\n\n return code;\n};\n\nexport default EAN8Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ean_8_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction UPCEReader() {\n EANReader.call(this);\n}\n\nvar properties = {\n CODE_FREQUENCY : {value: [\n [ 56, 52, 50, 49, 44, 38, 35, 42, 41, 37 ],\n [7, 11, 13, 14, 19, 25, 28, 21, 22, 26]]},\n STOP_PATTERN: { value: [1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7]},\n FORMAT: {value: \"upc_e\", writeable: false}\n};\n\nUPCEReader.prototype = Object.create(EANReader.prototype, properties);\nUPCEReader.prototype.constructor = UPCEReader;\n\nUPCEReader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this,\n codeFrequency = 0x0;\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end);\n if (!code) {\n return null;\n }\n if (code.code >= self.CODE_G_START) {\n code.code = code.code - self.CODE_G_START;\n codeFrequency |= 1 << (5 - i);\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n if (!self._determineParity(codeFrequency, result)) {\n return null;\n }\n\n return code;\n};\n\nUPCEReader.prototype._determineParity = function(codeFrequency, result) {\n var self =this,\n i,\n nrSystem;\n\n for (nrSystem = 0; nrSystem < self.CODE_FREQUENCY.length; nrSystem++){\n for ( i = 0; i < self.CODE_FREQUENCY[nrSystem].length; i++) {\n if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {\n result.unshift(nrSystem);\n result.push(i);\n return true;\n }\n }\n }\n return false;\n};\n\nUPCEReader.prototype._convertToUPCA = function(result) {\n var upca = [result[0]],\n lastDigit = result[result.length - 2];\n\n if (lastDigit <= 2) {\n upca = upca.concat(result.slice(1, 3))\n .concat([lastDigit, 0, 0, 0, 0])\n .concat(result.slice(3, 6));\n } else if (lastDigit === 3) {\n upca = upca.concat(result.slice(1, 4))\n .concat([0 ,0, 0, 0, 0])\n .concat(result.slice(4,6));\n } else if (lastDigit === 4) {\n upca = upca.concat(result.slice(1, 5))\n .concat([0, 0, 0, 0, 0, result[5]]);\n } else {\n upca = upca.concat(result.slice(1, 6))\n .concat([0, 0, 0, 0, lastDigit]);\n }\n\n upca.push(result[result.length - 1]);\n return upca;\n};\n\nUPCEReader.prototype._checksum = function(result) {\n return EANReader.prototype._checksum.call(this, this._convertToUPCA(result));\n};\n\nUPCEReader.prototype._findEnd = function(offset, isWhite) {\n isWhite = true;\n return EANReader.prototype._findEnd.call(this, offset, isWhite);\n};\n\nUPCEReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start)/2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n};\n\nexport default UPCEReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/upc_e_reader.js\n **/","import BarcodeReader from './barcode_reader';\nconst merge = require('lodash/object/merge');\n\nfunction I2of5Reader(opts) {\n opts = merge(getDefaulConfig(), opts);\n BarcodeReader.call(this, opts);\n this.barSpaceRatio = [1, 1];\n if (opts.normalizeBarSpaceWidth) {\n this.SINGLE_CODE_ERROR = 0.38;\n this.AVG_CODE_ERROR = 0.09;\n }\n}\n\nfunction getDefaulConfig() {\n var config = {};\n\n Object.keys(I2of5Reader.CONFIG_KEYS).forEach(function(key) {\n config[key] = I2of5Reader.CONFIG_KEYS[key]['default'];\n });\n return config;\n}\n\nvar N = 1,\n W = 3,\n properties = {\n MODULO : {value: 10},\n START_PATTERN : {value: [N*2.5, N*2.5, N*2.5, N*2.5]},\n STOP_PATTERN : {value: [N*2, N*2, W*2]},\n CODE_PATTERN : {value: [\n [N, N, W, W, N],\n [W, N, N, N, W],\n [N, W, N, N, W],\n [W, W, N, N, N],\n [N, N, W, N, W],\n [W, N, W, N, N],\n [N, W, W, N, N],\n [N, N, N, W, W],\n [W, N, N, W, N],\n [N, W, N, W, N]\n ]},\n SINGLE_CODE_ERROR: {value: 0.78, writable: true},\n AVG_CODE_ERROR: {value: 0.38, writable: true},\n MAX_CORRECTION_FACTOR: {value: 5},\n FORMAT: {value: \"i2of5\"}\n};\n\nI2of5Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nI2of5Reader.prototype.constructor = I2of5Reader;\n\nI2of5Reader.prototype._matchPattern = function(counter, code) {\n if (this.config.normalizeBarSpaceWidth) {\n var i,\n counterSum = [0, 0],\n codeSum = [0, 0],\n correction = [0, 0],\n correctionRatio = this.MAX_CORRECTION_FACTOR,\n correctionRatioInverse = 1 / correctionRatio;\n\n for (i = 0; i < counter.length; i++) {\n counterSum[i % 2] += counter[i];\n codeSum[i % 2] += code[i];\n }\n correction[0] = codeSum[0] / counterSum[0];\n correction[1] = codeSum[1] / counterSum[1];\n\n correction[0] = Math.max(Math.min(correction[0], correctionRatio), correctionRatioInverse);\n correction[1] = Math.max(Math.min(correction[1], correctionRatio), correctionRatioInverse);\n this.barSpaceRatio = correction;\n for (i = 0; i < counter.length; i++) {\n counter[i] *= this.barSpaceRatio[i % 2];\n }\n }\n return BarcodeReader.prototype._matchPattern.call(this, counter, code);\n};\n\nI2of5Reader.prototype._findPattern = function(pattern, offset, isWhite, tryHarder) {\n var counter = [],\n self = this,\n i,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n error,\n j,\n sum,\n normalized,\n epsilon = self.AVG_CODE_ERROR;\n\n isWhite = isWhite || false;\n tryHarder = tryHarder || false;\n\n if (!offset) {\n offset = self._nextSet(self._row);\n }\n\n for ( i = 0; i < pattern.length; i++) {\n counter[i] = 0;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n error = self._matchPattern(normalized, pattern);\n\n if (error < epsilon) {\n bestMatch.error = error;\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n if (tryHarder) {\n for (j = 0; j < counter.length - 2; j++) {\n counter[j] = counter[j + 2];\n }\n counter[counter.length - 2] = 0;\n counter[counter.length - 1] = 0;\n counterPos--;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._findStart = function() {\n var self = this,\n leadingWhitespaceStart,\n offset = self._nextSet(self._row),\n startInfo,\n narrowBarWidth = 1;\n\n while(!startInfo) {\n startInfo = self._findPattern(self.START_PATTERN, offset, false, true);\n if (!startInfo) {\n return null;\n }\n narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / 4);\n leadingWhitespaceStart = startInfo.start - narrowBarWidth*10;\n if (leadingWhitespaceStart >= 0) {\n if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n return startInfo;\n }\n }\n offset = startInfo.end;\n startInfo = null;\n }\n};\n\nI2of5Reader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start) / 2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._findEnd = function() {\n var self = this,\n endInfo,\n tmp;\n\n self._row.reverse();\n endInfo = self._findPattern(self.STOP_PATTERN);\n self._row.reverse();\n\n if (endInfo === null) {\n return null;\n }\n\n // reverse numbers\n tmp = endInfo.start;\n endInfo.start = self._row.length - endInfo.end;\n endInfo.end = self._row.length - tmp;\n\n return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n};\n\nI2of5Reader.prototype._decodePair = function(counterPair) {\n var i,\n code,\n codes = [],\n self = this;\n\n for (i = 0; i < counterPair.length; i++) {\n code = self._decodeCode(counterPair[i]);\n if (!code) {\n return null;\n }\n codes.push(code);\n }\n return codes;\n};\n\nI2of5Reader.prototype._decodeCode = function(counter) {\n var j,\n self = this,\n sum = 0,\n normalized,\n error,\n epsilon = self.AVG_CODE_ERROR,\n code,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n };\n\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < self.CODE_PATTERN.length; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n if (bestMatch.error < epsilon) {\n return bestMatch;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._decodePayload = function(counters, result, decodedCodes) {\n var i,\n self = this,\n pos = 0,\n counterLength = counters.length,\n counterPair = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],\n codes;\n\n while (pos < counterLength) {\n for (i = 0; i < 5; i++) {\n counterPair[0][i] = counters[pos]*this.barSpaceRatio[0];\n counterPair[1][i] = counters[pos + 1]*this.barSpaceRatio[1];\n pos += 2;\n }\n codes = self._decodePair(counterPair);\n if (!codes) {\n return null;\n }\n for (i = 0; i < codes.length; i++) {\n result.push(codes[i].code + \"\");\n decodedCodes.push(codes[i]);\n }\n }\n return codes;\n};\n\nI2of5Reader.prototype._verifyCounterLength = function(counters) {\n return (counters.length % 10 === 0);\n};\n\nI2of5Reader.prototype._decode = function() {\n var startInfo,\n endInfo,\n self = this,\n code,\n result = [],\n decodedCodes = [],\n counters;\n\n startInfo = self._findStart();\n if (!startInfo) {\n return null;\n }\n decodedCodes.push(startInfo);\n\n endInfo = self._findEnd();\n if (!endInfo) {\n return null;\n }\n\n counters = self._fillCounters(startInfo.end, endInfo.start, false);\n if (!self._verifyCounterLength(counters)) {\n return null;\n }\n code = self._decodePayload(counters, result, decodedCodes);\n if (!code) {\n return null;\n }\n if (result.length % 2 !== 0 ||\n result.length < 6) {\n return null;\n }\n\n decodedCodes.push(endInfo);\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : endInfo.end,\n startInfo : startInfo,\n decodedCodes : decodedCodes\n };\n};\n\nI2of5Reader.CONFIG_KEYS = {\n normalizeBarSpaceWidth: {\n 'type': 'boolean',\n 'default': false,\n 'description': 'If true, the reader tries to normalize the' +\n 'width-difference between bars and spaces'\n }\n};\n\nexport default I2of5Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/i2of5_reader.js\n **/","var baseMerge = require('../internal/baseMerge'),\n createAssigner = require('../internal/createAssigner');\n\n/**\n * Recursively merges own enumerable properties of the source object(s), that\n * don't resolve to `undefined` into the destination object. Subsequent sources\n * overwrite property assignments of previous sources. If `customizer` is\n * provided it's invoked to produce the merged values of the destination and\n * source properties. If `customizer` returns `undefined` merging is handled\n * by the method instead. The `customizer` is bound to `thisArg` and invoked\n * with five arguments: (objectValue, sourceValue, key, object, source).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var users = {\n * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n * };\n *\n * var ages = {\n * 'data': [{ 'age': 36 }, { 'age': 40 }]\n * };\n *\n * _.merge(users, ages);\n * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n *\n * // using a customizer callback\n * var object = {\n * 'fruits': ['apple'],\n * 'vegetables': ['beet']\n * };\n *\n * var other = {\n * 'fruits': ['banana'],\n * 'vegetables': ['carrot']\n * };\n *\n * _.merge(object, other, function(a, b) {\n * if (_.isArray(a)) {\n * return a.concat(b);\n * }\n * });\n * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n */\nvar merge = createAssigner(baseMerge);\n\nmodule.exports = merge;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/merge.js\n ** module id = 37\n ** module chunks = 0\n **/","var arrayEach = require('./arrayEach'),\n baseMergeDeep = require('./baseMergeDeep'),\n isArray = require('../lang/isArray'),\n isArrayLike = require('./isArrayLike'),\n isObject = require('../lang/isObject'),\n isObjectLike = require('./isObjectLike'),\n isTypedArray = require('../lang/isTypedArray'),\n keys = require('../object/keys');\n\n/**\n * The base implementation of `_.merge` without support for argument juggling,\n * multiple sources, and `this` binding `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {Object} Returns `object`.\n */\nfunction baseMerge(object, source, customizer, stackA, stackB) {\n if (!isObject(object)) {\n return object;\n }\n var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n props = isSrcArr ? undefined : keys(source);\n\n arrayEach(props || source, function(srcValue, key) {\n if (props) {\n key = srcValue;\n srcValue = source[key];\n }\n if (isObjectLike(srcValue)) {\n stackA || (stackA = []);\n stackB || (stackB = []);\n baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n }\n else {\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n }\n if ((result !== undefined || (isSrcArr && !(key in object))) &&\n (isCommon || (result === result ? (result !== value) : (value === value)))) {\n object[key] = result;\n }\n }\n });\n return object;\n}\n\nmodule.exports = baseMerge;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseMerge.js\n ** module id = 38\n ** module chunks = 0\n **/","/**\n * A specialized version of `_.forEach` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/arrayEach.js\n ** module id = 39\n ** module chunks = 0\n **/","var arrayCopy = require('./arrayCopy'),\n isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isArrayLike = require('./isArrayLike'),\n isPlainObject = require('../lang/isPlainObject'),\n isTypedArray = require('../lang/isTypedArray'),\n toPlainObject = require('../lang/toPlainObject');\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n var length = stackA.length,\n srcValue = source[key];\n\n while (length--) {\n if (stackA[length] == srcValue) {\n object[key] = stackB[length];\n return;\n }\n }\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n result = isArray(value)\n ? value\n : (isArrayLike(value) ? arrayCopy(value) : []);\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n result = isArguments(value)\n ? toPlainObject(value)\n : (isPlainObject(value) ? value : {});\n }\n else {\n isCommon = false;\n }\n }\n // Add the source value to the stack of traversed objects and associate\n // it with its merged value.\n stackA.push(srcValue);\n stackB.push(result);\n\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n } else if (result === result ? (result !== value) : (value === value)) {\n object[key] = result;\n }\n}\n\nmodule.exports = baseMergeDeep;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseMergeDeep.js\n ** module id = 40\n ** module chunks = 0\n **/","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction arrayCopy(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = arrayCopy;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/arrayCopy.js\n ** module id = 41\n ** module chunks = 0\n **/","var isArrayLike = require('../internal/isArrayLike'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Native method references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is classified as an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n return isObjectLike(value) && isArrayLike(value) &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n}\n\nmodule.exports = isArguments;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isArguments.js\n ** module id = 42\n ** module chunks = 0\n **/","var getLength = require('./getLength'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\nfunction isArrayLike(value) {\n return value != null && isLength(getLength(value));\n}\n\nmodule.exports = isArrayLike;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isArrayLike.js\n ** module id = 43\n ** module chunks = 0\n **/","var baseProperty = require('./baseProperty');\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\nmodule.exports = getLength;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/getLength.js\n ** module id = 44\n ** module chunks = 0\n **/","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseProperty.js\n ** module id = 45\n ** module chunks = 0\n **/","/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isLength.js\n ** module id = 46\n ** module chunks = 0\n **/","/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isObjectLike.js\n ** module id = 47\n ** module chunks = 0\n **/","var getNative = require('../internal/getNative'),\n isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\nmodule.exports = isArray;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isArray.js\n ** module id = 48\n ** module chunks = 0\n **/","var isNative = require('../lang/isNative');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/getNative.js\n ** module id = 49\n ** module chunks = 0\n **/","var isFunction = require('./isFunction'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isNative;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isNative.js\n ** module id = 50\n ** module chunks = 0\n **/","var isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, 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 older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 which returns 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\nmodule.exports = isFunction;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isFunction.js\n ** module id = 51\n ** module chunks = 0\n **/","/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isObject.js\n ** module id = 52\n ** module chunks = 0\n **/","var baseForIn = require('../internal/baseForIn'),\n isArguments = require('./isArguments'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * **Note:** This method assumes objects created by the `Object` constructor\n * have no inherited enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n var Ctor;\n\n // Exit early for non `Object` objects.\n if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n return false;\n }\n // IE < 9 iterates inherited properties before own properties. If the first\n // iterated property is an object's own property then there are no inherited\n // enumerable properties.\n var result;\n // In most environments an object's own properties are iterated before\n // its inherited properties. If the last iterated property is an object's\n // own property then there are no inherited enumerable properties.\n baseForIn(value, function(subValue, key) {\n result = key;\n });\n return result === undefined || hasOwnProperty.call(value, result);\n}\n\nmodule.exports = isPlainObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isPlainObject.js\n ** module id = 53\n ** module chunks = 0\n **/","var baseFor = require('./baseFor'),\n keysIn = require('../object/keysIn');\n\n/**\n * The base implementation of `_.forIn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForIn(object, iteratee) {\n return baseFor(object, iteratee, keysIn);\n}\n\nmodule.exports = baseForIn;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseForIn.js\n ** module id = 54\n ** module chunks = 0\n **/","var createBaseFor = require('./createBaseFor');\n\n/**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseFor.js\n ** module id = 55\n ** module chunks = 0\n **/","var toObject = require('./toObject');\n\n/**\n * Creates a base function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var iterable = toObject(object),\n props = keysFunc(object),\n length = props.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n var key = props[index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/createBaseFor.js\n ** module id = 56\n ** module chunks = 0\n **/","var isObject = require('../lang/isObject');\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/toObject.js\n ** module id = 57\n ** module chunks = 0\n **/","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('../internal/isIndex'),\n isLength = require('../internal/isLength'),\n isObject = require('../lang/isObject');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n if (object == null) {\n return [];\n }\n if (!isObject(object)) {\n object = Object(object);\n }\n var length = object.length;\n length = (length && isLength(length) &&\n (isArray(object) || isArguments(object)) && length) || 0;\n\n var Ctor = object.constructor,\n index = -1,\n isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n result = Array(length),\n skipIndexes = length > 0;\n\n while (++index < length) {\n result[index] = (index + '');\n }\n for (var key in object) {\n if (!(skipIndexes && isIndex(key, length)) &&\n !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keysIn;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/keysIn.js\n ** module id = 58\n ** module chunks = 0\n **/","/** Used to detect unsigned integer values. */\nvar reIsUint = /^\\d+$/;\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\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 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\nmodule.exports = isIndex;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isIndex.js\n ** module id = 59\n ** module chunks = 0\n **/","var isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nfunction isTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n}\n\nmodule.exports = isTypedArray;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isTypedArray.js\n ** module id = 60\n ** module chunks = 0\n **/","var baseCopy = require('../internal/baseCopy'),\n keysIn = require('../object/keysIn');\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable\n * properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return baseCopy(value, keysIn(value));\n}\n\nmodule.exports = toPlainObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/toPlainObject.js\n ** module id = 61\n ** module chunks = 0\n **/","/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction baseCopy(source, props, object) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n object[key] = source[key];\n }\n return object;\n}\n\nmodule.exports = baseCopy;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseCopy.js\n ** module id = 62\n ** module chunks = 0\n **/","var getNative = require('../internal/getNative'),\n isArrayLike = require('../internal/isArrayLike'),\n isObject = require('../lang/isObject'),\n shimKeys = require('../internal/shimKeys');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = getNative(Object, 'keys');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nvar keys = !nativeKeys ? shimKeys : function(object) {\n var Ctor = object == null ? undefined : object.constructor;\n if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n (typeof object != 'function' && isArrayLike(object))) {\n return shimKeys(object);\n }\n return isObject(object) ? nativeKeys(object) : [];\n};\n\nmodule.exports = keys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/keys.js\n ** module id = 63\n ** module chunks = 0\n **/","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('./isIndex'),\n isLength = require('./isLength'),\n keysIn = require('../object/keysIn');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction shimKeys(object) {\n var props = keysIn(object),\n propsLength = props.length,\n length = propsLength && object.length;\n\n var allowIndexes = !!length && isLength(length) &&\n (isArray(object) || isArguments(object));\n\n var index = -1,\n result = [];\n\n while (++index < propsLength) {\n var key = props[index];\n if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = shimKeys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/shimKeys.js\n ** module id = 64\n ** module chunks = 0\n **/","var bindCallback = require('./bindCallback'),\n isIterateeCall = require('./isIterateeCall'),\n restParam = require('../function/restParam');\n\n/**\n * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return restParam(function(object, sources) {\n var index = -1,\n length = object == null ? 0 : sources.length,\n customizer = length > 2 ? sources[length - 2] : undefined,\n guard = length > 2 ? sources[2] : undefined,\n thisArg = length > 1 ? sources[length - 1] : undefined;\n\n if (typeof customizer == 'function') {\n customizer = bindCallback(customizer, thisArg, 5);\n length -= 2;\n } else {\n customizer = typeof thisArg == 'function' ? thisArg : undefined;\n length -= (customizer ? 1 : 0);\n }\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/createAssigner.js\n ** module id = 65\n ** module chunks = 0\n **/","var identity = require('../utility/identity');\n\n/**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction bindCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n if (thisArg === undefined) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n case 5: return function(value, other, key, object, source) {\n return func.call(thisArg, value, other, key, object, source);\n };\n }\n return function() {\n return func.apply(thisArg, arguments);\n };\n}\n\nmodule.exports = bindCallback;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/bindCallback.js\n ** module id = 66\n ** module chunks = 0\n **/","/**\n * This method returns the first argument provided to it.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'user': 'fred' };\n *\n * _.identity(object) === object;\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/utility/identity.js\n ** module id = 67\n ** module chunks = 0\n **/","var isArrayLike = require('./isArrayLike'),\n isIndex = require('./isIndex'),\n isObject = require('../lang/isObject');\n\n/**\n * Checks if the provided 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, 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 var other = object[index];\n return value === value ? (value === other) : (other !== other);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isIterateeCall.js\n ** module id = 68\n ** module chunks = 0\n **/","/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction restParam(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n rest = Array(length);\n\n while (++index < length) {\n rest[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, args[0], rest);\n case 2: return func.call(this, args[0], args[1], rest);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = rest;\n return func.apply(this, otherArgs);\n };\n}\n\nmodule.exports = restParam;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/function/restParam.js\n ** module id = 69\n ** module chunks = 0\n **/","import CVUtils from './cv_utils';\n\nvar FrameGrabber = {};\n\nFrameGrabber.create = function(inputStream, canvas) {\n var _that = {},\n _streamConfig = inputStream.getConfig(),\n _video_size = CVUtils.imageRef(inputStream.getRealWidth(), inputStream.getRealHeight()),\n _canvasSize = inputStream.getCanvasSize(),\n _size = CVUtils.imageRef(inputStream.getWidth(), inputStream.getHeight()),\n topRight = inputStream.getTopRight(),\n _sx = topRight.x,\n _sy = topRight.y,\n _canvas,\n _ctx = null,\n _data = null;\n\n _canvas = canvas ? canvas : document.createElement(\"canvas\");\n _canvas.width = _canvasSize.x;\n _canvas.height = _canvasSize.y;\n _ctx = _canvas.getContext(\"2d\");\n _data = new Uint8Array(_size.x * _size.y);\n console.log(\"FrameGrabber\", JSON.stringify({\n size: _size,\n topRight: topRight,\n videoSize: _video_size,\n canvasSize: _canvasSize\n }));\n\n /**\n * Uses the given array as frame-buffer\n */\n _that.attachData = function(data) {\n _data = data;\n };\n\n /**\n * Returns the used frame-buffer\n */\n _that.getData = function() {\n return _data;\n };\n\n /**\n * Fetches a frame from the input-stream and puts into the frame-buffer.\n * The image-data is converted to gray-scale and then half-sampled if configured.\n */\n _that.grab = function() {\n var doHalfSample = _streamConfig.halfSample,\n frame = inputStream.getFrame(),\n ctxData;\n if (frame) {\n _ctx.drawImage(frame, 0, 0, _canvasSize.x, _canvasSize.y);\n ctxData = _ctx.getImageData(_sx, _sy, _size.x, _size.y).data;\n if(doHalfSample){\n CVUtils.grayAndHalfSampleFromCanvasData(ctxData, _size, _data);\n } else {\n CVUtils.computeGray(ctxData, _data, _streamConfig);\n }\n return true;\n } else {\n return false;\n }\n };\n\n _that.getSize = function() {\n return _size;\n };\n\n return _that;\n};\n\nexport default FrameGrabber;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/frame_grabber.js\n **/","export default {\n inputStream: {\n name: \"Live\",\n type: \"LiveStream\",\n constraints: {\n width: 640,\n height: 480,\n minAspectRatio: 0,\n maxAspectRatio: 100,\n facing: \"environment\" // or user\n },\n area: {\n top: \"0%\",\n right: \"0%\",\n left: \"0%\",\n bottom: \"0%\"\n },\n singleChannel: false // true: only the red color-channel is read\n },\n tracking: false,\n debug: false,\n controls: false,\n locate: true,\n numOfWorkers: 4,\n visual: {\n show: true\n },\n decoder: {\n drawBoundingBox: false,\n showFrequency: false,\n drawScanline: false,\n showPattern: false,\n readers: [\n 'code_128_reader'\n ]\n },\n locator: {\n halfSample: true,\n patchSize: \"medium\", // x-small, small, medium, large, x-large\n showCanvas: false,\n showPatches: false,\n showFoundPatches: false,\n showSkeleton: false,\n showLabels: false,\n showPatchLabels: false,\n showRemainingPatchLabels: false,\n boxFromPatches: {\n showTransformed: false,\n showTransformedBox: false,\n showBB: false\n }\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/config.js\n **/","export default function() {\n var events = {};\n\n function getEvent(eventName) {\n if (!events[eventName]) {\n events[eventName] = {\n subscribers : []\n };\n }\n return events[eventName];\n }\n\n function clearEvents(){\n events = {};\n }\n\n function publishSubscription(subscription, data) {\n if (subscription.async) {\n setTimeout(function() {\n subscription.callback(data);\n }, 4);\n } else {\n subscription.callback(data);\n }\n }\n\n function subscribe(event, callback, async) {\n var subscription;\n\n if ( typeof callback === \"function\") {\n subscription = {\n callback : callback,\n async : async\n };\n } else {\n subscription = callback;\n if (!subscription.callback) {\n throw \"Callback was not specified on options\";\n }\n }\n\n getEvent(event).subscribers.push(subscription);\n }\n\n return {\n subscribe : function(event, callback, async) {\n return subscribe(event, callback, async);\n },\n publish : function(eventName, data) {\n var event = getEvent(eventName),\n subscribers = event.subscribers;\n\n event.subscribers = subscribers.filter(function(subscriber) {\n publishSubscription(subscriber, data);\n return !subscriber.once;\n });\n },\n once: function(event, callback, async) {\n subscribe(event, {\n callback: callback,\n async: async,\n once: true\n });\n },\n unsubscribe: function(eventName, callback) {\n var event;\n\n if (eventName) {\n event = getEvent(eventName);\n if (event && callback) {\n event.subscribers = event.subscribers.filter(function(subscriber){\n return subscriber.callback !== callback;\n });\n } else {\n event.subscribers = [];\n }\n } else {\n clearEvents();\n }\n }\n };\n}();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/events.js\n **/","const merge = require('lodash/object/merge');\n\nvar streamRef,\n loadedDataHandler;\n\n/**\n * Wraps browser-specific getUserMedia\n * @param {Object} constraints\n * @param {Object} success Callback\n * @param {Object} failure Callback\n */\nfunction getUserMedia(constraints, success, failure) {\n if (typeof navigator.getUserMedia !== 'undefined') {\n navigator.getUserMedia(constraints, function (stream) {\n streamRef = stream;\n var videoSrc = (window.URL && window.URL.createObjectURL(stream)) || stream;\n success.apply(null, [videoSrc]);\n }, failure);\n } else {\n failure(new TypeError(\"getUserMedia not available\"));\n }\n}\n\nfunction loadedData(video, callback) {\n var attempts = 10;\n\n function checkVideo() {\n if (attempts > 0) {\n if (video.videoWidth > 0 && video.videoHeight > 0) {\n console.log(video.videoWidth + \"px x \" + video.videoHeight + \"px\");\n callback();\n } else {\n window.setTimeout(checkVideo, 500);\n }\n } else {\n callback('Unable to play video stream. Is webcam working?');\n }\n attempts--;\n }\n checkVideo();\n}\n\n/**\n * Tries to attach the camera-stream to a given video-element\n * and calls the callback function when the content is ready\n * @param {Object} constraints\n * @param {Object} video\n * @param {Object} callback\n */\nfunction initCamera(constraints, video, callback) {\n getUserMedia(constraints, function(src) {\n video.src = src;\n if (loadedDataHandler) {\n video.removeEventListener(\"loadeddata\", loadedDataHandler, false);\n }\n loadedDataHandler = loadedData.bind(null, video, callback);\n video.addEventListener('loadeddata', loadedDataHandler, false);\n video.play();\n }, function(e) {\n callback(e);\n });\n}\n\n/**\n * Normalizes the incoming constraints to satisfy the current browser\n * @param config\n * @param cb Callback which is called whenever constraints are created\n * @returns {*}\n */\nfunction normalizeConstraints(config, cb) {\n var constraints = {\n audio: false,\n video: true\n },\n videoConstraints = merge({\n width: 640,\n height: 480,\n minAspectRatio: 0,\n maxAspectRatio: 100,\n facing: \"environment\"\n }, config);\n\n if ( typeof MediaStreamTrack !== 'undefined' && typeof MediaStreamTrack.getSources !== 'undefined') {\n MediaStreamTrack.getSources(function(sourceInfos) {\n var videoSourceId;\n for (var i = 0; i != sourceInfos.length; ++i) {\n var sourceInfo = sourceInfos[i];\n if (sourceInfo.kind == \"video\" && sourceInfo.facing == videoConstraints.facing) {\n videoSourceId = sourceInfo.id;\n }\n }\n constraints.video = {\n mandatory: {\n minWidth: videoConstraints.width,\n minHeight: videoConstraints.height,\n minAspectRatio: videoConstraints.minAspectRatio,\n maxAspectRatio: videoConstraints.maxAspectRatio\n },\n optional: [{\n sourceId: videoSourceId\n }]\n };\n return cb(constraints);\n });\n } else {\n constraints.video = {\n mediaSource: \"camera\",\n width: { min: videoConstraints.width, max: videoConstraints.width },\n height: { min: videoConstraints.height, max: videoConstraints.height },\n require: [\"width\", \"height\"]\n };\n return cb(constraints);\n }\n}\n\n/**\n * Requests the back-facing camera of the user. The callback is called\n * whenever the stream is ready to be consumed, or if an error occures.\n * @param {Object} video\n * @param {Object} callback\n */\nfunction request(video, videoConstraints, callback) {\n normalizeConstraints(videoConstraints, function(constraints) {\n initCamera(constraints, video, callback);\n });\n}\n\nexport default {\n request : function(video, constraints, callback) {\n request(video, constraints, callback);\n },\n release : function() {\n var tracks = streamRef && streamRef.getVideoTracks();\n if (tracks.length) {\n tracks[0].stop();\n }\n streamRef = null;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/camera_access.js\n **/","import ImageDebug from './image_debug';\n\nfunction contains(codeResult, list) {\n if (list) {\n return list.some(function (item) {\n return Object.keys(item).every(function (key) {\n return item[key] === codeResult[key];\n });\n });\n }\n return false;\n}\n\nfunction passesFilter(codeResult, filter) {\n if (typeof filter === 'function') {\n return filter(codeResult);\n }\n return true;\n}\n\nexport default {\n create: function(config) {\n var canvas = document.createElement(\"canvas\"),\n ctx = canvas.getContext(\"2d\"),\n results = [],\n capacity = config.capacity || 20,\n capture = config.capture === true;\n\n function matchesConstraints(codeResult) {\n return capacity && codeResult && !contains(codeResult, config.blacklist) && passesFilter(codeResult, config.filter);\n }\n\n return {\n addResult: function(data, imageSize, codeResult) {\n var result = {};\n\n if (matchesConstraints(codeResult)) {\n capacity--;\n result.codeResult = codeResult;\n if (capture) {\n canvas.width = imageSize.x;\n canvas.height = imageSize.y;\n ImageDebug.drawImage(data, imageSize, ctx);\n result.frame = canvas.toDataURL();\n }\n results.push(result);\n }\n },\n getResults: function() {\n return results;\n }\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/result_collector.js\n **/"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/myModuleDefinition","webpack:///webpack/bootstrap 888ab824495283ce9c50","webpack:///./src/quagga.js","webpack:///./src/typedefs.js","webpack:///./src/input_stream.js","webpack:///./src/image_loader.js","webpack:///./src/image_wrapper.js","webpack:///./src/subImage.js","webpack:///./src/cv_utils.js","webpack:///./src/cluster.js","webpack:///./~/gl-matrix/src/gl-matrix.js","webpack:///./~/gl-matrix/src/gl-matrix/common.js","webpack:///./~/gl-matrix/src/gl-matrix/mat2.js","webpack:///./~/gl-matrix/src/gl-matrix/mat2d.js","webpack:///./~/gl-matrix/src/gl-matrix/mat3.js","webpack:///./~/gl-matrix/src/gl-matrix/mat4.js","webpack:///./~/gl-matrix/src/gl-matrix/quat.js","webpack:///./~/gl-matrix/src/gl-matrix/vec3.js","webpack:///./~/gl-matrix/src/gl-matrix/vec4.js","webpack:///./~/gl-matrix/src/gl-matrix/vec2.js","webpack:///./src/array_helper.js","webpack:///./src/barcode_locator.js","webpack:///./src/rasterizer.js","webpack:///./src/tracer.js","webpack:///./src/skeletonizer.js","webpack:///./src/image_debug.js","webpack:///./src/barcode_decoder.js","webpack:///./src/bresenham.js","webpack:///./src/code_128_reader.js","webpack:///./src/barcode_reader.js","webpack:///./src/ean_reader.js","webpack:///./src/code_39_reader.js","webpack:///./src/code_39_vin_reader.js","webpack:///./src/codabar_reader.js","webpack:///./src/upc_reader.js","webpack:///./src/ean_8_reader.js","webpack:///./src/upc_e_reader.js","webpack:///./src/i2of5_reader.js","webpack:///./~/lodash/object/merge.js","webpack:///./~/lodash/internal/baseMerge.js","webpack:///./~/lodash/internal/arrayEach.js","webpack:///./~/lodash/internal/baseMergeDeep.js","webpack:///./~/lodash/internal/arrayCopy.js","webpack:///./~/lodash/lang/isArguments.js","webpack:///./~/lodash/internal/isArrayLike.js","webpack:///./~/lodash/internal/getLength.js","webpack:///./~/lodash/internal/baseProperty.js","webpack:///./~/lodash/internal/isLength.js","webpack:///./~/lodash/internal/isObjectLike.js","webpack:///./~/lodash/lang/isArray.js","webpack:///./~/lodash/internal/getNative.js","webpack:///./~/lodash/lang/isNative.js","webpack:///./~/lodash/lang/isFunction.js","webpack:///./~/lodash/lang/isObject.js","webpack:///./~/lodash/lang/isPlainObject.js","webpack:///./~/lodash/internal/baseForIn.js","webpack:///./~/lodash/internal/baseFor.js","webpack:///./~/lodash/internal/createBaseFor.js","webpack:///./~/lodash/internal/toObject.js","webpack:///./~/lodash/object/keysIn.js","webpack:///./~/lodash/internal/isIndex.js","webpack:///./~/lodash/lang/isTypedArray.js","webpack:///./~/lodash/lang/toPlainObject.js","webpack:///./~/lodash/internal/baseCopy.js","webpack:///./~/lodash/object/keys.js","webpack:///./~/lodash/internal/shimKeys.js","webpack:///./~/lodash/internal/createAssigner.js","webpack:///./~/lodash/internal/bindCallback.js","webpack:///./~/lodash/utility/identity.js","webpack:///./~/lodash/internal/isIterateeCall.js","webpack:///./~/lodash/function/restParam.js","webpack:///./src/frame_grabber.js","webpack:///./src/config.js","webpack:///./src/events.js","webpack:///./src/camera_access.js","webpack:///./src/result_collector.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACRA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;qCCtCqB,CAAY;;;;yCACT,CAAgB;;;;0CACd,CAAiB;;;;4CACf,EAAmB;;;;4CACnB,EAAmB;;;;0CACrB,EAAiB;;;;oCACvB,EAAU;;;;mCACV,EAAU;;;;0CACJ,EAAiB;;;;wCACnB,EAAe;;;;qCACnB,CAAW;;6CACF,EAAoB;;;;AAEjD,KAAM,KAA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AK,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACjE,qBAAI,UAAU,GAAG,SAAS,EAAE;AACxB,4BAAO,IAAI,CAAC;kBACf;AACD,wBAAO,KAAK,CAAC;cAChB;AACD,sBAAS,EAAE,qBAAW;AAClB,wBAAO,MAAM,CAAC;cACjB;AACD,sBAAS,EAAE,qBAAW;AAClB,wBAAO,MAAM,CAAC;cACjB;UACJ,CAAC;MACL;AACD,gBAAW,EAAE,qBAAS,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE;AACvC,gBAAO;AACH,gBAAG,EAAE,KAAK,CAAC,QAAQ,CAAC;AACpB,kBAAK,EAAE,KAAK;AACZ,eAAE,EAAE,EAAE;UACT,CAAC;MACL;EACJ;;;;;;;AChED;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wC;;;;;;ACpCA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAU,OAAO;AACjB;AACA;AACA;AACA;;AAEA;;;;;;;ACnDA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB;;AAEA,mC;AACA,sB;AACA,iB;AACA,iB;AACA,+B;AACA,sB;AACA,G;;;AAGA;;;;;;;AC7SA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,YAAW,KAAK;AAChB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,YAAW,KAAK;AAChB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,KAAK;AAChB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,KAAK;AAChB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,cAAa,OAAO;AACpB;AACA,4B;AACA;AACA,G;;AAEA;;;;;;;AC5TA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,gB;AACA,qB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,MAAM;AACjB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAU,KAAK;AACf,WAAU,KAAK;AACf;AACA,aAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAU,KAAK;AACf,WAAU,KAAK;AACf;AACA,aAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gB;AACA,qB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;;AAGA;;;;;;;ACpjBA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gB;AACA,qB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qD;AACA;AACA;AACA;AACA;;AAEA,eAAc,WAAW,WAAW;AACpC;AACA;AACA;AACA;;AAEA,eAAc,WAAW,YAAY;AACrC;AACA;AACA;AACA;;AAEA,gBAAe,YAAY,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,oBAAmB,YAAY,YAAY;AAC3C,oBAAmB,YAAY,YAAY;AAC3C,oBAAmB,YAAY,aAAa;;AAE5C,sBAAqB,cAAc,cAAc;AACjD,sBAAqB,cAAc,cAAc;AACjD,sBAAqB,cAAc,eAAe;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA2C,aAAa;;AAExD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAe,YAAY,YAAY;AACvC,gBAAe,YAAY,YAAY;AACvC,gBAAe,YAAY,aAAa;;AAExC;AACA,yBAAwB,yBAAyB;AACjD,6BAA4B,qBAAqB;AACjD,6BAA4B,yBAAyB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA,4CAA2C,aAAa;;AAExD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,MAAM;AACjB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,MAAM;AACjB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,MAAM;AACjB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;;AAGA;;;;;;;AClwCA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA,gB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA,gB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA,gB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK,O;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yCAAwC;AACxC;AACA,2BAA0B;AAC1B;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;ACxiBA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;;AAEA,wBAAuB,OAAO;AAC9B,2BAA0B,iBAAiB;AAC3C;AACA,2BAA0B,iBAAiB;AAC3C;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,MAAK;AACL;AACA,M;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;ACpsBA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;;AAEA,wBAAuB,OAAO;AAC9B,2BAA0B,iBAAiB,iBAAiB;AAC5D;AACA,2BAA0B,iBAAiB,iBAAiB;AAC5D;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;ACxhBA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,OAAO;AAClB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,MAAM;AACjB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,YAAW,KAAK;AAChB,cAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;;AAEA,wBAAuB,OAAO;AAC9B,2BAA0B;AAC1B;AACA,2BAA0B;AAC1B;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA,YAAW,KAAK;AAChB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;;;;;;sBC1gBe;AACX,SAAI,EAAE,cAAS,GAAG,EAAE,GAAG,EAAE;AACrB,aAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;AACnB,gBAAO,CAAC,EAAE,EAAE;AACR,gBAAG,CAAC,CAAC,CAAC,GAAG,GAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAI;AACJ,WAAU;AACV;AACA;;AAEA;;;;;;;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;;;;;;ACvDA;AACA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,SAAS;AACpB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;;;;;;;AClEA;AACA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,MAAM;AACjB,cAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACnBA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,8BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACjCA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;ACdA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,EAAE;AACf;AACA;;AAEA;;;;;;;ACdA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACbA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;ACnBA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;ACXA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,0BAAyB,kBAAkB,EAAE;AAC7C;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACvCA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACfA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,4DAA2D;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC/CA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC3BA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;;;;;;ACtEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;AChBA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,cAAa,OAAO;AACpB;AACA;;AAEA;;;;;;;AChBA;;AAEA;AACA;AACA;AACA;AACA,YAAW,QAAQ;AACnB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC1BA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;ACbA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC/DA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACvBA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACzEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,SAAS;AACtB,WAAU;AACV;AACA,cAAa,SAAS;AACtB,WAAU;AACV;AACA;AACA;AACA;;AAEA;;;;;;;AC9BA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,MAAM;AACjB,YAAW,OAAO,WAAW;AAC7B,cAAa,OAAO;AACpB;AACA;AACA,yBAAwB;;AAExB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACtBA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC5CA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxCA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;;;;;;;ACxCA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,EAAE;AACb,YAAW,OAAO;AAClB,cAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,EAAE;AACf;AACA;AACA,kBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC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ACX,2BAAM,CAAC,UAAU,GAAG,UAAU,CAAC;AAC/B,yBAAI,OAAO,EAAE;AACT,+BAAM,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;AAC3B,+BAAM,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAC5B,kDAAW,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;AAC3C,+BAAM,CAAC,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;sBACrC;AACD,4BAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;kBACxB;cACJ;AACD,uBAAU,EAAE,sBAAW;AACnB,wBAAO,OAAO,CAAC;cAClB;UACJ,CAAC;MACL;EACJ","file":"quagga.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(factory.toString());\n\telse if(typeof exports === 'object')\n\t\texports[\"Quagga\"] = factory(factory.toString());\n\telse\n\t\troot[\"Quagga\"] = factory(factory.toString());\n})(this, function(__factorySource__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/myModuleDefinition\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 888ab824495283ce9c50\n **/","import TypeDefs from './typedefs';\nimport InputStream from './input_stream';\nimport ImageWrapper from './image_wrapper';\nimport BarcodeLocator from './barcode_locator';\nimport BarcodeDecoder from './barcode_decoder';\nimport FrameGrabber from './frame_grabber';\nimport Config from './config';\nimport Events from './events';\nimport CameraAccess from './camera_access';\nimport ImageDebug from './image_debug';\nimport {vec2} from 'gl-matrix';\nimport ResultCollector from './result_collector';\n\nconst merge = require('lodash/object/merge');\n\nvar _inputStream,\n _framegrabber,\n _stopped,\n _canvasContainer = {\n ctx : {\n image : null,\n overlay : null\n },\n dom : {\n image : null,\n overlay : null\n }\n },\n _inputImageWrapper,\n _boxSize,\n _decoder,\n _workerPool = [],\n _onUIThread = true,\n _resultCollector,\n _config = {};\n\nfunction initializeData(imageWrapper) {\n initBuffers(imageWrapper);\n _decoder = BarcodeDecoder.create(_config.decoder, _inputImageWrapper);\n}\n\nfunction initConfig() {\n if (typeof document !== \"undefined\") {\n var vis = [{\n node: document.querySelector(\"div[data-controls]\"),\n prop: _config.controls\n }, {\n node: _canvasContainer.dom.overlay,\n prop: _config.visual.show\n }];\n\n for (var i = 0; i < vis.length; i++) {\n if (vis[i].node) {\n if (vis[i].prop === true) {\n vis[i].node.style.display = \"block\";\n } else {\n vis[i].node.style.display = \"none\";\n }\n }\n }\n }\n}\n\nfunction initInputStream(cb) {\n var video;\n if (_config.inputStream.type == \"VideoStream\") {\n video = document.createElement(\"video\");\n _inputStream = InputStream.createVideoStream(video);\n } else if (_config.inputStream.type == \"ImageStream\") {\n _inputStream = InputStream.createImageStream();\n } else if (_config.inputStream.type == \"LiveStream\") {\n var $viewport = document.querySelector(\"#interactive.viewport\");\n if ($viewport) {\n video = $viewport.querySelector(\"video\");\n if (!video) {\n video = document.createElement(\"video\");\n $viewport.appendChild(video);\n }\n }\n _inputStream = InputStream.createLiveStream(video);\n CameraAccess.request(video, _config.inputStream.constraints, function(err) {\n if (!err) {\n _inputStream.trigger(\"canrecord\");\n } else {\n return cb(err);\n }\n });\n }\n\n _inputStream.setAttribute(\"preload\", \"auto\");\n _inputStream.setAttribute(\"autoplay\", true);\n _inputStream.setInputStream(_config.inputStream);\n _inputStream.addEventListener(\"canrecord\", canRecord.bind(undefined, cb));\n}\n\nfunction canRecord(cb) {\n BarcodeLocator.checkImageConstraints(_inputStream, _config.locator);\n initCanvas();\n _framegrabber = FrameGrabber.create(_inputStream, _canvasContainer.dom.image);\n initConfig();\n\n if (_config.numOfWorkers > 0) {\n initWorkers(function() {\n console.log(\"Workers created\");\n ready(cb);\n });\n } else {\n initializeData();\n ready(cb);\n }\n}\n\nfunction ready(cb){\n _inputStream.play();\n cb();\n}\n\nfunction initCanvas() {\n if (typeof document !== \"undefined\") {\n var $viewport = document.querySelector(\"#interactive.viewport\");\n _canvasContainer.dom.image = document.querySelector(\"canvas.imgBuffer\");\n if (!_canvasContainer.dom.image) {\n _canvasContainer.dom.image = document.createElement(\"canvas\");\n _canvasContainer.dom.image.className = \"imgBuffer\";\n if ($viewport && _config.inputStream.type == \"ImageStream\") {\n $viewport.appendChild(_canvasContainer.dom.image);\n }\n }\n _canvasContainer.ctx.image = _canvasContainer.dom.image.getContext(\"2d\");\n _canvasContainer.dom.image.width = _inputStream.getCanvasSize().x;\n _canvasContainer.dom.image.height = _inputStream.getCanvasSize().y;\n\n _canvasContainer.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n if (!_canvasContainer.dom.overlay) {\n _canvasContainer.dom.overlay = document.createElement(\"canvas\");\n _canvasContainer.dom.overlay.className = \"drawingBuffer\";\n if ($viewport) {\n $viewport.appendChild(_canvasContainer.dom.overlay);\n }\n var clearFix = document.createElement(\"br\");\n clearFix.setAttribute(\"clear\", \"all\");\n if ($viewport) {\n $viewport.appendChild(clearFix);\n }\n }\n _canvasContainer.ctx.overlay = _canvasContainer.dom.overlay.getContext(\"2d\");\n _canvasContainer.dom.overlay.width = _inputStream.getCanvasSize().x;\n _canvasContainer.dom.overlay.height = _inputStream.getCanvasSize().y;\n }\n}\n\nfunction initBuffers(imageWrapper) {\n if (imageWrapper) {\n _inputImageWrapper = imageWrapper;\n } else {\n _inputImageWrapper = new ImageWrapper({\n x : _inputStream.getWidth(),\n y : _inputStream.getHeight()\n });\n }\n\n console.log(_inputImageWrapper.size);\n _boxSize = [\n vec2.clone([0, 0]),\n vec2.clone([0, _inputImageWrapper.size.y]),\n vec2.clone([_inputImageWrapper.size.x, _inputImageWrapper.size.y]),\n vec2.clone([_inputImageWrapper.size.x, 0])\n ];\n BarcodeLocator.init(_inputImageWrapper, _config.locator);\n}\n\nfunction getBoundingBoxes() {\n if (_config.locate) {\n return BarcodeLocator.locate();\n } else {\n return [[\n vec2.clone(_boxSize[0]),\n vec2.clone(_boxSize[1]),\n vec2.clone(_boxSize[2]),\n vec2.clone(_boxSize[3])]];\n }\n}\n\nfunction transformResult(result) {\n var topRight = _inputStream.getTopRight(),\n xOffset = topRight.x,\n yOffset = topRight.y,\n i;\n\n if (!result || (xOffset === 0 && yOffset === 0)) {\n return;\n }\n\n\n if (result.line && result.line.length === 2) {\n moveLine(result.line);\n }\n if (result.boxes && result.boxes.length > 0) {\n for (i = 0; i < result.boxes.length; i++) {\n moveBox(result.boxes[i]);\n }\n }\n\n function moveBox(box) {\n var corner = box.length;\n\n while(corner--) {\n box[corner][0] += xOffset;\n box[corner][1] += yOffset;\n }\n }\n\n function moveLine(line) {\n line[0].x += xOffset;\n line[0].y += yOffset;\n line[1].x += xOffset;\n line[1].y += yOffset;\n }\n}\n\nfunction publishResult(result, imageData) {\n if (_onUIThread) {\n transformResult(result);\n if (imageData && result && result.codeResult) {\n if (_resultCollector) {\n _resultCollector.addResult(imageData, _inputStream.getCanvasSize(), result.codeResult);\n }\n }\n }\n\n Events.publish(\"processed\", result);\n if (result && result.codeResult) {\n Events.publish(\"detected\", result);\n }\n}\n\nfunction locateAndDecode() {\n var result,\n boxes;\n\n boxes = getBoundingBoxes();\n if (boxes) {\n result = _decoder.decodeFromBoundingBoxes(boxes);\n result = result || {};\n result.boxes = boxes;\n publishResult(result, _inputImageWrapper.data);\n } else {\n publishResult();\n }\n}\n\nfunction update() {\n var availableWorker;\n\n if (_onUIThread) {\n if (_workerPool.length > 0) {\n availableWorker = _workerPool.filter(function(workerThread) {\n return !workerThread.busy;\n })[0];\n if (availableWorker) {\n _framegrabber.attachData(availableWorker.imageData);\n } else {\n return; // all workers are busy\n }\n } else {\n _framegrabber.attachData(_inputImageWrapper.data);\n }\n if (_framegrabber.grab()) {\n if (availableWorker) {\n availableWorker.busy = true;\n availableWorker.worker.postMessage({\n cmd: 'process',\n imageData: availableWorker.imageData\n }, [availableWorker.imageData.buffer]);\n } else {\n locateAndDecode();\n }\n }\n } else {\n locateAndDecode();\n }\n}\n\nfunction start() {\n _stopped = false;\n ( function frame() {\n if (!_stopped) {\n update();\n if (_onUIThread && _config.inputStream.type == \"LiveStream\") {\n window.requestAnimFrame(frame);\n }\n }\n }());\n}\n\nfunction initWorkers(cb) {\n var i;\n _workerPool = [];\n\n for (i = 0; i < _config.numOfWorkers; i++) {\n initWorker(workerInitialized);\n }\n\n function workerInitialized(workerThread) {\n _workerPool.push(workerThread);\n if (_workerPool.length >= _config.numOfWorkers){\n cb();\n }\n }\n}\n\nfunction initWorker(cb) {\n var blobURL,\n workerThread = {\n worker: undefined,\n imageData: new Uint8Array(_inputStream.getWidth() * _inputStream.getHeight()),\n busy: true\n };\n\n blobURL = generateWorkerBlob();\n workerThread.worker = new Worker(blobURL);\n\n workerThread.worker.onmessage = function(e) {\n if (e.data.event === 'initialized') {\n URL.revokeObjectURL(blobURL);\n workerThread.busy = false;\n workerThread.imageData = new Uint8Array(e.data.imageData);\n console.log(\"Worker initialized\");\n return cb(workerThread);\n } else if (e.data.event === 'processed') {\n workerThread.imageData = new Uint8Array(e.data.imageData);\n workerThread.busy = false;\n publishResult(e.data.result, workerThread.imageData);\n } else if (e.data.event === 'error') {\n console.log(\"Worker error: \" + e.data.message);\n }\n };\n\n workerThread.worker.postMessage({\n cmd: 'init',\n size: {x: _inputStream.getWidth(), y: _inputStream.getHeight()},\n imageData: workerThread.imageData,\n config: _config\n }, [workerThread.imageData.buffer]);\n}\n\n\nfunction workerInterface(factory) {\n window = self;\n if (factory) {\n /* jshint ignore:start */\n var Quagga = factory();\n if (!Quagga) {\n self.postMessage({'event': 'error', message: 'Quagga could not be created'});\n return;\n }\n /* jshint ignore:end */\n }\n /* jshint ignore:start */\n var imageWrapper;\n\n self.onmessage = function(e) {\n if (e.data.cmd === 'init') {\n var config = e.data.config;\n config.numOfWorkers = 0;\n imageWrapper = new Quagga.ImageWrapper({\n x : e.data.size.x,\n y : e.data.size.y\n }, new Uint8Array(e.data.imageData));\n Quagga.init(config, ready, imageWrapper);\n Quagga.onProcessed(onProcessed);\n } else if (e.data.cmd === 'process') {\n imageWrapper.data = new Uint8Array(e.data.imageData);\n Quagga.start();\n } else if (e.data.cmd === 'setReaders') {\n Quagga.setReaders(e.data.readers);\n }\n };\n\n function onProcessed(result) {\n self.postMessage({'event': 'processed', imageData: imageWrapper.data, result: result}, [imageWrapper.data.buffer]);\n }\n\n function ready() {\n self.postMessage({'event': 'initialized', imageData: imageWrapper.data}, [imageWrapper.data.buffer]);\n }\n /* jshint ignore:end */\n}\n\nfunction generateWorkerBlob() {\n var blob,\n factorySource;\n\n /* jshint ignore:start */\n if (typeof __factorySource__ !== 'undefined') {\n factorySource = __factorySource__;\n }\n /* jshint ignore:end */\n\n blob = new Blob(['(' + workerInterface.toString() + ')(' + factorySource + ');'],\n {type : 'text/javascript'});\n\n return window.URL.createObjectURL(blob);\n}\n\nfunction setReaders(readers) {\n if (_decoder) {\n _decoder.setReaders(readers);\n } else if (_onUIThread && _workerPool.length > 0) {\n _workerPool.forEach(function(workerThread) {\n workerThread.worker.postMessage({cmd: 'setReaders', readers: readers});\n });\n }\n}\n\nexport default {\n init : function(config, cb, imageWrapper) {\n _config = merge({}, Config, config);\n if (imageWrapper) {\n _onUIThread = false;\n initializeData(imageWrapper);\n return cb();\n } else {\n initInputStream(cb);\n }\n },\n start : function() {\n start();\n },\n stop : function() {\n _stopped = true;\n _workerPool.forEach(function(workerThread) {\n workerThread.worker.terminate();\n console.log(\"Worker terminated!\");\n });\n _workerPool.length = 0;\n if (_config.inputStream.type === \"LiveStream\") {\n CameraAccess.release();\n _inputStream.clearEventHandlers();\n }\n },\n pause: function() {\n _stopped = true;\n },\n onDetected : function(callback) {\n Events.subscribe(\"detected\", callback);\n },\n offDetected: function(callback) {\n Events.unsubscribe(\"detected\", callback);\n },\n onProcessed: function(callback) {\n Events.subscribe(\"processed\", callback);\n },\n offProcessed: function(callback) {\n Events.unsubscribe(\"processed\", callback);\n },\n setReaders: function(readers) {\n setReaders(readers);\n },\n registerResultCollector: function(resultCollector) {\n if (resultCollector && typeof resultCollector.addResult === 'function') {\n _resultCollector = resultCollector;\n }\n },\n canvas : _canvasContainer,\n decodeSingle : function(config, resultCallback) {\n config = merge({\n inputStream: {\n type : \"ImageStream\",\n sequence : false,\n size: 800,\n src: config.src\n },\n numOfWorkers: 1,\n locator: {\n halfSample: false\n }\n }, config);\n this.init(config, function() {\n Events.once(\"processed\", function(result) {\n _stopped = true;\n resultCallback.call(null, result);\n }, true);\n start();\n });\n },\n ImageWrapper: ImageWrapper,\n ImageDebug: ImageDebug,\n ResultCollector: ResultCollector\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/quagga.js\n **/","/*\n * typedefs.js\n * Normalizes browser-specific prefixes\n */\n\nif (typeof window !== 'undefined') {\n window.requestAnimFrame = (function () {\n return window.requestAnimationFrame ||\n window.webkitRequestAnimationFrame ||\n window.mozRequestAnimationFrame ||\n window.oRequestAnimationFrame ||\n window.msRequestAnimationFrame ||\n function (/* function FrameRequestCallback */ callback) {\n window.setTimeout(callback, 1000 / 60);\n };\n })();\n\n navigator.getUserMedia = navigator.getUserMedia ||\n navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;\n}\nMath.imul = Math.imul || function(a, b) {\n var ah = (a >>> 16) & 0xffff,\n al = a & 0xffff,\n bh = (b >>> 16) & 0xffff,\n bl = b & 0xffff;\n // the shift by 0 fixes the sign on the high part\n // the final |0 converts the unsigned value into a signed value\n return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/typedefs.js\n **/","import ImageLoader from './image_loader';\n\nvar InputStream = {};\nInputStream.createVideoStream = function(video) {\n var that = {},\n _config = null,\n _eventNames = ['canrecord', 'ended'],\n _eventHandlers = {},\n _calculatedWidth,\n _calculatedHeight,\n _topRight = {x: 0, y: 0},\n _canvasSize = {x: 0, y: 0};\n\n function initSize() {\n var width = video.videoWidth,\n height = video.videoHeight;\n\n _calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;\n _calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;\n\n _canvasSize.x = _calculatedWidth;\n _canvasSize.y = _calculatedHeight;\n }\n\n that.getRealWidth = function() {\n return video.videoWidth;\n };\n\n that.getRealHeight = function() {\n return video.videoHeight;\n };\n\n that.getWidth = function() {\n return _calculatedWidth;\n };\n\n that.getHeight = function() {\n return _calculatedHeight;\n };\n\n that.setWidth = function(width) {\n _calculatedWidth = width;\n };\n\n that.setHeight = function(height) {\n _calculatedHeight = height;\n };\n\n that.setInputStream = function(config) {\n _config = config;\n video.src = (typeof config.src !== 'undefined') ? config.src : '';\n };\n\n that.ended = function() {\n return video.ended;\n };\n\n that.getConfig = function() {\n return _config;\n };\n\n that.setAttribute = function(name, value) {\n video.setAttribute(name, value);\n };\n\n that.pause = function() {\n video.pause();\n };\n\n that.play = function() {\n video.play();\n };\n\n that.setCurrentTime = function(time) {\n if (_config.type !== \"LiveStream\")\n video.currentTime = time;\n };\n\n that.addEventListener = function(event, f, bool) {\n if (_eventNames.indexOf(event) !== -1) {\n if (!_eventHandlers[event]) {\n _eventHandlers[event] = [];\n }\n _eventHandlers[event].push(f);\n } else {\n video.addEventListener(event, f, bool);\n }\n };\n\n that.clearEventHandlers = function() {\n _eventNames.forEach(function(eventName) {\n var handlers = _eventHandlers[eventName];\n if (handlers && handlers.length > 0) {\n handlers.forEach(function(handler) {\n video.removeEventListener(eventName, handler);\n });\n }\n });\n };\n\n that.trigger = function(eventName, args) {\n var j,\n handlers = _eventHandlers[eventName];\n\n if (eventName === 'canrecord') {\n initSize();\n }\n if (handlers && handlers.length > 0) {\n for ( j = 0; j < handlers.length; j++) {\n handlers[j].apply(that, args);\n }\n }\n };\n\n that.setTopRight = function(topRight) {\n _topRight.x = topRight.x;\n _topRight.y = topRight.y;\n };\n\n that.getTopRight = function() {\n return _topRight;\n };\n\n that.setCanvasSize = function(size) {\n _canvasSize.x = size.x;\n _canvasSize.y = size.y;\n };\n\n that.getCanvasSize = function() {\n return _canvasSize;\n };\n\n that.getFrame = function() {\n return video;\n };\n\n return that;\n};\n\nInputStream.createLiveStream = function(video) {\n video.setAttribute(\"autoplay\", true);\n var that = InputStream.createVideoStream(video);\n\n that.ended = function() {\n return false;\n };\n\n return that;\n};\n\nInputStream.createImageStream = function() {\n var that = {};\n var _config = null;\n\n var width = 0,\n height = 0,\n frameIdx = 0,\n paused = true,\n loaded = false,\n imgArray = null,\n size = 0,\n offset = 1,\n baseUrl = null,\n ended = false,\n calculatedWidth,\n calculatedHeight,\n _eventNames = ['canrecord', 'ended'],\n _eventHandlers = {},\n _topRight = {x: 0, y: 0},\n _canvasSize = {x: 0, y: 0};\n\n function loadImages() {\n loaded = false;\n ImageLoader.load(baseUrl, function(imgs) {\n imgArray = imgs;\n width = imgs[0].width;\n height = imgs[0].height;\n calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;\n calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;\n _canvasSize.x = calculatedWidth;\n _canvasSize.y = calculatedHeight;\n loaded = true;\n frameIdx = 0;\n setTimeout(function() {\n publishEvent(\"canrecord\", []);\n }, 0);\n }, offset, size, _config.sequence);\n }\n\n function publishEvent(eventName, args) {\n var j,\n handlers = _eventHandlers[eventName];\n\n if (handlers && handlers.length > 0) {\n for ( j = 0; j < handlers.length; j++) {\n handlers[j].apply(that, args);\n }\n }\n }\n\n\n that.trigger = publishEvent;\n\n that.getWidth = function() {\n return calculatedWidth;\n };\n\n that.getHeight = function() {\n return calculatedHeight;\n };\n\n that.setWidth = function(width) {\n calculatedWidth = width;\n };\n\n that.setHeight = function(height) {\n calculatedHeight = height;\n };\n\n that.getRealWidth = function() {\n return width;\n };\n\n that.getRealHeight = function() {\n return height;\n };\n\n that.setInputStream = function(stream) {\n _config = stream;\n if (stream.sequence === false) {\n baseUrl = stream.src;\n size = 1;\n } else {\n baseUrl = stream.src;\n size = stream.length;\n }\n loadImages();\n };\n\n that.ended = function() {\n return ended;\n };\n\n that.setAttribute = function() {};\n\n that.getConfig = function() {\n return _config;\n };\n\n that.pause = function() {\n paused = true;\n };\n\n that.play = function() {\n paused = false;\n };\n\n that.setCurrentTime = function(time) {\n frameIdx = time;\n };\n\n that.addEventListener = function(event, f) {\n if (_eventNames.indexOf(event) !== -1) {\n if (!_eventHandlers[event]) {\n _eventHandlers[event] = [];\n }\n _eventHandlers[event].push(f);\n }\n };\n\n that.setTopRight = function(topRight) {\n _topRight.x = topRight.x;\n _topRight.y = topRight.y;\n };\n\n that.getTopRight = function() {\n return _topRight;\n };\n\n that.setCanvasSize = function(size) {\n _canvasSize.x = size.x;\n _canvasSize.y = size.y;\n };\n\n that.getCanvasSize = function() {\n return _canvasSize;\n };\n\n that.getFrame = function() {\n var frame;\n\n if (!loaded){\n return null;\n }\n if (!paused) {\n frame = imgArray[frameIdx];\n if (frameIdx < (size - 1)) {\n frameIdx++;\n } else {\n setTimeout(function() {\n ended = true;\n publishEvent(\"ended\", []);\n }, 0);\n }\n }\n return frame;\n };\n\n return that;\n};\n\nexport default InputStream;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/input_stream.js\n **/","var ImageLoader = {};\nImageLoader.load = function(directory, callback, offset, size, sequence) {\n var htmlImagesSrcArray = new Array(size),\n htmlImagesArray = new Array(htmlImagesSrcArray.length),\n i,\n img,\n num;\n\n if (sequence === false) {\n htmlImagesSrcArray[0] = directory;\n } else {\n for ( i = 0; i < htmlImagesSrcArray.length; i++) {\n num = (offset + i);\n htmlImagesSrcArray[i] = directory + \"image-\" + (\"00\" + num).slice(-3) + \".jpg\";\n }\n }\n htmlImagesArray.notLoaded = [];\n htmlImagesArray.addImage = function(img) {\n htmlImagesArray.notLoaded.push(img);\n };\n htmlImagesArray.loaded = function(loadedImg) {\n var notloadedImgs = htmlImagesArray.notLoaded;\n for (var x = 0; x < notloadedImgs.length; x++) {\n if (notloadedImgs[x] == loadedImg) {\n notloadedImgs.splice(x, 1);\n for (var y = 0; y < htmlImagesSrcArray.length; y++) {\n var imgName = htmlImagesSrcArray[y].substr(htmlImagesSrcArray[y].lastIndexOf(\"/\"));\n if (loadedImg.src.lastIndexOf(imgName) != -1) {\n htmlImagesArray[y] = loadedImg;\n break;\n }\n }\n break;\n }\n }\n if (notloadedImgs.length === 0) {\n console.log(\"Images loaded\");\n callback.apply(null, [htmlImagesArray]);\n }\n };\n\n for ( i = 0; i < htmlImagesSrcArray.length; i++) {\n img = new Image();\n htmlImagesArray.addImage(img);\n addOnloadHandler(img, htmlImagesArray);\n img.src = htmlImagesSrcArray[i];\n }\n};\n\nfunction addOnloadHandler(img, htmlImagesArray) {\n img.onload = function() {\n htmlImagesArray.loaded(this);\n };\n}\n\nexport default (ImageLoader);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_loader.js\n **/","import SubImage from './subImage';\nimport CVUtils from './cv_utils';\nimport ArrayHelper from './array_helper';\nimport {vec2, mat2} from 'gl-matrix';\n\n/**\n * Represents a basic image combining the data and size.\n * In addition, some methods for manipulation are contained.\n * @param size {x,y} The size of the image in pixel\n * @param data {Array} If given, a flat array containing the pixel data\n * @param ArrayType {Type} If given, the desired DataType of the Array (may be typed/non-typed)\n * @param initialize {Boolean} Indicating if the array should be initialized on creation.\n * @returns {ImageWrapper}\n */\nfunction ImageWrapper(size, data, ArrayType, initialize) {\n if (!data) {\n if (ArrayType) {\n this.data = new ArrayType(size.x * size.y);\n if (ArrayType === Array && initialize) {\n ArrayHelper.init(this.data, 0);\n }\n } else {\n this.data = new Uint8Array(size.x * size.y);\n if (Uint8Array === Array && initialize) {\n ArrayHelper.init(this.data, 0);\n }\n }\n\n } else {\n this.data = data;\n }\n this.size = size;\n}\n\n/**\n * tests if a position is within the image with a given offset\n * @param imgRef {x, y} The location to test\n * @param border Number the padding value in pixel\n * @returns {Boolean} true if location inside the image's border, false otherwise\n * @see cvd/image.h\n */\nImageWrapper.prototype.inImageWithBorder = function(imgRef, border) {\n return (imgRef.x >= border) && (imgRef.y >= border) && (imgRef.x < (this.size.x - border)) && (imgRef.y < (this.size.y - border));\n};\n\n/**\n * Transforms an image according to the given affine-transformation matrix.\n * @param inImg ImageWrapper a image containing the information to be extracted.\n * @param outImg ImageWrapper the image to be filled. The whole image out image is filled by the in image.\n * @param M mat2 the matrix used to map point in the out matrix to those in the in matrix\n * @param inOrig vec2 origin in the in image\n * @param outOrig vec2 origin in the out image\n * @returns Number the number of pixels not in the in image\n * @see cvd/vision.h\n */\nImageWrapper.transform = function(inImg, outImg, M, inOrig, outOrig) {\n var w = outImg.size.x, h = outImg.size.y, iw = inImg.size.x, ih = inImg.size.y;\n var across = vec2.clone([M[0], M[2]]);\n var down = vec2.clone([M[1], M[3]]);\n var defaultValue = 0;\n\n var p0 = vec2.subtract(inOrig, mat2.xVec2(M, outOrig, vec2.clone()), vec2.clone());\n\n var min_x = p0[0], min_y = p0[1];\n var max_x = min_x, max_y = min_y;\n var p, i, j;\n\n var sampleFunc = ImageWrapper.sample;\n\n if (across[0] < 0)\n min_x += w * across[0];\n else\n max_x += w * across[0];\n\n if (down[0] < 0)\n min_x += h * down[0];\n else\n max_x += h * down[0];\n\n if (across[1] < 0)\n min_y += w * across[1];\n else\n max_y += w * across[1];\n\n if (down[1] < 0)\n min_y += h * down[1];\n else\n max_y += h * down[1];\n\n var carrigeReturn = vec2.subtract(down, vec2.scale(across, w, vec2.clone()), vec2.clone());\n\n if (min_x >= 0 && min_y >= 0 && max_x < iw - 1 && max_y < ih - 1) {\n p = p0;\n for ( i = 0; i < h; ++i, vec2.add(p, carrigeReturn))\n for ( j = 0; j < w; ++j, vec2.add(p, across))\n outImg.set(j, i, sampleFunc(inImg, p[0], p[1]));\n return 0;\n } else {\n var x_bound = iw - 1;\n var y_bound = ih - 1;\n var count = 0;\n p = p0;\n for ( i = 0; i < h; ++i, vec2.add(p, carrigeReturn)) {\n for ( j = 0; j < w; ++j, vec2.add(p, across)) {\n if (0 <= p[0] && 0 <= p[1] && p[0] < x_bound && p[1] < y_bound) {\n outImg.set(j, i, sampleFunc(inImg, p[0], p[1]));\n } else {\n outImg.set(j, i, defaultValue); ++count;\n }\n }\n }\n return count;\n }\n};\n\n/**\n * Performs bilinear sampling\n * @param inImg Image to extract sample from\n * @param x the x-coordinate\n * @param y the y-coordinate\n * @returns the sampled value\n * @see cvd/vision.h\n */\nImageWrapper.sample = function(inImg, x, y) {\n var lx = Math.floor(x);\n var ly = Math.floor(y);\n var w = inImg.size.x;\n var base = ly * inImg.size.x + lx;\n var a = inImg.data[base + 0];\n var b = inImg.data[base + 1];\n var c = inImg.data[base + w];\n var d = inImg.data[base + w + 1];\n var e = a - b;\n x -= lx;\n y -= ly;\n\n var result = Math.floor(x * (y * (e - c + d) - e) + y * (c - a) + a);\n return result;\n};\n\n/**\n * Initializes a given array. Sets each element to zero.\n * @param array {Array} The array to initialize\n */\nImageWrapper.clearArray = function(array) {\n var l = array.length;\n while (l--) {\n array[l] = 0;\n }\n};\n\n/**\n * Creates a {SubImage} from the current image ({this}).\n * @param from {ImageRef} The position where to start the {SubImage} from. (top-left corner)\n * @param size {ImageRef} The size of the resulting image\n * @returns {SubImage} A shared part of the original image\n */\nImageWrapper.prototype.subImage = function(from, size) {\n return new SubImage(from, size, this);\n};\n\n/**\n * Creates an {ImageWrapper) and copies the needed underlying image-data area\n * @param imageWrapper {ImageWrapper} The target {ImageWrapper} where the data should be copied\n * @param from {ImageRef} The location where to copy from (top-left location)\n */\nImageWrapper.prototype.subImageAsCopy = function(imageWrapper, from) {\n var sizeY = imageWrapper.size.y, sizeX = imageWrapper.size.x;\n var x, y;\n for ( x = 0; x < sizeX; x++) {\n for ( y = 0; y < sizeY; y++) {\n imageWrapper.data[y * sizeX + x] = this.data[(from.y + y) * this.size.x + from.x + x];\n }\n }\n};\n\nImageWrapper.prototype.copyTo = function(imageWrapper) {\n var length = this.data.length, srcData = this.data, dstData = imageWrapper.data;\n\n while (length--) {\n dstData[length] = srcData[length];\n }\n};\n\n/**\n * Retrieves a given pixel position from the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nImageWrapper.prototype.get = function(x, y) {\n return this.data[y * this.size.x + x];\n};\n\n/**\n * Retrieves a given pixel position from the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nImageWrapper.prototype.getSafe = function(x, y) {\n var i;\n\n if (!this.indexMapping) {\n this.indexMapping = {\n x : [],\n y : []\n };\n for (i = 0; i < this.size.x; i++) {\n this.indexMapping.x[i] = i;\n this.indexMapping.x[i + this.size.x] = i;\n }\n for (i = 0; i < this.size.y; i++) {\n this.indexMapping.y[i] = i;\n this.indexMapping.y[i + this.size.y] = i;\n }\n }\n return this.data[(this.indexMapping.y[y + this.size.y]) * this.size.x + this.indexMapping.x[x + this.size.x]];\n};\n\n/**\n * Sets a given pixel position in the image\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @param value {Number} The grayscale value to set\n * @returns {ImageWrapper} The Image itself (for possible chaining)\n */\nImageWrapper.prototype.set = function(x, y, value) {\n this.data[y * this.size.x + x] = value;\n return this;\n};\n\n/**\n * Sets the border of the image (1 pixel) to zero\n */\nImageWrapper.prototype.zeroBorder = function() {\n var i, width = this.size.x, height = this.size.y, data = this.data;\n for ( i = 0; i < width; i++) {\n data[i] = data[(height - 1) * width + i] = 0;\n }\n for ( i = 1; i < height - 1; i++) {\n data[i * width] = data[i * width + (width - 1)] = 0;\n }\n};\n\n/**\n * Inverts a binary image in place\n */\nImageWrapper.prototype.invert = function() {\n var data = this.data, length = data.length;\n\n while (length--) {\n data[length] = data[length] ? 0 : 1;\n }\n\n};\n\nImageWrapper.prototype.convolve = function(kernel) {\n var x, y, kx, ky, kSize = (kernel.length / 2) | 0, accu = 0;\n for ( y = 0; y < this.size.y; y++) {\n for ( x = 0; x < this.size.x; x++) {\n accu = 0;\n for ( ky = -kSize; ky <= kSize; ky++) {\n for ( kx = -kSize; kx <= kSize; kx++) {\n accu += kernel[ky+kSize][kx + kSize] * this.getSafe(x + kx, y + ky);\n }\n }\n this.data[y * this.size.x + x] = accu;\n }\n }\n};\n\nImageWrapper.prototype.moments = function(labelcount) {\n var data = this.data,\n x,\n y,\n height = this.size.y,\n width = this.size.x,\n val,\n ysq,\n labelsum = [],\n i,\n label,\n mu11,\n mu02,\n mu20,\n x_,\n y_,\n tmp,\n result = [],\n PI = Math.PI,\n PI_4 = PI / 4;\n\n if (labelcount <= 0) {\n return result;\n }\n\n for ( i = 0; i < labelcount; i++) {\n labelsum[i] = {\n m00 : 0,\n m01 : 0,\n m10 : 0,\n m11 : 0,\n m02 : 0,\n m20 : 0,\n theta : 0,\n rad : 0\n };\n }\n\n for ( y = 0; y < height; y++) {\n ysq = y * y;\n for ( x = 0; x < width; x++) {\n val = data[y * width + x];\n if (val > 0) {\n label = labelsum[val - 1];\n label.m00 += 1;\n label.m01 += y;\n label.m10 += x;\n label.m11 += x * y;\n label.m02 += ysq;\n label.m20 += x * x;\n }\n }\n }\n\n for ( i = 0; i < labelcount; i++) {\n label = labelsum[i];\n if (!isNaN(label.m00) && label.m00 !== 0) {\n x_ = label.m10 / label.m00;\n y_ = label.m01 / label.m00;\n mu11 = label.m11 / label.m00 - x_ * y_;\n mu02 = label.m02 / label.m00 - y_ * y_;\n mu20 = label.m20 / label.m00 - x_ * x_;\n tmp = (mu02 - mu20) / (2 * mu11);\n tmp = 0.5 * Math.atan(tmp) + (mu11 >= 0 ? PI_4 : -PI_4 ) + PI;\n label.theta = (tmp * 180 / PI + 90) % 180 - 90;\n if (label.theta < 0) {\n label.theta += 180;\n }\n label.rad = tmp > PI ? tmp - PI : tmp;\n label.vec = vec2.clone([Math.cos(tmp), Math.sin(tmp)]);\n result.push(label);\n }\n }\n\n return result;\n};\n\n/**\n * Displays the {ImageWrapper} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nImageWrapper.prototype.show = function(canvas, scale) {\n var ctx,\n frame,\n data,\n current,\n pixel,\n x,\n y;\n\n if (!scale) {\n scale = 1.0;\n }\n ctx = canvas.getContext('2d');\n canvas.width = this.size.x;\n canvas.height = this.size.y;\n frame = ctx.getImageData(0, 0, canvas.width, canvas.height);\n data = frame.data;\n current = 0;\n for (y = 0; y < this.size.y; y++) {\n for (x = 0; x < this.size.x; x++) {\n pixel = y * this.size.x + x;\n current = this.get(x, y) * scale;\n data[pixel * 4 + 0] = current;\n data[pixel * 4 + 1] = current;\n data[pixel * 4 + 2] = current;\n data[pixel * 4 + 3] = 255;\n }\n }\n //frame.data = data;\n ctx.putImageData(frame, 0, 0);\n};\n\n/**\n * Displays the {SubImage} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nImageWrapper.prototype.overlay = function(canvas, scale, from) {\n if (!scale || scale < 0 || scale > 360) {\n scale = 360;\n }\n var hsv = [0, 1, 1];\n var rgb = [0, 0, 0];\n var whiteRgb = [255, 255, 255];\n var blackRgb = [0, 0, 0];\n var result = [];\n var ctx = canvas.getContext('2d');\n var frame = ctx.getImageData(from.x, from.y, this.size.x, this.size.y);\n var data = frame.data;\n var length = this.data.length;\n while (length--) {\n hsv[0] = this.data[length] * scale;\n result = hsv[0] <= 0 ? whiteRgb : hsv[0] >= 360 ? blackRgb : CVUtils.hsv2rgb(hsv, rgb);\n data[length * 4 + 0] = result[0];\n data[length * 4 + 1] = result[1];\n data[length * 4 + 2] = result[2];\n data[length * 4 + 3] = 255;\n }\n ctx.putImageData(frame, from.x, from.y);\n};\n\nexport default ImageWrapper;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_wrapper.js\n **/","/**\n * Construct representing a part of another {ImageWrapper}. Shares data\n * between the parent and the child.\n * @param from {ImageRef} The position where to start the {SubImage} from. (top-left corner)\n * @param size {ImageRef} The size of the resulting image\n * @param I {ImageWrapper} The {ImageWrapper} to share from\n * @returns {SubImage} A shared part of the original image\n */\nfunction SubImage(from, size, I) {\n if (!I) {\n I = {\n data : null,\n size : size\n };\n }\n this.data = I.data;\n this.originalSize = I.size;\n this.I = I;\n\n this.from = from;\n this.size = size;\n}\n\n/**\n * Displays the {SubImage} in a given canvas\n * @param canvas {Canvas} The canvas element to write to\n * @param scale {Number} Scale which is applied to each pixel-value\n */\nSubImage.prototype.show = function(canvas, scale) {\n var ctx,\n frame,\n data,\n current,\n y,\n x,\n pixel;\n\n if (!scale) {\n scale = 1.0;\n }\n ctx = canvas.getContext('2d');\n canvas.width = this.size.x;\n canvas.height = this.size.y;\n frame = ctx.getImageData(0, 0, canvas.width, canvas.height);\n data = frame.data;\n current = 0;\n for (y = 0; y < this.size.y; y++) {\n for (x = 0; x < this.size.x; x++) {\n pixel = y * this.size.x + x;\n current = this.get(x, y) * scale;\n data[pixel * 4 + 0] = current;\n data[pixel * 4 + 1] = current;\n data[pixel * 4 + 2] = current;\n data[pixel * 4 + 3] = 255;\n }\n }\n frame.data = data;\n ctx.putImageData(frame, 0, 0);\n};\n\n/**\n * Retrieves a given pixel position from the {SubImage}\n * @param x {Number} The x-position\n * @param y {Number} The y-position\n * @returns {Number} The grayscale value at the pixel-position\n */\nSubImage.prototype.get = function(x, y) {\n return this.data[(this.from.y + y) * this.originalSize.x + this.from.x + x];\n};\n\n/**\n * Updates the underlying data from a given {ImageWrapper}\n * @param image {ImageWrapper} The updated image\n */\nSubImage.prototype.updateData = function(image) {\n this.originalSize = image.size;\n this.data = image.data;\n};\n\n/**\n * Updates the position of the shared area\n * @param from {x,y} The new location\n * @returns {SubImage} returns {this} for possible chaining\n */\nSubImage.prototype.updateFrom = function(from) {\n this.from = from;\n return this;\n};\n\nexport default (SubImage);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/subImage.js\n **/","import Cluster2 from './cluster';\nimport ArrayHelper from './array_helper';\nimport {vec2, vec3} from 'gl-matrix';\n\nvar CVUtils = {};\n\n/**\n * @param x x-coordinate\n * @param y y-coordinate\n * @return ImageReference {x,y} Coordinate\n */\nCVUtils.imageRef = function(x, y) {\n var that = {\n x : x,\n y : y,\n toVec2 : function() {\n return vec2.clone([this.x, this.y]);\n },\n toVec3 : function() {\n return vec3.clone([this.x, this.y, 1]);\n },\n round : function() {\n this.x = this.x > 0.0 ? Math.floor(this.x + 0.5) : Math.floor(this.x - 0.5);\n this.y = this.y > 0.0 ? Math.floor(this.y + 0.5) : Math.floor(this.y - 0.5);\n return this;\n }\n };\n return that;\n};\n\n/**\n * Computes an integral image of a given grayscale image.\n * @param imageDataContainer {ImageDataContainer} the image to be integrated\n */\nCVUtils.computeIntegralImage2 = function(imageWrapper, integralWrapper) {\n var imageData = imageWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0, posA = 0, posB = 0, posC = 0, posD = 0, x, y;\n\n // sum up first column\n posB = width;\n sum = 0;\n for ( y = 1; y < height; y++) {\n sum += imageData[posA];\n integralImageData[posB] += sum;\n posA += width;\n posB += width;\n }\n\n posA = 0;\n posB = 1;\n sum = 0;\n for ( x = 1; x < width; x++) {\n sum += imageData[posA];\n integralImageData[posB] += sum;\n posA++;\n posB++;\n }\n\n for ( y = 1; y < height; y++) {\n posA = y * width + 1;\n posB = (y - 1) * width + 1;\n posC = y * width;\n posD = (y - 1) * width;\n for ( x = 1; x < width; x++) {\n integralImageData[posA] += imageData[posA] + integralImageData[posB] + integralImageData[posC] - integralImageData[posD];\n posA++;\n posB++;\n posC++;\n posD++;\n }\n }\n};\n\nCVUtils.computeIntegralImage = function(imageWrapper, integralWrapper) {\n var imageData = imageWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0;\n\n // sum up first row\n for (var i = 0; i < width; i++) {\n sum += imageData[i];\n integralImageData[i] = sum;\n }\n\n for (var v = 1; v < height; v++) {\n sum = 0;\n for (var u = 0; u < width; u++) {\n sum += imageData[v * width + u];\n integralImageData[((v) * width) + u] = sum + integralImageData[(v - 1) * width + u];\n }\n }\n};\n\nCVUtils.thresholdImage = function(imageWrapper, threshold, targetWrapper) {\n if (!targetWrapper) {\n targetWrapper = imageWrapper;\n }\n var imageData = imageWrapper.data, length = imageData.length, targetData = targetWrapper.data;\n\n while (length--) {\n targetData[length] = imageData[length] < threshold ? 1 : 0;\n }\n};\n\nCVUtils.computeHistogram = function(imageWrapper, bitsPerPixel) {\n if (!bitsPerPixel) {\n bitsPerPixel = 8;\n }\n var imageData = imageWrapper.data,\n length = imageData.length,\n bitShift = 8 - bitsPerPixel,\n bucketCnt = 1 << bitsPerPixel,\n hist = new Int32Array(bucketCnt);\n\n while (length--) {\n hist[imageData[length] >> bitShift]++;\n }\n return hist;\n};\n\nCVUtils.sharpenLine = function(line) {\n var i,\n length = line.length,\n left = line[0],\n center = line[1],\n right;\n\n for (i = 1; i < length - 1; i++) {\n right = line[i + 1];\n // -1 4 -1 kernel\n line[i-1] = (((center * 2) - left - right)) & 255;\n left = center;\n center = right;\n }\n return line;\n};\n\nCVUtils.determineOtsuThreshold = function(imageWrapper, bitsPerPixel) {\n if (!bitsPerPixel) {\n bitsPerPixel = 8;\n }\n var hist,\n threshold,\n bitShift = 8 - bitsPerPixel;\n\n function px(init, end) {\n var sum = 0, i;\n for ( i = init; i <= end; i++) {\n sum += hist[i];\n }\n return sum;\n }\n\n function mx(init, end) {\n var i, sum = 0;\n\n for ( i = init; i <= end; i++) {\n sum += i * hist[i];\n }\n\n return sum;\n }\n\n function determineThreshold() {\n var vet = [0], p1, p2, p12, k, m1, m2, m12,\n max = (1 << bitsPerPixel) - 1;\n\n hist = CVUtils.computeHistogram(imageWrapper, bitsPerPixel);\n for ( k = 1; k < max; k++) {\n p1 = px(0, k);\n p2 = px(k + 1, max);\n p12 = p1 * p2;\n if (p12 === 0) {\n p12 = 1;\n }\n m1 = mx(0, k) * p2;\n m2 = mx(k + 1, max) * p1;\n m12 = m1 - m2;\n vet[k] = m12 * m12 / p12;\n }\n return ArrayHelper.maxIndex(vet);\n }\n\n threshold = determineThreshold();\n return threshold << bitShift;\n};\n\nCVUtils.otsuThreshold = function(imageWrapper, targetWrapper) {\n var threshold = CVUtils.determineOtsuThreshold(imageWrapper);\n\n CVUtils.thresholdImage(imageWrapper, threshold, targetWrapper);\n return threshold;\n};\n\n// local thresholding\nCVUtils.computeBinaryImage = function(imageWrapper, integralWrapper, targetWrapper) {\n CVUtils.computeIntegralImage(imageWrapper, integralWrapper);\n\n if (!targetWrapper) {\n targetWrapper = imageWrapper;\n }\n var imageData = imageWrapper.data;\n var targetData = targetWrapper.data;\n var width = imageWrapper.size.x;\n var height = imageWrapper.size.y;\n var integralImageData = integralWrapper.data;\n var sum = 0, v, u, kernel = 3, A, B, C, D, avg, size = (kernel * 2 + 1) * (kernel * 2 + 1);\n\n // clear out top & bottom-border\n for ( v = 0; v <= kernel; v++) {\n for ( u = 0; u < width; u++) {\n targetData[((v) * width) + u] = 0;\n targetData[(((height - 1) - v) * width) + u] = 0;\n }\n }\n\n // clear out left & right border\n for ( v = kernel; v < height - kernel; v++) {\n for ( u = 0; u <= kernel; u++) {\n targetData[((v) * width) + u] = 0;\n targetData[((v) * width) + (width - 1 - u)] = 0;\n }\n }\n\n for ( v = kernel + 1; v < height - kernel - 1; v++) {\n for ( u = kernel + 1; u < width - kernel; u++) {\n A = integralImageData[(v - kernel - 1) * width + (u - kernel - 1)];\n B = integralImageData[(v - kernel - 1) * width + (u + kernel)];\n C = integralImageData[(v + kernel) * width + (u - kernel - 1)];\n D = integralImageData[(v + kernel) * width + (u + kernel)];\n sum = D - C - B + A;\n avg = sum / (size);\n targetData[v * width + u] = imageData[v * width + u] > (avg + 5) ? 0 : 1;\n }\n }\n};\n\nCVUtils.cluster = function(points, threshold, property) {\n var i, k, cluster, point, clusters = [];\n\n if (!property) {\n property = \"rad\";\n }\n\n function addToCluster(point) {\n var found = false;\n for ( k = 0; k < clusters.length; k++) {\n cluster = clusters[k];\n if (cluster.fits(point)) {\n cluster.add(point);\n found = true;\n }\n }\n return found;\n }\n\n // iterate over each cloud\n for ( i = 0; i < points.length; i++) {\n point = Cluster2.createPoint(points[i], i, property);\n if (!addToCluster(point)) {\n clusters.push(Cluster2.create(point, threshold));\n }\n }\n\n return clusters;\n\n};\n\nCVUtils.Tracer = {\n trace : function(points, vec) {\n var iteration, maxIterations = 10, top = [], result = [], centerPos = 0, currentPos = 0;\n\n function trace(idx, forward) {\n var from, to, toIdx, predictedPos, thresholdX = 1, thresholdY = Math.abs(vec[1] / 10), found = false;\n\n function match(pos, predicted) {\n if (pos.x > (predicted.x - thresholdX) && pos.x < (predicted.x + thresholdX) && pos.y > (predicted.y - thresholdY) && pos.y < (predicted.y + thresholdY)) {\n return true;\n } else {\n return false;\n }\n }\n\n // check if the next index is within the vec specifications\n // if not, check as long as the threshold is met\n\n from = points[idx];\n if (forward) {\n predictedPos = {\n x : from.x + vec[0],\n y : from.y + vec[1]\n };\n } else {\n predictedPos = {\n x : from.x - vec[0],\n y : from.y - vec[1]\n };\n }\n\n toIdx = forward ? idx + 1 : idx - 1;\n to = points[toIdx];\n while (to && ( found = match(to, predictedPos)) !== true && (Math.abs(to.y - from.y) < vec[1])) {\n toIdx = forward ? toIdx + 1 : toIdx - 1;\n to = points[toIdx];\n }\n\n return found ? toIdx : null;\n }\n\n for ( iteration = 0; iteration < maxIterations; iteration++) {\n // randomly select point to start with\n centerPos = Math.floor(Math.random() * points.length);\n\n // trace forward\n top = [];\n currentPos = centerPos;\n top.push(points[currentPos]);\n while (( currentPos = trace(currentPos, true)) !== null) {\n top.push(points[currentPos]);\n }\n if (centerPos > 0) {\n currentPos = centerPos;\n while (( currentPos = trace(currentPos, false)) !== null) {\n top.push(points[currentPos]);\n }\n }\n\n if (top.length > result.length) {\n result = top;\n }\n }\n\n return result;\n\n }\n};\n\nCVUtils.DILATE = 1;\nCVUtils.ERODE = 2;\n\nCVUtils.dilate = function(inImageWrapper, outImageWrapper) {\n var v, u, inImageData = inImageWrapper.data, outImageData = outImageWrapper.data, height = inImageWrapper.size.y, width = inImageWrapper.size.x, sum, yStart1, yStart2, xStart1, xStart2;\n\n for ( v = 1; v < height - 1; v++) {\n for ( u = 1; u < width - 1; u++) {\n yStart1 = v - 1;\n yStart2 = v + 1;\n xStart1 = u - 1;\n xStart2 = u + 1;\n sum = inImageData[yStart1 * width + xStart1]/* + inImageData[yStart1*width+u] */ + inImageData[yStart1 * width + xStart2] +\n /* inImageData[v*width+xStart1] + */\n inImageData[v * width + u] + /* inImageData[v*width+xStart2] +*/\n inImageData[yStart2 * width + xStart1]/* + inImageData[yStart2*width+u]*/ + inImageData[yStart2 * width + xStart2];\n outImageData[v * width + u] = sum > 0 ? 1 : 0;\n }\n }\n};\n\nCVUtils.erode = function(inImageWrapper, outImageWrapper) {\n var v, u, inImageData = inImageWrapper.data, outImageData = outImageWrapper.data, height = inImageWrapper.size.y, width = inImageWrapper.size.x, sum, yStart1, yStart2, xStart1, xStart2;\n\n for ( v = 1; v < height - 1; v++) {\n for ( u = 1; u < width - 1; u++) {\n yStart1 = v - 1;\n yStart2 = v + 1;\n xStart1 = u - 1;\n xStart2 = u + 1;\n sum = inImageData[yStart1 * width + xStart1]/* + inImageData[yStart1*width+u] */ + inImageData[yStart1 * width + xStart2] +\n /* inImageData[v*width+xStart1] + */\n inImageData[v * width + u] + /* inImageData[v*width+xStart2] +*/\n inImageData[yStart2 * width + xStart1]/* + inImageData[yStart2*width+u]*/ + inImageData[yStart2 * width + xStart2];\n outImageData[v * width + u] = sum === 5 ? 1 : 0;\n }\n }\n};\n\nCVUtils.subtract = function(aImageWrapper, bImageWrapper, resultImageWrapper) {\n if (!resultImageWrapper) {\n resultImageWrapper = aImageWrapper;\n }\n var length = aImageWrapper.data.length, aImageData = aImageWrapper.data, bImageData = bImageWrapper.data, cImageData = resultImageWrapper.data;\n\n while (length--) {\n cImageData[length] = aImageData[length] - bImageData[length];\n }\n};\n\nCVUtils.bitwiseOr = function(aImageWrapper, bImageWrapper, resultImageWrapper) {\n if (!resultImageWrapper) {\n resultImageWrapper = aImageWrapper;\n }\n var length = aImageWrapper.data.length, aImageData = aImageWrapper.data, bImageData = bImageWrapper.data, cImageData = resultImageWrapper.data;\n\n while (length--) {\n cImageData[length] = aImageData[length] || bImageData[length];\n }\n};\n\nCVUtils.countNonZero = function(imageWrapper) {\n var length = imageWrapper.data.length, data = imageWrapper.data, sum = 0;\n\n while (length--) {\n sum += data[length];\n }\n return sum;\n};\n\nCVUtils.topGeneric = function(list, top, scoreFunc) {\n var i, minIdx = 0, min = 0, queue = [], score, hit, pos;\n\n for ( i = 0; i < top; i++) {\n queue[i] = {\n score : 0,\n item : null\n };\n }\n\n for ( i = 0; i < list.length; i++) {\n score = scoreFunc.apply(this, [list[i]]);\n if (score > min) {\n hit = queue[minIdx];\n hit.score = score;\n hit.item = list[i];\n min = Number.MAX_VALUE;\n for ( pos = 0; pos < top; pos++) {\n if (queue[pos].score < min) {\n min = queue[pos].score;\n minIdx = pos;\n }\n }\n }\n }\n\n return queue;\n};\n\nCVUtils.grayArrayFromImage = function(htmlImage, offsetX, ctx, array) {\n ctx.drawImage(htmlImage, offsetX, 0, htmlImage.width, htmlImage.height);\n var ctxData = ctx.getImageData(offsetX, 0, htmlImage.width, htmlImage.height).data;\n CVUtils.computeGray(ctxData, array);\n};\n\nCVUtils.grayArrayFromContext = function(ctx, size, offset, array) {\n var ctxData = ctx.getImageData(offset.x, offset.y, size.x, size.y).data;\n CVUtils.computeGray(ctxData, array);\n};\n\nCVUtils.grayAndHalfSampleFromCanvasData = function(canvasData, size, outArray) {\n var topRowIdx = 0;\n var bottomRowIdx = size.x;\n var endIdx = Math.floor(canvasData.length / 4);\n var outWidth = size.x / 2;\n var outImgIdx = 0;\n var inWidth = size.x;\n var i;\n\n while (bottomRowIdx < endIdx) {\n for ( i = 0; i < outWidth; i++) {\n outArray[outImgIdx] = Math.floor(((0.299 * canvasData[topRowIdx * 4 + 0] + 0.587 * canvasData[topRowIdx * 4 + 1] + 0.114 * canvasData[topRowIdx * 4 + 2]) + (0.299 * canvasData[(topRowIdx + 1) * 4 + 0] + 0.587 * canvasData[(topRowIdx + 1) * 4 + 1] + 0.114 * canvasData[(topRowIdx + 1) * 4 + 2]) + (0.299 * canvasData[(bottomRowIdx) * 4 + 0] + 0.587 * canvasData[(bottomRowIdx) * 4 + 1] + 0.114 * canvasData[(bottomRowIdx) * 4 + 2]) + (0.299 * canvasData[(bottomRowIdx + 1) * 4 + 0] + 0.587 * canvasData[(bottomRowIdx + 1) * 4 + 1] + 0.114 * canvasData[(bottomRowIdx + 1) * 4 + 2])) / 4);\n outImgIdx++;\n topRowIdx = topRowIdx + 2;\n bottomRowIdx = bottomRowIdx + 2;\n }\n topRowIdx = topRowIdx + inWidth;\n bottomRowIdx = bottomRowIdx + inWidth;\n }\n\n};\n\nCVUtils.computeGray = function(imageData, outArray, config) {\n var l = (imageData.length / 4) | 0,\n i,\n singleChannel = config && config.singleChannel === true;\n\n if (singleChannel) {\n for (i = 0; i < l; i++) {\n outArray[i] = imageData[i * 4 + 0];\n }\n } else {\n for (i = 0; i < l; i++) {\n outArray[i] = Math.floor(0.299 * imageData[i * 4 + 0] + 0.587 * imageData[i * 4 + 1] + 0.114 * imageData[i * 4 + 2]);\n }\n }\n};\n\nCVUtils.loadImageArray = function(src, callback, canvas) {\n if (!canvas)\n canvas = document.createElement('canvas');\n var img = new Image();\n img.callback = callback;\n img.onload = function() {\n canvas.width = this.width;\n canvas.height = this.height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(this, 0, 0);\n var array = new Uint8Array(this.width * this.height);\n ctx.drawImage(this, 0, 0);\n var data = ctx.getImageData(0, 0, this.width, this.height).data;\n CVUtils.computeGray(data, array);\n this.callback(array, {\n x : this.width,\n y : this.height\n }, this);\n };\n img.src = src;\n};\n\n/**\n * @param inImg {ImageWrapper} input image to be sampled\n * @param outImg {ImageWrapper} to be stored in\n */\nCVUtils.halfSample = function(inImgWrapper, outImgWrapper) {\n var inImg = inImgWrapper.data;\n var inWidth = inImgWrapper.size.x;\n var outImg = outImgWrapper.data;\n var topRowIdx = 0;\n var bottomRowIdx = inWidth;\n var endIdx = inImg.length;\n var outWidth = inWidth / 2;\n var outImgIdx = 0;\n while (bottomRowIdx < endIdx) {\n for (var i = 0; i < outWidth; i++) {\n outImg[outImgIdx] = Math.floor((inImg[topRowIdx] + inImg[topRowIdx + 1] + inImg[bottomRowIdx] + inImg[bottomRowIdx + 1]) / 4);\n outImgIdx++;\n topRowIdx = topRowIdx + 2;\n bottomRowIdx = bottomRowIdx + 2;\n }\n topRowIdx = topRowIdx + inWidth;\n bottomRowIdx = bottomRowIdx + inWidth;\n }\n};\n\nCVUtils.hsv2rgb = function(hsv, rgb) {\n var h = hsv[0], s = hsv[1], v = hsv[2], c = v * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = v - c, r = 0, g = 0, b = 0;\n rgb = rgb || [0, 0, 0];\n\n if (h < 60) {\n r = c;\n g = x;\n } else if (h < 120) {\n r = x;\n g = c;\n } else if (h < 180) {\n g = c;\n b = x;\n } else if (h < 240) {\n g = x;\n b = c;\n } else if (h < 300) {\n r = x;\n b = c;\n } else if (h < 360) {\n r = c;\n b = x;\n }\n rgb[0] = ((r + m) * 255) | 0;\n rgb[1] = ((g + m) * 255) | 0;\n rgb[2] = ((b + m) * 255) | 0;\n return rgb;\n};\n\nCVUtils._computeDivisors = function(n) {\n var largeDivisors = [],\n divisors = [],\n i;\n\n for (i = 1; i < Math.sqrt(n) + 1; i++) {\n if (n % i === 0) {\n divisors.push(i);\n if (i !== n/i) {\n largeDivisors.unshift(Math.floor(n/i));\n }\n }\n }\n return divisors.concat(largeDivisors);\n};\n\nCVUtils._computeIntersection = function(arr1, arr2) {\n var i = 0,\n j = 0,\n result = [];\n\n while (i < arr1.length && j < arr2.length) {\n if (arr1[i] === arr2[j]) {\n result.push(arr1[i]);\n i++;\n j++;\n } else if (arr1[i] > arr2[j]) {\n j++;\n } else {\n i++;\n }\n }\n return result;\n};\n\nCVUtils.calculatePatchSize = function(patchSize, imgSize) {\n var divisorsX = this._computeDivisors(imgSize.x),\n divisorsY = this._computeDivisors(imgSize.y),\n wideSide = Math.max(imgSize.x, imgSize.y),\n common = this._computeIntersection(divisorsX, divisorsY),\n nrOfPatchesList = [8, 10, 15, 20, 32, 60, 80],\n nrOfPatchesMap = {\n \"x-small\": 5,\n \"small\": 4,\n \"medium\": 3,\n \"large\": 2,\n \"x-large\": 1\n },\n nrOfPatchesIdx = nrOfPatchesMap[patchSize] || nrOfPatchesMap.medium,\n nrOfPatches = nrOfPatchesList[nrOfPatchesIdx],\n desiredPatchSize = Math.floor(wideSide/nrOfPatches),\n optimalPatchSize;\n\n function findPatchSizeForDivisors(divisors) {\n var i = 0,\n found = divisors[Math.floor(divisors.length/2)];\n\n while(i < (divisors.length - 1) && divisors[i] < desiredPatchSize) {\n i++;\n }\n if (i > 0) {\n if (Math.abs(divisors[i] - desiredPatchSize) > Math.abs(divisors[i-1] - desiredPatchSize)) {\n found = divisors[i-1];\n } else {\n found = divisors[i];\n }\n }\n if (desiredPatchSize / found < nrOfPatchesList[nrOfPatchesIdx+1] / nrOfPatchesList[nrOfPatchesIdx] &&\n desiredPatchSize / found > nrOfPatchesList[nrOfPatchesIdx-1]/nrOfPatchesList[nrOfPatchesIdx] ) {\n return {x: found, y: found};\n }\n return null;\n }\n\n optimalPatchSize = findPatchSizeForDivisors(common);\n if (!optimalPatchSize) {\n optimalPatchSize = findPatchSizeForDivisors(this._computeDivisors(wideSide));\n if (!optimalPatchSize) {\n optimalPatchSize = findPatchSizeForDivisors((this._computeDivisors(desiredPatchSize * nrOfPatches)));\n }\n }\n return optimalPatchSize;\n};\n\nCVUtils._parseCSSDimensionValues = function(value) {\n var dimension = {\n value: parseFloat(value),\n unit: value.indexOf(\"%\") === value.length-1 ? \"%\" : \"%\"\n };\n\n return dimension;\n};\n\nCVUtils._dimensionsConverters = {\n top: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.height * (dimension.value / 100));\n }\n },\n right: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.width - (context.width * (dimension.value / 100)));\n }\n },\n bottom: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.height - (context.height * (dimension.value / 100)));\n }\n },\n left: function(dimension, context) {\n if (dimension.unit === \"%\") {\n return Math.floor(context.width * (dimension.value / 100));\n }\n }\n};\n\nCVUtils.computeImageArea = function(inputWidth, inputHeight, area) {\n var context = {width: inputWidth, height: inputHeight};\n\n var parsedArea = Object.keys(area).reduce(function(result, key) {\n var value = area[key],\n parsed = CVUtils._parseCSSDimensionValues(value),\n calculated = CVUtils._dimensionsConverters[key](parsed, context);\n\n result[key] = calculated;\n return result;\n }, {});\n\n return {\n sx: parsedArea.left,\n sy: parsedArea.top,\n sw: parsedArea.right - parsedArea.left,\n sh: parsedArea.bottom - parsedArea.top\n };\n};\n\nexport default CVUtils;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/cv_utils.js\n **/","import {vec2} from 'gl-matrix';\n /**\n * Creates a cluster for grouping similar orientations of datapoints\n */\nexport default {\n create: function(point, threshold) {\n var points = [],\n center = {\n rad: 0,\n vec: vec2.clone([0, 0])\n },\n pointMap = {};\n\n function init() {\n add(point);\n updateCenter();\n }\n\n function add(point) {\n pointMap[point.id] = point;\n points.push(point);\n }\n\n function updateCenter() {\n var i, sum = 0;\n for ( i = 0; i < points.length; i++) {\n sum += points[i].rad;\n }\n center.rad = sum / points.length;\n center.vec = vec2.clone([Math.cos(center.rad), Math.sin(center.rad)]);\n }\n\n init();\n\n return {\n add: function(point) {\n if (!pointMap[point.id]) {\n add(point);\n updateCenter();\n }\n },\n fits: function(point) {\n // check cosine similarity to center-angle\n var similarity = Math.abs(vec2.dot(point.point.vec, center.vec));\n if (similarity > threshold) {\n return true;\n }\n return false;\n },\n getPoints: function() {\n return points;\n },\n getCenter: function() {\n return center;\n }\n };\n },\n createPoint: function(point, id, property) {\n return {\n rad: point[property],\n point: point,\n id: id\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/cluster.js\n **/","/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.0\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n// END HEADER\n\nexports.glMatrix = require(\"./gl-matrix/common.js\");\nexports.mat2 = require(\"./gl-matrix/mat2.js\");\nexports.mat2d = require(\"./gl-matrix/mat2d.js\");\nexports.mat3 = require(\"./gl-matrix/mat3.js\");\nexports.mat4 = require(\"./gl-matrix/mat4.js\");\nexports.quat = require(\"./gl-matrix/quat.js\");\nexports.vec2 = require(\"./gl-matrix/vec2.js\");\nexports.vec3 = require(\"./gl-matrix/vec3.js\");\nexports.vec4 = require(\"./gl-matrix/vec4.js\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix.js\n ** module id = 9\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n/**\n * @class Common utilities\n * @name glMatrix\n */\nvar glMatrix = {};\n\n// Constants\nglMatrix.EPSILON = 0.000001;\nglMatrix.ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;\nglMatrix.RANDOM = Math.random;\n\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Type} type Array type, such as Float32Array or Array\n */\nglMatrix.setMatrixArrayType = function(type) {\n GLMAT_ARRAY_TYPE = type;\n}\n\nvar degree = Math.PI / 180;\n\n/**\n* Convert Degree To Radian\n*\n* @param {Number} Angle in Degrees\n*/\nglMatrix.toRadian = function(a){\n return a * degree;\n}\n\nmodule.exports = glMatrix;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/common.js\n ** module id = 10\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2x2 Matrix\n * @name mat2\n */\nvar mat2 = {};\n\n/**\n * Creates a new identity mat2\n *\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param {mat2} a matrix to clone\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Copy the values from one mat2 to another\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set a mat2 to the identity matrix\n *\n * @param {mat2} out the receiving matrix\n * @returns {mat2} out\n */\nmat2.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n\n // Calculate the determinant\n det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n \n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.adjoint = function(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2\n *\n * @param {mat2} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2.determinant = function (a) {\n return a[0] * a[3] - a[2] * a[1];\n};\n\n/**\n * Multiplies two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the first operand\n * @param {mat2} b the second operand\n * @returns {mat2} out\n */\nmat2.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n};\n\n/**\n * Alias for {@link mat2.multiply}\n * @function\n */\nmat2.mul = mat2.multiply;\n\n/**\n * Rotates a mat2 by the given angle\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n};\n\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2} out\n **/\nmat2.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n};\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.fromRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat2} out\n */\nmat2.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2\n *\n * @param {mat2} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat2.str = function (a) {\n return 'mat2(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param {mat2} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))\n};\n\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param {mat2} L the lower triangular matrix \n * @param {mat2} D the diagonal matrix \n * @param {mat2} U the upper triangular matrix \n * @param {mat2} a the input matrix to factorize\n */\n\nmat2.LDU = function (L, D, U, a) { \n L[2] = a[2]/a[0]; \n U[0] = a[0]; \n U[1] = a[1]; \n U[3] = a[3] - L[2] * U[1]; \n return [L, D, U]; \n}; \n\n\nmodule.exports = mat2;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat2.js\n ** module id = 11\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2x3 Matrix\n * @name mat2d\n * \n * @description \n * A mat2d contains six elements defined as:\n * \n * [a, c, tx,\n * b, d, ty]\n *
\n * This is a short form for the 3x3 matrix:\n * \n * [a, c, tx,\n * b, d, ty,\n * 0, 0, 1]\n *
\n * The last row is ignored so the array is shorter and operations are faster.\n */\nvar mat2d = {};\n\n/**\n * Creates a new identity mat2d\n *\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.create = function() {\n var out = new glMatrix.ARRAY_TYPE(6);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param {mat2d} a matrix to clone\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(6);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Copy the values from one mat2d to another\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Set a mat2d to the identity matrix\n *\n * @param {mat2d} out the receiving matrix\n * @returns {mat2d} out\n */\nmat2d.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Inverts a mat2d\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.invert = function(out, a) {\n var aa = a[0], ab = a[1], ac = a[2], ad = a[3],\n atx = a[4], aty = a[5];\n\n var det = aa * ad - ab * ac;\n if(!det){\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2d\n *\n * @param {mat2d} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2d.determinant = function (a) {\n return a[0] * a[3] - a[1] * a[2];\n};\n\n/**\n * Multiplies two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the first operand\n * @param {mat2d} b the second operand\n * @returns {mat2d} out\n */\nmat2d.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n};\n\n/**\n * Alias for {@link mat2d.multiply}\n * @function\n */\nmat2d.mul = mat2d.multiply;\n\n/**\n * Rotates a mat2d by the given angle\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2d} out\n **/\nmat2d.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to translate the matrix by\n * @returns {mat2d} out\n **/\nmat2d.translate = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n};\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.rotate(dest, dest, rad);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.fromRotation = function(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.scale(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat2d} out\n */\nmat2d.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.translate(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {vec2} v Translation vector\n * @returns {mat2d} out\n */\nmat2d.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2d\n *\n * @param {mat2d} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat2d.str = function (a) {\n return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n a[3] + ', ' + a[4] + ', ' + a[5] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param {mat2d} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2d.frob = function (a) { \n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))\n}; \n\nmodule.exports = mat2d;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat2d.js\n ** module id = 12\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 3x3 Matrix\n * @name mat3\n */\nvar mat3 = {};\n\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.create = function() {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {mat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\nmat3.fromMat4 = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n};\n\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {mat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\nmat3.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b01 = a22 * a11 - a12 * a21,\n b11 = -a22 * a10 + a12 * a20,\n b21 = a21 * a10 - a11 * a20,\n\n // Calculate the determinant\n det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n out[0] = (a11 * a22 - a12 * a21);\n out[1] = (a02 * a21 - a01 * a22);\n out[2] = (a01 * a12 - a02 * a11);\n out[3] = (a12 * a20 - a10 * a22);\n out[4] = (a00 * a22 - a02 * a20);\n out[5] = (a02 * a10 - a00 * a12);\n out[6] = (a10 * a21 - a11 * a20);\n out[7] = (a01 * a20 - a00 * a21);\n out[8] = (a00 * a11 - a01 * a10);\n return out;\n};\n\n/**\n * Calculates the determinant of a mat3\n *\n * @param {mat3} a the source matrix\n * @returns {Number} determinant of a\n */\nmat3.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n};\n\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the first operand\n * @param {mat3} b the second operand\n * @returns {mat3} out\n */\nmat3.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b00 = b[0], b01 = b[1], b02 = b[2],\n b10 = b[3], b11 = b[4], b12 = b[5],\n b20 = b[6], b21 = b[7], b22 = b[8];\n\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n};\n\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\nmat3.mul = mat3.multiply;\n\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to translate\n * @param {vec2} v vector to translate by\n * @returns {mat3} out\n */\nmat3.translate = function(out, a, v) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n x = v[0], y = v[1];\n\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n};\n\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.rotate = function (out, a, rad) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n s = Math.sin(rad),\n c = Math.cos(rad);\n\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n};\n\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\nmat3.scale = function(out, a, v) {\n var x = v[0], y = v[1];\n\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {vec2} v Translation vector\n * @returns {mat3} out\n */\nmat3.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.fromRotation = function(out, rad) {\n var s = Math.sin(rad), c = Math.cos(rad);\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {vec2} v Scaling vector\n * @returns {mat3} out\n */\nmat3.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat2d} a the matrix to copy\n * @returns {mat3} out\n **/\nmat3.fromMat2d = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n};\n\n/**\n* Calculates a 3x3 matrix from the given quaternion\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {quat} q Quaternion to create matrix from\n*\n* @returns {mat3} out\n*/\nmat3.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n\n return out;\n};\n\n/**\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {mat4} a Mat4 to derive the normal matrix from\n*\n* @returns {mat3} out\n*/\nmat3.normalFromMat4 = function (out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\n return out;\n};\n\n/**\n * Returns a string representation of a mat3\n *\n * @param {mat3} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat3.str = function (a) {\n return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + \n a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + \n a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {mat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat3.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))\n};\n\n\nmodule.exports = mat3;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat3.js\n ** module id = 13\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 4x4 Matrix\n * @name mat4\n */\nvar mat4 = {};\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.create = function() {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {mat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\nmat4.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a03 = a[3],\n a12 = a[6], a13 = a[7],\n a23 = a[11];\n\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n \n return out;\n};\n\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) { \n return null; \n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));\n out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));\n return out;\n};\n\n/**\n * Calculates the determinant of a mat4\n *\n * @param {mat4} a the source matrix\n * @returns {Number} determinant of a\n */\nmat4.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n};\n\n/**\n * Multiplies two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the first operand\n * @param {mat4} b the second operand\n * @returns {mat4} out\n */\nmat4.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n // Cache only the current line of the second matrix\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; \n out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n return out;\n};\n\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\nmat4.mul = mat4.multiply;\n\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to translate\n * @param {vec3} v vector to translate by\n * @returns {mat4} out\n */\nmat4.translate = function (out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n};\n\n/**\n * Scales the mat4 by the dimensions in the given vec3\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to scale\n * @param {vec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nmat4.scale = function(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.rotate = function (out, a, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t,\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23,\n b00, b01, b02,\n b10, b11, b12,\n b20, b21, b22;\n\n if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n \n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n // Construct the elements of the rotation matrix\n b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;\n b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;\n b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;\n\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateX = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateY = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateZ = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n};\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromTranslation = function(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {vec3} v Scaling vector\n * @returns {mat4} out\n */\nmat4.fromScaling = function(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.fromRotation = function(out, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t;\n \n if (Math.abs(len) < glMatrix.EPSILON) { return null; }\n \n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n \n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n \n // Perform rotation-specific matrix multiplication\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromXRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromYRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.fromZRotation = function(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n \n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslation = function (out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n \n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @param {vec3} s Scaling vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslationScale = function (out, q, v, s) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2,\n sx = s[0],\n sy = s[1],\n sz = s[2];\n\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n \n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @param {vec3} s Scaling vector\n * @param {vec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\nmat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2,\n \n sx = s[0],\n sy = s[1],\n sz = s[2],\n\n ox = o[0],\n oy = o[1],\n oz = o[2];\n \n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);\n out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);\n out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);\n out[15] = 1;\n \n return out;\n};\n\nmat4.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.frustum = function (out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left),\n tb = 1 / (top - bottom),\n nf = 1 / (near - far);\n out[0] = (near * 2) * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = (near * 2) * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (far * near * 2) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspective = function (out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (2 * far * near) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspectiveFromFieldOfView = function (out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),\n downTan = Math.tan(fov.downDegrees * Math.PI/180.0),\n leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),\n rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n}\n\n/**\n * Generates a orthogonal projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.ortho = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {vec3} eye Position of the viewer\n * @param {vec3} center Point the viewer is looking at\n * @param {vec3} up vec3 pointing up\n * @returns {mat4} out\n */\nmat4.lookAt = function (out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,\n eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2],\n centerx = center[0],\n centery = center[1],\n centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&\n Math.abs(eyey - centery) < glMatrix.EPSILON &&\n Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return mat4.identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Returns a string representation of a mat4\n *\n * @param {mat4} mat matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nmat4.str = function (a) {\n return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +\n a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +\n a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + \n a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n};\n\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {mat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat4.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))\n};\n\n\nmodule.exports = mat4;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/mat4.js\n ** module id = 14\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\nvar mat3 = require(\"./mat3.js\");\nvar vec3 = require(\"./vec3.js\");\nvar vec4 = require(\"./vec4.js\");\n\n/**\n * @class Quaternion\n * @name quat\n */\nvar quat = {};\n\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\nquat.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {vec3} a the initial vector\n * @param {vec3} b the destination vector\n * @returns {quat} out\n */\nquat.rotationTo = (function() {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1,0,0);\n var yUnitVec3 = vec3.fromValues(0,1,0);\n\n return function(out, a, b) {\n var dot = vec3.dot(a, b);\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.length(tmpvec3) < 0.000001)\n vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n quat.setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return quat.normalize(out, out);\n }\n };\n})();\n\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {vec3} view the vector representing the viewing direction\n * @param {vec3} right the vector representing the local \"right\" direction\n * @param {vec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\nquat.setAxes = (function() {\n var matr = mat3.create();\n\n return function(out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n\n return quat.normalize(out, quat.fromMat3(out, matr));\n };\n})();\n\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {quat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\nquat.clone = vec4.clone;\n\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\nquat.fromValues = vec4.fromValues;\n\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the source quaternion\n * @returns {quat} out\n * @function\n */\nquat.copy = vec4.copy;\n\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\nquat.set = vec4.set;\n\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\nquat.identity = function(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {vec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\nquat.setAxisAngle = function(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n};\n\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n * @function\n */\nquat.add = vec4.add;\n\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n */\nquat.multiply = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n};\n\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\nquat.mul = quat.multiply;\n\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {quat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\nquat.scale = vec4.scale;\n\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateX = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateY = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n by = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateZ = function (out, a, rad) {\n rad *= 0.5; \n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bz = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n};\n\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate W component of\n * @returns {quat} out\n */\nquat.calculateW = function (out, a) {\n var x = a[0], y = a[1], z = a[2];\n\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n};\n\n/**\n * Calculates the dot product of two quat's\n *\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\nquat.dot = vec4.dot;\n\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n * @function\n */\nquat.lerp = vec4.lerp;\n\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n */\nquat.slerp = function (out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n var omega, cosom, sinom, scale0, scale1;\n\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if ( cosom < 0.0 ) {\n cosom = -cosom;\n bx = - bx;\n by = - by;\n bz = - bz;\n bw = - bw;\n }\n // calculate coefficients\n if ( (1.0 - cosom) > 0.000001 ) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else { \n // \"from\" and \"to\" quaternions are very close \n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n \n return out;\n};\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {quat} c the third operand\n * @param {quat} d the fourth operand\n * @param {Number} t interpolation amount\n * @returns {quat} out\n */\nquat.sqlerp = (function () {\n var temp1 = quat.create();\n var temp2 = quat.create();\n \n return function (out, a, b, c, d, t) {\n quat.slerp(temp1, a, d, t);\n quat.slerp(temp2, b, c, t);\n quat.slerp(out, temp1, temp2, 2 * t * (1 - t));\n \n return out;\n };\n}());\n\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate inverse of\n * @returns {quat} out\n */\nquat.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,\n invDot = dot ? 1.0/dot : 0;\n \n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0*invDot;\n out[1] = -a1*invDot;\n out[2] = -a2*invDot;\n out[3] = a3*invDot;\n return out;\n};\n\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate conjugate of\n * @returns {quat} out\n */\nquat.conjugate = function (out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Calculates the length of a quat\n *\n * @param {quat} a vector to calculate length of\n * @returns {Number} length of a\n * @function\n */\nquat.length = vec4.length;\n\n/**\n * Alias for {@link quat.length}\n * @function\n */\nquat.len = quat.length;\n\n/**\n * Calculates the squared length of a quat\n *\n * @param {quat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\nquat.squaredLength = vec4.squaredLength;\n\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\nquat.sqrLen = quat.squaredLength;\n\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\nquat.normalize = vec4.normalize;\n\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {mat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\nquat.fromMat3 = function(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if ( fTrace > 0.0 ) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5/fRoot; // 1/(4w)\n out[0] = (m[5]-m[7])*fRoot;\n out[1] = (m[6]-m[2])*fRoot;\n out[2] = (m[1]-m[3])*fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if ( m[4] > m[0] )\n i = 1;\n if ( m[8] > m[i*3+i] )\n i = 2;\n var j = (i+1)%3;\n var k = (i+2)%3;\n \n fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;\n out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;\n out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;\n }\n \n return out;\n};\n\n/**\n * Returns a string representation of a quatenion\n *\n * @param {quat} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nquat.str = function (a) {\n return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\nmodule.exports = quat;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/quat.js\n ** module id = 15\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 3 Dimensional Vector\n * @name vec3\n */\nvar vec3 = {};\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\nvec3.create = function() {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {vec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\nvec3.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\nvec3.fromValues = function(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the source vector\n * @returns {vec3} out\n */\nvec3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\nvec3.set = function(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\nvec3.sub = vec3.subtract;\n\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\nvec3.mul = vec3.multiply;\n\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\nvec3.div = vec3.divide;\n\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n};\n\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\nvec3.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n};\n\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\nvec3.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} distance between a and b\n */\nvec3.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\nvec3.dist = vec3.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec3.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\nvec3.sqrDist = vec3.squaredDistance;\n\n/**\n * Calculates the length of a vec3\n *\n * @param {vec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec3.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.length}\n * @function\n */\nvec3.len = vec3.length;\n\n/**\n * Calculates the squared length of a vec3\n *\n * @param {vec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec3.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\nvec3.sqrLen = vec3.squaredLength;\n\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to negate\n * @returns {vec3} out\n */\nvec3.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to invert\n * @returns {vec3} out\n */\nvec3.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n};\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to normalize\n * @returns {vec3} out\n */\nvec3.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var len = x*x + y*y + z*z;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec3.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n};\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.cross = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2],\n bx = b[0], by = b[1], bz = b[2];\n\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n};\n\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {vec3} c the third operand\n * @param {vec3} d the fourth operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.hermite = function (out, a, b, c, d, t) {\n var factorTimes2 = t * t,\n factor1 = factorTimes2 * (2 * t - 3) + 1,\n factor2 = factorTimes2 * (t - 2) + t,\n factor3 = factorTimes2 * (t - 1),\n factor4 = factorTimes2 * (3 - 2 * t);\n \n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n \n return out;\n};\n\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {vec3} c the third operand\n * @param {vec3} d the fourth operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.bezier = function (out, a, b, c, d, t) {\n var inverseFactor = 1 - t,\n inverseFactorTimesTwo = inverseFactor * inverseFactor,\n factorTimes2 = t * t,\n factor1 = inverseFactorTimesTwo * inverseFactor,\n factor2 = 3 * t * inverseFactorTimesTwo,\n factor3 = 3 * factorTimes2 * inverseFactor,\n factor4 = factorTimes2 * t;\n \n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n \n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\nvec3.random = function (out, scale) {\n scale = scale || 1.0;\n\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = (glMatrix.RANDOM() * 2.0) - 1.0;\n var zScale = Math.sqrt(1.0-z*z) * scale;\n\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2],\n w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat3 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n};\n\n/**\n * Transforms the vec3 with a quat\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec3} out\n */\nvec3.transformQuat = function(out, a, q) {\n // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations\n\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n};\n\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateX = function(out, a, b, c){\n var p = [], r=[];\n\t //Translate point to the origin\n\t p[0] = a[0] - b[0];\n\t p[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n\n\t //perform rotation\n\t r[0] = p[0];\n\t r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);\n\t r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);\n\n\t //translate to correct position\n\t out[0] = r[0] + b[0];\n\t out[1] = r[1] + b[1];\n\t out[2] = r[2] + b[2];\n\n \treturn out;\n};\n\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateY = function(out, a, b, c){\n \tvar p = [], r=[];\n \t//Translate point to the origin\n \tp[0] = a[0] - b[0];\n \tp[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n \n \t//perform rotation\n \tr[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);\n \tr[1] = p[1];\n \tr[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);\n \n \t//translate to correct position\n \tout[0] = r[0] + b[0];\n \tout[1] = r[1] + b[1];\n \tout[2] = r[2] + b[2];\n \n \treturn out;\n};\n\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateZ = function(out, a, b, c){\n \tvar p = [], r=[];\n \t//Translate point to the origin\n \tp[0] = a[0] - b[0];\n \tp[1] = a[1] - b[1];\n \tp[2] = a[2] - b[2];\n \n \t//perform rotation\n \tr[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);\n \tr[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);\n \tr[2] = p[2];\n \n \t//translate to correct position\n \tout[0] = r[0] + b[0];\n \tout[1] = r[1] + b[1];\n \tout[2] = r[2] + b[2];\n \n \treturn out;\n};\n\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec3.forEach = (function() {\n var vec = vec3.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 3;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];\n }\n \n return a;\n };\n})();\n\n/**\n * Get the angle between two 3D vectors\n * @param {vec3} a The first operand\n * @param {vec3} b The second operand\n * @returns {Number} The angle in radians\n */\nvec3.angle = function(a, b) {\n \n var tempA = vec3.fromValues(a[0], a[1], a[2]);\n var tempB = vec3.fromValues(b[0], b[1], b[2]);\n \n vec3.normalize(tempA, tempA);\n vec3.normalize(tempB, tempB);\n \n var cosine = vec3.dot(tempA, tempB);\n\n if(cosine > 1.0){\n return 0;\n } else {\n return Math.acos(cosine);\n } \n};\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec3} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec3.str = function (a) {\n return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n};\n\nmodule.exports = vec3;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec3.js\n ** module id = 16\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 4 Dimensional Vector\n * @name vec4\n */\nvar vec4 = {};\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\nvec4.create = function() {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {vec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\nvec4.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\nvec4.fromValues = function(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the source vector\n * @returns {vec4} out\n */\nvec4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\nvec4.set = function(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\nvec4.sub = vec4.subtract;\n\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\nvec4.mul = vec4.multiply;\n\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\nvec4.div = vec4.divide;\n\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n};\n\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\nvec4.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n};\n\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\nvec4.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n out[3] = a[3] + (b[3] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} distance between a and b\n */\nvec4.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\nvec4.dist = vec4.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec4.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\nvec4.sqrDist = vec4.squaredDistance;\n\n/**\n * Calculates the length of a vec4\n *\n * @param {vec4} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec4.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.length}\n * @function\n */\nvec4.len = vec4.length;\n\n/**\n * Calculates the squared length of a vec4\n *\n * @param {vec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec4.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\nvec4.sqrLen = vec4.squaredLength;\n\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to negate\n * @returns {vec4} out\n */\nvec4.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to invert\n * @returns {vec4} out\n */\nvec4.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n};\n\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to normalize\n * @returns {vec4} out\n */\nvec4.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var len = x*x + y*y + z*z + w*w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec4.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n};\n\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec4} out\n */\nvec4.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\nvec4.random = function (out, scale) {\n scale = scale || 1.0;\n\n //TODO: This is a pretty awful way of doing this. Find something better.\n out[0] = glMatrix.RANDOM();\n out[1] = glMatrix.RANDOM();\n out[2] = glMatrix.RANDOM();\n out[3] = glMatrix.RANDOM();\n vec4.normalize(out, out);\n vec4.scale(out, out, scale);\n return out;\n};\n\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec4} out\n */\nvec4.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n};\n\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec4} out\n */\nvec4.transformQuat = function(out, a, q) {\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec4.forEach = (function() {\n var vec = vec4.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 4;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];\n }\n \n return a;\n };\n})();\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec4} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec4.str = function (a) {\n return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n};\n\nmodule.exports = vec4;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec4.js\n ** module id = 17\n ** module chunks = 0\n **/","/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\nvar glMatrix = require(\"./common.js\");\n\n/**\n * @class 2 Dimensional Vector\n * @name vec2\n */\nvar vec2 = {};\n\n/**\n * Creates a new, empty vec2\n *\n * @returns {vec2} a new 2D vector\n */\nvec2.create = function() {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = 0;\n out[1] = 0;\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param {vec2} a vector to clone\n * @returns {vec2} a new 2D vector\n */\nvec2.clone = function(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} a new 2D vector\n */\nvec2.fromValues = function(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Copy the values from one vec2 to another\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the source vector\n * @returns {vec2} out\n */\nvec2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {vec2} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} out\n */\nvec2.set = function(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Adds two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\nvec2.sub = vec2.subtract;\n\n/**\n * Multiplies two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\nvec2.mul = vec2.multiply;\n\n/**\n * Divides two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\nvec2.div = vec2.divide;\n\n/**\n * Returns the minimum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n};\n\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec2} out\n */\nvec2.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n};\n\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec2} out\n */\nvec2.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} distance between a and b\n */\nvec2.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\nvec2.dist = vec2.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec2.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\nvec2.sqrDist = vec2.squaredDistance;\n\n/**\n * Calculates the length of a vec2\n *\n * @param {vec2} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec2.length = function (a) {\n var x = a[0],\n y = a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.length}\n * @function\n */\nvec2.len = vec2.length;\n\n/**\n * Calculates the squared length of a vec2\n *\n * @param {vec2} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec2.squaredLength = function (a) {\n var x = a[0],\n y = a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\nvec2.sqrLen = vec2.squaredLength;\n\n/**\n * Negates the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to negate\n * @returns {vec2} out\n */\nvec2.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to invert\n * @returns {vec2} out\n */\nvec2.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n};\n\n/**\n * Normalize a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to normalize\n * @returns {vec2} out\n */\nvec2.normalize = function(out, a) {\n var x = a[0],\n y = a[1];\n var len = x*x + y*y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec2.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1];\n};\n\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec3} out\n */\nvec2.cross = function(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec2} out\n */\nvec2.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec2} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec2} out\n */\nvec2.random = function (out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2d} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2d = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat3} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat3 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat4 = function(out, a, m) {\n var x = a[0], \n y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec2.forEach = (function() {\n var vec = vec2.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 2;\n }\n\n if(!offset) {\n offset = 0;\n }\n \n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1];\n }\n \n return a;\n };\n})();\n\n/**\n * Returns a string representation of a vector\n *\n * @param {vec2} vec vector to represent as a string\n * @returns {String} string representation of the vector\n */\nvec2.str = function (a) {\n return 'vec2(' + a[0] + ', ' + a[1] + ')';\n};\n\nmodule.exports = vec2;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/gl-matrix/src/gl-matrix/vec2.js\n ** module id = 18\n ** module chunks = 0\n **/","export default {\n init: function(arr, val) {\n var l = arr.length;\n while (l--) {\n arr[l] = val;\n }\n },\n\n /**\n * Shuffles the content of an array\n * @return {Array} the array itself shuffled\n */\n shuffle: function(arr) {\n var i = arr.length - 1, j, x;\n for (i; i >= 0; i--) {\n j = Math.floor(Math.random() * i);\n x = arr[i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n },\n\n toPointList: function(arr) {\n var i, j, row = [], rows = [];\n for ( i = 0; i < arr.length; i++) {\n row = [];\n for ( j = 0; j < arr[i].length; j++) {\n row[j] = arr[i][j];\n }\n rows[i] = \"[\" + row.join(\",\") + \"]\";\n }\n return \"[\" + rows.join(\",\\r\\n\") + \"]\";\n },\n\n /**\n * returns the elements which's score is bigger than the threshold\n * @return {Array} the reduced array\n */\n threshold: function(arr, threshold, scoreFunc) {\n var i, queue = [];\n for ( i = 0; i < arr.length; i++) {\n if (scoreFunc.apply(arr, [arr[i]]) >= threshold) {\n queue.push(arr[i]);\n }\n }\n return queue;\n },\n\n maxIndex: function(arr) {\n var i, max = 0;\n for ( i = 0; i < arr.length; i++) {\n if (arr[i] > arr[max]) {\n max = i;\n }\n }\n return max;\n },\n\n max: function(arr) {\n var i, max = 0;\n for ( i = 0; i < arr.length; i++) {\n if (arr[i] > max) {\n max = arr[i];\n }\n }\n return max;\n },\n\n sum: function(arr) {\n var length = arr.length,\n sum = 0;\n\n while (length--) {\n sum += arr[length];\n }\n return sum;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/array_helper.js\n **/","import ImageWrapper from './image_wrapper';\nimport CVUtils from './cv_utils';\nimport Rasterizer from './rasterizer';\nimport Tracer from './tracer';\nimport skeletonizer from './skeletonizer';\nimport ArrayHelper from './array_helper';\nimport ImageDebug from './image_debug';\nimport glMatrix from 'gl-matrix';\n\nvar _config,\n _currentImageWrapper,\n _skelImageWrapper,\n _subImageWrapper,\n _labelImageWrapper,\n _patchGrid,\n _patchLabelGrid,\n _imageToPatchGrid,\n _binaryImageWrapper,\n _patchSize,\n _canvasContainer = {\n ctx: {\n binary: null\n },\n dom: {\n binary: null\n }\n },\n _numPatches = {x: 0, y: 0},\n _inputImageWrapper,\n _skeletonizer,\n vec2 = glMatrix.vec2,\n mat2 = glMatrix.mat2,\n self = (typeof window !== 'undefined') ? window : self;\n\nfunction initBuffers() {\n var skeletonImageData;\n\n if (_config.halfSample) {\n _currentImageWrapper = new ImageWrapper({\n x: _inputImageWrapper.size.x / 2 | 0,\n y: _inputImageWrapper.size.y / 2 | 0\n });\n } else {\n _currentImageWrapper = _inputImageWrapper;\n }\n\n _patchSize = CVUtils.calculatePatchSize(_config.patchSize, _currentImageWrapper.size);\n\n _numPatches.x = _currentImageWrapper.size.x / _patchSize.x | 0;\n _numPatches.y = _currentImageWrapper.size.y / _patchSize.y | 0;\n\n _binaryImageWrapper = new ImageWrapper(_currentImageWrapper.size, undefined, Uint8Array, false);\n\n _labelImageWrapper = new ImageWrapper(_patchSize, undefined, Array, true);\n\n skeletonImageData = new ArrayBuffer(64 * 1024);\n _subImageWrapper = new ImageWrapper(_patchSize,\n new Uint8Array(skeletonImageData, 0, _patchSize.x * _patchSize.y));\n _skelImageWrapper = new ImageWrapper(_patchSize,\n new Uint8Array(skeletonImageData, _patchSize.x * _patchSize.y * 3, _patchSize.x * _patchSize.y),\n undefined, true);\n _skeletonizer = skeletonizer(self, {\n size: _patchSize.x\n }, skeletonImageData);\n\n _imageToPatchGrid = new ImageWrapper({\n x: (_currentImageWrapper.size.x / _subImageWrapper.size.x) | 0,\n y: (_currentImageWrapper.size.y / _subImageWrapper.size.y) | 0\n }, undefined, Array, true);\n _patchGrid = new ImageWrapper(_imageToPatchGrid.size, undefined, undefined, true);\n _patchLabelGrid = new ImageWrapper(_imageToPatchGrid.size, undefined, Int32Array, true);\n}\n\nfunction initCanvas() {\n if (_config.useWorker || typeof document === 'undefined') {\n return;\n }\n _canvasContainer.dom.binary = document.createElement(\"canvas\");\n _canvasContainer.dom.binary.className = \"binaryBuffer\";\n if (_config.showCanvas === true) {\n document.querySelector(\"#debug\").appendChild(_canvasContainer.dom.binary);\n }\n _canvasContainer.ctx.binary = _canvasContainer.dom.binary.getContext(\"2d\");\n _canvasContainer.dom.binary.width = _binaryImageWrapper.size.x;\n _canvasContainer.dom.binary.height = _binaryImageWrapper.size.y;\n}\n\n/**\n * Creates a bounding box which encloses all the given patches\n * @returns {Array} The minimal bounding box\n */\nfunction boxFromPatches(patches) {\n var overAvg,\n i,\n j,\n patch,\n transMat,\n minx =\n _binaryImageWrapper.size.x,\n miny = _binaryImageWrapper.size.y,\n maxx = -_binaryImageWrapper.size.x,\n maxy = -_binaryImageWrapper.size.y,\n box,\n scale;\n\n // draw all patches which are to be taken into consideration\n overAvg = 0;\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n overAvg += patch.rad;\n if (_config.showPatches) {\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: \"red\"});\n }\n }\n\n overAvg /= patches.length;\n overAvg = (overAvg * 180 / Math.PI + 90) % 180 - 90;\n if (overAvg < 0) {\n overAvg += 180;\n }\n\n overAvg = (180 - overAvg) * Math.PI / 180;\n transMat = mat2.clone([Math.cos(overAvg), Math.sin(overAvg), -Math.sin(overAvg), Math.cos(overAvg)]);\n\n // iterate over patches and rotate by angle\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n for ( j = 0; j < 4; j++) {\n vec2.transformMat2(patch.box[j], patch.box[j], transMat);\n }\n\n if (_config.boxFromPatches.showTransformed) {\n ImageDebug.drawPath(patch.box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#99ff00', lineWidth: 2});\n }\n }\n\n // find bounding box\n for ( i = 0; i < patches.length; i++) {\n patch = patches[i];\n for ( j = 0; j < 4; j++) {\n if (patch.box[j][0] < minx) {\n minx = patch.box[j][0];\n }\n if (patch.box[j][0] > maxx) {\n maxx = patch.box[j][0];\n }\n if (patch.box[j][1] < miny) {\n miny = patch.box[j][1];\n }\n if (patch.box[j][1] > maxy) {\n maxy = patch.box[j][1];\n }\n }\n }\n\n box = [[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]];\n\n if (_config.boxFromPatches.showTransformedBox) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});\n }\n\n scale = _config.halfSample ? 2 : 1;\n // reverse rotation;\n transMat = mat2.invert(transMat, transMat);\n for ( j = 0; j < 4; j++) {\n vec2.transformMat2(box[j], box[j], transMat);\n }\n\n if (_config.boxFromPatches.showBB) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});\n }\n\n for ( j = 0; j < 4; j++) {\n vec2.scale(box[j], box[j], scale);\n }\n\n return box;\n}\n\n/**\n * Creates a binary image of the current image\n */\nfunction binarizeImage() {\n CVUtils.otsuThreshold(_currentImageWrapper, _binaryImageWrapper);\n _binaryImageWrapper.zeroBorder();\n if (_config.showCanvas) {\n _binaryImageWrapper.show(_canvasContainer.dom.binary, 255);\n }\n}\n\n/**\n * Iterate over the entire image\n * extract patches\n */\nfunction findPatches() {\n var i,\n j,\n x,\n y,\n moments,\n patchesFound = [],\n rasterizer,\n rasterResult,\n patch;\n for (i = 0; i < _numPatches.x; i++) {\n for (j = 0; j < _numPatches.y; j++) {\n x = _subImageWrapper.size.x * i;\n y = _subImageWrapper.size.y * j;\n\n // seperate parts\n skeletonize(x, y);\n\n // Rasterize, find individual bars\n _skelImageWrapper.zeroBorder();\n ArrayHelper.init(_labelImageWrapper.data, 0);\n rasterizer = Rasterizer.create(_skelImageWrapper, _labelImageWrapper);\n rasterResult = rasterizer.rasterize(0);\n\n if (_config.showLabels) {\n _labelImageWrapper.overlay(_canvasContainer.dom.binary, Math.floor(360 / rasterResult.count),\n {x: x, y: y});\n }\n\n // calculate moments from the skeletonized patch\n moments = _labelImageWrapper.moments(rasterResult.count);\n\n // extract eligible patches\n patchesFound = patchesFound.concat(describePatch(moments, [i, j], x, y));\n }\n }\n\n if (_config.showFoundPatches) {\n for ( i = 0; i < patchesFound.length; i++) {\n patch = patchesFound[i];\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary,\n {color: \"#99ff00\", lineWidth: 2});\n }\n }\n\n return patchesFound;\n}\n\n/**\n * Finds those connected areas which contain at least 6 patches\n * and returns them ordered DESC by the number of contained patches\n * @param {Number} maxLabel\n */\nfunction findBiggestConnectedAreas(maxLabel){\n var i,\n sum,\n labelHist = [],\n topLabels = [];\n\n for ( i = 0; i < maxLabel; i++) {\n labelHist.push(0);\n }\n sum = _patchLabelGrid.data.length;\n while (sum--) {\n if (_patchLabelGrid.data[sum] > 0) {\n labelHist[_patchLabelGrid.data[sum] - 1]++;\n }\n }\n\n labelHist = labelHist.map(function(val, idx) {\n return {\n val: val,\n label: idx + 1\n };\n });\n\n labelHist.sort(function(a, b) {\n return b.val - a.val;\n });\n\n // extract top areas with at least 6 patches present\n topLabels = labelHist.filter(function(el) {\n return el.val >= 5;\n });\n\n return topLabels;\n}\n\n/**\n *\n */\nfunction findBoxes(topLabels, maxLabel) {\n var i,\n j,\n sum,\n patches = [],\n patch,\n box,\n boxes = [],\n hsv = [0, 1, 1],\n rgb = [0, 0, 0];\n\n for ( i = 0; i < topLabels.length; i++) {\n sum = _patchLabelGrid.data.length;\n patches.length = 0;\n while (sum--) {\n if (_patchLabelGrid.data[sum] === topLabels[i].label) {\n patch = _imageToPatchGrid.data[sum];\n patches.push(patch);\n }\n }\n box = boxFromPatches(patches);\n if (box) {\n boxes.push(box);\n\n // draw patch-labels if requested\n if (_config.showRemainingPatchLabels) {\n for ( j = 0; j < patches.length; j++) {\n patch = patches[j];\n hsv[0] = (topLabels[i].label / (maxLabel + 1)) * 360;\n CVUtils.hsv2rgb(hsv, rgb);\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary,\n {color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2});\n }\n }\n }\n }\n return boxes;\n}\n\n/**\n * Find similar moments (via cluster)\n * @param {Object} moments\n */\nfunction similarMoments(moments) {\n var clusters = CVUtils.cluster(moments, 0.90);\n var topCluster = CVUtils.topGeneric(clusters, 1, function(e) {\n return e.getPoints().length;\n });\n var points = [], result = [];\n if (topCluster.length === 1) {\n points = topCluster[0].item.getPoints();\n for (var i = 0; i < points.length; i++) {\n result.push(points[i].point);\n }\n }\n return result;\n}\n\nfunction skeletonize(x, y) {\n _binaryImageWrapper.subImageAsCopy(_subImageWrapper, CVUtils.imageRef(x, y));\n _skeletonizer.skeletonize();\n\n // Show skeleton if requested\n if (_config.showSkeleton) {\n _skelImageWrapper.overlay(_canvasContainer.dom.binary, 360, CVUtils.imageRef(x, y));\n }\n}\n\n/**\n * Extracts and describes those patches which seem to contain a barcode pattern\n * @param {Array} moments\n * @param {Object} patchPos,\n * @param {Number} x\n * @param {Number} y\n * @returns {Array} list of patches\n */\nfunction describePatch(moments, patchPos, x, y) {\n var k,\n avg,\n eligibleMoments = [],\n matchingMoments,\n patch,\n patchesFound = [],\n minComponentWeight = Math.ceil(_patchSize.x / 3);\n\n if (moments.length >= 2) {\n // only collect moments which's area covers at least minComponentWeight pixels.\n for ( k = 0; k < moments.length; k++) {\n if (moments[k].m00 > minComponentWeight) {\n eligibleMoments.push(moments[k]);\n }\n }\n\n // if at least 2 moments are found which have at least minComponentWeights covered\n if (eligibleMoments.length >= 2) {\n matchingMoments = similarMoments(eligibleMoments);\n avg = 0;\n // determine the similarity of the moments\n for ( k = 0; k < matchingMoments.length; k++) {\n avg += matchingMoments[k].rad;\n }\n\n // Only two of the moments are allowed not to fit into the equation\n // add the patch to the set\n if (matchingMoments.length > 1\n && matchingMoments.length >= (eligibleMoments.length / 4) * 3\n && matchingMoments.length > moments.length / 4) {\n avg /= matchingMoments.length;\n patch = {\n index: patchPos[1] * _numPatches.x + patchPos[0],\n pos: {\n x: x,\n y: y\n },\n box: [\n vec2.clone([x, y]),\n vec2.clone([x + _subImageWrapper.size.x, y]),\n vec2.clone([x + _subImageWrapper.size.x, y + _subImageWrapper.size.y]),\n vec2.clone([x, y + _subImageWrapper.size.y])\n ],\n moments: matchingMoments,\n rad: avg,\n vec: vec2.clone([Math.cos(avg), Math.sin(avg)])\n };\n patchesFound.push(patch);\n }\n }\n }\n return patchesFound;\n}\n\n/**\n * finds patches which are connected and share the same orientation\n * @param {Object} patchesFound\n */\nfunction rasterizeAngularSimilarity(patchesFound) {\n var label = 0,\n threshold = 0.95,\n currIdx = 0,\n j,\n patch,\n hsv = [0, 1, 1],\n rgb = [0, 0, 0];\n\n function notYetProcessed() {\n var i;\n for ( i = 0; i < _patchLabelGrid.data.length; i++) {\n if (_patchLabelGrid.data[i] === 0 && _patchGrid.data[i] === 1) {\n return i;\n }\n }\n return _patchLabelGrid.length;\n }\n\n function trace(currentIdx) {\n var x,\n y,\n currentPatch,\n patch,\n idx,\n dir,\n current = {\n x: currentIdx % _patchLabelGrid.size.x,\n y: (currentIdx / _patchLabelGrid.size.x) | 0\n },\n similarity;\n\n if (currentIdx < _patchLabelGrid.data.length) {\n currentPatch = _imageToPatchGrid.data[currentIdx];\n // assign label\n _patchLabelGrid.data[currentIdx] = label;\n for ( dir = 0; dir < Tracer.searchDirections.length; dir++) {\n y = current.y + Tracer.searchDirections[dir][0];\n x = current.x + Tracer.searchDirections[dir][1];\n idx = y * _patchLabelGrid.size.x + x;\n\n // continue if patch empty\n if (_patchGrid.data[idx] === 0) {\n _patchLabelGrid.data[idx] = Number.MAX_VALUE;\n continue;\n }\n\n patch = _imageToPatchGrid.data[idx];\n if (_patchLabelGrid.data[idx] === 0) {\n similarity = Math.abs(vec2.dot(patch.vec, currentPatch.vec));\n if (similarity > threshold) {\n trace(idx);\n }\n }\n }\n }\n }\n\n // prepare for finding the right patches\n ArrayHelper.init(_patchGrid.data, 0);\n ArrayHelper.init(_patchLabelGrid.data, 0);\n ArrayHelper.init(_imageToPatchGrid.data, null);\n\n for ( j = 0; j < patchesFound.length; j++) {\n patch = patchesFound[j];\n _imageToPatchGrid.data[patch.index] = patch;\n _patchGrid.data[patch.index] = 1;\n }\n\n // rasterize the patches found to determine area\n _patchGrid.zeroBorder();\n\n while (( currIdx = notYetProcessed()) < _patchLabelGrid.data.length) {\n label++;\n trace(currIdx);\n }\n\n // draw patch-labels if requested\n if (_config.showPatchLabels) {\n for ( j = 0; j < _patchLabelGrid.data.length; j++) {\n if (_patchLabelGrid.data[j] > 0 && _patchLabelGrid.data[j] <= label) {\n patch = _imageToPatchGrid.data[j];\n hsv[0] = (_patchLabelGrid.data[j] / (label + 1)) * 360;\n CVUtils.hsv2rgb(hsv, rgb);\n ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary,\n {color: \"rgb(\" + rgb.join(\",\") + \")\", lineWidth: 2});\n }\n }\n }\n\n return label;\n}\n\nexport default {\n init: function(inputImageWrapper, config) {\n _config = config;\n _inputImageWrapper = inputImageWrapper;\n\n initBuffers();\n initCanvas();\n },\n\n locate: function() {\n var patchesFound,\n topLabels,\n boxes;\n\n if (_config.halfSample) {\n CVUtils.halfSample(_inputImageWrapper, _currentImageWrapper);\n }\n\n binarizeImage();\n patchesFound = findPatches();\n // return unless 5% or more patches are found\n if (patchesFound.length < _numPatches.x * _numPatches.y * 0.05) {\n return null;\n }\n\n // rasterrize area by comparing angular similarity;\n var maxLabel = rasterizeAngularSimilarity(patchesFound);\n if (maxLabel < 1) {\n return null;\n }\n\n // search for area with the most patches (biggest connected area)\n topLabels = findBiggestConnectedAreas(maxLabel);\n if (topLabels.length === 0) {\n return null;\n }\n\n boxes = findBoxes(topLabels, maxLabel);\n return boxes;\n },\n\n checkImageConstraints: function(inputStream, config) {\n var patchSize,\n width = inputStream.getWidth(),\n height = inputStream.getHeight(),\n halfSample = config.halfSample ? 0.5 : 1,\n size,\n area;\n\n // calculate width and height based on area\n if (inputStream.getConfig().area) {\n area = CVUtils.computeImageArea(width, height, inputStream.getConfig().area);\n inputStream.setTopRight({x: area.sx, y: area.sy});\n inputStream.setCanvasSize({x: width, y: height});\n width = area.sw;\n height = area.sh;\n }\n\n size = {\n x: Math.floor(width * halfSample),\n y: Math.floor(height * halfSample)\n };\n\n patchSize = CVUtils.calculatePatchSize(config.patchSize, size);\n console.log(\"Patch-Size: \" + JSON.stringify(patchSize));\n\n inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / halfSample) * patchSize.x));\n inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / halfSample) * patchSize.y));\n\n if ((inputStream.getWidth() % patchSize.x) === 0 && (inputStream.getHeight() % patchSize.y) === 0) {\n return true;\n }\n\n throw new Error(\"Image dimensions do not comply with the current settings: Width (\" +\n width + \" )and height (\" + height +\n \") must a multiple of \" + patchSize.x);\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_locator.js\n **/","import Tracer from './tracer';\n\n/**\n * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n */\nvar Rasterizer = {\n createContour2D : function() {\n return {\n dir : null,\n index : null,\n firstVertex : null,\n insideContours : null,\n nextpeer : null,\n prevpeer : null\n };\n },\n CONTOUR_DIR : {\n CW_DIR : 0,\n CCW_DIR : 1,\n UNKNOWN_DIR : 2\n },\n DIR : {\n OUTSIDE_EDGE : -32767,\n INSIDE_EDGE : -32766\n },\n create : function(imageWrapper, labelWrapper) {\n var imageData = imageWrapper.data,\n labelData = labelWrapper.data,\n width = imageWrapper.size.x,\n height = imageWrapper.size.y,\n tracer = Tracer.create(imageWrapper, labelWrapper);\n\n return {\n rasterize : function(depthlabel) {\n var color,\n bc,\n lc,\n labelindex,\n cx,\n cy,\n colorMap = [],\n vertex,\n p,\n cc,\n sc,\n pos,\n connectedCount = 0,\n i;\n\n for ( i = 0; i < 400; i++) {\n colorMap[i] = 0;\n }\n\n colorMap[0] = imageData[0];\n cc = null;\n for ( cy = 1; cy < height - 1; cy++) {\n labelindex = 0;\n bc = colorMap[0];\n for ( cx = 1; cx < width - 1; cx++) {\n pos = cy * width + cx;\n if (labelData[pos] === 0) {\n color = imageData[pos];\n if (color !== bc) {\n if (labelindex === 0) {\n lc = connectedCount + 1;\n colorMap[lc] = color;\n bc = color;\n vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE);\n if (vertex !== null) {\n connectedCount++;\n labelindex = lc;\n p = Rasterizer.createContour2D();\n p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n p.index = labelindex;\n p.firstVertex = vertex;\n p.nextpeer = cc;\n p.insideContours = null;\n if (cc !== null) {\n cc.prevpeer = p;\n }\n cc = p;\n }\n } else {\n vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex);\n if (vertex !== null) {\n p = Rasterizer.createContour2D();\n p.firstVertex = vertex;\n p.insideContours = null;\n if (depthlabel === 0) {\n p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR;\n } else {\n p.dir = Rasterizer.CONTOUR_DIR.CW_DIR;\n }\n p.index = depthlabel;\n sc = cc;\n while ((sc !== null) && sc.index !== labelindex) {\n sc = sc.nextpeer;\n }\n if (sc !== null) {\n p.nextpeer = sc.insideContours;\n if (sc.insideContours !== null) {\n sc.insideContours.prevpeer = p;\n }\n sc.insideContours = p;\n }\n }\n }\n } else {\n labelData[pos] = labelindex;\n }\n } else if (labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n labelindex = 0;\n if (labelData[pos] === Rasterizer.DIR.INSIDE_EDGE) {\n bc = imageData[pos];\n } else {\n bc = colorMap[0];\n }\n } else {\n labelindex = labelData[pos];\n bc = colorMap[labelindex];\n }\n }\n }\n sc = cc;\n while (sc !== null) {\n sc.index = depthlabel;\n sc = sc.nextpeer;\n }\n return {\n cc : cc,\n count : connectedCount\n };\n },\n debug: {\n drawContour : function(canvas, firstContour) {\n var ctx = canvas.getContext(\"2d\"),\n pq = firstContour,\n iq,\n q,\n p;\n\n ctx.strokeStyle = \"red\";\n ctx.fillStyle = \"red\";\n ctx.lineWidth = 1;\n\n if (pq !== null) {\n iq = pq.insideContours;\n } else {\n iq = null;\n }\n\n while (pq !== null) {\n if (iq !== null) {\n q = iq;\n iq = iq.nextpeer;\n } else {\n q = pq;\n pq = pq.nextpeer;\n if (pq !== null) {\n iq = pq.insideContours;\n } else {\n iq = null;\n }\n }\n\n switch(q.dir) {\n case Rasterizer.CONTOUR_DIR.CW_DIR:\n ctx.strokeStyle = \"red\";\n break;\n case Rasterizer.CONTOUR_DIR.CCW_DIR:\n ctx.strokeStyle = \"blue\";\n break;\n case Rasterizer.CONTOUR_DIR.UNKNOWN_DIR:\n ctx.strokeStyle = \"green\";\n break;\n }\n\n p = q.firstVertex;\n ctx.beginPath();\n ctx.moveTo(p.x, p.y);\n do {\n p = p.next;\n ctx.lineTo(p.x, p.y);\n } while(p !== q.firstVertex);\n ctx.stroke();\n }\n }\n }\n };\n }\n};\n\nexport default Rasterizer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/rasterizer.js\n **/","/**\n * http://www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization\n */\nvar Tracer = {\n searchDirections : [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]],\n create : function(imageWrapper, labelWrapper) {\n var imageData = imageWrapper.data,\n labelData = labelWrapper.data,\n searchDirections = this.searchDirections,\n width = imageWrapper.size.x,\n pos;\n\n function trace(current, color, label, edgelabel) {\n var i,\n y,\n x;\n\n for ( i = 0; i < 7; i++) {\n y = current.cy + searchDirections[current.dir][0];\n x = current.cx + searchDirections[current.dir][1];\n pos = y * width + x;\n if ((imageData[pos] === color) && ((labelData[pos] === 0) || (labelData[pos] === label))) {\n labelData[pos] = label;\n current.cy = y;\n current.cx = x;\n return true;\n } else {\n if (labelData[pos] === 0) {\n labelData[pos] = edgelabel;\n }\n current.dir = (current.dir + 1) % 8;\n }\n }\n return false;\n }\n\n function vertex2D(x, y, dir) {\n return {\n dir : dir,\n x : x,\n y : y,\n next : null,\n prev : null\n };\n }\n\n function contourTracing(sy, sx, label, color, edgelabel) {\n var Fv = null,\n Cv,\n P,\n ldir,\n current = {\n cx : sx,\n cy : sy,\n dir : 0\n };\n\n if (trace(current, color, label, edgelabel)) {\n Fv = vertex2D(sx, sy, current.dir);\n Cv = Fv;\n ldir = current.dir;\n P = vertex2D(current.cx, current.cy, 0);\n P.prev = Cv;\n Cv.next = P;\n P.next = null;\n Cv = P;\n do {\n current.dir = (current.dir + 6) % 8;\n trace(current, color, label, edgelabel);\n if (ldir != current.dir) {\n Cv.dir = current.dir;\n P = vertex2D(current.cx, current.cy, 0);\n P.prev = Cv;\n Cv.next = P;\n P.next = null;\n Cv = P;\n } else {\n Cv.dir = ldir;\n Cv.x = current.cx;\n Cv.y = current.cy;\n }\n ldir = current.dir;\n } while(current.cx != sx || current.cy != sy);\n Fv.prev = Cv.prev;\n Cv.prev.next = Fv;\n }\n return Fv;\n }\n\n return {\n trace : function(current, color, label, edgelabel) {\n return trace(current, color, label, edgelabel);\n },\n contourTracing : function(sy, sx, label, color, edgelabel) {\n return contourTracing(sy, sx, label, color, edgelabel);\n }\n };\n }\n};\n\nexport default (Tracer);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/tracer.js\n **/","/* @preserve ASM BEGIN */\nfunction Skeletonizer(stdlib, foreign, buffer) {\n \"use asm\";\n\n var images = new stdlib.Uint8Array(buffer),\n size = foreign.size | 0,\n imul = stdlib.Math.imul;\n\n function erode(inImagePtr, outImagePtr) {\n inImagePtr = inImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var v = 0,\n u = 0,\n sum = 0,\n yStart1 = 0,\n yStart2 = 0,\n xStart1 = 0,\n xStart2 = 0,\n offset = 0;\n\n for ( v = 1; (v | 0) < ((size - 1) | 0); v = (v + 1) | 0) {\n offset = (offset + size) | 0;\n for ( u = 1; (u | 0) < ((size - 1) | 0); u = (u + 1) | 0) {\n yStart1 = (offset - size) | 0;\n yStart2 = (offset + size) | 0;\n xStart1 = (u - 1) | 0;\n xStart2 = (u + 1) | 0;\n sum = ((images[(inImagePtr + yStart1 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart1 + xStart2) | 0] | 0) + (images[(inImagePtr + offset + u) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart2) | 0] | 0)) | 0;\n if ((sum | 0) == (5 | 0)) {\n images[(outImagePtr + offset + u) | 0] = 1;\n } else {\n images[(outImagePtr + offset + u) | 0] = 0;\n }\n }\n }\n return;\n }\n\n function subtract(aImagePtr, bImagePtr, outImagePtr) {\n aImagePtr = aImagePtr | 0;\n bImagePtr = bImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(outImagePtr + length) | 0] = ((images[(aImagePtr + length) | 0] | 0) - (images[(bImagePtr + length) | 0] | 0)) | 0;\n }\n }\n\n function bitwiseOr(aImagePtr, bImagePtr, outImagePtr) {\n aImagePtr = aImagePtr | 0;\n bImagePtr = bImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(outImagePtr + length) | 0] = ((images[(aImagePtr + length) | 0] | 0) | (images[(bImagePtr + length) | 0] | 0)) | 0;\n }\n }\n\n function countNonZero(imagePtr) {\n imagePtr = imagePtr | 0;\n\n var sum = 0,\n length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n sum = ((sum | 0) + (images[(imagePtr + length) | 0] | 0)) | 0;\n }\n\n return (sum | 0);\n }\n\n function init(imagePtr, value) {\n imagePtr = imagePtr | 0;\n value = value | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(imagePtr + length) | 0] = value;\n }\n }\n\n function dilate(inImagePtr, outImagePtr) {\n inImagePtr = inImagePtr | 0;\n outImagePtr = outImagePtr | 0;\n\n var v = 0,\n u = 0,\n sum = 0,\n yStart1 = 0,\n yStart2 = 0,\n xStart1 = 0,\n xStart2 = 0,\n offset = 0;\n\n for ( v = 1; (v | 0) < ((size - 1) | 0); v = (v + 1) | 0) {\n offset = (offset + size) | 0;\n for ( u = 1; (u | 0) < ((size - 1) | 0); u = (u + 1) | 0) {\n yStart1 = (offset - size) | 0;\n yStart2 = (offset + size) | 0;\n xStart1 = (u - 1) | 0;\n xStart2 = (u + 1) | 0;\n sum = ((images[(inImagePtr + yStart1 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart1 + xStart2) | 0] | 0) + (images[(inImagePtr + offset + u) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart1) | 0] | 0) + (images[(inImagePtr + yStart2 + xStart2) | 0] | 0)) | 0;\n if ((sum | 0) > (0 | 0)) {\n images[(outImagePtr + offset + u) | 0] = 1;\n } else {\n images[(outImagePtr + offset + u) | 0] = 0;\n }\n }\n }\n return;\n }\n\n function memcpy(srcImagePtr, dstImagePtr) {\n srcImagePtr = srcImagePtr | 0;\n dstImagePtr = dstImagePtr | 0;\n\n var length = 0;\n\n length = imul(size, size) | 0;\n\n while ((length | 0) > 0) {\n length = (length - 1) | 0;\n images[(dstImagePtr + length) | 0] = (images[(srcImagePtr + length) | 0] | 0);\n }\n }\n\n function zeroBorder(imagePtr) {\n imagePtr = imagePtr | 0;\n\n var x = 0,\n y = 0;\n\n for ( x = 0; (x | 0) < ((size - 1) | 0); x = (x + 1) | 0) {\n images[(imagePtr + x) | 0] = 0;\n images[(imagePtr + y) | 0] = 0;\n y = ((y + size) - 1) | 0;\n images[(imagePtr + y) | 0] = 0;\n y = (y + 1) | 0;\n }\n for ( x = 0; (x | 0) < (size | 0); x = (x + 1) | 0) {\n images[(imagePtr + y) | 0] = 0;\n y = (y + 1) | 0;\n }\n }\n\n function skeletonize() {\n var subImagePtr = 0,\n erodedImagePtr = 0,\n tempImagePtr = 0,\n skelImagePtr = 0,\n sum = 0,\n done = 0;\n\n erodedImagePtr = imul(size, size) | 0;\n tempImagePtr = (erodedImagePtr + erodedImagePtr) | 0;\n skelImagePtr = (tempImagePtr + erodedImagePtr) | 0;\n\n // init skel-image\n init(skelImagePtr, 0);\n zeroBorder(subImagePtr);\n\n do {\n erode(subImagePtr, erodedImagePtr);\n dilate(erodedImagePtr, tempImagePtr);\n subtract(subImagePtr, tempImagePtr, tempImagePtr);\n bitwiseOr(skelImagePtr, tempImagePtr, skelImagePtr);\n memcpy(erodedImagePtr, subImagePtr);\n sum = countNonZero(subImagePtr) | 0;\n done = ((sum | 0) == 0 | 0);\n } while(!done);\n }\n\n return {\n skeletonize : skeletonize\n };\n}\n/* @preserve ASM END */\n\nexport default Skeletonizer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/skeletonizer.js\n **/","export default {\n drawRect: function(pos, size, ctx, style){\n ctx.strokeStyle = style.color;\n ctx.fillStyle = style.color;\n ctx.lineWidth = 1;\n ctx.beginPath();\n ctx.strokeRect(pos.x, pos.y, size.x, size.y);\n },\n drawPath: function(path, def, ctx, style) {\n ctx.strokeStyle = style.color;\n ctx.fillStyle = style.color;\n ctx.lineWidth = style.lineWidth;\n ctx.beginPath();\n ctx.moveTo(path[0][def.x], path[0][def.y]);\n for (var j = 1; j < path.length; j++) {\n ctx.lineTo(path[j][def.x], path[j][def.y]);\n }\n ctx.closePath();\n ctx.stroke();\n },\n drawImage: function(imageData, size, ctx) {\n var canvasData = ctx.getImageData(0, 0, size.x, size.y),\n data = canvasData.data,\n imageDataPos = imageData.length,\n canvasDataPos = data.length,\n value;\n\n if (canvasDataPos/imageDataPos !== 4) {\n return false;\n }\n while(imageDataPos--){\n value = imageData[imageDataPos];\n data[--canvasDataPos] = 255;\n data[--canvasDataPos] = value;\n data[--canvasDataPos] = value;\n data[--canvasDataPos] = value;\n }\n ctx.putImageData(canvasData, 0, 0);\n return true;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/image_debug.js\n **/","import Bresenham from './bresenham';\nimport ImageDebug from './image_debug';\nimport Code128Reader from './code_128_reader';\nimport EANReader from './ean_reader';\nimport Code39Reader from './code_39_reader';\nimport Code39VINReader from './code_39_vin_reader';\nimport CodabarReader from './codabar_reader';\nimport UPCReader from './upc_reader';\nimport EAN8Reader from './ean_8_reader';\nimport UPCEReader from './upc_e_reader';\nimport I2of5Reader from './i2of5_reader';\n\nvar readers = {\n code_128_reader: Code128Reader,\n ean_reader: EANReader,\n ean_8_reader: EAN8Reader,\n code_39_reader: Code39Reader,\n code_39_vin_reader: Code39VINReader,\n codabar_reader: CodabarReader,\n upc_reader: UPCReader,\n upc_e_reader: UPCEReader,\n i2of5_reader: I2of5Reader\n};\nexport default {\n create: function(config, inputImageWrapper) {\n var _canvas = {\n ctx: {\n frequency: null,\n pattern: null,\n overlay: null\n },\n dom: {\n frequency: null,\n pattern: null,\n overlay: null\n }\n },\n _barcodeReaders = [];\n\n initCanvas();\n initReaders();\n initConfig();\n\n function initCanvas() {\n if (typeof document !== 'undefined') {\n var $debug = document.querySelector(\"#debug.detection\");\n _canvas.dom.frequency = document.querySelector(\"canvas.frequency\");\n if (!_canvas.dom.frequency) {\n _canvas.dom.frequency = document.createElement(\"canvas\");\n _canvas.dom.frequency.className = \"frequency\";\n if ($debug) {\n $debug.appendChild(_canvas.dom.frequency);\n }\n }\n _canvas.ctx.frequency = _canvas.dom.frequency.getContext(\"2d\");\n\n _canvas.dom.pattern = document.querySelector(\"canvas.patternBuffer\");\n if (!_canvas.dom.pattern) {\n _canvas.dom.pattern = document.createElement(\"canvas\");\n _canvas.dom.pattern.className = \"patternBuffer\";\n if ($debug) {\n $debug.appendChild(_canvas.dom.pattern);\n }\n }\n _canvas.ctx.pattern = _canvas.dom.pattern.getContext(\"2d\");\n\n _canvas.dom.overlay = document.querySelector(\"canvas.drawingBuffer\");\n if (_canvas.dom.overlay) {\n _canvas.ctx.overlay = _canvas.dom.overlay.getContext(\"2d\");\n }\n }\n }\n\n function initReaders() {\n config.readers.forEach(function(readerConfig) {\n var reader,\n config = {};\n\n if (typeof readerConfig === 'object') {\n reader = readerConfig.format;\n config = readerConfig.config;\n } else if (typeof readerConfig === 'string') {\n reader = readerConfig;\n }\n console.log(\"Before registering reader: \", reader);\n _barcodeReaders.push(new readers[reader](config));\n });\n console.log(\"Registered Readers: \" + _barcodeReaders\n .map((reader) => JSON.stringify({format: reader.FORMAT, config: reader.config}))\n .join(', '));\n }\n\n function initConfig() {\n if (typeof document !== 'undefined') {\n var i,\n vis = [{\n node: _canvas.dom.frequency,\n prop: config.showFrequency\n }, {\n node: _canvas.dom.pattern,\n prop: config.showPattern\n }];\n\n for (i = 0; i < vis.length; i++) {\n if (vis[i].prop === true) {\n vis[i].node.style.display = \"block\";\n } else {\n vis[i].node.style.display = \"none\";\n }\n }\n }\n }\n\n /**\n * extend the line on both ends\n * @param {Array} line\n * @param {Number} angle\n */\n function getExtendedLine(line, angle, ext) {\n function extendLine(amount) {\n var extension = {\n y: amount * Math.sin(angle),\n x: amount * Math.cos(angle)\n };\n\n line[0].y -= extension.y;\n line[0].x -= extension.x;\n line[1].y += extension.y;\n line[1].x += extension.x;\n }\n\n // check if inside image\n extendLine(ext);\n while (ext > 1 && (!inputImageWrapper.inImageWithBorder(line[0], 0)\n || !inputImageWrapper.inImageWithBorder(line[1], 0))) {\n ext -= Math.ceil(ext / 2);\n extendLine(-ext);\n }\n return line;\n }\n\n function getLine(box) {\n return [{\n x: (box[1][0] - box[0][0]) / 2 + box[0][0],\n y: (box[1][1] - box[0][1]) / 2 + box[0][1]\n }, {\n x: (box[3][0] - box[2][0]) / 2 + box[2][0],\n y: (box[3][1] - box[2][1]) / 2 + box[2][1]\n }];\n }\n\n function tryDecode(line) {\n var result = null,\n i,\n barcodeLine = Bresenham.getBarcodeLine(inputImageWrapper, line[0], line[1]);\n\n if (config.showFrequency) {\n ImageDebug.drawPath(line, {x: 'x', y: 'y'}, _canvas.ctx.overlay, {color: 'red', lineWidth: 3});\n Bresenham.debug.printFrequency(barcodeLine.line, _canvas.dom.frequency);\n }\n Bresenham.toBinaryLine(barcodeLine);\n if (config.showPattern) {\n Bresenham.debug.printPattern(barcodeLine.line, _canvas.dom.pattern);\n }\n\n for ( i = 0; i < _barcodeReaders.length && result === null; i++) {\n result = _barcodeReaders[i].decodePattern(barcodeLine.line);\n }\n if(result === null){\n return null;\n }\n return {\n codeResult: result,\n barcodeLine: barcodeLine\n };\n\n }\n\n /**\n * This method slices the given area apart and tries to detect a barcode-pattern\n * for each slice. It returns the decoded barcode, or null if nothing was found\n * @param {Array} box\n * @param {Array} line\n * @param {Number} lineAngle\n */\n function tryDecodeBruteForce(box, line, lineAngle) {\n var sideLength = Math.sqrt(Math.pow(box[1][0] - box[0][0], 2) + Math.pow((box[1][1] - box[0][1]), 2)),\n i,\n slices = 16,\n result = null,\n dir,\n extension,\n xdir = Math.sin(lineAngle),\n ydir = Math.cos(lineAngle);\n\n for ( i = 1; i < slices && result === null; i++) {\n // move line perpendicular to angle\n dir = sideLength / slices * i * (i % 2 === 0 ? -1 : 1);\n extension = {\n y: dir * xdir,\n x: dir * ydir\n };\n line[0].y += extension.x;\n line[0].x -= extension.y;\n line[1].y += extension.x;\n line[1].x -= extension.y;\n\n result = tryDecode(line);\n }\n return result;\n }\n\n function getLineLength(line) {\n return Math.sqrt(\n Math.pow(Math.abs(line[1].y - line[0].y), 2) +\n Math.pow(Math.abs(line[1].x - line[0].x), 2));\n }\n\n /**\n * With the help of the configured readers (Code128 or EAN) this function tries to detect a\n * valid barcode pattern within the given area.\n * @param {Object} box The area to search in\n * @returns {Object} the result {codeResult, line, angle, pattern, threshold}\n */\n function decodeFromBoundingBox(box) {\n var line,\n lineAngle,\n ctx = _canvas.ctx.overlay,\n result,\n lineLength;\n\n if (config.drawBoundingBox && ctx) {\n ImageDebug.drawPath(box, {x: 0, y: 1}, ctx, {color: \"blue\", lineWidth: 2});\n }\n\n line = getLine(box);\n lineLength = getLineLength(line);\n lineAngle = Math.atan2(line[1].y - line[0].y, line[1].x - line[0].x);\n line = getExtendedLine(line, lineAngle, Math.floor(lineLength * 0.1));\n if (line === null){\n return null;\n }\n\n result = tryDecode(line);\n if (result === null) {\n result = tryDecodeBruteForce(box, line, lineAngle);\n }\n\n if (result === null) {\n return null;\n }\n\n if (result && config.drawScanline && ctx) {\n ImageDebug.drawPath(line, {x: 'x', y: 'y'}, ctx, {color: 'red', lineWidth: 3});\n }\n\n return {\n codeResult : result.codeResult,\n line : line,\n angle : lineAngle,\n pattern : result.barcodeLine.line,\n threshold : result.barcodeLine.threshold\n };\n }\n\n return {\n decodeFromBoundingBox: function(box) {\n return decodeFromBoundingBox(box);\n },\n decodeFromBoundingBoxes: function(boxes) {\n var i, result;\n for ( i = 0; i < boxes.length; i++) {\n result = decodeFromBoundingBox(boxes[i]);\n if (result && result.codeResult) {\n result.box = boxes[i];\n return result;\n }\n }\n },\n setReaders: function(readers) {\n config.readers = readers;\n _barcodeReaders.length = 0;\n initReaders();\n }\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_decoder.js\n **/","import CVUtils from './cv_utils';\nimport ImageWrapper from './image_wrapper';\n\nvar Bresenham = {};\n\nvar Slope = {\n DIR: {\n UP: 1,\n DOWN: -1\n }\n};\n/**\n * Scans a line of the given image from point p1 to p2 and returns a result object containing\n * gray-scale values (0-255) of the underlying pixels in addition to the min\n * and max values.\n * @param {Object} imageWrapper\n * @param {Object} p1 The start point {x,y}\n * @param {Object} p2 The end point {x,y}\n * @returns {line, min, max}\n */\nBresenham.getBarcodeLine = function(imageWrapper, p1, p2) {\n var x0 = p1.x | 0,\n y0 = p1.y | 0,\n x1 = p2.x | 0,\n y1 = p2.y | 0,\n steep = Math.abs(y1 - y0) > Math.abs(x1 - x0),\n deltax,\n deltay,\n error,\n ystep,\n y,\n tmp,\n x,\n line = [],\n imageData = imageWrapper.data,\n width = imageWrapper.size.x,\n sum = 0,\n val,\n min = 255,\n max = 0;\n\n function read(a, b) {\n val = imageData[b * width + a];\n sum += val;\n min = val < min ? val : min;\n max = val > max ? val : max;\n line.push(val);\n }\n\n if (steep) {\n tmp = x0;\n x0 = y0;\n y0 = tmp;\n\n tmp = x1;\n x1 = y1;\n y1 = tmp;\n }\n if (x0 > x1) {\n tmp = x0;\n x0 = x1;\n x1 = tmp;\n\n tmp = y0;\n y0 = y1;\n y1 = tmp;\n }\n deltax = x1 - x0;\n deltay = Math.abs(y1 - y0);\n error = (deltax / 2) | 0;\n y = y0;\n ystep = y0 < y1 ? 1 : -1;\n for ( x = x0; x < x1; x++) {\n if (steep){\n read(y, x);\n } else {\n read(x, y);\n }\n error = error - deltay;\n if (error < 0) {\n y = y + ystep;\n error = error + deltax;\n }\n }\n\n return {\n line: line,\n min: min,\n max: max\n };\n};\n\nBresenham.toOtsuBinaryLine = function(result) {\n var line = result.line,\n image = new ImageWrapper({x: line.length - 1, y: 1}, line),\n threshold = CVUtils.determineOtsuThreshold(image, 5);\n\n line = CVUtils.sharpenLine(line);\n CVUtils.thresholdImage(image, threshold);\n\n return {\n line: line,\n threshold: threshold\n };\n};\n\n/**\n * Converts the result from getBarcodeLine into a binary representation\n * also considering the frequency and slope of the signal for more robust results\n * @param {Object} result {line, min, max}\n */\nBresenham.toBinaryLine = function(result) {\n var min = result.min,\n max = result.max,\n line = result.line,\n slope,\n slope2,\n center = min + (max - min) / 2,\n extrema = [],\n currentDir,\n dir,\n threshold = (max - min) / 12,\n rThreshold = -threshold,\n i,\n j;\n\n // 1. find extrema\n currentDir = line[0] > center ? Slope.DIR.UP : Slope.DIR.DOWN;\n extrema.push({\n pos: 0,\n val: line[0]\n });\n for ( i = 0; i < line.length - 2; i++) {\n slope = (line[i + 1] - line[i]);\n slope2 = (line[i + 2] - line[i + 1]);\n if ((slope + slope2) < rThreshold && line[i + 1] < (center * 1.5)) {\n dir = Slope.DIR.DOWN;\n } else if ((slope + slope2) > threshold && line[i + 1] > (center * 0.5)) {\n dir = Slope.DIR.UP;\n } else {\n dir = currentDir;\n }\n\n if (currentDir !== dir) {\n extrema.push({\n pos: i,\n val: line[i]\n });\n currentDir = dir;\n }\n }\n extrema.push({\n pos: line.length,\n val: line[line.length - 1]\n });\n\n for ( j = extrema[0].pos; j < extrema[1].pos; j++) {\n line[j] = line[j] > center ? 0 : 1;\n }\n\n // iterate over extrema and convert to binary based on avg between minmax\n for ( i = 1; i < extrema.length - 1; i++) {\n if (extrema[i + 1].val > extrema[i].val) {\n threshold = (extrema[i].val + ((extrema[i + 1].val - extrema[i].val) / 3) * 2) | 0;\n } else {\n threshold = (extrema[i + 1].val + ((extrema[i].val - extrema[i + 1].val) / 3)) | 0;\n }\n\n for ( j = extrema[i].pos; j < extrema[i + 1].pos; j++) {\n line[j] = line[j] > threshold ? 0 : 1;\n }\n }\n\n return {\n line: line,\n threshold: threshold\n };\n};\n\n/**\n * Used for development only\n */\nBresenham.debug = {\n printFrequency: function(line, canvas) {\n var i,\n ctx = canvas.getContext(\"2d\");\n canvas.width = line.length;\n canvas.height = 256;\n\n ctx.beginPath();\n ctx.strokeStyle = \"blue\";\n for ( i = 0; i < line.length; i++) {\n ctx.moveTo(i, 255);\n ctx.lineTo(i, 255 - line[i]);\n }\n ctx.stroke();\n ctx.closePath();\n },\n\n printPattern: function(line, canvas) {\n var ctx = canvas.getContext(\"2d\"), i;\n\n canvas.width = line.length;\n ctx.fillColor = \"black\";\n for ( i = 0; i < line.length; i++) {\n if (line[i] === 1) {\n ctx.fillRect(i, 0, 1, 100);\n }\n }\n }\n};\n\nexport default Bresenham;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/bresenham.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction Code128Reader() {\n BarcodeReader.call(this);\n}\n\nvar properties = {\n CODE_SHIFT: {value: 98},\n CODE_C: {value: 99},\n CODE_B: {value: 100},\n CODE_A: {value: 101},\n START_CODE_A: {value: 103},\n START_CODE_B: {value: 104},\n START_CODE_C: {value: 105},\n STOP_CODE: {value: 106},\n MODULO: {value: 11},\n CODE_PATTERN: {value: [\n [2, 1, 2, 2, 2, 2],\n [2, 2, 2, 1, 2, 2],\n [2, 2, 2, 2, 2, 1],\n [1, 2, 1, 2, 2, 3],\n [1, 2, 1, 3, 2, 2],\n [1, 3, 1, 2, 2, 2],\n [1, 2, 2, 2, 1, 3],\n [1, 2, 2, 3, 1, 2],\n [1, 3, 2, 2, 1, 2],\n [2, 2, 1, 2, 1, 3],\n [2, 2, 1, 3, 1, 2],\n [2,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1, 1, 1, 1],\n [1, 1, 1, 2, 2, 4],\n [1, 1, 1, 4, 2, 2],\n [1, 2, 1, 1, 2, 4],\n [1, 2, 1, 4, 2, 1],\n [1, 4, 1, 1, 2, 2],\n [1, 4, 1, 2, 2, 1],\n [1, 1, 2, 2, 1, 4],\n [1, 1, 2, 4, 1, 2],\n [1, 2, 2, 1, 1, 4],\n [1, 2, 2, 4, 1, 1],\n [1, 4, 2, 1, 1, 2],\n [1, 4, 2, 2, 1, 1],\n [2, 4, 1, 2, 1, 1],\n [2, 2, 1, 1, 1, 4],\n [4, 1, 3, 1, 1, 1],\n [2, 4, 1, 1, 1, 2],\n [1, 3, 4, 1, 1, 1],\n [1, 1, 1, 2, 4, 2],\n [1, 2, 1, 1, 4, 2],\n [1, 2, 1, 2, 4, 1],\n [1, 1, 4, 2, 1, 2],\n [1, 2, 4, 1, 1, 2],\n [1, 2, 4, 2, 1, 1],\n [4, 1, 1, 2, 1, 2],\n [4, 2, 1, 1, 1, 2],\n [4, 2, 1, 2, 1, 1],\n [2, 1, 2, 1, 4, 1],\n [2, 1, 4, 1, 2, 1],\n [4, 1, 2, 1, 2, 1],\n [1, 1, 1, 1, 4, 3],\n [1, 1, 1, 3, 4, 1],\n [1, 3, 1, 1, 4, 1],\n [1, 1, 4, 1, 1, 3],\n [1, 1, 4, 3, 1, 1],\n [4, 1, 1, 1, 1, 3],\n [4, 1, 1, 3, 1, 1],\n [1, 1, 3, 1, 4, 1],\n [1, 1, 4, 1, 3, 1],\n [3, 1, 1, 1, 4, 1],\n [4, 1, 1, 1, 3, 1],\n [2, 1, 1, 4, 1, 2],\n [2, 1, 1, 2, 1, 4],\n [2, 1, 1, 2, 3, 2],\n [2, 3, 3, 1, 1, 1, 2]\n ]},\n SINGLE_CODE_ERROR: {value: 1},\n AVG_CODE_ERROR: {value: 0.5},\n FORMAT: {value: \"code_128\", writeable: false}\n};\n\nCode128Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nCode128Reader.prototype.constructor = Code128Reader;\n\nCode128Reader.prototype._decodeCode = function(start) {\n var counter = [0, 0, 0, 0, 0, 0],\n i,\n self = this,\n offset = start,\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error: Number.MAX_VALUE,\n code: -1,\n start: start,\n end: start\n },\n code,\n error,\n normalized;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < self.CODE_PATTERN.length; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n bestMatch.end = i;\n return bestMatch;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nCode128Reader.prototype._findStart = function() {\n var counter = [0, 0, 0, 0, 0, 0],\n i,\n self = this,\n offset = self._nextSet(self._row),\n isWhite = false,\n counterPos = 0,\n bestMatch = {\n error: Number.MAX_VALUE,\n code: -1,\n start: 0,\n end: 0\n },\n code,\n error,\n j,\n sum,\n normalized;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n if (bestMatch.error < self.AVG_CODE_ERROR) {\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n\n for ( j = 0; j < 4; j++) {\n counter[j] = counter[j + 2];\n }\n counter[4] = 0;\n counter[5] = 0;\n counterPos--;\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nCode128Reader.prototype._decode = function() {\n var self = this,\n startInfo = self._findStart(),\n code = null,\n done = false,\n result = [],\n multiplier = 0,\n checksum = 0,\n codeset,\n rawResult = [],\n decodedCodes = [],\n shiftNext = false,\n unshift;\n\n if (startInfo === null) {\n return null;\n }\n code = {\n code: startInfo.code,\n start: startInfo.start,\n end: startInfo.end\n };\n decodedCodes.push(code);\n checksum = code.code;\n switch (code.code) {\n case self.START_CODE_A:\n codeset = self.CODE_A;\n break;\n case self.START_CODE_B:\n codeset = self.CODE_B;\n break;\n case self.START_CODE_C:\n codeset = self.CODE_C;\n break;\n default:\n return null;\n }\n\n while (!done) {\n unshift = shiftNext;\n shiftNext = false;\n code = self._decodeCode(code.end);\n if (code !== null) {\n if (code.code !== self.STOP_CODE) {\n rawResult.push(code.code);\n multiplier++;\n checksum += multiplier * code.code;\n }\n decodedCodes.push(code);\n\n switch (codeset) {\n case self.CODE_A:\n if (code.code < 64) {\n result.push(String.fromCharCode(32 + code.code));\n } else if (code.code < 96) {\n result.push(String.fromCharCode(code.code - 64));\n } else {\n switch (code.code) {\n case self.CODE_SHIFT:\n shiftNext = true;\n codeset = self.CODE_B;\n break;\n case self.CODE_B:\n codeset = self.CODE_B;\n break;\n case self.CODE_C:\n codeset = self.CODE_C;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n }\n break;\n case self.CODE_B:\n if (code.code < 96) {\n result.push(String.fromCharCode(32 + code.code));\n } else {\n switch (code.code) {\n case self.CODE_SHIFT:\n shiftNext = true;\n codeset = self.CODE_A;\n break;\n case self.CODE_A:\n codeset = self.CODE_A;\n break;\n case self.CODE_C:\n codeset = self.CODE_C;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n }\n break;\n case self.CODE_C:\n if (code.code < 100) {\n result.push(code.code < 10 ? \"0\" + code.code : code.code);\n }\n switch (code.code) {\n case self.CODE_A:\n codeset = self.CODE_A;\n break;\n case self.CODE_B:\n codeset = self.CODE_B;\n break;\n case self.STOP_CODE:\n done = true;\n break;\n }\n break;\n }\n } else {\n done = true;\n }\n if (unshift) {\n codeset = codeset === self.CODE_A ? self.CODE_B : self.CODE_A;\n }\n }\n\n if (code === null) {\n return null;\n }\n\n // find end bar\n code.end = self._nextUnset(self._row, code.end);\n if (!self._verifyTrailingWhitespace(code)){\n return null;\n }\n\n // checksum\n // Does not work correctly yet!!! startcode - endcode?\n checksum -= multiplier * rawResult[rawResult.length - 1];\n if (checksum % 103 !== rawResult[rawResult.length - 1]) {\n return null;\n }\n\n if (!result.length) {\n return null;\n }\n\n // remove last code from result (checksum)\n result.splice(result.length - 1, 1);\n\n return {\n code: result.join(\"\"),\n start: startInfo.start,\n end: code.end,\n codeset: codeset,\n startInfo: startInfo,\n decodedCodes: decodedCodes,\n endInfo: code\n };\n};\n\n\nBarcodeReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start) / 2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nexport default Code128Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_128_reader.js\n **/","function BarcodeReader(config) {\n this._row = [];\n this.config = config || {};\n return this;\n}\n\nBarcodeReader.prototype._nextUnset = function(line, start) {\n var i;\n\n if (start === undefined) {\n start = 0;\n }\n for (i = start; i < line.length; i++) {\n if (!line[i]) {\n return i;\n }\n }\n return line.length;\n};\n\nBarcodeReader.prototype._matchPattern = function(counter, code) {\n var i,\n error = 0,\n singleError = 0,\n modulo = this.MODULO,\n maxSingleError = this.SINGLE_CODE_ERROR || 1;\n\n for (i = 0; i < counter.length; i++) {\n singleError = Math.abs(code[i] - counter[i]);\n if (singleError > maxSingleError) {\n return Number.MAX_VALUE;\n }\n error += singleError;\n }\n return error / modulo;\n};\n\nBarcodeReader.prototype._nextSet = function(line, offset) {\n var i;\n\n offset = offset || 0;\n for (i = offset; i < line.length; i++) {\n if (line[i]) {\n return i;\n }\n }\n return line.length;\n};\n\nBarcodeReader.prototype._normalize = function(counter, modulo) {\n var i,\n self = this,\n sum = 0,\n ratio,\n numOnes = 0,\n normalized = [],\n norm = 0;\n\n if (!modulo) {\n modulo = self.MODULO;\n }\n for (i = 0; i < counter.length; i++) {\n if (counter[i] === 1) {\n numOnes++;\n } else {\n sum += counter[i];\n }\n }\n ratio = sum / (modulo - numOnes);\n if (ratio > 1.0) {\n for (i = 0; i < counter.length; i++) {\n norm = counter[i] === 1 ? counter[i] : counter[i] / ratio;\n normalized.push(norm);\n }\n } else {\n ratio = (sum + numOnes) / modulo;\n for (i = 0; i < counter.length; i++) {\n norm = counter[i] / ratio;\n normalized.push(norm);\n }\n }\n return normalized;\n};\n\nBarcodeReader.prototype._matchTrace = function(cmpCounter, epsilon) {\n var counter = [],\n i,\n self = this,\n offset = self._nextSet(self._row),\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error: Number.MAX_VALUE,\n code: -1,\n start: 0\n },\n error;\n\n if (cmpCounter) {\n for ( i = 0; i < cmpCounter.length; i++) {\n counter.push(0);\n }\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n error = self._matchPattern(counter, cmpCounter);\n\n if (error < epsilon) {\n bestMatch.start = i - offset;\n bestMatch.end = i;\n bestMatch.counter = counter;\n return bestMatch;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n } else {\n counter.push(0);\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n counterPos++;\n counter.push(0);\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n }\n\n // if cmpCounter was not given\n bestMatch.start = offset;\n bestMatch.end = self._row.length - 1;\n bestMatch.counter = counter;\n return bestMatch;\n};\n\nBarcodeReader.prototype.decodePattern = function(pattern) {\n var self = this,\n result;\n\n self._row = pattern;\n result = self._decode();\n if (result === null) {\n self._row.reverse();\n result = self._decode();\n if (result) {\n result.direction = BarcodeReader.DIRECTION.REVERSE;\n result.start = self._row.length - result.start;\n result.end = self._row.length - result.end;\n }\n } else {\n result.direction = BarcodeReader.DIRECTION.FORWARD;\n }\n if (result) {\n result.format = self.FORMAT;\n }\n return result;\n};\n\nBarcodeReader.prototype._matchRange = function(start, end, value) {\n var i;\n\n start = start < 0 ? 0 : start;\n for (i = start; i < end; i++) {\n if (this._row[i] !== value) {\n return false;\n }\n }\n return true;\n};\n\nBarcodeReader.prototype._fillCounters = function(offset, end, isWhite) {\n var self = this,\n counterPos = 0,\n i,\n counters = [];\n\n isWhite = (typeof isWhite !== 'undefined') ? isWhite : true;\n offset = (typeof offset !== 'undefined') ? offset : self._nextUnset(self._row);\n end = end || self._row.length;\n\n counters[counterPos] = 0;\n for (i = offset; i < end; i++) {\n if (self._row[i] ^ isWhite) {\n counters[counterPos]++;\n } else {\n counterPos++;\n counters[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return counters;\n};\n\nObject.defineProperty(BarcodeReader.prototype, \"FORMAT\", {\n value: 'unknown',\n writeable: false\n});\n\nBarcodeReader.DIRECTION = {\n FORWARD: 1,\n REVERSE: -1\n};\n\nBarcodeReader.Exception = {\n StartNotFoundException: \"Start-Info was not found!\",\n CodeNotFoundException: \"Code could not be found!\",\n PatternNotFoundException: \"Pattern could not be found!\"\n};\n\nBarcodeReader.CONFIG_KEYS = {};\n\nexport default BarcodeReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/barcode_reader.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction EANReader(opts) {\n BarcodeReader.call(this, opts);\n}\n\nvar properties = {\n CODE_L_START : {value: 0},\n MODULO : {value: 7},\n CODE_G_START : {value: 10},\n START_PATTERN : {value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7]},\n STOP_PATTERN : {value: [1 / 3 * 7, 1 / 3 * 7, 1 / 3 * 7]},\n MIDDLE_PATTERN : {value: [1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7, 1 / 5 * 7]},\n CODE_PATTERN : {value: [\n [3, 2, 1, 1],\n [2, 2, 2, 1],\n [2, 1, 2, 2],\n [1, 4, 1, 1],\n [1, 1, 3, 2],\n [1, 2, 3, 1],\n [1, 1, 1, 4],\n [1, 3, 1, 2],\n [1, 2, 1, 3],\n [3, 1, 1, 2],\n [1, 1, 2, 3],\n [1, 2, 2, 2],\n [2, 2, 1, 2],\n [1, 1, 4, 1],\n [2, 3, 1, 1],\n [1, 3, 2, 1],\n [4, 1, 1, 1],\n [2, 1, 3, 1],\n [3, 1, 2, 1],\n [2, 1, 1, 3]\n ]},\n CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},\n SINGLE_CODE_ERROR: {value: 0.67},\n AVG_CODE_ERROR: {value: 0.27},\n FORMAT: {value: \"ean_13\", writeable: false}\n};\n\nEANReader.prototype = Object.create(BarcodeReader.prototype, properties);\nEANReader.prototype.constructor = EANReader;\n\nEANReader.prototype._decodeCode = function(start, coderange) {\n var counter = [0, 0, 0, 0],\n i,\n self = this,\n offset = start,\n isWhite = !self._row[offset],\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : start,\n end : start\n },\n code,\n error,\n normalized;\n\n if (!coderange) {\n coderange = self.CODE_PATTERN.length;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < coderange; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n bestMatch.end = i;\n if (bestMatch.error > self.AVG_CODE_ERROR) {\n return null;\n }\n return bestMatch;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nEANReader.prototype._findPattern = function(pattern, offset, isWhite, tryHarder, epsilon) {\n var counter = [],\n self = this,\n i,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n error,\n j,\n sum,\n normalized;\n\n if (!offset) {\n offset = self._nextSet(self._row);\n }\n\n if (isWhite === undefined) {\n isWhite = false;\n }\n\n if (tryHarder === undefined) {\n tryHarder = true;\n }\n\n if ( epsilon === undefined) {\n epsilon = self.AVG_CODE_ERROR;\n }\n\n for ( i = 0; i < pattern.length; i++) {\n counter[i] = 0;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n error = self._matchPattern(normalized, pattern);\n\n if (error < epsilon) {\n bestMatch.error = error;\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n if (tryHarder) {\n for ( j = 0; j < counter.length - 2; j++) {\n counter[j] = counter[j + 2];\n }\n counter[counter.length - 2] = 0;\n counter[counter.length - 1] = 0;\n counterPos--;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nEANReader.prototype._findStart = function() {\n var self = this,\n leadingWhitespaceStart,\n offset = self._nextSet(self._row),\n startInfo;\n\n while(!startInfo) {\n startInfo = self._findPattern(self.START_PATTERN, offset);\n if (!startInfo) {\n return null;\n }\n leadingWhitespaceStart = startInfo.start - (startInfo.end - startInfo.start);\n if (leadingWhitespaceStart >= 0) {\n if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n return startInfo;\n }\n }\n offset = startInfo.end;\n startInfo = null;\n }\n};\n\nEANReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + (endInfo.end - endInfo.start);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nEANReader.prototype._findEnd = function(offset, isWhite) {\n var self = this,\n endInfo = self._findPattern(self.STOP_PATTERN, offset, isWhite, false);\n\n return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n};\n\nEANReader.prototype._calculateFirstDigit = function(codeFrequency) {\n var i,\n self = this;\n\n for ( i = 0; i < self.CODE_FREQUENCY.length; i++) {\n if (codeFrequency === self.CODE_FREQUENCY[i]) {\n return i;\n }\n }\n return null;\n};\n\nEANReader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this,\n codeFrequency = 0x0,\n firstDigit;\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end);\n if (!code) {\n return null;\n }\n if (code.code >= self.CODE_G_START) {\n code.code = code.code - self.CODE_G_START;\n codeFrequency |= 1 << (5 - i);\n } else {\n codeFrequency |= 0 << (5 - i);\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n\n firstDigit = self._calculateFirstDigit(codeFrequency);\n if (firstDigit === null) {\n return null;\n }\n result.unshift(firstDigit);\n\n code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n if (code === null) {\n return null;\n }\n decodedCodes.push(code);\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n decodedCodes.push(code);\n result.push(code.code);\n }\n\n return code;\n};\n\nEANReader.prototype._decode = function() {\n var startInfo,\n self = this,\n code,\n result = [],\n decodedCodes = [];\n\n startInfo = self._findStart();\n if (!startInfo) {\n return null;\n }\n code = {\n code : startInfo.code,\n start : startInfo.start,\n end : startInfo.end\n };\n decodedCodes.push(code);\n code = self._decodePayload(code, result, decodedCodes);\n if (!code) {\n return null;\n }\n code = self._findEnd(code.end, false);\n if (!code){\n return null;\n }\n\n decodedCodes.push(code);\n\n // Checksum\n if (!self._checksum(result)) {\n return null;\n }\n\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : code.end,\n codeset : \"\",\n startInfo : startInfo,\n decodedCodes : decodedCodes\n };\n};\n\nEANReader.prototype._checksum = function(result) {\n var sum = 0, i;\n\n for ( i = result.length - 2; i >= 0; i -= 2) {\n sum += result[i];\n }\n sum *= 3;\n for ( i = result.length - 1; i >= 0; i -= 2) {\n sum += result[i];\n }\n return sum % 10 === 0;\n};\n\nexport default (EANReader);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ean_reader.js\n **/","import BarcodeReader from './barcode_reader';\nimport ArrayHelper from './array_helper';\n\nfunction Code39Reader() {\n BarcodeReader.call(this);\n}\n\nvar properties = {\n ALPHABETH_STRING: {value: \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%\"},\n ALPHABET: {value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,\n 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 45, 46, 32, 42, 36, 47, 43, 37]},\n CHARACTER_ENCODINGS: {value: [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049,\n 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106,\n 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, 0x0A8, 0x0A2, 0x08A, 0x02A\n ]},\n ASTERISK: {value: 0x094},\n FORMAT: {value: \"code_39\", writeable: false}\n};\n\nCode39Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nCode39Reader.prototype.constructor = Code39Reader;\n\nCode39Reader.prototype._toCounters = function(start, counter) {\n var self = this,\n numCounters = counter.length,\n end = self._row.length,\n isWhite = !self._row[start],\n i,\n counterPos = 0;\n\n ArrayHelper.init(counter, 0);\n\n for ( i = start; i < end; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n counterPos++;\n if (counterPos === numCounters) {\n break;\n } else {\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n }\n\n return counter;\n};\n\nCode39Reader.prototype._decode = function() {\n var self = this,\n counters = [0, 0, 0, 0, 0, 0, 0, 0, 0],\n result = [],\n start = self._findStart(),\n decodedChar,\n lastStart,\n pattern,\n nextStart;\n\n if (!start) {\n return null;\n }\n nextStart = self._nextSet(self._row, start.end);\n\n do {\n counters = self._toCounters(nextStart, counters);\n pattern = self._toPattern(counters);\n if (pattern < 0) {\n return null;\n }\n decodedChar = self._patternToChar(pattern);\n if (decodedChar < 0){\n return null;\n }\n result.push(decodedChar);\n lastStart = nextStart;\n nextStart += ArrayHelper.sum(counters);\n nextStart = self._nextSet(self._row, nextStart);\n } while (decodedChar !== '*');\n result.pop();\n\n if (!result.length) {\n return null;\n }\n\n if (!self._verifyTrailingWhitespace(lastStart, nextStart, counters)) {\n return null;\n }\n\n return {\n code: result.join(\"\"),\n start: start.start,\n end: nextStart,\n startInfo: start,\n decodedCodes: result\n };\n};\n\nCode39Reader.prototype._verifyTrailingWhitespace = function(lastStart, nextStart, counters) {\n var trailingWhitespaceEnd,\n patternSize = ArrayHelper.sum(counters);\n\n trailingWhitespaceEnd = nextStart - lastStart - patternSize;\n if ((trailingWhitespaceEnd * 3) >= patternSize) {\n return true;\n }\n return false;\n};\n\nCode39Reader.prototype._patternToChar = function(pattern) {\n var i,\n self = this;\n\n for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n if (self.CHARACTER_ENCODINGS[i] === pattern) {\n return String.fromCharCode(self.ALPHABET[i]);\n }\n }\n};\n\nCode39Reader.prototype._findNextWidth = function(counters, current) {\n var i,\n minWidth = Number.MAX_VALUE;\n\n for (i = 0; i < counters.length; i++) {\n if (counters[i] < minWidth && counters[i] > current) {\n minWidth = counters[i];\n }\n }\n\n return minWidth;\n};\n\nCode39Reader.prototype._toPattern = function(counters) {\n var numCounters = counters.length,\n maxNarrowWidth = 0,\n numWideBars = numCounters,\n wideBarWidth = 0,\n self = this,\n pattern,\n i;\n\n while (numWideBars > 3) {\n maxNarrowWidth = self._findNextWidth(counters, maxNarrowWidth);\n numWideBars = 0;\n pattern = 0;\n for (i = 0; i < numCounters; i++) {\n if (counters[i] > maxNarrowWidth) {\n pattern |= 1 << (numCounters - 1 - i);\n numWideBars++;\n wideBarWidth += counters[i];\n }\n }\n\n if (numWideBars === 3) {\n for (i = 0; i < numCounters && numWideBars > 0; i++) {\n if (counters[i] > maxNarrowWidth) {\n numWideBars--;\n if ((counters[i] * 2) >= wideBarWidth) {\n return -1;\n }\n }\n }\n return pattern;\n }\n }\n return -1;\n};\n\nCode39Reader.prototype._findStart = function() {\n var self = this,\n offset = self._nextSet(self._row),\n patternStart = offset,\n counter = [0, 0, 0, 0, 0, 0, 0, 0, 0],\n counterPos = 0,\n isWhite = false,\n i,\n j,\n whiteSpaceMustStart;\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n // find start pattern\n if (self._toPattern(counter) === self.ASTERISK) {\n whiteSpaceMustStart = Math.floor(Math.max(0, patternStart - ((i - patternStart) / 4)));\n if (self._matchRange(whiteSpaceMustStart, patternStart, 0)) {\n return {\n start: patternStart,\n end: i\n };\n }\n }\n\n patternStart += counter[0] + counter[1];\n for ( j = 0; j < 7; j++) {\n counter[j] = counter[j + 2];\n }\n counter[7] = 0;\n counter[8] = 0;\n counterPos--;\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nexport default Code39Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_39_reader.js\n **/","import Code39Reader from './code_39_reader';\n\nfunction Code39VINReader() {\n Code39Reader.call(this);\n}\n\nvar patterns = {\n IOQ: /[IOQ]/g,\n AZ09: /[A-Z0-9]{17}/\n};\n\nCode39VINReader.prototype = Object.create(Code39Reader.prototype);\nCode39VINReader.prototype.constructor = Code39VINReader;\n\n// Cribbed from:\n// /~https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/VINResultParser.java\nCode39VINReader.prototype._decode = function() {\n var result = Code39Reader.prototype._decode.apply(this);\n if (!result) {\n return null;\n }\n\n var code = result.code;\n\n if (!code) {\n return;\n }\n\n code = code.replace(patterns.IOQ, '');\n\n if (!code.match(patterns.AZ09)) {\n console.log('Failed AZ09 pattern code:', code);\n return null;\n }\n\n if (!this._checkChecksum(code)) {\n return null;\n }\n\n result.code = code;\n return result;\n};\n\nCode39VINReader.prototype._checkChecksum = function(code) {\n // TODO\n return !!code;\n};\n\nexport default Code39VINReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/code_39_vin_reader.js\n **/","import BarcodeReader from './barcode_reader';\n\nfunction CodabarReader() {\n BarcodeReader.call(this);\n this._counters = [];\n}\n\nvar properties = {\n ALPHABETH_STRING: {value: \"0123456789-$:/.+ABCD\"},\n ALPHABET: {value: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 36, 58, 47, 46, 43, 65, 66, 67, 68]},\n CHARACTER_ENCODINGS: {value: [0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018,\n 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E]},\n START_END: {value: [0x01A, 0x029, 0x00B, 0x00E]},\n MIN_ENCODED_CHARS: {value: 4},\n MAX_ACCEPTABLE: {value: 2.0},\n PADDING: {value: 1.5},\n FORMAT: {value: \"codabar\", writeable: false}\n};\n\nCodabarReader.prototype = Object.create(BarcodeReader.prototype, properties);\nCodabarReader.prototype.constructor = CodabarReader;\n\nCodabarReader.prototype._decode = function() {\n var self = this,\n result = [],\n start,\n decodedChar,\n pattern,\n nextStart,\n end;\n\n this._counters = self._fillCounters();\n start = self._findStart();\n if (!start) {\n return null;\n }\n nextStart = start.startCounter;\n\n do {\n pattern = self._toPattern(nextStart);\n if (pattern < 0) {\n return null;\n }\n decodedChar = self._patternToChar(pattern);\n if (decodedChar < 0){\n return null;\n }\n result.push(decodedChar);\n nextStart += 8;\n if (result.length > 1 && self._isStartEnd(pattern)) {\n break;\n }\n } while (nextStart < self._counters.length);\n\n // verify end\n if ((result.length - 2) < self.MIN_ENCODED_CHARS || !self._isStartEnd(pattern)) {\n return null;\n }\n\n // verify end white space\n if (!self._verifyWhitespace(start.startCounter, nextStart - 8)){\n return null;\n }\n\n if (!self._validateResult(result, start.startCounter)){\n return null;\n }\n\n nextStart = nextStart > self._counters.length ? self._counters.length : nextStart;\n end = start.start + self._sumCounters(start.startCounter, nextStart - 8);\n\n return {\n code: result.join(\"\"),\n start: start.start,\n end: end,\n startInfo: start,\n decodedCodes: result\n };\n};\n\nCodabarReader.prototype._verifyWhitespace = function(startCounter, endCounter) {\n if ((startCounter - 1 <= 0)\n || this._counters[startCounter - 1] >= (this._calculatePatternLength(startCounter) / 2.0)) {\n if ((endCounter + 8 >= this._counters.length)\n || this._counters[endCounter + 7] >= (this._calculatePatternLength(endCounter) / 2.0)) {\n return true;\n }\n }\n return false;\n};\n\nCodabarReader.prototype._calculatePatternLength = function(offset) {\n var i,\n sum = 0;\n\n for (i = offset; i < offset + 7; i++) {\n sum += this._counters[i];\n }\n\n return sum;\n};\n\nCodabarReader.prototype._thresholdResultPattern = function(result, startCounter){\n var self = this,\n categorization = {\n space: {\n narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE},\n wide: {size: 0, counts: 0, min: 0, max: Number.MAX_VALUE}\n },\n bar: {\n narrow: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE},\n wide: { size: 0, counts: 0, min: 0, max: Number.MAX_VALUE}\n }\n },\n kind,\n cat,\n i,\n j,\n pos = startCounter,\n pattern;\n\n for (i = 0; i < result.length; i++){\n pattern = self._charToPattern(result[i]);\n for (j = 6; j >= 0; j--) {\n kind = (j & 1) === 2 ? categorization.bar : categorization.space;\n cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n cat.size += self._counters[pos + j];\n cat.counts++;\n pattern >>= 1;\n }\n pos += 8;\n }\n\n [\"space\", \"bar\"].forEach(function(key) {\n var kind = categorization[key];\n kind.wide.min = Math.floor((kind.narrow.size / kind.narrow.counts + kind.wide.size / kind.wide.counts) / 2);\n kind.narrow.max = Math.ceil(kind.wide.min);\n kind.wide.max = Math.ceil((kind.wide.size * self.MAX_ACCEPTABLE + self.PADDING) / kind.wide.counts);\n });\n\n return categorization;\n};\n\nCodabarReader.prototype._charToPattern = function(char) {\n var self = this,\n charCode = char.charCodeAt(0),\n i;\n\n for (i = 0; i < self.ALPHABET.length; i++) {\n if (self.ALPHABET[i] === charCode){\n return self.CHARACTER_ENCODINGS[i];\n }\n }\n return 0x0;\n};\n\nCodabarReader.prototype._validateResult = function(result, startCounter) {\n var self = this,\n thresholds = self._thresholdResultPattern(result, startCounter),\n i,\n j,\n kind,\n cat,\n size,\n pos = startCounter,\n pattern;\n\n for (i = 0; i < result.length; i++) {\n pattern = self._charToPattern(result[i]);\n for (j = 6; j >= 0; j--) {\n kind = (j & 1) === 0 ? thresholds.bar : thresholds.space;\n cat = (pattern & 1) === 1 ? kind.wide : kind.narrow;\n size = self._counters[pos + j];\n if (size < cat.min || size > cat.max) {\n return false;\n }\n pattern >>= 1;\n }\n pos += 8;\n }\n return true;\n};\n\nCodabarReader.prototype._patternToChar = function(pattern) {\n var i,\n self = this;\n\n for (i = 0; i < self.CHARACTER_ENCODINGS.length; i++) {\n if (self.CHARACTER_ENCODINGS[i] === pattern) {\n return String.fromCharCode(self.ALPHABET[i]);\n }\n }\n return -1;\n};\n\nCodabarReader.prototype._computeAlternatingThreshold = function(offset, end) {\n var i,\n min = Number.MAX_VALUE,\n max = 0,\n counter;\n\n for (i = offset; i < end; i += 2){\n counter = this._counters[i];\n if (counter > max) {\n max = counter;\n }\n if (counter < min) {\n min = counter;\n }\n }\n\n return ((min + max) / 2.0) | 0;\n};\n\nCodabarReader.prototype._toPattern = function(offset) {\n var numCounters = 7,\n end = offset + numCounters,\n barThreshold,\n spaceThreshold,\n bitmask = 1 << (numCounters - 1),\n pattern = 0,\n i,\n threshold;\n\n if (end > this._counters.length) {\n return -1;\n }\n\n barThreshold = this._computeAlternatingThreshold(offset, end);\n spaceThreshold = this._computeAlternatingThreshold(offset + 1, end);\n\n for (i = 0; i < numCounters; i++){\n threshold = (i & 1) === 0 ? barThreshold : spaceThreshold;\n if (this._counters[offset + i] > threshold) {\n pattern |= bitmask;\n }\n bitmask >>= 1;\n }\n\n return pattern;\n};\n\nCodabarReader.prototype._isStartEnd = function(pattern) {\n var i;\n\n for (i = 0; i < this.START_END.length; i++) {\n if (this.START_END[i] === pattern) {\n return true;\n }\n }\n return false;\n};\n\nCodabarReader.prototype._sumCounters = function(start, end) {\n var i,\n sum = 0;\n\n for (i = start; i < end; i++) {\n sum += this._counters[i];\n }\n return sum;\n};\n\nCodabarReader.prototype._findStart = function() {\n var self = this,\n i,\n pattern,\n start = self._nextUnset(self._row),\n end;\n\n for (i = 1; i < this._counters.length; i++) {\n pattern = self._toPattern(i);\n if (pattern !== -1 && self._isStartEnd(pattern)) {\n // TODO: Look for whitespace ahead\n start += self._sumCounters(0, i);\n end = start + self._sumCounters(i, i + 8);\n return {\n start: start,\n end: end,\n startCounter: i,\n endCounter: i + 8\n };\n }\n }\n};\n\nexport default CodabarReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/codabar_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction UPCReader() {\n EANReader.call(this);\n}\n\nvar properties = {\n FORMAT: {value: \"upc_a\", writeable: false}\n};\n\nUPCReader.prototype = Object.create(EANReader.prototype, properties);\nUPCReader.prototype.constructor = UPCReader;\n\nUPCReader.prototype._decode = function() {\n var result = EANReader.prototype._decode.call(this);\n\n console.log(\"result\", result);\n if (result && result.code && result.code.length === 13 && result.code.charAt(0) === \"0\") {\n result.code = result.code.substring(1);\n return result;\n }\n return null;\n};\n\nexport default UPCReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/upc_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction EAN8Reader() {\n EANReader.call(this);\n}\n\nvar properties = {\n FORMAT: {value: \"ean_8\", writeable: false}\n};\n\nEAN8Reader.prototype = Object.create(EANReader.prototype, properties);\nEAN8Reader.prototype.constructor = EAN8Reader;\n\nEAN8Reader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this;\n\n for ( i = 0; i < 4; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n\n code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);\n if (code === null) {\n return null;\n }\n decodedCodes.push(code);\n\n for ( i = 0; i < 4; i++) {\n code = self._decodeCode(code.end, self.CODE_G_START);\n if (!code) {\n return null;\n }\n decodedCodes.push(code);\n result.push(code.code);\n }\n\n return code;\n};\n\nexport default EAN8Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/ean_8_reader.js\n **/","import EANReader from './ean_reader';\n\nfunction UPCEReader() {\n EANReader.call(this);\n}\n\nvar properties = {\n CODE_FREQUENCY : {value: [\n [ 56, 52, 50, 49, 44, 38, 35, 42, 41, 37 ],\n [7, 11, 13, 14, 19, 25, 28, 21, 22, 26]]},\n STOP_PATTERN: { value: [1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7, 1 / 6 * 7]},\n FORMAT: {value: \"upc_e\", writeable: false}\n};\n\nUPCEReader.prototype = Object.create(EANReader.prototype, properties);\nUPCEReader.prototype.constructor = UPCEReader;\n\nUPCEReader.prototype._decodePayload = function(code, result, decodedCodes) {\n var i,\n self = this,\n codeFrequency = 0x0;\n\n for ( i = 0; i < 6; i++) {\n code = self._decodeCode(code.end);\n if (!code) {\n return null;\n }\n if (code.code >= self.CODE_G_START) {\n code.code = code.code - self.CODE_G_START;\n codeFrequency |= 1 << (5 - i);\n }\n result.push(code.code);\n decodedCodes.push(code);\n }\n if (!self._determineParity(codeFrequency, result)) {\n return null;\n }\n\n return code;\n};\n\nUPCEReader.prototype._determineParity = function(codeFrequency, result) {\n var self =this,\n i,\n nrSystem;\n\n for (nrSystem = 0; nrSystem < self.CODE_FREQUENCY.length; nrSystem++){\n for ( i = 0; i < self.CODE_FREQUENCY[nrSystem].length; i++) {\n if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {\n result.unshift(nrSystem);\n result.push(i);\n return true;\n }\n }\n }\n return false;\n};\n\nUPCEReader.prototype._convertToUPCA = function(result) {\n var upca = [result[0]],\n lastDigit = result[result.length - 2];\n\n if (lastDigit <= 2) {\n upca = upca.concat(result.slice(1, 3))\n .concat([lastDigit, 0, 0, 0, 0])\n .concat(result.slice(3, 6));\n } else if (lastDigit === 3) {\n upca = upca.concat(result.slice(1, 4))\n .concat([0 ,0, 0, 0, 0])\n .concat(result.slice(4,6));\n } else if (lastDigit === 4) {\n upca = upca.concat(result.slice(1, 5))\n .concat([0, 0, 0, 0, 0, result[5]]);\n } else {\n upca = upca.concat(result.slice(1, 6))\n .concat([0, 0, 0, 0, lastDigit]);\n }\n\n upca.push(result[result.length - 1]);\n return upca;\n};\n\nUPCEReader.prototype._checksum = function(result) {\n return EANReader.prototype._checksum.call(this, this._convertToUPCA(result));\n};\n\nUPCEReader.prototype._findEnd = function(offset, isWhite) {\n isWhite = true;\n return EANReader.prototype._findEnd.call(this, offset, isWhite);\n};\n\nUPCEReader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start)/2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n};\n\nexport default UPCEReader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/upc_e_reader.js\n **/","import BarcodeReader from './barcode_reader';\nconst merge = require('lodash/object/merge');\n\nfunction I2of5Reader(opts) {\n opts = merge(getDefaulConfig(), opts);\n BarcodeReader.call(this, opts);\n this.barSpaceRatio = [1, 1];\n if (opts.normalizeBarSpaceWidth) {\n this.SINGLE_CODE_ERROR = 0.38;\n this.AVG_CODE_ERROR = 0.09;\n }\n}\n\nfunction getDefaulConfig() {\n var config = {};\n\n Object.keys(I2of5Reader.CONFIG_KEYS).forEach(function(key) {\n config[key] = I2of5Reader.CONFIG_KEYS[key]['default'];\n });\n return config;\n}\n\nvar N = 1,\n W = 3,\n properties = {\n MODULO : {value: 10},\n START_PATTERN : {value: [N*2.5, N*2.5, N*2.5, N*2.5]},\n STOP_PATTERN : {value: [N*2, N*2, W*2]},\n CODE_PATTERN : {value: [\n [N, N, W, W, N],\n [W, N, N, N, W],\n [N, W, N, N, W],\n [W, W, N, N, N],\n [N, N, W, N, W],\n [W, N, W, N, N],\n [N, W, W, N, N],\n [N, N, N, W, W],\n [W, N, N, W, N],\n [N, W, N, W, N]\n ]},\n SINGLE_CODE_ERROR: {value: 0.78, writable: true},\n AVG_CODE_ERROR: {value: 0.38, writable: true},\n MAX_CORRECTION_FACTOR: {value: 5},\n FORMAT: {value: \"i2of5\"}\n};\n\nI2of5Reader.prototype = Object.create(BarcodeReader.prototype, properties);\nI2of5Reader.prototype.constructor = I2of5Reader;\n\nI2of5Reader.prototype._matchPattern = function(counter, code) {\n if (this.config.normalizeBarSpaceWidth) {\n var i,\n counterSum = [0, 0],\n codeSum = [0, 0],\n correction = [0, 0],\n correctionRatio = this.MAX_CORRECTION_FACTOR,\n correctionRatioInverse = 1 / correctionRatio;\n\n for (i = 0; i < counter.length; i++) {\n counterSum[i % 2] += counter[i];\n codeSum[i % 2] += code[i];\n }\n correction[0] = codeSum[0] / counterSum[0];\n correction[1] = codeSum[1] / counterSum[1];\n\n correction[0] = Math.max(Math.min(correction[0], correctionRatio), correctionRatioInverse);\n correction[1] = Math.max(Math.min(correction[1], correctionRatio), correctionRatioInverse);\n this.barSpaceRatio = correction;\n for (i = 0; i < counter.length; i++) {\n counter[i] *= this.barSpaceRatio[i % 2];\n }\n }\n return BarcodeReader.prototype._matchPattern.call(this, counter, code);\n};\n\nI2of5Reader.prototype._findPattern = function(pattern, offset, isWhite, tryHarder) {\n var counter = [],\n self = this,\n i,\n counterPos = 0,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n },\n error,\n j,\n sum,\n normalized,\n epsilon = self.AVG_CODE_ERROR;\n\n isWhite = isWhite || false;\n tryHarder = tryHarder || false;\n\n if (!offset) {\n offset = self._nextSet(self._row);\n }\n\n for ( i = 0; i < pattern.length; i++) {\n counter[i] = 0;\n }\n\n for ( i = offset; i < self._row.length; i++) {\n if (self._row[i] ^ isWhite) {\n counter[counterPos]++;\n } else {\n if (counterPos === counter.length - 1) {\n sum = 0;\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n error = self._matchPattern(normalized, pattern);\n\n if (error < epsilon) {\n bestMatch.error = error;\n bestMatch.start = i - sum;\n bestMatch.end = i;\n return bestMatch;\n }\n }\n if (tryHarder) {\n for (j = 0; j < counter.length - 2; j++) {\n counter[j] = counter[j + 2];\n }\n counter[counter.length - 2] = 0;\n counter[counter.length - 1] = 0;\n counterPos--;\n } else {\n return null;\n }\n } else {\n counterPos++;\n }\n counter[counterPos] = 1;\n isWhite = !isWhite;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._findStart = function() {\n var self = this,\n leadingWhitespaceStart,\n offset = self._nextSet(self._row),\n startInfo,\n narrowBarWidth = 1;\n\n while(!startInfo) {\n startInfo = self._findPattern(self.START_PATTERN, offset, false, true);\n if (!startInfo) {\n return null;\n }\n narrowBarWidth = Math.floor((startInfo.end - startInfo.start) / 4);\n leadingWhitespaceStart = startInfo.start - narrowBarWidth*10;\n if (leadingWhitespaceStart >= 0) {\n if (self._matchRange(leadingWhitespaceStart, startInfo.start, 0)) {\n return startInfo;\n }\n }\n offset = startInfo.end;\n startInfo = null;\n }\n};\n\nI2of5Reader.prototype._verifyTrailingWhitespace = function(endInfo) {\n var self = this,\n trailingWhitespaceEnd;\n\n trailingWhitespaceEnd = endInfo.end + ((endInfo.end - endInfo.start) / 2);\n if (trailingWhitespaceEnd < self._row.length) {\n if (self._matchRange(endInfo.end, trailingWhitespaceEnd, 0)) {\n return endInfo;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._findEnd = function() {\n var self = this,\n endInfo,\n tmp;\n\n self._row.reverse();\n endInfo = self._findPattern(self.STOP_PATTERN);\n self._row.reverse();\n\n if (endInfo === null) {\n return null;\n }\n\n // reverse numbers\n tmp = endInfo.start;\n endInfo.start = self._row.length - endInfo.end;\n endInfo.end = self._row.length - tmp;\n\n return endInfo !== null ? self._verifyTrailingWhitespace(endInfo) : null;\n};\n\nI2of5Reader.prototype._decodePair = function(counterPair) {\n var i,\n code,\n codes = [],\n self = this;\n\n for (i = 0; i < counterPair.length; i++) {\n code = self._decodeCode(counterPair[i]);\n if (!code) {\n return null;\n }\n codes.push(code);\n }\n return codes;\n};\n\nI2of5Reader.prototype._decodeCode = function(counter) {\n var j,\n self = this,\n sum = 0,\n normalized,\n error,\n epsilon = self.AVG_CODE_ERROR,\n code,\n bestMatch = {\n error : Number.MAX_VALUE,\n code : -1,\n start : 0,\n end : 0\n };\n\n for ( j = 0; j < counter.length; j++) {\n sum += counter[j];\n }\n normalized = self._normalize(counter);\n if (normalized) {\n for (code = 0; code < self.CODE_PATTERN.length; code++) {\n error = self._matchPattern(normalized, self.CODE_PATTERN[code]);\n if (error < bestMatch.error) {\n bestMatch.code = code;\n bestMatch.error = error;\n }\n }\n if (bestMatch.error < epsilon) {\n return bestMatch;\n }\n }\n return null;\n};\n\nI2of5Reader.prototype._decodePayload = function(counters, result, decodedCodes) {\n var i,\n self = this,\n pos = 0,\n counterLength = counters.length,\n counterPair = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]],\n codes;\n\n while (pos < counterLength) {\n for (i = 0; i < 5; i++) {\n counterPair[0][i] = counters[pos]*this.barSpaceRatio[0];\n counterPair[1][i] = counters[pos + 1]*this.barSpaceRatio[1];\n pos += 2;\n }\n codes = self._decodePair(counterPair);\n if (!codes) {\n return null;\n }\n for (i = 0; i < codes.length; i++) {\n result.push(codes[i].code + \"\");\n decodedCodes.push(codes[i]);\n }\n }\n return codes;\n};\n\nI2of5Reader.prototype._verifyCounterLength = function(counters) {\n return (counters.length % 10 === 0);\n};\n\nI2of5Reader.prototype._decode = function() {\n var startInfo,\n endInfo,\n self = this,\n code,\n result = [],\n decodedCodes = [],\n counters;\n\n startInfo = self._findStart();\n if (!startInfo) {\n return null;\n }\n decodedCodes.push(startInfo);\n\n endInfo = self._findEnd();\n if (!endInfo) {\n return null;\n }\n\n counters = self._fillCounters(startInfo.end, endInfo.start, false);\n if (!self._verifyCounterLength(counters)) {\n return null;\n }\n code = self._decodePayload(counters, result, decodedCodes);\n if (!code) {\n return null;\n }\n if (result.length % 2 !== 0 ||\n result.length < 6) {\n return null;\n }\n\n decodedCodes.push(endInfo);\n return {\n code : result.join(\"\"),\n start : startInfo.start,\n end : endInfo.end,\n startInfo : startInfo,\n decodedCodes : decodedCodes\n };\n};\n\nI2of5Reader.CONFIG_KEYS = {\n normalizeBarSpaceWidth: {\n 'type': 'boolean',\n 'default': false,\n 'description': 'If true, the reader tries to normalize the' +\n 'width-difference between bars and spaces'\n }\n};\n\nexport default I2of5Reader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/i2of5_reader.js\n **/","var baseMerge = require('../internal/baseMerge'),\n createAssigner = require('../internal/createAssigner');\n\n/**\n * Recursively merges own enumerable properties of the source object(s), that\n * don't resolve to `undefined` into the destination object. Subsequent sources\n * overwrite property assignments of previous sources. If `customizer` is\n * provided it's invoked to produce the merged values of the destination and\n * source properties. If `customizer` returns `undefined` merging is handled\n * by the method instead. The `customizer` is bound to `thisArg` and invoked\n * with five arguments: (objectValue, sourceValue, key, object, source).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var users = {\n * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n * };\n *\n * var ages = {\n * 'data': [{ 'age': 36 }, { 'age': 40 }]\n * };\n *\n * _.merge(users, ages);\n * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n *\n * // using a customizer callback\n * var object = {\n * 'fruits': ['apple'],\n * 'vegetables': ['beet']\n * };\n *\n * var other = {\n * 'fruits': ['banana'],\n * 'vegetables': ['carrot']\n * };\n *\n * _.merge(object, other, function(a, b) {\n * if (_.isArray(a)) {\n * return a.concat(b);\n * }\n * });\n * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n */\nvar merge = createAssigner(baseMerge);\n\nmodule.exports = merge;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/merge.js\n ** module id = 37\n ** module chunks = 0\n **/","var arrayEach = require('./arrayEach'),\n baseMergeDeep = require('./baseMergeDeep'),\n isArray = require('../lang/isArray'),\n isArrayLike = require('./isArrayLike'),\n isObject = require('../lang/isObject'),\n isObjectLike = require('./isObjectLike'),\n isTypedArray = require('../lang/isTypedArray'),\n keys = require('../object/keys');\n\n/**\n * The base implementation of `_.merge` without support for argument juggling,\n * multiple sources, and `this` binding `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {Object} Returns `object`.\n */\nfunction baseMerge(object, source, customizer, stackA, stackB) {\n if (!isObject(object)) {\n return object;\n }\n var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n props = isSrcArr ? undefined : keys(source);\n\n arrayEach(props || source, function(srcValue, key) {\n if (props) {\n key = srcValue;\n srcValue = source[key];\n }\n if (isObjectLike(srcValue)) {\n stackA || (stackA = []);\n stackB || (stackB = []);\n baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n }\n else {\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n }\n if ((result !== undefined || (isSrcArr && !(key in object))) &&\n (isCommon || (result === result ? (result !== value) : (value === value)))) {\n object[key] = result;\n }\n }\n });\n return object;\n}\n\nmodule.exports = baseMerge;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseMerge.js\n ** module id = 38\n ** module chunks = 0\n **/","/**\n * A specialized version of `_.forEach` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/arrayEach.js\n ** module id = 39\n ** module chunks = 0\n **/","var arrayCopy = require('./arrayCopy'),\n isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isArrayLike = require('./isArrayLike'),\n isPlainObject = require('../lang/isPlainObject'),\n isTypedArray = require('../lang/isTypedArray'),\n toPlainObject = require('../lang/toPlainObject');\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n var length = stackA.length,\n srcValue = source[key];\n\n while (length--) {\n if (stackA[length] == srcValue) {\n object[key] = stackB[length];\n return;\n }\n }\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n result = isArray(value)\n ? value\n : (isArrayLike(value) ? arrayCopy(value) : []);\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n result = isArguments(value)\n ? toPlainObject(value)\n : (isPlainObject(value) ? value : {});\n }\n else {\n isCommon = false;\n }\n }\n // Add the source value to the stack of traversed objects and associate\n // it with its merged value.\n stackA.push(srcValue);\n stackB.push(result);\n\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n } else if (result === result ? (result !== value) : (value === value)) {\n object[key] = result;\n }\n}\n\nmodule.exports = baseMergeDeep;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseMergeDeep.js\n ** module id = 40\n ** module chunks = 0\n **/","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction arrayCopy(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = arrayCopy;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/arrayCopy.js\n ** module id = 41\n ** module chunks = 0\n **/","var isArrayLike = require('../internal/isArrayLike'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Native method references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is classified as an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n return isObjectLike(value) && isArrayLike(value) &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n}\n\nmodule.exports = isArguments;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isArguments.js\n ** module id = 42\n ** module chunks = 0\n **/","var getLength = require('./getLength'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\nfunction isArrayLike(value) {\n return value != null && isLength(getLength(value));\n}\n\nmodule.exports = isArrayLike;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isArrayLike.js\n ** module id = 43\n ** module chunks = 0\n **/","var baseProperty = require('./baseProperty');\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\nmodule.exports = getLength;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/getLength.js\n ** module id = 44\n ** module chunks = 0\n **/","/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseProperty.js\n ** module id = 45\n ** module chunks = 0\n **/","/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isLength.js\n ** module id = 46\n ** module chunks = 0\n **/","/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isObjectLike.js\n ** module id = 47\n ** module chunks = 0\n **/","var getNative = require('../internal/getNative'),\n isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\nmodule.exports = isArray;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isArray.js\n ** module id = 48\n ** module chunks = 0\n **/","var isNative = require('../lang/isNative');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/getNative.js\n ** module id = 49\n ** module chunks = 0\n **/","var isFunction = require('./isFunction'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isNative;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isNative.js\n ** module id = 50\n ** module chunks = 0\n **/","var isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, 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 older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 which returns 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\nmodule.exports = isFunction;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isFunction.js\n ** module id = 51\n ** module chunks = 0\n **/","/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\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(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isObject.js\n ** module id = 52\n ** module chunks = 0\n **/","var baseForIn = require('../internal/baseForIn'),\n isArguments = require('./isArguments'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * **Note:** This method assumes objects created by the `Object` constructor\n * have no inherited enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n var Ctor;\n\n // Exit early for non `Object` objects.\n if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n return false;\n }\n // IE < 9 iterates inherited properties before own properties. If the first\n // iterated property is an object's own property then there are no inherited\n // enumerable properties.\n var result;\n // In most environments an object's own properties are iterated before\n // its inherited properties. If the last iterated property is an object's\n // own property then there are no inherited enumerable properties.\n baseForIn(value, function(subValue, key) {\n result = key;\n });\n return result === undefined || hasOwnProperty.call(value, result);\n}\n\nmodule.exports = isPlainObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isPlainObject.js\n ** module id = 53\n ** module chunks = 0\n **/","var baseFor = require('./baseFor'),\n keysIn = require('../object/keysIn');\n\n/**\n * The base implementation of `_.forIn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForIn(object, iteratee) {\n return baseFor(object, iteratee, keysIn);\n}\n\nmodule.exports = baseForIn;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseForIn.js\n ** module id = 54\n ** module chunks = 0\n **/","var createBaseFor = require('./createBaseFor');\n\n/**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseFor.js\n ** module id = 55\n ** module chunks = 0\n **/","var toObject = require('./toObject');\n\n/**\n * Creates a base function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var iterable = toObject(object),\n props = keysFunc(object),\n length = props.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n var key = props[index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/createBaseFor.js\n ** module id = 56\n ** module chunks = 0\n **/","var isObject = require('../lang/isObject');\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/toObject.js\n ** module id = 57\n ** module chunks = 0\n **/","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('../internal/isIndex'),\n isLength = require('../internal/isLength'),\n isObject = require('../lang/isObject');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n if (object == null) {\n return [];\n }\n if (!isObject(object)) {\n object = Object(object);\n }\n var length = object.length;\n length = (length && isLength(length) &&\n (isArray(object) || isArguments(object)) && length) || 0;\n\n var Ctor = object.constructor,\n index = -1,\n isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n result = Array(length),\n skipIndexes = length > 0;\n\n while (++index < length) {\n result[index] = (index + '');\n }\n for (var key in object) {\n if (!(skipIndexes && isIndex(key, length)) &&\n !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keysIn;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/keysIn.js\n ** module id = 58\n ** module chunks = 0\n **/","/** Used to detect unsigned integer values. */\nvar reIsUint = /^\\d+$/;\n\n/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\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 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\nmodule.exports = isIndex;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isIndex.js\n ** module id = 59\n ** module chunks = 0\n **/","var isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dateTag] = typedArrayTags[errorTag] =\ntypedArrayTags[funcTag] = typedArrayTags[mapTag] =\ntypedArrayTags[numberTag] = typedArrayTags[objectTag] =\ntypedArrayTags[regexpTag] = typedArrayTags[setTag] =\ntypedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nfunction isTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n}\n\nmodule.exports = isTypedArray;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/isTypedArray.js\n ** module id = 60\n ** module chunks = 0\n **/","var baseCopy = require('../internal/baseCopy'),\n keysIn = require('../object/keysIn');\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable\n * properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return baseCopy(value, keysIn(value));\n}\n\nmodule.exports = toPlainObject;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/lang/toPlainObject.js\n ** module id = 61\n ** module chunks = 0\n **/","/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction baseCopy(source, props, object) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n object[key] = source[key];\n }\n return object;\n}\n\nmodule.exports = baseCopy;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/baseCopy.js\n ** module id = 62\n ** module chunks = 0\n **/","var getNative = require('../internal/getNative'),\n isArrayLike = require('../internal/isArrayLike'),\n isObject = require('../lang/isObject'),\n shimKeys = require('../internal/shimKeys');\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = getNative(Object, 'keys');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nvar keys = !nativeKeys ? shimKeys : function(object) {\n var Ctor = object == null ? undefined : object.constructor;\n if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n (typeof object != 'function' && isArrayLike(object))) {\n return shimKeys(object);\n }\n return isObject(object) ? nativeKeys(object) : [];\n};\n\nmodule.exports = keys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/object/keys.js\n ** module id = 63\n ** module chunks = 0\n **/","var isArguments = require('../lang/isArguments'),\n isArray = require('../lang/isArray'),\n isIndex = require('./isIndex'),\n isLength = require('./isLength'),\n keysIn = require('../object/keysIn');\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction shimKeys(object) {\n var props = keysIn(object),\n propsLength = props.length,\n length = propsLength && object.length;\n\n var allowIndexes = !!length && isLength(length) &&\n (isArray(object) || isArguments(object));\n\n var index = -1,\n result = [];\n\n while (++index < propsLength) {\n var key = props[index];\n if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = shimKeys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/shimKeys.js\n ** module id = 64\n ** module chunks = 0\n **/","var bindCallback = require('./bindCallback'),\n isIterateeCall = require('./isIterateeCall'),\n restParam = require('../function/restParam');\n\n/**\n * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return restParam(function(object, sources) {\n var index = -1,\n length = object == null ? 0 : sources.length,\n customizer = length > 2 ? sources[length - 2] : undefined,\n guard = length > 2 ? sources[2] : undefined,\n thisArg = length > 1 ? sources[length - 1] : undefined;\n\n if (typeof customizer == 'function') {\n customizer = bindCallback(customizer, thisArg, 5);\n length -= 2;\n } else {\n customizer = typeof thisArg == 'function' ? thisArg : undefined;\n length -= (customizer ? 1 : 0);\n }\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/createAssigner.js\n ** module id = 65\n ** module chunks = 0\n **/","var identity = require('../utility/identity');\n\n/**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\nfunction bindCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n if (thisArg === undefined) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n case 5: return function(value, other, key, object, source) {\n return func.call(thisArg, value, other, key, object, source);\n };\n }\n return function() {\n return func.apply(thisArg, arguments);\n };\n}\n\nmodule.exports = bindCallback;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/bindCallback.js\n ** module id = 66\n ** module chunks = 0\n **/","/**\n * This method returns the first argument provided to it.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'user': 'fred' };\n *\n * _.identity(object) === object;\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/utility/identity.js\n ** module id = 67\n ** module chunks = 0\n **/","var isArrayLike = require('./isArrayLike'),\n isIndex = require('./isIndex'),\n isObject = require('../lang/isObject');\n\n/**\n * Checks if the provided 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, 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 var other = object[index];\n return value === value ? (value === other) : (other !== other);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/internal/isIterateeCall.js\n ** module id = 68\n ** module chunks = 0\n **/","/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction restParam(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n rest = Array(length);\n\n while (++index < length) {\n rest[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, args[0], rest);\n case 2: return func.call(this, args[0], args[1], rest);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = rest;\n return func.apply(this, otherArgs);\n };\n}\n\nmodule.exports = restParam;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash/function/restParam.js\n ** module id = 69\n ** module chunks = 0\n **/","import CVUtils from './cv_utils';\n\nvar FrameGrabber = {};\n\nFrameGrabber.create = function(inputStream, canvas) {\n var _that = {},\n _streamConfig = inputStream.getConfig(),\n _video_size = CVUtils.imageRef(inputStream.getRealWidth(), inputStream.getRealHeight()),\n _canvasSize = inputStream.getCanvasSize(),\n _size = CVUtils.imageRef(inputStream.getWidth(), inputStream.getHeight()),\n topRight = inputStream.getTopRight(),\n _sx = topRight.x,\n _sy = topRight.y,\n _canvas,\n _ctx = null,\n _data = null;\n\n _canvas = canvas ? canvas : document.createElement(\"canvas\");\n _canvas.width = _canvasSize.x;\n _canvas.height = _canvasSize.y;\n _ctx = _canvas.getContext(\"2d\");\n _data = new Uint8Array(_size.x * _size.y);\n console.log(\"FrameGrabber\", JSON.stringify({\n size: _size,\n topRight: topRight,\n videoSize: _video_size,\n canvasSize: _canvasSize\n }));\n\n /**\n * Uses the given array as frame-buffer\n */\n _that.attachData = function(data) {\n _data = data;\n };\n\n /**\n * Returns the used frame-buffer\n */\n _that.getData = function() {\n return _data;\n };\n\n /**\n * Fetches a frame from the input-stream and puts into the frame-buffer.\n * The image-data is converted to gray-scale and then half-sampled if configured.\n */\n _that.grab = function() {\n var doHalfSample = _streamConfig.halfSample,\n frame = inputStream.getFrame(),\n ctxData;\n if (frame) {\n _ctx.drawImage(frame, 0, 0, _canvasSize.x, _canvasSize.y);\n ctxData = _ctx.getImageData(_sx, _sy, _size.x, _size.y).data;\n if(doHalfSample){\n CVUtils.grayAndHalfSampleFromCanvasData(ctxData, _size, _data);\n } else {\n CVUtils.computeGray(ctxData, _data, _streamConfig);\n }\n return true;\n } else {\n return false;\n }\n };\n\n _that.getSize = function() {\n return _size;\n };\n\n return _that;\n};\n\nexport default FrameGrabber;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/frame_grabber.js\n **/","export default {\n inputStream: {\n name: \"Live\",\n type: \"LiveStream\",\n constraints: {\n width: 640,\n height: 480,\n minAspectRatio: 0,\n maxAspectRatio: 100,\n facing: \"environment\" // or user\n },\n area: {\n top: \"0%\",\n right: \"0%\",\n left: \"0%\",\n bottom: \"0%\"\n },\n singleChannel: false // true: only the red color-channel is read\n },\n tracking: false,\n debug: false,\n controls: false,\n locate: true,\n numOfWorkers: 4,\n visual: {\n show: true\n },\n decoder: {\n drawBoundingBox: false,\n showFrequency: false,\n drawScanline: false,\n showPattern: false,\n readers: [\n 'code_128_reader'\n ]\n },\n locator: {\n halfSample: true,\n patchSize: \"medium\", // x-small, small, medium, large, x-large\n showCanvas: false,\n showPatches: false,\n showFoundPatches: false,\n showSkeleton: false,\n showLabels: false,\n showPatchLabels: false,\n showRemainingPatchLabels: false,\n boxFromPatches: {\n showTransformed: false,\n showTransformedBox: false,\n showBB: false\n }\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/config.js\n **/","export default function() {\n var events = {};\n\n function getEvent(eventName) {\n if (!events[eventName]) {\n events[eventName] = {\n subscribers : []\n };\n }\n return events[eventName];\n }\n\n function clearEvents(){\n events = {};\n }\n\n function publishSubscription(subscription, data) {\n if (subscription.async) {\n setTimeout(function() {\n subscription.callback(data);\n }, 4);\n } else {\n subscription.callback(data);\n }\n }\n\n function subscribe(event, callback, async) {\n var subscription;\n\n if ( typeof callback === \"function\") {\n subscription = {\n callback : callback,\n async : async\n };\n } else {\n subscription = callback;\n if (!subscription.callback) {\n throw \"Callback was not specified on options\";\n }\n }\n\n getEvent(event).subscribers.push(subscription);\n }\n\n return {\n subscribe : function(event, callback, async) {\n return subscribe(event, callback, async);\n },\n publish : function(eventName, data) {\n var event = getEvent(eventName),\n subscribers = event.subscribers;\n\n event.subscribers = subscribers.filter(function(subscriber) {\n publishSubscription(subscriber, data);\n return !subscriber.once;\n });\n },\n once: function(event, callback, async) {\n subscribe(event, {\n callback: callback,\n async: async,\n once: true\n });\n },\n unsubscribe: function(eventName, callback) {\n var event;\n\n if (eventName) {\n event = getEvent(eventName);\n if (event && callback) {\n event.subscribers = event.subscribers.filter(function(subscriber){\n return subscriber.callback !== callback;\n });\n } else {\n event.subscribers = [];\n }\n } else {\n clearEvents();\n }\n }\n };\n}();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/events.js\n **/","const merge = require('lodash/object/merge');\n\nvar streamRef,\n loadedDataHandler;\n\n/**\n * Wraps browser-specific getUserMedia\n * @param {Object} constraints\n * @param {Object} success Callback\n * @param {Object} failure Callback\n */\nfunction getUserMedia(constraints, success, failure) {\n if (typeof navigator.getUserMedia !== 'undefined') {\n navigator.getUserMedia(constraints, function (stream) {\n streamRef = stream;\n var videoSrc = (window.URL && window.URL.createObjectURL(stream)) || stream;\n success.apply(null, [videoSrc]);\n }, failure);\n } else {\n failure(new TypeError(\"getUserMedia not available\"));\n }\n}\n\nfunction loadedData(video, callback) {\n var attempts = 10;\n\n function checkVideo() {\n if (attempts > 0) {\n if (video.videoWidth > 0 && video.videoHeight > 0) {\n console.log(video.videoWidth + \"px x \" + video.videoHeight + \"px\");\n callback();\n } else {\n window.setTimeout(checkVideo, 500);\n }\n } else {\n callback('Unable to play video stream. Is webcam working?');\n }\n attempts--;\n }\n checkVideo();\n}\n\n/**\n * Tries to attach the camera-stream to a given video-element\n * and calls the callback function when the content is ready\n * @param {Object} constraints\n * @param {Object} video\n * @param {Object} callback\n */\nfunction initCamera(constraints, video, callback) {\n getUserMedia(constraints, function(src) {\n video.src = src;\n if (loadedDataHandler) {\n video.removeEventListener(\"loadeddata\", loadedDataHandler, false);\n }\n loadedDataHandler = loadedData.bind(null, video, callback);\n video.addEventListener('loadeddata', loadedDataHandler, false);\n video.play();\n }, function(e) {\n callback(e);\n });\n}\n\n/**\n * Normalizes the incoming constraints to satisfy the current browser\n * @param config\n * @param cb Callback which is called whenever constraints are created\n * @returns {*}\n */\nfunction normalizeConstraints(config, cb) {\n var constraints = {\n audio: false,\n video: true\n },\n videoConstraints = merge({\n width: 640,\n height: 480,\n minAspectRatio: 0,\n maxAspectRatio: 100,\n facing: \"environment\"\n }, config);\n\n if ( typeof MediaStreamTrack !== 'undefined' && typeof MediaStreamTrack.getSources !== 'undefined') {\n MediaStreamTrack.getSources(function(sourceInfos) {\n var videoSourceId;\n for (var i = 0; i < sourceInfos.length; ++i) {\n var sourceInfo = sourceInfos[i];\n if (sourceInfo.kind === \"video\" && sourceInfo.facing === videoConstraints.facing) {\n videoSourceId = sourceInfo.id;\n }\n }\n constraints.video = {\n mandatory: {\n minWidth: videoConstraints.width,\n minHeight: videoConstraints.height,\n minAspectRatio: videoConstraints.minAspectRatio,\n maxAspectRatio: videoConstraints.maxAspectRatio\n },\n optional: [{\n sourceId: videoSourceId\n }]\n };\n return cb(constraints);\n });\n } else {\n constraints.video = {\n mediaSource: \"camera\",\n width: { min: videoConstraints.width, max: videoConstraints.width },\n height: { min: videoConstraints.height, max: videoConstraints.height },\n require: [\"width\", \"height\"]\n };\n return cb(constraints);\n }\n}\n\n/**\n * Requests the back-facing camera of the user. The callback is called\n * whenever the stream is ready to be consumed, or if an error occures.\n * @param {Object} video\n * @param {Object} callback\n */\nfunction request(video, videoConstraints, callback) {\n normalizeConstraints(videoConstraints, function(constraints) {\n initCamera(constraints, video, callback);\n });\n}\n\nexport default {\n request: function(video, constraints, callback) {\n request(video, constraints, callback);\n },\n release: function() {\n var tracks = streamRef && streamRef.getVideoTracks();\n if (tracks.length) {\n tracks[0].stop();\n }\n streamRef = null;\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/camera_access.js\n **/","import ImageDebug from './image_debug';\n\nfunction contains(codeResult, list) {\n if (list) {\n return list.some(function (item) {\n return Object.keys(item).every(function (key) {\n return item[key] === codeResult[key];\n });\n });\n }\n return false;\n}\n\nfunction passesFilter(codeResult, filter) {\n if (typeof filter === 'function') {\n return filter(codeResult);\n }\n return true;\n}\n\nexport default {\n create: function(config) {\n var canvas = document.createElement(\"canvas\"),\n ctx = canvas.getContext(\"2d\"),\n results = [],\n capacity = config.capacity || 20,\n capture = config.capture === true;\n\n function matchesConstraints(codeResult) {\n return capacity && codeResult && !contains(codeResult, config.blacklist) && passesFilter(codeResult, config.filter);\n }\n\n return {\n addResult: function(data, imageSize, codeResult) {\n var result = {};\n\n if (matchesConstraints(codeResult)) {\n capacity--;\n result.codeResult = codeResult;\n if (capture) {\n canvas.width = imageSize.x;\n canvas.height = imageSize.y;\n ImageDebug.drawImage(data, imageSize, ctx);\n result.frame = canvas.toDataURL();\n }\n results.push(result);\n }\n },\n getResults: function() {\n return results;\n }\n };\n }\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/result_collector.js\n **/"],"sourceRoot":""}
\ No newline at end of file
diff --git a/example/file_input.html b/example/file_input.html
index a1571232..6435ed61 100644
--- a/example/file_input.html
+++ b/example/file_input.html
@@ -101,8 +101,8 @@ Working with file-input
© Copyright by Christoph Oberhofer