@wirecat/zoom-cli 0.72.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.
- package/contracts/wirecat.json +1478 -0
- package/dist/account-removal.d.ts.map +1 -1
- package/dist/account-removal.js +0 -2
- package/dist/account-removal.js.map +1 -1
- package/dist/answers.d.ts +1 -3
- package/dist/answers.d.ts.map +1 -1
- package/dist/answers.js +0 -3
- package/dist/answers.js.map +1 -1
- package/dist/bin/main.js +13 -5
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/{all-profiles-XFIPF4GF.js → all-profiles-V47CUJFK.js} +12 -12
- package/dist/bundle/answer-policy-W6H72X2R.js +112 -0
- package/dist/bundle/{anthropic-SSUBR3BC.js → anthropic-SID7Z3QN.js} +7 -7
- package/dist/bundle/{app-server-7DJHHF2F.js → app-server-KCMUSY4A.js} +67 -61
- package/dist/bundle/{bun-6HBYWQIX.js → bun-PWMM6L45.js} +2 -2
- package/dist/bundle/{bun-sqlite-4L3Q55NB.js → bun-sqlite-3TLKUN5A.js} +7 -7
- package/dist/bundle/{chunk-OY6N2ABP.js → chunk-2BAZRRJP.js} +19 -19
- package/dist/bundle/{chunk-KWURWGGB.js → chunk-2NQPB6MT.js} +28 -9
- package/dist/bundle/chunk-2PYZTRRC.js +84 -0
- package/dist/bundle/chunk-2VYEGKQ3.js +13 -0
- package/dist/bundle/{chunk-X2MP634F.js → chunk-35CYSRGJ.js} +4 -4
- package/dist/bundle/{chunk-SXZGCD6E.js → chunk-3ADFJ3UP.js} +3 -3
- package/dist/bundle/{chunk-63QXCE5Z.js → chunk-3HTJBGNP.js} +10 -10
- package/dist/bundle/{chunk-OHCLQJOV.js → chunk-44YVZIA4.js} +3 -3
- package/dist/bundle/{chunk-D24OQAHM.js → chunk-4LFFDUUW.js} +4 -4
- package/dist/bundle/{chunk-UVZLK3M4.js → chunk-4RJL32PF.js} +25 -10
- package/dist/bundle/{chunk-CANRIRNZ.js → chunk-6AO2RSYH.js} +951 -692
- package/dist/bundle/{chunk-37NF5CBJ.js → chunk-6NI4FE5G.js} +6 -8
- package/dist/bundle/{chunk-QW7YTRV2.js → chunk-6WUTUCKH.js} +3 -3
- package/dist/bundle/{chunk-WOAYHCM2.js → chunk-AIEMFRBU.js} +1 -1
- package/dist/bundle/{chunk-B3SILJBU.js → chunk-CIUJEQH4.js} +30 -22
- package/dist/bundle/{chunk-MSQHSW4C.js → chunk-CMWFYZ45.js} +2 -2
- package/dist/bundle/{chunk-2MIBRVSV.js → chunk-CQBLPBZU.js} +2 -2
- package/dist/bundle/{chunk-U3NJBGLA.js → chunk-DPSTOVKC.js} +185 -34
- package/dist/bundle/{chunk-OP5PGE2N.js → chunk-DYLYH7VE.js} +4 -4
- package/dist/bundle/{chunk-ELJUBPY4.js → chunk-EA2OB75T.js} +1 -1
- package/dist/bundle/{chunk-3KRTEX5M.js → chunk-ERQRY6WZ.js} +3 -2
- package/dist/bundle/{chunk-H53WFZBN.js → chunk-ETQNHS3A.js} +12 -12
- package/dist/bundle/{chunk-JG4MNYG2.js → chunk-EXWZCI5G.js} +1 -1
- package/dist/bundle/{chunk-MCPOZNWG.js → chunk-FIVFP53N.js} +1 -1
- package/dist/bundle/{chunk-7OD3522V.js → chunk-FJMRDRPN.js} +180 -149
- package/dist/bundle/{chunk-RZUJMAMK.js → chunk-FT7X74RT.js} +4 -4
- package/dist/bundle/{chunk-ADLS6FVG.js → chunk-FXBHOCJK.js} +1 -1
- package/dist/bundle/{chunk-JRCH4YZP.js → chunk-FZLJ2G7A.js} +17 -121
- package/dist/bundle/{chunk-ZW5KHKMA.js → chunk-G2TSDMTA.js} +5 -5
- package/dist/bundle/{chunk-7S4D5SM2.js → chunk-G3SIY4MQ.js} +29 -28
- package/dist/bundle/{chunk-M3DMXDX6.js → chunk-GCZMYDKU.js} +6 -6
- package/dist/bundle/{chunk-4XQWF3U2.js → chunk-HAMDPWEZ.js} +6 -6
- package/dist/bundle/{chunk-6DCLZLGX.js → chunk-HCZYJMBP.js} +1 -1
- package/dist/bundle/{chunk-S7SXSHRC.js → chunk-HNWDEDMU.js} +61 -30
- package/dist/bundle/{chunk-24OFZNRC.js → chunk-HO3GBTIT.js} +4038 -3729
- package/dist/bundle/chunk-IE7YBRUO.js +25 -0
- package/dist/bundle/{chunk-XPWZSW6Y.js → chunk-IJCUAKR5.js} +4 -4
- package/dist/bundle/{chunk-RLCVPECY.js → chunk-IKNOTHG2.js} +110 -64
- package/dist/bundle/{chunk-QA6KIL7Q.js → chunk-ILDGZBZD.js} +11 -8
- package/dist/bundle/{chunk-W3YTVEWV.js → chunk-JIS34MLC.js} +9 -9
- package/dist/bundle/{chunk-KFZL67JP.js → chunk-JQF4LM3V.js} +128 -47
- package/dist/bundle/{chunk-ZHA56THL.js → chunk-K5JFX5TK.js} +927 -904
- package/dist/bundle/{chunk-WXTYYWZI.js → chunk-K7EMVFJ7.js} +115 -113
- package/dist/bundle/{chunk-7GLJSJ7M.js → chunk-KHBZ4OEP.js} +1 -1
- package/dist/bundle/{chunk-PJWSGXOB.js → chunk-KK2IVZUQ.js} +7 -7
- package/dist/bundle/{chunk-YVVJ6Y5C.js → chunk-KQD4ZVNC.js} +7 -7
- package/dist/bundle/{chunk-TF2WKPNW.js → chunk-KSNJK4QM.js} +15 -15
- package/dist/bundle/{chunk-KPIQXFNB.js → chunk-KUL7S5Y3.js} +16 -15
- package/dist/bundle/{chunk-JZ4XNNL7.js → chunk-L6YSKCC3.js} +1 -1
- package/dist/bundle/chunk-LQYMN36C.js +73 -0
- package/dist/bundle/{chunk-5MGICK47.js → chunk-LSVQCI6V.js} +26 -26
- package/dist/bundle/{chunk-CW46FWKW.js → chunk-LVDTSCIN.js} +14 -12
- package/dist/bundle/{chunk-RX5CJ55S.js → chunk-M4OP5ASJ.js} +1 -1
- package/dist/bundle/{chunk-FSCPQQS5.js → chunk-MAE5UGRQ.js} +150 -93
- package/dist/bundle/{chunk-4YIGXTBP.js → chunk-MG2CCAVG.js} +3 -3
- package/dist/bundle/{chunk-N4QNYWWG.js → chunk-MOKEB656.js} +2 -2
- package/dist/bundle/{chunk-RN5SU2RN.js → chunk-N3SOTKXC.js} +6 -6
- package/dist/bundle/{chunk-7SUWPMZG.js → chunk-NBA2V6LB.js} +8 -8
- package/dist/bundle/{chunk-LLUNHAZ7.js → chunk-OFA22L4G.js} +4 -4
- package/dist/bundle/{chunk-RJTGENHZ.js → chunk-OKOJEBHK.js} +4 -7
- package/dist/bundle/{chunk-LA6QUVGQ.js → chunk-OMLVWOEF.js} +6 -2
- package/dist/bundle/{chunk-5X4IY5JH.js → chunk-OU5OXA6Q.js} +531 -416
- package/dist/bundle/{chunk-DEPXZJ2V.js → chunk-P4FU6R3Z.js} +17 -13
- package/dist/bundle/{chunk-5AELTC52.js → chunk-PACLT6IW.js} +102 -99
- package/dist/bundle/{chunk-EFF2XBHP.js → chunk-PGPHEC2X.js} +2 -2
- package/dist/bundle/{chunk-NMZQTYKJ.js → chunk-PJ3FKBXG.js} +1 -1
- package/dist/bundle/{chunk-7IFO43Q5.js → chunk-PKON63JH.js} +2 -2
- package/dist/bundle/{chunk-23J2ANZ7.js → chunk-Q43KX56Z.js} +2 -2
- package/dist/bundle/{chunk-VIV64MQM.js → chunk-QS6DWXDB.js} +26 -17
- package/dist/bundle/{chunk-IXO4SCKE.js → chunk-QVJMFZFW.js} +1 -1
- package/dist/bundle/{chunk-U32VL3MA.js → chunk-QWGEOQHA.js} +3 -2
- package/dist/bundle/{chunk-QQUY4MZY.js → chunk-R5FTCNLJ.js} +1 -1
- package/dist/bundle/{chunk-IFBIXU6C.js → chunk-SO52EJ2W.js} +2 -2
- package/dist/bundle/{chunk-JFPUYQSP.js → chunk-SYIOT45G.js} +5 -5
- package/dist/bundle/{chunk-ADKMBXY4.js → chunk-TI2OANJZ.js} +1 -1
- package/dist/bundle/{chunk-IACWKZWS.js → chunk-UIKVP23D.js} +1 -1
- package/dist/bundle/{chunk-JAEPK457.js → chunk-USIMMGWS.js} +23 -23
- package/dist/bundle/{chunk-WZGKHTA4.js → chunk-UYBLNGZ2.js} +8 -2
- package/dist/bundle/{chunk-4SY67IUA.js → chunk-V5Q2QKYM.js} +26 -33
- package/dist/bundle/{chunk-WLVG4RBZ.js → chunk-VJVYGTPM.js} +15 -2
- package/dist/bundle/{chunk-IU4DUUB3.js → chunk-VPPNYUQM.js} +8 -8
- package/dist/bundle/{chunk-D5EUMWD5.js → chunk-X2FILY5F.js} +3 -3
- package/dist/bundle/{chunk-LTWJM3ED.js → chunk-XLY7V2LB.js} +17 -17
- package/dist/bundle/chunk-XWBPP2HX.js +2 -0
- package/dist/bundle/{chunk-ZVFYGTGJ.js → chunk-Y3IH7EZC.js} +17 -17
- package/dist/bundle/{chunk-7JYMGXLI.js → chunk-Z5XCU4S7.js} +45 -41
- package/dist/bundle/{chunk-I7CUMZD6.js → chunk-ZAIE3G5I.js} +3 -3
- package/dist/bundle/{chunk-ERJYJ36F.js → chunk-ZMHZ6CQS.js} +2 -2
- package/dist/bundle/{chunk-T27IMG6X.js → chunk-ZVQDOKDY.js} +1 -1
- package/dist/bundle/{chunk-DOCVEKP2.js → chunk-ZX4QWTMQ.js} +36 -32
- package/dist/bundle/{cli-IYYI7GAM.js → cli-4ZYJ6OZE.js} +109 -101
- package/dist/bundle/command-contract-FJDDCHYP.js +43 -0
- package/dist/bundle/{command-server-entry-FXX4LJWF.js → command-server-entry-CASONRIJ.js} +35 -33
- package/dist/bundle/config-4DZHX2WX.js +99 -0
- package/dist/bundle/{decode-SRGOOGBW.js → decode-KEFCVGEB.js} +6 -6
- package/dist/bundle/{dispatch-OUHRPFUL.js → dispatch-EU67WGME.js} +9 -9
- package/dist/bundle/{dist-UZLNLAIO.js → dist-GCQ7KCKN.js} +26 -22
- package/dist/bundle/{echarts-7CM2MCMW.js → echarts-SDZA2SWG.js} +2 -2
- package/dist/bundle/{embed-VEE56BOB.js → embed-43VJEPM6.js} +7 -7
- package/dist/bundle/{embedder-SZFYR543.js → embedder-Q4ZHAGRP.js} +10 -10
- package/dist/bundle/{failure-MZBNM7M5.js → failure-CTJLEB2R.js} +3 -3
- package/dist/bundle/first-run-CPOLQVNA.js +29 -0
- package/dist/bundle/first-screen-XYESRGWW.js +41 -0
- package/dist/bundle/folders-MSBTAPAG.js +24 -0
- package/dist/bundle/{instructions-R7OHVAWH.js → instructions-7T6JJIFS.js} +1 -1
- package/dist/bundle/{main-EFUN2O3K.js → main-NA3QVPXS.js} +39 -26
- package/dist/bundle/{mcp-7KQUJNFN.js → mcp-TDKGDB4V.js} +2 -2
- package/dist/bundle/{meetings-5I2BDNTA.js → meetings-7CVIQJTA.js} +9 -7
- package/dist/bundle/{node-3N2JGZ7V.js → node-BZDMUFTW.js} +2 -2
- package/dist/bundle/{node-P4E63KXA.js → node-KM3CUABH.js} +9 -9
- package/dist/bundle/{node-sqlite-2UVEE2WM.js → node-sqlite-QHGB23B4.js} +10 -10
- package/dist/bundle/{oauth-AYGD7UU3.js → oauth-BMEMCM2I.js} +8 -8
- package/dist/bundle/{open-3GUVDLGD.js → open-JGU2NRJP.js} +6 -6
- package/dist/bundle/openai-VTXXFNCS.js +28 -0
- package/dist/bundle/{output-file-72JFXVHQ.js → output-file-VDOCYH2G.js} +6 -6
- package/dist/bundle/{process-YAHHUFR5.js → process-756VBE7E.js} +1 -1
- package/dist/bundle/{program-OSZROCTK.js → program-XM6CDIJ2.js} +138 -139
- package/dist/bundle/{prompt-HMCW4XQJ.js → prompt-2IPFXJ4B.js} +6 -6
- package/dist/bundle/{recognize-VF5CA7EM.js → recognize-672E2RIB.js} +5 -5
- package/dist/bundle/{remote-5C6VTPR2.js → remote-YLHRVPDS.js} +11 -10
- package/dist/bundle/{rerank-ER7NEDOI.js → rerank-NBXQG3OS.js} +8 -8
- package/dist/bundle/run-log-3WITBT2F.js +126 -0
- package/dist/bundle/{serve-QJWXJOM7.js → serve-FNLOUMYP.js} +10 -10
- package/dist/bundle/{server-KCIK3Y2P.js → server-7ZB5AK5H.js} +54 -50
- package/dist/bundle/server-GGRGD4SH.js +77 -0
- package/dist/bundle/{services-LQMYJQG3.js → services-Z4UWN64R.js} +46 -44
- package/dist/bundle/{speech-74GJQNQH.js → speech-XSYVCKR3.js} +20 -20
- package/dist/bundle/sqlite-runtime-GAPXJNWU.js +20 -0
- package/dist/bundle/{state-4XDGCHDF.js → state-QSA53EF5.js} +7 -7
- package/dist/bundle/{store-5Y5HK2L2.js → store-EKI4OAJH.js} +20 -20
- package/dist/bundle/{store-Y56AHJ2Y.js → store-NOF5EYUC.js} +30 -28
- package/dist/bundle/store-connection-2OZQGEIO.js +92 -0
- package/dist/bundle/store-maintenance-command-GNX3SOZ6.js +67 -0
- package/dist/bundle/{streaming-E5CR6HSR.js → streaming-PQEXKTE5.js} +7 -7
- package/dist/bundle/tokens-WJQYQ3FK.js +24 -0
- package/dist/bundle/zm.js +9 -9
- package/dist/bundle/{zoom-app-NVL7HEAX.js → zoom-app-Y7RMWLVU.js} +9 -8
- package/dist/folders.d.ts +12 -2
- package/dist/folders.d.ts.map +1 -1
- package/dist/folders.js +81 -3
- package/dist/folders.js.map +1 -1
- package/dist/identity.d.ts +5 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +14 -0
- package/dist/identity.js.map +1 -1
- package/dist/recording-schedule-setup.d.ts.map +1 -1
- package/dist/recording-schedule-setup.js +4 -7
- package/dist/recording-schedule-setup.js.map +1 -1
- package/dist/remote-http.d.ts +1 -1
- package/dist/remote-http.d.ts.map +1 -1
- package/dist/remote-http.js +21 -23
- package/dist/remote-http.js.map +1 -1
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +2 -4
- package/dist/setup-commands.js.map +1 -1
- package/dist/tokens.d.ts +17 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +109 -29
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +15 -14
- package/dist/bundle/answer-policy-AT6CDEE5.js +0 -110
- package/dist/bundle/chunk-EG25AY4L.js +0 -17
- package/dist/bundle/chunk-K6HR6HCO.js +0 -32
- package/dist/bundle/command-contract-TX7NSUBM.js +0 -42
- package/dist/bundle/config-YKNM33J7.js +0 -96
- package/dist/bundle/first-run-KWC7RKF2.js +0 -29
- package/dist/bundle/first-screen-DWKMNSEI.js +0 -40
- package/dist/bundle/folders-UQXRSDJJ.js +0 -16
- package/dist/bundle/openai-NHCDLWWY.js +0 -28
- package/dist/bundle/run-log-JKTLKXSK.js +0 -124
- package/dist/bundle/server-LLGFDLLJ.js +0 -75
- package/dist/bundle/store-connection-4WI32AYU.js +0 -89
- package/dist/bundle/store-maintenance-command-PCXO5AH4.js +0 -65
- package/dist/bundle/tokens-E2QNVC4F.js +0 -20
- /package/dist/bundle/{chunk-YVNHQFLC.js → chunk-7O7XM37N.js} +0 -0
|
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
fold
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KHBZ4OEP.js";
|
|
6
6
|
import {
|
|
7
7
|
CATALOG_KINDS,
|
|
8
8
|
CONTRACT_KINDS,
|
|
@@ -21,27 +21,27 @@ import {
|
|
|
21
21
|
parseReference,
|
|
22
22
|
providerLabel,
|
|
23
23
|
providerNamed
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-QS6DWXDB.js";
|
|
25
25
|
import {
|
|
26
26
|
holdsCredential,
|
|
27
27
|
secretNamed
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-QWGEOQHA.js";
|
|
29
29
|
import {
|
|
30
30
|
QUERY_LIMITS,
|
|
31
31
|
queryError
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-3HTJBGNP.js";
|
|
33
33
|
import {
|
|
34
34
|
CliError,
|
|
35
35
|
isCliError
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-EA2OB75T.js";
|
|
37
37
|
import {
|
|
38
38
|
singleLine
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-HCZYJMBP.js";
|
|
40
40
|
import {
|
|
41
41
|
__name
|
|
42
42
|
} from "./chunk-ZVVMGPBJ.js";
|
|
43
43
|
|
|
44
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
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
|
|
45
45
|
var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
|
|
46
46
|
var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
|
|
47
47
|
var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
|
|
@@ -160,7 +160,7 @@ var fieldError = /* @__PURE__ */ __name((schema, value, at = []) => {
|
|
|
160
160
|
return void 0;
|
|
161
161
|
}, "fieldError");
|
|
162
162
|
|
|
163
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
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
|
|
164
164
|
var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
|
|
165
165
|
var PARTY = ["person", "organization"];
|
|
166
166
|
var ORGANIZATION = ["organization"];
|
|
@@ -458,6 +458,7 @@ var RECORD_TYPES = {
|
|
|
458
458
|
update: "in-place",
|
|
459
459
|
tombstone: true,
|
|
460
460
|
importOnly: true,
|
|
461
|
+
sheet: false,
|
|
461
462
|
fields: objectOf({
|
|
462
463
|
kind: enumOf(["sms"], "sms: a text message of the phone"),
|
|
463
464
|
direction: enumOf(SMS_DIRECTIONS, "in: the other side wrote it; out: the owner did"),
|
|
@@ -475,6 +476,7 @@ var RECORD_TYPES = {
|
|
|
475
476
|
update: "in-place",
|
|
476
477
|
tombstone: true,
|
|
477
478
|
importOnly: true,
|
|
479
|
+
sheet: false,
|
|
478
480
|
fields: objectOf({
|
|
479
481
|
kind: enumOf(["call"], "call: a phone call"),
|
|
480
482
|
direction: enumOf(CALL_DIRECTIONS, "in, out, or missed: a call the owner did not take"),
|
|
@@ -484,6 +486,25 @@ var RECORD_TYPES = {
|
|
|
484
486
|
}, { required: ["kind", "direction", "phone", "started_at"] }),
|
|
485
487
|
roles: COUNTERPART
|
|
486
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
|
+
},
|
|
487
508
|
pipeline: {
|
|
488
509
|
table: "pipelines",
|
|
489
510
|
review: "direct",
|
|
@@ -504,7 +525,7 @@ var RECORD_TYPES = {
|
|
|
504
525
|
}
|
|
505
526
|
};
|
|
506
527
|
var isRecordType = /* @__PURE__ */ __name((type) => Object.hasOwn(RECORD_TYPES, type), "isRecordType");
|
|
507
|
-
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");
|
|
508
529
|
var isIdentityType = /* @__PURE__ */ __name((type) => typeof type === "string" && isRecordType(type) && RECORD_TYPES[type].review === "identity", "isIdentityType");
|
|
509
530
|
var RECORD_ENTITY_TYPES = Object.keys(RECORD_TYPES);
|
|
510
531
|
var RECORD_TABLES = Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, spec]) => [type, spec.table]));
|
|
@@ -534,7 +555,7 @@ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf(type).some(([, role])
|
|
|
534
555
|
var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
|
|
535
556
|
var article = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
|
|
536
557
|
|
|
537
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
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
|
|
538
559
|
var EMAIL_ADDRESS = /^[^\s@]+@[^\s@]+\.[^\s@]+$/u;
|
|
539
560
|
var isEmailAddress = /* @__PURE__ */ __name((value) => EMAIL_ADDRESS.test(value), "isEmailAddress");
|
|
540
561
|
var ROLE_ADDRESS_WORDS = {
|
|
@@ -596,830 +617,7 @@ var PERSON_LIKE = /* @__PURE__ */ new Set(["hr"]);
|
|
|
596
617
|
var isPersonLikeRoleAddress = /* @__PURE__ */ __name((address) => PERSON_LIKE.has(localWord(address)), "isPersonLikeRoleAddress");
|
|
597
618
|
var isNoReplyAddress = /* @__PURE__ */ __name((address) => NO_REPLY.has(localWord(address)), "isNoReplyAddress");
|
|
598
619
|
|
|
599
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
600
|
-
var QUERY_VERSION = 1;
|
|
601
|
-
var QUERY_LIMITS2 = {
|
|
602
|
-
...QUERY_LIMITS,
|
|
603
|
-
pattern: 1024,
|
|
604
|
-
states: 1e4,
|
|
605
|
-
expansions: 1e4,
|
|
606
|
-
candidates: 5e4,
|
|
607
|
-
bodyBytes: 8388608,
|
|
608
|
-
milliseconds: 2e3,
|
|
609
|
-
work: 1e7
|
|
610
|
-
};
|
|
611
|
-
var SEARCH_QUERY = {
|
|
612
|
-
command: "search",
|
|
613
|
-
guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md"
|
|
614
|
-
};
|
|
615
|
-
var MESSAGE_PARSING = { ...SEARCH_QUERY, proximity: true };
|
|
616
|
-
var MOST_WORDS_APART = 50;
|
|
617
|
-
function searchError(reason, span, alternative) {
|
|
618
|
-
queryError(reason, span, alternative, SEARCH_QUERY);
|
|
619
|
-
}
|
|
620
|
-
__name(searchError, "searchError");
|
|
621
|
-
var ANSWER_MS = 1e3;
|
|
622
|
-
var searchTimeLimit = /* @__PURE__ */ __name((deadline, now = Date.now()) => deadline?.explicit ? Math.max(QUERY_LIMITS2.milliseconds, deadline.endsAt - now - ANSWER_MS) : void 0, "searchTimeLimit");
|
|
623
|
-
function outOfTime(limitMs = QUERY_LIMITS2.milliseconds) {
|
|
624
|
-
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 });
|
|
625
|
-
}
|
|
626
|
-
__name(outOfTime, "outOfTime");
|
|
627
|
-
var isQueryLimit = /* @__PURE__ */ __name((error) => isCliError(error) && (error.details.reason === "query.too-large" || error.details.reason === "query.time-limit"), "isQueryLimit");
|
|
628
|
-
function exhausted(budget) {
|
|
629
|
-
throw new CliError("validation_error", `search exceeded its ${budget} budget \u2014 narrow the chat or date range`, {
|
|
630
|
-
reason: "query.too-large",
|
|
631
|
-
budget,
|
|
632
|
-
complete: false
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
__name(exhausted, "exhausted");
|
|
636
|
-
function tooWideTerm([term], budget) {
|
|
637
|
-
if (term === void 0)
|
|
638
|
-
exhausted(budget);
|
|
639
|
-
const part = term.replace(/[*?]+/gu, " ").trim().split(/\s+/u).sort((a, b) => b.length - a.length)[0] ?? term;
|
|
640
|
-
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 });
|
|
641
|
-
}
|
|
642
|
-
__name(tooWideTerm, "tooWideTerm");
|
|
643
|
-
|
|
644
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
|
|
645
|
-
var TAKES = {
|
|
646
|
-
chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
|
|
647
|
-
message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
|
|
648
|
-
};
|
|
649
|
-
var article2 = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
|
|
650
|
-
var wrongKind = /* @__PURE__ */ __name((text2, kind, takes) => new CliError("validation_error", `${text2} names ${article2(kind)} ${kind}; this takes ${TAKES[takes]}`, {
|
|
651
|
-
reason: "ref.wrong-kind"
|
|
652
|
-
}), "wrongKind");
|
|
653
|
-
var wrongProvider = /* @__PURE__ */ __name((text2, provider, kind) => {
|
|
654
|
-
const entry = providerNamed(provider);
|
|
655
|
-
const command = entry?.command;
|
|
656
|
-
const opens = kind === "entity" ? void 0 : entry?.opens?.[kind];
|
|
657
|
-
const how = command && opens ? `open it with ${command} <profile> ${opens} ${text2}` : "open it with its own CLI";
|
|
658
|
-
const label2 = providerLabel(provider);
|
|
659
|
-
return new CliError("validation_error", `${text2} is ${article2(label2.toLowerCase())} ${label2} ${kind}; ${how}`, {
|
|
660
|
-
reason: "ref.wrong-provider"
|
|
661
|
-
});
|
|
662
|
-
}, "wrongProvider");
|
|
663
|
-
var chatReferenceOf = /* @__PURE__ */ __name((text2, provider, takes = "chat") => {
|
|
664
|
-
const trimmed = text2.trim();
|
|
665
|
-
if (!looksLikeReference(trimmed))
|
|
666
|
-
return void 0;
|
|
667
|
-
const reference = parseReference(trimmed);
|
|
668
|
-
if (reference.type !== "chat" && reference.type !== "message")
|
|
669
|
-
throw wrongKind(trimmed, reference.type, takes);
|
|
670
|
-
if (reference.provider !== provider)
|
|
671
|
-
throw wrongProvider(trimmed, reference.provider, reference.type);
|
|
672
|
-
const found = {
|
|
673
|
-
text: trimmed,
|
|
674
|
-
provider: reference.provider,
|
|
675
|
-
account: reference.account,
|
|
676
|
-
chat: reference.chat,
|
|
677
|
-
...reference.type === "message" ? { message: reference.message } : {}
|
|
678
|
-
};
|
|
679
|
-
return found;
|
|
680
|
-
}, "chatReferenceOf");
|
|
681
|
-
var contactReferenceOf = /* @__PURE__ */ __name((text2, provider) => {
|
|
682
|
-
const trimmed = text2.trim();
|
|
683
|
-
if (!trimmed.startsWith("contact:"))
|
|
684
|
-
return void 0;
|
|
685
|
-
const reference = parseReference(trimmed);
|
|
686
|
-
if (reference.type !== "contact")
|
|
687
|
-
return void 0;
|
|
688
|
-
if (provider !== void 0 && reference.provider !== provider)
|
|
689
|
-
throw wrongProvider(trimmed, reference.provider, reference.type);
|
|
690
|
-
return reference.id;
|
|
691
|
-
}, "contactReferenceOf");
|
|
692
|
-
var wrongAccount = /* @__PURE__ */ __name((reference, scope, profiles) => {
|
|
693
|
-
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}`;
|
|
694
|
-
const others = profiles === void 0 ? "" : `. Profiles signed in to ${reference.account}: ${profiles.length > 0 ? profiles.join(", ") : "none here"}`;
|
|
695
|
-
return new CliError("validation_error", `${reference.text} belongs to account ${reference.account}; ${here}${others}`, { reason: "ref.wrong-account" });
|
|
696
|
-
}, "wrongAccount");
|
|
697
|
-
var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn) => {
|
|
698
|
-
if (scope.account !== void 0 && scope.account === reference.account)
|
|
699
|
-
return;
|
|
700
|
-
const profiles = await profilesOn?.(reference.account).catch(() => void 0);
|
|
701
|
-
throw wrongAccount(reference, scope, profiles);
|
|
702
|
-
}, "ensureAccount");
|
|
703
|
-
|
|
704
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
705
|
-
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
706
|
-
var literal = /* @__PURE__ */ __name((c) => ({
|
|
707
|
-
kind: "char",
|
|
708
|
-
ranges: [[c.codePointAt(0) ?? 0, c.codePointAt(0) ?? 0]],
|
|
709
|
-
negate: false
|
|
710
|
-
}), "literal");
|
|
711
|
-
var compileAutomaton = /* @__PURE__ */ __name((pattern, span = { start: 0, end: pattern.length }) => {
|
|
712
|
-
if (pattern.length > QUERY_LIMITS2.pattern * 2)
|
|
713
|
-
exhausted("pattern");
|
|
714
|
-
const chars = [...pattern];
|
|
715
|
-
if (chars.length > QUERY_LIMITS2.pattern)
|
|
716
|
-
exhausted("pattern");
|
|
717
|
-
let at = 0, depth = 0;
|
|
718
|
-
const failure = /* @__PURE__ */ __name(() => searchError("query.invalid-regex", span, "use the supported Lucene regex subset"), "failure");
|
|
719
|
-
const character = /* @__PURE__ */ __name(() => {
|
|
720
|
-
if (at >= chars.length)
|
|
721
|
-
return failure();
|
|
722
|
-
return chars[at++];
|
|
723
|
-
}, "character");
|
|
724
|
-
const predefined = /* @__PURE__ */ __name(() => {
|
|
725
|
-
if (chars[at] !== "\\")
|
|
726
|
-
return void 0;
|
|
727
|
-
const name = chars[at + 1] ?? "";
|
|
728
|
-
let ranges;
|
|
729
|
-
if (name.toLowerCase() === "d")
|
|
730
|
-
ranges = [[48, 57]];
|
|
731
|
-
if (name.toLowerCase() === "w")
|
|
732
|
-
ranges = [
|
|
733
|
-
[48, 57],
|
|
734
|
-
[65, 90],
|
|
735
|
-
[95, 95],
|
|
736
|
-
[97, 122]
|
|
737
|
-
];
|
|
738
|
-
if (name.toLowerCase() === "s")
|
|
739
|
-
ranges = [
|
|
740
|
-
[9, 10],
|
|
741
|
-
[13, 13],
|
|
742
|
-
[32, 32]
|
|
743
|
-
];
|
|
744
|
-
if (ranges) {
|
|
745
|
-
at += 2;
|
|
746
|
-
return { kind: "char", ranges, negate: name === name.toUpperCase() };
|
|
747
|
-
}
|
|
748
|
-
if (/^[a-zA-Z]$/u.test(name))
|
|
749
|
-
return failure();
|
|
750
|
-
return void 0;
|
|
751
|
-
}, "predefined");
|
|
752
|
-
const escaped = /* @__PURE__ */ __name(() => {
|
|
753
|
-
if (chars[at] === "\\")
|
|
754
|
-
at++;
|
|
755
|
-
return character();
|
|
756
|
-
}, "escaped");
|
|
757
|
-
const union = /* @__PURE__ */ __name(() => {
|
|
758
|
-
if (++depth > QUERY_LIMITS2.depth)
|
|
759
|
-
exhausted("pattern depth");
|
|
760
|
-
const children = [concat()];
|
|
761
|
-
while (chars[at] === "|") {
|
|
762
|
-
at++;
|
|
763
|
-
children.push(concat());
|
|
764
|
-
}
|
|
765
|
-
depth--;
|
|
766
|
-
return children.length === 1 ? children[0] : { kind: "union", children };
|
|
767
|
-
}, "union");
|
|
768
|
-
const concat = /* @__PURE__ */ __name(() => {
|
|
769
|
-
const children = [];
|
|
770
|
-
do {
|
|
771
|
-
children.push(repeat());
|
|
772
|
-
} while (at < chars.length && ![")", "|", "&"].includes(chars[at] ?? ""));
|
|
773
|
-
if (chars[at] === "&")
|
|
774
|
-
searchError("query.unsupported-regex", span, "automaton intersection is not supported");
|
|
775
|
-
return children.length === 1 ? children[0] : { kind: "concat", children };
|
|
776
|
-
}, "concat");
|
|
777
|
-
const repeat = /* @__PURE__ */ __name(() => {
|
|
778
|
-
let child = simple();
|
|
779
|
-
while (["?", "*", "+", "{"].includes(chars[at] ?? "")) {
|
|
780
|
-
const op = character();
|
|
781
|
-
let min = op === "+" ? 1 : 0, max = op === "?" ? 1 : null;
|
|
782
|
-
if (op === "{") {
|
|
783
|
-
const number = /* @__PURE__ */ __name(() => {
|
|
784
|
-
const start2 = at;
|
|
785
|
-
while (/^[0-9]$/u.test(chars[at] ?? ""))
|
|
786
|
-
at++;
|
|
787
|
-
if (at === start2)
|
|
788
|
-
return failure();
|
|
789
|
-
return Number(chars.slice(start2, at).join(""));
|
|
790
|
-
}, "number");
|
|
791
|
-
min = number();
|
|
792
|
-
max = min;
|
|
793
|
-
if (chars[at] === ",") {
|
|
794
|
-
at++;
|
|
795
|
-
max = chars[at] === "}" ? null : number();
|
|
796
|
-
}
|
|
797
|
-
if (character() !== "}" || max !== null && max < min)
|
|
798
|
-
return failure();
|
|
799
|
-
}
|
|
800
|
-
if (min > QUERY_LIMITS2.states || max !== null && max > QUERY_LIMITS2.states)
|
|
801
|
-
exhausted("automaton states");
|
|
802
|
-
child = { kind: "repeat", child, min, max };
|
|
803
|
-
}
|
|
804
|
-
return child;
|
|
805
|
-
}, "repeat");
|
|
806
|
-
const simple = /* @__PURE__ */ __name(() => {
|
|
807
|
-
const predefinedAtom = predefined();
|
|
808
|
-
if (predefinedAtom)
|
|
809
|
-
return predefinedAtom;
|
|
810
|
-
const c = character();
|
|
811
|
-
if (c === "~" || c === "<")
|
|
812
|
-
searchError("query.unsupported-regex", span, "complement, named automata and numeric intervals are not supported");
|
|
813
|
-
if (c === ".")
|
|
814
|
-
return any;
|
|
815
|
-
if (c === "#")
|
|
816
|
-
return { kind: "empty" };
|
|
817
|
-
if (c === "@")
|
|
818
|
-
return { kind: "repeat", child: any, min: 0, max: null };
|
|
819
|
-
if (c === '"') {
|
|
820
|
-
const children = [];
|
|
821
|
-
while (chars[at] !== '"')
|
|
822
|
-
children.push(literal(character()));
|
|
823
|
-
at++;
|
|
824
|
-
return { kind: "concat", children };
|
|
825
|
-
}
|
|
826
|
-
if (c === "(") {
|
|
827
|
-
if (chars[at] === ")") {
|
|
828
|
-
at++;
|
|
829
|
-
return { kind: "epsilon" };
|
|
830
|
-
}
|
|
831
|
-
if (chars[at] === "?")
|
|
832
|
-
searchError("query.unsupported-regex", span, "JavaScript groups and lookaround are not Lucene operators");
|
|
833
|
-
const child = union();
|
|
834
|
-
if (character() !== ")")
|
|
835
|
-
return failure();
|
|
836
|
-
return child;
|
|
837
|
-
}
|
|
838
|
-
if (c === "[") {
|
|
839
|
-
const negate = chars[at] === "^";
|
|
840
|
-
if (negate)
|
|
841
|
-
at++;
|
|
842
|
-
const choices = [];
|
|
843
|
-
do {
|
|
844
|
-
const pre = predefined();
|
|
845
|
-
if (pre) {
|
|
846
|
-
choices.push(pre);
|
|
847
|
-
continue;
|
|
848
|
-
}
|
|
849
|
-
const lo = escaped().codePointAt(0) ?? 0;
|
|
850
|
-
let hi = lo;
|
|
851
|
-
if (chars[at] === "-") {
|
|
852
|
-
at++;
|
|
853
|
-
hi = escaped().codePointAt(0) ?? 0;
|
|
854
|
-
}
|
|
855
|
-
if (hi < lo)
|
|
856
|
-
return failure();
|
|
857
|
-
choices.push({ kind: "char", ranges: [[lo, hi]], negate: false });
|
|
858
|
-
} while (at < chars.length && chars[at] !== "]");
|
|
859
|
-
if (character() !== "]")
|
|
860
|
-
return failure();
|
|
861
|
-
if (!negate)
|
|
862
|
-
return { kind: "union", children: choices };
|
|
863
|
-
const ranges = [];
|
|
864
|
-
for (const choice of choices) {
|
|
865
|
-
if (choice.kind !== "char" || choice.negate)
|
|
866
|
-
searchError("query.unsupported-regex", span, "negative predefined classes inside a negated class are not supported");
|
|
867
|
-
ranges.push(...choice.ranges);
|
|
868
|
-
}
|
|
869
|
-
return { kind: "char", ranges, negate: true };
|
|
870
|
-
}
|
|
871
|
-
if (c === "\\")
|
|
872
|
-
return literal(character());
|
|
873
|
-
return literal(c);
|
|
874
|
-
}, "simple");
|
|
875
|
-
const expression = chars.length === 0 ? { kind: "epsilon" } : union();
|
|
876
|
-
if (at !== chars.length)
|
|
877
|
-
return failure();
|
|
878
|
-
const states = [];
|
|
879
|
-
const state = /* @__PURE__ */ __name(() => {
|
|
880
|
-
if (states.length >= QUERY_LIMITS2.states)
|
|
881
|
-
exhausted("automaton states");
|
|
882
|
-
states.push({ epsilon: [], edges: [] });
|
|
883
|
-
return states.length - 1;
|
|
884
|
-
}, "state");
|
|
885
|
-
const epsilon = /* @__PURE__ */ __name((from, to) => {
|
|
886
|
-
;
|
|
887
|
-
states[from].epsilon.push(to);
|
|
888
|
-
}, "epsilon");
|
|
889
|
-
const build = /* @__PURE__ */ __name((node, from, to) => {
|
|
890
|
-
if (node.kind === "char") {
|
|
891
|
-
;
|
|
892
|
-
states[from].edges.push({ to, atom: node });
|
|
893
|
-
return;
|
|
894
|
-
}
|
|
895
|
-
if (node.kind === "empty")
|
|
896
|
-
return;
|
|
897
|
-
if (node.kind === "epsilon") {
|
|
898
|
-
epsilon(from, to);
|
|
899
|
-
return;
|
|
900
|
-
}
|
|
901
|
-
if (node.kind === "union") {
|
|
902
|
-
for (const child of node.children)
|
|
903
|
-
build(child, from, to);
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
if (node.kind === "concat") {
|
|
907
|
-
let current2 = from;
|
|
908
|
-
node.children.forEach((child, index) => {
|
|
909
|
-
const next = index === node.children.length - 1 ? to : state();
|
|
910
|
-
build(child, current2, next);
|
|
911
|
-
current2 = next;
|
|
912
|
-
});
|
|
913
|
-
if (node.children.length === 0)
|
|
914
|
-
epsilon(from, to);
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
917
|
-
let current = from;
|
|
918
|
-
for (let i = 0; i < node.min; i++) {
|
|
919
|
-
const next = state();
|
|
920
|
-
build(node.child, current, next);
|
|
921
|
-
current = next;
|
|
922
|
-
}
|
|
923
|
-
if (node.max === null) {
|
|
924
|
-
epsilon(current, to);
|
|
925
|
-
const end2 = state();
|
|
926
|
-
build(node.child, current, end2);
|
|
927
|
-
epsilon(end2, current);
|
|
928
|
-
} else {
|
|
929
|
-
for (let i = node.min; i < node.max; i++) {
|
|
930
|
-
epsilon(current, to);
|
|
931
|
-
const next = state();
|
|
932
|
-
build(node.child, current, next);
|
|
933
|
-
current = next;
|
|
934
|
-
}
|
|
935
|
-
epsilon(current, to);
|
|
936
|
-
}
|
|
937
|
-
}, "build");
|
|
938
|
-
const start = state(), end = state();
|
|
939
|
-
build(expression, start, end);
|
|
940
|
-
return {
|
|
941
|
-
states: states.length,
|
|
942
|
-
test: /* @__PURE__ */ __name((text2, budget = { work: 0 }) => {
|
|
943
|
-
const spend = /* @__PURE__ */ __name(() => {
|
|
944
|
-
if (++budget.work > (budget.maxWork ?? QUERY_LIMITS2.work))
|
|
945
|
-
exhausted("automaton work");
|
|
946
|
-
}, "spend");
|
|
947
|
-
const closure = /* @__PURE__ */ __name((initial) => {
|
|
948
|
-
const stack = [...initial];
|
|
949
|
-
while (stack.length) {
|
|
950
|
-
const id = stack.pop();
|
|
951
|
-
for (const next of states[id].epsilon) {
|
|
952
|
-
spend();
|
|
953
|
-
if (!initial.has(next)) {
|
|
954
|
-
initial.add(next);
|
|
955
|
-
stack.push(next);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
return initial;
|
|
960
|
-
}, "closure");
|
|
961
|
-
let current = closure(/* @__PURE__ */ new Set([start]));
|
|
962
|
-
for (const c of text2) {
|
|
963
|
-
const point = c.codePointAt(0) ?? 0;
|
|
964
|
-
const next = /* @__PURE__ */ new Set();
|
|
965
|
-
for (const id of current)
|
|
966
|
-
for (const edge of states[id].edges) {
|
|
967
|
-
spend();
|
|
968
|
-
const inside = edge.atom.ranges.some(([lo, hi]) => point >= lo && point <= hi);
|
|
969
|
-
if (inside !== edge.atom.negate)
|
|
970
|
-
next.add(edge.to);
|
|
971
|
-
}
|
|
972
|
-
current = closure(next);
|
|
973
|
-
if (current.size === 0)
|
|
974
|
-
return false;
|
|
975
|
-
}
|
|
976
|
-
return current.has(end);
|
|
977
|
-
}, "test")
|
|
978
|
-
};
|
|
979
|
-
}, "compileAutomaton");
|
|
980
|
-
var wildcardPattern = /* @__PURE__ */ __name((value) => {
|
|
981
|
-
const chars = [...value];
|
|
982
|
-
let pattern = "";
|
|
983
|
-
for (let at = 0; at < chars.length; at++) {
|
|
984
|
-
const c = chars[at];
|
|
985
|
-
if (c === "\\") {
|
|
986
|
-
const escaped = chars[++at];
|
|
987
|
-
if (escaped === void 0)
|
|
988
|
-
searchError("query.invalid-escape", { start: 0, end: value.length });
|
|
989
|
-
pattern += /[|&?*+(){}[\].#@<>"~\\]/u.test(escaped) ? `\\${escaped}` : escaped;
|
|
990
|
-
} else
|
|
991
|
-
pattern += c === "*" ? ".*" : c === "?" ? "." : /[|&?*+(){}[\].#@<>"~\\]/u.test(c) ? `\\${c}` : c;
|
|
992
|
-
}
|
|
993
|
-
return pattern;
|
|
994
|
-
}, "wildcardPattern");
|
|
995
|
-
var FOLD_RANGE = 4096;
|
|
996
|
-
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");
|
|
997
|
-
var classChar = /* @__PURE__ */ __name((point) => {
|
|
998
|
-
const c = String.fromCodePoint(point);
|
|
999
|
-
return /[\p{L}\p{N}]/u.test(c) ? c : `\\${c}`;
|
|
1000
|
-
}, "classChar");
|
|
1001
|
-
var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
1002
|
-
const chars = [...pattern.normalize("NFC")];
|
|
1003
|
-
let out = "";
|
|
1004
|
-
let at = 0;
|
|
1005
|
-
const literal2 = /* @__PURE__ */ __name((c) => {
|
|
1006
|
-
if (!/[\p{L}\p{N}\p{M}]/u.test(c))
|
|
1007
|
-
return c;
|
|
1008
|
-
const folded = fold(c);
|
|
1009
|
-
if (folded === "")
|
|
1010
|
-
return unfoldable(span, `"${c}"`);
|
|
1011
|
-
if ([...folded].length === 1 && /[\p{L}\p{N}]/u.test(folded))
|
|
1012
|
-
return folded;
|
|
1013
|
-
if (folded.includes('"'))
|
|
1014
|
-
return unfoldable(span, `"${c}"`);
|
|
1015
|
-
return `"${folded}"`;
|
|
1016
|
-
}, "literal");
|
|
1017
|
-
const characterClass = /* @__PURE__ */ __name(() => {
|
|
1018
|
-
const begin = at - 1;
|
|
1019
|
-
let negate = "";
|
|
1020
|
-
if (chars[at] === "^") {
|
|
1021
|
-
negate = "^";
|
|
1022
|
-
at++;
|
|
1023
|
-
}
|
|
1024
|
-
const kept2 = [];
|
|
1025
|
-
const points = /* @__PURE__ */ new Set();
|
|
1026
|
-
do {
|
|
1027
|
-
const start = at;
|
|
1028
|
-
if (chars[at] === "\\" && /^[a-zA-Z]$/u.test(chars[at + 1] ?? "")) {
|
|
1029
|
-
kept2.push(`\\${chars[at + 1]}`);
|
|
1030
|
-
at += 2;
|
|
1031
|
-
continue;
|
|
1032
|
-
}
|
|
1033
|
-
const escaped = /* @__PURE__ */ __name(() => {
|
|
1034
|
-
if (chars[at] === "\\")
|
|
1035
|
-
at++;
|
|
1036
|
-
return (chars[at++] ?? "").codePointAt(0) ?? 0;
|
|
1037
|
-
}, "escaped");
|
|
1038
|
-
const lo = escaped();
|
|
1039
|
-
let hi = lo;
|
|
1040
|
-
if (chars[at] === "-") {
|
|
1041
|
-
at++;
|
|
1042
|
-
hi = escaped();
|
|
1043
|
-
}
|
|
1044
|
-
if (at > chars.length) {
|
|
1045
|
-
out += chars.slice(begin).join("");
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
const single = /* @__PURE__ */ __name((point) => [...fold(String.fromCodePoint(point))], "single");
|
|
1049
|
-
if (hi < lo)
|
|
1050
|
-
kept2.push(chars.slice(start, at).join(""));
|
|
1051
|
-
else if (hi - lo >= FOLD_RANGE) {
|
|
1052
|
-
if (single(lo).join("") !== String.fromCodePoint(lo) || single(hi).join("") !== String.fromCodePoint(hi))
|
|
1053
|
-
unfoldable(span, `the range ${chars.slice(start, at).join("")}`);
|
|
1054
|
-
kept2.push(chars.slice(start, at).join(""));
|
|
1055
|
-
} else
|
|
1056
|
-
for (let point = lo; point <= hi; point++) {
|
|
1057
|
-
const folded = single(point);
|
|
1058
|
-
if (folded.length === 1)
|
|
1059
|
-
points.add(folded[0]?.codePointAt(0) ?? 0);
|
|
1060
|
-
else if (lo === hi)
|
|
1061
|
-
unfoldable(span, `"${String.fromCodePoint(point)}"`);
|
|
1062
|
-
}
|
|
1063
|
-
} while (at < chars.length && chars[at] !== "]");
|
|
1064
|
-
const sorted = [...points].sort((a, b) => a - b);
|
|
1065
|
-
const ranges = [];
|
|
1066
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
1067
|
-
const first = sorted[i];
|
|
1068
|
-
while (sorted[i + 1] === sorted[i] + 1)
|
|
1069
|
-
i++;
|
|
1070
|
-
const last = sorted[i];
|
|
1071
|
-
ranges.push(last === first ? classChar(first) : `${classChar(first)}-${classChar(last)}`);
|
|
1072
|
-
}
|
|
1073
|
-
if (!kept2.length && !ranges.length)
|
|
1074
|
-
unfoldable(span, "the class");
|
|
1075
|
-
out += `[${negate}${kept2.join("")}${ranges.join("")}`;
|
|
1076
|
-
}, "characterClass");
|
|
1077
|
-
while (at < chars.length) {
|
|
1078
|
-
const c = chars[at++];
|
|
1079
|
-
if (c === "\\") {
|
|
1080
|
-
const next = chars[at++];
|
|
1081
|
-
if (next === void 0)
|
|
1082
|
-
out += c;
|
|
1083
|
-
else
|
|
1084
|
-
out += (next.codePointAt(0) ?? 0) < 128 ? `${c}${next}` : literal2(next);
|
|
1085
|
-
} else if (c === '"') {
|
|
1086
|
-
const end = chars.indexOf('"', at);
|
|
1087
|
-
if (end < 0) {
|
|
1088
|
-
out += chars.slice(at - 1).join("");
|
|
1089
|
-
break;
|
|
1090
|
-
}
|
|
1091
|
-
const folded = fold(chars.slice(at, end).join(""));
|
|
1092
|
-
if (folded.includes('"'))
|
|
1093
|
-
unfoldable(span, `"${chars.slice(at, end).join("")}"`);
|
|
1094
|
-
out += `"${folded}"`;
|
|
1095
|
-
at = end + 1;
|
|
1096
|
-
} else if (c === "[")
|
|
1097
|
-
characterClass();
|
|
1098
|
-
else
|
|
1099
|
-
out += literal2(c);
|
|
1100
|
-
}
|
|
1101
|
-
return out;
|
|
1102
|
-
}, "foldRegex");
|
|
1103
|
-
|
|
1104
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
1105
|
-
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
1106
|
-
const padded = ` ${term} `;
|
|
1107
|
-
const pieces = /* @__PURE__ */ new Set();
|
|
1108
|
-
for (let at = 0; at + 3 <= padded.length; at++)
|
|
1109
|
-
pieces.add(padded.slice(at, at + 3));
|
|
1110
|
-
return [...pieces];
|
|
1111
|
-
}, "trigrams");
|
|
1112
|
-
|
|
1113
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/resolve.js
|
|
1114
|
-
var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
|
|
1115
|
-
var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
|
|
1116
|
-
var pickChat = /* @__PURE__ */ __name((reference, chats) => {
|
|
1117
|
-
const wanted = foldName(reference.trim());
|
|
1118
|
-
const matches = chats.filter((chat) => chat.title !== null && foldName(chat.title).includes(wanted));
|
|
1119
|
-
if (matches.length === 1 && matches[0])
|
|
1120
|
-
return matches[0];
|
|
1121
|
-
if (matches.length === 0)
|
|
1122
|
-
throw new CliError("not_found", `no chat matches "${reference}"`);
|
|
1123
|
-
throw ambiguous(reference, "chats", matches.map((chat) => ({ id: chat.id, title: chat.title })), ({ title }) => singleLine(String(title)));
|
|
1124
|
-
}, "pickChat");
|
|
1125
|
-
var pickPerson = /* @__PURE__ */ __name((reference, people) => {
|
|
1126
|
-
const trimmed = reference.trim();
|
|
1127
|
-
const contact = contactReferenceOf(trimmed, people.provider);
|
|
1128
|
-
if (contact !== void 0) {
|
|
1129
|
-
const named = people.get(contact);
|
|
1130
|
-
if (named)
|
|
1131
|
-
return named;
|
|
1132
|
-
throw new CliError("not_found", `no person ${contact} in what this account has seen`);
|
|
1133
|
-
}
|
|
1134
|
-
const known = people.get(trimmed);
|
|
1135
|
-
if (known)
|
|
1136
|
-
return known;
|
|
1137
|
-
if (isId(trimmed))
|
|
1138
|
-
throw new CliError("not_found", `no person ${trimmed} in what this account has seen`);
|
|
1139
|
-
const wanted = foldName(trimmed.replace(/^@/, ""));
|
|
1140
|
-
const everyone = people.all().toSorted((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
|
|
1141
|
-
const exact = everyone.filter((person) => namesOf(person).includes(wanted));
|
|
1142
|
-
const containing = everyone.filter((person) => namesOf(person).some((one) => one.includes(wanted)));
|
|
1143
|
-
if (exact.length === 1 && exact[0])
|
|
1144
|
-
return exact[0];
|
|
1145
|
-
if (containing.length === 1 && containing[0])
|
|
1146
|
-
return containing[0];
|
|
1147
|
-
if (containing.length === 0)
|
|
1148
|
-
throw new CliError("not_found", `nobody matches "${reference}"`);
|
|
1149
|
-
const matches = exact.length > 0 ? [...exact, ...containing.filter((person) => !exact.includes(person))] : containing;
|
|
1150
|
-
throw ambiguous(reference, "people", matches.map(({ id, name, username }) => ({ id, name, username })), ({ name, username }) => singleLine([name, username && `@${username}`].filter(isPresent).join(" ")));
|
|
1151
|
-
}, "pickPerson");
|
|
1152
|
-
var namesOf = /* @__PURE__ */ __name((person, byAddress = false) => [person.alias, person.name, person.username, byAddress ? person.id : void 0].filter(isPresent).map(foldName), "namesOf");
|
|
1153
|
-
var chatNamesOf = /* @__PURE__ */ __name((chat) => [chat.title, chat.providerMetadata?.username].filter((one) => typeof one === "string" && one !== "").map(foldName), "chatNamesOf");
|
|
1154
|
-
var namePattern = /* @__PURE__ */ __name((pattern) => {
|
|
1155
|
-
const automaton = compileAutomaton(wildcardPattern(foldName(pattern.trim().replace(/^@/, ""))));
|
|
1156
|
-
return (names) => names.some((one) => automaton.test(one));
|
|
1157
|
-
}, "namePattern");
|
|
1158
|
-
var peopleMatching = /* @__PURE__ */ __name((pattern, people, { byAddress = false } = {}) => {
|
|
1159
|
-
const fits = namePattern(pattern);
|
|
1160
|
-
return people.filter((person) => fits(namesOf(person, byAddress)));
|
|
1161
|
-
}, "peopleMatching");
|
|
1162
|
-
var chatsMatching = /* @__PURE__ */ __name((pattern, chats) => {
|
|
1163
|
-
const fits = namePattern(pattern);
|
|
1164
|
-
return chats.filter((chat) => fits(chatNamesOf(chat)));
|
|
1165
|
-
}, "chatsMatching");
|
|
1166
|
-
var nearest = /* @__PURE__ */ __name((pattern, items, names, most = 5) => {
|
|
1167
|
-
const pieces = /* @__PURE__ */ __name((text2) => foldName(text2).split(/\s+/u).flatMap(trigrams), "pieces");
|
|
1168
|
-
const wanted = new Set(pieces(pattern.replace(/\\(.)/gu, "$1").replace(/[*?@]/gu, " ").trim()));
|
|
1169
|
-
if (wanted.size === 0)
|
|
1170
|
-
return [];
|
|
1171
|
-
return items.map((item) => ({
|
|
1172
|
-
item,
|
|
1173
|
-
score: names(item).flatMap(pieces).filter((piece) => wanted.has(piece)).length
|
|
1174
|
-
})).filter(({ score }) => score > 1).toSorted((a, b) => b.score - a.score).slice(0, most).map(({ item }) => item);
|
|
1175
|
-
}, "nearest");
|
|
1176
|
-
var ambiguous = /* @__PURE__ */ __name((reference, what, candidates, label2) => {
|
|
1177
|
-
const width = Math.max(...candidates.map(({ id }) => id.length));
|
|
1178
|
-
const lines = candidates.map((candidate) => ` ${candidate.id.padEnd(width)} ${label2(candidate)}`).join("\n");
|
|
1179
|
-
return new CliError("validation_error", `"${singleLine(reference)}" matches ${candidates.length} ${what} \u2014 name one by its id:
|
|
1180
|
-
${lines}`, { candidates });
|
|
1181
|
-
}, "ambiguous");
|
|
1182
|
-
var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
|
|
1183
|
-
|
|
1184
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/display-names.js
|
|
1185
|
-
var QUOTES = [
|
|
1186
|
-
['"', '"'],
|
|
1187
|
-
["'", "'"],
|
|
1188
|
-
["\xAB", "\xBB"],
|
|
1189
|
-
["\u201C", "\u201D"],
|
|
1190
|
-
["\u201E", "\u201C"],
|
|
1191
|
-
["\u2018", "\u2019"],
|
|
1192
|
-
["`", "`"]
|
|
1193
|
-
];
|
|
1194
|
-
var READABLE = /[\p{L}\p{N}]/u;
|
|
1195
|
-
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"]);
|
|
1196
|
-
var unquoted = /* @__PURE__ */ __name((text2) => {
|
|
1197
|
-
let at = text2.replace(/\s+/gu, " ").trim();
|
|
1198
|
-
for (; ; ) {
|
|
1199
|
-
const pair = QUOTES.find(([open, close]) => at.length >= 2 && at.startsWith(open) && at.endsWith(close));
|
|
1200
|
-
if (pair === void 0)
|
|
1201
|
-
return at;
|
|
1202
|
-
at = at.slice(pair[0].length, at.length - pair[1].length).trim();
|
|
1203
|
-
}
|
|
1204
|
-
}, "unquoted");
|
|
1205
|
-
var given = /* @__PURE__ */ __name((value) => {
|
|
1206
|
-
const text2 = typeof value === "string" ? value.trim() : "";
|
|
1207
|
-
return text2 === "" ? void 0 : text2;
|
|
1208
|
-
}, "given");
|
|
1209
|
-
var displayName = /* @__PURE__ */ __name((name, fallbacks = {}) => {
|
|
1210
|
-
const unwrapped = typeof name === "string" ? unquoted(name) : "";
|
|
1211
|
-
const cleaned = PLACEHOLDERS.has(unwrapped.toLowerCase()) ? "" : unwrapped;
|
|
1212
|
-
if (READABLE.test(cleaned))
|
|
1213
|
-
return cleaned;
|
|
1214
|
-
const borrowed = fallbacks.name === void 0 || fallbacks.name === null ? null : displayName(fallbacks.name);
|
|
1215
|
-
if (borrowed !== null && READABLE.test(borrowed) && !borrowed.startsWith("@"))
|
|
1216
|
-
return borrowed;
|
|
1217
|
-
const username = given(fallbacks.username);
|
|
1218
|
-
return (username === void 0 ? void 0 : username.startsWith("@") ? username : `@${username}`) ?? given(fallbacks.phone) ?? given(fallbacks.email) ?? (cleaned === "" ? null : cleaned);
|
|
1219
|
-
}, "displayName");
|
|
1220
|
-
var present = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "" ? value : null, "present");
|
|
1221
|
-
var takeFallbacks = /* @__PURE__ */ __name((into, identity) => {
|
|
1222
|
-
const named = displayName(identity.name);
|
|
1223
|
-
if (into.name === null && isReadable(named) && !named?.startsWith("@"))
|
|
1224
|
-
into.name = named;
|
|
1225
|
-
into.username ??= present(identity.username);
|
|
1226
|
-
into.phone ??= present(identity.phone) ?? (identity.provider === "phone" ? identity.id : null);
|
|
1227
|
-
into.email ??= present(identity.email) ?? (identity.provider === "email" ? identity.id : null);
|
|
1228
|
-
return into;
|
|
1229
|
-
}, "takeFallbacks");
|
|
1230
|
-
var noFallbacks = /* @__PURE__ */ __name(() => ({ name: null, username: null, phone: null, email: null }), "noFallbacks");
|
|
1231
|
-
var nameKey = /* @__PURE__ */ __name((name) => {
|
|
1232
|
-
if (typeof name !== "string")
|
|
1233
|
-
return null;
|
|
1234
|
-
const unwrapped = unquoted(name);
|
|
1235
|
-
if (PLACEHOLDERS.has(unwrapped.toLowerCase()))
|
|
1236
|
-
return null;
|
|
1237
|
-
const words = foldName(unwrapped).split(/[^\p{L}\p{N}]+/u).filter((word) => word !== "");
|
|
1238
|
-
return words.length === 0 ? null : words.sort().join(" ");
|
|
1239
|
-
}, "nameKey");
|
|
1240
|
-
var isReadable = /* @__PURE__ */ __name((shown) => shown !== null && READABLE.test(shown), "isReadable");
|
|
1241
|
-
|
|
1242
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
1243
|
-
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
1244
|
-
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
1245
|
-
var counterValue = /* @__PURE__ */ __name((message, field) => {
|
|
1246
|
-
const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
|
|
1247
|
-
return validCounter(value) ? value : null;
|
|
1248
|
-
}, "counterValue");
|
|
1249
|
-
var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
|
|
1250
|
-
const at = Date.parse(observation.observedAt);
|
|
1251
|
-
if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
|
|
1252
|
-
throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
|
|
1253
|
-
if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
|
|
1254
|
-
throw new CliError("validation_error", "reaction observation payload and total disagree");
|
|
1255
|
-
return at;
|
|
1256
|
-
}, "counterObservationTime");
|
|
1257
|
-
var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
|
|
1258
|
-
const observations = {};
|
|
1259
|
-
for (const field of fields) {
|
|
1260
|
-
const value = counterValue(message, field);
|
|
1261
|
-
if (value !== null)
|
|
1262
|
-
observations[field] = {
|
|
1263
|
-
value,
|
|
1264
|
-
observedAt,
|
|
1265
|
-
source,
|
|
1266
|
-
...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
|
|
1267
|
-
};
|
|
1268
|
-
}
|
|
1269
|
-
return { ...message, counterObservations: observations };
|
|
1270
|
-
}, "observedCounters");
|
|
1271
|
-
var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
1272
|
-
if (!states.length || states.every((one) => one.freshness === "unknown"))
|
|
1273
|
-
return "unknown";
|
|
1274
|
-
if (states.some((one) => one.freshness === "unknown"))
|
|
1275
|
-
return "partial";
|
|
1276
|
-
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
1277
|
-
}, "counterFreshness");
|
|
1278
|
-
|
|
1279
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
1280
|
-
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
1281
|
-
var AUTHOR_MEASURES = [
|
|
1282
|
-
"messages",
|
|
1283
|
-
"words",
|
|
1284
|
-
"reactions",
|
|
1285
|
-
"replies",
|
|
1286
|
-
"answers",
|
|
1287
|
-
"answer-time",
|
|
1288
|
-
"threads",
|
|
1289
|
-
"active-days"
|
|
1290
|
-
];
|
|
1291
|
-
var CONTEXT = /* @__PURE__ */ new Set([
|
|
1292
|
-
"replies",
|
|
1293
|
-
"replies-from-others",
|
|
1294
|
-
"replies-from-others-per-message",
|
|
1295
|
-
"thread-size",
|
|
1296
|
-
"threads",
|
|
1297
|
-
"answers",
|
|
1298
|
-
"answer-time"
|
|
1299
|
-
]);
|
|
1300
|
-
var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
|
|
1301
|
-
var presets = {
|
|
1302
|
-
helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
|
|
1303
|
-
active: { "active-days": 0.6, messages: 0.4 },
|
|
1304
|
-
engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
|
|
1305
|
-
};
|
|
1306
|
-
function invalid(message) {
|
|
1307
|
-
throw new CliError("validation_error", message, { reason: "ranking.invalid" });
|
|
1308
|
-
}
|
|
1309
|
-
__name(invalid, "invalid");
|
|
1310
|
-
var rankingOptions = /* @__PURE__ */ __name((target, input) => {
|
|
1311
|
-
const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
|
|
1312
|
-
const { measure, score, weights: given2, minMessages } = input;
|
|
1313
|
-
const messageKind = input.messageKind ?? "all";
|
|
1314
|
-
if (!["all", "posts", "comments"].includes(messageKind))
|
|
1315
|
-
invalid("message_kind takes all, posts or comments");
|
|
1316
|
-
if (target === "messages" && minMessages !== void 0)
|
|
1317
|
-
invalid("min_messages applies to stats contacts top");
|
|
1318
|
-
if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
|
|
1319
|
-
invalid("min_messages takes a positive integer");
|
|
1320
|
-
if (measure !== void 0 && !measures.includes(measure))
|
|
1321
|
-
invalid(`--measure takes ${measures.join(", ")}`);
|
|
1322
|
-
if (measure !== void 0 && (score !== void 0 || given2 !== void 0))
|
|
1323
|
-
invalid("--measure cannot be combined with --score or --weights");
|
|
1324
|
-
if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
|
|
1325
|
-
invalid("--score takes helpful, active or engaging");
|
|
1326
|
-
if (target === "messages" && score !== void 0 && score !== "engaging")
|
|
1327
|
-
invalid("helpful and active scores apply to authors only");
|
|
1328
|
-
const scoring = score !== void 0 || given2 !== void 0;
|
|
1329
|
-
const preset = score;
|
|
1330
|
-
let weights = null;
|
|
1331
|
-
if (scoring) {
|
|
1332
|
-
let raw = given2 !== void 0 ? given2 : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
|
|
1333
|
-
if (typeof raw === "string") {
|
|
1334
|
-
try {
|
|
1335
|
-
raw = JSON.parse(raw);
|
|
1336
|
-
} catch {
|
|
1337
|
-
invalid("--weights takes a JSON object of component weights");
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
1341
|
-
invalid("--weights takes a JSON object of component weights");
|
|
1342
|
-
const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
|
|
1343
|
-
...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
|
|
1344
|
-
"replies-from-others",
|
|
1345
|
-
"reactions-per-message",
|
|
1346
|
-
"replies-from-others-per-message"
|
|
1347
|
-
];
|
|
1348
|
-
const entries = Object.entries(raw);
|
|
1349
|
-
for (const [name, weight] of entries) {
|
|
1350
|
-
if (!allowed.includes(name))
|
|
1351
|
-
invalid(`unknown ${target} score component: ${name}`);
|
|
1352
|
-
if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
|
|
1353
|
-
invalid(`weight for ${name} must be a finite nonnegative number`);
|
|
1354
|
-
}
|
|
1355
|
-
if (!entries.some(([, weight]) => weight > 0))
|
|
1356
|
-
invalid("--weights needs at least one positive weight");
|
|
1357
|
-
weights = Object.fromEntries(entries);
|
|
1358
|
-
}
|
|
1359
|
-
const selected = measure ?? (target === "messages" ? "reactions" : "messages");
|
|
1360
|
-
return {
|
|
1361
|
-
target,
|
|
1362
|
-
messageKind,
|
|
1363
|
-
minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
|
|
1364
|
-
measure: scoring ? "score" : selected,
|
|
1365
|
-
order: !scoring && selected === "answer-time" ? "ascending" : "descending",
|
|
1366
|
-
weights,
|
|
1367
|
-
preset: scoring ? preset ?? "custom" : null,
|
|
1368
|
-
components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
|
|
1369
|
-
};
|
|
1370
|
-
}, "rankingOptions");
|
|
1371
|
-
var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
|
|
1372
|
-
const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
|
|
1373
|
-
const scale = Math.max(...entries.map(([, weight]) => weight));
|
|
1374
|
-
const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
|
|
1375
|
-
if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
|
|
1376
|
-
return null;
|
|
1377
|
-
const normalized = {};
|
|
1378
|
-
const contributions = {};
|
|
1379
|
-
let sum = 0;
|
|
1380
|
-
for (const [name, weight] of entries) {
|
|
1381
|
-
const value = raw[name];
|
|
1382
|
-
const maximum = maxima[name];
|
|
1383
|
-
if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
|
|
1384
|
-
return null;
|
|
1385
|
-
const part = maximum === 0 ? 0 : value / maximum;
|
|
1386
|
-
normalized[name] = part;
|
|
1387
|
-
contributions[name] = 100 * part * (weight / scale) / denominator;
|
|
1388
|
-
sum += contributions[name];
|
|
1389
|
-
}
|
|
1390
|
-
return { score: Math.min(100, sum), normalized, contributions };
|
|
1391
|
-
}, "rankingScore");
|
|
1392
|
-
var RANKING_TOKENIZER_VERSION = 1;
|
|
1393
|
-
var withoutUrls = /* @__PURE__ */ __name((text2) => text2.replace(/\S+/gu, (token) => {
|
|
1394
|
-
for (let offset = 0; ; ) {
|
|
1395
|
-
const marker = token.indexOf("://", offset);
|
|
1396
|
-
if (marker < 0)
|
|
1397
|
-
break;
|
|
1398
|
-
let start = marker;
|
|
1399
|
-
while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
|
|
1400
|
-
start--;
|
|
1401
|
-
if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
|
|
1402
|
-
return token.slice(0, start);
|
|
1403
|
-
offset = marker + 3;
|
|
1404
|
-
}
|
|
1405
|
-
const folded = token.toLowerCase();
|
|
1406
|
-
for (let offset = 0; ; ) {
|
|
1407
|
-
const start = folded.indexOf("www.", offset);
|
|
1408
|
-
if (start < 0)
|
|
1409
|
-
break;
|
|
1410
|
-
if (start === 0 || !/\w/u.test(token[start - 1]))
|
|
1411
|
-
return token.slice(0, start);
|
|
1412
|
-
offset = start + 4;
|
|
1413
|
-
}
|
|
1414
|
-
return token;
|
|
1415
|
-
}), "withoutUrls");
|
|
1416
|
-
var rankingWords = /* @__PURE__ */ __name((text2) => withoutUrls(text2).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
1417
|
-
var rankingQuestion = /* @__PURE__ */ __name((text2) => withoutUrls(text2).includes("?"), "rankingQuestion");
|
|
1418
|
-
|
|
1419
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/records.js
|
|
1420
|
-
import { createHash } from "node:crypto";
|
|
1421
|
-
|
|
1422
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/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
|
|
1423
621
|
var PHONE_PLANS = [
|
|
1424
622
|
{
|
|
1425
623
|
country: "us",
|
|
@@ -1799,81 +997,903 @@ var PHONE_PLANS = [
|
|
|
1799
997
|
}
|
|
1800
998
|
];
|
|
1801
999
|
|
|
1802
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1803
|
-
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
1804
|
-
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
1805
|
-
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
1806
|
-
const countries = value.split(/[\s,]+/).map((one) => one.trim().toLowerCase()).filter(Boolean);
|
|
1807
|
-
const unknown = countries.filter((one) => !PHONE_COUNTRIES.includes(one));
|
|
1808
|
-
if (countries.length === 0 || unknown.length > 0)
|
|
1809
|
-
throw new CliError("validation_error", `phone_countries takes country codes, ${unknown.length > 0 ? `not ${unknown.join(", ")}` : "at least one"}: ` + PHONE_COUNTRIES.join(", "));
|
|
1810
|
-
return [...new Set(countries)];
|
|
1811
|
-
}, "parsePhoneCountries");
|
|
1812
|
-
var PLANS = new Map(PHONE_PLANS.map((plan) => [
|
|
1813
|
-
plan.country,
|
|
1814
|
-
{
|
|
1815
|
-
code: plan.code,
|
|
1816
|
-
trunk: plan.trunk ? new RegExp(`^(?:${plan.trunk})`) : null,
|
|
1817
|
-
lengths: new Set(plan.lengths),
|
|
1818
|
-
valid: new RegExp(`^(?:${plan.valid})$`),
|
|
1819
|
-
mobile: plan.mobile === null ? null : new RegExp(`^(?:${plan.mobile})$`)
|
|
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
|
|
1001
|
+
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
1002
|
+
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
1003
|
+
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
1004
|
+
const countries = value.split(/[\s,]+/).map((one) => one.trim().toLowerCase()).filter(Boolean);
|
|
1005
|
+
const unknown = countries.filter((one) => !PHONE_COUNTRIES.includes(one));
|
|
1006
|
+
if (countries.length === 0 || unknown.length > 0)
|
|
1007
|
+
throw new CliError("validation_error", `phone_countries takes country codes, ${unknown.length > 0 ? `not ${unknown.join(", ")}` : "at least one"}: ` + PHONE_COUNTRIES.join(", "));
|
|
1008
|
+
return [...new Set(countries)];
|
|
1009
|
+
}, "parsePhoneCountries");
|
|
1010
|
+
var PLANS = new Map(PHONE_PLANS.map((plan) => [
|
|
1011
|
+
plan.country,
|
|
1012
|
+
{
|
|
1013
|
+
code: plan.code,
|
|
1014
|
+
trunk: plan.trunk ? new RegExp(`^(?:${plan.trunk})`) : null,
|
|
1015
|
+
lengths: new Set(plan.lengths),
|
|
1016
|
+
valid: new RegExp(`^(?:${plan.valid})$`),
|
|
1017
|
+
mobile: plan.mobile === null ? null : new RegExp(`^(?:${plan.mobile})$`)
|
|
1018
|
+
}
|
|
1019
|
+
]));
|
|
1020
|
+
var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
|
|
1021
|
+
for (const country of countries) {
|
|
1022
|
+
const plan = PLANS.get(country);
|
|
1023
|
+
if (!plan)
|
|
1024
|
+
continue;
|
|
1025
|
+
const readings = [
|
|
1026
|
+
...plan.trunk?.test(digits) ? [digits.replace(plan.trunk, "")] : [],
|
|
1027
|
+
digits,
|
|
1028
|
+
...digits.startsWith(plan.code) ? [digits.slice(plan.code.length)] : []
|
|
1029
|
+
];
|
|
1030
|
+
for (const national of readings) {
|
|
1031
|
+
if (!plan.lengths.has(national.length) || !plan.valid.test(national))
|
|
1032
|
+
continue;
|
|
1033
|
+
const mobile = plan.mobile?.test(national) ?? false;
|
|
1034
|
+
if (anyType || mobile)
|
|
1035
|
+
return { value: `+${plan.code}${national}`, national, mobile };
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return void 0;
|
|
1039
|
+
}, "nationalPhone");
|
|
1040
|
+
var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE_COUNTRIES } = {}) => {
|
|
1041
|
+
const text2 = typed.trim();
|
|
1042
|
+
if (!/^\+?[\d\s().\-–]+$/.test(text2))
|
|
1043
|
+
return void 0;
|
|
1044
|
+
const digits = text2.replace(/\(0\)/, "").replace(/\D/g, "").replace(/^00/, "");
|
|
1045
|
+
if (digits.length < 7 || digits.length > 15)
|
|
1046
|
+
return void 0;
|
|
1047
|
+
const national = nationalPhone(digits, phoneCountries, { anyType: true });
|
|
1048
|
+
const tail = national?.national ?? digits.replace(/^0+/, "");
|
|
1049
|
+
return {
|
|
1050
|
+
value: text2.startsWith("+") || /^00/.test(text2) ? `+${digits}` : national?.value ?? digits,
|
|
1051
|
+
national: tail.length >= 8 ? tail : null
|
|
1052
|
+
};
|
|
1053
|
+
}, "typedPhone");
|
|
1054
|
+
var e164Of = /* @__PURE__ */ __name((phone, region) => {
|
|
1055
|
+
if (/^\s*(\+|00)/.test(phone))
|
|
1056
|
+
return typedPhone(phone)?.value;
|
|
1057
|
+
if (typedPhone(phone) === void 0)
|
|
1058
|
+
return void 0;
|
|
1059
|
+
if (region === void 0)
|
|
1060
|
+
return null;
|
|
1061
|
+
const digits = phone.replace(/\(0\)/, "").replace(/\D/g, "");
|
|
1062
|
+
return nationalPhone(digits, [region], { anyType: true })?.value;
|
|
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");
|
|
1065
|
+
var BARE_INTERNATIONAL_PROVIDERS = ["telegram", "max", "whatsapp"];
|
|
1066
|
+
var storedPhone = /* @__PURE__ */ __name((raw, provider) => {
|
|
1067
|
+
if (/^\s*(\+|00)/.test(raw))
|
|
1068
|
+
return typedPhone(raw)?.value;
|
|
1069
|
+
if (!BARE_INTERNATIONAL_PROVIDERS.includes(provider))
|
|
1070
|
+
return void 0;
|
|
1071
|
+
const found = /^([1-9]\d{6,14})$/.exec(raw.trim());
|
|
1072
|
+
return found ? `+${found[1]}` : void 0;
|
|
1073
|
+
}, "storedPhone");
|
|
1074
|
+
|
|
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
|
+
};
|
|
1820
1744
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
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"
|
|
1831
1823
|
];
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
if (
|
|
1837
|
-
|
|
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`);
|
|
1838
1830
|
}
|
|
1831
|
+
if (!entries.some(([, weight]) => weight > 0))
|
|
1832
|
+
invalid("--weights needs at least one positive weight");
|
|
1833
|
+
weights = Object.fromEntries(entries);
|
|
1839
1834
|
}
|
|
1840
|
-
|
|
1841
|
-
}, "nationalPhone");
|
|
1842
|
-
var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE_COUNTRIES } = {}) => {
|
|
1843
|
-
const text2 = typed.trim();
|
|
1844
|
-
if (!/^\+?[\d\s().\-–]+$/.test(text2))
|
|
1845
|
-
return void 0;
|
|
1846
|
-
const digits = text2.replace(/\(0\)/, "").replace(/\D/g, "").replace(/^00/, "");
|
|
1847
|
-
if (digits.length < 7 || digits.length > 15)
|
|
1848
|
-
return void 0;
|
|
1849
|
-
const national = nationalPhone(digits, phoneCountries, { anyType: true });
|
|
1850
|
-
const tail = national?.national ?? digits.replace(/^0+/, "");
|
|
1835
|
+
const selected = measure ?? (target === "messages" ? "reactions" : "messages");
|
|
1851
1836
|
return {
|
|
1852
|
-
|
|
1853
|
-
|
|
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)
|
|
1854
1845
|
};
|
|
1855
|
-
}, "
|
|
1856
|
-
var
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
if (region === void 0)
|
|
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)
|
|
1862
1852
|
return null;
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
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");
|
|
1875
1894
|
|
|
1876
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
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";
|
|
1877
1897
|
var RECORDS_SCHEMA_VERSION = 1;
|
|
1878
1898
|
var RECORD_OPERATIONS = ["upsert", "delete"];
|
|
1879
1899
|
var LINE_OPTIONS = ["text", "products"];
|
|
@@ -2093,8 +2113,9 @@ var recordErrors = /* @__PURE__ */ __name((record, index) => {
|
|
|
2093
2113
|
return withKey([invalid2([...at, "fields"], "an upsert carries its fields as an object")]);
|
|
2094
2114
|
if (record.fields !== void 0 && !isObject(record.fields))
|
|
2095
2115
|
return withKey([invalid2([...at, "fields"], "fields is an object")]);
|
|
2096
|
-
|
|
2097
|
-
|
|
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")]);
|
|
2098
2119
|
const secret = record.fields === void 0 ? void 0 : secretIn(record.fields, [...at, "fields"]);
|
|
2099
2120
|
if (secret)
|
|
2100
2121
|
return withKey([
|
|
@@ -2224,7 +2245,7 @@ var fieldReferences = /* @__PURE__ */ __name((record, options = {}) => {
|
|
|
2224
2245
|
return found;
|
|
2225
2246
|
}, "fieldReferences");
|
|
2226
2247
|
|
|
2227
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
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
|
|
2228
2249
|
var label = /* @__PURE__ */ __name((en, ru, es) => ({ en, ru, es }), "label");
|
|
2229
2250
|
var ROLE_LABELS = {
|
|
2230
2251
|
organization: {
|
|
@@ -2288,11 +2309,13 @@ export {
|
|
|
2288
2309
|
isRoleAddress,
|
|
2289
2310
|
isPersonLikeRoleAddress,
|
|
2290
2311
|
isNoReplyAddress,
|
|
2312
|
+
PHONE_COUNTRIES,
|
|
2291
2313
|
DEFAULT_PHONE_COUNTRIES,
|
|
2292
2314
|
parsePhoneCountries,
|
|
2293
2315
|
nationalPhone,
|
|
2294
2316
|
typedPhone,
|
|
2295
2317
|
e164Of,
|
|
2318
|
+
isMobilePhone,
|
|
2296
2319
|
BARE_INTERNATIONAL_PROVIDERS,
|
|
2297
2320
|
storedPhone,
|
|
2298
2321
|
QUERY_VERSION,
|