diff --git a/README.md b/README.md index 00a73a20..2ffa9d78 100644 --- a/README.md +++ b/README.md @@ -118,14 +118,14 @@ Download or get the CDN link to the script: | Name | Supported barcodes | Size (gzip) | CDN / Download | |------|--------------------|:-----------:|---------------:| -| *All* | *All the barcodes!* | *7.9 kB* | *[JsBarcode.all.min.js][1]* | -| CODE128 | CODE128 (auto and force mode) | 5.3 kB | [JsBarcode.code128.min.js][2] | +| *All* | *All the barcodes!* | *8.1 kB* | *[JsBarcode.all.min.js][1]* | +| CODE128 | CODE128 (auto and force mode) | 5.4 kB | [JsBarcode.code128.min.js][2] | | CODE39 | CODE39 | 4.6 kB | [JsBarcode.code39.min.js][3] | -| EAN / UPC | EAN-13, EAN-8, EAN-5, EAN-2, UPC (A) | 5.1 kB | [JsBarcode.ean-upc.min.js][4] | -| ITF-14 | ITF-14 | 4.3 kB | [JsBarcode.itf-14.min.js][5] | +| EAN / UPC | EAN-13, EAN-8, EAN-5, EAN-2, UPC (A) | 5.2 kB | [JsBarcode.ean-upc.min.js][4] | +| ITF-14 | ITF-14 | 4.4 kB | [JsBarcode.itf-14.min.js][5] | | ITF | ITF | 4.3 kB | [JsBarcode.itf.min.js][6] | -| MSI | MSI, MSI10, MSI11, MSI1010, MSI1110 | 4.5 kB | [JsBarcode.msi.min.js][7] | -| Pharmacode | Pharmacode | 4.1 kB | [JsBarcode.pharmacode.min.js][8] | +| MSI | MSI, MSI10, MSI11, MSI1010, MSI1110 | 4.6 kB | [JsBarcode.msi.min.js][7] | +| Pharmacode | Pharmacode | 4.2 kB | [JsBarcode.pharmacode.min.js][8] | ### Step 2: Include the script in your code: diff --git a/bin/JsBarcode.js b/bin/JsBarcode.js index acf9ec29..d614d090 100644 --- a/bin/JsBarcode.js +++ b/bin/JsBarcode.js @@ -26,7 +26,7 @@ var _ErrorHandler2 = _interopRequireDefault(_ErrorHandler); var _exceptions = require('./exceptions/exceptions.js'); -var _defaults = require('./defaults/defaults.js'); +var _defaults = require('./options/defaults.js'); var _defaults2 = _interopRequireDefault(_defaults); diff --git a/bin/barcodes/Barcode.js b/bin/barcodes/Barcode.js new file mode 100644 index 00000000..7138786d --- /dev/null +++ b/bin/barcodes/Barcode.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Barcode = function Barcode(data, options) { + _classCallCheck(this, Barcode); + + this.data = data; + this.text = options.text || data; + this.options = options; +}; + +exports.default = Barcode; \ No newline at end of file diff --git a/bin/barcodes/CODE128/CODE128.js b/bin/barcodes/CODE128/CODE128.js index d97cd023..38add81f 100644 --- a/bin/barcodes/CODE128/CODE128.js +++ b/bin/barcodes/CODE128/CODE128.js @@ -4,27 +4,38 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// This is the master class, it does require the start code to be +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // This is the master class, it does require the start code to be // included in the string -var CODE128 = function () { - function CODE128(string) { + +var CODE128 = function (_Barcode) { + _inherits(CODE128, _Barcode); + + function CODE128(data, options) { _classCallCheck(this, CODE128); // Fill the bytes variable with the ascii codes of string - this.bytes = []; - for (var i = 0; i < string.length; ++i) { - this.bytes.push(string.charCodeAt(i)); - } + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data.substring(1), options)); - // First element should be startcode, remove that - this.string = string.substring(1); + _this.bytes = []; + for (var i = 0; i < data.length; ++i) { + _this.bytes.push(data.charCodeAt(i)); + } // Data for each character, the last characters will not be encoded but are used for error correction // Numbers encode to (n + 1000) -> binary; 740 -> (740 + 1000).toString(2) -> "11011001100" - this.encodings = [// + 1000 + _this.encodings = [// + 1000 740, 644, 638, 176, 164, 100, 224, 220, 124, 608, 604, 572, 436, 244, 230, 484, 260, 254, 650, 628, 614, 764, 652, 902, 868, 836, 830, 892, 844, 842, 752, 734, 590, 304, 112, 94, 416, 128, 122, 672, 576, 570, 464, 422, 134, 496, 478, 142, 910, 678, 582, 768, 762, 774, 880, 862, 814, 896, 890, 818, 914, 602, 930, 328, 292, 200, 158, 68, 62, 424, 412, 232, 218, 76, 74, 554, 616, 978, 556, 146, 340, 212, 182, 508, 268, 266, 956, 940, 938, 758, 782, 974, 400, 310, 118, 512, 506, 960, 954, 502, 518, 886, 966, /* Start codes */668, 680, 692, 5379]; + return _this; } // The public encoding function @@ -46,7 +57,7 @@ var CODE128 = function () { } return { - text: this.string.replace(/[^\x20-\x7E]/g, ""), + text: this.text.replace(/[^\x20-\x7E]/g, ""), data: // Add the start bits this.getEncoding(startIndex) + @@ -68,7 +79,7 @@ var CODE128 = function () { CODE128.prototype.valid = function valid() { // ASCII value ranges 0-127, 200-211 - return this.string.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1; + return this.data.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1; }; CODE128.prototype.nextA = function nextA(bytes, depth) { @@ -215,6 +226,6 @@ var CODE128 = function () { }; return CODE128; -}(); +}(_Barcode3.default); exports.default = CODE128; \ No newline at end of file diff --git a/bin/barcodes/CODE128/CODE128A.js b/bin/barcodes/CODE128/CODE128A.js index 71dbafb0..41db84f6 100644 --- a/bin/barcodes/CODE128/CODE128A.js +++ b/bin/barcodes/CODE128/CODE128A.js @@ -19,14 +19,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128A = function (_CODE) { _inherits(CODE128A, _CODE); - function CODE128A(string) { + function CODE128A(string, options) { _classCallCheck(this, CODE128A); - return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(208) + string)); + return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(208) + string, options)); } CODE128A.prototype.valid = function valid() { - return this.string.search(/^[\x00-\x5F\xC8-\xCF]+$/) !== -1; + return this.data.search(/^[\x00-\x5F\xC8-\xCF]+$/) !== -1; }; return CODE128A; diff --git a/bin/barcodes/CODE128/CODE128B.js b/bin/barcodes/CODE128/CODE128B.js index c84d5cd7..96c4c413 100644 --- a/bin/barcodes/CODE128/CODE128B.js +++ b/bin/barcodes/CODE128/CODE128B.js @@ -19,14 +19,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128B = function (_CODE) { _inherits(CODE128B, _CODE); - function CODE128B(string) { + function CODE128B(string, options) { _classCallCheck(this, CODE128B); - return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(209) + string)); + return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(209) + string, options)); } CODE128B.prototype.valid = function valid() { - return this.string.search(/^[\x20-\x7F\xC8-\xCF]+$/) !== -1; + return this.data.search(/^[\x20-\x7F\xC8-\xCF]+$/) !== -1; }; return CODE128B; diff --git a/bin/barcodes/CODE128/CODE128C.js b/bin/barcodes/CODE128/CODE128C.js index 6d78cf32..fca2d74f 100644 --- a/bin/barcodes/CODE128/CODE128C.js +++ b/bin/barcodes/CODE128/CODE128C.js @@ -19,14 +19,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128C = function (_CODE) { _inherits(CODE128C, _CODE); - function CODE128C(string) { + function CODE128C(string, options) { _classCallCheck(this, CODE128C); - return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(210) + string)); + return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(210) + string, options)); } CODE128C.prototype.valid = function valid() { - return this.string.search(/^(\xCF*[0-9]{2}\xCF*)+$/) !== -1; + return this.data.search(/^(\xCF*[0-9]{2}\xCF*)+$/) !== -1; }; return CODE128C; diff --git a/bin/barcodes/CODE128/CODE128_AUTO.js b/bin/barcodes/CODE128/CODE128_AUTO.js index ca9258a1..ff8c49dd 100644 --- a/bin/barcodes/CODE128/CODE128_AUTO.js +++ b/bin/barcodes/CODE128/CODE128_AUTO.js @@ -19,14 +19,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128AUTO = function (_CODE) { _inherits(CODE128AUTO, _CODE); - function CODE128AUTO(string) { + function CODE128AUTO(data, options) { _classCallCheck(this, CODE128AUTO); // ASCII value ranges 0-127, 200-211 - if (string.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1) { - var _this = _possibleConstructorReturn(this, _CODE.call(this, autoSelectModes(string))); + if (data.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1) { + var _this = _possibleConstructorReturn(this, _CODE.call(this, autoSelectModes(data), options)); } else { - var _this = _possibleConstructorReturn(this, _CODE.call(this, string)); + var _this = _possibleConstructorReturn(this, _CODE.call(this, data, options)); } return _possibleConstructorReturn(_this); } diff --git a/bin/barcodes/CODE39/index.js b/bin/barcodes/CODE39/index.js index 2bd1c54d..a461ae66 100644 --- a/bin/barcodes/CODE39/index.js +++ b/bin/barcodes/CODE39/index.js @@ -3,91 +3,97 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.CODE39 = undefined; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// Encoding documentation: -// https://en.wikipedia.org/wiki/Code_39#Encoding - -var CODE39 = function () { - function CODE39(string, options) { - _classCallCheck(this, CODE39); +var _Barcode2 = require("../Barcode.js"); - this.string = string.toUpperCase(); +var _Barcode3 = _interopRequireDefault(_Barcode2); - // Enable mod43 checksum? - this.mod43Enabled = options.mod43 || false; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - // All characters. The position in the array is the (checksum) value - this.characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"]; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - // The decimal representation of the characters, is converted to the - // corresponding binary with the getEncoding function - this.encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770]; - } +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - // Get the binary representation of a character by converting the encodings - // from decimal to binary +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: +// https://en.wikipedia.org/wiki/Code_39#Encoding +var CODE39 = function (_Barcode) { + _inherits(CODE39, _Barcode); - CODE39.prototype.getEncoding = function getEncoding(character) { - return this.getBinary(this.characterValue(character)); - }; + function CODE39(data, options) { + _classCallCheck(this, CODE39); - CODE39.prototype.getBinary = function getBinary(characterValue) { - return this.encodings[characterValue].toString(2); - }; + data = data.toUpperCase(); - CODE39.prototype.getCharacter = function getCharacter(characterValue) { - return this.characters[characterValue]; - }; + // Calculate mod43 checksum if enabled + if (options.mod43) { + data += getCharacter(mod43checksum(data)); + } - CODE39.prototype.characterValue = function characterValue(character) { - return this.characters.indexOf(character); - }; + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + } CODE39.prototype.encode = function encode() { - var string = this.string; - // First character is always a * - var result = this.getEncoding("*"); + var result = getEncoding("*"); // Take every character and add the binary representation to the result - for (var i = 0; i < this.string.length; i++) { - result += this.getEncoding(this.string[i]) + "0"; - } - - // Calculate mod43 checksum if enabled - if (this.mod43Enabled) { - var checksum = this.mod43checksum(); - result += this.getBinary(checksum) + "0"; - string += this.getCharacter(checksum); + for (var i = 0; i < this.data.length; i++) { + result += getEncoding(this.data[i]) + "0"; } // Last character is always a * - result += this.getEncoding("*"); + result += getEncoding("*"); return { data: result, - text: string + text: this.text }; }; CODE39.prototype.valid = function valid() { - return this.string.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; + return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; }; - CODE39.prototype.mod43checksum = function mod43checksum() { - var checksum = 0; - for (var i = 0; i < this.string.length; i++) { - checksum += this.characterValue(this.string[i]); - } + return CODE39; +}(_Barcode3.default); - checksum = checksum % 43; - return checksum; - }; +// All characters. The position in the array is the (checksum) value - return CODE39; -}(); + +var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"]; + +// The decimal representation of the characters, is converted to the +// corresponding binary with the getEncoding function +var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770]; + +// Get the binary representation of a character by converting the encodings +// from decimal to binary +function getEncoding(character) { + return getBinary(characterValue(character)); +} + +function getBinary(characterValue) { + return encodings[characterValue].toString(2); +} + +function getCharacter(characterValue) { + return characters[characterValue]; +} + +function characterValue(character) { + return characters.indexOf(character); +} + +function mod43checksum(data) { + var checksum = 0; + for (var i = 0; i < data.length; i++) { + checksum += characterValue(data[i]); + } + + checksum = checksum % 43; + return checksum; +} exports.CODE39 = CODE39; \ No newline at end of file diff --git a/bin/barcodes/EAN_UPC/EAN13.js b/bin/barcodes/EAN_UPC/EAN13.js index 167ce025..1482d626 100644 --- a/bin/barcodes/EAN_UPC/EAN13.js +++ b/bin/barcodes/EAN_UPC/EAN13.js @@ -8,62 +8,71 @@ var _ean_encoder = require("./ean_encoder.js"); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode -var EAN13 = function () { - function EAN13(string, options) { +var EAN13 = function (_Barcode) { + _inherits(EAN13, _Barcode); + + function EAN13(data, options) { _classCallCheck(this, EAN13); // Add checksum if it does not exist - if (string.search(/^[0-9]{12}$/) !== -1) { - this.string = string + this.checksum(string); - } else { - this.string = string; + if (data.search(/^[0-9]{12}$/) !== -1) { + data += checksum(data); } - this.displayValue = options.displayValue; - // Define the EAN-13 structure - this.structure = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"]; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.structure = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"]; // Make sure the font is not bigger than the space between the guard bars if (options.fontSize > options.width * 10) { - this.fontSize = options.width * 10; + _this.fontSize = options.width * 10; } else { - this.fontSize = options.fontSize; + _this.fontSize = options.fontSize; } // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; + _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; // Adds a last character to the end of the barcode - this.lastChar = options.lastChar; + _this.lastChar = options.lastChar; + return _this; } EAN13.prototype.valid = function valid() { - return this.string.search(/^[0-9]{13}$/) !== -1 && this.string[12] == this.checksum(this.string); + return this.data.search(/^[0-9]{13}$/) !== -1 && this.data[12] == checksum(this.data); }; EAN13.prototype.encode = function encode() { var encoder = new _ean_encoder2.default(); var result = []; - var structure = this.structure[this.string[0]]; + var structure = this.structure[this.data[0]]; // Get the string to be encoded on the left side of the EAN code - var leftSide = this.string.substr(1, 6); + var leftSide = this.data.substr(1, 6); // Get the string to be encoded on the right side of the EAN code - var rightSide = this.string.substr(7, 6); + var rightSide = this.data.substr(7, 6); // Add the first digigt - if (this.displayValue) { + if (this.options.displayValue) { result.push({ data: "000000000000", - text: this.string[0], + text: this.text.substr(0, 1), options: { textAlign: "left", fontSize: this.fontSize } }); } @@ -77,7 +86,7 @@ var EAN13 = function () { // Add the left side result.push({ data: encoder.encode(leftSide, structure), - text: leftSide, + text: this.text.substr(1, 6), options: { fontSize: this.fontSize } }); @@ -90,7 +99,7 @@ var EAN13 = function () { // Add the right side result.push({ data: encoder.encode(rightSide, "RRRRRR"), - text: rightSide, + text: this.text.substr(7, 6), options: { fontSize: this.fontSize } }); @@ -100,12 +109,12 @@ var EAN13 = function () { options: { height: this.guardHeight } }); - if (this.lastChar && this.displayValue) { + if (this.options.lastChar && this.options.displayValue) { result.push({ data: "00" }); result.push({ data: "00000", - text: this.lastChar, + text: this.options.lastChar, options: { fontSize: this.fontSize } }); } @@ -113,25 +122,25 @@ var EAN13 = function () { return result; }; - // Calulate the checksum digit - // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit + return EAN13; +}(_Barcode3.default); +// Calulate the checksum digit +// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit - EAN13.prototype.checksum = function checksum(number) { - var result = 0; - var i; - for (i = 0; i < 12; i += 2) { - result += parseInt(number[i]); - } - for (i = 1; i < 12; i += 2) { - result += parseInt(number[i]) * 3; - } +function checksum(number) { + var result = 0; - return (10 - result % 10) % 10; - }; + var i; + for (i = 0; i < 12; i += 2) { + result += parseInt(number[i]); + } + for (i = 1; i < 12; i += 2) { + result += parseInt(number[i]) * 3; + } - return EAN13; -}(); + return (10 - result % 10) % 10; +} exports.default = EAN13; \ No newline at end of file diff --git a/bin/barcodes/EAN_UPC/EAN2.js b/bin/barcodes/EAN_UPC/EAN2.js index ae46f515..c8b7a8c9 100644 --- a/bin/barcodes/EAN_UPC/EAN2.js +++ b/bin/barcodes/EAN_UPC/EAN2.js @@ -8,43 +8,54 @@ var _ean_encoder = require("./ean_encoder.js"); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/EAN_2#Encoding -var EAN2 = function () { - function EAN2(string) { +var EAN2 = function (_Barcode) { + _inherits(EAN2, _Barcode); + + function EAN2(data, options) { _classCallCheck(this, EAN2); - this.string = string; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); - this.structure = ["LL", "LG", "GL", "GG"]; + _this.structure = ["LL", "LG", "GL", "GG"]; + return _this; } EAN2.prototype.valid = function valid() { - return this.string.search(/^[0-9]{2}$/) !== -1; + return this.data.search(/^[0-9]{2}$/) !== -1; }; EAN2.prototype.encode = function encode() { var encoder = new _ean_encoder2.default(); // Choose the structure based on the number mod 4 - var structure = this.structure[parseInt(this.string) % 4]; + var structure = this.structure[parseInt(this.data) % 4]; // Start bits var result = "1011"; // Encode the two digits with 01 in between - result += encoder.encode(this.string, structure, "01"); + result += encoder.encode(this.data, structure, "01"); return { data: result, - text: this.string + text: this.text }; }; return EAN2; -}(); +}(_Barcode3.default); exports.default = EAN2; \ No newline at end of file diff --git a/bin/barcodes/EAN_UPC/EAN5.js b/bin/barcodes/EAN_UPC/EAN5.js index f448c729..af22b6da 100644 --- a/bin/barcodes/EAN_UPC/EAN5.js +++ b/bin/barcodes/EAN_UPC/EAN5.js @@ -8,23 +8,34 @@ var _ean_encoder = require("./ean_encoder.js"); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/EAN_5#Encoding -var EAN5 = function () { - function EAN5(string) { - _classCallCheck(this, EAN5); +var EAN5 = function (_Barcode) { + _inherits(EAN5, _Barcode); - this.string = string; + function EAN5(data, options) { + _classCallCheck(this, EAN5); // Define the EAN-13 structure - this.structure = ["GGLLL", "GLGLL", "GLLGL", "GLLLG", "LGGLL", "LLGGL", "LLLGG", "LGLGL", "LGLLG", "LLGLG"]; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.structure = ["GGLLL", "GLGLL", "GLLGL", "GLLLG", "LGGLL", "LLGGL", "LLLGG", "LGLGL", "LGLLG", "LLGLG"]; + return _this; } EAN5.prototype.valid = function valid() { - return this.string.search(/^[0-9]{5}$/) !== -1; + return this.data.search(/^[0-9]{5}$/) !== -1; }; EAN5.prototype.encode = function encode() { @@ -35,27 +46,27 @@ var EAN5 = function () { var result = "1011"; // Use normal ean encoding with 01 in between all digits - result += encoder.encode(this.string, this.structure[checksum], "01"); + result += encoder.encode(this.data, this.structure[checksum], "01"); return { data: result, - text: this.string + text: this.text }; }; EAN5.prototype.checksum = function checksum() { var result = 0; - result += parseInt(this.string[0]) * 3; - result += parseInt(this.string[1]) * 9; - result += parseInt(this.string[2]) * 3; - result += parseInt(this.string[3]) * 9; - result += parseInt(this.string[4]) * 3; + result += parseInt(this.data[0]) * 3; + result += parseInt(this.data[1]) * 9; + result += parseInt(this.data[2]) * 3; + result += parseInt(this.data[3]) * 9; + result += parseInt(this.data[4]) * 3; return result % 10; }; return EAN5; -}(); +}(_Barcode3.default); exports.default = EAN5; \ No newline at end of file diff --git a/bin/barcodes/EAN_UPC/EAN8.js b/bin/barcodes/EAN_UPC/EAN8.js index 3cc8b8c1..e39fd0e5 100644 --- a/bin/barcodes/EAN_UPC/EAN8.js +++ b/bin/barcodes/EAN_UPC/EAN8.js @@ -8,25 +8,35 @@ var _ean_encoder = require("./ean_encoder.js"); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // http://www.barcodeisland.com/ean8.phtml -var EAN8 = function () { - function EAN8(string) { +var EAN8 = function (_Barcode) { + _inherits(EAN8, _Barcode); + + function EAN8(data, options) { _classCallCheck(this, EAN8); // Add checksum if it does not exist - if (string.search(/^[0-9]{7}$/) !== -1) { - this.string = string + this.checksum(string); - } else { - this.string = string; + if (data.search(/^[0-9]{7}$/) !== -1) { + data += checksum(data); } + + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); } EAN8.prototype.valid = function valid() { - return this.string.search(/^[0-9]{8}$/) !== -1 && this.string[7] == this.checksum(this.string); + return this.data.search(/^[0-9]{8}$/) !== -1 && this.data[7] == checksum(this.data); }; EAN8.prototype.encode = function encode() { @@ -36,10 +46,10 @@ var EAN8 = function () { var result = ""; // Get the number to be encoded on the left side of the EAN code - var leftSide = this.string.substr(0, 4); + var leftSide = this.data.substr(0, 4); // Get the number to be encoded on the right side of the EAN code - var rightSide = this.string.substr(4, 4); + var rightSide = this.data.substr(4, 4); // Add the start bits result += encoder.startBin; @@ -58,29 +68,29 @@ var EAN8 = function () { return { data: result, - text: this.string + text: this.text }; }; - // Calulate the checksum digit + return EAN8; +}(_Barcode3.default); +// Calulate the checksum digit - EAN8.prototype.checksum = function checksum(number) { - var result = 0; - var i; - for (i = 0; i < 7; i += 2) { - result += parseInt(number[i]) * 3; - } +function checksum(number) { + var result = 0; - for (i = 1; i < 7; i += 2) { - result += parseInt(number[i]); - } + var i; + for (i = 0; i < 7; i += 2) { + result += parseInt(number[i]) * 3; + } - return (10 - result % 10) % 10; - }; + for (i = 1; i < 7; i += 2) { + result += parseInt(number[i]); + } - return EAN8; -}(); + return (10 - result % 10) % 10; +} exports.default = EAN8; \ No newline at end of file diff --git a/bin/barcodes/EAN_UPC/UPC.js b/bin/barcodes/EAN_UPC/UPC.js index 935760eb..12db72ae 100644 --- a/bin/barcodes/EAN_UPC/UPC.js +++ b/bin/barcodes/EAN_UPC/UPC.js @@ -8,37 +8,48 @@ var _ean_encoder = require("./ean_encoder.js"); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding -var UPC = function () { - function UPC(string, options) { +var UPC = function (_Barcode) { + _inherits(UPC, _Barcode); + + function UPC(data, options) { _classCallCheck(this, UPC); // Add checksum if it does not exist - if (string.search(/^[0-9]{11}$/) !== -1) { - this.string = string + this.checksum(string); - } else { - this.string = string; + if (data.search(/^[0-9]{11}$/) !== -1) { + data += checksum(data); } - this.displayValue = options.displayValue; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.displayValue = options.displayValue; // Make sure the font is not bigger than the space between the guard bars if (options.fontSize > options.width * 10) { - this.fontSize = options.width * 10; + _this.fontSize = options.width * 10; } else { - this.fontSize = options.fontSize; + _this.fontSize = options.fontSize; } // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; + _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; + return _this; } UPC.prototype.valid = function valid() { - return this.string.search(/^[0-9]{12}$/) !== -1 && this.string[11] == this.checksum(this.string); + return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data); }; UPC.prototype.encode = function encode() { @@ -49,21 +60,21 @@ var UPC = function () { if (this.displayValue) { result.push({ data: "00000000", - text: this.string[0], + text: this.text.substr(0, 1), options: { textAlign: "left", fontSize: this.fontSize } }); } // Add the guard bars result.push({ - data: "101" + encoder.encode(this.string[0], "L"), + data: "101" + encoder.encode(this.data[0], "L"), options: { height: this.guardHeight } }); // Add the left side result.push({ - data: encoder.encode(this.string.substr(1, 5), "LLLLL"), - text: this.string.substr(1, 5), + data: encoder.encode(this.data.substr(1, 5), "LLLLL"), + text: this.text.substr(1, 5), options: { fontSize: this.fontSize } }); @@ -75,14 +86,14 @@ var UPC = function () { // Add the right side result.push({ - data: encoder.encode(this.string.substr(6, 5), "RRRRR"), - text: this.string.substr(6, 5), + data: encoder.encode(this.data.substr(6, 5), "RRRRR"), + text: this.text.substr(6, 5), options: { fontSize: this.fontSize } }); // Add the end bits result.push({ - data: encoder.encode(this.string[11], "R") + "101", + data: encoder.encode(this.data[11], "R") + "101", options: { height: this.guardHeight } }); @@ -90,7 +101,7 @@ var UPC = function () { if (this.displayValue) { result.push({ data: "00000000", - text: this.string[11], + text: this.text.substr(11, 1), options: { textAlign: "right", fontSize: this.fontSize } }); } @@ -98,25 +109,25 @@ var UPC = function () { return result; }; - // Calulate the checksum digit - // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit + return UPC; +}(_Barcode3.default); +// Calulate the checksum digit +// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit - UPC.prototype.checksum = function checksum(number) { - var result = 0; - var i; - for (i = 1; i < 11; i += 2) { - result += parseInt(number[i]); - } - for (i = 0; i < 11; i += 2) { - result += parseInt(number[i]) * 3; - } +function checksum(number) { + var result = 0; - return (10 - result % 10) % 10; - }; + var i; + for (i = 1; i < 11; i += 2) { + result += parseInt(number[i]); + } + for (i = 0; i < 11; i += 2) { + result += parseInt(number[i]) * 3; + } - return UPC; -}(); + return (10 - result % 10) % 10; +} exports.default = UPC; \ No newline at end of file diff --git a/bin/barcodes/GenericBarcode/index.js b/bin/barcodes/GenericBarcode/index.js index 8aee64c3..3a0b4730 100644 --- a/bin/barcodes/GenericBarcode/index.js +++ b/bin/barcodes/GenericBarcode/index.js @@ -3,14 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.GenericBarcode = undefined; + +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var GenericBarcode = function () { - function GenericBarcode(string) { +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var GenericBarcode = function (_Barcode) { + _inherits(GenericBarcode, _Barcode); + + function GenericBarcode(data, options) { _classCallCheck(this, GenericBarcode); - this.string = string; + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); // Sets this.data and this.text } // Return the corresponding binary numbers for the data provided @@ -19,7 +32,7 @@ var GenericBarcode = function () { GenericBarcode.prototype.encode = function encode() { return { data: "10101010101010101010101010101010101010101", - text: this.string + text: this.text }; }; @@ -31,6 +44,6 @@ var GenericBarcode = function () { }; return GenericBarcode; -}(); +}(_Barcode3.default); exports.GenericBarcode = GenericBarcode; \ No newline at end of file diff --git a/bin/barcodes/ITF/index.js b/bin/barcodes/ITF/index.js index 16af1b6a..e3451cfe 100644 --- a/bin/barcodes/ITF/index.js +++ b/bin/barcodes/ITF/index.js @@ -3,16 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.ITF = undefined; + +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var ITF = function () { - function ITF(string) { +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var ITF = function (_Barcode) { + _inherits(ITF, _Barcode); + + function ITF(data, options) { _classCallCheck(this, ITF); - this.string = string; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); - this.binaryRepresentation = { + _this.binaryRepresentation = { "0": "00110", "1": "10001", "2": "01001", @@ -24,10 +37,11 @@ var ITF = function () { "8": "10010", "9": "01010" }; + return _this; } ITF.prototype.valid = function valid() { - return this.string.search(/^([0-9]{2})+$/) !== -1; + return this.data.search(/^([0-9]{2})+$/) !== -1; }; ITF.prototype.encode = function encode() { @@ -35,8 +49,8 @@ var ITF = function () { var result = "1010"; // Calculate all the digit pairs - for (var i = 0; i < this.string.length; i += 2) { - result += this.calculatePair(this.string.substr(i, 2)); + for (var i = 0; i < this.data.length; i += 2) { + result += this.calculatePair(this.data.substr(i, 2)); } // Always add the same end bits @@ -44,7 +58,7 @@ var ITF = function () { return { data: result, - text: this.string + text: this.text }; }; @@ -67,6 +81,6 @@ var ITF = function () { }; return ITF; -}(); +}(_Barcode3.default); exports.ITF = ITF; \ No newline at end of file diff --git a/bin/barcodes/ITF14/index.js b/bin/barcodes/ITF14/index.js index b1096f9e..b1bf063b 100644 --- a/bin/barcodes/ITF14/index.js +++ b/bin/barcodes/ITF14/index.js @@ -3,21 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.ITF14 = undefined; + +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var ITF14 = function () { - function ITF14(string) { - _classCallCheck(this, ITF14); +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - this.string = string; +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var ITF14 = function (_Barcode) { + _inherits(ITF14, _Barcode); + + function ITF14(data, options) { + _classCallCheck(this, ITF14); // Add checksum if it does not exist - if (string.search(/^[0-9]{13}$/) !== -1) { - this.string += this.checksum(string); + if (data.search(/^[0-9]{13}$/) !== -1) { + data += checksum(data); } - this.binaryRepresentation = { + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.binaryRepresentation = { "0": "00110", "1": "10001", "2": "01001", @@ -29,10 +42,11 @@ var ITF14 = function () { "8": "10010", "9": "01010" }; + return _this; } ITF14.prototype.valid = function valid() { - return this.string.search(/^[0-9]{14}$/) !== -1 && this.string[13] == this.checksum(); + return this.data.search(/^[0-9]{14}$/) !== -1 && this.data[13] == checksum(this.data); }; ITF14.prototype.encode = function encode() { @@ -40,7 +54,7 @@ var ITF14 = function () { // Calculate all the digit pairs for (var i = 0; i < 14; i += 2) { - result += this.calculatePair(this.string.substr(i, 2)); + result += this.calculatePair(this.data.substr(i, 2)); } // Always add the same end bits @@ -48,7 +62,7 @@ var ITF14 = function () { return { data: result, - text: this.string + text: this.text }; }; @@ -70,20 +84,20 @@ var ITF14 = function () { return result; }; - // Calulate the checksum digit + return ITF14; +}(_Barcode3.default); +// Calulate the checksum digit - ITF14.prototype.checksum = function checksum() { - var result = 0; - for (var i = 0; i < 13; i++) { - result += parseInt(this.string[i]) * (3 - i % 2 * 2); - } +function checksum(data) { + var result = 0; - return Math.ceil(result / 10) * 10 - result; - }; + for (var i = 0; i < 13; i++) { + result += parseInt(data[i]) * (3 - i % 2 * 2); + } - return ITF14; -}(); + return Math.ceil(result / 10) * 10 - result; +} exports.ITF14 = ITF14; \ No newline at end of file diff --git a/bin/barcodes/MSI/MSI.js b/bin/barcodes/MSI/MSI.js index 0d0ba859..24410c5f 100644 --- a/bin/barcodes/MSI/MSI.js +++ b/bin/barcodes/MSI/MSI.js @@ -4,25 +4,35 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// Encoding documentation +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation // https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup -var MSI = function () { - function MSI(string) { +var MSI = function (_Barcode) { + _inherits(MSI, _Barcode); + + function MSI(data, options) { _classCallCheck(this, MSI); - this.string = string; + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); } MSI.prototype.encode = function encode() { // Start bits var ret = "110"; - for (var i = 0; i < this.string.length; i++) { + for (var i = 0; i < this.data.length; i++) { // Convert the character to binary (always 4 binary digits) - var digit = parseInt(this.string[i]); + var digit = parseInt(this.data[i]); var bin = digit.toString(2); bin = addZeroes(bin, 4 - bin.length); @@ -37,16 +47,16 @@ var MSI = function () { return { data: ret, - text: this.string + text: this.text }; }; MSI.prototype.valid = function valid() { - return this.string.search(/^[0-9]+$/) !== -1; + return this.data.search(/^[0-9]+$/) !== -1; }; return MSI; -}(); +}(_Barcode3.default); function addZeroes(number, n) { for (var i = 0; i < n; i++) { diff --git a/bin/barcodes/MSI/MSI10.js b/bin/barcodes/MSI/MSI10.js index 1f61887e..06e57014 100644 --- a/bin/barcodes/MSI/MSI10.js +++ b/bin/barcodes/MSI/MSI10.js @@ -21,13 +21,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI10 = function (_MSI) { _inherits(MSI10, _MSI); - function MSI10(string) { + function MSI10(data, options) { _classCallCheck(this, MSI10); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod10)(_this.string); - return _this; + return _possibleConstructorReturn(this, _MSI.call(this, data + (0, _checksums.mod10)(data), options)); } return MSI10; diff --git a/bin/barcodes/MSI/MSI1010.js b/bin/barcodes/MSI/MSI1010.js index 6f95625b..51df0f34 100644 --- a/bin/barcodes/MSI/MSI1010.js +++ b/bin/barcodes/MSI/MSI1010.js @@ -21,14 +21,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI1010 = function (_MSI) { _inherits(MSI1010, _MSI); - function MSI1010(string) { + function MSI1010(data, options) { _classCallCheck(this, MSI1010); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod10)(_this.string); - _this.string += (0, _checksums.mod10)(_this.string); - return _this; + data += (0, _checksums.mod10)(data); + data += (0, _checksums.mod10)(data); + return _possibleConstructorReturn(this, _MSI.call(this, data, options)); } return MSI1010; diff --git a/bin/barcodes/MSI/MSI11.js b/bin/barcodes/MSI/MSI11.js index e662416f..106c113e 100644 --- a/bin/barcodes/MSI/MSI11.js +++ b/bin/barcodes/MSI/MSI11.js @@ -21,13 +21,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI11 = function (_MSI) { _inherits(MSI11, _MSI); - function MSI11(string) { + function MSI11(data, options) { _classCallCheck(this, MSI11); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod11)(_this.string); - return _this; + return _possibleConstructorReturn(this, _MSI.call(this, data + (0, _checksums.mod11)(data), options)); } return MSI11; diff --git a/bin/barcodes/MSI/MSI1110.js b/bin/barcodes/MSI/MSI1110.js index 0f620207..e5539146 100644 --- a/bin/barcodes/MSI/MSI1110.js +++ b/bin/barcodes/MSI/MSI1110.js @@ -21,14 +21,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI1110 = function (_MSI) { _inherits(MSI1110, _MSI); - function MSI1110(string) { + function MSI1110(data, options) { _classCallCheck(this, MSI1110); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod11)(_this.string); - _this.string += (0, _checksums.mod10)(_this.string); - return _this; + data += (0, _checksums.mod11)(data); + data += (0, _checksums.mod10)(data); + return _possibleConstructorReturn(this, _MSI.call(this, data, options)); } return MSI1110; diff --git a/bin/barcodes/codabar/index.js b/bin/barcodes/codabar/index.js index 67f07ce1..03744d5c 100644 --- a/bin/barcodes/codabar/index.js +++ b/bin/barcodes/codabar/index.js @@ -3,23 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.codabar = undefined; + +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// Encoding specification: +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding specification: // http://www.barcodeisland.com/codabar.phtml -var codabar = function () { - function codabar(string) { - _classCallCheck(this, codabar); +var codabar = function (_Barcode) { + _inherits(codabar, _Barcode); - this.string = string.toUpperCase(); + function codabar(data, options) { + _classCallCheck(this, codabar); - if (this.string.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { - this.string = "A" + this.string + "A"; + if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { + data = "A" + data + "A"; } - this.encodings = { + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data.toUpperCase(), options)); + + _this.text = _this.options.text || _this.text.replace(/[A-D]/g, ''); + + _this.encodings = { "0": "101010011", "1": "101011001", "2": "101001011", @@ -41,28 +54,29 @@ var codabar = function () { "C": "1001001011", "D": "1010011001" }; + return _this; } codabar.prototype.valid = function valid() { - return this.string.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; + return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; }; codabar.prototype.encode = function encode() { var result = []; - for (var i = 0; i < this.string.length; i++) { - result.push(this.encodings[this.string.charAt(i)]); + for (var i = 0; i < this.data.length; i++) { + result.push(this.encodings[this.data.charAt(i)]); // for all characters except the last, append a narrow-space ("0") - if (i !== this.string.length - 1) { + if (i !== this.data.length - 1) { result.push("0"); } } return { - text: this.string.replace(/[A-D]/g, ''), + text: this.text, data: result.join('') }; }; return codabar; -}(); +}(_Barcode3.default); exports.codabar = codabar; \ No newline at end of file diff --git a/bin/barcodes/pharmacode/index.js b/bin/barcodes/pharmacode/index.js index a7e13120..a7912171 100644 --- a/bin/barcodes/pharmacode/index.js +++ b/bin/barcodes/pharmacode/index.js @@ -3,17 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.pharmacode = undefined; + +var _Barcode2 = require("../Barcode.js"); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// Encoding documentation +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation // http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf -var pharmacode = function () { - function pharmacode(string) { +var pharmacode = function (_Barcode) { + _inherits(pharmacode, _Barcode); + + function pharmacode(data, options) { _classCallCheck(this, pharmacode); - this.number = parseInt(string, 10); + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.number = parseInt(data, 10); + return _this; } pharmacode.prototype.encode = function encode() { @@ -39,7 +53,7 @@ var pharmacode = function () { return { data: result, - text: this.number + "" + text: this.text }; }; @@ -48,6 +62,6 @@ var pharmacode = function () { }; return pharmacode; -}(); +}(_Barcode3.default); exports.pharmacode = pharmacode; \ No newline at end of file diff --git a/bin/help/getOptionsFromElement.js b/bin/help/getOptionsFromElement.js index 59ffde17..2a6f5a1e 100644 --- a/bin/help/getOptionsFromElement.js +++ b/bin/help/getOptionsFromElement.js @@ -8,7 +8,7 @@ var _optionsFromStrings = require("./optionsFromStrings.js"); var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings); -var _defaults = require("../defaults/defaults.js"); +var _defaults = require("../options/defaults.js"); var _defaults2 = _interopRequireDefault(_defaults); diff --git a/bin/defaults/defaults.js b/bin/options/defaults.js similarity index 96% rename from bin/defaults/defaults.js rename to bin/options/defaults.js index 431a5059..f546b8a3 100644 --- a/bin/defaults/defaults.js +++ b/bin/options/defaults.js @@ -10,6 +10,7 @@ var defaults = { displayValue: true, fontOptions: "", font: "monospace", + text: undefined, textAlign: "center", textPosition: "bottom", textMargin: 2, diff --git a/bower.json b/bower.json index 375faa5d..6b3826c6 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "JsBarcode", "main": "dist/JsBarcode.all.min.js", - "version": "3.4.0", + "version": "3.5.0-beta", "homepage": "https://github.com/lindell/JsBarcode", "authors": [ "Johan Lindell " diff --git a/dist/JsBarcode.all.js b/dist/JsBarcode.all.js index c1895207..31a84d26 100644 --- a/dist/JsBarcode.all.js +++ b/dist/JsBarcode.all.js @@ -61,7 +61,7 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 40); +/******/ return __webpack_require__(__webpack_require__.s = 41); /******/ }) /************************************************************************/ /******/ ([ @@ -77,6 +77,29 @@ Object.defineProperty(exports, "__esModule", { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var Barcode = function Barcode(data, options) { + _classCallCheck(this, Barcode); + + this.data = data; + this.text = options.text || data; + this.options = options; +}; + +exports.default = Barcode; + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + +"use strict"; +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + var EANencoder = function () { function EANencoder() { _classCallCheck(this, EANencoder); @@ -131,8 +154,8 @@ var EANencoder = function () { exports.default = EANencoder; /***/ }, -/* 1 */ -/***/ function(module, exports) { +/* 2 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -141,25 +164,35 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// Encoding documentation +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation // https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup -var MSI = function () { - function MSI(string) { +var MSI = function (_Barcode) { + _inherits(MSI, _Barcode); + + function MSI(data, options) { _classCallCheck(this, MSI); - this.string = string; + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); } MSI.prototype.encode = function encode() { // Start bits var ret = "110"; - for (var i = 0; i < this.string.length; i++) { + for (var i = 0; i < this.data.length; i++) { // Convert the character to binary (always 4 binary digits) - var digit = parseInt(this.string[i]); + var digit = parseInt(this.data[i]); var bin = digit.toString(2); bin = addZeroes(bin, 4 - bin.length); @@ -174,16 +207,16 @@ var MSI = function () { return { data: ret, - text: this.string + text: this.text }; }; MSI.prototype.valid = function valid() { - return this.string.search(/^[0-9]+$/) !== -1; + return this.data.search(/^[0-9]+$/) !== -1; }; return MSI; -}(); +}(_Barcode3.default); function addZeroes(number, n) { for (var i = 0; i < n; i++) { @@ -195,7 +228,7 @@ function addZeroes(number, n) { exports.default = MSI; /***/ }, -/* 2 */ +/* 3 */ /***/ function(module, exports) { "use strict"; @@ -224,8 +257,8 @@ function merge(old, replaceObj) { } /***/ }, -/* 3 */ -/***/ function(module, exports) { +/* 4 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -234,27 +267,38 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// This is the master class, it does require the start code to be +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // This is the master class, it does require the start code to be // included in the string -var CODE128 = function () { - function CODE128(string) { + +var CODE128 = function (_Barcode) { + _inherits(CODE128, _Barcode); + + function CODE128(data, options) { _classCallCheck(this, CODE128); // Fill the bytes variable with the ascii codes of string - this.bytes = []; - for (var i = 0; i < string.length; ++i) { - this.bytes.push(string.charCodeAt(i)); - } + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data.substring(1), options)); - // First element should be startcode, remove that - this.string = string.substring(1); + _this.bytes = []; + for (var i = 0; i < data.length; ++i) { + _this.bytes.push(data.charCodeAt(i)); + } // Data for each character, the last characters will not be encoded but are used for error correction // Numbers encode to (n + 1000) -> binary; 740 -> (740 + 1000).toString(2) -> "11011001100" - this.encodings = [// + 1000 + _this.encodings = [// + 1000 740, 644, 638, 176, 164, 100, 224, 220, 124, 608, 604, 572, 436, 244, 230, 484, 260, 254, 650, 628, 614, 764, 652, 902, 868, 836, 830, 892, 844, 842, 752, 734, 590, 304, 112, 94, 416, 128, 122, 672, 576, 570, 464, 422, 134, 496, 478, 142, 910, 678, 582, 768, 762, 774, 880, 862, 814, 896, 890, 818, 914, 602, 930, 328, 292, 200, 158, 68, 62, 424, 412, 232, 218, 76, 74, 554, 616, 978, 556, 146, 340, 212, 182, 508, 268, 266, 956, 940, 938, 758, 782, 974, 400, 310, 118, 512, 506, 960, 954, 502, 518, 886, 966, /* Start codes */668, 680, 692, 5379]; + return _this; } // The public encoding function @@ -276,7 +320,7 @@ var CODE128 = function () { } return { - text: this.string.replace(/[^\x20-\x7E]/g, ""), + text: this.text.replace(/[^\x20-\x7E]/g, ""), data: // Add the start bits this.getEncoding(startIndex) + @@ -298,7 +342,7 @@ var CODE128 = function () { CODE128.prototype.valid = function valid() { // ASCII value ranges 0-127, 200-211 - return this.string.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1; + return this.data.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1; }; CODE128.prototype.nextA = function nextA(bytes, depth) { @@ -445,12 +489,12 @@ var CODE128 = function () { }; return CODE128; -}(); +}(_Barcode3.default); exports.default = CODE128; /***/ }, -/* 4 */ +/* 5 */ /***/ function(module, exports) { "use strict"; @@ -484,39 +528,6 @@ function mod11(number) { return (11 - sum % 11) % 11; } -/***/ }, -/* 5 */ -/***/ function(module, exports) { - -"use strict"; -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var defaults = { - width: 2, - height: 100, - format: "auto", - displayValue: true, - fontOptions: "", - font: "monospace", - textAlign: "center", - textPosition: "bottom", - textMargin: 2, - fontSize: 20, - background: "#ffffff", - lineColor: "#000000", - margin: 10, - marginTop: undefined, - marginBottom: undefined, - marginLeft: undefined, - marginRight: undefined, - valid: function valid() {} -}; - -exports.default = defaults; - /***/ }, /* 6 */ /***/ function(module, exports) { @@ -592,6 +603,40 @@ exports.NoElementException = NoElementException; /***/ }, /* 7 */ +/***/ function(module, exports) { + +"use strict"; +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var defaults = { + width: 2, + height: 100, + format: "auto", + displayValue: true, + fontOptions: "", + font: "monospace", + text: undefined, + textAlign: "center", + textPosition: "bottom", + textMargin: 2, + fontSize: 20, + background: "#ffffff", + lineColor: "#000000", + margin: 10, + marginTop: undefined, + marginBottom: undefined, + marginLeft: undefined, + marginRight: undefined, + valid: function valid() {} +}; + +exports.default = defaults; + +/***/ }, +/* 8 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -602,7 +647,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.getTotalWidthOfEncodings = exports.calculateEncodingAttributes = exports.getBarcodePadding = exports.getEncodingHeight = exports.getMaximumHeightOfEncodings = undefined; -var _merge = __webpack_require__(2); +var _merge = __webpack_require__(3); var _merge2 = _interopRequireDefault(_merge); @@ -682,7 +727,7 @@ exports.calculateEncodingAttributes = calculateEncodingAttributes; exports.getTotalWidthOfEncodings = getTotalWidthOfEncodings; /***/ }, -/* 8 */ +/* 9 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -692,23 +737,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _CODE = __webpack_require__(18); +var _CODE = __webpack_require__(19); -var _CODE2 = __webpack_require__(17); +var _CODE2 = __webpack_require__(18); -var _EAN_UPC = __webpack_require__(24); +var _EAN_UPC = __webpack_require__(25); -var _ITF = __webpack_require__(27); +var _ITF = __webpack_require__(28); -var _ITF2 = __webpack_require__(26); +var _ITF2 = __webpack_require__(27); -var _MSI = __webpack_require__(32); +var _MSI = __webpack_require__(33); -var _pharmacode = __webpack_require__(34); +var _pharmacode = __webpack_require__(35); -var _codabar = __webpack_require__(33); +var _codabar = __webpack_require__(34); -var _GenericBarcode = __webpack_require__(25); +var _GenericBarcode = __webpack_require__(26); exports.default = { CODE39: _CODE.CODE39, @@ -723,7 +768,7 @@ exports.default = { }; /***/ }, -/* 9 */ +/* 10 */ /***/ function(module, exports) { "use strict"; @@ -777,7 +822,7 @@ var ErrorHandler = function () { exports.default = ErrorHandler; /***/ }, -/* 10 */ +/* 11 */ /***/ function(module, exports) { "use strict"; @@ -800,7 +845,7 @@ function fixOptions(options) { } /***/ }, -/* 11 */ +/* 12 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -810,11 +855,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _getOptionsFromElement = __webpack_require__(35); +var _getOptionsFromElement = __webpack_require__(36); var _getOptionsFromElement2 = _interopRequireDefault(_getOptionsFromElement); -var _renderers = __webpack_require__(38); +var _renderers = __webpack_require__(39); var _exceptions = __webpack_require__(6); @@ -905,7 +950,7 @@ function newCanvasRenderProperties(imgElement) { exports.default = getRenderProperties; /***/ }, -/* 12 */ +/* 13 */ /***/ function(module, exports) { "use strict"; @@ -938,7 +983,7 @@ function linearizeEncodings(encodings) { } /***/ }, -/* 13 */ +/* 14 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -948,7 +993,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _CODE2 = __webpack_require__(3); +var _CODE2 = __webpack_require__(4); var _CODE3 = _interopRequireDefault(_CODE2); @@ -963,14 +1008,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128A = function (_CODE) { _inherits(CODE128A, _CODE); - function CODE128A(string) { + function CODE128A(string, options) { _classCallCheck(this, CODE128A); - return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(208) + string)); + return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(208) + string, options)); } CODE128A.prototype.valid = function valid() { - return this.string.search(/^[\x00-\x5F\xC8-\xCF]+$/) !== -1; + return this.data.search(/^[\x00-\x5F\xC8-\xCF]+$/) !== -1; }; return CODE128A; @@ -979,7 +1024,7 @@ var CODE128A = function (_CODE) { exports.default = CODE128A; /***/ }, -/* 14 */ +/* 15 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -989,7 +1034,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _CODE2 = __webpack_require__(3); +var _CODE2 = __webpack_require__(4); var _CODE3 = _interopRequireDefault(_CODE2); @@ -1004,14 +1049,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128B = function (_CODE) { _inherits(CODE128B, _CODE); - function CODE128B(string) { + function CODE128B(string, options) { _classCallCheck(this, CODE128B); - return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(209) + string)); + return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(209) + string, options)); } CODE128B.prototype.valid = function valid() { - return this.string.search(/^[\x20-\x7F\xC8-\xCF]+$/) !== -1; + return this.data.search(/^[\x20-\x7F\xC8-\xCF]+$/) !== -1; }; return CODE128B; @@ -1020,7 +1065,7 @@ var CODE128B = function (_CODE) { exports.default = CODE128B; /***/ }, -/* 15 */ +/* 16 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1030,7 +1075,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _CODE2 = __webpack_require__(3); +var _CODE2 = __webpack_require__(4); var _CODE3 = _interopRequireDefault(_CODE2); @@ -1045,14 +1090,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128C = function (_CODE) { _inherits(CODE128C, _CODE); - function CODE128C(string) { + function CODE128C(string, options) { _classCallCheck(this, CODE128C); - return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(210) + string)); + return _possibleConstructorReturn(this, _CODE.call(this, String.fromCharCode(210) + string, options)); } CODE128C.prototype.valid = function valid() { - return this.string.search(/^(\xCF*[0-9]{2}\xCF*)+$/) !== -1; + return this.data.search(/^(\xCF*[0-9]{2}\xCF*)+$/) !== -1; }; return CODE128C; @@ -1061,7 +1106,7 @@ var CODE128C = function (_CODE) { exports.default = CODE128C; /***/ }, -/* 16 */ +/* 17 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1071,7 +1116,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _CODE2 = __webpack_require__(3); +var _CODE2 = __webpack_require__(4); var _CODE3 = _interopRequireDefault(_CODE2); @@ -1086,14 +1131,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var CODE128AUTO = function (_CODE) { _inherits(CODE128AUTO, _CODE); - function CODE128AUTO(string) { + function CODE128AUTO(data, options) { _classCallCheck(this, CODE128AUTO); // ASCII value ranges 0-127, 200-211 - if (string.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1) { - var _this = _possibleConstructorReturn(this, _CODE.call(this, autoSelectModes(string))); + if (data.search(/^[\x00-\x7F\xC8-\xD3]+$/) !== -1) { + var _this = _possibleConstructorReturn(this, _CODE.call(this, autoSelectModes(data), options)); } else { - var _this = _possibleConstructorReturn(this, _CODE.call(this, string)); + var _this = _possibleConstructorReturn(this, _CODE.call(this, data, options)); } return _possibleConstructorReturn(_this); } @@ -1181,7 +1226,7 @@ function autoSelectFromC(string) { exports.default = CODE128AUTO; /***/ }, -/* 17 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1192,19 +1237,19 @@ Object.defineProperty(exports, "__esModule", { }); exports.CODE128C = exports.CODE128B = exports.CODE128A = exports.CODE128 = undefined; -var _CODE128_AUTO = __webpack_require__(16); +var _CODE128_AUTO = __webpack_require__(17); var _CODE128_AUTO2 = _interopRequireDefault(_CODE128_AUTO); -var _CODE128A = __webpack_require__(13); +var _CODE128A = __webpack_require__(14); var _CODE128A2 = _interopRequireDefault(_CODE128A); -var _CODE128B = __webpack_require__(14); +var _CODE128B = __webpack_require__(15); var _CODE128B2 = _interopRequireDefault(_CODE128B); -var _CODE128C = __webpack_require__(15); +var _CODE128C = __webpack_require__(16); var _CODE128C2 = _interopRequireDefault(_CODE128C); @@ -1216,8 +1261,8 @@ exports.CODE128B = _CODE128B2.default; exports.CODE128C = _CODE128C2.default; /***/ }, -/* 18 */ -/***/ function(module, exports) { +/* 19 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -1225,97 +1270,103 @@ exports.CODE128C = _CODE128C2.default; Object.defineProperty(exports, "__esModule", { value: true }); +exports.CODE39 = undefined; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// Encoding documentation: -// https://en.wikipedia.org/wiki/Code_39#Encoding +var _Barcode2 = __webpack_require__(0); -var CODE39 = function () { - function CODE39(string, options) { - _classCallCheck(this, CODE39); - - this.string = string.toUpperCase(); +var _Barcode3 = _interopRequireDefault(_Barcode2); - // Enable mod43 checksum? - this.mod43Enabled = options.mod43 || false; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - // All characters. The position in the array is the (checksum) value - this.characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"]; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - // The decimal representation of the characters, is converted to the - // corresponding binary with the getEncoding function - this.encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770]; - } +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - // Get the binary representation of a character by converting the encodings - // from decimal to binary +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: +// https://en.wikipedia.org/wiki/Code_39#Encoding +var CODE39 = function (_Barcode) { + _inherits(CODE39, _Barcode); - CODE39.prototype.getEncoding = function getEncoding(character) { - return this.getBinary(this.characterValue(character)); - }; + function CODE39(data, options) { + _classCallCheck(this, CODE39); - CODE39.prototype.getBinary = function getBinary(characterValue) { - return this.encodings[characterValue].toString(2); - }; + data = data.toUpperCase(); - CODE39.prototype.getCharacter = function getCharacter(characterValue) { - return this.characters[characterValue]; - }; + // Calculate mod43 checksum if enabled + if (options.mod43) { + data += getCharacter(mod43checksum(data)); + } - CODE39.prototype.characterValue = function characterValue(character) { - return this.characters.indexOf(character); - }; + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + } CODE39.prototype.encode = function encode() { - var string = this.string; - // First character is always a * - var result = this.getEncoding("*"); + var result = getEncoding("*"); // Take every character and add the binary representation to the result - for (var i = 0; i < this.string.length; i++) { - result += this.getEncoding(this.string[i]) + "0"; - } - - // Calculate mod43 checksum if enabled - if (this.mod43Enabled) { - var checksum = this.mod43checksum(); - result += this.getBinary(checksum) + "0"; - string += this.getCharacter(checksum); + for (var i = 0; i < this.data.length; i++) { + result += getEncoding(this.data[i]) + "0"; } // Last character is always a * - result += this.getEncoding("*"); + result += getEncoding("*"); return { data: result, - text: string + text: this.text }; }; CODE39.prototype.valid = function valid() { - return this.string.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; + return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) !== -1; }; - CODE39.prototype.mod43checksum = function mod43checksum() { - var checksum = 0; - for (var i = 0; i < this.string.length; i++) { - checksum += this.characterValue(this.string[i]); - } + return CODE39; +}(_Barcode3.default); - checksum = checksum % 43; - return checksum; - }; +// All characters. The position in the array is the (checksum) value - return CODE39; -}(); + +var characters = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", ".", " ", "$", "/", "+", "%", "*"]; + +// The decimal representation of the characters, is converted to the +// corresponding binary with the getEncoding function +var encodings = [20957, 29783, 23639, 30485, 20951, 29813, 23669, 20855, 29789, 23645, 29975, 23831, 30533, 22295, 30149, 24005, 21623, 29981, 23837, 22301, 30023, 23879, 30545, 22343, 30161, 24017, 21959, 30065, 23921, 22385, 29015, 18263, 29141, 17879, 29045, 18293, 17783, 29021, 18269, 17477, 17489, 17681, 20753, 35770]; + +// Get the binary representation of a character by converting the encodings +// from decimal to binary +function getEncoding(character) { + return getBinary(characterValue(character)); +} + +function getBinary(characterValue) { + return encodings[characterValue].toString(2); +} + +function getCharacter(characterValue) { + return characters[characterValue]; +} + +function characterValue(character) { + return characters.indexOf(character); +} + +function mod43checksum(data) { + var checksum = 0; + for (var i = 0; i < data.length; i++) { + checksum += characterValue(data[i]); + } + + checksum = checksum % 43; + return checksum; +} exports.CODE39 = CODE39; /***/ }, -/* 19 */ +/* 20 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1325,66 +1376,75 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _ean_encoder = __webpack_require__(0); +var _ean_encoder = __webpack_require__(1); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Binary_encoding_of_data_digits_into_EAN-13_barcode -var EAN13 = function () { - function EAN13(string, options) { +var EAN13 = function (_Barcode) { + _inherits(EAN13, _Barcode); + + function EAN13(data, options) { _classCallCheck(this, EAN13); // Add checksum if it does not exist - if (string.search(/^[0-9]{12}$/) !== -1) { - this.string = string + this.checksum(string); - } else { - this.string = string; + if (data.search(/^[0-9]{12}$/) !== -1) { + data += checksum(data); } - this.displayValue = options.displayValue; - // Define the EAN-13 structure - this.structure = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"]; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.structure = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"]; // Make sure the font is not bigger than the space between the guard bars if (options.fontSize > options.width * 10) { - this.fontSize = options.width * 10; + _this.fontSize = options.width * 10; } else { - this.fontSize = options.fontSize; + _this.fontSize = options.fontSize; } // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; + _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; // Adds a last character to the end of the barcode - this.lastChar = options.lastChar; + _this.lastChar = options.lastChar; + return _this; } EAN13.prototype.valid = function valid() { - return this.string.search(/^[0-9]{13}$/) !== -1 && this.string[12] == this.checksum(this.string); + return this.data.search(/^[0-9]{13}$/) !== -1 && this.data[12] == checksum(this.data); }; EAN13.prototype.encode = function encode() { var encoder = new _ean_encoder2.default(); var result = []; - var structure = this.structure[this.string[0]]; + var structure = this.structure[this.data[0]]; // Get the string to be encoded on the left side of the EAN code - var leftSide = this.string.substr(1, 6); + var leftSide = this.data.substr(1, 6); // Get the string to be encoded on the right side of the EAN code - var rightSide = this.string.substr(7, 6); + var rightSide = this.data.substr(7, 6); // Add the first digigt - if (this.displayValue) { + if (this.options.displayValue) { result.push({ data: "000000000000", - text: this.string[0], + text: this.text.substr(0, 1), options: { textAlign: "left", fontSize: this.fontSize } }); } @@ -1398,7 +1458,7 @@ var EAN13 = function () { // Add the left side result.push({ data: encoder.encode(leftSide, structure), - text: leftSide, + text: this.text.substr(1, 6), options: { fontSize: this.fontSize } }); @@ -1411,7 +1471,7 @@ var EAN13 = function () { // Add the right side result.push({ data: encoder.encode(rightSide, "RRRRRR"), - text: rightSide, + text: this.text.substr(7, 6), options: { fontSize: this.fontSize } }); @@ -1421,12 +1481,12 @@ var EAN13 = function () { options: { height: this.guardHeight } }); - if (this.lastChar && this.displayValue) { + if (this.options.lastChar && this.options.displayValue) { result.push({ data: "00" }); result.push({ data: "00000", - text: this.lastChar, + text: this.options.lastChar, options: { fontSize: this.fontSize } }); } @@ -1434,31 +1494,31 @@ var EAN13 = function () { return result; }; - // Calulate the checksum digit - // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit + return EAN13; +}(_Barcode3.default); +// Calulate the checksum digit +// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit - EAN13.prototype.checksum = function checksum(number) { - var result = 0; - var i; - for (i = 0; i < 12; i += 2) { - result += parseInt(number[i]); - } - for (i = 1; i < 12; i += 2) { - result += parseInt(number[i]) * 3; - } +function checksum(number) { + var result = 0; - return (10 - result % 10) % 10; - }; + var i; + for (i = 0; i < 12; i += 2) { + result += parseInt(number[i]); + } + for (i = 1; i < 12; i += 2) { + result += parseInt(number[i]) * 3; + } - return EAN13; -}(); + return (10 - result % 10) % 10; +} exports.default = EAN13; /***/ }, -/* 20 */ +/* 21 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1468,53 +1528,64 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _ean_encoder = __webpack_require__(0); +var _ean_encoder = __webpack_require__(1); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/EAN_2#Encoding -var EAN2 = function () { - function EAN2(string) { +var EAN2 = function (_Barcode) { + _inherits(EAN2, _Barcode); + + function EAN2(data, options) { _classCallCheck(this, EAN2); - this.string = string; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); - this.structure = ["LL", "LG", "GL", "GG"]; + _this.structure = ["LL", "LG", "GL", "GG"]; + return _this; } EAN2.prototype.valid = function valid() { - return this.string.search(/^[0-9]{2}$/) !== -1; + return this.data.search(/^[0-9]{2}$/) !== -1; }; EAN2.prototype.encode = function encode() { var encoder = new _ean_encoder2.default(); // Choose the structure based on the number mod 4 - var structure = this.structure[parseInt(this.string) % 4]; + var structure = this.structure[parseInt(this.data) % 4]; // Start bits var result = "1011"; // Encode the two digits with 01 in between - result += encoder.encode(this.string, structure, "01"); + result += encoder.encode(this.data, structure, "01"); return { data: result, - text: this.string + text: this.text }; }; return EAN2; -}(); +}(_Barcode3.default); exports.default = EAN2; /***/ }, -/* 21 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1524,27 +1595,38 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _ean_encoder = __webpack_require__(0); +var _ean_encoder = __webpack_require__(1); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/EAN_5#Encoding -var EAN5 = function () { - function EAN5(string) { - _classCallCheck(this, EAN5); +var EAN5 = function (_Barcode) { + _inherits(EAN5, _Barcode); - this.string = string; + function EAN5(data, options) { + _classCallCheck(this, EAN5); // Define the EAN-13 structure - this.structure = ["GGLLL", "GLGLL", "GLLGL", "GLLLG", "LGGLL", "LLGGL", "LLLGG", "LGLGL", "LGLLG", "LLGLG"]; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.structure = ["GGLLL", "GLGLL", "GLLGL", "GLLLG", "LGGLL", "LLGGL", "LLLGG", "LGLGL", "LGLLG", "LLGLG"]; + return _this; } EAN5.prototype.valid = function valid() { - return this.string.search(/^[0-9]{5}$/) !== -1; + return this.data.search(/^[0-9]{5}$/) !== -1; }; EAN5.prototype.encode = function encode() { @@ -1555,33 +1637,33 @@ var EAN5 = function () { var result = "1011"; // Use normal ean encoding with 01 in between all digits - result += encoder.encode(this.string, this.structure[checksum], "01"); + result += encoder.encode(this.data, this.structure[checksum], "01"); return { data: result, - text: this.string + text: this.text }; }; EAN5.prototype.checksum = function checksum() { var result = 0; - result += parseInt(this.string[0]) * 3; - result += parseInt(this.string[1]) * 9; - result += parseInt(this.string[2]) * 3; - result += parseInt(this.string[3]) * 9; - result += parseInt(this.string[4]) * 3; + result += parseInt(this.data[0]) * 3; + result += parseInt(this.data[1]) * 9; + result += parseInt(this.data[2]) * 3; + result += parseInt(this.data[3]) * 9; + result += parseInt(this.data[4]) * 3; return result % 10; }; return EAN5; -}(); +}(_Barcode3.default); exports.default = EAN5; /***/ }, -/* 22 */ +/* 23 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1591,29 +1673,39 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _ean_encoder = __webpack_require__(0); +var _ean_encoder = __webpack_require__(1); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // http://www.barcodeisland.com/ean8.phtml -var EAN8 = function () { - function EAN8(string) { +var EAN8 = function (_Barcode) { + _inherits(EAN8, _Barcode); + + function EAN8(data, options) { _classCallCheck(this, EAN8); // Add checksum if it does not exist - if (string.search(/^[0-9]{7}$/) !== -1) { - this.string = string + this.checksum(string); - } else { - this.string = string; + if (data.search(/^[0-9]{7}$/) !== -1) { + data += checksum(data); } + + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); } EAN8.prototype.valid = function valid() { - return this.string.search(/^[0-9]{8}$/) !== -1 && this.string[7] == this.checksum(this.string); + return this.data.search(/^[0-9]{8}$/) !== -1 && this.data[7] == checksum(this.data); }; EAN8.prototype.encode = function encode() { @@ -1623,10 +1715,10 @@ var EAN8 = function () { var result = ""; // Get the number to be encoded on the left side of the EAN code - var leftSide = this.string.substr(0, 4); + var leftSide = this.data.substr(0, 4); // Get the number to be encoded on the right side of the EAN code - var rightSide = this.string.substr(4, 4); + var rightSide = this.data.substr(4, 4); // Add the start bits result += encoder.startBin; @@ -1645,35 +1737,35 @@ var EAN8 = function () { return { data: result, - text: this.string + text: this.text }; }; - // Calulate the checksum digit + return EAN8; +}(_Barcode3.default); +// Calulate the checksum digit - EAN8.prototype.checksum = function checksum(number) { - var result = 0; - var i; - for (i = 0; i < 7; i += 2) { - result += parseInt(number[i]) * 3; - } +function checksum(number) { + var result = 0; - for (i = 1; i < 7; i += 2) { - result += parseInt(number[i]); - } + var i; + for (i = 0; i < 7; i += 2) { + result += parseInt(number[i]) * 3; + } - return (10 - result % 10) % 10; - }; + for (i = 1; i < 7; i += 2) { + result += parseInt(number[i]); + } - return EAN8; -}(); + return (10 - result % 10) % 10; +} exports.default = EAN8; /***/ }, -/* 23 */ +/* 24 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1683,41 +1775,52 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _ean_encoder = __webpack_require__(0); +var _ean_encoder = __webpack_require__(1); var _ean_encoder2 = _interopRequireDefault(_ean_encoder); +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Encoding documentation: +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation: // https://en.wikipedia.org/wiki/Universal_Product_Code#Encoding -var UPC = function () { - function UPC(string, options) { +var UPC = function (_Barcode) { + _inherits(UPC, _Barcode); + + function UPC(data, options) { _classCallCheck(this, UPC); // Add checksum if it does not exist - if (string.search(/^[0-9]{11}$/) !== -1) { - this.string = string + this.checksum(string); - } else { - this.string = string; + if (data.search(/^[0-9]{11}$/) !== -1) { + data += checksum(data); } - this.displayValue = options.displayValue; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.displayValue = options.displayValue; // Make sure the font is not bigger than the space between the guard bars if (options.fontSize > options.width * 10) { - this.fontSize = options.width * 10; + _this.fontSize = options.width * 10; } else { - this.fontSize = options.fontSize; + _this.fontSize = options.fontSize; } // Make the guard bars go down half the way of the text - this.guardHeight = options.height + this.fontSize / 2 + options.textMargin; + _this.guardHeight = options.height + _this.fontSize / 2 + options.textMargin; + return _this; } UPC.prototype.valid = function valid() { - return this.string.search(/^[0-9]{12}$/) !== -1 && this.string[11] == this.checksum(this.string); + return this.data.search(/^[0-9]{12}$/) !== -1 && this.data[11] == checksum(this.data); }; UPC.prototype.encode = function encode() { @@ -1728,21 +1831,21 @@ var UPC = function () { if (this.displayValue) { result.push({ data: "00000000", - text: this.string[0], + text: this.text.substr(0, 1), options: { textAlign: "left", fontSize: this.fontSize } }); } // Add the guard bars result.push({ - data: "101" + encoder.encode(this.string[0], "L"), + data: "101" + encoder.encode(this.data[0], "L"), options: { height: this.guardHeight } }); // Add the left side result.push({ - data: encoder.encode(this.string.substr(1, 5), "LLLLL"), - text: this.string.substr(1, 5), + data: encoder.encode(this.data.substr(1, 5), "LLLLL"), + text: this.text.substr(1, 5), options: { fontSize: this.fontSize } }); @@ -1754,14 +1857,14 @@ var UPC = function () { // Add the right side result.push({ - data: encoder.encode(this.string.substr(6, 5), "RRRRR"), - text: this.string.substr(6, 5), + data: encoder.encode(this.data.substr(6, 5), "RRRRR"), + text: this.text.substr(6, 5), options: { fontSize: this.fontSize } }); // Add the end bits result.push({ - data: encoder.encode(this.string[11], "R") + "101", + data: encoder.encode(this.data[11], "R") + "101", options: { height: this.guardHeight } }); @@ -1769,7 +1872,7 @@ var UPC = function () { if (this.displayValue) { result.push({ data: "00000000", - text: this.string[11], + text: this.text.substr(11, 1), options: { textAlign: "right", fontSize: this.fontSize } }); } @@ -1777,31 +1880,31 @@ var UPC = function () { return result; }; - // Calulate the checksum digit - // https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit + return UPC; +}(_Barcode3.default); +// Calulate the checksum digit +// https://en.wikipedia.org/wiki/International_Article_Number_(EAN)#Calculation_of_checksum_digit - UPC.prototype.checksum = function checksum(number) { - var result = 0; - var i; - for (i = 1; i < 11; i += 2) { - result += parseInt(number[i]); - } - for (i = 0; i < 11; i += 2) { - result += parseInt(number[i]) * 3; - } +function checksum(number) { + var result = 0; - return (10 - result % 10) % 10; - }; + var i; + for (i = 1; i < 11; i += 2) { + result += parseInt(number[i]); + } + for (i = 0; i < 11; i += 2) { + result += parseInt(number[i]) * 3; + } - return UPC; -}(); + return (10 - result % 10) % 10; +} exports.default = UPC; /***/ }, -/* 24 */ +/* 25 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -1812,23 +1915,23 @@ Object.defineProperty(exports, "__esModule", { }); exports.UPC = exports.EAN2 = exports.EAN5 = exports.EAN8 = exports.EAN13 = undefined; -var _EAN = __webpack_require__(19); +var _EAN = __webpack_require__(20); var _EAN2 = _interopRequireDefault(_EAN); -var _EAN3 = __webpack_require__(22); +var _EAN3 = __webpack_require__(23); var _EAN4 = _interopRequireDefault(_EAN3); -var _EAN5 = __webpack_require__(21); +var _EAN5 = __webpack_require__(22); var _EAN6 = _interopRequireDefault(_EAN5); -var _EAN7 = __webpack_require__(20); +var _EAN7 = __webpack_require__(21); var _EAN8 = _interopRequireDefault(_EAN7); -var _UPC = __webpack_require__(23); +var _UPC = __webpack_require__(24); var _UPC2 = _interopRequireDefault(_UPC); @@ -1841,8 +1944,8 @@ exports.EAN2 = _EAN8.default; exports.UPC = _UPC2.default; /***/ }, -/* 25 */ -/***/ function(module, exports) { +/* 26 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -1850,14 +1953,27 @@ exports.UPC = _UPC2.default; Object.defineProperty(exports, "__esModule", { value: true }); +exports.GenericBarcode = undefined; + +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var GenericBarcode = function () { - function GenericBarcode(string) { +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var GenericBarcode = function (_Barcode) { + _inherits(GenericBarcode, _Barcode); + + function GenericBarcode(data, options) { _classCallCheck(this, GenericBarcode); - this.string = string; + return _possibleConstructorReturn(this, _Barcode.call(this, data, options)); // Sets this.data and this.text } // Return the corresponding binary numbers for the data provided @@ -1866,7 +1982,7 @@ var GenericBarcode = function () { GenericBarcode.prototype.encode = function encode() { return { data: "10101010101010101010101010101010101010101", - text: this.string + text: this.text }; }; @@ -1878,13 +1994,13 @@ var GenericBarcode = function () { }; return GenericBarcode; -}(); +}(_Barcode3.default); exports.GenericBarcode = GenericBarcode; /***/ }, -/* 26 */ -/***/ function(module, exports) { +/* 27 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -1892,16 +2008,29 @@ exports.GenericBarcode = GenericBarcode; Object.defineProperty(exports, "__esModule", { value: true }); +exports.ITF = undefined; + +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var ITF = function () { - function ITF(string) { +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var ITF = function (_Barcode) { + _inherits(ITF, _Barcode); + + function ITF(data, options) { _classCallCheck(this, ITF); - this.string = string; + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); - this.binaryRepresentation = { + _this.binaryRepresentation = { "0": "00110", "1": "10001", "2": "01001", @@ -1913,10 +2042,11 @@ var ITF = function () { "8": "10010", "9": "01010" }; + return _this; } ITF.prototype.valid = function valid() { - return this.string.search(/^([0-9]{2})+$/) !== -1; + return this.data.search(/^([0-9]{2})+$/) !== -1; }; ITF.prototype.encode = function encode() { @@ -1924,8 +2054,8 @@ var ITF = function () { var result = "1010"; // Calculate all the digit pairs - for (var i = 0; i < this.string.length; i += 2) { - result += this.calculatePair(this.string.substr(i, 2)); + for (var i = 0; i < this.data.length; i += 2) { + result += this.calculatePair(this.data.substr(i, 2)); } // Always add the same end bits @@ -1933,7 +2063,7 @@ var ITF = function () { return { data: result, - text: this.string + text: this.text }; }; @@ -1956,13 +2086,13 @@ var ITF = function () { }; return ITF; -}(); +}(_Barcode3.default); exports.ITF = ITF; /***/ }, -/* 27 */ -/***/ function(module, exports) { +/* 28 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -1970,21 +2100,34 @@ exports.ITF = ITF; Object.defineProperty(exports, "__esModule", { value: true }); +exports.ITF14 = undefined; + +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var ITF14 = function () { - function ITF14(string) { - _classCallCheck(this, ITF14); +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var ITF14 = function (_Barcode) { + _inherits(ITF14, _Barcode); - this.string = string; + function ITF14(data, options) { + _classCallCheck(this, ITF14); // Add checksum if it does not exist - if (string.search(/^[0-9]{13}$/) !== -1) { - this.string += this.checksum(string); + if (data.search(/^[0-9]{13}$/) !== -1) { + data += checksum(data); } - this.binaryRepresentation = { + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.binaryRepresentation = { "0": "00110", "1": "10001", "2": "01001", @@ -1996,10 +2139,11 @@ var ITF14 = function () { "8": "10010", "9": "01010" }; + return _this; } ITF14.prototype.valid = function valid() { - return this.string.search(/^[0-9]{14}$/) !== -1 && this.string[13] == this.checksum(); + return this.data.search(/^[0-9]{14}$/) !== -1 && this.data[13] == checksum(this.data); }; ITF14.prototype.encode = function encode() { @@ -2007,7 +2151,7 @@ var ITF14 = function () { // Calculate all the digit pairs for (var i = 0; i < 14; i += 2) { - result += this.calculatePair(this.string.substr(i, 2)); + result += this.calculatePair(this.data.substr(i, 2)); } // Always add the same end bits @@ -2015,7 +2159,7 @@ var ITF14 = function () { return { data: result, - text: this.string + text: this.text }; }; @@ -2037,26 +2181,26 @@ var ITF14 = function () { return result; }; - // Calulate the checksum digit + return ITF14; +}(_Barcode3.default); +// Calulate the checksum digit - ITF14.prototype.checksum = function checksum() { - var result = 0; - for (var i = 0; i < 13; i++) { - result += parseInt(this.string[i]) * (3 - i % 2 * 2); - } +function checksum(data) { + var result = 0; - return Math.ceil(result / 10) * 10 - result; - }; + for (var i = 0; i < 13; i++) { + result += parseInt(data[i]) * (3 - i % 2 * 2); + } - return ITF14; -}(); + return Math.ceil(result / 10) * 10 - result; +} exports.ITF14 = ITF14; /***/ }, -/* 28 */ +/* 29 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2066,11 +2210,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _MSI2 = __webpack_require__(1); +var _MSI2 = __webpack_require__(2); var _MSI3 = _interopRequireDefault(_MSI2); -var _checksums = __webpack_require__(4); +var _checksums = __webpack_require__(5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2083,13 +2227,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI10 = function (_MSI) { _inherits(MSI10, _MSI); - function MSI10(string) { + function MSI10(data, options) { _classCallCheck(this, MSI10); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod10)(_this.string); - return _this; + return _possibleConstructorReturn(this, _MSI.call(this, data + (0, _checksums.mod10)(data), options)); } return MSI10; @@ -2098,7 +2239,7 @@ var MSI10 = function (_MSI) { exports.default = MSI10; /***/ }, -/* 29 */ +/* 30 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2108,11 +2249,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _MSI2 = __webpack_require__(1); +var _MSI2 = __webpack_require__(2); var _MSI3 = _interopRequireDefault(_MSI2); -var _checksums = __webpack_require__(4); +var _checksums = __webpack_require__(5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2125,14 +2266,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI1010 = function (_MSI) { _inherits(MSI1010, _MSI); - function MSI1010(string) { + function MSI1010(data, options) { _classCallCheck(this, MSI1010); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod10)(_this.string); - _this.string += (0, _checksums.mod10)(_this.string); - return _this; + data += (0, _checksums.mod10)(data); + data += (0, _checksums.mod10)(data); + return _possibleConstructorReturn(this, _MSI.call(this, data, options)); } return MSI1010; @@ -2141,7 +2280,7 @@ var MSI1010 = function (_MSI) { exports.default = MSI1010; /***/ }, -/* 30 */ +/* 31 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2151,11 +2290,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _MSI2 = __webpack_require__(1); +var _MSI2 = __webpack_require__(2); var _MSI3 = _interopRequireDefault(_MSI2); -var _checksums = __webpack_require__(4); +var _checksums = __webpack_require__(5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2168,13 +2307,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI11 = function (_MSI) { _inherits(MSI11, _MSI); - function MSI11(string) { + function MSI11(data, options) { _classCallCheck(this, MSI11); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod11)(_this.string); - return _this; + return _possibleConstructorReturn(this, _MSI.call(this, data + (0, _checksums.mod11)(data), options)); } return MSI11; @@ -2183,7 +2319,7 @@ var MSI11 = function (_MSI) { exports.default = MSI11; /***/ }, -/* 31 */ +/* 32 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2193,11 +2329,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _MSI2 = __webpack_require__(1); +var _MSI2 = __webpack_require__(2); var _MSI3 = _interopRequireDefault(_MSI2); -var _checksums = __webpack_require__(4); +var _checksums = __webpack_require__(5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2210,14 +2346,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var MSI1110 = function (_MSI) { _inherits(MSI1110, _MSI); - function MSI1110(string) { + function MSI1110(data, options) { _classCallCheck(this, MSI1110); - var _this = _possibleConstructorReturn(this, _MSI.call(this, string)); - - _this.string += (0, _checksums.mod11)(_this.string); - _this.string += (0, _checksums.mod10)(_this.string); - return _this; + data += (0, _checksums.mod11)(data); + data += (0, _checksums.mod10)(data); + return _possibleConstructorReturn(this, _MSI.call(this, data, options)); } return MSI1110; @@ -2226,7 +2360,7 @@ var MSI1110 = function (_MSI) { exports.default = MSI1110; /***/ }, -/* 32 */ +/* 33 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2237,23 +2371,23 @@ Object.defineProperty(exports, "__esModule", { }); exports.MSI1110 = exports.MSI1010 = exports.MSI11 = exports.MSI10 = exports.MSI = undefined; -var _MSI = __webpack_require__(1); +var _MSI = __webpack_require__(2); var _MSI2 = _interopRequireDefault(_MSI); -var _MSI3 = __webpack_require__(28); +var _MSI3 = __webpack_require__(29); var _MSI4 = _interopRequireDefault(_MSI3); -var _MSI5 = __webpack_require__(30); +var _MSI5 = __webpack_require__(31); var _MSI6 = _interopRequireDefault(_MSI5); -var _MSI7 = __webpack_require__(29); +var _MSI7 = __webpack_require__(30); var _MSI8 = _interopRequireDefault(_MSI7); -var _MSI9 = __webpack_require__(31); +var _MSI9 = __webpack_require__(32); var _MSI10 = _interopRequireDefault(_MSI9); @@ -2266,8 +2400,8 @@ exports.MSI1010 = _MSI8.default; exports.MSI1110 = _MSI10.default; /***/ }, -/* 33 */ -/***/ function(module, exports) { +/* 34 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -2275,23 +2409,36 @@ exports.MSI1110 = _MSI10.default; Object.defineProperty(exports, "__esModule", { value: true }); +exports.codabar = undefined; + +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// Encoding specification: +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding specification: // http://www.barcodeisland.com/codabar.phtml -var codabar = function () { - function codabar(string) { - _classCallCheck(this, codabar); +var codabar = function (_Barcode) { + _inherits(codabar, _Barcode); - this.string = string.toUpperCase(); + function codabar(data, options) { + _classCallCheck(this, codabar); - if (this.string.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { - this.string = "A" + this.string + "A"; + if (data.search(/^[0-9\-\$\:\.\+\/]+$/) === 0) { + data = "A" + data + "A"; } - this.encodings = { + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data.toUpperCase(), options)); + + _this.text = _this.options.text || _this.text.replace(/[A-D]/g, ''); + + _this.encodings = { "0": "101010011", "1": "101011001", "2": "101001011", @@ -2313,35 +2460,36 @@ var codabar = function () { "C": "1001001011", "D": "1010011001" }; + return _this; } codabar.prototype.valid = function valid() { - return this.string.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; + return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/) !== -1; }; codabar.prototype.encode = function encode() { var result = []; - for (var i = 0; i < this.string.length; i++) { - result.push(this.encodings[this.string.charAt(i)]); + for (var i = 0; i < this.data.length; i++) { + result.push(this.encodings[this.data.charAt(i)]); // for all characters except the last, append a narrow-space ("0") - if (i !== this.string.length - 1) { + if (i !== this.data.length - 1) { result.push("0"); } } return { - text: this.string.replace(/[A-D]/g, ''), + text: this.text, data: result.join('') }; }; return codabar; -}(); +}(_Barcode3.default); exports.codabar = codabar; /***/ }, -/* 34 */ -/***/ function(module, exports) { +/* 35 */ +/***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; @@ -2349,17 +2497,31 @@ exports.codabar = codabar; Object.defineProperty(exports, "__esModule", { value: true }); +exports.pharmacode = undefined; + +var _Barcode2 = __webpack_require__(0); + +var _Barcode3 = _interopRequireDefault(_Barcode2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// Encoding documentation +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation // http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf -var pharmacode = function () { - function pharmacode(string) { +var pharmacode = function (_Barcode) { + _inherits(pharmacode, _Barcode); + + function pharmacode(data, options) { _classCallCheck(this, pharmacode); - this.number = parseInt(string, 10); + var _this = _possibleConstructorReturn(this, _Barcode.call(this, data, options)); + + _this.number = parseInt(data, 10); + return _this; } pharmacode.prototype.encode = function encode() { @@ -2385,7 +2547,7 @@ var pharmacode = function () { return { data: result, - text: this.number + "" + text: this.text }; }; @@ -2394,12 +2556,12 @@ var pharmacode = function () { }; return pharmacode; -}(); +}(_Barcode3.default); exports.pharmacode = pharmacode; /***/ }, -/* 35 */ +/* 36 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2409,11 +2571,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _optionsFromStrings = __webpack_require__(36); +var _optionsFromStrings = __webpack_require__(37); var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings); -var _defaults = __webpack_require__(5); +var _defaults = __webpack_require__(7); var _defaults2 = _interopRequireDefault(_defaults); @@ -2446,7 +2608,7 @@ function getOptionsFromElement(element) { exports.default = getOptionsFromElement; /***/ }, -/* 36 */ +/* 37 */ /***/ function(module, exports) { "use strict"; @@ -2479,7 +2641,7 @@ function optionsFromStrings(options) { } /***/ }, -/* 37 */ +/* 38 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2489,11 +2651,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _merge = __webpack_require__(2); +var _merge = __webpack_require__(3); var _merge2 = _interopRequireDefault(_merge); -var _shared = __webpack_require__(7); +var _shared = __webpack_require__(8); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2633,7 +2795,7 @@ var CanvasRenderer = function () { exports.default = CanvasRenderer; /***/ }, -/* 38 */ +/* 39 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2644,11 +2806,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.getRendererClass = undefined; -var _canvas = __webpack_require__(37); +var _canvas = __webpack_require__(38); var _canvas2 = _interopRequireDefault(_canvas); -var _svg = __webpack_require__(39); +var _svg = __webpack_require__(40); var _svg2 = _interopRequireDefault(_svg); @@ -2668,7 +2830,7 @@ function getRendererClass(name) { exports.getRendererClass = getRendererClass; /***/ }, -/* 39 */ +/* 40 */ /***/ function(module, exports, __webpack_require__) { "use strict"; @@ -2678,11 +2840,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _merge = __webpack_require__(2); +var _merge = __webpack_require__(3); var _merge2 = _interopRequireDefault(_merge); -var _shared = __webpack_require__(7); +var _shared = __webpack_require__(8); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2849,39 +3011,39 @@ function drawLine(x, y, width, height, parent) { exports.default = SVGRenderer; /***/ }, -/* 40 */ +/* 41 */ /***/ function(module, exports, __webpack_require__) { "use strict"; 'use strict'; -var _barcodes = __webpack_require__(8); +var _barcodes = __webpack_require__(9); var _barcodes2 = _interopRequireDefault(_barcodes); -var _merge = __webpack_require__(2); +var _merge = __webpack_require__(3); var _merge2 = _interopRequireDefault(_merge); -var _linearizeEncodings = __webpack_require__(12); +var _linearizeEncodings = __webpack_require__(13); var _linearizeEncodings2 = _interopRequireDefault(_linearizeEncodings); -var _fixOptions = __webpack_require__(10); +var _fixOptions = __webpack_require__(11); var _fixOptions2 = _interopRequireDefault(_fixOptions); -var _getRenderProperties = __webpack_require__(11); +var _getRenderProperties = __webpack_require__(12); var _getRenderProperties2 = _interopRequireDefault(_getRenderProperties); -var _ErrorHandler = __webpack_require__(9); +var _ErrorHandler = __webpack_require__(10); var _ErrorHandler2 = _interopRequireDefault(_ErrorHandler); var _exceptions = __webpack_require__(6); -var _defaults = __webpack_require__(5); +var _defaults = __webpack_require__(7); var _defaults2 = _interopRequireDefault(_defaults); diff --git a/dist/JsBarcode.all.min.js b/dist/JsBarcode.all.min.js index fd08309a..1a262a78 100644 --- a/dist/JsBarcode.all.min.js +++ b/dist/JsBarcode.all.min.js @@ -1,2 +1,2 @@ -!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=40)}([function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){n(this,t),this.startBin="101",this.endBin="101",this.middleBin="01010",this.Lbinary=["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],this.Gbinary=["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],this.Rbinary=["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"]}return t.prototype.encode=function(t,e,n){var r="";n=n||"";for(var i=0;i=200)r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):100===r?n=this.nextB(t,e+1):98===r?(t[0]=t[0]>95?t[0]-96:t[0],n=this.nextA(t,e+1)):n=this.nextA(t,e+1);else{var i=t[0];r=i<32?i+64:i-32,t.shift(),n=this.nextA(t,e+1)}var o=this.getEncoding(r),s=r*e;return{result:o+n.result,checksum:s+n.checksum}},t.prototype.nextB=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):101===r?n=this.nextA(t,e+1):98===r?(t[0]=t[0]<32?t[0]+96:t[0],n=this.nextB(t,e+1)):n=this.nextB(t,e+1)):(r=t[0]-32,t.shift(),n=this.nextB(t,e+1));var i=this.getEncoding(r),o=r*e;return{result:i+n.result,checksum:o+n.checksum}},t.prototype.nextC=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),n=100===r?this.nextB(t,e+1):101===r?this.nextA(t,e+1):this.nextC(t,e+1)):(r=10*(t[0]-48)+t[1]-48,t.shift(),t.shift(),n=this.nextC(t,e+1));var i=this.getEncoding(r),o=r*e;return{result:i+n.result,checksum:o+n.checksum}},t}();e["default"]=r},function(t,e){"use strict";function n(t){for(var e=0,n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function c(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var f=n(2),h=r(f);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=s,e.getTotalWidthOfEncodings=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(18),i=n(17),o=n(24),s=n(27),a=n(26),u=n(32),c=n(34),f=n(33),h=n(25);e["default"]={CODE39:r.CODE39,CODE128:i.CODE128,CODE128A:i.CODE128A,CODE128B:i.CODE128B,CODE128C:i.CODE128C,EAN13:o.EAN13,EAN8:o.EAN8,EAN5:o.EAN5,EAN2:o.EAN2,UPC:o.UPC,ITF14:s.ITF14,ITF:a.ITF,MSI:u.MSI,MSI10:u.MSI10,MSI11:u.MSI11,MSI1010:u.MSI1010,MSI1110:u.MSI1110,pharmacode:c.pharmacode,codabar:f.codabar,GenericBarcode:h.GenericBarcode}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n=2?String.fromCharCode(210)+f(t):n>r?String.fromCharCode(208)+u(t):String.fromCharCode(209)+c(t),e=e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(t,e){return String.fromCharCode(203)+e})}function u(t){var e=t.match(/^([\x00-\x5F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+f(t.substring(e[1].length));var n=t.match(/^[\x00-\x5F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(205)+c(t.substring(n[0].length))}function c(t){var e=t.match(/^([\x20-\x7F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+f(t.substring(e[1].length));var n=t.match(/^[\x20-\x7F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(206)+u(t.substring(n[0].length))}function f(t){var e=t.match(/^(\xCF*[0-9]{2}\xCF*)+/)[0],n=e.length;if(n===t.length)return t;t=t.substring(n);var r=t.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length,i=t.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length;return r>=i?e+String.fromCharCode(206)+u(t):e+String.fromCharCode(205)+c(t)}Object.defineProperty(e,"__esModule",{value:!0});var h=n(3),l=r(h),d=function(t){function e(n){if(i(this,e),n.search(/^[\x00-\x7F\xC8-\xD3]+$/)!==-1)var r=o(this,t.call(this,a(n)));else var r=o(this,t.call(this,n));return o(r)}return s(e,t),e}(l["default"]);e["default"]=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var i=n(16),o=r(i),s=n(13),a=r(s),u=n(14),c=r(u),f=n(15),h=r(f);e.CODE128=o["default"],e.CODE128A=a["default"],e.CODE128B=c["default"],e.CODE128C=h["default"]},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e,r){n(this,t),this.string=e.toUpperCase(),this.mod43Enabled=r.mod43||!1,this.characters=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","-","."," ","$","/","+","%","*"],this.encodings=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770]}return t.prototype.getEncoding=function(t){return this.getBinary(this.characterValue(t))},t.prototype.getBinary=function(t){return this.encodings[t].toString(2)},t.prototype.getCharacter=function(t){return this.characters[t]},t.prototype.characterValue=function(t){return this.characters.indexOf(t)},t.prototype.encode=function(){for(var t=this.string,e=this.getEncoding("*"),n=0;n10*n.width?this.fontSize=10*n.width:this.fontSize=n.fontSize,this.guardHeight=n.height+this.fontSize/2+n.textMargin,this.lastChar=n.lastChar}return t.prototype.valid=function(){return this.string.search(/^[0-9]{13}$/)!==-1&&this.string[12]==this.checksum(this.string)},t.prototype.encode=function(){var t=new s["default"],e=[],n=this.structure[this.string[0]],r=this.string.substr(1,6),i=this.string.substr(7,6);return this.displayValue&&e.push({data:"000000000000",text:this.string[0],options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),e.push({data:t.encode(r,n),text:r,options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(i,"RRRRRR"),text:i,options:{fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),this.lastChar&&this.displayValue&&(e.push({data:"00"}),e.push({data:"00000",text:this.lastChar,options:{fontSize:this.fontSize}})),e},t.prototype.checksum=function(t){var e,n=0;for(e=0;e<12;e+=2)n+=parseInt(t[e]);for(e=1;e<12;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10},t}();e["default"]=a},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=r(o),a=function(){function t(e){i(this,t),this.string=e,this.structure=["LL","LG","GL","GG"]}return t.prototype.valid=function(){return this.string.search(/^[0-9]{2}$/)!==-1},t.prototype.encode=function(){var t=new s["default"],e=this.structure[parseInt(this.string)%4],n="1011";return n+=t.encode(this.string,e,"01"),{data:n,text:this.string}},t}();e["default"]=a},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=r(o),a=function(){function t(e){i(this,t),this.string=e,this.structure=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"]}return t.prototype.valid=function(){return this.string.search(/^[0-9]{5}$/)!==-1},t.prototype.encode=function(){var t=new s["default"],e=this.checksum(),n="1011";return n+=t.encode(this.string,this.structure[e],"01"),{data:n,text:this.string}},t.prototype.checksum=function(){var t=0;return t+=3*parseInt(this.string[0]),t+=9*parseInt(this.string[1]),t+=3*parseInt(this.string[2]),t+=9*parseInt(this.string[3]),t+=3*parseInt(this.string[4]),t%10},t}();e["default"]=a},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=r(o),a=function(){function t(e){i(this,t),e.search(/^[0-9]{7}$/)!==-1?this.string=e+this.checksum(e):this.string=e}return t.prototype.valid=function(){return this.string.search(/^[0-9]{8}$/)!==-1&&this.string[7]==this.checksum(this.string)},t.prototype.encode=function(){var t=new s["default"],e="",n=this.string.substr(0,4),r=this.string.substr(4,4);return e+=t.startBin,e+=t.encode(n,"LLLL"),e+=t.middleBin,e+=t.encode(r,"RRRR"),e+=t.endBin,{data:e,text:this.string}},t.prototype.checksum=function(t){var e,n=0;for(e=0;e<7;e+=2)n+=3*parseInt(t[e]);for(e=1;e<7;e+=2)n+=parseInt(t[e]);return(10-n%10)%10},t}();e["default"]=a},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=r(o),a=function(){function t(e,n){i(this,t),e.search(/^[0-9]{11}$/)!==-1?this.string=e+this.checksum(e):this.string=e,this.displayValue=n.displayValue,n.fontSize>10*n.width?this.fontSize=10*n.width:this.fontSize=n.fontSize,this.guardHeight=n.height+this.fontSize/2+n.textMargin}return t.prototype.valid=function(){return this.string.search(/^[0-9]{12}$/)!==-1&&this.string[11]==this.checksum(this.string)},t.prototype.encode=function(){var t=new s["default"],e=[];return this.displayValue&&e.push({data:"00000000",text:this.string[0],options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101"+t.encode(this.string[0],"L"),options:{height:this.guardHeight}}),e.push({data:t.encode(this.string.substr(1,5),"LLLLL"),text:this.string.substr(1,5),options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(this.string.substr(6,5),"RRRRR"),text:this.string.substr(6,5),options:{fontSize:this.fontSize}}),e.push({data:t.encode(this.string[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&e.push({data:"00000000",text:this.string[11],options:{textAlign:"right",fontSize:this.fontSize}}),e},t.prototype.checksum=function(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10},t}();e["default"]=a},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var i=n(19),o=r(i),s=n(22),a=r(s),u=n(21),c=r(u),f=n(20),h=r(f),l=n(23),d=r(l);e.EAN13=o["default"],e.EAN8=a["default"],e.EAN5=c["default"],e.EAN2=h["default"],e.UPC=d["default"]},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.string=e}return t.prototype.encode=function(){return{data:"10101010101010101010101010101010101010101",text:this.string}},t.prototype.valid=function(){return!0},t}();e.GenericBarcode=r},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.string=e,this.binaryRepresentation={0:"00110",1:"10001",2:"01001",3:"11000",4:"00101",5:"10100",6:"01100",7:"00011",8:"10010",9:"01010"}}return t.prototype.valid=function(){return this.string.search(/^([0-9]{2})+$/)!==-1},t.prototype.encode=function(){for(var t="1010",e=0;e=3&&this.number<=131070},t}();e.pharmacode=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,s["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(36),s=r(o),a=n(5),u=r(a);e["default"]=i},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue), -t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),s=r(o),a=n(7),u=function(){function t(e,n,r){i(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return s["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(37),s=r(o),a=n(39),u=r(a);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(h,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function s(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function a(t,e,n,r,i){var o=document.createElementNS(h,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(2),c=r(u),f=n(7),h="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(a(s-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&a(s-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(h,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",h),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){C.prototype[e]=C.prototype[e.toUpperCase()]=C.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var s=(0,h["default"])(i._options,r),a=t[e],u=o(n,a,s);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new x.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,d["default"])(i);for(var o=0;o=200)r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):100===r?n=this.nextB(t,e+1):98===r?(t[0]=t[0]>95?t[0]-96:t[0],n=this.nextA(t,e+1)):n=this.nextA(t,e+1);else{var o=t[0];r=o<32?o+64:o-32,t.shift(),n=this.nextA(t,e+1)}var i=this.getEncoding(r),a=r*e;return{result:i+n.result,checksum:a+n.checksum}},e.prototype.nextB=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):101===r?n=this.nextA(t,e+1):98===r?(t[0]=t[0]<32?t[0]+96:t[0],n=this.nextB(t,e+1)):n=this.nextB(t,e+1)):(r=t[0]-32,t.shift(),n=this.nextB(t,e+1));var o=this.getEncoding(r),i=r*e;return{result:o+n.result,checksum:i+n.checksum}},e.prototype.nextC=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),n=100===r?this.nextB(t,e+1):101===r?this.nextA(t,e+1):this.nextC(t,e+1)):(r=10*(t[0]-48)+t[1]-48,t.shift(),t.shift(),n=this.nextC(t,e+1));var o=this.getEncoding(r),i=r*e;return{result:o+n.result,checksum:i+n.checksum}},e}(s["default"]);e["default"]=c},function(t,e){"use strict";function n(t){for(var e=0,n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function i(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function c(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var o=r.measureText(t).width;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var f=n(3),l=r(f);e.getMaximumHeightOfEncodings=s,e.getEncodingHeight=o,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(19),o=n(18),i=n(25),a=n(28),u=n(27),s=n(33),c=n(35),f=n(34),l=n(26);e["default"]={CODE39:r.CODE39,CODE128:o.CODE128,CODE128A:o.CODE128A,CODE128B:o.CODE128B,CODE128C:o.CODE128C,EAN13:i.EAN13,EAN8:i.EAN8,EAN5:i.EAN5,EAN2:i.EAN2,UPC:i.UPC,ITF14:a.ITF14,ITF:u.ITF,MSI:s.MSI,MSI10:s.MSI10,MSI11:s.MSI11,MSI1010:s.MSI1010,MSI1110:s.MSI1110,pharmacode:c.pharmacode,codabar:f.codabar,GenericBarcode:l.GenericBarcode}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if("string"==typeof t)return i(t);if(Array.isArray(t)){for(var e=[],n=0;n=2?String.fromCharCode(210)+f(t):n>r?String.fromCharCode(208)+s(t):String.fromCharCode(209)+c(t),e=e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(t,e){return String.fromCharCode(203)+e})}function s(t){var e=t.match(/^([\x00-\x5F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+f(t.substring(e[1].length));var n=t.match(/^[\x00-\x5F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(205)+c(t.substring(n[0].length))}function c(t){var e=t.match(/^([\x20-\x7F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+f(t.substring(e[1].length));var n=t.match(/^[\x20-\x7F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(206)+s(t.substring(n[0].length))}function f(t){var e=t.match(/^(\xCF*[0-9]{2}\xCF*)+/)[0],n=e.length;if(n===t.length)return t;t=t.substring(n);var r=t.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length,o=t.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length;return r>=o?e+String.fromCharCode(206)+s(t):e+String.fromCharCode(205)+c(t)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(4),p=r(l),h=function(t){function e(n,r){if(o(this,e),n.search(/^[\x00-\x7F\xC8-\xD3]+$/)!==-1)var a=i(this,t.call(this,u(n),r));else var a=i(this,t.call(this,n,r));return i(a)}return a(e,t),e}(p["default"]);e["default"]=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var o=n(17),i=r(o),a=n(14),u=r(a),s=n(15),c=r(s),f=n(16),l=r(f);e.CODE128=i["default"],e.CODE128A=u["default"],e.CODE128B=c["default"],e.CODE128C=l["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){return s(f(t))}function s(t){return b[t].toString(2)}function c(t){return y[t]}function f(t){return y.indexOf(t)}function l(t){for(var e=0,n=0;n10*r.width?a.fontSize=10*r.width:a.fontSize=r.fontSize,a.guardHeight=r.height+a.fontSize/2+r.textMargin,a.lastChar=r.lastChar,a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{13}$/)!==-1&&this.data[12]==u(this.data)},e.prototype.encode=function(){var t=new c["default"],e=[],n=this.structure[this.data[0]],r=this.data.substr(1,6),o=this.data.substr(7,6);return this.options.displayValue&&e.push({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),e.push({data:t.encode(r,n),text:this.text.substr(1,6),options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(o,"RRRRRR"),text:this.text.substr(7,6),options:{fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),this.options.lastChar&&this.options.displayValue&&(e.push({data:"00"}),e.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}})),e},e}(l["default"]);e["default"]=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),s=r(u),c=n(0),f=r(c),l=function(t){function e(n,r){o(this,e);var a=i(this,t.call(this,n,r));return a.structure=["LL","LG","GL","GG"],a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{2}$/)!==-1},e.prototype.encode=function(){var t=new s["default"],e=this.structure[parseInt(this.data)%4],n="1011";return n+=t.encode(this.data,e,"01"),{data:n,text:this.text}},e}(f["default"]);e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),s=r(u),c=n(0),f=r(c),l=function(t){function e(n,r){o(this,e);var a=i(this,t.call(this,n,r));return a.structure=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{5}$/)!==-1},e.prototype.encode=function(){var t=new s["default"],e=this.checksum(),n="1011";return n+=t.encode(this.data,this.structure[e],"01"),{data:n,text:this.text}},e.prototype.checksum=function(){var t=0;return t+=3*parseInt(this.data[0]),t+=9*parseInt(this.data[1]),t+=3*parseInt(this.data[2]),t+=9*parseInt(this.data[3]),t+=3*parseInt(this.data[4]),t%10},e}(f["default"]);e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e,n=0;for(e=0;e<7;e+=2)n+=3*parseInt(t[e]);for(e=1;e<7;e+=2)n+=parseInt(t[e]);return(10-n%10)%10}Object.defineProperty(e,"__esModule",{value:!0});var s=n(1),c=r(s),f=n(0),l=r(f),p=function(t){function e(n,r){return o(this,e),n.search(/^[0-9]{7}$/)!==-1&&(n+=u(n)),i(this,t.call(this,n,r))}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{8}$/)!==-1&&this.data[7]==u(this.data)},e.prototype.encode=function(){var t=new c["default"],e="",n=this.data.substr(0,4),r=this.data.substr(4,4);return e+=t.startBin,e+=t.encode(n,"LLLL"),e+=t.middleBin,e+=t.encode(r,"RRRR"),e+=t.endBin,{data:e,text:this.text}},e}(l["default"]);e["default"]=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10}Object.defineProperty(e,"__esModule",{value:!0});var s=n(1),c=r(s),f=n(0),l=r(f),p=function(t){function e(n,r){o(this,e),n.search(/^[0-9]{11}$/)!==-1&&(n+=u(n));var a=i(this,t.call(this,n,r));return a.displayValue=r.displayValue,r.fontSize>10*r.width?a.fontSize=10*r.width:a.fontSize=r.fontSize,a.guardHeight=r.height+a.fontSize/2+r.textMargin,a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==u(this.data)},e.prototype.encode=function(){var t=new c["default"],e=[];return this.displayValue&&e.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101"+t.encode(this.data[0],"L"),options:{height:this.guardHeight}}),e.push({data:t.encode(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),e.push({data:t.encode(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&e.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),e},e}(l["default"]);e["default"]=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var o=n(20),i=r(o),a=n(23),u=r(a),s=n(22),c=r(s),f=n(21),l=r(f),p=n(24),h=r(p);e.EAN13=i["default"],e.EAN8=u["default"],e.EAN5=c["default"],e.EAN2=l["default"],e.UPC=h["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GenericBarcode=void 0;var u=n(0),s=r(u),c=function(t){function e(n,r){return o(this,e),i(this,t.call(this,n,r))}return a(e,t),e.prototype.encode=function(){return{data:"10101010101010101010101010101010101010101",text:this.text}},e.prototype.valid=function(){return!0},e}(s["default"]);e.GenericBarcode=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.ITF=void 0;var u=n(0),s=r(u),c=function(t){function e(n,r){o(this,e);var a=i(this,t.call(this,n,r));return a.binaryRepresentation={0:"00110",1:"10001",2:"01001",3:"11000",4:"00101",5:"10100",6:"01100",7:"00011",8:"10010",9:"01010"},a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^([0-9]{2})+$/)!==-1},e.prototype.encode=function(){for(var t="1010",e=0;e=3&&this.number<=131070},e}(s["default"]);e.pharmacode=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e={};for(var n in s["default"])s["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,a["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var i=n(37),a=r(i),u=n(7),s=r(u);e["default"]=o},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),a=r(i),u=n(8),s=function(){function t(e,n,r){o(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(o=0,n.textAlign="left"):"right"==t.textAlign?(o=e.width-1,n.textAlign="right"):(o=e.width/2,n.textAlign="center"),n.fillText(e.text,o,i)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){switch(t){case"canvas":return a["default"];case"svg":return s["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var i=n(38),a=r(i),u=n(40),s=r(u);e.getRendererClass=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var r=document.createElementNS(l,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function u(t,e,n,r,o){var i=document.createElementNS(l,"rect");i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(3),c=r(s),f=n(8),l="http://www.w3.org/2000/svg",p=function(){function t(e,n,r){o(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(u(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&u(a-e.width*(i-1),r,e.width*i,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(l,"text");if(e.displayValue){var o,i;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(o=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(o=n.width-1,r.setAttribute("text-anchor","end")):(o=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",o),r.setAttribute("y",i),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",l),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=p},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){O.prototype[e]=O.prototype[e.toUpperCase()]=O.prototype[e.toLowerCase()]=function(n,r){var o=this;return o._errorHandler.wrapBarcodeCall(function(){var a=(0,l["default"])(o._options,r),u=t[e],s=i(n,u,a);return o._encodings.push(s),o})}}function i(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new w.InvalidInputException(r.constructor.name,t);var o=r.encode();o=(0,h["default"])(o);for(var i=0;i0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function d(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var f=n(0),c=r(f);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9);e["default"]={codabar:r.codabar}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(12),a=r(o),s=n(14),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),d=r(u),f=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){A.prototype[e]=A.prototype[e.toUpperCase()]=A.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new x.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(10);e["default"]={codabar:r.codabar}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(13),a=r(o),s=n(15),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){A.prototype[e]=A.prototype[e.toUpperCase()]=A.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o=200)r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):100===r?n=this.nextB(t,e+1):98===r?(t[0]=t[0]>95?t[0]-96:t[0],n=this.nextA(t,e+1)):n=this.nextA(t,e+1);else{var i=t[0];r=i<32?i+64:i-32,t.shift(),n=this.nextA(t,e+1)}var o=this.getEncoding(r),a=r*e;return{result:o+n.result,checksum:a+n.checksum}},t.prototype.nextB=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):101===r?n=this.nextA(t,e+1):98===r?(t[0]=t[0]<32?t[0]+96:t[0],n=this.nextB(t,e+1)):n=this.nextB(t,e+1)):(r=t[0]-32,t.shift(),n=this.nextB(t,e+1));var i=this.getEncoding(r),o=r*e;return{result:i+n.result,checksum:o+n.checksum}},t.prototype.nextC=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),n=100===r?this.nextB(t,e+1):101===r?this.nextA(t,e+1):this.nextC(t,e+1)):(r=10*(t[0]-48)+t[1]-48,t.shift(),t.shift(),n=this.nextC(t,e+1));var i=this.getEncoding(r),o=r*e;return{result:i+n.result,checksum:o+n.checksum}},t}();e["default"]=r},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};e["default"]=n},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(i,o){n(this,e);var a=r(this,t.call(this));return a.name="InvalidInputException",a.symbology=i,a.input=o,a.message='"'+a.input+'" is not a valid input for '+a.symbology,a}return i(e,t),e}(Error),a=function(t){function e(){n(this,e);var i=r(this,t.call(this));return i.name="InvalidElementException",i.message="Not supported type to render on",i}return i(e,t),e}(Error),s=function(t){function e(){n(this,e);var i=r(this,t.call(this));return i.name="NoElementException",i.message="No element to render on.",i}return i(e,t),e}(Error);e.InvalidInputException=o,e.InvalidElementException=a,e.NoElementException=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return e.height+(e.displayValue&&t.text.length>0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var c=n(0),l=r(c);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(14);e["default"]={CODE128:r.CODE128,CODE128A:r.CODE128A,CODE128B:r.CODE128B,CODE128C:r.CODE128C}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n=2?String.fromCharCode(210)+c(t):n>r?String.fromCharCode(208)+u(t):String.fromCharCode(209)+f(t),e=e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(t,e){return String.fromCharCode(203)+e})}function u(t){var e=t.match(/^([\x00-\x5F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+c(t.substring(e[1].length));var n=t.match(/^[\x00-\x5F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(205)+f(t.substring(n[0].length))}function f(t){var e=t.match(/^([\x20-\x7F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+c(t.substring(e[1].length));var n=t.match(/^[\x20-\x7F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(206)+u(t.substring(n[0].length))}function c(t){var e=t.match(/^(\xCF*[0-9]{2}\xCF*)+/)[0],n=e.length;if(n===t.length)return t;t=t.substring(n);var r=t.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length,i=t.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length;return r>=i?e+String.fromCharCode(206)+u(t):e+String.fromCharCode(205)+f(t)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(1),d=r(l),h=function(t){function e(n){if(i(this,e),n.search(/^[\x00-\x7F\xC8-\xD3]+$/)!==-1)var r=o(this,t.call(this,s(n)));else var r=o(this,t.call(this,n));return o(r)}return a(e,t),e}(d["default"]);e["default"]=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var i=n(13),o=r(i),a=n(10),s=r(a),u=n(11),f=r(u),c=n(12),l=r(c);e.CODE128=o["default"],e.CODE128A=s["default"],e.CODE128B=f["default"],e.CODE128C=l["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,a["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(16),a=r(o),s=n(2),u=r(s);e["default"]=i},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=r(o),s=n(4),u=function(){function t(e,n,r){i(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(17),a=r(o),s=n(19),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(l,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(l,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),c=n(4),l="http://www.w3.org/2000/svg",d=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(l,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",l),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){_.prototype[e]=_.prototype[e.toUpperCase()]=_.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,l["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new C.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o=200)r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):100===r?n=this.nextB(t,e+1):98===r?(t[0]=t[0]>95?t[0]-96:t[0],n=this.nextA(t,e+1)):n=this.nextA(t,e+1);else{var o=t[0];r=o<32?o+64:o-32,t.shift(),n=this.nextA(t,e+1)}var i=this.getEncoding(r),a=r*e;return{result:i+n.result,checksum:a+n.checksum}},e.prototype.nextB=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),99===r?n=this.nextC(t,e+1):101===r?n=this.nextA(t,e+1):98===r?(t[0]=t[0]<32?t[0]+96:t[0],n=this.nextB(t,e+1)):n=this.nextB(t,e+1)):(r=t[0]-32,t.shift(),n=this.nextB(t,e+1));var o=this.getEncoding(r),i=r*e;return{result:o+n.result,checksum:i+n.checksum}},e.prototype.nextC=function(t,e){if(t.length<=0)return{result:"",checksum:0};var n,r;t[0]>=200?(r=t[0]-105,t.shift(),n=100===r?this.nextB(t,e+1):101===r?this.nextA(t,e+1):this.nextC(t,e+1)):(r=10*(t[0]-48)+t[1]-48,t.shift(),t.shift(),n=this.nextC(t,e+1));var o=this.getEncoding(r),i=r*e;return{result:o+n.result,checksum:i+n.checksum}},e}(u["default"]);e["default"]=f},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){function e(o,i){n(this,e);var a=r(this,t.call(this));return a.name="InvalidInputException",a.symbology=o,a.input=i,a.message='"'+a.input+'" is not a valid input for '+a.symbology,a}return o(e,t),e}(Error),a=function(t){function e(){n(this,e);var o=r(this,t.call(this));return o.name="InvalidElementException",o.message="Not supported type to render on",o}return o(e,t),e}(Error),s=function(t){function e(){n(this,e);var o=r(this,t.call(this));return o.name="NoElementException",o.message="No element to render on.",o}return o(e,t),e}(Error);e.InvalidInputException=i,e.InvalidElementException=a,e.NoElementException=s},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return e.height+(e.displayValue&&t.text.length>0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function i(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var o=r.measureText(t).width;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var c=n(0),l=r(c);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=o,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(15);e["default"]={CODE128:r.CODE128,CODE128A:r.CODE128A,CODE128B:r.CODE128B,CODE128C:r.CODE128C}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if("string"==typeof t)return i(t);if(Array.isArray(t)){for(var e=[],n=0;n=2?String.fromCharCode(210)+c(t):n>r?String.fromCharCode(208)+u(t):String.fromCharCode(209)+f(t),e=e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(t,e){return String.fromCharCode(203)+e})}function u(t){var e=t.match(/^([\x00-\x5F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+c(t.substring(e[1].length));var n=t.match(/^[\x00-\x5F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(205)+f(t.substring(n[0].length))}function f(t){var e=t.match(/^([\x20-\x7F\xC8-\xCF]+?)(([0-9]{2}){2,})([^0-9]|$)/);if(e)return e[1]+String.fromCharCode(204)+c(t.substring(e[1].length));var n=t.match(/^[\x20-\x7F\xC8-\xCF]+/);return n[0].length===t.length?t:n[0]+String.fromCharCode(206)+u(t.substring(n[0].length))}function c(t){var e=t.match(/^(\xCF*[0-9]{2}\xCF*)+/)[0],n=e.length;if(n===t.length)return t;t=t.substring(n);var r=t.match(/^[\x00-\x5F\xC8-\xCF]*/)[0].length,o=t.match(/^[\x20-\x7F\xC8-\xCF]*/)[0].length;return r>=o?e+String.fromCharCode(206)+u(t):e+String.fromCharCode(205)+f(t)}Object.defineProperty(e,"__esModule",{value:!0});var l=n(1),d=r(l),h=function(t){function e(n,r){if(o(this,e),n.search(/^[\x00-\x7F\xC8-\xD3]+$/)!==-1)var a=i(this,t.call(this,s(n),r));else var a=i(this,t.call(this,n,r));return i(a)}return a(e,t),e}(d["default"]);e["default"]=h},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var o=n(14),i=r(o),a=n(11),s=r(a),u=n(12),f=r(u),c=n(13),l=r(c);e.CODE128=i["default"],e.CODE128A=s["default"],e.CODE128B=f["default"],e.CODE128C=l["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,a["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var i=n(17),a=r(i),s=n(3),u=r(s);e["default"]=o},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=r(i),s=n(4),u=function(){function t(e,n,r){o(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(o=0,n.textAlign="left"):"right"==t.textAlign?(o=e.width-1,n.textAlign="right"):(o=e.width/2,n.textAlign="center"),n.fillText(e.text,o,i)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var i=n(18),a=r(i),s=n(20),u=r(s);e.getRendererClass=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var r=document.createElementNS(l,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,o){var i=document.createElementNS(l,"rect");i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),c=n(4),l="http://www.w3.org/2000/svg",d=function(){function t(e,n,r){o(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&s(a-e.width*(i-1),r,e.width*i,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(l,"text");if(e.displayValue){var o,i;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(o=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(o=n.width-1,r.setAttribute("text-anchor","end")):(o=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",o),r.setAttribute("y",i),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",l),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){_.prototype[e]=_.prototype[e.toUpperCase()]=_.prototype[e.toLowerCase()]=function(n,r){var o=this;return o._errorHandler.wrapBarcodeCall(function(){var a=(0,l["default"])(o._options,r),s=t[e],u=i(n,s,a);return o._encodings.push(u),o})}}function i(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var o=r.encode();o=(0,h["default"])(o);for(var i=0;i0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function d(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var f=n(0),c=r(f);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9);e["default"]={CODE39:r.CODE39}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(12),a=r(o),s=n(14),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),d=r(u),f=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new x.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(10);e["default"]={CODE39:r.CODE39}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(13),a=r(o),s=n(15),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,p["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var i;i="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,i.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var r=i.measureText(t).width;return r}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(1),c=i(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=r,e.getBarcodePadding=o,e.calculateEncodingAttributes=s,e.getTotalWidthOfEncodings=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(15);e["default"]={EAN13:i.EAN13,EAN8:i.EAN8,EAN5:i.EAN5,EAN2:i.EAN2,UPC:i.UPC}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=i},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n10*n.width?this.fontSize=10*n.width:this.fontSize=n.fontSize,this.guardHeight=n.height+this.fontSize/2+n.textMargin,this.lastChar=n.lastChar}return t.prototype.valid=function(){return this.string.search(/^[0-9]{13}$/)!==-1&&this.string[12]==this.checksum(this.string)},t.prototype.encode=function(){var t=new s["default"],e=[],n=this.structure[this.string[0]],i=this.string.substr(1,6),r=this.string.substr(7,6);return this.displayValue&&e.push({data:"000000000000",text:this.string[0],options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),e.push({data:t.encode(i,n),text:i,options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(r,"RRRRRR"),text:r,options:{fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),this.lastChar&&this.displayValue&&(e.push({data:"00"}),e.push({data:"00000",text:this.lastChar,options:{fontSize:this.fontSize}})),e},t.prototype.checksum=function(t){var e,n=0;for(e=0;e<12;e+=2)n+=parseInt(t[e]);for(e=1;e<12;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10},t}();e["default"]=a},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=i(o),a=function(){function t(e){r(this,t),this.string=e,this.structure=["LL","LG","GL","GG"]}return t.prototype.valid=function(){return this.string.search(/^[0-9]{2}$/)!==-1},t.prototype.encode=function(){var t=new s["default"],e=this.structure[parseInt(this.string)%4],n="1011";return n+=t.encode(this.string,e,"01"),{data:n,text:this.string}},t}();e["default"]=a},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=i(o),a=function(){function t(e){r(this,t),this.string=e,this.structure=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"]}return t.prototype.valid=function(){return this.string.search(/^[0-9]{5}$/)!==-1},t.prototype.encode=function(){var t=new s["default"],e=this.checksum(),n="1011";return n+=t.encode(this.string,this.structure[e],"01"),{data:n,text:this.string}},t.prototype.checksum=function(){var t=0;return t+=3*parseInt(this.string[0]),t+=9*parseInt(this.string[1]),t+=3*parseInt(this.string[2]),t+=9*parseInt(this.string[3]),t+=3*parseInt(this.string[4]),t%10},t}();e["default"]=a},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=i(o),a=function(){function t(e){r(this,t),e.search(/^[0-9]{7}$/)!==-1?this.string=e+this.checksum(e):this.string=e}return t.prototype.valid=function(){return this.string.search(/^[0-9]{8}$/)!==-1&&this.string[7]==this.checksum(this.string)},t.prototype.encode=function(){var t=new s["default"],e="",n=this.string.substr(0,4),i=this.string.substr(4,4);return e+=t.startBin,e+=t.encode(n,"LLLL"),e+=t.middleBin,e+=t.encode(i,"RRRR"),e+=t.endBin,{data:e,text:this.string}},t.prototype.checksum=function(t){var e,n=0;for(e=0;e<7;e+=2)n+=3*parseInt(t[e]);for(e=1;e<7;e+=2)n+=parseInt(t[e]);return(10-n%10)%10},t}();e["default"]=a},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),s=i(o),a=function(){function t(e,n){r(this,t),e.search(/^[0-9]{11}$/)!==-1?this.string=e+this.checksum(e):this.string=e,this.displayValue=n.displayValue,n.fontSize>10*n.width?this.fontSize=10*n.width:this.fontSize=n.fontSize,this.guardHeight=n.height+this.fontSize/2+n.textMargin}return t.prototype.valid=function(){return this.string.search(/^[0-9]{12}$/)!==-1&&this.string[11]==this.checksum(this.string)},t.prototype.encode=function(){var t=new s["default"],e=[];return this.displayValue&&e.push({data:"00000000",text:this.string[0],options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101"+t.encode(this.string[0],"L"),options:{height:this.guardHeight}}),e.push({data:t.encode(this.string.substr(1,5),"LLLLL"),text:this.string.substr(1,5),options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(this.string.substr(6,5),"RRRRR"),text:this.string.substr(6,5),options:{fontSize:this.fontSize}}),e.push({data:t.encode(this.string[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&e.push({data:"00000000",text:this.string[11],options:{textAlign:"right",fontSize:this.fontSize}}),e},t.prototype.checksum=function(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10},t}();e["default"]=a},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var r=n(10),o=i(r),s=n(13),a=i(s),u=n(12),f=i(u),d=n(11),c=i(d),h=n(14),l=i(h);e.EAN13=o["default"],e.EAN8=a["default"],e.EAN5=f["default"],e.EAN2=c["default"],e.UPC=l["default"]},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,s["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(17),s=i(o),a=n(2),u=i(a);e["default"]=r},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),s=i(o),a=n(4),u=function(){function t(e,n,i){r(this,t),this.canvas=e,this.encodings=n,this.options=i}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(r=0,n.textAlign="left"):"right"==t.textAlign?(r=e.width-1,n.textAlign="right"):(r=e.width/2,n.textAlign="center"),n.fillText(e.text,r,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t){switch(t){case"canvas":return s["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(18),s=i(o),a=n(20),u=i(a);e.getRendererClass=r},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var i=document.createElementNS(c,"g");return i.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(i),i}function s(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function a(t,e,n,i,r){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",i),r.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),f=i(u),d=n(4),c="http://www.w3.org/2000/svg",h=function(){function t(e,n,i){r(this,t),this.svg=e,this.encodings=n,this.options=i}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(a(s-e.width*o,i,e.width*o,e.height,t),o=0);o>0&&a(s-e.width*(o-1),i,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var i=document.createElementNS(c,"text");if(e.displayValue){var r,o;i.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor","end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(document.createTextNode(n.text)),t.appendChild(i)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=h},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){L.prototype[e]=L.prototype[e.toUpperCase()]=L.prototype[e.toLowerCase()]=function(n,i){var r=this;return r._errorHandler.wrapBarcodeCall(function(){var s=(0,c["default"])(r._options,i),a=t[e],u=o(n,a,s);return r._encodings.push(u),r})}}function o(t,e,n){t=""+t;var i=new e(t,n);if(!i.valid())throw new _.InvalidInputException(i.constructor.name,t);var r=i.encode();r=(0,l["default"])(r);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var c=n(2),d=r(c);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(16);e["default"]={EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n10*r.width?a.fontSize=10*r.width:a.fontSize=r.fontSize,a.guardHeight=r.height+a.fontSize/2+r.textMargin,a.lastChar=r.lastChar,a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{13}$/)!==-1&&this.data[12]==s(this.data)},e.prototype.encode=function(){var t=new f["default"],e=[],n=this.structure[this.data[0]],r=this.data.substr(1,6),i=this.data.substr(7,6);return this.options.displayValue&&e.push({data:"000000000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),e.push({data:t.encode(r,n),text:this.text.substr(1,6),options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(i,"RRRRRR"),text:this.text.substr(7,6),options:{fontSize:this.fontSize}}),e.push({data:"101",options:{height:this.guardHeight}}),this.options.lastChar&&this.options.displayValue&&(e.push({data:"00"}),e.push({data:"00000",text:this.options.lastChar,options:{fontSize:this.fontSize}})),e},e}(d["default"]);e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(1),u=r(s),f=n(0),c=r(f),d=function(t){function e(n,r){i(this,e);var a=o(this,t.call(this,n,r));return a.structure=["LL","LG","GL","GG"],a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{2}$/)!==-1},e.prototype.encode=function(){var t=new u["default"],e=this.structure[parseInt(this.data)%4],n="1011";return n+=t.encode(this.data,e,"01"),{data:n,text:this.text}},e}(c["default"]);e["default"]=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(1),u=r(s),f=n(0),c=r(f),d=function(t){function e(n,r){i(this,e);var a=o(this,t.call(this,n,r));return a.structure=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{5}$/)!==-1},e.prototype.encode=function(){var t=new u["default"],e=this.checksum(),n="1011";return n+=t.encode(this.data,this.structure[e],"01"),{data:n,text:this.text}},e.prototype.checksum=function(){var t=0;return t+=3*parseInt(this.data[0]),t+=9*parseInt(this.data[1]),t+=3*parseInt(this.data[2]),t+=9*parseInt(this.data[3]),t+=3*parseInt(this.data[4]),t%10},e}(c["default"]);e["default"]=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){var e,n=0;for(e=0;e<7;e+=2)n+=3*parseInt(t[e]);for(e=1;e<7;e+=2)n+=parseInt(t[e]);return(10-n%10)%10}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),f=r(u),c=n(0),d=r(c),l=function(t){function e(n,r){return i(this,e),n.search(/^[0-9]{7}$/)!==-1&&(n+=s(n)),o(this,t.call(this,n,r))}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{8}$/)!==-1&&this.data[7]==s(this.data)},e.prototype.encode=function(){var t=new f["default"],e="",n=this.data.substr(0,4),r=this.data.substr(4,4);return e+=t.startBin,e+=t.encode(n,"LLLL"),e+=t.middleBin,e+=t.encode(r,"RRRR"),e+=t.endBin,{data:e,text:this.text}},e}(d["default"]);e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),f=r(u),c=n(0),d=r(c),l=function(t){function e(n,r){i(this,e),n.search(/^[0-9]{11}$/)!==-1&&(n+=s(n));var a=o(this,t.call(this,n,r));return a.displayValue=r.displayValue,r.fontSize>10*r.width?a.fontSize=10*r.width:a.fontSize=r.fontSize,a.guardHeight=r.height+a.fontSize/2+r.textMargin,a}return a(e,t),e.prototype.valid=function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==s(this.data)},e.prototype.encode=function(){var t=new f["default"],e=[];return this.displayValue&&e.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),e.push({data:"101"+t.encode(this.data[0],"L"),options:{height:this.guardHeight}}),e.push({data:t.encode(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),e.push({data:"01010",options:{height:this.guardHeight}}),e.push({data:t.encode(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),e.push({data:t.encode(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&e.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),e},e}(d["default"]);e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var i=n(11),o=r(i),a=n(14),s=r(a),u=n(13),f=r(u),c=n(12),d=r(c),l=n(15),h=r(l);e.EAN13=o["default"],e.EAN8=s["default"],e.EAN5=f["default"],e.EAN2=d["default"],e.UPC=h["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,a["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(18),a=r(o),s=n(4),u=r(s);e["default"]=i},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),a=r(o),s=n(5),u=function(){function t(e,n,r){i(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(19),a=r(o),s=n(21),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(d,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(d,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(2),f=r(u),c=n(5),d="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(d,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",d),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){L.prototype[e]=L.prototype[e.toUpperCase()]=L.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,d["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new m.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9);e["default"]={ITF14:r.ITF14}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(12),a=r(o),s=n(14),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(10);e["default"]={ITF14:r.ITF14}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(13),a=r(o),s=n(15),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,p["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9);e["default"]={ITF:r.ITF}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(12),a=r(o),s=n(14),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(10);e["default"]={ITF:r.ITF}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(13),a=r(o),s=n(15),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,p["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function i(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var o=r.measureText(t).width;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var c=n(1),l=r(c);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=o,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(15);e["default"]={MSI:r.MSI,MSI10:r.MSI10,MSI11:r.MSI11,MSI1010:r.MSI1010,MSI1110:r.MSI1110}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if("string"==typeof t)return i(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(o=0,n.textAlign="left"):"right"==t.textAlign?(o=e.width-1,n.textAlign="right"):(o=e.width/2,n.textAlign="center"),n.fillText(e.text,o,i)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var i=n(18),a=r(i),s=n(20),u=r(s);e.getRendererClass=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var r=document.createElementNS(l,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,o){var i=document.createElementNS(l,"rect");i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),f=r(u),c=n(5),l="http://www.w3.org/2000/svg",d=function(){function t(e,n,r){o(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&s(a-e.width*(i-1),r,e.width*i,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(l,"text");if(e.displayValue){var o,i;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(o=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(o=n.width-1,r.setAttribute("text-anchor","end")):(o=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",o),r.setAttribute("y",i),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",l),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){M.prototype[e]=M.prototype[e.toUpperCase()]=M.prototype[e.toLowerCase()]=function(n,r){var o=this;return o._errorHandler.wrapBarcodeCall(function(){var a=(0,l["default"])(o._options,r),s=t[e],u=i(n,s,a);return o._encodings.push(u),o})}}function i(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new w.InvalidInputException(r.constructor.name,t);var o=r.encode();o=(0,p["default"])(o);for(var i=0;i0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function i(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var o=r.measureText(t).width;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var c=n(1),l=r(c);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=o,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(16);e["default"]={MSI:r.MSI,MSI10:r.MSI10,MSI11:r.MSI11,MSI1010:r.MSI1010,MSI1110:r.MSI1110}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if("string"==typeof t)return i(t);if(Array.isArray(t)){for(var e=[],n=0;n0?(o=0,n.textAlign="left"):"right"==t.textAlign?(o=e.width-1,n.textAlign="right"):(o=e.width/2,n.textAlign="center"),n.fillText(e.text,o,i)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var i=n(19),a=r(i),s=n(21),u=r(s);e.getRendererClass=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var r=document.createElementNS(l,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,o){var i=document.createElementNS(l,"rect");i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),f=r(u),c=n(5),l="http://www.w3.org/2000/svg",d=function(){function t(e,n,r){o(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&s(a-e.width*(i-1),r,e.width*i,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(l,"text");if(e.displayValue){var o,i;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(o=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(o=n.width-1,r.setAttribute("text-anchor","end")):(o=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",o),r.setAttribute("y",i),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",l),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){M.prototype[e]=M.prototype[e.toUpperCase()]=M.prototype[e.toLowerCase()]=function(n,r){var o=this;return o._errorHandler.wrapBarcodeCall(function(){var a=(0,l["default"])(o._options,r),s=t[e],u=i(n,s,a);return o._encodings.push(u),o})}}function i(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new w.InvalidInputException(r.constructor.name,t);var o=r.encode();o=(0,p["default"])(o);for(var i=0;i0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9);e["default"]={pharmacode:r.pharmacode}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n=3&&this.number<=131070},t}();e.pharmacode=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,a["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(11),a=r(o),s=n(1),u=r(s);e["default"]=i},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=r(o),s=n(3),u=function(){function t(e,n,r){i(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(12),a=r(o),s=n(14),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,h["default"])(i);for(var o=0;o0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var i=r.measureText(t).width;return i}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var d=n(0),c=r(d);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=i,e.getBarcodePadding=o,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(10);e["default"]={pharmacode:r.pharmacode}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e){n(this,t),this.api=e}return t.prototype.handleCatch=function(t){if("InvalidInputException"!==t.name)throw t;if(this.api._options.valid===this.api._defaults.valid)throw t.message;this.api._options.valid(!1),this.api.render=function(){}},t.prototype.wrapBarcodeCall=function(t){try{var e=t.apply(void 0,arguments);return this.api._options.valid(!0),e}catch(n){return this.handleCatch(n),this.api}},t}();e["default"]=r},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("string"==typeof t)return o(t);if(Array.isArray(t)){for(var e=[],n=0;n=3&&this.number<=131070},e}(u["default"]);e.pharmacode=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,a["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(12),a=r(o),s=n(2),u=r(s);e["default"]=i},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),a=r(o),s=n(3),u=function(){function t(e,n,r){i(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t0?(i=0,n.textAlign="left"):"right"==t.textAlign?(i=e.width-1,n.textAlign="right"):(i=e.width/2,n.textAlign="center"),n.fillText(e.text,i,o)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var o=n(13),a=r(o),s=n(15),u=r(s);e.getRendererClass=i},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){var r=document.createElementNS(c,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,i){var o=document.createElementNS(c,"rect");o.setAttribute("x",t),o.setAttribute("y",e),o.setAttribute("width",n),o.setAttribute("height",r),i.appendChild(o)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),f=r(u),d=n(3),c="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){i(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e0&&(s(a-e.width*o,r,e.width*o,e.height,t),o=0);o>0&&s(a-e.width*(o-1),r,e.width*o,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(c,"text");if(e.displayValue){var i,o;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(i=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(i=n.width-1,r.setAttribute("text-anchor","end")):(i=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",i),r.setAttribute("y",o),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",c),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){E.prototype[e]=E.prototype[e.toUpperCase()]=E.prototype[e.toLowerCase()]=function(n,r){var i=this;return i._errorHandler.wrapBarcodeCall(function(){var a=(0,c["default"])(i._options,r),s=t[e],u=o(n,s,a);return i._encodings.push(u),i})}}function o(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid())throw new b.InvalidInputException(r.constructor.name,t);var i=r.encode();i=(0,p["default"])(i);for(var o=0;o