123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184 |
- import {
- __commonJS,
- init_define_APP_INFO
- } from "./chunk-XY75H3MP.js";
- // node_modules/qrcode/lib/can-promise.js
- var require_can_promise = __commonJS({
- "node_modules/qrcode/lib/can-promise.js"(exports, module) {
- init_define_APP_INFO();
- module.exports = function() {
- return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
- };
- }
- });
- // node_modules/qrcode/lib/core/utils.js
- var require_utils = __commonJS({
- "node_modules/qrcode/lib/core/utils.js"(exports) {
- init_define_APP_INFO();
- var toSJISFunction;
- var CODEWORDS_COUNT = [
- 0,
- 26,
- 44,
- 70,
- 100,
- 134,
- 172,
- 196,
- 242,
- 292,
- 346,
- 404,
- 466,
- 532,
- 581,
- 655,
- 733,
- 815,
- 901,
- 991,
- 1085,
- 1156,
- 1258,
- 1364,
- 1474,
- 1588,
- 1706,
- 1828,
- 1921,
- 2051,
- 2185,
- 2323,
- 2465,
- 2611,
- 2761,
- 2876,
- 3034,
- 3196,
- 3362,
- 3532,
- 3706
- ];
- exports.getSymbolSize = function getSymbolSize(version) {
- if (!version)
- throw new Error('"version" cannot be null or undefined');
- if (version < 1 || version > 40)
- throw new Error('"version" should be in range from 1 to 40');
- return version * 4 + 17;
- };
- exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
- return CODEWORDS_COUNT[version];
- };
- exports.getBCHDigit = function(data) {
- let digit = 0;
- while (data !== 0) {
- digit++;
- data >>>= 1;
- }
- return digit;
- };
- exports.setToSJISFunction = function setToSJISFunction(f) {
- if (typeof f !== "function") {
- throw new Error('"toSJISFunc" is not a valid function.');
- }
- toSJISFunction = f;
- };
- exports.isKanjiModeEnabled = function() {
- return typeof toSJISFunction !== "undefined";
- };
- exports.toSJIS = function toSJIS(kanji) {
- return toSJISFunction(kanji);
- };
- }
- });
- // node_modules/qrcode/lib/core/error-correction-level.js
- var require_error_correction_level = __commonJS({
- "node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
- init_define_APP_INFO();
- 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;
- }
- };
- }
- });
- // node_modules/qrcode/lib/core/bit-buffer.js
- var require_bit_buffer = __commonJS({
- "node_modules/qrcode/lib/core/bit-buffer.js"(exports, module) {
- init_define_APP_INFO();
- function BitBuffer() {
- this.buffer = [];
- this.length = 0;
- }
- BitBuffer.prototype = {
- get: function(index) {
- const bufIndex = Math.floor(index / 8);
- return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
- },
- put: function(num, length) {
- for (let i = 0; i < length; i++) {
- this.putBit((num >>> length - i - 1 & 1) === 1);
- }
- },
- getLengthInBits: function() {
- return this.length;
- },
- putBit: function(bit) {
- const bufIndex = Math.floor(this.length / 8);
- if (this.buffer.length <= bufIndex) {
- this.buffer.push(0);
- }
- if (bit) {
- this.buffer[bufIndex] |= 128 >>> this.length % 8;
- }
- this.length++;
- }
- };
- module.exports = BitBuffer;
- }
- });
- // node_modules/qrcode/lib/core/bit-matrix.js
- var require_bit_matrix = __commonJS({
- "node_modules/qrcode/lib/core/bit-matrix.js"(exports, module) {
- init_define_APP_INFO();
- function BitMatrix(size) {
- if (!size || size < 1) {
- throw new Error("BitMatrix size must be defined and greater than 0");
- }
- this.size = size;
- this.data = new Uint8Array(size * size);
- this.reservedBit = new Uint8Array(size * size);
- }
- BitMatrix.prototype.set = function(row, col, value, reserved) {
- const index = row * this.size + col;
- this.data[index] = value;
- if (reserved)
- this.reservedBit[index] = true;
- };
- BitMatrix.prototype.get = function(row, col) {
- return this.data[row * this.size + col];
- };
- BitMatrix.prototype.xor = function(row, col, value) {
- this.data[row * this.size + col] ^= value;
- };
- BitMatrix.prototype.isReserved = function(row, col) {
- return this.reservedBit[row * this.size + col];
- };
- module.exports = BitMatrix;
- }
- });
- // node_modules/qrcode/lib/core/alignment-pattern.js
- var require_alignment_pattern = __commonJS({
- "node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
- init_define_APP_INFO();
- var getSymbolSize = require_utils().getSymbolSize;
- exports.getRowColCoords = function getRowColCoords(version) {
- if (version === 1)
- return [];
- const posCount = Math.floor(version / 7) + 2;
- const size = getSymbolSize(version);
- const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
- const positions = [size - 7];
- for (let i = 1; i < posCount - 1; i++) {
- positions[i] = positions[i - 1] - intervals;
- }
- positions.push(6);
- return positions.reverse();
- };
- exports.getPositions = function getPositions(version) {
- const coords = [];
- const pos = exports.getRowColCoords(version);
- const posLength = pos.length;
- for (let i = 0; i < posLength; i++) {
- for (let j = 0; j < posLength; j++) {
- if (i === 0 && j === 0 || i === 0 && j === posLength - 1 || i === posLength - 1 && j === 0) {
- continue;
- }
- coords.push([pos[i], pos[j]]);
- }
- }
- return coords;
- };
- }
- });
- // node_modules/qrcode/lib/core/finder-pattern.js
- var require_finder_pattern = __commonJS({
- "node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
- init_define_APP_INFO();
- var getSymbolSize = require_utils().getSymbolSize;
- var FINDER_PATTERN_SIZE = 7;
- exports.getPositions = function getPositions(version) {
- const size = getSymbolSize(version);
- return [
- [0, 0],
- [size - FINDER_PATTERN_SIZE, 0],
- [0, size - FINDER_PATTERN_SIZE]
- ];
- };
- }
- });
- // node_modules/qrcode/lib/core/mask-pattern.js
- var require_mask_pattern = __commonJS({
- "node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
- init_define_APP_INFO();
- exports.Patterns = {
- PATTERN000: 0,
- PATTERN001: 1,
- PATTERN010: 2,
- PATTERN011: 3,
- PATTERN100: 4,
- PATTERN101: 5,
- PATTERN110: 6,
- PATTERN111: 7
- };
- var PenaltyScores = {
- N1: 3,
- N2: 3,
- N3: 40,
- N4: 10
- };
- exports.isValid = function isValid(mask) {
- return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
- };
- exports.from = function from(value) {
- return exports.isValid(value) ? parseInt(value, 10) : void 0;
- };
- exports.getPenaltyN1 = function getPenaltyN1(data) {
- const size = data.size;
- let points = 0;
- let sameCountCol = 0;
- let sameCountRow = 0;
- let lastCol = null;
- let lastRow = null;
- for (let row = 0; row < size; row++) {
- sameCountCol = sameCountRow = 0;
- lastCol = lastRow = null;
- for (let col = 0; col < size; col++) {
- let module2 = data.get(row, col);
- if (module2 === lastCol) {
- sameCountCol++;
- } else {
- if (sameCountCol >= 5)
- points += PenaltyScores.N1 + (sameCountCol - 5);
- lastCol = module2;
- sameCountCol = 1;
- }
- module2 = data.get(col, row);
- if (module2 === lastRow) {
- sameCountRow++;
- } else {
- if (sameCountRow >= 5)
- points += PenaltyScores.N1 + (sameCountRow - 5);
- lastRow = module2;
- sameCountRow = 1;
- }
- }
- if (sameCountCol >= 5)
- points += PenaltyScores.N1 + (sameCountCol - 5);
- if (sameCountRow >= 5)
- points += PenaltyScores.N1 + (sameCountRow - 5);
- }
- return points;
- };
- exports.getPenaltyN2 = function getPenaltyN2(data) {
- const size = data.size;
- let points = 0;
- for (let row = 0; row < size - 1; row++) {
- for (let col = 0; col < size - 1; col++) {
- const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
- if (last === 4 || last === 0)
- points++;
- }
- }
- return points * PenaltyScores.N2;
- };
- exports.getPenaltyN3 = function getPenaltyN3(data) {
- const size = data.size;
- let points = 0;
- let bitsCol = 0;
- let bitsRow = 0;
- for (let row = 0; row < size; row++) {
- bitsCol = bitsRow = 0;
- for (let col = 0; col < size; col++) {
- bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
- if (col >= 10 && (bitsCol === 1488 || bitsCol === 93))
- points++;
- bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
- if (col >= 10 && (bitsRow === 1488 || bitsRow === 93))
- points++;
- }
- }
- return points * PenaltyScores.N3;
- };
- exports.getPenaltyN4 = function getPenaltyN4(data) {
- let darkCount = 0;
- const modulesCount = data.data.length;
- for (let i = 0; i < modulesCount; i++)
- darkCount += data.data[i];
- const k = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);
- return k * PenaltyScores.N4;
- };
- function getMaskAt(maskPattern, i, j) {
- switch (maskPattern) {
- case exports.Patterns.PATTERN000:
- return (i + j) % 2 === 0;
- case exports.Patterns.PATTERN001:
- return i % 2 === 0;
- case exports.Patterns.PATTERN010:
- return j % 3 === 0;
- case exports.Patterns.PATTERN011:
- return (i + j) % 3 === 0;
- case exports.Patterns.PATTERN100:
- return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
- case exports.Patterns.PATTERN101:
- return i * j % 2 + i * j % 3 === 0;
- case exports.Patterns.PATTERN110:
- return (i * j % 2 + i * j % 3) % 2 === 0;
- case exports.Patterns.PATTERN111:
- return (i * j % 3 + (i + j) % 2) % 2 === 0;
- default:
- throw new Error("bad maskPattern:" + maskPattern);
- }
- }
- exports.applyMask = function applyMask(pattern, data) {
- const size = data.size;
- for (let col = 0; col < size; col++) {
- for (let row = 0; row < size; row++) {
- if (data.isReserved(row, col))
- continue;
- data.xor(row, col, getMaskAt(pattern, row, col));
- }
- }
- };
- exports.getBestMask = function getBestMask(data, setupFormatFunc) {
- const numPatterns = Object.keys(exports.Patterns).length;
- let bestPattern = 0;
- let lowerPenalty = Infinity;
- for (let p = 0; p < numPatterns; p++) {
- setupFormatFunc(p);
- exports.applyMask(p, data);
- const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);
- exports.applyMask(p, data);
- if (penalty < lowerPenalty) {
- lowerPenalty = penalty;
- bestPattern = p;
- }
- }
- return bestPattern;
- };
- }
- });
- // node_modules/qrcode/lib/core/error-correction-code.js
- var require_error_correction_code = __commonJS({
- "node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
- init_define_APP_INFO();
- var ECLevel = require_error_correction_level();
- var EC_BLOCKS_TABLE = [
- 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
- ];
- var EC_CODEWORDS_TABLE = [
- 7,
- 10,
- 13,
- 17,
- 10,
- 16,
- 22,
- 28,
- 15,
- 26,
- 36,
- 44,
- 20,
- 36,
- 52,
- 64,
- 26,
- 48,
- 72,
- 88,
- 36,
- 64,
- 96,
- 112,
- 40,
- 72,
- 108,
- 130,
- 48,
- 88,
- 132,
- 156,
- 60,
- 110,
- 160,
- 192,
- 72,
- 130,
- 192,
- 224,
- 80,
- 150,
- 224,
- 264,
- 96,
- 176,
- 260,
- 308,
- 104,
- 198,
- 288,
- 352,
- 120,
- 216,
- 320,
- 384,
- 132,
- 240,
- 360,
- 432,
- 144,
- 280,
- 408,
- 480,
- 168,
- 308,
- 448,
- 532,
- 180,
- 338,
- 504,
- 588,
- 196,
- 364,
- 546,
- 650,
- 224,
- 416,
- 600,
- 700,
- 224,
- 442,
- 644,
- 750,
- 252,
- 476,
- 690,
- 816,
- 270,
- 504,
- 750,
- 900,
- 300,
- 560,
- 810,
- 960,
- 312,
- 588,
- 870,
- 1050,
- 336,
- 644,
- 952,
- 1110,
- 360,
- 700,
- 1020,
- 1200,
- 390,
- 728,
- 1050,
- 1260,
- 420,
- 784,
- 1140,
- 1350,
- 450,
- 812,
- 1200,
- 1440,
- 480,
- 868,
- 1290,
- 1530,
- 510,
- 924,
- 1350,
- 1620,
- 540,
- 980,
- 1440,
- 1710,
- 570,
- 1036,
- 1530,
- 1800,
- 570,
- 1064,
- 1590,
- 1890,
- 600,
- 1120,
- 1680,
- 1980,
- 630,
- 1204,
- 1770,
- 2100,
- 660,
- 1260,
- 1860,
- 2220,
- 720,
- 1316,
- 1950,
- 2310,
- 750,
- 1372,
- 2040,
- 2430
- ];
- exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
- switch (errorCorrectionLevel) {
- case ECLevel.L:
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
- case ECLevel.M:
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
- case ECLevel.Q:
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
- case ECLevel.H:
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
- default:
- return void 0;
- }
- };
- exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
- switch (errorCorrectionLevel) {
- case ECLevel.L:
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
- case ECLevel.M:
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
- case ECLevel.Q:
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
- case ECLevel.H:
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
- default:
- return void 0;
- }
- };
- }
- });
- // node_modules/qrcode/lib/core/galois-field.js
- var require_galois_field = __commonJS({
- "node_modules/qrcode/lib/core/galois-field.js"(exports) {
- init_define_APP_INFO();
- var EXP_TABLE = new Uint8Array(512);
- var LOG_TABLE = new Uint8Array(256);
- (function initTables() {
- let x = 1;
- for (let i = 0; i < 255; i++) {
- EXP_TABLE[i] = x;
- LOG_TABLE[x] = i;
- x <<= 1;
- if (x & 256) {
- x ^= 285;
- }
- }
- for (let i = 255; i < 512; i++) {
- EXP_TABLE[i] = EXP_TABLE[i - 255];
- }
- })();
- exports.log = function log(n) {
- if (n < 1)
- throw new Error("log(" + n + ")");
- return LOG_TABLE[n];
- };
- exports.exp = function exp(n) {
- return EXP_TABLE[n];
- };
- exports.mul = function mul(x, y) {
- if (x === 0 || y === 0)
- return 0;
- return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];
- };
- }
- });
- // node_modules/qrcode/lib/core/polynomial.js
- var require_polynomial = __commonJS({
- "node_modules/qrcode/lib/core/polynomial.js"(exports) {
- init_define_APP_INFO();
- var GF = require_galois_field();
- 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;
- };
- 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);
- }
- let offset = 0;
- while (offset < result.length && result[offset] === 0)
- offset++;
- result = result.slice(offset);
- }
- return result;
- };
- 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;
- };
- }
- });
- // node_modules/qrcode/lib/core/reed-solomon-encoder.js
- var require_reed_solomon_encoder = __commonJS({
- "node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module) {
- init_define_APP_INFO();
- var Polynomial = require_polynomial();
- function ReedSolomonEncoder(degree) {
- this.genPoly = void 0;
- this.degree = degree;
- if (this.degree)
- this.initialize(this.degree);
- }
- ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
- this.degree = degree;
- this.genPoly = Polynomial.generateECPolynomial(this.degree);
- };
- ReedSolomonEncoder.prototype.encode = function encode(data) {
- if (!this.genPoly) {
- throw new Error("Encoder not initialized");
- }
- const paddedData = new Uint8Array(data.length + this.degree);
- paddedData.set(data);
- const remainder = Polynomial.mod(paddedData, this.genPoly);
- const start = this.degree - remainder.length;
- if (start > 0) {
- const buff = new Uint8Array(this.degree);
- buff.set(remainder, start);
- return buff;
- }
- return remainder;
- };
- module.exports = ReedSolomonEncoder;
- }
- });
- // node_modules/qrcode/lib/core/version-check.js
- var require_version_check = __commonJS({
- "node_modules/qrcode/lib/core/version-check.js"(exports) {
- init_define_APP_INFO();
- exports.isValid = function isValid(version) {
- return !isNaN(version) && version >= 1 && version <= 40;
- };
- }
- });
- // node_modules/qrcode/lib/core/regex.js
- var require_regex = __commonJS({
- "node_modules/qrcode/lib/core/regex.js"(exports) {
- init_define_APP_INFO();
- var numeric = "[0-9]+";
- var alphanumeric = "[A-Z $%*+\\-./:]+";
- var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
- kanji = kanji.replace(/u/g, "\\u");
- var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
- exports.KANJI = new RegExp(kanji, "g");
- exports.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
- exports.BYTE = new RegExp(byte, "g");
- exports.NUMERIC = new RegExp(numeric, "g");
- exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");
- var TEST_KANJI = new RegExp("^" + kanji + "$");
- var TEST_NUMERIC = new RegExp("^" + numeric + "$");
- var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
- exports.testKanji = function testKanji(str) {
- return TEST_KANJI.test(str);
- };
- exports.testNumeric = function testNumeric(str) {
- return TEST_NUMERIC.test(str);
- };
- exports.testAlphanumeric = function testAlphanumeric(str) {
- return TEST_ALPHANUMERIC.test(str);
- };
- }
- });
- // node_modules/qrcode/lib/core/mode.js
- var require_mode = __commonJS({
- "node_modules/qrcode/lib/core/mode.js"(exports) {
- init_define_APP_INFO();
- var VersionCheck = require_version_check();
- var Regex = require_regex();
- exports.NUMERIC = {
- id: "Numeric",
- bit: 1 << 0,
- ccBits: [10, 12, 14]
- };
- exports.ALPHANUMERIC = {
- id: "Alphanumeric",
- bit: 1 << 1,
- ccBits: [9, 11, 13]
- };
- exports.BYTE = {
- id: "Byte",
- bit: 1 << 2,
- ccBits: [8, 16, 16]
- };
- exports.KANJI = {
- id: "Kanji",
- bit: 1 << 3,
- ccBits: [8, 10, 12]
- };
- exports.MIXED = {
- bit: -1
- };
- exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {
- if (!mode.ccBits)
- throw new Error("Invalid mode: " + mode);
- if (!VersionCheck.isValid(version)) {
- throw new Error("Invalid version: " + version);
- }
- if (version >= 1 && version < 10)
- return mode.ccBits[0];
- else if (version < 27)
- return mode.ccBits[1];
- return mode.ccBits[2];
- };
- exports.getBestModeForData = function getBestModeForData(dataStr) {
- if (Regex.testNumeric(dataStr))
- return exports.NUMERIC;
- else if (Regex.testAlphanumeric(dataStr))
- return exports.ALPHANUMERIC;
- else if (Regex.testKanji(dataStr))
- return exports.KANJI;
- else
- return exports.BYTE;
- };
- exports.toString = function toString(mode) {
- if (mode && mode.id)
- return mode.id;
- throw new Error("Invalid mode");
- };
- exports.isValid = function isValid(mode) {
- return mode && mode.bit && mode.ccBits;
- };
- function fromString(string) {
- if (typeof string !== "string") {
- throw new Error("Param is not a string");
- }
- const lcStr = string.toLowerCase();
- switch (lcStr) {
- case "numeric":
- return exports.NUMERIC;
- case "alphanumeric":
- return exports.ALPHANUMERIC;
- case "kanji":
- return exports.KANJI;
- case "byte":
- return exports.BYTE;
- default:
- throw new Error("Unknown mode: " + string);
- }
- }
- exports.from = function from(value, defaultValue) {
- if (exports.isValid(value)) {
- return value;
- }
- try {
- return fromString(value);
- } catch (e) {
- return defaultValue;
- }
- };
- }
- });
- // node_modules/qrcode/lib/core/version.js
- var require_version = __commonJS({
- "node_modules/qrcode/lib/core/version.js"(exports) {
- init_define_APP_INFO();
- var Utils = require_utils();
- var ECCode = require_error_correction_code();
- var ECLevel = require_error_correction_level();
- var Mode = require_mode();
- var VersionCheck = require_version_check();
- var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
- var 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 void 0;
- }
- function getReservedBitsCount(mode, version) {
- 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 void 0;
- }
- exports.from = function from(value, defaultValue) {
- if (VersionCheck.isValid(value)) {
- return parseInt(value, 10);
- }
- return defaultValue;
- };
- exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
- if (!VersionCheck.isValid(version)) {
- throw new Error("Invalid QR Code version");
- }
- if (typeof mode === "undefined")
- mode = Mode.BYTE;
- const totalCodewords = Utils.getSymbolTotalCodewords(version);
- const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
- const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
- if (mode === Mode.MIXED)
- return dataTotalCodewordsBits;
- const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
- 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);
- }
- };
- 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);
- };
- 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;
- };
- }
- });
- // node_modules/qrcode/lib/core/format-info.js
- var require_format_info = __commonJS({
- "node_modules/qrcode/lib/core/format-info.js"(exports) {
- init_define_APP_INFO();
- var Utils = require_utils();
- var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
- var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
- var G15_BCH = Utils.getBCHDigit(G15);
- exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
- const data = errorCorrectionLevel.bit << 3 | mask;
- let d = data << 10;
- while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
- d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;
- }
- return (data << 10 | d) ^ G15_MASK;
- };
- }
- });
- // node_modules/qrcode/lib/core/numeric-data.js
- var require_numeric_data = __commonJS({
- "node_modules/qrcode/lib/core/numeric-data.js"(exports, module) {
- init_define_APP_INFO();
- var Mode = require_mode();
- 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;
- for (i = 0; i + 3 <= this.data.length; i += 3) {
- group = this.data.substr(i, 3);
- value = parseInt(group, 10);
- bitBuffer.put(value, 10);
- }
- 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;
- }
- });
- // node_modules/qrcode/lib/core/alphanumeric-data.js
- var require_alphanumeric_data = __commonJS({
- "node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module) {
- init_define_APP_INFO();
- var Mode = require_mode();
- var ALPHA_NUM_CHARS = [
- "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 AlphanumericData(data) {
- this.mode = Mode.ALPHANUMERIC;
- this.data = data;
- }
- AlphanumericData.getBitsLength = function getBitsLength(length) {
- return 11 * Math.floor(length / 2) + 6 * (length % 2);
- };
- AlphanumericData.prototype.getLength = function getLength() {
- return this.data.length;
- };
- AlphanumericData.prototype.getBitsLength = function getBitsLength() {
- return AlphanumericData.getBitsLength(this.data.length);
- };
- AlphanumericData.prototype.write = function write(bitBuffer) {
- let i;
- for (i = 0; i + 2 <= this.data.length; i += 2) {
- let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
- value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
- bitBuffer.put(value, 11);
- }
- if (this.data.length % 2) {
- bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
- }
- };
- module.exports = AlphanumericData;
- }
- });
- // node_modules/encode-utf8/index.js
- var require_encode_utf8 = __commonJS({
- "node_modules/encode-utf8/index.js"(exports, module) {
- "use strict";
- init_define_APP_INFO();
- module.exports = function encodeUtf8(input) {
- var result = [];
- var size = input.length;
- for (var index = 0; index < size; index++) {
- var point = input.charCodeAt(index);
- if (point >= 55296 && point <= 56319 && size > index + 1) {
- var second = input.charCodeAt(index + 1);
- if (second >= 56320 && second <= 57343) {
- point = (point - 55296) * 1024 + second - 56320 + 65536;
- index += 1;
- }
- }
- if (point < 128) {
- result.push(point);
- continue;
- }
- if (point < 2048) {
- result.push(point >> 6 | 192);
- result.push(point & 63 | 128);
- continue;
- }
- if (point < 55296 || point >= 57344 && point < 65536) {
- result.push(point >> 12 | 224);
- result.push(point >> 6 & 63 | 128);
- result.push(point & 63 | 128);
- continue;
- }
- if (point >= 65536 && point <= 1114111) {
- result.push(point >> 18 | 240);
- result.push(point >> 12 & 63 | 128);
- result.push(point >> 6 & 63 | 128);
- result.push(point & 63 | 128);
- continue;
- }
- result.push(239, 191, 189);
- }
- return new Uint8Array(result).buffer;
- };
- }
- });
- // node_modules/qrcode/lib/core/byte-data.js
- var require_byte_data = __commonJS({
- "node_modules/qrcode/lib/core/byte-data.js"(exports, module) {
- init_define_APP_INFO();
- var encodeUtf8 = require_encode_utf8();
- var Mode = require_mode();
- function ByteData(data) {
- this.mode = Mode.BYTE;
- if (typeof data === "string") {
- data = encodeUtf8(data);
- }
- 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;
- }
- });
- // node_modules/qrcode/lib/core/kanji-data.js
- var require_kanji_data = __commonJS({
- "node_modules/qrcode/lib/core/kanji-data.js"(exports, module) {
- init_define_APP_INFO();
- var Mode = require_mode();
- var Utils = require_utils();
- 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;
- for (i = 0; i < this.data.length; i++) {
- let value = Utils.toSJIS(this.data[i]);
- if (value >= 33088 && value <= 40956) {
- value -= 33088;
- } else if (value >= 57408 && value <= 60351) {
- value -= 49472;
- } else {
- throw new Error(
- "Invalid SJIS character: " + this.data[i] + "\nMake sure your charset is UTF-8"
- );
- }
- value = (value >>> 8 & 255) * 192 + (value & 255);
- bitBuffer.put(value, 13);
- }
- };
- module.exports = KanjiData;
- }
- });
- // node_modules/dijkstrajs/dijkstra.js
- var require_dijkstra = __commonJS({
- "node_modules/dijkstrajs/dijkstra.js"(exports, module) {
- "use strict";
- init_define_APP_INFO();
- var dijkstra = {
- single_source_shortest_paths: function(graph, s, d) {
- var predecessors = {};
- var costs = {};
- costs[s] = 0;
- var open = dijkstra.PriorityQueue.make();
- open.push(s, 0);
- var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
- while (!open.empty()) {
- closest = open.pop();
- u = closest.value;
- cost_of_s_to_u = closest.cost;
- adjacent_nodes = graph[u] || {};
- for (v in adjacent_nodes) {
- if (adjacent_nodes.hasOwnProperty(v)) {
- cost_of_e = adjacent_nodes[v];
- cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
- cost_of_s_to_v = costs[v];
- first_visit = typeof costs[v] === "undefined";
- if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
- costs[v] = cost_of_s_to_u_plus_cost_of_e;
- open.push(v, cost_of_s_to_u_plus_cost_of_e);
- predecessors[v] = u;
- }
- }
- }
- }
- if (typeof d !== "undefined" && typeof costs[d] === "undefined") {
- var msg = ["Could not find a path from ", s, " to ", d, "."].join("");
- throw new Error(msg);
- }
- return predecessors;
- },
- extract_shortest_path_from_predecessor_list: function(predecessors, d) {
- var nodes = [];
- var u = d;
- var predecessor;
- while (u) {
- nodes.push(u);
- predecessor = predecessors[u];
- u = predecessors[u];
- }
- nodes.reverse();
- return nodes;
- },
- find_path: function(graph, s, d) {
- var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
- return dijkstra.extract_shortest_path_from_predecessor_list(
- predecessors,
- d
- );
- },
- PriorityQueue: {
- make: function(opts) {
- var T = dijkstra.PriorityQueue, t = {}, key;
- opts = opts || {};
- for (key in T) {
- if (T.hasOwnProperty(key)) {
- t[key] = T[key];
- }
- }
- t.queue = [];
- t.sorter = opts.sorter || T.default_sorter;
- return t;
- },
- default_sorter: function(a, b) {
- return a.cost - b.cost;
- },
- push: function(value, cost) {
- var item = { value, cost };
- this.queue.push(item);
- this.queue.sort(this.sorter);
- },
- pop: function() {
- return this.queue.shift();
- },
- empty: function() {
- return this.queue.length === 0;
- }
- }
- };
- if (typeof module !== "undefined") {
- module.exports = dijkstra;
- }
- }
- });
- // node_modules/qrcode/lib/core/segments.js
- var require_segments = __commonJS({
- "node_modules/qrcode/lib/core/segments.js"(exports) {
- init_define_APP_INFO();
- var Mode = require_mode();
- var NumericData = require_numeric_data();
- var AlphanumericData = require_alphanumeric_data();
- var ByteData = require_byte_data();
- var KanjiData = require_kanji_data();
- var Regex = require_regex();
- var Utils = require_utils();
- var dijkstra = require_dijkstra();
- function getStringByteLength(str) {
- return unescape(encodeURIComponent(str)).length;
- }
- function getSegments(regex, mode, str) {
- const segments = [];
- let result;
- while ((result = regex.exec(str)) !== null) {
- segments.push({
- data: result[0],
- index: result.index,
- mode,
- length: result[0].length
- });
- }
- return segments;
- }
- function getSegmentsFromString(dataStr) {
- const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
- const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
- let byteSegs;
- let kanjiSegs;
- if (Utils.isKanjiModeEnabled()) {
- byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
- kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
- } else {
- byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
- kanjiSegs = [];
- }
- const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
- return segs.sort(function(s1, s2) {
- return s1.index - s2.index;
- }).map(function(obj) {
- return {
- data: obj.data,
- mode: obj.mode,
- length: obj.length
- };
- });
- }
- function getSegmentBitsLength(length, mode) {
- switch (mode) {
- case Mode.NUMERIC:
- return NumericData.getBitsLength(length);
- case Mode.ALPHANUMERIC:
- return AlphanumericData.getBitsLength(length);
- case Mode.KANJI:
- return KanjiData.getBitsLength(length);
- case Mode.BYTE:
- return ByteData.getBitsLength(length);
- }
- }
- function mergeSegments(segs) {
- return segs.reduce(function(acc, curr) {
- const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
- if (prevSeg && prevSeg.mode === curr.mode) {
- acc[acc.length - 1].data += curr.data;
- return acc;
- }
- acc.push(curr);
- return acc;
- }, []);
- }
- function buildNodes(segs) {
- const nodes = [];
- for (let i = 0; i < segs.length; i++) {
- const seg = segs[i];
- switch (seg.mode) {
- case Mode.NUMERIC:
- nodes.push([
- seg,
- { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
- { data: seg.data, mode: Mode.BYTE, length: seg.length }
- ]);
- break;
- case Mode.ALPHANUMERIC:
- nodes.push([
- seg,
- { data: seg.data, mode: Mode.BYTE, length: seg.length }
- ]);
- break;
- case Mode.KANJI:
- nodes.push([
- seg,
- { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
- ]);
- break;
- case Mode.BYTE:
- nodes.push([
- { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
- ]);
- }
- }
- return nodes;
- }
- function buildGraph(nodes, version) {
- const table = {};
- const graph = { start: {} };
- let prevNodeIds = ["start"];
- for (let i = 0; i < nodes.length; i++) {
- const nodeGroup = nodes[i];
- const currentNodeIds = [];
- for (let j = 0; j < nodeGroup.length; j++) {
- const node = nodeGroup[j];
- const key = "" + i + j;
- currentNodeIds.push(key);
- table[key] = { node, lastCount: 0 };
- graph[key] = {};
- for (let n = 0; n < prevNodeIds.length; n++) {
- const prevNodeId = prevNodeIds[n];
- if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
- graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
- table[prevNodeId].lastCount += node.length;
- } else {
- if (table[prevNodeId])
- table[prevNodeId].lastCount = node.length;
- graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
- }
- }
- }
- prevNodeIds = currentNodeIds;
- }
- for (let n = 0; n < prevNodeIds.length; n++) {
- graph[prevNodeIds[n]].end = 0;
- }
- return { map: graph, table };
- }
- function buildSingleSegment(data, modesHint) {
- let mode;
- const bestMode = Mode.getBestModeForData(data);
- mode = Mode.from(modesHint, bestMode);
- if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
- throw new Error('"' + data + '" cannot be encoded with mode ' + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
- }
- if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
- mode = Mode.BYTE;
- }
- switch (mode) {
- case Mode.NUMERIC:
- return new NumericData(data);
- case Mode.ALPHANUMERIC:
- return new AlphanumericData(data);
- case Mode.KANJI:
- return new KanjiData(data);
- case Mode.BYTE:
- return new ByteData(data);
- }
- }
- exports.fromArray = function fromArray(array) {
- return array.reduce(function(acc, seg) {
- if (typeof seg === "string") {
- acc.push(buildSingleSegment(seg, null));
- } else if (seg.data) {
- acc.push(buildSingleSegment(seg.data, seg.mode));
- }
- return acc;
- }, []);
- };
- exports.fromString = function fromString(data, version) {
- const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
- const nodes = buildNodes(segs);
- const graph = buildGraph(nodes, version);
- const path = dijkstra.find_path(graph.map, "start", "end");
- const optimizedSegs = [];
- for (let i = 1; i < path.length - 1; i++) {
- optimizedSegs.push(graph.table[path[i]].node);
- }
- return exports.fromArray(mergeSegments(optimizedSegs));
- };
- exports.rawSplit = function rawSplit(data) {
- return exports.fromArray(
- getSegmentsFromString(data, Utils.isKanjiModeEnabled())
- );
- };
- }
- });
- // node_modules/qrcode/lib/core/qrcode.js
- var require_qrcode = __commonJS({
- "node_modules/qrcode/lib/core/qrcode.js"(exports) {
- init_define_APP_INFO();
- var Utils = require_utils();
- var ECLevel = require_error_correction_level();
- var BitBuffer = require_bit_buffer();
- var BitMatrix = require_bit_matrix();
- var AlignmentPattern = require_alignment_pattern();
- var FinderPattern = require_finder_pattern();
- var MaskPattern = require_mask_pattern();
- var ECCode = require_error_correction_code();
- var ReedSolomonEncoder = require_reed_solomon_encoder();
- var Version = require_version();
- var FormatInfo = require_format_info();
- var Mode = require_mode();
- var Segments = require_segments();
- 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);
- }
- }
- }
- }
- }
- 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);
- }
- }
- 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);
- }
- }
- }
- }
- }
- 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);
- }
- }
- 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;
- 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);
- }
- 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);
- }
- }
- matrix.set(size - 8, 8, 1, true);
- }
- 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;
- }
- }
- }
- }
- function createData(version, errorCorrectionLevel, segments) {
- const buffer = new BitBuffer();
- segments.forEach(function(data) {
- buffer.put(data.mode.bit, 4);
- buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
- data.write(buffer);
- });
- const totalCodewords = Utils.getSymbolTotalCodewords(version);
- const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
- const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
- if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
- buffer.put(0, 4);
- }
- while (buffer.getLengthInBits() % 8 !== 0) {
- buffer.putBit(0);
- }
- const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
- for (let i = 0; i < remainingByte; i++) {
- buffer.put(i % 2 ? 17 : 236, 8);
- }
- return createCodewords(buffer, version, errorCorrectionLevel);
- }
- function createCodewords(bitBuffer, version, errorCorrectionLevel) {
- const totalCodewords = Utils.getSymbolTotalCodewords(version);
- const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
- const dataTotalCodewords = totalCodewords - ecTotalCodewords;
- const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
- const blocksInGroup2 = totalCodewords % ecTotalBlocks;
- const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
- const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
- const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
- const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
- const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
- 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);
- for (let b = 0; b < ecTotalBlocks; b++) {
- const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
- dcData[b] = buffer.slice(offset, offset + dataSize);
- ecData[b] = rs.encode(dcData[b]);
- offset += dataSize;
- maxDataSize = Math.max(maxDataSize, dataSize);
- }
- const data = new Uint8Array(totalCodewords);
- let index = 0;
- let i, r;
- for (i = 0; i < maxDataSize; i++) {
- for (r = 0; r < ecTotalBlocks; r++) {
- if (i < dcData[r].length) {
- data[index++] = dcData[r][i];
- }
- }
- }
- for (i = 0; i < ecCount; i++) {
- for (r = 0; r < ecTotalBlocks; r++) {
- data[index++] = ecData[r][i];
- }
- }
- return 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);
- estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
- }
- segments = Segments.fromString(data, estimatedVersion || 40);
- } else {
- throw new Error("Invalid data");
- }
- const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
- if (!bestVersion) {
- throw new Error("The amount of data is too big to be stored in a QR Code");
- }
- if (!version) {
- version = bestVersion;
- } else if (version < bestVersion) {
- throw new Error(
- "\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n"
- );
- }
- const dataBits = createData(version, errorCorrectionLevel, segments);
- const moduleCount = Utils.getSymbolSize(version);
- const modules = new BitMatrix(moduleCount);
- setupFinderPattern(modules, version);
- setupTimingPattern(modules);
- setupAlignmentPattern(modules, version);
- setupFormatInfo(modules, errorCorrectionLevel, 0);
- if (version >= 7) {
- setupVersionInfo(modules, version);
- }
- setupData(modules, dataBits);
- if (isNaN(maskPattern)) {
- maskPattern = MaskPattern.getBestMask(
- modules,
- setupFormatInfo.bind(null, modules, errorCorrectionLevel)
- );
- }
- MaskPattern.applyMask(maskPattern, modules);
- setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
- return {
- modules,
- version,
- errorCorrectionLevel,
- maskPattern,
- segments
- };
- }
- 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") {
- 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);
- };
- }
- });
- // node_modules/qrcode/lib/renderer/utils.js
- var require_utils2 = __commonJS({
- "node_modules/qrcode/lib/renderer/utils.js"(exports) {
- init_define_APP_INFO();
- function hex2rgba(hex) {
- if (typeof hex === "number") {
- hex = hex.toString();
- }
- if (typeof hex !== "string") {
- throw new Error("Color should be defined as hex string");
- }
- let hexCode = hex.slice().replace("#", "").split("");
- if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
- throw new Error("Invalid hex color: " + hex);
- }
- if (hexCode.length === 3 || hexCode.length === 4) {
- hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {
- return [c, c];
- }));
- }
- if (hexCode.length === 6)
- hexCode.push("F", "F");
- const hexValue = parseInt(hexCode.join(""), 16);
- return {
- r: hexValue >> 24 & 255,
- g: hexValue >> 16 & 255,
- b: hexValue >> 8 & 255,
- a: hexValue & 255,
- hex: "#" + hexCode.slice(0, 6).join("")
- };
- }
- exports.getOptions = function getOptions(options) {
- if (!options)
- options = {};
- if (!options.color)
- options.color = {};
- const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;
- const width = options.width && options.width >= 21 ? options.width : void 0;
- const scale = options.scale || 4;
- return {
- width,
- scale: width ? 4 : scale,
- margin,
- color: {
- dark: hex2rgba(options.color.dark || "#000000ff"),
- light: hex2rgba(options.color.light || "#ffffffff")
- },
- type: options.type,
- rendererOpts: options.rendererOpts || {}
- };
- };
- exports.getScale = function getScale(qrSize, opts) {
- return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;
- };
- exports.getImageWidth = function getImageWidth(qrSize, opts) {
- const scale = exports.getScale(qrSize, opts);
- return Math.floor((qrSize + opts.margin * 2) * scale);
- };
- exports.qrToImageData = function qrToImageData(imgData, qr, opts) {
- const size = qr.modules.size;
- const data = qr.modules.data;
- const scale = exports.getScale(size, opts);
- const symbolSize = Math.floor((size + opts.margin * 2) * scale);
- const scaledMargin = opts.margin * scale;
- const palette = [opts.color.light, opts.color.dark];
- for (let i = 0; i < symbolSize; i++) {
- for (let j = 0; j < symbolSize; j++) {
- let posDst = (i * symbolSize + j) * 4;
- let pxColor = opts.color.light;
- if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
- const iSrc = Math.floor((i - scaledMargin) / scale);
- const jSrc = Math.floor((j - scaledMargin) / scale);
- pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
- }
- imgData[posDst++] = pxColor.r;
- imgData[posDst++] = pxColor.g;
- imgData[posDst++] = pxColor.b;
- imgData[posDst] = pxColor.a;
- }
- }
- };
- }
- });
- // node_modules/qrcode/lib/renderer/canvas.js
- var require_canvas = __commonJS({
- "node_modules/qrcode/lib/renderer/canvas.js"(exports) {
- init_define_APP_INFO();
- var Utils = require_utils2();
- function clearCanvas(ctx, canvas, size) {
- ctx.clearRect(0, 0, canvas.width, canvas.height);
- if (!canvas.style)
- canvas.style = {};
- canvas.height = size;
- canvas.width = size;
- canvas.style.height = size + "px";
- canvas.style.width = size + "px";
- }
- function getCanvasElement() {
- try {
- return document.createElement("canvas");
- } catch (e) {
- throw new Error("You need to specify a canvas element");
- }
- }
- exports.render = function render(qrData, canvas, options) {
- let opts = options;
- let canvasEl = canvas;
- if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
- opts = canvas;
- canvas = void 0;
- }
- if (!canvas) {
- canvasEl = getCanvasElement();
- }
- opts = Utils.getOptions(opts);
- const size = Utils.getImageWidth(qrData.modules.size, opts);
- const ctx = canvasEl.getContext("2d");
- const image = ctx.createImageData(size, size);
- Utils.qrToImageData(image.data, qrData, opts);
- clearCanvas(ctx, canvasEl, size);
- ctx.putImageData(image, 0, 0);
- return canvasEl;
- };
- exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {
- let opts = options;
- if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
- opts = canvas;
- canvas = void 0;
- }
- if (!opts)
- opts = {};
- const canvasEl = exports.render(qrData, canvas, opts);
- const type = opts.type || "image/png";
- const rendererOpts = opts.rendererOpts || {};
- return canvasEl.toDataURL(type, rendererOpts.quality);
- };
- }
- });
- // node_modules/qrcode/lib/renderer/svg-tag.js
- var require_svg_tag = __commonJS({
- "node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
- init_define_APP_INFO();
- var Utils = require_utils2();
- function getColorAttrib(color, attrib) {
- const alpha = color.a / 255;
- const str = attrib + '="' + color.hex + '"';
- return alpha < 1 ? str + " " + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str;
- }
- function svgCmd(cmd, x, y) {
- let str = cmd + x;
- if (typeof y !== "undefined")
- str += " " + y;
- return str;
- }
- function qrToPath(data, size, margin) {
- let path = "";
- let moveBy = 0;
- let newRow = false;
- let lineLength = 0;
- for (let i = 0; i < data.length; i++) {
- const col = Math.floor(i % size);
- const row = Math.floor(i / size);
- if (!col && !newRow)
- newRow = true;
- if (data[i]) {
- lineLength++;
- if (!(i > 0 && col > 0 && data[i - 1])) {
- path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
- moveBy = 0;
- newRow = false;
- }
- if (!(col + 1 < size && data[i + 1])) {
- path += svgCmd("h", lineLength);
- lineLength = 0;
- }
- } else {
- moveBy++;
- }
- }
- return path;
- }
- exports.render = function render(qrData, options, cb) {
- const opts = Utils.getOptions(options);
- const size = qrData.modules.size;
- const data = qrData.modules.data;
- const qrcodesize = size + opts.margin * 2;
- const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
- const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
- const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
- const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + "</svg>\n";
- if (typeof cb === "function") {
- cb(null, svgTag);
- }
- return svgTag;
- };
- }
- });
- // node_modules/qrcode/lib/browser.js
- var require_browser = __commonJS({
- "node_modules/qrcode/lib/browser.js"(exports) {
- init_define_APP_INFO();
- var canPromise = require_can_promise();
- var QRCode = require_qrcode();
- var CanvasRenderer = require_canvas();
- var SvgRenderer = require_svg_tag();
- function renderCanvas(renderFunc, canvas, text, opts, cb) {
- const args = [].slice.call(arguments, 1);
- const argsNum = args.length;
- const isLastArgCb = typeof args[argsNum - 1] === "function";
- if (!isLastArgCb && !canPromise()) {
- throw new Error("Callback required as last argument");
- }
- if (isLastArgCb) {
- if (argsNum < 2) {
- throw new Error("Too few arguments provided");
- }
- if (argsNum === 2) {
- cb = text;
- text = canvas;
- canvas = opts = void 0;
- } else if (argsNum === 3) {
- if (canvas.getContext && typeof cb === "undefined") {
- cb = opts;
- opts = void 0;
- } else {
- cb = opts;
- opts = text;
- text = canvas;
- canvas = void 0;
- }
- }
- } else {
- if (argsNum < 1) {
- throw new Error("Too few arguments provided");
- }
- if (argsNum === 1) {
- text = canvas;
- canvas = opts = void 0;
- } else if (argsNum === 2 && !canvas.getContext) {
- opts = text;
- text = canvas;
- canvas = void 0;
- }
- return new Promise(function(resolve, reject) {
- try {
- const data = QRCode.create(text, opts);
- resolve(renderFunc(data, canvas, opts));
- } catch (e) {
- reject(e);
- }
- });
- }
- try {
- const data = QRCode.create(text, opts);
- cb(null, renderFunc(data, canvas, opts));
- } catch (e) {
- cb(e);
- }
- }
- exports.create = QRCode.create;
- exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
- exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
- exports.toString = renderCanvas.bind(null, function(data, _, opts) {
- return SvgRenderer.render(data, opts);
- });
- }
- });
- // dep:qrcode
- init_define_APP_INFO();
- var qrcode_default = require_browser();
- export {
- qrcode_default as default
- };
- //# sourceMappingURL=qrcode.js.map
|