x402-proxy 0.10.7 → 0.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +7 -1
  3. package/dist/Credential-COZQnr1-.js +2055 -0
  4. package/dist/Mcp-CrCEqLqO.js +10 -0
  5. package/dist/Sse-ChldYgU7.js +9742 -0
  6. package/dist/Sse-kCB38G56.js +16482 -0
  7. package/dist/accounts-DsuvWwph.js +232 -0
  8. package/dist/accounts-DzvAlQRn.js +5 -0
  9. package/dist/accounts-IG-Cmrwy.js +229 -0
  10. package/dist/api-CUzmQvTQ.js +2802 -0
  11. package/dist/auth-DTzQmnZ_.js +1196 -0
  12. package/dist/bin/cli.js +585 -242
  13. package/dist/ccip-Bx-zoUCJ.js +240 -0
  14. package/dist/ccip-C2k1DD1T.js +153 -0
  15. package/dist/ccip-C6CQOJYv.js +152 -0
  16. package/dist/ccip-RZzsZ5Mv.js +156 -0
  17. package/dist/chain-CafcHffR.js +1997 -0
  18. package/dist/chain-DwfP5RGZ.js +1968 -0
  19. package/dist/chunk-DBEY4PJZ.js +16 -0
  20. package/dist/chunk-DjEMn6fM.js +36 -0
  21. package/dist/client-Blw2V7LF.js +657 -0
  22. package/dist/client-C37gWJOZ.js +102 -0
  23. package/dist/client-CEc4NYAA.js +6388 -0
  24. package/dist/client-CVDTUY0l.js +5152 -0
  25. package/dist/config-BUQsit4s.js +3 -0
  26. package/dist/config-DR1Fs_wL.js +6600 -0
  27. package/dist/{config-D9wIR3xc.js → config-rvKA3SYT.js} +10 -5
  28. package/dist/decodeFunctionData-DuFcwhC_.js +4510 -0
  29. package/dist/decodeFunctionData-JPOUdvil.js +4394 -0
  30. package/dist/derive-DNUl8LU9.js +9109 -0
  31. package/dist/dist-C2YO6HSQ.js +6581 -0
  32. package/dist/dist-DM5_F3r5.js +4 -0
  33. package/dist/dist-DxJCYyL5.js +1388 -0
  34. package/dist/hashTypedData-BHmP9dBd.js +859 -0
  35. package/dist/hashTypedData-CtEdfx4y.js +846 -0
  36. package/dist/helpers-CuUSw-tH.js +7125 -0
  37. package/dist/hmac-59IlS_by.js +648 -0
  38. package/dist/http-BAtucMbS.js +2060 -0
  39. package/dist/index.d.ts +1903 -9
  40. package/dist/index.js +18006 -50
  41. package/dist/index.node-CxkL0OFh.js +3592 -0
  42. package/dist/index.node-DvmeuZBj.js +3 -0
  43. package/dist/isAddressEqual-BLrd1Hg1.js +9 -0
  44. package/dist/isAddressEqual-DsAqfQOD.js +10 -0
  45. package/dist/localBatchGatewayRequest-C-RPJyDO.js +6260 -0
  46. package/dist/localBatchGatewayRequest-DOdQ9bR7.js +93 -0
  47. package/dist/localBatchGatewayRequest-DQkbZaSy.js +6261 -0
  48. package/dist/parseUnits-CApwcKSD.js +49 -0
  49. package/dist/parseUnits-cMO2udMe.js +48 -0
  50. package/dist/schemas-BxMFYNbH.js +1270 -0
  51. package/dist/secp256k1-BZpiyffY.js +2525 -0
  52. package/dist/secp256k1-BjenrLl5.js +1877 -0
  53. package/dist/secp256k1-CLPUX17u.js +3 -0
  54. package/dist/sendRawTransactionSync-DvSkhZtW.js +3612 -0
  55. package/dist/server-CSq0IuUq.js +565 -0
  56. package/dist/setup-BY4J49Lv.js +1110 -0
  57. package/dist/setup-wMOAgrsN.js +3 -0
  58. package/dist/sha256-FAs0qeni.js +17 -0
  59. package/dist/sha3-CYkWM8Xa.js +195 -0
  60. package/dist/sha3-DbMJRJ3C.js +194 -0
  61. package/dist/sse-B4LLqBQm.js +408 -0
  62. package/dist/status-Bu23RjW6.js +3 -0
  63. package/dist/{status-DihAcUSC.js → status-X21VnGUO.js} +16 -15
  64. package/dist/stdio-BADqxZdZ.js +85 -0
  65. package/dist/streamableHttp-BHkJypcI.js +358 -0
  66. package/dist/tempo-3nttrxgQ.js +17 -0
  67. package/dist/tempo-DER0P-ul.js +18 -0
  68. package/dist/types-BEKUz-Mf.js +1240 -0
  69. package/dist/types-DatK5vR5.js +3 -0
  70. package/dist/utils-BYjkXZDF.js +444 -0
  71. package/dist/utils-SeGHMW9O.js +445 -0
  72. package/dist/wallet-DKVlrR1S.js +3 -0
  73. package/dist/wallet-DSyht15_.js +17759 -0
  74. package/package.json +18 -71
  75. package/dist/config-B_upkJeK.js +0 -66
  76. package/dist/config-Be35NM5s.js +0 -3
  77. package/dist/config-J1m-CWXT.js +0 -27
  78. package/dist/derive-CL6e8K0Z.js +0 -81
  79. package/dist/openclaw/plugin.d.ts +0 -15
  80. package/dist/openclaw/plugin.js +0 -2067
  81. package/dist/openclaw.plugin.json +0 -93
  82. package/dist/setup-CNyMLnM-.js +0 -197
  83. package/dist/setup-DTIxPe58.js +0 -3
  84. package/dist/status-DZlJ4pS7.js +0 -3
  85. package/dist/wallet-B0S-rma9.js +0 -544
  86. package/dist/wallet-DBrVZJqe.js +0 -3
  87. package/openclaw.plugin.json +0 -93
  88. package/skills/SKILL.md +0 -183
  89. package/skills/references/library.md +0 -85
  90. package/skills/references/openclaw-plugin.md +0 -145
@@ -0,0 +1,1110 @@
1
+ #!/usr/bin/env node
2
+ import { i as __toESM, t as __commonJSMin } from "./chunk-DjEMn6fM.js";
3
+ import { c as buildCommand, n as deriveSolanaKeypair, o as require_picocolors, r as generateMnemonic, t as deriveEvmKeypair } from "./derive-DNUl8LU9.js";
4
+ import { c as getWalletPath, d as loadWalletFile, f as saveConfig, i as getConfigDirShort, l as isConfigured, m as saveWalletFile } from "./config-rvKA3SYT.js";
5
+ import "node:path";
6
+ import "node:fs";
7
+ import { stripVTControlCharacters, styleText } from "node:util";
8
+ import N, { stdin, stdout } from "node:process";
9
+ import "node:readline";
10
+ import ot from "node:readline";
11
+ import "node:tty";
12
+ //#endregion
13
+ //#region node_modules/.pnpm/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
14
+ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
15
+ const ESC = "\x1B";
16
+ const CSI = `${ESC}[`;
17
+ const beep = "\x07";
18
+ const cursor = {
19
+ to(x, y) {
20
+ if (!y) return `${CSI}${x + 1}G`;
21
+ return `${CSI}${y + 1};${x + 1}H`;
22
+ },
23
+ move(x, y) {
24
+ let ret = "";
25
+ if (x < 0) ret += `${CSI}${-x}D`;
26
+ else if (x > 0) ret += `${CSI}${x}C`;
27
+ if (y < 0) ret += `${CSI}${-y}A`;
28
+ else if (y > 0) ret += `${CSI}${y}B`;
29
+ return ret;
30
+ },
31
+ up: (count = 1) => `${CSI}${count}A`,
32
+ down: (count = 1) => `${CSI}${count}B`,
33
+ forward: (count = 1) => `${CSI}${count}C`,
34
+ backward: (count = 1) => `${CSI}${count}D`,
35
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
36
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
37
+ left: `${CSI}G`,
38
+ hide: `${CSI}?25l`,
39
+ show: `${CSI}?25h`,
40
+ save: `${ESC}7`,
41
+ restore: `${ESC}8`
42
+ };
43
+ module.exports = {
44
+ cursor,
45
+ scroll: {
46
+ up: (count = 1) => `${CSI}S`.repeat(count),
47
+ down: (count = 1) => `${CSI}T`.repeat(count)
48
+ },
49
+ erase: {
50
+ screen: `${CSI}2J`,
51
+ up: (count = 1) => `${CSI}1J`.repeat(count),
52
+ down: (count = 1) => `${CSI}J`.repeat(count),
53
+ line: `${CSI}2K`,
54
+ lineEnd: `${CSI}K`,
55
+ lineStart: `${CSI}1K`,
56
+ lines(count) {
57
+ let clear = "";
58
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
59
+ if (count) clear += cursor.left;
60
+ return clear;
61
+ }
62
+ },
63
+ beep
64
+ };
65
+ })))();
66
+ function x$1(t, e, s) {
67
+ if (!s.some((u) => !u.disabled)) return t;
68
+ const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
69
+ return s[n].disabled ? x$1(n, e < 0 ? -1 : 1, s) : n;
70
+ }
71
+ const at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L = /\t{1,1000}/y, P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, ft$1 = {
72
+ limit: Infinity,
73
+ ellipsis: ""
74
+ }, X$1 = (t, e = {}, s = {}) => {
75
+ const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X$1(r, ft$1, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
76
+ let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
77
+ t: for (;;) {
78
+ if (w > C || o >= p && o > h) {
79
+ const ut = t.slice(C, w) || t.slice(h, o);
80
+ v = 0;
81
+ for (const Y of ut.replaceAll(ct, "")) {
82
+ const $ = Y.codePointAt(0) || 0;
83
+ if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
84
+ F = !0;
85
+ break t;
86
+ }
87
+ v += Y.length, c += f;
88
+ }
89
+ C = w = 0;
90
+ }
91
+ if (o >= p) break;
92
+ if (M.lastIndex = o, M.test(t)) {
93
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
94
+ F = !0;
95
+ break;
96
+ }
97
+ c += f, C = h, w = o, o = h = M.lastIndex;
98
+ continue;
99
+ }
100
+ if (O.lastIndex = o, O.test(t)) {
101
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
102
+ F = !0;
103
+ break;
104
+ }
105
+ c += u, C = h, w = o, o = h = O.lastIndex;
106
+ continue;
107
+ }
108
+ if (y.lastIndex = o, y.test(t)) {
109
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
110
+ F = !0;
111
+ break;
112
+ }
113
+ c += f, C = h, w = o, o = h = y.lastIndex;
114
+ continue;
115
+ }
116
+ if (L.lastIndex = o, L.test(t)) {
117
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
118
+ F = !0;
119
+ break;
120
+ }
121
+ c += f, C = h, w = o, o = h = L.lastIndex;
122
+ continue;
123
+ }
124
+ if (P.lastIndex = o, P.test(t)) {
125
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
126
+ F = !0;
127
+ break;
128
+ }
129
+ c += g, C = h, w = o, o = h = P.lastIndex;
130
+ continue;
131
+ }
132
+ o += 1;
133
+ }
134
+ return {
135
+ width: F ? b : c,
136
+ index: F ? d : p,
137
+ truncated: F,
138
+ ellipsed: F && i >= n
139
+ };
140
+ }, pt$1 = {
141
+ limit: Infinity,
142
+ ellipsis: "",
143
+ ellipsisWidth: 0
144
+ }, S = (t, e = {}) => X$1(t, pt$1, e).width, T = "\x1B", Z = "›", Ft$1 = 39, j = "\x07", Q$1 = "[", dt = "]", tt = "m", U$1 = `${dt}8;;`, et = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j})`, "y"), mt$1 = (t) => {
145
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
146
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
147
+ if (t === 1 || t === 2) return 22;
148
+ if (t === 3) return 23;
149
+ if (t === 4) return 24;
150
+ if (t === 7) return 27;
151
+ if (t === 8) return 28;
152
+ if (t === 9) return 29;
153
+ if (t === 0) return 0;
154
+ }, st = (t) => `${T}${Q$1}${t}${tt}`, it = (t) => `${T}${U$1}${t}${j}`, gt$1 = (t) => t.map((e) => S(e)), G = (t, e, s) => {
155
+ const i = e[Symbol.iterator]();
156
+ let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
157
+ for (; !l.done;) {
158
+ const m = l.value, A = S(m);
159
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = !0, n = e.startsWith(U$1, g + 1)), r ? n ? m === j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
160
+ }
161
+ u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
162
+ }, vt$1 = (t) => {
163
+ const e = t.split(" ");
164
+ let s = e.length;
165
+ for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
166
+ return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
167
+ }, Et$1 = (t, e, s = {}) => {
168
+ if (s.trim !== !1 && t.trim() === "") return "";
169
+ let i = "", r, n;
170
+ const u = t.split(" "), a = gt$1(u);
171
+ let l = [""];
172
+ for (const [h, o] of u.entries()) {
173
+ s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
174
+ let p = S(l.at(-1) ?? "");
175
+ if (h !== 0 && (p >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), p = 0), (p > 0 || s.trim === !1) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
176
+ const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
177
+ Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
178
+ continue;
179
+ }
180
+ if (p + a[h] > e && p > 0 && a[h] > 0) {
181
+ if (s.wordWrap === !1 && p < e) {
182
+ G(l, o, e);
183
+ continue;
184
+ }
185
+ l.push("");
186
+ }
187
+ if (p + a[h] > e && s.wordWrap === !1) {
188
+ G(l, o, e);
189
+ continue;
190
+ }
191
+ l[l.length - 1] += o;
192
+ }
193
+ s.trim !== !1 && (l = l.map((h) => vt$1(h)));
194
+ const E = l.join(`
195
+ `), g = E[Symbol.iterator]();
196
+ let m = g.next(), A = g.next(), V = 0;
197
+ for (; !m.done;) {
198
+ const h = m.value, o = A.value;
199
+ if (i += h, h === T || h === Z) {
200
+ et.lastIndex = V + 1;
201
+ const F = et.exec(E)?.groups;
202
+ if (F?.code !== void 0) {
203
+ const d = Number.parseFloat(F.code);
204
+ r = d === Ft$1 ? void 0 : d;
205
+ } else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
206
+ }
207
+ const p = r ? mt$1(r) : void 0;
208
+ o === `
209
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
210
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
211
+ }
212
+ return i;
213
+ };
214
+ function K$1(t, e, s) {
215
+ return String(t).normalize().replaceAll(`\r
216
+ `, `
217
+ `).split(`
218
+ `).map((i) => Et$1(i, e, s)).join(`
219
+ `);
220
+ }
221
+ const _ = {
222
+ actions: new Set([
223
+ "up",
224
+ "down",
225
+ "left",
226
+ "right",
227
+ "space",
228
+ "enter",
229
+ "cancel"
230
+ ]),
231
+ aliases: new Map([
232
+ ["k", "up"],
233
+ ["j", "down"],
234
+ ["h", "left"],
235
+ ["l", "right"],
236
+ ["", "cancel"],
237
+ ["escape", "cancel"]
238
+ ]),
239
+ messages: {
240
+ cancel: "Canceled",
241
+ error: "Something went wrong"
242
+ },
243
+ withGuide: !0
244
+ };
245
+ function H$1(t, e) {
246
+ if (typeof t == "string") return _.aliases.get(t) === e;
247
+ for (const s of t) if (s !== void 0 && H$1(s, e)) return !0;
248
+ return !1;
249
+ }
250
+ function _t$1(t, e) {
251
+ if (t === e) return;
252
+ const s = t.split(`
253
+ `), i = e.split(`
254
+ `), r = Math.max(s.length, i.length), n = [];
255
+ for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
256
+ return {
257
+ lines: n,
258
+ numLinesBefore: s.length,
259
+ numLinesAfter: i.length,
260
+ numLines: r
261
+ };
262
+ }
263
+ globalThis.process.platform.startsWith("win");
264
+ const z$1 = Symbol("clack:cancel");
265
+ function Ct$1(t) {
266
+ return t === z$1;
267
+ }
268
+ function W$1(t, e) {
269
+ const s = t;
270
+ s.isTTY && s.setRawMode(e);
271
+ }
272
+ const rt = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
273
+ function Bt$1(t, e, s, i = s) {
274
+ return K$1(e, rt(t ?? stdout) - s.length, {
275
+ hard: !0,
276
+ trim: !1
277
+ }).split(`
278
+ `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
279
+ `);
280
+ }
281
+ var B = class {
282
+ input;
283
+ output;
284
+ _abortSignal;
285
+ rl;
286
+ opts;
287
+ _render;
288
+ _track = !1;
289
+ _prevFrame = "";
290
+ _subscribers = /* @__PURE__ */ new Map();
291
+ _cursor = 0;
292
+ state = "initial";
293
+ error = "";
294
+ value;
295
+ userInput = "";
296
+ constructor(e, s = !0) {
297
+ const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
298
+ this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
299
+ }
300
+ unsubscribe() {
301
+ this._subscribers.clear();
302
+ }
303
+ setSubscriber(e, s) {
304
+ const i = this._subscribers.get(e) ?? [];
305
+ i.push(s), this._subscribers.set(e, i);
306
+ }
307
+ on(e, s) {
308
+ this.setSubscriber(e, { cb: s });
309
+ }
310
+ once(e, s) {
311
+ this.setSubscriber(e, {
312
+ cb: s,
313
+ once: !0
314
+ });
315
+ }
316
+ emit(e, ...s) {
317
+ const i = this._subscribers.get(e) ?? [], r = [];
318
+ for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
319
+ for (const n of r) n();
320
+ }
321
+ prompt() {
322
+ return new Promise((e) => {
323
+ if (this._abortSignal) {
324
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z$1);
325
+ this._abortSignal.addEventListener("abort", () => {
326
+ this.state = "cancel", this.close();
327
+ }, { once: !0 });
328
+ }
329
+ this.rl = ot.createInterface({
330
+ input: this.input,
331
+ tabSize: 2,
332
+ prompt: "",
333
+ escapeCodeTimeout: 50,
334
+ terminal: !0
335
+ }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), W$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
336
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), W$1(this.input, !1), e(this.value);
337
+ }), this.once("cancel", () => {
338
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), W$1(this.input, !1), e(z$1);
339
+ });
340
+ });
341
+ }
342
+ _isActionKey(e, s) {
343
+ return e === " ";
344
+ }
345
+ _setValue(e) {
346
+ this.value = e, this.emit("value", this.value);
347
+ }
348
+ _setUserInput(e, s) {
349
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
350
+ }
351
+ _clearUserInput() {
352
+ this.rl?.write(null, {
353
+ ctrl: !0,
354
+ name: "u"
355
+ }), this._setUserInput("");
356
+ }
357
+ onKeypress(e, s) {
358
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
359
+ ctrl: !0,
360
+ name: "h"
361
+ }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
362
+ if (this.opts.validate) {
363
+ const i = this.opts.validate(this.value);
364
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
365
+ }
366
+ this.state !== "error" && (this.state = "submit");
367
+ }
368
+ H$1([
369
+ e,
370
+ s?.name,
371
+ s?.sequence
372
+ ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
373
+ }
374
+ close() {
375
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
376
+ `), W$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
377
+ }
378
+ restoreCursor() {
379
+ const e = K$1(this._prevFrame, process.stdout.columns, {
380
+ hard: !0,
381
+ trim: !1
382
+ }).split(`
383
+ `).length - 1;
384
+ this.output.write(import_src.cursor.move(-999, e * -1));
385
+ }
386
+ render() {
387
+ const e = K$1(this._render(this) ?? "", process.stdout.columns, {
388
+ hard: !0,
389
+ trim: !1
390
+ });
391
+ if (e !== this._prevFrame) {
392
+ if (this.state === "initial") this.output.write(import_src.cursor.hide);
393
+ else {
394
+ const s = _t$1(this._prevFrame, e), i = nt(this.output);
395
+ if (this.restoreCursor(), s) {
396
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
397
+ let u = s.lines.find((a) => a >= r);
398
+ if (u === void 0) {
399
+ this._prevFrame = e;
400
+ return;
401
+ }
402
+ if (s.lines.length === 1) {
403
+ this.output.write(import_src.cursor.move(0, u - n)), this.output.write(import_src.erase.lines(1));
404
+ const a = e.split(`
405
+ `);
406
+ this.output.write(a[u]), this._prevFrame = e, this.output.write(import_src.cursor.move(0, a.length - u - 1));
407
+ return;
408
+ } else if (s.lines.length > 1) {
409
+ if (r < n) u = r;
410
+ else {
411
+ const l = u - n;
412
+ l > 0 && this.output.write(import_src.cursor.move(0, l));
413
+ }
414
+ this.output.write(import_src.erase.down());
415
+ const a = e.split(`
416
+ `).slice(u);
417
+ this.output.write(a.join(`
418
+ `)), this._prevFrame = e;
419
+ return;
420
+ }
421
+ }
422
+ this.output.write(import_src.erase.down());
423
+ }
424
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
425
+ }
426
+ }
427
+ };
428
+ var kt$1 = class extends B {
429
+ get cursor() {
430
+ return this.value ? 0 : 1;
431
+ }
432
+ get _value() {
433
+ return this.cursor === 0;
434
+ }
435
+ constructor(e) {
436
+ super(e, !1), this.value = !!e.initialValue, this.on("userInput", () => {
437
+ this.value = this._value;
438
+ }), this.on("confirm", (s) => {
439
+ this.output.write(import_src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
440
+ }), this.on("cursor", () => {
441
+ this.value = !this.value;
442
+ });
443
+ }
444
+ };
445
+ var Tt$1 = class extends B {
446
+ options;
447
+ cursor = 0;
448
+ get _selectedValue() {
449
+ return this.options[this.cursor];
450
+ }
451
+ changeValue() {
452
+ this.value = this._selectedValue.value;
453
+ }
454
+ constructor(e) {
455
+ super(e, !1), this.options = e.options;
456
+ const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
457
+ this.cursor = this.options[i].disabled ? x$1(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
458
+ switch (r) {
459
+ case "left":
460
+ case "up":
461
+ this.cursor = x$1(this.cursor, -1, this.options);
462
+ break;
463
+ case "down":
464
+ case "right":
465
+ this.cursor = x$1(this.cursor, 1, this.options);
466
+ break;
467
+ }
468
+ this.changeValue();
469
+ });
470
+ }
471
+ };
472
+ var $t = class extends B {
473
+ get userInputWithCursor() {
474
+ if (this.state === "submit") return this.userInput;
475
+ const e = this.userInput;
476
+ if (this.cursor >= e.length) return `${this.userInput}\u2588`;
477
+ const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
478
+ return `${s}${styleText("inverse", i)}${r.join("")}`;
479
+ }
480
+ get cursor() {
481
+ return this._cursor;
482
+ }
483
+ constructor(e) {
484
+ super({
485
+ ...e,
486
+ initialUserInput: e.initialUserInput ?? e.initialValue
487
+ }), this.on("userInput", (s) => {
488
+ this._setValue(s);
489
+ }), this.on("finalize", () => {
490
+ this.value || (this.value = e.defaultValue), this.value === void 0 && (this.value = "");
491
+ });
492
+ }
493
+ };
494
+ //#endregion
495
+ //#region node_modules/.pnpm/@clack+prompts@1.1.0/node_modules/@clack/prompts/dist/index.mjs
496
+ function pt() {
497
+ return N.platform !== "win32" ? N.env.TERM !== "linux" : !!N.env.CI || !!N.env.WT_SESSION || !!N.env.TERMINUS_SUBLIME || N.env.ConEmuTask === "{cmd::Cmder}" || N.env.TERM_PROGRAM === "Terminus-Sublime" || N.env.TERM_PROGRAM === "vscode" || N.env.TERM === "xterm-256color" || N.env.TERM === "alacritty" || N.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
498
+ }
499
+ const ee = pt(), I = (e, r) => ee ? e : r, Re = I("◆", "*"), $e = I("■", "x"), de = I("▲", "x"), V = I("◇", "o"), he = I("┌", "T"), h = I("│", "|"), x = I("└", "—");
500
+ I("┐", "T");
501
+ I("┘", "—");
502
+ const z = I("●", ">"), H = I("○", " ");
503
+ I("◻", "[•]");
504
+ I("◼", "[+]");
505
+ I("◻", "[ ]");
506
+ I("▪", "•");
507
+ I("─", "-");
508
+ I("╮", "+");
509
+ I("├", "+");
510
+ I("╯", "+");
511
+ I("╰", "+");
512
+ I("╭", "+");
513
+ const fe = I("●", "•"), Fe = I("◆", "*"), ye = I("▲", "!"), Ee = I("■", "x"), W = (e) => {
514
+ switch (e) {
515
+ case "initial":
516
+ case "active": return styleText("cyan", Re);
517
+ case "cancel": return styleText("red", $e);
518
+ case "error": return styleText("yellow", de);
519
+ case "submit": return styleText("green", V);
520
+ }
521
+ }, ve = (e) => {
522
+ switch (e) {
523
+ case "initial":
524
+ case "active": return styleText("cyan", h);
525
+ case "cancel": return styleText("red", h);
526
+ case "error": return styleText("yellow", h);
527
+ case "submit": return styleText("green", h);
528
+ }
529
+ }, mt = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, gt = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, ft = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Ft = /\p{M}+/gu, yt = {
530
+ limit: Infinity,
531
+ ellipsis: ""
532
+ }, Le = (e, r = {}, s = {}) => {
533
+ const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
534
+ let $ = 0, m = 0, d = e.length, F = 0, y = !1, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S = 0;
535
+ e: for (;;) {
536
+ if (b > A || m >= d && m > $) {
537
+ const T = e.slice(A, b) || e.slice($, m);
538
+ F = 0;
539
+ for (const M of T.replaceAll(Ft, "")) {
540
+ const O = M.codePointAt(0) || 0;
541
+ if (gt(O) ? S = f : ft(O) ? S = E : c !== g && mt(O) ? S = c : S = g, w + S > C && (v = Math.min(v, Math.max(A, $) + F)), w + S > i) {
542
+ y = !0;
543
+ break e;
544
+ }
545
+ F += M.length, w += S;
546
+ }
547
+ A = b = 0;
548
+ }
549
+ if (m >= d) break;
550
+ if (ne.lastIndex = m, ne.test(e)) {
551
+ if (F = ne.lastIndex - m, S = F * g, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S > i) {
552
+ y = !0;
553
+ break;
554
+ }
555
+ w += S, A = $, b = m, m = $ = ne.lastIndex;
556
+ continue;
557
+ }
558
+ if (we.lastIndex = m, we.test(e)) {
559
+ if (w + u > C && (v = Math.min(v, m)), w + u > i) {
560
+ y = !0;
561
+ break;
562
+ }
563
+ w += u, A = $, b = m, m = $ = we.lastIndex;
564
+ continue;
565
+ }
566
+ if (re.lastIndex = m, re.test(e)) {
567
+ if (F = re.lastIndex - m, S = F * l, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S > i) {
568
+ y = !0;
569
+ break;
570
+ }
571
+ w += S, A = $, b = m, m = $ = re.lastIndex;
572
+ continue;
573
+ }
574
+ if (ie.lastIndex = m, ie.test(e)) {
575
+ if (F = ie.lastIndex - m, S = F * n, w + S > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S > i) {
576
+ y = !0;
577
+ break;
578
+ }
579
+ w += S, A = $, b = m, m = $ = ie.lastIndex;
580
+ continue;
581
+ }
582
+ if (Ae.lastIndex = m, Ae.test(e)) {
583
+ if (w + p > C && (v = Math.min(v, m)), w + p > i) {
584
+ y = !0;
585
+ break;
586
+ }
587
+ w += p, A = $, b = m, m = $ = Ae.lastIndex;
588
+ continue;
589
+ }
590
+ m += 1;
591
+ }
592
+ return {
593
+ width: y ? C : w,
594
+ index: y ? v : d,
595
+ truncated: y,
596
+ ellipsed: y && i >= o
597
+ };
598
+ }, Et = {
599
+ limit: Infinity,
600
+ ellipsis: "",
601
+ ellipsisWidth: 0
602
+ }, D = (e, r = {}) => Le(e, Et, r).width, ae = "\x1B", je = "›", vt = 39, Ce = "\x07", ke = "[", wt = "]", Ve = "m", Se = `${wt}8;;`, He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y"), At = (e) => {
603
+ if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
604
+ if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
605
+ if (e === 1 || e === 2) return 22;
606
+ if (e === 3) return 23;
607
+ if (e === 4) return 24;
608
+ if (e === 7) return 27;
609
+ if (e === 8) return 28;
610
+ if (e === 9) return 29;
611
+ if (e === 0) return 0;
612
+ }, Ue = (e) => `${ae}${ke}${e}${Ve}`, Ke = (e) => `${ae}${Se}${e}${Ce}`, Ct = (e) => e.map((r) => D(r)), Ie = (e, r, s) => {
613
+ const i = r[Symbol.iterator]();
614
+ let a = !1, o = !1, u = e.at(-1), l = u === void 0 ? 0 : D(u), n = i.next(), c = i.next(), p = 0;
615
+ for (; !n.done;) {
616
+ const f = n.value, g = D(f);
617
+ l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = !0, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = !1, o = !1) : f === Ve && (a = !1) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
618
+ }
619
+ u = e.at(-1), !l && u !== void 0 && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
620
+ }, St = (e) => {
621
+ const r = e.split(" ");
622
+ let s = r.length;
623
+ for (; s > 0 && !(D(r[s - 1]) > 0);) s--;
624
+ return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
625
+ }, It = (e, r, s = {}) => {
626
+ if (s.trim !== !1 && e.trim() === "") return "";
627
+ let i = "", a, o;
628
+ const u = e.split(" "), l = Ct(u);
629
+ let n = [""];
630
+ for (const [$, m] of u.entries()) {
631
+ s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
632
+ let d = D(n.at(-1) ?? "");
633
+ if ($ !== 0 && (d >= r && (s.wordWrap === !1 || s.trim === !1) && (n.push(""), d = 0), (d > 0 || s.trim === !1) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
634
+ const F = r - d, y = 1 + Math.floor((l[$] - F - 1) / r);
635
+ Math.floor((l[$] - 1) / r) < y && n.push(""), Ie(n, m, r);
636
+ continue;
637
+ }
638
+ if (d + l[$] > r && d > 0 && l[$] > 0) {
639
+ if (s.wordWrap === !1 && d < r) {
640
+ Ie(n, m, r);
641
+ continue;
642
+ }
643
+ n.push("");
644
+ }
645
+ if (d + l[$] > r && s.wordWrap === !1) {
646
+ Ie(n, m, r);
647
+ continue;
648
+ }
649
+ n[n.length - 1] += m;
650
+ }
651
+ s.trim !== !1 && (n = n.map(($) => St($)));
652
+ const c = n.join(`
653
+ `), p = c[Symbol.iterator]();
654
+ let f = p.next(), g = p.next(), E = 0;
655
+ for (; !f.done;) {
656
+ const $ = f.value, m = g.value;
657
+ if (i += $, $ === ae || $ === je) {
658
+ He.lastIndex = E + 1;
659
+ const y = He.exec(c)?.groups;
660
+ if (y?.code !== void 0) {
661
+ const v = Number.parseFloat(y.code);
662
+ a = v === vt ? void 0 : v;
663
+ } else y?.uri !== void 0 && (o = y.uri.length === 0 ? void 0 : y.uri);
664
+ }
665
+ const d = a ? At(a) : void 0;
666
+ m === `
667
+ ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
668
+ ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
669
+ }
670
+ return i;
671
+ };
672
+ function J(e, r, s) {
673
+ return String(e).normalize().replaceAll(`\r
674
+ `, `
675
+ `).split(`
676
+ `).map((i) => It(i, r, s)).join(`
677
+ `);
678
+ }
679
+ const bt = (e, r, s, i, a) => {
680
+ let o = r, u = 0;
681
+ for (let l = s; l < i; l++) {
682
+ const n = e[l];
683
+ if (o = o - n.length, u++, o <= a) break;
684
+ }
685
+ return {
686
+ lineCount: o,
687
+ removals: u
688
+ };
689
+ }, X = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
690
+ const l = rt(i) - o, n = nt(i), c = styleText("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
691
+ let g = 0;
692
+ e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
693
+ let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
694
+ const m = Math.min(g + f, r.length), d = [];
695
+ let F = 0;
696
+ E && F++, $ && F++;
697
+ const y = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
698
+ for (let A = y; A < v; A++) {
699
+ const b = J(s(r[A], A === e), l, {
700
+ hard: !0,
701
+ trim: !1
702
+ }).split(`
703
+ `);
704
+ d.push(b), F += b.length;
705
+ }
706
+ if (F > p) {
707
+ let A = 0, b = 0, w = F;
708
+ const S = e - y, T = (M, O) => bt(d, w, M, O, p);
709
+ E ? ({lineCount: w, removals: A} = T(0, S), w > p && ({lineCount: w, removals: b} = T(S + 1, d.length))) : ({lineCount: w, removals: b} = T(S + 1, d.length), w > p && ({lineCount: w, removals: A} = T(0, S))), A > 0 && (E = !0, d.splice(0, A)), b > 0 && ($ = !0, d.splice(d.length - b, b));
710
+ }
711
+ const C = [];
712
+ E && C.push(c);
713
+ for (const A of d) for (const b of A) C.push(b);
714
+ return $ && C.push(c), C;
715
+ }, Rt = (e) => {
716
+ const r = e.active ?? "Yes", s = e.inactive ?? "No";
717
+ return new kt$1({
718
+ active: r,
719
+ inactive: s,
720
+ signal: e.signal,
721
+ input: e.input,
722
+ output: e.output,
723
+ initialValue: e.initialValue ?? !0,
724
+ render() {
725
+ const i = e.withGuide ?? _.withGuide, a = `${i ? `${styleText("gray", h)}
726
+ ` : ""}${W(this.state)} ${e.message}
727
+ `, o = this.value ? r : s;
728
+ switch (this.state) {
729
+ case "submit": return `${a}${i ? `${styleText("gray", h)} ` : ""}${styleText("dim", o)}`;
730
+ case "cancel": return `${a}${i ? `${styleText("gray", h)} ` : ""}${styleText(["strikethrough", "dim"], o)}${i ? `
731
+ ${styleText("gray", h)}` : ""}`;
732
+ default: {
733
+ const u = i ? `${styleText("cyan", h)} ` : "", l = i ? styleText("cyan", x) : "";
734
+ return `${a}${u}${this.value ? `${styleText("green", z)} ${r}` : `${styleText("dim", H)} ${styleText("dim", r)}`}${e.vertical ? i ? `
735
+ ${styleText("cyan", h)} ` : `
736
+ ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
737
+ ${l}
738
+ `;
739
+ }
740
+ }
741
+ }
742
+ }).prompt();
743
+ }, R = {
744
+ message: (e = [], { symbol: r = styleText("gray", h), secondarySymbol: s = styleText("gray", h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
745
+ const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
746
+ for (let g = 0; g < a; g++) u.push(n);
747
+ const f = Array.isArray(e) ? e : e.split(`
748
+ `);
749
+ if (f.length > 0) {
750
+ const [g, ...E] = f;
751
+ g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
752
+ for (const $ of E) $.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
753
+ }
754
+ i.write(`${u.join(`
755
+ `)}
756
+ `);
757
+ },
758
+ info: (e, r) => {
759
+ R.message(e, {
760
+ ...r,
761
+ symbol: styleText("blue", fe)
762
+ });
763
+ },
764
+ success: (e, r) => {
765
+ R.message(e, {
766
+ ...r,
767
+ symbol: styleText("green", Fe)
768
+ });
769
+ },
770
+ step: (e, r) => {
771
+ R.message(e, {
772
+ ...r,
773
+ symbol: styleText("green", V)
774
+ });
775
+ },
776
+ warn: (e, r) => {
777
+ R.message(e, {
778
+ ...r,
779
+ symbol: styleText("yellow", ye)
780
+ });
781
+ },
782
+ warning: (e, r) => {
783
+ R.warn(e, r);
784
+ },
785
+ error: (e, r) => {
786
+ R.message(e, {
787
+ ...r,
788
+ symbol: styleText("red", Ee)
789
+ });
790
+ }
791
+ }, Nt = (e = "", r) => {
792
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", x)} ` : "";
793
+ s.write(`${i}${styleText("red", e)}
794
+
795
+ `);
796
+ }, Wt = (e = "", r) => {
797
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", he)} ` : "";
798
+ s.write(`${i}${e}
799
+ `);
800
+ }, Gt = (e = "", r) => {
801
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${styleText("gray", h)}
802
+ ${styleText("gray", x)} ` : "";
803
+ s.write(`${i}${e}
804
+
805
+ `);
806
+ };
807
+ I("─", "-"), I("━", "="), I("█", "#");
808
+ const oe = (e, r) => e.includes(`
809
+ `) ? e.split(`
810
+ `).map((s) => r(s)).join(`
811
+ `) : r(e), Jt = (e) => {
812
+ const r = (s, i) => {
813
+ const a = s.label ?? String(s.value);
814
+ switch (i) {
815
+ case "disabled": return `${styleText("gray", H)} ${oe(a, (o) => styleText("gray", o))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
816
+ case "selected": return `${oe(a, (o) => styleText("dim", o))}`;
817
+ case "active": return `${styleText("green", z)} ${a}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
818
+ case "cancelled": return `${oe(a, (o) => styleText(["strikethrough", "dim"], o))}`;
819
+ default: return `${styleText("dim", H)} ${oe(a, (o) => styleText("dim", o))}`;
820
+ }
821
+ };
822
+ return new Tt$1({
823
+ options: e.options,
824
+ signal: e.signal,
825
+ input: e.input,
826
+ output: e.output,
827
+ initialValue: e.initialValue,
828
+ render() {
829
+ const s = e.withGuide ?? _.withGuide, i = `${W(this.state)} `, a = `${ve(this.state)} `, o = Bt$1(e.output, e.message, a, i), u = `${s ? `${styleText("gray", h)}
830
+ ` : ""}${o}
831
+ `;
832
+ switch (this.state) {
833
+ case "submit": {
834
+ const l = s ? `${styleText("gray", h)} ` : "";
835
+ return `${u}${Bt$1(e.output, r(this.options[this.cursor], "selected"), l)}`;
836
+ }
837
+ case "cancel": {
838
+ const l = s ? `${styleText("gray", h)} ` : "";
839
+ return `${u}${Bt$1(e.output, r(this.options[this.cursor], "cancelled"), l)}${s ? `
840
+ ${styleText("gray", h)}` : ""}`;
841
+ }
842
+ default: {
843
+ const l = s ? `${styleText("cyan", h)} ` : "", n = s ? styleText("cyan", x) : "", c = u.split(`
844
+ `).length, p = s ? 2 : 1;
845
+ return `${u}${l}${X({
846
+ output: e.output,
847
+ cursor: this.cursor,
848
+ options: this.options,
849
+ maxItems: e.maxItems,
850
+ columnPadding: l.length,
851
+ rowPadding: c + p,
852
+ style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive")
853
+ }).join(`
854
+ ${l}`)}
855
+ ${n}
856
+ `;
857
+ }
858
+ }
859
+ }
860
+ }).prompt();
861
+ }, Qe = `${styleText("gray", h)} `, K = {
862
+ message: async (e, { symbol: r = styleText("gray", h) } = {}) => {
863
+ process.stdout.write(`${styleText("gray", h)}
864
+ ${r} `);
865
+ let s = 3;
866
+ for await (let i of e) {
867
+ i = i.replace(/\n/g, `
868
+ ${Qe}`), i.includes(`
869
+ `) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
870
+ `))).length);
871
+ const a = stripVTControlCharacters(i).length;
872
+ s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
873
+ ${Qe}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
874
+ }
875
+ process.stdout.write(`
876
+ `);
877
+ },
878
+ info: (e) => K.message(e, { symbol: styleText("blue", fe) }),
879
+ success: (e) => K.message(e, { symbol: styleText("green", Fe) }),
880
+ step: (e) => K.message(e, { symbol: styleText("green", V) }),
881
+ warn: (e) => K.message(e, { symbol: styleText("yellow", ye) }),
882
+ warning: (e) => K.warn(e),
883
+ error: (e) => K.message(e, { symbol: styleText("red", Ee) })
884
+ }, Zt = (e) => new $t({
885
+ validate: e.validate,
886
+ placeholder: e.placeholder,
887
+ defaultValue: e.defaultValue,
888
+ initialValue: e.initialValue,
889
+ output: e.output,
890
+ signal: e.signal,
891
+ input: e.input,
892
+ render() {
893
+ const r = e?.withGuide ?? _.withGuide, s = `${`${r ? `${styleText("gray", h)}
894
+ ` : ""}${W(this.state)} `}${e.message}
895
+ `, i = e.placeholder ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
896
+ switch (this.state) {
897
+ case "error": {
898
+ const u = this.error ? ` ${styleText("yellow", this.error)}` : "", l = r ? `${styleText("yellow", h)} ` : "", n = r ? styleText("yellow", x) : "";
899
+ return `${s.trim()}
900
+ ${l}${a}
901
+ ${n}${u}
902
+ `;
903
+ }
904
+ case "submit": {
905
+ const u = o ? ` ${styleText("dim", o)}` : "";
906
+ return `${s}${r ? styleText("gray", h) : ""}${u}`;
907
+ }
908
+ case "cancel": {
909
+ const u = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", l = r ? styleText("gray", h) : "";
910
+ return `${s}${l}${u}${o.trim() ? `
911
+ ${l}` : ""}`;
912
+ }
913
+ default: return `${s}${r ? `${styleText("cyan", h)} ` : ""}${a}
914
+ ${r ? styleText("cyan", x) : ""}
915
+ `;
916
+ }
917
+ }
918
+ }).prompt();
919
+ //#endregion
920
+ //#region packages/x402-proxy/src/commands/setup.ts
921
+ var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
922
+ async function runSetup(opts) {
923
+ const nonInteractive = opts?.nonInteractive ?? false;
924
+ if (nonInteractive && isConfigured() && !opts?.force) {
925
+ const walletFile = loadWalletFile();
926
+ if (walletFile) {
927
+ process.stdout.write(`${JSON.stringify({
928
+ base: walletFile.addresses.evm,
929
+ tempo: walletFile.addresses.evm,
930
+ solana: walletFile.addresses.solana
931
+ })}\n`);
932
+ return;
933
+ }
934
+ }
935
+ if (isConfigured() && !opts?.force) {
936
+ R.warn(`Already configured. Wallet at ${import_picocolors.default.dim(getWalletPath())}\nTo reconfigure, run:\n ${import_picocolors.default.cyan("$ npx x402-proxy setup --force")}`);
937
+ return;
938
+ }
939
+ let mnemonic;
940
+ if (nonInteractive) {
941
+ if (opts?.importMnemonic) {
942
+ const words = opts.importMnemonic.trim().split(/\s+/);
943
+ if (words.length !== 12 && words.length !== 24) {
944
+ process.stderr.write("Error: mnemonic must be 12 or 24 words\n");
945
+ process.exit(1);
946
+ }
947
+ mnemonic = opts.importMnemonic.trim();
948
+ } else mnemonic = generateMnemonic();
949
+ const evm = deriveEvmKeypair(mnemonic);
950
+ const sol = deriveSolanaKeypair(mnemonic);
951
+ saveWalletFile({
952
+ version: 1,
953
+ mnemonic,
954
+ addresses: {
955
+ evm: evm.address,
956
+ solana: sol.address
957
+ }
958
+ });
959
+ saveConfig({ preferredProtocol: "x402" });
960
+ process.stdout.write(`${JSON.stringify({
961
+ base: evm.address,
962
+ tempo: evm.address,
963
+ solana: sol.address
964
+ })}\n`);
965
+ return;
966
+ }
967
+ Wt(import_picocolors.default.cyan("x402-proxy setup"));
968
+ R.info("This will generate a single BIP-39 mnemonic that derives wallets for both Solana and EVM chains.");
969
+ const action = await Jt({
970
+ message: "How would you like to set up your wallet?",
971
+ options: [{
972
+ value: "generate",
973
+ label: "Generate a new mnemonic"
974
+ }, {
975
+ value: "import",
976
+ label: "Import an existing mnemonic"
977
+ }]
978
+ });
979
+ if (Ct$1(action)) {
980
+ Nt("Setup cancelled.");
981
+ process.exit(0);
982
+ }
983
+ if (action === "generate") {
984
+ mnemonic = generateMnemonic();
985
+ R.warn("Write down your mnemonic and store it safely. It will NOT be shown again.");
986
+ R.message(import_picocolors.default.bold(mnemonic));
987
+ } else {
988
+ const input = await Zt({
989
+ message: "Enter your 24-word mnemonic:",
990
+ validate: (v = "") => {
991
+ const words = v.trim().split(/\s+/);
992
+ if (words.length !== 12 && words.length !== 24) return "Mnemonic must be 12 or 24 words";
993
+ }
994
+ });
995
+ if (Ct$1(input)) {
996
+ Nt("Setup cancelled.");
997
+ process.exit(0);
998
+ }
999
+ mnemonic = input.trim();
1000
+ }
1001
+ const evm = deriveEvmKeypair(mnemonic);
1002
+ const sol = deriveSolanaKeypair(mnemonic);
1003
+ R.success(`Base address: ${import_picocolors.default.green(evm.address)}`);
1004
+ R.success(`Tempo address: ${import_picocolors.default.green(evm.address)}`);
1005
+ R.success(`Solana address: ${import_picocolors.default.green(sol.address)}`);
1006
+ saveWalletFile({
1007
+ version: 1,
1008
+ mnemonic,
1009
+ addresses: {
1010
+ evm: evm.address,
1011
+ solana: sol.address
1012
+ }
1013
+ });
1014
+ const protocol = await Jt({
1015
+ message: "Preferred payment protocol?",
1016
+ options: [{
1017
+ value: "x402",
1018
+ label: "x402 - on-chain payments (Base, Solana)"
1019
+ }, {
1020
+ value: "mpp",
1021
+ label: "MPP - machine payments over HTTP 402 (Tempo)"
1022
+ }]
1023
+ });
1024
+ if (Ct$1(protocol)) {
1025
+ Nt("Setup cancelled.");
1026
+ process.exit(0);
1027
+ }
1028
+ const network = await Jt({
1029
+ message: "Preferred network?",
1030
+ options: protocol === "mpp" ? [{
1031
+ value: "tempo",
1032
+ label: "Tempo"
1033
+ }] : [
1034
+ {
1035
+ value: "auto",
1036
+ label: "Auto-detect (pick chain with highest balance)"
1037
+ },
1038
+ {
1039
+ value: "base",
1040
+ label: "Base (EVM)"
1041
+ },
1042
+ {
1043
+ value: "solana",
1044
+ label: "Solana"
1045
+ }
1046
+ ]
1047
+ });
1048
+ if (Ct$1(network)) {
1049
+ Nt("Setup cancelled.");
1050
+ process.exit(0);
1051
+ }
1052
+ const config = { preferredProtocol: protocol };
1053
+ if (network !== "auto") config.defaultNetwork = network;
1054
+ saveConfig(config);
1055
+ R.info(`Config directory: ${import_picocolors.default.dim(getConfigDirShort())}`);
1056
+ R.step("Fund your wallets to start using x402 resources:");
1057
+ R.message(` Solana (USDC): Send USDC to ${import_picocolors.default.cyan(sol.address)}`);
1058
+ R.message(` Base (USDC): Send USDC to ${import_picocolors.default.cyan(evm.address)}`);
1059
+ R.step("Try your first request:");
1060
+ R.message(` ${import_picocolors.default.cyan(`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`)}`);
1061
+ Gt(import_picocolors.default.green("Setup complete!"));
1062
+ }
1063
+ const setupCommand = buildCommand({
1064
+ docs: {
1065
+ brief: "Set up x402-proxy wallet (generate new or import existing mnemonic)",
1066
+ fullDescription: `Set up x402-proxy wallet interactively, or use --non-interactive for automated environments.
1067
+
1068
+ Non-interactive mode auto-generates a wallet and outputs JSON to stdout:
1069
+ $ npx x402-proxy setup --non-interactive
1070
+ {"base":"0x...","tempo":"0x...","solana":"..."}
1071
+
1072
+ Import an existing mnemonic non-interactively:
1073
+ $ npx x402-proxy setup --non-interactive --import-mnemonic "word1 word2 ... word24"
1074
+
1075
+ If a wallet already exists, --non-interactive outputs the existing addresses.`
1076
+ },
1077
+ parameters: {
1078
+ flags: {
1079
+ force: {
1080
+ kind: "boolean",
1081
+ brief: "Overwrite existing configuration",
1082
+ default: false
1083
+ },
1084
+ nonInteractive: {
1085
+ kind: "boolean",
1086
+ brief: "Auto-generate wallet and output addresses as JSON (no prompts)",
1087
+ default: false
1088
+ },
1089
+ importMnemonic: {
1090
+ kind: "parsed",
1091
+ brief: "Import a BIP-39 mnemonic (use with --non-interactive)",
1092
+ parse: String,
1093
+ optional: true
1094
+ }
1095
+ },
1096
+ positional: {
1097
+ kind: "tuple",
1098
+ parameters: []
1099
+ }
1100
+ },
1101
+ async func(flags) {
1102
+ await runSetup({
1103
+ force: flags.force,
1104
+ nonInteractive: flags.nonInteractive,
1105
+ importMnemonic: flags.importMnemonic
1106
+ });
1107
+ }
1108
+ });
1109
+ //#endregion
1110
+ export { Nt as a, Wt as c, Jt as i, Ct$1 as l, setupCommand as n, R as o, Gt as r, Rt as s, runSetup as t };