qrcode.js 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184
  1. import {
  2. __commonJS,
  3. init_define_APP_INFO
  4. } from "./chunk-XY75H3MP.js";
  5. // node_modules/qrcode/lib/can-promise.js
  6. var require_can_promise = __commonJS({
  7. "node_modules/qrcode/lib/can-promise.js"(exports, module) {
  8. init_define_APP_INFO();
  9. module.exports = function() {
  10. return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
  11. };
  12. }
  13. });
  14. // node_modules/qrcode/lib/core/utils.js
  15. var require_utils = __commonJS({
  16. "node_modules/qrcode/lib/core/utils.js"(exports) {
  17. init_define_APP_INFO();
  18. var toSJISFunction;
  19. var CODEWORDS_COUNT = [
  20. 0,
  21. 26,
  22. 44,
  23. 70,
  24. 100,
  25. 134,
  26. 172,
  27. 196,
  28. 242,
  29. 292,
  30. 346,
  31. 404,
  32. 466,
  33. 532,
  34. 581,
  35. 655,
  36. 733,
  37. 815,
  38. 901,
  39. 991,
  40. 1085,
  41. 1156,
  42. 1258,
  43. 1364,
  44. 1474,
  45. 1588,
  46. 1706,
  47. 1828,
  48. 1921,
  49. 2051,
  50. 2185,
  51. 2323,
  52. 2465,
  53. 2611,
  54. 2761,
  55. 2876,
  56. 3034,
  57. 3196,
  58. 3362,
  59. 3532,
  60. 3706
  61. ];
  62. exports.getSymbolSize = function getSymbolSize(version) {
  63. if (!version)
  64. throw new Error('"version" cannot be null or undefined');
  65. if (version < 1 || version > 40)
  66. throw new Error('"version" should be in range from 1 to 40');
  67. return version * 4 + 17;
  68. };
  69. exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
  70. return CODEWORDS_COUNT[version];
  71. };
  72. exports.getBCHDigit = function(data) {
  73. let digit = 0;
  74. while (data !== 0) {
  75. digit++;
  76. data >>>= 1;
  77. }
  78. return digit;
  79. };
  80. exports.setToSJISFunction = function setToSJISFunction(f) {
  81. if (typeof f !== "function") {
  82. throw new Error('"toSJISFunc" is not a valid function.');
  83. }
  84. toSJISFunction = f;
  85. };
  86. exports.isKanjiModeEnabled = function() {
  87. return typeof toSJISFunction !== "undefined";
  88. };
  89. exports.toSJIS = function toSJIS(kanji) {
  90. return toSJISFunction(kanji);
  91. };
  92. }
  93. });
  94. // node_modules/qrcode/lib/core/error-correction-level.js
  95. var require_error_correction_level = __commonJS({
  96. "node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
  97. init_define_APP_INFO();
  98. exports.L = { bit: 1 };
  99. exports.M = { bit: 0 };
  100. exports.Q = { bit: 3 };
  101. exports.H = { bit: 2 };
  102. function fromString(string) {
  103. if (typeof string !== "string") {
  104. throw new Error("Param is not a string");
  105. }
  106. const lcStr = string.toLowerCase();
  107. switch (lcStr) {
  108. case "l":
  109. case "low":
  110. return exports.L;
  111. case "m":
  112. case "medium":
  113. return exports.M;
  114. case "q":
  115. case "quartile":
  116. return exports.Q;
  117. case "h":
  118. case "high":
  119. return exports.H;
  120. default:
  121. throw new Error("Unknown EC Level: " + string);
  122. }
  123. }
  124. exports.isValid = function isValid(level) {
  125. return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;
  126. };
  127. exports.from = function from(value, defaultValue) {
  128. if (exports.isValid(value)) {
  129. return value;
  130. }
  131. try {
  132. return fromString(value);
  133. } catch (e) {
  134. return defaultValue;
  135. }
  136. };
  137. }
  138. });
  139. // node_modules/qrcode/lib/core/bit-buffer.js
  140. var require_bit_buffer = __commonJS({
  141. "node_modules/qrcode/lib/core/bit-buffer.js"(exports, module) {
  142. init_define_APP_INFO();
  143. function BitBuffer() {
  144. this.buffer = [];
  145. this.length = 0;
  146. }
  147. BitBuffer.prototype = {
  148. get: function(index) {
  149. const bufIndex = Math.floor(index / 8);
  150. return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
  151. },
  152. put: function(num, length) {
  153. for (let i = 0; i < length; i++) {
  154. this.putBit((num >>> length - i - 1 & 1) === 1);
  155. }
  156. },
  157. getLengthInBits: function() {
  158. return this.length;
  159. },
  160. putBit: function(bit) {
  161. const bufIndex = Math.floor(this.length / 8);
  162. if (this.buffer.length <= bufIndex) {
  163. this.buffer.push(0);
  164. }
  165. if (bit) {
  166. this.buffer[bufIndex] |= 128 >>> this.length % 8;
  167. }
  168. this.length++;
  169. }
  170. };
  171. module.exports = BitBuffer;
  172. }
  173. });
  174. // node_modules/qrcode/lib/core/bit-matrix.js
  175. var require_bit_matrix = __commonJS({
  176. "node_modules/qrcode/lib/core/bit-matrix.js"(exports, module) {
  177. init_define_APP_INFO();
  178. function BitMatrix(size) {
  179. if (!size || size < 1) {
  180. throw new Error("BitMatrix size must be defined and greater than 0");
  181. }
  182. this.size = size;
  183. this.data = new Uint8Array(size * size);
  184. this.reservedBit = new Uint8Array(size * size);
  185. }
  186. BitMatrix.prototype.set = function(row, col, value, reserved) {
  187. const index = row * this.size + col;
  188. this.data[index] = value;
  189. if (reserved)
  190. this.reservedBit[index] = true;
  191. };
  192. BitMatrix.prototype.get = function(row, col) {
  193. return this.data[row * this.size + col];
  194. };
  195. BitMatrix.prototype.xor = function(row, col, value) {
  196. this.data[row * this.size + col] ^= value;
  197. };
  198. BitMatrix.prototype.isReserved = function(row, col) {
  199. return this.reservedBit[row * this.size + col];
  200. };
  201. module.exports = BitMatrix;
  202. }
  203. });
  204. // node_modules/qrcode/lib/core/alignment-pattern.js
  205. var require_alignment_pattern = __commonJS({
  206. "node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
  207. init_define_APP_INFO();
  208. var getSymbolSize = require_utils().getSymbolSize;
  209. exports.getRowColCoords = function getRowColCoords(version) {
  210. if (version === 1)
  211. return [];
  212. const posCount = Math.floor(version / 7) + 2;
  213. const size = getSymbolSize(version);
  214. const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
  215. const positions = [size - 7];
  216. for (let i = 1; i < posCount - 1; i++) {
  217. positions[i] = positions[i - 1] - intervals;
  218. }
  219. positions.push(6);
  220. return positions.reverse();
  221. };
  222. exports.getPositions = function getPositions(version) {
  223. const coords = [];
  224. const pos = exports.getRowColCoords(version);
  225. const posLength = pos.length;
  226. for (let i = 0; i < posLength; i++) {
  227. for (let j = 0; j < posLength; j++) {
  228. if (i === 0 && j === 0 || i === 0 && j === posLength - 1 || i === posLength - 1 && j === 0) {
  229. continue;
  230. }
  231. coords.push([pos[i], pos[j]]);
  232. }
  233. }
  234. return coords;
  235. };
  236. }
  237. });
  238. // node_modules/qrcode/lib/core/finder-pattern.js
  239. var require_finder_pattern = __commonJS({
  240. "node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
  241. init_define_APP_INFO();
  242. var getSymbolSize = require_utils().getSymbolSize;
  243. var FINDER_PATTERN_SIZE = 7;
  244. exports.getPositions = function getPositions(version) {
  245. const size = getSymbolSize(version);
  246. return [
  247. [0, 0],
  248. [size - FINDER_PATTERN_SIZE, 0],
  249. [0, size - FINDER_PATTERN_SIZE]
  250. ];
  251. };
  252. }
  253. });
  254. // node_modules/qrcode/lib/core/mask-pattern.js
  255. var require_mask_pattern = __commonJS({
  256. "node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
  257. init_define_APP_INFO();
  258. exports.Patterns = {
  259. PATTERN000: 0,
  260. PATTERN001: 1,
  261. PATTERN010: 2,
  262. PATTERN011: 3,
  263. PATTERN100: 4,
  264. PATTERN101: 5,
  265. PATTERN110: 6,
  266. PATTERN111: 7
  267. };
  268. var PenaltyScores = {
  269. N1: 3,
  270. N2: 3,
  271. N3: 40,
  272. N4: 10
  273. };
  274. exports.isValid = function isValid(mask) {
  275. return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
  276. };
  277. exports.from = function from(value) {
  278. return exports.isValid(value) ? parseInt(value, 10) : void 0;
  279. };
  280. exports.getPenaltyN1 = function getPenaltyN1(data) {
  281. const size = data.size;
  282. let points = 0;
  283. let sameCountCol = 0;
  284. let sameCountRow = 0;
  285. let lastCol = null;
  286. let lastRow = null;
  287. for (let row = 0; row < size; row++) {
  288. sameCountCol = sameCountRow = 0;
  289. lastCol = lastRow = null;
  290. for (let col = 0; col < size; col++) {
  291. let module2 = data.get(row, col);
  292. if (module2 === lastCol) {
  293. sameCountCol++;
  294. } else {
  295. if (sameCountCol >= 5)
  296. points += PenaltyScores.N1 + (sameCountCol - 5);
  297. lastCol = module2;
  298. sameCountCol = 1;
  299. }
  300. module2 = data.get(col, row);
  301. if (module2 === lastRow) {
  302. sameCountRow++;
  303. } else {
  304. if (sameCountRow >= 5)
  305. points += PenaltyScores.N1 + (sameCountRow - 5);
  306. lastRow = module2;
  307. sameCountRow = 1;
  308. }
  309. }
  310. if (sameCountCol >= 5)
  311. points += PenaltyScores.N1 + (sameCountCol - 5);
  312. if (sameCountRow >= 5)
  313. points += PenaltyScores.N1 + (sameCountRow - 5);
  314. }
  315. return points;
  316. };
  317. exports.getPenaltyN2 = function getPenaltyN2(data) {
  318. const size = data.size;
  319. let points = 0;
  320. for (let row = 0; row < size - 1; row++) {
  321. for (let col = 0; col < size - 1; col++) {
  322. const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
  323. if (last === 4 || last === 0)
  324. points++;
  325. }
  326. }
  327. return points * PenaltyScores.N2;
  328. };
  329. exports.getPenaltyN3 = function getPenaltyN3(data) {
  330. const size = data.size;
  331. let points = 0;
  332. let bitsCol = 0;
  333. let bitsRow = 0;
  334. for (let row = 0; row < size; row++) {
  335. bitsCol = bitsRow = 0;
  336. for (let col = 0; col < size; col++) {
  337. bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
  338. if (col >= 10 && (bitsCol === 1488 || bitsCol === 93))
  339. points++;
  340. bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
  341. if (col >= 10 && (bitsRow === 1488 || bitsRow === 93))
  342. points++;
  343. }
  344. }
  345. return points * PenaltyScores.N3;
  346. };
  347. exports.getPenaltyN4 = function getPenaltyN4(data) {
  348. let darkCount = 0;
  349. const modulesCount = data.data.length;
  350. for (let i = 0; i < modulesCount; i++)
  351. darkCount += data.data[i];
  352. const k = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);
  353. return k * PenaltyScores.N4;
  354. };
  355. function getMaskAt(maskPattern, i, j) {
  356. switch (maskPattern) {
  357. case exports.Patterns.PATTERN000:
  358. return (i + j) % 2 === 0;
  359. case exports.Patterns.PATTERN001:
  360. return i % 2 === 0;
  361. case exports.Patterns.PATTERN010:
  362. return j % 3 === 0;
  363. case exports.Patterns.PATTERN011:
  364. return (i + j) % 3 === 0;
  365. case exports.Patterns.PATTERN100:
  366. return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
  367. case exports.Patterns.PATTERN101:
  368. return i * j % 2 + i * j % 3 === 0;
  369. case exports.Patterns.PATTERN110:
  370. return (i * j % 2 + i * j % 3) % 2 === 0;
  371. case exports.Patterns.PATTERN111:
  372. return (i * j % 3 + (i + j) % 2) % 2 === 0;
  373. default:
  374. throw new Error("bad maskPattern:" + maskPattern);
  375. }
  376. }
  377. exports.applyMask = function applyMask(pattern, data) {
  378. const size = data.size;
  379. for (let col = 0; col < size; col++) {
  380. for (let row = 0; row < size; row++) {
  381. if (data.isReserved(row, col))
  382. continue;
  383. data.xor(row, col, getMaskAt(pattern, row, col));
  384. }
  385. }
  386. };
  387. exports.getBestMask = function getBestMask(data, setupFormatFunc) {
  388. const numPatterns = Object.keys(exports.Patterns).length;
  389. let bestPattern = 0;
  390. let lowerPenalty = Infinity;
  391. for (let p = 0; p < numPatterns; p++) {
  392. setupFormatFunc(p);
  393. exports.applyMask(p, data);
  394. const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);
  395. exports.applyMask(p, data);
  396. if (penalty < lowerPenalty) {
  397. lowerPenalty = penalty;
  398. bestPattern = p;
  399. }
  400. }
  401. return bestPattern;
  402. };
  403. }
  404. });
  405. // node_modules/qrcode/lib/core/error-correction-code.js
  406. var require_error_correction_code = __commonJS({
  407. "node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
  408. init_define_APP_INFO();
  409. var ECLevel = require_error_correction_level();
  410. var EC_BLOCKS_TABLE = [
  411. 1,
  412. 1,
  413. 1,
  414. 1,
  415. 1,
  416. 1,
  417. 1,
  418. 1,
  419. 1,
  420. 1,
  421. 2,
  422. 2,
  423. 1,
  424. 2,
  425. 2,
  426. 4,
  427. 1,
  428. 2,
  429. 4,
  430. 4,
  431. 2,
  432. 4,
  433. 4,
  434. 4,
  435. 2,
  436. 4,
  437. 6,
  438. 5,
  439. 2,
  440. 4,
  441. 6,
  442. 6,
  443. 2,
  444. 5,
  445. 8,
  446. 8,
  447. 4,
  448. 5,
  449. 8,
  450. 8,
  451. 4,
  452. 5,
  453. 8,
  454. 11,
  455. 4,
  456. 8,
  457. 10,
  458. 11,
  459. 4,
  460. 9,
  461. 12,
  462. 16,
  463. 4,
  464. 9,
  465. 16,
  466. 16,
  467. 6,
  468. 10,
  469. 12,
  470. 18,
  471. 6,
  472. 10,
  473. 17,
  474. 16,
  475. 6,
  476. 11,
  477. 16,
  478. 19,
  479. 6,
  480. 13,
  481. 18,
  482. 21,
  483. 7,
  484. 14,
  485. 21,
  486. 25,
  487. 8,
  488. 16,
  489. 20,
  490. 25,
  491. 8,
  492. 17,
  493. 23,
  494. 25,
  495. 9,
  496. 17,
  497. 23,
  498. 34,
  499. 9,
  500. 18,
  501. 25,
  502. 30,
  503. 10,
  504. 20,
  505. 27,
  506. 32,
  507. 12,
  508. 21,
  509. 29,
  510. 35,
  511. 12,
  512. 23,
  513. 34,
  514. 37,
  515. 12,
  516. 25,
  517. 34,
  518. 40,
  519. 13,
  520. 26,
  521. 35,
  522. 42,
  523. 14,
  524. 28,
  525. 38,
  526. 45,
  527. 15,
  528. 29,
  529. 40,
  530. 48,
  531. 16,
  532. 31,
  533. 43,
  534. 51,
  535. 17,
  536. 33,
  537. 45,
  538. 54,
  539. 18,
  540. 35,
  541. 48,
  542. 57,
  543. 19,
  544. 37,
  545. 51,
  546. 60,
  547. 19,
  548. 38,
  549. 53,
  550. 63,
  551. 20,
  552. 40,
  553. 56,
  554. 66,
  555. 21,
  556. 43,
  557. 59,
  558. 70,
  559. 22,
  560. 45,
  561. 62,
  562. 74,
  563. 24,
  564. 47,
  565. 65,
  566. 77,
  567. 25,
  568. 49,
  569. 68,
  570. 81
  571. ];
  572. var EC_CODEWORDS_TABLE = [
  573. 7,
  574. 10,
  575. 13,
  576. 17,
  577. 10,
  578. 16,
  579. 22,
  580. 28,
  581. 15,
  582. 26,
  583. 36,
  584. 44,
  585. 20,
  586. 36,
  587. 52,
  588. 64,
  589. 26,
  590. 48,
  591. 72,
  592. 88,
  593. 36,
  594. 64,
  595. 96,
  596. 112,
  597. 40,
  598. 72,
  599. 108,
  600. 130,
  601. 48,
  602. 88,
  603. 132,
  604. 156,
  605. 60,
  606. 110,
  607. 160,
  608. 192,
  609. 72,
  610. 130,
  611. 192,
  612. 224,
  613. 80,
  614. 150,
  615. 224,
  616. 264,
  617. 96,
  618. 176,
  619. 260,
  620. 308,
  621. 104,
  622. 198,
  623. 288,
  624. 352,
  625. 120,
  626. 216,
  627. 320,
  628. 384,
  629. 132,
  630. 240,
  631. 360,
  632. 432,
  633. 144,
  634. 280,
  635. 408,
  636. 480,
  637. 168,
  638. 308,
  639. 448,
  640. 532,
  641. 180,
  642. 338,
  643. 504,
  644. 588,
  645. 196,
  646. 364,
  647. 546,
  648. 650,
  649. 224,
  650. 416,
  651. 600,
  652. 700,
  653. 224,
  654. 442,
  655. 644,
  656. 750,
  657. 252,
  658. 476,
  659. 690,
  660. 816,
  661. 270,
  662. 504,
  663. 750,
  664. 900,
  665. 300,
  666. 560,
  667. 810,
  668. 960,
  669. 312,
  670. 588,
  671. 870,
  672. 1050,
  673. 336,
  674. 644,
  675. 952,
  676. 1110,
  677. 360,
  678. 700,
  679. 1020,
  680. 1200,
  681. 390,
  682. 728,
  683. 1050,
  684. 1260,
  685. 420,
  686. 784,
  687. 1140,
  688. 1350,
  689. 450,
  690. 812,
  691. 1200,
  692. 1440,
  693. 480,
  694. 868,
  695. 1290,
  696. 1530,
  697. 510,
  698. 924,
  699. 1350,
  700. 1620,
  701. 540,
  702. 980,
  703. 1440,
  704. 1710,
  705. 570,
  706. 1036,
  707. 1530,
  708. 1800,
  709. 570,
  710. 1064,
  711. 1590,
  712. 1890,
  713. 600,
  714. 1120,
  715. 1680,
  716. 1980,
  717. 630,
  718. 1204,
  719. 1770,
  720. 2100,
  721. 660,
  722. 1260,
  723. 1860,
  724. 2220,
  725. 720,
  726. 1316,
  727. 1950,
  728. 2310,
  729. 750,
  730. 1372,
  731. 2040,
  732. 2430
  733. ];
  734. exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
  735. switch (errorCorrectionLevel) {
  736. case ECLevel.L:
  737. return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
  738. case ECLevel.M:
  739. return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
  740. case ECLevel.Q:
  741. return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
  742. case ECLevel.H:
  743. return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
  744. default:
  745. return void 0;
  746. }
  747. };
  748. exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
  749. switch (errorCorrectionLevel) {
  750. case ECLevel.L:
  751. return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
  752. case ECLevel.M:
  753. return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
  754. case ECLevel.Q:
  755. return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
  756. case ECLevel.H:
  757. return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
  758. default:
  759. return void 0;
  760. }
  761. };
  762. }
  763. });
  764. // node_modules/qrcode/lib/core/galois-field.js
  765. var require_galois_field = __commonJS({
  766. "node_modules/qrcode/lib/core/galois-field.js"(exports) {
  767. init_define_APP_INFO();
  768. var EXP_TABLE = new Uint8Array(512);
  769. var LOG_TABLE = new Uint8Array(256);
  770. (function initTables() {
  771. let x = 1;
  772. for (let i = 0; i < 255; i++) {
  773. EXP_TABLE[i] = x;
  774. LOG_TABLE[x] = i;
  775. x <<= 1;
  776. if (x & 256) {
  777. x ^= 285;
  778. }
  779. }
  780. for (let i = 255; i < 512; i++) {
  781. EXP_TABLE[i] = EXP_TABLE[i - 255];
  782. }
  783. })();
  784. exports.log = function log(n) {
  785. if (n < 1)
  786. throw new Error("log(" + n + ")");
  787. return LOG_TABLE[n];
  788. };
  789. exports.exp = function exp(n) {
  790. return EXP_TABLE[n];
  791. };
  792. exports.mul = function mul(x, y) {
  793. if (x === 0 || y === 0)
  794. return 0;
  795. return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];
  796. };
  797. }
  798. });
  799. // node_modules/qrcode/lib/core/polynomial.js
  800. var require_polynomial = __commonJS({
  801. "node_modules/qrcode/lib/core/polynomial.js"(exports) {
  802. init_define_APP_INFO();
  803. var GF = require_galois_field();
  804. exports.mul = function mul(p1, p2) {
  805. const coeff = new Uint8Array(p1.length + p2.length - 1);
  806. for (let i = 0; i < p1.length; i++) {
  807. for (let j = 0; j < p2.length; j++) {
  808. coeff[i + j] ^= GF.mul(p1[i], p2[j]);
  809. }
  810. }
  811. return coeff;
  812. };
  813. exports.mod = function mod(divident, divisor) {
  814. let result = new Uint8Array(divident);
  815. while (result.length - divisor.length >= 0) {
  816. const coeff = result[0];
  817. for (let i = 0; i < divisor.length; i++) {
  818. result[i] ^= GF.mul(divisor[i], coeff);
  819. }
  820. let offset = 0;
  821. while (offset < result.length && result[offset] === 0)
  822. offset++;
  823. result = result.slice(offset);
  824. }
  825. return result;
  826. };
  827. exports.generateECPolynomial = function generateECPolynomial(degree) {
  828. let poly = new Uint8Array([1]);
  829. for (let i = 0; i < degree; i++) {
  830. poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));
  831. }
  832. return poly;
  833. };
  834. }
  835. });
  836. // node_modules/qrcode/lib/core/reed-solomon-encoder.js
  837. var require_reed_solomon_encoder = __commonJS({
  838. "node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module) {
  839. init_define_APP_INFO();
  840. var Polynomial = require_polynomial();
  841. function ReedSolomonEncoder(degree) {
  842. this.genPoly = void 0;
  843. this.degree = degree;
  844. if (this.degree)
  845. this.initialize(this.degree);
  846. }
  847. ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
  848. this.degree = degree;
  849. this.genPoly = Polynomial.generateECPolynomial(this.degree);
  850. };
  851. ReedSolomonEncoder.prototype.encode = function encode(data) {
  852. if (!this.genPoly) {
  853. throw new Error("Encoder not initialized");
  854. }
  855. const paddedData = new Uint8Array(data.length + this.degree);
  856. paddedData.set(data);
  857. const remainder = Polynomial.mod(paddedData, this.genPoly);
  858. const start = this.degree - remainder.length;
  859. if (start > 0) {
  860. const buff = new Uint8Array(this.degree);
  861. buff.set(remainder, start);
  862. return buff;
  863. }
  864. return remainder;
  865. };
  866. module.exports = ReedSolomonEncoder;
  867. }
  868. });
  869. // node_modules/qrcode/lib/core/version-check.js
  870. var require_version_check = __commonJS({
  871. "node_modules/qrcode/lib/core/version-check.js"(exports) {
  872. init_define_APP_INFO();
  873. exports.isValid = function isValid(version) {
  874. return !isNaN(version) && version >= 1 && version <= 40;
  875. };
  876. }
  877. });
  878. // node_modules/qrcode/lib/core/regex.js
  879. var require_regex = __commonJS({
  880. "node_modules/qrcode/lib/core/regex.js"(exports) {
  881. init_define_APP_INFO();
  882. var numeric = "[0-9]+";
  883. var alphanumeric = "[A-Z $%*+\\-./:]+";
  884. var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
  885. kanji = kanji.replace(/u/g, "\\u");
  886. var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
  887. exports.KANJI = new RegExp(kanji, "g");
  888. exports.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
  889. exports.BYTE = new RegExp(byte, "g");
  890. exports.NUMERIC = new RegExp(numeric, "g");
  891. exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");
  892. var TEST_KANJI = new RegExp("^" + kanji + "$");
  893. var TEST_NUMERIC = new RegExp("^" + numeric + "$");
  894. var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
  895. exports.testKanji = function testKanji(str) {
  896. return TEST_KANJI.test(str);
  897. };
  898. exports.testNumeric = function testNumeric(str) {
  899. return TEST_NUMERIC.test(str);
  900. };
  901. exports.testAlphanumeric = function testAlphanumeric(str) {
  902. return TEST_ALPHANUMERIC.test(str);
  903. };
  904. }
  905. });
  906. // node_modules/qrcode/lib/core/mode.js
  907. var require_mode = __commonJS({
  908. "node_modules/qrcode/lib/core/mode.js"(exports) {
  909. init_define_APP_INFO();
  910. var VersionCheck = require_version_check();
  911. var Regex = require_regex();
  912. exports.NUMERIC = {
  913. id: "Numeric",
  914. bit: 1 << 0,
  915. ccBits: [10, 12, 14]
  916. };
  917. exports.ALPHANUMERIC = {
  918. id: "Alphanumeric",
  919. bit: 1 << 1,
  920. ccBits: [9, 11, 13]
  921. };
  922. exports.BYTE = {
  923. id: "Byte",
  924. bit: 1 << 2,
  925. ccBits: [8, 16, 16]
  926. };
  927. exports.KANJI = {
  928. id: "Kanji",
  929. bit: 1 << 3,
  930. ccBits: [8, 10, 12]
  931. };
  932. exports.MIXED = {
  933. bit: -1
  934. };
  935. exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {
  936. if (!mode.ccBits)
  937. throw new Error("Invalid mode: " + mode);
  938. if (!VersionCheck.isValid(version)) {
  939. throw new Error("Invalid version: " + version);
  940. }
  941. if (version >= 1 && version < 10)
  942. return mode.ccBits[0];
  943. else if (version < 27)
  944. return mode.ccBits[1];
  945. return mode.ccBits[2];
  946. };
  947. exports.getBestModeForData = function getBestModeForData(dataStr) {
  948. if (Regex.testNumeric(dataStr))
  949. return exports.NUMERIC;
  950. else if (Regex.testAlphanumeric(dataStr))
  951. return exports.ALPHANUMERIC;
  952. else if (Regex.testKanji(dataStr))
  953. return exports.KANJI;
  954. else
  955. return exports.BYTE;
  956. };
  957. exports.toString = function toString(mode) {
  958. if (mode && mode.id)
  959. return mode.id;
  960. throw new Error("Invalid mode");
  961. };
  962. exports.isValid = function isValid(mode) {
  963. return mode && mode.bit && mode.ccBits;
  964. };
  965. function fromString(string) {
  966. if (typeof string !== "string") {
  967. throw new Error("Param is not a string");
  968. }
  969. const lcStr = string.toLowerCase();
  970. switch (lcStr) {
  971. case "numeric":
  972. return exports.NUMERIC;
  973. case "alphanumeric":
  974. return exports.ALPHANUMERIC;
  975. case "kanji":
  976. return exports.KANJI;
  977. case "byte":
  978. return exports.BYTE;
  979. default:
  980. throw new Error("Unknown mode: " + string);
  981. }
  982. }
  983. exports.from = function from(value, defaultValue) {
  984. if (exports.isValid(value)) {
  985. return value;
  986. }
  987. try {
  988. return fromString(value);
  989. } catch (e) {
  990. return defaultValue;
  991. }
  992. };
  993. }
  994. });
  995. // node_modules/qrcode/lib/core/version.js
  996. var require_version = __commonJS({
  997. "node_modules/qrcode/lib/core/version.js"(exports) {
  998. init_define_APP_INFO();
  999. var Utils = require_utils();
  1000. var ECCode = require_error_correction_code();
  1001. var ECLevel = require_error_correction_level();
  1002. var Mode = require_mode();
  1003. var VersionCheck = require_version_check();
  1004. var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
  1005. var G18_BCH = Utils.getBCHDigit(G18);
  1006. function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {
  1007. for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
  1008. if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
  1009. return currentVersion;
  1010. }
  1011. }
  1012. return void 0;
  1013. }
  1014. function getReservedBitsCount(mode, version) {
  1015. return Mode.getCharCountIndicator(mode, version) + 4;
  1016. }
  1017. function getTotalBitsFromDataArray(segments, version) {
  1018. let totalBits = 0;
  1019. segments.forEach(function(data) {
  1020. const reservedBits = getReservedBitsCount(data.mode, version);
  1021. totalBits += reservedBits + data.getBitsLength();
  1022. });
  1023. return totalBits;
  1024. }
  1025. function getBestVersionForMixedData(segments, errorCorrectionLevel) {
  1026. for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
  1027. const length = getTotalBitsFromDataArray(segments, currentVersion);
  1028. if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
  1029. return currentVersion;
  1030. }
  1031. }
  1032. return void 0;
  1033. }
  1034. exports.from = function from(value, defaultValue) {
  1035. if (VersionCheck.isValid(value)) {
  1036. return parseInt(value, 10);
  1037. }
  1038. return defaultValue;
  1039. };
  1040. exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
  1041. if (!VersionCheck.isValid(version)) {
  1042. throw new Error("Invalid QR Code version");
  1043. }
  1044. if (typeof mode === "undefined")
  1045. mode = Mode.BYTE;
  1046. const totalCodewords = Utils.getSymbolTotalCodewords(version);
  1047. const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
  1048. const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
  1049. if (mode === Mode.MIXED)
  1050. return dataTotalCodewordsBits;
  1051. const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
  1052. switch (mode) {
  1053. case Mode.NUMERIC:
  1054. return Math.floor(usableBits / 10 * 3);
  1055. case Mode.ALPHANUMERIC:
  1056. return Math.floor(usableBits / 11 * 2);
  1057. case Mode.KANJI:
  1058. return Math.floor(usableBits / 13);
  1059. case Mode.BYTE:
  1060. default:
  1061. return Math.floor(usableBits / 8);
  1062. }
  1063. };
  1064. exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {
  1065. let seg;
  1066. const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
  1067. if (Array.isArray(data)) {
  1068. if (data.length > 1) {
  1069. return getBestVersionForMixedData(data, ecl);
  1070. }
  1071. if (data.length === 0) {
  1072. return 1;
  1073. }
  1074. seg = data[0];
  1075. } else {
  1076. seg = data;
  1077. }
  1078. return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);
  1079. };
  1080. exports.getEncodedBits = function getEncodedBits(version) {
  1081. if (!VersionCheck.isValid(version) || version < 7) {
  1082. throw new Error("Invalid QR Code version");
  1083. }
  1084. let d = version << 12;
  1085. while (Utils.getBCHDigit(d) - G18_BCH >= 0) {
  1086. d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;
  1087. }
  1088. return version << 12 | d;
  1089. };
  1090. }
  1091. });
  1092. // node_modules/qrcode/lib/core/format-info.js
  1093. var require_format_info = __commonJS({
  1094. "node_modules/qrcode/lib/core/format-info.js"(exports) {
  1095. init_define_APP_INFO();
  1096. var Utils = require_utils();
  1097. var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
  1098. var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
  1099. var G15_BCH = Utils.getBCHDigit(G15);
  1100. exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
  1101. const data = errorCorrectionLevel.bit << 3 | mask;
  1102. let d = data << 10;
  1103. while (Utils.getBCHDigit(d) - G15_BCH >= 0) {
  1104. d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;
  1105. }
  1106. return (data << 10 | d) ^ G15_MASK;
  1107. };
  1108. }
  1109. });
  1110. // node_modules/qrcode/lib/core/numeric-data.js
  1111. var require_numeric_data = __commonJS({
  1112. "node_modules/qrcode/lib/core/numeric-data.js"(exports, module) {
  1113. init_define_APP_INFO();
  1114. var Mode = require_mode();
  1115. function NumericData(data) {
  1116. this.mode = Mode.NUMERIC;
  1117. this.data = data.toString();
  1118. }
  1119. NumericData.getBitsLength = function getBitsLength(length) {
  1120. return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);
  1121. };
  1122. NumericData.prototype.getLength = function getLength() {
  1123. return this.data.length;
  1124. };
  1125. NumericData.prototype.getBitsLength = function getBitsLength() {
  1126. return NumericData.getBitsLength(this.data.length);
  1127. };
  1128. NumericData.prototype.write = function write(bitBuffer) {
  1129. let i, group, value;
  1130. for (i = 0; i + 3 <= this.data.length; i += 3) {
  1131. group = this.data.substr(i, 3);
  1132. value = parseInt(group, 10);
  1133. bitBuffer.put(value, 10);
  1134. }
  1135. const remainingNum = this.data.length - i;
  1136. if (remainingNum > 0) {
  1137. group = this.data.substr(i);
  1138. value = parseInt(group, 10);
  1139. bitBuffer.put(value, remainingNum * 3 + 1);
  1140. }
  1141. };
  1142. module.exports = NumericData;
  1143. }
  1144. });
  1145. // node_modules/qrcode/lib/core/alphanumeric-data.js
  1146. var require_alphanumeric_data = __commonJS({
  1147. "node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module) {
  1148. init_define_APP_INFO();
  1149. var Mode = require_mode();
  1150. var ALPHA_NUM_CHARS = [
  1151. "0",
  1152. "1",
  1153. "2",
  1154. "3",
  1155. "4",
  1156. "5",
  1157. "6",
  1158. "7",
  1159. "8",
  1160. "9",
  1161. "A",
  1162. "B",
  1163. "C",
  1164. "D",
  1165. "E",
  1166. "F",
  1167. "G",
  1168. "H",
  1169. "I",
  1170. "J",
  1171. "K",
  1172. "L",
  1173. "M",
  1174. "N",
  1175. "O",
  1176. "P",
  1177. "Q",
  1178. "R",
  1179. "S",
  1180. "T",
  1181. "U",
  1182. "V",
  1183. "W",
  1184. "X",
  1185. "Y",
  1186. "Z",
  1187. " ",
  1188. "$",
  1189. "%",
  1190. "*",
  1191. "+",
  1192. "-",
  1193. ".",
  1194. "/",
  1195. ":"
  1196. ];
  1197. function AlphanumericData(data) {
  1198. this.mode = Mode.ALPHANUMERIC;
  1199. this.data = data;
  1200. }
  1201. AlphanumericData.getBitsLength = function getBitsLength(length) {
  1202. return 11 * Math.floor(length / 2) + 6 * (length % 2);
  1203. };
  1204. AlphanumericData.prototype.getLength = function getLength() {
  1205. return this.data.length;
  1206. };
  1207. AlphanumericData.prototype.getBitsLength = function getBitsLength() {
  1208. return AlphanumericData.getBitsLength(this.data.length);
  1209. };
  1210. AlphanumericData.prototype.write = function write(bitBuffer) {
  1211. let i;
  1212. for (i = 0; i + 2 <= this.data.length; i += 2) {
  1213. let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
  1214. value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
  1215. bitBuffer.put(value, 11);
  1216. }
  1217. if (this.data.length % 2) {
  1218. bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
  1219. }
  1220. };
  1221. module.exports = AlphanumericData;
  1222. }
  1223. });
  1224. // node_modules/encode-utf8/index.js
  1225. var require_encode_utf8 = __commonJS({
  1226. "node_modules/encode-utf8/index.js"(exports, module) {
  1227. "use strict";
  1228. init_define_APP_INFO();
  1229. module.exports = function encodeUtf8(input) {
  1230. var result = [];
  1231. var size = input.length;
  1232. for (var index = 0; index < size; index++) {
  1233. var point = input.charCodeAt(index);
  1234. if (point >= 55296 && point <= 56319 && size > index + 1) {
  1235. var second = input.charCodeAt(index + 1);
  1236. if (second >= 56320 && second <= 57343) {
  1237. point = (point - 55296) * 1024 + second - 56320 + 65536;
  1238. index += 1;
  1239. }
  1240. }
  1241. if (point < 128) {
  1242. result.push(point);
  1243. continue;
  1244. }
  1245. if (point < 2048) {
  1246. result.push(point >> 6 | 192);
  1247. result.push(point & 63 | 128);
  1248. continue;
  1249. }
  1250. if (point < 55296 || point >= 57344 && point < 65536) {
  1251. result.push(point >> 12 | 224);
  1252. result.push(point >> 6 & 63 | 128);
  1253. result.push(point & 63 | 128);
  1254. continue;
  1255. }
  1256. if (point >= 65536 && point <= 1114111) {
  1257. result.push(point >> 18 | 240);
  1258. result.push(point >> 12 & 63 | 128);
  1259. result.push(point >> 6 & 63 | 128);
  1260. result.push(point & 63 | 128);
  1261. continue;
  1262. }
  1263. result.push(239, 191, 189);
  1264. }
  1265. return new Uint8Array(result).buffer;
  1266. };
  1267. }
  1268. });
  1269. // node_modules/qrcode/lib/core/byte-data.js
  1270. var require_byte_data = __commonJS({
  1271. "node_modules/qrcode/lib/core/byte-data.js"(exports, module) {
  1272. init_define_APP_INFO();
  1273. var encodeUtf8 = require_encode_utf8();
  1274. var Mode = require_mode();
  1275. function ByteData(data) {
  1276. this.mode = Mode.BYTE;
  1277. if (typeof data === "string") {
  1278. data = encodeUtf8(data);
  1279. }
  1280. this.data = new Uint8Array(data);
  1281. }
  1282. ByteData.getBitsLength = function getBitsLength(length) {
  1283. return length * 8;
  1284. };
  1285. ByteData.prototype.getLength = function getLength() {
  1286. return this.data.length;
  1287. };
  1288. ByteData.prototype.getBitsLength = function getBitsLength() {
  1289. return ByteData.getBitsLength(this.data.length);
  1290. };
  1291. ByteData.prototype.write = function(bitBuffer) {
  1292. for (let i = 0, l = this.data.length; i < l; i++) {
  1293. bitBuffer.put(this.data[i], 8);
  1294. }
  1295. };
  1296. module.exports = ByteData;
  1297. }
  1298. });
  1299. // node_modules/qrcode/lib/core/kanji-data.js
  1300. var require_kanji_data = __commonJS({
  1301. "node_modules/qrcode/lib/core/kanji-data.js"(exports, module) {
  1302. init_define_APP_INFO();
  1303. var Mode = require_mode();
  1304. var Utils = require_utils();
  1305. function KanjiData(data) {
  1306. this.mode = Mode.KANJI;
  1307. this.data = data;
  1308. }
  1309. KanjiData.getBitsLength = function getBitsLength(length) {
  1310. return length * 13;
  1311. };
  1312. KanjiData.prototype.getLength = function getLength() {
  1313. return this.data.length;
  1314. };
  1315. KanjiData.prototype.getBitsLength = function getBitsLength() {
  1316. return KanjiData.getBitsLength(this.data.length);
  1317. };
  1318. KanjiData.prototype.write = function(bitBuffer) {
  1319. let i;
  1320. for (i = 0; i < this.data.length; i++) {
  1321. let value = Utils.toSJIS(this.data[i]);
  1322. if (value >= 33088 && value <= 40956) {
  1323. value -= 33088;
  1324. } else if (value >= 57408 && value <= 60351) {
  1325. value -= 49472;
  1326. } else {
  1327. throw new Error(
  1328. "Invalid SJIS character: " + this.data[i] + "\nMake sure your charset is UTF-8"
  1329. );
  1330. }
  1331. value = (value >>> 8 & 255) * 192 + (value & 255);
  1332. bitBuffer.put(value, 13);
  1333. }
  1334. };
  1335. module.exports = KanjiData;
  1336. }
  1337. });
  1338. // node_modules/dijkstrajs/dijkstra.js
  1339. var require_dijkstra = __commonJS({
  1340. "node_modules/dijkstrajs/dijkstra.js"(exports, module) {
  1341. "use strict";
  1342. init_define_APP_INFO();
  1343. var dijkstra = {
  1344. single_source_shortest_paths: function(graph, s, d) {
  1345. var predecessors = {};
  1346. var costs = {};
  1347. costs[s] = 0;
  1348. var open = dijkstra.PriorityQueue.make();
  1349. open.push(s, 0);
  1350. 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;
  1351. while (!open.empty()) {
  1352. closest = open.pop();
  1353. u = closest.value;
  1354. cost_of_s_to_u = closest.cost;
  1355. adjacent_nodes = graph[u] || {};
  1356. for (v in adjacent_nodes) {
  1357. if (adjacent_nodes.hasOwnProperty(v)) {
  1358. cost_of_e = adjacent_nodes[v];
  1359. cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
  1360. cost_of_s_to_v = costs[v];
  1361. first_visit = typeof costs[v] === "undefined";
  1362. if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
  1363. costs[v] = cost_of_s_to_u_plus_cost_of_e;
  1364. open.push(v, cost_of_s_to_u_plus_cost_of_e);
  1365. predecessors[v] = u;
  1366. }
  1367. }
  1368. }
  1369. }
  1370. if (typeof d !== "undefined" && typeof costs[d] === "undefined") {
  1371. var msg = ["Could not find a path from ", s, " to ", d, "."].join("");
  1372. throw new Error(msg);
  1373. }
  1374. return predecessors;
  1375. },
  1376. extract_shortest_path_from_predecessor_list: function(predecessors, d) {
  1377. var nodes = [];
  1378. var u = d;
  1379. var predecessor;
  1380. while (u) {
  1381. nodes.push(u);
  1382. predecessor = predecessors[u];
  1383. u = predecessors[u];
  1384. }
  1385. nodes.reverse();
  1386. return nodes;
  1387. },
  1388. find_path: function(graph, s, d) {
  1389. var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
  1390. return dijkstra.extract_shortest_path_from_predecessor_list(
  1391. predecessors,
  1392. d
  1393. );
  1394. },
  1395. PriorityQueue: {
  1396. make: function(opts) {
  1397. var T = dijkstra.PriorityQueue, t = {}, key;
  1398. opts = opts || {};
  1399. for (key in T) {
  1400. if (T.hasOwnProperty(key)) {
  1401. t[key] = T[key];
  1402. }
  1403. }
  1404. t.queue = [];
  1405. t.sorter = opts.sorter || T.default_sorter;
  1406. return t;
  1407. },
  1408. default_sorter: function(a, b) {
  1409. return a.cost - b.cost;
  1410. },
  1411. push: function(value, cost) {
  1412. var item = { value, cost };
  1413. this.queue.push(item);
  1414. this.queue.sort(this.sorter);
  1415. },
  1416. pop: function() {
  1417. return this.queue.shift();
  1418. },
  1419. empty: function() {
  1420. return this.queue.length === 0;
  1421. }
  1422. }
  1423. };
  1424. if (typeof module !== "undefined") {
  1425. module.exports = dijkstra;
  1426. }
  1427. }
  1428. });
  1429. // node_modules/qrcode/lib/core/segments.js
  1430. var require_segments = __commonJS({
  1431. "node_modules/qrcode/lib/core/segments.js"(exports) {
  1432. init_define_APP_INFO();
  1433. var Mode = require_mode();
  1434. var NumericData = require_numeric_data();
  1435. var AlphanumericData = require_alphanumeric_data();
  1436. var ByteData = require_byte_data();
  1437. var KanjiData = require_kanji_data();
  1438. var Regex = require_regex();
  1439. var Utils = require_utils();
  1440. var dijkstra = require_dijkstra();
  1441. function getStringByteLength(str) {
  1442. return unescape(encodeURIComponent(str)).length;
  1443. }
  1444. function getSegments(regex, mode, str) {
  1445. const segments = [];
  1446. let result;
  1447. while ((result = regex.exec(str)) !== null) {
  1448. segments.push({
  1449. data: result[0],
  1450. index: result.index,
  1451. mode,
  1452. length: result[0].length
  1453. });
  1454. }
  1455. return segments;
  1456. }
  1457. function getSegmentsFromString(dataStr) {
  1458. const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
  1459. const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
  1460. let byteSegs;
  1461. let kanjiSegs;
  1462. if (Utils.isKanjiModeEnabled()) {
  1463. byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
  1464. kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
  1465. } else {
  1466. byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
  1467. kanjiSegs = [];
  1468. }
  1469. const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
  1470. return segs.sort(function(s1, s2) {
  1471. return s1.index - s2.index;
  1472. }).map(function(obj) {
  1473. return {
  1474. data: obj.data,
  1475. mode: obj.mode,
  1476. length: obj.length
  1477. };
  1478. });
  1479. }
  1480. function getSegmentBitsLength(length, mode) {
  1481. switch (mode) {
  1482. case Mode.NUMERIC:
  1483. return NumericData.getBitsLength(length);
  1484. case Mode.ALPHANUMERIC:
  1485. return AlphanumericData.getBitsLength(length);
  1486. case Mode.KANJI:
  1487. return KanjiData.getBitsLength(length);
  1488. case Mode.BYTE:
  1489. return ByteData.getBitsLength(length);
  1490. }
  1491. }
  1492. function mergeSegments(segs) {
  1493. return segs.reduce(function(acc, curr) {
  1494. const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
  1495. if (prevSeg && prevSeg.mode === curr.mode) {
  1496. acc[acc.length - 1].data += curr.data;
  1497. return acc;
  1498. }
  1499. acc.push(curr);
  1500. return acc;
  1501. }, []);
  1502. }
  1503. function buildNodes(segs) {
  1504. const nodes = [];
  1505. for (let i = 0; i < segs.length; i++) {
  1506. const seg = segs[i];
  1507. switch (seg.mode) {
  1508. case Mode.NUMERIC:
  1509. nodes.push([
  1510. seg,
  1511. { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
  1512. { data: seg.data, mode: Mode.BYTE, length: seg.length }
  1513. ]);
  1514. break;
  1515. case Mode.ALPHANUMERIC:
  1516. nodes.push([
  1517. seg,
  1518. { data: seg.data, mode: Mode.BYTE, length: seg.length }
  1519. ]);
  1520. break;
  1521. case Mode.KANJI:
  1522. nodes.push([
  1523. seg,
  1524. { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
  1525. ]);
  1526. break;
  1527. case Mode.BYTE:
  1528. nodes.push([
  1529. { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
  1530. ]);
  1531. }
  1532. }
  1533. return nodes;
  1534. }
  1535. function buildGraph(nodes, version) {
  1536. const table = {};
  1537. const graph = { start: {} };
  1538. let prevNodeIds = ["start"];
  1539. for (let i = 0; i < nodes.length; i++) {
  1540. const nodeGroup = nodes[i];
  1541. const currentNodeIds = [];
  1542. for (let j = 0; j < nodeGroup.length; j++) {
  1543. const node = nodeGroup[j];
  1544. const key = "" + i + j;
  1545. currentNodeIds.push(key);
  1546. table[key] = { node, lastCount: 0 };
  1547. graph[key] = {};
  1548. for (let n = 0; n < prevNodeIds.length; n++) {
  1549. const prevNodeId = prevNodeIds[n];
  1550. if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
  1551. graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
  1552. table[prevNodeId].lastCount += node.length;
  1553. } else {
  1554. if (table[prevNodeId])
  1555. table[prevNodeId].lastCount = node.length;
  1556. graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
  1557. }
  1558. }
  1559. }
  1560. prevNodeIds = currentNodeIds;
  1561. }
  1562. for (let n = 0; n < prevNodeIds.length; n++) {
  1563. graph[prevNodeIds[n]].end = 0;
  1564. }
  1565. return { map: graph, table };
  1566. }
  1567. function buildSingleSegment(data, modesHint) {
  1568. let mode;
  1569. const bestMode = Mode.getBestModeForData(data);
  1570. mode = Mode.from(modesHint, bestMode);
  1571. if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
  1572. throw new Error('"' + data + '" cannot be encoded with mode ' + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
  1573. }
  1574. if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
  1575. mode = Mode.BYTE;
  1576. }
  1577. switch (mode) {
  1578. case Mode.NUMERIC:
  1579. return new NumericData(data);
  1580. case Mode.ALPHANUMERIC:
  1581. return new AlphanumericData(data);
  1582. case Mode.KANJI:
  1583. return new KanjiData(data);
  1584. case Mode.BYTE:
  1585. return new ByteData(data);
  1586. }
  1587. }
  1588. exports.fromArray = function fromArray(array) {
  1589. return array.reduce(function(acc, seg) {
  1590. if (typeof seg === "string") {
  1591. acc.push(buildSingleSegment(seg, null));
  1592. } else if (seg.data) {
  1593. acc.push(buildSingleSegment(seg.data, seg.mode));
  1594. }
  1595. return acc;
  1596. }, []);
  1597. };
  1598. exports.fromString = function fromString(data, version) {
  1599. const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
  1600. const nodes = buildNodes(segs);
  1601. const graph = buildGraph(nodes, version);
  1602. const path = dijkstra.find_path(graph.map, "start", "end");
  1603. const optimizedSegs = [];
  1604. for (let i = 1; i < path.length - 1; i++) {
  1605. optimizedSegs.push(graph.table[path[i]].node);
  1606. }
  1607. return exports.fromArray(mergeSegments(optimizedSegs));
  1608. };
  1609. exports.rawSplit = function rawSplit(data) {
  1610. return exports.fromArray(
  1611. getSegmentsFromString(data, Utils.isKanjiModeEnabled())
  1612. );
  1613. };
  1614. }
  1615. });
  1616. // node_modules/qrcode/lib/core/qrcode.js
  1617. var require_qrcode = __commonJS({
  1618. "node_modules/qrcode/lib/core/qrcode.js"(exports) {
  1619. init_define_APP_INFO();
  1620. var Utils = require_utils();
  1621. var ECLevel = require_error_correction_level();
  1622. var BitBuffer = require_bit_buffer();
  1623. var BitMatrix = require_bit_matrix();
  1624. var AlignmentPattern = require_alignment_pattern();
  1625. var FinderPattern = require_finder_pattern();
  1626. var MaskPattern = require_mask_pattern();
  1627. var ECCode = require_error_correction_code();
  1628. var ReedSolomonEncoder = require_reed_solomon_encoder();
  1629. var Version = require_version();
  1630. var FormatInfo = require_format_info();
  1631. var Mode = require_mode();
  1632. var Segments = require_segments();
  1633. function setupFinderPattern(matrix, version) {
  1634. const size = matrix.size;
  1635. const pos = FinderPattern.getPositions(version);
  1636. for (let i = 0; i < pos.length; i++) {
  1637. const row = pos[i][0];
  1638. const col = pos[i][1];
  1639. for (let r = -1; r <= 7; r++) {
  1640. if (row + r <= -1 || size <= row + r)
  1641. continue;
  1642. for (let c = -1; c <= 7; c++) {
  1643. if (col + c <= -1 || size <= col + c)
  1644. continue;
  1645. 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) {
  1646. matrix.set(row + r, col + c, true, true);
  1647. } else {
  1648. matrix.set(row + r, col + c, false, true);
  1649. }
  1650. }
  1651. }
  1652. }
  1653. }
  1654. function setupTimingPattern(matrix) {
  1655. const size = matrix.size;
  1656. for (let r = 8; r < size - 8; r++) {
  1657. const value = r % 2 === 0;
  1658. matrix.set(r, 6, value, true);
  1659. matrix.set(6, r, value, true);
  1660. }
  1661. }
  1662. function setupAlignmentPattern(matrix, version) {
  1663. const pos = AlignmentPattern.getPositions(version);
  1664. for (let i = 0; i < pos.length; i++) {
  1665. const row = pos[i][0];
  1666. const col = pos[i][1];
  1667. for (let r = -2; r <= 2; r++) {
  1668. for (let c = -2; c <= 2; c++) {
  1669. if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {
  1670. matrix.set(row + r, col + c, true, true);
  1671. } else {
  1672. matrix.set(row + r, col + c, false, true);
  1673. }
  1674. }
  1675. }
  1676. }
  1677. }
  1678. function setupVersionInfo(matrix, version) {
  1679. const size = matrix.size;
  1680. const bits = Version.getEncodedBits(version);
  1681. let row, col, mod;
  1682. for (let i = 0; i < 18; i++) {
  1683. row = Math.floor(i / 3);
  1684. col = i % 3 + size - 8 - 3;
  1685. mod = (bits >> i & 1) === 1;
  1686. matrix.set(row, col, mod, true);
  1687. matrix.set(col, row, mod, true);
  1688. }
  1689. }
  1690. function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
  1691. const size = matrix.size;
  1692. const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
  1693. let i, mod;
  1694. for (i = 0; i < 15; i++) {
  1695. mod = (bits >> i & 1) === 1;
  1696. if (i < 6) {
  1697. matrix.set(i, 8, mod, true);
  1698. } else if (i < 8) {
  1699. matrix.set(i + 1, 8, mod, true);
  1700. } else {
  1701. matrix.set(size - 15 + i, 8, mod, true);
  1702. }
  1703. if (i < 8) {
  1704. matrix.set(8, size - i - 1, mod, true);
  1705. } else if (i < 9) {
  1706. matrix.set(8, 15 - i - 1 + 1, mod, true);
  1707. } else {
  1708. matrix.set(8, 15 - i - 1, mod, true);
  1709. }
  1710. }
  1711. matrix.set(size - 8, 8, 1, true);
  1712. }
  1713. function setupData(matrix, data) {
  1714. const size = matrix.size;
  1715. let inc = -1;
  1716. let row = size - 1;
  1717. let bitIndex = 7;
  1718. let byteIndex = 0;
  1719. for (let col = size - 1; col > 0; col -= 2) {
  1720. if (col === 6)
  1721. col--;
  1722. while (true) {
  1723. for (let c = 0; c < 2; c++) {
  1724. if (!matrix.isReserved(row, col - c)) {
  1725. let dark = false;
  1726. if (byteIndex < data.length) {
  1727. dark = (data[byteIndex] >>> bitIndex & 1) === 1;
  1728. }
  1729. matrix.set(row, col - c, dark);
  1730. bitIndex--;
  1731. if (bitIndex === -1) {
  1732. byteIndex++;
  1733. bitIndex = 7;
  1734. }
  1735. }
  1736. }
  1737. row += inc;
  1738. if (row < 0 || size <= row) {
  1739. row -= inc;
  1740. inc = -inc;
  1741. break;
  1742. }
  1743. }
  1744. }
  1745. }
  1746. function createData(version, errorCorrectionLevel, segments) {
  1747. const buffer = new BitBuffer();
  1748. segments.forEach(function(data) {
  1749. buffer.put(data.mode.bit, 4);
  1750. buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
  1751. data.write(buffer);
  1752. });
  1753. const totalCodewords = Utils.getSymbolTotalCodewords(version);
  1754. const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
  1755. const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
  1756. if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
  1757. buffer.put(0, 4);
  1758. }
  1759. while (buffer.getLengthInBits() % 8 !== 0) {
  1760. buffer.putBit(0);
  1761. }
  1762. const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
  1763. for (let i = 0; i < remainingByte; i++) {
  1764. buffer.put(i % 2 ? 17 : 236, 8);
  1765. }
  1766. return createCodewords(buffer, version, errorCorrectionLevel);
  1767. }
  1768. function createCodewords(bitBuffer, version, errorCorrectionLevel) {
  1769. const totalCodewords = Utils.getSymbolTotalCodewords(version);
  1770. const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
  1771. const dataTotalCodewords = totalCodewords - ecTotalCodewords;
  1772. const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
  1773. const blocksInGroup2 = totalCodewords % ecTotalBlocks;
  1774. const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
  1775. const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
  1776. const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
  1777. const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
  1778. const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
  1779. const rs = new ReedSolomonEncoder(ecCount);
  1780. let offset = 0;
  1781. const dcData = new Array(ecTotalBlocks);
  1782. const ecData = new Array(ecTotalBlocks);
  1783. let maxDataSize = 0;
  1784. const buffer = new Uint8Array(bitBuffer.buffer);
  1785. for (let b = 0; b < ecTotalBlocks; b++) {
  1786. const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
  1787. dcData[b] = buffer.slice(offset, offset + dataSize);
  1788. ecData[b] = rs.encode(dcData[b]);
  1789. offset += dataSize;
  1790. maxDataSize = Math.max(maxDataSize, dataSize);
  1791. }
  1792. const data = new Uint8Array(totalCodewords);
  1793. let index = 0;
  1794. let i, r;
  1795. for (i = 0; i < maxDataSize; i++) {
  1796. for (r = 0; r < ecTotalBlocks; r++) {
  1797. if (i < dcData[r].length) {
  1798. data[index++] = dcData[r][i];
  1799. }
  1800. }
  1801. }
  1802. for (i = 0; i < ecCount; i++) {
  1803. for (r = 0; r < ecTotalBlocks; r++) {
  1804. data[index++] = ecData[r][i];
  1805. }
  1806. }
  1807. return data;
  1808. }
  1809. function createSymbol(data, version, errorCorrectionLevel, maskPattern) {
  1810. let segments;
  1811. if (Array.isArray(data)) {
  1812. segments = Segments.fromArray(data);
  1813. } else if (typeof data === "string") {
  1814. let estimatedVersion = version;
  1815. if (!estimatedVersion) {
  1816. const rawSegments = Segments.rawSplit(data);
  1817. estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
  1818. }
  1819. segments = Segments.fromString(data, estimatedVersion || 40);
  1820. } else {
  1821. throw new Error("Invalid data");
  1822. }
  1823. const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
  1824. if (!bestVersion) {
  1825. throw new Error("The amount of data is too big to be stored in a QR Code");
  1826. }
  1827. if (!version) {
  1828. version = bestVersion;
  1829. } else if (version < bestVersion) {
  1830. throw new Error(
  1831. "\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n"
  1832. );
  1833. }
  1834. const dataBits = createData(version, errorCorrectionLevel, segments);
  1835. const moduleCount = Utils.getSymbolSize(version);
  1836. const modules = new BitMatrix(moduleCount);
  1837. setupFinderPattern(modules, version);
  1838. setupTimingPattern(modules);
  1839. setupAlignmentPattern(modules, version);
  1840. setupFormatInfo(modules, errorCorrectionLevel, 0);
  1841. if (version >= 7) {
  1842. setupVersionInfo(modules, version);
  1843. }
  1844. setupData(modules, dataBits);
  1845. if (isNaN(maskPattern)) {
  1846. maskPattern = MaskPattern.getBestMask(
  1847. modules,
  1848. setupFormatInfo.bind(null, modules, errorCorrectionLevel)
  1849. );
  1850. }
  1851. MaskPattern.applyMask(maskPattern, modules);
  1852. setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
  1853. return {
  1854. modules,
  1855. version,
  1856. errorCorrectionLevel,
  1857. maskPattern,
  1858. segments
  1859. };
  1860. }
  1861. exports.create = function create(data, options) {
  1862. if (typeof data === "undefined" || data === "") {
  1863. throw new Error("No input text");
  1864. }
  1865. let errorCorrectionLevel = ECLevel.M;
  1866. let version;
  1867. let mask;
  1868. if (typeof options !== "undefined") {
  1869. errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
  1870. version = Version.from(options.version);
  1871. mask = MaskPattern.from(options.maskPattern);
  1872. if (options.toSJISFunc) {
  1873. Utils.setToSJISFunction(options.toSJISFunc);
  1874. }
  1875. }
  1876. return createSymbol(data, version, errorCorrectionLevel, mask);
  1877. };
  1878. }
  1879. });
  1880. // node_modules/qrcode/lib/renderer/utils.js
  1881. var require_utils2 = __commonJS({
  1882. "node_modules/qrcode/lib/renderer/utils.js"(exports) {
  1883. init_define_APP_INFO();
  1884. function hex2rgba(hex) {
  1885. if (typeof hex === "number") {
  1886. hex = hex.toString();
  1887. }
  1888. if (typeof hex !== "string") {
  1889. throw new Error("Color should be defined as hex string");
  1890. }
  1891. let hexCode = hex.slice().replace("#", "").split("");
  1892. if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
  1893. throw new Error("Invalid hex color: " + hex);
  1894. }
  1895. if (hexCode.length === 3 || hexCode.length === 4) {
  1896. hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {
  1897. return [c, c];
  1898. }));
  1899. }
  1900. if (hexCode.length === 6)
  1901. hexCode.push("F", "F");
  1902. const hexValue = parseInt(hexCode.join(""), 16);
  1903. return {
  1904. r: hexValue >> 24 & 255,
  1905. g: hexValue >> 16 & 255,
  1906. b: hexValue >> 8 & 255,
  1907. a: hexValue & 255,
  1908. hex: "#" + hexCode.slice(0, 6).join("")
  1909. };
  1910. }
  1911. exports.getOptions = function getOptions(options) {
  1912. if (!options)
  1913. options = {};
  1914. if (!options.color)
  1915. options.color = {};
  1916. const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;
  1917. const width = options.width && options.width >= 21 ? options.width : void 0;
  1918. const scale = options.scale || 4;
  1919. return {
  1920. width,
  1921. scale: width ? 4 : scale,
  1922. margin,
  1923. color: {
  1924. dark: hex2rgba(options.color.dark || "#000000ff"),
  1925. light: hex2rgba(options.color.light || "#ffffffff")
  1926. },
  1927. type: options.type,
  1928. rendererOpts: options.rendererOpts || {}
  1929. };
  1930. };
  1931. exports.getScale = function getScale(qrSize, opts) {
  1932. return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;
  1933. };
  1934. exports.getImageWidth = function getImageWidth(qrSize, opts) {
  1935. const scale = exports.getScale(qrSize, opts);
  1936. return Math.floor((qrSize + opts.margin * 2) * scale);
  1937. };
  1938. exports.qrToImageData = function qrToImageData(imgData, qr, opts) {
  1939. const size = qr.modules.size;
  1940. const data = qr.modules.data;
  1941. const scale = exports.getScale(size, opts);
  1942. const symbolSize = Math.floor((size + opts.margin * 2) * scale);
  1943. const scaledMargin = opts.margin * scale;
  1944. const palette = [opts.color.light, opts.color.dark];
  1945. for (let i = 0; i < symbolSize; i++) {
  1946. for (let j = 0; j < symbolSize; j++) {
  1947. let posDst = (i * symbolSize + j) * 4;
  1948. let pxColor = opts.color.light;
  1949. if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
  1950. const iSrc = Math.floor((i - scaledMargin) / scale);
  1951. const jSrc = Math.floor((j - scaledMargin) / scale);
  1952. pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
  1953. }
  1954. imgData[posDst++] = pxColor.r;
  1955. imgData[posDst++] = pxColor.g;
  1956. imgData[posDst++] = pxColor.b;
  1957. imgData[posDst] = pxColor.a;
  1958. }
  1959. }
  1960. };
  1961. }
  1962. });
  1963. // node_modules/qrcode/lib/renderer/canvas.js
  1964. var require_canvas = __commonJS({
  1965. "node_modules/qrcode/lib/renderer/canvas.js"(exports) {
  1966. init_define_APP_INFO();
  1967. var Utils = require_utils2();
  1968. function clearCanvas(ctx, canvas, size) {
  1969. ctx.clearRect(0, 0, canvas.width, canvas.height);
  1970. if (!canvas.style)
  1971. canvas.style = {};
  1972. canvas.height = size;
  1973. canvas.width = size;
  1974. canvas.style.height = size + "px";
  1975. canvas.style.width = size + "px";
  1976. }
  1977. function getCanvasElement() {
  1978. try {
  1979. return document.createElement("canvas");
  1980. } catch (e) {
  1981. throw new Error("You need to specify a canvas element");
  1982. }
  1983. }
  1984. exports.render = function render(qrData, canvas, options) {
  1985. let opts = options;
  1986. let canvasEl = canvas;
  1987. if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
  1988. opts = canvas;
  1989. canvas = void 0;
  1990. }
  1991. if (!canvas) {
  1992. canvasEl = getCanvasElement();
  1993. }
  1994. opts = Utils.getOptions(opts);
  1995. const size = Utils.getImageWidth(qrData.modules.size, opts);
  1996. const ctx = canvasEl.getContext("2d");
  1997. const image = ctx.createImageData(size, size);
  1998. Utils.qrToImageData(image.data, qrData, opts);
  1999. clearCanvas(ctx, canvasEl, size);
  2000. ctx.putImageData(image, 0, 0);
  2001. return canvasEl;
  2002. };
  2003. exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {
  2004. let opts = options;
  2005. if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
  2006. opts = canvas;
  2007. canvas = void 0;
  2008. }
  2009. if (!opts)
  2010. opts = {};
  2011. const canvasEl = exports.render(qrData, canvas, opts);
  2012. const type = opts.type || "image/png";
  2013. const rendererOpts = opts.rendererOpts || {};
  2014. return canvasEl.toDataURL(type, rendererOpts.quality);
  2015. };
  2016. }
  2017. });
  2018. // node_modules/qrcode/lib/renderer/svg-tag.js
  2019. var require_svg_tag = __commonJS({
  2020. "node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
  2021. init_define_APP_INFO();
  2022. var Utils = require_utils2();
  2023. function getColorAttrib(color, attrib) {
  2024. const alpha = color.a / 255;
  2025. const str = attrib + '="' + color.hex + '"';
  2026. return alpha < 1 ? str + " " + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str;
  2027. }
  2028. function svgCmd(cmd, x, y) {
  2029. let str = cmd + x;
  2030. if (typeof y !== "undefined")
  2031. str += " " + y;
  2032. return str;
  2033. }
  2034. function qrToPath(data, size, margin) {
  2035. let path = "";
  2036. let moveBy = 0;
  2037. let newRow = false;
  2038. let lineLength = 0;
  2039. for (let i = 0; i < data.length; i++) {
  2040. const col = Math.floor(i % size);
  2041. const row = Math.floor(i / size);
  2042. if (!col && !newRow)
  2043. newRow = true;
  2044. if (data[i]) {
  2045. lineLength++;
  2046. if (!(i > 0 && col > 0 && data[i - 1])) {
  2047. path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
  2048. moveBy = 0;
  2049. newRow = false;
  2050. }
  2051. if (!(col + 1 < size && data[i + 1])) {
  2052. path += svgCmd("h", lineLength);
  2053. lineLength = 0;
  2054. }
  2055. } else {
  2056. moveBy++;
  2057. }
  2058. }
  2059. return path;
  2060. }
  2061. exports.render = function render(qrData, options, cb) {
  2062. const opts = Utils.getOptions(options);
  2063. const size = qrData.modules.size;
  2064. const data = qrData.modules.data;
  2065. const qrcodesize = size + opts.margin * 2;
  2066. const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
  2067. const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
  2068. const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
  2069. const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
  2070. const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + "</svg>\n";
  2071. if (typeof cb === "function") {
  2072. cb(null, svgTag);
  2073. }
  2074. return svgTag;
  2075. };
  2076. }
  2077. });
  2078. // node_modules/qrcode/lib/browser.js
  2079. var require_browser = __commonJS({
  2080. "node_modules/qrcode/lib/browser.js"(exports) {
  2081. init_define_APP_INFO();
  2082. var canPromise = require_can_promise();
  2083. var QRCode = require_qrcode();
  2084. var CanvasRenderer = require_canvas();
  2085. var SvgRenderer = require_svg_tag();
  2086. function renderCanvas(renderFunc, canvas, text, opts, cb) {
  2087. const args = [].slice.call(arguments, 1);
  2088. const argsNum = args.length;
  2089. const isLastArgCb = typeof args[argsNum - 1] === "function";
  2090. if (!isLastArgCb && !canPromise()) {
  2091. throw new Error("Callback required as last argument");
  2092. }
  2093. if (isLastArgCb) {
  2094. if (argsNum < 2) {
  2095. throw new Error("Too few arguments provided");
  2096. }
  2097. if (argsNum === 2) {
  2098. cb = text;
  2099. text = canvas;
  2100. canvas = opts = void 0;
  2101. } else if (argsNum === 3) {
  2102. if (canvas.getContext && typeof cb === "undefined") {
  2103. cb = opts;
  2104. opts = void 0;
  2105. } else {
  2106. cb = opts;
  2107. opts = text;
  2108. text = canvas;
  2109. canvas = void 0;
  2110. }
  2111. }
  2112. } else {
  2113. if (argsNum < 1) {
  2114. throw new Error("Too few arguments provided");
  2115. }
  2116. if (argsNum === 1) {
  2117. text = canvas;
  2118. canvas = opts = void 0;
  2119. } else if (argsNum === 2 && !canvas.getContext) {
  2120. opts = text;
  2121. text = canvas;
  2122. canvas = void 0;
  2123. }
  2124. return new Promise(function(resolve, reject) {
  2125. try {
  2126. const data = QRCode.create(text, opts);
  2127. resolve(renderFunc(data, canvas, opts));
  2128. } catch (e) {
  2129. reject(e);
  2130. }
  2131. });
  2132. }
  2133. try {
  2134. const data = QRCode.create(text, opts);
  2135. cb(null, renderFunc(data, canvas, opts));
  2136. } catch (e) {
  2137. cb(e);
  2138. }
  2139. }
  2140. exports.create = QRCode.create;
  2141. exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
  2142. exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
  2143. exports.toString = renderCanvas.bind(null, function(data, _, opts) {
  2144. return SvgRenderer.render(data, opts);
  2145. });
  2146. }
  2147. });
  2148. // dep:qrcode
  2149. init_define_APP_INFO();
  2150. var qrcode_default = require_browser();
  2151. export {
  2152. qrcode_default as default
  2153. };
  2154. //# sourceMappingURL=qrcode.js.map