@toon-protocol/client 3.2.0 → 4.0.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/dist/cli/main.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  generateKeystore,
4
4
  importKeystore,
5
5
  openKeystore
6
- } from "../chunk-4I3JQ7KA.js";
6
+ } from "../chunk-2DGVNDKA.js";
7
7
  import {
8
8
  DEVNET,
9
9
  deriveFullIdentity,
10
10
  evmDerivationPath,
11
11
  generateRandomIdentity,
12
12
  isHiddenServiceUrl
13
- } from "../chunk-7MPONJW5.js";
13
+ } from "../chunk-WJKJ6Y4N.js";
14
14
 
15
15
  // src/cli/main.ts
16
16
  import { homedir as homedir3 } from "os";
@@ -80,6 +80,11 @@ var GLOBAL_OPTIONS = {
80
80
  arg: "URL",
81
81
  help: "SOCKS5h proxy for a .anyone connector, e.g. socks5h://127.0.0.1:9050. Env TOON_SOCKS. Default: start a managed anon daemon."
82
82
  },
83
+ facilitator: {
84
+ type: "string",
85
+ arg: "URL",
86
+ help: "The x402 facilitator that relays a Base channel deposit and pays its gas. Env TOON_FACILITATOR. Default: the devnet Onboarder on Base Sepolia."
87
+ },
83
88
  json: { type: "boolean", help: "Print one JSON document on stdout and nothing else." },
84
89
  quiet: { type: "boolean", help: "Suppress progress and warnings on stderr." },
85
90
  help: { type: "boolean", short: "h", help: "Show this help." },
@@ -95,11 +100,10 @@ var COMMAND_OPTIONS = {
95
100
  type: "boolean",
96
101
  help: "Show the addresses of every derivation scheme, not just the one in use."
97
102
  },
98
- deposit: { type: "string", arg: "BASE_UNITS", help: "Collateral to lock, in base units." },
99
- "settlement-timeout": {
103
+ deposit: {
100
104
  type: "string",
101
- arg: "SECONDS",
102
- help: "Challenge period. Default 86400; EVM floors it at 3600."
105
+ arg: "BASE_UNITS",
106
+ help: "What a channel is opened with, in base units. Default 100000 (0.10 USDC)."
103
107
  },
104
108
  "connector-view": {
105
109
  type: "boolean",
@@ -180,7 +184,7 @@ var COMMANDS = {
180
184
  options: [],
181
185
  minPositionals: 1,
182
186
  maxPositionals: 1,
183
- details: ["Needs an open channel: a probe carries a claim, it just does not spend it."]
187
+ details: ["Needs a channel already paid on: a probe resends the last voucher, which spends nothing."]
184
188
  },
185
189
  send: {
186
190
  summary: "Pay for one HTTP request and print the answer.",
@@ -199,12 +203,14 @@ var COMMANDS = {
199
203
  channel: {
200
204
  summary: "Open, fund, inspect, close and settle the payment channel.",
201
205
  usage: "channel open|deposit <amount>|close|settle|status [--deposit BASE_UNITS] [--connector-view]",
202
- options: ["deposit", "settlement-timeout", "connector-view"],
206
+ options: ["deposit", "connector-view"],
203
207
  minPositionals: 1,
204
208
  maxPositionals: 2,
205
209
  details: [
206
- "Every one of these is your transaction, on your gas. `close` starts the",
207
- "challenge period; `settle` pays out once it has elapsed."
210
+ "Opening and depositing cost no gas: a facilitator relays the deposit on Base,",
211
+ "the connector sponsors the open on Solana. `close` and `settle` are your own",
212
+ "transactions, on your gas: `close` starts the exit window, and `settle` takes",
213
+ "the unspent deposit back once it has elapsed."
208
214
  ]
209
215
  },
210
216
  "claim-state": {
@@ -428,6 +434,7 @@ var CHAIN_ENV = "TOON_CHAIN";
428
434
  var RPC_ENV = "TOON_RPC_URL";
429
435
  var CHANNEL_STORE_ENV = "TOON_CHANNEL_STORE";
430
436
  var SOCKS_ENV = "TOON_SOCKS";
437
+ var FACILITATOR_ENV = "TOON_FACILITATOR";
431
438
  function defaultChannelStorePath(home = homedir2()) {
432
439
  return join2(home, ".toon", "channels.json");
433
440
  }
@@ -469,9 +476,13 @@ function resolveSettings(values, env, options = {}) {
469
476
  const socksFlag = stringOption(values, "socks");
470
477
  const socksEnv = env[SOCKS_ENV];
471
478
  const socksProxy = socksFlag !== void 0 && socksFlag.length > 0 ? socksFlag : socksEnv !== void 0 && socksEnv.length > 0 ? socksEnv : void 0;
479
+ const facilitator = stringOption(values, "facilitator") ?? env[FACILITATOR_ENV];
480
+ const deposit = stringOption(values, "deposit");
472
481
  const settings = {
473
482
  connector,
474
483
  connectorSource,
484
+ ...facilitator !== void 0 && facilitator.length > 0 ? { facilitatorUrl: facilitator } : {},
485
+ ...deposit !== void 0 ? { deposit } : {},
475
486
  ...chain !== void 0 ? { chain } : {},
476
487
  ...rpcUrl !== void 0 && rpcUrl.length > 0 ? { rpcUrl } : {},
477
488
  channelStore,
@@ -529,7 +540,9 @@ function buildClientConfig(settings, keys) {
529
540
  // See this module's docs: a command never opens a channel as a side effect.
530
541
  autoOpenChannel: false,
531
542
  ...settings.chain !== void 0 ? { chain: settings.chain } : {},
532
- ...settings.rpcUrl !== void 0 ? { rpcUrl: settings.rpcUrl } : {}
543
+ ...settings.rpcUrl !== void 0 ? { rpcUrl: settings.rpcUrl } : {},
544
+ ...settings.facilitatorUrl !== void 0 ? { facilitatorUrl: settings.facilitatorUrl } : {},
545
+ ...settings.deposit !== void 0 ? { deposit: settings.deposit } : {}
533
546
  };
534
547
  if (keys.kind === "mnemonic") {
535
548
  return { ...base, mnemonic: keys.mnemonic, keyDerivation: keys.derivation };
@@ -542,7 +555,7 @@ function buildClientConfig(settings, keys) {
542
555
  };
543
556
  }
544
557
  async function defaultCreateClient(config) {
545
- const module = await import("../client-SCEP67S5.js");
558
+ const module = await import("../client-7YIJOR5K.js");
546
559
  const factory = module.ToonClient;
547
560
  if (factory === void 0) {
548
561
  throw new Error(
@@ -612,20 +625,23 @@ async function defaultStartAnon(log) {
612
625
 
613
626
  // src/cli/output.ts
614
627
  import { formatUnits } from "viem";
615
- function assetSymbol(tokenAddress) {
616
- if (tokenAddress === void 0) return void 0;
617
- const t = tokenAddress.toLowerCase();
618
- if (t === DEVNET.evm.tokenAddress.toLowerCase()) return "USDC";
619
- if (t === DEVNET.solana.tokenAddress.toLowerCase()) return "USDC";
620
- return void 0;
628
+ var KNOWN_USDC = new Set(
629
+ [
630
+ DEVNET.evm.tokenAddress,
631
+ DEVNET.solana.tokenAddress,
632
+ "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
633
+ "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
634
+ ].map((a) => a.startsWith("0x") ? a.toLowerCase() : a)
635
+ );
636
+ function known(asset) {
637
+ if (asset === void 0) return false;
638
+ return KNOWN_USDC.has(asset.startsWith("0x") ? asset.toLowerCase() : asset);
621
639
  }
622
- function assetFromSettlement(settlement) {
623
- if (settlement === void 0) return {};
624
- return { decimals: settlement.decimals, symbol: assetSymbol(settlement.tokenAddress) };
640
+ function assetInfo(asset) {
641
+ return known(asset) ? { decimals: 6, symbol: "USDC" } : {};
625
642
  }
626
- function assetFromTerms(terms) {
627
- if (terms === void 0) return {};
628
- return { decimals: terms.decimals, symbol: assetSymbol(terms.token) };
643
+ function assetFromSettlement(terms) {
644
+ return assetInfo(terms?.asset);
629
645
  }
630
646
  function formatAmount(amount, asset = {}) {
631
647
  const base = typeof amount === "bigint" ? amount : BigInt(amount);
@@ -750,21 +766,23 @@ async function run(ctx) {
750
766
  // src/cli/commands/channel.ts
751
767
  function stateRows(state, asset) {
752
768
  const rows = [
753
- ["channel", state.channelId],
754
- ["chain", state.domain.chain],
755
- ["counterparty", state.counterparty],
756
- ["status", state.status],
769
+ ["channel", state.channel.channelId],
770
+ ["network", state.channel.network],
757
771
  ["deposit", formatAmount(state.depositTotal, asset)],
758
- ["spent", formatAmount(state.spent, asset)],
759
- ["available", formatAmount(state.available, asset)],
760
- ["nonce", String(state.nonce)]
772
+ ["signed", formatAmount(state.signed, asset)],
773
+ [
774
+ "available",
775
+ formatAmount(
776
+ state.depositTotal > state.signed ? state.depositTotal - state.signed : 0n,
777
+ asset
778
+ )
779
+ ]
761
780
  ];
762
- if (state.onChain?.closedAt !== void 0) {
763
- rows.push(["closed at", `${state.onChain.closedAt.toString()} (unix seconds)`]);
764
- }
765
- if (state.onChain?.settleableAt !== void 0) {
766
- rows.push(["settleable at", `${state.onChain.settleableAt.toString()} (unix seconds)`]);
781
+ if (state.closedAt !== void 0) rows.push(["closed at", `${state.closedAt.toString()} (unix seconds)`]);
782
+ if (state.settleableAt !== void 0) {
783
+ rows.push(["settleable at", `${state.settleableAt.toString()} (unix seconds)`]);
767
784
  }
785
+ if (state.settledAt !== void 0) rows.push(["settled at", `${state.settledAt.toString()} (unix seconds)`]);
768
786
  return rows;
769
787
  }
770
788
  function connectorRows(entry, asset) {
@@ -772,39 +790,34 @@ function connectorRows(entry, asset) {
772
790
  return [["connector", `cannot report this channel (${entry.error})`]];
773
791
  }
774
792
  return [
775
- ["connector nonce", String(entry.nonce)],
776
793
  ["connector claimed", formatAmount(entry.cumulativeClaimed, asset)],
777
- [
778
- "connector deposit",
779
- entry.depositTotal === null ? "declared only" : formatAmount(entry.depositTotal, asset)
780
- ],
781
- [
782
- "connector available",
783
- entry.available === null ? "unknown" : formatAmount(entry.available, asset)
784
- ]
794
+ ["connector max", formatAmount(entry.maxCumulative, asset)],
795
+ ["connector available", formatAmount(entry.available, asset)]
785
796
  ];
786
797
  }
798
+ function exitRows(result) {
799
+ const rows = [["channel", result.channelId]];
800
+ if (result.transaction !== void 0) rows.push(["tx", result.transaction]);
801
+ if (result.settleableAt !== void 0) rows.push(["settleable at", result.settleableAt.toString()]);
802
+ if (result.error !== void 0) rows.push(["error", result.error]);
803
+ if (result.transaction === void 0 && result.error === void 0 && result.settleableAt === void 0) {
804
+ rows.push(["status", "nothing left to take back"]);
805
+ }
806
+ return rows;
807
+ }
787
808
  async function run2(ctx) {
788
809
  const sub = ctx.positionals[0];
789
810
  if (sub === void 0 || !CHANNEL_SUBCOMMANDS.includes(sub)) {
790
- throw new UsageError(
791
- `channel needs one of: ${CHANNEL_SUBCOMMANDS.join(", ")}`,
792
- "channel"
793
- );
811
+ throw new UsageError(`channel needs one of: ${CHANNEL_SUBCOMMANDS.join(", ")}`, "channel");
794
812
  }
795
813
  const client = await ctx.client();
796
814
  const channel = client.channel;
797
815
  if (sub === "open") {
798
- const deposit = stringOption(ctx.values, "deposit");
799
- const timeout = stringOption(ctx.values, "settlement-timeout");
800
- const state2 = await channel.open({
801
- ...deposit !== void 0 ? { deposit } : {},
802
- ...timeout !== void 0 ? { settlementTimeout: Number(timeout) } : {}
803
- });
804
- const asset2 = assetFromTerms(state2.domain);
805
- ctx.out.render(state2, () => {
816
+ const state = await channel.open();
817
+ const asset = assetInfo(state.channel.config.token);
818
+ ctx.out.render(state, () => {
806
819
  ctx.out.line("Channel open.");
807
- ctx.out.rows(stateRows(state2, asset2));
820
+ ctx.out.rows(stateRows(state, asset));
808
821
  });
809
822
  return 0;
810
823
  }
@@ -813,48 +826,51 @@ async function run2(ctx) {
813
826
  if (amount === void 0) {
814
827
  throw new UsageError("channel deposit needs an amount in base units", "channel");
815
828
  }
816
- const state2 = await channel.deposit(amount);
817
- const asset2 = assetFromTerms(state2.domain);
818
- ctx.out.render(state2, () => {
829
+ let value;
830
+ try {
831
+ value = BigInt(amount);
832
+ } catch {
833
+ throw new UsageError(`'${amount}' is not a whole number of base units`, "channel");
834
+ }
835
+ const state = await channel.deposit(value);
836
+ const asset = assetInfo(state.channel.config.token);
837
+ ctx.out.render(state, () => {
819
838
  ctx.out.line("Deposit confirmed.");
820
- ctx.out.rows(stateRows(state2, asset2));
839
+ ctx.out.rows(stateRows(state, asset));
821
840
  });
822
841
  return 0;
823
842
  }
824
- if (sub === "close") {
825
- const result = await channel.close();
826
- ctx.out.render(result, () => {
827
- ctx.out.line("Challenge period started. Settle once it has elapsed.");
828
- const rows = [];
829
- if (result.txHash !== void 0) rows.push(["tx", result.txHash]);
830
- if (result.closedAt !== void 0) rows.push(["closed at", result.closedAt.toString()]);
831
- if (result.settleableAt !== void 0) {
832
- rows.push(["settleable at", result.settleableAt.toString()]);
843
+ if (sub === "close" || sub === "settle") {
844
+ const results = sub === "close" ? await channel.close() : await channel.settle();
845
+ ctx.out.render(results, () => {
846
+ if (results.length === 0) {
847
+ ctx.out.line("No channel is ready to settle yet.");
848
+ return;
833
849
  }
834
- ctx.out.rows(rows);
835
- });
836
- return 0;
837
- }
838
- if (sub === "settle") {
839
- const result = await channel.settle();
840
- ctx.out.render(result, () => {
841
- ctx.out.line("Channel settled; the collateral is released.");
842
- if (result.txHash !== void 0) ctx.out.rows([["tx", result.txHash]]);
850
+ ctx.out.line(
851
+ sub === "close" ? "Leaving every open channel. Settle each once its window has elapsed." : "Unspent deposits returned where each window had elapsed."
852
+ );
853
+ for (const r of results) ctx.out.rows(exitRows(r));
843
854
  });
844
- return 0;
855
+ return results.some((r) => r.error !== void 0) ? 1 : 0;
845
856
  }
846
- const state = await channel.state({ onChain: true });
847
- const asset = assetFromTerms(state.domain);
857
+ const channels = channel.channels();
848
858
  let connectorView;
849
- if (boolOption(ctx.values, "connector-view")) {
850
- const entries = await client.claimState([state.channelId]);
851
- connectorView = entries[0];
859
+ if (boolOption(ctx.values, "connector-view") && channels.length > 0) {
860
+ connectorView = await client.claimState(channels.map((c) => c.channel.channelId));
852
861
  }
853
- ctx.out.render({ ...state, ...connectorView !== void 0 ? { connectorView } : {} }, () => {
854
- ctx.out.rows(stateRows(state, asset));
855
- if (connectorView !== void 0) {
862
+ ctx.out.render(connectorView === void 0 ? channels : { channels, connector: connectorView }, () => {
863
+ if (channels.length === 0) {
864
+ ctx.out.line("No channel with this node yet. Open one with 'toon channel open', or pay for a request.");
865
+ return;
866
+ }
867
+ for (const state of channels) {
868
+ const asset = assetInfo(state.channel.config.token);
869
+ const rows = stateRows(state, asset);
870
+ const theirs = connectorView?.find((e) => e.channelId === state.channel.channelId);
871
+ if (theirs !== void 0) rows.push(...connectorRows(theirs, asset));
872
+ ctx.out.rows(rows);
856
873
  ctx.out.line();
857
- ctx.out.rows(connectorRows(connectorView, asset));
858
874
  }
859
875
  });
860
876
  return 0;
@@ -865,15 +881,15 @@ async function run3(ctx) {
865
881
  const client = await ctx.client();
866
882
  const entries = await client.claimState();
867
883
  const description = await client.describe();
868
- const asset = assetFromSettlement(description.settlements[0]);
884
+ const asset = assetFromSettlement(description.batchSettlements[0]);
869
885
  ctx.out.render({ connector: client.connector, channels: entries }, () => {
870
886
  if (entries.length === 0) {
871
887
  ctx.out.line("This connector reports no channels for your account.");
872
- ctx.out.line("Open one with 'toon channel open --deposit 100000'.");
888
+ ctx.out.line("Open one with 'toon channel open', or pay for a request.");
873
889
  return;
874
890
  }
875
891
  for (const entry of entries) {
876
- const id = entry.channelId ?? entry.channelAccount ?? "(unnamed)";
892
+ const id = entry.channelId ?? "(unnamed)";
877
893
  if (!entry.ok) {
878
894
  ctx.out.rows([
879
895
  ["channel", id],
@@ -886,13 +902,9 @@ async function run3(ctx) {
886
902
  ctx.out.rows([
887
903
  ["channel", id],
888
904
  ["chain", entry.blockchain],
889
- ["nonce", String(entry.nonce)],
890
905
  ["claimed", formatAmount(entry.cumulativeClaimed, asset)],
891
- [
892
- "deposit",
893
- entry.depositTotal === null ? "declared only" : formatAmount(entry.depositTotal, asset)
894
- ],
895
- ["available", entry.available === null ? "unknown" : formatAmount(entry.available, asset)],
906
+ ["max cumulative", formatAmount(entry.maxCumulative, asset)],
907
+ ["available", formatAmount(entry.available, asset)],
896
908
  [
897
909
  // Printed as the connector gave it, unconverted: the field is
898
910
  // best-effort and non-durable, and `null` means "unknown", never
@@ -915,7 +927,7 @@ async function run4(ctx) {
915
927
  ...url !== void 0 ? { connector: url } : {}
916
928
  });
917
929
  const description = await client.describe();
918
- const asset = assetFromSettlement(description.settlements[0]);
930
+ const asset = assetFromSettlement(description.batchSettlements[0]);
919
931
  const payload = {
920
932
  connector: client.connector,
921
933
  ilpAddresses: description.ilpAddresses,
@@ -923,7 +935,8 @@ async function run4(ctx) {
923
935
  btpEndpoint: description.btpEndpoint,
924
936
  peerCarriages: description.peerCarriages,
925
937
  edgeIdentity: description.edgeIdentity,
926
- settlements: description.settlements,
938
+ batchSettlements: description.batchSettlements,
939
+ voucherSigners: description.voucherSigners,
927
940
  routes: description.routes,
928
941
  requiredTransport: description.requiredTransport,
929
942
  supportedVersions: description.supportedVersions,
@@ -951,18 +964,19 @@ async function run4(ctx) {
951
964
  ]);
952
965
  ctx.out.rows(head);
953
966
  ctx.out.line();
954
- if (description.settlements.length === 0) {
955
- ctx.out.line("Settlements: none \u2014 this node cannot be paid.");
967
+ if (description.batchSettlements.length === 0) {
968
+ ctx.out.line("Channels: none offered \u2014 this node cannot be paid.");
956
969
  } else {
957
- ctx.out.line("Settlements:");
970
+ ctx.out.line("Channels (x402 batch-settlement):");
958
971
  ctx.out.rows(
959
- description.settlements.map((s) => [
960
- s.chain,
972
+ description.batchSettlements.map((t) => [
973
+ t.network,
961
974
  [
962
- `counterparty ${s.settlementAddress}`,
963
- `token ${s.tokenAddress} (${String(s.decimals)}dp)`,
964
- s.kind === "evm" ? `tokenNetwork ${s.tokenNetwork}` : `program ${s.programId}`
965
- ].join(" ")
975
+ `payTo ${t.payTo}`,
976
+ `token ${t.asset}`,
977
+ `min delay ${String(t.extra.withdrawDelay)}s`,
978
+ t.chain === "solana" ? `sponsor ${t.extra.feePayer}` : ""
979
+ ].filter((x) => x !== "").join(" ")
966
980
  ])
967
981
  );
968
982
  }
@@ -1143,7 +1157,7 @@ async function run8(ctx) {
1143
1157
  });
1144
1158
  const terms = await client.routePrice(destination);
1145
1159
  const description = await client.describe();
1146
- const asset = assetFromSettlement(description.settlements[0]);
1160
+ const asset = assetFromSettlement(description.batchSettlements[0]);
1147
1161
  const perKib = terms?.pricePerKib;
1148
1162
  ctx.out.render(
1149
1163
  {
@@ -1176,7 +1190,7 @@ async function run9(ctx) {
1176
1190
  const client = await ctx.client();
1177
1191
  const result = await client.probe(destination);
1178
1192
  const description = await client.describe();
1179
- const asset = assetFromSettlement(description.settlements[0]);
1193
+ const asset = assetFromSettlement(description.batchSettlements[0]);
1180
1194
  ctx.out.render({ destination, ...result }, () => {
1181
1195
  ctx.out.rows([
1182
1196
  ["destination", destination],
@@ -1321,7 +1335,7 @@ function payloadFor(result) {
1321
1335
  httpEndpoint: terms.httpEndpoint,
1322
1336
  btpEndpoint: terms.btpEndpoint,
1323
1337
  requiredTransport: terms.requiredTransport,
1324
- settlements: terms.settlements,
1338
+ batchSettlements: terms.batchSettlements,
1325
1339
  sessionLeaseTtlMs: terms.sessionLeaseTtlMs
1326
1340
  }
1327
1341
  } : {}
@@ -1344,20 +1358,20 @@ async function run10(ctx) {
1344
1358
  amountFlag === void 0 ? void 0 : { amount: BigInt(amountFlag) }
1345
1359
  );
1346
1360
  const description = await client.describe();
1347
- const asset = assetFromSettlement(description.settlements[0]);
1361
+ const asset = assetFromSettlement(description.batchSettlements[0]);
1348
1362
  ctx.out.render(payloadFor(result), () => {
1349
1363
  if (result.fulfilled) {
1350
1364
  ctx.out.line(`FULFILL ${String(result.status)} (${result.transport})`);
1351
1365
  const claim = result.claim;
1352
1366
  ctx.out.rows(
1353
1367
  claim === void 0 ? (
1354
- // A route priced at zero takes no claim, so there is no channel,
1355
- // nonce or amount to show. Saying so beats printing zeroes.
1368
+ // A route priced at zero takes no voucher, so there is no channel
1369
+ // or amount to show. Saying so beats printing zeroes.
1356
1370
  [["paid", "nothing \u2014 this route is free"]]
1357
1371
  ) : [
1358
1372
  [
1359
1373
  "paid",
1360
- `${formatAmount(claim.amount, asset)} channel ${claim.channelId} nonce ${String(claim.nonce)}`
1374
+ `${formatAmount(claim.amount, asset)} channel ${claim.channelId}`
1361
1375
  ],
1362
1376
  ["cumulative", formatAmount(claim.cumulative, asset)]
1363
1377
  ]
@@ -1527,7 +1541,9 @@ var FUNDING_CODES = /* @__PURE__ */ new Set([
1527
1541
  "CHANNEL_RESUME",
1528
1542
  "CHANNEL_NOT_OPEN",
1529
1543
  "INSUFFICIENT_BALANCE",
1530
- "TRANSFER_NOT_DELIVERED"
1544
+ "TRANSFER_NOT_DELIVERED",
1545
+ "FACILITATOR",
1546
+ "SPONSOR_REFUSED"
1531
1547
  ]);
1532
1548
  var NETWORK_CODES = /* @__PURE__ */ new Set(["NETWORK_ERROR", "CONNECTOR_ERROR", "STALE_RPC_READ"]);
1533
1549
  var PAYMENT_CODES = /* @__PURE__ */ new Set([