@wirecat/zoom-cli 0.71.0 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/contracts/wirecat.json +1478 -0
  2. package/dist/account-removal.d.ts.map +1 -1
  3. package/dist/account-removal.js +0 -2
  4. package/dist/account-removal.js.map +1 -1
  5. package/dist/answers.d.ts +57 -3
  6. package/dist/answers.d.ts.map +1 -1
  7. package/dist/answers.js +0 -3
  8. package/dist/answers.js.map +1 -1
  9. package/dist/bin/main.js +13 -5
  10. package/dist/bin/main.js.map +1 -1
  11. package/dist/bin/zm.js +2 -2
  12. package/dist/bundle/{all-profiles-O4YNVPZX.js → all-profiles-V47CUJFK.js} +12 -12
  13. package/dist/bundle/answer-policy-W6H72X2R.js +112 -0
  14. package/dist/bundle/{anthropic-7GGRX3RX.js → anthropic-SID7Z3QN.js} +19 -12
  15. package/dist/bundle/{app-server-CPMKM3HI.js → app-server-KCMUSY4A.js} +75 -57
  16. package/dist/bundle/{bun-POHZKEPV.js → bun-PWMM6L45.js} +2 -2
  17. package/dist/bundle/{bun-sqlite-PGYMBPEL.js → bun-sqlite-3TLKUN5A.js} +10 -6
  18. package/dist/bundle/{chunk-Q3XLZIY3.js → chunk-2BAZRRJP.js} +29 -23
  19. package/dist/bundle/{chunk-OWEBWDHV.js → chunk-2NQPB6MT.js} +103 -9
  20. package/dist/bundle/chunk-2PYZTRRC.js +84 -0
  21. package/dist/bundle/chunk-2VYEGKQ3.js +13 -0
  22. package/dist/bundle/{chunk-I4DFFR7F.js → chunk-35CYSRGJ.js} +14 -5
  23. package/dist/bundle/{chunk-GGS6D4W4.js → chunk-3ADFJ3UP.js} +3 -3
  24. package/dist/bundle/{chunk-EOSVN2ER.js → chunk-3HTJBGNP.js} +242 -242
  25. package/dist/bundle/{chunk-2KESWII5.js → chunk-44YVZIA4.js} +3 -3
  26. package/dist/bundle/{chunk-GXF5HFFP.js → chunk-4LFFDUUW.js} +4 -4
  27. package/dist/bundle/{chunk-WOIHSQAL.js → chunk-4RJL32PF.js} +49 -10
  28. package/dist/bundle/{chunk-7ROXXRGG.js → chunk-6AO2RSYH.js} +7031 -5279
  29. package/dist/bundle/{chunk-DIQLXAAZ.js → chunk-6NI4FE5G.js} +6 -8
  30. package/dist/bundle/{chunk-X277FBTF.js → chunk-6WUTUCKH.js} +3 -3
  31. package/dist/bundle/{chunk-77TCCHMP.js → chunk-AIEMFRBU.js} +1 -1
  32. package/dist/bundle/{chunk-MRI6QMZ3.js → chunk-CIUJEQH4.js} +27 -19
  33. package/dist/bundle/{chunk-CRFOGYDG.js → chunk-CMWFYZ45.js} +2 -2
  34. package/dist/bundle/{chunk-LE7MDAQG.js → chunk-CQBLPBZU.js} +2 -2
  35. package/dist/bundle/{chunk-RQG5VOGH.js → chunk-DPSTOVKC.js} +185 -34
  36. package/dist/bundle/{chunk-4QUFFB2U.js → chunk-DYLYH7VE.js} +4 -4
  37. package/dist/bundle/{chunk-FEM2JQN2.js → chunk-EA2OB75T.js} +1 -1
  38. package/dist/bundle/chunk-ERQRY6WZ.js +54 -0
  39. package/dist/bundle/{chunk-P3XC6EDU.js → chunk-ETQNHS3A.js} +10 -129
  40. package/dist/bundle/{chunk-IAV5BG3I.js → chunk-EXWZCI5G.js} +1 -1
  41. package/dist/bundle/{chunk-VW6BF6M7.js → chunk-FIVFP53N.js} +1 -1
  42. package/dist/bundle/{chunk-DSVZEXYJ.js → chunk-FJMRDRPN.js} +3573 -3347
  43. package/dist/bundle/{chunk-7QC4M4HS.js → chunk-FT7X74RT.js} +4 -4
  44. package/dist/bundle/{chunk-ADLS6FVG.js → chunk-FXBHOCJK.js} +1 -1
  45. package/dist/bundle/{chunk-ZBFL5JPT.js → chunk-FZLJ2G7A.js} +22 -120
  46. package/dist/bundle/{chunk-GL3MYFMX.js → chunk-G2TSDMTA.js} +5 -5
  47. package/dist/bundle/{chunk-2FV5JUQU.js → chunk-G3SIY4MQ.js} +47 -40
  48. package/dist/bundle/{chunk-2U27KIKU.js → chunk-GCZMYDKU.js} +6 -6
  49. package/dist/bundle/{chunk-CKPCVEXU.js → chunk-HAMDPWEZ.js} +6 -6
  50. package/dist/bundle/{chunk-OE7EIP5L.js → chunk-HCZYJMBP.js} +1 -1
  51. package/dist/bundle/{chunk-OORMSM6O.js → chunk-HNWDEDMU.js} +61 -30
  52. package/dist/bundle/{chunk-FSHCAWZS.js → chunk-HO3GBTIT.js} +13464 -10422
  53. package/dist/bundle/chunk-IE7YBRUO.js +25 -0
  54. package/dist/bundle/{chunk-RGJ7OWHU.js → chunk-IJCUAKR5.js} +61 -21
  55. package/dist/bundle/{chunk-ULDXZ6LH.js → chunk-IKNOTHG2.js} +116 -70
  56. package/dist/bundle/{chunk-633QXP57.js → chunk-ILDGZBZD.js} +14 -9
  57. package/dist/bundle/{chunk-CFQF6IGY.js → chunk-JIS34MLC.js} +69 -6
  58. package/dist/bundle/{chunk-DHWBSXG3.js → chunk-JQF4LM3V.js} +415 -66
  59. package/dist/bundle/{chunk-4LAQDZXU.js → chunk-K5JFX5TK.js} +953 -210
  60. package/dist/bundle/{chunk-5LJTU4LY.js → chunk-K7EMVFJ7.js} +115 -113
  61. package/dist/bundle/chunk-KHBZ4OEP.js +16 -0
  62. package/dist/bundle/chunk-KK2IVZUQ.js +185 -0
  63. package/dist/bundle/{chunk-SELXER2Q.js → chunk-KQD4ZVNC.js} +7 -7
  64. package/dist/bundle/{chunk-VJXHIUFP.js → chunk-KSNJK4QM.js} +13 -13
  65. package/dist/bundle/{chunk-X4GWR6GO.js → chunk-KUL7S5Y3.js} +376 -10
  66. package/dist/bundle/{chunk-M76MXMLY.js → chunk-L6YSKCC3.js} +1 -1
  67. package/dist/bundle/chunk-LQYMN36C.js +73 -0
  68. package/dist/bundle/{chunk-USQ23X5V.js → chunk-LSVQCI6V.js} +751 -735
  69. package/dist/bundle/{chunk-DRBQDCDU.js → chunk-LVDTSCIN.js} +39 -122
  70. package/dist/bundle/{chunk-P3ASN72F.js → chunk-M4OP5ASJ.js} +1 -1
  71. package/dist/bundle/chunk-MAE5UGRQ.js +301 -0
  72. package/dist/bundle/{chunk-CT4WVR4N.js → chunk-MG2CCAVG.js} +3 -3
  73. package/dist/bundle/chunk-MOKEB656.js +71 -0
  74. package/dist/bundle/{chunk-BGTEVIW4.js → chunk-N3SOTKXC.js} +6 -6
  75. package/dist/bundle/{chunk-VRH7VRTK.js → chunk-NBA2V6LB.js} +10 -15
  76. package/dist/bundle/{chunk-5J4AMBMM.js → chunk-OFA22L4G.js} +4 -4
  77. package/dist/bundle/chunk-OKOJEBHK.js +106 -0
  78. package/dist/bundle/{chunk-Q5PI72CR.js → chunk-OMLVWOEF.js} +7 -2
  79. package/dist/bundle/{chunk-DK6ICIGL.js → chunk-OU5OXA6Q.js} +2150 -1312
  80. package/dist/bundle/{chunk-QVSLSWAL.js → chunk-P4FU6R3Z.js} +27 -152
  81. package/dist/bundle/{chunk-YPO2U2YB.js → chunk-PACLT6IW.js} +363 -115
  82. package/dist/bundle/{chunk-BBTQIVFP.js → chunk-PGPHEC2X.js} +2 -2
  83. package/dist/bundle/chunk-PJ3FKBXG.js +18 -0
  84. package/dist/bundle/{chunk-X3ZDN3U7.js → chunk-PKON63JH.js} +2 -2
  85. package/dist/bundle/{chunk-Q2SUFGSH.js → chunk-Q43KX56Z.js} +2 -2
  86. package/dist/bundle/{chunk-XI3VIQKW.js → chunk-QS6DWXDB.js} +569 -537
  87. package/dist/bundle/{chunk-INVTDIF6.js → chunk-QVJMFZFW.js} +1 -1
  88. package/dist/bundle/{chunk-QTHIU7CO.js → chunk-QWGEOQHA.js} +3 -2
  89. package/dist/bundle/{chunk-N2FNMION.js → chunk-R5FTCNLJ.js} +1 -1
  90. package/dist/bundle/{chunk-MW4EGDDV.js → chunk-SO52EJ2W.js} +2 -2
  91. package/dist/bundle/{chunk-HB6XJQ3Y.js → chunk-SYIOT45G.js} +5 -5
  92. package/dist/bundle/{chunk-4QPQ7MDA.js → chunk-TI2OANJZ.js} +1 -1
  93. package/dist/bundle/{chunk-ALIT5QFT.js → chunk-UIKVP23D.js} +1 -1
  94. package/dist/bundle/{chunk-OHWMIUCT.js → chunk-USIMMGWS.js} +244 -245
  95. package/dist/bundle/{chunk-MEED7YFG.js → chunk-UYBLNGZ2.js} +8 -2
  96. package/dist/bundle/{chunk-IED3NS7G.js → chunk-V5Q2QKYM.js} +29 -36
  97. package/dist/bundle/{chunk-54YDWBYG.js → chunk-VJVYGTPM.js} +15 -2
  98. package/dist/bundle/{chunk-5K7OGPGA.js → chunk-VPPNYUQM.js} +8 -8
  99. package/dist/bundle/{chunk-ZBKWRYRS.js → chunk-X2FILY5F.js} +3 -3
  100. package/dist/bundle/{chunk-2RUAMDVV.js → chunk-XLY7V2LB.js} +14 -14
  101. package/dist/bundle/chunk-XWBPP2HX.js +2 -0
  102. package/dist/bundle/{chunk-ZVI6TFQR.js → chunk-Y3IH7EZC.js} +17 -17
  103. package/dist/bundle/{chunk-YD2RYVMK.js → chunk-Z5XCU4S7.js} +46 -40
  104. package/dist/bundle/{chunk-RN4EHCC5.js → chunk-ZAIE3G5I.js} +3 -3
  105. package/dist/bundle/{chunk-2U6SER67.js → chunk-ZMHZ6CQS.js} +2 -2
  106. package/dist/bundle/{chunk-64ZHF6PJ.js → chunk-ZVQDOKDY.js} +3 -1
  107. package/dist/bundle/{chunk-TM4JSVGQ.js → chunk-ZX4QWTMQ.js} +42 -43
  108. package/dist/bundle/{cli-KHMEUXNG.js → cli-4ZYJ6OZE.js} +158 -88
  109. package/dist/bundle/command-contract-FJDDCHYP.js +43 -0
  110. package/dist/bundle/command-server-entry-CASONRIJ.js +173 -0
  111. package/dist/bundle/config-4DZHX2WX.js +99 -0
  112. package/dist/bundle/{decode-7RP4HSVE.js → decode-KEFCVGEB.js} +6 -6
  113. package/dist/bundle/{dispatch-IZCAK47P.js → dispatch-EU67WGME.js} +11 -11
  114. package/dist/bundle/{dist-BFT2SUBV.js → dist-GCQ7KCKN.js} +55 -30
  115. package/dist/bundle/{echarts-T2BSQ2YV.js → echarts-SDZA2SWG.js} +2 -2
  116. package/dist/bundle/{embed-BAS6YPDT.js → embed-43VJEPM6.js} +7 -7
  117. package/dist/bundle/{embedder-5XD5FCAO.js → embedder-Q4ZHAGRP.js} +10 -10
  118. package/dist/bundle/{failure-R2OIHCE5.js → failure-CTJLEB2R.js} +3 -3
  119. package/dist/bundle/first-run-CPOLQVNA.js +29 -0
  120. package/dist/bundle/first-screen-XYESRGWW.js +41 -0
  121. package/dist/bundle/folders-MSBTAPAG.js +24 -0
  122. package/dist/bundle/{instructions-XZPROPKY.js → instructions-7T6JJIFS.js} +1 -1
  123. package/dist/bundle/{main-TZXKGL3L.js → main-NA3QVPXS.js} +39 -25
  124. package/dist/bundle/{mcp-M4QN2E7R.js → mcp-TDKGDB4V.js} +2 -2
  125. package/dist/bundle/{meetings-JB2ISPND.js → meetings-7CVIQJTA.js} +9 -7
  126. package/dist/bundle/{node-A3B3MJWX.js → node-BZDMUFTW.js} +2 -2
  127. package/dist/bundle/{node-P4E63KXA.js → node-KM3CUABH.js} +9 -9
  128. package/dist/bundle/{node-sqlite-QVWDLGDX.js → node-sqlite-QHGB23B4.js} +11 -7
  129. package/dist/bundle/{oauth-YA6IYV4O.js → oauth-BMEMCM2I.js} +8 -8
  130. package/dist/bundle/{open-SY7TXJBS.js → open-JGU2NRJP.js} +6 -6
  131. package/dist/bundle/openai-VTXXFNCS.js +28 -0
  132. package/dist/bundle/{output-file-YGQYZCBJ.js → output-file-VDOCYH2G.js} +6 -6
  133. package/dist/bundle/{process-6HNBTJIY.js → process-756VBE7E.js} +1 -1
  134. package/dist/bundle/{program-77BUCJ4H.js → program-XM6CDIJ2.js} +134 -129
  135. package/dist/bundle/{prompt-YDG73YDS.js → prompt-2IPFXJ4B.js} +6 -6
  136. package/dist/bundle/{recognize-ECXDGTB7.js → recognize-672E2RIB.js} +5 -5
  137. package/dist/bundle/{remote-K4JHGBVJ.js → remote-YLHRVPDS.js} +11 -8
  138. package/dist/bundle/{rerank-IU2YYD4T.js → rerank-NBXQG3OS.js} +8 -8
  139. package/dist/bundle/run-log-3WITBT2F.js +126 -0
  140. package/dist/bundle/{serve-3XWIF3HI.js → serve-FNLOUMYP.js} +10 -10
  141. package/dist/bundle/{server-56VYOHWP.js → server-7ZB5AK5H.js} +53 -47
  142. package/dist/bundle/server-GGRGD4SH.js +77 -0
  143. package/dist/bundle/{services-X7IPEGQ5.js → services-Z4UWN64R.js} +56 -37
  144. package/dist/bundle/{speech-E2OBQWYA.js → speech-XSYVCKR3.js} +17 -14
  145. package/dist/bundle/sqlite-runtime-GAPXJNWU.js +20 -0
  146. package/dist/bundle/{state-4GMJYK4H.js → state-QSA53EF5.js} +7 -7
  147. package/dist/bundle/{store-LA4TV4DM.js → store-EKI4OAJH.js} +22 -19
  148. package/dist/bundle/{store-KPI7GB5Y.js → store-NOF5EYUC.js} +38 -21
  149. package/dist/bundle/store-connection-2OZQGEIO.js +92 -0
  150. package/dist/bundle/store-maintenance-command-GNX3SOZ6.js +67 -0
  151. package/dist/bundle/{streaming-EJ3NM2C2.js → streaming-PQEXKTE5.js} +7 -7
  152. package/dist/bundle/tokens-WJQYQ3FK.js +24 -0
  153. package/dist/bundle/zm.js +34 -10
  154. package/dist/bundle/{zoom-app-QEJBTIJ4.js → zoom-app-Y7RMWLVU.js} +9 -8
  155. package/dist/folders.d.ts +12 -2
  156. package/dist/folders.d.ts.map +1 -1
  157. package/dist/folders.js +81 -3
  158. package/dist/folders.js.map +1 -1
  159. package/dist/identity.d.ts +5 -0
  160. package/dist/identity.d.ts.map +1 -1
  161. package/dist/identity.js +14 -0
  162. package/dist/identity.js.map +1 -1
  163. package/dist/recording-schedule-setup.d.ts.map +1 -1
  164. package/dist/recording-schedule-setup.js +4 -7
  165. package/dist/recording-schedule-setup.js.map +1 -1
  166. package/dist/remote-http.d.ts +1 -1
  167. package/dist/remote-http.d.ts.map +1 -1
  168. package/dist/remote-http.js +21 -23
  169. package/dist/remote-http.js.map +1 -1
  170. package/dist/setup-commands.d.ts.map +1 -1
  171. package/dist/setup-commands.js +2 -4
  172. package/dist/setup-commands.js.map +1 -1
  173. package/dist/tokens.d.ts +17 -2
  174. package/dist/tokens.d.ts.map +1 -1
  175. package/dist/tokens.js +109 -29
  176. package/dist/tokens.js.map +1 -1
  177. package/dist/version.d.ts +1 -1
  178. package/dist/version.js +1 -1
  179. package/dist/wcat.d.ts +3 -0
  180. package/dist/wcat.d.ts.map +1 -0
  181. package/dist/wcat.js +4 -0
  182. package/dist/wcat.js.map +1 -0
  183. package/package.json +15 -14
  184. package/dist/bundle/answer-policy-PPSPMCLH.js +0 -104
  185. package/dist/bundle/chunk-KMV7GZB6.js +0 -35
  186. package/dist/bundle/chunk-UG447QY2.js +0 -27
  187. package/dist/bundle/chunk-XRFHQGOD.js +0 -17
  188. package/dist/bundle/command-contract-4K6XXZYE.js +0 -41
  189. package/dist/bundle/config-EEDB632I.js +0 -90
  190. package/dist/bundle/first-run-23WWZ2PW.js +0 -28
  191. package/dist/bundle/first-screen-6HFUYVFR.js +0 -39
  192. package/dist/bundle/folders-ZXTOFY4T.js +0 -16
  193. package/dist/bundle/openai-2AU24NRN.js +0 -25
  194. package/dist/bundle/run-log-LFEXNZ74.js +0 -118
  195. package/dist/bundle/server-YSTMUZ22.js +0 -72
  196. package/dist/bundle/store-connection-AZTIF6IH.js +0 -83
  197. package/dist/bundle/store-maintenance-command-LR572PS4.js +0 -61
  198. package/dist/bundle/tokens-BE6CJMR5.js +0 -20
  199. /package/dist/bundle/{chunk-VOXIGICJ.js → chunk-7O7XM37N.js} +0 -0
@@ -1,5 +1,8 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ fold
5
+ } from "./chunk-KHBZ4OEP.js";
3
6
  import {
4
7
  CATALOG_KINDS,
5
8
  CONTRACT_KINDS,
@@ -13,20 +16,32 @@ import {
13
16
  ORDER_STATUSES,
14
17
  SUBSCRIPTION_STATUSES,
15
18
  TRANSACTION_STATUSES,
16
- WALLET_KINDS
17
- } from "./chunk-XI3VIQKW.js";
19
+ WALLET_KINDS,
20
+ looksLikeReference,
21
+ parseReference,
22
+ providerLabel,
23
+ providerNamed
24
+ } from "./chunk-QS6DWXDB.js";
18
25
  import {
19
26
  holdsCredential,
20
27
  secretNamed
21
- } from "./chunk-QTHIU7CO.js";
28
+ } from "./chunk-QWGEOQHA.js";
29
+ import {
30
+ QUERY_LIMITS,
31
+ queryError
32
+ } from "./chunk-3HTJBGNP.js";
22
33
  import {
23
- CliError
24
- } from "./chunk-FEM2JQN2.js";
34
+ CliError,
35
+ isCliError
36
+ } from "./chunk-EA2OB75T.js";
37
+ import {
38
+ singleLine
39
+ } from "./chunk-HCZYJMBP.js";
25
40
  import {
26
41
  __name
27
42
  } from "./chunk-ZVVMGPBJ.js";
28
43
 
29
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
44
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
30
45
  var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
31
46
  var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
32
47
  var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
@@ -145,7 +160,7 @@ var fieldError = /* @__PURE__ */ __name((schema, value, at = []) => {
145
160
  return void 0;
146
161
  }, "fieldError");
147
162
 
148
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/record-types.js
163
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/record-types.js
149
164
  var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
150
165
  var PARTY = ["person", "organization"];
151
166
  var ORGANIZATION = ["organization"];
@@ -443,6 +458,7 @@ var RECORD_TYPES = {
443
458
  update: "in-place",
444
459
  tombstone: true,
445
460
  importOnly: true,
461
+ sheet: false,
446
462
  fields: objectOf({
447
463
  kind: enumOf(["sms"], "sms: a text message of the phone"),
448
464
  direction: enumOf(SMS_DIRECTIONS, "in: the other side wrote it; out: the owner did"),
@@ -460,6 +476,7 @@ var RECORD_TYPES = {
460
476
  update: "in-place",
461
477
  tombstone: true,
462
478
  importOnly: true,
479
+ sheet: false,
463
480
  fields: objectOf({
464
481
  kind: enumOf(["call"], "call: a phone call"),
465
482
  direction: enumOf(CALL_DIRECTIONS, "in, out, or missed: a call the owner did not take"),
@@ -469,6 +486,25 @@ var RECORD_TYPES = {
469
486
  }, { required: ["kind", "direction", "phone", "started_at"] }),
470
487
  roles: COUNTERPART
471
488
  },
489
+ document: {
490
+ table: "documents",
491
+ review: "direct",
492
+ update: "in-place",
493
+ tombstone: true,
494
+ importOnly: true,
495
+ fieldsBytes: 1048576,
496
+ fields: objectOf({
497
+ title: text("What the document is called; its external id when left out", 500),
498
+ text: { type: "string", maxLength: 1e6, description: "The text search reads" },
499
+ created_at: instant("When the source made it"),
500
+ updated_at: instant("When the source last changed it: what date: reads"),
501
+ url: text("Where the original is", 4096),
502
+ metadata: { type: "object", description: "Anything else the source knows about it, kept as sent" }
503
+ }, { required: ["text"] }),
504
+ roles: {
505
+ about: { targets: ["person", "organization", "deal", "event"], many: true }
506
+ }
507
+ },
472
508
  pipeline: {
473
509
  table: "pipelines",
474
510
  review: "direct",
@@ -489,7 +525,7 @@ var RECORD_TYPES = {
489
525
  }
490
526
  };
491
527
  var isRecordType = /* @__PURE__ */ __name((type) => Object.hasOwn(RECORD_TYPES, type), "isRecordType");
492
- var isBusinessType = /* @__PURE__ */ __name((type) => isRecordType(type) && RECORD_TYPES[type].review !== "identity", "isBusinessType");
528
+ var isBusinessType = /* @__PURE__ */ __name((type) => isRecordType(type) && RECORD_TYPES[type].review !== "identity" && type !== "document", "isBusinessType");
493
529
  var isIdentityType = /* @__PURE__ */ __name((type) => typeof type === "string" && isRecordType(type) && RECORD_TYPES[type].review === "identity", "isIdentityType");
494
530
  var RECORD_ENTITY_TYPES = Object.keys(RECORD_TYPES);
495
531
  var RECORD_TABLES = Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, spec]) => [type, spec.table]));
@@ -519,44 +555,7 @@ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf(type).some(([, role])
519
555
  var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
520
556
  var article = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
521
557
 
522
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/counters.js
523
- var COUNTER_FIELDS = ["views", "reactions", "comments"];
524
- var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
525
- var counterValue = /* @__PURE__ */ __name((message, field) => {
526
- const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
527
- return validCounter(value) ? value : null;
528
- }, "counterValue");
529
- var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
530
- const at = Date.parse(observation.observedAt);
531
- if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
532
- throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
533
- if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
534
- throw new CliError("validation_error", "reaction observation payload and total disagree");
535
- return at;
536
- }, "counterObservationTime");
537
- var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
538
- const observations = {};
539
- for (const field of fields) {
540
- const value = counterValue(message, field);
541
- if (value !== null)
542
- observations[field] = {
543
- value,
544
- observedAt,
545
- source,
546
- ...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
547
- };
548
- }
549
- return { ...message, counterObservations: observations };
550
- }, "observedCounters");
551
- var counterFreshness = /* @__PURE__ */ __name((states) => {
552
- if (!states.length || states.every((one) => one.freshness === "unknown"))
553
- return "unknown";
554
- if (states.some((one) => one.freshness === "unknown"))
555
- return "partial";
556
- return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
557
- }, "counterFreshness");
558
-
559
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/addresses.js
558
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/addresses.js
560
559
  var EMAIL_ADDRESS = /^[^\s@]+@[^\s@]+\.[^\s@]+$/u;
561
560
  var isEmailAddress = /* @__PURE__ */ __name((value) => EMAIL_ADDRESS.test(value), "isEmailAddress");
562
561
  var ROLE_ADDRESS_WORDS = {
@@ -614,152 +613,11 @@ var localWord = /* @__PURE__ */ __name((address) => {
614
613
  return bare(local.split("+")[0] ?? "");
615
614
  }, "localWord");
616
615
  var isRoleAddress = /* @__PURE__ */ __name((address) => ROLE.has(localWord(address)), "isRoleAddress");
616
+ var PERSON_LIKE = /* @__PURE__ */ new Set(["hr"]);
617
+ var isPersonLikeRoleAddress = /* @__PURE__ */ __name((address) => PERSON_LIKE.has(localWord(address)), "isPersonLikeRoleAddress");
617
618
  var isNoReplyAddress = /* @__PURE__ */ __name((address) => NO_REPLY.has(localWord(address)), "isNoReplyAddress");
618
619
 
619
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
620
- var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
621
- var AUTHOR_MEASURES = [
622
- "messages",
623
- "words",
624
- "reactions",
625
- "replies",
626
- "answers",
627
- "answer-time",
628
- "threads",
629
- "active-days"
630
- ];
631
- var CONTEXT = /* @__PURE__ */ new Set([
632
- "replies",
633
- "replies-from-others",
634
- "replies-from-others-per-message",
635
- "thread-size",
636
- "threads",
637
- "answers",
638
- "answer-time"
639
- ]);
640
- var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
641
- var presets = {
642
- helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
643
- active: { "active-days": 0.6, messages: 0.4 },
644
- engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
645
- };
646
- function invalid(message) {
647
- throw new CliError("validation_error", message, { reason: "ranking.invalid" });
648
- }
649
- __name(invalid, "invalid");
650
- var rankingOptions = /* @__PURE__ */ __name((target, input) => {
651
- const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
652
- const { measure, score, weights: given, minMessages } = input;
653
- const messageKind = input.messageKind ?? "all";
654
- if (!["all", "posts", "comments"].includes(messageKind))
655
- invalid("message_kind takes all, posts or comments");
656
- if (target === "messages" && minMessages !== void 0)
657
- invalid("min_messages applies to stats contacts top");
658
- if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
659
- invalid("min_messages takes a positive integer");
660
- if (measure !== void 0 && !measures.includes(measure))
661
- invalid(`--measure takes ${measures.join(", ")}`);
662
- if (measure !== void 0 && (score !== void 0 || given !== void 0))
663
- invalid("--measure cannot be combined with --score or --weights");
664
- if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
665
- invalid("--score takes helpful, active or engaging");
666
- if (target === "messages" && score !== void 0 && score !== "engaging")
667
- invalid("helpful and active scores apply to authors only");
668
- const scoring = score !== void 0 || given !== void 0;
669
- const preset = score;
670
- let weights = null;
671
- if (scoring) {
672
- let raw = given !== void 0 ? given : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
673
- if (typeof raw === "string") {
674
- try {
675
- raw = JSON.parse(raw);
676
- } catch {
677
- invalid("--weights takes a JSON object of component weights");
678
- }
679
- }
680
- if (!raw || typeof raw !== "object" || Array.isArray(raw))
681
- invalid("--weights takes a JSON object of component weights");
682
- const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
683
- ...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
684
- "replies-from-others",
685
- "reactions-per-message",
686
- "replies-from-others-per-message"
687
- ];
688
- const entries = Object.entries(raw);
689
- for (const [name, weight] of entries) {
690
- if (!allowed.includes(name))
691
- invalid(`unknown ${target} score component: ${name}`);
692
- if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
693
- invalid(`weight for ${name} must be a finite nonnegative number`);
694
- }
695
- if (!entries.some(([, weight]) => weight > 0))
696
- invalid("--weights needs at least one positive weight");
697
- weights = Object.fromEntries(entries);
698
- }
699
- const selected = measure ?? (target === "messages" ? "reactions" : "messages");
700
- return {
701
- target,
702
- messageKind,
703
- minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
704
- measure: scoring ? "score" : selected,
705
- order: !scoring && selected === "answer-time" ? "ascending" : "descending",
706
- weights,
707
- preset: scoring ? preset ?? "custom" : null,
708
- components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
709
- };
710
- }, "rankingOptions");
711
- var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
712
- const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
713
- const scale = Math.max(...entries.map(([, weight]) => weight));
714
- const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
715
- if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
716
- return null;
717
- const normalized = {};
718
- const contributions = {};
719
- let sum = 0;
720
- for (const [name, weight] of entries) {
721
- const value = raw[name];
722
- const maximum = maxima[name];
723
- if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
724
- return null;
725
- const part = maximum === 0 ? 0 : value / maximum;
726
- normalized[name] = part;
727
- contributions[name] = 100 * part * (weight / scale) / denominator;
728
- sum += contributions[name];
729
- }
730
- return { score: Math.min(100, sum), normalized, contributions };
731
- }, "rankingScore");
732
- var RANKING_TOKENIZER_VERSION = 1;
733
- var withoutUrls = /* @__PURE__ */ __name((text2) => text2.replace(/\S+/gu, (token) => {
734
- for (let offset = 0; ; ) {
735
- const marker = token.indexOf("://", offset);
736
- if (marker < 0)
737
- break;
738
- let start = marker;
739
- while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
740
- start--;
741
- if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
742
- return token.slice(0, start);
743
- offset = marker + 3;
744
- }
745
- const folded = token.toLowerCase();
746
- for (let offset = 0; ; ) {
747
- const start = folded.indexOf("www.", offset);
748
- if (start < 0)
749
- break;
750
- if (start === 0 || !/\w/u.test(token[start - 1]))
751
- return token.slice(0, start);
752
- offset = start + 4;
753
- }
754
- return token;
755
- }), "withoutUrls");
756
- var rankingWords = /* @__PURE__ */ __name((text2) => withoutUrls(text2).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
757
- var rankingQuestion = /* @__PURE__ */ __name((text2) => withoutUrls(text2).includes("?"), "rankingQuestion");
758
-
759
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/records.js
760
- import { createHash } from "node:crypto";
761
-
762
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
620
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
763
621
  var PHONE_PLANS = [
764
622
  {
765
623
  country: "us",
@@ -1139,7 +997,7 @@ var PHONE_PLANS = [
1139
997
  }
1140
998
  ];
1141
999
 
1142
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/phones.js
1000
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/phones.js
1143
1001
  var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
1144
1002
  var DEFAULT_PHONE_COUNTRIES = ["ru"];
1145
1003
  var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
@@ -1203,6 +1061,7 @@ var e164Of = /* @__PURE__ */ __name((phone, region) => {
1203
1061
  const digits = phone.replace(/\(0\)/, "").replace(/\D/g, "");
1204
1062
  return nationalPhone(digits, [region], { anyType: true })?.value;
1205
1063
  }, "e164Of");
1064
+ var isMobilePhone = /* @__PURE__ */ __name((e164) => /^\+\d+$/.test(e164) && PHONE_COUNTRIES.some((country) => nationalPhone(e164.slice(1), [country], { anyType: false })?.value === e164), "isMobilePhone");
1206
1065
  var BARE_INTERNATIONAL_PROVIDERS = ["telegram", "max", "whatsapp"];
1207
1066
  var storedPhone = /* @__PURE__ */ __name((raw, provider) => {
1208
1067
  if (/^\s*(\+|00)/.test(raw))
@@ -1213,7 +1072,828 @@ var storedPhone = /* @__PURE__ */ __name((raw, provider) => {
1213
1072
  return found ? `+${found[1]}` : void 0;
1214
1073
  }, "storedPhone");
1215
1074
 
1216
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/records.js
1075
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
1076
+ var QUERY_VERSION = 1;
1077
+ var QUERY_LIMITS2 = {
1078
+ ...QUERY_LIMITS,
1079
+ pattern: 1024,
1080
+ states: 1e4,
1081
+ expansions: 1e4,
1082
+ candidates: 5e4,
1083
+ bodyBytes: 8388608,
1084
+ milliseconds: 2e3,
1085
+ work: 1e7
1086
+ };
1087
+ var SEARCH_QUERY = {
1088
+ command: "search",
1089
+ guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md"
1090
+ };
1091
+ var MESSAGE_PARSING = { ...SEARCH_QUERY, proximity: true };
1092
+ var MOST_WORDS_APART = 50;
1093
+ function searchError(reason, span, alternative) {
1094
+ queryError(reason, span, alternative, SEARCH_QUERY);
1095
+ }
1096
+ __name(searchError, "searchError");
1097
+ var ANSWER_MS = 1e3;
1098
+ var searchTimeLimit = /* @__PURE__ */ __name((deadline, now = Date.now()) => deadline?.explicit ? Math.max(QUERY_LIMITS2.milliseconds, deadline.endsAt - now - ANSWER_MS) : void 0, "searchTimeLimit");
1099
+ function outOfTime(limitMs = QUERY_LIMITS2.milliseconds) {
1100
+ throw new CliError("timeout", `search stopped at its time limit of ${limitMs / 1e3}s \u2014 the query is valid; add chat: or date: to search less of the store`, { reason: "query.time-limit", budget: "time", limit_ms: limitMs, complete: false });
1101
+ }
1102
+ __name(outOfTime, "outOfTime");
1103
+ var isQueryLimit = /* @__PURE__ */ __name((error) => isCliError(error) && (error.details.reason === "query.too-large" || error.details.reason === "query.time-limit"), "isQueryLimit");
1104
+ function exhausted(budget) {
1105
+ throw new CliError("validation_error", `search exceeded its ${budget} budget \u2014 narrow the chat or date range`, {
1106
+ reason: "query.too-large",
1107
+ budget,
1108
+ complete: false
1109
+ });
1110
+ }
1111
+ __name(exhausted, "exhausted");
1112
+ function tooWideTerm([term], budget) {
1113
+ if (term === void 0)
1114
+ exhausted(budget);
1115
+ const part = term.replace(/[*?]+/gu, " ").trim().split(/\s+/u).sort((a, b) => b.length - a.length)[0] ?? term;
1116
+ throw new CliError("validation_error", `search exceeded its ${budget} budget: ${term} is checked word by word, and too many messages hold it \u2014 write *${part}* (any word holding it, read from the index), more of the word, or add chat: or date:`, { reason: "query.too-large", budget, term, complete: false });
1117
+ }
1118
+ __name(tooWideTerm, "tooWideTerm");
1119
+
1120
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
1121
+ var TAKES = {
1122
+ chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
1123
+ message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
1124
+ };
1125
+ var article2 = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
1126
+ var wrongKind = /* @__PURE__ */ __name((text2, kind, takes) => new CliError("validation_error", `${text2} names ${article2(kind)} ${kind}; this takes ${TAKES[takes]}`, {
1127
+ reason: "ref.wrong-kind"
1128
+ }), "wrongKind");
1129
+ var wrongProvider = /* @__PURE__ */ __name((text2, provider, kind) => {
1130
+ const entry = providerNamed(provider);
1131
+ const command = entry?.command;
1132
+ const opens = kind === "entity" ? void 0 : entry?.opens?.[kind];
1133
+ const how = command && opens ? `open it with ${command} <profile> ${opens} ${text2}` : "open it with its own CLI";
1134
+ const label2 = providerLabel(provider);
1135
+ return new CliError("validation_error", `${text2} is ${article2(label2.toLowerCase())} ${label2} ${kind}; ${how}`, {
1136
+ reason: "ref.wrong-provider"
1137
+ });
1138
+ }, "wrongProvider");
1139
+ var chatReferenceOf = /* @__PURE__ */ __name((text2, provider, takes = "chat") => {
1140
+ const trimmed = text2.trim();
1141
+ if (!looksLikeReference(trimmed))
1142
+ return void 0;
1143
+ const reference = parseReference(trimmed);
1144
+ if (reference.type !== "chat" && reference.type !== "message")
1145
+ throw wrongKind(trimmed, reference.type, takes);
1146
+ if (reference.provider !== provider)
1147
+ throw wrongProvider(trimmed, reference.provider, reference.type);
1148
+ const found = {
1149
+ text: trimmed,
1150
+ provider: reference.provider,
1151
+ account: reference.account,
1152
+ chat: reference.chat,
1153
+ ...reference.type === "message" ? { message: reference.message } : {}
1154
+ };
1155
+ return found;
1156
+ }, "chatReferenceOf");
1157
+ var contactReferenceOf = /* @__PURE__ */ __name((text2, provider) => {
1158
+ const trimmed = text2.trim();
1159
+ if (!trimmed.startsWith("contact:"))
1160
+ return void 0;
1161
+ const reference = parseReference(trimmed);
1162
+ if (reference.type !== "contact")
1163
+ return void 0;
1164
+ if (provider !== void 0 && reference.provider !== provider)
1165
+ throw wrongProvider(trimmed, reference.provider, reference.type);
1166
+ return reference.id;
1167
+ }, "contactReferenceOf");
1168
+ var wrongAccount = /* @__PURE__ */ __name((reference, scope, profiles) => {
1169
+ const here = scope.account === void 0 ? "the account of this profile is not known yet" : `${scope.profile === void 0 ? "this profile" : `profile ${scope.profile}`} is account ${scope.account}`;
1170
+ const others = profiles === void 0 ? "" : `. Profiles signed in to ${reference.account}: ${profiles.length > 0 ? profiles.join(", ") : "none here"}`;
1171
+ return new CliError("validation_error", `${reference.text} belongs to account ${reference.account}; ${here}${others}`, { reason: "ref.wrong-account" });
1172
+ }, "wrongAccount");
1173
+ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn) => {
1174
+ if (scope.account !== void 0 && scope.account === reference.account)
1175
+ return;
1176
+ const profiles = await profilesOn?.(reference.account).catch(() => void 0);
1177
+ throw wrongAccount(reference, scope, profiles);
1178
+ }, "ensureAccount");
1179
+
1180
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
1181
+ var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
1182
+ var literal = /* @__PURE__ */ __name((c) => ({
1183
+ kind: "char",
1184
+ ranges: [[c.codePointAt(0) ?? 0, c.codePointAt(0) ?? 0]],
1185
+ negate: false
1186
+ }), "literal");
1187
+ var compileAutomaton = /* @__PURE__ */ __name((pattern, span = { start: 0, end: pattern.length }) => {
1188
+ if (pattern.length > QUERY_LIMITS2.pattern * 2)
1189
+ exhausted("pattern");
1190
+ const chars = [...pattern];
1191
+ if (chars.length > QUERY_LIMITS2.pattern)
1192
+ exhausted("pattern");
1193
+ let at = 0, depth = 0;
1194
+ const failure = /* @__PURE__ */ __name(() => searchError("query.invalid-regex", span, "use the supported Lucene regex subset"), "failure");
1195
+ const character = /* @__PURE__ */ __name(() => {
1196
+ if (at >= chars.length)
1197
+ return failure();
1198
+ return chars[at++];
1199
+ }, "character");
1200
+ const predefined = /* @__PURE__ */ __name(() => {
1201
+ if (chars[at] !== "\\")
1202
+ return void 0;
1203
+ const name = chars[at + 1] ?? "";
1204
+ let ranges;
1205
+ if (name.toLowerCase() === "d")
1206
+ ranges = [[48, 57]];
1207
+ if (name.toLowerCase() === "w")
1208
+ ranges = [
1209
+ [48, 57],
1210
+ [65, 90],
1211
+ [95, 95],
1212
+ [97, 122]
1213
+ ];
1214
+ if (name.toLowerCase() === "s")
1215
+ ranges = [
1216
+ [9, 10],
1217
+ [13, 13],
1218
+ [32, 32]
1219
+ ];
1220
+ if (ranges) {
1221
+ at += 2;
1222
+ return { kind: "char", ranges, negate: name === name.toUpperCase() };
1223
+ }
1224
+ if (/^[a-zA-Z]$/u.test(name))
1225
+ return failure();
1226
+ return void 0;
1227
+ }, "predefined");
1228
+ const escaped = /* @__PURE__ */ __name(() => {
1229
+ if (chars[at] === "\\")
1230
+ at++;
1231
+ return character();
1232
+ }, "escaped");
1233
+ const union = /* @__PURE__ */ __name(() => {
1234
+ if (++depth > QUERY_LIMITS2.depth)
1235
+ exhausted("pattern depth");
1236
+ const children = [concat()];
1237
+ while (chars[at] === "|") {
1238
+ at++;
1239
+ children.push(concat());
1240
+ }
1241
+ depth--;
1242
+ return children.length === 1 ? children[0] : { kind: "union", children };
1243
+ }, "union");
1244
+ const concat = /* @__PURE__ */ __name(() => {
1245
+ const children = [];
1246
+ do {
1247
+ children.push(repeat());
1248
+ } while (at < chars.length && ![")", "|", "&"].includes(chars[at] ?? ""));
1249
+ if (chars[at] === "&")
1250
+ searchError("query.unsupported-regex", span, "automaton intersection is not supported");
1251
+ return children.length === 1 ? children[0] : { kind: "concat", children };
1252
+ }, "concat");
1253
+ const repeat = /* @__PURE__ */ __name(() => {
1254
+ let child = simple();
1255
+ while (["?", "*", "+", "{"].includes(chars[at] ?? "")) {
1256
+ const op = character();
1257
+ let min = op === "+" ? 1 : 0, max = op === "?" ? 1 : null;
1258
+ if (op === "{") {
1259
+ const number = /* @__PURE__ */ __name(() => {
1260
+ const start2 = at;
1261
+ while (/^[0-9]$/u.test(chars[at] ?? ""))
1262
+ at++;
1263
+ if (at === start2)
1264
+ return failure();
1265
+ return Number(chars.slice(start2, at).join(""));
1266
+ }, "number");
1267
+ min = number();
1268
+ max = min;
1269
+ if (chars[at] === ",") {
1270
+ at++;
1271
+ max = chars[at] === "}" ? null : number();
1272
+ }
1273
+ if (character() !== "}" || max !== null && max < min)
1274
+ return failure();
1275
+ }
1276
+ if (min > QUERY_LIMITS2.states || max !== null && max > QUERY_LIMITS2.states)
1277
+ exhausted("automaton states");
1278
+ child = { kind: "repeat", child, min, max };
1279
+ }
1280
+ return child;
1281
+ }, "repeat");
1282
+ const simple = /* @__PURE__ */ __name(() => {
1283
+ const predefinedAtom = predefined();
1284
+ if (predefinedAtom)
1285
+ return predefinedAtom;
1286
+ const c = character();
1287
+ if (c === "~" || c === "<")
1288
+ searchError("query.unsupported-regex", span, "complement, named automata and numeric intervals are not supported");
1289
+ if (c === ".")
1290
+ return any;
1291
+ if (c === "#")
1292
+ return { kind: "empty" };
1293
+ if (c === "@")
1294
+ return { kind: "repeat", child: any, min: 0, max: null };
1295
+ if (c === '"') {
1296
+ const children = [];
1297
+ while (chars[at] !== '"')
1298
+ children.push(literal(character()));
1299
+ at++;
1300
+ return { kind: "concat", children };
1301
+ }
1302
+ if (c === "(") {
1303
+ if (chars[at] === ")") {
1304
+ at++;
1305
+ return { kind: "epsilon" };
1306
+ }
1307
+ if (chars[at] === "?")
1308
+ searchError("query.unsupported-regex", span, "JavaScript groups and lookaround are not Lucene operators");
1309
+ const child = union();
1310
+ if (character() !== ")")
1311
+ return failure();
1312
+ return child;
1313
+ }
1314
+ if (c === "[") {
1315
+ const negate = chars[at] === "^";
1316
+ if (negate)
1317
+ at++;
1318
+ const choices = [];
1319
+ do {
1320
+ const pre = predefined();
1321
+ if (pre) {
1322
+ choices.push(pre);
1323
+ continue;
1324
+ }
1325
+ const lo = escaped().codePointAt(0) ?? 0;
1326
+ let hi = lo;
1327
+ if (chars[at] === "-") {
1328
+ at++;
1329
+ hi = escaped().codePointAt(0) ?? 0;
1330
+ }
1331
+ if (hi < lo)
1332
+ return failure();
1333
+ choices.push({ kind: "char", ranges: [[lo, hi]], negate: false });
1334
+ } while (at < chars.length && chars[at] !== "]");
1335
+ if (character() !== "]")
1336
+ return failure();
1337
+ if (!negate)
1338
+ return { kind: "union", children: choices };
1339
+ const ranges = [];
1340
+ for (const choice of choices) {
1341
+ if (choice.kind !== "char" || choice.negate)
1342
+ searchError("query.unsupported-regex", span, "negative predefined classes inside a negated class are not supported");
1343
+ ranges.push(...choice.ranges);
1344
+ }
1345
+ return { kind: "char", ranges, negate: true };
1346
+ }
1347
+ if (c === "\\")
1348
+ return literal(character());
1349
+ return literal(c);
1350
+ }, "simple");
1351
+ const expression = chars.length === 0 ? { kind: "epsilon" } : union();
1352
+ if (at !== chars.length)
1353
+ return failure();
1354
+ const states = [];
1355
+ const state = /* @__PURE__ */ __name(() => {
1356
+ if (states.length >= QUERY_LIMITS2.states)
1357
+ exhausted("automaton states");
1358
+ states.push({ epsilon: [], edges: [] });
1359
+ return states.length - 1;
1360
+ }, "state");
1361
+ const epsilon = /* @__PURE__ */ __name((from, to) => {
1362
+ ;
1363
+ states[from].epsilon.push(to);
1364
+ }, "epsilon");
1365
+ const build = /* @__PURE__ */ __name((node, from, to) => {
1366
+ if (node.kind === "char") {
1367
+ ;
1368
+ states[from].edges.push({ to, atom: node });
1369
+ return;
1370
+ }
1371
+ if (node.kind === "empty")
1372
+ return;
1373
+ if (node.kind === "epsilon") {
1374
+ epsilon(from, to);
1375
+ return;
1376
+ }
1377
+ if (node.kind === "union") {
1378
+ for (const child of node.children)
1379
+ build(child, from, to);
1380
+ return;
1381
+ }
1382
+ if (node.kind === "concat") {
1383
+ let current2 = from;
1384
+ node.children.forEach((child, index) => {
1385
+ const next = index === node.children.length - 1 ? to : state();
1386
+ build(child, current2, next);
1387
+ current2 = next;
1388
+ });
1389
+ if (node.children.length === 0)
1390
+ epsilon(from, to);
1391
+ return;
1392
+ }
1393
+ let current = from;
1394
+ for (let i = 0; i < node.min; i++) {
1395
+ const next = state();
1396
+ build(node.child, current, next);
1397
+ current = next;
1398
+ }
1399
+ if (node.max === null) {
1400
+ epsilon(current, to);
1401
+ const end2 = state();
1402
+ build(node.child, current, end2);
1403
+ epsilon(end2, current);
1404
+ } else {
1405
+ for (let i = node.min; i < node.max; i++) {
1406
+ epsilon(current, to);
1407
+ const next = state();
1408
+ build(node.child, current, next);
1409
+ current = next;
1410
+ }
1411
+ epsilon(current, to);
1412
+ }
1413
+ }, "build");
1414
+ const start = state(), end = state();
1415
+ build(expression, start, end);
1416
+ return {
1417
+ states: states.length,
1418
+ test: /* @__PURE__ */ __name((text2, budget = { work: 0 }) => {
1419
+ const spend = /* @__PURE__ */ __name(() => {
1420
+ if (++budget.work > (budget.maxWork ?? QUERY_LIMITS2.work))
1421
+ exhausted("automaton work");
1422
+ }, "spend");
1423
+ const closure = /* @__PURE__ */ __name((initial) => {
1424
+ const stack = [...initial];
1425
+ while (stack.length) {
1426
+ const id = stack.pop();
1427
+ for (const next of states[id].epsilon) {
1428
+ spend();
1429
+ if (!initial.has(next)) {
1430
+ initial.add(next);
1431
+ stack.push(next);
1432
+ }
1433
+ }
1434
+ }
1435
+ return initial;
1436
+ }, "closure");
1437
+ let current = closure(/* @__PURE__ */ new Set([start]));
1438
+ for (const c of text2) {
1439
+ const point = c.codePointAt(0) ?? 0;
1440
+ const next = /* @__PURE__ */ new Set();
1441
+ for (const id of current)
1442
+ for (const edge of states[id].edges) {
1443
+ spend();
1444
+ const inside = edge.atom.ranges.some(([lo, hi]) => point >= lo && point <= hi);
1445
+ if (inside !== edge.atom.negate)
1446
+ next.add(edge.to);
1447
+ }
1448
+ current = closure(next);
1449
+ if (current.size === 0)
1450
+ return false;
1451
+ }
1452
+ return current.has(end);
1453
+ }, "test")
1454
+ };
1455
+ }, "compileAutomaton");
1456
+ var wildcardPattern = /* @__PURE__ */ __name((value) => {
1457
+ const chars = [...value];
1458
+ let pattern = "";
1459
+ for (let at = 0; at < chars.length; at++) {
1460
+ const c = chars[at];
1461
+ if (c === "\\") {
1462
+ const escaped = chars[++at];
1463
+ if (escaped === void 0)
1464
+ searchError("query.invalid-escape", { start: 0, end: value.length });
1465
+ pattern += /[|&?*+(){}[\].#@<>"~\\]/u.test(escaped) ? `\\${escaped}` : escaped;
1466
+ } else
1467
+ pattern += c === "*" ? ".*" : c === "?" ? "." : /[|&?*+(){}[\].#@<>"~\\]/u.test(c) ? `\\${c}` : c;
1468
+ }
1469
+ return pattern;
1470
+ }, "wildcardPattern");
1471
+ var FOLD_RANGE = 4096;
1472
+ var unfoldable = /* @__PURE__ */ __name((span, what) => searchError("query.unsupported-regex", span, `${what} has no single lowercase form without accents, which is what text: words are \u2014 write it that way, or use body:/\u2026/ to match the original text`), "unfoldable");
1473
+ var classChar = /* @__PURE__ */ __name((point) => {
1474
+ const c = String.fromCodePoint(point);
1475
+ return /[\p{L}\p{N}]/u.test(c) ? c : `\\${c}`;
1476
+ }, "classChar");
1477
+ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
1478
+ const chars = [...pattern.normalize("NFC")];
1479
+ let out = "";
1480
+ let at = 0;
1481
+ const literal2 = /* @__PURE__ */ __name((c) => {
1482
+ if (!/[\p{L}\p{N}\p{M}]/u.test(c))
1483
+ return c;
1484
+ const folded = fold(c);
1485
+ if (folded === "")
1486
+ return unfoldable(span, `"${c}"`);
1487
+ if ([...folded].length === 1 && /[\p{L}\p{N}]/u.test(folded))
1488
+ return folded;
1489
+ if (folded.includes('"'))
1490
+ return unfoldable(span, `"${c}"`);
1491
+ return `"${folded}"`;
1492
+ }, "literal");
1493
+ const characterClass = /* @__PURE__ */ __name(() => {
1494
+ const begin = at - 1;
1495
+ let negate = "";
1496
+ if (chars[at] === "^") {
1497
+ negate = "^";
1498
+ at++;
1499
+ }
1500
+ const kept2 = [];
1501
+ const points = /* @__PURE__ */ new Set();
1502
+ do {
1503
+ const start = at;
1504
+ if (chars[at] === "\\" && /^[a-zA-Z]$/u.test(chars[at + 1] ?? "")) {
1505
+ kept2.push(`\\${chars[at + 1]}`);
1506
+ at += 2;
1507
+ continue;
1508
+ }
1509
+ const escaped = /* @__PURE__ */ __name(() => {
1510
+ if (chars[at] === "\\")
1511
+ at++;
1512
+ return (chars[at++] ?? "").codePointAt(0) ?? 0;
1513
+ }, "escaped");
1514
+ const lo = escaped();
1515
+ let hi = lo;
1516
+ if (chars[at] === "-") {
1517
+ at++;
1518
+ hi = escaped();
1519
+ }
1520
+ if (at > chars.length) {
1521
+ out += chars.slice(begin).join("");
1522
+ return;
1523
+ }
1524
+ const single = /* @__PURE__ */ __name((point) => [...fold(String.fromCodePoint(point))], "single");
1525
+ if (hi < lo)
1526
+ kept2.push(chars.slice(start, at).join(""));
1527
+ else if (hi - lo >= FOLD_RANGE) {
1528
+ if (single(lo).join("") !== String.fromCodePoint(lo) || single(hi).join("") !== String.fromCodePoint(hi))
1529
+ unfoldable(span, `the range ${chars.slice(start, at).join("")}`);
1530
+ kept2.push(chars.slice(start, at).join(""));
1531
+ } else
1532
+ for (let point = lo; point <= hi; point++) {
1533
+ const folded = single(point);
1534
+ if (folded.length === 1)
1535
+ points.add(folded[0]?.codePointAt(0) ?? 0);
1536
+ else if (lo === hi)
1537
+ unfoldable(span, `"${String.fromCodePoint(point)}"`);
1538
+ }
1539
+ } while (at < chars.length && chars[at] !== "]");
1540
+ const sorted = [...points].sort((a, b) => a - b);
1541
+ const ranges = [];
1542
+ for (let i = 0; i < sorted.length; i++) {
1543
+ const first = sorted[i];
1544
+ while (sorted[i + 1] === sorted[i] + 1)
1545
+ i++;
1546
+ const last = sorted[i];
1547
+ ranges.push(last === first ? classChar(first) : `${classChar(first)}-${classChar(last)}`);
1548
+ }
1549
+ if (!kept2.length && !ranges.length)
1550
+ unfoldable(span, "the class");
1551
+ out += `[${negate}${kept2.join("")}${ranges.join("")}`;
1552
+ }, "characterClass");
1553
+ while (at < chars.length) {
1554
+ const c = chars[at++];
1555
+ if (c === "\\") {
1556
+ const next = chars[at++];
1557
+ if (next === void 0)
1558
+ out += c;
1559
+ else
1560
+ out += (next.codePointAt(0) ?? 0) < 128 ? `${c}${next}` : literal2(next);
1561
+ } else if (c === '"') {
1562
+ const end = chars.indexOf('"', at);
1563
+ if (end < 0) {
1564
+ out += chars.slice(at - 1).join("");
1565
+ break;
1566
+ }
1567
+ const folded = fold(chars.slice(at, end).join(""));
1568
+ if (folded.includes('"'))
1569
+ unfoldable(span, `"${chars.slice(at, end).join("")}"`);
1570
+ out += `"${folded}"`;
1571
+ at = end + 1;
1572
+ } else if (c === "[")
1573
+ characterClass();
1574
+ else
1575
+ out += literal2(c);
1576
+ }
1577
+ return out;
1578
+ }, "foldRegex");
1579
+
1580
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/search/trigrams.js
1581
+ var trigrams = /* @__PURE__ */ __name((term) => {
1582
+ const padded = ` ${term} `;
1583
+ const pieces = /* @__PURE__ */ new Set();
1584
+ for (let at = 0; at + 3 <= padded.length; at++)
1585
+ pieces.add(padded.slice(at, at + 3));
1586
+ return [...pieces];
1587
+ }, "trigrams");
1588
+
1589
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/resolve.js
1590
+ var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
1591
+ var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
1592
+ var pickChat = /* @__PURE__ */ __name((reference, chats) => {
1593
+ const wanted = foldName(reference.trim());
1594
+ const matches = chats.filter((chat) => chat.title !== null && foldName(chat.title).includes(wanted));
1595
+ if (matches.length === 1 && matches[0])
1596
+ return matches[0];
1597
+ if (matches.length === 0)
1598
+ throw new CliError("not_found", `no chat matches "${reference}"`);
1599
+ throw ambiguous(reference, "chats", matches.map((chat) => ({ id: chat.id, title: chat.title })), ({ title }) => singleLine(String(title)));
1600
+ }, "pickChat");
1601
+ var pickPerson = /* @__PURE__ */ __name((reference, people) => {
1602
+ const trimmed = reference.trim();
1603
+ const contact = contactReferenceOf(trimmed, people.provider);
1604
+ if (contact !== void 0) {
1605
+ const named = people.get(contact);
1606
+ if (named)
1607
+ return named;
1608
+ throw new CliError("not_found", `no person ${contact} in what this account has seen`);
1609
+ }
1610
+ const known = people.get(trimmed);
1611
+ if (known)
1612
+ return known;
1613
+ if (isId(trimmed))
1614
+ throw new CliError("not_found", `no person ${trimmed} in what this account has seen`);
1615
+ const wanted = foldName(trimmed.replace(/^@/, ""));
1616
+ const everyone = people.all().toSorted((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
1617
+ const exact = everyone.filter((person) => namesOf(person).includes(wanted));
1618
+ const containing = everyone.filter((person) => namesOf(person).some((one) => one.includes(wanted)));
1619
+ if (exact.length === 1 && exact[0])
1620
+ return exact[0];
1621
+ if (containing.length === 1 && containing[0])
1622
+ return containing[0];
1623
+ if (containing.length === 0)
1624
+ throw new CliError("not_found", `nobody matches "${reference}"`);
1625
+ const matches = exact.length > 0 ? [...exact, ...containing.filter((person) => !exact.includes(person))] : containing;
1626
+ throw ambiguous(reference, "people", matches.map(({ id, name, username }) => ({ id, name, username })), ({ name, username }) => singleLine([name, username && `@${username}`].filter(isPresent).join(" ")));
1627
+ }, "pickPerson");
1628
+ var namesOf = /* @__PURE__ */ __name((person, byAddress = false) => [person.alias, person.name, person.username, byAddress ? person.id : void 0].filter(isPresent).map(foldName), "namesOf");
1629
+ var chatNamesOf = /* @__PURE__ */ __name((chat) => [chat.title, chat.providerMetadata?.username].filter((one) => typeof one === "string" && one !== "").map(foldName), "chatNamesOf");
1630
+ var namePattern = /* @__PURE__ */ __name((pattern) => {
1631
+ const automaton = compileAutomaton(wildcardPattern(foldName(pattern.trim().replace(/^@/, ""))));
1632
+ return (names) => names.some((one) => automaton.test(one));
1633
+ }, "namePattern");
1634
+ var peopleMatching = /* @__PURE__ */ __name((pattern, people, { byAddress = false } = {}) => {
1635
+ const fits = namePattern(pattern);
1636
+ return people.filter((person) => fits(namesOf(person, byAddress)));
1637
+ }, "peopleMatching");
1638
+ var chatsMatching = /* @__PURE__ */ __name((pattern, chats) => {
1639
+ const fits = namePattern(pattern);
1640
+ return chats.filter((chat) => fits(chatNamesOf(chat)));
1641
+ }, "chatsMatching");
1642
+ var nearest = /* @__PURE__ */ __name((pattern, items, names, most = 5) => {
1643
+ const pieces = /* @__PURE__ */ __name((text2) => foldName(text2).split(/\s+/u).flatMap(trigrams), "pieces");
1644
+ const wanted = new Set(pieces(pattern.replace(/\\(.)/gu, "$1").replace(/[*?@]/gu, " ").trim()));
1645
+ if (wanted.size === 0)
1646
+ return [];
1647
+ return items.map((item) => ({
1648
+ item,
1649
+ score: names(item).flatMap(pieces).filter((piece) => wanted.has(piece)).length
1650
+ })).filter(({ score }) => score > 1).toSorted((a, b) => b.score - a.score).slice(0, most).map(({ item }) => item);
1651
+ }, "nearest");
1652
+ var ambiguous = /* @__PURE__ */ __name((reference, what, candidates, label2) => {
1653
+ const width = Math.max(...candidates.map(({ id }) => id.length));
1654
+ const lines = candidates.map((candidate) => ` ${candidate.id.padEnd(width)} ${label2(candidate)}`).join("\n");
1655
+ return new CliError("validation_error", `"${singleLine(reference)}" matches ${candidates.length} ${what} \u2014 name one by its id:
1656
+ ${lines}`, { candidates });
1657
+ }, "ambiguous");
1658
+ var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
1659
+
1660
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/display-names.js
1661
+ var QUOTES = [
1662
+ ['"', '"'],
1663
+ ["'", "'"],
1664
+ ["\xAB", "\xBB"],
1665
+ ["\u201C", "\u201D"],
1666
+ ["\u201E", "\u201C"],
1667
+ ["\u2018", "\u2019"],
1668
+ ["`", "`"]
1669
+ ];
1670
+ var READABLE = /[\p{L}\p{N}]/u;
1671
+ var PLACEHOLDERS = /* @__PURE__ */ new Set(["null", "undefined", "none", "\u0431\u0435\u0437 \u0438\u043C\u0435\u043D\u0438", "deleted account", "\u0443\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442"]);
1672
+ var unquoted = /* @__PURE__ */ __name((text2) => {
1673
+ let at = text2.replace(/\s+/gu, " ").trim();
1674
+ for (; ; ) {
1675
+ const pair = QUOTES.find(([open, close]) => at.length >= 2 && at.startsWith(open) && at.endsWith(close));
1676
+ if (pair === void 0)
1677
+ return at;
1678
+ at = at.slice(pair[0].length, at.length - pair[1].length).trim();
1679
+ }
1680
+ }, "unquoted");
1681
+ var given = /* @__PURE__ */ __name((value) => {
1682
+ const text2 = typeof value === "string" ? value.trim() : "";
1683
+ return text2 === "" ? void 0 : text2;
1684
+ }, "given");
1685
+ var displayName = /* @__PURE__ */ __name((name, fallbacks = {}) => {
1686
+ const unwrapped = typeof name === "string" ? unquoted(name) : "";
1687
+ const cleaned = PLACEHOLDERS.has(unwrapped.toLowerCase()) ? "" : unwrapped;
1688
+ if (READABLE.test(cleaned))
1689
+ return cleaned;
1690
+ const borrowed = fallbacks.name === void 0 || fallbacks.name === null ? null : displayName(fallbacks.name);
1691
+ if (borrowed !== null && READABLE.test(borrowed) && !borrowed.startsWith("@"))
1692
+ return borrowed;
1693
+ const username = given(fallbacks.username);
1694
+ return (username === void 0 ? void 0 : username.startsWith("@") ? username : `@${username}`) ?? given(fallbacks.phone) ?? given(fallbacks.email) ?? (cleaned === "" ? null : cleaned);
1695
+ }, "displayName");
1696
+ var present = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "" ? value : null, "present");
1697
+ var takeFallbacks = /* @__PURE__ */ __name((into, identity) => {
1698
+ const named = displayName(identity.name);
1699
+ if (into.name === null && isReadable(named) && !named?.startsWith("@"))
1700
+ into.name = named;
1701
+ into.username ??= present(identity.username);
1702
+ into.phone ??= present(identity.phone) ?? (identity.provider === "phone" ? identity.id : null);
1703
+ into.email ??= present(identity.email) ?? (identity.provider === "email" ? identity.id : null);
1704
+ return into;
1705
+ }, "takeFallbacks");
1706
+ var noFallbacks = /* @__PURE__ */ __name(() => ({ name: null, username: null, phone: null, email: null }), "noFallbacks");
1707
+ var nameKey = /* @__PURE__ */ __name((name) => {
1708
+ if (typeof name !== "string")
1709
+ return null;
1710
+ const unwrapped = unquoted(name);
1711
+ if (PLACEHOLDERS.has(unwrapped.toLowerCase()))
1712
+ return null;
1713
+ const words = foldName(unwrapped).split(/[^\p{L}\p{N}]+/u).filter((word) => word !== "");
1714
+ return words.length === 0 ? null : words.sort().join(" ");
1715
+ }, "nameKey");
1716
+ var isReadable = /* @__PURE__ */ __name((shown) => shown !== null && READABLE.test(shown), "isReadable");
1717
+
1718
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/counters.js
1719
+ var COUNTER_FIELDS = ["views", "reactions", "comments"];
1720
+ var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
1721
+ var counterValue = /* @__PURE__ */ __name((message, field) => {
1722
+ const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
1723
+ return validCounter(value) ? value : null;
1724
+ }, "counterValue");
1725
+ var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
1726
+ const at = Date.parse(observation.observedAt);
1727
+ if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
1728
+ throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
1729
+ if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
1730
+ throw new CliError("validation_error", "reaction observation payload and total disagree");
1731
+ return at;
1732
+ }, "counterObservationTime");
1733
+ var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
1734
+ const observations = {};
1735
+ for (const field of fields) {
1736
+ const value = counterValue(message, field);
1737
+ if (value !== null)
1738
+ observations[field] = {
1739
+ value,
1740
+ observedAt,
1741
+ source,
1742
+ ...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
1743
+ };
1744
+ }
1745
+ return { ...message, counterObservations: observations };
1746
+ }, "observedCounters");
1747
+ var counterFreshness = /* @__PURE__ */ __name((states) => {
1748
+ if (!states.length || states.every((one) => one.freshness === "unknown"))
1749
+ return "unknown";
1750
+ if (states.some((one) => one.freshness === "unknown"))
1751
+ return "partial";
1752
+ return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
1753
+ }, "counterFreshness");
1754
+
1755
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
1756
+ var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
1757
+ var AUTHOR_MEASURES = [
1758
+ "messages",
1759
+ "words",
1760
+ "reactions",
1761
+ "replies",
1762
+ "answers",
1763
+ "answer-time",
1764
+ "threads",
1765
+ "active-days"
1766
+ ];
1767
+ var CONTEXT = /* @__PURE__ */ new Set([
1768
+ "replies",
1769
+ "replies-from-others",
1770
+ "replies-from-others-per-message",
1771
+ "thread-size",
1772
+ "threads",
1773
+ "answers",
1774
+ "answer-time"
1775
+ ]);
1776
+ var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
1777
+ var presets = {
1778
+ helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
1779
+ active: { "active-days": 0.6, messages: 0.4 },
1780
+ engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
1781
+ };
1782
+ function invalid(message) {
1783
+ throw new CliError("validation_error", message, { reason: "ranking.invalid" });
1784
+ }
1785
+ __name(invalid, "invalid");
1786
+ var rankingOptions = /* @__PURE__ */ __name((target, input) => {
1787
+ const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
1788
+ const { measure, score, weights: given2, minMessages } = input;
1789
+ const messageKind = input.messageKind ?? "all";
1790
+ if (!["all", "posts", "comments"].includes(messageKind))
1791
+ invalid("message_kind takes all, posts or comments");
1792
+ if (target === "messages" && minMessages !== void 0)
1793
+ invalid("min_messages applies to stats contacts top");
1794
+ if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
1795
+ invalid("min_messages takes a positive integer");
1796
+ if (measure !== void 0 && !measures.includes(measure))
1797
+ invalid(`--measure takes ${measures.join(", ")}`);
1798
+ if (measure !== void 0 && (score !== void 0 || given2 !== void 0))
1799
+ invalid("--measure cannot be combined with --score or --weights");
1800
+ if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
1801
+ invalid("--score takes helpful, active or engaging");
1802
+ if (target === "messages" && score !== void 0 && score !== "engaging")
1803
+ invalid("helpful and active scores apply to authors only");
1804
+ const scoring = score !== void 0 || given2 !== void 0;
1805
+ const preset = score;
1806
+ let weights = null;
1807
+ if (scoring) {
1808
+ let raw = given2 !== void 0 ? given2 : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
1809
+ if (typeof raw === "string") {
1810
+ try {
1811
+ raw = JSON.parse(raw);
1812
+ } catch {
1813
+ invalid("--weights takes a JSON object of component weights");
1814
+ }
1815
+ }
1816
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
1817
+ invalid("--weights takes a JSON object of component weights");
1818
+ const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
1819
+ ...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
1820
+ "replies-from-others",
1821
+ "reactions-per-message",
1822
+ "replies-from-others-per-message"
1823
+ ];
1824
+ const entries = Object.entries(raw);
1825
+ for (const [name, weight] of entries) {
1826
+ if (!allowed.includes(name))
1827
+ invalid(`unknown ${target} score component: ${name}`);
1828
+ if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
1829
+ invalid(`weight for ${name} must be a finite nonnegative number`);
1830
+ }
1831
+ if (!entries.some(([, weight]) => weight > 0))
1832
+ invalid("--weights needs at least one positive weight");
1833
+ weights = Object.fromEntries(entries);
1834
+ }
1835
+ const selected = measure ?? (target === "messages" ? "reactions" : "messages");
1836
+ return {
1837
+ target,
1838
+ messageKind,
1839
+ minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
1840
+ measure: scoring ? "score" : selected,
1841
+ order: !scoring && selected === "answer-time" ? "ascending" : "descending",
1842
+ weights,
1843
+ preset: scoring ? preset ?? "custom" : null,
1844
+ components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
1845
+ };
1846
+ }, "rankingOptions");
1847
+ var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
1848
+ const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
1849
+ const scale = Math.max(...entries.map(([, weight]) => weight));
1850
+ const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
1851
+ if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
1852
+ return null;
1853
+ const normalized = {};
1854
+ const contributions = {};
1855
+ let sum = 0;
1856
+ for (const [name, weight] of entries) {
1857
+ const value = raw[name];
1858
+ const maximum = maxima[name];
1859
+ if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
1860
+ return null;
1861
+ const part = maximum === 0 ? 0 : value / maximum;
1862
+ normalized[name] = part;
1863
+ contributions[name] = 100 * part * (weight / scale) / denominator;
1864
+ sum += contributions[name];
1865
+ }
1866
+ return { score: Math.min(100, sum), normalized, contributions };
1867
+ }, "rankingScore");
1868
+ var RANKING_TOKENIZER_VERSION = 1;
1869
+ var withoutUrls = /* @__PURE__ */ __name((text2) => text2.replace(/\S+/gu, (token) => {
1870
+ for (let offset = 0; ; ) {
1871
+ const marker = token.indexOf("://", offset);
1872
+ if (marker < 0)
1873
+ break;
1874
+ let start = marker;
1875
+ while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
1876
+ start--;
1877
+ if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
1878
+ return token.slice(0, start);
1879
+ offset = marker + 3;
1880
+ }
1881
+ const folded = token.toLowerCase();
1882
+ for (let offset = 0; ; ) {
1883
+ const start = folded.indexOf("www.", offset);
1884
+ if (start < 0)
1885
+ break;
1886
+ if (start === 0 || !/\w/u.test(token[start - 1]))
1887
+ return token.slice(0, start);
1888
+ offset = start + 4;
1889
+ }
1890
+ return token;
1891
+ }), "withoutUrls");
1892
+ var rankingWords = /* @__PURE__ */ __name((text2) => withoutUrls(text2).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
1893
+ var rankingQuestion = /* @__PURE__ */ __name((text2) => withoutUrls(text2).includes("?"), "rankingQuestion");
1894
+
1895
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/records.js
1896
+ import { createHash } from "node:crypto";
1217
1897
  var RECORDS_SCHEMA_VERSION = 1;
1218
1898
  var RECORD_OPERATIONS = ["upsert", "delete"];
1219
1899
  var LINE_OPTIONS = ["text", "products"];
@@ -1433,8 +2113,9 @@ var recordErrors = /* @__PURE__ */ __name((record, index) => {
1433
2113
  return withKey([invalid2([...at, "fields"], "an upsert carries its fields as an object")]);
1434
2114
  if (record.fields !== void 0 && !isObject(record.fields))
1435
2115
  return withKey([invalid2([...at, "fields"], "fields is an object")]);
1436
- if (record.fields !== void 0 && Buffer.byteLength(JSON.stringify(record.fields)) > MAX_FIELDS_BYTES)
1437
- return withKey([invalid2([...at, "fields"], `fields take at most ${MAX_FIELDS_BYTES} bytes`, "record.too-large")]);
2116
+ const most = isRecordType(record.type) && RECORD_TYPES[record.type].fieldsBytes || MAX_FIELDS_BYTES;
2117
+ if (record.fields !== void 0 && Buffer.byteLength(JSON.stringify(record.fields)) > most)
2118
+ return withKey([invalid2([...at, "fields"], `fields take at most ${most} bytes`, "record.too-large")]);
1438
2119
  const secret = record.fields === void 0 ? void 0 : secretIn(record.fields, [...at, "fields"]);
1439
2120
  if (secret)
1440
2121
  return withKey([
@@ -1564,14 +2245,46 @@ var fieldReferences = /* @__PURE__ */ __name((record, options = {}) => {
1564
2245
  return found;
1565
2246
  }, "fieldReferences");
1566
2247
 
1567
- // node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/domain/crm.js
1568
- var CRM_KINDS = ["organization", "person", "deal", "lead"];
1569
- var isCrmUserId = /* @__PURE__ */ __name((id) => /^\d{1,20}$/.test(id), "isCrmUserId");
1570
- var normalCrmUserId = /* @__PURE__ */ __name((id) => {
1571
- const text2 = id.trim();
1572
- return /^\d+$/.test(text2) ? text2.replace(/^0+(?=\d)/, "") : text2;
1573
- }, "normalCrmUserId");
1574
- var isItemKind = /* @__PURE__ */ __name((kind) => kind === "deal" || kind === "lead", "isItemKind");
2248
+ // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/relation-role-labels.js
2249
+ var label = /* @__PURE__ */ __name((en, ru, es) => ({ en, ru, es }), "label");
2250
+ var ROLE_LABELS = {
2251
+ organization: {
2252
+ employee: label("Employee", "\u0421\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A", "Empleado"),
2253
+ contractor: label("Contractor", "\u041F\u043E\u0434\u0440\u044F\u0434\u0447\u0438\u043A", "Contratista"),
2254
+ founder: label("Founder", "\u041E\u0441\u043D\u043E\u0432\u0430\u0442\u0435\u043B\u044C", "Fundador"),
2255
+ owner: label("Owner", "\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446", "Propietario"),
2256
+ manager: label("Manager", "\u0420\u0443\u043A\u043E\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C", "Directivo"),
2257
+ adviser: label("Adviser", "\u0421\u043E\u0432\u0435\u0442\u043D\u0438\u043A", "Asesor"),
2258
+ contact: label("Contact", "\u041A\u043E\u043D\u0442\u0430\u043A\u0442", "Contacto")
2259
+ },
2260
+ project: {
2261
+ owner: label("Owner", "\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446", "Propietario"),
2262
+ manager: label("Manager", "\u0420\u0443\u043A\u043E\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C", "Directivo"),
2263
+ contributor: label("Contributor", "\u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A", "Colaborador"),
2264
+ "client-contact": label("Client contact", "\u041A\u043E\u043D\u0442\u0430\u043A\u0442 \u043A\u043B\u0438\u0435\u043D\u0442\u0430", "Contacto del cliente"),
2265
+ approver: label("Approver", "\u0421\u043E\u0433\u043B\u0430\u0441\u0443\u044E\u0449\u0438\u0439", "Aprobador")
2266
+ },
2267
+ deal: {
2268
+ owner: label("Responsible", "\u041E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439", "Responsable"),
2269
+ contact: label("Contact", "\u041A\u043E\u043D\u0442\u0430\u043A\u0442", "Contacto"),
2270
+ "decision-maker": label("Decision-maker", "\u041F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043D\u0438\u0435", "Responsable de decidir"),
2271
+ influencer: label("Influencer", "\u0412\u043B\u0438\u044F\u0435\u0442 \u043D\u0430 \u0440\u0435\u0448\u0435\u043D\u0438\u0435", "Influye en la decisi\xF3n")
2272
+ },
2273
+ contract: {
2274
+ customer: label("Customer", "\u0417\u0430\u043A\u0430\u0437\u0447\u0438\u043A", "Cliente"),
2275
+ supplier: label("Supplier", "\u041F\u043E\u0441\u0442\u0430\u0432\u0449\u0438\u043A", "Proveedor"),
2276
+ signatory: label("Signatory", "\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442", "Firmante"),
2277
+ guarantor: label("Guarantor", "\u041F\u043E\u0440\u0443\u0447\u0438\u0442\u0435\u043B\u044C", "Garante")
2278
+ },
2279
+ related: {
2280
+ colleague: label("Colleague", "\u041A\u043E\u043B\u043B\u0435\u0433\u0430", "Colega"),
2281
+ adviser: label("Adviser", "\u0421\u043E\u0432\u0435\u0442\u043D\u0438\u043A", "Asesor"),
2282
+ investor: label("Investor", "\u0418\u043D\u0432\u0435\u0441\u0442\u043E\u0440", "Inversor"),
2283
+ mentor: label("Mentor", "\u041D\u0430\u0441\u0442\u0430\u0432\u043D\u0438\u043A", "Mentor"),
2284
+ family: label("Family", "\u0421\u0435\u043C\u044C\u044F", "Familia"),
2285
+ friend: label("Friend", "\u0414\u0440\u0443\u0433", "Amigo")
2286
+ }
2287
+ };
1575
2288
 
1576
2289
  export {
1577
2290
  isObject,
@@ -1591,23 +2304,56 @@ export {
1591
2304
  hasV1Roles,
1592
2305
  IDENTITY_TYPES,
1593
2306
  article,
2307
+ isEmailAddress,
2308
+ ROLE_ADDRESS_WORDS,
2309
+ isRoleAddress,
2310
+ isPersonLikeRoleAddress,
2311
+ isNoReplyAddress,
2312
+ PHONE_COUNTRIES,
1594
2313
  DEFAULT_PHONE_COUNTRIES,
1595
2314
  parsePhoneCountries,
1596
2315
  nationalPhone,
1597
2316
  typedPhone,
1598
2317
  e164Of,
2318
+ isMobilePhone,
1599
2319
  BARE_INTERNATIONAL_PROVIDERS,
1600
2320
  storedPhone,
2321
+ QUERY_VERSION,
2322
+ QUERY_LIMITS2 as QUERY_LIMITS,
2323
+ SEARCH_QUERY,
2324
+ MESSAGE_PARSING,
2325
+ MOST_WORDS_APART,
2326
+ searchError,
2327
+ searchTimeLimit,
2328
+ outOfTime,
2329
+ isQueryLimit,
2330
+ exhausted,
2331
+ tooWideTerm,
2332
+ compileAutomaton,
2333
+ wildcardPattern,
2334
+ foldRegex,
2335
+ chatReferenceOf,
2336
+ wrongAccount,
2337
+ ensureAccount,
2338
+ trigrams,
2339
+ isId,
2340
+ foldName,
2341
+ pickChat,
2342
+ pickPerson,
2343
+ peopleMatching,
2344
+ chatsMatching,
2345
+ nearest,
2346
+ displayName,
2347
+ takeFallbacks,
2348
+ noFallbacks,
2349
+ nameKey,
2350
+ isReadable,
1601
2351
  COUNTER_FIELDS,
1602
2352
  validCounter,
1603
2353
  counterValue,
1604
2354
  counterObservationTime,
1605
2355
  observedCounters,
1606
2356
  counterFreshness,
1607
- isEmailAddress,
1608
- ROLE_ADDRESS_WORDS,
1609
- isRoleAddress,
1610
- isNoReplyAddress,
1611
2357
  MESSAGE_MEASURES,
1612
2358
  AUTHOR_MEASURES,
1613
2359
  needsRankingContext,
@@ -1628,8 +2374,5 @@ export {
1628
2374
  envelopeOfJsonl,
1629
2375
  envelopeOfText,
1630
2376
  fieldReferences,
1631
- CRM_KINDS,
1632
- isCrmUserId,
1633
- normalCrmUserId,
1634
- isItemKind
2377
+ ROLE_LABELS
1635
2378
  };