UNPKG

tpa_web_component

Version:

TPA Web Components Library

1,673 lines (1,372 loc) 2.14 MB
/******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 34: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var isCallable = __webpack_require__(4901); module.exports = function (it) { return typeof it == 'object' ? it !== null : isCallable(it); }; /***/ }), /***/ 81: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var call = __webpack_require__(9565); var aCallable = __webpack_require__(9306); var anObject = __webpack_require__(8551); var tryToString = __webpack_require__(6823); var getIteratorMethod = __webpack_require__(851); var $TypeError = TypeError; module.exports = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); throw new $TypeError(tryToString(argument) + ' is not iterable'); }; /***/ }), /***/ 116: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(6518); var call = __webpack_require__(9565); var iterate = __webpack_require__(2652); var aCallable = __webpack_require__(9306); var anObject = __webpack_require__(8551); var getIteratorDirect = __webpack_require__(1767); var iteratorClose = __webpack_require__(9539); var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); var findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('find', TypeError); // `Iterator.prototype.find` method // https://tc39.es/ecma262/#sec-iterator.prototype.find $({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, { find: function find(predicate) { anObject(this); try { aCallable(predicate); } catch (error) { iteratorClose(this, 'throw', error); } if (findWithoutClosingOnEarlyError) return call(findWithoutClosingOnEarlyError, this, predicate); var record = getIteratorDirect(this); var counter = 0; return iterate(record, function (value, stop) { if (predicate(value, counter++)) return stop(value); }, { IS_RECORD: true, INTERRUPTED: true }).result; } }); /***/ }), /***/ 139: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { __webpack_require__(9577); const Mode = __webpack_require__(7195); function ByteData(data) { this.mode = Mode.BYTE; if (typeof data === 'string') { this.data = new TextEncoder().encode(data); } else { this.data = new Uint8Array(data); } } ByteData.getBitsLength = function getBitsLength(length) { return length * 8; }; ByteData.prototype.getLength = function getLength() { return this.data.length; }; ByteData.prototype.getBitsLength = function getBitsLength() { return ByteData.getBitsLength(this.data.length); }; ByteData.prototype.write = function (bitBuffer) { for (let i = 0, l = this.data.length; i < l; i++) { bitBuffer.put(this.data[i], 8); } }; module.exports = ByteData; /***/ }), /***/ 283: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(9504); var fails = __webpack_require__(9039); var isCallable = __webpack_require__(4901); var hasOwn = __webpack_require__(9297); var DESCRIPTORS = __webpack_require__(3724); var CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(350).CONFIGURABLE); var inspectSource = __webpack_require__(3706); var InternalStateModule = __webpack_require__(1181); var enforceInternalState = InternalStateModule.enforce; var getInternalState = InternalStateModule.get; var $String = String; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; var stringSlice = uncurryThis(''.slice); var replace = uncurryThis(''.replace); var join = uncurryThis([].join); var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () { return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; }); var TEMPLATE = String(String).split('String'); var makeBuiltIn = module.exports = function (value, name, options) { if (stringSlice($String(name), 0, 7) === 'Symbol(') { name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']'; } if (options && options.getter) name = 'get ' + name; if (options && options.setter) name = 'set ' + name; if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true }); else value.name = name; } if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) { defineProperty(value, 'length', { value: options.arity }); } try { if (options && hasOwn(options, 'constructor') && options.constructor) { if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false }); // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable } else if (value.prototype) value.prototype = undefined; } catch (error) { /* empty */ } var state = enforceInternalState(value); if (!hasOwn(state, 'source')) { state.source = join(TEMPLATE, typeof name == 'string' ? name : ''); } return value; }; // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative // eslint-disable-next-line no-extend-native -- required Function.prototype.toString = makeBuiltIn(function toString() { return isCallable(this) && getInternalState(this).source || inspectSource(this); }, 'toString'); /***/ }), /***/ 350: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(3724); var hasOwn = __webpack_require__(9297); var FunctionPrototype = Function.prototype; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn(FunctionPrototype, 'name'); // additional protection from minified / mangled / dropped function names var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable)); module.exports = { EXISTS: EXISTS, PROPER: PROPER, CONFIGURABLE: CONFIGURABLE }; /***/ }), /***/ 397: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(7751); module.exports = getBuiltIn('document', 'documentElement'); /***/ }), /***/ 421: /***/ (function(module) { "use strict"; module.exports = {}; /***/ }), /***/ 507: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var call = __webpack_require__(9565); module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) { var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator; var next = record.next; var step, result; while (!(step = call(next, iterator)).done) { result = fn(step.value); if (result !== undefined) return result; } }; /***/ }), /***/ 531: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(6518); var call = __webpack_require__(9565); var aCallable = __webpack_require__(9306); var anObject = __webpack_require__(8551); var getIteratorDirect = __webpack_require__(1767); var getIteratorFlattenable = __webpack_require__(8646); var createIteratorProxy = __webpack_require__(9462); var iteratorClose = __webpack_require__(9539); var IS_PURE = __webpack_require__(6395); var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684); var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); var FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('flatMap', function () { /* empty */ }); var flatMapWithoutClosingOnEarlyError = !IS_PURE && !FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR && iteratorHelperWithoutClosingOnEarlyError('flatMap', TypeError); var FORCED = IS_PURE || FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || flatMapWithoutClosingOnEarlyError; var IteratorProxy = createIteratorProxy(function () { var iterator = this.iterator; var mapper = this.mapper; var result, inner; while (true) { if (inner = this.inner) try { result = anObject(call(inner.next, inner.iterator)); if (!result.done) return result.value; this.inner = null; } catch (error) { iteratorClose(iterator, 'throw', error); } result = anObject(call(this.next, iterator)); if (this.done = !!result.done) return; try { this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false); } catch (error) { iteratorClose(iterator, 'throw', error); } } }); // `Iterator.prototype.flatMap` method // https://tc39.es/ecma262/#sec-iterator.prototype.flatmap $({ target: 'Iterator', proto: true, real: true, forced: FORCED }, { flatMap: function flatMap(mapper) { anObject(this); try { aCallable(mapper); } catch (error) { iteratorClose(this, 'throw', error); } if (flatMapWithoutClosingOnEarlyError) return call(flatMapWithoutClosingOnEarlyError, this, mapper); return new IteratorProxy(getIteratorDirect(this), { mapper: mapper, inner: null }); } }); /***/ }), /***/ 616: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(9039); module.exports = !fails(function () { // eslint-disable-next-line es/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test != 'function' || test.hasOwnProperty('prototype'); }); /***/ }), /***/ 655: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(6955); var $String = String; module.exports = function (argument) { if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string'); return $String(argument); }; /***/ }), /***/ 679: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var isPrototypeOf = __webpack_require__(1625); var $TypeError = TypeError; module.exports = function (it, Prototype) { if (isPrototypeOf(Prototype, it)) return it; throw new $TypeError('Incorrect invocation'); }; /***/ }), /***/ 684: /***/ (function(module) { "use strict"; // Should throw an error on invalid iterator // https://issues.chromium.org/issues/336839115 module.exports = function (methodName, argument) { // eslint-disable-next-line es/no-iterator -- required for testing var method = typeof Iterator == 'function' && Iterator.prototype[methodName]; if (method) try { method.call({ next: null }, argument).next(); } catch (error) { return true; } }; /***/ }), /***/ 741: /***/ (function(module) { "use strict"; var ceil = Math.ceil; var floor = Math.floor; // `Math.trunc` method // https://tc39.es/ecma262/#sec-math.trunc // eslint-disable-next-line es/no-math-trunc -- safe module.exports = Math.trunc || function trunc(x) { var n = +x; return (n > 0 ? floor : ceil)(n); }; /***/ }), /***/ 757: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(7751); var isCallable = __webpack_require__(4901); var isPrototypeOf = __webpack_require__(1625); var USE_SYMBOL_AS_UID = __webpack_require__(7040); var $Object = Object; module.exports = USE_SYMBOL_AS_UID ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn('Symbol'); return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); }; /***/ }), /***/ 851: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(6955); var getMethod = __webpack_require__(5966); var isNullOrUndefined = __webpack_require__(4117); var Iterators = __webpack_require__(6269); var wellKnownSymbol = __webpack_require__(8227); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)]; }; /***/ }), /***/ 866: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const Mode = __webpack_require__(7195); function NumericData(data) { this.mode = Mode.NUMERIC; this.data = data.toString(); } NumericData.getBitsLength = function getBitsLength(length) { return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0); }; NumericData.prototype.getLength = function getLength() { return this.data.length; }; NumericData.prototype.getBitsLength = function getBitsLength() { return NumericData.getBitsLength(this.data.length); }; NumericData.prototype.write = function write(bitBuffer) { let i, group, value; // The input data string is divided into groups of three digits, // and each group is converted to its 10-bit binary equivalent. for (i = 0; i + 3 <= this.data.length; i += 3) { group = this.data.substr(i, 3); value = parseInt(group, 10); bitBuffer.put(value, 10); } // If the number of input digits is not an exact multiple of three, // the final one or two digits are converted to 4 or 7 bits respectively. const remainingNum = this.data.length - i; if (remainingNum > 0) { group = this.data.substr(i); value = parseInt(group, 10); bitBuffer.put(value, remainingNum * 3 + 1); } }; module.exports = NumericData; /***/ }), /***/ 1006: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { __webpack_require__(8111); __webpack_require__(7588); const Utils = __webpack_require__(9547); const ECCode = __webpack_require__(2039); const ECLevel = __webpack_require__(1210); const Mode = __webpack_require__(7195); const VersionCheck = __webpack_require__(5847); // Generator polynomial used to encode version information const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0; const G18_BCH = Utils.getBCHDigit(G18); function getBestVersionForDataLength(mode, length, errorCorrectionLevel) { for (let currentVersion = 1; currentVersion <= 40; currentVersion++) { if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) { return currentVersion; } } return undefined; } function getReservedBitsCount(mode, version) { // Character count indicator + mode indicator bits return Mode.getCharCountIndicator(mode, version) + 4; } function getTotalBitsFromDataArray(segments, version) { let totalBits = 0; segments.forEach(function (data) { const reservedBits = getReservedBitsCount(data.mode, version); totalBits += reservedBits + data.getBitsLength(); }); return totalBits; } function getBestVersionForMixedData(segments, errorCorrectionLevel) { for (let currentVersion = 1; currentVersion <= 40; currentVersion++) { const length = getTotalBitsFromDataArray(segments, currentVersion); if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) { return currentVersion; } } return undefined; } /** * Returns version number from a value. * If value is not a valid version, returns defaultValue * * @param {Number|String} value QR Code version * @param {Number} defaultValue Fallback value * @return {Number} QR Code version number */ exports.from = function from(value, defaultValue) { if (VersionCheck.isValid(value)) { return parseInt(value, 10); } return defaultValue; }; /** * Returns how much data can be stored with the specified QR code version * and error correction level * * @param {Number} version QR Code version (1-40) * @param {Number} errorCorrectionLevel Error correction level * @param {Mode} mode Data mode * @return {Number} Quantity of storable data */ exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) { if (!VersionCheck.isValid(version)) { throw new Error('Invalid QR Code version'); } // Use Byte mode as default if (typeof mode === 'undefined') mode = Mode.BYTE; // Total codewords for this QR code version (Data + Error correction) const totalCodewords = Utils.getSymbolTotalCodewords(version); // Total number of error correction codewords const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel); // Total number of data codewords const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8; if (mode === Mode.MIXED) return dataTotalCodewordsBits; const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version); // Return max number of storable codewords switch (mode) { case Mode.NUMERIC: return Math.floor(usableBits / 10 * 3); case Mode.ALPHANUMERIC: return Math.floor(usableBits / 11 * 2); case Mode.KANJI: return Math.floor(usableBits / 13); case Mode.BYTE: default: return Math.floor(usableBits / 8); } }; /** * Returns the minimum version needed to contain the amount of data * * @param {Segment} data Segment of data * @param {Number} [errorCorrectionLevel=H] Error correction level * @param {Mode} mode Data mode * @return {Number} QR Code version */ exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) { let seg; const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M); if (Array.isArray(data)) { if (data.length > 1) { return getBestVersionForMixedData(data, ecl); } if (data.length === 0) { return 1; } seg = data[0]; } else { seg = data; } return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl); }; /** * Returns version information with relative error correction bits * * The version information is included in QR Code symbols of version 7 or larger. * It consists of an 18-bit sequence containing 6 data bits, * with 12 error correction bits calculated using the (18, 6) Golay code. * * @param {Number} version QR Code version * @return {Number} Encoded version info bits */ exports.getEncodedBits = function getEncodedBits(version) { if (!VersionCheck.isValid(version) || version < 7) { throw new Error('Invalid QR Code version'); } let d = version << 12; while (Utils.getBCHDigit(d) - G18_BCH >= 0) { d ^= G18 << Utils.getBCHDigit(d) - G18_BCH; } return version << 12 | d; }; /***/ }), /***/ 1072: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var internalObjectKeys = __webpack_require__(1828); var enumBugKeys = __webpack_require__(8727); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es/no-object-keys -- safe module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; /***/ }), /***/ 1108: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(6955); module.exports = function (it) { var klass = classof(it); return klass === 'BigInt64Array' || klass === 'BigUint64Array'; }; /***/ }), /***/ 1148: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(6518); var call = __webpack_require__(9565); var iterate = __webpack_require__(2652); var aCallable = __webpack_require__(9306); var anObject = __webpack_require__(8551); var getIteratorDirect = __webpack_require__(1767); var iteratorClose = __webpack_require__(9539); var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); var everyWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('every', TypeError); // `Iterator.prototype.every` method // https://tc39.es/ecma262/#sec-iterator.prototype.every $({ target: 'Iterator', proto: true, real: true, forced: everyWithoutClosingOnEarlyError }, { every: function every(predicate) { anObject(this); try { aCallable(predicate); } catch (error) { iteratorClose(this, 'throw', error); } if (everyWithoutClosingOnEarlyError) return call(everyWithoutClosingOnEarlyError, this, predicate); var record = getIteratorDirect(this); var counter = 0; return !iterate(record, function (value, stop) { if (!predicate(value, counter++)) return stop(); }, { IS_RECORD: true, INTERRUPTED: true }).stopped; } }); /***/ }), /***/ 1181: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var NATIVE_WEAK_MAP = __webpack_require__(8622); var globalThis = __webpack_require__(4576); var isObject = __webpack_require__(34); var createNonEnumerableProperty = __webpack_require__(6699); var hasOwn = __webpack_require__(9297); var shared = __webpack_require__(7629); var sharedKey = __webpack_require__(6119); var hiddenKeys = __webpack_require__(421); var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; var TypeError = globalThis.TypeError; var WeakMap = globalThis.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw new TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap()); /* eslint-disable no-self-assign -- prototype methods protection */ store.get = store.get; store.has = store.has; store.set = store.set; /* eslint-enable no-self-assign -- prototype methods protection */ set = function (it, metadata) { if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; store.set(it, metadata); return metadata; }; get = function (it) { return store.get(it) || {}; }; has = function (it) { return store.has(it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return hasOwn(it, STATE) ? it[STATE] : {}; }; has = function (it) { return hasOwn(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; /***/ }), /***/ 1210: /***/ (function(__unused_webpack_module, exports) { exports.L = { bit: 1 }; exports.M = { bit: 0 }; exports.Q = { bit: 3 }; exports.H = { bit: 2 }; function fromString(string) { if (typeof string !== 'string') { throw new Error('Param is not a string'); } const lcStr = string.toLowerCase(); switch (lcStr) { case 'l': case 'low': return exports.L; case 'm': case 'medium': return exports.M; case 'q': case 'quartile': return exports.Q; case 'h': case 'high': return exports.H; default: throw new Error('Unknown EC Level: ' + string); } } exports.isValid = function isValid(level) { return level && typeof level.bit !== 'undefined' && level.bit >= 0 && level.bit < 4; }; exports.from = function from(value, defaultValue) { if (exports.isValid(value)) { return value; } try { return fromString(value); } catch (e) { return defaultValue; } }; /***/ }), /***/ 1241: /***/ (function(__unused_webpack_module, exports) { "use strict"; var __webpack_unused_export__; __webpack_unused_export__ = ({ value: true }); // runtime helper for setting properties on components // in a tree-shakable way exports.A = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; /***/ }), /***/ 1291: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var trunc = __webpack_require__(741); // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity module.exports = function (argument) { var number = +argument; // eslint-disable-next-line no-self-compare -- NaN check return number !== number || number === 0 ? 0 : trunc(number); }; /***/ }), /***/ 1385: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var iteratorClose = __webpack_require__(9539); module.exports = function (iters, kind, value) { for (var i = iters.length - 1; i >= 0; i--) { if (iters[i] === undefined) continue; try { value = iteratorClose(iters[i].iterator, kind, value); } catch (error) { kind = 'throw'; value = error; } } if (kind === 'throw') throw value; return value; }; /***/ }), /***/ 1558: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { __webpack_require__(9577); const GF = __webpack_require__(2528); /** * Multiplies two polynomials inside Galois Field * * @param {Uint8Array} p1 Polynomial * @param {Uint8Array} p2 Polynomial * @return {Uint8Array} Product of p1 and p2 */ exports.mul = function mul(p1, p2) { const coeff = new Uint8Array(p1.length + p2.length - 1); for (let i = 0; i < p1.length; i++) { for (let j = 0; j < p2.length; j++) { coeff[i + j] ^= GF.mul(p1[i], p2[j]); } } return coeff; }; /** * Calculate the remainder of polynomials division * * @param {Uint8Array} divident Polynomial * @param {Uint8Array} divisor Polynomial * @return {Uint8Array} Remainder */ exports.mod = function mod(divident, divisor) { let result = new Uint8Array(divident); while (result.length - divisor.length >= 0) { const coeff = result[0]; for (let i = 0; i < divisor.length; i++) { result[i] ^= GF.mul(divisor[i], coeff); } // remove all zeros from buffer head let offset = 0; while (offset < result.length && result[offset] === 0) offset++; result = result.slice(offset); } return result; }; /** * Generate an irreducible generator polynomial of specified degree * (used by Reed-Solomon encoder) * * @param {Number} degree Degree of the generator polynomial * @return {Uint8Array} Buffer containing polynomial coefficients */ exports.generateECPolynomial = function generateECPolynomial(degree) { let poly = new Uint8Array([1]); for (let i = 0; i < degree; i++) { poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)])); } return poly; }; /***/ }), /***/ 1625: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(9504); module.exports = uncurryThis({}.isPrototypeOf); /***/ }), /***/ 1698: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(6518); var union = __webpack_require__(4204); var setMethodGetKeysBeforeCloning = __webpack_require__(9835); var setMethodAcceptSetLike = __webpack_require__(4916); var FORCED = !setMethodAcceptSetLike('union') || !setMethodGetKeysBeforeCloning('union'); // `Set.prototype.union` method // https://tc39.es/ecma262/#sec-set.prototype.union $({ target: 'Set', proto: true, real: true, forced: FORCED }, { union: union }); /***/ }), /***/ 1701: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(6518); var call = __webpack_require__(9565); var aCallable = __webpack_require__(9306); var anObject = __webpack_require__(8551); var getIteratorDirect = __webpack_require__(1767); var createIteratorProxy = __webpack_require__(9462); var callWithSafeIterationClosing = __webpack_require__(6319); var iteratorClose = __webpack_require__(9539); var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684); var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); var IS_PURE = __webpack_require__(6395); var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('map', function () { /* empty */ }); var mapWithoutClosingOnEarlyError = !IS_PURE && !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR && iteratorHelperWithoutClosingOnEarlyError('map', TypeError); var FORCED = IS_PURE || MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError; var IteratorProxy = createIteratorProxy(function () { var iterator = this.iterator; var result = anObject(call(this.next, iterator)); var done = this.done = !!result.done; if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true); }); // `Iterator.prototype.map` method // https://tc39.es/ecma262/#sec-iterator.prototype.map $({ target: 'Iterator', proto: true, real: true, forced: FORCED }, { map: function map(mapper) { anObject(this); try { aCallable(mapper); } catch (error) { iteratorClose(this, 'throw', error); } if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper); return new IteratorProxy(getIteratorDirect(this), { mapper: mapper }); } }); /***/ }), /***/ 1767: /***/ (function(module) { "use strict"; // `GetIteratorDirect(obj)` abstract operation // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect module.exports = function (obj) { return { iterator: obj, next: obj.next, done: false }; }; /***/ }), /***/ 1806: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(6518); var anObject = __webpack_require__(8551); var iterate = __webpack_require__(2652); var getIteratorDirect = __webpack_require__(1767); var push = [].push; // `Iterator.prototype.toArray` method // https://tc39.es/ecma262/#sec-iterator.prototype.toarray $({ target: 'Iterator', proto: true, real: true }, { toArray: function toArray() { var result = []; iterate(getIteratorDirect(anObject(this)), push, { that: result, IS_RECORD: true }); return result; } }); /***/ }), /***/ 1828: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(9504); var hasOwn = __webpack_require__(9297); var toIndexedObject = __webpack_require__(5397); var indexOf = (__webpack_require__(9617).indexOf); var hiddenKeys = __webpack_require__(421); var push = uncurryThis([].push); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); // Don't enum bug & hidden keys while (names.length > i) if (hasOwn(O, key = names[i++])) { ~indexOf(result, key) || push(result, key); } return result; }; /***/ }), /***/ 1910: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { const Mode = __webpack_require__(7195); const Utils = __webpack_require__(9547); function KanjiData(data) { this.mode = Mode.KANJI; this.data = data; } KanjiData.getBitsLength = function getBitsLength(length) { return length * 13; }; KanjiData.prototype.getLength = function getLength() { return this.data.length; }; KanjiData.prototype.getBitsLength = function getBitsLength() { return KanjiData.getBitsLength(this.data.length); }; KanjiData.prototype.write = function (bitBuffer) { let i; // In the Shift JIS system, Kanji characters are represented by a two byte combination. // These byte values are shifted from the JIS X 0208 values. // JIS X 0208 gives details of the shift coded representation. for (i = 0; i < this.data.length; i++) { let value = Utils.toSJIS(this.data[i]); // For characters with Shift JIS values from 0x8140 to 0x9FFC: if (value >= 0x8140 && value <= 0x9FFC) { // Subtract 0x8140 from Shift JIS value value -= 0x8140; // For characters with Shift JIS values from 0xE040 to 0xEBBF } else if (value >= 0xE040 && value <= 0xEBBF) { // Subtract 0xC140 from Shift JIS value value -= 0xC140; } else { throw new Error('Invalid SJIS character: ' + this.data[i] + '\n' + 'Make sure your charset is UTF-8'); } // Multiply most significant byte of result by 0xC0 // and add least significant byte to product value = (value >>> 8 & 0xff) * 0xC0 + (value & 0xff); // Convert result to a 13-bit binary string bitBuffer.put(value, 13); } }; module.exports = KanjiData; /***/ }), /***/ 1954: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { __webpack_require__(8111); __webpack_require__(7588); __webpack_require__(9577); const Utils = __webpack_require__(9547); const ECLevel = __webpack_require__(1210); const BitBuffer = __webpack_require__(9188); const BitMatrix = __webpack_require__(9927); const AlignmentPattern = __webpack_require__(6099); const FinderPattern = __webpack_require__(1955); const MaskPattern = __webpack_require__(2395); const ECCode = __webpack_require__(2039); const ReedSolomonEncoder = __webpack_require__(5987); const Version = __webpack_require__(1006); const FormatInfo = __webpack_require__(4804); const Mode = __webpack_require__(7195); const Segments = __webpack_require__(7942); /** * QRCode for JavaScript * * modified by Ryan Day for nodejs support * Copyright (c) 2011 Ryan Day * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * //--------------------------------------------------------------------- // QRCode for JavaScript // // Copyright (c) 2009 Kazuhiko Arase // // URL: http://www.d-project.com/ // // Licensed under the MIT license: // http://www.opensource.org/licenses/mit-license.php // // The word "QR Code" is registered trademark of // DENSO WAVE INCORPORATED // http://www.denso-wave.com/qrcode/faqpatent-e.html // //--------------------------------------------------------------------- */ /** * Add finder patterns bits to matrix * * @param {BitMatrix} matrix Modules matrix * @param {Number} version QR Code version */ function setupFinderPattern(matrix, version) { const size = matrix.size; const pos = FinderPattern.getPositions(version); for (let i = 0; i < pos.length; i++) { const row = pos[i][0]; const col = pos[i][1]; for (let r = -1; r <= 7; r++) { if (row + r <= -1 || size <= row + r) continue; for (let c = -1; c <= 7; c++) { if (col + c <= -1 || size <= col + c) continue; if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) { matrix.set(row + r, col + c, true, true); } else { matrix.set(row + r, col + c, false, true); } } } } } /** * Add timing pattern bits to matrix * * Note: this function must be called before {@link setupAlignmentPattern} * * @param {BitMatrix} matrix Modules matrix */ function setupTimingPattern(matrix) { const size = matrix.size; for (let r = 8; r < size - 8; r++) { const value = r % 2 === 0; matrix.set(r, 6, value, true); matrix.set(6, r, value, true); } } /** * Add alignment patterns bits to matrix * * Note: this function must be called after {@link setupTimingPattern} * * @param {BitMatrix} matrix Modules matrix * @param {Number} version QR Code version */ function setupAlignmentPattern(matrix, version) { const pos = AlignmentPattern.getPositions(version); for (let i = 0; i < pos.length; i++) { const row = pos[i][0]; const col = pos[i][1]; for (let r = -2; r <= 2; r++) { for (let c = -2; c <= 2; c++) { if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) { matrix.set(row + r, col + c, true, true); } else { matrix.set(row + r, col + c, false, true); } } } } } /** * Add version info bits to matrix * * @param {BitMatrix} matrix Modules matrix * @param {Number} version QR Code version */ function setupVersionInfo(matrix, version) { const size = matrix.size; const bits = Version.getEncodedBits(version); let row, col, mod; for (let i = 0; i < 18; i++) { row = Math.floor(i / 3); col = i % 3 + size - 8 - 3; mod = (bits >> i & 1) === 1; matrix.set(row, col, mod, true); matrix.set(col, row, mod, true); } } /** * Add format info bits to matrix * * @param {BitMatrix} matrix Modules matrix * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level * @param {Number} maskPattern Mask pattern reference value */ function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) { const size = matrix.size; const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern); let i, mod; for (i = 0; i < 15; i++) { mod = (bits >> i & 1) === 1; // vertical if (i < 6) { matrix.set(i, 8, mod, true); } else if (i < 8) { matrix.set(i + 1, 8, mod, true); } else { matrix.set(size - 15 + i, 8, mod, true); } // horizontal if (i < 8) { matrix.set(8, size - i - 1, mod, true); } else if (i < 9) { matrix.set(8, 15 - i - 1 + 1, mod, true); } else { matrix.set(8, 15 - i - 1, mod, true); } } // fixed module matrix.set(size - 8, 8, 1, true); } /** * Add encoded data bits to matrix * * @param {BitMatrix} matrix Modules matrix * @param {Uint8Array} data Data codewords */ function setupData(matrix, data) { const size = matrix.size; let inc = -1; let row = size - 1; let bitIndex = 7; let byteIndex = 0; for (let col = size - 1; col > 0; col -= 2) { if (col === 6) col--; while (true) { for (let c = 0; c < 2; c++) { if (!matrix.isReserved(row, col - c)) { let dark = false; if (byteIndex < data.length) { dark = (data[byteIndex] >>> bitIndex & 1) === 1; } matrix.set(row, col - c, dark); bitIndex--; if (bitIndex === -1) { byteIndex++; bitIndex = 7; } } } row += inc; if (row < 0 || size <= row) { row -= inc; inc = -inc; break; } } } } /** * Create encoded codewords from data input * * @param {Number} version QR Code version * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level * @param {ByteData} data Data input * @return {Uint8Array} Buffer containing encoded codewords */ function createData(version, errorCorrectionLevel, segments) { // Prepare data buffer const buffer = new BitBuffer(); segments.forEach(function (data) { // prefix data with mode indicator (4 bits) buffer.put(data.mode.bit, 4); // Prefix data with character count indicator. // The character count indicator is a string of bits that represents the // number of characters that are being encoded. // The character count indicator must be placed after the mode indicator // and must be a certain number of bits long, depending on the QR version // and data mode // @see {@link Mode.getCharCountIndicator}. buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version)); // add binary data sequence to buffer data.write(buffer); }); // Calculate required number of bits const totalCodewords = Utils.getSymbolTotalCodewords(version); const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel); const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8; // Add a terminator. // If the bit string is shorter than the total number of required bits, // a terminator of up to four 0s must be added to the right side of the string. // If the bit string is more than four bits shorter than the required number of bits, // add four 0s to the end. if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) { buffer.put(0, 4); } // If the bit string is fewer than four bits shorter, add only the number of 0s that // are needed to reach the required number of bits. // After adding the terminator, if the number of bits in the string is not a multiple of 8, // pad the string on the right with 0s to make the string's length a multiple of 8. while (buffer.getLengthInBits() % 8 !== 0) { buffer.putBit(0); } // Add pad bytes if the string is still shorter than the total number of required bits. // Extend the buffer to fill the data capacity of the symbol corresponding to // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC) // and 00010001 (0x11) alternately. const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8; for (let i = 0; i < remainingByte; i++) { buffer.put(i % 2 ? 0x11 : 0xEC, 8); } return createCodewords(buffer, version, errorCorrectionLevel); } /** * Encode input data with Reed-Solomon and return codewords with * relative error correction bits * * @param {BitBuffer} bitBuffer Data to encode * @param {Number} version QR Code version * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level * @return {Uint8Array} Buffer containing encoded codewords */ function createCodewords(bitBuffer, version, errorCorrectionLevel) { // Total codewords for this QR code version (Data + Error correction) const totalCodewords = Utils.getSymbolTotalCodewords(version); // Total number of error correction codewords const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel); // Total number of data codewords const dataTotalCodewords = totalCodewords - ecTotalCodewords; // Total number of blocks const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel); // Calculate how many blocks each group should contain const blocksInGroup2 = totalCodewords % ecTotalBlocks; const blocksInGroup1 = ecTotalBlocks - blocksInGroup2; const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks); const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks); const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1; // Number of EC codewords is the same for both groups const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1; // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount const rs = new ReedSolomonEncoder(ecCount); let offset = 0; const dcData = new Array(ecTotalBlocks); const ecData = new Array(ecTotalBlocks); let maxDataSize = 0; const buffer = new Uint8Array(bitBuffer.buffer); // Divide the buffer into the required number of blocks for (let b = 0; b < ecTotalBlocks; b++) { const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2; // extract a block of data from buffer dcData[b] = buffer.slice(offset, offset + dataSize); // Calculate EC codewords for this data block ecData[b] = rs.encode(dcData[b]); offset += dataSize; maxDataSize = Math.max(maxDataSize, dataSize); } // Create final data // Interleave the data and error correction codewords from each block const data = new Uint8Array(totalCodewords); let index = 0; let i, r; // Add data codewords for (i = 0; i < maxDataSize; i++) { for (r = 0; r < ecTotalBlocks; r++) { if (i < dcData[r].length) { data[index++] = dcData[r][i]; } } } // Apped EC codewords for (i = 0; i < ecCount; i++) { for (r = 0; r < ecTotalBlocks; r++) { data[index++] = ecData[r][i]; } } return data; } /** * Build QR Code symbol * * @param {String} data Input string * @param {Number} version QR Code version * @param {ErrorCorretionLevel} errorCorrectionLevel Error level * @param {MaskPattern} maskPattern Mask pattern * @return {Object} Object containing symbol data */ function createSymbol(data, version, errorCorrectionLevel, maskPattern) { let segments; if (Array.isArray(data)) { segments = Segments.fromArray(data); } else if (typeof data === 'string') { let estimatedVersion = version; if (!estimatedVersion) { const rawSegments = Segments.rawSplit(data); // Estimate best version that can contain raw splitted segments estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel); } // Build optimized segments // If estimated version is undefined, try with the highest version segments = Segments.fromString(data, estimatedVersion || 40); } else { throw new Error('Invalid data'); } // Get the min version that can contain data const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel); // If no version is found, data cannot be stored if (!bestVersion) { throw new Error('The amount of data is too big to be stored in a QR Code'); } // If not specified, use min version as default if (!version) { version = bestVersion; // Check if the specified version can contain the data } else if (version < bestVersion) { throw new Error('\n' + 'The chosen QR Code version cannot contain this amount of data.\n' + 'Minimum version required to store current data is: ' + bestVersion + '.\n'); } const dataBits = createData(version, errorCorrectionLevel, segments); // Allocate matrix buffer const moduleCount = Utils.getSymbolSize(version); const modules = new BitMatrix(moduleCount); // Add function modules setupFinderPattern(modules, version); setupTimingPattern(modules); setupAlignmentPattern(modules, version); // Add temporary dummy bits for format info just to set them as reserved. // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask} // since the masking operation must be performed only on the encoding region. // These blocks will be replaced with correct values later in code. setupFormatInfo(modules, errorCorrectionLevel, 0); if (version >= 7) { setupVersionInfo(modules, version); } // Add data codewords setupData(modules, dataBits); if (isNaN(maskPattern)) { // Find best mask pattern maskPattern = MaskPattern.getBestMask(modules, setupFormatInfo.bind(null, modules, errorCorrectionLevel)); } // Apply mask pattern MaskPattern.applyMask(maskPattern, modules); // Replace format info bits with correct values setupFormatInfo(modules, errorCorrectionLevel, maskPattern); return { modules: modules, version: version, errorCorrectionLevel: errorCorrectionLevel, maskPattern: maskPattern, segments: segments }; } /** * QR Code * * @param {String | Array} data Input data * @param {Object} options Optional configurations * @param {Number} options.version QR Code version * @param {String} options.errorCorrectionLevel Error correction level * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis */ exports.create = function create(data, options) { if (typeof data === 'undefined' || data === '') { throw new Error('No input text'); } let errorCorrectionLevel = ECLevel.M; let version; let mask; if (typeof options !== 'undefined') { // Use higher error correction level as default errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M); version = Version.from(options.version); mask = MaskPattern.from(options.maskPattern); if (options.toSJISFunc) { Utils.setToSJISFunction(options.toSJISFunc); } } return createSymbol(data, version, errorCorrectionLevel, mask); }; /***/ }), /***/ 1955: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { const getSymbolSize = (__webpack_require__(9547).getSymbolSize); const FINDER_PATTERN_SIZE = 7; /** * Returns an array containing the positions of each finder pattern. * Each array's element represent the top-left point of the pattern as (x, y) coordinates * * @param {Number} version QR Code version * @return {Array} Array of coordinates */ exports.getPositions = function getPositions(version) { const size = getSymbolSize(version); return [ // top-left [0, 0], // top-right [size - FINDER_PATTERN_SIZE, 0], // bottom-left [0, size - FINDER_PATTERN_SIZE]]; }; /***/ }), /***/ 2039: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { const ECLevel = __webpack_require__(1210); const EC_BLOCKS_TABLE = [ // L M Q H 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 4, 1, 2, 4, 4, 2, 4, 4, 4, 2, 4, 6, 5, 2, 4, 6, 6, 2, 5, 8, 8, 4, 5, 8, 8, 4, 5, 8, 11, 4, 8, 10, 11, 4, 9, 12, 16, 4, 9, 16, 16, 6, 10, 12, 18, 6, 10, 17, 16, 6, 11, 16, 19, 6, 13, 18, 21, 7, 14, 21, 25, 8, 16, 20, 25, 8, 17, 23, 25, 9, 17, 23, 34, 9, 18, 25, 30, 10, 20, 27, 32, 12, 21, 29, 35, 12, 23, 34, 37, 12, 25, 34, 40, 13, 26, 35, 42, 14, 28, 38, 45, 15, 29, 40, 48, 16, 31, 43, 51, 17, 33, 45, 54, 18, 35, 48, 57, 19, 37, 51, 60, 19, 38, 53, 63, 20, 40, 56, 66, 21, 43, 59, 70, 22, 45, 62, 74, 24, 47, 65, 77, 25, 49, 68, 81]; const EC_CODEWORDS_TABLE = [ //