opacacms 0.2.1 → 0.3.1

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 (185) hide show
  1. package/README.md +31 -22
  2. package/dist/admin/auth-client.d.ts +39 -39
  3. package/dist/admin/index.d.ts +2 -2
  4. package/dist/admin/index.js +15 -10520
  5. package/dist/admin/plugin-client.d.ts +65 -0
  6. package/dist/admin/react.d.ts +2 -2
  7. package/dist/admin/react.js +34 -4
  8. package/dist/admin/stores/ui.d.ts +19 -4
  9. package/dist/admin/ui/components/PluginSettingsForm.d.ts +2 -2
  10. package/dist/admin/ui/components/custom-alert.d.ts +7 -0
  11. package/dist/admin/ui/components/{DetailSheet.d.ts → detail-sheet.d.ts} +1 -2
  12. package/dist/admin/ui/components/fields/FieldLabel.d.ts +1 -1
  13. package/dist/admin/ui/components/fields/RelationshipField.d.ts +1 -1
  14. package/dist/admin/ui/components/media/AssetManagerModal.d.ts +2 -2
  15. package/dist/admin/ui/components/plugin-iframe.d.ts +7 -0
  16. package/dist/admin/ui/components/ui/accordion.d.ts +17 -7
  17. package/dist/admin/ui/components/ui/alert-dialog.d.ts +16 -12
  18. package/dist/admin/ui/components/ui/button.d.ts +11 -7
  19. package/dist/admin/ui/components/ui/relationship.d.ts +1 -1
  20. package/dist/admin/ui/components/ui/sheet.d.ts +14 -27
  21. package/dist/admin/ui/components/ui/tooltip.d.ts +7 -0
  22. package/dist/admin/ui/components/versions-sheet.d.ts +4 -5
  23. package/dist/admin/ui/views/collection-list-view.d.ts +1 -1
  24. package/dist/admin/ui/views/dashboard-view.d.ts +1 -1
  25. package/dist/admin/ui/views/media-registry-view.d.ts +3 -3
  26. package/dist/admin/ui/views/settings-view.d.ts +2 -2
  27. package/dist/admin/vue.js +27 -4
  28. package/dist/admin/webcomponent.js +66 -16
  29. package/dist/admin.css +1 -1
  30. package/dist/auth/index.d.ts +43 -43
  31. package/dist/{chunk-7y1nbmw6.js → chunk-1bd7fz7n.js} +32 -2
  32. package/dist/chunk-1qm0m8r8.js +413 -0
  33. package/dist/chunk-2k3ysje3.js +31 -0
  34. package/dist/{chunk-jdfw4v3r.js → chunk-3j9zjfmn.js} +95 -30
  35. package/dist/{chunk-byq8g0rd.js → chunk-48ywpd0a.js} +16 -22
  36. package/dist/{chunk-tfnaf41w.js → chunk-5422w4eq.js} +41 -25
  37. package/dist/chunk-56n342hs.js +95 -0
  38. package/dist/chunk-5b8r0v8c.js +47 -0
  39. package/dist/chunk-63yg00vx.js +263 -0
  40. package/dist/{chunk-8sqjbsgt.js → chunk-6bywt602.js} +26 -1
  41. package/dist/{chunk-v9z61v3g.js → chunk-6qs0g65f.js} +43 -3
  42. package/dist/chunk-7rr5p01g.js +581 -0
  43. package/dist/{chunk-2es275xs.js → chunk-941zxavt.js} +867 -322
  44. package/dist/{chunk-51z3x7kq.js → chunk-a3qae86h.js} +1 -1
  45. package/dist/{chunk-3rdhbedb.js → chunk-adq2b75c.js} +2 -2
  46. package/dist/chunk-d0tb1xjw.js +93 -0
  47. package/dist/chunk-d7cgd6vn.js +318 -0
  48. package/dist/{chunk-6d1vdfwa.js → chunk-e0g6gn7n.js} +54 -75
  49. package/dist/chunk-ec4jhybj.js +1137 -0
  50. package/dist/chunk-fatyf6f7.js +221 -0
  51. package/dist/{chunk-526a3gqx.js → chunk-fnsf1dfm.js} +1 -1
  52. package/dist/chunk-g9bxb6h0.js +205 -0
  53. package/dist/chunk-gyaf5kgf.js +10 -0
  54. package/dist/{chunk-9kxpbcb1.js → chunk-h6dhexzr.js} +16 -7
  55. package/dist/{chunk-dykn5hr6.js → chunk-j8js1y0h.js} +31 -74
  56. package/dist/{chunk-t0zg026p.js → chunk-jq1drsen.js} +12 -1
  57. package/dist/{chunk-b3kr8w41.js → chunk-m24yqkeq.js} +38 -26
  58. package/dist/chunk-m5ems3hh.js +410 -0
  59. package/dist/{chunk-8scgdznr.js → chunk-m83ybzf8.js} +15 -18
  60. package/dist/chunk-majsbncm.js +98 -0
  61. package/dist/chunk-mp2gt9yh.js +237 -0
  62. package/dist/chunk-n1twhqmf.js +54 -0
  63. package/dist/{chunk-bygjkgrx.js → chunk-naqcqj8n.js} +57 -80
  64. package/dist/chunk-q5sb5dcr.js +15 -0
  65. package/dist/{chunk-06ks4ggh.js → chunk-qhdsjek6.js} +49 -89
  66. package/dist/{chunk-n133qpsm.js → chunk-qsh2nqz3.js} +50 -81
  67. package/dist/chunk-r0ms5tk1.js +76 -0
  68. package/dist/chunk-rwqwsanx.js +75 -0
  69. package/dist/chunk-sqsfk9p4.js +700 -0
  70. package/dist/{chunk-5gvbp2qa.js → chunk-x7bnzswh.js} +25 -18
  71. package/dist/cli/commands/dev.d.ts +8 -0
  72. package/dist/cli/commands/doctor.d.ts +8 -0
  73. package/dist/cli/commands/generate.d.ts +26 -0
  74. package/dist/cli/commands/init.d.ts +13 -1
  75. package/dist/cli/commands/migrate.d.ts +33 -0
  76. package/dist/cli/commands/plugin.d.ts +13 -0
  77. package/dist/cli/commands/seed.d.ts +21 -0
  78. package/dist/cli/{commands/migrate-commands.d.ts → core/migrations/migrate-logic.d.ts} +2 -2
  79. package/dist/cli/core/migrations/schema-diff-engine.d.ts +12 -0
  80. package/dist/cli/core/migrations/schema-diff.d.ts +11 -0
  81. package/dist/cli/{seeding.d.ts → core/seeding/auto-seed.d.ts} +7 -4
  82. package/dist/cli/core/seeding/seed-logic.d.ts +2 -0
  83. package/dist/cli/index.d.ts +4 -0
  84. package/dist/cli/index.js +6 -170
  85. package/dist/client/RichText.d.ts +5 -0
  86. package/dist/client/rich-text-utils.d.ts +5 -0
  87. package/dist/client.js +3 -2
  88. package/dist/config.d.ts +3 -3
  89. package/dist/db/better-sqlite.d.ts +2 -3
  90. package/dist/db/better-sqlite.js +6 -5
  91. package/dist/db/bun-sqlite.d.ts +2 -3
  92. package/dist/db/bun-sqlite.js +6 -5
  93. package/dist/db/d1.d.ts +13 -7
  94. package/dist/db/d1.js +6 -5
  95. package/dist/db/index.d.ts +2 -2
  96. package/dist/db/index.js +10 -12
  97. package/dist/db/kysely/factory.d.ts +29 -0
  98. package/dist/db/kysely/plugins/audit-logging.d.ts +48 -0
  99. package/dist/db/kysely/plugins/auto-timestamps.d.ts +38 -0
  100. package/dist/db/kysely/plugins/cursor-pagination.d.ts +42 -0
  101. package/dist/db/kysely/plugins/deadlock-handler.d.ts +47 -0
  102. package/dist/db/kysely/plugins/draft-swapper.d.ts +33 -0
  103. package/dist/db/kysely/plugins/field-masking.d.ts +45 -0
  104. package/dist/db/kysely/plugins/fts-normalizer.d.ts +38 -0
  105. package/dist/db/kysely/plugins/i18n-fallback.d.ts +48 -0
  106. package/dist/db/kysely/plugins/id-generation.d.ts +42 -0
  107. package/dist/db/kysely/plugins/index.d.ts +16 -0
  108. package/dist/db/kysely/plugins/json-flattener.d.ts +38 -0
  109. package/dist/db/kysely/plugins/relationship-preloading.d.ts +39 -0
  110. package/dist/db/kysely/plugins/slug-generation.d.ts +37 -0
  111. package/dist/db/kysely/plugins/soft-delete.d.ts +42 -0
  112. package/dist/db/kysely/plugins/tree-resolver.d.ts +39 -0
  113. package/dist/db/kysely/plugins/virtual-field-resolver.d.ts +54 -0
  114. package/dist/db/kysely/plugins/zod-coercion.d.ts +34 -0
  115. package/dist/db/kysely/snapshot/snapshot-manager.d.ts +18 -0
  116. package/dist/db/postgres.d.ts +2 -2
  117. package/dist/db/postgres.js +6 -5
  118. package/dist/db/sqlite.d.ts +2 -3
  119. package/dist/db/sqlite.js +6 -5
  120. package/dist/index.d.ts +3 -0
  121. package/dist/index.js +161 -7
  122. package/dist/runtimes/bun.js +9 -6
  123. package/dist/runtimes/cloudflare-workers.d.ts +3 -1
  124. package/dist/runtimes/cloudflare-workers.js +36 -7
  125. package/dist/runtimes/next.js +8 -5
  126. package/dist/runtimes/node.js +9 -6
  127. package/dist/schema/collection.d.ts +116 -70
  128. package/dist/schema/compiler.d.ts +6 -0
  129. package/dist/schema/global.d.ts +38 -71
  130. package/dist/schema/index.d.ts +5 -4
  131. package/dist/schema/index.js +35 -550
  132. package/dist/schema/zod.d.ts +564 -0
  133. package/dist/server/admin-router.d.ts +1 -1
  134. package/dist/server/collection-router.d.ts +1 -1
  135. package/dist/server/graphql.d.ts +6 -0
  136. package/dist/server/handlers.d.ts +25 -7
  137. package/dist/server/middlewares/auth.d.ts +1 -1
  138. package/dist/server/plugins-loader.d.ts +1 -1
  139. package/dist/server/router.d.ts +2 -2
  140. package/dist/server/routers/admin.d.ts +1 -1
  141. package/dist/server/routers/auth.d.ts +1 -1
  142. package/dist/server/routers/collections.d.ts +4 -1
  143. package/dist/server/routers/plugins.d.ts +2 -2
  144. package/dist/server/setup-middlewares.d.ts +1 -1
  145. package/dist/server/system-router.d.ts +1 -1
  146. package/dist/server.js +11 -6
  147. package/dist/storage/adapters/cloudflare-r2.d.ts +11 -2
  148. package/dist/storage/index.js +5 -5
  149. package/dist/types.d.ts +253 -42
  150. package/dist/utils/context.d.ts +14 -0
  151. package/dist/utils/logger.d.ts +2 -0
  152. package/dist/utils/string.d.ts +10 -0
  153. package/dist/utils/webhooks-engine.d.ts +24 -0
  154. package/dist/validation.d.ts +67 -1
  155. package/dist/validator.d.ts +1 -0
  156. package/package.json +50 -11
  157. package/src/cli/index.ts +117 -0
  158. package/dist/chunk-6qq3ne6b.js +0 -288
  159. package/dist/chunk-6v1fw7q7.js +0 -126
  160. package/dist/chunk-7a9kn0np.js +0 -116
  161. package/dist/chunk-bexcv7xe.js +0 -36
  162. package/dist/chunk-d3ffeqp9.js +0 -87
  163. package/dist/chunk-fj19qccp.js +0 -78
  164. package/dist/chunk-g1jb60xd.js +0 -17
  165. package/dist/chunk-j53pz21t.js +0 -20
  166. package/dist/chunk-mkn49zmy.js +0 -102
  167. package/dist/chunk-r39em4yj.js +0 -29
  168. package/dist/chunk-rsf0tpy1.js +0 -8
  169. package/dist/chunk-srsac177.js +0 -85
  170. package/dist/chunk-twpvxfce.js +0 -64
  171. package/dist/chunk-ywm4t2gm.js +0 -19
  172. package/dist/cli/commands/plugin-sync.d.ts +0 -1
  173. package/dist/cli/commands/seed-command.d.ts +0 -2
  174. package/dist/plugins/ui-bridge.d.ts +0 -12
  175. package/dist/schema/fields/base.d.ts +0 -84
  176. package/dist/schema/fields/index.d.ts +0 -147
  177. package/dist/schema/infer.d.ts +0 -55
  178. /package/dist/admin/ui/components/{ColumnVisibilityToggle.d.ts → column-visibility-toggle.d.ts} +0 -0
  179. /package/dist/admin/ui/components/{DataDetailView.d.ts → data-detail-view.d.ts} +0 -0
  180. /package/dist/cli/{d1-mock.d.ts → core/mocks/d1-mock.d.ts} +0 -0
  181. /package/dist/cli/{r2-mock.d.ts → core/mocks/r2-mock.d.ts} +0 -0
  182. /package/dist/cli/{commands → core/plugins}/plugin-build.d.ts +0 -0
  183. /package/dist/cli/{commands → core/plugins}/plugin-init.d.ts +0 -0
  184. /package/dist/cli/{commands → core/types}/generate-types.d.ts +0 -0
  185. /package/dist/{schema/fields/validation.test.d.ts → cli/seeding.test.d.ts} +0 -0
@@ -0,0 +1,1137 @@
1
+ import {
2
+ __commonJS,
3
+ __toESM
4
+ } from "./chunk-6bywt602.js";
5
+
6
+ // ../../node_modules/sisteransi/src/index.js
7
+ var require_src = __commonJS((exports, module) => {
8
+ var ESC = "\x1B";
9
+ var CSI = `${ESC}[`;
10
+ var beep = "\x07";
11
+ var cursor = {
12
+ to(x, y) {
13
+ if (!y)
14
+ return `${CSI}${x + 1}G`;
15
+ return `${CSI}${y + 1};${x + 1}H`;
16
+ },
17
+ move(x, y) {
18
+ let ret = "";
19
+ if (x < 0)
20
+ ret += `${CSI}${-x}D`;
21
+ else if (x > 0)
22
+ ret += `${CSI}${x}C`;
23
+ if (y < 0)
24
+ ret += `${CSI}${-y}A`;
25
+ else if (y > 0)
26
+ ret += `${CSI}${y}B`;
27
+ return ret;
28
+ },
29
+ up: (count = 1) => `${CSI}${count}A`,
30
+ down: (count = 1) => `${CSI}${count}B`,
31
+ forward: (count = 1) => `${CSI}${count}C`,
32
+ backward: (count = 1) => `${CSI}${count}D`,
33
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
34
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
35
+ left: `${CSI}G`,
36
+ hide: `${CSI}?25l`,
37
+ show: `${CSI}?25h`,
38
+ save: `${ESC}7`,
39
+ restore: `${ESC}8`
40
+ };
41
+ var scroll = {
42
+ up: (count = 1) => `${CSI}S`.repeat(count),
43
+ down: (count = 1) => `${CSI}T`.repeat(count)
44
+ };
45
+ var erase = {
46
+ screen: `${CSI}2J`,
47
+ up: (count = 1) => `${CSI}1J`.repeat(count),
48
+ down: (count = 1) => `${CSI}J`.repeat(count),
49
+ line: `${CSI}2K`,
50
+ lineEnd: `${CSI}K`,
51
+ lineStart: `${CSI}1K`,
52
+ lines(count) {
53
+ let clear = "";
54
+ for (let i = 0;i < count; i++)
55
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
56
+ if (count)
57
+ clear += cursor.left;
58
+ return clear;
59
+ }
60
+ };
61
+ module.exports = { cursor, scroll, erase, beep };
62
+ });
63
+
64
+ // ../../node_modules/@clack/core/dist/index.mjs
65
+ var import_sisteransi = __toESM(require_src(), 1);
66
+ import { styleText as D } from "node:util";
67
+ import { stdout as R, stdin as q } from "node:process";
68
+ import * as k from "node:readline";
69
+ import ot from "node:readline";
70
+ import { ReadStream as J } from "node:tty";
71
+ function x(t, e, s) {
72
+ if (!s.some((u) => !u.disabled))
73
+ return t;
74
+ const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
75
+ return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
76
+ }
77
+ var 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;
78
+ var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
79
+ var 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;
80
+ var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
81
+ var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
82
+ var L = /\t{1,1000}/y;
83
+ var 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?))*/yu;
84
+ var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
85
+ var ct = /\p{M}+/gu;
86
+ var ft = { limit: 1 / 0, ellipsis: "" };
87
+ var X = (t, e = {}, s = {}) => {
88
+ const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, 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;
89
+ let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
90
+ t:
91
+ for (;; ) {
92
+ if (w > C || o >= p && o > h) {
93
+ const ut = t.slice(C, w) || t.slice(h, o);
94
+ v = 0;
95
+ for (const Y of ut.replaceAll(ct, "")) {
96
+ const $ = Y.codePointAt(0) || 0;
97
+ 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) {
98
+ F = true;
99
+ break t;
100
+ }
101
+ v += Y.length, c += f;
102
+ }
103
+ C = w = 0;
104
+ }
105
+ if (o >= p)
106
+ break;
107
+ if (M.lastIndex = o, M.test(t)) {
108
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
109
+ F = true;
110
+ break;
111
+ }
112
+ c += f, C = h, w = o, o = h = M.lastIndex;
113
+ continue;
114
+ }
115
+ if (O.lastIndex = o, O.test(t)) {
116
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
117
+ F = true;
118
+ break;
119
+ }
120
+ c += u, C = h, w = o, o = h = O.lastIndex;
121
+ continue;
122
+ }
123
+ if (y.lastIndex = o, y.test(t)) {
124
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
125
+ F = true;
126
+ break;
127
+ }
128
+ c += f, C = h, w = o, o = h = y.lastIndex;
129
+ continue;
130
+ }
131
+ if (L.lastIndex = o, L.test(t)) {
132
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
133
+ F = true;
134
+ break;
135
+ }
136
+ c += f, C = h, w = o, o = h = L.lastIndex;
137
+ continue;
138
+ }
139
+ if (P.lastIndex = o, P.test(t)) {
140
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
141
+ F = true;
142
+ break;
143
+ }
144
+ c += g, C = h, w = o, o = h = P.lastIndex;
145
+ continue;
146
+ }
147
+ o += 1;
148
+ }
149
+ return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
150
+ };
151
+ var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
152
+ var S = (t, e = {}) => X(t, pt, e).width;
153
+ var T = "\x1B";
154
+ var Z = "›";
155
+ var Ft = 39;
156
+ var j = "\x07";
157
+ var Q = "[";
158
+ var dt = "]";
159
+ var tt = "m";
160
+ var U = `${dt}8;;`;
161
+ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
162
+ var mt = (t) => {
163
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
164
+ return 39;
165
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
166
+ return 49;
167
+ if (t === 1 || t === 2)
168
+ return 22;
169
+ if (t === 3)
170
+ return 23;
171
+ if (t === 4)
172
+ return 24;
173
+ if (t === 7)
174
+ return 27;
175
+ if (t === 8)
176
+ return 28;
177
+ if (t === 9)
178
+ return 29;
179
+ if (t === 0)
180
+ return 0;
181
+ };
182
+ var st = (t) => `${T}${Q}${t}${tt}`;
183
+ var it = (t) => `${T}${U}${t}${j}`;
184
+ var gt = (t) => t.map((e) => S(e));
185
+ var G = (t, e, s) => {
186
+ const i = e[Symbol.iterator]();
187
+ let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
188
+ for (;!l.done; ) {
189
+ const m = l.value, A = S(m);
190
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
191
+ }
192
+ u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
193
+ };
194
+ var vt = (t) => {
195
+ const e = t.split(" ");
196
+ let s = e.length;
197
+ for (;s > 0 && !(S(e[s - 1]) > 0); )
198
+ s--;
199
+ return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
200
+ };
201
+ var Et = (t, e, s = {}) => {
202
+ if (s.trim !== false && t.trim() === "")
203
+ return "";
204
+ let i = "", r, n;
205
+ const u = t.split(" "), a = gt(u);
206
+ let l = [""];
207
+ for (const [h, o] of u.entries()) {
208
+ s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
209
+ let p = S(l.at(-1) ?? "");
210
+ if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
211
+ const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
212
+ Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
213
+ continue;
214
+ }
215
+ if (p + a[h] > e && p > 0 && a[h] > 0) {
216
+ if (s.wordWrap === false && p < e) {
217
+ G(l, o, e);
218
+ continue;
219
+ }
220
+ l.push("");
221
+ }
222
+ if (p + a[h] > e && s.wordWrap === false) {
223
+ G(l, o, e);
224
+ continue;
225
+ }
226
+ l[l.length - 1] += o;
227
+ }
228
+ s.trim !== false && (l = l.map((h) => vt(h)));
229
+ const E = l.join(`
230
+ `), g = E[Symbol.iterator]();
231
+ let m = g.next(), A = g.next(), V = 0;
232
+ for (;!m.done; ) {
233
+ const h = m.value, o = A.value;
234
+ if (i += h, h === T || h === Z) {
235
+ et.lastIndex = V + 1;
236
+ const F = et.exec(E)?.groups;
237
+ if (F?.code !== undefined) {
238
+ const d = Number.parseFloat(F.code);
239
+ r = d === Ft ? undefined : d;
240
+ } else
241
+ F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
242
+ }
243
+ const p = r ? mt(r) : undefined;
244
+ o === `
245
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
246
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
247
+ }
248
+ return i;
249
+ };
250
+ function K(t, e, s) {
251
+ return String(t).normalize().replaceAll(`\r
252
+ `, `
253
+ `).split(`
254
+ `).map((i) => Et(i, e, s)).join(`
255
+ `);
256
+ }
257
+ var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
258
+ var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
259
+ function H(t, e) {
260
+ if (typeof t == "string")
261
+ return _.aliases.get(t) === e;
262
+ for (const s of t)
263
+ if (s !== undefined && H(s, e))
264
+ return true;
265
+ return false;
266
+ }
267
+ function _t(t, e) {
268
+ if (t === e)
269
+ return;
270
+ const s = t.split(`
271
+ `), i = e.split(`
272
+ `), r = Math.max(s.length, i.length), n = [];
273
+ for (let u = 0;u < r; u++)
274
+ s[u] !== i[u] && n.push(u);
275
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
276
+ }
277
+ var bt = globalThis.process.platform.startsWith("win");
278
+ var z = Symbol("clack:cancel");
279
+ function Ct(t) {
280
+ return t === z;
281
+ }
282
+ function W(t, e) {
283
+ const s = t;
284
+ s.isTTY && s.setRawMode(e);
285
+ }
286
+ function xt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
287
+ const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
288
+ k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
289
+ const n = (u, { name: a, sequence: l }) => {
290
+ const E = String(u);
291
+ if (H([E, a, l], "cancel")) {
292
+ i && e.write(import_sisteransi.cursor.show), process.exit(0);
293
+ return;
294
+ }
295
+ if (!s)
296
+ return;
297
+ const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
298
+ k.moveCursor(e, g, m, () => {
299
+ k.clearLine(e, 1, () => {
300
+ t.once("keypress", n);
301
+ });
302
+ });
303
+ };
304
+ return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
305
+ t.off("keypress", n), i && e.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
306
+ };
307
+ }
308
+ var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
309
+ var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
310
+ function Bt(t, e, s, i = s) {
311
+ const r = rt(t ?? R);
312
+ return K(e, r - s.length, { hard: true, trim: false }).split(`
313
+ `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
314
+ `);
315
+ }
316
+
317
+ class B {
318
+ input;
319
+ output;
320
+ _abortSignal;
321
+ rl;
322
+ opts;
323
+ _render;
324
+ _track = false;
325
+ _prevFrame = "";
326
+ _subscribers = new Map;
327
+ _cursor = 0;
328
+ state = "initial";
329
+ error = "";
330
+ value;
331
+ userInput = "";
332
+ constructor(e, s = true) {
333
+ const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
334
+ 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;
335
+ }
336
+ unsubscribe() {
337
+ this._subscribers.clear();
338
+ }
339
+ setSubscriber(e, s) {
340
+ const i = this._subscribers.get(e) ?? [];
341
+ i.push(s), this._subscribers.set(e, i);
342
+ }
343
+ on(e, s) {
344
+ this.setSubscriber(e, { cb: s });
345
+ }
346
+ once(e, s) {
347
+ this.setSubscriber(e, { cb: s, once: true });
348
+ }
349
+ emit(e, ...s) {
350
+ const i = this._subscribers.get(e) ?? [], r = [];
351
+ for (const n of i)
352
+ n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
353
+ for (const n of r)
354
+ n();
355
+ }
356
+ prompt() {
357
+ return new Promise((e) => {
358
+ if (this._abortSignal) {
359
+ if (this._abortSignal.aborted)
360
+ return this.state = "cancel", this.close(), e(z);
361
+ this._abortSignal.addEventListener("abort", () => {
362
+ this.state = "cancel", this.close();
363
+ }, { once: true });
364
+ }
365
+ this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), W(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
366
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(this.value);
367
+ }), this.once("cancel", () => {
368
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(z);
369
+ });
370
+ });
371
+ }
372
+ _isActionKey(e, s) {
373
+ return e === "\t";
374
+ }
375
+ _setValue(e) {
376
+ this.value = e, this.emit("value", this.value);
377
+ }
378
+ _setUserInput(e, s) {
379
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
380
+ }
381
+ _clearUserInput() {
382
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
383
+ }
384
+ onKeypress(e, s) {
385
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), 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") {
386
+ if (this.opts.validate) {
387
+ const i = this.opts.validate(this.value);
388
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
389
+ }
390
+ this.state !== "error" && (this.state = "submit");
391
+ }
392
+ H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
393
+ }
394
+ close() {
395
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
396
+ `), W(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
397
+ }
398
+ restoreCursor() {
399
+ const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
400
+ `).length - 1;
401
+ this.output.write(import_sisteransi.cursor.move(-999, e * -1));
402
+ }
403
+ render() {
404
+ const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
405
+ if (e !== this._prevFrame) {
406
+ if (this.state === "initial")
407
+ this.output.write(import_sisteransi.cursor.hide);
408
+ else {
409
+ const s = _t(this._prevFrame, e), i = nt(this.output);
410
+ if (this.restoreCursor(), s) {
411
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
412
+ let u = s.lines.find((a) => a >= r);
413
+ if (u === undefined) {
414
+ this._prevFrame = e;
415
+ return;
416
+ }
417
+ if (s.lines.length === 1) {
418
+ this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
419
+ const a = e.split(`
420
+ `);
421
+ this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
422
+ return;
423
+ } else if (s.lines.length > 1) {
424
+ if (r < n)
425
+ u = r;
426
+ else {
427
+ const l = u - n;
428
+ l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
429
+ }
430
+ this.output.write(import_sisteransi.erase.down());
431
+ const a = e.split(`
432
+ `).slice(u);
433
+ this.output.write(a.join(`
434
+ `)), this._prevFrame = e;
435
+ return;
436
+ }
437
+ }
438
+ this.output.write(import_sisteransi.erase.down());
439
+ }
440
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
441
+ }
442
+ }
443
+ }
444
+ function wt(t, e) {
445
+ if (t === undefined || e.length === 0)
446
+ return 0;
447
+ const s = e.findIndex((i) => i.value === t);
448
+ return s !== -1 ? s : 0;
449
+ }
450
+ function Dt(t, e) {
451
+ return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
452
+ }
453
+ function St(t, e) {
454
+ if (e)
455
+ return t ? e : e[0];
456
+ }
457
+
458
+ class Vt extends B {
459
+ filteredOptions;
460
+ multiple;
461
+ isNavigating = false;
462
+ selectedValues = [];
463
+ focusedValue;
464
+ #t = 0;
465
+ #s = "";
466
+ #i;
467
+ #e;
468
+ get cursor() {
469
+ return this.#t;
470
+ }
471
+ get userInputWithCursor() {
472
+ if (!this.userInput)
473
+ return D(["inverse", "hidden"], "_");
474
+ if (this._cursor >= this.userInput.length)
475
+ return `${this.userInput}█`;
476
+ const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
477
+ return `${e}${D("inverse", s)}${i.join("")}`;
478
+ }
479
+ get options() {
480
+ return typeof this.#e == "function" ? this.#e() : this.#e;
481
+ }
482
+ constructor(e) {
483
+ super(e), this.#e = e.options;
484
+ const s = this.options;
485
+ this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
486
+ let i;
487
+ if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
488
+ for (const r of i) {
489
+ const n = s.findIndex((u) => u.value === r);
490
+ n !== -1 && (this.toggleSelected(r), this.#t = n);
491
+ }
492
+ this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
493
+ }
494
+ _isActionKey(e, s) {
495
+ return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
496
+ }
497
+ #r(e, s) {
498
+ const i = s.name === "up", r = s.name === "down", n = s.name === "return";
499
+ i || r ? (this.#t = x(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
500
+ }
501
+ deselectAll() {
502
+ this.selectedValues = [];
503
+ }
504
+ toggleSelected(e) {
505
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
506
+ }
507
+ #n(e) {
508
+ if (e !== this.#s) {
509
+ this.#s = e;
510
+ const s = this.options;
511
+ e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
512
+ const i = wt(this.focusedValue, this.filteredOptions);
513
+ this.#t = x(i, 0, this.filteredOptions);
514
+ const r = this.filteredOptions[this.#t];
515
+ r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
516
+ }
517
+ }
518
+ }
519
+
520
+ class kt extends B {
521
+ get cursor() {
522
+ return this.value ? 0 : 1;
523
+ }
524
+ get _value() {
525
+ return this.cursor === 0;
526
+ }
527
+ constructor(e) {
528
+ super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
529
+ this.value = this._value;
530
+ }), this.on("confirm", (s) => {
531
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
532
+ }), this.on("cursor", () => {
533
+ this.value = !this.value;
534
+ });
535
+ }
536
+ }
537
+
538
+ class yt extends B {
539
+ options;
540
+ cursor = 0;
541
+ #t;
542
+ getGroupItems(e) {
543
+ return this.options.filter((s) => s.group === e);
544
+ }
545
+ isGroupSelected(e) {
546
+ const s = this.getGroupItems(e), i = this.value;
547
+ return i === undefined ? false : s.every((r) => i.includes(r.value));
548
+ }
549
+ toggleValue() {
550
+ const e = this.options[this.cursor];
551
+ if (this.value === undefined && (this.value = []), e.group === true) {
552
+ const s = e.value, i = this.getGroupItems(s);
553
+ this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
554
+ } else {
555
+ const s = this.value.includes(e.value);
556
+ this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
557
+ }
558
+ }
559
+ constructor(e) {
560
+ super(e, false);
561
+ const { options: s } = e;
562
+ this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
563
+ switch (i) {
564
+ case "left":
565
+ case "up": {
566
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
567
+ const r = this.options[this.cursor]?.group === true;
568
+ !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
569
+ break;
570
+ }
571
+ case "down":
572
+ case "right": {
573
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
574
+ const r = this.options[this.cursor]?.group === true;
575
+ !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
576
+ break;
577
+ }
578
+ case "space":
579
+ this.toggleValue();
580
+ break;
581
+ }
582
+ });
583
+ }
584
+ }
585
+ class Tt extends B {
586
+ options;
587
+ cursor = 0;
588
+ get _selectedValue() {
589
+ return this.options[this.cursor];
590
+ }
591
+ changeValue() {
592
+ this.value = this._selectedValue.value;
593
+ }
594
+ constructor(e) {
595
+ super(e, false), this.options = e.options;
596
+ const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
597
+ this.cursor = this.options[i].disabled ? x(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
598
+ switch (r) {
599
+ case "left":
600
+ case "up":
601
+ this.cursor = x(this.cursor, -1, this.options);
602
+ break;
603
+ case "down":
604
+ case "right":
605
+ this.cursor = x(this.cursor, 1, this.options);
606
+ break;
607
+ }
608
+ this.changeValue();
609
+ });
610
+ }
611
+ }
612
+ class $t extends B {
613
+ get userInputWithCursor() {
614
+ if (this.state === "submit")
615
+ return this.userInput;
616
+ const e = this.userInput;
617
+ if (this.cursor >= e.length)
618
+ return `${this.userInput}█`;
619
+ const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
620
+ return `${s}${D("inverse", i)}${r.join("")}`;
621
+ }
622
+ get cursor() {
623
+ return this._cursor;
624
+ }
625
+ constructor(e) {
626
+ super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
627
+ this._setValue(s);
628
+ }), this.on("finalize", () => {
629
+ this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
630
+ });
631
+ }
632
+ }
633
+
634
+ // ../../node_modules/@clack/prompts/dist/index.mjs
635
+ import { styleText as t, stripVTControlCharacters as ue } from "node:util";
636
+ import N2 from "node:process";
637
+ var import_sisteransi2 = __toESM(require_src(), 1);
638
+ function pt2() {
639
+ return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
640
+ }
641
+ var ee = pt2();
642
+ var ce = () => process.env.CI === "true";
643
+ var I2 = (e, r) => ee ? e : r;
644
+ var Re = I2("◆", "*");
645
+ var $e = I2("■", "x");
646
+ var de = I2("▲", "x");
647
+ var V = I2("◇", "o");
648
+ var he = I2("┌", "T");
649
+ var h = I2("│", "|");
650
+ var x2 = I2("└", "—");
651
+ var Oe = I2("┐", "T");
652
+ var Pe = I2("┘", "—");
653
+ var z2 = I2("●", ">");
654
+ var H2 = I2("○", " ");
655
+ var te = I2("◻", "[•]");
656
+ var U2 = I2("◼", "[+]");
657
+ var q2 = I2("◻", "[ ]");
658
+ var Ne = I2("▪", "•");
659
+ var se = I2("─", "-");
660
+ var pe = I2("╮", "+");
661
+ var We = I2("├", "+");
662
+ var me = I2("╯", "+");
663
+ var ge = I2("╰", "+");
664
+ var Ge = I2("╭", "+");
665
+ var fe = I2("●", "•");
666
+ var Fe = I2("◆", "*");
667
+ var ye = I2("▲", "!");
668
+ var Ee = I2("■", "x");
669
+ var W2 = (e) => {
670
+ switch (e) {
671
+ case "initial":
672
+ case "active":
673
+ return t("cyan", Re);
674
+ case "cancel":
675
+ return t("red", $e);
676
+ case "error":
677
+ return t("yellow", de);
678
+ case "submit":
679
+ return t("green", V);
680
+ }
681
+ };
682
+ var ve = (e) => {
683
+ switch (e) {
684
+ case "initial":
685
+ case "active":
686
+ return t("cyan", h);
687
+ case "cancel":
688
+ return t("red", h);
689
+ case "error":
690
+ return t("yellow", h);
691
+ case "submit":
692
+ return t("green", h);
693
+ }
694
+ };
695
+ var mt2 = (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;
696
+ var gt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
697
+ var ft2 = (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;
698
+ var we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
699
+ var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
700
+ var ie = /\t{1,1000}/y;
701
+ var 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?))*/yu;
702
+ var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
703
+ var Ft2 = /\p{M}+/gu;
704
+ var yt2 = { limit: 1 / 0, ellipsis: "" };
705
+ var Le = (e, r = {}, s = {}) => {
706
+ const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt2, 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;
707
+ let $ = 0, m = 0, d = e.length, F = 0, y2 = false, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S2 = 0;
708
+ e:
709
+ for (;; ) {
710
+ if (b > A || m >= d && m > $) {
711
+ const T2 = e.slice(A, b) || e.slice($, m);
712
+ F = 0;
713
+ for (const M2 of T2.replaceAll(Ft2, "")) {
714
+ const O2 = M2.codePointAt(0) || 0;
715
+ if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
716
+ y2 = true;
717
+ break e;
718
+ }
719
+ F += M2.length, w += S2;
720
+ }
721
+ A = b = 0;
722
+ }
723
+ if (m >= d)
724
+ break;
725
+ if (ne.lastIndex = m, ne.test(e)) {
726
+ if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
727
+ y2 = true;
728
+ break;
729
+ }
730
+ w += S2, A = $, b = m, m = $ = ne.lastIndex;
731
+ continue;
732
+ }
733
+ if (we.lastIndex = m, we.test(e)) {
734
+ if (w + u > C && (v = Math.min(v, m)), w + u > i) {
735
+ y2 = true;
736
+ break;
737
+ }
738
+ w += u, A = $, b = m, m = $ = we.lastIndex;
739
+ continue;
740
+ }
741
+ if (re.lastIndex = m, re.test(e)) {
742
+ if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
743
+ y2 = true;
744
+ break;
745
+ }
746
+ w += S2, A = $, b = m, m = $ = re.lastIndex;
747
+ continue;
748
+ }
749
+ if (ie.lastIndex = m, ie.test(e)) {
750
+ if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
751
+ y2 = true;
752
+ break;
753
+ }
754
+ w += S2, A = $, b = m, m = $ = ie.lastIndex;
755
+ continue;
756
+ }
757
+ if (Ae.lastIndex = m, Ae.test(e)) {
758
+ if (w + p > C && (v = Math.min(v, m)), w + p > i) {
759
+ y2 = true;
760
+ break;
761
+ }
762
+ w += p, A = $, b = m, m = $ = Ae.lastIndex;
763
+ continue;
764
+ }
765
+ m += 1;
766
+ }
767
+ return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
768
+ };
769
+ var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
770
+ var D2 = (e, r = {}) => Le(e, Et2, r).width;
771
+ var ae = "\x1B";
772
+ var je = "›";
773
+ var vt2 = 39;
774
+ var Ce = "\x07";
775
+ var ke = "[";
776
+ var wt2 = "]";
777
+ var Ve = "m";
778
+ var Se = `${wt2}8;;`;
779
+ var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
780
+ var At2 = (e) => {
781
+ if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
782
+ return 39;
783
+ if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
784
+ return 49;
785
+ if (e === 1 || e === 2)
786
+ return 22;
787
+ if (e === 3)
788
+ return 23;
789
+ if (e === 4)
790
+ return 24;
791
+ if (e === 7)
792
+ return 27;
793
+ if (e === 8)
794
+ return 28;
795
+ if (e === 9)
796
+ return 29;
797
+ if (e === 0)
798
+ return 0;
799
+ };
800
+ var Ue = (e) => `${ae}${ke}${e}${Ve}`;
801
+ var Ke = (e) => `${ae}${Se}${e}${Ce}`;
802
+ var Ct2 = (e) => e.map((r) => D2(r));
803
+ var Ie = (e, r, s) => {
804
+ const i = r[Symbol.iterator]();
805
+ let a = false, o = false, u = e.at(-1), l = u === undefined ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
806
+ for (;!n.done; ) {
807
+ const f = n.value, g = D2(f);
808
+ l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
809
+ }
810
+ u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
811
+ };
812
+ var St2 = (e) => {
813
+ const r = e.split(" ");
814
+ let s = r.length;
815
+ for (;s > 0 && !(D2(r[s - 1]) > 0); )
816
+ s--;
817
+ return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
818
+ };
819
+ var It2 = (e, r, s = {}) => {
820
+ if (s.trim !== false && e.trim() === "")
821
+ return "";
822
+ let i = "", a, o;
823
+ const u = e.split(" "), l = Ct2(u);
824
+ let n = [""];
825
+ for (const [$, m] of u.entries()) {
826
+ s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
827
+ let d = D2(n.at(-1) ?? "");
828
+ if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
829
+ const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
830
+ Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
831
+ continue;
832
+ }
833
+ if (d + l[$] > r && d > 0 && l[$] > 0) {
834
+ if (s.wordWrap === false && d < r) {
835
+ Ie(n, m, r);
836
+ continue;
837
+ }
838
+ n.push("");
839
+ }
840
+ if (d + l[$] > r && s.wordWrap === false) {
841
+ Ie(n, m, r);
842
+ continue;
843
+ }
844
+ n[n.length - 1] += m;
845
+ }
846
+ s.trim !== false && (n = n.map(($) => St2($)));
847
+ const c = n.join(`
848
+ `), p = c[Symbol.iterator]();
849
+ let f = p.next(), g = p.next(), E = 0;
850
+ for (;!f.done; ) {
851
+ const $ = f.value, m = g.value;
852
+ if (i += $, $ === ae || $ === je) {
853
+ He.lastIndex = E + 1;
854
+ const y2 = He.exec(c)?.groups;
855
+ if (y2?.code !== undefined) {
856
+ const v = Number.parseFloat(y2.code);
857
+ a = v === vt2 ? undefined : v;
858
+ } else
859
+ y2?.uri !== undefined && (o = y2.uri.length === 0 ? undefined : y2.uri);
860
+ }
861
+ const d = a ? At2(a) : undefined;
862
+ m === `
863
+ ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
864
+ ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
865
+ }
866
+ return i;
867
+ };
868
+ function J2(e, r, s) {
869
+ return String(e).normalize().replaceAll(`\r
870
+ `, `
871
+ `).split(`
872
+ `).map((i) => It2(i, r, s)).join(`
873
+ `);
874
+ }
875
+ var bt2 = (e, r, s, i, a) => {
876
+ let o = r, u = 0;
877
+ for (let l = s;l < i; l++) {
878
+ const n = e[l];
879
+ if (o = o - n.length, u++, o <= a)
880
+ break;
881
+ }
882
+ return { lineCount: o, removals: u };
883
+ };
884
+ var X2 = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
885
+ const l = rt(i) - o, n = nt(i), c = t("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
886
+ let g = 0;
887
+ e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
888
+ let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
889
+ const m = Math.min(g + f, r.length), d = [];
890
+ let F = 0;
891
+ E && F++, $ && F++;
892
+ const y2 = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
893
+ for (let A = y2;A < v; A++) {
894
+ const b = J2(s(r[A], A === e), l, { hard: true, trim: false }).split(`
895
+ `);
896
+ d.push(b), F += b.length;
897
+ }
898
+ if (F > p) {
899
+ let A = 0, b = 0, w = F;
900
+ const S2 = e - y2, T2 = (M2, O2) => bt2(d, w, M2, O2, p);
901
+ E ? ({ lineCount: w, removals: A } = T2(0, S2), w > p && ({ lineCount: w, removals: b } = T2(S2 + 1, d.length))) : ({ lineCount: w, removals: b } = T2(S2 + 1, d.length), w > p && ({ lineCount: w, removals: A } = T2(0, S2))), A > 0 && (E = true, d.splice(0, A)), b > 0 && ($ = true, d.splice(d.length - b, b));
902
+ }
903
+ const C = [];
904
+ E && C.push(c);
905
+ for (const A of d)
906
+ for (const b of A)
907
+ C.push(b);
908
+ return $ && C.push(c), C;
909
+ };
910
+ var Rt = (e) => {
911
+ const r = e.active ?? "Yes", s = e.inactive ?? "No";
912
+ return new kt({ active: r, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
913
+ const i = e.withGuide ?? _.withGuide, a = `${i ? `${t("gray", h)}
914
+ ` : ""}${W2(this.state)} ${e.message}
915
+ `, o = this.value ? r : s;
916
+ switch (this.state) {
917
+ case "submit": {
918
+ const u = i ? `${t("gray", h)} ` : "";
919
+ return `${a}${u}${t("dim", o)}`;
920
+ }
921
+ case "cancel": {
922
+ const u = i ? `${t("gray", h)} ` : "";
923
+ return `${a}${u}${t(["strikethrough", "dim"], o)}${i ? `
924
+ ${t("gray", h)}` : ""}`;
925
+ }
926
+ default: {
927
+ const u = i ? `${t("cyan", h)} ` : "", l = i ? t("cyan", x2) : "";
928
+ return `${a}${u}${this.value ? `${t("green", z2)} ${r}` : `${t("dim", H2)} ${t("dim", r)}`}${e.vertical ? i ? `
929
+ ${t("cyan", h)} ` : `
930
+ ` : ` ${t("dim", "/")} `}${this.value ? `${t("dim", H2)} ${t("dim", s)}` : `${t("green", z2)} ${s}`}
931
+ ${l}
932
+ `;
933
+ }
934
+ }
935
+ } }).prompt();
936
+ };
937
+ var R2 = { message: (e = [], { symbol: r = t("gray", h), secondarySymbol: s = t("gray", h), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
938
+ const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", p = l ? `${s} ` : "";
939
+ for (let g = 0;g < a; g++)
940
+ u.push(n);
941
+ const f = Array.isArray(e) ? e : e.split(`
942
+ `);
943
+ if (f.length > 0) {
944
+ const [g, ...E] = f;
945
+ g.length > 0 ? u.push(`${c}${g}`) : u.push(l ? r : "");
946
+ for (const $ of E)
947
+ $.length > 0 ? u.push(`${p}${$}`) : u.push(l ? s : "");
948
+ }
949
+ i.write(`${u.join(`
950
+ `)}
951
+ `);
952
+ }, info: (e, r) => {
953
+ R2.message(e, { ...r, symbol: t("blue", fe) });
954
+ }, success: (e, r) => {
955
+ R2.message(e, { ...r, symbol: t("green", Fe) });
956
+ }, step: (e, r) => {
957
+ R2.message(e, { ...r, symbol: t("green", V) });
958
+ }, warn: (e, r) => {
959
+ R2.message(e, { ...r, symbol: t("yellow", ye) });
960
+ }, warning: (e, r) => {
961
+ R2.warn(e, r);
962
+ }, error: (e, r) => {
963
+ R2.message(e, { ...r, symbol: t("red", Ee) });
964
+ } };
965
+ var Nt = (e = "", r) => {
966
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", x2)} ` : "";
967
+ s.write(`${i}${t("red", e)}
968
+
969
+ `);
970
+ };
971
+ var Wt2 = (e = "", r) => {
972
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", he)} ` : "";
973
+ s.write(`${i}${e}
974
+ `);
975
+ };
976
+ var Gt = (e = "", r) => {
977
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", h)}
978
+ ${t("gray", x2)} ` : "";
979
+ s.write(`${i}${e}
980
+
981
+ `);
982
+ };
983
+ var jt = (e) => t("dim", e);
984
+ var kt2 = (e, r, s) => {
985
+ const i = { hard: true, trim: false }, a = J2(e, r, i).split(`
986
+ `), o = a.reduce((n, c) => Math.max(D2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(D2(c), n), 0), l = r - (u - o);
987
+ return J2(e, l, i);
988
+ };
989
+ var Vt2 = (e = "", r = "", s) => {
990
+ const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? jt, u = ["", ...kt2(e, rt(i) - 6, o).split(`
991
+ `).map(o), ""], l = D2(r), n = Math.max(u.reduce((g, E) => {
992
+ const $ = D2(E);
993
+ return $ > g ? $ : g;
994
+ }, 0), l) + 2, c = u.map((g) => `${t("gray", h)} ${g}${" ".repeat(n - D2(g))}${t("gray", h)}`).join(`
995
+ `), p = a ? `${t("gray", h)}
996
+ ` : "", f = a ? We : ge;
997
+ i.write(`${p}${t("green", V)} ${t("reset", r)} ${t("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
998
+ ${c}
999
+ ${t("gray", f + se.repeat(n + 2) + me)}
1000
+ `);
1001
+ };
1002
+ var Kt = (e) => t("magenta", e);
1003
+ var be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = ee ? 80 : 120, signal: l, ...n } = {}) => {
1004
+ const c = ce();
1005
+ let p, f, g = false, E = false, $ = "", m, d = performance.now();
1006
+ const F = rt(s), y2 = n?.styleFrame ?? Kt, v = (B2) => {
1007
+ const P2 = B2 > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
1008
+ E = B2 === 1, g && (k2(P2, B2), E && typeof r == "function" && r());
1009
+ }, C = () => v(2), A = () => v(1), b = () => {
1010
+ process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
1011
+ }, w = () => {
1012
+ process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", A), process.removeListener("SIGTERM", A), process.removeListener("exit", v), l && l.removeEventListener("abort", A);
1013
+ }, S2 = () => {
1014
+ if (m === undefined)
1015
+ return;
1016
+ c && s.write(`
1017
+ `);
1018
+ const B2 = J2(m, F, { hard: true, trim: false }).split(`
1019
+ `);
1020
+ B2.length > 1 && s.write(import_sisteransi2.cursor.up(B2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1021
+ }, T2 = (B2) => B2.replace(/\.+$/, ""), M2 = (B2) => {
1022
+ const P2 = (performance.now() - B2) / 1000, G2 = Math.floor(P2 / 60), L2 = Math.floor(P2 % 60);
1023
+ return G2 > 0 ? `[${G2}m ${L2}s]` : `[${L2}s]`;
1024
+ }, O2 = n.withGuide ?? _.withGuide, le = (B2 = "") => {
1025
+ g = true, p = xt({ output: s }), $ = T2(B2), d = performance.now(), O2 && s.write(`${t("gray", h)}
1026
+ `);
1027
+ let P2 = 0, G2 = 0;
1028
+ b(), f = setInterval(() => {
1029
+ if (c && $ === m)
1030
+ return;
1031
+ S2(), m = $;
1032
+ const L2 = y2(o[P2]);
1033
+ let Z2;
1034
+ if (c)
1035
+ Z2 = `${L2} ${$}...`;
1036
+ else if (e === "timer")
1037
+ Z2 = `${L2} ${$} ${M2(d)}`;
1038
+ else {
1039
+ const et2 = ".".repeat(Math.floor(G2)).slice(0, 3);
1040
+ Z2 = `${L2} ${$}${et2}`;
1041
+ }
1042
+ const Ze = J2(Z2, F, { hard: true, trim: false });
1043
+ s.write(Ze), P2 = P2 + 1 < o.length ? P2 + 1 : 0, G2 = G2 < 4 ? G2 + 0.125 : 0;
1044
+ }, u);
1045
+ }, k2 = (B2 = "", P2 = 0, G2 = false) => {
1046
+ if (!g)
1047
+ return;
1048
+ g = false, clearInterval(f), S2();
1049
+ const L2 = P2 === 0 ? t("green", V) : P2 === 1 ? t("red", $e) : t("red", de);
1050
+ $ = B2 ?? $, G2 || (e === "timer" ? s.write(`${L2} ${$} ${M2(d)}
1051
+ `) : s.write(`${L2} ${$}
1052
+ `)), w(), p();
1053
+ };
1054
+ return { start: le, stop: (B2 = "") => k2(B2, 0), message: (B2 = "") => {
1055
+ $ = T2(B2 ?? $);
1056
+ }, cancel: (B2 = "") => k2(B2, 1), error: (B2 = "") => k2(B2, 2), clear: () => k2("", 0, true), get isCancelled() {
1057
+ return E;
1058
+ } };
1059
+ };
1060
+ var ze = { light: I2("─", "-"), heavy: I2("━", "="), block: I2("█", "#") };
1061
+ var oe = (e, r) => e.includes(`
1062
+ `) ? e.split(`
1063
+ `).map((s) => r(s)).join(`
1064
+ `) : r(e);
1065
+ var Jt = (e) => {
1066
+ const r = (s, i) => {
1067
+ const a = s.label ?? String(s.value);
1068
+ switch (i) {
1069
+ case "disabled":
1070
+ return `${t("gray", H2)} ${oe(a, (o) => t("gray", o))}${s.hint ? ` ${t("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1071
+ case "selected":
1072
+ return `${oe(a, (o) => t("dim", o))}`;
1073
+ case "active":
1074
+ return `${t("green", z2)} ${a}${s.hint ? ` ${t("dim", `(${s.hint})`)}` : ""}`;
1075
+ case "cancelled":
1076
+ return `${oe(a, (o) => t(["strikethrough", "dim"], o))}`;
1077
+ default:
1078
+ return `${t("dim", H2)} ${oe(a, (o) => t("dim", o))}`;
1079
+ }
1080
+ };
1081
+ return new Tt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
1082
+ const s = e.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${ve(this.state)} `, o = Bt(e.output, e.message, a, i), u = `${s ? `${t("gray", h)}
1083
+ ` : ""}${o}
1084
+ `;
1085
+ switch (this.state) {
1086
+ case "submit": {
1087
+ const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "selected"), l);
1088
+ return `${u}${n}`;
1089
+ }
1090
+ case "cancel": {
1091
+ const l = s ? `${t("gray", h)} ` : "", n = Bt(e.output, r(this.options[this.cursor], "cancelled"), l);
1092
+ return `${u}${n}${s ? `
1093
+ ${t("gray", h)}` : ""}`;
1094
+ }
1095
+ default: {
1096
+ const l = s ? `${t("cyan", h)} ` : "", n = s ? t("cyan", x2) : "", c = u.split(`
1097
+ `).length, p = s ? 2 : 1;
1098
+ return `${u}${l}${X2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: (f, g) => r(f, f.disabled ? "disabled" : g ? "active" : "inactive") }).join(`
1099
+ ${l}`)}
1100
+ ${n}
1101
+ `;
1102
+ }
1103
+ }
1104
+ } }).prompt();
1105
+ };
1106
+ var Qe = `${t("gray", h)} `;
1107
+ var Zt = (e) => new $t({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
1108
+ const r = e?.withGuide ?? _.withGuide, s = `${`${r ? `${t("gray", h)}
1109
+ ` : ""}${W2(this.state)} `}${e.message}
1110
+ `, i = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
1111
+ switch (this.state) {
1112
+ case "error": {
1113
+ const u = this.error ? ` ${t("yellow", this.error)}` : "", l = r ? `${t("yellow", h)} ` : "", n = r ? t("yellow", x2) : "";
1114
+ return `${s.trim()}
1115
+ ${l}${a}
1116
+ ${n}${u}
1117
+ `;
1118
+ }
1119
+ case "submit": {
1120
+ const u = o ? ` ${t("dim", o)}` : "", l = r ? t("gray", h) : "";
1121
+ return `${s}${l}${u}`;
1122
+ }
1123
+ case "cancel": {
1124
+ const u = o ? ` ${t(["strikethrough", "dim"], o)}` : "", l = r ? t("gray", h) : "";
1125
+ return `${s}${l}${u}${o.trim() ? `
1126
+ ${l}` : ""}`;
1127
+ }
1128
+ default: {
1129
+ const u = r ? `${t("cyan", h)} ` : "", l = r ? t("cyan", x2) : "";
1130
+ return `${s}${u}${a}
1131
+ ${l}
1132
+ `;
1133
+ }
1134
+ }
1135
+ } }).prompt();
1136
+
1137
+ export { Ct, Rt, R2 as R, Nt, Wt2 as Wt, Gt, Vt2 as Vt, be, Jt, Zt };