@wirecat/zoom-cli 0.55.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/bin/zm.js +35 -5
- package/dist/bundle/all-profiles-EKHWTGOY.js +25 -0
- package/dist/bundle/answer-policy-KH2IFXPN.js +96 -0
- package/dist/bundle/anthropic-VL54IUGF.js +70 -0
- package/dist/bundle/bun-ADJVI4HY.js +169 -0
- package/dist/bundle/bun-sqlite-2SDA3YOT.js +69 -0
- package/dist/bundle/chunk-2IKY7VBH.js +9 -0
- package/dist/bundle/chunk-2WOGZDZG.js +431 -0
- package/dist/bundle/chunk-4R7HYNZS.js +73 -0
- package/dist/bundle/chunk-4VCA7QU3.js +538 -0
- package/dist/bundle/chunk-4YLS4YLS.js +29 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5F7IOESV.js +281 -0
- package/dist/bundle/chunk-5QESMCQK.js +122 -0
- package/dist/bundle/chunk-6M6FJV5D.js +138 -0
- package/dist/bundle/chunk-6MX5T6AQ.js +17 -0
- package/dist/bundle/chunk-6P3YHT54.js +385 -0
- package/dist/bundle/chunk-7A6PZUDR.js +938 -0
- package/dist/bundle/chunk-7GUG6UZS.js +884 -0
- package/dist/bundle/chunk-7JZJMHQY.js +487 -0
- package/dist/bundle/chunk-A4ETXPMZ.js +98 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AE4BOXH7.js +5292 -0
- package/dist/bundle/chunk-AN3GVZTU.js +76 -0
- package/dist/bundle/chunk-BAYNCCNM.js +215 -0
- package/dist/bundle/chunk-BW2WPOXP.js +166 -0
- package/dist/bundle/chunk-BW52AJ4R.js +3387 -0
- package/dist/bundle/chunk-CB5UTASG.js +18 -0
- package/dist/bundle/chunk-CLMXBW53.js +1028 -0
- package/dist/bundle/chunk-DCTXOMOR.js +35 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-EOQFWJJD.js +1095 -0
- package/dist/bundle/chunk-G4R4ZIGD.js +3569 -0
- package/dist/bundle/chunk-G4VZDINN.js +161 -0
- package/dist/bundle/chunk-GARCOIB6.js +409 -0
- package/dist/bundle/chunk-GKMGS7G5.js +1938 -0
- package/dist/bundle/chunk-HCNMFFG3.js +82 -0
- package/dist/bundle/chunk-HG5KRV55.js +1970 -0
- package/dist/bundle/chunk-HKYLSIZ2.js +82 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-I4VQDXFR.js +100 -0
- package/dist/bundle/chunk-ICSKEDPI.js +36139 -0
- package/dist/bundle/chunk-IP4OK7RQ.js +24 -0
- package/dist/bundle/chunk-IVQ6342B.js +2 -0
- package/dist/bundle/chunk-K72SEMYI.js +160 -0
- package/dist/bundle/chunk-LHRCJYFC.js +19 -0
- package/dist/bundle/chunk-LPTIQLDW.js +192 -0
- package/dist/bundle/chunk-LQ3T2ZIX.js +124 -0
- package/dist/bundle/chunk-LSVI3A5X.js +836 -0
- package/dist/bundle/chunk-LW2G4U6W.js +570 -0
- package/dist/bundle/chunk-LXB6ONWC.js +3517 -0
- package/dist/bundle/chunk-LY26NW3I.js +6848 -0
- package/dist/bundle/chunk-MAEFLDHG.js +6092 -0
- package/dist/bundle/chunk-MZH4GDR4.js +45 -0
- package/dist/bundle/chunk-NN5B24KP.js +1109 -0
- package/dist/bundle/chunk-NO7CJEYV.js +22 -0
- package/dist/bundle/chunk-NTDWAAGL.js +18435 -0
- package/dist/bundle/chunk-NW3X3G5X.js +264 -0
- package/dist/bundle/chunk-O66V2WHK.js +48 -0
- package/dist/bundle/chunk-OCGPZHXW.js +25 -0
- package/dist/bundle/chunk-OIHDCGV4.js +151 -0
- package/dist/bundle/chunk-OVSWVPXL.js +8190 -0
- package/dist/bundle/chunk-PIN5RZ3D.js +63 -0
- package/dist/bundle/chunk-QLIB3PEC.js +1146 -0
- package/dist/bundle/chunk-QTR6D5HT.js +58 -0
- package/dist/bundle/chunk-QUJPQMHJ.js +2315 -0
- package/dist/bundle/chunk-R3HPOCZD.js +188 -0
- package/dist/bundle/chunk-RMV4C2YL.js +482 -0
- package/dist/bundle/chunk-RRRBMQ2E.js +844 -0
- package/dist/bundle/chunk-S4S7E54J.js +60 -0
- package/dist/bundle/chunk-SB6WOSHG.js +1109 -0
- package/dist/bundle/chunk-SE75DPBY.js +31 -0
- package/dist/bundle/chunk-SQJ7EH2D.js +97 -0
- package/dist/bundle/chunk-TKCHUT2H.js +422 -0
- package/dist/bundle/chunk-TLQUKHEM.js +193 -0
- package/dist/bundle/chunk-TZ2MKETI.js +100 -0
- package/dist/bundle/chunk-UC44ZMQV.js +78 -0
- package/dist/bundle/chunk-UI5UTMSZ.js +275 -0
- package/dist/bundle/chunk-VPPYYWOH.js +630 -0
- package/dist/bundle/chunk-WJHK5D7Z.js +35612 -0
- package/dist/bundle/chunk-WQ24UC44.js +239 -0
- package/dist/bundle/chunk-X5DFDGWS.js +2 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YB4DMKYX.js +119 -0
- package/dist/bundle/chunk-Z4TZ6TAF.js +288 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/cli-72EQATJF.js +825 -0
- package/dist/bundle/command-contract-4MHSZUN3.js +38 -0
- package/dist/bundle/config-GFIJK6G2.js +79 -0
- package/dist/bundle/dist-IBNHCQXT.js +136 -0
- package/dist/bundle/dist-XUFQCJXW.js +7577 -0
- package/dist/bundle/echarts-RFTK737T.js +42501 -0
- package/dist/bundle/embed-7QYA2ZZE.js +35 -0
- package/dist/bundle/embedder-YNN6PCHG.js +108 -0
- package/dist/bundle/first-run-EVSRQKZJ.js +23 -0
- package/dist/bundle/first-screen-RG4GUKW7.js +36 -0
- package/dist/bundle/folders-JEPOMYM4.js +13 -0
- package/dist/bundle/instructions-FHNL7CMW.js +9 -0
- package/dist/bundle/main-NYGJXPH7.js +130 -0
- package/dist/bundle/mcp-IXFC2VVR.js +165 -0
- package/dist/bundle/mcp-VGSZDCKK.js +189 -0
- package/dist/bundle/mcp-XKP2PXLS.js +92 -0
- package/dist/bundle/meetings-IBPI4MM4.js +215 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-ZMCACJVS.js +176 -0
- package/dist/bundle/node-sqlite-ZNGOBA5Q.js +45 -0
- package/dist/bundle/oauth-Q6LKF7DB.js +17 -0
- package/dist/bundle/open-LJ332Y5O.js +19 -0
- package/dist/bundle/output-file-RYQZ3RTE.js +63 -0
- package/dist/bundle/process-ZPTLNVQS.js +91 -0
- package/dist/bundle/program-IBRQBQ6W.js +5845 -0
- package/dist/bundle/prompt-RT7GUUXH.js +12 -0
- package/dist/bundle/recognize-QXGE7YJH.js +190 -0
- package/dist/bundle/remote-FD4MZQV3.js +26 -0
- package/dist/bundle/rerank-V6AVV755.js +49 -0
- package/dist/bundle/run-log-RE2EI3UU.js +111 -0
- package/dist/bundle/serve-HIJTFAW7.js +19 -0
- package/dist/bundle/server-3QOXOYYL.js +53 -0
- package/dist/bundle/server-WLJCU7KK.js +812 -0
- package/dist/bundle/services-KC5KQFBS.js +330 -0
- package/dist/bundle/speech-5JOXLYDA.js +44 -0
- package/dist/bundle/state-PPGRB3T6.js +33 -0
- package/dist/bundle/store-LODVDPK3.js +141 -0
- package/dist/bundle/store-WB5BICTG.js +124 -0
- package/dist/bundle/store-connection-EG6Z5ITP.js +76 -0
- package/dist/bundle/store-maintenance-command-Q5WMFUZ2.js +54 -0
- package/dist/bundle/streaming-UGFFNOXL.js +15 -0
- package/dist/bundle/tokens-AF5CPY2F.js +17 -0
- package/dist/bundle/zm.js +8 -0
- package/dist/commands.js +2 -2
- package/dist/commands.js.map +1 -1
- package/dist/config-issues.d.ts.map +1 -1
- package/dist/config-issues.js +3 -0
- package/dist/config-issues.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +34 -45
- package/dist/contract-overrides.js.map +1 -1
- package/dist/first-screen.js +1 -1
- package/dist/first-screen.js.map +1 -1
- package/dist/mcp-command.d.ts +5 -3
- package/dist/mcp-command.d.ts.map +1 -1
- package/dist/mcp-command.js +73 -15
- package/dist/mcp-command.js.map +1 -1
- package/dist/program-bindings.d.ts.map +1 -1
- package/dist/program-bindings.js +1 -0
- package/dist/program-bindings.js.map +1 -1
- package/dist/recording-archive.d.ts.map +1 -1
- package/dist/recording-archive.js +9 -4
- package/dist/recording-archive.js.map +1 -1
- package/dist/remote-http.d.ts +2 -0
- package/dist/remote-http.d.ts.map +1 -1
- package/dist/remote-http.js +21 -11
- package/dist/remote-http.js.map +1 -1
- package/dist/request-events.d.ts +12 -0
- package/dist/request-events.d.ts.map +1 -1
- package/dist/request-events.js +56 -4
- package/dist/request-events.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +4 -1
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -5
- package/skills/zoom-cli/SKILL.md +3 -1
|
@@ -0,0 +1,1970 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
validateFormattedText
|
|
5
|
+
} from "./chunk-RMV4C2YL.js";
|
|
6
|
+
import {
|
|
7
|
+
inputPolicy
|
|
8
|
+
} from "./chunk-HCNMFFG3.js";
|
|
9
|
+
import {
|
|
10
|
+
CliError,
|
|
11
|
+
indent
|
|
12
|
+
} from "./chunk-AE4BOXH7.js";
|
|
13
|
+
import {
|
|
14
|
+
__name
|
|
15
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
16
|
+
|
|
17
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/domain/checks.js
|
|
18
|
+
var spelled = /* @__PURE__ */ __name((check, args) => `${check.replaceAll(".", " ")}${args === void 0 ? "" : ` ${args}`}`, "spelled");
|
|
19
|
+
var bareCheck = /* @__PURE__ */ __name((check, args) => `\`${spelled(check, args)}\``, "bareCheck");
|
|
20
|
+
var checkWords = /* @__PURE__ */ __name((command, profile) => (check, args) => `\`${command} ${profile === void 0 ? "" : `${profile} `}${spelled(check, args)}\``, "checkWords");
|
|
21
|
+
|
|
22
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/domain/markdown.js
|
|
23
|
+
var MARKERS = [
|
|
24
|
+
["**", "bold"],
|
|
25
|
+
["~~", "strike"],
|
|
26
|
+
["`", "code"],
|
|
27
|
+
["_", "italic"],
|
|
28
|
+
["*", "italic"]
|
|
29
|
+
];
|
|
30
|
+
var WORD = /[\p{L}\p{N}]/u;
|
|
31
|
+
var parseMarkdown = /* @__PURE__ */ __name((input) => {
|
|
32
|
+
let text = "";
|
|
33
|
+
const markup = [];
|
|
34
|
+
let index = 0;
|
|
35
|
+
while (index < input.length) {
|
|
36
|
+
const char = input[index];
|
|
37
|
+
if (char === "\\" && index + 1 < input.length) {
|
|
38
|
+
text += input[index + 1];
|
|
39
|
+
index += 2;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const found = MARKERS.find(([marker]) => input.startsWith(marker, index));
|
|
43
|
+
const span = found && closing(input, index, found[0]);
|
|
44
|
+
if (found && span !== void 0) {
|
|
45
|
+
const inner = input.slice(index + found[0].length, span);
|
|
46
|
+
markup.push({ type: found[1], from: text.length, length: inner.length });
|
|
47
|
+
text += inner;
|
|
48
|
+
index = span + found[0].length;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
text += char;
|
|
52
|
+
index += 1;
|
|
53
|
+
}
|
|
54
|
+
return { text, markup };
|
|
55
|
+
}, "parseMarkdown");
|
|
56
|
+
var closing = /* @__PURE__ */ __name((input, open, marker) => {
|
|
57
|
+
const start = open + marker.length;
|
|
58
|
+
const end = input.indexOf(marker, start);
|
|
59
|
+
if (end <= start || input.slice(start, end).includes("\n"))
|
|
60
|
+
return void 0;
|
|
61
|
+
if (marker === "_" || marker === "*") {
|
|
62
|
+
if (WORD.test(input[open - 1] ?? "") || WORD.test(input[end + 1] ?? ""))
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
return end;
|
|
66
|
+
}, "closing");
|
|
67
|
+
|
|
68
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/domain/markdown-spans.js
|
|
69
|
+
var STYLES = [
|
|
70
|
+
["**", "bold"],
|
|
71
|
+
["__", "underline"],
|
|
72
|
+
["~~", "strike"],
|
|
73
|
+
["||", "spoiler"],
|
|
74
|
+
["*", "bold"],
|
|
75
|
+
["_", "italic"],
|
|
76
|
+
["~", "strike"]
|
|
77
|
+
];
|
|
78
|
+
var WORD2 = /[\p{L}\p{N}]/u;
|
|
79
|
+
var before = /* @__PURE__ */ __name((input, at) => {
|
|
80
|
+
const code = input.charCodeAt(at - 1);
|
|
81
|
+
return code >= 56320 && code <= 57343 ? input.slice(at - 2, at) : input[at - 1] ?? "";
|
|
82
|
+
}, "before");
|
|
83
|
+
var after = /* @__PURE__ */ __name((input, at) => String.fromCodePoint(input.codePointAt(at) ?? 0), "after");
|
|
84
|
+
var fail = /* @__PURE__ */ __name((message) => {
|
|
85
|
+
throw new CliError("validation_error", message);
|
|
86
|
+
}, "fail");
|
|
87
|
+
var balanced = /* @__PURE__ */ __name((input, start, open, close) => {
|
|
88
|
+
let depth = 1;
|
|
89
|
+
for (let at = start + 1; at < input.length; at++) {
|
|
90
|
+
if (input[at] === "\\") {
|
|
91
|
+
at++;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (input[at] === open) {
|
|
95
|
+
if (++depth > 32)
|
|
96
|
+
fail("Markdown nesting exceeds 32 levels");
|
|
97
|
+
}
|
|
98
|
+
if (input[at] === close && --depth === 0)
|
|
99
|
+
return at;
|
|
100
|
+
}
|
|
101
|
+
return void 0;
|
|
102
|
+
}, "balanced");
|
|
103
|
+
var parse = /* @__PURE__ */ __name((input, depth = 0) => {
|
|
104
|
+
if (depth > 32)
|
|
105
|
+
fail("Markdown nesting exceeds 32 levels");
|
|
106
|
+
let text = "", at = 0;
|
|
107
|
+
const spans = [];
|
|
108
|
+
const links = input.includes("](");
|
|
109
|
+
const append = /* @__PURE__ */ __name((part, type, extra = {}) => {
|
|
110
|
+
const from = text.length;
|
|
111
|
+
text += part.text;
|
|
112
|
+
for (const span of part.spans)
|
|
113
|
+
spans.push({ ...span, from: from + span.from });
|
|
114
|
+
if (type && part.text.length > 0)
|
|
115
|
+
spans.push({ type, from, length: part.text.length, ...extra });
|
|
116
|
+
if (spans.length > 100)
|
|
117
|
+
fail("Markdown has more than 100 formatting spans");
|
|
118
|
+
}, "append");
|
|
119
|
+
while (at < input.length) {
|
|
120
|
+
const lineStart = at === 0 || input[at - 1] === "\n";
|
|
121
|
+
if (lineStart && input.startsWith("```", at)) {
|
|
122
|
+
const opening = /^```([\w.+#-]*)[ \t]*\r?\n/u.exec(input.slice(at));
|
|
123
|
+
const inline = opening ? null : /^```([^`\r\n]+)```/u.exec(input.slice(at));
|
|
124
|
+
if (inline) {
|
|
125
|
+
append({ text: inline[1] ?? "", spans: [] }, "pre", { language: "" });
|
|
126
|
+
at += inline[0].length;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (!opening)
|
|
130
|
+
throw new CliError("validation_error", "a Markdown code fence needs a newline and an optional language token");
|
|
131
|
+
if (opening) {
|
|
132
|
+
const bodyStart = at + opening[0].length;
|
|
133
|
+
const closing2 = /^(?:```)[ \t]*(?:\r?\n|$)/gmu;
|
|
134
|
+
closing2.lastIndex = bodyStart;
|
|
135
|
+
const end = closing2.exec(input);
|
|
136
|
+
if (!end)
|
|
137
|
+
throw new CliError("validation_error", "a Markdown code fence needs a closing fence");
|
|
138
|
+
append({ text: input.slice(bodyStart, end.index), spans: [] }, "pre", { language: opening[1] ?? "" });
|
|
139
|
+
at = end.index + end[0].length;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (lineStart && /^>(?: |\r?\n|$)/u.test(input.slice(at))) {
|
|
144
|
+
const quoted = [];
|
|
145
|
+
let trailing = "";
|
|
146
|
+
while (at < input.length && /^>(?: |\r?\n|$)/u.test(input.slice(at))) {
|
|
147
|
+
const end = input.indexOf("\n", at);
|
|
148
|
+
const lineEnd = end === -1 ? input.length : end;
|
|
149
|
+
const line = input.slice(at, lineEnd);
|
|
150
|
+
quoted.push(line.replace(/^> ?/u, ""));
|
|
151
|
+
at = end === -1 ? input.length : end + 1;
|
|
152
|
+
trailing = end === -1 ? "" : "\n";
|
|
153
|
+
}
|
|
154
|
+
append(parse(quoted.join("\n"), depth + 1), "blockquote");
|
|
155
|
+
text += trailing;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (lineStart) {
|
|
159
|
+
const heading = /^#{1,6} +([^\r\n]*)(\r?\n|$)/u.exec(input.slice(at));
|
|
160
|
+
if (heading) {
|
|
161
|
+
append(parse(heading[1] ?? "", depth + 1), "heading");
|
|
162
|
+
text += heading[2] ?? "";
|
|
163
|
+
at += heading[0].length;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (input[at] === "\\" && at + 1 < input.length) {
|
|
168
|
+
text += input[at + 1];
|
|
169
|
+
at += 2;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (links && input[at] === "[") {
|
|
173
|
+
const labelEnd = balanced(input, at, "[", "]");
|
|
174
|
+
if (labelEnd !== void 0 && input[labelEnd + 1] === "(") {
|
|
175
|
+
const urlEnd = balanced(input, labelEnd + 1, "(", ")");
|
|
176
|
+
if (urlEnd !== void 0) {
|
|
177
|
+
const url = input.slice(labelEnd + 2, urlEnd).replace(/\\([\\()])/gu, "$1");
|
|
178
|
+
append(parse(input.slice(at + 1, labelEnd), depth + 1), "link", { url });
|
|
179
|
+
at = urlEnd + 1;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (input[at] === "`" && !input.startsWith("```", at)) {
|
|
185
|
+
const end = input.indexOf("`", at + 1);
|
|
186
|
+
if (end > at + 1) {
|
|
187
|
+
const content = input.slice(at + 1, end);
|
|
188
|
+
if (!content.includes("\n") && !content.includes("\r")) {
|
|
189
|
+
append({ text: content, spans: [] }, "code");
|
|
190
|
+
at = end + 1;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const style = STYLES.find(([marker]) => input.startsWith(marker, at));
|
|
196
|
+
if (style) {
|
|
197
|
+
const [marker, type] = style;
|
|
198
|
+
let end = input.indexOf(marker, at + marker.length);
|
|
199
|
+
while (end !== -1 && (() => {
|
|
200
|
+
let escapes = 0;
|
|
201
|
+
for (let i = end - 1; i >= 0 && input[i] === "\\"; i--)
|
|
202
|
+
escapes++;
|
|
203
|
+
return escapes % 2 === 1;
|
|
204
|
+
})())
|
|
205
|
+
end = input.indexOf(marker, end + marker.length);
|
|
206
|
+
const edge = marker !== "_" && marker !== "*" || !WORD2.test(before(input, at)) && !WORD2.test(after(input, end + marker.length));
|
|
207
|
+
if (end > at + marker.length && edge) {
|
|
208
|
+
append(parse(input.slice(at + marker.length, end), depth + 1), type);
|
|
209
|
+
at = end + marker.length;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
text += marker;
|
|
213
|
+
at += marker.length;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
text += input[at];
|
|
217
|
+
at++;
|
|
218
|
+
}
|
|
219
|
+
return { text, spans };
|
|
220
|
+
}, "parse");
|
|
221
|
+
var parseMarkdownSpans = /* @__PURE__ */ __name((input) => {
|
|
222
|
+
const result = parse(input);
|
|
223
|
+
const block = /* @__PURE__ */ __name((span) => span.type === "blockquote" || span.type === "heading" ? 0 : 1, "block");
|
|
224
|
+
result.spans.sort((a, b) => a.from - b.from || b.length - a.length || block(a) - block(b) || a.type.localeCompare(b.type));
|
|
225
|
+
return validateFormattedText(result);
|
|
226
|
+
}, "parseMarkdownSpans");
|
|
227
|
+
|
|
228
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/domain/polls.js
|
|
229
|
+
var countedPoll = /* @__PURE__ */ __name((poll, votes, self) => {
|
|
230
|
+
const cast = votes.filter((vote) => vote.answers.length > 0);
|
|
231
|
+
const mine = self === null ? void 0 : votes.find((vote) => vote.person.id === self);
|
|
232
|
+
return {
|
|
233
|
+
...poll,
|
|
234
|
+
answers: poll.answers.map((answer) => ({
|
|
235
|
+
...answer,
|
|
236
|
+
voters: cast.filter((vote) => vote.answers.includes(answer.id)).length,
|
|
237
|
+
chosen: mine ? mine.answers.includes(answer.id) : answer.chosen
|
|
238
|
+
})),
|
|
239
|
+
voters: cast.length
|
|
240
|
+
};
|
|
241
|
+
}, "countedPoll");
|
|
242
|
+
|
|
243
|
+
// node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
244
|
+
var qrcode = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
245
|
+
const PAD0 = 236;
|
|
246
|
+
const PAD1 = 17;
|
|
247
|
+
let _typeNumber = typeNumber;
|
|
248
|
+
const _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
|
|
249
|
+
let _modules = null;
|
|
250
|
+
let _moduleCount = 0;
|
|
251
|
+
let _dataCache = null;
|
|
252
|
+
const _dataList = [];
|
|
253
|
+
const _this = {};
|
|
254
|
+
const makeImpl = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
255
|
+
_moduleCount = _typeNumber * 4 + 17;
|
|
256
|
+
_modules = (function(moduleCount) {
|
|
257
|
+
const modules2 = new Array(moduleCount);
|
|
258
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
259
|
+
modules2[row] = new Array(moduleCount);
|
|
260
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
261
|
+
modules2[row][col] = null;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return modules2;
|
|
265
|
+
})(_moduleCount);
|
|
266
|
+
setupPositionProbePattern(0, 0);
|
|
267
|
+
setupPositionProbePattern(_moduleCount - 7, 0);
|
|
268
|
+
setupPositionProbePattern(0, _moduleCount - 7);
|
|
269
|
+
setupPositionAdjustPattern();
|
|
270
|
+
setupTimingPattern();
|
|
271
|
+
setupTypeInfo(test, maskPattern);
|
|
272
|
+
if (_typeNumber >= 7) {
|
|
273
|
+
setupTypeNumber(test);
|
|
274
|
+
}
|
|
275
|
+
if (_dataCache == null) {
|
|
276
|
+
_dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
|
|
277
|
+
}
|
|
278
|
+
mapData(_dataCache, maskPattern);
|
|
279
|
+
}, "makeImpl");
|
|
280
|
+
const setupPositionProbePattern = /* @__PURE__ */ __name(function(row, col) {
|
|
281
|
+
for (let r = -1; r <= 7; r += 1) {
|
|
282
|
+
if (row + r <= -1 || _moduleCount <= row + r) continue;
|
|
283
|
+
for (let c = -1; c <= 7; c += 1) {
|
|
284
|
+
if (col + c <= -1 || _moduleCount <= col + c) continue;
|
|
285
|
+
if (0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
|
|
286
|
+
_modules[row + r][col + c] = true;
|
|
287
|
+
} else {
|
|
288
|
+
_modules[row + r][col + c] = false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}, "setupPositionProbePattern");
|
|
293
|
+
const getBestMaskPattern = /* @__PURE__ */ __name(function() {
|
|
294
|
+
let minLostPoint = 0;
|
|
295
|
+
let pattern = 0;
|
|
296
|
+
for (let i = 0; i < 8; i += 1) {
|
|
297
|
+
makeImpl(true, i);
|
|
298
|
+
const lostPoint = QRUtil.getLostPoint(_this);
|
|
299
|
+
if (i == 0 || minLostPoint > lostPoint) {
|
|
300
|
+
minLostPoint = lostPoint;
|
|
301
|
+
pattern = i;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return pattern;
|
|
305
|
+
}, "getBestMaskPattern");
|
|
306
|
+
const setupTimingPattern = /* @__PURE__ */ __name(function() {
|
|
307
|
+
for (let r = 8; r < _moduleCount - 8; r += 1) {
|
|
308
|
+
if (_modules[r][6] != null) {
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
_modules[r][6] = r % 2 == 0;
|
|
312
|
+
}
|
|
313
|
+
for (let c = 8; c < _moduleCount - 8; c += 1) {
|
|
314
|
+
if (_modules[6][c] != null) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
_modules[6][c] = c % 2 == 0;
|
|
318
|
+
}
|
|
319
|
+
}, "setupTimingPattern");
|
|
320
|
+
const setupPositionAdjustPattern = /* @__PURE__ */ __name(function() {
|
|
321
|
+
const pos = QRUtil.getPatternPosition(_typeNumber);
|
|
322
|
+
for (let i = 0; i < pos.length; i += 1) {
|
|
323
|
+
for (let j = 0; j < pos.length; j += 1) {
|
|
324
|
+
const row = pos[i];
|
|
325
|
+
const col = pos[j];
|
|
326
|
+
if (_modules[row][col] != null) {
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
for (let r = -2; r <= 2; r += 1) {
|
|
330
|
+
for (let c = -2; c <= 2; c += 1) {
|
|
331
|
+
if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
|
|
332
|
+
_modules[row + r][col + c] = true;
|
|
333
|
+
} else {
|
|
334
|
+
_modules[row + r][col + c] = false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}, "setupPositionAdjustPattern");
|
|
341
|
+
const setupTypeNumber = /* @__PURE__ */ __name(function(test) {
|
|
342
|
+
const bits = QRUtil.getBCHTypeNumber(_typeNumber);
|
|
343
|
+
for (let i = 0; i < 18; i += 1) {
|
|
344
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
345
|
+
_modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
|
|
346
|
+
}
|
|
347
|
+
for (let i = 0; i < 18; i += 1) {
|
|
348
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
349
|
+
_modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
|
|
350
|
+
}
|
|
351
|
+
}, "setupTypeNumber");
|
|
352
|
+
const setupTypeInfo = /* @__PURE__ */ __name(function(test, maskPattern) {
|
|
353
|
+
const data = _errorCorrectionLevel << 3 | maskPattern;
|
|
354
|
+
const bits = QRUtil.getBCHTypeInfo(data);
|
|
355
|
+
for (let i = 0; i < 15; i += 1) {
|
|
356
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
357
|
+
if (i < 6) {
|
|
358
|
+
_modules[i][8] = mod;
|
|
359
|
+
} else if (i < 8) {
|
|
360
|
+
_modules[i + 1][8] = mod;
|
|
361
|
+
} else {
|
|
362
|
+
_modules[_moduleCount - 15 + i][8] = mod;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
for (let i = 0; i < 15; i += 1) {
|
|
366
|
+
const mod = !test && (bits >> i & 1) == 1;
|
|
367
|
+
if (i < 8) {
|
|
368
|
+
_modules[8][_moduleCount - i - 1] = mod;
|
|
369
|
+
} else if (i < 9) {
|
|
370
|
+
_modules[8][15 - i - 1 + 1] = mod;
|
|
371
|
+
} else {
|
|
372
|
+
_modules[8][15 - i - 1] = mod;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
_modules[_moduleCount - 8][8] = !test;
|
|
376
|
+
}, "setupTypeInfo");
|
|
377
|
+
const mapData = /* @__PURE__ */ __name(function(data, maskPattern) {
|
|
378
|
+
let inc = -1;
|
|
379
|
+
let row = _moduleCount - 1;
|
|
380
|
+
let bitIndex = 7;
|
|
381
|
+
let byteIndex = 0;
|
|
382
|
+
const maskFunc = QRUtil.getMaskFunction(maskPattern);
|
|
383
|
+
for (let col = _moduleCount - 1; col > 0; col -= 2) {
|
|
384
|
+
if (col == 6) col -= 1;
|
|
385
|
+
while (true) {
|
|
386
|
+
for (let c = 0; c < 2; c += 1) {
|
|
387
|
+
if (_modules[row][col - c] == null) {
|
|
388
|
+
let dark = false;
|
|
389
|
+
if (byteIndex < data.length) {
|
|
390
|
+
dark = (data[byteIndex] >>> bitIndex & 1) == 1;
|
|
391
|
+
}
|
|
392
|
+
const mask = maskFunc(row, col - c);
|
|
393
|
+
if (mask) {
|
|
394
|
+
dark = !dark;
|
|
395
|
+
}
|
|
396
|
+
_modules[row][col - c] = dark;
|
|
397
|
+
bitIndex -= 1;
|
|
398
|
+
if (bitIndex == -1) {
|
|
399
|
+
byteIndex += 1;
|
|
400
|
+
bitIndex = 7;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
row += inc;
|
|
405
|
+
if (row < 0 || _moduleCount <= row) {
|
|
406
|
+
row -= inc;
|
|
407
|
+
inc = -inc;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}, "mapData");
|
|
413
|
+
const createBytes = /* @__PURE__ */ __name(function(buffer, rsBlocks) {
|
|
414
|
+
let offset = 0;
|
|
415
|
+
let maxDcCount = 0;
|
|
416
|
+
let maxEcCount = 0;
|
|
417
|
+
const dcdata = new Array(rsBlocks.length);
|
|
418
|
+
const ecdata = new Array(rsBlocks.length);
|
|
419
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
420
|
+
const dcCount = rsBlocks[r].dataCount;
|
|
421
|
+
const ecCount = rsBlocks[r].totalCount - dcCount;
|
|
422
|
+
maxDcCount = Math.max(maxDcCount, dcCount);
|
|
423
|
+
maxEcCount = Math.max(maxEcCount, ecCount);
|
|
424
|
+
dcdata[r] = new Array(dcCount);
|
|
425
|
+
for (let i = 0; i < dcdata[r].length; i += 1) {
|
|
426
|
+
dcdata[r][i] = 255 & buffer.getBuffer()[i + offset];
|
|
427
|
+
}
|
|
428
|
+
offset += dcCount;
|
|
429
|
+
const rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
|
|
430
|
+
const rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
|
|
431
|
+
const modPoly = rawPoly.mod(rsPoly);
|
|
432
|
+
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
|
433
|
+
for (let i = 0; i < ecdata[r].length; i += 1) {
|
|
434
|
+
const modIndex = i + modPoly.getLength() - ecdata[r].length;
|
|
435
|
+
ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
let totalCodeCount = 0;
|
|
439
|
+
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
440
|
+
totalCodeCount += rsBlocks[i].totalCount;
|
|
441
|
+
}
|
|
442
|
+
const data = new Array(totalCodeCount);
|
|
443
|
+
let index = 0;
|
|
444
|
+
for (let i = 0; i < maxDcCount; i += 1) {
|
|
445
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
446
|
+
if (i < dcdata[r].length) {
|
|
447
|
+
data[index] = dcdata[r][i];
|
|
448
|
+
index += 1;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
for (let i = 0; i < maxEcCount; i += 1) {
|
|
453
|
+
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
454
|
+
if (i < ecdata[r].length) {
|
|
455
|
+
data[index] = ecdata[r][i];
|
|
456
|
+
index += 1;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return data;
|
|
461
|
+
}, "createBytes");
|
|
462
|
+
const createData = /* @__PURE__ */ __name(function(typeNumber2, errorCorrectionLevel2, dataList) {
|
|
463
|
+
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, errorCorrectionLevel2);
|
|
464
|
+
const buffer = qrBitBuffer();
|
|
465
|
+
for (let i = 0; i < dataList.length; i += 1) {
|
|
466
|
+
const data = dataList[i];
|
|
467
|
+
buffer.put(data.getMode(), 4);
|
|
468
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
469
|
+
data.write(buffer);
|
|
470
|
+
}
|
|
471
|
+
let totalDataCount = 0;
|
|
472
|
+
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
473
|
+
totalDataCount += rsBlocks[i].dataCount;
|
|
474
|
+
}
|
|
475
|
+
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
|
476
|
+
throw "code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")";
|
|
477
|
+
}
|
|
478
|
+
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
|
479
|
+
buffer.put(0, 4);
|
|
480
|
+
}
|
|
481
|
+
while (buffer.getLengthInBits() % 8 != 0) {
|
|
482
|
+
buffer.putBit(false);
|
|
483
|
+
}
|
|
484
|
+
while (true) {
|
|
485
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
buffer.put(PAD0, 8);
|
|
489
|
+
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
buffer.put(PAD1, 8);
|
|
493
|
+
}
|
|
494
|
+
return createBytes(buffer, rsBlocks);
|
|
495
|
+
}, "createData");
|
|
496
|
+
_this.addData = function(data, mode) {
|
|
497
|
+
mode = mode || "Byte";
|
|
498
|
+
let newData = null;
|
|
499
|
+
switch (mode) {
|
|
500
|
+
case "Numeric":
|
|
501
|
+
newData = qrNumber(data);
|
|
502
|
+
break;
|
|
503
|
+
case "Alphanumeric":
|
|
504
|
+
newData = qrAlphaNum(data);
|
|
505
|
+
break;
|
|
506
|
+
case "Byte":
|
|
507
|
+
newData = qr8BitByte(data);
|
|
508
|
+
break;
|
|
509
|
+
case "Kanji":
|
|
510
|
+
newData = qrKanji(data);
|
|
511
|
+
break;
|
|
512
|
+
default:
|
|
513
|
+
throw "mode:" + mode;
|
|
514
|
+
}
|
|
515
|
+
_dataList.push(newData);
|
|
516
|
+
_dataCache = null;
|
|
517
|
+
};
|
|
518
|
+
_this.isDark = function(row, col) {
|
|
519
|
+
if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
|
|
520
|
+
throw row + "," + col;
|
|
521
|
+
}
|
|
522
|
+
return _modules[row][col];
|
|
523
|
+
};
|
|
524
|
+
_this.getModuleCount = function() {
|
|
525
|
+
return _moduleCount;
|
|
526
|
+
};
|
|
527
|
+
_this.make = function() {
|
|
528
|
+
if (_typeNumber < 1) {
|
|
529
|
+
let typeNumber2 = 1;
|
|
530
|
+
for (; typeNumber2 < 40; typeNumber2++) {
|
|
531
|
+
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, _errorCorrectionLevel);
|
|
532
|
+
const buffer = qrBitBuffer();
|
|
533
|
+
for (let i = 0; i < _dataList.length; i++) {
|
|
534
|
+
const data = _dataList[i];
|
|
535
|
+
buffer.put(data.getMode(), 4);
|
|
536
|
+
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
537
|
+
data.write(buffer);
|
|
538
|
+
}
|
|
539
|
+
let totalDataCount = 0;
|
|
540
|
+
for (let i = 0; i < rsBlocks.length; i++) {
|
|
541
|
+
totalDataCount += rsBlocks[i].dataCount;
|
|
542
|
+
}
|
|
543
|
+
if (buffer.getLengthInBits() <= totalDataCount * 8) {
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
_typeNumber = typeNumber2;
|
|
548
|
+
}
|
|
549
|
+
makeImpl(false, getBestMaskPattern());
|
|
550
|
+
};
|
|
551
|
+
_this.createTableTag = function(cellSize, margin) {
|
|
552
|
+
cellSize = cellSize || 2;
|
|
553
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
554
|
+
let qrHtml = "";
|
|
555
|
+
qrHtml += '<table style="';
|
|
556
|
+
qrHtml += " border-width: 0px; border-style: none;";
|
|
557
|
+
qrHtml += " border-collapse: collapse;";
|
|
558
|
+
qrHtml += " padding: 0px; margin: " + margin + "px;";
|
|
559
|
+
qrHtml += '">';
|
|
560
|
+
qrHtml += "<tbody>";
|
|
561
|
+
for (let r = 0; r < _this.getModuleCount(); r += 1) {
|
|
562
|
+
qrHtml += "<tr>";
|
|
563
|
+
for (let c = 0; c < _this.getModuleCount(); c += 1) {
|
|
564
|
+
qrHtml += '<td style="';
|
|
565
|
+
qrHtml += " border-width: 0px; border-style: none;";
|
|
566
|
+
qrHtml += " border-collapse: collapse;";
|
|
567
|
+
qrHtml += " padding: 0px; margin: 0px;";
|
|
568
|
+
qrHtml += " width: " + cellSize + "px;";
|
|
569
|
+
qrHtml += " height: " + cellSize + "px;";
|
|
570
|
+
qrHtml += " background-color: ";
|
|
571
|
+
qrHtml += _this.isDark(r, c) ? "#000000" : "#ffffff";
|
|
572
|
+
qrHtml += ";";
|
|
573
|
+
qrHtml += '"/>';
|
|
574
|
+
}
|
|
575
|
+
qrHtml += "</tr>";
|
|
576
|
+
}
|
|
577
|
+
qrHtml += "</tbody>";
|
|
578
|
+
qrHtml += "</table>";
|
|
579
|
+
return qrHtml;
|
|
580
|
+
};
|
|
581
|
+
_this.createSvgTag = function(cellSize, margin, alt, title) {
|
|
582
|
+
let opts = {};
|
|
583
|
+
if (typeof arguments[0] == "object") {
|
|
584
|
+
opts = arguments[0];
|
|
585
|
+
cellSize = opts.cellSize;
|
|
586
|
+
margin = opts.margin;
|
|
587
|
+
alt = opts.alt;
|
|
588
|
+
title = opts.title;
|
|
589
|
+
}
|
|
590
|
+
cellSize = cellSize || 2;
|
|
591
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
592
|
+
alt = typeof alt === "string" ? { text: alt } : alt || {};
|
|
593
|
+
alt.text = alt.text || null;
|
|
594
|
+
alt.id = alt.text ? alt.id || "qrcode-description" : null;
|
|
595
|
+
title = typeof title === "string" ? { text: title } : title || {};
|
|
596
|
+
title.text = title.text || null;
|
|
597
|
+
title.id = title.text ? title.id || "qrcode-title" : null;
|
|
598
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
599
|
+
let c, mc, r, mr, qrSvg = "", rect;
|
|
600
|
+
rect = "l" + cellSize + ",0 0," + cellSize + " -" + cellSize + ",0 0,-" + cellSize + "z ";
|
|
601
|
+
qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
|
|
602
|
+
qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : "";
|
|
603
|
+
qrSvg += ' viewBox="0 0 ' + size + " " + size + '" ';
|
|
604
|
+
qrSvg += ' preserveAspectRatio="xMinYMin meet"';
|
|
605
|
+
qrSvg += title.text || alt.text ? ' role="img" aria-labelledby="' + escapeXml([title.id, alt.id].join(" ").trim()) + '"' : "";
|
|
606
|
+
qrSvg += ">";
|
|
607
|
+
qrSvg += title.text ? '<title id="' + escapeXml(title.id) + '">' + escapeXml(title.text) + "</title>" : "";
|
|
608
|
+
qrSvg += alt.text ? '<description id="' + escapeXml(alt.id) + '">' + escapeXml(alt.text) + "</description>" : "";
|
|
609
|
+
qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
|
|
610
|
+
qrSvg += '<path d="';
|
|
611
|
+
for (r = 0; r < _this.getModuleCount(); r += 1) {
|
|
612
|
+
mr = r * cellSize + margin;
|
|
613
|
+
for (c = 0; c < _this.getModuleCount(); c += 1) {
|
|
614
|
+
if (_this.isDark(r, c)) {
|
|
615
|
+
mc = c * cellSize + margin;
|
|
616
|
+
qrSvg += "M" + mc + "," + mr + rect;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
qrSvg += '" stroke="transparent" fill="black"/>';
|
|
621
|
+
qrSvg += "</svg>";
|
|
622
|
+
return qrSvg;
|
|
623
|
+
};
|
|
624
|
+
_this.createDataURL = function(cellSize, margin) {
|
|
625
|
+
cellSize = cellSize || 2;
|
|
626
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
627
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
628
|
+
const min = margin;
|
|
629
|
+
const max = size - margin;
|
|
630
|
+
return createDataURL(size, size, function(x, y) {
|
|
631
|
+
if (min <= x && x < max && min <= y && y < max) {
|
|
632
|
+
const c = Math.floor((x - min) / cellSize);
|
|
633
|
+
const r = Math.floor((y - min) / cellSize);
|
|
634
|
+
return _this.isDark(r, c) ? 0 : 1;
|
|
635
|
+
} else {
|
|
636
|
+
return 1;
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
};
|
|
640
|
+
_this.createImgTag = function(cellSize, margin, alt) {
|
|
641
|
+
cellSize = cellSize || 2;
|
|
642
|
+
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
643
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
644
|
+
let img = "";
|
|
645
|
+
img += "<img";
|
|
646
|
+
img += ' src="';
|
|
647
|
+
img += _this.createDataURL(cellSize, margin);
|
|
648
|
+
img += '"';
|
|
649
|
+
img += ' width="';
|
|
650
|
+
img += size;
|
|
651
|
+
img += '"';
|
|
652
|
+
img += ' height="';
|
|
653
|
+
img += size;
|
|
654
|
+
img += '"';
|
|
655
|
+
if (alt) {
|
|
656
|
+
img += ' alt="';
|
|
657
|
+
img += escapeXml(alt);
|
|
658
|
+
img += '"';
|
|
659
|
+
}
|
|
660
|
+
img += "/>";
|
|
661
|
+
return img;
|
|
662
|
+
};
|
|
663
|
+
const escapeXml = /* @__PURE__ */ __name(function(s) {
|
|
664
|
+
let escaped = "";
|
|
665
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
666
|
+
const c = s.charAt(i);
|
|
667
|
+
switch (c) {
|
|
668
|
+
case "<":
|
|
669
|
+
escaped += "<";
|
|
670
|
+
break;
|
|
671
|
+
case ">":
|
|
672
|
+
escaped += ">";
|
|
673
|
+
break;
|
|
674
|
+
case "&":
|
|
675
|
+
escaped += "&";
|
|
676
|
+
break;
|
|
677
|
+
case '"':
|
|
678
|
+
escaped += """;
|
|
679
|
+
break;
|
|
680
|
+
default:
|
|
681
|
+
escaped += c;
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
return escaped;
|
|
686
|
+
}, "escapeXml");
|
|
687
|
+
const _createHalfASCII = /* @__PURE__ */ __name(function(margin) {
|
|
688
|
+
const cellSize = 1;
|
|
689
|
+
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
690
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
691
|
+
const min = margin;
|
|
692
|
+
const max = size - margin;
|
|
693
|
+
let y, x, r1, r2, p;
|
|
694
|
+
const blocks = {
|
|
695
|
+
"\u2588\u2588": "\u2588",
|
|
696
|
+
"\u2588 ": "\u2580",
|
|
697
|
+
" \u2588": "\u2584",
|
|
698
|
+
" ": " "
|
|
699
|
+
};
|
|
700
|
+
const blocksLastLineNoMargin = {
|
|
701
|
+
"\u2588\u2588": "\u2580",
|
|
702
|
+
"\u2588 ": "\u2580",
|
|
703
|
+
" \u2588": " ",
|
|
704
|
+
" ": " "
|
|
705
|
+
};
|
|
706
|
+
let ascii = "";
|
|
707
|
+
for (y = 0; y < size; y += 2) {
|
|
708
|
+
r1 = Math.floor((y - min) / cellSize);
|
|
709
|
+
r2 = Math.floor((y + 1 - min) / cellSize);
|
|
710
|
+
for (x = 0; x < size; x += 1) {
|
|
711
|
+
p = "\u2588";
|
|
712
|
+
if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
|
|
713
|
+
p = " ";
|
|
714
|
+
}
|
|
715
|
+
if (min <= x && x < max && min <= y + 1 && y + 1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
|
|
716
|
+
p += " ";
|
|
717
|
+
} else {
|
|
718
|
+
p += "\u2588";
|
|
719
|
+
}
|
|
720
|
+
ascii += margin < 1 && y + 1 >= max ? blocksLastLineNoMargin[p] : blocks[p];
|
|
721
|
+
}
|
|
722
|
+
ascii += "\n";
|
|
723
|
+
}
|
|
724
|
+
if (size % 2 && margin > 0) {
|
|
725
|
+
return ascii.substring(0, ascii.length - size - 1) + Array(size + 1).join("\u2580");
|
|
726
|
+
}
|
|
727
|
+
return ascii.substring(0, ascii.length - 1);
|
|
728
|
+
}, "_createHalfASCII");
|
|
729
|
+
_this.createASCII = function(cellSize, margin) {
|
|
730
|
+
cellSize = cellSize || 1;
|
|
731
|
+
if (cellSize < 2) {
|
|
732
|
+
return _createHalfASCII(margin);
|
|
733
|
+
}
|
|
734
|
+
cellSize -= 1;
|
|
735
|
+
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
736
|
+
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
737
|
+
const min = margin;
|
|
738
|
+
const max = size - margin;
|
|
739
|
+
let y, x, r, p;
|
|
740
|
+
const white = Array(cellSize + 1).join("\u2588\u2588");
|
|
741
|
+
const black = Array(cellSize + 1).join(" ");
|
|
742
|
+
let ascii = "";
|
|
743
|
+
let line = "";
|
|
744
|
+
for (y = 0; y < size; y += 1) {
|
|
745
|
+
r = Math.floor((y - min) / cellSize);
|
|
746
|
+
line = "";
|
|
747
|
+
for (x = 0; x < size; x += 1) {
|
|
748
|
+
p = 1;
|
|
749
|
+
if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
|
|
750
|
+
p = 0;
|
|
751
|
+
}
|
|
752
|
+
line += p ? white : black;
|
|
753
|
+
}
|
|
754
|
+
for (r = 0; r < cellSize; r += 1) {
|
|
755
|
+
ascii += line + "\n";
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return ascii.substring(0, ascii.length - 1);
|
|
759
|
+
};
|
|
760
|
+
_this.renderTo2dContext = function(context, cellSize) {
|
|
761
|
+
cellSize = cellSize || 2;
|
|
762
|
+
const length = _this.getModuleCount();
|
|
763
|
+
for (let row = 0; row < length; row++) {
|
|
764
|
+
for (let col = 0; col < length; col++) {
|
|
765
|
+
context.fillStyle = _this.isDark(row, col) ? "black" : "white";
|
|
766
|
+
context.fillRect(col * cellSize, row * cellSize, cellSize, cellSize);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
return _this;
|
|
771
|
+
}, "qrcode");
|
|
772
|
+
qrcode.stringToBytes = function(s) {
|
|
773
|
+
const bytes = [];
|
|
774
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
775
|
+
const c = s.charCodeAt(i);
|
|
776
|
+
bytes.push(c & 255);
|
|
777
|
+
}
|
|
778
|
+
return bytes;
|
|
779
|
+
};
|
|
780
|
+
qrcode.createStringToBytes = function(unicodeData, numChars) {
|
|
781
|
+
const unicodeMap = (function() {
|
|
782
|
+
const bin = base64DecodeInputStream(unicodeData);
|
|
783
|
+
const read = /* @__PURE__ */ __name(function() {
|
|
784
|
+
const b = bin.read();
|
|
785
|
+
if (b == -1) throw "eof";
|
|
786
|
+
return b;
|
|
787
|
+
}, "read");
|
|
788
|
+
let count = 0;
|
|
789
|
+
const unicodeMap2 = {};
|
|
790
|
+
while (true) {
|
|
791
|
+
const b0 = bin.read();
|
|
792
|
+
if (b0 == -1) break;
|
|
793
|
+
const b1 = read();
|
|
794
|
+
const b2 = read();
|
|
795
|
+
const b3 = read();
|
|
796
|
+
const k = String.fromCharCode(b0 << 8 | b1);
|
|
797
|
+
const v = b2 << 8 | b3;
|
|
798
|
+
unicodeMap2[k] = v;
|
|
799
|
+
count += 1;
|
|
800
|
+
}
|
|
801
|
+
if (count != numChars) {
|
|
802
|
+
throw count + " != " + numChars;
|
|
803
|
+
}
|
|
804
|
+
return unicodeMap2;
|
|
805
|
+
})();
|
|
806
|
+
const unknownChar = "?".charCodeAt(0);
|
|
807
|
+
return function(s) {
|
|
808
|
+
const bytes = [];
|
|
809
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
810
|
+
const c = s.charCodeAt(i);
|
|
811
|
+
if (c < 128) {
|
|
812
|
+
bytes.push(c);
|
|
813
|
+
} else {
|
|
814
|
+
const b = unicodeMap[s.charAt(i)];
|
|
815
|
+
if (typeof b == "number") {
|
|
816
|
+
if ((b & 255) == b) {
|
|
817
|
+
bytes.push(b);
|
|
818
|
+
} else {
|
|
819
|
+
bytes.push(b >>> 8);
|
|
820
|
+
bytes.push(b & 255);
|
|
821
|
+
}
|
|
822
|
+
} else {
|
|
823
|
+
bytes.push(unknownChar);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
return bytes;
|
|
828
|
+
};
|
|
829
|
+
};
|
|
830
|
+
var QRMode = {
|
|
831
|
+
MODE_NUMBER: 1 << 0,
|
|
832
|
+
MODE_ALPHA_NUM: 1 << 1,
|
|
833
|
+
MODE_8BIT_BYTE: 1 << 2,
|
|
834
|
+
MODE_KANJI: 1 << 3
|
|
835
|
+
};
|
|
836
|
+
var QRErrorCorrectionLevel = {
|
|
837
|
+
L: 1,
|
|
838
|
+
M: 0,
|
|
839
|
+
Q: 3,
|
|
840
|
+
H: 2
|
|
841
|
+
};
|
|
842
|
+
var QRMaskPattern = {
|
|
843
|
+
PATTERN000: 0,
|
|
844
|
+
PATTERN001: 1,
|
|
845
|
+
PATTERN010: 2,
|
|
846
|
+
PATTERN011: 3,
|
|
847
|
+
PATTERN100: 4,
|
|
848
|
+
PATTERN101: 5,
|
|
849
|
+
PATTERN110: 6,
|
|
850
|
+
PATTERN111: 7
|
|
851
|
+
};
|
|
852
|
+
var QRUtil = (function() {
|
|
853
|
+
const PATTERN_POSITION_TABLE = [
|
|
854
|
+
[],
|
|
855
|
+
[6, 18],
|
|
856
|
+
[6, 22],
|
|
857
|
+
[6, 26],
|
|
858
|
+
[6, 30],
|
|
859
|
+
[6, 34],
|
|
860
|
+
[6, 22, 38],
|
|
861
|
+
[6, 24, 42],
|
|
862
|
+
[6, 26, 46],
|
|
863
|
+
[6, 28, 50],
|
|
864
|
+
[6, 30, 54],
|
|
865
|
+
[6, 32, 58],
|
|
866
|
+
[6, 34, 62],
|
|
867
|
+
[6, 26, 46, 66],
|
|
868
|
+
[6, 26, 48, 70],
|
|
869
|
+
[6, 26, 50, 74],
|
|
870
|
+
[6, 30, 54, 78],
|
|
871
|
+
[6, 30, 56, 82],
|
|
872
|
+
[6, 30, 58, 86],
|
|
873
|
+
[6, 34, 62, 90],
|
|
874
|
+
[6, 28, 50, 72, 94],
|
|
875
|
+
[6, 26, 50, 74, 98],
|
|
876
|
+
[6, 30, 54, 78, 102],
|
|
877
|
+
[6, 28, 54, 80, 106],
|
|
878
|
+
[6, 32, 58, 84, 110],
|
|
879
|
+
[6, 30, 58, 86, 114],
|
|
880
|
+
[6, 34, 62, 90, 118],
|
|
881
|
+
[6, 26, 50, 74, 98, 122],
|
|
882
|
+
[6, 30, 54, 78, 102, 126],
|
|
883
|
+
[6, 26, 52, 78, 104, 130],
|
|
884
|
+
[6, 30, 56, 82, 108, 134],
|
|
885
|
+
[6, 34, 60, 86, 112, 138],
|
|
886
|
+
[6, 30, 58, 86, 114, 142],
|
|
887
|
+
[6, 34, 62, 90, 118, 146],
|
|
888
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
889
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
890
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
891
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
892
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
893
|
+
[6, 30, 58, 86, 114, 142, 170]
|
|
894
|
+
];
|
|
895
|
+
const G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
896
|
+
const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
|
|
897
|
+
const G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
|
898
|
+
const _this = {};
|
|
899
|
+
const getBCHDigit = /* @__PURE__ */ __name(function(data) {
|
|
900
|
+
let digit = 0;
|
|
901
|
+
while (data != 0) {
|
|
902
|
+
digit += 1;
|
|
903
|
+
data >>>= 1;
|
|
904
|
+
}
|
|
905
|
+
return digit;
|
|
906
|
+
}, "getBCHDigit");
|
|
907
|
+
_this.getBCHTypeInfo = function(data) {
|
|
908
|
+
let d = data << 10;
|
|
909
|
+
while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
|
|
910
|
+
d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
|
|
911
|
+
}
|
|
912
|
+
return (data << 10 | d) ^ G15_MASK;
|
|
913
|
+
};
|
|
914
|
+
_this.getBCHTypeNumber = function(data) {
|
|
915
|
+
let d = data << 12;
|
|
916
|
+
while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
|
|
917
|
+
d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
|
|
918
|
+
}
|
|
919
|
+
return data << 12 | d;
|
|
920
|
+
};
|
|
921
|
+
_this.getPatternPosition = function(typeNumber) {
|
|
922
|
+
return PATTERN_POSITION_TABLE[typeNumber - 1];
|
|
923
|
+
};
|
|
924
|
+
_this.getMaskFunction = function(maskPattern) {
|
|
925
|
+
switch (maskPattern) {
|
|
926
|
+
case QRMaskPattern.PATTERN000:
|
|
927
|
+
return function(i, j) {
|
|
928
|
+
return (i + j) % 2 == 0;
|
|
929
|
+
};
|
|
930
|
+
case QRMaskPattern.PATTERN001:
|
|
931
|
+
return function(i, j) {
|
|
932
|
+
return i % 2 == 0;
|
|
933
|
+
};
|
|
934
|
+
case QRMaskPattern.PATTERN010:
|
|
935
|
+
return function(i, j) {
|
|
936
|
+
return j % 3 == 0;
|
|
937
|
+
};
|
|
938
|
+
case QRMaskPattern.PATTERN011:
|
|
939
|
+
return function(i, j) {
|
|
940
|
+
return (i + j) % 3 == 0;
|
|
941
|
+
};
|
|
942
|
+
case QRMaskPattern.PATTERN100:
|
|
943
|
+
return function(i, j) {
|
|
944
|
+
return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
|
|
945
|
+
};
|
|
946
|
+
case QRMaskPattern.PATTERN101:
|
|
947
|
+
return function(i, j) {
|
|
948
|
+
return i * j % 2 + i * j % 3 == 0;
|
|
949
|
+
};
|
|
950
|
+
case QRMaskPattern.PATTERN110:
|
|
951
|
+
return function(i, j) {
|
|
952
|
+
return (i * j % 2 + i * j % 3) % 2 == 0;
|
|
953
|
+
};
|
|
954
|
+
case QRMaskPattern.PATTERN111:
|
|
955
|
+
return function(i, j) {
|
|
956
|
+
return (i * j % 3 + (i + j) % 2) % 2 == 0;
|
|
957
|
+
};
|
|
958
|
+
default:
|
|
959
|
+
throw "bad maskPattern:" + maskPattern;
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
_this.getErrorCorrectPolynomial = function(errorCorrectLength) {
|
|
963
|
+
let a = qrPolynomial([1], 0);
|
|
964
|
+
for (let i = 0; i < errorCorrectLength; i += 1) {
|
|
965
|
+
a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
|
|
966
|
+
}
|
|
967
|
+
return a;
|
|
968
|
+
};
|
|
969
|
+
_this.getLengthInBits = function(mode, type) {
|
|
970
|
+
if (1 <= type && type < 10) {
|
|
971
|
+
switch (mode) {
|
|
972
|
+
case QRMode.MODE_NUMBER:
|
|
973
|
+
return 10;
|
|
974
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
975
|
+
return 9;
|
|
976
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
977
|
+
return 8;
|
|
978
|
+
case QRMode.MODE_KANJI:
|
|
979
|
+
return 8;
|
|
980
|
+
default:
|
|
981
|
+
throw "mode:" + mode;
|
|
982
|
+
}
|
|
983
|
+
} else if (type < 27) {
|
|
984
|
+
switch (mode) {
|
|
985
|
+
case QRMode.MODE_NUMBER:
|
|
986
|
+
return 12;
|
|
987
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
988
|
+
return 11;
|
|
989
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
990
|
+
return 16;
|
|
991
|
+
case QRMode.MODE_KANJI:
|
|
992
|
+
return 10;
|
|
993
|
+
default:
|
|
994
|
+
throw "mode:" + mode;
|
|
995
|
+
}
|
|
996
|
+
} else if (type < 41) {
|
|
997
|
+
switch (mode) {
|
|
998
|
+
case QRMode.MODE_NUMBER:
|
|
999
|
+
return 14;
|
|
1000
|
+
case QRMode.MODE_ALPHA_NUM:
|
|
1001
|
+
return 13;
|
|
1002
|
+
case QRMode.MODE_8BIT_BYTE:
|
|
1003
|
+
return 16;
|
|
1004
|
+
case QRMode.MODE_KANJI:
|
|
1005
|
+
return 12;
|
|
1006
|
+
default:
|
|
1007
|
+
throw "mode:" + mode;
|
|
1008
|
+
}
|
|
1009
|
+
} else {
|
|
1010
|
+
throw "type:" + type;
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
_this.getLostPoint = function(qrcode2) {
|
|
1014
|
+
const moduleCount = qrcode2.getModuleCount();
|
|
1015
|
+
let lostPoint = 0;
|
|
1016
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
1017
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
1018
|
+
let sameCount = 0;
|
|
1019
|
+
const dark = qrcode2.isDark(row, col);
|
|
1020
|
+
for (let r = -1; r <= 1; r += 1) {
|
|
1021
|
+
if (row + r < 0 || moduleCount <= row + r) {
|
|
1022
|
+
continue;
|
|
1023
|
+
}
|
|
1024
|
+
for (let c = -1; c <= 1; c += 1) {
|
|
1025
|
+
if (col + c < 0 || moduleCount <= col + c) {
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
if (r == 0 && c == 0) {
|
|
1029
|
+
continue;
|
|
1030
|
+
}
|
|
1031
|
+
if (dark == qrcode2.isDark(row + r, col + c)) {
|
|
1032
|
+
sameCount += 1;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
if (sameCount > 5) {
|
|
1037
|
+
lostPoint += 3 + sameCount - 5;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
;
|
|
1042
|
+
for (let row = 0; row < moduleCount - 1; row += 1) {
|
|
1043
|
+
for (let col = 0; col < moduleCount - 1; col += 1) {
|
|
1044
|
+
let count = 0;
|
|
1045
|
+
if (qrcode2.isDark(row, col)) count += 1;
|
|
1046
|
+
if (qrcode2.isDark(row + 1, col)) count += 1;
|
|
1047
|
+
if (qrcode2.isDark(row, col + 1)) count += 1;
|
|
1048
|
+
if (qrcode2.isDark(row + 1, col + 1)) count += 1;
|
|
1049
|
+
if (count == 0 || count == 4) {
|
|
1050
|
+
lostPoint += 3;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
1055
|
+
for (let col = 0; col < moduleCount - 6; col += 1) {
|
|
1056
|
+
if (qrcode2.isDark(row, col) && !qrcode2.isDark(row, col + 1) && qrcode2.isDark(row, col + 2) && qrcode2.isDark(row, col + 3) && qrcode2.isDark(row, col + 4) && !qrcode2.isDark(row, col + 5) && qrcode2.isDark(row, col + 6)) {
|
|
1057
|
+
lostPoint += 40;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
1062
|
+
for (let row = 0; row < moduleCount - 6; row += 1) {
|
|
1063
|
+
if (qrcode2.isDark(row, col) && !qrcode2.isDark(row + 1, col) && qrcode2.isDark(row + 2, col) && qrcode2.isDark(row + 3, col) && qrcode2.isDark(row + 4, col) && !qrcode2.isDark(row + 5, col) && qrcode2.isDark(row + 6, col)) {
|
|
1064
|
+
lostPoint += 40;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
let darkCount = 0;
|
|
1069
|
+
for (let col = 0; col < moduleCount; col += 1) {
|
|
1070
|
+
for (let row = 0; row < moduleCount; row += 1) {
|
|
1071
|
+
if (qrcode2.isDark(row, col)) {
|
|
1072
|
+
darkCount += 1;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
|
1077
|
+
lostPoint += ratio * 10;
|
|
1078
|
+
return lostPoint;
|
|
1079
|
+
};
|
|
1080
|
+
return _this;
|
|
1081
|
+
})();
|
|
1082
|
+
var QRMath = (function() {
|
|
1083
|
+
const EXP_TABLE = new Array(256);
|
|
1084
|
+
const LOG_TABLE = new Array(256);
|
|
1085
|
+
for (let i = 0; i < 8; i += 1) {
|
|
1086
|
+
EXP_TABLE[i] = 1 << i;
|
|
1087
|
+
}
|
|
1088
|
+
for (let i = 8; i < 256; i += 1) {
|
|
1089
|
+
EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
|
1090
|
+
}
|
|
1091
|
+
for (let i = 0; i < 255; i += 1) {
|
|
1092
|
+
LOG_TABLE[EXP_TABLE[i]] = i;
|
|
1093
|
+
}
|
|
1094
|
+
const _this = {};
|
|
1095
|
+
_this.glog = function(n) {
|
|
1096
|
+
if (n < 1) {
|
|
1097
|
+
throw "glog(" + n + ")";
|
|
1098
|
+
}
|
|
1099
|
+
return LOG_TABLE[n];
|
|
1100
|
+
};
|
|
1101
|
+
_this.gexp = function(n) {
|
|
1102
|
+
while (n < 0) {
|
|
1103
|
+
n += 255;
|
|
1104
|
+
}
|
|
1105
|
+
while (n >= 256) {
|
|
1106
|
+
n -= 255;
|
|
1107
|
+
}
|
|
1108
|
+
return EXP_TABLE[n];
|
|
1109
|
+
};
|
|
1110
|
+
return _this;
|
|
1111
|
+
})();
|
|
1112
|
+
var qrPolynomial = /* @__PURE__ */ __name(function(num, shift) {
|
|
1113
|
+
if (typeof num.length == "undefined") {
|
|
1114
|
+
throw num.length + "/" + shift;
|
|
1115
|
+
}
|
|
1116
|
+
const _num = (function() {
|
|
1117
|
+
let offset = 0;
|
|
1118
|
+
while (offset < num.length && num[offset] == 0) {
|
|
1119
|
+
offset += 1;
|
|
1120
|
+
}
|
|
1121
|
+
const _num2 = new Array(num.length - offset + shift);
|
|
1122
|
+
for (let i = 0; i < num.length - offset; i += 1) {
|
|
1123
|
+
_num2[i] = num[i + offset];
|
|
1124
|
+
}
|
|
1125
|
+
return _num2;
|
|
1126
|
+
})();
|
|
1127
|
+
const _this = {};
|
|
1128
|
+
_this.getAt = function(index) {
|
|
1129
|
+
return _num[index];
|
|
1130
|
+
};
|
|
1131
|
+
_this.getLength = function() {
|
|
1132
|
+
return _num.length;
|
|
1133
|
+
};
|
|
1134
|
+
_this.multiply = function(e) {
|
|
1135
|
+
const num2 = new Array(_this.getLength() + e.getLength() - 1);
|
|
1136
|
+
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
1137
|
+
for (let j = 0; j < e.getLength(); j += 1) {
|
|
1138
|
+
num2[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
return qrPolynomial(num2, 0);
|
|
1142
|
+
};
|
|
1143
|
+
_this.mod = function(e) {
|
|
1144
|
+
if (_this.getLength() - e.getLength() < 0) {
|
|
1145
|
+
return _this;
|
|
1146
|
+
}
|
|
1147
|
+
const ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
|
|
1148
|
+
const num2 = new Array(_this.getLength());
|
|
1149
|
+
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
1150
|
+
num2[i] = _this.getAt(i);
|
|
1151
|
+
}
|
|
1152
|
+
for (let i = 0; i < e.getLength(); i += 1) {
|
|
1153
|
+
num2[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
|
|
1154
|
+
}
|
|
1155
|
+
return qrPolynomial(num2, 0).mod(e);
|
|
1156
|
+
};
|
|
1157
|
+
return _this;
|
|
1158
|
+
}, "qrPolynomial");
|
|
1159
|
+
var QRRSBlock = (function() {
|
|
1160
|
+
const RS_BLOCK_TABLE = [
|
|
1161
|
+
// L
|
|
1162
|
+
// M
|
|
1163
|
+
// Q
|
|
1164
|
+
// H
|
|
1165
|
+
// 1
|
|
1166
|
+
[1, 26, 19],
|
|
1167
|
+
[1, 26, 16],
|
|
1168
|
+
[1, 26, 13],
|
|
1169
|
+
[1, 26, 9],
|
|
1170
|
+
// 2
|
|
1171
|
+
[1, 44, 34],
|
|
1172
|
+
[1, 44, 28],
|
|
1173
|
+
[1, 44, 22],
|
|
1174
|
+
[1, 44, 16],
|
|
1175
|
+
// 3
|
|
1176
|
+
[1, 70, 55],
|
|
1177
|
+
[1, 70, 44],
|
|
1178
|
+
[2, 35, 17],
|
|
1179
|
+
[2, 35, 13],
|
|
1180
|
+
// 4
|
|
1181
|
+
[1, 100, 80],
|
|
1182
|
+
[2, 50, 32],
|
|
1183
|
+
[2, 50, 24],
|
|
1184
|
+
[4, 25, 9],
|
|
1185
|
+
// 5
|
|
1186
|
+
[1, 134, 108],
|
|
1187
|
+
[2, 67, 43],
|
|
1188
|
+
[2, 33, 15, 2, 34, 16],
|
|
1189
|
+
[2, 33, 11, 2, 34, 12],
|
|
1190
|
+
// 6
|
|
1191
|
+
[2, 86, 68],
|
|
1192
|
+
[4, 43, 27],
|
|
1193
|
+
[4, 43, 19],
|
|
1194
|
+
[4, 43, 15],
|
|
1195
|
+
// 7
|
|
1196
|
+
[2, 98, 78],
|
|
1197
|
+
[4, 49, 31],
|
|
1198
|
+
[2, 32, 14, 4, 33, 15],
|
|
1199
|
+
[4, 39, 13, 1, 40, 14],
|
|
1200
|
+
// 8
|
|
1201
|
+
[2, 121, 97],
|
|
1202
|
+
[2, 60, 38, 2, 61, 39],
|
|
1203
|
+
[4, 40, 18, 2, 41, 19],
|
|
1204
|
+
[4, 40, 14, 2, 41, 15],
|
|
1205
|
+
// 9
|
|
1206
|
+
[2, 146, 116],
|
|
1207
|
+
[3, 58, 36, 2, 59, 37],
|
|
1208
|
+
[4, 36, 16, 4, 37, 17],
|
|
1209
|
+
[4, 36, 12, 4, 37, 13],
|
|
1210
|
+
// 10
|
|
1211
|
+
[2, 86, 68, 2, 87, 69],
|
|
1212
|
+
[4, 69, 43, 1, 70, 44],
|
|
1213
|
+
[6, 43, 19, 2, 44, 20],
|
|
1214
|
+
[6, 43, 15, 2, 44, 16],
|
|
1215
|
+
// 11
|
|
1216
|
+
[4, 101, 81],
|
|
1217
|
+
[1, 80, 50, 4, 81, 51],
|
|
1218
|
+
[4, 50, 22, 4, 51, 23],
|
|
1219
|
+
[3, 36, 12, 8, 37, 13],
|
|
1220
|
+
// 12
|
|
1221
|
+
[2, 116, 92, 2, 117, 93],
|
|
1222
|
+
[6, 58, 36, 2, 59, 37],
|
|
1223
|
+
[4, 46, 20, 6, 47, 21],
|
|
1224
|
+
[7, 42, 14, 4, 43, 15],
|
|
1225
|
+
// 13
|
|
1226
|
+
[4, 133, 107],
|
|
1227
|
+
[8, 59, 37, 1, 60, 38],
|
|
1228
|
+
[8, 44, 20, 4, 45, 21],
|
|
1229
|
+
[12, 33, 11, 4, 34, 12],
|
|
1230
|
+
// 14
|
|
1231
|
+
[3, 145, 115, 1, 146, 116],
|
|
1232
|
+
[4, 64, 40, 5, 65, 41],
|
|
1233
|
+
[11, 36, 16, 5, 37, 17],
|
|
1234
|
+
[11, 36, 12, 5, 37, 13],
|
|
1235
|
+
// 15
|
|
1236
|
+
[5, 109, 87, 1, 110, 88],
|
|
1237
|
+
[5, 65, 41, 5, 66, 42],
|
|
1238
|
+
[5, 54, 24, 7, 55, 25],
|
|
1239
|
+
[11, 36, 12, 7, 37, 13],
|
|
1240
|
+
// 16
|
|
1241
|
+
[5, 122, 98, 1, 123, 99],
|
|
1242
|
+
[7, 73, 45, 3, 74, 46],
|
|
1243
|
+
[15, 43, 19, 2, 44, 20],
|
|
1244
|
+
[3, 45, 15, 13, 46, 16],
|
|
1245
|
+
// 17
|
|
1246
|
+
[1, 135, 107, 5, 136, 108],
|
|
1247
|
+
[10, 74, 46, 1, 75, 47],
|
|
1248
|
+
[1, 50, 22, 15, 51, 23],
|
|
1249
|
+
[2, 42, 14, 17, 43, 15],
|
|
1250
|
+
// 18
|
|
1251
|
+
[5, 150, 120, 1, 151, 121],
|
|
1252
|
+
[9, 69, 43, 4, 70, 44],
|
|
1253
|
+
[17, 50, 22, 1, 51, 23],
|
|
1254
|
+
[2, 42, 14, 19, 43, 15],
|
|
1255
|
+
// 19
|
|
1256
|
+
[3, 141, 113, 4, 142, 114],
|
|
1257
|
+
[3, 70, 44, 11, 71, 45],
|
|
1258
|
+
[17, 47, 21, 4, 48, 22],
|
|
1259
|
+
[9, 39, 13, 16, 40, 14],
|
|
1260
|
+
// 20
|
|
1261
|
+
[3, 135, 107, 5, 136, 108],
|
|
1262
|
+
[3, 67, 41, 13, 68, 42],
|
|
1263
|
+
[15, 54, 24, 5, 55, 25],
|
|
1264
|
+
[15, 43, 15, 10, 44, 16],
|
|
1265
|
+
// 21
|
|
1266
|
+
[4, 144, 116, 4, 145, 117],
|
|
1267
|
+
[17, 68, 42],
|
|
1268
|
+
[17, 50, 22, 6, 51, 23],
|
|
1269
|
+
[19, 46, 16, 6, 47, 17],
|
|
1270
|
+
// 22
|
|
1271
|
+
[2, 139, 111, 7, 140, 112],
|
|
1272
|
+
[17, 74, 46],
|
|
1273
|
+
[7, 54, 24, 16, 55, 25],
|
|
1274
|
+
[34, 37, 13],
|
|
1275
|
+
// 23
|
|
1276
|
+
[4, 151, 121, 5, 152, 122],
|
|
1277
|
+
[4, 75, 47, 14, 76, 48],
|
|
1278
|
+
[11, 54, 24, 14, 55, 25],
|
|
1279
|
+
[16, 45, 15, 14, 46, 16],
|
|
1280
|
+
// 24
|
|
1281
|
+
[6, 147, 117, 4, 148, 118],
|
|
1282
|
+
[6, 73, 45, 14, 74, 46],
|
|
1283
|
+
[11, 54, 24, 16, 55, 25],
|
|
1284
|
+
[30, 46, 16, 2, 47, 17],
|
|
1285
|
+
// 25
|
|
1286
|
+
[8, 132, 106, 4, 133, 107],
|
|
1287
|
+
[8, 75, 47, 13, 76, 48],
|
|
1288
|
+
[7, 54, 24, 22, 55, 25],
|
|
1289
|
+
[22, 45, 15, 13, 46, 16],
|
|
1290
|
+
// 26
|
|
1291
|
+
[10, 142, 114, 2, 143, 115],
|
|
1292
|
+
[19, 74, 46, 4, 75, 47],
|
|
1293
|
+
[28, 50, 22, 6, 51, 23],
|
|
1294
|
+
[33, 46, 16, 4, 47, 17],
|
|
1295
|
+
// 27
|
|
1296
|
+
[8, 152, 122, 4, 153, 123],
|
|
1297
|
+
[22, 73, 45, 3, 74, 46],
|
|
1298
|
+
[8, 53, 23, 26, 54, 24],
|
|
1299
|
+
[12, 45, 15, 28, 46, 16],
|
|
1300
|
+
// 28
|
|
1301
|
+
[3, 147, 117, 10, 148, 118],
|
|
1302
|
+
[3, 73, 45, 23, 74, 46],
|
|
1303
|
+
[4, 54, 24, 31, 55, 25],
|
|
1304
|
+
[11, 45, 15, 31, 46, 16],
|
|
1305
|
+
// 29
|
|
1306
|
+
[7, 146, 116, 7, 147, 117],
|
|
1307
|
+
[21, 73, 45, 7, 74, 46],
|
|
1308
|
+
[1, 53, 23, 37, 54, 24],
|
|
1309
|
+
[19, 45, 15, 26, 46, 16],
|
|
1310
|
+
// 30
|
|
1311
|
+
[5, 145, 115, 10, 146, 116],
|
|
1312
|
+
[19, 75, 47, 10, 76, 48],
|
|
1313
|
+
[15, 54, 24, 25, 55, 25],
|
|
1314
|
+
[23, 45, 15, 25, 46, 16],
|
|
1315
|
+
// 31
|
|
1316
|
+
[13, 145, 115, 3, 146, 116],
|
|
1317
|
+
[2, 74, 46, 29, 75, 47],
|
|
1318
|
+
[42, 54, 24, 1, 55, 25],
|
|
1319
|
+
[23, 45, 15, 28, 46, 16],
|
|
1320
|
+
// 32
|
|
1321
|
+
[17, 145, 115],
|
|
1322
|
+
[10, 74, 46, 23, 75, 47],
|
|
1323
|
+
[10, 54, 24, 35, 55, 25],
|
|
1324
|
+
[19, 45, 15, 35, 46, 16],
|
|
1325
|
+
// 33
|
|
1326
|
+
[17, 145, 115, 1, 146, 116],
|
|
1327
|
+
[14, 74, 46, 21, 75, 47],
|
|
1328
|
+
[29, 54, 24, 19, 55, 25],
|
|
1329
|
+
[11, 45, 15, 46, 46, 16],
|
|
1330
|
+
// 34
|
|
1331
|
+
[13, 145, 115, 6, 146, 116],
|
|
1332
|
+
[14, 74, 46, 23, 75, 47],
|
|
1333
|
+
[44, 54, 24, 7, 55, 25],
|
|
1334
|
+
[59, 46, 16, 1, 47, 17],
|
|
1335
|
+
// 35
|
|
1336
|
+
[12, 151, 121, 7, 152, 122],
|
|
1337
|
+
[12, 75, 47, 26, 76, 48],
|
|
1338
|
+
[39, 54, 24, 14, 55, 25],
|
|
1339
|
+
[22, 45, 15, 41, 46, 16],
|
|
1340
|
+
// 36
|
|
1341
|
+
[6, 151, 121, 14, 152, 122],
|
|
1342
|
+
[6, 75, 47, 34, 76, 48],
|
|
1343
|
+
[46, 54, 24, 10, 55, 25],
|
|
1344
|
+
[2, 45, 15, 64, 46, 16],
|
|
1345
|
+
// 37
|
|
1346
|
+
[17, 152, 122, 4, 153, 123],
|
|
1347
|
+
[29, 74, 46, 14, 75, 47],
|
|
1348
|
+
[49, 54, 24, 10, 55, 25],
|
|
1349
|
+
[24, 45, 15, 46, 46, 16],
|
|
1350
|
+
// 38
|
|
1351
|
+
[4, 152, 122, 18, 153, 123],
|
|
1352
|
+
[13, 74, 46, 32, 75, 47],
|
|
1353
|
+
[48, 54, 24, 14, 55, 25],
|
|
1354
|
+
[42, 45, 15, 32, 46, 16],
|
|
1355
|
+
// 39
|
|
1356
|
+
[20, 147, 117, 4, 148, 118],
|
|
1357
|
+
[40, 75, 47, 7, 76, 48],
|
|
1358
|
+
[43, 54, 24, 22, 55, 25],
|
|
1359
|
+
[10, 45, 15, 67, 46, 16],
|
|
1360
|
+
// 40
|
|
1361
|
+
[19, 148, 118, 6, 149, 119],
|
|
1362
|
+
[18, 75, 47, 31, 76, 48],
|
|
1363
|
+
[34, 54, 24, 34, 55, 25],
|
|
1364
|
+
[20, 45, 15, 61, 46, 16]
|
|
1365
|
+
];
|
|
1366
|
+
const qrRSBlock = /* @__PURE__ */ __name(function(totalCount, dataCount) {
|
|
1367
|
+
const _this2 = {};
|
|
1368
|
+
_this2.totalCount = totalCount;
|
|
1369
|
+
_this2.dataCount = dataCount;
|
|
1370
|
+
return _this2;
|
|
1371
|
+
}, "qrRSBlock");
|
|
1372
|
+
const _this = {};
|
|
1373
|
+
const getRsBlockTable = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
1374
|
+
switch (errorCorrectionLevel) {
|
|
1375
|
+
case QRErrorCorrectionLevel.L:
|
|
1376
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
|
1377
|
+
case QRErrorCorrectionLevel.M:
|
|
1378
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
|
1379
|
+
case QRErrorCorrectionLevel.Q:
|
|
1380
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
|
1381
|
+
case QRErrorCorrectionLevel.H:
|
|
1382
|
+
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
|
1383
|
+
default:
|
|
1384
|
+
return void 0;
|
|
1385
|
+
}
|
|
1386
|
+
}, "getRsBlockTable");
|
|
1387
|
+
_this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
|
|
1388
|
+
const rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
|
|
1389
|
+
if (typeof rsBlock == "undefined") {
|
|
1390
|
+
throw "bad rs block @ typeNumber:" + typeNumber + "/errorCorrectionLevel:" + errorCorrectionLevel;
|
|
1391
|
+
}
|
|
1392
|
+
const length = rsBlock.length / 3;
|
|
1393
|
+
const list = [];
|
|
1394
|
+
for (let i = 0; i < length; i += 1) {
|
|
1395
|
+
const count = rsBlock[i * 3 + 0];
|
|
1396
|
+
const totalCount = rsBlock[i * 3 + 1];
|
|
1397
|
+
const dataCount = rsBlock[i * 3 + 2];
|
|
1398
|
+
for (let j = 0; j < count; j += 1) {
|
|
1399
|
+
list.push(qrRSBlock(totalCount, dataCount));
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return list;
|
|
1403
|
+
};
|
|
1404
|
+
return _this;
|
|
1405
|
+
})();
|
|
1406
|
+
var qrBitBuffer = /* @__PURE__ */ __name(function() {
|
|
1407
|
+
const _buffer = [];
|
|
1408
|
+
let _length = 0;
|
|
1409
|
+
const _this = {};
|
|
1410
|
+
_this.getBuffer = function() {
|
|
1411
|
+
return _buffer;
|
|
1412
|
+
};
|
|
1413
|
+
_this.getAt = function(index) {
|
|
1414
|
+
const bufIndex = Math.floor(index / 8);
|
|
1415
|
+
return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
|
|
1416
|
+
};
|
|
1417
|
+
_this.put = function(num, length) {
|
|
1418
|
+
for (let i = 0; i < length; i += 1) {
|
|
1419
|
+
_this.putBit((num >>> length - i - 1 & 1) == 1);
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
_this.getLengthInBits = function() {
|
|
1423
|
+
return _length;
|
|
1424
|
+
};
|
|
1425
|
+
_this.putBit = function(bit) {
|
|
1426
|
+
const bufIndex = Math.floor(_length / 8);
|
|
1427
|
+
if (_buffer.length <= bufIndex) {
|
|
1428
|
+
_buffer.push(0);
|
|
1429
|
+
}
|
|
1430
|
+
if (bit) {
|
|
1431
|
+
_buffer[bufIndex] |= 128 >>> _length % 8;
|
|
1432
|
+
}
|
|
1433
|
+
_length += 1;
|
|
1434
|
+
};
|
|
1435
|
+
return _this;
|
|
1436
|
+
}, "qrBitBuffer");
|
|
1437
|
+
var qrNumber = /* @__PURE__ */ __name(function(data) {
|
|
1438
|
+
const _mode = QRMode.MODE_NUMBER;
|
|
1439
|
+
const _data = data;
|
|
1440
|
+
const _this = {};
|
|
1441
|
+
_this.getMode = function() {
|
|
1442
|
+
return _mode;
|
|
1443
|
+
};
|
|
1444
|
+
_this.getLength = function(buffer) {
|
|
1445
|
+
return _data.length;
|
|
1446
|
+
};
|
|
1447
|
+
_this.write = function(buffer) {
|
|
1448
|
+
const data2 = _data;
|
|
1449
|
+
let i = 0;
|
|
1450
|
+
while (i + 2 < data2.length) {
|
|
1451
|
+
buffer.put(strToNum(data2.substring(i, i + 3)), 10);
|
|
1452
|
+
i += 3;
|
|
1453
|
+
}
|
|
1454
|
+
if (i < data2.length) {
|
|
1455
|
+
if (data2.length - i == 1) {
|
|
1456
|
+
buffer.put(strToNum(data2.substring(i, i + 1)), 4);
|
|
1457
|
+
} else if (data2.length - i == 2) {
|
|
1458
|
+
buffer.put(strToNum(data2.substring(i, i + 2)), 7);
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
const strToNum = /* @__PURE__ */ __name(function(s) {
|
|
1463
|
+
let num = 0;
|
|
1464
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
1465
|
+
num = num * 10 + chatToNum(s.charAt(i));
|
|
1466
|
+
}
|
|
1467
|
+
return num;
|
|
1468
|
+
}, "strToNum");
|
|
1469
|
+
const chatToNum = /* @__PURE__ */ __name(function(c) {
|
|
1470
|
+
if ("0" <= c && c <= "9") {
|
|
1471
|
+
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
1472
|
+
}
|
|
1473
|
+
throw "illegal char :" + c;
|
|
1474
|
+
}, "chatToNum");
|
|
1475
|
+
return _this;
|
|
1476
|
+
}, "qrNumber");
|
|
1477
|
+
var qrAlphaNum = /* @__PURE__ */ __name(function(data) {
|
|
1478
|
+
const _mode = QRMode.MODE_ALPHA_NUM;
|
|
1479
|
+
const _data = data;
|
|
1480
|
+
const _this = {};
|
|
1481
|
+
_this.getMode = function() {
|
|
1482
|
+
return _mode;
|
|
1483
|
+
};
|
|
1484
|
+
_this.getLength = function(buffer) {
|
|
1485
|
+
return _data.length;
|
|
1486
|
+
};
|
|
1487
|
+
_this.write = function(buffer) {
|
|
1488
|
+
const s = _data;
|
|
1489
|
+
let i = 0;
|
|
1490
|
+
while (i + 1 < s.length) {
|
|
1491
|
+
buffer.put(
|
|
1492
|
+
getCode(s.charAt(i)) * 45 + getCode(s.charAt(i + 1)),
|
|
1493
|
+
11
|
|
1494
|
+
);
|
|
1495
|
+
i += 2;
|
|
1496
|
+
}
|
|
1497
|
+
if (i < s.length) {
|
|
1498
|
+
buffer.put(getCode(s.charAt(i)), 6);
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
const getCode = /* @__PURE__ */ __name(function(c) {
|
|
1502
|
+
if ("0" <= c && c <= "9") {
|
|
1503
|
+
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
1504
|
+
} else if ("A" <= c && c <= "Z") {
|
|
1505
|
+
return c.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
1506
|
+
} else {
|
|
1507
|
+
switch (c) {
|
|
1508
|
+
case " ":
|
|
1509
|
+
return 36;
|
|
1510
|
+
case "$":
|
|
1511
|
+
return 37;
|
|
1512
|
+
case "%":
|
|
1513
|
+
return 38;
|
|
1514
|
+
case "*":
|
|
1515
|
+
return 39;
|
|
1516
|
+
case "+":
|
|
1517
|
+
return 40;
|
|
1518
|
+
case "-":
|
|
1519
|
+
return 41;
|
|
1520
|
+
case ".":
|
|
1521
|
+
return 42;
|
|
1522
|
+
case "/":
|
|
1523
|
+
return 43;
|
|
1524
|
+
case ":":
|
|
1525
|
+
return 44;
|
|
1526
|
+
default:
|
|
1527
|
+
throw "illegal char :" + c;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
}, "getCode");
|
|
1531
|
+
return _this;
|
|
1532
|
+
}, "qrAlphaNum");
|
|
1533
|
+
var qr8BitByte = /* @__PURE__ */ __name(function(data) {
|
|
1534
|
+
const _mode = QRMode.MODE_8BIT_BYTE;
|
|
1535
|
+
const _data = data;
|
|
1536
|
+
const _bytes = qrcode.stringToBytes(data);
|
|
1537
|
+
const _this = {};
|
|
1538
|
+
_this.getMode = function() {
|
|
1539
|
+
return _mode;
|
|
1540
|
+
};
|
|
1541
|
+
_this.getLength = function(buffer) {
|
|
1542
|
+
return _bytes.length;
|
|
1543
|
+
};
|
|
1544
|
+
_this.write = function(buffer) {
|
|
1545
|
+
for (let i = 0; i < _bytes.length; i += 1) {
|
|
1546
|
+
buffer.put(_bytes[i], 8);
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
return _this;
|
|
1550
|
+
}, "qr8BitByte");
|
|
1551
|
+
var qrKanji = /* @__PURE__ */ __name(function(data) {
|
|
1552
|
+
const _mode = QRMode.MODE_KANJI;
|
|
1553
|
+
const _data = data;
|
|
1554
|
+
const stringToBytes2 = qrcode.stringToBytes;
|
|
1555
|
+
!(function(c, code) {
|
|
1556
|
+
const test = stringToBytes2(c);
|
|
1557
|
+
if (test.length != 2 || (test[0] << 8 | test[1]) != code) {
|
|
1558
|
+
throw "sjis not supported.";
|
|
1559
|
+
}
|
|
1560
|
+
})("\u53CB", 38726);
|
|
1561
|
+
const _bytes = stringToBytes2(data);
|
|
1562
|
+
const _this = {};
|
|
1563
|
+
_this.getMode = function() {
|
|
1564
|
+
return _mode;
|
|
1565
|
+
};
|
|
1566
|
+
_this.getLength = function(buffer) {
|
|
1567
|
+
return ~~(_bytes.length / 2);
|
|
1568
|
+
};
|
|
1569
|
+
_this.write = function(buffer) {
|
|
1570
|
+
const data2 = _bytes;
|
|
1571
|
+
let i = 0;
|
|
1572
|
+
while (i + 1 < data2.length) {
|
|
1573
|
+
let c = (255 & data2[i]) << 8 | 255 & data2[i + 1];
|
|
1574
|
+
if (33088 <= c && c <= 40956) {
|
|
1575
|
+
c -= 33088;
|
|
1576
|
+
} else if (57408 <= c && c <= 60351) {
|
|
1577
|
+
c -= 49472;
|
|
1578
|
+
} else {
|
|
1579
|
+
throw "illegal char at " + (i + 1) + "/" + c;
|
|
1580
|
+
}
|
|
1581
|
+
c = (c >>> 8 & 255) * 192 + (c & 255);
|
|
1582
|
+
buffer.put(c, 13);
|
|
1583
|
+
i += 2;
|
|
1584
|
+
}
|
|
1585
|
+
if (i < data2.length) {
|
|
1586
|
+
throw "illegal char at " + (i + 1);
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
return _this;
|
|
1590
|
+
}, "qrKanji");
|
|
1591
|
+
var byteArrayOutputStream = /* @__PURE__ */ __name(function() {
|
|
1592
|
+
const _bytes = [];
|
|
1593
|
+
const _this = {};
|
|
1594
|
+
_this.writeByte = function(b) {
|
|
1595
|
+
_bytes.push(b & 255);
|
|
1596
|
+
};
|
|
1597
|
+
_this.writeShort = function(i) {
|
|
1598
|
+
_this.writeByte(i);
|
|
1599
|
+
_this.writeByte(i >>> 8);
|
|
1600
|
+
};
|
|
1601
|
+
_this.writeBytes = function(b, off, len) {
|
|
1602
|
+
off = off || 0;
|
|
1603
|
+
len = len || b.length;
|
|
1604
|
+
for (let i = 0; i < len; i += 1) {
|
|
1605
|
+
_this.writeByte(b[i + off]);
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
_this.writeString = function(s) {
|
|
1609
|
+
for (let i = 0; i < s.length; i += 1) {
|
|
1610
|
+
_this.writeByte(s.charCodeAt(i));
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
_this.toByteArray = function() {
|
|
1614
|
+
return _bytes;
|
|
1615
|
+
};
|
|
1616
|
+
_this.toString = function() {
|
|
1617
|
+
let s = "";
|
|
1618
|
+
s += "[";
|
|
1619
|
+
for (let i = 0; i < _bytes.length; i += 1) {
|
|
1620
|
+
if (i > 0) {
|
|
1621
|
+
s += ",";
|
|
1622
|
+
}
|
|
1623
|
+
s += _bytes[i];
|
|
1624
|
+
}
|
|
1625
|
+
s += "]";
|
|
1626
|
+
return s;
|
|
1627
|
+
};
|
|
1628
|
+
return _this;
|
|
1629
|
+
}, "byteArrayOutputStream");
|
|
1630
|
+
var base64EncodeOutputStream = /* @__PURE__ */ __name(function() {
|
|
1631
|
+
let _buffer = 0;
|
|
1632
|
+
let _buflen = 0;
|
|
1633
|
+
let _length = 0;
|
|
1634
|
+
let _base64 = "";
|
|
1635
|
+
const _this = {};
|
|
1636
|
+
const writeEncoded = /* @__PURE__ */ __name(function(b) {
|
|
1637
|
+
_base64 += String.fromCharCode(encode(b & 63));
|
|
1638
|
+
}, "writeEncoded");
|
|
1639
|
+
const encode = /* @__PURE__ */ __name(function(n) {
|
|
1640
|
+
if (n < 0) {
|
|
1641
|
+
throw "n:" + n;
|
|
1642
|
+
} else if (n < 26) {
|
|
1643
|
+
return 65 + n;
|
|
1644
|
+
} else if (n < 52) {
|
|
1645
|
+
return 97 + (n - 26);
|
|
1646
|
+
} else if (n < 62) {
|
|
1647
|
+
return 48 + (n - 52);
|
|
1648
|
+
} else if (n == 62) {
|
|
1649
|
+
return 43;
|
|
1650
|
+
} else if (n == 63) {
|
|
1651
|
+
return 47;
|
|
1652
|
+
} else {
|
|
1653
|
+
throw "n:" + n;
|
|
1654
|
+
}
|
|
1655
|
+
}, "encode");
|
|
1656
|
+
_this.writeByte = function(n) {
|
|
1657
|
+
_buffer = _buffer << 8 | n & 255;
|
|
1658
|
+
_buflen += 8;
|
|
1659
|
+
_length += 1;
|
|
1660
|
+
while (_buflen >= 6) {
|
|
1661
|
+
writeEncoded(_buffer >>> _buflen - 6);
|
|
1662
|
+
_buflen -= 6;
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
_this.flush = function() {
|
|
1666
|
+
if (_buflen > 0) {
|
|
1667
|
+
writeEncoded(_buffer << 6 - _buflen);
|
|
1668
|
+
_buffer = 0;
|
|
1669
|
+
_buflen = 0;
|
|
1670
|
+
}
|
|
1671
|
+
if (_length % 3 != 0) {
|
|
1672
|
+
const padlen = 3 - _length % 3;
|
|
1673
|
+
for (let i = 0; i < padlen; i += 1) {
|
|
1674
|
+
_base64 += "=";
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
_this.toString = function() {
|
|
1679
|
+
return _base64;
|
|
1680
|
+
};
|
|
1681
|
+
return _this;
|
|
1682
|
+
}, "base64EncodeOutputStream");
|
|
1683
|
+
var base64DecodeInputStream = /* @__PURE__ */ __name(function(str) {
|
|
1684
|
+
const _str = str;
|
|
1685
|
+
let _pos = 0;
|
|
1686
|
+
let _buffer = 0;
|
|
1687
|
+
let _buflen = 0;
|
|
1688
|
+
const _this = {};
|
|
1689
|
+
_this.read = function() {
|
|
1690
|
+
while (_buflen < 8) {
|
|
1691
|
+
if (_pos >= _str.length) {
|
|
1692
|
+
if (_buflen == 0) {
|
|
1693
|
+
return -1;
|
|
1694
|
+
}
|
|
1695
|
+
throw "unexpected end of file./" + _buflen;
|
|
1696
|
+
}
|
|
1697
|
+
const c = _str.charAt(_pos);
|
|
1698
|
+
_pos += 1;
|
|
1699
|
+
if (c == "=") {
|
|
1700
|
+
_buflen = 0;
|
|
1701
|
+
return -1;
|
|
1702
|
+
} else if (c.match(/^\s$/)) {
|
|
1703
|
+
continue;
|
|
1704
|
+
}
|
|
1705
|
+
_buffer = _buffer << 6 | decode(c.charCodeAt(0));
|
|
1706
|
+
_buflen += 6;
|
|
1707
|
+
}
|
|
1708
|
+
const n = _buffer >>> _buflen - 8 & 255;
|
|
1709
|
+
_buflen -= 8;
|
|
1710
|
+
return n;
|
|
1711
|
+
};
|
|
1712
|
+
const decode = /* @__PURE__ */ __name(function(c) {
|
|
1713
|
+
if (65 <= c && c <= 90) {
|
|
1714
|
+
return c - 65;
|
|
1715
|
+
} else if (97 <= c && c <= 122) {
|
|
1716
|
+
return c - 97 + 26;
|
|
1717
|
+
} else if (48 <= c && c <= 57) {
|
|
1718
|
+
return c - 48 + 52;
|
|
1719
|
+
} else if (c == 43) {
|
|
1720
|
+
return 62;
|
|
1721
|
+
} else if (c == 47) {
|
|
1722
|
+
return 63;
|
|
1723
|
+
} else {
|
|
1724
|
+
throw "c:" + c;
|
|
1725
|
+
}
|
|
1726
|
+
}, "decode");
|
|
1727
|
+
return _this;
|
|
1728
|
+
}, "base64DecodeInputStream");
|
|
1729
|
+
var gifImage = /* @__PURE__ */ __name(function(width, height) {
|
|
1730
|
+
const _width = width;
|
|
1731
|
+
const _height = height;
|
|
1732
|
+
const _data = new Array(width * height);
|
|
1733
|
+
const _this = {};
|
|
1734
|
+
_this.setPixel = function(x, y, pixel) {
|
|
1735
|
+
_data[y * _width + x] = pixel;
|
|
1736
|
+
};
|
|
1737
|
+
_this.write = function(out) {
|
|
1738
|
+
out.writeString("GIF87a");
|
|
1739
|
+
out.writeShort(_width);
|
|
1740
|
+
out.writeShort(_height);
|
|
1741
|
+
out.writeByte(128);
|
|
1742
|
+
out.writeByte(0);
|
|
1743
|
+
out.writeByte(0);
|
|
1744
|
+
out.writeByte(0);
|
|
1745
|
+
out.writeByte(0);
|
|
1746
|
+
out.writeByte(0);
|
|
1747
|
+
out.writeByte(255);
|
|
1748
|
+
out.writeByte(255);
|
|
1749
|
+
out.writeByte(255);
|
|
1750
|
+
out.writeString(",");
|
|
1751
|
+
out.writeShort(0);
|
|
1752
|
+
out.writeShort(0);
|
|
1753
|
+
out.writeShort(_width);
|
|
1754
|
+
out.writeShort(_height);
|
|
1755
|
+
out.writeByte(0);
|
|
1756
|
+
const lzwMinCodeSize = 2;
|
|
1757
|
+
const raster = getLZWRaster(lzwMinCodeSize);
|
|
1758
|
+
out.writeByte(lzwMinCodeSize);
|
|
1759
|
+
let offset = 0;
|
|
1760
|
+
while (raster.length - offset > 255) {
|
|
1761
|
+
out.writeByte(255);
|
|
1762
|
+
out.writeBytes(raster, offset, 255);
|
|
1763
|
+
offset += 255;
|
|
1764
|
+
}
|
|
1765
|
+
out.writeByte(raster.length - offset);
|
|
1766
|
+
out.writeBytes(raster, offset, raster.length - offset);
|
|
1767
|
+
out.writeByte(0);
|
|
1768
|
+
out.writeString(";");
|
|
1769
|
+
};
|
|
1770
|
+
const bitOutputStream = /* @__PURE__ */ __name(function(out) {
|
|
1771
|
+
const _out = out;
|
|
1772
|
+
let _bitLength = 0;
|
|
1773
|
+
let _bitBuffer = 0;
|
|
1774
|
+
const _this2 = {};
|
|
1775
|
+
_this2.write = function(data, length) {
|
|
1776
|
+
if (data >>> length != 0) {
|
|
1777
|
+
throw "length over";
|
|
1778
|
+
}
|
|
1779
|
+
while (_bitLength + length >= 8) {
|
|
1780
|
+
_out.writeByte(255 & (data << _bitLength | _bitBuffer));
|
|
1781
|
+
length -= 8 - _bitLength;
|
|
1782
|
+
data >>>= 8 - _bitLength;
|
|
1783
|
+
_bitBuffer = 0;
|
|
1784
|
+
_bitLength = 0;
|
|
1785
|
+
}
|
|
1786
|
+
_bitBuffer = data << _bitLength | _bitBuffer;
|
|
1787
|
+
_bitLength = _bitLength + length;
|
|
1788
|
+
};
|
|
1789
|
+
_this2.flush = function() {
|
|
1790
|
+
if (_bitLength > 0) {
|
|
1791
|
+
_out.writeByte(_bitBuffer);
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
return _this2;
|
|
1795
|
+
}, "bitOutputStream");
|
|
1796
|
+
const getLZWRaster = /* @__PURE__ */ __name(function(lzwMinCodeSize) {
|
|
1797
|
+
const clearCode = 1 << lzwMinCodeSize;
|
|
1798
|
+
const endCode = (1 << lzwMinCodeSize) + 1;
|
|
1799
|
+
let bitLength = lzwMinCodeSize + 1;
|
|
1800
|
+
const table = lzwTable();
|
|
1801
|
+
for (let i = 0; i < clearCode; i += 1) {
|
|
1802
|
+
table.add(String.fromCharCode(i));
|
|
1803
|
+
}
|
|
1804
|
+
table.add(String.fromCharCode(clearCode));
|
|
1805
|
+
table.add(String.fromCharCode(endCode));
|
|
1806
|
+
const byteOut = byteArrayOutputStream();
|
|
1807
|
+
const bitOut = bitOutputStream(byteOut);
|
|
1808
|
+
bitOut.write(clearCode, bitLength);
|
|
1809
|
+
let dataIndex = 0;
|
|
1810
|
+
let s = String.fromCharCode(_data[dataIndex]);
|
|
1811
|
+
dataIndex += 1;
|
|
1812
|
+
while (dataIndex < _data.length) {
|
|
1813
|
+
const c = String.fromCharCode(_data[dataIndex]);
|
|
1814
|
+
dataIndex += 1;
|
|
1815
|
+
if (table.contains(s + c)) {
|
|
1816
|
+
s = s + c;
|
|
1817
|
+
} else {
|
|
1818
|
+
bitOut.write(table.indexOf(s), bitLength);
|
|
1819
|
+
if (table.size() < 4095) {
|
|
1820
|
+
if (table.size() == 1 << bitLength) {
|
|
1821
|
+
bitLength += 1;
|
|
1822
|
+
}
|
|
1823
|
+
table.add(s + c);
|
|
1824
|
+
}
|
|
1825
|
+
s = c;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
bitOut.write(table.indexOf(s), bitLength);
|
|
1829
|
+
bitOut.write(endCode, bitLength);
|
|
1830
|
+
bitOut.flush();
|
|
1831
|
+
return byteOut.toByteArray();
|
|
1832
|
+
}, "getLZWRaster");
|
|
1833
|
+
const lzwTable = /* @__PURE__ */ __name(function() {
|
|
1834
|
+
const _map = {};
|
|
1835
|
+
let _size = 0;
|
|
1836
|
+
const _this2 = {};
|
|
1837
|
+
_this2.add = function(key) {
|
|
1838
|
+
if (_this2.contains(key)) {
|
|
1839
|
+
throw "dup key:" + key;
|
|
1840
|
+
}
|
|
1841
|
+
_map[key] = _size;
|
|
1842
|
+
_size += 1;
|
|
1843
|
+
};
|
|
1844
|
+
_this2.size = function() {
|
|
1845
|
+
return _size;
|
|
1846
|
+
};
|
|
1847
|
+
_this2.indexOf = function(key) {
|
|
1848
|
+
return _map[key];
|
|
1849
|
+
};
|
|
1850
|
+
_this2.contains = function(key) {
|
|
1851
|
+
return typeof _map[key] != "undefined";
|
|
1852
|
+
};
|
|
1853
|
+
return _this2;
|
|
1854
|
+
}, "lzwTable");
|
|
1855
|
+
return _this;
|
|
1856
|
+
}, "gifImage");
|
|
1857
|
+
var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
|
|
1858
|
+
const gif = gifImage(width, height);
|
|
1859
|
+
for (let y = 0; y < height; y += 1) {
|
|
1860
|
+
for (let x = 0; x < width; x += 1) {
|
|
1861
|
+
gif.setPixel(x, y, getPixel(x, y));
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
const b = byteArrayOutputStream();
|
|
1865
|
+
gif.write(b);
|
|
1866
|
+
const base64 = base64EncodeOutputStream();
|
|
1867
|
+
const bytes = b.toByteArray();
|
|
1868
|
+
for (let i = 0; i < bytes.length; i += 1) {
|
|
1869
|
+
base64.writeByte(bytes[i]);
|
|
1870
|
+
}
|
|
1871
|
+
base64.flush();
|
|
1872
|
+
return "data:image/gif;base64," + base64;
|
|
1873
|
+
}, "createDataURL");
|
|
1874
|
+
var qrcode_default = qrcode;
|
|
1875
|
+
var stringToBytes = qrcode.stringToBytes;
|
|
1876
|
+
|
|
1877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/terminal/qr.js
|
|
1878
|
+
var QUIET_ZONE = 4;
|
|
1879
|
+
var BLACK_ON_WHITE = "\x1B[30;107m";
|
|
1880
|
+
var RESET = "\x1B[0m";
|
|
1881
|
+
var modules = /* @__PURE__ */ __name((link) => {
|
|
1882
|
+
const code = qrcode_default(0, "M");
|
|
1883
|
+
code.addData(link);
|
|
1884
|
+
code.make();
|
|
1885
|
+
const count = code.getModuleCount();
|
|
1886
|
+
const size = count + QUIET_ZONE * 2;
|
|
1887
|
+
const dark = /* @__PURE__ */ __name((row, col) => {
|
|
1888
|
+
const r = row - QUIET_ZONE;
|
|
1889
|
+
const c = col - QUIET_ZONE;
|
|
1890
|
+
return r >= 0 && c >= 0 && r < count && c < count && code.isDark(r, c);
|
|
1891
|
+
}, "dark");
|
|
1892
|
+
return { size, dark };
|
|
1893
|
+
}, "modules");
|
|
1894
|
+
var terminalQr = /* @__PURE__ */ __name((link) => {
|
|
1895
|
+
const { size, dark } = modules(link);
|
|
1896
|
+
const lines = [];
|
|
1897
|
+
for (let row = 0; row < size; row += 2) {
|
|
1898
|
+
let line = "";
|
|
1899
|
+
for (let col = 0; col < size; col++) {
|
|
1900
|
+
const top = dark(row, col);
|
|
1901
|
+
const bottom = row + 1 < size && dark(row + 1, col);
|
|
1902
|
+
line += top && bottom ? "\u2588" : top ? "\u2580" : bottom ? "\u2584" : " ";
|
|
1903
|
+
}
|
|
1904
|
+
lines.push(`${BLACK_ON_WHITE}${line}${RESET}`);
|
|
1905
|
+
}
|
|
1906
|
+
return { text: lines.join("\n"), width: size };
|
|
1907
|
+
}, "terminalQr");
|
|
1908
|
+
var plainQr = /* @__PURE__ */ __name((link) => {
|
|
1909
|
+
const { size, dark } = modules(link);
|
|
1910
|
+
const light = /* @__PURE__ */ __name((row, col) => row < size && !dark(row, col), "light");
|
|
1911
|
+
const lines = [];
|
|
1912
|
+
for (let row = 0; row < size; row += 2) {
|
|
1913
|
+
let line = "";
|
|
1914
|
+
for (let col = 0; col < size; col++) {
|
|
1915
|
+
const top = light(row, col);
|
|
1916
|
+
const bottom = light(row + 1, col);
|
|
1917
|
+
line += top && bottom ? "\u2588" : top ? "\u2580" : bottom ? "\u2584" : " ";
|
|
1918
|
+
}
|
|
1919
|
+
lines.push(line);
|
|
1920
|
+
}
|
|
1921
|
+
return lines.join("\n");
|
|
1922
|
+
}, "plainQr");
|
|
1923
|
+
|
|
1924
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/terminal/login-qr.js
|
|
1925
|
+
var MARGIN = 2;
|
|
1926
|
+
var atTerminal = /* @__PURE__ */ __name((input) => input.isTTY === true && !inputPolicy(input).noInput, "atTerminal");
|
|
1927
|
+
var PASTE_QR = "agents: paste the QR code above into the chat as a code block, exactly as printed; when a new one is printed, paste it and say the old one expired";
|
|
1928
|
+
var loginQr = /* @__PURE__ */ __name(({ diagnostic, note, indent: pad = 0, columns = /* @__PURE__ */ __name(() => process.stderr.columns, "columns"), terminal = process.stderr.isTTY === true, json = false }) => ({
|
|
1929
|
+
show: /* @__PURE__ */ __name((link, scan, expiresAt) => {
|
|
1930
|
+
if (!terminal) {
|
|
1931
|
+
const text = plainQr(link);
|
|
1932
|
+
diagnostic(`
|
|
1933
|
+
${text}
|
|
1934
|
+
`);
|
|
1935
|
+
if (json)
|
|
1936
|
+
diagnostic(JSON.stringify({
|
|
1937
|
+
event: "qr",
|
|
1938
|
+
qr: { text, expires_at: expiresAt?.toISOString() ?? null, scan: scan ?? null }
|
|
1939
|
+
}));
|
|
1940
|
+
note(PASTE_QR);
|
|
1941
|
+
if (scan)
|
|
1942
|
+
note(scan);
|
|
1943
|
+
return;
|
|
1944
|
+
}
|
|
1945
|
+
const drawn = terminalQr(link);
|
|
1946
|
+
const need = drawn.width + pad + MARGIN;
|
|
1947
|
+
const width = columns();
|
|
1948
|
+
if (width !== void 0 && need > width) {
|
|
1949
|
+
diagnostic(`the terminal is ${width} columns wide and the QR code needs ${need} \u2014 widen it`);
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
diagnostic(`
|
|
1953
|
+
${indent(drawn.text, pad + MARGIN)}`);
|
|
1954
|
+
if (scan)
|
|
1955
|
+
note(scan);
|
|
1956
|
+
}, "show")
|
|
1957
|
+
}), "loginQr");
|
|
1958
|
+
|
|
1959
|
+
export {
|
|
1960
|
+
bareCheck,
|
|
1961
|
+
checkWords,
|
|
1962
|
+
parseMarkdown,
|
|
1963
|
+
parseMarkdownSpans,
|
|
1964
|
+
countedPoll,
|
|
1965
|
+
terminalQr,
|
|
1966
|
+
plainQr,
|
|
1967
|
+
atTerminal,
|
|
1968
|
+
PASTE_QR,
|
|
1969
|
+
loginQr
|
|
1970
|
+
};
|