@wecom/wecom-openclaw-cli 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  3. package/dist/_virtual/alignment-pattern.js +6 -0
  4. package/dist/_virtual/alignment-pattern.js.map +1 -0
  5. package/dist/_virtual/bitmapper.js +6 -0
  6. package/dist/_virtual/bitmapper.js.map +1 -0
  7. package/dist/_virtual/browser.js +6 -0
  8. package/dist/_virtual/browser.js.map +1 -0
  9. package/dist/_virtual/canvas.js +6 -0
  10. package/dist/_virtual/canvas.js.map +1 -0
  11. package/dist/_virtual/chunkstream.js +6 -0
  12. package/dist/_virtual/chunkstream.js.map +1 -0
  13. package/dist/_virtual/crc.js +6 -0
  14. package/dist/_virtual/crc.js.map +1 -0
  15. package/dist/_virtual/dijkstra.js +6 -0
  16. package/dist/_virtual/dijkstra.js.map +1 -0
  17. package/dist/_virtual/error-correction-code.js +6 -0
  18. package/dist/_virtual/error-correction-code.js.map +1 -0
  19. package/dist/_virtual/error-correction-level.js +6 -0
  20. package/dist/_virtual/error-correction-level.js.map +1 -0
  21. package/dist/_virtual/filter-parse-async.js +6 -0
  22. package/dist/_virtual/filter-parse-async.js.map +1 -0
  23. package/dist/_virtual/filter-parse-sync.js +6 -0
  24. package/dist/_virtual/filter-parse-sync.js.map +1 -0
  25. package/dist/_virtual/filter-parse.js +6 -0
  26. package/dist/_virtual/filter-parse.js.map +1 -0
  27. package/dist/_virtual/finder-pattern.js +6 -0
  28. package/dist/_virtual/finder-pattern.js.map +1 -0
  29. package/dist/_virtual/format-info.js +6 -0
  30. package/dist/_virtual/format-info.js.map +1 -0
  31. package/dist/_virtual/galois-field.js +6 -0
  32. package/dist/_virtual/galois-field.js.map +1 -0
  33. package/dist/_virtual/index.js +10 -0
  34. package/dist/_virtual/index.js.map +1 -0
  35. package/dist/_virtual/interlace.js +6 -0
  36. package/dist/_virtual/interlace.js.map +1 -0
  37. package/dist/_virtual/mask-pattern.js +6 -0
  38. package/dist/_virtual/mask-pattern.js.map +1 -0
  39. package/dist/_virtual/mode.js +6 -0
  40. package/dist/_virtual/mode.js.map +1 -0
  41. package/dist/_virtual/packer-async.js +6 -0
  42. package/dist/_virtual/packer-async.js.map +1 -0
  43. package/dist/_virtual/packer.js +6 -0
  44. package/dist/_virtual/packer.js.map +1 -0
  45. package/dist/_virtual/parser-async.js +6 -0
  46. package/dist/_virtual/parser-async.js.map +1 -0
  47. package/dist/_virtual/parser.js +6 -0
  48. package/dist/_virtual/parser.js.map +1 -0
  49. package/dist/_virtual/png-sync.js +6 -0
  50. package/dist/_virtual/png-sync.js.map +1 -0
  51. package/dist/_virtual/png.js +6 -0
  52. package/dist/_virtual/png.js.map +1 -0
  53. package/dist/_virtual/png2.js +6 -0
  54. package/dist/_virtual/png2.js.map +1 -0
  55. package/dist/_virtual/polynomial.js +6 -0
  56. package/dist/_virtual/polynomial.js.map +1 -0
  57. package/dist/_virtual/qrcode.js +6 -0
  58. package/dist/_virtual/qrcode.js.map +1 -0
  59. package/dist/_virtual/regex.js +6 -0
  60. package/dist/_virtual/regex.js.map +1 -0
  61. package/dist/_virtual/segments.js +6 -0
  62. package/dist/_virtual/segments.js.map +1 -0
  63. package/dist/_virtual/server.js +6 -0
  64. package/dist/_virtual/server.js.map +1 -0
  65. package/dist/_virtual/svg-tag.js +6 -0
  66. package/dist/_virtual/svg-tag.js.map +1 -0
  67. package/dist/_virtual/svg.js +6 -0
  68. package/dist/_virtual/svg.js.map +1 -0
  69. package/dist/_virtual/sync-inflate.js +6 -0
  70. package/dist/_virtual/sync-inflate.js.map +1 -0
  71. package/dist/_virtual/sync-reader.js +6 -0
  72. package/dist/_virtual/sync-reader.js.map +1 -0
  73. package/dist/_virtual/terminal-small.js +6 -0
  74. package/dist/_virtual/terminal-small.js.map +1 -0
  75. package/dist/_virtual/terminal.js +6 -0
  76. package/dist/_virtual/terminal.js.map +1 -0
  77. package/dist/_virtual/terminal2.js +6 -0
  78. package/dist/_virtual/terminal2.js.map +1 -0
  79. package/dist/_virtual/utf8.js +6 -0
  80. package/dist/_virtual/utf8.js.map +1 -0
  81. package/dist/_virtual/utils.js +6 -0
  82. package/dist/_virtual/utils.js.map +1 -0
  83. package/dist/_virtual/utils2.js +6 -0
  84. package/dist/_virtual/utils2.js.map +1 -0
  85. package/dist/_virtual/version-check.js +6 -0
  86. package/dist/_virtual/version-check.js.map +1 -0
  87. package/dist/_virtual/version.js +6 -0
  88. package/dist/_virtual/version.js.map +1 -0
  89. package/dist/node_modules/dijkstrajs/dijkstra.js +179 -0
  90. package/dist/node_modules/dijkstrajs/dijkstra.js.map +1 -0
  91. package/dist/node_modules/pngjs/lib/bitmapper.js +281 -0
  92. package/dist/node_modules/pngjs/lib/bitmapper.js.map +1 -0
  93. package/dist/node_modules/pngjs/lib/bitpacker.js +172 -0
  94. package/dist/node_modules/pngjs/lib/bitpacker.js.map +1 -0
  95. package/dist/node_modules/pngjs/lib/chunkstream.js +204 -0
  96. package/dist/node_modules/pngjs/lib/chunkstream.js.map +1 -0
  97. package/dist/node_modules/pngjs/lib/constants.js +44 -0
  98. package/dist/node_modules/pngjs/lib/constants.js.map +1 -0
  99. package/dist/node_modules/pngjs/lib/crc.js +53 -0
  100. package/dist/node_modules/pngjs/lib/crc.js.map +1 -0
  101. package/dist/node_modules/pngjs/lib/filter-pack.js +185 -0
  102. package/dist/node_modules/pngjs/lib/filter-pack.js.map +1 -0
  103. package/dist/node_modules/pngjs/lib/filter-parse-async.js +40 -0
  104. package/dist/node_modules/pngjs/lib/filter-parse-async.js.map +1 -0
  105. package/dist/node_modules/pngjs/lib/filter-parse-sync.js +36 -0
  106. package/dist/node_modules/pngjs/lib/filter-parse-sync.js.map +1 -0
  107. package/dist/node_modules/pngjs/lib/filter-parse.js +192 -0
  108. package/dist/node_modules/pngjs/lib/filter-parse.js.map +1 -0
  109. package/dist/node_modules/pngjs/lib/format-normaliser.js +105 -0
  110. package/dist/node_modules/pngjs/lib/format-normaliser.js.map +1 -0
  111. package/dist/node_modules/pngjs/lib/interlace.js +108 -0
  112. package/dist/node_modules/pngjs/lib/interlace.js.map +1 -0
  113. package/dist/node_modules/pngjs/lib/packer-async.js +67 -0
  114. package/dist/node_modules/pngjs/lib/packer-async.js.map +1 -0
  115. package/dist/node_modules/pngjs/lib/packer-sync.js +72 -0
  116. package/dist/node_modules/pngjs/lib/packer-sync.js.map +1 -0
  117. package/dist/node_modules/pngjs/lib/packer.js +147 -0
  118. package/dist/node_modules/pngjs/lib/packer.js.map +1 -0
  119. package/dist/node_modules/pngjs/lib/paeth-predictor.js +28 -0
  120. package/dist/node_modules/pngjs/lib/paeth-predictor.js.map +1 -0
  121. package/dist/node_modules/pngjs/lib/parser-async.js +185 -0
  122. package/dist/node_modules/pngjs/lib/parser-async.js.map +1 -0
  123. package/dist/node_modules/pngjs/lib/parser-sync.js +128 -0
  124. package/dist/node_modules/pngjs/lib/parser-sync.js.map +1 -0
  125. package/dist/node_modules/pngjs/lib/parser.js +305 -0
  126. package/dist/node_modules/pngjs/lib/parser.js.map +1 -0
  127. package/dist/node_modules/pngjs/lib/png-sync.js +27 -0
  128. package/dist/node_modules/pngjs/lib/png-sync.js.map +1 -0
  129. package/dist/node_modules/pngjs/lib/png.js +212 -0
  130. package/dist/node_modules/pngjs/lib/png.js.map +1 -0
  131. package/dist/node_modules/pngjs/lib/sync-inflate.js +184 -0
  132. package/dist/node_modules/pngjs/lib/sync-inflate.js.map +1 -0
  133. package/dist/node_modules/pngjs/lib/sync-reader.js +58 -0
  134. package/dist/node_modules/pngjs/lib/sync-reader.js.map +1 -0
  135. package/dist/node_modules/qrcode/lib/browser.js +93 -0
  136. package/dist/node_modules/qrcode/lib/browser.js.map +1 -0
  137. package/dist/node_modules/qrcode/lib/can-promise.js +20 -0
  138. package/dist/node_modules/qrcode/lib/can-promise.js.map +1 -0
  139. package/dist/node_modules/qrcode/lib/core/alignment-pattern.js +100 -0
  140. package/dist/node_modules/qrcode/lib/core/alignment-pattern.js.map +1 -0
  141. package/dist/node_modules/qrcode/lib/core/alphanumeric-data.js +74 -0
  142. package/dist/node_modules/qrcode/lib/core/alphanumeric-data.js.map +1 -0
  143. package/dist/node_modules/qrcode/lib/core/bit-buffer.js +50 -0
  144. package/dist/node_modules/qrcode/lib/core/bit-buffer.js.map +1 -0
  145. package/dist/node_modules/qrcode/lib/core/bit-matrix.js +79 -0
  146. package/dist/node_modules/qrcode/lib/core/bit-matrix.js.map +1 -0
  147. package/dist/node_modules/qrcode/lib/core/byte-data.js +45 -0
  148. package/dist/node_modules/qrcode/lib/core/byte-data.js.map +1 -0
  149. package/dist/node_modules/qrcode/lib/core/error-correction-code.js +150 -0
  150. package/dist/node_modules/qrcode/lib/core/error-correction-code.js.map +1 -0
  151. package/dist/node_modules/qrcode/lib/core/error-correction-level.js +66 -0
  152. package/dist/node_modules/qrcode/lib/core/error-correction-level.js.map +1 -0
  153. package/dist/node_modules/qrcode/lib/core/finder-pattern.js +37 -0
  154. package/dist/node_modules/qrcode/lib/core/finder-pattern.js.map +1 -0
  155. package/dist/node_modules/qrcode/lib/core/format-info.js +44 -0
  156. package/dist/node_modules/qrcode/lib/core/format-info.js.map +1 -0
  157. package/dist/node_modules/qrcode/lib/core/galois-field.js +83 -0
  158. package/dist/node_modules/qrcode/lib/core/galois-field.js.map +1 -0
  159. package/dist/node_modules/qrcode/lib/core/kanji-data.js +70 -0
  160. package/dist/node_modules/qrcode/lib/core/kanji-data.js.map +1 -0
  161. package/dist/node_modules/qrcode/lib/core/mask-pattern.js +251 -0
  162. package/dist/node_modules/qrcode/lib/core/mask-pattern.js.map +1 -0
  163. package/dist/node_modules/qrcode/lib/core/mode.js +185 -0
  164. package/dist/node_modules/qrcode/lib/core/mode.js.map +1 -0
  165. package/dist/node_modules/qrcode/lib/core/numeric-data.js +58 -0
  166. package/dist/node_modules/qrcode/lib/core/numeric-data.js.map +1 -0
  167. package/dist/node_modules/qrcode/lib/core/polynomial.js +79 -0
  168. package/dist/node_modules/qrcode/lib/core/polynomial.js.map +1 -0
  169. package/dist/node_modules/qrcode/lib/core/qrcode.js +522 -0
  170. package/dist/node_modules/qrcode/lib/core/qrcode.js.map +1 -0
  171. package/dist/node_modules/qrcode/lib/core/reed-solomon-encoder.js +71 -0
  172. package/dist/node_modules/qrcode/lib/core/reed-solomon-encoder.js.map +1 -0
  173. package/dist/node_modules/qrcode/lib/core/regex.js +45 -0
  174. package/dist/node_modules/qrcode/lib/core/regex.js.map +1 -0
  175. package/dist/node_modules/qrcode/lib/core/segments.js +354 -0
  176. package/dist/node_modules/qrcode/lib/core/segments.js.map +1 -0
  177. package/dist/node_modules/qrcode/lib/core/utils.js +77 -0
  178. package/dist/node_modules/qrcode/lib/core/utils.js.map +1 -0
  179. package/dist/node_modules/qrcode/lib/core/version-check.js +24 -0
  180. package/dist/node_modules/qrcode/lib/core/version-check.js.map +1 -0
  181. package/dist/node_modules/qrcode/lib/core/version.js +184 -0
  182. package/dist/node_modules/qrcode/lib/core/version.js.map +1 -0
  183. package/dist/node_modules/qrcode/lib/index.js +27 -0
  184. package/dist/node_modules/qrcode/lib/index.js.map +1 -0
  185. package/dist/node_modules/qrcode/lib/renderer/canvas.js +80 -0
  186. package/dist/node_modules/qrcode/lib/renderer/canvas.js.map +1 -0
  187. package/dist/node_modules/qrcode/lib/renderer/png.js +97 -0
  188. package/dist/node_modules/qrcode/lib/renderer/png.js.map +1 -0
  189. package/dist/node_modules/qrcode/lib/renderer/svg-tag.js +96 -0
  190. package/dist/node_modules/qrcode/lib/renderer/svg-tag.js.map +1 -0
  191. package/dist/node_modules/qrcode/lib/renderer/svg.js +37 -0
  192. package/dist/node_modules/qrcode/lib/renderer/svg.js.map +1 -0
  193. package/dist/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +99 -0
  194. package/dist/node_modules/qrcode/lib/renderer/terminal/terminal-small.js.map +1 -0
  195. package/dist/node_modules/qrcode/lib/renderer/terminal/terminal.js +63 -0
  196. package/dist/node_modules/qrcode/lib/renderer/terminal/terminal.js.map +1 -0
  197. package/dist/node_modules/qrcode/lib/renderer/terminal.js +25 -0
  198. package/dist/node_modules/qrcode/lib/renderer/terminal.js.map +1 -0
  199. package/dist/node_modules/qrcode/lib/renderer/utf8.js +89 -0
  200. package/dist/node_modules/qrcode/lib/renderer/utf8.js.map +1 -0
  201. package/dist/node_modules/qrcode/lib/renderer/utils.js +115 -0
  202. package/dist/node_modules/qrcode/lib/renderer/utils.js.map +1 -0
  203. package/dist/node_modules/qrcode/lib/server.js +159 -0
  204. package/dist/node_modules/qrcode/lib/server.js.map +1 -0
  205. package/dist/package.json.js +3 -2
  206. package/dist/package.json.js.map +1 -1
  207. package/dist/utils/config.js +2 -2
  208. package/dist/utils/config.js.map +1 -1
  209. package/dist/utils/qrcode.d.ts.map +1 -1
  210. package/dist/utils/qrcode.js +5 -9
  211. package/dist/utils/qrcode.js.map +1 -1
  212. package/package.json +3 -2
@@ -0,0 +1,522 @@
1
+ 'use strict';
2
+
3
+ var qrcode = require('../../../../_virtual/qrcode.js');
4
+ var utils = require('./utils.js');
5
+ var errorCorrectionLevel = require('./error-correction-level.js');
6
+ var bitBuffer = require('./bit-buffer.js');
7
+ var bitMatrix = require('./bit-matrix.js');
8
+ var alignmentPattern = require('./alignment-pattern.js');
9
+ var finderPattern = require('./finder-pattern.js');
10
+ var maskPattern = require('./mask-pattern.js');
11
+ var errorCorrectionCode = require('./error-correction-code.js');
12
+ var reedSolomonEncoder = require('./reed-solomon-encoder.js');
13
+ var version = require('./version.js');
14
+ var formatInfo = require('./format-info.js');
15
+ var mode = require('./mode.js');
16
+ var segments = require('./segments.js');
17
+
18
+ var hasRequiredQrcode;
19
+
20
+ function requireQrcode () {
21
+ if (hasRequiredQrcode) return qrcode.__exports;
22
+ hasRequiredQrcode = 1;
23
+ const Utils = utils.__require();
24
+ const ECLevel = errorCorrectionLevel.__require();
25
+ const BitBuffer = bitBuffer.__require();
26
+ const BitMatrix = bitMatrix.__require();
27
+ const AlignmentPattern = alignmentPattern.__require();
28
+ const FinderPattern = finderPattern.__require();
29
+ const MaskPattern = maskPattern.__require();
30
+ const ECCode = errorCorrectionCode.__require();
31
+ const ReedSolomonEncoder = reedSolomonEncoder.__require();
32
+ const Version = version.__require();
33
+ const FormatInfo = formatInfo.__require();
34
+ const Mode = mode.__require();
35
+ const Segments = segments.__require();
36
+
37
+ /**
38
+ * QRCode for JavaScript
39
+ *
40
+ * modified by Ryan Day for nodejs support
41
+ * Copyright (c) 2011 Ryan Day
42
+ *
43
+ * Licensed under the MIT license:
44
+ * http://www.opensource.org/licenses/mit-license.php
45
+ *
46
+ //---------------------------------------------------------------------
47
+ // QRCode for JavaScript
48
+ //
49
+ // Copyright (c) 2009 Kazuhiko Arase
50
+ //
51
+ // URL: http://www.d-project.com/
52
+ //
53
+ // Licensed under the MIT license:
54
+ // http://www.opensource.org/licenses/mit-license.php
55
+ //
56
+ // The word "QR Code" is registered trademark of
57
+ // DENSO WAVE INCORPORATED
58
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
59
+ //
60
+ //---------------------------------------------------------------------
61
+ */
62
+
63
+ /**
64
+ * Add finder patterns bits to matrix
65
+ *
66
+ * @param {BitMatrix} matrix Modules matrix
67
+ * @param {Number} version QR Code version
68
+ */
69
+ function setupFinderPattern (matrix, version) {
70
+ const size = matrix.size;
71
+ const pos = FinderPattern.getPositions(version);
72
+
73
+ for (let i = 0; i < pos.length; i++) {
74
+ const row = pos[i][0];
75
+ const col = pos[i][1];
76
+
77
+ for (let r = -1; r <= 7; r++) {
78
+ if (row + r <= -1 || size <= row + r) continue
79
+
80
+ for (let c = -1; c <= 7; c++) {
81
+ if (col + c <= -1 || size <= col + c) continue
82
+
83
+ if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
84
+ (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
85
+ (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
86
+ matrix.set(row + r, col + c, true, true);
87
+ } else {
88
+ matrix.set(row + r, col + c, false, true);
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Add timing pattern bits to matrix
97
+ *
98
+ * Note: this function must be called before {@link setupAlignmentPattern}
99
+ *
100
+ * @param {BitMatrix} matrix Modules matrix
101
+ */
102
+ function setupTimingPattern (matrix) {
103
+ const size = matrix.size;
104
+
105
+ for (let r = 8; r < size - 8; r++) {
106
+ const value = r % 2 === 0;
107
+ matrix.set(r, 6, value, true);
108
+ matrix.set(6, r, value, true);
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Add alignment patterns bits to matrix
114
+ *
115
+ * Note: this function must be called after {@link setupTimingPattern}
116
+ *
117
+ * @param {BitMatrix} matrix Modules matrix
118
+ * @param {Number} version QR Code version
119
+ */
120
+ function setupAlignmentPattern (matrix, version) {
121
+ const pos = AlignmentPattern.getPositions(version);
122
+
123
+ for (let i = 0; i < pos.length; i++) {
124
+ const row = pos[i][0];
125
+ const col = pos[i][1];
126
+
127
+ for (let r = -2; r <= 2; r++) {
128
+ for (let c = -2; c <= 2; c++) {
129
+ if (r === -2 || r === 2 || c === -2 || c === 2 ||
130
+ (r === 0 && c === 0)) {
131
+ matrix.set(row + r, col + c, true, true);
132
+ } else {
133
+ matrix.set(row + r, col + c, false, true);
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Add version info bits to matrix
142
+ *
143
+ * @param {BitMatrix} matrix Modules matrix
144
+ * @param {Number} version QR Code version
145
+ */
146
+ function setupVersionInfo (matrix, version) {
147
+ const size = matrix.size;
148
+ const bits = Version.getEncodedBits(version);
149
+ let row, col, mod;
150
+
151
+ for (let i = 0; i < 18; i++) {
152
+ row = Math.floor(i / 3);
153
+ col = i % 3 + size - 8 - 3;
154
+ mod = ((bits >> i) & 1) === 1;
155
+
156
+ matrix.set(row, col, mod, true);
157
+ matrix.set(col, row, mod, true);
158
+ }
159
+ }
160
+
161
+ /**
162
+ * Add format info bits to matrix
163
+ *
164
+ * @param {BitMatrix} matrix Modules matrix
165
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
166
+ * @param {Number} maskPattern Mask pattern reference value
167
+ */
168
+ function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
169
+ const size = matrix.size;
170
+ const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
171
+ let i, mod;
172
+
173
+ for (i = 0; i < 15; i++) {
174
+ mod = ((bits >> i) & 1) === 1;
175
+
176
+ // vertical
177
+ if (i < 6) {
178
+ matrix.set(i, 8, mod, true);
179
+ } else if (i < 8) {
180
+ matrix.set(i + 1, 8, mod, true);
181
+ } else {
182
+ matrix.set(size - 15 + i, 8, mod, true);
183
+ }
184
+
185
+ // horizontal
186
+ if (i < 8) {
187
+ matrix.set(8, size - i - 1, mod, true);
188
+ } else if (i < 9) {
189
+ matrix.set(8, 15 - i - 1 + 1, mod, true);
190
+ } else {
191
+ matrix.set(8, 15 - i - 1, mod, true);
192
+ }
193
+ }
194
+
195
+ // fixed module
196
+ matrix.set(size - 8, 8, 1, true);
197
+ }
198
+
199
+ /**
200
+ * Add encoded data bits to matrix
201
+ *
202
+ * @param {BitMatrix} matrix Modules matrix
203
+ * @param {Uint8Array} data Data codewords
204
+ */
205
+ function setupData (matrix, data) {
206
+ const size = matrix.size;
207
+ let inc = -1;
208
+ let row = size - 1;
209
+ let bitIndex = 7;
210
+ let byteIndex = 0;
211
+
212
+ for (let col = size - 1; col > 0; col -= 2) {
213
+ if (col === 6) col--;
214
+
215
+ while (true) {
216
+ for (let c = 0; c < 2; c++) {
217
+ if (!matrix.isReserved(row, col - c)) {
218
+ let dark = false;
219
+
220
+ if (byteIndex < data.length) {
221
+ dark = (((data[byteIndex] >>> bitIndex) & 1) === 1);
222
+ }
223
+
224
+ matrix.set(row, col - c, dark);
225
+ bitIndex--;
226
+
227
+ if (bitIndex === -1) {
228
+ byteIndex++;
229
+ bitIndex = 7;
230
+ }
231
+ }
232
+ }
233
+
234
+ row += inc;
235
+
236
+ if (row < 0 || size <= row) {
237
+ row -= inc;
238
+ inc = -inc;
239
+ break
240
+ }
241
+ }
242
+ }
243
+ }
244
+
245
+ /**
246
+ * Create encoded codewords from data input
247
+ *
248
+ * @param {Number} version QR Code version
249
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
250
+ * @param {ByteData} data Data input
251
+ * @return {Uint8Array} Buffer containing encoded codewords
252
+ */
253
+ function createData (version, errorCorrectionLevel, segments) {
254
+ // Prepare data buffer
255
+ const buffer = new BitBuffer();
256
+
257
+ segments.forEach(function (data) {
258
+ // prefix data with mode indicator (4 bits)
259
+ buffer.put(data.mode.bit, 4);
260
+
261
+ // Prefix data with character count indicator.
262
+ // The character count indicator is a string of bits that represents the
263
+ // number of characters that are being encoded.
264
+ // The character count indicator must be placed after the mode indicator
265
+ // and must be a certain number of bits long, depending on the QR version
266
+ // and data mode
267
+ // @see {@link Mode.getCharCountIndicator}.
268
+ buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
269
+
270
+ // add binary data sequence to buffer
271
+ data.write(buffer);
272
+ });
273
+
274
+ // Calculate required number of bits
275
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
276
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
277
+ const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
278
+
279
+ // Add a terminator.
280
+ // If the bit string is shorter than the total number of required bits,
281
+ // a terminator of up to four 0s must be added to the right side of the string.
282
+ // If the bit string is more than four bits shorter than the required number of bits,
283
+ // add four 0s to the end.
284
+ if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
285
+ buffer.put(0, 4);
286
+ }
287
+
288
+ // If the bit string is fewer than four bits shorter, add only the number of 0s that
289
+ // are needed to reach the required number of bits.
290
+
291
+ // After adding the terminator, if the number of bits in the string is not a multiple of 8,
292
+ // pad the string on the right with 0s to make the string's length a multiple of 8.
293
+ while (buffer.getLengthInBits() % 8 !== 0) {
294
+ buffer.putBit(0);
295
+ }
296
+
297
+ // Add pad bytes if the string is still shorter than the total number of required bits.
298
+ // Extend the buffer to fill the data capacity of the symbol corresponding to
299
+ // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
300
+ // and 00010001 (0x11) alternately.
301
+ const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
302
+ for (let i = 0; i < remainingByte; i++) {
303
+ buffer.put(i % 2 ? 0x11 : 0xEC, 8);
304
+ }
305
+
306
+ return createCodewords(buffer, version, errorCorrectionLevel)
307
+ }
308
+
309
+ /**
310
+ * Encode input data with Reed-Solomon and return codewords with
311
+ * relative error correction bits
312
+ *
313
+ * @param {BitBuffer} bitBuffer Data to encode
314
+ * @param {Number} version QR Code version
315
+ * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
316
+ * @return {Uint8Array} Buffer containing encoded codewords
317
+ */
318
+ function createCodewords (bitBuffer, version, errorCorrectionLevel) {
319
+ // Total codewords for this QR code version (Data + Error correction)
320
+ const totalCodewords = Utils.getSymbolTotalCodewords(version);
321
+
322
+ // Total number of error correction codewords
323
+ const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
324
+
325
+ // Total number of data codewords
326
+ const dataTotalCodewords = totalCodewords - ecTotalCodewords;
327
+
328
+ // Total number of blocks
329
+ const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
330
+
331
+ // Calculate how many blocks each group should contain
332
+ const blocksInGroup2 = totalCodewords % ecTotalBlocks;
333
+ const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
334
+
335
+ const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
336
+
337
+ const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
338
+ const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
339
+
340
+ // Number of EC codewords is the same for both groups
341
+ const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
342
+
343
+ // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
344
+ const rs = new ReedSolomonEncoder(ecCount);
345
+
346
+ let offset = 0;
347
+ const dcData = new Array(ecTotalBlocks);
348
+ const ecData = new Array(ecTotalBlocks);
349
+ let maxDataSize = 0;
350
+ const buffer = new Uint8Array(bitBuffer.buffer);
351
+
352
+ // Divide the buffer into the required number of blocks
353
+ for (let b = 0; b < ecTotalBlocks; b++) {
354
+ const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
355
+
356
+ // extract a block of data from buffer
357
+ dcData[b] = buffer.slice(offset, offset + dataSize);
358
+
359
+ // Calculate EC codewords for this data block
360
+ ecData[b] = rs.encode(dcData[b]);
361
+
362
+ offset += dataSize;
363
+ maxDataSize = Math.max(maxDataSize, dataSize);
364
+ }
365
+
366
+ // Create final data
367
+ // Interleave the data and error correction codewords from each block
368
+ const data = new Uint8Array(totalCodewords);
369
+ let index = 0;
370
+ let i, r;
371
+
372
+ // Add data codewords
373
+ for (i = 0; i < maxDataSize; i++) {
374
+ for (r = 0; r < ecTotalBlocks; r++) {
375
+ if (i < dcData[r].length) {
376
+ data[index++] = dcData[r][i];
377
+ }
378
+ }
379
+ }
380
+
381
+ // Apped EC codewords
382
+ for (i = 0; i < ecCount; i++) {
383
+ for (r = 0; r < ecTotalBlocks; r++) {
384
+ data[index++] = ecData[r][i];
385
+ }
386
+ }
387
+
388
+ return data
389
+ }
390
+
391
+ /**
392
+ * Build QR Code symbol
393
+ *
394
+ * @param {String} data Input string
395
+ * @param {Number} version QR Code version
396
+ * @param {ErrorCorretionLevel} errorCorrectionLevel Error level
397
+ * @param {MaskPattern} maskPattern Mask pattern
398
+ * @return {Object} Object containing symbol data
399
+ */
400
+ function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
401
+ let segments;
402
+
403
+ if (Array.isArray(data)) {
404
+ segments = Segments.fromArray(data);
405
+ } else if (typeof data === 'string') {
406
+ let estimatedVersion = version;
407
+
408
+ if (!estimatedVersion) {
409
+ const rawSegments = Segments.rawSplit(data);
410
+
411
+ // Estimate best version that can contain raw splitted segments
412
+ estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
413
+ }
414
+
415
+ // Build optimized segments
416
+ // If estimated version is undefined, try with the highest version
417
+ segments = Segments.fromString(data, estimatedVersion || 40);
418
+ } else {
419
+ throw new Error('Invalid data')
420
+ }
421
+
422
+ // Get the min version that can contain data
423
+ const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
424
+
425
+ // If no version is found, data cannot be stored
426
+ if (!bestVersion) {
427
+ throw new Error('The amount of data is too big to be stored in a QR Code')
428
+ }
429
+
430
+ // If not specified, use min version as default
431
+ if (!version) {
432
+ version = bestVersion;
433
+
434
+ // Check if the specified version can contain the data
435
+ } else if (version < bestVersion) {
436
+ throw new Error('\n' +
437
+ 'The chosen QR Code version cannot contain this amount of data.\n' +
438
+ 'Minimum version required to store current data is: ' + bestVersion + '.\n'
439
+ )
440
+ }
441
+
442
+ const dataBits = createData(version, errorCorrectionLevel, segments);
443
+
444
+ // Allocate matrix buffer
445
+ const moduleCount = Utils.getSymbolSize(version);
446
+ const modules = new BitMatrix(moduleCount);
447
+
448
+ // Add function modules
449
+ setupFinderPattern(modules, version);
450
+ setupTimingPattern(modules);
451
+ setupAlignmentPattern(modules, version);
452
+
453
+ // Add temporary dummy bits for format info just to set them as reserved.
454
+ // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}
455
+ // since the masking operation must be performed only on the encoding region.
456
+ // These blocks will be replaced with correct values later in code.
457
+ setupFormatInfo(modules, errorCorrectionLevel, 0);
458
+
459
+ if (version >= 7) {
460
+ setupVersionInfo(modules, version);
461
+ }
462
+
463
+ // Add data codewords
464
+ setupData(modules, dataBits);
465
+
466
+ if (isNaN(maskPattern)) {
467
+ // Find best mask pattern
468
+ maskPattern = MaskPattern.getBestMask(modules,
469
+ setupFormatInfo.bind(null, modules, errorCorrectionLevel));
470
+ }
471
+
472
+ // Apply mask pattern
473
+ MaskPattern.applyMask(maskPattern, modules);
474
+
475
+ // Replace format info bits with correct values
476
+ setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
477
+
478
+ return {
479
+ modules: modules,
480
+ version: version,
481
+ errorCorrectionLevel: errorCorrectionLevel,
482
+ maskPattern: maskPattern,
483
+ segments: segments
484
+ }
485
+ }
486
+
487
+ /**
488
+ * QR Code
489
+ *
490
+ * @param {String | Array} data Input data
491
+ * @param {Object} options Optional configurations
492
+ * @param {Number} options.version QR Code version
493
+ * @param {String} options.errorCorrectionLevel Error correction level
494
+ * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
495
+ */
496
+ qrcode.__exports.create = function create (data, options) {
497
+ if (typeof data === 'undefined' || data === '') {
498
+ throw new Error('No input text')
499
+ }
500
+
501
+ let errorCorrectionLevel = ECLevel.M;
502
+ let version;
503
+ let mask;
504
+
505
+ if (typeof options !== 'undefined') {
506
+ // Use higher error correction level as default
507
+ errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
508
+ version = Version.from(options.version);
509
+ mask = MaskPattern.from(options.maskPattern);
510
+
511
+ if (options.toSJISFunc) {
512
+ Utils.setToSJISFunction(options.toSJISFunc);
513
+ }
514
+ }
515
+
516
+ return createSymbol(data, version, errorCorrectionLevel, mask)
517
+ };
518
+ return qrcode.__exports;
519
+ }
520
+
521
+ exports.__require = requireQrcode;
522
+ //# sourceMappingURL=qrcode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qrcode.js","sources":["../../../../../node_modules/qrcode/lib/core/qrcode.js"],"sourcesContent":["const Utils = require('./utils')\nconst ECLevel = require('./error-correction-level')\nconst BitBuffer = require('./bit-buffer')\nconst BitMatrix = require('./bit-matrix')\nconst AlignmentPattern = require('./alignment-pattern')\nconst FinderPattern = require('./finder-pattern')\nconst MaskPattern = require('./mask-pattern')\nconst ECCode = require('./error-correction-code')\nconst ReedSolomonEncoder = require('./reed-solomon-encoder')\nconst Version = require('./version')\nconst FormatInfo = require('./format-info')\nconst Mode = require('./mode')\nconst Segments = require('./segments')\n\n/**\n * QRCode for JavaScript\n *\n * modified by Ryan Day for nodejs support\n * Copyright (c) 2011 Ryan Day\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/mit-license.php\n *\n//---------------------------------------------------------------------\n// QRCode for JavaScript\n//\n// Copyright (c) 2009 Kazuhiko Arase\n//\n// URL: http://www.d-project.com/\n//\n// Licensed under the MIT license:\n// http://www.opensource.org/licenses/mit-license.php\n//\n// The word \"QR Code\" is registered trademark of\n// DENSO WAVE INCORPORATED\n// http://www.denso-wave.com/qrcode/faqpatent-e.html\n//\n//---------------------------------------------------------------------\n*/\n\n/**\n * Add finder patterns bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupFinderPattern (matrix, version) {\n const size = matrix.size\n const pos = FinderPattern.getPositions(version)\n\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0]\n const col = pos[i][1]\n\n for (let r = -1; r <= 7; r++) {\n if (row + r <= -1 || size <= row + r) continue\n\n for (let c = -1; c <= 7; c++) {\n if (col + c <= -1 || size <= col + c) continue\n\n if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||\n (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||\n (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {\n matrix.set(row + r, col + c, true, true)\n } else {\n matrix.set(row + r, col + c, false, true)\n }\n }\n }\n }\n}\n\n/**\n * Add timing pattern bits to matrix\n *\n * Note: this function must be called before {@link setupAlignmentPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n */\nfunction setupTimingPattern (matrix) {\n const size = matrix.size\n\n for (let r = 8; r < size - 8; r++) {\n const value = r % 2 === 0\n matrix.set(r, 6, value, true)\n matrix.set(6, r, value, true)\n }\n}\n\n/**\n * Add alignment patterns bits to matrix\n *\n * Note: this function must be called after {@link setupTimingPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupAlignmentPattern (matrix, version) {\n const pos = AlignmentPattern.getPositions(version)\n\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0]\n const col = pos[i][1]\n\n for (let r = -2; r <= 2; r++) {\n for (let c = -2; c <= 2; c++) {\n if (r === -2 || r === 2 || c === -2 || c === 2 ||\n (r === 0 && c === 0)) {\n matrix.set(row + r, col + c, true, true)\n } else {\n matrix.set(row + r, col + c, false, true)\n }\n }\n }\n }\n}\n\n/**\n * Add version info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupVersionInfo (matrix, version) {\n const size = matrix.size\n const bits = Version.getEncodedBits(version)\n let row, col, mod\n\n for (let i = 0; i < 18; i++) {\n row = Math.floor(i / 3)\n col = i % 3 + size - 8 - 3\n mod = ((bits >> i) & 1) === 1\n\n matrix.set(row, col, mod, true)\n matrix.set(col, row, mod, true)\n }\n}\n\n/**\n * Add format info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {Number} maskPattern Mask pattern reference value\n */\nfunction setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {\n const size = matrix.size\n const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern)\n let i, mod\n\n for (i = 0; i < 15; i++) {\n mod = ((bits >> i) & 1) === 1\n\n // vertical\n if (i < 6) {\n matrix.set(i, 8, mod, true)\n } else if (i < 8) {\n matrix.set(i + 1, 8, mod, true)\n } else {\n matrix.set(size - 15 + i, 8, mod, true)\n }\n\n // horizontal\n if (i < 8) {\n matrix.set(8, size - i - 1, mod, true)\n } else if (i < 9) {\n matrix.set(8, 15 - i - 1 + 1, mod, true)\n } else {\n matrix.set(8, 15 - i - 1, mod, true)\n }\n }\n\n // fixed module\n matrix.set(size - 8, 8, 1, true)\n}\n\n/**\n * Add encoded data bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Uint8Array} data Data codewords\n */\nfunction setupData (matrix, data) {\n const size = matrix.size\n let inc = -1\n let row = size - 1\n let bitIndex = 7\n let byteIndex = 0\n\n for (let col = size - 1; col > 0; col -= 2) {\n if (col === 6) col--\n\n while (true) {\n for (let c = 0; c < 2; c++) {\n if (!matrix.isReserved(row, col - c)) {\n let dark = false\n\n if (byteIndex < data.length) {\n dark = (((data[byteIndex] >>> bitIndex) & 1) === 1)\n }\n\n matrix.set(row, col - c, dark)\n bitIndex--\n\n if (bitIndex === -1) {\n byteIndex++\n bitIndex = 7\n }\n }\n }\n\n row += inc\n\n if (row < 0 || size <= row) {\n row -= inc\n inc = -inc\n break\n }\n }\n }\n}\n\n/**\n * Create encoded codewords from data input\n *\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {ByteData} data Data input\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createData (version, errorCorrectionLevel, segments) {\n // Prepare data buffer\n const buffer = new BitBuffer()\n\n segments.forEach(function (data) {\n // prefix data with mode indicator (4 bits)\n buffer.put(data.mode.bit, 4)\n\n // Prefix data with character count indicator.\n // The character count indicator is a string of bits that represents the\n // number of characters that are being encoded.\n // The character count indicator must be placed after the mode indicator\n // and must be a certain number of bits long, depending on the QR version\n // and data mode\n // @see {@link Mode.getCharCountIndicator}.\n buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version))\n\n // add binary data sequence to buffer\n data.write(buffer)\n })\n\n // Calculate required number of bits\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8\n\n // Add a terminator.\n // If the bit string is shorter than the total number of required bits,\n // a terminator of up to four 0s must be added to the right side of the string.\n // If the bit string is more than four bits shorter than the required number of bits,\n // add four 0s to the end.\n if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {\n buffer.put(0, 4)\n }\n\n // If the bit string is fewer than four bits shorter, add only the number of 0s that\n // are needed to reach the required number of bits.\n\n // After adding the terminator, if the number of bits in the string is not a multiple of 8,\n // pad the string on the right with 0s to make the string's length a multiple of 8.\n while (buffer.getLengthInBits() % 8 !== 0) {\n buffer.putBit(0)\n }\n\n // Add pad bytes if the string is still shorter than the total number of required bits.\n // Extend the buffer to fill the data capacity of the symbol corresponding to\n // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)\n // and 00010001 (0x11) alternately.\n const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8\n for (let i = 0; i < remainingByte; i++) {\n buffer.put(i % 2 ? 0x11 : 0xEC, 8)\n }\n\n return createCodewords(buffer, version, errorCorrectionLevel)\n}\n\n/**\n * Encode input data with Reed-Solomon and return codewords with\n * relative error correction bits\n *\n * @param {BitBuffer} bitBuffer Data to encode\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createCodewords (bitBuffer, version, errorCorrectionLevel) {\n // Total codewords for this QR code version (Data + Error correction)\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n\n // Total number of error correction codewords\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n\n // Total number of data codewords\n const dataTotalCodewords = totalCodewords - ecTotalCodewords\n\n // Total number of blocks\n const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel)\n\n // Calculate how many blocks each group should contain\n const blocksInGroup2 = totalCodewords % ecTotalBlocks\n const blocksInGroup1 = ecTotalBlocks - blocksInGroup2\n\n const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks)\n\n const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks)\n const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1\n\n // Number of EC codewords is the same for both groups\n const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1\n\n // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount\n const rs = new ReedSolomonEncoder(ecCount)\n\n let offset = 0\n const dcData = new Array(ecTotalBlocks)\n const ecData = new Array(ecTotalBlocks)\n let maxDataSize = 0\n const buffer = new Uint8Array(bitBuffer.buffer)\n\n // Divide the buffer into the required number of blocks\n for (let b = 0; b < ecTotalBlocks; b++) {\n const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2\n\n // extract a block of data from buffer\n dcData[b] = buffer.slice(offset, offset + dataSize)\n\n // Calculate EC codewords for this data block\n ecData[b] = rs.encode(dcData[b])\n\n offset += dataSize\n maxDataSize = Math.max(maxDataSize, dataSize)\n }\n\n // Create final data\n // Interleave the data and error correction codewords from each block\n const data = new Uint8Array(totalCodewords)\n let index = 0\n let i, r\n\n // Add data codewords\n for (i = 0; i < maxDataSize; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n if (i < dcData[r].length) {\n data[index++] = dcData[r][i]\n }\n }\n }\n\n // Apped EC codewords\n for (i = 0; i < ecCount; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n data[index++] = ecData[r][i]\n }\n }\n\n return data\n}\n\n/**\n * Build QR Code symbol\n *\n * @param {String} data Input string\n * @param {Number} version QR Code version\n * @param {ErrorCorretionLevel} errorCorrectionLevel Error level\n * @param {MaskPattern} maskPattern Mask pattern\n * @return {Object} Object containing symbol data\n */\nfunction createSymbol (data, version, errorCorrectionLevel, maskPattern) {\n let segments\n\n if (Array.isArray(data)) {\n segments = Segments.fromArray(data)\n } else if (typeof data === 'string') {\n let estimatedVersion = version\n\n if (!estimatedVersion) {\n const rawSegments = Segments.rawSplit(data)\n\n // Estimate best version that can contain raw splitted segments\n estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel)\n }\n\n // Build optimized segments\n // If estimated version is undefined, try with the highest version\n segments = Segments.fromString(data, estimatedVersion || 40)\n } else {\n throw new Error('Invalid data')\n }\n\n // Get the min version that can contain data\n const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel)\n\n // If no version is found, data cannot be stored\n if (!bestVersion) {\n throw new Error('The amount of data is too big to be stored in a QR Code')\n }\n\n // If not specified, use min version as default\n if (!version) {\n version = bestVersion\n\n // Check if the specified version can contain the data\n } else if (version < bestVersion) {\n throw new Error('\\n' +\n 'The chosen QR Code version cannot contain this amount of data.\\n' +\n 'Minimum version required to store current data is: ' + bestVersion + '.\\n'\n )\n }\n\n const dataBits = createData(version, errorCorrectionLevel, segments)\n\n // Allocate matrix buffer\n const moduleCount = Utils.getSymbolSize(version)\n const modules = new BitMatrix(moduleCount)\n\n // Add function modules\n setupFinderPattern(modules, version)\n setupTimingPattern(modules)\n setupAlignmentPattern(modules, version)\n\n // Add temporary dummy bits for format info just to set them as reserved.\n // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}\n // since the masking operation must be performed only on the encoding region.\n // These blocks will be replaced with correct values later in code.\n setupFormatInfo(modules, errorCorrectionLevel, 0)\n\n if (version >= 7) {\n setupVersionInfo(modules, version)\n }\n\n // Add data codewords\n setupData(modules, dataBits)\n\n if (isNaN(maskPattern)) {\n // Find best mask pattern\n maskPattern = MaskPattern.getBestMask(modules,\n setupFormatInfo.bind(null, modules, errorCorrectionLevel))\n }\n\n // Apply mask pattern\n MaskPattern.applyMask(maskPattern, modules)\n\n // Replace format info bits with correct values\n setupFormatInfo(modules, errorCorrectionLevel, maskPattern)\n\n return {\n modules: modules,\n version: version,\n errorCorrectionLevel: errorCorrectionLevel,\n maskPattern: maskPattern,\n segments: segments\n }\n}\n\n/**\n * QR Code\n *\n * @param {String | Array} data Input data\n * @param {Object} options Optional configurations\n * @param {Number} options.version QR Code version\n * @param {String} options.errorCorrectionLevel Error correction level\n * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis\n */\nexports.create = function create (data, options) {\n if (typeof data === 'undefined' || data === '') {\n throw new Error('No input text')\n }\n\n let errorCorrectionLevel = ECLevel.M\n let version\n let mask\n\n if (typeof options !== 'undefined') {\n // Use higher error correction level as default\n errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M)\n version = Version.from(options.version)\n mask = MaskPattern.from(options.maskPattern)\n\n if (options.toSJISFunc) {\n Utils.setToSJISFunction(options.toSJISFunc)\n }\n }\n\n return createSymbol(data, version, errorCorrectionLevel, mask)\n}\n"],"names":["require$$0","require$$1","require$$2","require$$3","require$$4","require$$5","require$$6","require$$7","require$$8","require$$9","require$$10","require$$11","require$$12","qrcode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,CAAA,MAAM,KAAK,GAAGA,eAAA;AACd,CAAA,MAAM,OAAO,GAAGC,8BAAA;AAChB,CAAA,MAAM,SAAS,GAAGC,mBAAA;AAClB,CAAA,MAAM,SAAS,GAAGC,mBAAA;AAClB,CAAA,MAAM,gBAAgB,GAAGC,0BAAA;AACzB,CAAA,MAAM,aAAa,GAAGC,uBAAA;AACtB,CAAA,MAAM,WAAW,GAAGC,qBAAA;AACpB,CAAA,MAAM,MAAM,GAAGC,6BAAA;AACf,CAAA,MAAM,kBAAkB,GAAGC,4BAAA;AAC3B,CAAA,MAAM,OAAO,GAAGC,iBAAA;AAChB,CAAA,MAAM,UAAU,GAAGC,oBAAA;AACnB,CAAA,MAAM,IAAI,GAAGC,cAAA;AACb,CAAA,MAAM,QAAQ,GAAGC,kBAAA;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAA,SAAS,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE;AAC9C,GAAE,MAAM,IAAI,GAAG,MAAM,CAAC;AACtB,GAA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AW;;AAE/C,KAAI,IAAI,OAAO,CAAC,UAAU,EAAE;AAC5B,OAAM,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,UAAU;AAChD,KAAA;AACA,GAAA;;GAEE,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI;AAC/D,CAAA;;;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ var polynomial = require('./polynomial.js');
4
+
5
+ var reedSolomonEncoder;
6
+ var hasRequiredReedSolomonEncoder;
7
+
8
+ function requireReedSolomonEncoder () {
9
+ if (hasRequiredReedSolomonEncoder) return reedSolomonEncoder;
10
+ hasRequiredReedSolomonEncoder = 1;
11
+ const Polynomial = polynomial.__require();
12
+
13
+ function ReedSolomonEncoder (degree) {
14
+ this.genPoly = undefined;
15
+ this.degree = degree;
16
+
17
+ if (this.degree) this.initialize(this.degree);
18
+ }
19
+
20
+ /**
21
+ * Initialize the encoder.
22
+ * The input param should correspond to the number of error correction codewords.
23
+ *
24
+ * @param {Number} degree
25
+ */
26
+ ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
27
+ // create an irreducible generator polynomial
28
+ this.degree = degree;
29
+ this.genPoly = Polynomial.generateECPolynomial(this.degree);
30
+ };
31
+
32
+ /**
33
+ * Encodes a chunk of data
34
+ *
35
+ * @param {Uint8Array} data Buffer containing input data
36
+ * @return {Uint8Array} Buffer containing encoded data
37
+ */
38
+ ReedSolomonEncoder.prototype.encode = function encode (data) {
39
+ if (!this.genPoly) {
40
+ throw new Error('Encoder not initialized')
41
+ }
42
+
43
+ // Calculate EC for this data block
44
+ // extends data size to data+genPoly size
45
+ const paddedData = new Uint8Array(data.length + this.degree);
46
+ paddedData.set(data);
47
+
48
+ // The error correction codewords are the remainder after dividing the data codewords
49
+ // by a generator polynomial
50
+ const remainder = Polynomial.mod(paddedData, this.genPoly);
51
+
52
+ // return EC data blocks (last n byte, where n is the degree of genPoly)
53
+ // If coefficients number in remainder are less than genPoly degree,
54
+ // pad with 0s to the left to reach the needed number of coefficients
55
+ const start = this.degree - remainder.length;
56
+ if (start > 0) {
57
+ const buff = new Uint8Array(this.degree);
58
+ buff.set(remainder, start);
59
+
60
+ return buff
61
+ }
62
+
63
+ return remainder
64
+ };
65
+
66
+ reedSolomonEncoder = ReedSolomonEncoder;
67
+ return reedSolomonEncoder;
68
+ }
69
+
70
+ exports.__require = requireReedSolomonEncoder;
71
+ //# sourceMappingURL=reed-solomon-encoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reed-solomon-encoder.js","sources":["../../../../../node_modules/qrcode/lib/core/reed-solomon-encoder.js"],"sourcesContent":["const Polynomial = require('./polynomial')\n\nfunction ReedSolomonEncoder (degree) {\n this.genPoly = undefined\n this.degree = degree\n\n if (this.degree) this.initialize(this.degree)\n}\n\n/**\n * Initialize the encoder.\n * The input param should correspond to the number of error correction codewords.\n *\n * @param {Number} degree\n */\nReedSolomonEncoder.prototype.initialize = function initialize (degree) {\n // create an irreducible generator polynomial\n this.degree = degree\n this.genPoly = Polynomial.generateECPolynomial(this.degree)\n}\n\n/**\n * Encodes a chunk of data\n *\n * @param {Uint8Array} data Buffer containing input data\n * @return {Uint8Array} Buffer containing encoded data\n */\nReedSolomonEncoder.prototype.encode = function encode (data) {\n if (!this.genPoly) {\n throw new Error('Encoder not initialized')\n }\n\n // Calculate EC for this data block\n // extends data size to data+genPoly size\n const paddedData = new Uint8Array(data.length + this.degree)\n paddedData.set(data)\n\n // The error correction codewords are the remainder after dividing the data codewords\n // by a generator polynomial\n const remainder = Polynomial.mod(paddedData, this.genPoly)\n\n // return EC data blocks (last n byte, where n is the degree of genPoly)\n // If coefficients number in remainder are less than genPoly degree,\n // pad with 0s to the left to reach the needed number of coefficients\n const start = this.degree - remainder.length\n if (start > 0) {\n const buff = new Uint8Array(this.degree)\n buff.set(remainder, start)\n\n return buff\n }\n\n return remainder\n}\n\nmodule.exports = ReedSolomonEncoder\n"],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