@wirecat/cli-memo 0.131.61 → 0.131.63

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 (156) hide show
  1. package/dist/bin/memo.js +2 -2
  2. package/dist/bundle/{all-profiles-WPBMSWJF.js → all-profiles-L6EBORCV.js} +5 -5
  3. package/dist/bundle/{anthropic-FZRVISSX.js → anthropic-42PADP4V.js} +2 -2
  4. package/dist/bundle/{app-server-QGIZPU4R.js → app-server-QBJG7OGQ.js} +35 -35
  5. package/dist/bundle/auto-LGA3VXKQ.js +85 -0
  6. package/dist/bundle/{bun-AO76624P.js → bun-NYSNYHAD.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-HYBE66QU.js → bun-sqlite-B46U7KI7.js} +2 -2
  8. package/dist/bundle/{chunk-233N77WN.js → chunk-2UCLF4AO.js} +273 -272
  9. package/dist/bundle/{chunk-YRHLPKTG.js → chunk-2XVXF4RW.js} +2 -2
  10. package/dist/bundle/{chunk-IZZU4NS6.js → chunk-347UBASY.js} +3 -3
  11. package/dist/bundle/{chunk-RRHSJ7CR.js → chunk-37E74SKW.js} +62 -62
  12. package/dist/bundle/{chunk-7DPHHUSZ.js → chunk-3ZXWLFUG.js} +21 -21
  13. package/dist/bundle/{chunk-6YK3RZZJ.js → chunk-4BKSE3CG.js} +4 -4
  14. package/dist/bundle/{chunk-WFDGEREJ.js → chunk-4GTZSCUE.js} +2 -2
  15. package/dist/bundle/{chunk-OFERGS4J.js → chunk-4SUROBD4.js} +2 -2
  16. package/dist/bundle/{chunk-5ZVWDMDT.js → chunk-5D7BPC33.js} +1 -1
  17. package/dist/bundle/{chunk-CTRVHHBK.js → chunk-5Q534L4I.js} +5 -5
  18. package/dist/bundle/{chunk-RRPUM4RS.js → chunk-6OZ2WI7Y.js} +2 -2
  19. package/dist/bundle/{chunk-B4VCZOLF.js → chunk-724DPWN6.js} +1 -1
  20. package/dist/bundle/{chunk-4WKZ3UIZ.js → chunk-A524HPDV.js} +1 -1
  21. package/dist/bundle/{chunk-2Q55K5HY.js → chunk-ACG5QN77.js} +2 -2
  22. package/dist/bundle/{chunk-WMRR2SNG.js → chunk-B3SERZMP.js} +1 -1
  23. package/dist/bundle/{chunk-XT7EJLA4.js → chunk-BOMHJR2E.js} +4 -4
  24. package/dist/bundle/{chunk-SSX6S3EG.js → chunk-DKO7WEXJ.js} +1 -1
  25. package/dist/bundle/{chunk-YVCNJKDA.js → chunk-E5JQFEIQ.js} +42 -42
  26. package/dist/bundle/{chunk-LIW42UCX.js → chunk-EGI6JHIA.js} +9 -9
  27. package/dist/bundle/{chunk-2UXFM5GE.js → chunk-FC5PK6M6.js} +12 -12
  28. package/dist/bundle/{chunk-HLTGPK6P.js → chunk-FG4Q6T72.js} +4 -4
  29. package/dist/bundle/{chunk-ETYD55QD.js → chunk-FH4P5UQA.js} +3 -3
  30. package/dist/bundle/{chunk-7CKXTTZG.js → chunk-FWRBJAQZ.js} +2 -2
  31. package/dist/bundle/{chunk-F6E7DSJO.js → chunk-GNHDE7FH.js} +1738 -32
  32. package/dist/bundle/{chunk-6NHJ4TTJ.js → chunk-HGNWJJDT.js} +336 -335
  33. package/dist/bundle/{chunk-OQSOQYSQ.js → chunk-HKC7GDJD.js} +4 -4
  34. package/dist/bundle/{chunk-XYFYZP2N.js → chunk-I5L7MLZ6.js} +1 -1
  35. package/dist/bundle/{chunk-KZRBIHQL.js → chunk-K4WCDPDL.js} +5 -5
  36. package/dist/bundle/{chunk-3FPF5DBU.js → chunk-K5VF47E2.js} +5 -5
  37. package/dist/bundle/{chunk-K6FQVROA.js → chunk-LK6D26RK.js} +21 -21
  38. package/dist/bundle/{chunk-6AEQACVV.js → chunk-MWAXS4BX.js} +7 -7
  39. package/dist/bundle/{chunk-D4PK5OXW.js → chunk-NZJUMLTD.js} +1 -1
  40. package/dist/bundle/{chunk-UTUUXAPS.js → chunk-O2NQCWRM.js} +28 -28
  41. package/dist/bundle/{chunk-35OBIX5A.js → chunk-OXBETHGN.js} +8 -8
  42. package/dist/bundle/{chunk-OIHKFGHK.js → chunk-PKUBC2ME.js} +3 -3
  43. package/dist/bundle/{chunk-7ETYPYIN.js → chunk-Q3VEUHC7.js} +12 -12
  44. package/dist/bundle/{chunk-RT476OFI.js → chunk-RGZUDHAQ.js} +7 -7
  45. package/dist/bundle/{chunk-UTSMQ7KI.js → chunk-RLX5SC2X.js} +1 -1
  46. package/dist/bundle/{chunk-PSYZ33UQ.js → chunk-RP6VV35S.js} +1 -1
  47. package/dist/bundle/{chunk-R7ZD7TNI.js → chunk-RSG7BRXI.js} +1 -1
  48. package/dist/bundle/{chunk-37ILRM2G.js → chunk-RTLQHLHG.js} +4 -4
  49. package/dist/bundle/{chunk-4HLYKLGJ.js → chunk-SIBQ34LX.js} +1 -1
  50. package/dist/bundle/{chunk-JAJSTFBB.js → chunk-SIJA2UYC.js} +6 -6
  51. package/dist/bundle/{chunk-MQCBJGXA.js → chunk-SJ55SMBE.js} +9 -9
  52. package/dist/bundle/{chunk-I6LNI45S.js → chunk-SOQGV3ZM.js} +5 -5
  53. package/dist/bundle/{chunk-5SD4CV2D.js → chunk-TBSWOVM3.js} +571 -293
  54. package/dist/bundle/{chunk-STXMSLU6.js → chunk-TKPIS4G2.js} +1 -1
  55. package/dist/bundle/{chunk-XU7UER3B.js → chunk-TSKGEK2S.js} +10 -10
  56. package/dist/bundle/{chunk-2VMZLQ5K.js → chunk-V7TJSYFK.js} +2 -2
  57. package/dist/bundle/{chunk-KGZM5WYK.js → chunk-VTKLHYCZ.js} +4 -4
  58. package/dist/bundle/{chunk-7E46JN6V.js → chunk-VX4HNQLN.js} +2 -2
  59. package/dist/bundle/{chunk-OEPBIWHI.js → chunk-WDWKG7FJ.js} +150 -150
  60. package/dist/bundle/{chunk-OWVHNTY6.js → chunk-WDZOEBTE.js} +6 -6
  61. package/dist/bundle/{chunk-7NKBX7FC.js → chunk-XVREIQ2N.js} +2 -2
  62. package/dist/bundle/chunk-YVJAD5E7.js +268 -0
  63. package/dist/bundle/{chunk-Y264FW55.js → chunk-ZUQXDJ7A.js} +1 -1
  64. package/dist/bundle/{command-contract-4TGN6GSP.js → command-contract-SIXWLKAS.js} +11 -11
  65. package/dist/bundle/{decode-S3PPQHID.js → decode-2Z4GCIGA.js} +2 -2
  66. package/dist/bundle/{echarts-AH6U7X2S.js → echarts-JADCSUD7.js} +2 -2
  67. package/dist/bundle/{embed-4NSZECMB.js → embed-ZLEPINEK.js} +3 -3
  68. package/dist/bundle/{embedder-EGRA7YEY.js → embedder-E3DHPZCK.js} +6 -6
  69. package/dist/bundle/{entry-O3V72WZP.js → entry-SFLEGFSN.js} +4 -4
  70. package/dist/bundle/failure-OGSLUNT6.js +65 -0
  71. package/dist/bundle/{first-run-S7RRDIGX.js → first-run-ZKDGFY6P.js} +5 -5
  72. package/dist/bundle/{first-screen-YKJAQUVE.js → first-screen-IQEU7XF2.js} +12 -12
  73. package/dist/bundle/{instructions-ETUUZKBM.js → instructions-ECXOBMWS.js} +1 -1
  74. package/dist/bundle/{mcp-J3K7RC5W.js → mcp-Y4XMDC5Q.js} +35 -35
  75. package/dist/bundle/memo.js +6 -6
  76. package/dist/bundle/{node-O4XVOEGO.js → node-A6363DJ4.js} +2 -2
  77. package/dist/bundle/{node-sqlite-PC3K43U7.js → node-sqlite-FA2P77PW.js} +3 -3
  78. package/dist/bundle/{oauth-MBJUEG2Z.js → oauth-DBGARGR7.js} +4 -4
  79. package/dist/bundle/{open-5FAYV6JM.js → open-5YYG2VWH.js} +2 -2
  80. package/dist/bundle/{openai-57CRSGLH.js → openai-BPVP7TZ7.js} +7 -7
  81. package/dist/bundle/{process-NAW4COYH.js → process-DGPZRHQA.js} +1 -1
  82. package/dist/bundle/{program-CFJAGFYD.js → program-ZHLCEVWB.js} +618 -290
  83. package/dist/bundle/{prompt-FT2MMVS7.js → prompt-NTAZWPWA.js} +2 -2
  84. package/dist/bundle/{recognize-PEYPOI3Q.js → recognize-OGEP5VD3.js} +1 -1
  85. package/dist/bundle/{remote-FQAXACFW.js → remote-DER2PFH6.js} +4 -4
  86. package/dist/bundle/{rerank-4KEB4X6T.js → rerank-PB5ACFHS.js} +4 -4
  87. package/dist/bundle/{serve-LCTIHO37.js → serve-KNEY4BXK.js} +6 -6
  88. package/dist/bundle/{server-XQLRMM73.js → server-I5BPRS5C.js} +55 -52
  89. package/dist/bundle/server-IQILK5YP.js +61 -0
  90. package/dist/bundle/server-NKI7SVK5.js +48 -0
  91. package/dist/bundle/{state-YF4M4RHC.js → state-JMCWHHZM.js} +3 -3
  92. package/dist/bundle/{store-EQEMYMCC.js → store-6H4FPFTX.js} +9 -9
  93. package/dist/bundle/store-maintenance-command-IFVWSQMJ.js +47 -0
  94. package/dist/bundle/update-YMILPFRY.js +68 -0
  95. package/dist/config-issues.d.ts +4 -1
  96. package/dist/config-issues.d.ts.map +1 -1
  97. package/dist/config-issues.js +6 -2
  98. package/dist/config-issues.js.map +1 -1
  99. package/dist/contract-overrides/search.js +2 -2
  100. package/dist/contract-overrides/search.js.map +1 -1
  101. package/dist/digest/command.d.ts.map +1 -1
  102. package/dist/digest/command.js +11 -7
  103. package/dist/digest/command.js.map +1 -1
  104. package/dist/digest/digest.d.ts +29 -4
  105. package/dist/digest/digest.d.ts.map +1 -1
  106. package/dist/digest/digest.js +124 -39
  107. package/dist/digest/digest.js.map +1 -1
  108. package/dist/digest/sync-health.d.ts +51 -0
  109. package/dist/digest/sync-health.d.ts.map +1 -0
  110. package/dist/digest/sync-health.js +116 -0
  111. package/dist/digest/sync-health.js.map +1 -0
  112. package/dist/digest/tasks.d.ts +38 -0
  113. package/dist/digest/tasks.d.ts.map +1 -0
  114. package/dist/digest/tasks.js +108 -0
  115. package/dist/digest/tasks.js.map +1 -0
  116. package/dist/digest/text.d.ts.map +1 -1
  117. package/dist/digest/text.js +9 -2
  118. package/dist/digest/text.js.map +1 -1
  119. package/dist/knowledge/messenger-sync.d.ts +5 -0
  120. package/dist/knowledge/messenger-sync.d.ts.map +1 -1
  121. package/dist/knowledge/messenger-sync.js +12 -9
  122. package/dist/knowledge/messenger-sync.js.map +1 -1
  123. package/dist/mcp/catalogue.d.ts.map +1 -1
  124. package/dist/mcp/catalogue.js +5 -3
  125. package/dist/mcp/catalogue.js.map +1 -1
  126. package/dist/mcp/granted.d.ts +13 -0
  127. package/dist/mcp/granted.d.ts.map +1 -0
  128. package/dist/mcp/granted.js +19 -0
  129. package/dist/mcp/granted.js.map +1 -0
  130. package/dist/search/command.d.ts.map +1 -1
  131. package/dist/search/command.js +19 -7
  132. package/dist/search/command.js.map +1 -1
  133. package/dist/search/lane-gates.d.ts +33 -0
  134. package/dist/search/lane-gates.d.ts.map +1 -0
  135. package/dist/search/lane-gates.js +65 -0
  136. package/dist/search/lane-gates.js.map +1 -0
  137. package/dist/search/search.d.ts +5 -2
  138. package/dist/search/search.d.ts.map +1 -1
  139. package/dist/search/search.js +24 -2
  140. package/dist/search/search.js.map +1 -1
  141. package/dist/show/command.d.ts +3 -1
  142. package/dist/show/command.d.ts.map +1 -1
  143. package/dist/show/command.js +28 -3
  144. package/dist/show/command.js.map +1 -1
  145. package/dist/version.d.ts +1 -1
  146. package/dist/version.js +1 -1
  147. package/package.json +2 -2
  148. package/skills/morning-digest/SKILL.md +24 -10
  149. package/dist/bundle/auto-5VPCO4DD.js +0 -85
  150. package/dist/bundle/chunk-3FDJSMLJ.js +0 -1900
  151. package/dist/bundle/failure-CFGWWTV5.js +0 -65
  152. package/dist/bundle/server-AQTWRRAJ.js +0 -61
  153. package/dist/bundle/server-JIFODLCU.js +0 -48
  154. package/dist/bundle/store-maintenance-command-7IC3LTYY.js +0 -47
  155. package/dist/bundle/update-T237KLFA.js +0 -68
  156. /package/dist/bundle/{chunk-GFNWVGLD.js → chunk-C3XNJQD7.js} +0 -0
@@ -27,22 +27,23 @@ import {
27
27
  serverSearchOptions,
28
28
  summaryOf,
29
29
  unansweredHours
30
- } from "./chunk-5SD4CV2D.js";
30
+ } from "./chunk-TBSWOVM3.js";
31
31
  import {
32
32
  MAIL_HIT_UNTRUSTED,
33
33
  messagesAnswer,
34
34
  offsetOf,
35
35
  shownOf
36
- } from "./chunk-K6FQVROA.js";
36
+ } from "./chunk-LK6D26RK.js";
37
37
  import {
38
38
  messageItem
39
- } from "./chunk-YVCNJKDA.js";
39
+ } from "./chunk-E5JQFEIQ.js";
40
40
  import {
41
41
  knownPermissionKeys
42
- } from "./chunk-7DPHHUSZ.js";
42
+ } from "./chunk-3ZXWLFUG.js";
43
43
  import {
44
44
  AGENDA_DEFAULTS,
45
45
  DEFAULT_BACKEND,
46
+ RESOURCES_SEARCHED,
46
47
  REVIEW_DAYS,
47
48
  SERVER_BOUNDS,
48
49
  SERVER_SEARCH_KEY,
@@ -62,7 +63,7 @@ import {
62
63
  sourceKey,
63
64
  typedQuery,
64
65
  withQuery
65
- } from "./chunk-233N77WN.js";
66
+ } from "./chunk-2UCLF4AO.js";
66
67
  import {
67
68
  Command,
68
69
  FETCH,
@@ -89,16 +90,17 @@ import {
89
90
  readConfigFile,
90
91
  readConfigText,
91
92
  renderAnswer,
93
+ rootOf,
92
94
  settingPathOf,
93
95
  sharedCommand,
94
96
  snakeKeys,
95
97
  withSettingDefaults,
96
98
  withoutSetting
97
- } from "./chunk-OEPBIWHI.js";
99
+ } from "./chunk-WDWKG7FJ.js";
98
100
  import {
99
101
  mailHolderVariable,
100
102
  readOnlyLockOf
101
- } from "./chunk-PSYZ33UQ.js";
103
+ } from "./chunk-RP6VV35S.js";
102
104
  import {
103
105
  DEFAULT_DECISION_POLICY,
104
106
  MESSAGE_PARSING,
@@ -111,8 +113,9 @@ import {
111
113
  registrableOf,
112
114
  scoreGroup,
113
115
  validateFields
114
- } from "./chunk-6NHJ4TTJ.js";
116
+ } from "./chunk-HGNWJJDT.js";
115
117
  import {
118
+ DEAL_KINDS,
116
119
  count,
117
120
  dateRange,
118
121
  defineQuery,
@@ -122,7 +125,7 @@ import {
122
125
  time,
123
126
  timezoneOf,
124
127
  untrusted
125
- } from "./chunk-RRHSJ7CR.js";
128
+ } from "./chunk-37E74SKW.js";
126
129
  import {
127
130
  configFilePath,
128
131
  resolvePaths,
@@ -159,7 +162,7 @@ import {
159
162
  __toESM
160
163
  } from "./chunk-ZVVMGPBJ.js";
161
164
 
162
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/attachments.js
165
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/attachments.js
163
166
  var MAX_ATTACHMENT_CHARS = 2e5;
164
167
  var DEFAULT_ATTACHMENT_POLICY = { read: true, maxBytes: 10 * 1024 * 1024 };
165
168
  var POLICY_SKIPS = ["not-read", "too-large"];
@@ -198,7 +201,7 @@ var readAttachments = /* @__PURE__ */ __name(async (mail, messageId, { loadEngin
198
201
  return files;
199
202
  }, "readAttachments");
200
203
 
201
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/read.js
204
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/read.js
202
205
  var lowerSuspicious = /* @__PURE__ */ __name((items, suspicious) => [
203
206
  ...items.filter((item) => !suspicious(item)),
204
207
  ...items.filter(suspicious)
@@ -285,11 +288,11 @@ var attachmentsText = /* @__PURE__ */ __name((hit) => (hit.attachments ?? []).ma
285
288
  ${file.text.replace(/\n/g, "\n ")}`;
286
289
  }).join("\n"), "attachmentsText");
287
290
 
288
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/bulk.js
291
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/bulk.js
289
292
  var BULK = "bulk";
290
293
  var bulkBox = { externalId: "memo:bulk", name: "bulk", kind: BULK };
291
294
 
292
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/email-input.js
295
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/email-input.js
293
296
  var sentAtOf = /* @__PURE__ */ __name((date, receivedAt) => {
294
297
  const sent = date === null ? Number.NaN : Date.parse(date);
295
298
  return Number.isNaN(sent) ? Date.parse(receivedAt) : sent;
@@ -309,7 +312,7 @@ var parsedEmail = /* @__PURE__ */ __name((mail, item, header, address) => ({
309
312
  outgoing: mail.from === null ? null : mail.from.email === address
310
313
  }), "parsedEmail");
311
314
 
312
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/presets.js
315
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/presets.js
313
316
  var PRESETS = {
314
317
  social: {
315
318
  about: "notifications from social networks",
@@ -401,7 +404,7 @@ var presetMatches = /* @__PURE__ */ __name((name, facts) => {
401
404
  return false;
402
405
  }, "presetMatches");
403
406
 
404
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/probe.js
407
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/probe.js
405
408
  var share = /* @__PURE__ */ __name((part, whole) => Math.round(part / whole * 100) / 100, "share");
406
409
  var isSent = /* @__PURE__ */ __name((item) => item.labels?.includes("Sent") || /(^|\/)sent\b/i.test(item.folder ?? ""), "isSent");
407
410
  var groupKey = /* @__PURE__ */ __name((headers) => headers.listId === void 0 ? `from:${headers.from}` : `list:${headers.listId}`, "groupKey");
@@ -469,7 +472,7 @@ var probeMail = /* @__PURE__ */ __name((items, limit, ages = /* @__PURE__ */ new
469
472
  };
470
473
  }, "probeMail");
471
474
 
472
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/facts.js
475
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/facts.js
473
476
  var factsOf = /* @__PURE__ */ __name((listed2, rules, ages = /* @__PURE__ */ new Map()) => {
474
477
  const grouped = rules.some(({ match }) => match.score_at_least !== void 0 || match.preset !== void 0);
475
478
  if (!grouped)
@@ -5740,7 +5743,7 @@ var PostalMime = class _PostalMime {
5740
5743
  }
5741
5744
  };
5742
5745
 
5743
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/headers.js
5746
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/headers.js
5744
5747
  var unfold = /* @__PURE__ */ __name((text2) => text2.replace(/\r?\n[ \t]+/g, " "), "unfold");
5745
5748
  var field = /* @__PURE__ */ __name((unfolded, name) => new RegExp(`^${name}:[ \\t]*(.*?)\\r?$`, "im").exec(unfolded)?.[1], "field");
5746
5749
  var fieldsOf = /* @__PURE__ */ __name((unfolded, name) => [...unfolded.matchAll(new RegExp(`^${name}:[ \\t]*(.*?)\\r?$`, "gim"))].map(([, value]) => value), "fieldsOf");
@@ -5787,7 +5790,7 @@ var mailHeadersOf = /* @__PURE__ */ __name((raw) => {
5787
5790
  };
5788
5791
  }, "mailHeadersOf");
5789
5792
 
5790
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/parse.js
5793
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/parse.js
5791
5794
  var MAX_BODY_CHARS = 1e6;
5792
5795
  var MAX_ATTACHMENTS = 50;
5793
5796
  var BRACKETED_ID = /<[^<>\s]+>/g;
@@ -5852,13 +5855,13 @@ var parseMail = /* @__PURE__ */ __name(async (raw, maxBodyChars = MAX_BODY_CHARS
5852
5855
  };
5853
5856
  }, "parseMail");
5854
5857
 
5855
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/partial.js
5858
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/partial.js
5856
5859
  var PARTIAL = "partial";
5857
5860
 
5858
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/account-key.js
5861
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/account-key.js
5859
5862
  var mailAccountKey = /* @__PURE__ */ __name((address) => ({ provider: "email", account: address.toLowerCase() }), "mailAccountKey");
5860
5863
 
5861
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/rule-stored.js
5864
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/rule-stored.js
5862
5865
  var ACTION_OF = { full: "keep", envelope: "envelope", skip: "skip" };
5863
5866
  var KINDS = {
5864
5867
  from: "string",
@@ -5927,7 +5930,7 @@ var storedMailRuleSet = /* @__PURE__ */ __name(async (store, account, query) =>
5927
5930
  }, "storedMailRuleSet");
5928
5931
  var storedMailRules = /* @__PURE__ */ __name(async (store, account, query) => (await storedMailRuleSet(store, account, query)).rules, "storedMailRules");
5929
5932
 
5930
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/rules.js
5933
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/rules.js
5931
5934
  var DAY_MS = 24 * 60 * 60 * 1e3;
5932
5935
  var domainOf = /* @__PURE__ */ __name((address) => address.slice(address.lastIndexOf("@") + 1), "domainOf");
5933
5936
  var domainMatches = /* @__PURE__ */ __name((wanted2, sender) => {
@@ -5999,7 +6002,7 @@ var tagsOf = /* @__PURE__ */ __name((rules, facts) => {
5999
6002
  }, "tagsOf");
6000
6003
  var conditionKeys = /* @__PURE__ */ __name((match) => Object.keys(match).filter((key) => match[key] !== void 0).sort(), "conditionKeys");
6001
6004
 
6002
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/rule-input.js
6005
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/rule-input.js
6003
6006
  var STORE_ACTION = { keep: "full", envelope: "envelope", skip: "skip" };
6004
6007
  var LOWER = ["from", "domain", "list_id", "subject"];
6005
6008
  var conditionsOf = /* @__PURE__ */ __name((match) => Object.fromEntries(conditionKeys(match).map((key) => {
@@ -6029,7 +6032,7 @@ var ruleInput = /* @__PURE__ */ __name((rule, source = rule.source ?? "owner") =
6029
6032
  decidedAt: decidedAtOf(rule.decided_at)
6030
6033
  }), "ruleInput");
6031
6034
 
6032
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/rule-tags.js
6035
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/rule-tags.js
6033
6036
  var reuseOf = /* @__PURE__ */ __name((error) => {
6034
6037
  const { details } = error;
6035
6038
  return details?.reason === "tag-review.required" ? details.candidates?.[0]?.name : void 0;
@@ -6090,7 +6093,7 @@ var settleRuleTags = /* @__PURE__ */ __name(async (store, accountId, rules, outc
6090
6093
  }
6091
6094
  }, "settleRuleTags");
6092
6095
 
6093
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/server-query.js
6096
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/server-query.js
6094
6097
  var DAY = 864e5;
6095
6098
  var empty = /* @__PURE__ */ __name(() => ({ words: [], from: [], to: [], cc: [], subject: [], body: [] }), "empty");
6096
6099
  var narrows = /* @__PURE__ */ __name((criteria) => criteria.words.length + criteria.from.length + criteria.to.length + criteria.cc.length + criteria.subject.length + criteria.body.length > 0 || criteria.since !== void 0 || criteria.before !== void 0 || criteria.seen !== void 0 || criteria.flagged !== void 0, "narrows");
@@ -6163,7 +6166,7 @@ var mailCriteriaOf = /* @__PURE__ */ __name((text2, { exact, timezone } = {}) =>
6163
6166
  };
6164
6167
  }, "mailCriteriaOf");
6165
6168
 
6166
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/server-search.js
6169
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/server-search.js
6167
6170
  var refusal = {
6168
6171
  unsupported: "this mailbox's server cannot be searched \u2014 use --backend archive",
6169
6172
  offline: "--backend server needs the network \u2014 not with --offline",
@@ -6378,7 +6381,7 @@ var searchMailServer = /* @__PURE__ */ __name(async (store, mailbox, access, req
6378
6381
  return { report, sources };
6379
6382
  }, "searchMailServer");
6380
6383
 
6381
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/cli/marks.js
6384
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/cli/marks.js
6382
6385
  var iso = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
6383
6386
  var mailMark = strictObject({
6384
6387
  holder: string(),
@@ -6476,7 +6479,7 @@ var resetMarkCommand = /* @__PURE__ */ __name((mail) => answerEntity(annotate(ne
6476
6479
  });
6477
6480
  }), "resetMarkCommand");
6478
6481
 
6479
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/review.js
6482
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/review.js
6480
6483
  var REVIEW_THREADS = 50;
6481
6484
  var REVIEW_PER_THREAD = 50;
6482
6485
  var OWED_DAYS = 30;
@@ -6574,7 +6577,7 @@ var reviewMail = /* @__PURE__ */ __name(async (store, mailbox, options) => {
6574
6577
  };
6575
6578
  }, "reviewMail");
6576
6579
 
6577
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/cli/review.js
6580
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/cli/review.js
6578
6581
  var DAY2 = 864e5;
6579
6582
  var REVIEW_UNTRUSTED = [...SUMMARY_UNTRUSTED, ...MAIL_HIT_UNTRUSTED];
6580
6583
  var MAIL_REVIEW_QUERY = defineQuery({
@@ -6856,7 +6859,7 @@ an agent over MCP, and each scheduled run.`).action(async function(query) {
6856
6859
  saved?.save(found.checked ?? {}, found.complete ? { through: found.until } : {});
6857
6860
  }), "mailReviewCommand");
6858
6861
 
6859
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/cli/bulk-settings.js
6862
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/cli/bulk-settings.js
6860
6863
  var listed = /* @__PURE__ */ __name((words2) => words2.join(", "), "listed");
6861
6864
  var MAIL_BULK_SETTINGS = [
6862
6865
  {
@@ -6912,7 +6915,7 @@ var bulkTriageOf = /* @__PURE__ */ __name((config) => {
6912
6915
  };
6913
6916
  }, "bulkTriageOf");
6914
6917
 
6915
- // node_modules/.pnpm/@wirecat+cli-core@0.612.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_2b92b8a5a9536cd50d24d35c3ce22b6a/node_modules/@wirecat/cli-core/dist/mail/cli/index.js
6918
+ // node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/mail/cli/index.js
6916
6919
  var absentAccount = /* @__PURE__ */ __name((error) => {
6917
6920
  if (error instanceof CliError && error.code === "not_found")
6918
6921
  return void 0;
@@ -7196,6 +7199,1706 @@ var mailReadCommands = sharedCommand((mail) => [
7196
7199
  conversationsCommand(mail)
7197
7200
  ]);
7198
7201
 
7202
+ // node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
7203
+ var qrcode = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
7204
+ const PAD0 = 236;
7205
+ const PAD1 = 17;
7206
+ let _typeNumber = typeNumber;
7207
+ const _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
7208
+ let _modules = null;
7209
+ let _moduleCount = 0;
7210
+ let _dataCache = null;
7211
+ const _dataList = [];
7212
+ const _this = {};
7213
+ const makeImpl = /* @__PURE__ */ __name(function(test, maskPattern) {
7214
+ _moduleCount = _typeNumber * 4 + 17;
7215
+ _modules = (function(moduleCount) {
7216
+ const modules = new Array(moduleCount);
7217
+ for (let row = 0; row < moduleCount; row += 1) {
7218
+ modules[row] = new Array(moduleCount);
7219
+ for (let col = 0; col < moduleCount; col += 1) {
7220
+ modules[row][col] = null;
7221
+ }
7222
+ }
7223
+ return modules;
7224
+ })(_moduleCount);
7225
+ setupPositionProbePattern(0, 0);
7226
+ setupPositionProbePattern(_moduleCount - 7, 0);
7227
+ setupPositionProbePattern(0, _moduleCount - 7);
7228
+ setupPositionAdjustPattern();
7229
+ setupTimingPattern();
7230
+ setupTypeInfo(test, maskPattern);
7231
+ if (_typeNumber >= 7) {
7232
+ setupTypeNumber(test);
7233
+ }
7234
+ if (_dataCache == null) {
7235
+ _dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
7236
+ }
7237
+ mapData(_dataCache, maskPattern);
7238
+ }, "makeImpl");
7239
+ const setupPositionProbePattern = /* @__PURE__ */ __name(function(row, col) {
7240
+ for (let r = -1; r <= 7; r += 1) {
7241
+ if (row + r <= -1 || _moduleCount <= row + r) continue;
7242
+ for (let c = -1; c <= 7; c += 1) {
7243
+ if (col + c <= -1 || _moduleCount <= col + c) continue;
7244
+ 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) {
7245
+ _modules[row + r][col + c] = true;
7246
+ } else {
7247
+ _modules[row + r][col + c] = false;
7248
+ }
7249
+ }
7250
+ }
7251
+ }, "setupPositionProbePattern");
7252
+ const getBestMaskPattern = /* @__PURE__ */ __name(function() {
7253
+ let minLostPoint = 0;
7254
+ let pattern2 = 0;
7255
+ for (let i = 0; i < 8; i += 1) {
7256
+ makeImpl(true, i);
7257
+ const lostPoint = QRUtil.getLostPoint(_this);
7258
+ if (i == 0 || minLostPoint > lostPoint) {
7259
+ minLostPoint = lostPoint;
7260
+ pattern2 = i;
7261
+ }
7262
+ }
7263
+ return pattern2;
7264
+ }, "getBestMaskPattern");
7265
+ const setupTimingPattern = /* @__PURE__ */ __name(function() {
7266
+ for (let r = 8; r < _moduleCount - 8; r += 1) {
7267
+ if (_modules[r][6] != null) {
7268
+ continue;
7269
+ }
7270
+ _modules[r][6] = r % 2 == 0;
7271
+ }
7272
+ for (let c = 8; c < _moduleCount - 8; c += 1) {
7273
+ if (_modules[6][c] != null) {
7274
+ continue;
7275
+ }
7276
+ _modules[6][c] = c % 2 == 0;
7277
+ }
7278
+ }, "setupTimingPattern");
7279
+ const setupPositionAdjustPattern = /* @__PURE__ */ __name(function() {
7280
+ const pos = QRUtil.getPatternPosition(_typeNumber);
7281
+ for (let i = 0; i < pos.length; i += 1) {
7282
+ for (let j = 0; j < pos.length; j += 1) {
7283
+ const row = pos[i];
7284
+ const col = pos[j];
7285
+ if (_modules[row][col] != null) {
7286
+ continue;
7287
+ }
7288
+ for (let r = -2; r <= 2; r += 1) {
7289
+ for (let c = -2; c <= 2; c += 1) {
7290
+ if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
7291
+ _modules[row + r][col + c] = true;
7292
+ } else {
7293
+ _modules[row + r][col + c] = false;
7294
+ }
7295
+ }
7296
+ }
7297
+ }
7298
+ }
7299
+ }, "setupPositionAdjustPattern");
7300
+ const setupTypeNumber = /* @__PURE__ */ __name(function(test) {
7301
+ const bits = QRUtil.getBCHTypeNumber(_typeNumber);
7302
+ for (let i = 0; i < 18; i += 1) {
7303
+ const mod = !test && (bits >> i & 1) == 1;
7304
+ _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
7305
+ }
7306
+ for (let i = 0; i < 18; i += 1) {
7307
+ const mod = !test && (bits >> i & 1) == 1;
7308
+ _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
7309
+ }
7310
+ }, "setupTypeNumber");
7311
+ const setupTypeInfo = /* @__PURE__ */ __name(function(test, maskPattern) {
7312
+ const data = _errorCorrectionLevel << 3 | maskPattern;
7313
+ const bits = QRUtil.getBCHTypeInfo(data);
7314
+ for (let i = 0; i < 15; i += 1) {
7315
+ const mod = !test && (bits >> i & 1) == 1;
7316
+ if (i < 6) {
7317
+ _modules[i][8] = mod;
7318
+ } else if (i < 8) {
7319
+ _modules[i + 1][8] = mod;
7320
+ } else {
7321
+ _modules[_moduleCount - 15 + i][8] = mod;
7322
+ }
7323
+ }
7324
+ for (let i = 0; i < 15; i += 1) {
7325
+ const mod = !test && (bits >> i & 1) == 1;
7326
+ if (i < 8) {
7327
+ _modules[8][_moduleCount - i - 1] = mod;
7328
+ } else if (i < 9) {
7329
+ _modules[8][15 - i - 1 + 1] = mod;
7330
+ } else {
7331
+ _modules[8][15 - i - 1] = mod;
7332
+ }
7333
+ }
7334
+ _modules[_moduleCount - 8][8] = !test;
7335
+ }, "setupTypeInfo");
7336
+ const mapData = /* @__PURE__ */ __name(function(data, maskPattern) {
7337
+ let inc = -1;
7338
+ let row = _moduleCount - 1;
7339
+ let bitIndex = 7;
7340
+ let byteIndex = 0;
7341
+ const maskFunc = QRUtil.getMaskFunction(maskPattern);
7342
+ for (let col = _moduleCount - 1; col > 0; col -= 2) {
7343
+ if (col == 6) col -= 1;
7344
+ while (true) {
7345
+ for (let c = 0; c < 2; c += 1) {
7346
+ if (_modules[row][col - c] == null) {
7347
+ let dark = false;
7348
+ if (byteIndex < data.length) {
7349
+ dark = (data[byteIndex] >>> bitIndex & 1) == 1;
7350
+ }
7351
+ const mask = maskFunc(row, col - c);
7352
+ if (mask) {
7353
+ dark = !dark;
7354
+ }
7355
+ _modules[row][col - c] = dark;
7356
+ bitIndex -= 1;
7357
+ if (bitIndex == -1) {
7358
+ byteIndex += 1;
7359
+ bitIndex = 7;
7360
+ }
7361
+ }
7362
+ }
7363
+ row += inc;
7364
+ if (row < 0 || _moduleCount <= row) {
7365
+ row -= inc;
7366
+ inc = -inc;
7367
+ break;
7368
+ }
7369
+ }
7370
+ }
7371
+ }, "mapData");
7372
+ const createBytes = /* @__PURE__ */ __name(function(buffer, rsBlocks) {
7373
+ let offset = 0;
7374
+ let maxDcCount = 0;
7375
+ let maxEcCount = 0;
7376
+ const dcdata = new Array(rsBlocks.length);
7377
+ const ecdata = new Array(rsBlocks.length);
7378
+ for (let r = 0; r < rsBlocks.length; r += 1) {
7379
+ const dcCount = rsBlocks[r].dataCount;
7380
+ const ecCount = rsBlocks[r].totalCount - dcCount;
7381
+ maxDcCount = Math.max(maxDcCount, dcCount);
7382
+ maxEcCount = Math.max(maxEcCount, ecCount);
7383
+ dcdata[r] = new Array(dcCount);
7384
+ for (let i = 0; i < dcdata[r].length; i += 1) {
7385
+ dcdata[r][i] = 255 & buffer.getBuffer()[i + offset];
7386
+ }
7387
+ offset += dcCount;
7388
+ const rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
7389
+ const rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
7390
+ const modPoly = rawPoly.mod(rsPoly);
7391
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
7392
+ for (let i = 0; i < ecdata[r].length; i += 1) {
7393
+ const modIndex = i + modPoly.getLength() - ecdata[r].length;
7394
+ ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
7395
+ }
7396
+ }
7397
+ let totalCodeCount = 0;
7398
+ for (let i = 0; i < rsBlocks.length; i += 1) {
7399
+ totalCodeCount += rsBlocks[i].totalCount;
7400
+ }
7401
+ const data = new Array(totalCodeCount);
7402
+ let index = 0;
7403
+ for (let i = 0; i < maxDcCount; i += 1) {
7404
+ for (let r = 0; r < rsBlocks.length; r += 1) {
7405
+ if (i < dcdata[r].length) {
7406
+ data[index] = dcdata[r][i];
7407
+ index += 1;
7408
+ }
7409
+ }
7410
+ }
7411
+ for (let i = 0; i < maxEcCount; i += 1) {
7412
+ for (let r = 0; r < rsBlocks.length; r += 1) {
7413
+ if (i < ecdata[r].length) {
7414
+ data[index] = ecdata[r][i];
7415
+ index += 1;
7416
+ }
7417
+ }
7418
+ }
7419
+ return data;
7420
+ }, "createBytes");
7421
+ const createData = /* @__PURE__ */ __name(function(typeNumber2, errorCorrectionLevel2, dataList) {
7422
+ const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, errorCorrectionLevel2);
7423
+ const buffer = qrBitBuffer();
7424
+ for (let i = 0; i < dataList.length; i += 1) {
7425
+ const data = dataList[i];
7426
+ buffer.put(data.getMode(), 4);
7427
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
7428
+ data.write(buffer);
7429
+ }
7430
+ let totalDataCount = 0;
7431
+ for (let i = 0; i < rsBlocks.length; i += 1) {
7432
+ totalDataCount += rsBlocks[i].dataCount;
7433
+ }
7434
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
7435
+ throw "code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")";
7436
+ }
7437
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
7438
+ buffer.put(0, 4);
7439
+ }
7440
+ while (buffer.getLengthInBits() % 8 != 0) {
7441
+ buffer.putBit(false);
7442
+ }
7443
+ while (true) {
7444
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
7445
+ break;
7446
+ }
7447
+ buffer.put(PAD0, 8);
7448
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
7449
+ break;
7450
+ }
7451
+ buffer.put(PAD1, 8);
7452
+ }
7453
+ return createBytes(buffer, rsBlocks);
7454
+ }, "createData");
7455
+ _this.addData = function(data, mode) {
7456
+ mode = mode || "Byte";
7457
+ let newData = null;
7458
+ switch (mode) {
7459
+ case "Numeric":
7460
+ newData = qrNumber(data);
7461
+ break;
7462
+ case "Alphanumeric":
7463
+ newData = qrAlphaNum(data);
7464
+ break;
7465
+ case "Byte":
7466
+ newData = qr8BitByte(data);
7467
+ break;
7468
+ case "Kanji":
7469
+ newData = qrKanji(data);
7470
+ break;
7471
+ default:
7472
+ throw "mode:" + mode;
7473
+ }
7474
+ _dataList.push(newData);
7475
+ _dataCache = null;
7476
+ };
7477
+ _this.isDark = function(row, col) {
7478
+ if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
7479
+ throw row + "," + col;
7480
+ }
7481
+ return _modules[row][col];
7482
+ };
7483
+ _this.getModuleCount = function() {
7484
+ return _moduleCount;
7485
+ };
7486
+ _this.make = function() {
7487
+ if (_typeNumber < 1) {
7488
+ let typeNumber2 = 1;
7489
+ for (; typeNumber2 < 40; typeNumber2++) {
7490
+ const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, _errorCorrectionLevel);
7491
+ const buffer = qrBitBuffer();
7492
+ for (let i = 0; i < _dataList.length; i++) {
7493
+ const data = _dataList[i];
7494
+ buffer.put(data.getMode(), 4);
7495
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
7496
+ data.write(buffer);
7497
+ }
7498
+ let totalDataCount = 0;
7499
+ for (let i = 0; i < rsBlocks.length; i++) {
7500
+ totalDataCount += rsBlocks[i].dataCount;
7501
+ }
7502
+ if (buffer.getLengthInBits() <= totalDataCount * 8) {
7503
+ break;
7504
+ }
7505
+ }
7506
+ _typeNumber = typeNumber2;
7507
+ }
7508
+ makeImpl(false, getBestMaskPattern());
7509
+ };
7510
+ _this.createTableTag = function(cellSize, margin) {
7511
+ cellSize = cellSize || 2;
7512
+ margin = typeof margin == "undefined" ? cellSize * 4 : margin;
7513
+ let qrHtml = "";
7514
+ qrHtml += '<table style="';
7515
+ qrHtml += " border-width: 0px; border-style: none;";
7516
+ qrHtml += " border-collapse: collapse;";
7517
+ qrHtml += " padding: 0px; margin: " + margin + "px;";
7518
+ qrHtml += '">';
7519
+ qrHtml += "<tbody>";
7520
+ for (let r = 0; r < _this.getModuleCount(); r += 1) {
7521
+ qrHtml += "<tr>";
7522
+ for (let c = 0; c < _this.getModuleCount(); c += 1) {
7523
+ qrHtml += '<td style="';
7524
+ qrHtml += " border-width: 0px; border-style: none;";
7525
+ qrHtml += " border-collapse: collapse;";
7526
+ qrHtml += " padding: 0px; margin: 0px;";
7527
+ qrHtml += " width: " + cellSize + "px;";
7528
+ qrHtml += " height: " + cellSize + "px;";
7529
+ qrHtml += " background-color: ";
7530
+ qrHtml += _this.isDark(r, c) ? "#000000" : "#ffffff";
7531
+ qrHtml += ";";
7532
+ qrHtml += '"/>';
7533
+ }
7534
+ qrHtml += "</tr>";
7535
+ }
7536
+ qrHtml += "</tbody>";
7537
+ qrHtml += "</table>";
7538
+ return qrHtml;
7539
+ };
7540
+ _this.createSvgTag = function(cellSize, margin, alt, title) {
7541
+ let opts = {};
7542
+ if (typeof arguments[0] == "object") {
7543
+ opts = arguments[0];
7544
+ cellSize = opts.cellSize;
7545
+ margin = opts.margin;
7546
+ alt = opts.alt;
7547
+ title = opts.title;
7548
+ }
7549
+ cellSize = cellSize || 2;
7550
+ margin = typeof margin == "undefined" ? cellSize * 4 : margin;
7551
+ alt = typeof alt === "string" ? { text: alt } : alt || {};
7552
+ alt.text = alt.text || null;
7553
+ alt.id = alt.text ? alt.id || "qrcode-description" : null;
7554
+ title = typeof title === "string" ? { text: title } : title || {};
7555
+ title.text = title.text || null;
7556
+ title.id = title.text ? title.id || "qrcode-title" : null;
7557
+ const size = _this.getModuleCount() * cellSize + margin * 2;
7558
+ let c, mc, r, mr, qrSvg = "", rect;
7559
+ rect = "l" + cellSize + ",0 0," + cellSize + " -" + cellSize + ",0 0,-" + cellSize + "z ";
7560
+ qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
7561
+ qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : "";
7562
+ qrSvg += ' viewBox="0 0 ' + size + " " + size + '" ';
7563
+ qrSvg += ' preserveAspectRatio="xMinYMin meet"';
7564
+ qrSvg += title.text || alt.text ? ' role="img" aria-labelledby="' + escapeXml([title.id, alt.id].join(" ").trim()) + '"' : "";
7565
+ qrSvg += ">";
7566
+ qrSvg += title.text ? '<title id="' + escapeXml(title.id) + '">' + escapeXml(title.text) + "</title>" : "";
7567
+ qrSvg += alt.text ? '<description id="' + escapeXml(alt.id) + '">' + escapeXml(alt.text) + "</description>" : "";
7568
+ qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
7569
+ qrSvg += '<path d="';
7570
+ for (r = 0; r < _this.getModuleCount(); r += 1) {
7571
+ mr = r * cellSize + margin;
7572
+ for (c = 0; c < _this.getModuleCount(); c += 1) {
7573
+ if (_this.isDark(r, c)) {
7574
+ mc = c * cellSize + margin;
7575
+ qrSvg += "M" + mc + "," + mr + rect;
7576
+ }
7577
+ }
7578
+ }
7579
+ qrSvg += '" stroke="transparent" fill="black"/>';
7580
+ qrSvg += "</svg>";
7581
+ return qrSvg;
7582
+ };
7583
+ _this.createDataURL = function(cellSize, margin) {
7584
+ cellSize = cellSize || 2;
7585
+ margin = typeof margin == "undefined" ? cellSize * 4 : margin;
7586
+ const size = _this.getModuleCount() * cellSize + margin * 2;
7587
+ const min = margin;
7588
+ const max = size - margin;
7589
+ return createDataURL(size, size, function(x, y) {
7590
+ if (min <= x && x < max && min <= y && y < max) {
7591
+ const c = Math.floor((x - min) / cellSize);
7592
+ const r = Math.floor((y - min) / cellSize);
7593
+ return _this.isDark(r, c) ? 0 : 1;
7594
+ } else {
7595
+ return 1;
7596
+ }
7597
+ });
7598
+ };
7599
+ _this.createImgTag = function(cellSize, margin, alt) {
7600
+ cellSize = cellSize || 2;
7601
+ margin = typeof margin == "undefined" ? cellSize * 4 : margin;
7602
+ const size = _this.getModuleCount() * cellSize + margin * 2;
7603
+ let img = "";
7604
+ img += "<img";
7605
+ img += ' src="';
7606
+ img += _this.createDataURL(cellSize, margin);
7607
+ img += '"';
7608
+ img += ' width="';
7609
+ img += size;
7610
+ img += '"';
7611
+ img += ' height="';
7612
+ img += size;
7613
+ img += '"';
7614
+ if (alt) {
7615
+ img += ' alt="';
7616
+ img += escapeXml(alt);
7617
+ img += '"';
7618
+ }
7619
+ img += "/>";
7620
+ return img;
7621
+ };
7622
+ const escapeXml = /* @__PURE__ */ __name(function(s) {
7623
+ let escaped = "";
7624
+ for (let i = 0; i < s.length; i += 1) {
7625
+ const c = s.charAt(i);
7626
+ switch (c) {
7627
+ case "<":
7628
+ escaped += "&lt;";
7629
+ break;
7630
+ case ">":
7631
+ escaped += "&gt;";
7632
+ break;
7633
+ case "&":
7634
+ escaped += "&amp;";
7635
+ break;
7636
+ case '"':
7637
+ escaped += "&quot;";
7638
+ break;
7639
+ default:
7640
+ escaped += c;
7641
+ break;
7642
+ }
7643
+ }
7644
+ return escaped;
7645
+ }, "escapeXml");
7646
+ const _createHalfASCII = /* @__PURE__ */ __name(function(margin) {
7647
+ const cellSize = 1;
7648
+ margin = typeof margin == "undefined" ? cellSize * 2 : margin;
7649
+ const size = _this.getModuleCount() * cellSize + margin * 2;
7650
+ const min = margin;
7651
+ const max = size - margin;
7652
+ let y, x, r1, r2, p;
7653
+ const blocks = {
7654
+ "\u2588\u2588": "\u2588",
7655
+ "\u2588 ": "\u2580",
7656
+ " \u2588": "\u2584",
7657
+ " ": " "
7658
+ };
7659
+ const blocksLastLineNoMargin = {
7660
+ "\u2588\u2588": "\u2580",
7661
+ "\u2588 ": "\u2580",
7662
+ " \u2588": " ",
7663
+ " ": " "
7664
+ };
7665
+ let ascii = "";
7666
+ for (y = 0; y < size; y += 2) {
7667
+ r1 = Math.floor((y - min) / cellSize);
7668
+ r2 = Math.floor((y + 1 - min) / cellSize);
7669
+ for (x = 0; x < size; x += 1) {
7670
+ p = "\u2588";
7671
+ if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
7672
+ p = " ";
7673
+ }
7674
+ if (min <= x && x < max && min <= y + 1 && y + 1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
7675
+ p += " ";
7676
+ } else {
7677
+ p += "\u2588";
7678
+ }
7679
+ ascii += margin < 1 && y + 1 >= max ? blocksLastLineNoMargin[p] : blocks[p];
7680
+ }
7681
+ ascii += "\n";
7682
+ }
7683
+ if (size % 2 && margin > 0) {
7684
+ return ascii.substring(0, ascii.length - size - 1) + Array(size + 1).join("\u2580");
7685
+ }
7686
+ return ascii.substring(0, ascii.length - 1);
7687
+ }, "_createHalfASCII");
7688
+ _this.createASCII = function(cellSize, margin) {
7689
+ cellSize = cellSize || 1;
7690
+ if (cellSize < 2) {
7691
+ return _createHalfASCII(margin);
7692
+ }
7693
+ cellSize -= 1;
7694
+ margin = typeof margin == "undefined" ? cellSize * 2 : margin;
7695
+ const size = _this.getModuleCount() * cellSize + margin * 2;
7696
+ const min = margin;
7697
+ const max = size - margin;
7698
+ let y, x, r, p;
7699
+ const white = Array(cellSize + 1).join("\u2588\u2588");
7700
+ const black = Array(cellSize + 1).join(" ");
7701
+ let ascii = "";
7702
+ let line2 = "";
7703
+ for (y = 0; y < size; y += 1) {
7704
+ r = Math.floor((y - min) / cellSize);
7705
+ line2 = "";
7706
+ for (x = 0; x < size; x += 1) {
7707
+ p = 1;
7708
+ if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
7709
+ p = 0;
7710
+ }
7711
+ line2 += p ? white : black;
7712
+ }
7713
+ for (r = 0; r < cellSize; r += 1) {
7714
+ ascii += line2 + "\n";
7715
+ }
7716
+ }
7717
+ return ascii.substring(0, ascii.length - 1);
7718
+ };
7719
+ _this.renderTo2dContext = function(context, cellSize) {
7720
+ cellSize = cellSize || 2;
7721
+ const length = _this.getModuleCount();
7722
+ for (let row = 0; row < length; row++) {
7723
+ for (let col = 0; col < length; col++) {
7724
+ context.fillStyle = _this.isDark(row, col) ? "black" : "white";
7725
+ context.fillRect(col * cellSize, row * cellSize, cellSize, cellSize);
7726
+ }
7727
+ }
7728
+ };
7729
+ return _this;
7730
+ }, "qrcode");
7731
+ qrcode.stringToBytes = function(s) {
7732
+ const bytes = [];
7733
+ for (let i = 0; i < s.length; i += 1) {
7734
+ const c = s.charCodeAt(i);
7735
+ bytes.push(c & 255);
7736
+ }
7737
+ return bytes;
7738
+ };
7739
+ qrcode.createStringToBytes = function(unicodeData, numChars) {
7740
+ const unicodeMap = (function() {
7741
+ const bin = base64DecodeInputStream(unicodeData);
7742
+ const read = /* @__PURE__ */ __name(function() {
7743
+ const b = bin.read();
7744
+ if (b == -1) throw "eof";
7745
+ return b;
7746
+ }, "read");
7747
+ let count2 = 0;
7748
+ const unicodeMap2 = {};
7749
+ while (true) {
7750
+ const b0 = bin.read();
7751
+ if (b0 == -1) break;
7752
+ const b1 = read();
7753
+ const b2 = read();
7754
+ const b3 = read();
7755
+ const k = String.fromCharCode(b0 << 8 | b1);
7756
+ const v = b2 << 8 | b3;
7757
+ unicodeMap2[k] = v;
7758
+ count2 += 1;
7759
+ }
7760
+ if (count2 != numChars) {
7761
+ throw count2 + " != " + numChars;
7762
+ }
7763
+ return unicodeMap2;
7764
+ })();
7765
+ const unknownChar = "?".charCodeAt(0);
7766
+ return function(s) {
7767
+ const bytes = [];
7768
+ for (let i = 0; i < s.length; i += 1) {
7769
+ const c = s.charCodeAt(i);
7770
+ if (c < 128) {
7771
+ bytes.push(c);
7772
+ } else {
7773
+ const b = unicodeMap[s.charAt(i)];
7774
+ if (typeof b == "number") {
7775
+ if ((b & 255) == b) {
7776
+ bytes.push(b);
7777
+ } else {
7778
+ bytes.push(b >>> 8);
7779
+ bytes.push(b & 255);
7780
+ }
7781
+ } else {
7782
+ bytes.push(unknownChar);
7783
+ }
7784
+ }
7785
+ }
7786
+ return bytes;
7787
+ };
7788
+ };
7789
+ var QRMode = {
7790
+ MODE_NUMBER: 1 << 0,
7791
+ MODE_ALPHA_NUM: 1 << 1,
7792
+ MODE_8BIT_BYTE: 1 << 2,
7793
+ MODE_KANJI: 1 << 3
7794
+ };
7795
+ var QRErrorCorrectionLevel = {
7796
+ L: 1,
7797
+ M: 0,
7798
+ Q: 3,
7799
+ H: 2
7800
+ };
7801
+ var QRMaskPattern = {
7802
+ PATTERN000: 0,
7803
+ PATTERN001: 1,
7804
+ PATTERN010: 2,
7805
+ PATTERN011: 3,
7806
+ PATTERN100: 4,
7807
+ PATTERN101: 5,
7808
+ PATTERN110: 6,
7809
+ PATTERN111: 7
7810
+ };
7811
+ var QRUtil = (function() {
7812
+ const PATTERN_POSITION_TABLE = [
7813
+ [],
7814
+ [6, 18],
7815
+ [6, 22],
7816
+ [6, 26],
7817
+ [6, 30],
7818
+ [6, 34],
7819
+ [6, 22, 38],
7820
+ [6, 24, 42],
7821
+ [6, 26, 46],
7822
+ [6, 28, 50],
7823
+ [6, 30, 54],
7824
+ [6, 32, 58],
7825
+ [6, 34, 62],
7826
+ [6, 26, 46, 66],
7827
+ [6, 26, 48, 70],
7828
+ [6, 26, 50, 74],
7829
+ [6, 30, 54, 78],
7830
+ [6, 30, 56, 82],
7831
+ [6, 30, 58, 86],
7832
+ [6, 34, 62, 90],
7833
+ [6, 28, 50, 72, 94],
7834
+ [6, 26, 50, 74, 98],
7835
+ [6, 30, 54, 78, 102],
7836
+ [6, 28, 54, 80, 106],
7837
+ [6, 32, 58, 84, 110],
7838
+ [6, 30, 58, 86, 114],
7839
+ [6, 34, 62, 90, 118],
7840
+ [6, 26, 50, 74, 98, 122],
7841
+ [6, 30, 54, 78, 102, 126],
7842
+ [6, 26, 52, 78, 104, 130],
7843
+ [6, 30, 56, 82, 108, 134],
7844
+ [6, 34, 60, 86, 112, 138],
7845
+ [6, 30, 58, 86, 114, 142],
7846
+ [6, 34, 62, 90, 118, 146],
7847
+ [6, 30, 54, 78, 102, 126, 150],
7848
+ [6, 24, 50, 76, 102, 128, 154],
7849
+ [6, 28, 54, 80, 106, 132, 158],
7850
+ [6, 32, 58, 84, 110, 136, 162],
7851
+ [6, 26, 54, 82, 110, 138, 166],
7852
+ [6, 30, 58, 86, 114, 142, 170]
7853
+ ];
7854
+ const G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
7855
+ const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
7856
+ const G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
7857
+ const _this = {};
7858
+ const getBCHDigit = /* @__PURE__ */ __name(function(data) {
7859
+ let digit = 0;
7860
+ while (data != 0) {
7861
+ digit += 1;
7862
+ data >>>= 1;
7863
+ }
7864
+ return digit;
7865
+ }, "getBCHDigit");
7866
+ _this.getBCHTypeInfo = function(data) {
7867
+ let d = data << 10;
7868
+ while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
7869
+ d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
7870
+ }
7871
+ return (data << 10 | d) ^ G15_MASK;
7872
+ };
7873
+ _this.getBCHTypeNumber = function(data) {
7874
+ let d = data << 12;
7875
+ while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
7876
+ d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
7877
+ }
7878
+ return data << 12 | d;
7879
+ };
7880
+ _this.getPatternPosition = function(typeNumber) {
7881
+ return PATTERN_POSITION_TABLE[typeNumber - 1];
7882
+ };
7883
+ _this.getMaskFunction = function(maskPattern) {
7884
+ switch (maskPattern) {
7885
+ case QRMaskPattern.PATTERN000:
7886
+ return function(i, j) {
7887
+ return (i + j) % 2 == 0;
7888
+ };
7889
+ case QRMaskPattern.PATTERN001:
7890
+ return function(i, j) {
7891
+ return i % 2 == 0;
7892
+ };
7893
+ case QRMaskPattern.PATTERN010:
7894
+ return function(i, j) {
7895
+ return j % 3 == 0;
7896
+ };
7897
+ case QRMaskPattern.PATTERN011:
7898
+ return function(i, j) {
7899
+ return (i + j) % 3 == 0;
7900
+ };
7901
+ case QRMaskPattern.PATTERN100:
7902
+ return function(i, j) {
7903
+ return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
7904
+ };
7905
+ case QRMaskPattern.PATTERN101:
7906
+ return function(i, j) {
7907
+ return i * j % 2 + i * j % 3 == 0;
7908
+ };
7909
+ case QRMaskPattern.PATTERN110:
7910
+ return function(i, j) {
7911
+ return (i * j % 2 + i * j % 3) % 2 == 0;
7912
+ };
7913
+ case QRMaskPattern.PATTERN111:
7914
+ return function(i, j) {
7915
+ return (i * j % 3 + (i + j) % 2) % 2 == 0;
7916
+ };
7917
+ default:
7918
+ throw "bad maskPattern:" + maskPattern;
7919
+ }
7920
+ };
7921
+ _this.getErrorCorrectPolynomial = function(errorCorrectLength) {
7922
+ let a = qrPolynomial([1], 0);
7923
+ for (let i = 0; i < errorCorrectLength; i += 1) {
7924
+ a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
7925
+ }
7926
+ return a;
7927
+ };
7928
+ _this.getLengthInBits = function(mode, type) {
7929
+ if (1 <= type && type < 10) {
7930
+ switch (mode) {
7931
+ case QRMode.MODE_NUMBER:
7932
+ return 10;
7933
+ case QRMode.MODE_ALPHA_NUM:
7934
+ return 9;
7935
+ case QRMode.MODE_8BIT_BYTE:
7936
+ return 8;
7937
+ case QRMode.MODE_KANJI:
7938
+ return 8;
7939
+ default:
7940
+ throw "mode:" + mode;
7941
+ }
7942
+ } else if (type < 27) {
7943
+ switch (mode) {
7944
+ case QRMode.MODE_NUMBER:
7945
+ return 12;
7946
+ case QRMode.MODE_ALPHA_NUM:
7947
+ return 11;
7948
+ case QRMode.MODE_8BIT_BYTE:
7949
+ return 16;
7950
+ case QRMode.MODE_KANJI:
7951
+ return 10;
7952
+ default:
7953
+ throw "mode:" + mode;
7954
+ }
7955
+ } else if (type < 41) {
7956
+ switch (mode) {
7957
+ case QRMode.MODE_NUMBER:
7958
+ return 14;
7959
+ case QRMode.MODE_ALPHA_NUM:
7960
+ return 13;
7961
+ case QRMode.MODE_8BIT_BYTE:
7962
+ return 16;
7963
+ case QRMode.MODE_KANJI:
7964
+ return 12;
7965
+ default:
7966
+ throw "mode:" + mode;
7967
+ }
7968
+ } else {
7969
+ throw "type:" + type;
7970
+ }
7971
+ };
7972
+ _this.getLostPoint = function(qrcode2) {
7973
+ const moduleCount = qrcode2.getModuleCount();
7974
+ let lostPoint = 0;
7975
+ for (let row = 0; row < moduleCount; row += 1) {
7976
+ for (let col = 0; col < moduleCount; col += 1) {
7977
+ let sameCount = 0;
7978
+ const dark = qrcode2.isDark(row, col);
7979
+ for (let r = -1; r <= 1; r += 1) {
7980
+ if (row + r < 0 || moduleCount <= row + r) {
7981
+ continue;
7982
+ }
7983
+ for (let c = -1; c <= 1; c += 1) {
7984
+ if (col + c < 0 || moduleCount <= col + c) {
7985
+ continue;
7986
+ }
7987
+ if (r == 0 && c == 0) {
7988
+ continue;
7989
+ }
7990
+ if (dark == qrcode2.isDark(row + r, col + c)) {
7991
+ sameCount += 1;
7992
+ }
7993
+ }
7994
+ }
7995
+ if (sameCount > 5) {
7996
+ lostPoint += 3 + sameCount - 5;
7997
+ }
7998
+ }
7999
+ }
8000
+ ;
8001
+ for (let row = 0; row < moduleCount - 1; row += 1) {
8002
+ for (let col = 0; col < moduleCount - 1; col += 1) {
8003
+ let count2 = 0;
8004
+ if (qrcode2.isDark(row, col)) count2 += 1;
8005
+ if (qrcode2.isDark(row + 1, col)) count2 += 1;
8006
+ if (qrcode2.isDark(row, col + 1)) count2 += 1;
8007
+ if (qrcode2.isDark(row + 1, col + 1)) count2 += 1;
8008
+ if (count2 == 0 || count2 == 4) {
8009
+ lostPoint += 3;
8010
+ }
8011
+ }
8012
+ }
8013
+ for (let row = 0; row < moduleCount; row += 1) {
8014
+ for (let col = 0; col < moduleCount - 6; col += 1) {
8015
+ 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)) {
8016
+ lostPoint += 40;
8017
+ }
8018
+ }
8019
+ }
8020
+ for (let col = 0; col < moduleCount; col += 1) {
8021
+ for (let row = 0; row < moduleCount - 6; row += 1) {
8022
+ 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)) {
8023
+ lostPoint += 40;
8024
+ }
8025
+ }
8026
+ }
8027
+ let darkCount = 0;
8028
+ for (let col = 0; col < moduleCount; col += 1) {
8029
+ for (let row = 0; row < moduleCount; row += 1) {
8030
+ if (qrcode2.isDark(row, col)) {
8031
+ darkCount += 1;
8032
+ }
8033
+ }
8034
+ }
8035
+ const ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
8036
+ lostPoint += ratio * 10;
8037
+ return lostPoint;
8038
+ };
8039
+ return _this;
8040
+ })();
8041
+ var QRMath = (function() {
8042
+ const EXP_TABLE = new Array(256);
8043
+ const LOG_TABLE = new Array(256);
8044
+ for (let i = 0; i < 8; i += 1) {
8045
+ EXP_TABLE[i] = 1 << i;
8046
+ }
8047
+ for (let i = 8; i < 256; i += 1) {
8048
+ EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
8049
+ }
8050
+ for (let i = 0; i < 255; i += 1) {
8051
+ LOG_TABLE[EXP_TABLE[i]] = i;
8052
+ }
8053
+ const _this = {};
8054
+ _this.glog = function(n) {
8055
+ if (n < 1) {
8056
+ throw "glog(" + n + ")";
8057
+ }
8058
+ return LOG_TABLE[n];
8059
+ };
8060
+ _this.gexp = function(n) {
8061
+ while (n < 0) {
8062
+ n += 255;
8063
+ }
8064
+ while (n >= 256) {
8065
+ n -= 255;
8066
+ }
8067
+ return EXP_TABLE[n];
8068
+ };
8069
+ return _this;
8070
+ })();
8071
+ var qrPolynomial = /* @__PURE__ */ __name(function(num, shift) {
8072
+ if (typeof num.length == "undefined") {
8073
+ throw num.length + "/" + shift;
8074
+ }
8075
+ const _num = (function() {
8076
+ let offset = 0;
8077
+ while (offset < num.length && num[offset] == 0) {
8078
+ offset += 1;
8079
+ }
8080
+ const _num2 = new Array(num.length - offset + shift);
8081
+ for (let i = 0; i < num.length - offset; i += 1) {
8082
+ _num2[i] = num[i + offset];
8083
+ }
8084
+ return _num2;
8085
+ })();
8086
+ const _this = {};
8087
+ _this.getAt = function(index) {
8088
+ return _num[index];
8089
+ };
8090
+ _this.getLength = function() {
8091
+ return _num.length;
8092
+ };
8093
+ _this.multiply = function(e) {
8094
+ const num2 = new Array(_this.getLength() + e.getLength() - 1);
8095
+ for (let i = 0; i < _this.getLength(); i += 1) {
8096
+ for (let j = 0; j < e.getLength(); j += 1) {
8097
+ num2[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
8098
+ }
8099
+ }
8100
+ return qrPolynomial(num2, 0);
8101
+ };
8102
+ _this.mod = function(e) {
8103
+ if (_this.getLength() - e.getLength() < 0) {
8104
+ return _this;
8105
+ }
8106
+ const ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
8107
+ const num2 = new Array(_this.getLength());
8108
+ for (let i = 0; i < _this.getLength(); i += 1) {
8109
+ num2[i] = _this.getAt(i);
8110
+ }
8111
+ for (let i = 0; i < e.getLength(); i += 1) {
8112
+ num2[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
8113
+ }
8114
+ return qrPolynomial(num2, 0).mod(e);
8115
+ };
8116
+ return _this;
8117
+ }, "qrPolynomial");
8118
+ var QRRSBlock = (function() {
8119
+ const RS_BLOCK_TABLE = [
8120
+ // L
8121
+ // M
8122
+ // Q
8123
+ // H
8124
+ // 1
8125
+ [1, 26, 19],
8126
+ [1, 26, 16],
8127
+ [1, 26, 13],
8128
+ [1, 26, 9],
8129
+ // 2
8130
+ [1, 44, 34],
8131
+ [1, 44, 28],
8132
+ [1, 44, 22],
8133
+ [1, 44, 16],
8134
+ // 3
8135
+ [1, 70, 55],
8136
+ [1, 70, 44],
8137
+ [2, 35, 17],
8138
+ [2, 35, 13],
8139
+ // 4
8140
+ [1, 100, 80],
8141
+ [2, 50, 32],
8142
+ [2, 50, 24],
8143
+ [4, 25, 9],
8144
+ // 5
8145
+ [1, 134, 108],
8146
+ [2, 67, 43],
8147
+ [2, 33, 15, 2, 34, 16],
8148
+ [2, 33, 11, 2, 34, 12],
8149
+ // 6
8150
+ [2, 86, 68],
8151
+ [4, 43, 27],
8152
+ [4, 43, 19],
8153
+ [4, 43, 15],
8154
+ // 7
8155
+ [2, 98, 78],
8156
+ [4, 49, 31],
8157
+ [2, 32, 14, 4, 33, 15],
8158
+ [4, 39, 13, 1, 40, 14],
8159
+ // 8
8160
+ [2, 121, 97],
8161
+ [2, 60, 38, 2, 61, 39],
8162
+ [4, 40, 18, 2, 41, 19],
8163
+ [4, 40, 14, 2, 41, 15],
8164
+ // 9
8165
+ [2, 146, 116],
8166
+ [3, 58, 36, 2, 59, 37],
8167
+ [4, 36, 16, 4, 37, 17],
8168
+ [4, 36, 12, 4, 37, 13],
8169
+ // 10
8170
+ [2, 86, 68, 2, 87, 69],
8171
+ [4, 69, 43, 1, 70, 44],
8172
+ [6, 43, 19, 2, 44, 20],
8173
+ [6, 43, 15, 2, 44, 16],
8174
+ // 11
8175
+ [4, 101, 81],
8176
+ [1, 80, 50, 4, 81, 51],
8177
+ [4, 50, 22, 4, 51, 23],
8178
+ [3, 36, 12, 8, 37, 13],
8179
+ // 12
8180
+ [2, 116, 92, 2, 117, 93],
8181
+ [6, 58, 36, 2, 59, 37],
8182
+ [4, 46, 20, 6, 47, 21],
8183
+ [7, 42, 14, 4, 43, 15],
8184
+ // 13
8185
+ [4, 133, 107],
8186
+ [8, 59, 37, 1, 60, 38],
8187
+ [8, 44, 20, 4, 45, 21],
8188
+ [12, 33, 11, 4, 34, 12],
8189
+ // 14
8190
+ [3, 145, 115, 1, 146, 116],
8191
+ [4, 64, 40, 5, 65, 41],
8192
+ [11, 36, 16, 5, 37, 17],
8193
+ [11, 36, 12, 5, 37, 13],
8194
+ // 15
8195
+ [5, 109, 87, 1, 110, 88],
8196
+ [5, 65, 41, 5, 66, 42],
8197
+ [5, 54, 24, 7, 55, 25],
8198
+ [11, 36, 12, 7, 37, 13],
8199
+ // 16
8200
+ [5, 122, 98, 1, 123, 99],
8201
+ [7, 73, 45, 3, 74, 46],
8202
+ [15, 43, 19, 2, 44, 20],
8203
+ [3, 45, 15, 13, 46, 16],
8204
+ // 17
8205
+ [1, 135, 107, 5, 136, 108],
8206
+ [10, 74, 46, 1, 75, 47],
8207
+ [1, 50, 22, 15, 51, 23],
8208
+ [2, 42, 14, 17, 43, 15],
8209
+ // 18
8210
+ [5, 150, 120, 1, 151, 121],
8211
+ [9, 69, 43, 4, 70, 44],
8212
+ [17, 50, 22, 1, 51, 23],
8213
+ [2, 42, 14, 19, 43, 15],
8214
+ // 19
8215
+ [3, 141, 113, 4, 142, 114],
8216
+ [3, 70, 44, 11, 71, 45],
8217
+ [17, 47, 21, 4, 48, 22],
8218
+ [9, 39, 13, 16, 40, 14],
8219
+ // 20
8220
+ [3, 135, 107, 5, 136, 108],
8221
+ [3, 67, 41, 13, 68, 42],
8222
+ [15, 54, 24, 5, 55, 25],
8223
+ [15, 43, 15, 10, 44, 16],
8224
+ // 21
8225
+ [4, 144, 116, 4, 145, 117],
8226
+ [17, 68, 42],
8227
+ [17, 50, 22, 6, 51, 23],
8228
+ [19, 46, 16, 6, 47, 17],
8229
+ // 22
8230
+ [2, 139, 111, 7, 140, 112],
8231
+ [17, 74, 46],
8232
+ [7, 54, 24, 16, 55, 25],
8233
+ [34, 37, 13],
8234
+ // 23
8235
+ [4, 151, 121, 5, 152, 122],
8236
+ [4, 75, 47, 14, 76, 48],
8237
+ [11, 54, 24, 14, 55, 25],
8238
+ [16, 45, 15, 14, 46, 16],
8239
+ // 24
8240
+ [6, 147, 117, 4, 148, 118],
8241
+ [6, 73, 45, 14, 74, 46],
8242
+ [11, 54, 24, 16, 55, 25],
8243
+ [30, 46, 16, 2, 47, 17],
8244
+ // 25
8245
+ [8, 132, 106, 4, 133, 107],
8246
+ [8, 75, 47, 13, 76, 48],
8247
+ [7, 54, 24, 22, 55, 25],
8248
+ [22, 45, 15, 13, 46, 16],
8249
+ // 26
8250
+ [10, 142, 114, 2, 143, 115],
8251
+ [19, 74, 46, 4, 75, 47],
8252
+ [28, 50, 22, 6, 51, 23],
8253
+ [33, 46, 16, 4, 47, 17],
8254
+ // 27
8255
+ [8, 152, 122, 4, 153, 123],
8256
+ [22, 73, 45, 3, 74, 46],
8257
+ [8, 53, 23, 26, 54, 24],
8258
+ [12, 45, 15, 28, 46, 16],
8259
+ // 28
8260
+ [3, 147, 117, 10, 148, 118],
8261
+ [3, 73, 45, 23, 74, 46],
8262
+ [4, 54, 24, 31, 55, 25],
8263
+ [11, 45, 15, 31, 46, 16],
8264
+ // 29
8265
+ [7, 146, 116, 7, 147, 117],
8266
+ [21, 73, 45, 7, 74, 46],
8267
+ [1, 53, 23, 37, 54, 24],
8268
+ [19, 45, 15, 26, 46, 16],
8269
+ // 30
8270
+ [5, 145, 115, 10, 146, 116],
8271
+ [19, 75, 47, 10, 76, 48],
8272
+ [15, 54, 24, 25, 55, 25],
8273
+ [23, 45, 15, 25, 46, 16],
8274
+ // 31
8275
+ [13, 145, 115, 3, 146, 116],
8276
+ [2, 74, 46, 29, 75, 47],
8277
+ [42, 54, 24, 1, 55, 25],
8278
+ [23, 45, 15, 28, 46, 16],
8279
+ // 32
8280
+ [17, 145, 115],
8281
+ [10, 74, 46, 23, 75, 47],
8282
+ [10, 54, 24, 35, 55, 25],
8283
+ [19, 45, 15, 35, 46, 16],
8284
+ // 33
8285
+ [17, 145, 115, 1, 146, 116],
8286
+ [14, 74, 46, 21, 75, 47],
8287
+ [29, 54, 24, 19, 55, 25],
8288
+ [11, 45, 15, 46, 46, 16],
8289
+ // 34
8290
+ [13, 145, 115, 6, 146, 116],
8291
+ [14, 74, 46, 23, 75, 47],
8292
+ [44, 54, 24, 7, 55, 25],
8293
+ [59, 46, 16, 1, 47, 17],
8294
+ // 35
8295
+ [12, 151, 121, 7, 152, 122],
8296
+ [12, 75, 47, 26, 76, 48],
8297
+ [39, 54, 24, 14, 55, 25],
8298
+ [22, 45, 15, 41, 46, 16],
8299
+ // 36
8300
+ [6, 151, 121, 14, 152, 122],
8301
+ [6, 75, 47, 34, 76, 48],
8302
+ [46, 54, 24, 10, 55, 25],
8303
+ [2, 45, 15, 64, 46, 16],
8304
+ // 37
8305
+ [17, 152, 122, 4, 153, 123],
8306
+ [29, 74, 46, 14, 75, 47],
8307
+ [49, 54, 24, 10, 55, 25],
8308
+ [24, 45, 15, 46, 46, 16],
8309
+ // 38
8310
+ [4, 152, 122, 18, 153, 123],
8311
+ [13, 74, 46, 32, 75, 47],
8312
+ [48, 54, 24, 14, 55, 25],
8313
+ [42, 45, 15, 32, 46, 16],
8314
+ // 39
8315
+ [20, 147, 117, 4, 148, 118],
8316
+ [40, 75, 47, 7, 76, 48],
8317
+ [43, 54, 24, 22, 55, 25],
8318
+ [10, 45, 15, 67, 46, 16],
8319
+ // 40
8320
+ [19, 148, 118, 6, 149, 119],
8321
+ [18, 75, 47, 31, 76, 48],
8322
+ [34, 54, 24, 34, 55, 25],
8323
+ [20, 45, 15, 61, 46, 16]
8324
+ ];
8325
+ const qrRSBlock = /* @__PURE__ */ __name(function(totalCount, dataCount) {
8326
+ const _this2 = {};
8327
+ _this2.totalCount = totalCount;
8328
+ _this2.dataCount = dataCount;
8329
+ return _this2;
8330
+ }, "qrRSBlock");
8331
+ const _this = {};
8332
+ const getRsBlockTable = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
8333
+ switch (errorCorrectionLevel) {
8334
+ case QRErrorCorrectionLevel.L:
8335
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
8336
+ case QRErrorCorrectionLevel.M:
8337
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
8338
+ case QRErrorCorrectionLevel.Q:
8339
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
8340
+ case QRErrorCorrectionLevel.H:
8341
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
8342
+ default:
8343
+ return void 0;
8344
+ }
8345
+ }, "getRsBlockTable");
8346
+ _this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
8347
+ const rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
8348
+ if (typeof rsBlock == "undefined") {
8349
+ throw "bad rs block @ typeNumber:" + typeNumber + "/errorCorrectionLevel:" + errorCorrectionLevel;
8350
+ }
8351
+ const length = rsBlock.length / 3;
8352
+ const list = [];
8353
+ for (let i = 0; i < length; i += 1) {
8354
+ const count2 = rsBlock[i * 3 + 0];
8355
+ const totalCount = rsBlock[i * 3 + 1];
8356
+ const dataCount = rsBlock[i * 3 + 2];
8357
+ for (let j = 0; j < count2; j += 1) {
8358
+ list.push(qrRSBlock(totalCount, dataCount));
8359
+ }
8360
+ }
8361
+ return list;
8362
+ };
8363
+ return _this;
8364
+ })();
8365
+ var qrBitBuffer = /* @__PURE__ */ __name(function() {
8366
+ const _buffer = [];
8367
+ let _length = 0;
8368
+ const _this = {};
8369
+ _this.getBuffer = function() {
8370
+ return _buffer;
8371
+ };
8372
+ _this.getAt = function(index) {
8373
+ const bufIndex = Math.floor(index / 8);
8374
+ return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
8375
+ };
8376
+ _this.put = function(num, length) {
8377
+ for (let i = 0; i < length; i += 1) {
8378
+ _this.putBit((num >>> length - i - 1 & 1) == 1);
8379
+ }
8380
+ };
8381
+ _this.getLengthInBits = function() {
8382
+ return _length;
8383
+ };
8384
+ _this.putBit = function(bit) {
8385
+ const bufIndex = Math.floor(_length / 8);
8386
+ if (_buffer.length <= bufIndex) {
8387
+ _buffer.push(0);
8388
+ }
8389
+ if (bit) {
8390
+ _buffer[bufIndex] |= 128 >>> _length % 8;
8391
+ }
8392
+ _length += 1;
8393
+ };
8394
+ return _this;
8395
+ }, "qrBitBuffer");
8396
+ var qrNumber = /* @__PURE__ */ __name(function(data) {
8397
+ const _mode = QRMode.MODE_NUMBER;
8398
+ const _data = data;
8399
+ const _this = {};
8400
+ _this.getMode = function() {
8401
+ return _mode;
8402
+ };
8403
+ _this.getLength = function(buffer) {
8404
+ return _data.length;
8405
+ };
8406
+ _this.write = function(buffer) {
8407
+ const data2 = _data;
8408
+ let i = 0;
8409
+ while (i + 2 < data2.length) {
8410
+ buffer.put(strToNum(data2.substring(i, i + 3)), 10);
8411
+ i += 3;
8412
+ }
8413
+ if (i < data2.length) {
8414
+ if (data2.length - i == 1) {
8415
+ buffer.put(strToNum(data2.substring(i, i + 1)), 4);
8416
+ } else if (data2.length - i == 2) {
8417
+ buffer.put(strToNum(data2.substring(i, i + 2)), 7);
8418
+ }
8419
+ }
8420
+ };
8421
+ const strToNum = /* @__PURE__ */ __name(function(s) {
8422
+ let num = 0;
8423
+ for (let i = 0; i < s.length; i += 1) {
8424
+ num = num * 10 + chatToNum(s.charAt(i));
8425
+ }
8426
+ return num;
8427
+ }, "strToNum");
8428
+ const chatToNum = /* @__PURE__ */ __name(function(c) {
8429
+ if ("0" <= c && c <= "9") {
8430
+ return c.charCodeAt(0) - "0".charCodeAt(0);
8431
+ }
8432
+ throw "illegal char :" + c;
8433
+ }, "chatToNum");
8434
+ return _this;
8435
+ }, "qrNumber");
8436
+ var qrAlphaNum = /* @__PURE__ */ __name(function(data) {
8437
+ const _mode = QRMode.MODE_ALPHA_NUM;
8438
+ const _data = data;
8439
+ const _this = {};
8440
+ _this.getMode = function() {
8441
+ return _mode;
8442
+ };
8443
+ _this.getLength = function(buffer) {
8444
+ return _data.length;
8445
+ };
8446
+ _this.write = function(buffer) {
8447
+ const s = _data;
8448
+ let i = 0;
8449
+ while (i + 1 < s.length) {
8450
+ buffer.put(
8451
+ getCode(s.charAt(i)) * 45 + getCode(s.charAt(i + 1)),
8452
+ 11
8453
+ );
8454
+ i += 2;
8455
+ }
8456
+ if (i < s.length) {
8457
+ buffer.put(getCode(s.charAt(i)), 6);
8458
+ }
8459
+ };
8460
+ const getCode = /* @__PURE__ */ __name(function(c) {
8461
+ if ("0" <= c && c <= "9") {
8462
+ return c.charCodeAt(0) - "0".charCodeAt(0);
8463
+ } else if ("A" <= c && c <= "Z") {
8464
+ return c.charCodeAt(0) - "A".charCodeAt(0) + 10;
8465
+ } else {
8466
+ switch (c) {
8467
+ case " ":
8468
+ return 36;
8469
+ case "$":
8470
+ return 37;
8471
+ case "%":
8472
+ return 38;
8473
+ case "*":
8474
+ return 39;
8475
+ case "+":
8476
+ return 40;
8477
+ case "-":
8478
+ return 41;
8479
+ case ".":
8480
+ return 42;
8481
+ case "/":
8482
+ return 43;
8483
+ case ":":
8484
+ return 44;
8485
+ default:
8486
+ throw "illegal char :" + c;
8487
+ }
8488
+ }
8489
+ }, "getCode");
8490
+ return _this;
8491
+ }, "qrAlphaNum");
8492
+ var qr8BitByte = /* @__PURE__ */ __name(function(data) {
8493
+ const _mode = QRMode.MODE_8BIT_BYTE;
8494
+ const _data = data;
8495
+ const _bytes = qrcode.stringToBytes(data);
8496
+ const _this = {};
8497
+ _this.getMode = function() {
8498
+ return _mode;
8499
+ };
8500
+ _this.getLength = function(buffer) {
8501
+ return _bytes.length;
8502
+ };
8503
+ _this.write = function(buffer) {
8504
+ for (let i = 0; i < _bytes.length; i += 1) {
8505
+ buffer.put(_bytes[i], 8);
8506
+ }
8507
+ };
8508
+ return _this;
8509
+ }, "qr8BitByte");
8510
+ var qrKanji = /* @__PURE__ */ __name(function(data) {
8511
+ const _mode = QRMode.MODE_KANJI;
8512
+ const _data = data;
8513
+ const stringToBytes2 = qrcode.stringToBytes;
8514
+ !(function(c, code) {
8515
+ const test = stringToBytes2(c);
8516
+ if (test.length != 2 || (test[0] << 8 | test[1]) != code) {
8517
+ throw "sjis not supported.";
8518
+ }
8519
+ })("\u53CB", 38726);
8520
+ const _bytes = stringToBytes2(data);
8521
+ const _this = {};
8522
+ _this.getMode = function() {
8523
+ return _mode;
8524
+ };
8525
+ _this.getLength = function(buffer) {
8526
+ return ~~(_bytes.length / 2);
8527
+ };
8528
+ _this.write = function(buffer) {
8529
+ const data2 = _bytes;
8530
+ let i = 0;
8531
+ while (i + 1 < data2.length) {
8532
+ let c = (255 & data2[i]) << 8 | 255 & data2[i + 1];
8533
+ if (33088 <= c && c <= 40956) {
8534
+ c -= 33088;
8535
+ } else if (57408 <= c && c <= 60351) {
8536
+ c -= 49472;
8537
+ } else {
8538
+ throw "illegal char at " + (i + 1) + "/" + c;
8539
+ }
8540
+ c = (c >>> 8 & 255) * 192 + (c & 255);
8541
+ buffer.put(c, 13);
8542
+ i += 2;
8543
+ }
8544
+ if (i < data2.length) {
8545
+ throw "illegal char at " + (i + 1);
8546
+ }
8547
+ };
8548
+ return _this;
8549
+ }, "qrKanji");
8550
+ var byteArrayOutputStream = /* @__PURE__ */ __name(function() {
8551
+ const _bytes = [];
8552
+ const _this = {};
8553
+ _this.writeByte = function(b) {
8554
+ _bytes.push(b & 255);
8555
+ };
8556
+ _this.writeShort = function(i) {
8557
+ _this.writeByte(i);
8558
+ _this.writeByte(i >>> 8);
8559
+ };
8560
+ _this.writeBytes = function(b, off, len) {
8561
+ off = off || 0;
8562
+ len = len || b.length;
8563
+ for (let i = 0; i < len; i += 1) {
8564
+ _this.writeByte(b[i + off]);
8565
+ }
8566
+ };
8567
+ _this.writeString = function(s) {
8568
+ for (let i = 0; i < s.length; i += 1) {
8569
+ _this.writeByte(s.charCodeAt(i));
8570
+ }
8571
+ };
8572
+ _this.toByteArray = function() {
8573
+ return _bytes;
8574
+ };
8575
+ _this.toString = function() {
8576
+ let s = "";
8577
+ s += "[";
8578
+ for (let i = 0; i < _bytes.length; i += 1) {
8579
+ if (i > 0) {
8580
+ s += ",";
8581
+ }
8582
+ s += _bytes[i];
8583
+ }
8584
+ s += "]";
8585
+ return s;
8586
+ };
8587
+ return _this;
8588
+ }, "byteArrayOutputStream");
8589
+ var base64EncodeOutputStream = /* @__PURE__ */ __name(function() {
8590
+ let _buffer = 0;
8591
+ let _buflen = 0;
8592
+ let _length = 0;
8593
+ let _base64 = "";
8594
+ const _this = {};
8595
+ const writeEncoded = /* @__PURE__ */ __name(function(b) {
8596
+ _base64 += String.fromCharCode(encode(b & 63));
8597
+ }, "writeEncoded");
8598
+ const encode = /* @__PURE__ */ __name(function(n) {
8599
+ if (n < 0) {
8600
+ throw "n:" + n;
8601
+ } else if (n < 26) {
8602
+ return 65 + n;
8603
+ } else if (n < 52) {
8604
+ return 97 + (n - 26);
8605
+ } else if (n < 62) {
8606
+ return 48 + (n - 52);
8607
+ } else if (n == 62) {
8608
+ return 43;
8609
+ } else if (n == 63) {
8610
+ return 47;
8611
+ } else {
8612
+ throw "n:" + n;
8613
+ }
8614
+ }, "encode");
8615
+ _this.writeByte = function(n) {
8616
+ _buffer = _buffer << 8 | n & 255;
8617
+ _buflen += 8;
8618
+ _length += 1;
8619
+ while (_buflen >= 6) {
8620
+ writeEncoded(_buffer >>> _buflen - 6);
8621
+ _buflen -= 6;
8622
+ }
8623
+ };
8624
+ _this.flush = function() {
8625
+ if (_buflen > 0) {
8626
+ writeEncoded(_buffer << 6 - _buflen);
8627
+ _buffer = 0;
8628
+ _buflen = 0;
8629
+ }
8630
+ if (_length % 3 != 0) {
8631
+ const padlen = 3 - _length % 3;
8632
+ for (let i = 0; i < padlen; i += 1) {
8633
+ _base64 += "=";
8634
+ }
8635
+ }
8636
+ };
8637
+ _this.toString = function() {
8638
+ return _base64;
8639
+ };
8640
+ return _this;
8641
+ }, "base64EncodeOutputStream");
8642
+ var base64DecodeInputStream = /* @__PURE__ */ __name(function(str) {
8643
+ const _str = str;
8644
+ let _pos = 0;
8645
+ let _buffer = 0;
8646
+ let _buflen = 0;
8647
+ const _this = {};
8648
+ _this.read = function() {
8649
+ while (_buflen < 8) {
8650
+ if (_pos >= _str.length) {
8651
+ if (_buflen == 0) {
8652
+ return -1;
8653
+ }
8654
+ throw "unexpected end of file./" + _buflen;
8655
+ }
8656
+ const c = _str.charAt(_pos);
8657
+ _pos += 1;
8658
+ if (c == "=") {
8659
+ _buflen = 0;
8660
+ return -1;
8661
+ } else if (c.match(/^\s$/)) {
8662
+ continue;
8663
+ }
8664
+ _buffer = _buffer << 6 | decode2(c.charCodeAt(0));
8665
+ _buflen += 6;
8666
+ }
8667
+ const n = _buffer >>> _buflen - 8 & 255;
8668
+ _buflen -= 8;
8669
+ return n;
8670
+ };
8671
+ const decode2 = /* @__PURE__ */ __name(function(c) {
8672
+ if (65 <= c && c <= 90) {
8673
+ return c - 65;
8674
+ } else if (97 <= c && c <= 122) {
8675
+ return c - 97 + 26;
8676
+ } else if (48 <= c && c <= 57) {
8677
+ return c - 48 + 52;
8678
+ } else if (c == 43) {
8679
+ return 62;
8680
+ } else if (c == 47) {
8681
+ return 63;
8682
+ } else {
8683
+ throw "c:" + c;
8684
+ }
8685
+ }, "decode");
8686
+ return _this;
8687
+ }, "base64DecodeInputStream");
8688
+ var gifImage = /* @__PURE__ */ __name(function(width, height) {
8689
+ const _width = width;
8690
+ const _height = height;
8691
+ const _data = new Array(width * height);
8692
+ const _this = {};
8693
+ _this.setPixel = function(x, y, pixel) {
8694
+ _data[y * _width + x] = pixel;
8695
+ };
8696
+ _this.write = function(out) {
8697
+ out.writeString("GIF87a");
8698
+ out.writeShort(_width);
8699
+ out.writeShort(_height);
8700
+ out.writeByte(128);
8701
+ out.writeByte(0);
8702
+ out.writeByte(0);
8703
+ out.writeByte(0);
8704
+ out.writeByte(0);
8705
+ out.writeByte(0);
8706
+ out.writeByte(255);
8707
+ out.writeByte(255);
8708
+ out.writeByte(255);
8709
+ out.writeString(",");
8710
+ out.writeShort(0);
8711
+ out.writeShort(0);
8712
+ out.writeShort(_width);
8713
+ out.writeShort(_height);
8714
+ out.writeByte(0);
8715
+ const lzwMinCodeSize = 2;
8716
+ const raster = getLZWRaster(lzwMinCodeSize);
8717
+ out.writeByte(lzwMinCodeSize);
8718
+ let offset = 0;
8719
+ while (raster.length - offset > 255) {
8720
+ out.writeByte(255);
8721
+ out.writeBytes(raster, offset, 255);
8722
+ offset += 255;
8723
+ }
8724
+ out.writeByte(raster.length - offset);
8725
+ out.writeBytes(raster, offset, raster.length - offset);
8726
+ out.writeByte(0);
8727
+ out.writeString(";");
8728
+ };
8729
+ const bitOutputStream = /* @__PURE__ */ __name(function(out) {
8730
+ const _out = out;
8731
+ let _bitLength = 0;
8732
+ let _bitBuffer = 0;
8733
+ const _this2 = {};
8734
+ _this2.write = function(data, length) {
8735
+ if (data >>> length != 0) {
8736
+ throw "length over";
8737
+ }
8738
+ while (_bitLength + length >= 8) {
8739
+ _out.writeByte(255 & (data << _bitLength | _bitBuffer));
8740
+ length -= 8 - _bitLength;
8741
+ data >>>= 8 - _bitLength;
8742
+ _bitBuffer = 0;
8743
+ _bitLength = 0;
8744
+ }
8745
+ _bitBuffer = data << _bitLength | _bitBuffer;
8746
+ _bitLength = _bitLength + length;
8747
+ };
8748
+ _this2.flush = function() {
8749
+ if (_bitLength > 0) {
8750
+ _out.writeByte(_bitBuffer);
8751
+ }
8752
+ };
8753
+ return _this2;
8754
+ }, "bitOutputStream");
8755
+ const getLZWRaster = /* @__PURE__ */ __name(function(lzwMinCodeSize) {
8756
+ const clearCode = 1 << lzwMinCodeSize;
8757
+ const endCode = (1 << lzwMinCodeSize) + 1;
8758
+ let bitLength = lzwMinCodeSize + 1;
8759
+ const table = lzwTable();
8760
+ for (let i = 0; i < clearCode; i += 1) {
8761
+ table.add(String.fromCharCode(i));
8762
+ }
8763
+ table.add(String.fromCharCode(clearCode));
8764
+ table.add(String.fromCharCode(endCode));
8765
+ const byteOut = byteArrayOutputStream();
8766
+ const bitOut = bitOutputStream(byteOut);
8767
+ bitOut.write(clearCode, bitLength);
8768
+ let dataIndex = 0;
8769
+ let s = String.fromCharCode(_data[dataIndex]);
8770
+ dataIndex += 1;
8771
+ while (dataIndex < _data.length) {
8772
+ const c = String.fromCharCode(_data[dataIndex]);
8773
+ dataIndex += 1;
8774
+ if (table.contains(s + c)) {
8775
+ s = s + c;
8776
+ } else {
8777
+ bitOut.write(table.indexOf(s), bitLength);
8778
+ if (table.size() < 4095) {
8779
+ if (table.size() == 1 << bitLength) {
8780
+ bitLength += 1;
8781
+ }
8782
+ table.add(s + c);
8783
+ }
8784
+ s = c;
8785
+ }
8786
+ }
8787
+ bitOut.write(table.indexOf(s), bitLength);
8788
+ bitOut.write(endCode, bitLength);
8789
+ bitOut.flush();
8790
+ return byteOut.toByteArray();
8791
+ }, "getLZWRaster");
8792
+ const lzwTable = /* @__PURE__ */ __name(function() {
8793
+ const _map = {};
8794
+ let _size = 0;
8795
+ const _this2 = {};
8796
+ _this2.add = function(key) {
8797
+ if (_this2.contains(key)) {
8798
+ throw "dup key:" + key;
8799
+ }
8800
+ _map[key] = _size;
8801
+ _size += 1;
8802
+ };
8803
+ _this2.size = function() {
8804
+ return _size;
8805
+ };
8806
+ _this2.indexOf = function(key) {
8807
+ return _map[key];
8808
+ };
8809
+ _this2.contains = function(key) {
8810
+ return typeof _map[key] != "undefined";
8811
+ };
8812
+ return _this2;
8813
+ }, "lzwTable");
8814
+ return _this;
8815
+ }, "gifImage");
8816
+ var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
8817
+ const gif = gifImage(width, height);
8818
+ for (let y = 0; y < height; y += 1) {
8819
+ for (let x = 0; x < width; x += 1) {
8820
+ gif.setPixel(x, y, getPixel(x, y));
8821
+ }
8822
+ }
8823
+ const b = byteArrayOutputStream();
8824
+ gif.write(b);
8825
+ const base64 = base64EncodeOutputStream();
8826
+ const bytes = b.toByteArray();
8827
+ for (let i = 0; i < bytes.length; i += 1) {
8828
+ base64.writeByte(bytes[i]);
8829
+ }
8830
+ base64.flush();
8831
+ return "data:image/gif;base64," + base64;
8832
+ }, "createDataURL");
8833
+ var stringToBytes = qrcode.stringToBytes;
8834
+
8835
+ // dist/mcp/granted.js
8836
+ var granted = /* @__PURE__ */ new WeakMap();
8837
+ var grantLevels = /* @__PURE__ */ __name((program, levels) => {
8838
+ granted.set(program, levels);
8839
+ }, "grantLevels");
8840
+ var grantedLevel = /* @__PURE__ */ __name((command, key) => {
8841
+ const levels = granted.get(rootOf(command));
8842
+ return levels === void 0 ? void 0 : levelFor(levels, key).level;
8843
+ }, "grantedLevel");
8844
+
8845
+ // dist/search/lane-gates.js
8846
+ var LANE_GATES = [
8847
+ {
8848
+ lane: "business",
8849
+ key: "business.list",
8850
+ // contracts, subscriptions, products and wallets have no memo command yet; their keys guard them once they do.
8851
+ kinds: {
8852
+ invoice: "invoices.list",
8853
+ payment: "payments.list",
8854
+ order: "orders.list",
8855
+ contract: "contracts.list",
8856
+ subscription: "subscriptions.list",
8857
+ product: "products.list",
8858
+ wallet: "wallets.list"
8859
+ }
8860
+ },
8861
+ { lane: "crm", key: "crm.list", kinds: { deal: "deals.list", lead: "leads.list" } }
8862
+ ];
8863
+ var LANE_KEYS = LANE_GATES.map(({ key }) => key);
8864
+ var leftOut = /* @__PURE__ */ __name((lane, what, key) => ({
8865
+ code: "permission_error",
8866
+ resource: lane,
8867
+ reason: `${what} left out: memo's MCP server denies ${key}`
8868
+ }), "leftOut");
8869
+ var lanesFor = /* @__PURE__ */ __name((command, asked) => {
8870
+ const lanes = asked ?? [...RESOURCES_SEARCHED];
8871
+ const denied = /* @__PURE__ */ __name((key) => grantedLevel(command, key) === "deny", "denied");
8872
+ const skipped = [];
8873
+ const hidden = /* @__PURE__ */ new Set();
8874
+ const off = /* @__PURE__ */ new Set();
8875
+ for (const gate of LANE_GATES) {
8876
+ if (!lanes.includes(gate.lane))
8877
+ continue;
8878
+ if (denied(gate.key)) {
8879
+ off.add(gate.lane);
8880
+ skipped.push(leftOut(gate.lane, gate.lane, gate.key));
8881
+ continue;
8882
+ }
8883
+ for (const [kind, key] of Object.entries(gate.kinds))
8884
+ if (denied(key)) {
8885
+ hidden.add(kind);
8886
+ skipped.push(leftOut(gate.lane, kind, key));
8887
+ }
8888
+ if (Object.keys(gate.kinds).every((kind) => hidden.has(kind)))
8889
+ off.add(gate.lane);
8890
+ }
8891
+ const shows = hidden.size ? { shows: /* @__PURE__ */ __name((item) => !hidden.has(item.kind), "shows") } : {};
8892
+ const crmKinds = DEAL_KINDS.filter((kind) => !hidden.has(kind));
8893
+ const narrowed = crmKinds.length < DEAL_KINDS.length && !off.has("crm") ? { crmKinds } : {};
8894
+ if (!off.size)
8895
+ return { only: asked, ...narrowed, skipped, ...shows };
8896
+ const only = lanes.filter((lane) => !off.has(lane));
8897
+ if (!only.length)
8898
+ throw new CliError("permission_error", `search all has nothing it may read: ${skipped.map(({ reason }) => reason).join("; ")}`, { reason: "search.all-denied" });
8899
+ return { only, ...narrowed, skipped, ...shows };
8900
+ }, "lanesFor");
8901
+
7199
8902
  // dist/config-issues.js
7200
8903
  var pathOf = /* @__PURE__ */ __name((command) => {
7201
8904
  const words2 = [];
@@ -7204,7 +8907,7 @@ var pathOf = /* @__PURE__ */ __name((command) => {
7204
8907
  return words2;
7205
8908
  }, "pathOf");
7206
8909
  var permissionKeyOf = /* @__PURE__ */ __name((command) => pathOf(command).join(".") || null, "permissionKeyOf");
7207
- var memoPermissionKeys = /* @__PURE__ */ __name((program) => knownPermissionKeys(program, permissionKeyOf, ["mcp.authority"]), "memoPermissionKeys");
8910
+ var memoPermissionKeys = /* @__PURE__ */ __name((program) => knownPermissionKeys(program, permissionKeyOf, ["mcp.authority", ...LANE_KEYS]), "memoPermissionKeys");
7208
8911
 
7209
8912
  // dist/notes/files.js
7210
8913
  import { closeSync, openSync, readdirSync, readSync } from "node:fs";
@@ -7597,6 +9300,9 @@ export {
7597
9300
  markItem,
7598
9301
  OWED_DAYS,
7599
9302
  mailReadCommands,
9303
+ grantLevels,
9304
+ grantedLevel,
9305
+ lanesFor,
7600
9306
  memoPermissionKeys,
7601
9307
  NOTE_EXTENSIONS,
7602
9308
  readMemoId,