@ircam/comote-helpers 1.0.1 → 1.0.4

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 (198) hide show
  1. package/README.md +9 -0
  2. package/package.json +4 -1
  3. package/.babelrc +0 -5
  4. package/.github/workflows/main.yml +0 -45
  5. package/.history/.gitignore_20250415160643 +0 -6
  6. package/.history/.gitignore_20250415160723 +0 -6
  7. package/.history/examples/simple-webview/package-lock_20250415130242.json +0 -5109
  8. package/.history/examples/simple-webview/package-lock_20250416103557.json +0 -5109
  9. package/.history/examples/simple-webview/package_20250415130704.json +0 -26
  10. package/.history/examples/simple-webview/package_20250415184837.json +0 -26
  11. package/.history/examples/simple-webview/package_20250415190300.json +0 -23
  12. package/.history/examples/simple-webview/src/server_20250415105733.js +0 -20
  13. package/.history/examples/simple-webview/src/server_20250415184604.js +0 -20
  14. package/.history/examples/soundworks/package_20250415132431.json +0 -35
  15. package/.history/examples/soundworks/package_20250416105956.json +0 -35
  16. package/.history/max/CoMote/examples/simple-webview/package_20250415184836.json +0 -26
  17. package/.history/max/CoMote/examples/simple-webview/package_20250415185949.json +0 -23
  18. package/.history/max/CoMote/examples/simple-webview/package_20250415185950.json +0 -23
  19. package/.history/max/CoMote/package-info_20241018173608.json +0 -41
  20. package/.history/max/CoMote/package-info_20250416105743.json +0 -27
  21. package/.history/max/CoMote/package-info_20250416105826.json +0 -27
  22. package/.history/max/CoMote/source/comote-connect/package_20250415132759.json +0 -19
  23. package/.history/max/CoMote/source/comote-connect/package_20250416110158.json +0 -19
  24. package/.history/max/CoMote/source/comote-connect/server_20250414175059.js +0 -193
  25. package/.history/max/CoMote/source/comote-connect/server_20250415180549.js +0 -193
  26. package/.history/package_20250415143437.json +0 -26
  27. package/.history/package_20250416105907.json +0 -26
  28. package/examples/simple-webview/README.md +0 -10
  29. package/examples/simple-webview/build/comote-simple-webview-server.js +0 -44
  30. package/examples/simple-webview/package-lock.json +0 -5109
  31. package/examples/simple-webview/package.json +0 -23
  32. package/examples/simple-webview/public/favicon.ico +0 -0
  33. package/examples/simple-webview/public/index.html +0 -13
  34. package/examples/simple-webview/public/index.mjs +0 -3623
  35. package/examples/simple-webview/public/styles.css +0 -99
  36. package/examples/simple-webview/src/client.js +0 -35
  37. package/examples/simple-webview/src/server.js +0 -20
  38. package/examples/soundworks/.build/clients/components/sw-audit.js +0 -64
  39. package/examples/soundworks/.build/clients/components/sw-audit.js.map +0 -1
  40. package/examples/soundworks/.build/clients/components/sw-credits.js +0 -73
  41. package/examples/soundworks/.build/clients/components/sw-credits.js.map +0 -1
  42. package/examples/soundworks/.build/clients/player/.editorbackup/PlayerExperience.js~ +0 -131
  43. package/examples/soundworks/.build/clients/player/index.js +0 -116
  44. package/examples/soundworks/.build/clients/player/index.js.map +0 -1
  45. package/examples/soundworks/.build/clients/styles/app.scss +0 -79
  46. package/examples/soundworks/.build/clients/styles/normalize.scss +0 -359
  47. package/examples/soundworks/.build/clients/webview/index.js +0 -72
  48. package/examples/soundworks/.build/clients/webview/index.js.map +0 -1
  49. package/examples/soundworks/.build/public/css/app.css +0 -76
  50. package/examples/soundworks/.build/public/css/app.css.map +0 -1
  51. package/examples/soundworks/.build/public/css/normalize.css +0 -321
  52. package/examples/soundworks/.build/public/css/normalize.css.map +0 -1
  53. package/examples/soundworks/.build/public/player.js +0 -98098
  54. package/examples/soundworks/.build/public/player.js.map +0 -1
  55. package/examples/soundworks/.build/public/webview.js +0 -50725
  56. package/examples/soundworks/.build/public/webview.js.map +0 -1
  57. package/examples/soundworks/.build/server/index.js +0 -57
  58. package/examples/soundworks/.build/server/index.js.map +0 -1
  59. package/examples/soundworks/.build/server/schemas/.gitkeep +0 -1
  60. package/examples/soundworks/.build/server/schemas/global.js +0 -19
  61. package/examples/soundworks/.build/server/schemas/global.js.map +0 -1
  62. package/examples/soundworks/.build/server/tmpl/default.tmpl +0 -27
  63. package/examples/soundworks/.build/utils/catch-unhandled-errors.js +0 -9
  64. package/examples/soundworks/.build/utils/catch-unhandled-errors.js.map +0 -1
  65. package/examples/soundworks/.editorconfig +0 -12
  66. package/examples/soundworks/.eslintrc +0 -3
  67. package/examples/soundworks/.soundworks +0 -7
  68. package/examples/soundworks/.vendors/public/webcomponentsjs/CHANGELOG.md +0 -76
  69. package/examples/soundworks/.vendors/public/webcomponentsjs/LICENSE.md +0 -19
  70. package/examples/soundworks/.vendors/public/webcomponentsjs/README.md +0 -259
  71. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-ce.js +0 -63
  72. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-ce.js.map +0 -1
  73. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_dom.js +0 -62
  74. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_dom.js.map +0 -1
  75. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_js.js +0 -95
  76. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_js.js.map +0 -1
  77. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +0 -374
  78. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +0 -1
  79. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce.js +0 -240
  80. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +0 -1
  81. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd.js +0 -196
  82. package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd.js.map +0 -1
  83. package/examples/soundworks/.vendors/public/webcomponentsjs/custom-elements-es5-adapter.js +0 -15
  84. package/examples/soundworks/.vendors/public/webcomponentsjs/package.json +0 -51
  85. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js +0 -16
  86. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js +0 -55
  87. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js +0 -17
  88. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-pf_dom-index.js +0 -19
  89. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-pf_js-index.js +0 -13
  90. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js +0 -19
  91. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js +0 -25
  92. package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js +0 -18
  93. package/examples/soundworks/.vendors/public/webcomponentsjs/src/flag-parser.js +0 -69
  94. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/baseuri.js +0 -28
  95. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/after.js +0 -47
  96. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/before.js +0 -40
  97. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/index.js +0 -14
  98. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/remove.js +0 -37
  99. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/replace-with.js +0 -42
  100. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/custom-event.js +0 -79
  101. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/es6-misc.js +0 -38
  102. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/event-listener-options.js +0 -122
  103. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/get-attribute-names.js +0 -27
  104. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/matches.js +0 -21
  105. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/append.js +0 -31
  106. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/index.js +0 -13
  107. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/prepend.js +0 -42
  108. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/replace-children.js +0 -45
  109. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/promise.js +0 -50
  110. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/svg-element-class-list.js +0 -28
  111. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/symbol.js +0 -64
  112. package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/toggle-attribute.js +0 -39
  113. package/examples/soundworks/.vendors/public/webcomponentsjs/src/unresolved.js +0 -32
  114. package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.d.ts +0 -175
  115. package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.js +0 -384
  116. package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.js.map +0 -1
  117. package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-loader.js +0 -238
  118. package/examples/soundworks/LICENSE +0 -28
  119. package/examples/soundworks/README.md +0 -26
  120. package/examples/soundworks/config/application.yaml +0 -8
  121. package/examples/soundworks/config/env-default.yaml +0 -12
  122. package/examples/soundworks/package.json +0 -35
  123. package/examples/soundworks/public/favicon.ico +0 -0
  124. package/examples/soundworks/public/images/loader.gif +0 -0
  125. package/examples/soundworks/src/clients/components/sw-audit.js +0 -78
  126. package/examples/soundworks/src/clients/components/sw-credits.js +0 -80
  127. package/examples/soundworks/src/clients/player/.editorbackup/PlayerExperience.js~ +0 -131
  128. package/examples/soundworks/src/clients/player/index.js +0 -118
  129. package/examples/soundworks/src/clients/styles/app.scss +0 -79
  130. package/examples/soundworks/src/clients/styles/normalize.scss +0 -359
  131. package/examples/soundworks/src/clients/webview/index.js +0 -78
  132. package/examples/soundworks/src/server/index.js +0 -62
  133. package/examples/soundworks/src/server/schemas/.gitkeep +0 -1
  134. package/examples/soundworks/src/server/schemas/global.js +0 -18
  135. package/examples/soundworks/src/server/tmpl/default.tmpl +0 -27
  136. package/examples/soundworks/src/utils/catch-unhandled-errors.js +0 -9
  137. package/index.html +0 -51
  138. package/max/CoMote/docs/sw.shared-state.maxref.xml +0 -95
  139. package/max/CoMote/examples/simple-webview/README.md +0 -10
  140. package/max/CoMote/examples/simple-webview/build/comote-simple-webview-server.js +0 -44
  141. package/max/CoMote/examples/simple-webview/comote-simple-webview-server.maxpat +0 -186
  142. package/max/CoMote/examples/simple-webview/package-lock.json +0 -5109
  143. package/max/CoMote/examples/simple-webview/package.json +0 -23
  144. package/max/CoMote/examples/simple-webview/public/favicon.ico +0 -0
  145. package/max/CoMote/examples/simple-webview/public/index.html +0 -13
  146. package/max/CoMote/examples/simple-webview/public/index.mjs +0 -3623
  147. package/max/CoMote/examples/simple-webview/public/styles.css +0 -99
  148. package/max/CoMote/examples/simple-webview/src/client.js +0 -35
  149. package/max/CoMote/examples/simple-webview/src/server.js +0 -20
  150. package/max/CoMote/examples/soundworks/.editorconfig +0 -12
  151. package/max/CoMote/examples/soundworks/.eslintrc +0 -3
  152. package/max/CoMote/examples/soundworks/.soundworks +0 -7
  153. package/max/CoMote/examples/soundworks/LICENSE +0 -28
  154. package/max/CoMote/examples/soundworks/README.md +0 -26
  155. package/max/CoMote/examples/soundworks/config/application.yaml +0 -8
  156. package/max/CoMote/examples/soundworks/config/env-default.yaml +0 -12
  157. package/max/CoMote/examples/soundworks/package.json +0 -35
  158. package/max/CoMote/examples/soundworks/public/favicon.ico +0 -0
  159. package/max/CoMote/examples/soundworks/public/images/loader.gif +0 -0
  160. package/max/CoMote/examples/soundworks/src/clients/components/sw-audit.js +0 -78
  161. package/max/CoMote/examples/soundworks/src/clients/components/sw-credits.js +0 -80
  162. package/max/CoMote/examples/soundworks/src/clients/player/.editorbackup/PlayerExperience.js~ +0 -131
  163. package/max/CoMote/examples/soundworks/src/clients/player/index.js +0 -118
  164. package/max/CoMote/examples/soundworks/src/clients/styles/app.scss +0 -79
  165. package/max/CoMote/examples/soundworks/src/clients/styles/normalize.scss +0 -359
  166. package/max/CoMote/examples/soundworks/src/clients/webview/index.js +0 -78
  167. package/max/CoMote/examples/soundworks/src/server/index.js +0 -62
  168. package/max/CoMote/examples/soundworks/src/server/schemas/.gitkeep +0 -1
  169. package/max/CoMote/examples/soundworks/src/server/schemas/global.js +0 -18
  170. package/max/CoMote/examples/soundworks/src/server/tmpl/default.tmpl +0 -27
  171. package/max/CoMote/examples/soundworks/src/utils/catch-unhandled-errors.js +0 -9
  172. package/max/CoMote/extras/CoMote.maxpat +0 -1994
  173. package/max/CoMote/help/comote_osc_receive.maxhelp +0 -946
  174. package/max/CoMote/icon.png +0 -0
  175. package/max/CoMote/init/objectmappings.txt +0 -2
  176. package/max/CoMote/media/comote-screenshot.png +0 -0
  177. package/max/CoMote/package-info.json +0 -27
  178. package/max/CoMote/patchers/comote-connect/comote-connect-public/comote-connect-client.mjs +0 -2821
  179. package/max/CoMote/patchers/comote-connect/comote-connect-public/favicon.ico +0 -0
  180. package/max/CoMote/patchers/comote-connect/comote-connect-public/index.html +0 -22
  181. package/max/CoMote/patchers/comote-connect/comote-connect-server.js +0 -24775
  182. package/max/CoMote/patchers/comote-connect/comote-connect.maxpat +0 -1048
  183. package/max/CoMote/patchers/comote-connect/package.json +0 -4
  184. package/max/CoMote/patchers/comote_format_from_comote_v2.maxpat +0 -613
  185. package/max/CoMote/patchers/comote_format_from_v3.maxpat +0 -443
  186. package/max/CoMote/patchers/comote_format_gyro_v2_to_v3.maxpat +0 -240
  187. package/max/CoMote/patchers/comote_format_gyro_v3_to_v2.maxpat +0 -240
  188. package/max/CoMote/patchers/comote_format_heading_v2_to_v3.maxpat +0 -171
  189. package/max/CoMote/patchers/comote_osc_receive.maxpat +0 -440
  190. package/max/CoMote/patchers/comote_osc_to_list.maxpat +0 -161
  191. package/max/CoMote/readme.md +0 -22
  192. package/max/CoMote/source/comote-connect/client.js +0 -104
  193. package/max/CoMote/source/comote-connect/package-lock.json +0 -591
  194. package/max/CoMote/source/comote-connect/package.json +0 -19
  195. package/max/CoMote/source/comote-connect/server.js +0 -193
  196. package/max-update.bash +0 -44
  197. package/src/.editorbackup/network-infos.js~ +0 -60
  198. package/src/.editorbackup/wifi-infos.js~ +0 -33
@@ -1,2821 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- // If the importer is in node compatibility mode or this is not an ESM
20
- // file that has been converted to a CommonJS file using a Babel-
21
- // compatible transform (i.e. "__esModule" has not been set), then set
22
- // "default" to the CommonJS "module.exports" for node compatibility.
23
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
- mod
25
- ));
26
-
27
- // ../../../../node_modules/qrcode/lib/can-promise.js
28
- var require_can_promise = __commonJS({
29
- "../../../../node_modules/qrcode/lib/can-promise.js"(exports, module) {
30
- module.exports = function() {
31
- return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
32
- };
33
- }
34
- });
35
-
36
- // ../../../../node_modules/qrcode/lib/core/utils.js
37
- var require_utils = __commonJS({
38
- "../../../../node_modules/qrcode/lib/core/utils.js"(exports) {
39
- var toSJISFunction;
40
- var CODEWORDS_COUNT = [
41
- 0,
42
- // Not used
43
- 26,
44
- 44,
45
- 70,
46
- 100,
47
- 134,
48
- 172,
49
- 196,
50
- 242,
51
- 292,
52
- 346,
53
- 404,
54
- 466,
55
- 532,
56
- 581,
57
- 655,
58
- 733,
59
- 815,
60
- 901,
61
- 991,
62
- 1085,
63
- 1156,
64
- 1258,
65
- 1364,
66
- 1474,
67
- 1588,
68
- 1706,
69
- 1828,
70
- 1921,
71
- 2051,
72
- 2185,
73
- 2323,
74
- 2465,
75
- 2611,
76
- 2761,
77
- 2876,
78
- 3034,
79
- 3196,
80
- 3362,
81
- 3532,
82
- 3706
83
- ];
84
- exports.getSymbolSize = function getSymbolSize(version) {
85
- if (!version) throw new Error('"version" cannot be null or undefined');
86
- if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40');
87
- return version * 4 + 17;
88
- };
89
- exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {
90
- return CODEWORDS_COUNT[version];
91
- };
92
- exports.getBCHDigit = function(data) {
93
- let digit = 0;
94
- while (data !== 0) {
95
- digit++;
96
- data >>>= 1;
97
- }
98
- return digit;
99
- };
100
- exports.setToSJISFunction = function setToSJISFunction(f3) {
101
- if (typeof f3 !== "function") {
102
- throw new Error('"toSJISFunc" is not a valid function.');
103
- }
104
- toSJISFunction = f3;
105
- };
106
- exports.isKanjiModeEnabled = function() {
107
- return typeof toSJISFunction !== "undefined";
108
- };
109
- exports.toSJIS = function toSJIS(kanji) {
110
- return toSJISFunction(kanji);
111
- };
112
- }
113
- });
114
-
115
- // ../../../../node_modules/qrcode/lib/core/error-correction-level.js
116
- var require_error_correction_level = __commonJS({
117
- "../../../../node_modules/qrcode/lib/core/error-correction-level.js"(exports) {
118
- exports.L = { bit: 1 };
119
- exports.M = { bit: 0 };
120
- exports.Q = { bit: 3 };
121
- exports.H = { bit: 2 };
122
- function fromString(string) {
123
- if (typeof string !== "string") {
124
- throw new Error("Param is not a string");
125
- }
126
- const lcStr = string.toLowerCase();
127
- switch (lcStr) {
128
- case "l":
129
- case "low":
130
- return exports.L;
131
- case "m":
132
- case "medium":
133
- return exports.M;
134
- case "q":
135
- case "quartile":
136
- return exports.Q;
137
- case "h":
138
- case "high":
139
- return exports.H;
140
- default:
141
- throw new Error("Unknown EC Level: " + string);
142
- }
143
- }
144
- exports.isValid = function isValid(level) {
145
- return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;
146
- };
147
- exports.from = function from(value, defaultValue) {
148
- if (exports.isValid(value)) {
149
- return value;
150
- }
151
- try {
152
- return fromString(value);
153
- } catch (e4) {
154
- return defaultValue;
155
- }
156
- };
157
- }
158
- });
159
-
160
- // ../../../../node_modules/qrcode/lib/core/bit-buffer.js
161
- var require_bit_buffer = __commonJS({
162
- "../../../../node_modules/qrcode/lib/core/bit-buffer.js"(exports, module) {
163
- function BitBuffer() {
164
- this.buffer = [];
165
- this.length = 0;
166
- }
167
- BitBuffer.prototype = {
168
- get: function(index) {
169
- const bufIndex = Math.floor(index / 8);
170
- return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;
171
- },
172
- put: function(num, length) {
173
- for (let i5 = 0; i5 < length; i5++) {
174
- this.putBit((num >>> length - i5 - 1 & 1) === 1);
175
- }
176
- },
177
- getLengthInBits: function() {
178
- return this.length;
179
- },
180
- putBit: function(bit) {
181
- const bufIndex = Math.floor(this.length / 8);
182
- if (this.buffer.length <= bufIndex) {
183
- this.buffer.push(0);
184
- }
185
- if (bit) {
186
- this.buffer[bufIndex] |= 128 >>> this.length % 8;
187
- }
188
- this.length++;
189
- }
190
- };
191
- module.exports = BitBuffer;
192
- }
193
- });
194
-
195
- // ../../../../node_modules/qrcode/lib/core/bit-matrix.js
196
- var require_bit_matrix = __commonJS({
197
- "../../../../node_modules/qrcode/lib/core/bit-matrix.js"(exports, module) {
198
- function BitMatrix(size) {
199
- if (!size || size < 1) {
200
- throw new Error("BitMatrix size must be defined and greater than 0");
201
- }
202
- this.size = size;
203
- this.data = new Uint8Array(size * size);
204
- this.reservedBit = new Uint8Array(size * size);
205
- }
206
- BitMatrix.prototype.set = function(row, col, value, reserved) {
207
- const index = row * this.size + col;
208
- this.data[index] = value;
209
- if (reserved) this.reservedBit[index] = true;
210
- };
211
- BitMatrix.prototype.get = function(row, col) {
212
- return this.data[row * this.size + col];
213
- };
214
- BitMatrix.prototype.xor = function(row, col, value) {
215
- this.data[row * this.size + col] ^= value;
216
- };
217
- BitMatrix.prototype.isReserved = function(row, col) {
218
- return this.reservedBit[row * this.size + col];
219
- };
220
- module.exports = BitMatrix;
221
- }
222
- });
223
-
224
- // ../../../../node_modules/qrcode/lib/core/alignment-pattern.js
225
- var require_alignment_pattern = __commonJS({
226
- "../../../../node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {
227
- var getSymbolSize = require_utils().getSymbolSize;
228
- exports.getRowColCoords = function getRowColCoords(version) {
229
- if (version === 1) return [];
230
- const posCount = Math.floor(version / 7) + 2;
231
- const size = getSymbolSize(version);
232
- const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
233
- const positions = [size - 7];
234
- for (let i5 = 1; i5 < posCount - 1; i5++) {
235
- positions[i5] = positions[i5 - 1] - intervals;
236
- }
237
- positions.push(6);
238
- return positions.reverse();
239
- };
240
- exports.getPositions = function getPositions(version) {
241
- const coords = [];
242
- const pos = exports.getRowColCoords(version);
243
- const posLength = pos.length;
244
- for (let i5 = 0; i5 < posLength; i5++) {
245
- for (let j2 = 0; j2 < posLength; j2++) {
246
- if (i5 === 0 && j2 === 0 || // top-left
247
- i5 === 0 && j2 === posLength - 1 || // bottom-left
248
- i5 === posLength - 1 && j2 === 0) {
249
- continue;
250
- }
251
- coords.push([pos[i5], pos[j2]]);
252
- }
253
- }
254
- return coords;
255
- };
256
- }
257
- });
258
-
259
- // ../../../../node_modules/qrcode/lib/core/finder-pattern.js
260
- var require_finder_pattern = __commonJS({
261
- "../../../../node_modules/qrcode/lib/core/finder-pattern.js"(exports) {
262
- var getSymbolSize = require_utils().getSymbolSize;
263
- var FINDER_PATTERN_SIZE = 7;
264
- exports.getPositions = function getPositions(version) {
265
- const size = getSymbolSize(version);
266
- return [
267
- // top-left
268
- [0, 0],
269
- // top-right
270
- [size - FINDER_PATTERN_SIZE, 0],
271
- // bottom-left
272
- [0, size - FINDER_PATTERN_SIZE]
273
- ];
274
- };
275
- }
276
- });
277
-
278
- // ../../../../node_modules/qrcode/lib/core/mask-pattern.js
279
- var require_mask_pattern = __commonJS({
280
- "../../../../node_modules/qrcode/lib/core/mask-pattern.js"(exports) {
281
- exports.Patterns = {
282
- PATTERN000: 0,
283
- PATTERN001: 1,
284
- PATTERN010: 2,
285
- PATTERN011: 3,
286
- PATTERN100: 4,
287
- PATTERN101: 5,
288
- PATTERN110: 6,
289
- PATTERN111: 7
290
- };
291
- var PenaltyScores = {
292
- N1: 3,
293
- N2: 3,
294
- N3: 40,
295
- N4: 10
296
- };
297
- exports.isValid = function isValid(mask) {
298
- return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;
299
- };
300
- exports.from = function from(value) {
301
- return exports.isValid(value) ? parseInt(value, 10) : void 0;
302
- };
303
- exports.getPenaltyN1 = function getPenaltyN1(data) {
304
- const size = data.size;
305
- let points = 0;
306
- let sameCountCol = 0;
307
- let sameCountRow = 0;
308
- let lastCol = null;
309
- let lastRow = null;
310
- for (let row = 0; row < size; row++) {
311
- sameCountCol = sameCountRow = 0;
312
- lastCol = lastRow = null;
313
- for (let col = 0; col < size; col++) {
314
- let module2 = data.get(row, col);
315
- if (module2 === lastCol) {
316
- sameCountCol++;
317
- } else {
318
- if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
319
- lastCol = module2;
320
- sameCountCol = 1;
321
- }
322
- module2 = data.get(col, row);
323
- if (module2 === lastRow) {
324
- sameCountRow++;
325
- } else {
326
- if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
327
- lastRow = module2;
328
- sameCountRow = 1;
329
- }
330
- }
331
- if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
332
- if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
333
- }
334
- return points;
335
- };
336
- exports.getPenaltyN2 = function getPenaltyN2(data) {
337
- const size = data.size;
338
- let points = 0;
339
- for (let row = 0; row < size - 1; row++) {
340
- for (let col = 0; col < size - 1; col++) {
341
- const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);
342
- if (last === 4 || last === 0) points++;
343
- }
344
- }
345
- return points * PenaltyScores.N2;
346
- };
347
- exports.getPenaltyN3 = function getPenaltyN3(data) {
348
- const size = data.size;
349
- let points = 0;
350
- let bitsCol = 0;
351
- let bitsRow = 0;
352
- for (let row = 0; row < size; row++) {
353
- bitsCol = bitsRow = 0;
354
- for (let col = 0; col < size; col++) {
355
- bitsCol = bitsCol << 1 & 2047 | data.get(row, col);
356
- if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;
357
- bitsRow = bitsRow << 1 & 2047 | data.get(col, row);
358
- if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;
359
- }
360
- }
361
- return points * PenaltyScores.N3;
362
- };
363
- exports.getPenaltyN4 = function getPenaltyN4(data) {
364
- let darkCount = 0;
365
- const modulesCount = data.data.length;
366
- for (let i5 = 0; i5 < modulesCount; i5++) darkCount += data.data[i5];
367
- const k2 = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);
368
- return k2 * PenaltyScores.N4;
369
- };
370
- function getMaskAt(maskPattern, i5, j2) {
371
- switch (maskPattern) {
372
- case exports.Patterns.PATTERN000:
373
- return (i5 + j2) % 2 === 0;
374
- case exports.Patterns.PATTERN001:
375
- return i5 % 2 === 0;
376
- case exports.Patterns.PATTERN010:
377
- return j2 % 3 === 0;
378
- case exports.Patterns.PATTERN011:
379
- return (i5 + j2) % 3 === 0;
380
- case exports.Patterns.PATTERN100:
381
- return (Math.floor(i5 / 2) + Math.floor(j2 / 3)) % 2 === 0;
382
- case exports.Patterns.PATTERN101:
383
- return i5 * j2 % 2 + i5 * j2 % 3 === 0;
384
- case exports.Patterns.PATTERN110:
385
- return (i5 * j2 % 2 + i5 * j2 % 3) % 2 === 0;
386
- case exports.Patterns.PATTERN111:
387
- return (i5 * j2 % 3 + (i5 + j2) % 2) % 2 === 0;
388
- default:
389
- throw new Error("bad maskPattern:" + maskPattern);
390
- }
391
- }
392
- exports.applyMask = function applyMask(pattern, data) {
393
- const size = data.size;
394
- for (let col = 0; col < size; col++) {
395
- for (let row = 0; row < size; row++) {
396
- if (data.isReserved(row, col)) continue;
397
- data.xor(row, col, getMaskAt(pattern, row, col));
398
- }
399
- }
400
- };
401
- exports.getBestMask = function getBestMask(data, setupFormatFunc) {
402
- const numPatterns = Object.keys(exports.Patterns).length;
403
- let bestPattern = 0;
404
- let lowerPenalty = Infinity;
405
- for (let p3 = 0; p3 < numPatterns; p3++) {
406
- setupFormatFunc(p3);
407
- exports.applyMask(p3, data);
408
- const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);
409
- exports.applyMask(p3, data);
410
- if (penalty < lowerPenalty) {
411
- lowerPenalty = penalty;
412
- bestPattern = p3;
413
- }
414
- }
415
- return bestPattern;
416
- };
417
- }
418
- });
419
-
420
- // ../../../../node_modules/qrcode/lib/core/error-correction-code.js
421
- var require_error_correction_code = __commonJS({
422
- "../../../../node_modules/qrcode/lib/core/error-correction-code.js"(exports) {
423
- var ECLevel = require_error_correction_level();
424
- var EC_BLOCKS_TABLE = [
425
- // L M Q H
426
- 1,
427
- 1,
428
- 1,
429
- 1,
430
- 1,
431
- 1,
432
- 1,
433
- 1,
434
- 1,
435
- 1,
436
- 2,
437
- 2,
438
- 1,
439
- 2,
440
- 2,
441
- 4,
442
- 1,
443
- 2,
444
- 4,
445
- 4,
446
- 2,
447
- 4,
448
- 4,
449
- 4,
450
- 2,
451
- 4,
452
- 6,
453
- 5,
454
- 2,
455
- 4,
456
- 6,
457
- 6,
458
- 2,
459
- 5,
460
- 8,
461
- 8,
462
- 4,
463
- 5,
464
- 8,
465
- 8,
466
- 4,
467
- 5,
468
- 8,
469
- 11,
470
- 4,
471
- 8,
472
- 10,
473
- 11,
474
- 4,
475
- 9,
476
- 12,
477
- 16,
478
- 4,
479
- 9,
480
- 16,
481
- 16,
482
- 6,
483
- 10,
484
- 12,
485
- 18,
486
- 6,
487
- 10,
488
- 17,
489
- 16,
490
- 6,
491
- 11,
492
- 16,
493
- 19,
494
- 6,
495
- 13,
496
- 18,
497
- 21,
498
- 7,
499
- 14,
500
- 21,
501
- 25,
502
- 8,
503
- 16,
504
- 20,
505
- 25,
506
- 8,
507
- 17,
508
- 23,
509
- 25,
510
- 9,
511
- 17,
512
- 23,
513
- 34,
514
- 9,
515
- 18,
516
- 25,
517
- 30,
518
- 10,
519
- 20,
520
- 27,
521
- 32,
522
- 12,
523
- 21,
524
- 29,
525
- 35,
526
- 12,
527
- 23,
528
- 34,
529
- 37,
530
- 12,
531
- 25,
532
- 34,
533
- 40,
534
- 13,
535
- 26,
536
- 35,
537
- 42,
538
- 14,
539
- 28,
540
- 38,
541
- 45,
542
- 15,
543
- 29,
544
- 40,
545
- 48,
546
- 16,
547
- 31,
548
- 43,
549
- 51,
550
- 17,
551
- 33,
552
- 45,
553
- 54,
554
- 18,
555
- 35,
556
- 48,
557
- 57,
558
- 19,
559
- 37,
560
- 51,
561
- 60,
562
- 19,
563
- 38,
564
- 53,
565
- 63,
566
- 20,
567
- 40,
568
- 56,
569
- 66,
570
- 21,
571
- 43,
572
- 59,
573
- 70,
574
- 22,
575
- 45,
576
- 62,
577
- 74,
578
- 24,
579
- 47,
580
- 65,
581
- 77,
582
- 25,
583
- 49,
584
- 68,
585
- 81
586
- ];
587
- var EC_CODEWORDS_TABLE = [
588
- // L M Q H
589
- 7,
590
- 10,
591
- 13,
592
- 17,
593
- 10,
594
- 16,
595
- 22,
596
- 28,
597
- 15,
598
- 26,
599
- 36,
600
- 44,
601
- 20,
602
- 36,
603
- 52,
604
- 64,
605
- 26,
606
- 48,
607
- 72,
608
- 88,
609
- 36,
610
- 64,
611
- 96,
612
- 112,
613
- 40,
614
- 72,
615
- 108,
616
- 130,
617
- 48,
618
- 88,
619
- 132,
620
- 156,
621
- 60,
622
- 110,
623
- 160,
624
- 192,
625
- 72,
626
- 130,
627
- 192,
628
- 224,
629
- 80,
630
- 150,
631
- 224,
632
- 264,
633
- 96,
634
- 176,
635
- 260,
636
- 308,
637
- 104,
638
- 198,
639
- 288,
640
- 352,
641
- 120,
642
- 216,
643
- 320,
644
- 384,
645
- 132,
646
- 240,
647
- 360,
648
- 432,
649
- 144,
650
- 280,
651
- 408,
652
- 480,
653
- 168,
654
- 308,
655
- 448,
656
- 532,
657
- 180,
658
- 338,
659
- 504,
660
- 588,
661
- 196,
662
- 364,
663
- 546,
664
- 650,
665
- 224,
666
- 416,
667
- 600,
668
- 700,
669
- 224,
670
- 442,
671
- 644,
672
- 750,
673
- 252,
674
- 476,
675
- 690,
676
- 816,
677
- 270,
678
- 504,
679
- 750,
680
- 900,
681
- 300,
682
- 560,
683
- 810,
684
- 960,
685
- 312,
686
- 588,
687
- 870,
688
- 1050,
689
- 336,
690
- 644,
691
- 952,
692
- 1110,
693
- 360,
694
- 700,
695
- 1020,
696
- 1200,
697
- 390,
698
- 728,
699
- 1050,
700
- 1260,
701
- 420,
702
- 784,
703
- 1140,
704
- 1350,
705
- 450,
706
- 812,
707
- 1200,
708
- 1440,
709
- 480,
710
- 868,
711
- 1290,
712
- 1530,
713
- 510,
714
- 924,
715
- 1350,
716
- 1620,
717
- 540,
718
- 980,
719
- 1440,
720
- 1710,
721
- 570,
722
- 1036,
723
- 1530,
724
- 1800,
725
- 570,
726
- 1064,
727
- 1590,
728
- 1890,
729
- 600,
730
- 1120,
731
- 1680,
732
- 1980,
733
- 630,
734
- 1204,
735
- 1770,
736
- 2100,
737
- 660,
738
- 1260,
739
- 1860,
740
- 2220,
741
- 720,
742
- 1316,
743
- 1950,
744
- 2310,
745
- 750,
746
- 1372,
747
- 2040,
748
- 2430
749
- ];
750
- exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {
751
- switch (errorCorrectionLevel) {
752
- case ECLevel.L:
753
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];
754
- case ECLevel.M:
755
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];
756
- case ECLevel.Q:
757
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];
758
- case ECLevel.H:
759
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];
760
- default:
761
- return void 0;
762
- }
763
- };
764
- exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {
765
- switch (errorCorrectionLevel) {
766
- case ECLevel.L:
767
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];
768
- case ECLevel.M:
769
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];
770
- case ECLevel.Q:
771
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];
772
- case ECLevel.H:
773
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];
774
- default:
775
- return void 0;
776
- }
777
- };
778
- }
779
- });
780
-
781
- // ../../../../node_modules/qrcode/lib/core/galois-field.js
782
- var require_galois_field = __commonJS({
783
- "../../../../node_modules/qrcode/lib/core/galois-field.js"(exports) {
784
- var EXP_TABLE = new Uint8Array(512);
785
- var LOG_TABLE = new Uint8Array(256);
786
- (function initTables() {
787
- let x2 = 1;
788
- for (let i5 = 0; i5 < 255; i5++) {
789
- EXP_TABLE[i5] = x2;
790
- LOG_TABLE[x2] = i5;
791
- x2 <<= 1;
792
- if (x2 & 256) {
793
- x2 ^= 285;
794
- }
795
- }
796
- for (let i5 = 255; i5 < 512; i5++) {
797
- EXP_TABLE[i5] = EXP_TABLE[i5 - 255];
798
- }
799
- })();
800
- exports.log = function log(n4) {
801
- if (n4 < 1) throw new Error("log(" + n4 + ")");
802
- return LOG_TABLE[n4];
803
- };
804
- exports.exp = function exp(n4) {
805
- return EXP_TABLE[n4];
806
- };
807
- exports.mul = function mul(x2, y3) {
808
- if (x2 === 0 || y3 === 0) return 0;
809
- return EXP_TABLE[LOG_TABLE[x2] + LOG_TABLE[y3]];
810
- };
811
- }
812
- });
813
-
814
- // ../../../../node_modules/qrcode/lib/core/polynomial.js
815
- var require_polynomial = __commonJS({
816
- "../../../../node_modules/qrcode/lib/core/polynomial.js"(exports) {
817
- var GF = require_galois_field();
818
- exports.mul = function mul(p1, p22) {
819
- const coeff = new Uint8Array(p1.length + p22.length - 1);
820
- for (let i5 = 0; i5 < p1.length; i5++) {
821
- for (let j2 = 0; j2 < p22.length; j2++) {
822
- coeff[i5 + j2] ^= GF.mul(p1[i5], p22[j2]);
823
- }
824
- }
825
- return coeff;
826
- };
827
- exports.mod = function mod(divident, divisor) {
828
- let result = new Uint8Array(divident);
829
- while (result.length - divisor.length >= 0) {
830
- const coeff = result[0];
831
- for (let i5 = 0; i5 < divisor.length; i5++) {
832
- result[i5] ^= GF.mul(divisor[i5], coeff);
833
- }
834
- let offset = 0;
835
- while (offset < result.length && result[offset] === 0) offset++;
836
- result = result.slice(offset);
837
- }
838
- return result;
839
- };
840
- exports.generateECPolynomial = function generateECPolynomial(degree) {
841
- let poly = new Uint8Array([1]);
842
- for (let i5 = 0; i5 < degree; i5++) {
843
- poly = exports.mul(poly, new Uint8Array([1, GF.exp(i5)]));
844
- }
845
- return poly;
846
- };
847
- }
848
- });
849
-
850
- // ../../../../node_modules/qrcode/lib/core/reed-solomon-encoder.js
851
- var require_reed_solomon_encoder = __commonJS({
852
- "../../../../node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module) {
853
- var Polynomial = require_polynomial();
854
- function ReedSolomonEncoder(degree) {
855
- this.genPoly = void 0;
856
- this.degree = degree;
857
- if (this.degree) this.initialize(this.degree);
858
- }
859
- ReedSolomonEncoder.prototype.initialize = function initialize(degree) {
860
- this.degree = degree;
861
- this.genPoly = Polynomial.generateECPolynomial(this.degree);
862
- };
863
- ReedSolomonEncoder.prototype.encode = function encode(data) {
864
- if (!this.genPoly) {
865
- throw new Error("Encoder not initialized");
866
- }
867
- const paddedData = new Uint8Array(data.length + this.degree);
868
- paddedData.set(data);
869
- const remainder = Polynomial.mod(paddedData, this.genPoly);
870
- const start = this.degree - remainder.length;
871
- if (start > 0) {
872
- const buff = new Uint8Array(this.degree);
873
- buff.set(remainder, start);
874
- return buff;
875
- }
876
- return remainder;
877
- };
878
- module.exports = ReedSolomonEncoder;
879
- }
880
- });
881
-
882
- // ../../../../node_modules/qrcode/lib/core/version-check.js
883
- var require_version_check = __commonJS({
884
- "../../../../node_modules/qrcode/lib/core/version-check.js"(exports) {
885
- exports.isValid = function isValid(version) {
886
- return !isNaN(version) && version >= 1 && version <= 40;
887
- };
888
- }
889
- });
890
-
891
- // ../../../../node_modules/qrcode/lib/core/regex.js
892
- var require_regex = __commonJS({
893
- "../../../../node_modules/qrcode/lib/core/regex.js"(exports) {
894
- var numeric = "[0-9]+";
895
- var alphanumeric = "[A-Z $%*+\\-./:]+";
896
- var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
897
- kanji = kanji.replace(/u/g, "\\u");
898
- var byte = "(?:(?![A-Z0-9 $%*+\\-./:]|" + kanji + ")(?:.|[\r\n]))+";
899
- exports.KANJI = new RegExp(kanji, "g");
900
- exports.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
901
- exports.BYTE = new RegExp(byte, "g");
902
- exports.NUMERIC = new RegExp(numeric, "g");
903
- exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");
904
- var TEST_KANJI = new RegExp("^" + kanji + "$");
905
- var TEST_NUMERIC = new RegExp("^" + numeric + "$");
906
- var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
907
- exports.testKanji = function testKanji(str) {
908
- return TEST_KANJI.test(str);
909
- };
910
- exports.testNumeric = function testNumeric(str) {
911
- return TEST_NUMERIC.test(str);
912
- };
913
- exports.testAlphanumeric = function testAlphanumeric(str) {
914
- return TEST_ALPHANUMERIC.test(str);
915
- };
916
- }
917
- });
918
-
919
- // ../../../../node_modules/qrcode/lib/core/mode.js
920
- var require_mode = __commonJS({
921
- "../../../../node_modules/qrcode/lib/core/mode.js"(exports) {
922
- var VersionCheck = require_version_check();
923
- var Regex = require_regex();
924
- exports.NUMERIC = {
925
- id: "Numeric",
926
- bit: 1 << 0,
927
- ccBits: [10, 12, 14]
928
- };
929
- exports.ALPHANUMERIC = {
930
- id: "Alphanumeric",
931
- bit: 1 << 1,
932
- ccBits: [9, 11, 13]
933
- };
934
- exports.BYTE = {
935
- id: "Byte",
936
- bit: 1 << 2,
937
- ccBits: [8, 16, 16]
938
- };
939
- exports.KANJI = {
940
- id: "Kanji",
941
- bit: 1 << 3,
942
- ccBits: [8, 10, 12]
943
- };
944
- exports.MIXED = {
945
- bit: -1
946
- };
947
- exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {
948
- if (!mode.ccBits) throw new Error("Invalid mode: " + mode);
949
- if (!VersionCheck.isValid(version)) {
950
- throw new Error("Invalid version: " + version);
951
- }
952
- if (version >= 1 && version < 10) return mode.ccBits[0];
953
- else if (version < 27) return mode.ccBits[1];
954
- return mode.ccBits[2];
955
- };
956
- exports.getBestModeForData = function getBestModeForData(dataStr) {
957
- if (Regex.testNumeric(dataStr)) return exports.NUMERIC;
958
- else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;
959
- else if (Regex.testKanji(dataStr)) return exports.KANJI;
960
- else return exports.BYTE;
961
- };
962
- exports.toString = function toString(mode) {
963
- if (mode && mode.id) return mode.id;
964
- throw new Error("Invalid mode");
965
- };
966
- exports.isValid = function isValid(mode) {
967
- return mode && mode.bit && mode.ccBits;
968
- };
969
- function fromString(string) {
970
- if (typeof string !== "string") {
971
- throw new Error("Param is not a string");
972
- }
973
- const lcStr = string.toLowerCase();
974
- switch (lcStr) {
975
- case "numeric":
976
- return exports.NUMERIC;
977
- case "alphanumeric":
978
- return exports.ALPHANUMERIC;
979
- case "kanji":
980
- return exports.KANJI;
981
- case "byte":
982
- return exports.BYTE;
983
- default:
984
- throw new Error("Unknown mode: " + string);
985
- }
986
- }
987
- exports.from = function from(value, defaultValue) {
988
- if (exports.isValid(value)) {
989
- return value;
990
- }
991
- try {
992
- return fromString(value);
993
- } catch (e4) {
994
- return defaultValue;
995
- }
996
- };
997
- }
998
- });
999
-
1000
- // ../../../../node_modules/qrcode/lib/core/version.js
1001
- var require_version = __commonJS({
1002
- "../../../../node_modules/qrcode/lib/core/version.js"(exports) {
1003
- var Utils = require_utils();
1004
- var ECCode = require_error_correction_code();
1005
- var ECLevel = require_error_correction_level();
1006
- var Mode = require_mode();
1007
- var VersionCheck = require_version_check();
1008
- var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
1009
- var G18_BCH = Utils.getBCHDigit(G18);
1010
- function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {
1011
- for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
1012
- if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
1013
- return currentVersion;
1014
- }
1015
- }
1016
- return void 0;
1017
- }
1018
- function getReservedBitsCount(mode, version) {
1019
- return Mode.getCharCountIndicator(mode, version) + 4;
1020
- }
1021
- function getTotalBitsFromDataArray(segments, version) {
1022
- let totalBits = 0;
1023
- segments.forEach(function(data) {
1024
- const reservedBits = getReservedBitsCount(data.mode, version);
1025
- totalBits += reservedBits + data.getBitsLength();
1026
- });
1027
- return totalBits;
1028
- }
1029
- function getBestVersionForMixedData(segments, errorCorrectionLevel) {
1030
- for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
1031
- const length = getTotalBitsFromDataArray(segments, currentVersion);
1032
- if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {
1033
- return currentVersion;
1034
- }
1035
- }
1036
- return void 0;
1037
- }
1038
- exports.from = function from(value, defaultValue) {
1039
- if (VersionCheck.isValid(value)) {
1040
- return parseInt(value, 10);
1041
- }
1042
- return defaultValue;
1043
- };
1044
- exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {
1045
- if (!VersionCheck.isValid(version)) {
1046
- throw new Error("Invalid QR Code version");
1047
- }
1048
- if (typeof mode === "undefined") mode = Mode.BYTE;
1049
- const totalCodewords = Utils.getSymbolTotalCodewords(version);
1050
- const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1051
- const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
1052
- if (mode === Mode.MIXED) return dataTotalCodewordsBits;
1053
- const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);
1054
- switch (mode) {
1055
- case Mode.NUMERIC:
1056
- return Math.floor(usableBits / 10 * 3);
1057
- case Mode.ALPHANUMERIC:
1058
- return Math.floor(usableBits / 11 * 2);
1059
- case Mode.KANJI:
1060
- return Math.floor(usableBits / 13);
1061
- case Mode.BYTE:
1062
- default:
1063
- return Math.floor(usableBits / 8);
1064
- }
1065
- };
1066
- exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {
1067
- let seg;
1068
- const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);
1069
- if (Array.isArray(data)) {
1070
- if (data.length > 1) {
1071
- return getBestVersionForMixedData(data, ecl);
1072
- }
1073
- if (data.length === 0) {
1074
- return 1;
1075
- }
1076
- seg = data[0];
1077
- } else {
1078
- seg = data;
1079
- }
1080
- return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);
1081
- };
1082
- exports.getEncodedBits = function getEncodedBits(version) {
1083
- if (!VersionCheck.isValid(version) || version < 7) {
1084
- throw new Error("Invalid QR Code version");
1085
- }
1086
- let d3 = version << 12;
1087
- while (Utils.getBCHDigit(d3) - G18_BCH >= 0) {
1088
- d3 ^= G18 << Utils.getBCHDigit(d3) - G18_BCH;
1089
- }
1090
- return version << 12 | d3;
1091
- };
1092
- }
1093
- });
1094
-
1095
- // ../../../../node_modules/qrcode/lib/core/format-info.js
1096
- var require_format_info = __commonJS({
1097
- "../../../../node_modules/qrcode/lib/core/format-info.js"(exports) {
1098
- var Utils = require_utils();
1099
- var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
1100
- var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
1101
- var G15_BCH = Utils.getBCHDigit(G15);
1102
- exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {
1103
- const data = errorCorrectionLevel.bit << 3 | mask;
1104
- let d3 = data << 10;
1105
- while (Utils.getBCHDigit(d3) - G15_BCH >= 0) {
1106
- d3 ^= G15 << Utils.getBCHDigit(d3) - G15_BCH;
1107
- }
1108
- return (data << 10 | d3) ^ G15_MASK;
1109
- };
1110
- }
1111
- });
1112
-
1113
- // ../../../../node_modules/qrcode/lib/core/numeric-data.js
1114
- var require_numeric_data = __commonJS({
1115
- "../../../../node_modules/qrcode/lib/core/numeric-data.js"(exports, module) {
1116
- var Mode = require_mode();
1117
- function NumericData(data) {
1118
- this.mode = Mode.NUMERIC;
1119
- this.data = data.toString();
1120
- }
1121
- NumericData.getBitsLength = function getBitsLength(length) {
1122
- return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);
1123
- };
1124
- NumericData.prototype.getLength = function getLength() {
1125
- return this.data.length;
1126
- };
1127
- NumericData.prototype.getBitsLength = function getBitsLength() {
1128
- return NumericData.getBitsLength(this.data.length);
1129
- };
1130
- NumericData.prototype.write = function write(bitBuffer) {
1131
- let i5, group, value;
1132
- for (i5 = 0; i5 + 3 <= this.data.length; i5 += 3) {
1133
- group = this.data.substr(i5, 3);
1134
- value = parseInt(group, 10);
1135
- bitBuffer.put(value, 10);
1136
- }
1137
- const remainingNum = this.data.length - i5;
1138
- if (remainingNum > 0) {
1139
- group = this.data.substr(i5);
1140
- value = parseInt(group, 10);
1141
- bitBuffer.put(value, remainingNum * 3 + 1);
1142
- }
1143
- };
1144
- module.exports = NumericData;
1145
- }
1146
- });
1147
-
1148
- // ../../../../node_modules/qrcode/lib/core/alphanumeric-data.js
1149
- var require_alphanumeric_data = __commonJS({
1150
- "../../../../node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module) {
1151
- var Mode = require_mode();
1152
- var ALPHA_NUM_CHARS = [
1153
- "0",
1154
- "1",
1155
- "2",
1156
- "3",
1157
- "4",
1158
- "5",
1159
- "6",
1160
- "7",
1161
- "8",
1162
- "9",
1163
- "A",
1164
- "B",
1165
- "C",
1166
- "D",
1167
- "E",
1168
- "F",
1169
- "G",
1170
- "H",
1171
- "I",
1172
- "J",
1173
- "K",
1174
- "L",
1175
- "M",
1176
- "N",
1177
- "O",
1178
- "P",
1179
- "Q",
1180
- "R",
1181
- "S",
1182
- "T",
1183
- "U",
1184
- "V",
1185
- "W",
1186
- "X",
1187
- "Y",
1188
- "Z",
1189
- " ",
1190
- "$",
1191
- "%",
1192
- "*",
1193
- "+",
1194
- "-",
1195
- ".",
1196
- "/",
1197
- ":"
1198
- ];
1199
- function AlphanumericData(data) {
1200
- this.mode = Mode.ALPHANUMERIC;
1201
- this.data = data;
1202
- }
1203
- AlphanumericData.getBitsLength = function getBitsLength(length) {
1204
- return 11 * Math.floor(length / 2) + 6 * (length % 2);
1205
- };
1206
- AlphanumericData.prototype.getLength = function getLength() {
1207
- return this.data.length;
1208
- };
1209
- AlphanumericData.prototype.getBitsLength = function getBitsLength() {
1210
- return AlphanumericData.getBitsLength(this.data.length);
1211
- };
1212
- AlphanumericData.prototype.write = function write(bitBuffer) {
1213
- let i5;
1214
- for (i5 = 0; i5 + 2 <= this.data.length; i5 += 2) {
1215
- let value = ALPHA_NUM_CHARS.indexOf(this.data[i5]) * 45;
1216
- value += ALPHA_NUM_CHARS.indexOf(this.data[i5 + 1]);
1217
- bitBuffer.put(value, 11);
1218
- }
1219
- if (this.data.length % 2) {
1220
- bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i5]), 6);
1221
- }
1222
- };
1223
- module.exports = AlphanumericData;
1224
- }
1225
- });
1226
-
1227
- // ../../../../node_modules/qrcode/lib/core/byte-data.js
1228
- var require_byte_data = __commonJS({
1229
- "../../../../node_modules/qrcode/lib/core/byte-data.js"(exports, module) {
1230
- var Mode = require_mode();
1231
- function ByteData(data) {
1232
- this.mode = Mode.BYTE;
1233
- if (typeof data === "string") {
1234
- this.data = new TextEncoder().encode(data);
1235
- } else {
1236
- this.data = new Uint8Array(data);
1237
- }
1238
- }
1239
- ByteData.getBitsLength = function getBitsLength(length) {
1240
- return length * 8;
1241
- };
1242
- ByteData.prototype.getLength = function getLength() {
1243
- return this.data.length;
1244
- };
1245
- ByteData.prototype.getBitsLength = function getBitsLength() {
1246
- return ByteData.getBitsLength(this.data.length);
1247
- };
1248
- ByteData.prototype.write = function(bitBuffer) {
1249
- for (let i5 = 0, l3 = this.data.length; i5 < l3; i5++) {
1250
- bitBuffer.put(this.data[i5], 8);
1251
- }
1252
- };
1253
- module.exports = ByteData;
1254
- }
1255
- });
1256
-
1257
- // ../../../../node_modules/qrcode/lib/core/kanji-data.js
1258
- var require_kanji_data = __commonJS({
1259
- "../../../../node_modules/qrcode/lib/core/kanji-data.js"(exports, module) {
1260
- var Mode = require_mode();
1261
- var Utils = require_utils();
1262
- function KanjiData(data) {
1263
- this.mode = Mode.KANJI;
1264
- this.data = data;
1265
- }
1266
- KanjiData.getBitsLength = function getBitsLength(length) {
1267
- return length * 13;
1268
- };
1269
- KanjiData.prototype.getLength = function getLength() {
1270
- return this.data.length;
1271
- };
1272
- KanjiData.prototype.getBitsLength = function getBitsLength() {
1273
- return KanjiData.getBitsLength(this.data.length);
1274
- };
1275
- KanjiData.prototype.write = function(bitBuffer) {
1276
- let i5;
1277
- for (i5 = 0; i5 < this.data.length; i5++) {
1278
- let value = Utils.toSJIS(this.data[i5]);
1279
- if (value >= 33088 && value <= 40956) {
1280
- value -= 33088;
1281
- } else if (value >= 57408 && value <= 60351) {
1282
- value -= 49472;
1283
- } else {
1284
- throw new Error(
1285
- "Invalid SJIS character: " + this.data[i5] + "\nMake sure your charset is UTF-8"
1286
- );
1287
- }
1288
- value = (value >>> 8 & 255) * 192 + (value & 255);
1289
- bitBuffer.put(value, 13);
1290
- }
1291
- };
1292
- module.exports = KanjiData;
1293
- }
1294
- });
1295
-
1296
- // ../../../../node_modules/dijkstrajs/dijkstra.js
1297
- var require_dijkstra = __commonJS({
1298
- "../../../../node_modules/dijkstrajs/dijkstra.js"(exports, module) {
1299
- "use strict";
1300
- var dijkstra = {
1301
- single_source_shortest_paths: function(graph, s4, d3) {
1302
- var predecessors = {};
1303
- var costs = {};
1304
- costs[s4] = 0;
1305
- var open = dijkstra.PriorityQueue.make();
1306
- open.push(s4, 0);
1307
- var closest, u3, v2, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
1308
- while (!open.empty()) {
1309
- closest = open.pop();
1310
- u3 = closest.value;
1311
- cost_of_s_to_u = closest.cost;
1312
- adjacent_nodes = graph[u3] || {};
1313
- for (v2 in adjacent_nodes) {
1314
- if (adjacent_nodes.hasOwnProperty(v2)) {
1315
- cost_of_e = adjacent_nodes[v2];
1316
- cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
1317
- cost_of_s_to_v = costs[v2];
1318
- first_visit = typeof costs[v2] === "undefined";
1319
- if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
1320
- costs[v2] = cost_of_s_to_u_plus_cost_of_e;
1321
- open.push(v2, cost_of_s_to_u_plus_cost_of_e);
1322
- predecessors[v2] = u3;
1323
- }
1324
- }
1325
- }
1326
- }
1327
- if (typeof d3 !== "undefined" && typeof costs[d3] === "undefined") {
1328
- var msg = ["Could not find a path from ", s4, " to ", d3, "."].join("");
1329
- throw new Error(msg);
1330
- }
1331
- return predecessors;
1332
- },
1333
- extract_shortest_path_from_predecessor_list: function(predecessors, d3) {
1334
- var nodes = [];
1335
- var u3 = d3;
1336
- var predecessor;
1337
- while (u3) {
1338
- nodes.push(u3);
1339
- predecessor = predecessors[u3];
1340
- u3 = predecessors[u3];
1341
- }
1342
- nodes.reverse();
1343
- return nodes;
1344
- },
1345
- find_path: function(graph, s4, d3) {
1346
- var predecessors = dijkstra.single_source_shortest_paths(graph, s4, d3);
1347
- return dijkstra.extract_shortest_path_from_predecessor_list(
1348
- predecessors,
1349
- d3
1350
- );
1351
- },
1352
- /**
1353
- * A very naive priority queue implementation.
1354
- */
1355
- PriorityQueue: {
1356
- make: function(opts) {
1357
- var T2 = dijkstra.PriorityQueue, t3 = {}, key;
1358
- opts = opts || {};
1359
- for (key in T2) {
1360
- if (T2.hasOwnProperty(key)) {
1361
- t3[key] = T2[key];
1362
- }
1363
- }
1364
- t3.queue = [];
1365
- t3.sorter = opts.sorter || T2.default_sorter;
1366
- return t3;
1367
- },
1368
- default_sorter: function(a3, b3) {
1369
- return a3.cost - b3.cost;
1370
- },
1371
- /**
1372
- * Add a new item to the queue and ensure the highest priority element
1373
- * is at the front of the queue.
1374
- */
1375
- push: function(value, cost) {
1376
- var item = { value, cost };
1377
- this.queue.push(item);
1378
- this.queue.sort(this.sorter);
1379
- },
1380
- /**
1381
- * Return the highest priority element in the queue.
1382
- */
1383
- pop: function() {
1384
- return this.queue.shift();
1385
- },
1386
- empty: function() {
1387
- return this.queue.length === 0;
1388
- }
1389
- }
1390
- };
1391
- if (typeof module !== "undefined") {
1392
- module.exports = dijkstra;
1393
- }
1394
- }
1395
- });
1396
-
1397
- // ../../../../node_modules/qrcode/lib/core/segments.js
1398
- var require_segments = __commonJS({
1399
- "../../../../node_modules/qrcode/lib/core/segments.js"(exports) {
1400
- var Mode = require_mode();
1401
- var NumericData = require_numeric_data();
1402
- var AlphanumericData = require_alphanumeric_data();
1403
- var ByteData = require_byte_data();
1404
- var KanjiData = require_kanji_data();
1405
- var Regex = require_regex();
1406
- var Utils = require_utils();
1407
- var dijkstra = require_dijkstra();
1408
- function getStringByteLength(str) {
1409
- return unescape(encodeURIComponent(str)).length;
1410
- }
1411
- function getSegments(regex, mode, str) {
1412
- const segments = [];
1413
- let result;
1414
- while ((result = regex.exec(str)) !== null) {
1415
- segments.push({
1416
- data: result[0],
1417
- index: result.index,
1418
- mode,
1419
- length: result[0].length
1420
- });
1421
- }
1422
- return segments;
1423
- }
1424
- function getSegmentsFromString(dataStr) {
1425
- const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);
1426
- const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);
1427
- let byteSegs;
1428
- let kanjiSegs;
1429
- if (Utils.isKanjiModeEnabled()) {
1430
- byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);
1431
- kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);
1432
- } else {
1433
- byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);
1434
- kanjiSegs = [];
1435
- }
1436
- const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
1437
- return segs.sort(function(s1, s22) {
1438
- return s1.index - s22.index;
1439
- }).map(function(obj) {
1440
- return {
1441
- data: obj.data,
1442
- mode: obj.mode,
1443
- length: obj.length
1444
- };
1445
- });
1446
- }
1447
- function getSegmentBitsLength(length, mode) {
1448
- switch (mode) {
1449
- case Mode.NUMERIC:
1450
- return NumericData.getBitsLength(length);
1451
- case Mode.ALPHANUMERIC:
1452
- return AlphanumericData.getBitsLength(length);
1453
- case Mode.KANJI:
1454
- return KanjiData.getBitsLength(length);
1455
- case Mode.BYTE:
1456
- return ByteData.getBitsLength(length);
1457
- }
1458
- }
1459
- function mergeSegments(segs) {
1460
- return segs.reduce(function(acc, curr) {
1461
- const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
1462
- if (prevSeg && prevSeg.mode === curr.mode) {
1463
- acc[acc.length - 1].data += curr.data;
1464
- return acc;
1465
- }
1466
- acc.push(curr);
1467
- return acc;
1468
- }, []);
1469
- }
1470
- function buildNodes(segs) {
1471
- const nodes = [];
1472
- for (let i5 = 0; i5 < segs.length; i5++) {
1473
- const seg = segs[i5];
1474
- switch (seg.mode) {
1475
- case Mode.NUMERIC:
1476
- nodes.push([
1477
- seg,
1478
- { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },
1479
- { data: seg.data, mode: Mode.BYTE, length: seg.length }
1480
- ]);
1481
- break;
1482
- case Mode.ALPHANUMERIC:
1483
- nodes.push([
1484
- seg,
1485
- { data: seg.data, mode: Mode.BYTE, length: seg.length }
1486
- ]);
1487
- break;
1488
- case Mode.KANJI:
1489
- nodes.push([
1490
- seg,
1491
- { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
1492
- ]);
1493
- break;
1494
- case Mode.BYTE:
1495
- nodes.push([
1496
- { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }
1497
- ]);
1498
- }
1499
- }
1500
- return nodes;
1501
- }
1502
- function buildGraph(nodes, version) {
1503
- const table = {};
1504
- const graph = { start: {} };
1505
- let prevNodeIds = ["start"];
1506
- for (let i5 = 0; i5 < nodes.length; i5++) {
1507
- const nodeGroup = nodes[i5];
1508
- const currentNodeIds = [];
1509
- for (let j2 = 0; j2 < nodeGroup.length; j2++) {
1510
- const node = nodeGroup[j2];
1511
- const key = "" + i5 + j2;
1512
- currentNodeIds.push(key);
1513
- table[key] = { node, lastCount: 0 };
1514
- graph[key] = {};
1515
- for (let n4 = 0; n4 < prevNodeIds.length; n4++) {
1516
- const prevNodeId = prevNodeIds[n4];
1517
- if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
1518
- graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
1519
- table[prevNodeId].lastCount += node.length;
1520
- } else {
1521
- if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
1522
- graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);
1523
- }
1524
- }
1525
- }
1526
- prevNodeIds = currentNodeIds;
1527
- }
1528
- for (let n4 = 0; n4 < prevNodeIds.length; n4++) {
1529
- graph[prevNodeIds[n4]].end = 0;
1530
- }
1531
- return { map: graph, table };
1532
- }
1533
- function buildSingleSegment(data, modesHint) {
1534
- let mode;
1535
- const bestMode = Mode.getBestModeForData(data);
1536
- mode = Mode.from(modesHint, bestMode);
1537
- if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {
1538
- throw new Error('"' + data + '" cannot be encoded with mode ' + Mode.toString(mode) + ".\n Suggested mode is: " + Mode.toString(bestMode));
1539
- }
1540
- if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {
1541
- mode = Mode.BYTE;
1542
- }
1543
- switch (mode) {
1544
- case Mode.NUMERIC:
1545
- return new NumericData(data);
1546
- case Mode.ALPHANUMERIC:
1547
- return new AlphanumericData(data);
1548
- case Mode.KANJI:
1549
- return new KanjiData(data);
1550
- case Mode.BYTE:
1551
- return new ByteData(data);
1552
- }
1553
- }
1554
- exports.fromArray = function fromArray(array) {
1555
- return array.reduce(function(acc, seg) {
1556
- if (typeof seg === "string") {
1557
- acc.push(buildSingleSegment(seg, null));
1558
- } else if (seg.data) {
1559
- acc.push(buildSingleSegment(seg.data, seg.mode));
1560
- }
1561
- return acc;
1562
- }, []);
1563
- };
1564
- exports.fromString = function fromString(data, version) {
1565
- const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
1566
- const nodes = buildNodes(segs);
1567
- const graph = buildGraph(nodes, version);
1568
- const path = dijkstra.find_path(graph.map, "start", "end");
1569
- const optimizedSegs = [];
1570
- for (let i5 = 1; i5 < path.length - 1; i5++) {
1571
- optimizedSegs.push(graph.table[path[i5]].node);
1572
- }
1573
- return exports.fromArray(mergeSegments(optimizedSegs));
1574
- };
1575
- exports.rawSplit = function rawSplit(data) {
1576
- return exports.fromArray(
1577
- getSegmentsFromString(data, Utils.isKanjiModeEnabled())
1578
- );
1579
- };
1580
- }
1581
- });
1582
-
1583
- // ../../../../node_modules/qrcode/lib/core/qrcode.js
1584
- var require_qrcode = __commonJS({
1585
- "../../../../node_modules/qrcode/lib/core/qrcode.js"(exports) {
1586
- var Utils = require_utils();
1587
- var ECLevel = require_error_correction_level();
1588
- var BitBuffer = require_bit_buffer();
1589
- var BitMatrix = require_bit_matrix();
1590
- var AlignmentPattern = require_alignment_pattern();
1591
- var FinderPattern = require_finder_pattern();
1592
- var MaskPattern = require_mask_pattern();
1593
- var ECCode = require_error_correction_code();
1594
- var ReedSolomonEncoder = require_reed_solomon_encoder();
1595
- var Version = require_version();
1596
- var FormatInfo = require_format_info();
1597
- var Mode = require_mode();
1598
- var Segments = require_segments();
1599
- function setupFinderPattern(matrix, version) {
1600
- const size = matrix.size;
1601
- const pos = FinderPattern.getPositions(version);
1602
- for (let i5 = 0; i5 < pos.length; i5++) {
1603
- const row = pos[i5][0];
1604
- const col = pos[i5][1];
1605
- for (let r4 = -1; r4 <= 7; r4++) {
1606
- if (row + r4 <= -1 || size <= row + r4) continue;
1607
- for (let c4 = -1; c4 <= 7; c4++) {
1608
- if (col + c4 <= -1 || size <= col + c4) continue;
1609
- if (r4 >= 0 && r4 <= 6 && (c4 === 0 || c4 === 6) || c4 >= 0 && c4 <= 6 && (r4 === 0 || r4 === 6) || r4 >= 2 && r4 <= 4 && c4 >= 2 && c4 <= 4) {
1610
- matrix.set(row + r4, col + c4, true, true);
1611
- } else {
1612
- matrix.set(row + r4, col + c4, false, true);
1613
- }
1614
- }
1615
- }
1616
- }
1617
- }
1618
- function setupTimingPattern(matrix) {
1619
- const size = matrix.size;
1620
- for (let r4 = 8; r4 < size - 8; r4++) {
1621
- const value = r4 % 2 === 0;
1622
- matrix.set(r4, 6, value, true);
1623
- matrix.set(6, r4, value, true);
1624
- }
1625
- }
1626
- function setupAlignmentPattern(matrix, version) {
1627
- const pos = AlignmentPattern.getPositions(version);
1628
- for (let i5 = 0; i5 < pos.length; i5++) {
1629
- const row = pos[i5][0];
1630
- const col = pos[i5][1];
1631
- for (let r4 = -2; r4 <= 2; r4++) {
1632
- for (let c4 = -2; c4 <= 2; c4++) {
1633
- if (r4 === -2 || r4 === 2 || c4 === -2 || c4 === 2 || r4 === 0 && c4 === 0) {
1634
- matrix.set(row + r4, col + c4, true, true);
1635
- } else {
1636
- matrix.set(row + r4, col + c4, false, true);
1637
- }
1638
- }
1639
- }
1640
- }
1641
- }
1642
- function setupVersionInfo(matrix, version) {
1643
- const size = matrix.size;
1644
- const bits = Version.getEncodedBits(version);
1645
- let row, col, mod;
1646
- for (let i5 = 0; i5 < 18; i5++) {
1647
- row = Math.floor(i5 / 3);
1648
- col = i5 % 3 + size - 8 - 3;
1649
- mod = (bits >> i5 & 1) === 1;
1650
- matrix.set(row, col, mod, true);
1651
- matrix.set(col, row, mod, true);
1652
- }
1653
- }
1654
- function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {
1655
- const size = matrix.size;
1656
- const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
1657
- let i5, mod;
1658
- for (i5 = 0; i5 < 15; i5++) {
1659
- mod = (bits >> i5 & 1) === 1;
1660
- if (i5 < 6) {
1661
- matrix.set(i5, 8, mod, true);
1662
- } else if (i5 < 8) {
1663
- matrix.set(i5 + 1, 8, mod, true);
1664
- } else {
1665
- matrix.set(size - 15 + i5, 8, mod, true);
1666
- }
1667
- if (i5 < 8) {
1668
- matrix.set(8, size - i5 - 1, mod, true);
1669
- } else if (i5 < 9) {
1670
- matrix.set(8, 15 - i5 - 1 + 1, mod, true);
1671
- } else {
1672
- matrix.set(8, 15 - i5 - 1, mod, true);
1673
- }
1674
- }
1675
- matrix.set(size - 8, 8, 1, true);
1676
- }
1677
- function setupData(matrix, data) {
1678
- const size = matrix.size;
1679
- let inc = -1;
1680
- let row = size - 1;
1681
- let bitIndex = 7;
1682
- let byteIndex = 0;
1683
- for (let col = size - 1; col > 0; col -= 2) {
1684
- if (col === 6) col--;
1685
- while (true) {
1686
- for (let c4 = 0; c4 < 2; c4++) {
1687
- if (!matrix.isReserved(row, col - c4)) {
1688
- let dark = false;
1689
- if (byteIndex < data.length) {
1690
- dark = (data[byteIndex] >>> bitIndex & 1) === 1;
1691
- }
1692
- matrix.set(row, col - c4, dark);
1693
- bitIndex--;
1694
- if (bitIndex === -1) {
1695
- byteIndex++;
1696
- bitIndex = 7;
1697
- }
1698
- }
1699
- }
1700
- row += inc;
1701
- if (row < 0 || size <= row) {
1702
- row -= inc;
1703
- inc = -inc;
1704
- break;
1705
- }
1706
- }
1707
- }
1708
- }
1709
- function createData(version, errorCorrectionLevel, segments) {
1710
- const buffer = new BitBuffer();
1711
- segments.forEach(function(data) {
1712
- buffer.put(data.mode.bit, 4);
1713
- buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));
1714
- data.write(buffer);
1715
- });
1716
- const totalCodewords = Utils.getSymbolTotalCodewords(version);
1717
- const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1718
- const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
1719
- if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
1720
- buffer.put(0, 4);
1721
- }
1722
- while (buffer.getLengthInBits() % 8 !== 0) {
1723
- buffer.putBit(0);
1724
- }
1725
- const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
1726
- for (let i5 = 0; i5 < remainingByte; i5++) {
1727
- buffer.put(i5 % 2 ? 17 : 236, 8);
1728
- }
1729
- return createCodewords(buffer, version, errorCorrectionLevel);
1730
- }
1731
- function createCodewords(bitBuffer, version, errorCorrectionLevel) {
1732
- const totalCodewords = Utils.getSymbolTotalCodewords(version);
1733
- const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);
1734
- const dataTotalCodewords = totalCodewords - ecTotalCodewords;
1735
- const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);
1736
- const blocksInGroup2 = totalCodewords % ecTotalBlocks;
1737
- const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
1738
- const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
1739
- const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
1740
- const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
1741
- const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
1742
- const rs = new ReedSolomonEncoder(ecCount);
1743
- let offset = 0;
1744
- const dcData = new Array(ecTotalBlocks);
1745
- const ecData = new Array(ecTotalBlocks);
1746
- let maxDataSize = 0;
1747
- const buffer = new Uint8Array(bitBuffer.buffer);
1748
- for (let b3 = 0; b3 < ecTotalBlocks; b3++) {
1749
- const dataSize = b3 < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
1750
- dcData[b3] = buffer.slice(offset, offset + dataSize);
1751
- ecData[b3] = rs.encode(dcData[b3]);
1752
- offset += dataSize;
1753
- maxDataSize = Math.max(maxDataSize, dataSize);
1754
- }
1755
- const data = new Uint8Array(totalCodewords);
1756
- let index = 0;
1757
- let i5, r4;
1758
- for (i5 = 0; i5 < maxDataSize; i5++) {
1759
- for (r4 = 0; r4 < ecTotalBlocks; r4++) {
1760
- if (i5 < dcData[r4].length) {
1761
- data[index++] = dcData[r4][i5];
1762
- }
1763
- }
1764
- }
1765
- for (i5 = 0; i5 < ecCount; i5++) {
1766
- for (r4 = 0; r4 < ecTotalBlocks; r4++) {
1767
- data[index++] = ecData[r4][i5];
1768
- }
1769
- }
1770
- return data;
1771
- }
1772
- function createSymbol(data, version, errorCorrectionLevel, maskPattern) {
1773
- let segments;
1774
- if (Array.isArray(data)) {
1775
- segments = Segments.fromArray(data);
1776
- } else if (typeof data === "string") {
1777
- let estimatedVersion = version;
1778
- if (!estimatedVersion) {
1779
- const rawSegments = Segments.rawSplit(data);
1780
- estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);
1781
- }
1782
- segments = Segments.fromString(data, estimatedVersion || 40);
1783
- } else {
1784
- throw new Error("Invalid data");
1785
- }
1786
- const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);
1787
- if (!bestVersion) {
1788
- throw new Error("The amount of data is too big to be stored in a QR Code");
1789
- }
1790
- if (!version) {
1791
- version = bestVersion;
1792
- } else if (version < bestVersion) {
1793
- throw new Error(
1794
- "\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: " + bestVersion + ".\n"
1795
- );
1796
- }
1797
- const dataBits = createData(version, errorCorrectionLevel, segments);
1798
- const moduleCount = Utils.getSymbolSize(version);
1799
- const modules = new BitMatrix(moduleCount);
1800
- setupFinderPattern(modules, version);
1801
- setupTimingPattern(modules);
1802
- setupAlignmentPattern(modules, version);
1803
- setupFormatInfo(modules, errorCorrectionLevel, 0);
1804
- if (version >= 7) {
1805
- setupVersionInfo(modules, version);
1806
- }
1807
- setupData(modules, dataBits);
1808
- if (isNaN(maskPattern)) {
1809
- maskPattern = MaskPattern.getBestMask(
1810
- modules,
1811
- setupFormatInfo.bind(null, modules, errorCorrectionLevel)
1812
- );
1813
- }
1814
- MaskPattern.applyMask(maskPattern, modules);
1815
- setupFormatInfo(modules, errorCorrectionLevel, maskPattern);
1816
- return {
1817
- modules,
1818
- version,
1819
- errorCorrectionLevel,
1820
- maskPattern,
1821
- segments
1822
- };
1823
- }
1824
- exports.create = function create(data, options) {
1825
- if (typeof data === "undefined" || data === "") {
1826
- throw new Error("No input text");
1827
- }
1828
- let errorCorrectionLevel = ECLevel.M;
1829
- let version;
1830
- let mask;
1831
- if (typeof options !== "undefined") {
1832
- errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);
1833
- version = Version.from(options.version);
1834
- mask = MaskPattern.from(options.maskPattern);
1835
- if (options.toSJISFunc) {
1836
- Utils.setToSJISFunction(options.toSJISFunc);
1837
- }
1838
- }
1839
- return createSymbol(data, version, errorCorrectionLevel, mask);
1840
- };
1841
- }
1842
- });
1843
-
1844
- // ../../../../node_modules/qrcode/lib/renderer/utils.js
1845
- var require_utils2 = __commonJS({
1846
- "../../../../node_modules/qrcode/lib/renderer/utils.js"(exports) {
1847
- function hex2rgba(hex) {
1848
- if (typeof hex === "number") {
1849
- hex = hex.toString();
1850
- }
1851
- if (typeof hex !== "string") {
1852
- throw new Error("Color should be defined as hex string");
1853
- }
1854
- let hexCode = hex.slice().replace("#", "").split("");
1855
- if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
1856
- throw new Error("Invalid hex color: " + hex);
1857
- }
1858
- if (hexCode.length === 3 || hexCode.length === 4) {
1859
- hexCode = Array.prototype.concat.apply([], hexCode.map(function(c4) {
1860
- return [c4, c4];
1861
- }));
1862
- }
1863
- if (hexCode.length === 6) hexCode.push("F", "F");
1864
- const hexValue = parseInt(hexCode.join(""), 16);
1865
- return {
1866
- r: hexValue >> 24 & 255,
1867
- g: hexValue >> 16 & 255,
1868
- b: hexValue >> 8 & 255,
1869
- a: hexValue & 255,
1870
- hex: "#" + hexCode.slice(0, 6).join("")
1871
- };
1872
- }
1873
- exports.getOptions = function getOptions(options) {
1874
- if (!options) options = {};
1875
- if (!options.color) options.color = {};
1876
- const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;
1877
- const width = options.width && options.width >= 21 ? options.width : void 0;
1878
- const scale = options.scale || 4;
1879
- return {
1880
- width,
1881
- scale: width ? 4 : scale,
1882
- margin,
1883
- color: {
1884
- dark: hex2rgba(options.color.dark || "#000000ff"),
1885
- light: hex2rgba(options.color.light || "#ffffffff")
1886
- },
1887
- type: options.type,
1888
- rendererOpts: options.rendererOpts || {}
1889
- };
1890
- };
1891
- exports.getScale = function getScale(qrSize, opts) {
1892
- return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;
1893
- };
1894
- exports.getImageWidth = function getImageWidth(qrSize, opts) {
1895
- const scale = exports.getScale(qrSize, opts);
1896
- return Math.floor((qrSize + opts.margin * 2) * scale);
1897
- };
1898
- exports.qrToImageData = function qrToImageData(imgData, qr, opts) {
1899
- const size = qr.modules.size;
1900
- const data = qr.modules.data;
1901
- const scale = exports.getScale(size, opts);
1902
- const symbolSize = Math.floor((size + opts.margin * 2) * scale);
1903
- const scaledMargin = opts.margin * scale;
1904
- const palette = [opts.color.light, opts.color.dark];
1905
- for (let i5 = 0; i5 < symbolSize; i5++) {
1906
- for (let j2 = 0; j2 < symbolSize; j2++) {
1907
- let posDst = (i5 * symbolSize + j2) * 4;
1908
- let pxColor = opts.color.light;
1909
- if (i5 >= scaledMargin && j2 >= scaledMargin && i5 < symbolSize - scaledMargin && j2 < symbolSize - scaledMargin) {
1910
- const iSrc = Math.floor((i5 - scaledMargin) / scale);
1911
- const jSrc = Math.floor((j2 - scaledMargin) / scale);
1912
- pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
1913
- }
1914
- imgData[posDst++] = pxColor.r;
1915
- imgData[posDst++] = pxColor.g;
1916
- imgData[posDst++] = pxColor.b;
1917
- imgData[posDst] = pxColor.a;
1918
- }
1919
- }
1920
- };
1921
- }
1922
- });
1923
-
1924
- // ../../../../node_modules/qrcode/lib/renderer/canvas.js
1925
- var require_canvas = __commonJS({
1926
- "../../../../node_modules/qrcode/lib/renderer/canvas.js"(exports) {
1927
- var Utils = require_utils2();
1928
- function clearCanvas(ctx, canvas, size) {
1929
- ctx.clearRect(0, 0, canvas.width, canvas.height);
1930
- if (!canvas.style) canvas.style = {};
1931
- canvas.height = size;
1932
- canvas.width = size;
1933
- canvas.style.height = size + "px";
1934
- canvas.style.width = size + "px";
1935
- }
1936
- function getCanvasElement() {
1937
- try {
1938
- return document.createElement("canvas");
1939
- } catch (e4) {
1940
- throw new Error("You need to specify a canvas element");
1941
- }
1942
- }
1943
- exports.render = function render(qrData, canvas, options) {
1944
- let opts = options;
1945
- let canvasEl = canvas;
1946
- if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
1947
- opts = canvas;
1948
- canvas = void 0;
1949
- }
1950
- if (!canvas) {
1951
- canvasEl = getCanvasElement();
1952
- }
1953
- opts = Utils.getOptions(opts);
1954
- const size = Utils.getImageWidth(qrData.modules.size, opts);
1955
- const ctx = canvasEl.getContext("2d");
1956
- const image = ctx.createImageData(size, size);
1957
- Utils.qrToImageData(image.data, qrData, opts);
1958
- clearCanvas(ctx, canvasEl, size);
1959
- ctx.putImageData(image, 0, 0);
1960
- return canvasEl;
1961
- };
1962
- exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {
1963
- let opts = options;
1964
- if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {
1965
- opts = canvas;
1966
- canvas = void 0;
1967
- }
1968
- if (!opts) opts = {};
1969
- const canvasEl = exports.render(qrData, canvas, opts);
1970
- const type = opts.type || "image/png";
1971
- const rendererOpts = opts.rendererOpts || {};
1972
- return canvasEl.toDataURL(type, rendererOpts.quality);
1973
- };
1974
- }
1975
- });
1976
-
1977
- // ../../../../node_modules/qrcode/lib/renderer/svg-tag.js
1978
- var require_svg_tag = __commonJS({
1979
- "../../../../node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
1980
- var Utils = require_utils2();
1981
- function getColorAttrib(color, attrib) {
1982
- const alpha = color.a / 255;
1983
- const str = attrib + '="' + color.hex + '"';
1984
- return alpha < 1 ? str + " " + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str;
1985
- }
1986
- function svgCmd(cmd, x2, y3) {
1987
- let str = cmd + x2;
1988
- if (typeof y3 !== "undefined") str += " " + y3;
1989
- return str;
1990
- }
1991
- function qrToPath(data, size, margin) {
1992
- let path = "";
1993
- let moveBy = 0;
1994
- let newRow = false;
1995
- let lineLength = 0;
1996
- for (let i5 = 0; i5 < data.length; i5++) {
1997
- const col = Math.floor(i5 % size);
1998
- const row = Math.floor(i5 / size);
1999
- if (!col && !newRow) newRow = true;
2000
- if (data[i5]) {
2001
- lineLength++;
2002
- if (!(i5 > 0 && col > 0 && data[i5 - 1])) {
2003
- path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
2004
- moveBy = 0;
2005
- newRow = false;
2006
- }
2007
- if (!(col + 1 < size && data[i5 + 1])) {
2008
- path += svgCmd("h", lineLength);
2009
- lineLength = 0;
2010
- }
2011
- } else {
2012
- moveBy++;
2013
- }
2014
- }
2015
- return path;
2016
- }
2017
- exports.render = function render(qrData, options, cb) {
2018
- const opts = Utils.getOptions(options);
2019
- const size = qrData.modules.size;
2020
- const data = qrData.modules.data;
2021
- const qrcodesize = size + opts.margin * 2;
2022
- const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
2023
- const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
2024
- const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
2025
- const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
2026
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + "</svg>\n";
2027
- if (typeof cb === "function") {
2028
- cb(null, svgTag);
2029
- }
2030
- return svgTag;
2031
- };
2032
- }
2033
- });
2034
-
2035
- // ../../../../node_modules/qrcode/lib/browser.js
2036
- var require_browser = __commonJS({
2037
- "../../../../node_modules/qrcode/lib/browser.js"(exports) {
2038
- var canPromise = require_can_promise();
2039
- var QRCode2 = require_qrcode();
2040
- var CanvasRenderer = require_canvas();
2041
- var SvgRenderer = require_svg_tag();
2042
- function renderCanvas(renderFunc, canvas, text, opts, cb) {
2043
- const args = [].slice.call(arguments, 1);
2044
- const argsNum = args.length;
2045
- const isLastArgCb = typeof args[argsNum - 1] === "function";
2046
- if (!isLastArgCb && !canPromise()) {
2047
- throw new Error("Callback required as last argument");
2048
- }
2049
- if (isLastArgCb) {
2050
- if (argsNum < 2) {
2051
- throw new Error("Too few arguments provided");
2052
- }
2053
- if (argsNum === 2) {
2054
- cb = text;
2055
- text = canvas;
2056
- canvas = opts = void 0;
2057
- } else if (argsNum === 3) {
2058
- if (canvas.getContext && typeof cb === "undefined") {
2059
- cb = opts;
2060
- opts = void 0;
2061
- } else {
2062
- cb = opts;
2063
- opts = text;
2064
- text = canvas;
2065
- canvas = void 0;
2066
- }
2067
- }
2068
- } else {
2069
- if (argsNum < 1) {
2070
- throw new Error("Too few arguments provided");
2071
- }
2072
- if (argsNum === 1) {
2073
- text = canvas;
2074
- canvas = opts = void 0;
2075
- } else if (argsNum === 2 && !canvas.getContext) {
2076
- opts = text;
2077
- text = canvas;
2078
- canvas = void 0;
2079
- }
2080
- return new Promise(function(resolve, reject) {
2081
- try {
2082
- const data = QRCode2.create(text, opts);
2083
- resolve(renderFunc(data, canvas, opts));
2084
- } catch (e4) {
2085
- reject(e4);
2086
- }
2087
- });
2088
- }
2089
- try {
2090
- const data = QRCode2.create(text, opts);
2091
- cb(null, renderFunc(data, canvas, opts));
2092
- } catch (e4) {
2093
- cb(e4);
2094
- }
2095
- }
2096
- exports.create = QRCode2.create;
2097
- exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);
2098
- exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);
2099
- exports.toString = renderCanvas.bind(null, function(data, _2, opts) {
2100
- return SvgRenderer.render(data, opts);
2101
- });
2102
- }
2103
- });
2104
-
2105
- // node_modules/@lit/reactive-element/css-tag.js
2106
- var t = globalThis;
2107
- var e = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
2108
- var s = Symbol();
2109
- var o = /* @__PURE__ */ new WeakMap();
2110
- var n = class {
2111
- constructor(t3, e4, o5) {
2112
- if (this._$cssResult$ = true, o5 !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
2113
- this.cssText = t3, this.t = e4;
2114
- }
2115
- get styleSheet() {
2116
- let t3 = this.o;
2117
- const s4 = this.t;
2118
- if (e && void 0 === t3) {
2119
- const e4 = void 0 !== s4 && 1 === s4.length;
2120
- e4 && (t3 = o.get(s4)), void 0 === t3 && ((this.o = t3 = new CSSStyleSheet()).replaceSync(this.cssText), e4 && o.set(s4, t3));
2121
- }
2122
- return t3;
2123
- }
2124
- toString() {
2125
- return this.cssText;
2126
- }
2127
- };
2128
- var r = (t3) => new n("string" == typeof t3 ? t3 : t3 + "", void 0, s);
2129
- var S = (s4, o5) => {
2130
- if (e) s4.adoptedStyleSheets = o5.map((t3) => t3 instanceof CSSStyleSheet ? t3 : t3.styleSheet);
2131
- else for (const e4 of o5) {
2132
- const o6 = document.createElement("style"), n4 = t.litNonce;
2133
- void 0 !== n4 && o6.setAttribute("nonce", n4), o6.textContent = e4.cssText, s4.appendChild(o6);
2134
- }
2135
- };
2136
- var c = e ? (t3) => t3 : (t3) => t3 instanceof CSSStyleSheet ? ((t4) => {
2137
- let e4 = "";
2138
- for (const s4 of t4.cssRules) e4 += s4.cssText;
2139
- return r(e4);
2140
- })(t3) : t3;
2141
-
2142
- // node_modules/@lit/reactive-element/reactive-element.js
2143
- var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: h, getOwnPropertyNames: r2, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
2144
- var a = globalThis;
2145
- var c2 = a.trustedTypes;
2146
- var l = c2 ? c2.emptyScript : "";
2147
- var p = a.reactiveElementPolyfillSupport;
2148
- var d = (t3, s4) => t3;
2149
- var u = { toAttribute(t3, s4) {
2150
- switch (s4) {
2151
- case Boolean:
2152
- t3 = t3 ? l : null;
2153
- break;
2154
- case Object:
2155
- case Array:
2156
- t3 = null == t3 ? t3 : JSON.stringify(t3);
2157
- }
2158
- return t3;
2159
- }, fromAttribute(t3, s4) {
2160
- let i5 = t3;
2161
- switch (s4) {
2162
- case Boolean:
2163
- i5 = null !== t3;
2164
- break;
2165
- case Number:
2166
- i5 = null === t3 ? null : Number(t3);
2167
- break;
2168
- case Object:
2169
- case Array:
2170
- try {
2171
- i5 = JSON.parse(t3);
2172
- } catch (t4) {
2173
- i5 = null;
2174
- }
2175
- }
2176
- return i5;
2177
- } };
2178
- var f = (t3, s4) => !i2(t3, s4);
2179
- var b = { attribute: true, type: String, converter: u, reflect: false, useDefault: false, hasChanged: f };
2180
- Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
2181
- var y = class extends HTMLElement {
2182
- static addInitializer(t3) {
2183
- this._$Ei(), (this.l ??= []).push(t3);
2184
- }
2185
- static get observedAttributes() {
2186
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
2187
- }
2188
- static createProperty(t3, s4 = b) {
2189
- if (s4.state && (s4.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t3) && ((s4 = Object.create(s4)).wrapped = true), this.elementProperties.set(t3, s4), !s4.noAccessor) {
2190
- const i5 = Symbol(), h3 = this.getPropertyDescriptor(t3, i5, s4);
2191
- void 0 !== h3 && e2(this.prototype, t3, h3);
2192
- }
2193
- }
2194
- static getPropertyDescriptor(t3, s4, i5) {
2195
- const { get: e4, set: r4 } = h(this.prototype, t3) ?? { get() {
2196
- return this[s4];
2197
- }, set(t4) {
2198
- this[s4] = t4;
2199
- } };
2200
- return { get: e4, set(s5) {
2201
- const h3 = e4?.call(this);
2202
- r4?.call(this, s5), this.requestUpdate(t3, h3, i5);
2203
- }, configurable: true, enumerable: true };
2204
- }
2205
- static getPropertyOptions(t3) {
2206
- return this.elementProperties.get(t3) ?? b;
2207
- }
2208
- static _$Ei() {
2209
- if (this.hasOwnProperty(d("elementProperties"))) return;
2210
- const t3 = n2(this);
2211
- t3.finalize(), void 0 !== t3.l && (this.l = [...t3.l]), this.elementProperties = new Map(t3.elementProperties);
2212
- }
2213
- static finalize() {
2214
- if (this.hasOwnProperty(d("finalized"))) return;
2215
- if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
2216
- const t4 = this.properties, s4 = [...r2(t4), ...o2(t4)];
2217
- for (const i5 of s4) this.createProperty(i5, t4[i5]);
2218
- }
2219
- const t3 = this[Symbol.metadata];
2220
- if (null !== t3) {
2221
- const s4 = litPropertyMetadata.get(t3);
2222
- if (void 0 !== s4) for (const [t4, i5] of s4) this.elementProperties.set(t4, i5);
2223
- }
2224
- this._$Eh = /* @__PURE__ */ new Map();
2225
- for (const [t4, s4] of this.elementProperties) {
2226
- const i5 = this._$Eu(t4, s4);
2227
- void 0 !== i5 && this._$Eh.set(i5, t4);
2228
- }
2229
- this.elementStyles = this.finalizeStyles(this.styles);
2230
- }
2231
- static finalizeStyles(s4) {
2232
- const i5 = [];
2233
- if (Array.isArray(s4)) {
2234
- const e4 = new Set(s4.flat(1 / 0).reverse());
2235
- for (const s5 of e4) i5.unshift(c(s5));
2236
- } else void 0 !== s4 && i5.push(c(s4));
2237
- return i5;
2238
- }
2239
- static _$Eu(t3, s4) {
2240
- const i5 = s4.attribute;
2241
- return false === i5 ? void 0 : "string" == typeof i5 ? i5 : "string" == typeof t3 ? t3.toLowerCase() : void 0;
2242
- }
2243
- constructor() {
2244
- super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
2245
- }
2246
- _$Ev() {
2247
- this._$ES = new Promise((t3) => this.enableUpdating = t3), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t3) => t3(this));
2248
- }
2249
- addController(t3) {
2250
- (this._$EO ??= /* @__PURE__ */ new Set()).add(t3), void 0 !== this.renderRoot && this.isConnected && t3.hostConnected?.();
2251
- }
2252
- removeController(t3) {
2253
- this._$EO?.delete(t3);
2254
- }
2255
- _$E_() {
2256
- const t3 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
2257
- for (const i5 of s4.keys()) this.hasOwnProperty(i5) && (t3.set(i5, this[i5]), delete this[i5]);
2258
- t3.size > 0 && (this._$Ep = t3);
2259
- }
2260
- createRenderRoot() {
2261
- const t3 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
2262
- return S(t3, this.constructor.elementStyles), t3;
2263
- }
2264
- connectedCallback() {
2265
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t3) => t3.hostConnected?.());
2266
- }
2267
- enableUpdating(t3) {
2268
- }
2269
- disconnectedCallback() {
2270
- this._$EO?.forEach((t3) => t3.hostDisconnected?.());
2271
- }
2272
- attributeChangedCallback(t3, s4, i5) {
2273
- this._$AK(t3, i5);
2274
- }
2275
- _$ET(t3, s4) {
2276
- const i5 = this.constructor.elementProperties.get(t3), e4 = this.constructor._$Eu(t3, i5);
2277
- if (void 0 !== e4 && true === i5.reflect) {
2278
- const h3 = (void 0 !== i5.converter?.toAttribute ? i5.converter : u).toAttribute(s4, i5.type);
2279
- this._$Em = t3, null == h3 ? this.removeAttribute(e4) : this.setAttribute(e4, h3), this._$Em = null;
2280
- }
2281
- }
2282
- _$AK(t3, s4) {
2283
- const i5 = this.constructor, e4 = i5._$Eh.get(t3);
2284
- if (void 0 !== e4 && this._$Em !== e4) {
2285
- const t4 = i5.getPropertyOptions(e4), h3 = "function" == typeof t4.converter ? { fromAttribute: t4.converter } : void 0 !== t4.converter?.fromAttribute ? t4.converter : u;
2286
- this._$Em = e4, this[e4] = h3.fromAttribute(s4, t4.type) ?? this._$Ej?.get(e4) ?? null, this._$Em = null;
2287
- }
2288
- }
2289
- requestUpdate(t3, s4, i5) {
2290
- if (void 0 !== t3) {
2291
- const e4 = this.constructor, h3 = this[t3];
2292
- if (i5 ??= e4.getPropertyOptions(t3), !((i5.hasChanged ?? f)(h3, s4) || i5.useDefault && i5.reflect && h3 === this._$Ej?.get(t3) && !this.hasAttribute(e4._$Eu(t3, i5)))) return;
2293
- this.C(t3, s4, i5);
2294
- }
2295
- false === this.isUpdatePending && (this._$ES = this._$EP());
2296
- }
2297
- C(t3, s4, { useDefault: i5, reflect: e4, wrapped: h3 }, r4) {
2298
- i5 && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t3) && (this._$Ej.set(t3, r4 ?? s4 ?? this[t3]), true !== h3 || void 0 !== r4) || (this._$AL.has(t3) || (this.hasUpdated || i5 || (s4 = void 0), this._$AL.set(t3, s4)), true === e4 && this._$Em !== t3 && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t3));
2299
- }
2300
- async _$EP() {
2301
- this.isUpdatePending = true;
2302
- try {
2303
- await this._$ES;
2304
- } catch (t4) {
2305
- Promise.reject(t4);
2306
- }
2307
- const t3 = this.scheduleUpdate();
2308
- return null != t3 && await t3, !this.isUpdatePending;
2309
- }
2310
- scheduleUpdate() {
2311
- return this.performUpdate();
2312
- }
2313
- performUpdate() {
2314
- if (!this.isUpdatePending) return;
2315
- if (!this.hasUpdated) {
2316
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
2317
- for (const [t5, s5] of this._$Ep) this[t5] = s5;
2318
- this._$Ep = void 0;
2319
- }
2320
- const t4 = this.constructor.elementProperties;
2321
- if (t4.size > 0) for (const [s5, i5] of t4) {
2322
- const { wrapped: t5 } = i5, e4 = this[s5];
2323
- true !== t5 || this._$AL.has(s5) || void 0 === e4 || this.C(s5, void 0, i5, e4);
2324
- }
2325
- }
2326
- let t3 = false;
2327
- const s4 = this._$AL;
2328
- try {
2329
- t3 = this.shouldUpdate(s4), t3 ? (this.willUpdate(s4), this._$EO?.forEach((t4) => t4.hostUpdate?.()), this.update(s4)) : this._$EM();
2330
- } catch (s5) {
2331
- throw t3 = false, this._$EM(), s5;
2332
- }
2333
- t3 && this._$AE(s4);
2334
- }
2335
- willUpdate(t3) {
2336
- }
2337
- _$AE(t3) {
2338
- this._$EO?.forEach((t4) => t4.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t3)), this.updated(t3);
2339
- }
2340
- _$EM() {
2341
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
2342
- }
2343
- get updateComplete() {
2344
- return this.getUpdateComplete();
2345
- }
2346
- getUpdateComplete() {
2347
- return this._$ES;
2348
- }
2349
- shouldUpdate(t3) {
2350
- return true;
2351
- }
2352
- update(t3) {
2353
- this._$Eq &&= this._$Eq.forEach((t4) => this._$ET(t4, this[t4])), this._$EM();
2354
- }
2355
- updated(t3) {
2356
- }
2357
- firstUpdated(t3) {
2358
- }
2359
- };
2360
- y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d("elementProperties")] = /* @__PURE__ */ new Map(), y[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: y }), (a.reactiveElementVersions ??= []).push("2.1.0");
2361
-
2362
- // node_modules/lit-html/lit-html.js
2363
- var t2 = globalThis;
2364
- var i3 = t2.trustedTypes;
2365
- var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t3) => t3 }) : void 0;
2366
- var e3 = "$lit$";
2367
- var h2 = `lit$${Math.random().toFixed(9).slice(2)}$`;
2368
- var o3 = "?" + h2;
2369
- var n3 = `<${o3}>`;
2370
- var r3 = document;
2371
- var l2 = () => r3.createComment("");
2372
- var c3 = (t3) => null === t3 || "object" != typeof t3 && "function" != typeof t3;
2373
- var a2 = Array.isArray;
2374
- var u2 = (t3) => a2(t3) || "function" == typeof t3?.[Symbol.iterator];
2375
- var d2 = "[ \n\f\r]";
2376
- var f2 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
2377
- var v = /-->/g;
2378
- var _ = />/g;
2379
- var m = RegExp(`>|${d2}(?:([^\\s"'>=/]+)(${d2}*=${d2}*(?:[^
2380
- \f\r"'\`<>=]|("|')|))|$)`, "g");
2381
- var p2 = /'/g;
2382
- var g = /"/g;
2383
- var $ = /^(?:script|style|textarea|title)$/i;
2384
- var y2 = (t3) => (i5, ...s4) => ({ _$litType$: t3, strings: i5, values: s4 });
2385
- var x = y2(1);
2386
- var b2 = y2(2);
2387
- var w = y2(3);
2388
- var T = Symbol.for("lit-noChange");
2389
- var E = Symbol.for("lit-nothing");
2390
- var A = /* @__PURE__ */ new WeakMap();
2391
- var C = r3.createTreeWalker(r3, 129);
2392
- function P(t3, i5) {
2393
- if (!a2(t3) || !t3.hasOwnProperty("raw")) throw Error("invalid template strings array");
2394
- return void 0 !== s2 ? s2.createHTML(i5) : i5;
2395
- }
2396
- var V = (t3, i5) => {
2397
- const s4 = t3.length - 1, o5 = [];
2398
- let r4, l3 = 2 === i5 ? "<svg>" : 3 === i5 ? "<math>" : "", c4 = f2;
2399
- for (let i6 = 0; i6 < s4; i6++) {
2400
- const s5 = t3[i6];
2401
- let a3, u3, d3 = -1, y3 = 0;
2402
- for (; y3 < s5.length && (c4.lastIndex = y3, u3 = c4.exec(s5), null !== u3); ) y3 = c4.lastIndex, c4 === f2 ? "!--" === u3[1] ? c4 = v : void 0 !== u3[1] ? c4 = _ : void 0 !== u3[2] ? ($.test(u3[2]) && (r4 = RegExp("</" + u3[2], "g")), c4 = m) : void 0 !== u3[3] && (c4 = m) : c4 === m ? ">" === u3[0] ? (c4 = r4 ?? f2, d3 = -1) : void 0 === u3[1] ? d3 = -2 : (d3 = c4.lastIndex - u3[2].length, a3 = u3[1], c4 = void 0 === u3[3] ? m : '"' === u3[3] ? g : p2) : c4 === g || c4 === p2 ? c4 = m : c4 === v || c4 === _ ? c4 = f2 : (c4 = m, r4 = void 0);
2403
- const x2 = c4 === m && t3[i6 + 1].startsWith("/>") ? " " : "";
2404
- l3 += c4 === f2 ? s5 + n3 : d3 >= 0 ? (o5.push(a3), s5.slice(0, d3) + e3 + s5.slice(d3) + h2 + x2) : s5 + h2 + (-2 === d3 ? i6 : x2);
2405
- }
2406
- return [P(t3, l3 + (t3[s4] || "<?>") + (2 === i5 ? "</svg>" : 3 === i5 ? "</math>" : "")), o5];
2407
- };
2408
- var N = class _N {
2409
- constructor({ strings: t3, _$litType$: s4 }, n4) {
2410
- let r4;
2411
- this.parts = [];
2412
- let c4 = 0, a3 = 0;
2413
- const u3 = t3.length - 1, d3 = this.parts, [f3, v2] = V(t3, s4);
2414
- if (this.el = _N.createElement(f3, n4), C.currentNode = this.el.content, 2 === s4 || 3 === s4) {
2415
- const t4 = this.el.content.firstChild;
2416
- t4.replaceWith(...t4.childNodes);
2417
- }
2418
- for (; null !== (r4 = C.nextNode()) && d3.length < u3; ) {
2419
- if (1 === r4.nodeType) {
2420
- if (r4.hasAttributes()) for (const t4 of r4.getAttributeNames()) if (t4.endsWith(e3)) {
2421
- const i5 = v2[a3++], s5 = r4.getAttribute(t4).split(h2), e4 = /([.?@])?(.*)/.exec(i5);
2422
- d3.push({ type: 1, index: c4, name: e4[2], strings: s5, ctor: "." === e4[1] ? H : "?" === e4[1] ? I : "@" === e4[1] ? L : k }), r4.removeAttribute(t4);
2423
- } else t4.startsWith(h2) && (d3.push({ type: 6, index: c4 }), r4.removeAttribute(t4));
2424
- if ($.test(r4.tagName)) {
2425
- const t4 = r4.textContent.split(h2), s5 = t4.length - 1;
2426
- if (s5 > 0) {
2427
- r4.textContent = i3 ? i3.emptyScript : "";
2428
- for (let i5 = 0; i5 < s5; i5++) r4.append(t4[i5], l2()), C.nextNode(), d3.push({ type: 2, index: ++c4 });
2429
- r4.append(t4[s5], l2());
2430
- }
2431
- }
2432
- } else if (8 === r4.nodeType) if (r4.data === o3) d3.push({ type: 2, index: c4 });
2433
- else {
2434
- let t4 = -1;
2435
- for (; -1 !== (t4 = r4.data.indexOf(h2, t4 + 1)); ) d3.push({ type: 7, index: c4 }), t4 += h2.length - 1;
2436
- }
2437
- c4++;
2438
- }
2439
- }
2440
- static createElement(t3, i5) {
2441
- const s4 = r3.createElement("template");
2442
- return s4.innerHTML = t3, s4;
2443
- }
2444
- };
2445
- function S2(t3, i5, s4 = t3, e4) {
2446
- if (i5 === T) return i5;
2447
- let h3 = void 0 !== e4 ? s4._$Co?.[e4] : s4._$Cl;
2448
- const o5 = c3(i5) ? void 0 : i5._$litDirective$;
2449
- return h3?.constructor !== o5 && (h3?._$AO?.(false), void 0 === o5 ? h3 = void 0 : (h3 = new o5(t3), h3._$AT(t3, s4, e4)), void 0 !== e4 ? (s4._$Co ??= [])[e4] = h3 : s4._$Cl = h3), void 0 !== h3 && (i5 = S2(t3, h3._$AS(t3, i5.values), h3, e4)), i5;
2450
- }
2451
- var M = class {
2452
- constructor(t3, i5) {
2453
- this._$AV = [], this._$AN = void 0, this._$AD = t3, this._$AM = i5;
2454
- }
2455
- get parentNode() {
2456
- return this._$AM.parentNode;
2457
- }
2458
- get _$AU() {
2459
- return this._$AM._$AU;
2460
- }
2461
- u(t3) {
2462
- const { el: { content: i5 }, parts: s4 } = this._$AD, e4 = (t3?.creationScope ?? r3).importNode(i5, true);
2463
- C.currentNode = e4;
2464
- let h3 = C.nextNode(), o5 = 0, n4 = 0, l3 = s4[0];
2465
- for (; void 0 !== l3; ) {
2466
- if (o5 === l3.index) {
2467
- let i6;
2468
- 2 === l3.type ? i6 = new R(h3, h3.nextSibling, this, t3) : 1 === l3.type ? i6 = new l3.ctor(h3, l3.name, l3.strings, this, t3) : 6 === l3.type && (i6 = new z(h3, this, t3)), this._$AV.push(i6), l3 = s4[++n4];
2469
- }
2470
- o5 !== l3?.index && (h3 = C.nextNode(), o5++);
2471
- }
2472
- return C.currentNode = r3, e4;
2473
- }
2474
- p(t3) {
2475
- let i5 = 0;
2476
- for (const s4 of this._$AV) void 0 !== s4 && (void 0 !== s4.strings ? (s4._$AI(t3, s4, i5), i5 += s4.strings.length - 2) : s4._$AI(t3[i5])), i5++;
2477
- }
2478
- };
2479
- var R = class _R {
2480
- get _$AU() {
2481
- return this._$AM?._$AU ?? this._$Cv;
2482
- }
2483
- constructor(t3, i5, s4, e4) {
2484
- this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t3, this._$AB = i5, this._$AM = s4, this.options = e4, this._$Cv = e4?.isConnected ?? true;
2485
- }
2486
- get parentNode() {
2487
- let t3 = this._$AA.parentNode;
2488
- const i5 = this._$AM;
2489
- return void 0 !== i5 && 11 === t3?.nodeType && (t3 = i5.parentNode), t3;
2490
- }
2491
- get startNode() {
2492
- return this._$AA;
2493
- }
2494
- get endNode() {
2495
- return this._$AB;
2496
- }
2497
- _$AI(t3, i5 = this) {
2498
- t3 = S2(this, t3, i5), c3(t3) ? t3 === E || null == t3 || "" === t3 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t3 !== this._$AH && t3 !== T && this._(t3) : void 0 !== t3._$litType$ ? this.$(t3) : void 0 !== t3.nodeType ? this.T(t3) : u2(t3) ? this.k(t3) : this._(t3);
2499
- }
2500
- O(t3) {
2501
- return this._$AA.parentNode.insertBefore(t3, this._$AB);
2502
- }
2503
- T(t3) {
2504
- this._$AH !== t3 && (this._$AR(), this._$AH = this.O(t3));
2505
- }
2506
- _(t3) {
2507
- this._$AH !== E && c3(this._$AH) ? this._$AA.nextSibling.data = t3 : this.T(r3.createTextNode(t3)), this._$AH = t3;
2508
- }
2509
- $(t3) {
2510
- const { values: i5, _$litType$: s4 } = t3, e4 = "number" == typeof s4 ? this._$AC(t3) : (void 0 === s4.el && (s4.el = N.createElement(P(s4.h, s4.h[0]), this.options)), s4);
2511
- if (this._$AH?._$AD === e4) this._$AH.p(i5);
2512
- else {
2513
- const t4 = new M(e4, this), s5 = t4.u(this.options);
2514
- t4.p(i5), this.T(s5), this._$AH = t4;
2515
- }
2516
- }
2517
- _$AC(t3) {
2518
- let i5 = A.get(t3.strings);
2519
- return void 0 === i5 && A.set(t3.strings, i5 = new N(t3)), i5;
2520
- }
2521
- k(t3) {
2522
- a2(this._$AH) || (this._$AH = [], this._$AR());
2523
- const i5 = this._$AH;
2524
- let s4, e4 = 0;
2525
- for (const h3 of t3) e4 === i5.length ? i5.push(s4 = new _R(this.O(l2()), this.O(l2()), this, this.options)) : s4 = i5[e4], s4._$AI(h3), e4++;
2526
- e4 < i5.length && (this._$AR(s4 && s4._$AB.nextSibling, e4), i5.length = e4);
2527
- }
2528
- _$AR(t3 = this._$AA.nextSibling, i5) {
2529
- for (this._$AP?.(false, true, i5); t3 && t3 !== this._$AB; ) {
2530
- const i6 = t3.nextSibling;
2531
- t3.remove(), t3 = i6;
2532
- }
2533
- }
2534
- setConnected(t3) {
2535
- void 0 === this._$AM && (this._$Cv = t3, this._$AP?.(t3));
2536
- }
2537
- };
2538
- var k = class {
2539
- get tagName() {
2540
- return this.element.tagName;
2541
- }
2542
- get _$AU() {
2543
- return this._$AM._$AU;
2544
- }
2545
- constructor(t3, i5, s4, e4, h3) {
2546
- this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t3, this.name = i5, this._$AM = e4, this.options = h3, s4.length > 2 || "" !== s4[0] || "" !== s4[1] ? (this._$AH = Array(s4.length - 1).fill(new String()), this.strings = s4) : this._$AH = E;
2547
- }
2548
- _$AI(t3, i5 = this, s4, e4) {
2549
- const h3 = this.strings;
2550
- let o5 = false;
2551
- if (void 0 === h3) t3 = S2(this, t3, i5, 0), o5 = !c3(t3) || t3 !== this._$AH && t3 !== T, o5 && (this._$AH = t3);
2552
- else {
2553
- const e5 = t3;
2554
- let n4, r4;
2555
- for (t3 = h3[0], n4 = 0; n4 < h3.length - 1; n4++) r4 = S2(this, e5[s4 + n4], i5, n4), r4 === T && (r4 = this._$AH[n4]), o5 ||= !c3(r4) || r4 !== this._$AH[n4], r4 === E ? t3 = E : t3 !== E && (t3 += (r4 ?? "") + h3[n4 + 1]), this._$AH[n4] = r4;
2556
- }
2557
- o5 && !e4 && this.j(t3);
2558
- }
2559
- j(t3) {
2560
- t3 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t3 ?? "");
2561
- }
2562
- };
2563
- var H = class extends k {
2564
- constructor() {
2565
- super(...arguments), this.type = 3;
2566
- }
2567
- j(t3) {
2568
- this.element[this.name] = t3 === E ? void 0 : t3;
2569
- }
2570
- };
2571
- var I = class extends k {
2572
- constructor() {
2573
- super(...arguments), this.type = 4;
2574
- }
2575
- j(t3) {
2576
- this.element.toggleAttribute(this.name, !!t3 && t3 !== E);
2577
- }
2578
- };
2579
- var L = class extends k {
2580
- constructor(t3, i5, s4, e4, h3) {
2581
- super(t3, i5, s4, e4, h3), this.type = 5;
2582
- }
2583
- _$AI(t3, i5 = this) {
2584
- if ((t3 = S2(this, t3, i5, 0) ?? E) === T) return;
2585
- const s4 = this._$AH, e4 = t3 === E && s4 !== E || t3.capture !== s4.capture || t3.once !== s4.once || t3.passive !== s4.passive, h3 = t3 !== E && (s4 === E || e4);
2586
- e4 && this.element.removeEventListener(this.name, this, s4), h3 && this.element.addEventListener(this.name, this, t3), this._$AH = t3;
2587
- }
2588
- handleEvent(t3) {
2589
- "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t3) : this._$AH.handleEvent(t3);
2590
- }
2591
- };
2592
- var z = class {
2593
- constructor(t3, i5, s4) {
2594
- this.element = t3, this.type = 6, this._$AN = void 0, this._$AM = i5, this.options = s4;
2595
- }
2596
- get _$AU() {
2597
- return this._$AM._$AU;
2598
- }
2599
- _$AI(t3) {
2600
- S2(this, t3);
2601
- }
2602
- };
2603
- var j = t2.litHtmlPolyfillSupport;
2604
- j?.(N, R), (t2.litHtmlVersions ??= []).push("3.3.0");
2605
- var B = (t3, i5, s4) => {
2606
- const e4 = s4?.renderBefore ?? i5;
2607
- let h3 = e4._$litPart$;
2608
- if (void 0 === h3) {
2609
- const t4 = s4?.renderBefore ?? null;
2610
- e4._$litPart$ = h3 = new R(i5.insertBefore(l2(), t4), t4, void 0, s4 ?? {});
2611
- }
2612
- return h3._$AI(t3), h3;
2613
- };
2614
-
2615
- // node_modules/lit-element/lit-element.js
2616
- var s3 = globalThis;
2617
- var i4 = class extends y {
2618
- constructor() {
2619
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
2620
- }
2621
- createRenderRoot() {
2622
- const t3 = super.createRenderRoot();
2623
- return this.renderOptions.renderBefore ??= t3.firstChild, t3;
2624
- }
2625
- update(t3) {
2626
- const r4 = this.render();
2627
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t3), this._$Do = B(r4, this.renderRoot, this.renderOptions);
2628
- }
2629
- connectedCallback() {
2630
- super.connectedCallback(), this._$Do?.setConnected(true);
2631
- }
2632
- disconnectedCallback() {
2633
- super.disconnectedCallback(), this._$Do?.setConnected(false);
2634
- }
2635
- render() {
2636
- return T;
2637
- }
2638
- };
2639
- i4._$litElement$ = true, i4["finalized"] = true, s3.litElementHydrateSupport?.({ LitElement: i4 });
2640
- var o4 = s3.litElementPolyfillSupport;
2641
- o4?.({ LitElement: i4 });
2642
- (s3.litElementVersions ??= []).push("4.2.0");
2643
-
2644
- // ../../../../src/qrcode.js
2645
- var import_qrcode = __toESM(require_browser(), 1);
2646
- function formatConfigToLink(config) {
2647
- let link = `comote://settings?`;
2648
- const query = [];
2649
- if ("id" in config) {
2650
- query.push(`id=${config.id}`);
2651
- }
2652
- if (Number.isFinite(config.interval) && config.interval > 0) {
2653
- query.push(`interval=${config.interval}`);
2654
- }
2655
- if (config.ws) {
2656
- const { protocol, hostname, port, pathname } = config.ws;
2657
- if (!hostname) {
2658
- throw new Error(`Invalid WebSocket config: ${config.ws}`);
2659
- }
2660
- let url = `ws-url=`;
2661
- url += protocol == "ws" || protocol == "wss" ? `${protocol}://` : `ws://`;
2662
- url += hostname;
2663
- if (port) {
2664
- url += `:${port}`;
2665
- }
2666
- if (pathname) {
2667
- url += pathname;
2668
- }
2669
- query.push(url);
2670
- if (config.ws.autostart === true) {
2671
- query.push(`ws-enable=1`);
2672
- }
2673
- }
2674
- if (config.osc) {
2675
- const { hostname, port } = config.osc;
2676
- if (!hostname || !Number.isInteger(port)) {
2677
- throw new Error(`Invalid WebSocket config: ${config.osc}`);
2678
- }
2679
- query.push(`osc-url=udp://${hostname}:${port}`);
2680
- if (config.osc.autostart === true) {
2681
- query.push(`osc-enable=1`);
2682
- }
2683
- }
2684
- if (config.webview) {
2685
- query.push(`webview=${encodeURIComponent(config.webview)}`);
2686
- }
2687
- link += query.join("&");
2688
- return link;
2689
- }
2690
- async function dataURL(config) {
2691
- const link = formatConfigToLink(config);
2692
- return await await import_qrcode.default.toDataURL(link);
2693
- }
2694
-
2695
- // client.js
2696
- var wifiInfos = null;
2697
- var networkInfos = null;
2698
- var comoteConfig = null;
2699
- var qrCode = null;
2700
- var socket = new WebSocket(`ws://${window.location.host}`);
2701
- socket.onopen = () => {
2702
- console.log("Websocket opened");
2703
- };
2704
- socket.onmessage = async (event) => {
2705
- const msg = JSON.parse(event.data);
2706
- const { type, payload } = msg;
2707
- switch (type) {
2708
- case "wifiInfos":
2709
- wifiInfos = payload;
2710
- break;
2711
- case "comoteConfig":
2712
- comoteConfig = payload;
2713
- console.log(comoteConfig);
2714
- qrCode = await dataURL(comoteConfig);
2715
- break;
2716
- case "networkInfos":
2717
- networkInfos = payload;
2718
- break;
2719
- default:
2720
- console.warn("received unknown message", { type, payload });
2721
- break;
2722
- }
2723
- renderApp();
2724
- };
2725
- socket.onclose = (event) => console.log(`connection closed`);
2726
- socket.onerror = (error) => console.log(`[error] ${error.message}`);
2727
- function selectNetworkInterface(networkInterface) {
2728
- comoteConfig.osc.hostname = networkInterface;
2729
- const msg = JSON.stringify({ type: "comoteConfig", payload: comoteConfig });
2730
- console.log(typeof msg, "msg = ", msg);
2731
- socket.send(msg);
2732
- }
2733
- function updateWebviewURL(url) {
2734
- comoteConfig.webview = url;
2735
- const msg = JSON.stringify({ type: "comoteConfig", payload: comoteConfig });
2736
- console.log(typeof msg, "msg = ", msg);
2737
- socket.send(msg);
2738
- }
2739
- function renderApp() {
2740
- if (!qrCode) {
2741
- B(x`
2742
- <p style="margin-left: 30px">loading...</p>
2743
- `, document.body);
2744
- } else {
2745
- B(x`
2746
- <div style="margin-left: 30px">
2747
- <div>Id: ${comoteConfig.id}</div>
2748
- <div>Sensors sample period: ${comoteConfig.interval} ms</div>
2749
-
2750
- <select
2751
- name="networkNetworkInterface"
2752
- @change=${(e4) => selectNetworkInterface(e4.target.value)}
2753
- >
2754
- ${networkInfos.map((iface) => x`
2755
- <option
2756
- value=${iface.ip4}
2757
- >${iface.ifaceName} (${iface.type}) ${iface.ip4}</option>
2758
- `)}
2759
- </select>
2760
-
2761
- ${wifiInfos && wifiInfos.ip === comoteConfig.osc.hostname ? x`<div>WiFi SSID: ${wifiInfos.ssid}</div>` : E}
2762
- <div>OSC IP: ${comoteConfig.osc.hostname}</div>
2763
- <div>OSC Port: ${comoteConfig.osc.port}</div>
2764
- <div>OSC autostart: ${comoteConfig.osc.autostart ? 1 : 0}</div>
2765
- <div>Webview:
2766
- <input
2767
- type="text"
2768
- .value="${comoteConfig.webview}"
2769
- @change=${(e4) => updateWebviewURL(e4.target.value)}
2770
- />
2771
- </div>
2772
- </div>
2773
- <div>
2774
- <img
2775
- style="image-rendering: pixelated; margin: 0; "
2776
- src="${qrCode}"
2777
- width="300"
2778
- height="300"
2779
- />
2780
- </div>
2781
- `, document.body);
2782
- }
2783
- }
2784
- renderApp();
2785
- /*! Bundled license information:
2786
-
2787
- @lit/reactive-element/css-tag.js:
2788
- (**
2789
- * @license
2790
- * Copyright 2019 Google LLC
2791
- * SPDX-License-Identifier: BSD-3-Clause
2792
- *)
2793
-
2794
- @lit/reactive-element/reactive-element.js:
2795
- (**
2796
- * @license
2797
- * Copyright 2017 Google LLC
2798
- * SPDX-License-Identifier: BSD-3-Clause
2799
- *)
2800
-
2801
- lit-html/lit-html.js:
2802
- (**
2803
- * @license
2804
- * Copyright 2017 Google LLC
2805
- * SPDX-License-Identifier: BSD-3-Clause
2806
- *)
2807
-
2808
- lit-element/lit-element.js:
2809
- (**
2810
- * @license
2811
- * Copyright 2017 Google LLC
2812
- * SPDX-License-Identifier: BSD-3-Clause
2813
- *)
2814
-
2815
- lit-html/is-server.js:
2816
- (**
2817
- * @license
2818
- * Copyright 2022 Google LLC
2819
- * SPDX-License-Identifier: BSD-3-Clause
2820
- *)
2821
- */