├── .DS_Store
├── index.mjs
├── .gitignore
├── examples
├── images
│ ├── logo.png
│ ├── generated-qr.png
│ ├── generated-qr-single.png
│ ├── algorand-qrcode-banner.jpg
│ ├── Screenshot 2023-02-12 at 01.37.24.png
│ └── Screenshot 2023-02-17 at 12.45.23.png
└── test.html
├── src
├── QRCode
│ ├── QRErrorCorrectLevel.js
│ ├── QRMode.js
│ ├── QRMaskPattern.js
│ ├── QR8bitByte.js
│ ├── QRBitBuffer.js
│ ├── QRMath.js
│ ├── QRPolynomial.js
│ ├── QRRSBlock.js
│ ├── QRUtil.js
│ └── index.js
├── index.mjs
└── terminal.cjs
├── rollup.config.js
├── LICENSE
├── .vscode
└── launch.json
├── package.json
├── bin
└── algoqrcode.cjs
├── README.md
└── lib
├── bundle.min.js
└── bundle.min.js.map
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emg110/algorand-qrcode/HEAD/.DS_Store
--------------------------------------------------------------------------------
/index.mjs:
--------------------------------------------------------------------------------
1 | import algoqrcode from "./lib/bundle.min.js";
2 | export default algoqrcode
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /build
3 | package-lock.json
4 | /examples/js
5 | .DS_Store
6 |
--------------------------------------------------------------------------------
/examples/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emg110/algorand-qrcode/HEAD/examples/images/logo.png
--------------------------------------------------------------------------------
/src/QRCode/QRErrorCorrectLevel.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | L : 1,
3 | M : 0,
4 | Q : 3,
5 | H : 2
6 | };
7 |
8 |
--------------------------------------------------------------------------------
/examples/images/generated-qr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emg110/algorand-qrcode/HEAD/examples/images/generated-qr.png
--------------------------------------------------------------------------------
/examples/images/generated-qr-single.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emg110/algorand-qrcode/HEAD/examples/images/generated-qr-single.png
--------------------------------------------------------------------------------
/examples/images/algorand-qrcode-banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emg110/algorand-qrcode/HEAD/examples/images/algorand-qrcode-banner.jpg
--------------------------------------------------------------------------------
/examples/images/Screenshot 2023-02-12 at 01.37.24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emg110/algorand-qrcode/HEAD/examples/images/Screenshot 2023-02-12 at 01.37.24.png
--------------------------------------------------------------------------------
/examples/images/Screenshot 2023-02-17 at 12.45.23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emg110/algorand-qrcode/HEAD/examples/images/Screenshot 2023-02-17 at 12.45.23.png
--------------------------------------------------------------------------------
/src/QRCode/QRMode.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | MODE_NUMBER : 1 << 0,
3 | MODE_ALPHA_NUM : 1 << 1,
4 | MODE_8BIT_BYTE : 1 << 2,
5 | MODE_KANJI : 1 << 3
6 | };
7 |
--------------------------------------------------------------------------------
/src/QRCode/QRMaskPattern.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | PATTERN000 : 0,
3 | PATTERN001 : 1,
4 | PATTERN010 : 2,
5 | PATTERN011 : 3,
6 | PATTERN100 : 4,
7 | PATTERN101 : 5,
8 | PATTERN110 : 6,
9 | PATTERN111 : 7
10 | };
11 |
--------------------------------------------------------------------------------
/src/QRCode/QR8bitByte.js:
--------------------------------------------------------------------------------
1 | var QRMode = require('./QRMode');
2 |
3 | function QR8bitByte(data) {
4 | this.mode = QRMode.MODE_8BIT_BYTE;
5 | this.data = data;
6 | }
7 |
8 | QR8bitByte.prototype = {
9 |
10 | getLength : function() {
11 | return this.data.length;
12 | },
13 |
14 | write : function(buffer) {
15 | for (var i = 0; i < this.data.length; i++) {
16 | // not JIS ...
17 | buffer.put(this.data.charCodeAt(i), 8);
18 | }
19 | }
20 | };
21 |
22 | module.exports = QR8bitByte;
23 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from 'rollup-plugin-babel'
2 | import { terser } from 'rollup-plugin-terser'
3 | import commonjs from '@rollup/plugin-commonjs'
4 | import resolve from '@rollup/plugin-node-resolve'
5 |
6 | const babelConfig = {
7 | babelrc: false,
8 | presets: [['@babel/preset-env', { targets: 'defaults, IE >= 10, Safari >= 5.1' }]]
9 | }
10 |
11 | export default [{
12 | input: 'src',
13 | output: [{
14 | file: 'lib/bundle.min.js',
15 | format: "es",
16 | name: 'algoqrcode',
17 | exports: 'named',
18 | sourcemap: true,
19 | }],
20 | plugins: [commonjs(), resolve(), babel(babelConfig), terser()]
21 | }]
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/QRCode/QRBitBuffer.js:
--------------------------------------------------------------------------------
1 | function QRBitBuffer() {
2 | this.buffer = [];
3 | this.length = 0;
4 | }
5 |
6 | QRBitBuffer.prototype = {
7 |
8 | get : function(index) {
9 | var bufIndex = Math.floor(index / 8);
10 | return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
11 | },
12 |
13 | put : function(num, length) {
14 | for (var i = 0; i < length; i++) {
15 | this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
16 | }
17 | },
18 |
19 | getLengthInBits : function() {
20 | return this.length;
21 | },
22 |
23 | putBit : function(bit) {
24 |
25 | var bufIndex = Math.floor(this.length / 8);
26 | if (this.buffer.length <= bufIndex) {
27 | this.buffer.push(0);
28 | }
29 |
30 | if (bit) {
31 | this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) );
32 | }
33 |
34 | this.length++;
35 | }
36 | };
37 |
38 | module.exports = QRBitBuffer;
39 |
--------------------------------------------------------------------------------
/src/QRCode/QRMath.js:
--------------------------------------------------------------------------------
1 | var QRMath = {
2 |
3 | glog : function(n) {
4 |
5 | if (n < 1) {
6 | throw new Error("glog(" + n + ")");
7 | }
8 |
9 | return QRMath.LOG_TABLE[n];
10 | },
11 |
12 | gexp : function(n) {
13 |
14 | while (n < 0) {
15 | n += 255;
16 | }
17 |
18 | while (n >= 256) {
19 | n -= 255;
20 | }
21 |
22 | return QRMath.EXP_TABLE[n];
23 | },
24 |
25 | EXP_TABLE : new Array(256),
26 |
27 | LOG_TABLE : new Array(256)
28 |
29 | };
30 |
31 | for (var i = 0; i < 8; i++) {
32 | QRMath.EXP_TABLE[i] = 1 << i;
33 | }
34 | for (var i = 8; i < 256; i++) {
35 | QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4]
36 | ^ QRMath.EXP_TABLE[i - 5]
37 | ^ QRMath.EXP_TABLE[i - 6]
38 | ^ QRMath.EXP_TABLE[i - 8];
39 | }
40 | for (var i = 0; i < 255; i++) {
41 | QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i;
42 | }
43 |
44 | module.exports = QRMath;
45 |
--------------------------------------------------------------------------------
/examples/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Test
5 |
6 |
7 |
8 | Test Algorand QRCode Generator
9 |
10 |
13 |
14 |
15 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Mohammad Ghiasi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "node",
9 | "request": "launch",
10 | "name": "Launch API Server via NPM",
11 | "runtimeExecutable": "npm",
12 | "runtimeArgs": [
13 | "run-script",
14 | "api"
15 | ],
16 | "port": 9229,
17 | "skipFiles": [
18 | "/**"
19 | ]
20 | },
21 | {
22 | "type": "node",
23 | "request": "launch",
24 | "name": "Launch static server via NPM",
25 | "runtimeExecutable": "npm",
26 | "runtimeArgs": [
27 | "run-script",
28 | "static"
29 | ],
30 | "port": 9229,
31 | "skipFiles": [
32 | "/**"
33 | ]
34 | }
35 |
36 | ]
37 | }
--------------------------------------------------------------------------------
/src/QRCode/QRPolynomial.js:
--------------------------------------------------------------------------------
1 | var QRMath = require('./QRMath');
2 |
3 | function QRPolynomial(num, shift) {
4 | if (num.length === undefined) {
5 | throw new Error(num.length + "/" + shift);
6 | }
7 |
8 | var offset = 0;
9 |
10 | while (offset < num.length && num[offset] === 0) {
11 | offset++;
12 | }
13 |
14 | this.num = new Array(num.length - offset + shift);
15 | for (var i = 0; i < num.length - offset; i++) {
16 | this.num[i] = num[i + offset];
17 | }
18 | }
19 |
20 | QRPolynomial.prototype = {
21 |
22 | get : function(index) {
23 | return this.num[index];
24 | },
25 |
26 | getLength : function() {
27 | return this.num.length;
28 | },
29 |
30 | multiply : function(e) {
31 |
32 | var num = new Array(this.getLength() + e.getLength() - 1);
33 |
34 | for (var i = 0; i < this.getLength(); i++) {
35 | for (var j = 0; j < e.getLength(); j++) {
36 | num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) );
37 | }
38 | }
39 |
40 | return new QRPolynomial(num, 0);
41 | },
42 |
43 | mod : function(e) {
44 |
45 | if (this.getLength() - e.getLength() < 0) {
46 | return this;
47 | }
48 |
49 | var ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) );
50 |
51 | var num = new Array(this.getLength() );
52 |
53 | for (var i = 0; i < this.getLength(); i++) {
54 | num[i] = this.get(i);
55 | }
56 |
57 | for (var x = 0; x < e.getLength(); x++) {
58 | num[x] ^= QRMath.gexp(QRMath.glog(e.get(x) ) + ratio);
59 | }
60 |
61 | // recursive call
62 | return new QRPolynomial(num, 0).mod(e);
63 | }
64 | };
65 |
66 | module.exports = QRPolynomial;
67 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "algorand-qrcode",
3 | "version": "3.3.0",
4 | "description": "Algorand QR Code generator js module",
5 | "repository": {
6 | "type": "git",
7 | "url": "git+https://github.com/emg110/algorand-qrcode.git"
8 | },
9 |
10 | "bin": {
11 | "algoqrcode": "bin/algoqrcode.cjs"
12 | },
13 | "main": "index.mjs",
14 | "author": "MG ",
15 | "contributors": [
16 | {
17 | "name": "MG",
18 | "email": "emg110@gmail.com",
19 | "url": "http://github.com/emg110"
20 | },
21 | {
22 | "name": "Sheghzo",
23 | "email": "shm1358110@gmail.com",
24 | "url": "http://github.com/sheghzo"
25 | }
26 | ],
27 | "homepage": "https://github.com/emg110/algorand-qrcode#readme",
28 | "private": false,
29 | "dependencies": {
30 | "encode-utf8": "^2.0.0",
31 | "express-favicon": "^2.0.1",
32 | "yargs": "^17.6.2",
33 | "qrcode-svg": "^1.1.0",
34 | "browser-or-node": "^2.1.1"
35 |
36 | },
37 | "babel": {
38 | "presets": [
39 | "@babel/preset-env",
40 | "@babel/preset-react"
41 | ]
42 | },
43 | "devDependencies": {
44 | "rollup": "^2.6.1",
45 | "rollup-plugin-babel": "^4.4.0",
46 | "rollup-plugin-terser": "^7.0.2",
47 | "@rollup/plugin-commonjs": "^24.0.1",
48 | "@rollup/plugin-node-resolve": "^15.0.1",
49 | "@babel/preset-react": "^7.18.6",
50 | "es2015": "latest",
51 | "@babel/core": "^7.20.12",
52 | "@babel/preset-env": "^7.20.2",
53 | "babelify": "^10.0.0"
54 | },
55 | "scripts": {
56 | "pretest": "npm run lint",
57 | "build": "rollup -c",
58 | "cli": "node ./bin/algoqrcode.cjs"
59 | },
60 | "license": "MIT",
61 | "bugs": {
62 | "url": "https://github.com/emg110/algorand-qrcode/issues"
63 | },
64 | "engines": {
65 | "node": ">=10.0.0"
66 | },
67 | "browserslist": {
68 | "production": [
69 | ">0.2%",
70 | "not dead",
71 | "not op_mini all"
72 | ],
73 | "development": [
74 | "last 1 chrome version",
75 | "last 1 firefox version",
76 | "last 1 safari version"
77 | ]
78 | }
79 | }
--------------------------------------------------------------------------------
/src/index.mjs:
--------------------------------------------------------------------------------
1 | import QRCode from "qrcode-svg"
2 | import QRCodeTerminal from "./terminal.cjs"
3 |
4 |
5 | import { isBrowser, isNode, isWebWorker, isJsDom, isDeno } from "browser-or-node";
6 | function parseOptions(args) {
7 | /*
8 | content: "http://github.com/",
9 | padding: 4,
10 | width: 256,
11 | height: 256,
12 | color: "#000000",
13 | background: "#ffffff",
14 | ecl: "M",
15 | */
16 | let content = "algorand://"
17 | let amount = args.amount;
18 | let wallet = args.wallet;
19 | let label = args.label;
20 | let asset = args.asset;
21 | let note = args.note;
22 | if (!!label && !!wallet) {
23 | content = "algorand://" + wallet+ "?" + "label=" + label;
24 | } else if (!!asset && !!wallet) {
25 | if (!!note && amount > 0) {
26 | content = "algorand://" + wallet+ "?" + "amount=" + amount + "&asset=" + asset + "¬e=" + note;
27 | } else if (amount > 0) {
28 | content = "algorand://" + wallet+ "?" + "amount=" + amount + "&asset=" + asset;
29 | } else if (amount === 0) {
30 | content = "algorand://?" + "amount=0" + "&asset=" + asset;
31 | }
32 |
33 | } else if (!!note && !!wallet && !!amount) {
34 | content = "algorand://" + wallet+ "?" + "amount=" + amount + "¬e=" + note;
35 | } else if ( !!wallet && !!amount){
36 | content = "algorand://" + wallet+ "?" + "amount=" + amount;
37 | }
38 | let options = {
39 | content: content,
40 | container: "svg-viewbox",
41 | ecl: args.ecl || "H",
42 | file: args.file || "algorand-qrcode.svg",
43 | padding: args.margin || 4,
44 | width: args.width || 256,
45 | height: args.height || 256,
46 | output: args.output || "terminal",
47 | background: args.background || "#e1dede",
48 | color: args.color || "#000000"
49 | }
50 | return options
51 | }
52 | const algoqrcode = (options) =>{
53 | if (isBrowser) {
54 | let opts = parseOptions(options)
55 | let qrcode = new QRCode(opts);
56 | return qrcode
57 |
58 | } else if (isNode) {
59 | if (options.output === 'svg') {
60 | let opts = parseOptions(options)
61 | let qrcode = new QRCode(opts);
62 | return qrcode
63 | } else {
64 | let opts = parseOptions(options)
65 | return QRCodeTerminal.generate(opts.content, {small: true});
66 | }
67 |
68 |
69 | }
70 |
71 | }
72 | export default algoqrcode
73 |
74 |
--------------------------------------------------------------------------------
/src/terminal.cjs:
--------------------------------------------------------------------------------
1 | var Reset = "\x1b[0m",
2 | Bright = "\x1b[1m",
3 | Dim = "\x1b[2m",
4 | Underscore = "\x1b[4m",
5 | Blink = "\x1b[5m",
6 | Reverse = "\x1b[7m",
7 | Hidden = "\x1b[8m",
8 |
9 | BgBlack = "\x1b[40m",
10 | BgRed = "\x1b[41m",
11 | BgGreen = "\x1b[42m",
12 | BgYellow = "\x1b[43m",
13 | BgBlue = "\x1b[44m",
14 | BgMagenta = "\x1b[45m",
15 | BgCyan = "\x1b[46m",
16 | BgWhite = "\x1b[47m",
17 | BgGray = "\x1b[100m"
18 | var QRCode = require('./QRCode'),
19 | QRErrorCorrectLevel = require('./QRCode/QRErrorCorrectLevel'),
20 | black = BgBlack +" "+ Reset,
21 | white = BgWhite +" "+ Reset,
22 | toCell = function (isBlack) {
23 | return isBlack ? black : white;
24 | },
25 | repeat = function (color) {
26 | return {
27 | times: function (count) {
28 | return new Array(count).join(color);
29 | }
30 | };
31 | },
32 | fill = function(length, value) {
33 | var arr = new Array(length);
34 | for (var i = 0; i < length; i++) {
35 | arr[i] = value;
36 | }
37 | return arr;
38 | };
39 |
40 | module.exports = {
41 |
42 | error: QRErrorCorrectLevel.L,
43 |
44 | generate: function (input, opts, cb) {
45 | if (typeof opts === 'function') {
46 | cb = opts;
47 | opts = {};
48 | }
49 |
50 | var qrcode = new QRCode(-1, this.error);
51 | qrcode.addData(input);
52 | qrcode.make();
53 |
54 | var output = '';
55 | if (opts && opts.small) {
56 | var BLACK = true, WHITE = false;
57 | var moduleCount = qrcode.getModuleCount();
58 | var moduleData = qrcode.modules.slice();
59 |
60 | var oddRow = moduleCount % 2 === 1;
61 | if (oddRow) {
62 | moduleData.push(fill(moduleCount, WHITE));
63 | }
64 |
65 | var platte= {
66 | WHITE_ALL: '\u2588',
67 | WHITE_BLACK: '\u2580',
68 | BLACK_WHITE: '\u2584',
69 | BLACK_ALL: ' ',
70 | };
71 |
72 | var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3);
73 | var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3);
74 | output += borderTop + '\n';
75 |
76 | for (var row = 0; row < moduleCount; row += 2) {
77 | output += platte.WHITE_ALL;
78 |
79 | for (var col = 0; col < moduleCount; col++) {
80 | if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {
81 | output += platte.WHITE_ALL;
82 | } else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {
83 | output += platte.WHITE_BLACK;
84 | } else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {
85 | output += platte.BLACK_WHITE;
86 | } else {
87 | output += platte.BLACK_ALL;
88 | }
89 | }
90 |
91 | output += platte.WHITE_ALL + '\n';
92 | }
93 |
94 | if (!oddRow) {
95 | output += borderBottom;
96 | }
97 | } else {
98 | var border = repeat(white).times(qrcode.getModuleCount() + 3);
99 |
100 | output += border + '\n';
101 | qrcode.modules.forEach(function (row) {
102 | output += white;
103 | output += row.map(toCell).join('');
104 | output += white + '\n';
105 | });
106 | output += border;
107 | }
108 |
109 | if (cb) cb(output);
110 | else console.log(output);
111 | },
112 |
113 | setErrorLevel: function (error) {
114 | this.error = QRErrorCorrectLevel[error] || this.error;
115 | }
116 |
117 | };
118 |
--------------------------------------------------------------------------------
/src/QRCode/QRRSBlock.js:
--------------------------------------------------------------------------------
1 | var QRErrorCorrectLevel = require('./QRErrorCorrectLevel');
2 |
3 | function QRRSBlock(totalCount, dataCount) {
4 | this.totalCount = totalCount;
5 | this.dataCount = dataCount;
6 | }
7 |
8 | QRRSBlock.RS_BLOCK_TABLE = [
9 |
10 | // L
11 | // M
12 | // Q
13 | // H
14 |
15 | // 1
16 | [1, 26, 19],
17 | [1, 26, 16],
18 | [1, 26, 13],
19 | [1, 26, 9],
20 |
21 | // 2
22 | [1, 44, 34],
23 | [1, 44, 28],
24 | [1, 44, 22],
25 | [1, 44, 16],
26 |
27 | // 3
28 | [1, 70, 55],
29 | [1, 70, 44],
30 | [2, 35, 17],
31 | [2, 35, 13],
32 |
33 | // 4
34 | [1, 100, 80],
35 | [2, 50, 32],
36 | [2, 50, 24],
37 | [4, 25, 9],
38 |
39 | // 5
40 | [1, 134, 108],
41 | [2, 67, 43],
42 | [2, 33, 15, 2, 34, 16],
43 | [2, 33, 11, 2, 34, 12],
44 |
45 | // 6
46 | [2, 86, 68],
47 | [4, 43, 27],
48 | [4, 43, 19],
49 | [4, 43, 15],
50 |
51 | // 7
52 | [2, 98, 78],
53 | [4, 49, 31],
54 | [2, 32, 14, 4, 33, 15],
55 | [4, 39, 13, 1, 40, 14],
56 |
57 | // 8
58 | [2, 121, 97],
59 | [2, 60, 38, 2, 61, 39],
60 | [4, 40, 18, 2, 41, 19],
61 | [4, 40, 14, 2, 41, 15],
62 |
63 | // 9
64 | [2, 146, 116],
65 | [3, 58, 36, 2, 59, 37],
66 | [4, 36, 16, 4, 37, 17],
67 | [4, 36, 12, 4, 37, 13],
68 |
69 | // 10
70 | [2, 86, 68, 2, 87, 69],
71 | [4, 69, 43, 1, 70, 44],
72 | [6, 43, 19, 2, 44, 20],
73 | [6, 43, 15, 2, 44, 16],
74 |
75 | // 11
76 | [4, 101, 81],
77 | [1, 80, 50, 4, 81, 51],
78 | [4, 50, 22, 4, 51, 23],
79 | [3, 36, 12, 8, 37, 13],
80 |
81 | // 12
82 | [2, 116, 92, 2, 117, 93],
83 | [6, 58, 36, 2, 59, 37],
84 | [4, 46, 20, 6, 47, 21],
85 | [7, 42, 14, 4, 43, 15],
86 |
87 | // 13
88 | [4, 133, 107],
89 | [8, 59, 37, 1, 60, 38],
90 | [8, 44, 20, 4, 45, 21],
91 | [12, 33, 11, 4, 34, 12],
92 |
93 | // 14
94 | [3, 145, 115, 1, 146, 116],
95 | [4, 64, 40, 5, 65, 41],
96 | [11, 36, 16, 5, 37, 17],
97 | [11, 36, 12, 5, 37, 13],
98 |
99 | // 15
100 | [5, 109, 87, 1, 110, 88],
101 | [5, 65, 41, 5, 66, 42],
102 | [5, 54, 24, 7, 55, 25],
103 | [11, 36, 12],
104 |
105 | // 16
106 | [5, 122, 98, 1, 123, 99],
107 | [7, 73, 45, 3, 74, 46],
108 | [15, 43, 19, 2, 44, 20],
109 | [3, 45, 15, 13, 46, 16],
110 |
111 | // 17
112 | [1, 135, 107, 5, 136, 108],
113 | [10, 74, 46, 1, 75, 47],
114 | [1, 50, 22, 15, 51, 23],
115 | [2, 42, 14, 17, 43, 15],
116 |
117 | // 18
118 | [5, 150, 120, 1, 151, 121],
119 | [9, 69, 43, 4, 70, 44],
120 | [17, 50, 22, 1, 51, 23],
121 | [2, 42, 14, 19, 43, 15],
122 |
123 | // 19
124 | [3, 141, 113, 4, 142, 114],
125 | [3, 70, 44, 11, 71, 45],
126 | [17, 47, 21, 4, 48, 22],
127 | [9, 39, 13, 16, 40, 14],
128 |
129 | // 20
130 | [3, 135, 107, 5, 136, 108],
131 | [3, 67, 41, 13, 68, 42],
132 | [15, 54, 24, 5, 55, 25],
133 | [15, 43, 15, 10, 44, 16],
134 |
135 | // 21
136 | [4, 144, 116, 4, 145, 117],
137 | [17, 68, 42],
138 | [17, 50, 22, 6, 51, 23],
139 | [19, 46, 16, 6, 47, 17],
140 |
141 | // 22
142 | [2, 139, 111, 7, 140, 112],
143 | [17, 74, 46],
144 | [7, 54, 24, 16, 55, 25],
145 | [34, 37, 13],
146 |
147 | // 23
148 | [4, 151, 121, 5, 152, 122],
149 | [4, 75, 47, 14, 76, 48],
150 | [11, 54, 24, 14, 55, 25],
151 | [16, 45, 15, 14, 46, 16],
152 |
153 | // 24
154 | [6, 147, 117, 4, 148, 118],
155 | [6, 73, 45, 14, 74, 46],
156 | [11, 54, 24, 16, 55, 25],
157 | [30, 46, 16, 2, 47, 17],
158 |
159 | // 25
160 | [8, 132, 106, 4, 133, 107],
161 | [8, 75, 47, 13, 76, 48],
162 | [7, 54, 24, 22, 55, 25],
163 | [22, 45, 15, 13, 46, 16],
164 |
165 | // 26
166 | [10, 142, 114, 2, 143, 115],
167 | [19, 74, 46, 4, 75, 47],
168 | [28, 50, 22, 6, 51, 23],
169 | [33, 46, 16, 4, 47, 17],
170 |
171 | // 27
172 | [8, 152, 122, 4, 153, 123],
173 | [22, 73, 45, 3, 74, 46],
174 | [8, 53, 23, 26, 54, 24],
175 | [12, 45, 15, 28, 46, 16],
176 |
177 | // 28
178 | [3, 147, 117, 10, 148, 118],
179 | [3, 73, 45, 23, 74, 46],
180 | [4, 54, 24, 31, 55, 25],
181 | [11, 45, 15, 31, 46, 16],
182 |
183 | // 29
184 | [7, 146, 116, 7, 147, 117],
185 | [21, 73, 45, 7, 74, 46],
186 | [1, 53, 23, 37, 54, 24],
187 | [19, 45, 15, 26, 46, 16],
188 |
189 | // 30
190 | [5, 145, 115, 10, 146, 116],
191 | [19, 75, 47, 10, 76, 48],
192 | [15, 54, 24, 25, 55, 25],
193 | [23, 45, 15, 25, 46, 16],
194 |
195 | // 31
196 | [13, 145, 115, 3, 146, 116],
197 | [2, 74, 46, 29, 75, 47],
198 | [42, 54, 24, 1, 55, 25],
199 | [23, 45, 15, 28, 46, 16],
200 |
201 | // 32
202 | [17, 145, 115],
203 | [10, 74, 46, 23, 75, 47],
204 | [10, 54, 24, 35, 55, 25],
205 | [19, 45, 15, 35, 46, 16],
206 |
207 | // 33
208 | [17, 145, 115, 1, 146, 116],
209 | [14, 74, 46, 21, 75, 47],
210 | [29, 54, 24, 19, 55, 25],
211 | [11, 45, 15, 46, 46, 16],
212 |
213 | // 34
214 | [13, 145, 115, 6, 146, 116],
215 | [14, 74, 46, 23, 75, 47],
216 | [44, 54, 24, 7, 55, 25],
217 | [59, 46, 16, 1, 47, 17],
218 |
219 | // 35
220 | [12, 151, 121, 7, 152, 122],
221 | [12, 75, 47, 26, 76, 48],
222 | [39, 54, 24, 14, 55, 25],
223 | [22, 45, 15, 41, 46, 16],
224 |
225 | // 36
226 | [6, 151, 121, 14, 152, 122],
227 | [6, 75, 47, 34, 76, 48],
228 | [46, 54, 24, 10, 55, 25],
229 | [2, 45, 15, 64, 46, 16],
230 |
231 | // 37
232 | [17, 152, 122, 4, 153, 123],
233 | [29, 74, 46, 14, 75, 47],
234 | [49, 54, 24, 10, 55, 25],
235 | [24, 45, 15, 46, 46, 16],
236 |
237 | // 38
238 | [4, 152, 122, 18, 153, 123],
239 | [13, 74, 46, 32, 75, 47],
240 | [48, 54, 24, 14, 55, 25],
241 | [42, 45, 15, 32, 46, 16],
242 |
243 | // 39
244 | [20, 147, 117, 4, 148, 118],
245 | [40, 75, 47, 7, 76, 48],
246 | [43, 54, 24, 22, 55, 25],
247 | [10, 45, 15, 67, 46, 16],
248 |
249 | // 40
250 | [19, 148, 118, 6, 149, 119],
251 | [18, 75, 47, 31, 76, 48],
252 | [34, 54, 24, 34, 55, 25],
253 | [20, 45, 15, 61, 46, 16]
254 | ];
255 |
256 | QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
257 |
258 | var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
259 |
260 | if (rsBlock === undefined) {
261 | throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
262 | }
263 |
264 | var length = rsBlock.length / 3;
265 |
266 | var list = [];
267 |
268 | for (var i = 0; i < length; i++) {
269 |
270 | var count = rsBlock[i * 3 + 0];
271 | var totalCount = rsBlock[i * 3 + 1];
272 | var dataCount = rsBlock[i * 3 + 2];
273 |
274 | for (var j = 0; j < count; j++) {
275 | list.push(new QRRSBlock(totalCount, dataCount) );
276 | }
277 | }
278 |
279 | return list;
280 | };
281 |
282 | QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
283 |
284 | switch(errorCorrectLevel) {
285 | case QRErrorCorrectLevel.L :
286 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
287 | case QRErrorCorrectLevel.M :
288 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
289 | case QRErrorCorrectLevel.Q :
290 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
291 | case QRErrorCorrectLevel.H :
292 | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
293 | default :
294 | return undefined;
295 | }
296 | };
297 |
298 | module.exports = QRRSBlock;
299 |
--------------------------------------------------------------------------------
/bin/algoqrcode.cjs:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | const QRCode = require("qrcode-svg")
3 | const QRCodeTerminal = require("../src/terminal.cjs")
4 | const yargs = require('yargs');
5 |
6 |
7 | /**
8 | *
9 | * @function
10 | * @name save
11 | * @desc Saves an generated Algorand QR Code into image file
12 | * @param {Blob} file
13 | * @param {*} options
14 | * @return {*}
15 | */
16 | function save(file, options) {
17 | return new QRCode(options).save(file, function (err, data) {
18 | if (err) {
19 | console.error('Error:', err.message)
20 | process.exit(1)
21 | }
22 |
23 | console.log('saved qrcode to: ' + file + '\n')
24 | })
25 | }
26 |
27 | /**
28 | *
29 | * @function
30 | * @name print
31 | * @desc prints an generated Algorand QR Code into console log
32 | * @param {Blob} file
33 | * @param {*} options
34 | * @return {*}
35 | */
36 | function handle(options) {
37 |
38 | if (options.output === 'file') {
39 |
40 | return new QRCode(options).save(options.file, function (error) {
41 | if (error) throw error;
42 | console.log("Done!");
43 | })
44 | }else if (options.output === 'svg') {
45 |
46 | return console.log(new QRCode(options).svg())
47 | } else {
48 | return QRCodeTerminal.generate(options.content, {small: true})
49 | }
50 |
51 | }
52 |
53 | /**
54 | *
55 | * @function
56 | * @name parseOptions
57 | * @desc Parses and fetches Algorand options from args
58 | * @param {Array} args
59 | * @return {*}
60 | */
61 | function parseOptions(args) {
62 | /*
63 | content: "http://github.com/",
64 | padding: 4,
65 | width: 256,
66 | height: 256,
67 | color: "#000000",
68 | background: "#ffffff",
69 | ecl: "M",
70 | */
71 | let content = "algorand://"
72 | let amount = args.amount;
73 | let wallet = args.wallet;
74 | let label = args.label;
75 | let asset = args.asset;
76 | let note = args.note;
77 | if (!!label && !!wallet) {
78 | content = "algorand://" + wallet+ "?" + "&label=" + label;
79 | } else if (!!asset && !!wallet) {
80 | if (!!note && amount > 0) {
81 | content = "algorand://" + wallet+ "?" + "&amount=" + amount + "&asset=" + asset + "¬e=" + note;
82 | } else if (amount > 0) {
83 | content = "algorand://" + wallet+ "?" + "&amount=" + amount + "&asset=" + asset;
84 | } else if (amount === 0) {
85 | content = "algorand://?" + "amount=0" + "&asset=" + asset;
86 | }
87 |
88 | } else if (!!note && !!wallet && !!amount) {
89 | content = "algorand://" + wallet+ "?" + "&amount=" + amount + "¬e=" + note;
90 | } else if ( !!wallet && !!amount){
91 | content = "algorand://" + wallet+ "?" + "&amount=" + amount;
92 | }
93 | let options = {
94 | content: content,
95 | container: "svg-viewbox",
96 | ecl: args.ecl || "H",
97 | file: args.file || "algorand-qrcode.svg",
98 | padding: args.margin || 4,
99 | width: args.width || 256,
100 | height: args.height || 256,
101 | output: args.output || "terminal",
102 | background: args.background || "#e1dede",
103 | color: args.color || "#000000"
104 | }
105 | return options
106 | }
107 |
108 | /**
109 | *
110 | * @function
111 | * @name processInputs
112 | * @desc Process CLI inputs
113 | * @param {Array} opts
114 | * @return {*}
115 | */
116 | function processInputs(opts) {
117 |
118 | if (!opts) {
119 | yargs.showHelp()
120 | process.exit(1)
121 | }
122 |
123 | return handle(parseOptions(opts))
124 | }
125 |
126 | // Instantiation of yargs with configuration to get CLI interaction up and running
127 | console.log(`
128 | _______ ______ _____ _____ ______ _______ _____ ______ _______
129 | |_____| | | ____ | | | __| |_____/ | | | | \ |______
130 | | | |_____ |_____| |_____| |____\| | \_ |_____ |_____| |_____/ |______
131 |
132 | `)
133 | var argv = yargs
134 | .detectLocale(false)
135 | .usage('Usage: $0 [options]')
136 | .option('m', {
137 | alias: 'amount',
138 | description: 'Algorand URI amount field',
139 | group: 'Algorand URI params:',
140 | type: 'number'
141 | })
142 | .option('w', {
143 | alias: 'wallet',
144 | description: 'Algorand URI destination wallet (account) address field',
145 | group: 'Algorand URI params:',
146 | type: 'string'
147 | })
148 | .option('l', {
149 | alias: 'label',
150 | description: 'Algorand URI label field',
151 | group: 'Algorand URI params:',
152 | type: 'string'
153 | })
154 | .option('a', {
155 | alias: 'asset',
156 | description: 'Algorand URI asset id field',
157 | group: 'Algorand URI params:',
158 | type: 'number'
159 | })
160 | .option('n', {
161 | alias: 'note',
162 | description: 'Algorand URI note field',
163 | group: 'Algorand URI params:',
164 | type: 'string'
165 | })
166 | .option('e', {
167 | alias: 'ecl',
168 | description: 'Error correction level',
169 | choices: ['L', 'M', 'Q', 'H'],
170 | group: 'QR Code options:'
171 | })
172 | .option('s', {
173 | alias: 'size',
174 | description: 'Image width and height (px)',
175 | group: 'Renderer options:',
176 | type: 'number'
177 | })
178 | .option('p', {
179 | alias: 'padding',
180 | description: 'QR Free padding size (px)',
181 | group: 'Renderer options:',
182 | type: 'number'
183 | })
184 | .option('b', {
185 | alias: 'background',
186 | description: 'background color',
187 | group: 'Renderer options:'
188 | })
189 | .option('c', {
190 | alias: 'color',
191 | description: 'Foreground color',
192 | group: 'Renderer options:'
193 | })
194 | .option('f', {
195 | alias: 'file',
196 | description: 'File name to save QR code SVG image',
197 | group: 'Renderer options:'
198 | })
199 | .option('o', {
200 | alias: 'output',
201 | description: `Output type: "terminal", "file" or "svg" string`,
202 | })
203 | .help('h')
204 | .alias('h', 'help')
205 | .version()
206 | .example('$0 -w "AMESZ5UX7ZJL5M6GYEHXM63OMFCPOJ23UXCQ6CVTI2HVX6WUELYIY262WI" -m 1000000 -n "This is a test transaction for QR code generator"')
207 | .example('$0 -o file -f algorand-qrcode.svg -w "AMESZ5UX7ZJL5M6GYEHXM63OMFCPOJ23UXCQ6CVTI2HVX6WUELYIY262WI" -l "Coffee Payment at StarBucks"')
208 | .example('$0 -o file -f algorand-qrcode.svg -w "AMESZ5UX7ZJL5M6GYEHXM63OMFCPOJ23UXCQ6CVTI2HVX6WUELYIY262WI" -a 1000000 -n "This is a test USDT transfer for QR code generator file save"')
209 | .parserConfiguration({ 'parse-numbers': false })
210 | .argv
211 | // Process of QR Code via command line interface has been started start
212 |
213 | processInputs(argv)
214 |
--------------------------------------------------------------------------------
/src/QRCode/QRUtil.js:
--------------------------------------------------------------------------------
1 | var QRMode = require('./QRMode');
2 | var QRPolynomial = require('./QRPolynomial');
3 | var QRMath = require('./QRMath');
4 | var QRMaskPattern = require('./QRMaskPattern');
5 |
6 | var QRUtil = {
7 |
8 | PATTERN_POSITION_TABLE : [
9 | [],
10 | [6, 18],
11 | [6, 22],
12 | [6, 26],
13 | [6, 30],
14 | [6, 34],
15 | [6, 22, 38],
16 | [6, 24, 42],
17 | [6, 26, 46],
18 | [6, 28, 50],
19 | [6, 30, 54],
20 | [6, 32, 58],
21 | [6, 34, 62],
22 | [6, 26, 46, 66],
23 | [6, 26, 48, 70],
24 | [6, 26, 50, 74],
25 | [6, 30, 54, 78],
26 | [6, 30, 56, 82],
27 | [6, 30, 58, 86],
28 | [6, 34, 62, 90],
29 | [6, 28, 50, 72, 94],
30 | [6, 26, 50, 74, 98],
31 | [6, 30, 54, 78, 102],
32 | [6, 28, 54, 80, 106],
33 | [6, 32, 58, 84, 110],
34 | [6, 30, 58, 86, 114],
35 | [6, 34, 62, 90, 118],
36 | [6, 26, 50, 74, 98, 122],
37 | [6, 30, 54, 78, 102, 126],
38 | [6, 26, 52, 78, 104, 130],
39 | [6, 30, 56, 82, 108, 134],
40 | [6, 34, 60, 86, 112, 138],
41 | [6, 30, 58, 86, 114, 142],
42 | [6, 34, 62, 90, 118, 146],
43 | [6, 30, 54, 78, 102, 126, 150],
44 | [6, 24, 50, 76, 102, 128, 154],
45 | [6, 28, 54, 80, 106, 132, 158],
46 | [6, 32, 58, 84, 110, 136, 162],
47 | [6, 26, 54, 82, 110, 138, 166],
48 | [6, 30, 58, 86, 114, 142, 170]
49 | ],
50 |
51 | G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
52 | G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
53 | G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
54 |
55 | getBCHTypeInfo : function(data) {
56 | var d = data << 10;
57 | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
58 | d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) );
59 | }
60 | return ( (data << 10) | d) ^ QRUtil.G15_MASK;
61 | },
62 |
63 | getBCHTypeNumber : function(data) {
64 | var d = data << 12;
65 | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
66 | d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) );
67 | }
68 | return (data << 12) | d;
69 | },
70 |
71 | getBCHDigit : function(data) {
72 |
73 | var digit = 0;
74 |
75 | while (data !== 0) {
76 | digit++;
77 | data >>>= 1;
78 | }
79 |
80 | return digit;
81 | },
82 |
83 | getPatternPosition : function(typeNumber) {
84 | return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
85 | },
86 |
87 | getMask : function(maskPattern, i, j) {
88 |
89 | switch (maskPattern) {
90 |
91 | case QRMaskPattern.PATTERN000 : return (i + j) % 2 === 0;
92 | case QRMaskPattern.PATTERN001 : return i % 2 === 0;
93 | case QRMaskPattern.PATTERN010 : return j % 3 === 0;
94 | case QRMaskPattern.PATTERN011 : return (i + j) % 3 === 0;
95 | case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 === 0;
96 | case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 === 0;
97 | case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 === 0;
98 | case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 === 0;
99 |
100 | default :
101 | throw new Error("bad maskPattern:" + maskPattern);
102 | }
103 | },
104 |
105 | getErrorCorrectPolynomial : function(errorCorrectLength) {
106 |
107 | var a = new QRPolynomial([1], 0);
108 |
109 | for (var i = 0; i < errorCorrectLength; i++) {
110 | a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) );
111 | }
112 |
113 | return a;
114 | },
115 |
116 | getLengthInBits : function(mode, type) {
117 |
118 | if (1 <= type && type < 10) {
119 |
120 | // 1 - 9
121 |
122 | switch(mode) {
123 | case QRMode.MODE_NUMBER : return 10;
124 | case QRMode.MODE_ALPHA_NUM : return 9;
125 | case QRMode.MODE_8BIT_BYTE : return 8;
126 | case QRMode.MODE_KANJI : return 8;
127 | default :
128 | throw new Error("mode:" + mode);
129 | }
130 |
131 | } else if (type < 27) {
132 |
133 | // 10 - 26
134 |
135 | switch(mode) {
136 | case QRMode.MODE_NUMBER : return 12;
137 | case QRMode.MODE_ALPHA_NUM : return 11;
138 | case QRMode.MODE_8BIT_BYTE : return 16;
139 | case QRMode.MODE_KANJI : return 10;
140 | default :
141 | throw new Error("mode:" + mode);
142 | }
143 |
144 | } else if (type < 41) {
145 |
146 | // 27 - 40
147 |
148 | switch(mode) {
149 | case QRMode.MODE_NUMBER : return 14;
150 | case QRMode.MODE_ALPHA_NUM : return 13;
151 | case QRMode.MODE_8BIT_BYTE : return 16;
152 | case QRMode.MODE_KANJI : return 12;
153 | default :
154 | throw new Error("mode:" + mode);
155 | }
156 |
157 | } else {
158 | throw new Error("type:" + type);
159 | }
160 | },
161 |
162 | getLostPoint : function(qrCode) {
163 |
164 | var moduleCount = qrCode.getModuleCount();
165 | var lostPoint = 0;
166 | var row = 0;
167 | var col = 0;
168 |
169 |
170 | // LEVEL1
171 |
172 | for (row = 0; row < moduleCount; row++) {
173 |
174 | for (col = 0; col < moduleCount; col++) {
175 |
176 | var sameCount = 0;
177 | var dark = qrCode.isDark(row, col);
178 |
179 | for (var r = -1; r <= 1; r++) {
180 |
181 | if (row + r < 0 || moduleCount <= row + r) {
182 | continue;
183 | }
184 |
185 | for (var c = -1; c <= 1; c++) {
186 |
187 | if (col + c < 0 || moduleCount <= col + c) {
188 | continue;
189 | }
190 |
191 | if (r === 0 && c === 0) {
192 | continue;
193 | }
194 |
195 | if (dark === qrCode.isDark(row + r, col + c) ) {
196 | sameCount++;
197 | }
198 | }
199 | }
200 |
201 | if (sameCount > 5) {
202 | lostPoint += (3 + sameCount - 5);
203 | }
204 | }
205 | }
206 |
207 | // LEVEL2
208 |
209 | for (row = 0; row < moduleCount - 1; row++) {
210 | for (col = 0; col < moduleCount - 1; col++) {
211 | var count = 0;
212 | if (qrCode.isDark(row, col ) ) count++;
213 | if (qrCode.isDark(row + 1, col ) ) count++;
214 | if (qrCode.isDark(row, col + 1) ) count++;
215 | if (qrCode.isDark(row + 1, col + 1) ) count++;
216 | if (count === 0 || count === 4) {
217 | lostPoint += 3;
218 | }
219 | }
220 | }
221 |
222 | // LEVEL3
223 |
224 | for (row = 0; row < moduleCount; row++) {
225 | for (col = 0; col < moduleCount - 6; col++) {
226 | if (qrCode.isDark(row, col) &&
227 | !qrCode.isDark(row, col + 1) &&
228 | qrCode.isDark(row, col + 2) &&
229 | qrCode.isDark(row, col + 3) &&
230 | qrCode.isDark(row, col + 4) &&
231 | !qrCode.isDark(row, col + 5) &&
232 | qrCode.isDark(row, col + 6) ) {
233 | lostPoint += 40;
234 | }
235 | }
236 | }
237 |
238 | for (col = 0; col < moduleCount; col++) {
239 | for (row = 0; row < moduleCount - 6; row++) {
240 | if (qrCode.isDark(row, col) &&
241 | !qrCode.isDark(row + 1, col) &&
242 | qrCode.isDark(row + 2, col) &&
243 | qrCode.isDark(row + 3, col) &&
244 | qrCode.isDark(row + 4, col) &&
245 | !qrCode.isDark(row + 5, col) &&
246 | qrCode.isDark(row + 6, col) ) {
247 | lostPoint += 40;
248 | }
249 | }
250 | }
251 |
252 | // LEVEL4
253 |
254 | var darkCount = 0;
255 |
256 | for (col = 0; col < moduleCount; col++) {
257 | for (row = 0; row < moduleCount; row++) {
258 | if (qrCode.isDark(row, col) ) {
259 | darkCount++;
260 | }
261 | }
262 | }
263 |
264 | var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
265 | lostPoint += ratio * 10;
266 |
267 | return lostPoint;
268 | }
269 |
270 | };
271 |
272 | module.exports = QRUtil;
273 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [
](https://developer.algorand.org/solutions/algorand-qr-code-generator-javascript/)
2 |
3 | # Algorand QR Code Generator V3.2.0
4 | [](https://www.npmjs.com/package/algorand-qrcode) [](https://standardjs.com)
5 | [](https://github.com/emg110/algorand-qrcode/blob/master/license)
6 |
7 | New version 3 is a complete re-write of the Algorand QRCode generation tool. Simpler and more effective!
8 |
9 | Breaking changes: The way to import and some of options have changed , please consult this readme.
10 |
11 |
12 |

13 |
14 |
15 | algorand://AMESZ5UX7ZJL5M6GYEHXM63OMFCPOJ23UXCQ6CVTI2HVX6WUELYIY262WI?label=emg110@gmail.com
16 |
17 | ## Demo
18 |
19 | ### [Live Demo](https://emg110.github.io/algorandqrcode/)
20 |
21 | ## Links
22 |
23 | ### [Algorand Developers Portal Publication](https://developer.algorand.org/solutions/algorand-qr-code-generator-javascript/)
24 |
25 | ### [Algorand Dev Hours Presentation](https://cutt.ly/SnkO7Xl)
26 |
27 | ### [Algorand Dev Hours Presentation Video on YouTube](https://www.youtube.com/watch?v=RzP3y42Lf4o)
28 |
29 |
30 | ## News
31 |
32 | > ## Version 3.2.0 is now here!
33 |
34 | > ### Now completely supports any modern web framework
35 |
36 | > ### Modern JS Module in both Node and Browser
37 |
38 |
39 |
40 | ## Technical notes
41 |
42 | - Amount is in MicroAlgos
43 |
44 | - Algorand URI reference specification: [Algorand payment prompts specification](https://developer.algorand.org/docs/reference/payment_prompts/).
45 |
46 | - Requires NodeJS version later than 10.
47 |
48 |
49 |
50 | ## Table of contents
51 |
52 |
53 | - [Highlights](#highlights)
54 | - [Algorand URI's ABNF Grammar](#algorand-uri-abnf-grammar)
55 | - [Installation](#installation)
56 | - [Usage](#usage)
57 | - [Error correction level](#error-correction-level)
58 | - [Mentioned Trademarks](#mentioned-trademarks)
59 | - [Credits](#credits)
60 | - [License](#license)
61 |
62 |
63 |
64 | ## Highlights
65 | - Supports NodeJS and Browser.
66 | - Supports RFC 3986 and Algorand URI ABNF Grammar.
67 | - CLI utility.
68 | - Save QR code as valid SVG image or text
69 |
70 | ## Algorand URI ABNF Grammar
71 |
72 | ```javascript
73 | algorandurn = "algorand://" algorandaddress [ "?" algorandparams ]
74 | algorandaddress = *base32
75 | algorandparams = algorandparam [ "&" algorandparams ]
76 | algorandparam = [ amountparam / labelparam / noteparam / assetparam ]
77 | amountparam = "amount=" *digit
78 | labelparam = "label=" *qchar
79 | assetparam = "asset=" *digit
80 | note = "note=" *qchar
81 | ```
82 |
83 | ## Installation and use
84 |
85 |
86 | ```shell
87 | npm install --save algorand-qrcode
88 | ```
89 | and then
90 |
91 | ```shell
92 | import algoqrcode from "algorand-qrcode/lib/bundle.min.js"
93 | ```
94 |
95 | or, install it globally to use `qrcode` cli command to generate Algorand URI qrcode images in your terminal.
96 |
97 | ```shell
98 | npm install -g algorand-qrcode
99 | ```
100 | and then
101 |
102 | ```shell
103 | algoqrcode [options]
104 | ```
105 |
106 | ## Usage
107 |
108 | ### Browser and Frameworks (react...) use
109 |
110 | ```javascript
111 | import algoqrcode from "algorand-qrcode/lib/bundle.min.js";
112 | const MyQrCodeComponent = (props)=>{
113 | let qrcode = algoqrcode({wallet:props.wallet, label:props.label})
114 | let scg = qrcode.svg()
115 | return svg
116 | }
117 |
118 |
119 | ```
120 |
121 | ### CLI
122 |
123 | ```
124 | Usage: algoqrcode [options]
125 |
126 | Algorand options:
127 | -m, --amount Amount (in Micro Algos) of Algorand transaction [number]
128 | -w, --wallet Destination Wallet address (Algorand account address) [string]
129 | -l, --label Label of Algorand transaction [string]
130 | -a, --asset Algorand asset id (in case of Algorand ASA transfer) [string]
131 | -n, --note note [string]
132 |
133 | QR Code options:
134 |
135 | -e, --ecl Error correction level [choices: "L", "M", "Q", "H"]
136 |
137 |
138 |
139 | Renderer options:
140 | -o, --output Output type [choices: "file", "svg", "terminal"]
141 | -w, --wallet Destination wallet [number]
142 | -p, --padding Padding around QRcode [number]
143 | -b, --background Light color [string]
144 | -c, --color Dark color [string]
145 | -s, --size QRcode image width and height (px) [number]
146 | -f, --file Output file [string]
147 |
148 |
149 | Options:
150 |
151 | -h, --help Show help [boolean]
152 | --version Show version number [boolean]
153 |
154 | Examples:
155 | - Send 1 Algo transaction:
156 | algoqrcode -w "AMESZ5UX7ZJL5M6GYEHXM63OMFCPOJ23UXCQ6CVTI2HVX6WUELYIY262WI" -m 1000000 -s 128 -n "This is an Algo payment transaction QR Code"
157 |
158 | - Save Algorand contact label as svg image:
159 | algoqrcode -w "AMESZ5UX7ZJL5M6GYEHXM63OMFCPOJ23UXCQ6CVTI2HVX6WUELYIY262WI" -l "emg110@gmail.com" -o file -f sample.svg
160 |
161 | ```
162 |
163 |
164 | ### NodeJS
165 | Import the module `algorand-qrcode` for your NodeJS module
166 |
167 | ```javascript
168 | import algoqrcode from 'algorand-qrcode'
169 | let qrcode = algoqrcode({
170 | wallet: "AMESZ5UX7ZJL5M6GYEHXM63OMFCPOJ23UXCQ6CVTI2HVX6WUELYIY262WI",
171 | label: "Test Label",
172 | output: "svg",
173 | size:256
174 | })
175 | let svg = qrcode.svg()
176 | console.log(svg)
177 | ```
178 |
179 | ## Error correction level
180 | Error correction capability allows to successfully scan a QR Code even if the symbol is dirty or damaged.
181 | Four levels are available to choose according to the operating environment.
182 |
183 | Higher levels offer a better error resistance but reduce the symbol's capacity.
184 | If the chances that the QR Code symbol may be corrupted are low (for example if it is showed through a monitor)
185 | is possible to safely use a low error level such as `Low` or `Medium`.
186 |
187 | Possible levels are shown below:
188 |
189 | | Level | Error resistance |
190 | |------------------|:----------------:|
191 | | **L** (Low) | **~7%** |
192 | | **M** (Medium) | **~15%** |
193 | | **Q** (Quartile) | **~25%** |
194 | | **H** (High) | **~30%** |
195 |
196 | The percentage indicates the maximum amount of damaged surface after which the symbol becomes unreadable.
197 |
198 | Error level can be set through `options.ecl` property.
199 | If not specified, the default value is `M`.
200 |
201 |
202 |
203 | #### QR Code options
204 |
205 |
206 | ##### `errorCorrectionLevel`
207 | Type: `String`
208 | Default: `M`
209 |
210 | Error correction level.
211 | Possible values are `low, medium, quartile, high` or `L, M, Q, H`.
212 |
213 |
214 | #### Algorand URI params
215 |
216 | ##### `wallet`
217 | Type: `String`
218 |
219 | Wallet address for Algorand transaction.
220 |
221 | ##### `amount`
222 | Type: `Number`
223 |
224 | Amount of Algorand transaction in MicroAlgos or Standard Asset Unit.
225 |
226 | ##### `label`
227 | Type: `String`
228 |
229 | Label of Algorand transaction.
230 |
231 | ##### `asset`
232 | Type: `String`
233 |
234 | Asset Id of Algorand transaction if used. If not specified , Algo will be used as fungible token.
235 |
236 | ##### `note`
237 | Type: `String`
238 |
239 | note field content of Algorand transaction.
240 |
241 |
242 | #### Renderers options
243 |
244 | ##### `ecl`
245 | Type: `String`
246 | Default: `M`
247 |
248 | Define the error correction level.
249 |
250 | ##### `padding`
251 | Type: `Number`
252 | Default: `5`
253 |
254 | Define how much wide the quiet zone should be.
255 |
256 | ##### `size`
257 | Type: `Number`
258 | Default: `128`
259 |
260 | Width and height.
261 |
262 |
263 | ##### `color`
264 | Type: `String`
265 | Default: `#000000ff`
266 |
267 | Color of dark module. Value must be in hex format (RGBA).
268 | Note: dark color should always be darker than `color.light`.
269 |
270 | ##### `background`
271 | Type: `String`
272 | Default: `#ffffffff`
273 |
274 | Color of light module. Value must be in hex format (RGBA).
275 |
276 |
277 | ## License
278 | [MIT](https://github.com/emg110/algorand-qrcode/blob/master/license)
279 |
280 |
281 | ## Credits
282 | > Special appreciations to [Sheghzo](https://github.com/sheghzo/).
283 |
284 |
285 |
286 | > The idea for this lib was inspired by: Algorand developers portal Article [Payment Prompts with Algorand Mobile Wallet](https://developer.algorand.org/articles/payment-prompts-with-algorand-mobile-wallet/ ) ,from Jason Paulos.
287 |
288 |
289 | ## Mentioned Trademarks
290 | "QR Code" curtsey of :
291 | [
](https://www.denso-wave.com)
292 |
293 |
294 | "Algorand" curtsey of:
295 | [
](https://algorand.com)
296 |
297 |
--------------------------------------------------------------------------------
/src/QRCode/index.js:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | // QRCode for JavaScript
3 | //
4 | // Copyright (c) 2009 Kazuhiko Arase
5 | //
6 | // URL: http://www.d-project.com/
7 | //
8 | // Licensed under the MIT license:
9 | // http://www.opensource.org/licenses/mit-license.php
10 | //
11 | // The word "QR Code" is registered trademark of
12 | // DENSO WAVE INCORPORATED
13 | // http://www.denso-wave.com/qrcode/faqpatent-e.html
14 | //
15 | //---------------------------------------------------------------------
16 | // Modified to work in node for this project (and some refactoring)
17 | //---------------------------------------------------------------------
18 |
19 | var QR8bitByte = require('./QR8bitByte');
20 | var QRUtil = require('./QRUtil');
21 | var QRPolynomial = require('./QRPolynomial');
22 | var QRRSBlock = require('./QRRSBlock');
23 | var QRBitBuffer = require('./QRBitBuffer');
24 |
25 | function QRCode(typeNumber, errorCorrectLevel) {
26 | this.typeNumber = typeNumber;
27 | this.errorCorrectLevel = errorCorrectLevel;
28 | this.modules = null;
29 | this.moduleCount = 0;
30 | this.dataCache = null;
31 | this.dataList = [];
32 | }
33 |
34 | QRCode.prototype = {
35 |
36 | addData : function(data) {
37 | var newData = new QR8bitByte(data);
38 | this.dataList.push(newData);
39 | this.dataCache = null;
40 | },
41 |
42 | isDark : function(row, col) {
43 | if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
44 | throw new Error(row + "," + col);
45 | }
46 | return this.modules[row][col];
47 | },
48 |
49 | getModuleCount : function() {
50 | return this.moduleCount;
51 | },
52 |
53 | make : function() {
54 | // Calculate automatically typeNumber if provided is < 1
55 | if (this.typeNumber < 1 ){
56 | var typeNumber = 1;
57 | for (typeNumber = 1; typeNumber < 40; typeNumber++) {
58 | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
59 |
60 | var buffer = new QRBitBuffer();
61 | var totalDataCount = 0;
62 | for (var i = 0; i < rsBlocks.length; i++) {
63 | totalDataCount += rsBlocks[i].dataCount;
64 | }
65 |
66 | for (var x = 0; x < this.dataList.length; x++) {
67 | var data = this.dataList[x];
68 | buffer.put(data.mode, 4);
69 | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) );
70 | data.write(buffer);
71 | }
72 | if (buffer.getLengthInBits() <= totalDataCount * 8)
73 | break;
74 | }
75 | this.typeNumber = typeNumber;
76 | }
77 | this.makeImpl(false, this.getBestMaskPattern() );
78 | },
79 |
80 | makeImpl : function(test, maskPattern) {
81 |
82 | this.moduleCount = this.typeNumber * 4 + 17;
83 | this.modules = new Array(this.moduleCount);
84 |
85 | for (var row = 0; row < this.moduleCount; row++) {
86 |
87 | this.modules[row] = new Array(this.moduleCount);
88 |
89 | for (var col = 0; col < this.moduleCount; col++) {
90 | this.modules[row][col] = null;//(col + row) % 3;
91 | }
92 | }
93 |
94 | this.setupPositionProbePattern(0, 0);
95 | this.setupPositionProbePattern(this.moduleCount - 7, 0);
96 | this.setupPositionProbePattern(0, this.moduleCount - 7);
97 | this.setupPositionAdjustPattern();
98 | this.setupTimingPattern();
99 | this.setupTypeInfo(test, maskPattern);
100 |
101 | if (this.typeNumber >= 7) {
102 | this.setupTypeNumber(test);
103 | }
104 |
105 | if (this.dataCache === null) {
106 | this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
107 | }
108 |
109 | this.mapData(this.dataCache, maskPattern);
110 | },
111 |
112 | setupPositionProbePattern : function(row, col) {
113 |
114 | for (var r = -1; r <= 7; r++) {
115 |
116 | if (row + r <= -1 || this.moduleCount <= row + r) continue;
117 |
118 | for (var c = -1; c <= 7; c++) {
119 |
120 | if (col + c <= -1 || this.moduleCount <= col + c) continue;
121 |
122 | if ( (0 <= r && r <= 6 && (c === 0 || c === 6) ) ||
123 | (0 <= c && c <= 6 && (r === 0 || r === 6) ) ||
124 | (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
125 | this.modules[row + r][col + c] = true;
126 | } else {
127 | this.modules[row + r][col + c] = false;
128 | }
129 | }
130 | }
131 | },
132 |
133 | getBestMaskPattern : function() {
134 |
135 | var minLostPoint = 0;
136 | var pattern = 0;
137 |
138 | for (var i = 0; i < 8; i++) {
139 |
140 | this.makeImpl(true, i);
141 |
142 | var lostPoint = QRUtil.getLostPoint(this);
143 |
144 | if (i === 0 || minLostPoint > lostPoint) {
145 | minLostPoint = lostPoint;
146 | pattern = i;
147 | }
148 | }
149 |
150 | return pattern;
151 | },
152 |
153 | createMovieClip : function(target_mc, instance_name, depth) {
154 |
155 | var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
156 | var cs = 1;
157 |
158 | this.make();
159 |
160 | for (var row = 0; row < this.modules.length; row++) {
161 |
162 | var y = row * cs;
163 |
164 | for (var col = 0; col < this.modules[row].length; col++) {
165 |
166 | var x = col * cs;
167 | var dark = this.modules[row][col];
168 |
169 | if (dark) {
170 | qr_mc.beginFill(0, 100);
171 | qr_mc.moveTo(x, y);
172 | qr_mc.lineTo(x + cs, y);
173 | qr_mc.lineTo(x + cs, y + cs);
174 | qr_mc.lineTo(x, y + cs);
175 | qr_mc.endFill();
176 | }
177 | }
178 | }
179 |
180 | return qr_mc;
181 | },
182 |
183 | setupTimingPattern : function() {
184 |
185 | for (var r = 8; r < this.moduleCount - 8; r++) {
186 | if (this.modules[r][6] !== null) {
187 | continue;
188 | }
189 | this.modules[r][6] = (r % 2 === 0);
190 | }
191 |
192 | for (var c = 8; c < this.moduleCount - 8; c++) {
193 | if (this.modules[6][c] !== null) {
194 | continue;
195 | }
196 | this.modules[6][c] = (c % 2 === 0);
197 | }
198 | },
199 |
200 | setupPositionAdjustPattern : function() {
201 |
202 | var pos = QRUtil.getPatternPosition(this.typeNumber);
203 |
204 | for (var i = 0; i < pos.length; i++) {
205 |
206 | for (var j = 0; j < pos.length; j++) {
207 |
208 | var row = pos[i];
209 | var col = pos[j];
210 |
211 | if (this.modules[row][col] !== null) {
212 | continue;
213 | }
214 |
215 | for (var r = -2; r <= 2; r++) {
216 |
217 | for (var c = -2; c <= 2; c++) {
218 |
219 | if (Math.abs(r) === 2 ||
220 | Math.abs(c) === 2 ||
221 | (r === 0 && c === 0) ) {
222 | this.modules[row + r][col + c] = true;
223 | } else {
224 | this.modules[row + r][col + c] = false;
225 | }
226 | }
227 | }
228 | }
229 | }
230 | },
231 |
232 | setupTypeNumber : function(test) {
233 |
234 | var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
235 | var mod;
236 |
237 | for (var i = 0; i < 18; i++) {
238 | mod = (!test && ( (bits >> i) & 1) === 1);
239 | this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
240 | }
241 |
242 | for (var x = 0; x < 18; x++) {
243 | mod = (!test && ( (bits >> x) & 1) === 1);
244 | this.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod;
245 | }
246 | },
247 |
248 | setupTypeInfo : function(test, maskPattern) {
249 |
250 | var data = (this.errorCorrectLevel << 3) | maskPattern;
251 | var bits = QRUtil.getBCHTypeInfo(data);
252 | var mod;
253 |
254 | // vertical
255 | for (var v = 0; v < 15; v++) {
256 |
257 | mod = (!test && ( (bits >> v) & 1) === 1);
258 |
259 | if (v < 6) {
260 | this.modules[v][8] = mod;
261 | } else if (v < 8) {
262 | this.modules[v + 1][8] = mod;
263 | } else {
264 | this.modules[this.moduleCount - 15 + v][8] = mod;
265 | }
266 | }
267 |
268 | // horizontal
269 | for (var h = 0; h < 15; h++) {
270 |
271 | mod = (!test && ( (bits >> h) & 1) === 1);
272 |
273 | if (h < 8) {
274 | this.modules[8][this.moduleCount - h - 1] = mod;
275 | } else if (h < 9) {
276 | this.modules[8][15 - h - 1 + 1] = mod;
277 | } else {
278 | this.modules[8][15 - h - 1] = mod;
279 | }
280 | }
281 |
282 | // fixed module
283 | this.modules[this.moduleCount - 8][8] = (!test);
284 |
285 | },
286 |
287 | mapData : function(data, maskPattern) {
288 |
289 | var inc = -1;
290 | var row = this.moduleCount - 1;
291 | var bitIndex = 7;
292 | var byteIndex = 0;
293 |
294 | for (var col = this.moduleCount - 1; col > 0; col -= 2) {
295 |
296 | if (col === 6) col--;
297 |
298 | while (true) {
299 |
300 | for (var c = 0; c < 2; c++) {
301 |
302 | if (this.modules[row][col - c] === null) {
303 |
304 | var dark = false;
305 |
306 | if (byteIndex < data.length) {
307 | dark = ( ( (data[byteIndex] >>> bitIndex) & 1) === 1);
308 | }
309 |
310 | var mask = QRUtil.getMask(maskPattern, row, col - c);
311 |
312 | if (mask) {
313 | dark = !dark;
314 | }
315 |
316 | this.modules[row][col - c] = dark;
317 | bitIndex--;
318 |
319 | if (bitIndex === -1) {
320 | byteIndex++;
321 | bitIndex = 7;
322 | }
323 | }
324 | }
325 |
326 | row += inc;
327 |
328 | if (row < 0 || this.moduleCount <= row) {
329 | row -= inc;
330 | inc = -inc;
331 | break;
332 | }
333 | }
334 | }
335 |
336 | }
337 |
338 | };
339 |
340 | QRCode.PAD0 = 0xEC;
341 | QRCode.PAD1 = 0x11;
342 |
343 | QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
344 |
345 | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
346 |
347 | var buffer = new QRBitBuffer();
348 |
349 | for (var i = 0; i < dataList.length; i++) {
350 | var data = dataList[i];
351 | buffer.put(data.mode, 4);
352 | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) );
353 | data.write(buffer);
354 | }
355 |
356 | // calc num max data.
357 | var totalDataCount = 0;
358 | for (var x = 0; x < rsBlocks.length; x++) {
359 | totalDataCount += rsBlocks[x].dataCount;
360 | }
361 |
362 | if (buffer.getLengthInBits() > totalDataCount * 8) {
363 | throw new Error("code length overflow. (" +
364 | buffer.getLengthInBits() +
365 | ">" +
366 | totalDataCount * 8 +
367 | ")");
368 | }
369 |
370 | // end code
371 | if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
372 | buffer.put(0, 4);
373 | }
374 |
375 | // padding
376 | while (buffer.getLengthInBits() % 8 !== 0) {
377 | buffer.putBit(false);
378 | }
379 |
380 | // padding
381 | while (true) {
382 |
383 | if (buffer.getLengthInBits() >= totalDataCount * 8) {
384 | break;
385 | }
386 | buffer.put(QRCode.PAD0, 8);
387 |
388 | if (buffer.getLengthInBits() >= totalDataCount * 8) {
389 | break;
390 | }
391 | buffer.put(QRCode.PAD1, 8);
392 | }
393 |
394 | return QRCode.createBytes(buffer, rsBlocks);
395 | };
396 |
397 | QRCode.createBytes = function(buffer, rsBlocks) {
398 |
399 | var offset = 0;
400 |
401 | var maxDcCount = 0;
402 | var maxEcCount = 0;
403 |
404 | var dcdata = new Array(rsBlocks.length);
405 | var ecdata = new Array(rsBlocks.length);
406 |
407 | for (var r = 0; r < rsBlocks.length; r++) {
408 |
409 | var dcCount = rsBlocks[r].dataCount;
410 | var ecCount = rsBlocks[r].totalCount - dcCount;
411 |
412 | maxDcCount = Math.max(maxDcCount, dcCount);
413 | maxEcCount = Math.max(maxEcCount, ecCount);
414 |
415 | dcdata[r] = new Array(dcCount);
416 |
417 | for (var i = 0; i < dcdata[r].length; i++) {
418 | dcdata[r][i] = 0xff & buffer.buffer[i + offset];
419 | }
420 | offset += dcCount;
421 |
422 | var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
423 | var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
424 |
425 | var modPoly = rawPoly.mod(rsPoly);
426 | ecdata[r] = new Array(rsPoly.getLength() - 1);
427 | for (var x = 0; x < ecdata[r].length; x++) {
428 | var modIndex = x + modPoly.getLength() - ecdata[r].length;
429 | ecdata[r][x] = (modIndex >= 0)? modPoly.get(modIndex) : 0;
430 | }
431 |
432 | }
433 |
434 | var totalCodeCount = 0;
435 | for (var y = 0; y < rsBlocks.length; y++) {
436 | totalCodeCount += rsBlocks[y].totalCount;
437 | }
438 |
439 | var data = new Array(totalCodeCount);
440 | var index = 0;
441 |
442 | for (var z = 0; z < maxDcCount; z++) {
443 | for (var s = 0; s < rsBlocks.length; s++) {
444 | if (z < dcdata[s].length) {
445 | data[index++] = dcdata[s][z];
446 | }
447 | }
448 | }
449 |
450 | for (var xx = 0; xx < maxEcCount; xx++) {
451 | for (var t = 0; t < rsBlocks.length; t++) {
452 | if (xx < ecdata[t].length) {
453 | data[index++] = ecdata[t][xx];
454 | }
455 | }
456 | }
457 |
458 | return data;
459 |
460 | };
461 |
462 | module.exports = QRCode;
463 |
--------------------------------------------------------------------------------
/lib/bundle.min.js:
--------------------------------------------------------------------------------
1 | var t={};!function(t){function e(t){this.mode=o.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e65536?(n[0]=240|(1835008&i)>>>18,n[1]=128|(258048&i)>>>12,n[2]=128|(4032&i)>>>6,n[3]=128|63&i):i>2048?(n[0]=224|(61440&i)>>>12,n[1]=128|(4032&i)>>>6,n[2]=128|63&i):i>128?(n[0]=192|(1984&i)>>>6,n[1]=128|63&i):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function r(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}e.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var o=-1;o<=7;o++)e+o<=-1||this.moduleCount<=e+o||(this.modules[t+r][e+o]=0<=r&&r<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=d.getLostPoint(this);(0==r||t>o)&&(t=o,e=r)}return e},createMovieClip:function(t,e,r){var o=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;r<18;r++){o=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,o=d.getBCHTypeInfo(r),n=0;n<15;n++){var i=!t&&1==(o>>n&1);n<6?this.modules[n][8]=i:n<8?this.modules[n+1][8]=i:this.modules[this.moduleCount-15+n][8]=i}for(n=0;n<15;n++){i=!t&&1==(o>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=i:n<9?this.modules[8][15-n-1+1]=i:this.modules[8][15-n-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,s=this.moduleCount-1;s>0;s-=2)for(6==s&&s--;;){for(var a=0;a<2;a++)if(null==this.modules[o][s-a]){var u=!1;i>>n&1)),d.getMask(e,o,s-a)&&(u=!u),this.modules[o][s-a]=u,-1==--n&&(i++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},r.PAD0=236,r.PAD1=17,r.createData=function(t,e,o){for(var n=v.getRSBlocks(t,e),i=new E,s=0;s8*u)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+8*u+")");for(i.getLengthInBits()+4<=8*u&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*u||(i.put(r.PAD0,8),i.getLengthInBits()>=8*u));)i.put(r.PAD1,8);return r.createBytes(i,n)},r.createBytes=function(t,e){for(var r=0,o=0,n=0,i=new Array(e.length),s=new Array(e.length),a=0;a=0?g.get(c):0}}var m=0;for(l=0;l=0;)e^=d.G15<=0;)e^=d.G18<>>=1;return e},getPatternPosition:function(t){return d.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case i:return(e+r)%2==0;case s:return e%2==0;case a:return r%3==0;case u:return(e+r)%3==0;case h:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case l:return e*r%2+e*r%3==0;case f:return(e*r%2+e*r%3)%2==0;case g:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new p([1],0),r=0;r5&&(r+=3+i-5)}for(o=0;o=256;)t-=255;return c.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},m=0;m<8;m++)c.EXP_TABLE[m]=1<>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var L=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function w(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M"},"string"==typeof t&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0&&this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");var o=this.options.content,i=function(t,e){for(var r=function(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}(t),o=1,n=0,i=0,s=L.length;i<=s;i++){var a=L[i];if(!a)throw new Error("Content too long: expected "+n+" but got "+r);switch(e){case"L":n=a[0];break;case"M":n=a[1];break;case"Q":n=a[2];break;case"H":n=a[3];break;default:throw new Error("Unknwon error correction level: "+e)}if(r<=n)break;o++}if(o>L.length)throw new Error("Content too long");return o}(o,this.options.ecl),s=function(t){switch(t){case"L":return n.L;case"M":return n.M;case"Q":return n.Q;case"H":return n.H;default:throw new Error("Unknwon error correction level: "+t)}}(this.options.ecl);this.qrcode=new r(i,s),this.qrcode.addData(o),this.qrcode.make()}w.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;void 0===t&&(t={container:e.container||"svg"});for(var o=void 0===e.pretty||!!e.pretty,n=o?" ":"",i=o?"\r\n":"",s=e.width,a=e.height,u=r.length,h=s/(u+2*e.padding),l=a/(u+2*e.padding),f=void 0!==e.join&&!!e.join,g=void 0!==e.swap&&!!e.swap,d=void 0===e.xmlDeclaration||!!e.xmlDeclaration,c=void 0!==e.predefined&&!!e.predefined,m=c?n+''+i:"",p=n+''+i,v="",E="",L=0;L'+i:n+''+i}}f&&(v=n+'');var D="";switch(t.container){case"svg":d&&(D+=''+i),D+='";break;case"svg-viewbox":d&&(D+=''+i),D+='";break;case"g":D+=''+i,D+=m+p+v,D+="";break;default:D+=(m+p+v).replace(/^\s+/,"")}return D},w.prototype.save=function(t,e){var r=this.svg();"function"!=typeof e&&(e=function(t,e){});try{require("fs").writeFile(t,r,e)}catch(t){e(t)}},t.exports=w}({get exports(){return t},set exports(e){t=e}});var e=t,r={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o=r;function n(t){this.mode=o.MODE_8BIT_BYTE,this.data=t}n.prototype={getLength:function(){return this.data.length},write:function(t){for(var e=0;e=256;)t-=255;return s.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},a=0;a<8;a++)s.EXP_TABLE[a]=1<=0;)e^=p.G15<=0;)e^=p.G18<>>=1;return e},getPatternPosition:function(t){return p.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case m.PATTERN000:return(e+r)%2==0;case m.PATTERN001:return e%2==0;case m.PATTERN010:return r%3==0;case m.PATTERN011:return(e+r)%3==0;case m.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case m.PATTERN101:return e*r%2+e*r%3==0;case m.PATTERN110:return(e*r%2+e*r%3)%2==0;case m.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new d([1],0),r=0;r5&&(r+=3+i-5)}for(o=0;o>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var T=i,C=v,y=f,D=B,_=A;function P(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}P.prototype={addData:function(t){var e=new T(t);this.dataList.push(e),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var t=1;for(t=1;t<40;t++){for(var e=D.getRSBlocks(t,this.errorCorrectLevel),r=new _,o=0,n=0;n=7&&this.setupTypeNumber(t),null===this.dataCache&&(this.dataCache=P.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var o=-1;o<=7;o++)e+o<=-1||this.moduleCount<=e+o||(this.modules[t+r][e+o]=0<=r&&r<=6&&(0===o||6===o)||0<=o&&o<=6&&(0===r||6===r)||2<=r&&r<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=C.getLostPoint(this);(0===r||t>o)&&(t=o,e=r)}return e},createMovieClip:function(t,e,r){var o=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n>o&1),this.modules[Math.floor(o/3)][o%3+this.moduleCount-8-3]=e;for(var n=0;n<18;n++)e=!t&&1==(r>>n&1),this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=e},setupTypeInfo:function(t,e){for(var r,o=this.errorCorrectLevel<<3|e,n=C.getBCHTypeInfo(o),i=0;i<15;i++)r=!t&&1==(n>>i&1),i<6?this.modules[i][8]=r:i<8?this.modules[i+1][8]=r:this.modules[this.moduleCount-15+i][8]=r;for(var s=0;s<15;s++)r=!t&&1==(n>>s&1),s<8?this.modules[8][this.moduleCount-s-1]=r:s<9?this.modules[8][15-s-1+1]=r:this.modules[8][15-s-1]=r;this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,s=this.moduleCount-1;s>0;s-=2)for(6===s&&s--;;){for(var a=0;a<2;a++)if(null===this.modules[o][s-a]){var u=!1;i>>n&1)),C.getMask(e,o,s-a)&&(u=!u),this.modules[o][s-a]=u,-1===--n&&(i++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},P.PAD0=236,P.PAD1=17,P.createData=function(t,e,r){for(var o=D.getRSBlocks(t,e),n=new _,i=0;i8*a)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*a+")");for(n.getLengthInBits()+4<=8*a&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*a||(n.put(P.PAD0,8),n.getLengthInBits()>=8*a));)n.put(P.PAD1,8);return P.createBytes(n,o)},P.createBytes=function(t,e){for(var r=0,o=0,n=0,i=new Array(e.length),s=new Array(e.length),a=0;a=0?g.get(c):0}}for(var m=0,p=0;p0?e="algorand://"+o+"?&amount="+r+"&asset="+i+"¬e="+s:r>0?e="algorand://"+o+"?&amount="+r+"&asset="+i:0===r&&(e="algorand://?amount=0&asset="+i):s&&o&&r?e="algorand://"+o+"?&amount="+r+"¬e="+s:o&&r&&(e="algorand://"+o+"?&amount="+r),{content:e,container:"svg-viewbox",ecl:t.ecl||"H",file:t.file||"algorand-qrcode.svg",padding:t.margin||4,width:t.width||256,height:t.height||256,output:t.output||"terminal",background:t.background||"#e1dede",color:t.color||"#000000"}}x.isJsDom=j,x.isDeno=W;var q=function(t){if(F){var r=J(t);return new e(r)}if(Y){if("svg"===t.output){var o=J(t);return new e(o)}var n=J(t);return R.generate(n.content,{small:!0})}};export{q as default};
2 | //# sourceMappingURL=bundle.min.js.map
3 |
--------------------------------------------------------------------------------
/lib/bundle.min.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"bundle.min.js","sources":["../node_modules/qrcode-svg/lib/qrcode.js","../src/QRCode/QRMode.js","../src/QRCode/QR8bitByte.js","../src/QRCode/QRMath.js","../src/QRCode/QRPolynomial.js","../src/QRCode/QRUtil.js","../src/QRCode/QRMaskPattern.js","../src/QRCode/QRErrorCorrectLevel.js","../src/QRCode/QRRSBlock.js","../src/QRCode/QRBitBuffer.js","../src/QRCode/index.js","../src/terminal.cjs","../node_modules/browser-or-node/lib/index.js","../src/index.mjs"],"sourcesContent":["/**\n * @fileoverview\n * - modified davidshimjs/qrcodejs library for use in node.js\n * - Using the 'QRCode for Javascript library'\n * - Fixed dataset of 'QRCode for Javascript library' for support full-spec.\n * - this library has no dependencies.\n *\n * @version 0.9.1 (2016-02-12)\n * @author davidshimjs, papnkukn\n * @see http://www.d-project.com/\n * @see http://jeromeetienne.github.com/jquery-qrcode/\n * @see https://github.com/davidshimjs/qrcodejs\n */\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//---------------------------------------------------------------------\nfunction QR8bitByte(data) {\n this.mode = QRMode.MODE_8BIT_BYTE;\n this.data = data;\n this.parsedData = [];\n\n // Added to support UTF-8 Characters\n for (var i = 0, l = this.data.length; i < l; i++) {\n var byteArray = [];\n var code = this.data.charCodeAt(i);\n\n if (code > 0x10000) {\n byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);\n byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);\n byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);\n byteArray[3] = 0x80 | (code & 0x3F);\n } else if (code > 0x800) {\n byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);\n byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);\n byteArray[2] = 0x80 | (code & 0x3F);\n } else if (code > 0x80) {\n byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);\n byteArray[1] = 0x80 | (code & 0x3F);\n } else {\n byteArray[0] = code;\n }\n\n this.parsedData.push(byteArray);\n }\n\n this.parsedData = Array.prototype.concat.apply([], this.parsedData);\n\n if (this.parsedData.length != this.data.length) {\n this.parsedData.unshift(191);\n this.parsedData.unshift(187);\n this.parsedData.unshift(239);\n }\n}\n\nQR8bitByte.prototype = {\n getLength: function (buffer) {\n return this.parsedData.length;\n },\n write: function (buffer) {\n for (var i = 0, l = this.parsedData.length; i < l; i++) {\n buffer.put(this.parsedData[i], 8);\n }\n }\n};\n\nfunction QRCodeModel(typeNumber, errorCorrectLevel) {\n this.typeNumber = typeNumber;\n this.errorCorrectLevel = errorCorrectLevel;\n this.modules = null;\n this.moduleCount = 0;\n this.dataCache = null;\n this.dataList = [];\n}\n\nQRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+\",\"+col);}\nreturn this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);}\nif(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);}\nthis.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}\nreturn pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}\nfor(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}}\nfor(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}}\nthis.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);}\nvar mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}\nthis.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}\nrow+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error(\"code length overflow. (\"\n+buffer.getLengthInBits()\n+\">\"\n+totalDataCount*8\n+\")\");}\nif(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}\nwhile(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}\nwhile(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}\nbuffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}\nbuffer.put(QRCodeModel.PAD1,8);}\nreturn QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}}\nvar totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));}\nreturn((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));}\nreturn(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;}\nreturn digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error(\"bad maskPattern:\"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}}\nfor(var row=0;row=256){n-=255;}\nreturn QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);}\nif(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));}\nthis.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];\n\n\n/** Constructor */\nfunction QRCode(options) {\n var instance = this;\n \n //Default options\n this.options = {\n padding: 4,\n width: 256, \n height: 256,\n typeNumber: 4,\n color: \"#000000\",\n background: \"#ffffff\",\n ecl: \"M\"\n };\n \n //In case the options is string\n if (typeof options === 'string') {\n options = {\n content: options\n };\n }\n \n //Merge options\n if (options) {\n for (var i in options) {\n this.options[i] = options[i];\n }\n }\n \n if (typeof this.options.content !== 'string') {\n throw new Error(\"Expected 'content' as string!\");\n }\n \n if (this.options.content.length === 0 /* || this.options.content.length > 7089 */) {\n throw new Error(\"Expected 'content' to be non-empty!\");\n }\n \n if (!(this.options.padding >= 0)) {\n throw new Error(\"Expected 'padding' value to be non-negative!\");\n }\n \n if (!(this.options.width > 0) || !(this.options.height > 0)) {\n throw new Error(\"Expected 'width' or 'height' value to be higher than zero!\");\n }\n \n //Gets the error correction level\n function _getErrorCorrectLevel(ecl) {\n switch (ecl) {\n case \"L\":\n return QRErrorCorrectLevel.L;\n \n case \"M\":\n return QRErrorCorrectLevel.M;\n \n case \"Q\":\n return QRErrorCorrectLevel.Q;\n \n case \"H\":\n return QRErrorCorrectLevel.H;\n \n default:\n throw new Error(\"Unknwon error correction level: \" + ecl);\n }\n }\n \n //Get type number\n function _getTypeNumber(content, ecl) { \n var length = _getUTF8Length(content);\n \n var type = 1;\n var limit = 0;\n for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {\n var table = QRCodeLimitLength[i];\n if (!table) {\n throw new Error(\"Content too long: expected \" + limit + \" but got \" + length);\n }\n \n switch (ecl) {\n case \"L\":\n limit = table[0];\n break;\n \n case \"M\":\n limit = table[1];\n break;\n \n case \"Q\":\n limit = table[2];\n break;\n \n case \"H\":\n limit = table[3];\n break;\n \n default:\n throw new Error(\"Unknwon error correction level: \" + ecl);\n }\n \n if (length <= limit) {\n break;\n }\n \n type++;\n }\n \n if (type > QRCodeLimitLength.length) {\n throw new Error(\"Content too long\");\n }\n \n return type;\n }\n\n //Gets text length\n function _getUTF8Length(content) {\n var result = encodeURI(content).toString().replace(/\\%[0-9a-fA-F]{2}/g, 'a');\n return result.length + (result.length != content ? 3 : 0);\n }\n \n //Generate QR Code matrix\n var content = this.options.content;\n var type = _getTypeNumber(content, this.options.ecl);\n var ecl = _getErrorCorrectLevel(this.options.ecl);\n this.qrcode = new QRCodeModel(type, ecl);\n this.qrcode.addData(content);\n this.qrcode.make();\n}\n\n/** Generates QR Code as SVG image */\nQRCode.prototype.svg = function(opt) {\n var options = this.options || { };\n var modules = this.qrcode.modules;\n \n if (typeof opt == \"undefined\") {\n opt = { container: options.container || \"svg\" };\n }\n \n //Apply new lines and indents in SVG?\n var pretty = typeof options.pretty != \"undefined\" ? !!options.pretty : true;\n \n var indent = pretty ? ' ' : '';\n var EOL = pretty ? '\\r\\n' : '';\n var width = options.width;\n var height = options.height;\n var length = modules.length;\n var xsize = width / (length + 2 * options.padding);\n var ysize = height / (length + 2 * options.padding);\n \n //Join (union, merge) rectangles into one shape?\n var join = typeof options.join != \"undefined\" ? !!options.join : false;\n \n //Swap the X and Y modules, pull request #2\n var swap = typeof options.swap != \"undefined\" ? !!options.swap : false;\n \n //Apply declaration in SVG?\n var xmlDeclaration = typeof options.xmlDeclaration != \"undefined\" ? !!options.xmlDeclaration : true;\n \n //Populate with predefined shape instead of \"rect\" elements, thanks to @kkocdko\n var predefined = typeof options.predefined != \"undefined\" ? !!options.predefined : false;\n var defs = predefined ? indent + '' + EOL : '';\n \n //Background rectangle\n var bgrect = indent + '' + EOL;\n \n //Rectangles representing modules\n var modrect = '';\n var pathdata = '';\n\n for (var y = 0; y < length; y++) {\n for (var x = 0; x < length; x++) {\n var module = modules[x][y];\n if (module) {\n \n var px = (x * xsize + options.padding * xsize);\n var py = (y * ysize + options.padding * ysize);\n \n //Some users have had issues with the QR Code, thanks to @danioso for the solution\n if (swap) {\n var t = px;\n px = py;\n py = t;\n }\n \n if (join) {\n //Module as a part of svg path data, thanks to @danioso\n var w = xsize + px\n var h = ysize + py\n\n px = (Number.isInteger(px))? Number(px): px.toFixed(2);\n py = (Number.isInteger(py))? Number(py): py.toFixed(2);\n w = (Number.isInteger(w))? Number(w): w.toFixed(2);\n h = (Number.isInteger(h))? Number(h): h.toFixed(2);\n\n pathdata += ('M' + px + ',' + py + ' V' + h + ' H' + w + ' V' + py + ' H' + px + ' Z ');\n }\n else if (predefined) {\n //Module as a predefined shape, thanks to @kkocdko\n modrect += indent + '' + EOL;\n }\n else {\n //Module as rectangle element\n modrect += indent + '' + EOL;\n }\n }\n }\n }\n \n if (join) {\n modrect = indent + '';\n }\n\n var svg = \"\";\n switch (opt.container) {\n //Wrapped in SVG document\n case \"svg\":\n if (xmlDeclaration) {\n svg += '' + EOL;\n }\n svg += '';\n break;\n \n //Viewbox for responsive use in a browser, thanks to @danioso\n case \"svg-viewbox\":\n if (xmlDeclaration) {\n svg += '' + EOL;\n }\n svg += '';\n break;\n \n \n //Wrapped in group element \n case \"g\":\n svg += '' + EOL;\n svg += defs + bgrect + modrect;\n svg += '';\n break;\n \n //Without a container\n default:\n svg += (defs + bgrect + modrect).replace(/^\\s+/, \"\"); //Clear indents on each line\n break;\n }\n \n return svg;\n};\n\n/** Writes QR Code image to a file */\nQRCode.prototype.save = function(file, callback) {\n var data = this.svg();\n if (typeof callback != \"function\") {\n callback = function(error, result) { };\n }\n try {\n //Package 'fs' is available in node.js but not in a web browser\n var fs = require('fs');\n fs.writeFile(file, data, callback);\n }\n catch (e) {\n //Sorry, 'fs' is not available\n callback(e);\n }\n};\n\nif (typeof module != \"undefined\") {\n module.exports = QRCode;\n}\n","module.exports = {\n MODE_NUMBER : 1 << 0,\n MODE_ALPHA_NUM : 1 << 1,\n MODE_8BIT_BYTE : 1 << 2,\n MODE_KANJI : 1 << 3\n};\n","var QRMode = require('./QRMode');\n\nfunction QR8bitByte(data) {\n\tthis.mode = QRMode.MODE_8BIT_BYTE;\n\tthis.data = data;\n}\n\nQR8bitByte.prototype = {\n\n\tgetLength : function() {\n\t\treturn this.data.length;\n\t},\n\t\n\twrite : function(buffer) {\n\t\tfor (var i = 0; i < this.data.length; i++) {\n\t\t\t// not JIS ...\n\t\t\tbuffer.put(this.data.charCodeAt(i), 8);\n\t\t}\n\t}\n};\n\nmodule.exports = QR8bitByte;\n","var QRMath = {\n\n\tglog : function(n) {\n\t\n\t\tif (n < 1) {\n\t\t\tthrow new Error(\"glog(\" + n + \")\");\n\t\t}\n\t\t\n\t\treturn QRMath.LOG_TABLE[n];\n\t},\n\t\n\tgexp : function(n) {\n\t\n\t\twhile (n < 0) {\n\t\t\tn += 255;\n\t\t}\n\t\n\t\twhile (n >= 256) {\n\t\t\tn -= 255;\n\t\t}\n\t\n\t\treturn QRMath.EXP_TABLE[n];\n\t},\n\t\n\tEXP_TABLE : new Array(256),\n\t\n\tLOG_TABLE : new Array(256)\n\n};\n\t\nfor (var i = 0; i < 8; i++) {\n\tQRMath.EXP_TABLE[i] = 1 << i;\n}\nfor (var i = 8; i < 256; i++) {\n\tQRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4]\n\t\t^ QRMath.EXP_TABLE[i - 5]\n\t\t^ QRMath.EXP_TABLE[i - 6]\n\t\t^ QRMath.EXP_TABLE[i - 8];\n}\nfor (var i = 0; i < 255; i++) {\n\tQRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i;\n}\n\nmodule.exports = QRMath;\n","var QRMath = require('./QRMath');\n\nfunction QRPolynomial(num, shift) {\n\tif (num.length === undefined) {\n\t\tthrow new Error(num.length + \"/\" + shift);\n\t}\n\n\tvar offset = 0;\n\n\twhile (offset < num.length && num[offset] === 0) {\n\t\toffset++;\n\t}\n\n\tthis.num = new Array(num.length - offset + shift);\n\tfor (var i = 0; i < num.length - offset; i++) {\n\t\tthis.num[i] = num[i + offset];\n\t}\n}\n\nQRPolynomial.prototype = {\n\n\tget : function(index) {\n\t\treturn this.num[index];\n\t},\n\t\n\tgetLength : function() {\n\t\treturn this.num.length;\n\t},\n\t\n\tmultiply : function(e) {\n\t\n\t\tvar num = new Array(this.getLength() + e.getLength() - 1);\n\t\n\t\tfor (var i = 0; i < this.getLength(); i++) {\n\t\t\tfor (var j = 0; j < e.getLength(); j++) {\n\t\t\t\tnum[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) );\n\t\t\t}\n\t\t}\n\t\n\t\treturn new QRPolynomial(num, 0);\n\t},\n\t\n\tmod : function(e) {\n\t\n\t\tif (this.getLength() - e.getLength() < 0) {\n\t\t\treturn this;\n\t\t}\n\t\n\t\tvar ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) );\n\t\n\t\tvar num = new Array(this.getLength() );\n\t\t\n\t\tfor (var i = 0; i < this.getLength(); i++) {\n\t\t\tnum[i] = this.get(i);\n\t\t}\n\t\t\n\t\tfor (var x = 0; x < e.getLength(); x++) {\n\t\t\tnum[x] ^= QRMath.gexp(QRMath.glog(e.get(x) ) + ratio);\n\t\t}\n\t\n\t\t// recursive call\n\t\treturn new QRPolynomial(num, 0).mod(e);\n\t}\n};\n\nmodule.exports = QRPolynomial;\n","var QRMode = require('./QRMode');\nvar QRPolynomial = require('./QRPolynomial');\nvar QRMath = require('./QRMath');\nvar QRMaskPattern = require('./QRMaskPattern');\n\nvar QRUtil = {\n\n PATTERN_POSITION_TABLE : [\n [],\n [6, 18],\n [6, 22],\n [6, 26],\n [6, 30],\n [6, 34],\n [6, 22, 38],\n [6, 24, 42],\n [6, 26, 46],\n [6, 28, 50],\n [6, 30, 54], \n [6, 32, 58],\n [6, 34, 62],\n [6, 26, 46, 66],\n [6, 26, 48, 70],\n [6, 26, 50, 74],\n [6, 30, 54, 78],\n [6, 30, 56, 82],\n [6, 30, 58, 86],\n [6, 34, 62, 90],\n [6, 28, 50, 72, 94],\n [6, 26, 50, 74, 98],\n [6, 30, 54, 78, 102],\n [6, 28, 54, 80, 106],\n [6, 32, 58, 84, 110],\n [6, 30, 58, 86, 114],\n [6, 34, 62, 90, 118],\n [6, 26, 50, 74, 98, 122],\n [6, 30, 54, 78, 102, 126],\n [6, 26, 52, 78, 104, 130],\n [6, 30, 56, 82, 108, 134],\n [6, 34, 60, 86, 112, 138],\n [6, 30, 58, 86, 114, 142],\n [6, 34, 62, 90, 118, 146],\n [6, 30, 54, 78, 102, 126, 150],\n [6, 24, 50, 76, 102, 128, 154],\n [6, 28, 54, 80, 106, 132, 158],\n [6, 32, 58, 84, 110, 136, 162],\n [6, 26, 54, 82, 110, 138, 166],\n [6, 30, 58, 86, 114, 142, 170]\n ],\n\n G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),\n G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),\n G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),\n\n getBCHTypeInfo : function(data) {\n var d = data << 10;\n while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {\n d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) ); \n }\n return ( (data << 10) | d) ^ QRUtil.G15_MASK;\n },\n\n getBCHTypeNumber : function(data) {\n var d = data << 12;\n while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {\n d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) ); \n }\n return (data << 12) | d;\n },\n\n getBCHDigit : function(data) {\n\n var digit = 0;\n\n while (data !== 0) {\n digit++;\n data >>>= 1;\n }\n\n return digit;\n },\n\n getPatternPosition : function(typeNumber) {\n return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];\n },\n\n getMask : function(maskPattern, i, j) {\n \n switch (maskPattern) {\n \n case QRMaskPattern.PATTERN000 : return (i + j) % 2 === 0;\n case QRMaskPattern.PATTERN001 : return i % 2 === 0;\n case QRMaskPattern.PATTERN010 : return j % 3 === 0;\n case QRMaskPattern.PATTERN011 : return (i + j) % 3 === 0;\n case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 === 0;\n case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 === 0;\n case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 === 0;\n case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 === 0;\n\n default :\n throw new Error(\"bad maskPattern:\" + maskPattern);\n }\n },\n\n getErrorCorrectPolynomial : function(errorCorrectLength) {\n\n var a = new QRPolynomial([1], 0);\n\n for (var i = 0; i < errorCorrectLength; i++) {\n a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) );\n }\n\n return a;\n },\n\n getLengthInBits : function(mode, type) {\n\n if (1 <= type && type < 10) {\n\n // 1 - 9\n\n switch(mode) {\n case QRMode.MODE_NUMBER : return 10;\n case QRMode.MODE_ALPHA_NUM : return 9;\n case QRMode.MODE_8BIT_BYTE : return 8;\n case QRMode.MODE_KANJI : return 8;\n default :\n throw new Error(\"mode:\" + mode);\n }\n\n } else if (type < 27) {\n\n // 10 - 26\n\n switch(mode) {\n case QRMode.MODE_NUMBER : return 12;\n case QRMode.MODE_ALPHA_NUM : return 11;\n case QRMode.MODE_8BIT_BYTE : return 16;\n case QRMode.MODE_KANJI : return 10;\n default :\n throw new Error(\"mode:\" + mode);\n }\n\n } else if (type < 41) {\n\n // 27 - 40\n\n switch(mode) {\n case QRMode.MODE_NUMBER : return 14;\n case QRMode.MODE_ALPHA_NUM : return 13;\n case QRMode.MODE_8BIT_BYTE : return 16;\n case QRMode.MODE_KANJI : return 12;\n default :\n throw new Error(\"mode:\" + mode);\n }\n\n } else {\n throw new Error(\"type:\" + type);\n }\n },\n\n getLostPoint : function(qrCode) {\n \n var moduleCount = qrCode.getModuleCount();\n var lostPoint = 0;\n var row = 0; \n var col = 0;\n\n \n // LEVEL1\n \n for (row = 0; row < moduleCount; row++) {\n\n for (col = 0; col < moduleCount; col++) {\n\n var sameCount = 0;\n var dark = qrCode.isDark(row, col);\n\n for (var r = -1; r <= 1; r++) {\n\n if (row + r < 0 || moduleCount <= row + r) {\n continue;\n }\n\n for (var c = -1; c <= 1; c++) {\n\n if (col + c < 0 || moduleCount <= col + c) {\n continue;\n }\n\n if (r === 0 && c === 0) {\n continue;\n }\n\n if (dark === qrCode.isDark(row + r, col + c) ) {\n sameCount++;\n }\n }\n }\n\n if (sameCount > 5) {\n lostPoint += (3 + sameCount - 5);\n }\n }\n }\n\n // LEVEL2\n\n for (row = 0; row < moduleCount - 1; row++) {\n for (col = 0; col < moduleCount - 1; col++) {\n var count = 0;\n if (qrCode.isDark(row, col ) ) count++;\n if (qrCode.isDark(row + 1, col ) ) count++;\n if (qrCode.isDark(row, col + 1) ) count++;\n if (qrCode.isDark(row + 1, col + 1) ) count++;\n if (count === 0 || count === 4) {\n lostPoint += 3;\n }\n }\n }\n\n // LEVEL3\n\n for (row = 0; row < moduleCount; row++) {\n for (col = 0; col < moduleCount - 6; col++) {\n if (qrCode.isDark(row, col) && \n !qrCode.isDark(row, col + 1) && \n qrCode.isDark(row, col + 2) && \n qrCode.isDark(row, col + 3) && \n qrCode.isDark(row, col + 4) && \n !qrCode.isDark(row, col + 5) && \n qrCode.isDark(row, col + 6) ) {\n lostPoint += 40;\n }\n }\n }\n\n for (col = 0; col < moduleCount; col++) {\n for (row = 0; row < moduleCount - 6; row++) {\n if (qrCode.isDark(row, col) &&\n !qrCode.isDark(row + 1, col) &&\n qrCode.isDark(row + 2, col) &&\n qrCode.isDark(row + 3, col) &&\n qrCode.isDark(row + 4, col) &&\n !qrCode.isDark(row + 5, col) &&\n qrCode.isDark(row + 6, col) ) {\n lostPoint += 40;\n }\n }\n }\n\n // LEVEL4\n \n var darkCount = 0;\n\n for (col = 0; col < moduleCount; col++) {\n for (row = 0; row < moduleCount; row++) {\n if (qrCode.isDark(row, col) ) {\n darkCount++;\n }\n }\n }\n \n var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;\n lostPoint += ratio * 10;\n\n return lostPoint; \n }\n\n};\n\nmodule.exports = QRUtil;\n","module.exports = {\n\tPATTERN000 : 0,\n\tPATTERN001 : 1,\n\tPATTERN010 : 2,\n\tPATTERN011 : 3,\n\tPATTERN100 : 4,\n\tPATTERN101 : 5,\n\tPATTERN110 : 6,\n\tPATTERN111 : 7\n};\n","module.exports = {\n\tL : 1,\n\tM : 0,\n\tQ : 3,\n\tH : 2\n};\n\n","var QRErrorCorrectLevel = require('./QRErrorCorrectLevel');\n\nfunction QRRSBlock(totalCount, dataCount) {\n\tthis.totalCount = totalCount;\n\tthis.dataCount = dataCount;\n}\n\nQRRSBlock.RS_BLOCK_TABLE = [\n\n\t// L\n\t// M\n\t// Q\n\t// H\n\n\t// 1\n\t[1, 26, 19],\n\t[1, 26, 16],\n\t[1, 26, 13],\n\t[1, 26, 9],\n\t\n\t// 2\n\t[1, 44, 34],\n\t[1, 44, 28],\n\t[1, 44, 22],\n\t[1, 44, 16],\n\n\t// 3\n\t[1, 70, 55],\n\t[1, 70, 44],\n\t[2, 35, 17],\n\t[2, 35, 13],\n\n\t// 4\t\t\n\t[1, 100, 80],\n\t[2, 50, 32],\n\t[2, 50, 24],\n\t[4, 25, 9],\n\t\n\t// 5\n\t[1, 134, 108],\n\t[2, 67, 43],\n\t[2, 33, 15, 2, 34, 16],\n\t[2, 33, 11, 2, 34, 12],\n\t\n\t// 6\n\t[2, 86, 68],\n\t[4, 43, 27],\n\t[4, 43, 19],\n\t[4, 43, 15],\n\t\n\t// 7\t\t\n\t[2, 98, 78],\n\t[4, 49, 31],\n\t[2, 32, 14, 4, 33, 15],\n\t[4, 39, 13, 1, 40, 14],\n\t\n\t// 8\n\t[2, 121, 97],\n\t[2, 60, 38, 2, 61, 39],\n\t[4, 40, 18, 2, 41, 19],\n\t[4, 40, 14, 2, 41, 15],\n\t\n\t// 9\n\t[2, 146, 116],\n\t[3, 58, 36, 2, 59, 37],\n\t[4, 36, 16, 4, 37, 17],\n\t[4, 36, 12, 4, 37, 13],\n\t\n\t// 10\t\t\n\t[2, 86, 68, 2, 87, 69],\n\t[4, 69, 43, 1, 70, 44],\n\t[6, 43, 19, 2, 44, 20],\n\t[6, 43, 15, 2, 44, 16],\n\n\t// 11\n\t[4, 101, 81],\n\t[1, 80, 50, 4, 81, 51],\n\t[4, 50, 22, 4, 51, 23],\n\t[3, 36, 12, 8, 37, 13],\n\n\t// 12\n\t[2, 116, 92, 2, 117, 93],\n\t[6, 58, 36, 2, 59, 37],\n\t[4, 46, 20, 6, 47, 21],\n\t[7, 42, 14, 4, 43, 15],\n\n\t// 13\n\t[4, 133, 107],\n\t[8, 59, 37, 1, 60, 38],\n\t[8, 44, 20, 4, 45, 21],\n\t[12, 33, 11, 4, 34, 12],\n\n\t// 14\n\t[3, 145, 115, 1, 146, 116],\n\t[4, 64, 40, 5, 65, 41],\n\t[11, 36, 16, 5, 37, 17],\n\t[11, 36, 12, 5, 37, 13],\n\n\t// 15\n\t[5, 109, 87, 1, 110, 88],\n\t[5, 65, 41, 5, 66, 42],\n\t[5, 54, 24, 7, 55, 25],\n\t[11, 36, 12],\n\n\t// 16\n\t[5, 122, 98, 1, 123, 99],\n\t[7, 73, 45, 3, 74, 46],\n\t[15, 43, 19, 2, 44, 20],\n\t[3, 45, 15, 13, 46, 16],\n\n\t// 17\n\t[1, 135, 107, 5, 136, 108],\n\t[10, 74, 46, 1, 75, 47],\n\t[1, 50, 22, 15, 51, 23],\n\t[2, 42, 14, 17, 43, 15],\n\n\t// 18\n\t[5, 150, 120, 1, 151, 121],\n\t[9, 69, 43, 4, 70, 44],\n\t[17, 50, 22, 1, 51, 23],\n\t[2, 42, 14, 19, 43, 15],\n\n\t// 19\n\t[3, 141, 113, 4, 142, 114],\n\t[3, 70, 44, 11, 71, 45],\n\t[17, 47, 21, 4, 48, 22],\n\t[9, 39, 13, 16, 40, 14],\n\n\t// 20\n\t[3, 135, 107, 5, 136, 108],\n\t[3, 67, 41, 13, 68, 42],\n\t[15, 54, 24, 5, 55, 25],\n\t[15, 43, 15, 10, 44, 16],\n\n\t// 21\n\t[4, 144, 116, 4, 145, 117],\n\t[17, 68, 42],\n\t[17, 50, 22, 6, 51, 23],\n\t[19, 46, 16, 6, 47, 17],\n\n\t// 22\n\t[2, 139, 111, 7, 140, 112],\n\t[17, 74, 46],\n\t[7, 54, 24, 16, 55, 25],\n\t[34, 37, 13],\n\n\t// 23\n\t[4, 151, 121, 5, 152, 122],\n\t[4, 75, 47, 14, 76, 48],\n\t[11, 54, 24, 14, 55, 25],\n\t[16, 45, 15, 14, 46, 16],\n\n\t// 24\n\t[6, 147, 117, 4, 148, 118],\n\t[6, 73, 45, 14, 74, 46],\n\t[11, 54, 24, 16, 55, 25],\n\t[30, 46, 16, 2, 47, 17],\n\n\t// 25\n\t[8, 132, 106, 4, 133, 107],\n\t[8, 75, 47, 13, 76, 48],\n\t[7, 54, 24, 22, 55, 25],\n\t[22, 45, 15, 13, 46, 16],\n\n\t// 26\n\t[10, 142, 114, 2, 143, 115],\n\t[19, 74, 46, 4, 75, 47],\n\t[28, 50, 22, 6, 51, 23],\n\t[33, 46, 16, 4, 47, 17],\n\n\t// 27\n\t[8, 152, 122, 4, 153, 123],\n\t[22, 73, 45, 3, 74, 46],\n\t[8, 53, 23, 26, 54, 24],\n\t[12, 45, 15, 28, 46, 16],\n\n\t// 28\n\t[3, 147, 117, 10, 148, 118],\n\t[3, 73, 45, 23, 74, 46],\n\t[4, 54, 24, 31, 55, 25],\n\t[11, 45, 15, 31, 46, 16],\n\n\t// 29\n\t[7, 146, 116, 7, 147, 117],\n\t[21, 73, 45, 7, 74, 46],\n\t[1, 53, 23, 37, 54, 24],\n\t[19, 45, 15, 26, 46, 16],\n\n\t// 30\n\t[5, 145, 115, 10, 146, 116],\n\t[19, 75, 47, 10, 76, 48],\n\t[15, 54, 24, 25, 55, 25],\n\t[23, 45, 15, 25, 46, 16],\n\n\t// 31\n\t[13, 145, 115, 3, 146, 116],\n\t[2, 74, 46, 29, 75, 47],\n\t[42, 54, 24, 1, 55, 25],\n\t[23, 45, 15, 28, 46, 16],\n\n\t// 32\n\t[17, 145, 115],\n\t[10, 74, 46, 23, 75, 47],\n\t[10, 54, 24, 35, 55, 25],\n\t[19, 45, 15, 35, 46, 16],\n\n\t// 33\n\t[17, 145, 115, 1, 146, 116],\n\t[14, 74, 46, 21, 75, 47],\n\t[29, 54, 24, 19, 55, 25],\n\t[11, 45, 15, 46, 46, 16],\n\n\t// 34\n\t[13, 145, 115, 6, 146, 116],\n\t[14, 74, 46, 23, 75, 47],\n\t[44, 54, 24, 7, 55, 25],\n\t[59, 46, 16, 1, 47, 17],\n\n\t// 35\n\t[12, 151, 121, 7, 152, 122],\n\t[12, 75, 47, 26, 76, 48],\n\t[39, 54, 24, 14, 55, 25],\n\t[22, 45, 15, 41, 46, 16],\n\n\t// 36\n\t[6, 151, 121, 14, 152, 122],\n\t[6, 75, 47, 34, 76, 48],\n\t[46, 54, 24, 10, 55, 25],\n\t[2, 45, 15, 64, 46, 16],\n\n\t// 37\n\t[17, 152, 122, 4, 153, 123],\n\t[29, 74, 46, 14, 75, 47],\n\t[49, 54, 24, 10, 55, 25],\n\t[24, 45, 15, 46, 46, 16],\n\n\t// 38\n\t[4, 152, 122, 18, 153, 123],\n\t[13, 74, 46, 32, 75, 47],\n\t[48, 54, 24, 14, 55, 25],\n\t[42, 45, 15, 32, 46, 16],\n\n\t// 39\n\t[20, 147, 117, 4, 148, 118],\n\t[40, 75, 47, 7, 76, 48],\n\t[43, 54, 24, 22, 55, 25],\n\t[10, 45, 15, 67, 46, 16],\n\n\t// 40\n\t[19, 148, 118, 6, 149, 119],\n\t[18, 75, 47, 31, 76, 48],\n\t[34, 54, 24, 34, 55, 25],\n\t[20, 45, 15, 61, 46, 16]\n];\n\nQRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {\n\t\n\tvar rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);\n\t\n\tif (rsBlock === undefined) {\n\t\tthrow new Error(\"bad rs block @ typeNumber:\" + typeNumber + \"/errorCorrectLevel:\" + errorCorrectLevel);\n\t}\n\n\tvar length = rsBlock.length / 3;\n\t\n\tvar list = [];\n\t\n\tfor (var i = 0; i < length; i++) {\n\n\t\tvar count = rsBlock[i * 3 + 0];\n\t\tvar totalCount = rsBlock[i * 3 + 1];\n\t\tvar dataCount = rsBlock[i * 3 + 2];\n\n\t\tfor (var j = 0; j < count; j++) {\n\t\t\tlist.push(new QRRSBlock(totalCount, dataCount) );\t\n\t\t}\n\t}\n\t\n\treturn list;\n};\n\nQRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {\n\n\tswitch(errorCorrectLevel) {\n\tcase QRErrorCorrectLevel.L :\n\t\treturn QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];\n\tcase QRErrorCorrectLevel.M :\n\t\treturn QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];\n\tcase QRErrorCorrectLevel.Q :\n\t\treturn QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];\n\tcase QRErrorCorrectLevel.H :\n\t\treturn QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];\n\tdefault :\n\t\treturn undefined;\n\t}\n};\n\nmodule.exports = QRRSBlock;\n","function QRBitBuffer() {\n\tthis.buffer = [];\n\tthis.length = 0;\n}\n\nQRBitBuffer.prototype = {\n\n\tget : function(index) {\n\t\tvar bufIndex = Math.floor(index / 8);\n\t\treturn ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;\n\t},\n\t\n\tput : function(num, length) {\n\t\tfor (var i = 0; i < length; i++) {\n\t\t\tthis.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);\n\t\t}\n\t},\n\t\n\tgetLengthInBits : function() {\n\t\treturn this.length;\n\t},\n\t\n\tputBit : function(bit) {\n\t\n\t\tvar bufIndex = Math.floor(this.length / 8);\n\t\tif (this.buffer.length <= bufIndex) {\n\t\t\tthis.buffer.push(0);\n\t\t}\n\t\n\t\tif (bit) {\n\t\t\tthis.buffer[bufIndex] |= (0x80 >>> (this.length % 8) );\n\t\t}\n\t\n\t\tthis.length++;\n\t}\n};\n\nmodule.exports = QRBitBuffer;\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// Modified to work in node for this project (and some refactoring)\n//---------------------------------------------------------------------\n\nvar QR8bitByte = require('./QR8bitByte');\nvar QRUtil = require('./QRUtil');\nvar QRPolynomial = require('./QRPolynomial');\nvar QRRSBlock = require('./QRRSBlock');\nvar QRBitBuffer = require('./QRBitBuffer');\n\nfunction QRCode(typeNumber, errorCorrectLevel) {\n\tthis.typeNumber = typeNumber;\n\tthis.errorCorrectLevel = errorCorrectLevel;\n\tthis.modules = null;\n\tthis.moduleCount = 0;\n\tthis.dataCache = null;\n\tthis.dataList = [];\n}\n\nQRCode.prototype = {\n\t\n\taddData : function(data) {\n\t\tvar newData = new QR8bitByte(data);\n\t\tthis.dataList.push(newData);\n\t\tthis.dataCache = null;\n\t},\n\t\n\tisDark : function(row, col) {\n\t\tif (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {\n\t\t\tthrow new Error(row + \",\" + col);\n\t\t}\n\t\treturn this.modules[row][col];\n\t},\n\n\tgetModuleCount : function() {\n\t\treturn this.moduleCount;\n\t},\n\t\n\tmake : function() {\n\t\t// Calculate automatically typeNumber if provided is < 1\n\t\tif (this.typeNumber < 1 ){\n\t\t\tvar typeNumber = 1;\n\t\t\tfor (typeNumber = 1; typeNumber < 40; typeNumber++) {\n\t\t\t\tvar rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);\n\n\t\t\t\tvar buffer = new QRBitBuffer();\n\t\t\t\tvar totalDataCount = 0;\n\t\t\t\tfor (var i = 0; i < rsBlocks.length; i++) {\n\t\t\t\t\ttotalDataCount += rsBlocks[i].dataCount;\n\t\t\t\t}\n\n\t\t\t\tfor (var x = 0; x < this.dataList.length; x++) {\n\t\t\t\t\tvar data = this.dataList[x];\n\t\t\t\t\tbuffer.put(data.mode, 4);\n\t\t\t\t\tbuffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) );\n\t\t\t\t\tdata.write(buffer);\n\t\t\t\t}\n\t\t\t\tif (buffer.getLengthInBits() <= totalDataCount * 8)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.typeNumber = typeNumber;\n\t\t}\n\t\tthis.makeImpl(false, this.getBestMaskPattern() );\n\t},\n\t\n\tmakeImpl : function(test, maskPattern) {\n\t\t\n\t\tthis.moduleCount = this.typeNumber * 4 + 17;\n\t\tthis.modules = new Array(this.moduleCount);\n\t\t\n\t\tfor (var row = 0; row < this.moduleCount; row++) {\n\t\t\t\n\t\t\tthis.modules[row] = new Array(this.moduleCount);\n\t\t\t\n\t\t\tfor (var col = 0; col < this.moduleCount; col++) {\n\t\t\t\tthis.modules[row][col] = null;//(col + row) % 3;\n\t\t\t}\n\t\t}\n\t\n\t\tthis.setupPositionProbePattern(0, 0);\n\t\tthis.setupPositionProbePattern(this.moduleCount - 7, 0);\n\t\tthis.setupPositionProbePattern(0, this.moduleCount - 7);\n\t\tthis.setupPositionAdjustPattern();\n\t\tthis.setupTimingPattern();\n\t\tthis.setupTypeInfo(test, maskPattern);\n\t\t\n\t\tif (this.typeNumber >= 7) {\n\t\t\tthis.setupTypeNumber(test);\n\t\t}\n\t\n\t\tif (this.dataCache === null) {\n\t\t\tthis.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);\n\t\t}\n\t\n\t\tthis.mapData(this.dataCache, maskPattern);\n\t},\n\n\tsetupPositionProbePattern : function(row, col) {\n\t\t\n\t\tfor (var r = -1; r <= 7; r++) {\n\t\t\t\n\t\t\tif (row + r <= -1 || this.moduleCount <= row + r) continue;\n\t\t\t\n\t\t\tfor (var c = -1; c <= 7; c++) {\n\t\t\t\t\n\t\t\t\tif (col + c <= -1 || this.moduleCount <= col + c) continue;\n\t\t\t\t\n\t\t\t\tif ( (0 <= r && r <= 6 && (c === 0 || c === 6) ) || \n (0 <= c && c <= 6 && (r === 0 || r === 6) ) || \n (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {\n\t\t\t\t\tthis.modules[row + r][col + c] = true;\n\t\t\t\t} else {\n\t\t\t\t\tthis.modules[row + r][col + c] = false;\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\t\t\n\t},\n\t\n\tgetBestMaskPattern : function() {\n\t\n\t\tvar minLostPoint = 0;\n\t\tvar pattern = 0;\n\t\n\t\tfor (var i = 0; i < 8; i++) {\n\t\t\t\n\t\t\tthis.makeImpl(true, i);\n\t\n\t\t\tvar lostPoint = QRUtil.getLostPoint(this);\n\t\n\t\t\tif (i === 0 || minLostPoint > lostPoint) {\n\t\t\t\tminLostPoint = lostPoint;\n\t\t\t\tpattern = i;\n\t\t\t}\n\t\t}\n\t\n\t\treturn pattern;\n\t},\n\t\n\tcreateMovieClip : function(target_mc, instance_name, depth) {\n\t\n\t\tvar qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);\n\t\tvar cs = 1;\n\t\n\t\tthis.make();\n\n\t\tfor (var row = 0; row < this.modules.length; row++) {\n\t\t\t\n\t\t\tvar y = row * cs;\n\t\t\t\n\t\t\tfor (var col = 0; col < this.modules[row].length; col++) {\n\t\n\t\t\t\tvar x = col * cs;\n\t\t\t\tvar dark = this.modules[row][col];\n\t\t\t\n\t\t\t\tif (dark) {\n\t\t\t\t\tqr_mc.beginFill(0, 100);\n\t\t\t\t\tqr_mc.moveTo(x, y);\n\t\t\t\t\tqr_mc.lineTo(x + cs, y);\n\t\t\t\t\tqr_mc.lineTo(x + cs, y + cs);\n\t\t\t\t\tqr_mc.lineTo(x, y + cs);\n\t\t\t\t\tqr_mc.endFill();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn qr_mc;\n\t},\n\n\tsetupTimingPattern : function() {\n\t\t\n\t\tfor (var r = 8; r < this.moduleCount - 8; r++) {\n\t\t\tif (this.modules[r][6] !== null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.modules[r][6] = (r % 2 === 0);\n\t\t}\n\t\n\t\tfor (var c = 8; c < this.moduleCount - 8; c++) {\n\t\t\tif (this.modules[6][c] !== null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis.modules[6][c] = (c % 2 === 0);\n\t\t}\n\t},\n\t\n\tsetupPositionAdjustPattern : function() {\n\t\n\t\tvar pos = QRUtil.getPatternPosition(this.typeNumber);\n\t\t\n\t\tfor (var i = 0; i < pos.length; i++) {\n\t\t\n\t\t\tfor (var j = 0; j < pos.length; j++) {\n\t\t\t\n\t\t\t\tvar row = pos[i];\n\t\t\t\tvar col = pos[j];\n\t\t\t\t\n\t\t\t\tif (this.modules[row][col] !== null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (var r = -2; r <= 2; r++) {\n\t\t\t\t\n\t\t\t\t\tfor (var c = -2; c <= 2; c++) {\n\t\t\t\t\t\n\t\t\t\t\t\tif (Math.abs(r) === 2 || \n Math.abs(c) === 2 ||\n (r === 0 && c === 0) ) {\n\t\t\t\t\t\t\tthis.modules[row + r][col + c] = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.modules[row + r][col + c] = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\n\tsetupTypeNumber : function(test) {\n\t\n\t\tvar bits = QRUtil.getBCHTypeNumber(this.typeNumber);\n var mod;\n\t\n\t\tfor (var i = 0; i < 18; i++) {\n\t\t\tmod = (!test && ( (bits >> i) & 1) === 1);\n\t\t\tthis.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;\n\t\t}\n\t\n\t\tfor (var x = 0; x < 18; x++) {\n\t\t\tmod = (!test && ( (bits >> x) & 1) === 1);\n\t\t\tthis.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod;\n\t\t}\n\t},\n\t\n\tsetupTypeInfo : function(test, maskPattern) {\n\t\n\t\tvar data = (this.errorCorrectLevel << 3) | maskPattern;\n\t\tvar bits = QRUtil.getBCHTypeInfo(data);\n var mod;\n\t\n\t\t// vertical\t\t\n\t\tfor (var v = 0; v < 15; v++) {\n\t\n\t\t\tmod = (!test && ( (bits >> v) & 1) === 1);\n\t\n\t\t\tif (v < 6) {\n\t\t\t\tthis.modules[v][8] = mod;\n\t\t\t} else if (v < 8) {\n\t\t\t\tthis.modules[v + 1][8] = mod;\n\t\t\t} else {\n\t\t\t\tthis.modules[this.moduleCount - 15 + v][8] = mod;\n\t\t\t}\n\t\t}\n\t\n\t\t// horizontal\n\t\tfor (var h = 0; h < 15; h++) {\n\t\n\t\t\tmod = (!test && ( (bits >> h) & 1) === 1);\n\t\t\t\n\t\t\tif (h < 8) {\n\t\t\t\tthis.modules[8][this.moduleCount - h - 1] = mod;\n\t\t\t} else if (h < 9) {\n\t\t\t\tthis.modules[8][15 - h - 1 + 1] = mod;\n\t\t\t} else {\n\t\t\t\tthis.modules[8][15 - h - 1] = mod;\n\t\t\t}\n\t\t}\n\t\n\t\t// fixed module\n\t\tthis.modules[this.moduleCount - 8][8] = (!test);\n\t\n\t},\n\t\n\tmapData : function(data, maskPattern) {\n\t\t\n\t\tvar inc = -1;\n\t\tvar row = this.moduleCount - 1;\n\t\tvar bitIndex = 7;\n\t\tvar byteIndex = 0;\n\t\t\n\t\tfor (var col = this.moduleCount - 1; col > 0; col -= 2) {\n\t\n\t\t\tif (col === 6) col--;\n\t\n\t\t\twhile (true) {\n\t\n\t\t\t\tfor (var c = 0; c < 2; c++) {\n\t\t\t\t\t\n\t\t\t\t\tif (this.modules[row][col - c] === null) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar dark = false;\n\t\n\t\t\t\t\t\tif (byteIndex < data.length) {\n\t\t\t\t\t\t\tdark = ( ( (data[byteIndex] >>> bitIndex) & 1) === 1);\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tvar mask = QRUtil.getMask(maskPattern, row, col - c);\n\t\n\t\t\t\t\t\tif (mask) {\n\t\t\t\t\t\t\tdark = !dark;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.modules[row][col - c] = dark;\n\t\t\t\t\t\tbitIndex--;\n\t\n\t\t\t\t\t\tif (bitIndex === -1) {\n\t\t\t\t\t\t\tbyteIndex++;\n\t\t\t\t\t\t\tbitIndex = 7;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\trow += inc;\n\t\n\t\t\t\tif (row < 0 || this.moduleCount <= row) {\n\t\t\t\t\trow -= inc;\n\t\t\t\t\tinc = -inc;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\n};\n\nQRCode.PAD0 = 0xEC;\nQRCode.PAD1 = 0x11;\n\nQRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {\n\t\n\tvar rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);\n\t\n\tvar buffer = new QRBitBuffer();\n\t\n\tfor (var i = 0; i < dataList.length; i++) {\n\t\tvar data = dataList[i];\n\t\tbuffer.put(data.mode, 4);\n\t\tbuffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) );\n\t\tdata.write(buffer);\n\t}\n\n\t// calc num max data.\n\tvar totalDataCount = 0;\n\tfor (var x = 0; x < rsBlocks.length; x++) {\n\t\ttotalDataCount += rsBlocks[x].dataCount;\n\t}\n\n\tif (buffer.getLengthInBits() > totalDataCount * 8) {\n\t\tthrow new Error(\"code length overflow. (\" + \n buffer.getLengthInBits() + \n \">\" + \n totalDataCount * 8 + \n \")\");\n\t}\n\n\t// end code\n\tif (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {\n\t\tbuffer.put(0, 4);\n\t}\n\n\t// padding\n\twhile (buffer.getLengthInBits() % 8 !== 0) {\n\t\tbuffer.putBit(false);\n\t}\n\n\t// padding\n\twhile (true) {\n\t\t\n\t\tif (buffer.getLengthInBits() >= totalDataCount * 8) {\n\t\t\tbreak;\n\t\t}\n\t\tbuffer.put(QRCode.PAD0, 8);\n\t\t\n\t\tif (buffer.getLengthInBits() >= totalDataCount * 8) {\n\t\t\tbreak;\n\t\t}\n\t\tbuffer.put(QRCode.PAD1, 8);\n\t}\n\n\treturn QRCode.createBytes(buffer, rsBlocks);\n};\n\nQRCode.createBytes = function(buffer, rsBlocks) {\n\n\tvar offset = 0;\n\t\n\tvar maxDcCount = 0;\n\tvar maxEcCount = 0;\n\t\n\tvar dcdata = new Array(rsBlocks.length);\n\tvar ecdata = new Array(rsBlocks.length);\n\t\n\tfor (var r = 0; r < rsBlocks.length; r++) {\n\n\t\tvar dcCount = rsBlocks[r].dataCount;\n\t\tvar ecCount = rsBlocks[r].totalCount - dcCount;\n\n\t\tmaxDcCount = Math.max(maxDcCount, dcCount);\n\t\tmaxEcCount = Math.max(maxEcCount, ecCount);\n\t\t\n\t\tdcdata[r] = new Array(dcCount);\n\t\t\n\t\tfor (var i = 0; i < dcdata[r].length; i++) {\n\t\t\tdcdata[r][i] = 0xff & buffer.buffer[i + offset];\n\t\t}\n\t\toffset += dcCount;\n\t\t\n\t\tvar rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);\n\t\tvar rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);\n\n\t\tvar modPoly = rawPoly.mod(rsPoly);\n\t\tecdata[r] = new Array(rsPoly.getLength() - 1);\n\t\tfor (var x = 0; x < ecdata[r].length; x++) {\n var modIndex = x + modPoly.getLength() - ecdata[r].length;\n\t\t\tecdata[r][x] = (modIndex >= 0)? modPoly.get(modIndex) : 0;\n\t\t}\n\n\t}\n\t\n\tvar totalCodeCount = 0;\n\tfor (var y = 0; y < rsBlocks.length; y++) {\n\t\ttotalCodeCount += rsBlocks[y].totalCount;\n\t}\n\n\tvar data = new Array(totalCodeCount);\n\tvar index = 0;\n\n\tfor (var z = 0; z < maxDcCount; z++) {\n\t\tfor (var s = 0; s < rsBlocks.length; s++) {\n\t\t\tif (z < dcdata[s].length) {\n\t\t\t\tdata[index++] = dcdata[s][z];\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var xx = 0; xx < maxEcCount; xx++) {\n\t\tfor (var t = 0; t < rsBlocks.length; t++) {\n\t\t\tif (xx < ecdata[t].length) {\n\t\t\t\tdata[index++] = ecdata[t][xx];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn data;\n\n};\n\nmodule.exports = QRCode;\n","var Reset = \"\\x1b[0m\",\nBright = \"\\x1b[1m\",\nDim = \"\\x1b[2m\",\nUnderscore = \"\\x1b[4m\",\nBlink = \"\\x1b[5m\",\nReverse = \"\\x1b[7m\",\nHidden = \"\\x1b[8m\",\n\nBgBlack = \"\\x1b[40m\",\nBgRed = \"\\x1b[41m\",\nBgGreen = \"\\x1b[42m\",\nBgYellow = \"\\x1b[43m\",\nBgBlue = \"\\x1b[44m\",\nBgMagenta = \"\\x1b[45m\",\nBgCyan = \"\\x1b[46m\",\nBgWhite = \"\\x1b[47m\",\nBgGray = \"\\x1b[100m\"\nvar QRCode = require('./QRCode'),\n QRErrorCorrectLevel = require('./QRCode/QRErrorCorrectLevel'),\n black = BgBlack +\" \"+ Reset,\n white = BgWhite +\" \"+ Reset,\n toCell = function (isBlack) {\n return isBlack ? black : white;\n },\n repeat = function (color) {\n return {\n times: function (count) {\n return new Array(count).join(color);\n }\n };\n },\n fill = function(length, value) {\n var arr = new Array(length);\n for (var i = 0; i < length; i++) {\n arr[i] = value;\n }\n return arr;\n };\n\nmodule.exports = {\n\n error: QRErrorCorrectLevel.L,\n\n generate: function (input, opts, cb) {\n if (typeof opts === 'function') {\n cb = opts;\n opts = {};\n }\n\n var qrcode = new QRCode(-1, this.error);\n qrcode.addData(input);\n qrcode.make();\n\n var output = '';\n if (opts && opts.small) {\n var BLACK = true, WHITE = false;\n var moduleCount = qrcode.getModuleCount();\n var moduleData = qrcode.modules.slice();\n\n var oddRow = moduleCount % 2 === 1;\n if (oddRow) {\n moduleData.push(fill(moduleCount, WHITE));\n }\n\n var platte= {\n WHITE_ALL: '\\u2588',\n WHITE_BLACK: '\\u2580',\n BLACK_WHITE: '\\u2584',\n BLACK_ALL: ' ',\n };\n\n var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3);\n var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3);\n output += borderTop + '\\n';\n\n for (var row = 0; row < moduleCount; row += 2) {\n output += platte.WHITE_ALL;\n\n for (var col = 0; col < moduleCount; col++) {\n if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {\n output += platte.WHITE_ALL;\n } else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {\n output += platte.WHITE_BLACK;\n } else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {\n output += platte.BLACK_WHITE;\n } else {\n output += platte.BLACK_ALL;\n }\n }\n\n output += platte.WHITE_ALL + '\\n';\n }\n\n if (!oddRow) {\n output += borderBottom;\n }\n } else {\n var border = repeat(white).times(qrcode.getModuleCount() + 3);\n\n output += border + '\\n';\n qrcode.modules.forEach(function (row) {\n output += white;\n output += row.map(toCell).join(''); \n output += white + '\\n';\n });\n output += border;\n }\n\n if (cb) cb(output);\n else console.log(output);\n },\n\n setErrorLevel: function (error) {\n this.error = QRErrorCorrectLevel[error] || this.error;\n }\n\n};\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\nvar isNode = typeof process !== \"undefined\" && process.versions != null && process.versions.node != null;\n\nvar isWebWorker = (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === \"object\" && self.constructor && self.constructor.name === \"DedicatedWorkerGlobalScope\";\n\n/**\n * @see https://github.com/jsdom/jsdom/releases/tag/12.0.0\n * @see https://github.com/jsdom/jsdom/issues/1537\n */\nvar isJsDom = typeof window !== \"undefined\" && window.name === \"nodejs\" || typeof navigator !== \"undefined\" && (navigator.userAgent.includes(\"Node.js\") || navigator.userAgent.includes(\"jsdom\"));\n\nvar isDeno = typeof Deno !== \"undefined\" && typeof Deno.version !== \"undefined\" && typeof Deno.version.deno !== \"undefined\";\n\nexports.isBrowser = isBrowser;\nexports.isWebWorker = isWebWorker;\nexports.isNode = isNode;\nexports.isJsDom = isJsDom;\nexports.isDeno = isDeno;","import QRCode from \"qrcode-svg\"\nimport QRCodeTerminal from \"./terminal.cjs\"\n\n\nimport { isBrowser, isNode, isWebWorker, isJsDom, isDeno } from \"browser-or-node\";\nfunction parseOptions(args) {\n /* \n content: \"http://github.com/\",\n padding: 4,\n width: 256,\n height: 256,\n color: \"#000000\",\n background: \"#ffffff\",\n ecl: \"M\",\n*/\n let content = \"algorand://\"\n let amount = args.amount;\n let wallet = args.wallet;\n let label = args.label;\n let asset = args.asset;\n let note = args.note;\n if (!!label && !!wallet) {\n content = \"algorand://\" + wallet+ \"?\" + \"&label=\" + label;\n } else if (!!asset && !!wallet) {\n if (!!note && amount > 0) {\n content = \"algorand://\" + wallet+ \"?\" + \"&amount=\" + amount + \"&asset=\" + asset + \"¬e=\" + note;\n } else if (amount > 0) {\n content = \"algorand://\" + wallet+ \"?\" + \"&amount=\" + amount + \"&asset=\" + asset;\n } else if (amount === 0) {\n content = \"algorand://?\" + \"amount=0\" + \"&asset=\" + asset;\n }\n\n } else if (!!note && !!wallet && !!amount) {\n content = \"algorand://\" + wallet+ \"?\" + \"&amount=\" + amount + \"¬e=\" + note;\n } else if ( !!wallet && !!amount){\n content = \"algorand://\" + wallet+ \"?\" + \"&amount=\" + amount;\n }\n let options = {\n content: content,\n container: \"svg-viewbox\",\n ecl: args.ecl || \"H\",\n file: args.file || \"algorand-qrcode.svg\",\n padding: args.margin || 4,\n width: args.width || 256,\n height: args.height || 256,\n output: args.output || \"terminal\",\n background: args.background || \"#e1dede\",\n color: args.color || \"#000000\"\n }\n return options\n}\nconst algoqrcode = (options) =>{\n if (isBrowser) {\n let opts = parseOptions(options)\n let qrcode = new QRCode(opts);\n return qrcode\n\n } else if (isNode) {\n if (options.output === 'svg') {\n let opts = parseOptions(options)\n let qrcode = new QRCode(opts);\n return qrcode\n } else {\n let opts = parseOptions(options)\n return QRCodeTerminal.generate(opts.content, {small: true});\n }\n\n\n }\n\n}\nexport default algoqrcode\n\n"],"names":["QR8bitByte","data","this","mode","QRMode","MODE_8BIT_BYTE","parsedData","i","l","length","byteArray","code","charCodeAt","push","Array","prototype","concat","apply","unshift","QRCodeModel","typeNumber","errorCorrectLevel","modules","moduleCount","dataCache","dataList","getLength","buffer","write","put","addData","newData","isDark","row","col","Error","getModuleCount","make","makeImpl","getBestMaskPattern","test","maskPattern","setupPositionProbePattern","setupPositionAdjustPattern","setupTimingPattern","setupTypeInfo","setupTypeNumber","createData","mapData","r","c","minLostPoint","pattern","lostPoint","QRUtil","getLostPoint","createMovieClip","target_mc","instance_name","depth","qr_mc","createEmptyMovieClip","y","x","beginFill","moveTo","lineTo","endFill","pos","getPatternPosition","j","bits","getBCHTypeNumber","mod","Math","floor","getBCHTypeInfo","inc","bitIndex","byteIndex","dark","getMask","PAD0","PAD1","rsBlocks","QRRSBlock","getRSBlocks","QRBitBuffer","getLengthInBits","totalDataCount","dataCount","putBit","createBytes","offset","maxDcCount","maxEcCount","dcdata","ecdata","dcCount","ecCount","totalCount","max","rsPoly","getErrorCorrectPolynomial","modPoly","QRPolynomial","modIndex","get","totalCodeCount","index","MODE_NUMBER","MODE_ALPHA_NUM","MODE_KANJI","QRErrorCorrectLevel","L","M","Q","H","QRMaskPattern","PATTERN_POSITION_TABLE","G15","G18","G15_MASK","d","getBCHDigit","digit","errorCorrectLength","a","multiply","QRMath","gexp","type","qrCode","sameCount","count","darkCount","abs","glog","n","LOG_TABLE","EXP_TABLE","num","shift","undefined","e","ratio","RS_BLOCK_TABLE","rsBlock","getRsBlockTable","list","bufIndex","bit","QRCodeLimitLength","QRCode","options","padding","width","height","color","background","ecl","content","result","encodeURI","toString","replace","_getUTF8Length","limit","len","table","_getTypeNumber","_getErrorCorrectLevel","qrcode","svg","opt","container","pretty","indent","EOL","xsize","ysize","join","swap","xmlDeclaration","predefined","defs","bgrect","modrect","pathdata","px","py","t","w","h","Number","isInteger","toFixed","save","file","callback","error","require","writeFile","module","exports","require$$0","QR8bitByte_1","QRMath_1","QRPolynomial_1","require$$1","require$$2","PATTERN000","PATTERN001","PATTERN010","PATTERN011","PATTERN100","PATTERN101","PATTERN110","PATTERN111","QRUtil_1","QRRSBlock_1","require$$3","v","z","s","xx","Reset","black","BgBlack","white","BgWhite","toCell","isBlack","repeat","times","terminal","generate","input","opts","cb","output","small","WHITE","moduleData","slice","oddRow","value","arr","fill","platte","WHITE_ALL","WHITE_BLACK","BLACK_WHITE","BLACK_ALL","borderTop","borderBottom","border","forEach","map","console","log","setErrorLevel","Object","defineProperty","lib","_typeof","Symbol","_typeof2","iterator","obj","constructor","isBrowser","window","document","isNode","process","versions","node","isWebWorker","self","name","isJsDom","navigator","userAgent","includes","isDeno","Deno","version","deno","isBrowser_1","isNode_1","parseOptions","args","amount","wallet","label","asset","note","margin","algoqrcode","QRCodeTerminal"],"mappings":"sBA6BA,SAASA,EAAWC,GAClBC,KAAKC,KAAOC,EAAOC,eACnBH,KAAKD,KAAOA,EACZC,KAAKI,WAAa,GAGlB,IAAK,IAAIC,EAAI,EAAGC,EAAIN,KAAKD,KAAKQ,OAAQF,EAAIC,EAAGD,IAAK,CAChD,IAAIG,EAAY,GACZC,EAAOT,KAAKD,KAAKW,WAAWL,GAE5BI,EAAO,OACTD,EAAU,GAAK,KAAgB,QAAPC,KAAqB,GAC7CD,EAAU,GAAK,KAAgB,OAAPC,KAAoB,GAC5CD,EAAU,GAAK,KAAgB,KAAPC,KAAkB,EAC1CD,EAAU,GAAK,IAAe,GAAPC,GACdA,EAAO,MAChBD,EAAU,GAAK,KAAgB,MAAPC,KAAmB,GAC3CD,EAAU,GAAK,KAAgB,KAAPC,KAAkB,EAC1CD,EAAU,GAAK,IAAe,GAAPC,GACdA,EAAO,KAChBD,EAAU,GAAK,KAAgB,KAAPC,KAAkB,EAC1CD,EAAU,GAAK,IAAe,GAAPC,GAEvBD,EAAU,GAAKC,EAGjBT,KAAKI,WAAWO,KAAKH,EACtB,CAEDR,KAAKI,WAAaQ,MAAMC,UAAUC,OAAOC,MAAM,GAAIf,KAAKI,YAEpDJ,KAAKI,WAAWG,QAAUP,KAAKD,KAAKQ,SACtCP,KAAKI,WAAWY,QAAQ,KACxBhB,KAAKI,WAAWY,QAAQ,KACxBhB,KAAKI,WAAWY,QAAQ,KAE5B,CAaA,SAASC,EAAYC,EAAYC,GAC/BnB,KAAKkB,WAAaA,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hDC,GAAUH,GAAYD,EAC/BpI,EAAU,cAAgBqI,EAAhB,YAA2CD,EAAS,SAAWI,EAC/DH,GAAYD,IACtBpI,EAAU,cAAgBqI,EAAhB,YAA2CD,GAE3C,CACVpI,QAASA,EACTc,UAAW,cACXf,IAAKoI,EAAKpI,KAAO,IACjBsC,KAAM8F,EAAK9F,MAAQ,sBACnB3C,QAASyI,EAAKM,QAAU,EACxB9I,MAAOwI,EAAKxI,OAAS,IACrBC,OAAQuI,EAAKvI,QAAU,IACvBmF,OAAQoD,EAAKpD,QAAU,WACvBjF,WAAYqI,EAAKrI,YAAc,UAC/BD,MAAOsI,EAAKtI,OAAS,UAG7B,CDzBe0G,EAAAiB,QAAGA,EAClBjB,EAAAqB,OAAiBA,ECyBjB,IAAMc,EAAa,SAACjJ,GAChB,GAAIqH,EAAW,CACX,IAAIjC,EAAOqD,EAAazI,GAExB,OADa,IAAID,EAAOqF,EAG3B,CAAM,GAAIoC,EAAQ,CACf,GAAuB,QAAnBxH,EAAQsF,OAAkB,CAC1B,IAAIF,EAAOqD,EAAazI,GAExB,OADe,IAAID,EAAOqF,EAE9B,CACI,IAAIA,EAAOqD,EAAazI,GACxB,OAAOkJ,EAAehE,SAASE,EAAK7E,QAAS,CAACgF,OAAO,GAI7D,CAEJ"}
--------------------------------------------------------------------------------