@sythos/js_barcode_universal 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/AI_USAGE.md +33 -0
  2. package/LICENSE +4 -2
  3. package/NOTICE.md +10 -5
  4. package/README.md +95 -31
  5. package/bundle/sythos-barcode.esm.js +11552 -8877
  6. package/bundle/sythos-barcode.js +11469 -8877
  7. package/examples/create.html +2 -1
  8. package/examples/read.html +6 -0
  9. package/licenses/README.md +5 -0
  10. package/licenses/aztec-rune.license +76 -0
  11. package/licenses/compact-pdf417.license +76 -0
  12. package/licenses/ean-2.license +75 -0
  13. package/licenses/ean-5.license +75 -0
  14. package/licenses/gs1-databar.license +84 -0
  15. package/package.json +16 -4
  16. package/src/aztec/decoder.js +1 -0
  17. package/src/aztec/detector.js +1 -0
  18. package/src/aztec/encoder.js +1 -0
  19. package/src/aztec/high-level.js +1 -0
  20. package/src/aztec/index.js +1 -0
  21. package/src/aztec/tables.js +1 -0
  22. package/src/aztecrune/decoder.js +156 -0
  23. package/src/aztecrune/detector.js +167 -0
  24. package/src/aztecrune/encoder.js +122 -0
  25. package/src/aztecrune/index.js +50 -0
  26. package/src/aztecrune/tables.js +138 -0
  27. package/src/compactpdf417/decoder.js +129 -0
  28. package/src/compactpdf417/detector.js +140 -0
  29. package/src/compactpdf417/encoder.js +141 -0
  30. package/src/compactpdf417/index.js +22 -0
  31. package/src/compactpdf417/tables.js +174 -0
  32. package/src/core/bit-buffer.js +1 -0
  33. package/src/core/bit-matrix.js +1 -0
  34. package/src/core/errors.js +1 -0
  35. package/src/core/galois-field.js +1 -0
  36. package/src/core/index.js +1 -0
  37. package/src/core/reed-solomon.js +1 -0
  38. package/src/databar/codec.js +182 -0
  39. package/src/databar/decoder.js +216 -0
  40. package/src/databar/encoder.js +97 -0
  41. package/src/databar/gs1.js +178 -0
  42. package/src/databar/index.js +69 -0
  43. package/src/databar/patterns.js +144 -0
  44. package/src/databar/tables.js +125 -0
  45. package/src/datamatrix/decoder.js +1 -0
  46. package/src/datamatrix/detector.js +1 -0
  47. package/src/datamatrix/encoder.js +1 -0
  48. package/src/datamatrix/index.js +1 -0
  49. package/src/datamatrix/tables.js +1 -0
  50. package/src/frameqr/decoder.js +16 -15
  51. package/src/frameqr/detector.js +3 -2
  52. package/src/frameqr/encoder.js +8 -7
  53. package/src/frameqr/index.js +1 -0
  54. package/src/frameqr/tables.js +11 -10
  55. package/src/image/binarizer.js +1 -0
  56. package/src/image/grid-sampler.js +1 -0
  57. package/src/image/index.js +1 -0
  58. package/src/image/luminance.js +1 -0
  59. package/src/image/perspective.js +1 -0
  60. package/src/index.js +101 -12
  61. package/src/micropdf417/compaction.js +1 -0
  62. package/src/micropdf417/decoder.js +1 -0
  63. package/src/micropdf417/detector.js +1 -0
  64. package/src/micropdf417/encoder.js +1 -0
  65. package/src/micropdf417/error-correction.js +1 -0
  66. package/src/micropdf417/index.js +1 -0
  67. package/src/micropdf417/tables.js +1 -0
  68. package/src/microqr/decoder.js +1 -0
  69. package/src/microqr/detector.js +1 -0
  70. package/src/microqr/encoder.js +1 -0
  71. package/src/microqr/index.js +1 -0
  72. package/src/microqr/tables.js +1 -0
  73. package/src/oned/addons.js +421 -0
  74. package/src/oned/index.js +21 -3
  75. package/src/oned/patterns.js +1 -0
  76. package/src/oned/reader.js +330 -11
  77. package/src/oned/writers.js +6 -0
  78. package/src/pdf417/compaction.js +1 -0
  79. package/src/pdf417/decoder.js +1 -0
  80. package/src/pdf417/detector.js +1 -0
  81. package/src/pdf417/encoder.js +1 -0
  82. package/src/pdf417/error-correction.js +1 -0
  83. package/src/pdf417/index.js +5 -0
  84. package/src/pdf417/tables.js +1 -0
  85. package/src/qr/decoder.js +1 -0
  86. package/src/qr/detector.js +1 -0
  87. package/src/qr/encoder.js +1 -0
  88. package/src/qr/index.js +1 -0
  89. package/src/qr/tables.js +1 -0
  90. package/src/render/image-data.js +1 -0
  91. package/src/render/index.js +1 -0
  92. package/src/render/options.js +1 -0
  93. package/src/render/png.js +1 -0
  94. package/src/render/svg.js +1 -0
  95. package/src/render/webgl.js +1 -0
  96. package/src/render/webgpu.js +1 -0
  97. package/src/rmqr/decoder.js +1 -0
  98. package/src/rmqr/detector.js +1 -0
  99. package/src/rmqr/encoder.js +1 -0
  100. package/src/rmqr/index.js +1 -0
  101. package/src/rmqr/tables.js +1 -0
@@ -0,0 +1,69 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ *
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+
32
+ /** Verified GS1 DataBar data-layer primitives. @module databar */
33
+
34
+ export {
35
+ dataBarGtinTransmission,
36
+ decodeDataBar14GTIN,
37
+ decodeDataBarLimitedGTIN,
38
+ encodeDataBar14GTIN,
39
+ encodeDataBarLimitedGTIN,
40
+ gtinCheckDigit,
41
+ makeGTIN14,
42
+ normalizeGTIN,
43
+ } from './codec.js';
44
+
45
+ export {
46
+ GS1_SEPARATOR,
47
+ decodeGS1ElementString,
48
+ encodeGS1ElementString,
49
+ formatGS1Elements,
50
+ gs1AIInfo,
51
+ parseGS1ElementString,
52
+ } from './gs1.js';
53
+
54
+ export {
55
+ DATABAR14_VARIANTS,
56
+ DATABAR_LIMITED_VARIANT,
57
+ dataBar14GroupFor,
58
+ validateDataBarTables,
59
+ } from './tables.js';
60
+
61
+ export { encodeDataBar14 } from './encoder.js';
62
+ export { decodeDataBar14, decodeDataBar14Scanline } from './decoder.js';
63
+ export {
64
+ DATABAR14_CHECKSUM_WEIGHTS,
65
+ DATABAR14_FINDERS,
66
+ dataBar14CharacterWidths,
67
+ dataBar14ValueForWidths,
68
+ dataBarWidths,
69
+ } from './patterns.js';
@@ -0,0 +1,144 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+
32
+ /** Mathematical width construction for GS1 DataBar characters. @module databar/patterns */
33
+
34
+ import { dataBar14GroupFor } from './tables.js';
35
+
36
+ function combinations(n, r) {
37
+ if (n < r || r < 0) return 0;
38
+ if (r === 0 || n === r) return 1;
39
+ let result = 1;
40
+ const k = Math.min(r, n - r);
41
+ for (let i = 1; i <= k; i++) result = result * (n - k + i) / i;
42
+ return result;
43
+ }
44
+
45
+ /**
46
+ * Unrank one constrained positive composition.
47
+ *
48
+ * The rank is the GS1 DataBar symbol-character value inside its group. This
49
+ * implementation follows the combinatorial definition directly: it counts
50
+ * every remaining admissible suffix rather than storing third-party patterns.
51
+ */
52
+ export function dataBarWidths(rank, modules, elements, maximumWidth, noNarrow) {
53
+ if (!Number.isInteger(rank) || rank < 0) throw new RangeError('GS1 DataBar width rank must be non-negative');
54
+ const widths = new Array(elements).fill(0);
55
+ let remaining = modules;
56
+ let narrowMask = 0;
57
+
58
+ for (let bar = 0; bar < elements - 1; bar++) {
59
+ let count = 0;
60
+ for (let width = 1; ; width++) {
61
+ narrowMask |= width === 1 ? 1 << bar : 0;
62
+ count = combinations(remaining - width - 1, elements - bar - 2);
63
+
64
+ if (noNarrow && narrowMask === 0 && remaining - width - (elements - bar - 1) >= elements - bar - 1) {
65
+ count -= combinations(remaining - width - (elements - bar), elements - bar - 2);
66
+ }
67
+
68
+ if (elements - bar - 1 > 1) {
69
+ let tooWide = 0;
70
+ for (let last = remaining - width - (elements - bar - 2); last > maximumWidth; last--) {
71
+ tooWide += combinations(remaining - width - last - 1, elements - bar - 3);
72
+ }
73
+ count -= tooWide * (elements - 1 - bar);
74
+ } else if (remaining - width > maximumWidth) {
75
+ count--;
76
+ }
77
+
78
+ if (rank < count) {
79
+ widths[bar] = width;
80
+ remaining -= width;
81
+ break;
82
+ }
83
+ rank -= count;
84
+ narrowMask &= ~(1 << bar);
85
+ }
86
+ }
87
+ widths[elements - 1] = remaining;
88
+ if (rank !== 0 || widths.some((width) => width < 1 || width > maximumWidth)) {
89
+ throw new RangeError('GS1 DataBar width rank exceeds its character group');
90
+ }
91
+ return widths;
92
+ }
93
+
94
+ /** Convert one DataBar-14 character value into its eight alternating widths. */
95
+ export function dataBar14CharacterWidths(value, kind) {
96
+ const group = dataBar14GroupFor(value, kind);
97
+ const offset = value - group.gsum;
98
+ const outside = kind === 'outside';
99
+ const oddRank = outside ? Math.floor(offset / group.evenTotal) : offset % group.oddTotal;
100
+ const evenRank = outside ? offset % group.evenTotal : Math.floor(offset / group.oddTotal);
101
+ const odd = dataBarWidths(oddRank, group.oddModules, 4, group.oddWidest, !outside);
102
+ const even = dataBarWidths(evenRank, group.evenModules, 4, group.evenWidest, outside);
103
+ const result = [];
104
+ for (let i = 0; i < 4; i++) result.push(odd[i], even[i]);
105
+ return result;
106
+ }
107
+
108
+ const inverseCharacterMaps = new Map();
109
+
110
+ /** Recover a character value from its canonical eight-width representation. */
111
+ export function dataBar14ValueForWidths(widths, kind) {
112
+ if (!Array.isArray(widths) || widths.length !== 8 || widths.some((width) => !Number.isInteger(width) || width < 1)) {
113
+ throw new TypeError('GS1 DataBar character widths must contain eight positive integers');
114
+ }
115
+ if (kind !== 'outside' && kind !== 'inside') throw new RangeError(`Unknown GS1 DataBar character kind "${kind}"`);
116
+ let inverse = inverseCharacterMaps.get(kind);
117
+ if (!inverse) {
118
+ inverse = new Map();
119
+ const maximum = kind === 'outside' ? 2840 : 1596;
120
+ for (let value = 0; value <= maximum; value++) {
121
+ inverse.set(dataBar14CharacterWidths(value, kind).join(','), value);
122
+ }
123
+ inverseCharacterMaps.set(kind, inverse);
124
+ }
125
+ const value = inverse.get(widths.join(','));
126
+ if (value === undefined) throw new RangeError(`Invalid GS1 DataBar ${kind} character widths`);
127
+ return value;
128
+ }
129
+
130
+ /** Nine finder patterns, expressed as normative five-element widths. */
131
+ export const DATABAR14_FINDERS = Object.freeze([
132
+ Object.freeze([3, 8, 2, 1, 1]), Object.freeze([3, 5, 5, 1, 1]),
133
+ Object.freeze([3, 3, 7, 1, 1]), Object.freeze([3, 1, 9, 1, 1]),
134
+ Object.freeze([2, 7, 4, 1, 1]), Object.freeze([2, 5, 6, 1, 1]),
135
+ Object.freeze([2, 3, 8, 1, 1]), Object.freeze([1, 5, 7, 1, 1]),
136
+ Object.freeze([1, 3, 9, 1, 1]),
137
+ ]);
138
+
139
+ /** Weight sequence generated as powers of three modulo 79. */
140
+ export const DATABAR14_CHECKSUM_WEIGHTS = Object.freeze(Array.from({ length: 32 }, (_, index) => {
141
+ let value = 1;
142
+ for (let i = 0; i < index; i++) value = (value * 3) % 79;
143
+ return value;
144
+ }));
@@ -0,0 +1,125 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+
32
+ /**
33
+ * Static GS1 DataBar facts used by the GTIN compaction codec.
34
+ *
35
+ * The numbers in the DataBar-14 group tables are the public tables in
36
+ * ISO/IEC 24724:2011, clauses 5.2.2 and 5.2.3. They describe values, not a
37
+ * third-party implementation. Pattern construction deliberately belongs in
38
+ * the renderer/encoder layer so this module stays a small, auditable contract.
39
+ *
40
+ * @module databar/tables
41
+ */
42
+
43
+ const group = (first, last, gsum, oddModules, evenModules, oddWidest, evenWidest, oddTotal, evenTotal) => Object.freeze({
44
+ first, last, gsum, oddModules, evenModules, oddWidest, evenWidest, oddTotal, evenTotal,
45
+ });
46
+
47
+ /** The four GTIN-only layouts sharing the DataBar-14 compaction rules. */
48
+ export const DATABAR14_VARIANTS = Object.freeze({
49
+ omnidirectional: Object.freeze({ id: 'omnidirectional', rows: 1, modules: 96, checksumModulus: 79, pointOfSale: true }),
50
+ truncated: Object.freeze({ id: 'truncated', rows: 1, modules: 96, checksumModulus: 79, pointOfSale: false }),
51
+ stacked: Object.freeze({ id: 'stacked', rows: 2, modules: 50, checksumModulus: 79, pointOfSale: false }),
52
+ 'stacked-omnidirectional': Object.freeze({ id: 'stacked-omnidirectional', rows: 2, modules: 50, checksumModulus: 79, pointOfSale: true }),
53
+ });
54
+
55
+ /** GS1 DataBar Limited is a distinct two-character symbology. */
56
+ export const DATABAR_LIMITED_VARIANT = Object.freeze({
57
+ id: 'limited', rows: 1, checksumModulus: 89, pointOfSale: false,
58
+ permittedIndicatorDigits: Object.freeze([0, 1]),
59
+ });
60
+
61
+ /** (16,4) outside character groups, ISO/IEC 24724:2011 Table 1. */
62
+ export const DATABAR14_OUTSIDE_GROUPS = Object.freeze([
63
+ group(0, 160, 0, 12, 4, 8, 1, 161, 1),
64
+ group(161, 960, 161, 10, 6, 6, 3, 80, 10),
65
+ group(961, 2014, 961, 8, 8, 4, 5, 31, 34),
66
+ group(2015, 2714, 2015, 6, 10, 3, 6, 10, 70),
67
+ group(2715, 2840, 2715, 4, 12, 1, 8, 1, 126),
68
+ ]);
69
+
70
+ /** (15,4) inside character groups, ISO/IEC 24724:2011 Table 2. */
71
+ export const DATABAR14_INSIDE_GROUPS = Object.freeze([
72
+ group(0, 335, 0, 5, 10, 2, 7, 4, 84),
73
+ group(336, 1035, 336, 7, 8, 4, 5, 20, 35),
74
+ group(1036, 1515, 1036, 9, 6, 6, 3, 48, 10),
75
+ group(1516, 1596, 1516, 11, 4, 8, 1, 81, 1),
76
+ ]);
77
+
78
+ /** Number of values carried by an inside (15,4) character. */
79
+ export const DATABAR14_INSIDE_RADIX = 1597;
80
+ /** Number of values carried by one outside/inside character pair. */
81
+ export const DATABAR14_PAIR_RADIX = 4537077;
82
+ /** Stand-alone and composite DataBar-14 payload domain, including linkage. */
83
+ export const DATABAR14_SYMBOL_LIMIT = 20000000000000n;
84
+
85
+ /** GS1 DataBar Limited divides its 13 data digits into two character values. */
86
+ export const DATABAR_LIMITED_PAIR_RADIX = 2013571;
87
+ /** Offset that switches a DataBar Limited value from stand-alone to composite. */
88
+ export const DATABAR_LIMITED_LINKAGE_OFFSET = 2015133531096n;
89
+ /** DataBar Limited carries GTIN values whose first digit is zero or one. */
90
+ export const DATABAR_LIMITED_DATA_LIMIT = 2000000000000n;
91
+
92
+ /** Locate the value group that an outside or inside character belongs to. */
93
+ export function dataBar14GroupFor(value, kind) {
94
+ if (!Number.isInteger(value)) throw new TypeError('GS1 DataBar character value must be an integer');
95
+ const groups = kind === 'outside' ? DATABAR14_OUTSIDE_GROUPS
96
+ : kind === 'inside' ? DATABAR14_INSIDE_GROUPS : null;
97
+ if (!groups) throw new RangeError(`Unknown GS1 DataBar character kind "${kind}"`);
98
+ const found = groups.find((entry) => value >= entry.first && value <= entry.last);
99
+ if (!found) throw new RangeError(`GS1 DataBar ${kind} character value ${value} is out of range`);
100
+ return found;
101
+ }
102
+ /** Check the independently represented table identities. */
103
+ export function validateDataBarTables() {
104
+ const problems = [];
105
+ const validateGroups = (name, groups, expectedLast) => {
106
+ let next = 0;
107
+ for (const entry of groups) {
108
+ if (entry.first !== next) problems.push(`${name}: gap before ${entry.first}`);
109
+ if (entry.last < entry.first) problems.push(`${name}: inverted range ${entry.first}-${entry.last}`);
110
+ if (entry.oddTotal * entry.evenTotal !== entry.last - entry.first + 1) {
111
+ problems.push(`${name}: combination count mismatch at ${entry.first}`);
112
+ }
113
+ next = entry.last + 1;
114
+ }
115
+ if (next - 1 !== expectedLast) problems.push(`${name}: final value is ${next - 1}, expected ${expectedLast}`);
116
+ };
117
+ validateGroups('outside', DATABAR14_OUTSIDE_GROUPS, 2840);
118
+ validateGroups('inside', DATABAR14_INSIDE_GROUPS, 1596);
119
+ if (DATABAR14_PAIR_RADIX !== 2841 * DATABAR14_INSIDE_RADIX) problems.push('pair radix mismatch');
120
+ if (DATABAR14_SYMBOL_LIMIT !== 2n * 10000000000000n) problems.push('symbol limit mismatch');
121
+ if (DATABAR_LIMITED_LINKAGE_OFFSET !== BigInt(DATABAR_LIMITED_PAIR_RADIX) * 1000776n) {
122
+ problems.push('limited linkage offset mismatch');
123
+ }
124
+ return problems;
125
+ }
@@ -23,6 +23,7 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
24
  * SOFTWARE.
25
25
  *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -4,6 +4,7 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
7
8
  *
8
9
  * Permission is hereby granted, free of charge, to any person obtaining a copy
9
10
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +30,7 @@
29
30
  */
30
31
 
31
32
  /**
32
- * Decoder for the Sythos Canvas QR profile.
33
+ * Decoder for FrameQR Code.
33
34
  *
34
35
  * This is intentionally not a DENSO FrameQR decoder. The profile is a QR
35
36
  * symbol with a bounded artwork reservation and an explicit `frameqr` marker.
@@ -87,7 +88,7 @@ function isExpectedProfile(profile) {
87
88
  * @returns {{canvas: object, damage: object}}
88
89
  */
89
90
  function validateCanvas(symbolSize, version, canvas) {
90
- if (!isObject(canvas)) throw new FormatError('Sythos Canvas QR: canvas metadata is missing');
91
+ if (!isObject(canvas)) throw new FormatError('FrameQR Code: canvas metadata is missing');
91
92
 
92
93
  let normalized;
93
94
  try {
@@ -103,14 +104,14 @@ function validateCanvas(symbolSize, version, canvas) {
103
104
  }
104
105
  } catch (error) {
105
106
  if (error instanceof FormatError) throw error;
106
- throw new FormatError(`Sythos Canvas QR: invalid canvas metadata: ${error.message}`);
107
+ throw new FormatError(`FrameQR Code: invalid canvas metadata: ${error.message}`);
107
108
  }
108
109
 
109
110
  let damage;
110
111
  try {
111
112
  damage = analyzeCanvasDamage(version, normalized);
112
113
  } catch (error) {
113
- throw new FormatError(`Sythos Canvas QR: cannot analyse canvas damage: ${error.message}`);
114
+ throw new FormatError(`FrameQR Code: cannot analyse canvas damage: ${error.message}`);
114
115
  }
115
116
  return { canvas: normalized, damage };
116
117
  }
@@ -135,24 +136,24 @@ function resolveProfile(matrix, options) {
135
136
  const markerId = isObject(markerProfile) ? markerProfile.id : markerProfile;
136
137
  const suppliedId = isObject(suppliedProfile) ? suppliedProfile.id : suppliedProfile;
137
138
  if (markerId !== suppliedId) {
138
- throw new FormatError('Sythos Canvas QR: matrix and requested profile markers disagree');
139
+ throw new FormatError('FrameQR Code: matrix and requested profile markers disagree');
139
140
  }
140
141
  }
141
142
  const profile = markerProfile ?? suppliedProfile;
142
143
 
143
144
  if (!isExpectedProfile(profile)) {
144
145
  throw new FormatError(
145
- 'Sythos Canvas QR: profile marker is missing or is not the Sythos Canvas QR profile'
146
+ 'FrameQR Code: profile marker is missing or is not a FrameQR Code symbol'
146
147
  );
147
148
  }
148
149
  if (marker && marker.certified === true) {
149
150
  throw new FormatError(
150
- 'Sythos Canvas QR: certified FrameQR input is not supported by this profile decoder'
151
+ 'FrameQR Code: certified FrameQR input is not supported by this profile decoder'
151
152
  );
152
153
  }
153
154
  if (!marker && !options.allowUnmarked) {
154
155
  throw new FormatError(
155
- 'Sythos Canvas QR: unmarked QR matrix rejected; provide a verified profile marker'
156
+ 'FrameQR Code: unmarked QR matrix rejected; provide a verified profile marker'
156
157
  );
157
158
  }
158
159
 
@@ -160,7 +161,7 @@ function resolveProfile(matrix, options) {
160
161
  const canvas = options.canvas ?? markerCanvas;
161
162
  const version = (matrix.width - 17) / 4;
162
163
  if (!Number.isInteger(version) || version < 1 || version > 40) {
163
- throw new FormatError(`Sythos Canvas QR: invalid QR symbol size ${matrix.width}`);
164
+ throw new FormatError(`FrameQR Code: invalid QR symbol size ${matrix.width}`);
164
165
  }
165
166
  const checked = validateCanvas(matrix.width, version, canvas);
166
167
  if (markerCanvas && options.canvas) {
@@ -168,11 +169,11 @@ function resolveProfile(matrix, options) {
168
169
  try {
169
170
  marked = normalizeCanvasSpec(matrix.width, markerCanvas);
170
171
  } catch (error) {
171
- throw new FormatError(`Sythos Canvas QR: invalid marker canvas: ${error.message}`);
172
+ throw new FormatError(`FrameQR Code: invalid marker canvas: ${error.message}`);
172
173
  }
173
174
  const fields = ['shape', 'centerX', 'centerY', 'width', 'height', 'angle'];
174
175
  if (fields.some((field) => marked[field] !== checked.canvas[field])) {
175
- throw new FormatError('Sythos Canvas QR: matrix and requested canvas metadata disagree');
176
+ throw new FormatError('FrameQR Code: matrix and requested canvas metadata disagree');
176
177
  }
177
178
  }
178
179
  return {
@@ -184,7 +185,7 @@ function resolveProfile(matrix, options) {
184
185
  }
185
186
 
186
187
  /**
187
- * Decode a Sythos Canvas QR matrix.
188
+ * Decode a FrameQR Code matrix.
188
189
  *
189
190
  * @param {import('../core/bit-matrix.js').BitMatrix} matrix
190
191
  * Square QR modules, normally returned by `encodeFrameQR` or a FrameQR
@@ -204,11 +205,11 @@ function resolveProfile(matrix, options) {
204
205
  */
205
206
  export function decodeFrameQR(matrix, options = {}) {
206
207
  if (!matrix || !Number.isInteger(matrix.width) || !Number.isInteger(matrix.height)) {
207
- throw new FormatError('Sythos Canvas QR: no matrix supplied');
208
+ throw new FormatError('FrameQR Code: no matrix supplied');
208
209
  }
209
210
  if (matrix.width !== matrix.height) {
210
211
  throw new FormatError(
211
- `Sythos Canvas QR: symbol must be square, got ${matrix.width}x${matrix.height}`
212
+ `FrameQR Code: symbol must be square, got ${matrix.width}x${matrix.height}`
212
213
  );
213
214
  }
214
215
 
@@ -220,7 +221,7 @@ export function decodeFrameQR(matrix, options = {}) {
220
221
  // Preserve the original QR/RS error when possible, but give callers a
221
222
  // profile-specific context without exposing implementation details.
222
223
  if (error instanceof FormatError) {
223
- throw new FormatError(`Sythos Canvas QR: payload is not recoverable: ${error.message}`);
224
+ throw new FormatError(`FrameQR Code: payload is not recoverable: ${error.message}`);
224
225
  }
225
226
  throw error;
226
227
  }
@@ -4,6 +4,7 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
7
8
  *
8
9
  * Permission is hereby granted, free of charge, to any person obtaining a copy
9
10
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +30,7 @@
29
30
  */
30
31
 
31
32
  /**
32
- * Detector for the non-certified Sythos Canvas QR profile.
33
+ * Detector for the non-certified FrameQR Code profile.
33
34
  *
34
35
  * The profile deliberately reuses QR Model 2 geometry. Finder localisation and
35
36
  * projective sampling therefore use the QR detector; the additional profile
@@ -98,7 +99,7 @@ function sameCandidate(left, right) {
98
99
  }
99
100
 
100
101
  /**
101
- * Detect Sythos Canvas QR symbols in a binarized raster.
102
+ * Detect FrameQR Code symbols in a binarized raster.
102
103
  *
103
104
  * @param {import('../core/bit-matrix.js').BitMatrix} binaryImage Set bit = dark.
104
105
  * @param {object} [options]
@@ -4,6 +4,7 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
7
8
  *
8
9
  * Permission is hereby granted, free of charge, to any person obtaining a copy
9
10
  * of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +30,7 @@
29
30
  */
30
31
 
31
32
  /**
32
- * Sythos Canvas QR profile encoder.
33
+ * FrameQR Code encoder.
33
34
  *
34
35
  * This encoder deliberately builds on this project's QR Code implementation
35
36
  * and then removes a conservatively bounded set of data modules for artwork.
@@ -68,7 +69,7 @@ function clearCanvas(matrix, modules) {
68
69
 
69
70
  /**
70
71
  * Encode a QR Code with a conservative artwork canvas according to the
71
- * non-certified Sythos Canvas QR profile.
72
+ * non-certified FrameQR Code profile.
72
73
  *
73
74
  * The profile forces QR H error correction and rejects a canvas whenever its
74
75
  * known codeword damage exceeds the per-block correction budget. When a
@@ -84,10 +85,10 @@ function clearCanvas(matrix, modules) {
84
85
  */
85
86
  export function encodeFrameQR(text, options = {}) {
86
87
  if (typeof text !== 'string') {
87
- throw new EncodeError('Sythos Canvas QR: text must be a string');
88
+ throw new EncodeError('FrameQR Code: text must be a string');
88
89
  }
89
90
  if (options.ecc !== undefined && options.ecc !== 'H') {
90
- throw new EncodeError('Sythos Canvas QR: ecc is fixed to H for this profile');
91
+ throw new EncodeError('FrameQR Code: ecc is fixed to H for this profile');
91
92
  }
92
93
 
93
94
  const qrOptions = {
@@ -123,7 +124,7 @@ export function encodeFrameQR(text, options = {}) {
123
124
  analysis = validateCanvasSpec(versionFor(matrix), canvas);
124
125
  } catch (error) {
125
126
  if (error instanceof EncodeError) throw error;
126
- throw new EncodeError(`Sythos Canvas QR: invalid canvas: ${error.message}`);
127
+ throw new EncodeError(`FrameQR Code: invalid canvas: ${error.message}`);
127
128
  }
128
129
  if (!analysis.safe) {
129
130
  unsafeAnalysis = analysis;
@@ -136,13 +137,13 @@ export function encodeFrameQR(text, options = {}) {
136
137
  if (!selected) {
137
138
  if (unsafeAnalysis) {
138
139
  throw new EncodeError(
139
- 'Sythos Canvas QR: canvas is not safe for the selected QR version; ' +
140
+ 'FrameQR Code: canvas is not safe for the selected QR version; ' +
140
141
  `it touches ${unsafeAnalysis.touchedCodewordCount} codewords and has ` +
141
142
  `a per-block correction budget of ${unsafeAnalysis.correctionBudgetPerBlock}`
142
143
  );
143
144
  }
144
145
  if (capacityError) throw capacityError;
145
- throw new EncodeError('Sythos Canvas QR: unable to select a QR version');
146
+ throw new EncodeError('FrameQR Code: unable to select a QR version');
146
147
  }
147
148
 
148
149
  const { matrix, canvas } = selected;
@@ -4,6 +4,7 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
7
8
  *
8
9
  * Permission is hereby granted, free of charge, to any person obtaining a copy
9
10
  * of this software and associated documentation files (the "Software"), to deal