UNPKG

ci-plus

Version:

ci组件库

1,646 lines 90.8 kB
/** * 版本: jsbarcode@3.11.6/+esm' * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. * Original file: /npm/jsbarcode@3.11.6/bin/JsBarcode.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ var t = {}, e = {}, n = {} Object.defineProperty(n, '__esModule', { value: !0 }) ;(n.default = function t(e, n) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, t), (this.data = e), (this.text = n.text || e), (this.options = n) }), Object.defineProperty(e, '__esModule', { value: !0 }), (e.CODE39 = void 0) var r, o = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), i = (r = n) && r.__esModule ? r : { default: r } var a = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), (t = t.toUpperCase()), n.mod43 && (t += (function (t) { return u[t] })( (function (t) { for (var e = 0, n = 0; n < t.length; n++) e += s(t[n]) return (e %= 43), e })(t) )), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) ) } return ( (function (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)) })(e, i.default), o(e, [ { key: 'encode', value: function () { for (var t = c('*'), e = 0; e < this.data.length; e++) t += c(this.data[e]) + '0' return { data: (t += c('*')), text: this.text } } }, { key: 'valid', value: function () { return -1 !== this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/) } } ]), e ) })(), u = [ '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', '-', '.', ' ', '$', '/', '+', '%', '*' ], f = [ 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 c(t) { return (function (t) { return f[t].toString(2) })(s(t)) } function s(t) { return u.indexOf(t) } e.CODE39 = a var l, p = {}, d = {}, h = {}, y = {} function v(t, e, n) { return ( e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : (t[e] = n), t ) } Object.defineProperty(y, '__esModule', { value: !0 }) var b = (y.SET_A = 0), _ = (y.SET_B = 1), g = (y.SET_C = 2) y.SHIFT = 98 var O = (y.START_A = 103), E = (y.START_B = 104), w = (y.START_C = 105) ;(y.MODULO = 103), (y.STOP = 106), (y.FNC1 = 207), (y.SET_BY_CODE = (v((l = {}), O, b), v(l, E, _), v(l, w, g), l)), (y.SWAP = { 101: b, 100: _, 99: g }), (y.A_START_CHAR = String.fromCharCode(208)), (y.B_START_CHAR = String.fromCharCode(209)), (y.C_START_CHAR = String.fromCharCode(210)), (y.A_CHARS = '[\0-_È-Ï]'), (y.B_CHARS = '[ -È-Ï]'), (y.C_CHARS = '(Ï*[0-9]{2}Ï*)'), (y.BARS = [ 11011001100, 11001101100, 11001100110, 10010011e3, 10010001100, 10001001100, 10011001e3, 10011000100, 10001100100, 11001001e3, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011e3, 11011000110, 11000110110, 10100011e3, 10001011e3, 10001000110, 10110001e3, 10001101e3, 10001100010, 11010001e3, 11000101e3, 11000100010, 10110111e3, 10110001110, 10001101110, 10111011e3, 10111000110, 10001110110, 11101110110, 11010001110, 11000101110, 11011101e3, 11011100010, 11011101110, 11101011e3, 11101000110, 11100010110, 11101101e3, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, 1010011e4, 10100001100, 1001011e4, 10010000110, 10000101100, 10000100110, 1011001e4, 10110000100, 1001101e4, 10011000010, 10000110100, 10000110010, 11000010010, 1100101e4, 11110111010, 11000010100, 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111e3, 10100011110, 10001011110, 10111101e3, 10111100010, 11110101e3, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, 11010000100, 1101001e4, 11010011100, 1100011101011 ]), Object.defineProperty(h, '__esModule', { value: !0 }) var m = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), j = (function (t) { return t && t.__esModule ? t : { default: t } })(n), x = y var P = (function (t) { function e(t, n) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e) var r = (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t.substring(1), n)) return ( (r.bytes = t.split('').map(function (t) { return t.charCodeAt(0) })), r ) } return ( (function (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)) })(e, j.default), m( e, [ { key: 'valid', value: function () { return /^[\x00-\x7F\xC8-\xD3]+$/.test(this.data) } }, { key: 'encode', value: function () { var t = this.bytes, n = t.shift() - 105, r = x.SET_BY_CODE[n] if (void 0 === r) throw new RangeError('The encoding does not start with a start character.') !0 === this.shouldEncodeAsEan128() && t.unshift(x.FNC1) var o = e.next(t, 1, r) return { text: this.text === this.data ? this.text.replace(/[^\x20-\x7E]/g, '') : this.text, data: e.getBar(n) + o.result + e.getBar((o.checksum + n) % x.MODULO) + e.getBar(x.STOP) } } }, { key: 'shouldEncodeAsEan128', value: function () { var t = this.options.ean128 || !1 return 'string' == typeof t && (t = 'true' === t.toLowerCase()), t } } ], [ { key: 'getBar', value: function (t) { return x.BARS[t] ? x.BARS[t].toString() : '' } }, { key: 'correctIndex', value: function (t, e) { if (e === x.SET_A) { var n = t.shift() return n < 32 ? n + 64 : n - 32 } return e === x.SET_B ? t.shift() - 32 : 10 * (t.shift() - 48) + t.shift() - 48 } }, { key: 'next', value: function (t, n, r) { if (!t.length) return { result: '', checksum: 0 } var o = void 0, i = void 0 if (t[0] >= 200) { i = t.shift() - 105 var a = x.SWAP[i] void 0 !== a ? (o = e.next(t, n + 1, a)) : ((r !== x.SET_A && r !== x.SET_B) || i !== x.SHIFT || (t[0] = r === x.SET_A ? t[0] > 95 ? t[0] - 96 : t[0] : t[0] < 32 ? t[0] + 96 : t[0]), (o = e.next(t, n + 1, r))) } else (i = e.correctIndex(t, r)), (o = e.next(t, n + 1, r)) var u = i * n return { result: e.getBar(i) + o.result, checksum: u + o.checksum } } } ] ), e ) })() h.default = P var S = {} Object.defineProperty(S, '__esModule', { value: !0 }) var C = y, A = function (t) { return t.match(new RegExp('^' + C.A_CHARS + '*'))[0].length }, T = function (t) { return t.match(new RegExp('^' + C.B_CHARS + '*'))[0].length }, M = function (t) { return t.match(new RegExp('^' + C.C_CHARS + '*'))[0] } function R(t, e) { var n = e ? C.A_CHARS : C.B_CHARS, r = t.match(new RegExp('^(' + n + '+?)(([0-9]{2}){2,})([^0-9]|$)')) if (r) return r[1] + String.fromCharCode(204) + L(t.substring(r[1].length)) var o = t.match(new RegExp('^' + n + '+'))[0] return o.length === t.length ? t : o + String.fromCharCode(e ? 205 : 206) + R(t.substring(o.length), !e) } function L(t) { var e = M(t), n = e.length if (n === t.length) return t t = t.substring(n) var r = A(t) >= T(t) return e + String.fromCharCode(r ? 206 : 205) + R(t, r) } ;(S.default = function (t) { var e = void 0 if (M(t).length >= 2) e = C.C_START_CHAR + L(t) else { var n = A(t) > T(t) e = (n ? C.A_START_CHAR : C.B_START_CHAR) + R(t, n) } return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/, function (t, e) { return String.fromCharCode(203) + e }) }), Object.defineProperty(d, '__esModule', { value: !0 }) var k = G(h), I = G(S) function G(t) { return t && t.__esModule ? t : { default: t } } function B(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 } var D = (function (t) { function e(t, n) { if ( ((function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), /^[\x00-\x7F\xC8-\xD3]+$/.test(t)) ) var r = B(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, (0, I.default)(t), n)) else r = B(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) return B(r) } return ( (function (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)) })(e, k.default), e ) })() d.default = D var N = {} Object.defineProperty(N, '__esModule', { value: !0 }) var X = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), z = (function (t) { return t && t.__esModule ? t : { default: t } })(h), H = y var V = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, H.A_START_CHAR + t, n)) ) } return ( (function (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)) })(e, z.default), X(e, [ { key: 'valid', value: function () { return new RegExp('^' + H.A_CHARS + '+$').test(this.data) } } ]), e ) })() N.default = V var U = {} Object.defineProperty(U, '__esModule', { value: !0 }) var $ = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), F = (function (t) { return t && t.__esModule ? t : { default: t } })(h), W = y var Q = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, W.B_START_CHAR + t, n)) ) } return ( (function (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)) })(e, F.default), $(e, [ { key: 'valid', value: function () { return new RegExp('^' + W.B_CHARS + '+$').test(this.data) } } ]), e ) })() U.default = Q var J = {} Object.defineProperty(J, '__esModule', { value: !0 }) var Y = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), Z = (function (t) { return t && t.__esModule ? t : { default: t } })(h), q = y var K = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, q.C_START_CHAR + t, n)) ) } return ( (function (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)) })(e, Z.default), Y(e, [ { key: 'valid', value: function () { return new RegExp('^' + q.C_CHARS + '+$').test(this.data) } } ]), e ) })() ;(J.default = K), Object.defineProperty(p, '__esModule', { value: !0 }), (p.CODE128C = p.CODE128B = p.CODE128A = p.CODE128 = void 0) var tt = ot(d), et = ot(N), nt = ot(U), rt = ot(J) function ot(t) { return t && t.__esModule ? t : { default: t } } ;(p.CODE128 = tt.default), (p.CODE128A = et.default), (p.CODE128B = nt.default), (p.CODE128C = rt.default) var it = {}, at = {}, ut = {} Object.defineProperty(ut, '__esModule', { value: !0 }), (ut.SIDE_BIN = '101'), (ut.MIDDLE_BIN = '01010'), (ut.BINARIES = { L: [ '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011' ], G: [ '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111' ], R: [ '1110010', '1100110', '1101100', '1000010', '1011100', '1001110', '1010000', '1000100', '1001000', '1110100' ], O: [ '0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011' ], E: [ '0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111' ] }), (ut.EAN2_STRUCTURE = ['LL', 'LG', 'GL', 'GG']), (ut.EAN5_STRUCTURE = [ 'GGLLL', 'GLGLL', 'GLLGL', 'GLLLG', 'LGGLL', 'LLGGL', 'LLLGG', 'LGLGL', 'LGLLG', 'LLGLG' ]), (ut.EAN13_STRUCTURE = [ 'LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL' ]) var ft = {}, ct = {} Object.defineProperty(ct, '__esModule', { value: !0 }) var st = ut ;(ct.default = function (t, e, n) { var r = t .split('') .map(function (t, n) { return st.BINARIES[e[n]] }) .map(function (e, n) { return e ? e[t[n]] : '' }) if (n) { var o = t.length - 1 r = r.map(function (t, e) { return e < o ? t + n : t }) } return r.join('') }), Object.defineProperty(ft, '__esModule', { value: !0 }) var lt = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), pt = ut, dt = yt(ct), ht = yt(n) function yt(t) { return t && t.__esModule ? t : { default: t } } var vt = (function (t) { function e(t, n) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e) var r = (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) return ( (r.fontSize = !n.flat && n.fontSize > 10 * n.width ? 10 * n.width : n.fontSize), (r.guardHeight = n.height + r.fontSize / 2 + n.textMargin), r ) } return ( (function (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)) })(e, ht.default), lt(e, [ { key: 'encode', value: function () { return this.options.flat ? this.encodeFlat() : this.encodeGuarded() } }, { key: 'leftText', value: function (t, e) { return this.text.substr(t, e) } }, { key: 'leftEncode', value: function (t, e) { return (0, dt.default)(t, e) } }, { key: 'rightText', value: function (t, e) { return this.text.substr(t, e) } }, { key: 'rightEncode', value: function (t, e) { return (0, dt.default)(t, e) } }, { key: 'encodeGuarded', value: function () { var t = { fontSize: this.fontSize }, e = { height: this.guardHeight } return [ { data: pt.SIDE_BIN, options: e }, { data: this.leftEncode(), text: this.leftText(), options: t }, { data: pt.MIDDLE_BIN, options: e }, { data: this.rightEncode(), text: this.rightText(), options: t }, { data: pt.SIDE_BIN, options: e } ] } }, { key: 'encodeFlat', value: function () { return { data: [ pt.SIDE_BIN, this.leftEncode(), pt.MIDDLE_BIN, this.rightEncode(), pt.SIDE_BIN ].join(''), text: this.text } } } ]), e ) })() ;(ft.default = vt), Object.defineProperty(at, '__esModule', { value: !0 }) var bt = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), _t = function t(e, n, r) { null === e && (e = Function.prototype) var o = Object.getOwnPropertyDescriptor(e, n) if (void 0 === o) { var i = Object.getPrototypeOf(e) return null === i ? void 0 : t(i, n, r) } if ('value' in o) return o.value var a = o.get return void 0 !== a ? a.call(r) : void 0 }, gt = ut, Ot = (function (t) { return t && t.__esModule ? t : { default: t } })(ft) var Et = function (t) { return ( (10 - (t .substr(0, 12) .split('') .map(function (t) { return +t }) .reduce(function (t, e, n) { return n % 2 ? t + 3 * e : t + e }, 0) % 10)) % 10 ) }, wt = (function (t) { function e(t, n) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), -1 !== t.search(/^[0-9]{12}$/) && (t += Et(t)) var r = (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) return (r.lastChar = n.lastChar), r } return ( (function (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)) })(e, Ot.default), bt(e, [ { key: 'valid', value: function () { return -1 !== this.data.search(/^[0-9]{13}$/) && +this.data[12] === Et(this.data) } }, { key: 'leftText', value: function () { return _t( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'leftText', this ).call(this, 1, 6) } }, { key: 'leftEncode', value: function () { var t = this.data.substr(1, 6), n = gt.EAN13_STRUCTURE[this.data[0]] return _t( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'leftEncode', this ).call(this, t, n) } }, { key: 'rightText', value: function () { return _t( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'rightText', this ).call(this, 7, 6) } }, { key: 'rightEncode', value: function () { var t = this.data.substr(7, 6) return _t( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'rightEncode', this ).call(this, t, 'RRRRRR') } }, { key: 'encodeGuarded', value: function () { var t = _t( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'encodeGuarded', this ).call(this) return ( this.options.displayValue && (t.unshift({ data: '000000000000', text: this.text.substr(0, 1), options: { textAlign: 'left', fontSize: this.fontSize } }), this.options.lastChar && (t.push({ data: '00' }), t.push({ data: '00000', text: this.options.lastChar, options: { fontSize: this.fontSize } }))), t ) } } ]), e ) })() at.default = wt var mt = {} Object.defineProperty(mt, '__esModule', { value: !0 }) var jt = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), xt = function t(e, n, r) { null === e && (e = Function.prototype) var o = Object.getOwnPropertyDescriptor(e, n) if (void 0 === o) { var i = Object.getPrototypeOf(e) return null === i ? void 0 : t(i, n, r) } if ('value' in o) return o.value var a = o.get return void 0 !== a ? a.call(r) : void 0 }, Pt = (function (t) { return t && t.__esModule ? t : { default: t } })(ft) var St = function (t) { return ( (10 - (t .substr(0, 7) .split('') .map(function (t) { return +t }) .reduce(function (t, e, n) { return n % 2 ? t + e : t + 3 * e }, 0) % 10)) % 10 ) }, Ct = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), -1 !== t.search(/^[0-9]{7}$/) && (t += St(t)), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) ) } return ( (function (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)) })(e, Pt.default), jt(e, [ { key: 'valid', value: function () { return -1 !== this.data.search(/^[0-9]{8}$/) && +this.data[7] === St(this.data) } }, { key: 'leftText', value: function () { return xt( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'leftText', this ).call(this, 0, 4) } }, { key: 'leftEncode', value: function () { var t = this.data.substr(0, 4) return xt( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'leftEncode', this ).call(this, t, 'LLLL') } }, { key: 'rightText', value: function () { return xt( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'rightText', this ).call(this, 4, 4) } }, { key: 'rightEncode', value: function () { var t = this.data.substr(4, 4) return xt( e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), 'rightEncode', this ).call(this, t, 'RRRR') } } ]), e ) })() mt.default = Ct var At = {} Object.defineProperty(At, '__esModule', { value: !0 }) var Tt = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), Mt = ut, Rt = kt(ct), Lt = kt(n) function kt(t) { return t && t.__esModule ? t : { default: t } } var It = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) ) } return ( (function (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)) })(e, Lt.default), Tt(e, [ { key: 'valid', value: function () { return -1 !== this.data.search(/^[0-9]{5}$/) } }, { key: 'encode', value: function () { var t, e = Mt.EAN5_STRUCTURE[ ((t = this.data), t .split('') .map(function (t) { return +t }) .reduce(function (t, e, n) { return n % 2 ? t + 9 * e : t + 3 * e }, 0) % 10) ] return { data: '1011' + (0, Rt.default)(this.data, e, '01'), text: this.text } } } ]), e ) })() At.default = It var Gt = {} Object.defineProperty(Gt, '__esModule', { value: !0 }) var Bt = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), Dt = ut, Nt = zt(ct), Xt = zt(n) function zt(t) { return t && t.__esModule ? t : { default: t } } var Ht = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) ) } return ( (function (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)) })(e, Xt.default), Bt(e, [ { key: 'valid', value: function () { return -1 !== this.data.search(/^[0-9]{2}$/) } }, { key: 'encode', value: function () { var t = Dt.EAN2_STRUCTURE[parseInt(this.data) % 4] return { data: '1011' + (0, Nt.default)(this.data, t, '01'), text: this.text } } } ]), e ) })() Gt.default = Ht var Vt = {} Object.defineProperty(Vt, '__esModule', { value: !0 }) var Ut = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })() Vt.checksum = Jt var $t = Wt(ct), Ft = Wt(n) function Wt(t) { return t && t.__esModule ? t : { default: t } } var Qt = (function (t) { function e(t, n) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), -1 !== t.search(/^[0-9]{11}$/) && (t += Jt(t)) var r = (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) return ( (r.displayValue = n.displayValue), n.fontSize > 10 * n.width ? (r.fontSize = 10 * n.width) : (r.fontSize = n.fontSize), (r.guardHeight = n.height + r.fontSize / 2 + n.textMargin), r ) } return ( (function (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)) })(e, Ft.default), Ut(e, [ { key: 'valid', value: function () { return -1 !== this.data.search(/^[0-9]{12}$/) && this.data[11] == Jt(this.data) } }, { key: 'encode', value: function () { return this.options.flat ? this.flatEncoding() : this.guardedEncoding() } }, { key: 'flatEncoding', value: function () { var t = '' return ( (t += '101'), (t += (0, $t.default)(this.data.substr(0, 6), 'LLLLLL')), (t += '01010'), (t += (0, $t.default)(this.data.substr(6, 6), 'RRRRRR')), { data: (t += '101'), text: this.text } ) } }, { key: 'guardedEncoding', value: function () { var t = [] return ( this.displayValue && t.push({ data: '00000000', text: this.text.substr(0, 1), options: { textAlign: 'left', fontSize: this.fontSize } }), t.push({ data: '101' + (0, $t.default)(this.data[0], 'L'), options: { height: this.guardHeight } }), t.push({ data: (0, $t.default)(this.data.substr(1, 5), 'LLLLL'), text: this.text.substr(1, 5), options: { fontSize: this.fontSize } }), t.push({ data: '01010', options: { height: this.guardHeight } }), t.push({ data: (0, $t.default)(this.data.substr(6, 5), 'RRRRR'), text: this.text.substr(6, 5), options: { fontSize: this.fontSize } }), t.push({ data: (0, $t.default)(this.data[11], 'R') + '101', options: { height: this.guardHeight } }), this.displayValue && t.push({ data: '00000000', text: this.text.substr(11, 1), options: { textAlign: 'right', fontSize: this.fontSize } }), t ) } } ]), e ) })() function Jt(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 } Vt.default = Qt var Yt = {} Object.defineProperty(Yt, '__esModule', { value: !0 }) var Zt = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), qt = ee(ct), Kt = ee(n), te = Vt function ee(t) { return t && t.__esModule ? t : { default: t } } function ne(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 } var re = [ 'XX00000XXX', 'XX10000XXX', 'XX20000XXX', 'XXX00000XX', 'XXXX00000X', 'XXXXX00005', 'XXXXX00006', 'XXXXX00007', 'XXXXX00008', 'XXXXX00009' ], oe = [ ['EEEOOO', 'OOOEEE'], ['EEOEOO', 'OOEOEE'], ['EEOOEO', 'OOEEOE'], ['EEOOOE', 'OOEEEO'], ['EOEEOO', 'OEOOEE'], ['EOOEEO', 'OEEOOE'], ['EOOOEE', 'OEEEOO'], ['EOEOEO', 'OEOEOE'], ['EOEOOE', 'OEOEEO'], ['EOOEOE', 'OEEOEO'] ], ie = (function (t) { function e(t, n) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e) var r = ne(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t, n)) if (((r.isValid = !1), -1 !== t.search(/^[0-9]{6}$/))) (r.middleDigits = t), (r.upcA = ae(t, '0')), (r.text = n.text || '' + r.upcA[0] + t + r.upcA[r.upcA.length - 1]), (r.isValid = !0) else { if (-1 === t.search(/^[01][0-9]{7}$/)) return ne(r) if ( ((r.middleDigits = t.substring(1, t.length - 1)), (r.upcA = ae(r.middleDigits, t[0])), r.upcA[r.upcA.length - 1] !== t[t.length - 1]) ) return ne(r) r.isValid = !0 } return ( (r.displayValue = n.displayValue), n.fontSize > 10 * n.width ? (r.fontSize = 10 * n.width) : (r.fontSize = n.fontSize), (r.guardHeight = n.height + r.fontSize / 2 + n.textMargin), r ) } return ( (function (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)) })(e, Kt.default), Zt(e, [ { key: 'valid', value: function () { return this.isValid } }, { key: 'encode', value: function () { return this.options.flat ? this.flatEncoding() : this.guardedEncoding() } }, { key: 'flatEncoding', value: function () { var t = '' return ( (t += '101'), (t += this.encodeMiddleDigits()), { data: (t += '010101'), text: this.text } ) } }, { key: 'guardedEncoding', value: function () { var t = [] return ( this.displayValue && t.push({ data: '00000000', text: this.text[0], options: { textAlign: 'left', fontSize: this.fontSize } }), t.push({ data: '101', options: { height: this.guardHeight } }), t.push({ data: this.encodeMiddleDigits(), text: this.text.substring(1, 7), options: { fontSize: this.fontSize } }), t.push({ data: '010101', options: { height: this.guardHeight } }), this.displayValue && t.push({ data: '00000000', text: this.text[7], options: { textAlign: 'right', fontSize: this.fontSize } }), t ) } }, { key: 'encodeMiddleDigits', value: function () { var t = this.upcA[0], e = this.upcA[this.upcA.length - 1], n = oe[parseInt(e)][parseInt(t)] return (0, qt.default)(this.middleDigits, n) } } ]), e ) })() function ae(t, e) { for (var n = parseInt(t[t.length - 1]), r = re[n], o = '', i = 0, a = 0; a < r.length; a++) { var u = r[a] o += 'X' === u ? t[i++] : u } return '' + (o = '' + e + o) + (0, te.checksum)(o) } ;(Yt.default = ie), Object.defineProperty(it, '__esModule', { value: !0 }), (it.UPCE = it.UPC = it.EAN2 = it.EAN5 = it.EAN8 = it.EAN13 = void 0) var ue = de(at), fe = de(mt), ce = de(At), se = de(Gt), le = de(Vt), pe = de(Yt) function de(t) { return t && t.__esModule ? t : { default: t } } ;(it.EAN13 = ue.default), (it.EAN8 = fe.default), (it.EAN5 = ce.default), (it.EAN2 = se.default), (it.UPC = le.default), (it.UPCE = pe.default) var he = {}, ye = {}, ve = {} Object.defineProperty(ve, '__esModule', { value: !0 }), (ve.START_BIN = '1010'), (ve.END_BIN = '11101'), (ve.BINARIES = [ '00110', '10001', '01001', '11000', '00101', '10100', '01100', '00011', '10010', '01010' ]), Object.defineProperty(ye, '__esModule', { value: !0 }) var be = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), _e = ve, ge = (function (t) { return t && t.__esModule ? t : { default: t } })(n) var Oe = (function (t) { function e() { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), (function (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 })(this, (e.__proto__ || Object.getPrototypeOf(e)).apply(this, arguments)) ) } return ( (function (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)) })(e, ge.default), be(e, [ { key: 'valid', value: function () { return -1 !== this.data.search(/^([0-9]{2})+$/) } }, { key: 'encode', value: function () { var t = this, e = this.data .match(/.{2}/g) .map(function (e) { return t.encodePair(e) }) .join('') return { data: _e.START_BIN + e + _e.END_BIN, text: this.text } } }, { key: 'encodePair', value: function (t) { var e = _e.BINARIES[t[1]] return _e.BINARIES[t[0]] .split('') .map(function (t, n) { return ('1' === t ? '111' : '1') + ('1' === e[n] ? '000' : '0') }) .join('') } } ]), e ) })() ye.default = Oe var Ee = {} Object.defineProperty(Ee, '__esModule', { value: !0 }) var we = (function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var r = e[n] ;(r.enumerable = r.enumerable || !1), (r.configurable = !0), 'value' in r && (r.writable = !0), Object.defineProperty(t, r.key, r) } } return function (e, n, r) { return n && t(e.prototype, n), r && t(e, r), e } })(), me = (function (t) { return t && t.__esModule ? t : { default: t } })(ye) var je = function (t) { var e = t .substr(0, 13) .split('') .map(function (t) { return parseInt(t, 10) }) .reduce(function (t, e, n) { return t + e * (3 - (n % 2) * 2) }, 0) return 10 * Math.ceil(e / 10) - e }, xe = (function (t) { function e(t, n) { return ( (function (t, e) { if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function') })(this, e), -1