@funkai/cli 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -11,6 +11,7 @@ import ot from "node:readline";
11
11
  import { ReadStream } from "node:tty";
12
12
  import fs, { existsSync, lstatSync, mkdirSync, promises, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
13
13
  import path, { basename, dirname, extname, isAbsolute, join, resolve } from "node:path";
14
+ import { attempt, attemptAsync } from "es-toolkit";
14
15
  import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
15
16
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
16
17
  import { homedir } from "node:os";
@@ -483,10 +484,10 @@ function Dt$2(t, e) {
483
484
  function St$2(t, e) {
484
485
  if (e) return t ? e : e[0];
485
486
  }
486
- var import_src$1, at$2, lt$1, ht$1, O$2, y$2, L$1, P$4, M$2, ct$1, ft$2, X$2, pt$2, S$2, T$2, Z$1, Ft$2, j$2, Q$2, dt$1, tt$1, U$2, et$1, mt$2, st$1, it$1, gt$2, G$1, vt$2, Et$2, _$2, bt$2, z$3, rt$1, nt$1, B$1, Vt$2, kt$2, yt$2, Lt$2, Mt$2, Tt$2, Wt$2, $t$1;
487
- var init_dist$10 = __esmMin((() => {
487
+ var import_src$1, at$1, lt$1, ht$1, O$2, y$2, L$1, P$4, M$2, ct$1, ft$2, X$2, pt$2, S$2, T$2, Z$1, Ft$2, j$2, Q$2, dt$1, tt$1, U$2, et$1, mt$2, st$1, it$1, gt$2, G$1, vt$2, Et$2, _$2, bt$2, z$3, rt$1, nt$1, B$1, Vt$2, kt$2, yt$2, Lt$2, Mt$2, Tt$2, Wt$2, $t$1;
488
+ var init_dist$9 = __esmMin((() => {
488
489
  import_src$1 = require_src();
489
- at$2 = (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$1 = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht$1 = (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$2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y$2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L$1 = /\t{1,1000}/y, P$4 = /[\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$2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct$1 = /\p{M}+/gu, ft$2 = {
490
+ at$1 = (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$1 = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht$1 = (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$2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y$2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L$1 = /\t{1,1000}/y, P$4 = /[\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$2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct$1 = /\p{M}+/gu, ft$2 = {
490
491
  limit: Infinity,
491
492
  ellipsis: ""
492
493
  }, X$2 = (t, e = {}, s = {}) => {
@@ -498,7 +499,7 @@ var init_dist$10 = __esmMin((() => {
498
499
  v = 0;
499
500
  for (const Y of ut.replaceAll(ct$1, "")) {
500
501
  const $ = Y.codePointAt(0) || 0;
501
- if (lt$1($) ? f = m : ht$1($) ? f = V : E !== A && at$2($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
502
+ if (lt$1($) ? f = m : ht$1($) ? f = V : E !== A && at$1($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
502
503
  F = !0;
503
504
  break t;
504
505
  }
@@ -1091,8 +1092,8 @@ function Ye$1(e, r, s, i) {
1091
1092
  return i === "center" ? a = Math.floor((r - e) / 2) : i === "right" && (a = r - e - s), o = r - a - e, [a, o];
1092
1093
  }
1093
1094
  var import_src, ee$1, ce$1, Me$1, I$1, Re$1, $e$1, de$1, V$1, he$1, h$3, x$2, Oe$1, Pe$1, z$2, H$1, te$1, U$1, q$1, Ne$1, se$1, pe$1, We$1, me$1, ge$1, Ge$1, fe$1, Fe$1, ye$1, Ee$1, W$1, ve$1, mt$1, gt$1, ft$1, we$1, re$1, ie$1, Ae$1, ne$1, Ft$1, yt$1, Le$1, Et$1, D$2, ae$1, je$1, vt$1, Ce$1, ke$1, wt$1, Ve$1, Se$1, He$1, At$1, Ue$1, Ke$1, Ct$1, Ie$1, St$1, It$1, bt$1, X$1, Xe$1, xt$1, _t$1, Dt$1, Tt$1, Mt$1, Rt$1, Ot$1, Pt$1, R$1, Nt$1, Wt$1, Gt$1, Q$1, Lt$1, jt$1, kt$1, Vt$1, Ht$1, Ut$1, Kt$1, be$1, ze$1, oe$1, Jt$1, Xt$1, Qe$1, K$1, Yt$1, zt$1, Qt$1, Zt$1;
1094
- var init_dist$9 = __esmMin((() => {
1095
- init_dist$10();
1095
+ var init_dist$8 = __esmMin((() => {
1096
+ init_dist$9();
1096
1097
  import_src = require_src();
1097
1098
  ee$1 = pt$1(), ce$1 = () => process.env.CI === "true", Me$1 = (e) => e.isTTY === !0, I$1 = (e, r) => ee$1 ? e : r, Re$1 = I$1("◆", "*"), $e$1 = I$1("■", "x"), de$1 = I$1("▲", "x"), V$1 = I$1("◇", "o"), he$1 = I$1("┌", "T"), h$3 = I$1("│", "|"), x$2 = I$1("└", "—"), Oe$1 = I$1("┐", "T"), Pe$1 = I$1("┘", "—"), z$2 = I$1("●", ">"), H$1 = I$1("○", " "), te$1 = I$1("◻", "[•]"), U$1 = I$1("◼", "[+]"), q$1 = I$1("◻", "[ ]"), Ne$1 = I$1("▪", "•"), se$1 = I$1("─", "-"), pe$1 = I$1("╮", "+"), We$1 = I$1("├", "+"), me$1 = I$1("╯", "+"), ge$1 = I$1("╰", "+"), Ge$1 = I$1("╭", "+"), fe$1 = I$1("●", "•"), Fe$1 = I$1("◆", "*"), ye$1 = I$1("▲", "!"), Ee$1 = I$1("■", "x"), W$1 = (e) => {
1098
1099
  switch (e) {
@@ -2136,2924 +2137,151 @@ ${n}${u}
2136
2137
  case "submit": {
2137
2138
  const u = o ? ` ${styleText("dim", o)}` : "";
2138
2139
  return `${s}${r ? styleText("gray", h$3) : ""}${u}`;
2139
- }
2140
- case "cancel": {
2141
- const u = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", l = r ? styleText("gray", h$3) : "";
2142
- return `${s}${l}${u}${o.trim() ? `
2143
- ${l}` : ""}`;
2144
- }
2145
- default: return `${s}${r ? `${styleText("cyan", h$3)} ` : ""}${a}
2146
- ${r ? styleText("cyan", x$2) : ""}
2147
- `;
2148
- }
2149
- }
2150
- }).prompt();
2151
- }));
2152
-
2153
- //#endregion
2154
- //#region ../../node_modules/.pnpm/@kidd-cli+core@0.10.0_chokidar@5.0.0_jiti@2.6.1_magicast@0.5.2_vitest@4.1.0_@opentelemetry+ap_h5jt7i6rdfwaknd5di57zdj5zy/node_modules/@kidd-cli/core/dist/lib/logger.js
2155
- /**
2156
- * Create a new {@link CliLogger} instance.
2157
- *
2158
- * @param options - Logger configuration.
2159
- * @returns A CliLogger wired to the given output stream.
2160
- */
2161
- function createCliLogger(options = {}) {
2162
- const output = options.output ?? process.stderr;
2163
- return {
2164
- check(input) {
2165
- output.write(`${formatCheck(input)}\n`);
2166
- },
2167
- error(message) {
2168
- R$1.error(message);
2169
- },
2170
- finding(input) {
2171
- output.write(`${formatFinding(input)}\n\n`);
2172
- },
2173
- info(message) {
2174
- R$1.info(message);
2175
- },
2176
- intro(title) {
2177
- Wt$1(title);
2178
- },
2179
- message(message, opts) {
2180
- R$1.message(message, opts);
2181
- },
2182
- newline() {
2183
- output.write("\n");
2184
- },
2185
- note(message, title) {
2186
- Vt$1(message, title);
2187
- },
2188
- outro(message) {
2189
- Gt$1(message);
2190
- },
2191
- print(text) {
2192
- output.write(`${text}\n`);
2193
- },
2194
- step(message) {
2195
- R$1.step(message);
2196
- },
2197
- success(message) {
2198
- R$1.success(message);
2199
- },
2200
- tally(input) {
2201
- output.write(`\n${formatTally(input)}\n`);
2202
- },
2203
- warn(message) {
2204
- R$1.warn(message);
2205
- }
2206
- };
2207
- }
2208
- var cliLogger;
2209
- var init_logger = __esmMin((() => {
2210
- init_tally_KfEitTrZ();
2211
- init_dist$9();
2212
- cliLogger = createCliLogger();
2213
- }));
2214
-
2215
- //#endregion
2216
- //#region ../../node_modules/.pnpm/@kidd-cli+utils@0.1.5/node_modules/@kidd-cli/utils/dist/tag.js
2217
- /**
2218
- * Create a shallow copy of `obj` with a non-enumerable {@link TAG} property.
2219
- *
2220
- * The original object is not mutated. The tag is defined as non-enumerable,
2221
- * non-writable, and non-configurable via `Object.defineProperty`.
2222
- *
2223
- * @param obj - The source object to copy and tag.
2224
- * @param tag - The tag string to brand the copy with.
2225
- * @returns A new object with all own enumerable properties of `obj` plus the hidden tag.
2226
- */
2227
- function withTag(obj, tag) {
2228
- const copy = { ...obj };
2229
- Object.defineProperty(copy, TAG, {
2230
- configurable: false,
2231
- enumerable: false,
2232
- value: tag,
2233
- writable: false
2234
- });
2235
- return copy;
2236
- }
2237
- /**
2238
- * Type guard that checks whether `value` carries the given tag.
2239
- *
2240
- * @param value - The value to inspect.
2241
- * @param tag - The expected tag string.
2242
- * @returns `true` when `value` is a non-null object whose `[TAG]` equals `tag`.
2243
- */
2244
- function hasTag(value, tag) {
2245
- if (typeof value !== "object" || value === null) return false;
2246
- return value[TAG] === tag;
2247
- }
2248
- var TAG;
2249
- var init_tag = __esmMin((() => {
2250
- TAG = Symbol("kidd.tag");
2251
- }));
2252
-
2253
- //#endregion
2254
- //#region ../../node_modules/.pnpm/@kidd-cli+utils@0.1.5/node_modules/@kidd-cli/utils/dist/result-U5VP3FRv.js
2255
- /**
2256
- * Normalize an unknown caught value into an Error instance.
2257
- *
2258
- * If already an Error, returns it as-is. Otherwise wraps via `new Error(String(value))`.
2259
- *
2260
- * @param value - The unknown value to normalize.
2261
- * @returns An Error instance.
2262
- */
2263
- function toError(value) {
2264
- if (value instanceof Error) return value;
2265
- return new Error(String(value));
2266
- }
2267
- function ok(value) {
2268
- return [null, value];
2269
- }
2270
- /**
2271
- * Construct a failure Result tuple.
2272
- *
2273
- * Coerces any value to an `Error` via {@link toError} and returns `[Error, null]`.
2274
- * For domain-specific error types (e.g. `AuthError`, `IconsError`), use raw
2275
- * tuple literals instead: `[domainError, null] as const`.
2276
- *
2277
- * @param error - The error value (coerced to Error).
2278
- * @returns A Result tuple `[Error, null]`.
2279
- */
2280
- function err(error) {
2281
- return [toError(error), null];
2282
- }
2283
- var init_result_U5VP3FRv = __esmMin((() => {}));
2284
-
2285
- //#endregion
2286
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/at.mjs
2287
- function at$1(arr, indices) {
2288
- const result = new Array(indices.length);
2289
- const length = arr.length;
2290
- for (let i = 0; i < indices.length; i++) {
2291
- let index = indices[i];
2292
- index = Number.isInteger(index) ? index : Math.trunc(index) || 0;
2293
- if (index < 0) index += length;
2294
- result[i] = arr[index];
2295
- }
2296
- return result;
2297
- }
2298
- var init_at = __esmMin((() => {}));
2299
-
2300
- //#endregion
2301
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/chunk.mjs
2302
- function chunk(arr, size) {
2303
- if (!Number.isInteger(size) || size <= 0) throw new Error("Size must be an integer greater than zero.");
2304
- const chunkLength = Math.ceil(arr.length / size);
2305
- const result = Array(chunkLength);
2306
- for (let index = 0; index < chunkLength; index++) {
2307
- const start = index * size;
2308
- const end = start + size;
2309
- result[index] = arr.slice(start, end);
2310
- }
2311
- return result;
2312
- }
2313
- var init_chunk = __esmMin((() => {}));
2314
-
2315
- //#endregion
2316
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/compact.mjs
2317
- function compact(arr) {
2318
- const result = [];
2319
- for (let i = 0; i < arr.length; i++) {
2320
- const item = arr[i];
2321
- if (item) result.push(item);
2322
- }
2323
- return result;
2324
- }
2325
- var init_compact = __esmMin((() => {}));
2326
-
2327
- //#endregion
2328
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/countBy.mjs
2329
- function countBy(arr, mapper) {
2330
- const result = {};
2331
- for (let i = 0; i < arr.length; i++) {
2332
- const item = arr[i];
2333
- const key = mapper(item, i, arr);
2334
- result[key] = (result[key] ?? 0) + 1;
2335
- }
2336
- return result;
2337
- }
2338
- var init_countBy = __esmMin((() => {}));
2339
-
2340
- //#endregion
2341
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/difference.mjs
2342
- function difference(firstArr, secondArr) {
2343
- const secondSet = new Set(secondArr);
2344
- return firstArr.filter((item) => !secondSet.has(item));
2345
- }
2346
- var init_difference = __esmMin((() => {}));
2347
-
2348
- //#endregion
2349
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/differenceBy.mjs
2350
- function differenceBy(firstArr, secondArr, mapper) {
2351
- const mappedSecondSet = new Set(secondArr.map((item) => mapper(item)));
2352
- return firstArr.filter((item) => {
2353
- return !mappedSecondSet.has(mapper(item));
2354
- });
2355
- }
2356
- var init_differenceBy = __esmMin((() => {}));
2357
-
2358
- //#endregion
2359
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/differenceWith.mjs
2360
- function differenceWith(firstArr, secondArr, areItemsEqual) {
2361
- return firstArr.filter((firstItem) => {
2362
- return secondArr.every((secondItem) => {
2363
- return !areItemsEqual(firstItem, secondItem);
2364
- });
2365
- });
2366
- }
2367
- var init_differenceWith = __esmMin((() => {}));
2368
-
2369
- //#endregion
2370
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/drop.mjs
2371
- function drop(arr, itemsCount) {
2372
- itemsCount = Math.max(itemsCount, 0);
2373
- return arr.slice(itemsCount);
2374
- }
2375
- var init_drop = __esmMin((() => {}));
2376
-
2377
- //#endregion
2378
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/dropRight.mjs
2379
- function dropRight(arr, itemsCount) {
2380
- itemsCount = Math.min(-itemsCount, 0);
2381
- if (itemsCount === 0) return arr.slice();
2382
- return arr.slice(0, itemsCount);
2383
- }
2384
- var init_dropRight = __esmMin((() => {}));
2385
-
2386
- //#endregion
2387
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/dropRightWhile.mjs
2388
- function dropRightWhile(arr, canContinueDropping) {
2389
- for (let i = arr.length - 1; i >= 0; i--) if (!canContinueDropping(arr[i], i, arr)) return arr.slice(0, i + 1);
2390
- return [];
2391
- }
2392
- var init_dropRightWhile = __esmMin((() => {}));
2393
-
2394
- //#endregion
2395
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/dropWhile.mjs
2396
- function dropWhile(arr, canContinueDropping) {
2397
- const dropEndIndex = arr.findIndex((item, index, arr) => !canContinueDropping(item, index, arr));
2398
- if (dropEndIndex === -1) return [];
2399
- return arr.slice(dropEndIndex);
2400
- }
2401
- var init_dropWhile = __esmMin((() => {}));
2402
-
2403
- //#endregion
2404
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/fill.mjs
2405
- function fill(array, value, start = 0, end = array.length) {
2406
- const length = array.length;
2407
- const finalStart = Math.max(start >= 0 ? start : length + start, 0);
2408
- const finalEnd = Math.min(end >= 0 ? end : length + end, length);
2409
- for (let i = finalStart; i < finalEnd; i++) array[i] = value;
2410
- return array;
2411
- }
2412
- var init_fill = __esmMin((() => {}));
2413
-
2414
- //#endregion
2415
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/promise/semaphore.mjs
2416
- var Semaphore;
2417
- var init_semaphore = __esmMin((() => {
2418
- Semaphore = class {
2419
- capacity;
2420
- available;
2421
- deferredTasks = [];
2422
- constructor(capacity) {
2423
- this.capacity = capacity;
2424
- this.available = capacity;
2425
- }
2426
- async acquire() {
2427
- if (this.available > 0) {
2428
- this.available--;
2429
- return;
2430
- }
2431
- return new Promise((resolve) => {
2432
- this.deferredTasks.push(resolve);
2433
- });
2434
- }
2435
- release() {
2436
- const deferredTask = this.deferredTasks.shift();
2437
- if (deferredTask != null) {
2438
- deferredTask();
2439
- return;
2440
- }
2441
- if (this.available < this.capacity) this.available++;
2442
- }
2443
- };
2444
- }));
2445
-
2446
- //#endregion
2447
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/limitAsync.mjs
2448
- function limitAsync(callback, concurrency) {
2449
- const semaphore = new Semaphore(concurrency);
2450
- return async function(...args) {
2451
- try {
2452
- await semaphore.acquire();
2453
- return await callback.apply(this, args);
2454
- } finally {
2455
- semaphore.release();
2456
- }
2457
- };
2458
- }
2459
- var init_limitAsync = __esmMin((() => {
2460
- init_semaphore();
2461
- }));
2462
-
2463
- //#endregion
2464
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/filterAsync.mjs
2465
- async function filterAsync(array, predicate, options) {
2466
- if (options?.concurrency != null) predicate = limitAsync(predicate, options.concurrency);
2467
- const results = await Promise.all(array.map(predicate));
2468
- return array.filter((_, index) => results[index]);
2469
- }
2470
- var init_filterAsync = __esmMin((() => {
2471
- init_limitAsync();
2472
- }));
2473
-
2474
- //#endregion
2475
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/flatten.mjs
2476
- function flatten$1(arr, depth = 1) {
2477
- const result = [];
2478
- const flooredDepth = Math.floor(depth);
2479
- const recursive = (arr, currentDepth) => {
2480
- for (let i = 0; i < arr.length; i++) {
2481
- const item = arr[i];
2482
- if (Array.isArray(item) && currentDepth < flooredDepth) recursive(item, currentDepth + 1);
2483
- else result.push(item);
2484
- }
2485
- };
2486
- recursive(arr, 0);
2487
- return result;
2488
- }
2489
- var init_flatten$1 = __esmMin((() => {}));
2490
-
2491
- //#endregion
2492
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/flatMap.mjs
2493
- function flatMap(arr, iteratee, depth = 1) {
2494
- return flatten$1(arr.map((item, index) => iteratee(item, index, arr)), depth);
2495
- }
2496
- var init_flatMap = __esmMin((() => {
2497
- init_flatten$1();
2498
- }));
2499
-
2500
- //#endregion
2501
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/flatMapAsync.mjs
2502
- async function flatMapAsync(array, callback, options) {
2503
- if (options?.concurrency != null) callback = limitAsync(callback, options.concurrency);
2504
- return flatten$1(await Promise.all(array.map(callback)));
2505
- }
2506
- var init_flatMapAsync = __esmMin((() => {
2507
- init_flatten$1();
2508
- init_limitAsync();
2509
- }));
2510
-
2511
- //#endregion
2512
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/flattenDeep.mjs
2513
- function flattenDeep(arr) {
2514
- return flatten$1(arr, Infinity);
2515
- }
2516
- var init_flattenDeep = __esmMin((() => {
2517
- init_flatten$1();
2518
- }));
2519
-
2520
- //#endregion
2521
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/flatMapDeep.mjs
2522
- function flatMapDeep(arr, iteratee) {
2523
- return flattenDeep(arr.map((item, index) => iteratee(item, index, arr)));
2524
- }
2525
- var init_flatMapDeep = __esmMin((() => {
2526
- init_flattenDeep();
2527
- }));
2528
-
2529
- //#endregion
2530
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/forEachAsync.mjs
2531
- async function forEachAsync(array, callback, options) {
2532
- if (options?.concurrency != null) callback = limitAsync(callback, options.concurrency);
2533
- await Promise.all(array.map(callback));
2534
- }
2535
- var init_forEachAsync = __esmMin((() => {
2536
- init_limitAsync();
2537
- }));
2538
-
2539
- //#endregion
2540
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/forEachRight.mjs
2541
- function forEachRight(arr, callback) {
2542
- for (let i = arr.length - 1; i >= 0; i--) {
2543
- const element = arr[i];
2544
- callback(element, i, arr);
2545
- }
2546
- }
2547
- var init_forEachRight = __esmMin((() => {}));
2548
-
2549
- //#endregion
2550
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/groupBy.mjs
2551
- function groupBy(arr, getKeyFromItem) {
2552
- const result = {};
2553
- for (let i = 0; i < arr.length; i++) {
2554
- const item = arr[i];
2555
- const key = getKeyFromItem(item, i, arr);
2556
- if (!Object.hasOwn(result, key)) result[key] = [];
2557
- result[key].push(item);
2558
- }
2559
- return result;
2560
- }
2561
- var init_groupBy = __esmMin((() => {}));
2562
-
2563
- //#endregion
2564
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/head.mjs
2565
- function head(arr) {
2566
- return arr[0];
2567
- }
2568
- var init_head = __esmMin((() => {}));
2569
-
2570
- //#endregion
2571
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/initial.mjs
2572
- function initial(arr) {
2573
- return arr.slice(0, -1);
2574
- }
2575
- var init_initial = __esmMin((() => {}));
2576
-
2577
- //#endregion
2578
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/intersection.mjs
2579
- function intersection(firstArr, secondArr) {
2580
- const secondSet = new Set(secondArr);
2581
- return firstArr.filter((item) => secondSet.has(item));
2582
- }
2583
- var init_intersection = __esmMin((() => {}));
2584
-
2585
- //#endregion
2586
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/intersectionBy.mjs
2587
- function intersectionBy(firstArr, secondArr, mapper) {
2588
- const result = [];
2589
- const mappedSecondSet = new Set(secondArr.map(mapper));
2590
- for (let i = 0; i < firstArr.length; i++) {
2591
- const item = firstArr[i];
2592
- const mappedItem = mapper(item);
2593
- if (mappedSecondSet.has(mappedItem)) {
2594
- result.push(item);
2595
- mappedSecondSet.delete(mappedItem);
2596
- }
2597
- }
2598
- return result;
2599
- }
2600
- var init_intersectionBy = __esmMin((() => {}));
2601
-
2602
- //#endregion
2603
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/intersectionWith.mjs
2604
- function intersectionWith(firstArr, secondArr, areItemsEqual) {
2605
- return firstArr.filter((firstItem) => {
2606
- return secondArr.some((secondItem) => {
2607
- return areItemsEqual(firstItem, secondItem);
2608
- });
2609
- });
2610
- }
2611
- var init_intersectionWith = __esmMin((() => {}));
2612
-
2613
- //#endregion
2614
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/isSubset.mjs
2615
- function isSubset(superset, subset) {
2616
- return difference(subset, superset).length === 0;
2617
- }
2618
- var init_isSubset = __esmMin((() => {
2619
- init_difference();
2620
- }));
2621
-
2622
- //#endregion
2623
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/isSubsetWith.mjs
2624
- function isSubsetWith(superset, subset, areItemsEqual) {
2625
- return differenceWith(subset, superset, areItemsEqual).length === 0;
2626
- }
2627
- var init_isSubsetWith = __esmMin((() => {
2628
- init_differenceWith();
2629
- }));
2630
-
2631
- //#endregion
2632
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/keyBy.mjs
2633
- function keyBy(arr, getKeyFromItem) {
2634
- const result = {};
2635
- for (let i = 0; i < arr.length; i++) {
2636
- const item = arr[i];
2637
- const key = getKeyFromItem(item, i, arr);
2638
- result[key] = item;
2639
- }
2640
- return result;
2641
- }
2642
- var init_keyBy = __esmMin((() => {}));
2643
-
2644
- //#endregion
2645
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/last.mjs
2646
- function last(arr) {
2647
- return arr[arr.length - 1];
2648
- }
2649
- var init_last = __esmMin((() => {}));
2650
-
2651
- //#endregion
2652
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/mapAsync.mjs
2653
- function mapAsync(array, callback, options) {
2654
- if (options?.concurrency != null) callback = limitAsync(callback, options.concurrency);
2655
- return Promise.all(array.map(callback));
2656
- }
2657
- var init_mapAsync = __esmMin((() => {
2658
- init_limitAsync();
2659
- }));
2660
-
2661
- //#endregion
2662
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/maxBy.mjs
2663
- function maxBy(items, getValue) {
2664
- if (items.length === 0) return;
2665
- let maxElement = items[0];
2666
- let max = getValue(maxElement, 0, items);
2667
- for (let i = 1; i < items.length; i++) {
2668
- const element = items[i];
2669
- const value = getValue(element, i, items);
2670
- if (value > max) {
2671
- max = value;
2672
- maxElement = element;
2673
- }
2674
- }
2675
- return maxElement;
2676
- }
2677
- var init_maxBy = __esmMin((() => {}));
2678
-
2679
- //#endregion
2680
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/minBy.mjs
2681
- function minBy(items, getValue) {
2682
- if (items.length === 0) return;
2683
- let minElement = items[0];
2684
- let min = getValue(minElement, 0, items);
2685
- for (let i = 1; i < items.length; i++) {
2686
- const element = items[i];
2687
- const value = getValue(element, i, items);
2688
- if (value < min) {
2689
- min = value;
2690
- minElement = element;
2691
- }
2692
- }
2693
- return minElement;
2694
- }
2695
- var init_minBy = __esmMin((() => {}));
2696
-
2697
- //#endregion
2698
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/_internal/compareValues.mjs
2699
- function compareValues(a, b, order) {
2700
- if (a < b) return order === "asc" ? -1 : 1;
2701
- if (a > b) return order === "asc" ? 1 : -1;
2702
- return 0;
2703
- }
2704
- var init_compareValues = __esmMin((() => {}));
2705
-
2706
- //#endregion
2707
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/orderBy.mjs
2708
- function orderBy(arr, criteria, orders) {
2709
- return arr.slice().sort((a, b) => {
2710
- const ordersLength = orders.length;
2711
- for (let i = 0; i < criteria.length; i++) {
2712
- const order = ordersLength > i ? orders[i] : orders[ordersLength - 1];
2713
- const criterion = criteria[i];
2714
- const criterionIsFunction = typeof criterion === "function";
2715
- const result = compareValues(criterionIsFunction ? criterion(a) : a[criterion], criterionIsFunction ? criterion(b) : b[criterion], order);
2716
- if (result !== 0) return result;
2717
- }
2718
- return 0;
2719
- });
2720
- }
2721
- var init_orderBy = __esmMin((() => {
2722
- init_compareValues();
2723
- }));
2724
-
2725
- //#endregion
2726
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/partition.mjs
2727
- function partition(arr, isInTruthy) {
2728
- const truthy = [];
2729
- const falsy = [];
2730
- for (let i = 0; i < arr.length; i++) {
2731
- const item = arr[i];
2732
- if (isInTruthy(item, i, arr)) truthy.push(item);
2733
- else falsy.push(item);
2734
- }
2735
- return [truthy, falsy];
2736
- }
2737
- var init_partition = __esmMin((() => {}));
2738
-
2739
- //#endregion
2740
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/pull.mjs
2741
- function pull(arr, valuesToRemove) {
2742
- const valuesSet = new Set(valuesToRemove);
2743
- let resultIndex = 0;
2744
- for (let i = 0; i < arr.length; i++) {
2745
- if (valuesSet.has(arr[i])) continue;
2746
- if (!Object.hasOwn(arr, i)) {
2747
- delete arr[resultIndex++];
2748
- continue;
2749
- }
2750
- arr[resultIndex++] = arr[i];
2751
- }
2752
- arr.length = resultIndex;
2753
- return arr;
2754
- }
2755
- var init_pull = __esmMin((() => {}));
2756
-
2757
- //#endregion
2758
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/pullAt.mjs
2759
- function pullAt(arr, indicesToRemove) {
2760
- const removed = at$1(arr, indicesToRemove);
2761
- const indices = new Set(indicesToRemove.slice().sort((x, y) => y - x));
2762
- for (const index of indices) arr.splice(index, 1);
2763
- return removed;
2764
- }
2765
- var init_pullAt = __esmMin((() => {
2766
- init_at();
2767
- }));
2768
-
2769
- //#endregion
2770
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/reduceAsync.mjs
2771
- async function reduceAsync(array, reducer, initialValue) {
2772
- let startIndex = 0;
2773
- if (initialValue == null) {
2774
- initialValue = array[0];
2775
- startIndex = 1;
2776
- }
2777
- let accumulator = initialValue;
2778
- for (let i = startIndex; i < array.length; i++) accumulator = await reducer(accumulator, array[i], i, array);
2779
- return accumulator;
2780
- }
2781
- var init_reduceAsync = __esmMin((() => {}));
2782
-
2783
- //#endregion
2784
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/remove.mjs
2785
- function remove(arr, shouldRemoveElement) {
2786
- const originalArr = arr.slice();
2787
- const removed = [];
2788
- let resultIndex = 0;
2789
- for (let i = 0; i < arr.length; i++) {
2790
- if (shouldRemoveElement(arr[i], i, originalArr)) {
2791
- removed.push(arr[i]);
2792
- continue;
2793
- }
2794
- if (!Object.hasOwn(arr, i)) {
2795
- delete arr[resultIndex++];
2796
- continue;
2797
- }
2798
- arr[resultIndex++] = arr[i];
2799
- }
2800
- arr.length = resultIndex;
2801
- return removed;
2802
- }
2803
- var init_remove = __esmMin((() => {}));
2804
-
2805
- //#endregion
2806
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/sample.mjs
2807
- function sample(arr) {
2808
- return arr[Math.floor(Math.random() * arr.length)];
2809
- }
2810
- var init_sample = __esmMin((() => {}));
2811
-
2812
- //#endregion
2813
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/random.mjs
2814
- function random(minimum, maximum) {
2815
- if (maximum == null) {
2816
- maximum = minimum;
2817
- minimum = 0;
2818
- }
2819
- if (minimum >= maximum) throw new Error("Invalid input: The maximum value must be greater than the minimum value.");
2820
- return Math.random() * (maximum - minimum) + minimum;
2821
- }
2822
- var init_random = __esmMin((() => {}));
2823
-
2824
- //#endregion
2825
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/randomInt.mjs
2826
- function randomInt(minimum, maximum) {
2827
- return Math.floor(random(minimum, maximum));
2828
- }
2829
- var init_randomInt = __esmMin((() => {
2830
- init_random();
2831
- }));
2832
-
2833
- //#endregion
2834
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/sampleSize.mjs
2835
- function sampleSize(array, size) {
2836
- if (size > array.length) throw new Error("Size must be less than or equal to the length of array.");
2837
- const result = new Array(size);
2838
- const selected = /* @__PURE__ */ new Set();
2839
- for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {
2840
- let index = randomInt(0, step + 1);
2841
- if (selected.has(index)) index = step;
2842
- selected.add(index);
2843
- result[resultIndex] = array[index];
2844
- }
2845
- return result;
2846
- }
2847
- var init_sampleSize = __esmMin((() => {
2848
- init_randomInt();
2849
- }));
2850
-
2851
- //#endregion
2852
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/shuffle.mjs
2853
- function shuffle(arr) {
2854
- const result = arr.slice();
2855
- for (let i = result.length - 1; i >= 1; i--) {
2856
- const j = Math.floor(Math.random() * (i + 1));
2857
- [result[i], result[j]] = [result[j], result[i]];
2858
- }
2859
- return result;
2860
- }
2861
- var init_shuffle = __esmMin((() => {}));
2862
-
2863
- //#endregion
2864
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/sortBy.mjs
2865
- function sortBy(arr, criteria) {
2866
- return orderBy(arr, criteria, ["asc"]);
2867
- }
2868
- var init_sortBy = __esmMin((() => {
2869
- init_orderBy();
2870
- }));
2871
-
2872
- //#endregion
2873
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/tail.mjs
2874
- function tail(arr) {
2875
- return arr.slice(1);
2876
- }
2877
- var init_tail = __esmMin((() => {}));
2878
-
2879
- //#endregion
2880
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs
2881
- function isSymbol$1(value) {
2882
- return typeof value === "symbol" || value instanceof Symbol;
2883
- }
2884
- var init_isSymbol$1 = __esmMin((() => {}));
2885
-
2886
- //#endregion
2887
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/util/toNumber.mjs
2888
- function toNumber(value) {
2889
- if (isSymbol$1(value)) return NaN;
2890
- return Number(value);
2891
- }
2892
- var init_toNumber = __esmMin((() => {
2893
- init_isSymbol$1();
2894
- }));
2895
-
2896
- //#endregion
2897
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/util/toFinite.mjs
2898
- function toFinite(value) {
2899
- if (!value) return value === 0 ? value : 0;
2900
- value = toNumber(value);
2901
- if (value === Infinity || value === -Infinity) return (value < 0 ? -1 : 1) * Number.MAX_VALUE;
2902
- return value === value ? value : 0;
2903
- }
2904
- var init_toFinite = __esmMin((() => {
2905
- init_toNumber();
2906
- }));
2907
-
2908
- //#endregion
2909
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/util/toInteger.mjs
2910
- function toInteger(value) {
2911
- const finite = toFinite(value);
2912
- const remainder = finite % 1;
2913
- return remainder ? finite - remainder : finite;
2914
- }
2915
- var init_toInteger = __esmMin((() => {
2916
- init_toFinite();
2917
- }));
2918
-
2919
- //#endregion
2920
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/take.mjs
2921
- function take(arr, count, guard) {
2922
- count = guard || count === void 0 ? 1 : toInteger(count);
2923
- return arr.slice(0, count);
2924
- }
2925
- var init_take = __esmMin((() => {
2926
- init_toInteger();
2927
- }));
2928
-
2929
- //#endregion
2930
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/takeRight.mjs
2931
- function takeRight(arr, count, guard) {
2932
- count = guard || count === void 0 ? 1 : toInteger(count);
2933
- if (count <= 0 || arr.length === 0) return [];
2934
- return arr.slice(-count);
2935
- }
2936
- var init_takeRight = __esmMin((() => {
2937
- init_toInteger();
2938
- }));
2939
-
2940
- //#endregion
2941
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/takeRightWhile.mjs
2942
- function takeRightWhile(arr, shouldContinueTaking) {
2943
- for (let i = arr.length - 1; i >= 0; i--) if (!shouldContinueTaking(arr[i], i, arr)) return arr.slice(i + 1);
2944
- return arr.slice();
2945
- }
2946
- var init_takeRightWhile = __esmMin((() => {}));
2947
-
2948
- //#endregion
2949
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/takeWhile.mjs
2950
- function takeWhile(arr, shouldContinueTaking) {
2951
- const result = [];
2952
- for (let i = 0; i < arr.length; i++) {
2953
- const item = arr[i];
2954
- if (!shouldContinueTaking(item, i, arr)) break;
2955
- result.push(item);
2956
- }
2957
- return result;
2958
- }
2959
- var init_takeWhile = __esmMin((() => {}));
2960
-
2961
- //#endregion
2962
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/toFilled.mjs
2963
- function toFilled(arr, value, start = 0, end = arr.length) {
2964
- const length = arr.length;
2965
- const finalStart = Math.max(start >= 0 ? start : length + start, 0);
2966
- const finalEnd = Math.min(end >= 0 ? end : length + end, length);
2967
- const newArr = arr.slice();
2968
- for (let i = finalStart; i < finalEnd; i++) newArr[i] = value;
2969
- return newArr;
2970
- }
2971
- var init_toFilled = __esmMin((() => {}));
2972
-
2973
- //#endregion
2974
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/uniq.mjs
2975
- function uniq(arr) {
2976
- return [...new Set(arr)];
2977
- }
2978
- var init_uniq = __esmMin((() => {}));
2979
-
2980
- //#endregion
2981
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/union.mjs
2982
- function union(arr1, arr2) {
2983
- return uniq(arr1.concat(arr2));
2984
- }
2985
- var init_union = __esmMin((() => {
2986
- init_uniq();
2987
- }));
2988
-
2989
- //#endregion
2990
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/uniqBy.mjs
2991
- function uniqBy(arr, mapper) {
2992
- const map = /* @__PURE__ */ new Map();
2993
- for (let i = 0; i < arr.length; i++) {
2994
- const item = arr[i];
2995
- const key = mapper(item, i, arr);
2996
- if (!map.has(key)) map.set(key, item);
2997
- }
2998
- return Array.from(map.values());
2999
- }
3000
- var init_uniqBy = __esmMin((() => {}));
3001
-
3002
- //#endregion
3003
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/unionBy.mjs
3004
- function unionBy(arr1, arr2, mapper) {
3005
- return uniqBy(arr1.concat(arr2), mapper);
3006
- }
3007
- var init_unionBy = __esmMin((() => {
3008
- init_uniqBy();
3009
- }));
3010
-
3011
- //#endregion
3012
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/uniqWith.mjs
3013
- function uniqWith(arr, areItemsEqual) {
3014
- const result = [];
3015
- for (let i = 0; i < arr.length; i++) {
3016
- const item = arr[i];
3017
- if (result.every((v) => !areItemsEqual(v, item))) result.push(item);
3018
- }
3019
- return result;
3020
- }
3021
- var init_uniqWith = __esmMin((() => {}));
3022
-
3023
- //#endregion
3024
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/unionWith.mjs
3025
- function unionWith(arr1, arr2, areItemsEqual) {
3026
- return uniqWith(arr1.concat(arr2), areItemsEqual);
3027
- }
3028
- var init_unionWith = __esmMin((() => {
3029
- init_uniqWith();
3030
- }));
3031
-
3032
- //#endregion
3033
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/unzip.mjs
3034
- function unzip(zipped) {
3035
- let maxLen = 0;
3036
- for (let i = 0; i < zipped.length; i++) if (zipped[i].length > maxLen) maxLen = zipped[i].length;
3037
- const result = new Array(maxLen);
3038
- for (let i = 0; i < maxLen; i++) {
3039
- result[i] = new Array(zipped.length);
3040
- for (let j = 0; j < zipped.length; j++) result[i][j] = zipped[j][i];
3041
- }
3042
- return result;
3043
- }
3044
- var init_unzip = __esmMin((() => {}));
3045
-
3046
- //#endregion
3047
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/unzipWith.mjs
3048
- function unzipWith(target, iteratee) {
3049
- const maxLength = Math.max(...target.map((innerArray) => innerArray.length));
3050
- const result = new Array(maxLength);
3051
- for (let i = 0; i < maxLength; i++) {
3052
- const group = new Array(target.length);
3053
- for (let j = 0; j < target.length; j++) group[j] = target[j][i];
3054
- result[i] = iteratee(...group);
3055
- }
3056
- return result;
3057
- }
3058
- var init_unzipWith = __esmMin((() => {}));
3059
-
3060
- //#endregion
3061
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/windowed.mjs
3062
- function windowed(arr, size, step = 1, { partialWindows = false } = {}) {
3063
- if (size <= 0 || !Number.isInteger(size)) throw new Error("Size must be a positive integer.");
3064
- if (step <= 0 || !Number.isInteger(step)) throw new Error("Step must be a positive integer.");
3065
- const result = [];
3066
- const end = partialWindows ? arr.length : arr.length - size + 1;
3067
- for (let i = 0; i < end; i += step) result.push(arr.slice(i, i + size));
3068
- return result;
3069
- }
3070
- var init_windowed = __esmMin((() => {}));
3071
-
3072
- //#endregion
3073
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/without.mjs
3074
- function without(array, ...values) {
3075
- return difference(array, values);
3076
- }
3077
- var init_without = __esmMin((() => {
3078
- init_difference();
3079
- }));
3080
-
3081
- //#endregion
3082
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/xor.mjs
3083
- function xor(arr1, arr2) {
3084
- return difference(union(arr1, arr2), intersection(arr1, arr2));
3085
- }
3086
- var init_xor = __esmMin((() => {
3087
- init_difference();
3088
- init_intersection();
3089
- init_union();
3090
- }));
3091
-
3092
- //#endregion
3093
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/xorBy.mjs
3094
- function xorBy(arr1, arr2, mapper) {
3095
- return differenceBy(unionBy(arr1, arr2, mapper), intersectionBy(arr1, arr2, mapper), mapper);
3096
- }
3097
- var init_xorBy = __esmMin((() => {
3098
- init_differenceBy();
3099
- init_intersectionBy();
3100
- init_unionBy();
3101
- }));
3102
-
3103
- //#endregion
3104
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/xorWith.mjs
3105
- function xorWith(arr1, arr2, areElementsEqual) {
3106
- return differenceWith(unionWith(arr1, arr2, areElementsEqual), intersectionWith(arr1, arr2, areElementsEqual), areElementsEqual);
3107
- }
3108
- var init_xorWith = __esmMin((() => {
3109
- init_differenceWith();
3110
- init_intersectionWith();
3111
- init_unionWith();
3112
- }));
3113
-
3114
- //#endregion
3115
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/zip.mjs
3116
- function zip(...arrs) {
3117
- let rowCount = 0;
3118
- for (let i = 0; i < arrs.length; i++) if (arrs[i].length > rowCount) rowCount = arrs[i].length;
3119
- const columnCount = arrs.length;
3120
- const result = Array(rowCount);
3121
- for (let i = 0; i < rowCount; ++i) {
3122
- const row = Array(columnCount);
3123
- for (let j = 0; j < columnCount; ++j) row[j] = arrs[j][i];
3124
- result[i] = row;
3125
- }
3126
- return result;
3127
- }
3128
- var init_zip = __esmMin((() => {}));
3129
-
3130
- //#endregion
3131
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/zipObject.mjs
3132
- function zipObject(keys, values) {
3133
- const result = {};
3134
- for (let i = 0; i < keys.length; i++) result[keys[i]] = values[i];
3135
- return result;
3136
- }
3137
- var init_zipObject = __esmMin((() => {}));
3138
-
3139
- //#endregion
3140
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/zipWith.mjs
3141
- function zipWith(arr1, ...rest) {
3142
- const arrs = [arr1, ...rest.slice(0, -1)];
3143
- const combine = rest[rest.length - 1];
3144
- const maxIndex = Math.max(...arrs.map((arr) => arr.length));
3145
- const result = Array(maxIndex);
3146
- for (let i = 0; i < maxIndex; i++) result[i] = combine(...arrs.map((arr) => arr[i]), i);
3147
- return result;
3148
- }
3149
- var init_zipWith = __esmMin((() => {}));
3150
-
3151
- //#endregion
3152
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/error/AbortError.mjs
3153
- var AbortError;
3154
- var init_AbortError = __esmMin((() => {
3155
- AbortError = class extends Error {
3156
- constructor(message = "The operation was aborted") {
3157
- super(message);
3158
- this.name = "AbortError";
3159
- }
3160
- };
3161
- }));
3162
-
3163
- //#endregion
3164
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/error/TimeoutError.mjs
3165
- var TimeoutError;
3166
- var init_TimeoutError = __esmMin((() => {
3167
- TimeoutError = class extends Error {
3168
- constructor(message = "The operation was timed out") {
3169
- super(message);
3170
- this.name = "TimeoutError";
3171
- }
3172
- };
3173
- }));
3174
-
3175
- //#endregion
3176
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/after.mjs
3177
- function after(n, func) {
3178
- if (!Number.isInteger(n) || n < 0) throw new Error(`n must be a non-negative integer.`);
3179
- let counter = 0;
3180
- return (...args) => {
3181
- if (++counter >= n) return func(...args);
3182
- };
3183
- }
3184
- var init_after = __esmMin((() => {}));
3185
-
3186
- //#endregion
3187
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/ary.mjs
3188
- function ary(func, n) {
3189
- return function(...args) {
3190
- return func.apply(this, args.slice(0, n));
3191
- };
3192
- }
3193
- var init_ary = __esmMin((() => {}));
3194
-
3195
- //#endregion
3196
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/asyncNoop.mjs
3197
- async function asyncNoop() {}
3198
- var init_asyncNoop = __esmMin((() => {}));
3199
-
3200
- //#endregion
3201
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/before.mjs
3202
- function before(n, func) {
3203
- if (!Number.isInteger(n) || n < 0) throw new Error("n must be a non-negative integer.");
3204
- let counter = 0;
3205
- return (...args) => {
3206
- if (++counter < n) return func(...args);
3207
- };
3208
- }
3209
- var init_before = __esmMin((() => {}));
3210
-
3211
- //#endregion
3212
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/curry.mjs
3213
- function curry(func) {
3214
- if (func.length === 0 || func.length === 1) return func;
3215
- return function(arg) {
3216
- return makeCurry(func, func.length, [arg]);
3217
- };
3218
- }
3219
- function makeCurry(origin, argsLength, args) {
3220
- if (args.length === argsLength) return origin(...args);
3221
- else {
3222
- const next = function(arg) {
3223
- return makeCurry(origin, argsLength, [...args, arg]);
3224
- };
3225
- return next;
3226
- }
3227
- }
3228
- var init_curry = __esmMin((() => {}));
3229
-
3230
- //#endregion
3231
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/curryRight.mjs
3232
- function curryRight(func) {
3233
- if (func.length === 0 || func.length === 1) return func;
3234
- return function(arg) {
3235
- return makeCurryRight(func, func.length, [arg]);
3236
- };
3237
- }
3238
- function makeCurryRight(origin, argsLength, args) {
3239
- if (args.length === argsLength) return origin(...args);
3240
- else {
3241
- const next = function(arg) {
3242
- return makeCurryRight(origin, argsLength, [arg, ...args]);
3243
- };
3244
- return next;
3245
- }
3246
- }
3247
- var init_curryRight = __esmMin((() => {}));
3248
-
3249
- //#endregion
3250
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/debounce.mjs
3251
- function debounce(func, debounceMs, { signal, edges } = {}) {
3252
- let pendingThis = void 0;
3253
- let pendingArgs = null;
3254
- const leading = edges != null && edges.includes("leading");
3255
- const trailing = edges == null || edges.includes("trailing");
3256
- const invoke = () => {
3257
- if (pendingArgs !== null) {
3258
- func.apply(pendingThis, pendingArgs);
3259
- pendingThis = void 0;
3260
- pendingArgs = null;
3261
- }
3262
- };
3263
- const onTimerEnd = () => {
3264
- if (trailing) invoke();
3265
- cancel();
3266
- };
3267
- let timeoutId = null;
3268
- const schedule = () => {
3269
- if (timeoutId != null) clearTimeout(timeoutId);
3270
- timeoutId = setTimeout(() => {
3271
- timeoutId = null;
3272
- onTimerEnd();
3273
- }, debounceMs);
3274
- };
3275
- const cancelTimer = () => {
3276
- if (timeoutId !== null) {
3277
- clearTimeout(timeoutId);
3278
- timeoutId = null;
3279
- }
3280
- };
3281
- const cancel = () => {
3282
- cancelTimer();
3283
- pendingThis = void 0;
3284
- pendingArgs = null;
3285
- };
3286
- const flush = () => {
3287
- invoke();
3288
- };
3289
- const debounced = function(...args) {
3290
- if (signal?.aborted) return;
3291
- pendingThis = this;
3292
- pendingArgs = args;
3293
- const isFirstCall = timeoutId == null;
3294
- schedule();
3295
- if (leading && isFirstCall) invoke();
3296
- };
3297
- debounced.schedule = schedule;
3298
- debounced.cancel = cancel;
3299
- debounced.flush = flush;
3300
- signal?.addEventListener("abort", cancel, { once: true });
3301
- return debounced;
3302
- }
3303
- var init_debounce = __esmMin((() => {}));
3304
-
3305
- //#endregion
3306
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/flow.mjs
3307
- function flow(...funcs) {
3308
- return function(...args) {
3309
- let result = funcs.length ? funcs[0].apply(this, args) : args[0];
3310
- for (let i = 1; i < funcs.length; i++) result = funcs[i].call(this, result);
3311
- return result;
3312
- };
3313
- }
3314
- var init_flow = __esmMin((() => {}));
3315
-
3316
- //#endregion
3317
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/flowRight.mjs
3318
- function flowRight(...funcs) {
3319
- return flow(...funcs.reverse());
3320
- }
3321
- var init_flowRight = __esmMin((() => {
3322
- init_flow();
3323
- }));
3324
-
3325
- //#endregion
3326
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/identity.mjs
3327
- function identity(x) {
3328
- return x;
3329
- }
3330
- var init_identity = __esmMin((() => {}));
3331
-
3332
- //#endregion
3333
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/memoize.mjs
3334
- function memoize(fn, options = {}) {
3335
- const { cache = /* @__PURE__ */ new Map(), getCacheKey } = options;
3336
- const memoizedFn = function(arg) {
3337
- const key = getCacheKey ? getCacheKey(arg) : arg;
3338
- if (cache.has(key)) return cache.get(key);
3339
- const result = fn.call(this, arg);
3340
- cache.set(key, result);
3341
- return result;
3342
- };
3343
- memoizedFn.cache = cache;
3344
- return memoizedFn;
3345
- }
3346
- var init_memoize = __esmMin((() => {}));
3347
-
3348
- //#endregion
3349
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/negate.mjs
3350
- function negate(func) {
3351
- return ((...args) => !func(...args));
3352
- }
3353
- var init_negate = __esmMin((() => {}));
3354
-
3355
- //#endregion
3356
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/noop.mjs
3357
- function noop() {}
3358
- var init_noop = __esmMin((() => {}));
3359
-
3360
- //#endregion
3361
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/once.mjs
3362
- function once(func) {
3363
- let called = false;
3364
- let cache;
3365
- return function(...args) {
3366
- if (!called) {
3367
- called = true;
3368
- cache = func(...args);
3369
- }
3370
- return cache;
3371
- };
3372
- }
3373
- var init_once = __esmMin((() => {}));
3374
-
3375
- //#endregion
3376
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/partial.mjs
3377
- function partial(func, ...partialArgs) {
3378
- return partialImpl(func, placeholderSymbol$1, ...partialArgs);
3379
- }
3380
- function partialImpl(func, placeholder, ...partialArgs) {
3381
- const partialed = function(...providedArgs) {
3382
- let providedArgsIndex = 0;
3383
- const substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg);
3384
- const remainingArgs = providedArgs.slice(providedArgsIndex);
3385
- return func.apply(this, substitutedArgs.concat(remainingArgs));
3386
- };
3387
- if (func.prototype) partialed.prototype = Object.create(func.prototype);
3388
- return partialed;
3389
- }
3390
- var placeholderSymbol$1;
3391
- var init_partial = __esmMin((() => {
3392
- placeholderSymbol$1 = Symbol("partial.placeholder");
3393
- partial.placeholder = placeholderSymbol$1;
3394
- }));
3395
-
3396
- //#endregion
3397
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/partialRight.mjs
3398
- function partialRight(func, ...partialArgs) {
3399
- return partialRightImpl(func, placeholderSymbol, ...partialArgs);
3400
- }
3401
- function partialRightImpl(func, placeholder, ...partialArgs) {
3402
- const partialedRight = function(...providedArgs) {
3403
- const placeholderLength = partialArgs.filter((arg) => arg === placeholder).length;
3404
- const rangeLength = Math.max(providedArgs.length - placeholderLength, 0);
3405
- const remainingArgs = providedArgs.slice(0, rangeLength);
3406
- let providedArgsIndex = rangeLength;
3407
- const substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg);
3408
- return func.apply(this, remainingArgs.concat(substitutedArgs));
3409
- };
3410
- if (func.prototype) partialedRight.prototype = Object.create(func.prototype);
3411
- return partialedRight;
3412
- }
3413
- var placeholderSymbol;
3414
- var init_partialRight = __esmMin((() => {
3415
- placeholderSymbol = Symbol("partialRight.placeholder");
3416
- partialRight.placeholder = placeholderSymbol;
3417
- }));
3418
-
3419
- //#endregion
3420
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/rest.mjs
3421
- function rest(func, startIndex = func.length - 1) {
3422
- return function(...args) {
3423
- const rest = args.slice(startIndex);
3424
- const params = args.slice(0, startIndex);
3425
- while (params.length < startIndex) params.push(void 0);
3426
- return func.apply(this, [...params, rest]);
3427
- };
3428
- }
3429
- var init_rest = __esmMin((() => {}));
3430
-
3431
- //#endregion
3432
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/promise/delay.mjs
3433
- function delay(ms, { signal } = {}) {
3434
- return new Promise((resolve, reject) => {
3435
- const abortError = () => {
3436
- reject(new AbortError());
3437
- };
3438
- const abortHandler = () => {
3439
- clearTimeout(timeoutId);
3440
- abortError();
3441
- };
3442
- if (signal?.aborted) return abortError();
3443
- const timeoutId = setTimeout(() => {
3444
- signal?.removeEventListener("abort", abortHandler);
3445
- resolve();
3446
- }, ms);
3447
- signal?.addEventListener("abort", abortHandler, { once: true });
3448
- });
3449
- }
3450
- var init_delay = __esmMin((() => {
3451
- init_AbortError();
3452
- }));
3453
-
3454
- //#endregion
3455
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/retry.mjs
3456
- async function retry(func, _options) {
3457
- let delay$1;
3458
- let retries;
3459
- let signal;
3460
- let shouldRetry;
3461
- if (typeof _options === "number") {
3462
- delay$1 = DEFAULT_DELAY;
3463
- retries = _options;
3464
- signal = void 0;
3465
- shouldRetry = DEFAULT_SHOULD_RETRY;
3466
- } else {
3467
- delay$1 = _options?.delay ?? DEFAULT_DELAY;
3468
- retries = _options?.retries ?? DEFAULT_RETRIES;
3469
- signal = _options?.signal;
3470
- shouldRetry = _options?.shouldRetry ?? DEFAULT_SHOULD_RETRY;
3471
- }
3472
- let error;
3473
- for (let attempts = 0; attempts <= retries; attempts++) {
3474
- if (signal?.aborted) throw error ?? /* @__PURE__ */ new Error(`The retry operation was aborted due to an abort signal.`);
3475
- try {
3476
- return await func();
3477
- } catch (err) {
3478
- error = err;
3479
- if (!shouldRetry(err, attempts)) throw err;
3480
- await delay(typeof delay$1 === "function" ? delay$1(attempts) : delay$1);
3481
- }
3482
- }
3483
- throw error;
3484
- }
3485
- var DEFAULT_DELAY, DEFAULT_RETRIES, DEFAULT_SHOULD_RETRY;
3486
- var init_retry = __esmMin((() => {
3487
- init_delay();
3488
- DEFAULT_DELAY = 0;
3489
- DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
3490
- DEFAULT_SHOULD_RETRY = () => true;
3491
- }));
3492
-
3493
- //#endregion
3494
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/spread.mjs
3495
- function spread(func) {
3496
- return function(argsArr) {
3497
- return func.apply(this, argsArr);
3498
- };
3499
- }
3500
- var init_spread = __esmMin((() => {}));
3501
-
3502
- //#endregion
3503
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/throttle.mjs
3504
- function throttle(func, throttleMs, { signal, edges = ["leading", "trailing"] } = {}) {
3505
- let pendingAt = null;
3506
- const debounced = debounce(function(...args) {
3507
- pendingAt = Date.now();
3508
- func.apply(this, args);
3509
- }, throttleMs, {
3510
- signal,
3511
- edges
3512
- });
3513
- const throttled = function(...args) {
3514
- if (pendingAt == null) pendingAt = Date.now();
3515
- if (Date.now() - pendingAt >= throttleMs) {
3516
- pendingAt = Date.now();
3517
- func.apply(this, args);
3518
- debounced.cancel();
3519
- debounced.schedule();
3520
- return;
3521
- }
3522
- debounced.apply(this, args);
3523
- };
3524
- throttled.cancel = debounced.cancel;
3525
- throttled.flush = debounced.flush;
3526
- return throttled;
3527
- }
3528
- var init_throttle = __esmMin((() => {
3529
- init_debounce();
3530
- }));
3531
-
3532
- //#endregion
3533
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/unary.mjs
3534
- function unary(func) {
3535
- return ary(func, 1);
3536
- }
3537
- var init_unary = __esmMin((() => {
3538
- init_ary();
3539
- }));
3540
-
3541
- //#endregion
3542
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/clamp.mjs
3543
- function clamp(value, bound1, bound2) {
3544
- if (bound2 == null) return Math.min(value, bound1);
3545
- return Math.min(Math.max(value, bound1), bound2);
3546
- }
3547
- var init_clamp = __esmMin((() => {}));
3548
-
3549
- //#endregion
3550
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/inRange.mjs
3551
- function inRange(value, minimum, maximum) {
3552
- if (maximum == null) {
3553
- maximum = minimum;
3554
- minimum = 0;
3555
- }
3556
- if (minimum >= maximum) throw new Error("The maximum value must be greater than the minimum value.");
3557
- return minimum <= value && value < maximum;
3558
- }
3559
- var init_inRange = __esmMin((() => {}));
3560
-
3561
- //#endregion
3562
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/sum.mjs
3563
- function sum(nums) {
3564
- let result = 0;
3565
- for (let i = 0; i < nums.length; i++) result += nums[i];
3566
- return result;
3567
- }
3568
- var init_sum = __esmMin((() => {}));
3569
-
3570
- //#endregion
3571
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/mean.mjs
3572
- function mean(nums) {
3573
- return sum(nums) / nums.length;
3574
- }
3575
- var init_mean = __esmMin((() => {
3576
- init_sum();
3577
- }));
3578
-
3579
- //#endregion
3580
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/sumBy.mjs
3581
- function sumBy(items, getValue) {
3582
- let result = 0;
3583
- for (let i = 0; i < items.length; i++) result += getValue(items[i], i);
3584
- return result;
3585
- }
3586
- var init_sumBy = __esmMin((() => {}));
3587
-
3588
- //#endregion
3589
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/meanBy.mjs
3590
- function meanBy(items, getValue) {
3591
- return sumBy(items, (item) => getValue(item)) / items.length;
3592
- }
3593
- var init_meanBy = __esmMin((() => {
3594
- init_sumBy();
3595
- }));
3596
-
3597
- //#endregion
3598
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/median.mjs
3599
- function median(nums) {
3600
- if (nums.length === 0) return NaN;
3601
- const sorted = nums.slice().sort((a, b) => a - b);
3602
- const middleIndex = Math.floor(sorted.length / 2);
3603
- if (sorted.length % 2 === 0) return (sorted[middleIndex - 1] + sorted[middleIndex]) / 2;
3604
- else return sorted[middleIndex];
3605
- }
3606
- var init_median = __esmMin((() => {}));
3607
-
3608
- //#endregion
3609
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/medianBy.mjs
3610
- function medianBy(items, getValue) {
3611
- return median(items.map((x) => getValue(x)));
3612
- }
3613
- var init_medianBy = __esmMin((() => {
3614
- init_median();
3615
- }));
3616
-
3617
- //#endregion
3618
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/range.mjs
3619
- function range(start, end, step = 1) {
3620
- if (end == null) {
3621
- end = start;
3622
- start = 0;
3623
- }
3624
- if (!Number.isInteger(step) || step === 0) throw new Error(`The step value must be a non-zero integer.`);
3625
- const length = Math.max(Math.ceil((end - start) / step), 0);
3626
- const result = new Array(length);
3627
- for (let i = 0; i < length; i++) result[i] = start + i * step;
3628
- return result;
3629
- }
3630
- var init_range = __esmMin((() => {}));
3631
-
3632
- //#endregion
3633
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/rangeRight.mjs
3634
- function rangeRight(start, end, step = 1) {
3635
- if (end == null) {
3636
- end = start;
3637
- start = 0;
3638
- }
3639
- if (!Number.isInteger(step) || step === 0) throw new Error(`The step value must be a non-zero integer.`);
3640
- const length = Math.max(Math.ceil((end - start) / step), 0);
3641
- const result = new Array(length);
3642
- for (let i = 0; i < length; i++) result[i] = start + (length - i - 1) * step;
3643
- return result;
3644
- }
3645
- var init_rangeRight = __esmMin((() => {}));
3646
-
3647
- //#endregion
3648
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/math/round.mjs
3649
- function round(value, precision = 0) {
3650
- if (!Number.isInteger(precision)) throw new Error("Precision must be an integer.");
3651
- const multiplier = Math.pow(10, precision);
3652
- return Math.round(value * multiplier) / multiplier;
3653
- }
3654
- var init_round = __esmMin((() => {}));
3655
-
3656
- //#endregion
3657
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
3658
- function isPrimitive(value) {
3659
- return value == null || typeof value !== "object" && typeof value !== "function";
3660
- }
3661
- var init_isPrimitive = __esmMin((() => {}));
3662
-
3663
- //#endregion
3664
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
3665
- function isTypedArray(x) {
3666
- return ArrayBuffer.isView(x) && !(x instanceof DataView);
3667
- }
3668
- var init_isTypedArray = __esmMin((() => {}));
3669
-
3670
- //#endregion
3671
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/clone.mjs
3672
- function clone(obj) {
3673
- if (isPrimitive(obj)) return obj;
3674
- if (Array.isArray(obj) || isTypedArray(obj) || obj instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && obj instanceof SharedArrayBuffer) return obj.slice(0);
3675
- const prototype = Object.getPrototypeOf(obj);
3676
- if (prototype == null) return Object.assign(Object.create(prototype), obj);
3677
- const Constructor = prototype.constructor;
3678
- if (obj instanceof Date || obj instanceof Map || obj instanceof Set) return new Constructor(obj);
3679
- if (obj instanceof RegExp) {
3680
- const newRegExp = new Constructor(obj);
3681
- newRegExp.lastIndex = obj.lastIndex;
3682
- return newRegExp;
3683
- }
3684
- if (obj instanceof DataView) return new Constructor(obj.buffer.slice(0));
3685
- if (obj instanceof Error) {
3686
- let newError;
3687
- if (obj instanceof AggregateError) newError = new Constructor(obj.errors, obj.message, { cause: obj.cause });
3688
- else newError = new Constructor(obj.message, { cause: obj.cause });
3689
- newError.stack = obj.stack;
3690
- Object.assign(newError, obj);
3691
- return newError;
3692
- }
3693
- if (typeof File !== "undefined" && obj instanceof File) return new Constructor([obj], obj.name, {
3694
- type: obj.type,
3695
- lastModified: obj.lastModified
3696
- });
3697
- if (typeof obj === "object") {
3698
- const newObject = Object.create(prototype);
3699
- return Object.assign(newObject, obj);
3700
- }
3701
- return obj;
3702
- }
3703
- var init_clone = __esmMin((() => {
3704
- init_isPrimitive();
3705
- init_isTypedArray();
3706
- }));
3707
-
3708
- //#endregion
3709
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
3710
- function getSymbols(object) {
3711
- return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
3712
- }
3713
- var init_getSymbols = __esmMin((() => {}));
3714
-
3715
- //#endregion
3716
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
3717
- function getTag(value) {
3718
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
3719
- return Object.prototype.toString.call(value);
3720
- }
3721
- var init_getTag = __esmMin((() => {}));
3722
-
3723
- //#endregion
3724
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
3725
- var regexpTag, stringTag, numberTag, booleanTag, argumentsTag, symbolTag, dateTag, mapTag, setTag, arrayTag, functionTag, arrayBufferTag, objectTag, errorTag, dataViewTag, uint8ArrayTag, uint8ClampedArrayTag, uint16ArrayTag, uint32ArrayTag, bigUint64ArrayTag, int8ArrayTag, int16ArrayTag, int32ArrayTag, bigInt64ArrayTag, float32ArrayTag, float64ArrayTag;
3726
- var init_tags = __esmMin((() => {
3727
- regexpTag = "[object RegExp]";
3728
- stringTag = "[object String]";
3729
- numberTag = "[object Number]";
3730
- booleanTag = "[object Boolean]";
3731
- argumentsTag = "[object Arguments]";
3732
- symbolTag = "[object Symbol]";
3733
- dateTag = "[object Date]";
3734
- mapTag = "[object Map]";
3735
- setTag = "[object Set]";
3736
- arrayTag = "[object Array]";
3737
- functionTag = "[object Function]";
3738
- arrayBufferTag = "[object ArrayBuffer]";
3739
- objectTag = "[object Object]";
3740
- errorTag = "[object Error]";
3741
- dataViewTag = "[object DataView]";
3742
- uint8ArrayTag = "[object Uint8Array]";
3743
- uint8ClampedArrayTag = "[object Uint8ClampedArray]";
3744
- uint16ArrayTag = "[object Uint16Array]";
3745
- uint32ArrayTag = "[object Uint32Array]";
3746
- bigUint64ArrayTag = "[object BigUint64Array]";
3747
- int8ArrayTag = "[object Int8Array]";
3748
- int16ArrayTag = "[object Int16Array]";
3749
- int32ArrayTag = "[object Int32Array]";
3750
- bigInt64ArrayTag = "[object BigInt64Array]";
3751
- float32ArrayTag = "[object Float32Array]";
3752
- float64ArrayTag = "[object Float64Array]";
3753
- }));
3754
-
3755
- //#endregion
3756
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/cloneDeepWith.mjs
3757
- function cloneDeepWith(obj, cloneValue) {
3758
- return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), cloneValue);
3759
- }
3760
- function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = /* @__PURE__ */ new Map(), cloneValue = void 0) {
3761
- const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);
3762
- if (cloned !== void 0) return cloned;
3763
- if (isPrimitive(valueToClone)) return valueToClone;
3764
- if (stack.has(valueToClone)) return stack.get(valueToClone);
3765
- if (Array.isArray(valueToClone)) {
3766
- const result = new Array(valueToClone.length);
3767
- stack.set(valueToClone, result);
3768
- for (let i = 0; i < valueToClone.length; i++) result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
3769
- if (Object.hasOwn(valueToClone, "index")) result.index = valueToClone.index;
3770
- if (Object.hasOwn(valueToClone, "input")) result.input = valueToClone.input;
3771
- return result;
3772
- }
3773
- if (valueToClone instanceof Date) return new Date(valueToClone.getTime());
3774
- if (valueToClone instanceof RegExp) {
3775
- const result = new RegExp(valueToClone.source, valueToClone.flags);
3776
- result.lastIndex = valueToClone.lastIndex;
3777
- return result;
3778
- }
3779
- if (valueToClone instanceof Map) {
3780
- const result = /* @__PURE__ */ new Map();
3781
- stack.set(valueToClone, result);
3782
- for (const [key, value] of valueToClone) result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
3783
- return result;
3784
- }
3785
- if (valueToClone instanceof Set) {
3786
- const result = /* @__PURE__ */ new Set();
3787
- stack.set(valueToClone, result);
3788
- for (const value of valueToClone) result.add(cloneDeepWithImpl(value, void 0, objectToClone, stack, cloneValue));
3789
- return result;
3790
- }
3791
- if (typeof Buffer !== "undefined" && Buffer.isBuffer(valueToClone)) return valueToClone.subarray();
3792
- if (isTypedArray(valueToClone)) {
3793
- const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
3794
- stack.set(valueToClone, result);
3795
- for (let i = 0; i < valueToClone.length; i++) result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
3796
- return result;
3797
- }
3798
- if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) return valueToClone.slice(0);
3799
- if (valueToClone instanceof DataView) {
3800
- const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
3801
- stack.set(valueToClone, result);
3802
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3803
- return result;
3804
- }
3805
- if (typeof File !== "undefined" && valueToClone instanceof File) {
3806
- const result = new File([valueToClone], valueToClone.name, { type: valueToClone.type });
3807
- stack.set(valueToClone, result);
3808
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3809
- return result;
3810
- }
3811
- if (typeof Blob !== "undefined" && valueToClone instanceof Blob) {
3812
- const result = new Blob([valueToClone], { type: valueToClone.type });
3813
- stack.set(valueToClone, result);
3814
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3815
- return result;
3816
- }
3817
- if (valueToClone instanceof Error) {
3818
- const result = structuredClone(valueToClone);
3819
- stack.set(valueToClone, result);
3820
- result.message = valueToClone.message;
3821
- result.name = valueToClone.name;
3822
- result.stack = valueToClone.stack;
3823
- result.cause = valueToClone.cause;
3824
- result.constructor = valueToClone.constructor;
3825
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3826
- return result;
3827
- }
3828
- if (valueToClone instanceof Boolean) {
3829
- const result = new Boolean(valueToClone.valueOf());
3830
- stack.set(valueToClone, result);
3831
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3832
- return result;
3833
- }
3834
- if (valueToClone instanceof Number) {
3835
- const result = new Number(valueToClone.valueOf());
3836
- stack.set(valueToClone, result);
3837
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3838
- return result;
3839
- }
3840
- if (valueToClone instanceof String) {
3841
- const result = new String(valueToClone.valueOf());
3842
- stack.set(valueToClone, result);
3843
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3844
- return result;
3845
- }
3846
- if (typeof valueToClone === "object" && isCloneableObject(valueToClone)) {
3847
- const result = Object.create(Object.getPrototypeOf(valueToClone));
3848
- stack.set(valueToClone, result);
3849
- copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
3850
- return result;
3851
- }
3852
- return valueToClone;
3853
- }
3854
- function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
3855
- const keys = [...Object.keys(source), ...getSymbols(source)];
3856
- for (let i = 0; i < keys.length; i++) {
3857
- const key = keys[i];
3858
- const descriptor = Object.getOwnPropertyDescriptor(target, key);
3859
- if (descriptor == null || descriptor.writable) target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
3860
- }
3861
- }
3862
- function isCloneableObject(object) {
3863
- switch (getTag(object)) {
3864
- case argumentsTag:
3865
- case arrayTag:
3866
- case arrayBufferTag:
3867
- case dataViewTag:
3868
- case booleanTag:
3869
- case dateTag:
3870
- case float32ArrayTag:
3871
- case float64ArrayTag:
3872
- case int8ArrayTag:
3873
- case int16ArrayTag:
3874
- case int32ArrayTag:
3875
- case mapTag:
3876
- case numberTag:
3877
- case objectTag:
3878
- case regexpTag:
3879
- case setTag:
3880
- case stringTag:
3881
- case symbolTag:
3882
- case uint8ArrayTag:
3883
- case uint8ClampedArrayTag:
3884
- case uint16ArrayTag:
3885
- case uint32ArrayTag: return true;
3886
- default: return false;
3887
- }
3888
- }
3889
- var init_cloneDeepWith = __esmMin((() => {
3890
- init_getSymbols();
3891
- init_getTag();
3892
- init_tags();
3893
- init_isPrimitive();
3894
- init_isTypedArray();
3895
- }));
3896
-
3897
- //#endregion
3898
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/cloneDeep.mjs
3899
- function cloneDeep(obj) {
3900
- return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), void 0);
3901
- }
3902
- var init_cloneDeep = __esmMin((() => {
3903
- init_cloneDeepWith();
3904
- }));
3905
-
3906
- //#endregion
3907
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/findKey.mjs
3908
- function findKey(obj, predicate) {
3909
- return Object.keys(obj).find((key) => predicate(obj[key], key, obj));
3910
- }
3911
- var init_findKey = __esmMin((() => {}));
3912
-
3913
- //#endregion
3914
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
3915
- function isPlainObject$2(value) {
3916
- if (!value || typeof value !== "object") return false;
3917
- const proto = Object.getPrototypeOf(value);
3918
- if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
3919
- return Object.prototype.toString.call(value) === "[object Object]";
3920
- }
3921
- var init_isPlainObject$1 = __esmMin((() => {}));
3922
-
3923
- //#endregion
3924
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/flattenObject.mjs
3925
- function flattenObject(object, { delimiter = "." } = {}) {
3926
- return flattenObjectImpl(object, "", delimiter);
3927
- }
3928
- function flattenObjectImpl(object, prefix, delimiter) {
3929
- const result = {};
3930
- const keys = Object.keys(object);
3931
- for (let i = 0; i < keys.length; i++) {
3932
- const key = keys[i];
3933
- const value = object[key];
3934
- const prefixedKey = prefix ? `${prefix}${delimiter}${key}` : key;
3935
- if (isPlainObject$2(value) && Object.keys(value).length > 0) {
3936
- Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
3937
- continue;
3938
- }
3939
- if (Array.isArray(value) && value.length > 0) {
3940
- Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
3941
- continue;
3942
- }
3943
- result[prefixedKey] = value;
3944
- }
3945
- return result;
3946
- }
3947
- var init_flattenObject = __esmMin((() => {
3948
- init_isPlainObject$1();
3949
- }));
3950
-
3951
- //#endregion
3952
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/invert.mjs
3953
- function invert(obj) {
3954
- const result = {};
3955
- const keys = Object.keys(obj);
3956
- for (let i = 0; i < keys.length; i++) {
3957
- const key = keys[i];
3958
- const value = obj[key];
3959
- result[value] = key;
3960
- }
3961
- return result;
3962
- }
3963
- var init_invert = __esmMin((() => {}));
3964
-
3965
- //#endregion
3966
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/mapKeys.mjs
3967
- function mapKeys(object, getNewKey) {
3968
- const result = {};
3969
- const keys = Object.keys(object);
3970
- for (let i = 0; i < keys.length; i++) {
3971
- const key = keys[i];
3972
- const value = object[key];
3973
- result[getNewKey(value, key, object)] = value;
3974
- }
3975
- return result;
3976
- }
3977
- var init_mapKeys = __esmMin((() => {}));
3978
-
3979
- //#endregion
3980
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/mapValues.mjs
3981
- function mapValues(object, getNewValue) {
3982
- const result = {};
3983
- const keys = Object.keys(object);
3984
- for (let i = 0; i < keys.length; i++) {
3985
- const key = keys[i];
3986
- const value = object[key];
3987
- result[key] = getNewValue(value, key, object);
3988
- }
3989
- return result;
3990
- }
3991
- var init_mapValues = __esmMin((() => {}));
3992
-
3993
- //#endregion
3994
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
3995
- function isUnsafeProperty(key) {
3996
- return key === "__proto__";
3997
- }
3998
- var init_isUnsafeProperty = __esmMin((() => {}));
3999
-
4000
- //#endregion
4001
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/merge.mjs
4002
- function merge(target, source) {
4003
- const sourceKeys = Object.keys(source);
4004
- for (let i = 0; i < sourceKeys.length; i++) {
4005
- const key = sourceKeys[i];
4006
- if (isUnsafeProperty(key)) continue;
4007
- const sourceValue = source[key];
4008
- const targetValue = target[key];
4009
- if (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) target[key] = merge(targetValue, sourceValue);
4010
- else if (Array.isArray(sourceValue)) target[key] = merge([], sourceValue);
4011
- else if (isPlainObject$2(sourceValue)) target[key] = merge({}, sourceValue);
4012
- else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
4013
- }
4014
- return target;
4015
- }
4016
- function isMergeableValue(value) {
4017
- return isPlainObject$2(value) || Array.isArray(value);
4018
- }
4019
- var init_merge = __esmMin((() => {
4020
- init_isUnsafeProperty();
4021
- init_isPlainObject$1();
4022
- }));
4023
-
4024
- //#endregion
4025
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/mergeWith.mjs
4026
- function mergeWith(target, source, merge) {
4027
- const sourceKeys = Object.keys(source);
4028
- for (let i = 0; i < sourceKeys.length; i++) {
4029
- const key = sourceKeys[i];
4030
- if (isUnsafeProperty(key)) continue;
4031
- const sourceValue = source[key];
4032
- const targetValue = target[key];
4033
- const merged = merge(targetValue, sourceValue, key, target, source);
4034
- if (merged !== void 0) target[key] = merged;
4035
- else if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);
4036
- else target[key] = mergeWith([], sourceValue, merge);
4037
- else if (isPlainObject$2(sourceValue)) if (isPlainObject$2(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);
4038
- else target[key] = mergeWith({}, sourceValue, merge);
4039
- else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
4040
- }
4041
- return target;
4042
- }
4043
- var init_mergeWith = __esmMin((() => {
4044
- init_isUnsafeProperty();
4045
- init_isPlainObject$1();
4046
- }));
4047
-
4048
- //#endregion
4049
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/omit.mjs
4050
- function omit(obj, keys) {
4051
- const result = { ...obj };
4052
- for (let i = 0; i < keys.length; i++) {
4053
- const key = keys[i];
4054
- delete result[key];
4055
- }
4056
- return result;
4057
- }
4058
- var init_omit = __esmMin((() => {}));
4059
-
4060
- //#endregion
4061
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/omitBy.mjs
4062
- function omitBy(obj, shouldOmit) {
4063
- const result = {};
4064
- const keys = Object.keys(obj);
4065
- for (let i = 0; i < keys.length; i++) {
4066
- const key = keys[i];
4067
- const value = obj[key];
4068
- if (!shouldOmit(value, key)) result[key] = value;
4069
- }
4070
- return result;
4071
- }
4072
- var init_omitBy = __esmMin((() => {}));
4073
-
4074
- //#endregion
4075
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/pick.mjs
4076
- function pick(obj, keys) {
4077
- const result = {};
4078
- for (let i = 0; i < keys.length; i++) {
4079
- const key = keys[i];
4080
- if (Object.hasOwn(obj, key)) result[key] = obj[key];
4081
- }
4082
- return result;
4083
- }
4084
- var init_pick = __esmMin((() => {}));
4085
-
4086
- //#endregion
4087
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/pickBy.mjs
4088
- function pickBy(obj, shouldPick) {
4089
- const result = {};
4090
- const keys = Object.keys(obj);
4091
- for (let i = 0; i < keys.length; i++) {
4092
- const key = keys[i];
4093
- const value = obj[key];
4094
- if (shouldPick(value, key)) result[key] = value;
4095
- }
4096
- return result;
4097
- }
4098
- var init_pickBy = __esmMin((() => {}));
4099
-
4100
- //#endregion
4101
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArray.mjs
4102
- function isArray(value) {
4103
- return Array.isArray(value);
4104
- }
4105
- var init_isArray = __esmMin((() => {}));
4106
-
4107
- //#endregion
4108
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/capitalize.mjs
4109
- function capitalize(str) {
4110
- return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
4111
- }
4112
- var init_capitalize = __esmMin((() => {}));
4113
-
4114
- //#endregion
4115
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/words.mjs
4116
- function words(str) {
4117
- return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
4118
- }
4119
- var CASE_SPLIT_PATTERN;
4120
- var init_words = __esmMin((() => {
4121
- CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
4122
- }));
4123
-
4124
- //#endregion
4125
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/camelCase.mjs
4126
- function camelCase$1(str) {
4127
- const words$1 = words(str);
4128
- if (words$1.length === 0) return "";
4129
- const [first, ...rest] = words$1;
4130
- return `${first.toLowerCase()}${rest.map((word) => capitalize(word)).join("")}`;
4131
- }
4132
- var init_camelCase = __esmMin((() => {
4133
- init_capitalize();
4134
- init_words();
4135
- }));
4136
-
4137
- //#endregion
4138
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/toCamelCaseKeys.mjs
4139
- function toCamelCaseKeys(obj) {
4140
- if (isArray(obj)) return obj.map((item) => toCamelCaseKeys(item));
4141
- if (isPlainObject$2(obj)) {
4142
- const result = {};
4143
- const keys = Object.keys(obj);
4144
- for (let i = 0; i < keys.length; i++) {
4145
- const key = keys[i];
4146
- const camelKey = camelCase$1(key);
4147
- result[camelKey] = toCamelCaseKeys(obj[key]);
4148
- }
4149
- return result;
4150
- }
4151
- return obj;
4152
- }
4153
- var init_toCamelCaseKeys = __esmMin((() => {
4154
- init_isArray();
4155
- init_isPlainObject$1();
4156
- init_camelCase();
4157
- }));
4158
-
4159
- //#endregion
4160
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/toMerged.mjs
4161
- function toMerged(target, source) {
4162
- return mergeWith(clone(target), source, function mergeRecursively(targetValue, sourceValue) {
4163
- if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) return mergeWith(clone(targetValue), sourceValue, mergeRecursively);
4164
- else return mergeWith([], sourceValue, mergeRecursively);
4165
- else if (isPlainObject$2(sourceValue)) if (isPlainObject$2(targetValue)) return mergeWith(clone(targetValue), sourceValue, mergeRecursively);
4166
- else return mergeWith({}, sourceValue, mergeRecursively);
4167
- });
4168
- }
4169
- var init_toMerged = __esmMin((() => {
4170
- init_clone();
4171
- init_mergeWith();
4172
- init_isPlainObject$1();
4173
- }));
4174
-
4175
- //#endregion
4176
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs
4177
- function isPlainObject$1(object) {
4178
- if (typeof object !== "object") return false;
4179
- if (object == null) return false;
4180
- if (Object.getPrototypeOf(object) === null) return true;
4181
- if (Object.prototype.toString.call(object) !== "[object Object]") {
4182
- const tag = object[Symbol.toStringTag];
4183
- if (tag == null) return false;
4184
- if (!Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable) return false;
4185
- return object.toString() === `[object ${tag}]`;
4186
- }
4187
- let proto = object;
4188
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
4189
- return Object.getPrototypeOf(object) === proto;
4190
- }
4191
- var init_isPlainObject = __esmMin((() => {}));
4192
-
4193
- //#endregion
4194
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/snakeCase.mjs
4195
- function snakeCase(str) {
4196
- return words(str).map((word) => word.toLowerCase()).join("_");
4197
- }
4198
- var init_snakeCase = __esmMin((() => {
4199
- init_words();
4200
- }));
4201
-
4202
- //#endregion
4203
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/toSnakeCaseKeys.mjs
4204
- function toSnakeCaseKeys(obj) {
4205
- if (isArray(obj)) return obj.map((item) => toSnakeCaseKeys(item));
4206
- if (isPlainObject$1(obj)) {
4207
- const result = {};
4208
- const keys = Object.keys(obj);
4209
- for (let i = 0; i < keys.length; i++) {
4210
- const key = keys[i];
4211
- const snakeKey = snakeCase(key);
4212
- result[snakeKey] = toSnakeCaseKeys(obj[key]);
4213
- }
4214
- return result;
4215
- }
4216
- return obj;
4217
- }
4218
- var init_toSnakeCaseKeys = __esmMin((() => {
4219
- init_isArray();
4220
- init_isPlainObject();
4221
- init_snakeCase();
4222
- }));
4223
-
4224
- //#endregion
4225
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isArrayBuffer.mjs
4226
- function isArrayBuffer(value) {
4227
- return value instanceof ArrayBuffer;
4228
- }
4229
- var init_isArrayBuffer = __esmMin((() => {}));
4230
-
4231
- //#endregion
4232
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isBlob.mjs
4233
- function isBlob(x) {
4234
- if (typeof Blob === "undefined") return false;
4235
- return x instanceof Blob;
4236
- }
4237
- var init_isBlob = __esmMin((() => {}));
4238
-
4239
- //#endregion
4240
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isBoolean.mjs
4241
- function isBoolean$1(x) {
4242
- return typeof x === "boolean";
4243
- }
4244
- var init_isBoolean = __esmMin((() => {}));
4245
-
4246
- //#endregion
4247
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isBrowser.mjs
4248
- function isBrowser() {
4249
- return typeof window !== "undefined" && window?.document != null;
4250
- }
4251
- var init_isBrowser = __esmMin((() => {}));
4252
-
4253
- //#endregion
4254
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isBuffer.mjs
4255
- function isBuffer$1(x) {
4256
- return typeof Buffer !== "undefined" && Buffer.isBuffer(x);
4257
- }
4258
- var init_isBuffer = __esmMin((() => {}));
4259
-
4260
- //#endregion
4261
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isDate.mjs
4262
- function isDate(value) {
4263
- return value instanceof Date;
4264
- }
4265
- var init_isDate = __esmMin((() => {}));
4266
-
4267
- //#endregion
4268
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isEmptyObject.mjs
4269
- function isEmptyObject(value) {
4270
- return isPlainObject$2(value) && Object.keys(value).length === 0;
4271
- }
4272
- var init_isEmptyObject = __esmMin((() => {
4273
- init_isPlainObject$1();
4274
- }));
4275
-
4276
- //#endregion
4277
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs
4278
- function isEqualsSameValueZero(value, other) {
4279
- return value === other || Number.isNaN(value) && Number.isNaN(other);
4280
- }
4281
- var init_isEqualsSameValueZero = __esmMin((() => {}));
4282
-
4283
- //#endregion
4284
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
4285
- function isEqualWith(a, b, areValuesEqual) {
4286
- return isEqualWithImpl(a, b, void 0, void 0, void 0, void 0, areValuesEqual);
4287
- }
4288
- function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
4289
- const result = areValuesEqual(a, b, property, aParent, bParent, stack);
4290
- if (result !== void 0) return result;
4291
- if (typeof a === typeof b) switch (typeof a) {
4292
- case "bigint":
4293
- case "string":
4294
- case "boolean":
4295
- case "symbol":
4296
- case "undefined": return a === b;
4297
- case "number": return a === b || Object.is(a, b);
4298
- case "function": return a === b;
4299
- case "object": return areObjectsEqual(a, b, stack, areValuesEqual);
4300
- }
4301
- return areObjectsEqual(a, b, stack, areValuesEqual);
4302
- }
4303
- function areObjectsEqual(a, b, stack, areValuesEqual) {
4304
- if (Object.is(a, b)) return true;
4305
- let aTag = getTag(a);
4306
- let bTag = getTag(b);
4307
- if (aTag === "[object Arguments]") aTag = objectTag;
4308
- if (bTag === "[object Arguments]") bTag = objectTag;
4309
- if (aTag !== bTag) return false;
4310
- switch (aTag) {
4311
- case stringTag: return a.toString() === b.toString();
4312
- case numberTag: return isEqualsSameValueZero(a.valueOf(), b.valueOf());
4313
- case booleanTag:
4314
- case dateTag:
4315
- case symbolTag: return Object.is(a.valueOf(), b.valueOf());
4316
- case regexpTag: return a.source === b.source && a.flags === b.flags;
4317
- case functionTag: return a === b;
4318
- }
4319
- stack = stack ?? /* @__PURE__ */ new Map();
4320
- const aStack = stack.get(a);
4321
- const bStack = stack.get(b);
4322
- if (aStack != null && bStack != null) return aStack === b;
4323
- stack.set(a, b);
4324
- stack.set(b, a);
4325
- try {
4326
- switch (aTag) {
4327
- case mapTag:
4328
- if (a.size !== b.size) return false;
4329
- for (const [key, value] of a.entries()) if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) return false;
4330
- return true;
4331
- case setTag: {
4332
- if (a.size !== b.size) return false;
4333
- const aValues = Array.from(a.values());
4334
- const bValues = Array.from(b.values());
4335
- for (let i = 0; i < aValues.length; i++) {
4336
- const aValue = aValues[i];
4337
- const index = bValues.findIndex((bValue) => {
4338
- return isEqualWithImpl(aValue, bValue, void 0, a, b, stack, areValuesEqual);
4339
- });
4340
- if (index === -1) return false;
4341
- bValues.splice(index, 1);
4342
- }
4343
- return true;
4344
- }
4345
- case arrayTag:
4346
- case uint8ArrayTag:
4347
- case uint8ClampedArrayTag:
4348
- case uint16ArrayTag:
4349
- case uint32ArrayTag:
4350
- case bigUint64ArrayTag:
4351
- case int8ArrayTag:
4352
- case int16ArrayTag:
4353
- case int32ArrayTag:
4354
- case bigInt64ArrayTag:
4355
- case float32ArrayTag:
4356
- case float64ArrayTag:
4357
- if (typeof Buffer !== "undefined" && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) return false;
4358
- if (a.length !== b.length) return false;
4359
- for (let i = 0; i < a.length; i++) if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) return false;
4360
- return true;
4361
- case arrayBufferTag:
4362
- if (a.byteLength !== b.byteLength) return false;
4363
- return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
4364
- case dataViewTag:
4365
- if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) return false;
4366
- return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
4367
- case errorTag: return a.name === b.name && a.message === b.message;
4368
- case objectTag: {
4369
- if (!(areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) || isPlainObject$2(a) && isPlainObject$2(b))) return false;
4370
- const aKeys = [...Object.keys(a), ...getSymbols(a)];
4371
- const bKeys = [...Object.keys(b), ...getSymbols(b)];
4372
- if (aKeys.length !== bKeys.length) return false;
4373
- for (let i = 0; i < aKeys.length; i++) {
4374
- const propKey = aKeys[i];
4375
- const aProp = a[propKey];
4376
- if (!Object.hasOwn(b, propKey)) return false;
4377
- const bProp = b[propKey];
4378
- if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) return false;
4379
- }
4380
- return true;
4381
- }
4382
- default: return false;
4383
- }
4384
- } finally {
4385
- stack.delete(a);
4386
- stack.delete(b);
4387
- }
4388
- }
4389
- var init_isEqualWith = __esmMin((() => {
4390
- init_isPlainObject$1();
4391
- init_getSymbols();
4392
- init_getTag();
4393
- init_tags();
4394
- init_isEqualsSameValueZero();
4395
- }));
4396
-
4397
- //#endregion
4398
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isEqual.mjs
4399
- function isEqual(a, b) {
4400
- return isEqualWith(a, b, noop);
4401
- }
4402
- var init_isEqual = __esmMin((() => {
4403
- init_isEqualWith();
4404
- init_noop();
4405
- }));
4406
-
4407
- //#endregion
4408
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isError.mjs
4409
- function isError(value) {
4410
- return value instanceof Error;
4411
- }
4412
- var init_isError = __esmMin((() => {}));
4413
-
4414
- //#endregion
4415
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isFile.mjs
4416
- function isFile(x) {
4417
- if (typeof File === "undefined") return false;
4418
- return isBlob(x) && x instanceof File;
4419
- }
4420
- var init_isFile = __esmMin((() => {
4421
- init_isBlob();
4422
- }));
4423
-
4424
- //#endregion
4425
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isFunction.mjs
4426
- function isFunction$1(value) {
4427
- return typeof value === "function";
4428
- }
4429
- var init_isFunction = __esmMin((() => {}));
4430
-
4431
- //#endregion
4432
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isJSON.mjs
4433
- function isJSON(value) {
4434
- if (typeof value !== "string") return false;
4435
- try {
4436
- JSON.parse(value);
4437
- return true;
4438
- } catch {
4439
- return false;
4440
- }
4441
- }
4442
- var init_isJSON = __esmMin((() => {}));
4443
-
4444
- //#endregion
4445
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isJSONValue.mjs
4446
- function isJSONValue(value) {
4447
- switch (typeof value) {
4448
- case "object": return value === null || isJSONArray(value) || isJSONObject(value);
4449
- case "string":
4450
- case "number":
4451
- case "boolean": return true;
4452
- default: return false;
4453
- }
4454
- }
4455
- function isJSONArray(value) {
4456
- if (!Array.isArray(value)) return false;
4457
- return value.every((item) => isJSONValue(item));
4458
- }
4459
- function isJSONObject(obj) {
4460
- if (!isPlainObject$2(obj)) return false;
4461
- const keys = Reflect.ownKeys(obj);
4462
- for (let i = 0; i < keys.length; i++) {
4463
- const key = keys[i];
4464
- const value = obj[key];
4465
- if (typeof key !== "string") return false;
4466
- if (!isJSONValue(value)) return false;
4467
- }
4468
- return true;
4469
- }
4470
- var init_isJSONValue = __esmMin((() => {
4471
- init_isPlainObject$1();
4472
- }));
4473
-
4474
- //#endregion
4475
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isLength.mjs
4476
- function isLength(value) {
4477
- return Number.isSafeInteger(value) && value >= 0;
4478
- }
4479
- var init_isLength = __esmMin((() => {}));
4480
-
4481
- //#endregion
4482
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isMap.mjs
4483
- function isMap(value) {
4484
- return value instanceof Map;
4485
- }
4486
- var init_isMap = __esmMin((() => {}));
4487
-
4488
- //#endregion
4489
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isNil.mjs
4490
- function isNil(x) {
4491
- return x == null;
4492
- }
4493
- var init_isNil = __esmMin((() => {}));
4494
-
4495
- //#endregion
4496
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isNode.mjs
4497
- function isNode() {
4498
- return typeof process !== "undefined" && process?.versions?.node != null;
4499
- }
4500
- var init_isNode = __esmMin((() => {}));
4501
-
4502
- //#endregion
4503
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isNotNil.mjs
4504
- function isNotNil(x) {
4505
- return x != null;
4506
- }
4507
- var init_isNotNil = __esmMin((() => {}));
4508
-
4509
- //#endregion
4510
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isNull.mjs
4511
- function isNull(x) {
4512
- return x === null;
4513
- }
4514
- var init_isNull = __esmMin((() => {}));
4515
-
4516
- //#endregion
4517
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isNumber.mjs
4518
- function isNumber(x) {
4519
- return typeof x === "number" || x instanceof Number;
4520
- }
4521
- var init_isNumber = __esmMin((() => {}));
4522
-
4523
- //#endregion
4524
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPromise.mjs
4525
- function isPromise$1(value) {
4526
- return value instanceof Promise;
4527
- }
4528
- var init_isPromise = __esmMin((() => {}));
4529
-
4530
- //#endregion
4531
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isRegExp.mjs
4532
- function isRegExp(value) {
4533
- return value instanceof RegExp;
4534
- }
4535
- var init_isRegExp = __esmMin((() => {}));
4536
-
4537
- //#endregion
4538
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isSet.mjs
4539
- function isSet(value) {
4540
- return value instanceof Set;
4541
- }
4542
- var init_isSet = __esmMin((() => {}));
4543
-
4544
- //#endregion
4545
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isString.mjs
4546
- function isString(value) {
4547
- return typeof value === "string";
4548
- }
4549
- var init_isString = __esmMin((() => {}));
4550
-
4551
- //#endregion
4552
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isSymbol.mjs
4553
- function isSymbol(value) {
4554
- return typeof value === "symbol";
4555
- }
4556
- var init_isSymbol = __esmMin((() => {}));
4557
-
4558
- //#endregion
4559
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isUndefined.mjs
4560
- function isUndefined(x) {
4561
- return x === void 0;
4562
- }
4563
- var init_isUndefined = __esmMin((() => {}));
4564
-
4565
- //#endregion
4566
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isWeakMap.mjs
4567
- function isWeakMap(value) {
4568
- return value instanceof WeakMap;
4569
- }
4570
- var init_isWeakMap = __esmMin((() => {}));
4571
-
4572
- //#endregion
4573
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isWeakSet.mjs
4574
- function isWeakSet(value) {
4575
- return value instanceof WeakSet;
4576
- }
4577
- var init_isWeakSet = __esmMin((() => {}));
4578
-
4579
- //#endregion
4580
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/promise/mutex.mjs
4581
- var Mutex;
4582
- var init_mutex = __esmMin((() => {
4583
- init_semaphore();
4584
- Mutex = class {
4585
- semaphore = new Semaphore(1);
4586
- get isLocked() {
4587
- return this.semaphore.available === 0;
4588
- }
4589
- async acquire() {
4590
- return this.semaphore.acquire();
4591
- }
4592
- release() {
4593
- this.semaphore.release();
4594
- }
4595
- };
4596
- }));
4597
-
4598
- //#endregion
4599
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/promise/timeout.mjs
4600
- async function timeout(ms) {
4601
- await delay(ms);
4602
- throw new TimeoutError();
4603
- }
4604
- var init_timeout = __esmMin((() => {
4605
- init_delay();
4606
- init_TimeoutError();
4607
- }));
4608
-
4609
- //#endregion
4610
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/promise/withTimeout.mjs
4611
- async function withTimeout(run, ms) {
4612
- return Promise.race([run(), timeout(ms)]);
4613
- }
4614
- var init_withTimeout = __esmMin((() => {
4615
- init_timeout();
4616
- }));
4617
-
4618
- //#endregion
4619
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/constantCase.mjs
4620
- function constantCase(str) {
4621
- return words(str).map((word) => word.toUpperCase()).join("_");
4622
- }
4623
- var init_constantCase = __esmMin((() => {
4624
- init_words();
4625
- }));
4626
-
4627
- //#endregion
4628
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/deburr.mjs
4629
- function deburr(str) {
4630
- str = str.normalize("NFD");
4631
- let result = "";
4632
- for (let i = 0; i < str.length; i++) {
4633
- const char = str[i];
4634
- if (char >= "̀" && char <= "ͯ" || char >= "︠" && char <= "︣") continue;
4635
- result += deburrMap.get(char) ?? char;
4636
- }
4637
- return result;
4638
- }
4639
- var deburrMap;
4640
- var init_deburr = __esmMin((() => {
4641
- deburrMap = new Map([
4642
- ["Æ", "Ae"],
4643
- ["Ð", "D"],
4644
- ["Ø", "O"],
4645
- ["Þ", "Th"],
4646
- ["ß", "ss"],
4647
- ["æ", "ae"],
4648
- ["ð", "d"],
4649
- ["ø", "o"],
4650
- ["þ", "th"],
4651
- ["Đ", "D"],
4652
- ["đ", "d"],
4653
- ["Ħ", "H"],
4654
- ["ħ", "h"],
4655
- ["ı", "i"],
4656
- ["IJ", "IJ"],
4657
- ["ij", "ij"],
4658
- ["ĸ", "k"],
4659
- ["Ŀ", "L"],
4660
- ["ŀ", "l"],
4661
- ["Ł", "L"],
4662
- ["ł", "l"],
4663
- ["ʼn", "'n"],
4664
- ["Ŋ", "N"],
4665
- ["ŋ", "n"],
4666
- ["Œ", "Oe"],
4667
- ["œ", "oe"],
4668
- ["Ŧ", "T"],
4669
- ["ŧ", "t"],
4670
- ["ſ", "s"]
4671
- ]);
4672
- }));
4673
-
4674
- //#endregion
4675
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/escape.mjs
4676
- function escape(str) {
4677
- return str.replace(/[&<>"']/g, (match) => htmlEscapes[match]);
4678
- }
4679
- var htmlEscapes;
4680
- var init_escape = __esmMin((() => {
4681
- htmlEscapes = {
4682
- "&": "&amp;",
4683
- "<": "&lt;",
4684
- ">": "&gt;",
4685
- "\"": "&quot;",
4686
- "'": "&#39;"
4687
- };
4688
- }));
4689
-
4690
- //#endregion
4691
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/escapeRegExp.mjs
4692
- function escapeRegExp(str) {
4693
- return str.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
4694
- }
4695
- var init_escapeRegExp = __esmMin((() => {}));
4696
-
4697
- //#endregion
4698
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/kebabCase.mjs
4699
- function kebabCase(str) {
4700
- return words(str).map((word) => word.toLowerCase()).join("-");
4701
- }
4702
- var init_kebabCase = __esmMin((() => {
4703
- init_words();
4704
- }));
4705
-
4706
- //#endregion
4707
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/lowerCase.mjs
4708
- function lowerCase(str) {
4709
- return words(str).map((word) => word.toLowerCase()).join(" ");
4710
- }
4711
- var init_lowerCase = __esmMin((() => {
4712
- init_words();
4713
- }));
4714
-
4715
- //#endregion
4716
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/lowerFirst.mjs
4717
- function lowerFirst(str) {
4718
- return str.substring(0, 1).toLowerCase() + str.substring(1);
4719
- }
4720
- var init_lowerFirst = __esmMin((() => {}));
4721
-
4722
- //#endregion
4723
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/pad.mjs
4724
- function pad(str, length, chars = " ") {
4725
- return str.padStart(Math.floor((length - str.length) / 2) + str.length, chars).padEnd(length, chars);
4726
- }
4727
- var init_pad = __esmMin((() => {}));
4728
-
4729
- //#endregion
4730
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/pascalCase.mjs
4731
- function pascalCase(str) {
4732
- return words(str).map((word) => capitalize(word)).join("");
4733
- }
4734
- var init_pascalCase = __esmMin((() => {
4735
- init_capitalize();
4736
- init_words();
2140
+ }
2141
+ case "cancel": {
2142
+ const u = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", l = r ? styleText("gray", h$3) : "";
2143
+ return `${s}${l}${u}${o.trim() ? `
2144
+ ${l}` : ""}`;
2145
+ }
2146
+ default: return `${s}${r ? `${styleText("cyan", h$3)} ` : ""}${a}
2147
+ ${r ? styleText("cyan", x$2) : ""}
2148
+ `;
2149
+ }
2150
+ }
2151
+ }).prompt();
4737
2152
  }));
4738
2153
 
4739
2154
  //#endregion
4740
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/reverseString.mjs
4741
- function reverseString(value) {
4742
- return [...value].reverse().join("");
4743
- }
4744
- var init_reverseString = __esmMin((() => {}));
4745
-
4746
- //#endregion
4747
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/startCase.mjs
4748
- function startCase(str) {
4749
- const words$1 = words(str.trim());
4750
- let result = "";
4751
- for (let i = 0; i < words$1.length; i++) {
4752
- const word = words$1[i];
4753
- if (result) result += " ";
4754
- result += word[0].toUpperCase() + word.slice(1).toLowerCase();
4755
- }
4756
- return result;
2155
+ //#region ../../node_modules/.pnpm/@kidd-cli+core@0.10.0_chokidar@5.0.0_jiti@2.6.1_magicast@0.5.2_vitest@4.1.0_@opentelemetry+ap_h5jt7i6rdfwaknd5di57zdj5zy/node_modules/@kidd-cli/core/dist/lib/logger.js
2156
+ /**
2157
+ * Create a new {@link CliLogger} instance.
2158
+ *
2159
+ * @param options - Logger configuration.
2160
+ * @returns A CliLogger wired to the given output stream.
2161
+ */
2162
+ function createCliLogger(options = {}) {
2163
+ const output = options.output ?? process.stderr;
2164
+ return {
2165
+ check(input) {
2166
+ output.write(`${formatCheck(input)}\n`);
2167
+ },
2168
+ error(message) {
2169
+ R$1.error(message);
2170
+ },
2171
+ finding(input) {
2172
+ output.write(`${formatFinding(input)}\n\n`);
2173
+ },
2174
+ info(message) {
2175
+ R$1.info(message);
2176
+ },
2177
+ intro(title) {
2178
+ Wt$1(title);
2179
+ },
2180
+ message(message, opts) {
2181
+ R$1.message(message, opts);
2182
+ },
2183
+ newline() {
2184
+ output.write("\n");
2185
+ },
2186
+ note(message, title) {
2187
+ Vt$1(message, title);
2188
+ },
2189
+ outro(message) {
2190
+ Gt$1(message);
2191
+ },
2192
+ print(text) {
2193
+ output.write(`${text}\n`);
2194
+ },
2195
+ step(message) {
2196
+ R$1.step(message);
2197
+ },
2198
+ success(message) {
2199
+ R$1.success(message);
2200
+ },
2201
+ tally(input) {
2202
+ output.write(`\n${formatTally(input)}\n`);
2203
+ },
2204
+ warn(message) {
2205
+ R$1.warn(message);
2206
+ }
2207
+ };
4757
2208
  }
4758
- var init_startCase = __esmMin((() => {
4759
- init_words();
2209
+ var cliLogger;
2210
+ var init_logger = __esmMin((() => {
2211
+ init_tally_KfEitTrZ();
2212
+ init_dist$8();
2213
+ cliLogger = createCliLogger();
4760
2214
  }));
4761
2215
 
4762
2216
  //#endregion
4763
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/trimEnd.mjs
4764
- function trimEnd(str, chars) {
4765
- if (chars === void 0) return str.trimEnd();
4766
- let endIndex = str.length;
4767
- switch (typeof chars) {
4768
- case "string":
4769
- if (chars.length !== 1) throw new Error(`The 'chars' parameter should be a single character string.`);
4770
- while (endIndex > 0 && str[endIndex - 1] === chars) endIndex--;
4771
- break;
4772
- case "object": while (endIndex > 0 && chars.includes(str[endIndex - 1])) endIndex--;
4773
- }
4774
- return str.substring(0, endIndex);
4775
- }
4776
- var init_trimEnd = __esmMin((() => {}));
4777
-
4778
- //#endregion
4779
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/trimStart.mjs
4780
- function trimStart(str, chars) {
4781
- if (chars === void 0) return str.trimStart();
4782
- let startIndex = 0;
4783
- switch (typeof chars) {
4784
- case "string":
4785
- while (startIndex < str.length && str[startIndex] === chars) startIndex++;
4786
- break;
4787
- case "object": while (startIndex < str.length && chars.includes(str[startIndex])) startIndex++;
4788
- }
4789
- return str.substring(startIndex);
2217
+ //#region ../../node_modules/.pnpm/@kidd-cli+utils@0.1.5/node_modules/@kidd-cli/utils/dist/tag.js
2218
+ /**
2219
+ * Create a shallow copy of `obj` with a non-enumerable {@link TAG} property.
2220
+ *
2221
+ * The original object is not mutated. The tag is defined as non-enumerable,
2222
+ * non-writable, and non-configurable via `Object.defineProperty`.
2223
+ *
2224
+ * @param obj - The source object to copy and tag.
2225
+ * @param tag - The tag string to brand the copy with.
2226
+ * @returns A new object with all own enumerable properties of `obj` plus the hidden tag.
2227
+ */
2228
+ function withTag(obj, tag) {
2229
+ const copy = { ...obj };
2230
+ Object.defineProperty(copy, TAG, {
2231
+ configurable: false,
2232
+ enumerable: false,
2233
+ value: tag,
2234
+ writable: false
2235
+ });
2236
+ return copy;
4790
2237
  }
4791
- var init_trimStart = __esmMin((() => {}));
4792
-
4793
- //#endregion
4794
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/trim.mjs
4795
- function trim(str, chars) {
4796
- if (chars === void 0) return str.trim();
4797
- return trimStart(trimEnd(str, chars), chars);
4798
- }
4799
- var init_trim = __esmMin((() => {
4800
- init_trimEnd();
4801
- init_trimStart();
4802
- }));
4803
-
4804
- //#endregion
4805
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/unescape.mjs
4806
- function unescape(str) {
4807
- return str.replace(/&(?:amp|lt|gt|quot|#(0+)?39);/g, (match) => htmlUnescapes[match] || "'");
4808
- }
4809
- var htmlUnescapes;
4810
- var init_unescape = __esmMin((() => {
4811
- htmlUnescapes = {
4812
- "&amp;": "&",
4813
- "&lt;": "<",
4814
- "&gt;": ">",
4815
- "&quot;": "\"",
4816
- "&#39;": "'"
4817
- };
4818
- }));
4819
-
4820
- //#endregion
4821
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/upperCase.mjs
4822
- function upperCase(str) {
4823
- const words$1 = words(str);
4824
- let result = "";
4825
- for (let i = 0; i < words$1.length; i++) {
4826
- result += words$1[i].toUpperCase();
4827
- if (i < words$1.length - 1) result += " ";
4828
- }
4829
- return result;
2238
+ /**
2239
+ * Type guard that checks whether `value` carries the given tag.
2240
+ *
2241
+ * @param value - The value to inspect.
2242
+ * @param tag - The expected tag string.
2243
+ * @returns `true` when `value` is a non-null object whose `[TAG]` equals `tag`.
2244
+ */
2245
+ function hasTag(value, tag) {
2246
+ if (typeof value !== "object" || value === null) return false;
2247
+ return value[TAG] === tag;
4830
2248
  }
4831
- var init_upperCase = __esmMin((() => {
4832
- init_words();
2249
+ var TAG;
2250
+ var init_tag = __esmMin((() => {
2251
+ TAG = Symbol("kidd.tag");
4833
2252
  }));
4834
2253
 
4835
2254
  //#endregion
4836
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/string/upperFirst.mjs
4837
- function upperFirst(str) {
4838
- return str.substring(0, 1).toUpperCase() + str.substring(1);
4839
- }
4840
- var init_upperFirst = __esmMin((() => {}));
4841
-
4842
- //#endregion
4843
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/util/attempt.mjs
4844
- function attempt(func) {
4845
- try {
4846
- return [null, func()];
4847
- } catch (error) {
4848
- return [error, null];
4849
- }
2255
+ //#region ../../node_modules/.pnpm/@kidd-cli+utils@0.1.5/node_modules/@kidd-cli/utils/dist/result-U5VP3FRv.js
2256
+ /**
2257
+ * Normalize an unknown caught value into an Error instance.
2258
+ *
2259
+ * If already an Error, returns it as-is. Otherwise wraps via `new Error(String(value))`.
2260
+ *
2261
+ * @param value - The unknown value to normalize.
2262
+ * @returns An Error instance.
2263
+ */
2264
+ function toError(value) {
2265
+ if (value instanceof Error) return value;
2266
+ return new Error(String(value));
4850
2267
  }
4851
- var init_attempt = __esmMin((() => {}));
4852
-
4853
- //#endregion
4854
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/util/attemptAsync.mjs
4855
- async function attemptAsync(func) {
4856
- try {
4857
- return [null, await func()];
4858
- } catch (error) {
4859
- return [error, null];
4860
- }
2268
+ function ok(value) {
2269
+ return [null, value];
4861
2270
  }
4862
- var init_attemptAsync = __esmMin((() => {}));
4863
-
4864
- //#endregion
4865
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/util/invariant.mjs
4866
- function invariant(condition, message) {
4867
- if (condition) return;
4868
- if (typeof message === "string") throw new Error(message);
4869
- throw message;
2271
+ /**
2272
+ * Construct a failure Result tuple.
2273
+ *
2274
+ * Coerces any value to an `Error` via {@link toError} and returns `[Error, null]`.
2275
+ * For domain-specific error types (e.g. `AuthError`, `IconsError`), use raw
2276
+ * tuple literals instead: `[domainError, null] as const`.
2277
+ *
2278
+ * @param error - The error value (coerced to Error).
2279
+ * @returns A Result tuple `[Error, null]`.
2280
+ */
2281
+ function err(error) {
2282
+ return [toError(error), null];
4870
2283
  }
4871
- var init_invariant = __esmMin((() => {}));
4872
-
4873
- //#endregion
4874
- //#region ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/index.mjs
4875
- var init_dist$8 = __esmMin((() => {
4876
- init_at();
4877
- init_chunk();
4878
- init_compact();
4879
- init_countBy();
4880
- init_difference();
4881
- init_differenceBy();
4882
- init_differenceWith();
4883
- init_drop();
4884
- init_dropRight();
4885
- init_dropRightWhile();
4886
- init_dropWhile();
4887
- init_fill();
4888
- init_filterAsync();
4889
- init_flatMap();
4890
- init_flatMapAsync();
4891
- init_flatMapDeep();
4892
- init_flatten$1();
4893
- init_flattenDeep();
4894
- init_forEachAsync();
4895
- init_forEachRight();
4896
- init_groupBy();
4897
- init_head();
4898
- init_initial();
4899
- init_intersection();
4900
- init_intersectionBy();
4901
- init_intersectionWith();
4902
- init_isSubset();
4903
- init_isSubsetWith();
4904
- init_keyBy();
4905
- init_last();
4906
- init_limitAsync();
4907
- init_mapAsync();
4908
- init_maxBy();
4909
- init_minBy();
4910
- init_orderBy();
4911
- init_partition();
4912
- init_pull();
4913
- init_pullAt();
4914
- init_reduceAsync();
4915
- init_remove();
4916
- init_sample();
4917
- init_sampleSize();
4918
- init_shuffle();
4919
- init_sortBy();
4920
- init_tail();
4921
- init_take();
4922
- init_takeRight();
4923
- init_takeRightWhile();
4924
- init_takeWhile();
4925
- init_toFilled();
4926
- init_union();
4927
- init_unionBy();
4928
- init_unionWith();
4929
- init_uniq();
4930
- init_uniqBy();
4931
- init_uniqWith();
4932
- init_unzip();
4933
- init_unzipWith();
4934
- init_windowed();
4935
- init_without();
4936
- init_xor();
4937
- init_xorBy();
4938
- init_xorWith();
4939
- init_zip();
4940
- init_zipObject();
4941
- init_zipWith();
4942
- init_AbortError();
4943
- init_TimeoutError();
4944
- init_after();
4945
- init_ary();
4946
- init_asyncNoop();
4947
- init_before();
4948
- init_curry();
4949
- init_curryRight();
4950
- init_debounce();
4951
- init_flow();
4952
- init_flowRight();
4953
- init_identity();
4954
- init_memoize();
4955
- init_negate();
4956
- init_noop();
4957
- init_once();
4958
- init_partial();
4959
- init_partialRight();
4960
- init_rest();
4961
- init_retry();
4962
- init_spread();
4963
- init_throttle();
4964
- init_unary();
4965
- init_clamp();
4966
- init_inRange();
4967
- init_mean();
4968
- init_meanBy();
4969
- init_median();
4970
- init_medianBy();
4971
- init_random();
4972
- init_randomInt();
4973
- init_range();
4974
- init_rangeRight();
4975
- init_round();
4976
- init_sum();
4977
- init_sumBy();
4978
- init_clone();
4979
- init_cloneDeep();
4980
- init_cloneDeepWith();
4981
- init_findKey();
4982
- init_flattenObject();
4983
- init_invert();
4984
- init_mapKeys();
4985
- init_mapValues();
4986
- init_merge();
4987
- init_mergeWith();
4988
- init_omit();
4989
- init_omitBy();
4990
- init_pick();
4991
- init_pickBy();
4992
- init_toCamelCaseKeys();
4993
- init_toMerged();
4994
- init_toSnakeCaseKeys();
4995
- init_isArrayBuffer();
4996
- init_isBlob();
4997
- init_isBoolean();
4998
- init_isBrowser();
4999
- init_isBuffer();
5000
- init_isDate();
5001
- init_isEmptyObject();
5002
- init_isEqual();
5003
- init_isEqualWith();
5004
- init_isError();
5005
- init_isFile();
5006
- init_isFunction();
5007
- init_isJSON();
5008
- init_isJSONValue();
5009
- init_isLength();
5010
- init_isMap();
5011
- init_isNil();
5012
- init_isNode();
5013
- init_isNotNil();
5014
- init_isNull();
5015
- init_isNumber();
5016
- init_isPlainObject$1();
5017
- init_isPrimitive();
5018
- init_isPromise();
5019
- init_isRegExp();
5020
- init_isSet();
5021
- init_isString();
5022
- init_isSymbol();
5023
- init_isTypedArray();
5024
- init_isUndefined();
5025
- init_isWeakMap();
5026
- init_isWeakSet();
5027
- init_delay();
5028
- init_mutex();
5029
- init_semaphore();
5030
- init_timeout();
5031
- init_withTimeout();
5032
- init_camelCase();
5033
- init_capitalize();
5034
- init_constantCase();
5035
- init_deburr();
5036
- init_escape();
5037
- init_escapeRegExp();
5038
- init_kebabCase();
5039
- init_lowerCase();
5040
- init_lowerFirst();
5041
- init_pad();
5042
- init_pascalCase();
5043
- init_reverseString();
5044
- init_snakeCase();
5045
- init_startCase();
5046
- init_trim();
5047
- init_trimEnd();
5048
- init_trimStart();
5049
- init_unescape();
5050
- init_upperCase();
5051
- init_upperFirst();
5052
- init_words();
5053
- init_attempt();
5054
- init_attemptAsync();
5055
- init_invariant();
5056
- }));
2284
+ var init_result_U5VP3FRv = __esmMin((() => {}));
5057
2285
 
5058
2286
  //#endregion
5059
2287
  //#region ../../node_modules/.pnpm/@kidd-cli+utils@0.1.5/node_modules/@kidd-cli/utils/dist/json.js
@@ -5076,7 +2304,6 @@ function jsonStringify(data, options = {}) {
5076
2304
  var JSON_INDENT;
5077
2305
  var init_json$1 = __esmMin((() => {
5078
2306
  init_result_U5VP3FRv();
5079
- init_dist$8();
5080
2307
  JSON_INDENT = 2;
5081
2308
  }));
5082
2309
 
@@ -5351,7 +2578,7 @@ function createContext(options) {
5351
2578
  var import_picocolors;
5352
2579
  var init_create_context_vWwSL8R5 = __esmMin((() => {
5353
2580
  init_logger();
5354
- init_dist$9();
2581
+ init_dist$8();
5355
2582
  import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
5356
2583
  init_tag();
5357
2584
  init_json$1();
@@ -5360,198 +2587,16 @@ var init_create_context_vWwSL8R5 = __esmMin((() => {
5360
2587
  //#endregion
5361
2588
  //#region ../../node_modules/.pnpm/@kidd-cli+utils@0.1.5/node_modules/@kidd-cli/utils/dist/fp.js
5362
2589
  var fp_exports = /* @__PURE__ */ __exportAll$1({
5363
- AbortError: () => AbortError,
5364
- Mutex: () => Mutex,
5365
- Semaphore: () => Semaphore,
5366
- TimeoutError: () => TimeoutError,
5367
- after: () => after,
5368
- ary: () => ary,
5369
- assert: () => invariant,
5370
- asyncNoop: () => asyncNoop,
5371
- at: () => at$1,
5372
- attempt: () => attempt,
5373
- attemptAsync: () => attemptAsync,
5374
- before: () => before,
5375
- camelCase: () => camelCase$1,
5376
- capitalize: () => capitalize,
5377
- chunk: () => chunk,
5378
- clamp: () => clamp,
5379
- clone: () => clone,
5380
- cloneDeep: () => cloneDeep,
5381
- cloneDeepWith: () => cloneDeepWith,
5382
- compact: () => compact,
5383
- constantCase: () => constantCase,
5384
- countBy: () => countBy,
5385
- curry: () => curry,
5386
- curryRight: () => curryRight,
5387
- debounce: () => debounce,
5388
- deburr: () => deburr,
5389
- delay: () => delay,
5390
- difference: () => difference,
5391
- differenceBy: () => differenceBy,
5392
- differenceWith: () => differenceWith,
5393
- drop: () => drop,
5394
- dropRight: () => dropRight,
5395
- dropRightWhile: () => dropRightWhile,
5396
- dropWhile: () => dropWhile,
5397
2590
  err: () => err,
5398
- escape: () => escape,
5399
- escapeRegExp: () => escapeRegExp,
5400
- fill: () => fill,
5401
- filterAsync: () => filterAsync,
5402
- findKey: () => findKey,
5403
- flatMap: () => flatMap,
5404
- flatMapAsync: () => flatMapAsync,
5405
- flatMapDeep: () => flatMapDeep,
5406
- flatten: () => flatten$1,
5407
- flattenDeep: () => flattenDeep,
5408
- flattenObject: () => flattenObject,
5409
- flow: () => flow,
5410
- flowRight: () => flowRight,
5411
- forEachAsync: () => forEachAsync,
5412
- forEachRight: () => forEachRight,
5413
- groupBy: () => groupBy,
5414
- head: () => head,
5415
- identity: () => identity,
5416
- inRange: () => inRange,
5417
- initial: () => initial,
5418
- intersection: () => intersection,
5419
- intersectionBy: () => intersectionBy,
5420
- intersectionWith: () => intersectionWith,
5421
- invariant: () => invariant,
5422
- invert: () => invert,
5423
- isArrayBuffer: () => isArrayBuffer,
5424
- isBlob: () => isBlob,
5425
- isBoolean: () => isBoolean$1,
5426
- isBrowser: () => isBrowser,
5427
- isBuffer: () => isBuffer$1,
5428
- isDate: () => isDate,
5429
- isEmptyObject: () => isEmptyObject,
5430
- isEqual: () => isEqual,
5431
- isEqualWith: () => isEqualWith,
5432
- isError: () => isError,
5433
- isFile: () => isFile,
5434
- isFunction: () => isFunction$1,
5435
- isJSON: () => isJSON,
5436
- isJSONArray: () => isJSONArray,
5437
- isJSONObject: () => isJSONObject,
5438
- isJSONValue: () => isJSONValue,
5439
- isLength: () => isLength,
5440
- isMap: () => isMap,
5441
- isNil: () => isNil,
5442
- isNode: () => isNode,
5443
- isNotNil: () => isNotNil,
5444
- isNull: () => isNull,
5445
- isNumber: () => isNumber,
5446
- isPlainObject: () => isPlainObject$2,
5447
- isPrimitive: () => isPrimitive,
5448
- isPromise: () => isPromise$1,
5449
- isRegExp: () => isRegExp,
5450
- isSet: () => isSet,
5451
- isString: () => isString,
5452
- isSubset: () => isSubset,
5453
- isSubsetWith: () => isSubsetWith,
5454
- isSymbol: () => isSymbol,
5455
- isTypedArray: () => isTypedArray,
5456
- isUndefined: () => isUndefined,
5457
- isWeakMap: () => isWeakMap,
5458
- isWeakSet: () => isWeakSet,
5459
- kebabCase: () => kebabCase,
5460
- keyBy: () => keyBy,
5461
- last: () => last,
5462
- limitAsync: () => limitAsync,
5463
- lowerCase: () => lowerCase,
5464
- lowerFirst: () => lowerFirst,
5465
- mapAsync: () => mapAsync,
5466
- mapKeys: () => mapKeys,
5467
- mapValues: () => mapValues,
5468
- maxBy: () => maxBy,
5469
- mean: () => mean,
5470
- meanBy: () => meanBy,
5471
- median: () => median,
5472
- medianBy: () => medianBy,
5473
- memoize: () => memoize,
5474
- merge: () => merge,
5475
- mergeWith: () => mergeWith,
5476
- minBy: () => minBy,
5477
- negate: () => negate,
5478
- noop: () => noop,
5479
2591
  ok: () => ok,
5480
- omit: () => omit,
5481
- omitBy: () => omitBy,
5482
- once: () => once,
5483
- orderBy: () => orderBy,
5484
- pad: () => pad,
5485
- partial: () => partial,
5486
- partialRight: () => partialRight,
5487
- partition: () => partition,
5488
- pascalCase: () => pascalCase,
5489
- pick: () => pick,
5490
- pickBy: () => pickBy,
5491
- pull: () => pull,
5492
- pullAt: () => pullAt,
5493
- random: () => random,
5494
- randomInt: () => randomInt,
5495
- range: () => range,
5496
- rangeRight: () => rangeRight,
5497
- reduceAsync: () => reduceAsync,
5498
- remove: () => remove,
5499
- rest: () => rest,
5500
- retry: () => retry,
5501
- reverseString: () => reverseString,
5502
- round: () => round,
5503
- sample: () => sample,
5504
- sampleSize: () => sampleSize,
5505
- shuffle: () => shuffle,
5506
- snakeCase: () => snakeCase,
5507
- sortBy: () => sortBy,
5508
- spread: () => spread,
5509
- startCase: () => startCase,
5510
- sum: () => sum,
5511
- sumBy: () => sumBy,
5512
- tail: () => tail,
5513
- take: () => take,
5514
- takeRight: () => takeRight,
5515
- takeRightWhile: () => takeRightWhile,
5516
- takeWhile: () => takeWhile,
5517
- throttle: () => throttle,
5518
- timeout: () => timeout,
5519
- toCamelCaseKeys: () => toCamelCaseKeys,
5520
- toError: () => toError,
5521
- toFilled: () => toFilled,
5522
- toMerged: () => toMerged,
5523
- toSnakeCaseKeys: () => toSnakeCaseKeys,
5524
- trim: () => trim,
5525
- trimEnd: () => trimEnd,
5526
- trimStart: () => trimStart,
5527
- unary: () => unary,
5528
- unescape: () => unescape,
5529
- union: () => union,
5530
- unionBy: () => unionBy,
5531
- unionWith: () => unionWith,
5532
- uniq: () => uniq,
5533
- uniqBy: () => uniqBy,
5534
- uniqWith: () => uniqWith,
5535
- unzip: () => unzip,
5536
- unzipWith: () => unzipWith,
5537
- upperCase: () => upperCase,
5538
- upperFirst: () => upperFirst,
5539
- windowed: () => windowed,
5540
- withTimeout: () => withTimeout,
5541
- without: () => without,
5542
- words: () => words,
5543
- xor: () => xor,
5544
- xorBy: () => xorBy,
5545
- xorWith: () => xorWith,
5546
- zip: () => zip,
5547
- zipObject: () => zipObject,
5548
- zipWith: () => zipWith
2592
+ toError: () => toError
5549
2593
  });
2594
+ import * as import_es_toolkit from "es-toolkit";
2595
+ __reExport(fp_exports, import_es_toolkit);
5550
2596
  import * as import_ts_pattern from "ts-pattern";
5551
2597
  __reExport(fp_exports, import_ts_pattern);
5552
2598
  var init_fp = __esmMin((() => {
5553
2599
  init_result_U5VP3FRv();
5554
- init_dist$8();
5555
2600
  }));
5556
2601
 
5557
2602
  //#endregion
@@ -6887,7 +3932,7 @@ var init_dist$5 = __esmMin((() => {
6887
3932
 
6888
3933
  //#endregion
6889
3934
  //#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
6890
- function isPlainObject(value) {
3935
+ function isPlainObject$1(value) {
6891
3936
  if (value === null || typeof value !== "object") return false;
6892
3937
  const prototype = Object.getPrototypeOf(value);
6893
3938
  if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
@@ -6896,7 +3941,7 @@ function isPlainObject(value) {
6896
3941
  return true;
6897
3942
  }
6898
3943
  function _defu(baseObject, defaults, namespace = ".", merger) {
6899
- if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
3944
+ if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
6900
3945
  const object = Object.assign({}, defaults);
6901
3946
  for (const key in baseObject) {
6902
3947
  if (key === "__proto__" || key === "constructor") continue;
@@ -6904,7 +3949,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
6904
3949
  if (value === null || value === void 0) continue;
6905
3950
  if (merger && merger(object, key, value, namespace)) continue;
6906
3951
  if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
6907
- else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
3952
+ else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
6908
3953
  else object[key] = value;
6909
3954
  }
6910
3955
  return object;
@@ -15625,7 +12670,7 @@ function serializeJson(data) {
15625
12670
  * @returns A ConfigOperationResult with the YAML string or a serialization error.
15626
12671
  */
15627
12672
  function serializeYaml(data) {
15628
- const [yamlError, yaml] = attempt(() => stringify(data));
12673
+ const [yamlError, yaml] = (0, fp_exports.attempt)(() => stringify(data));
15629
12674
  if (yamlError) return err(`Failed to serialize config as YAML: ${String(yamlError)}`);
15630
12675
  return ok(yaml);
15631
12676
  }
@@ -15651,7 +12696,7 @@ function createConfigClient(options) {
15651
12696
  * @returns The c12 result, or null if nothing was found.
15652
12697
  */
15653
12698
  async function resolveFromDir(cwd, configFile) {
15654
- const [loadError, loaded] = await attemptAsync(() => loadConfig$1({
12699
+ const [loadError, loaded] = await (0, fp_exports.attemptAsync)(() => loadConfig$1({
15655
12700
  configFile,
15656
12701
  cwd,
15657
12702
  dotenv: false,
@@ -15756,9 +12801,9 @@ function createConfigClient(options) {
15756
12801
  });
15757
12802
  const [serializeError, serialized] = serializeContent(validated, resolvedFormat);
15758
12803
  if (serializeError) return err(serializeError);
15759
- const [mkdirError] = await attemptAsync(() => mkdir(dirname(resolvedFilePath), { recursive: true }));
12804
+ const [mkdirError] = await (0, fp_exports.attemptAsync)(() => mkdir(dirname(resolvedFilePath), { recursive: true }));
15760
12805
  if (mkdirError) return err(`Failed to create directory for ${resolvedFilePath}: ${String(mkdirError)}`);
15761
- const [writeError] = await attemptAsync(() => writeFile(resolvedFilePath, serialized, "utf8"));
12806
+ const [writeError] = await (0, fp_exports.attemptAsync)(() => writeFile(resolvedFilePath, serialized, "utf8"));
15762
12807
  if (writeError) return err(`Failed to write config to ${resolvedFilePath}: ${String(writeError)}`);
15763
12808
  return ok({
15764
12809
  filePath: resolvedFilePath,
@@ -15894,7 +12939,6 @@ var init_loader = __esmMin((() => {
15894
12939
  init_tag();
15895
12940
  init_fp();
15896
12941
  init_dist$1();
15897
- init_dist$8();
15898
12942
  init_validate$2();
15899
12943
  CompileTargetSchema = z.enum([
15900
12944
  "darwin-arm64",
@@ -21286,6 +18330,16 @@ function toCamelCase(name) {
21286
18330
  function escapeTemplateLiteral(str) {
21287
18331
  return str.replaceAll("\\", String.raw`\\`).replaceAll("`", "\\`").replaceAll("${", "\\${");
21288
18332
  }
18333
+ /** @private */
18334
+ function formatGroupValue(group) {
18335
+ if (group) return `'${group}' as const`;
18336
+ return "undefined";
18337
+ }
18338
+ /** @private */
18339
+ function parseGroupSegments(group) {
18340
+ if (group) return group.split("/").map(toCamelCase);
18341
+ return [];
18342
+ }
21289
18343
  /**
21290
18344
  * Generate the Zod schema expression for a list of schema variables.
21291
18345
  *
@@ -21295,10 +18349,7 @@ function generateSchemaExpression(vars) {
21295
18349
  if (vars.length === 0) return "z.object({})";
21296
18350
  return `z.object({\n${vars.map((v) => {
21297
18351
  const base = "z.string()";
21298
- const expr = (() => {
21299
- if (v.required) return base;
21300
- return `${base}.optional()`;
21301
- })();
18352
+ const expr = match(v.required).with(true, () => base).otherwise(() => `${base}.optional()`);
21302
18353
  return ` ${v.name}: ${expr},`;
21303
18354
  }).join("\n")}\n})`;
21304
18355
  }
@@ -21311,10 +18362,7 @@ function generateSchemaExpression(vars) {
21311
18362
  function generatePromptModule(prompt) {
21312
18363
  const escaped = escapeTemplateLiteral(prompt.template);
21313
18364
  const schemaExpr = generateSchemaExpression(prompt.schema);
21314
- const groupValue = (() => {
21315
- if (prompt.group) return `'${prompt.group}' as const`;
21316
- return "undefined";
21317
- })();
18365
+ const groupValue = formatGroupValue(prompt.group);
21318
18366
  return [
21319
18367
  HEADER,
21320
18368
  `// Source: ${prompt.sourcePath}`,
@@ -21363,10 +18411,7 @@ function generatePromptModule(prompt) {
21363
18411
  function buildTree(prompts) {
21364
18412
  return prompts.reduce((root, prompt) => {
21365
18413
  const importName = toCamelCase(prompt.name);
21366
- const target = (() => {
21367
- if (prompt.group) return prompt.group.split("/").map(toCamelCase);
21368
- return [];
21369
- })().reduce((current, segment) => {
18414
+ const target = parseGroupSegments(prompt.group).reduce((current, segment) => {
21370
18415
  const existing = current[segment];
21371
18416
  if (typeof existing === "string") throw new TypeError(`Collision: prompt "${existing}" and group namespace "${segment}" share the same key at the same level.`);
21372
18417
  if (existing === null || existing === void 0) current[segment] = {};
@@ -21388,14 +18433,11 @@ function buildTree(prompts) {
21388
18433
  */
21389
18434
  function serializeTree(node, indent) {
21390
18435
  const pad = " ".repeat(indent);
21391
- const lines = [];
21392
- for (const [key, value] of Object.entries(node)) if (typeof value === "string") lines.push(`${pad}${key},`);
21393
- else {
21394
- lines.push(`${pad}${key}: {`);
21395
- for (const child of serializeTree(value, indent + 1)) lines.push(child);
21396
- lines.push(`${pad}},`);
21397
- }
21398
- return lines;
18436
+ return Object.entries(node).flatMap(([key, value]) => match(typeof value).with("string", () => [`${pad}${key},`]).otherwise(() => [
18437
+ `${pad}${key}: {`,
18438
+ ...serializeTree(value, indent + 1),
18439
+ `${pad}},`
18440
+ ]));
21399
18441
  }
21400
18442
  /**
21401
18443
  * Generate the registry `index.ts` that wires all prompt modules
@@ -21448,21 +18490,20 @@ var init_codegen = __esmMin((() => {
21448
18490
  * @returns Lint result with diagnostics.
21449
18491
  */
21450
18492
  function lintPrompt(name, filePath, schemaVars, templateVars) {
21451
- const diagnostics = [];
21452
18493
  const declared = new Set(schemaVars.map((v) => v.name));
21453
18494
  const used = new Set(templateVars);
21454
- for (const varName of used) if (!declared.has(varName)) diagnostics.push({
18495
+ const undeclaredErrors = [...used].filter((varName) => !declared.has(varName)).map((varName) => ({
21455
18496
  level: "error",
21456
18497
  message: `Undefined variable "${varName}" in ${name}.prompt\n Variable "${varName}" is used in the template but not declared in frontmatter schema.\n Add it to the schema section in the frontmatter.`
21457
- });
21458
- for (const varName of declared) if (!used.has(varName)) diagnostics.push({
18498
+ }));
18499
+ const unusedWarnings = [...declared].filter((varName) => !used.has(varName)).map((varName) => ({
21459
18500
  level: "warn",
21460
18501
  message: `Unused variable "${varName}" in ${name}.prompt\n Variable "${varName}" is declared in the schema but never used in the template.`
21461
- });
18502
+ }));
21462
18503
  return {
21463
18504
  name,
21464
18505
  filePath,
21465
- diagnostics
18506
+ diagnostics: [...undeclaredErrors, ...unusedWarnings]
21466
18507
  };
21467
18508
  }
21468
18509
  /**
@@ -21475,6 +18516,11 @@ var init_lint$1 = __esmMin((() => {}));
21475
18516
 
21476
18517
  //#endregion
21477
18518
  //#region src/lib/prompts/extract-variables.ts
18519
+ /** @private */
18520
+ function extractRoot(variable) {
18521
+ if (Array.isArray(variable)) return String(variable[0]);
18522
+ return String(variable);
18523
+ }
21478
18524
  /**
21479
18525
  * Extract top-level variable names from a Liquid template string.
21480
18526
  *
@@ -21482,37 +18528,48 @@ var init_lint$1 = __esmMin((() => {}));
21482
18528
  * and extract all referenced variable names. Only returns the root
21483
18529
  * variable name (e.g. `user` from `{{ user.name }}`).
21484
18530
  *
18531
+ * @param template - The Liquid template string to parse.
18532
+ * @returns Sorted, deduplicated array of top-level variable names.
21485
18533
  * @throws {Error} If a variable name is dangerous (e.g. `__proto__`)
18534
+ * @example
18535
+ * ```ts
18536
+ * extractVariables("Hello {{ user.name }}, you have {{ count }} items");
18537
+ * // ["count", "user"]
18538
+ * ```
21486
18539
  */
21487
18540
  function extractVariables(template) {
21488
- const engine = new Liquid();
21489
18541
  const parsed = engine.parse(template);
21490
18542
  const variables = engine.variablesSync(parsed);
21491
18543
  return [...new Set(variables.map((variable) => {
21492
- const root = (() => {
21493
- if (Array.isArray(variable)) return String(variable[0]);
21494
- return String(variable);
21495
- })();
18544
+ const root = extractRoot(variable);
21496
18545
  if (DANGEROUS_NAMES.has(root)) throw new Error(`Dangerous variable name "${root}" is not allowed in prompt templates`);
21497
18546
  return root;
21498
18547
  }))].toSorted();
21499
18548
  }
21500
- var DANGEROUS_NAMES;
18549
+ var DANGEROUS_NAMES, engine;
21501
18550
  var init_extract_variables = __esmMin((() => {
21502
18551
  DANGEROUS_NAMES = new Set([
21503
18552
  "constructor",
21504
18553
  "__proto__",
21505
18554
  "prototype"
21506
18555
  ]);
18556
+ engine = new Liquid();
21507
18557
  }));
21508
18558
 
21509
18559
  //#endregion
21510
18560
  //#region src/lib/prompts/flatten.ts
18561
+ /** @private */
18562
+ function parseParamsOrEmpty(raw, partialName) {
18563
+ if (raw.length > 0) return parseParams(raw, partialName);
18564
+ return {};
18565
+ }
21511
18566
  /**
21512
18567
  * Parse literal string parameters from a render tag's param string.
21513
18568
  *
21514
18569
  * Only supports literal string values (e.g. `role: 'Bot'`).
21515
18570
  * Throws if a parameter value is a variable reference.
18571
+ *
18572
+ * @private
21516
18573
  */
21517
18574
  function parseParams(raw, partialName) {
21518
18575
  const literalMatches = [...raw.matchAll(LITERAL_PARAM_RE)];
@@ -21523,16 +18580,32 @@ function parseParams(raw, partialName) {
21523
18580
  return [name, literal[2]];
21524
18581
  }));
21525
18582
  }
18583
+ /** @private */
18584
+ function errorMessage$1(error) {
18585
+ if (error instanceof Error) return error.message;
18586
+ return String(error);
18587
+ }
18588
+ /**
18589
+ * Render a single partial tag via LiquidJS, wrapping errors with context.
18590
+ *
18591
+ * @private
18592
+ */
18593
+ function renderPartial(engine, tag) {
18594
+ const liquidTag = `{% render '${tag.partialName}' ${Object.entries(tag.params).map(([k, v]) => `${k}: '${v}'`).join(", ")} %}`;
18595
+ try {
18596
+ return engine.parseAndRenderSync(liquidTag);
18597
+ } catch (error) {
18598
+ throw new Error(`Failed to render partial '${tag.partialName}': ${errorMessage$1(error)}`, { cause: error });
18599
+ }
18600
+ }
21526
18601
  /**
21527
18602
  * Find all `{% render %}` tags in a template string.
18603
+ *
18604
+ * @private
21528
18605
  */
21529
18606
  function parseRenderTags(template) {
21530
18607
  return [...template.matchAll(RENDER_TAG_RE)].map((m) => {
21531
- const rawParams = (m[2] ?? "").trim();
21532
- const params = (() => {
21533
- if (rawParams.length > 0) return parseParams(rawParams, m[1]);
21534
- return {};
21535
- })();
18608
+ const params = parseParamsOrEmpty((m[2] ?? "").trim(), m[1]);
21536
18609
  return {
21537
18610
  fullMatch: m[0],
21538
18611
  partialName: m[1],
@@ -21550,11 +18623,15 @@ function parseRenderTags(template) {
21550
18623
  * All other Liquid expressions (`{{ var }}`, `{% if %}`, `{% for %}`)
21551
18624
  * are preserved for runtime rendering.
21552
18625
  *
21553
- * @param template - Template string (frontmatter already stripped).
21554
- * @param partialsDirs - Directories to search for partial `.prompt` files.
18626
+ * @param params - Template content and partial directories.
21555
18627
  * @returns Flattened template with all render tags resolved.
18628
+ * @example
18629
+ * ```ts
18630
+ * flattenPartials({ template: "{% render 'header' %}\nBody", partialsDirs: ["./partials"] });
18631
+ * // "Welcome!\nBody"
18632
+ * ```
21556
18633
  */
21557
- function flattenPartials(template, partialsDirs) {
18634
+ function flattenPartials({ template, partialsDirs }) {
21558
18635
  const tags = parseRenderTags(template);
21559
18636
  if (tags.length === 0) return template;
21560
18637
  const engine = new Liquid({
@@ -21563,8 +18640,8 @@ function flattenPartials(template, partialsDirs) {
21563
18640
  extname: ".prompt"
21564
18641
  });
21565
18642
  return tags.reduce((acc, tag) => {
21566
- const rendered = engine.parseAndRenderSync(`{% render '${tag.partialName}' ${Object.entries(tag.params).map(([k, v]) => `${k}: '${v}'`).join(", ")} %}`);
21567
- return acc.replace(tag.fullMatch, rendered);
18643
+ const rendered = renderPartial(engine, tag);
18644
+ return acc.replace(tag.fullMatch, () => rendered);
21568
18645
  }, template);
21569
18646
  }
21570
18647
  var RENDER_TAG_RE, LITERAL_PARAM_RE;
@@ -21598,12 +18675,16 @@ function parseYamlContent(yaml, filePath) {
21598
18675
  * Extracts `name`, `group`, `version`, and `schema` fields.
21599
18676
  * The `schema` field maps variable names to their type definitions.
21600
18677
  *
21601
- * @param content - Raw file content (including frontmatter fences).
21602
- * @param filePath - File path for error messages.
18678
+ * @param params - Content and file path to parse.
21603
18679
  * @returns Parsed frontmatter with schema variables.
21604
18680
  * @throws If frontmatter is missing, malformed, or has an invalid name.
18681
+ * @example
18682
+ * ```ts
18683
+ * const fm = parseFrontmatter({ content: "---\nname: greeting\n---\nHello!", filePath: "greeting.prompt" });
18684
+ * // { name: "greeting", group: undefined, version: undefined, schema: [] }
18685
+ * ```
21605
18686
  */
21606
- function parseFrontmatter(content, filePath) {
18687
+ function parseFrontmatter({ content, filePath }) {
21607
18688
  const fmMatch = content.match(FRONTMATTER_RE);
21608
18689
  if (!fmMatch) throw new Error(`No frontmatter found in ${filePath}`);
21609
18690
  const parsed = parseYamlContent(fmMatch[1], filePath);
@@ -21613,20 +18694,39 @@ function parseFrontmatter(content, filePath) {
21613
18694
  if (!NAME_RE.test(name)) throw new Error(`Invalid prompt name "${name}" in ${filePath}. Names must be lowercase alphanumeric with hyphens only.`);
21614
18695
  return {
21615
18696
  name,
21616
- group: (() => {
21617
- if (typeof parsed.group === "string") {
21618
- const g = parsed.group;
21619
- const invalidSegment = g.split("/").find((segment) => !NAME_RE.test(segment));
21620
- if (invalidSegment !== void 0) throw new Error(`Invalid group segment "${invalidSegment}" in ${filePath}. Group segments must be lowercase alphanumeric with hyphens only.`);
21621
- return g;
21622
- }
21623
- })(),
21624
- version: (() => {
21625
- if (parsed.version !== null && parsed.version !== void 0) return String(parsed.version);
21626
- })(),
18697
+ group: parseGroup(parsed.group, filePath),
18698
+ version: parseVersion(parsed.version),
21627
18699
  schema: parseSchemaBlock(parsed.schema, filePath)
21628
18700
  };
21629
18701
  }
18702
+ /** @private */
18703
+ function stringOrDefault(value, fallback) {
18704
+ if (typeof value === "string") return value;
18705
+ return fallback;
18706
+ }
18707
+ /** @private */
18708
+ function stringOrUndefined(value) {
18709
+ if (typeof value === "string") return value;
18710
+ }
18711
+ /**
18712
+ * Validate and extract the `group` field from parsed frontmatter.
18713
+ *
18714
+ * @private
18715
+ */
18716
+ function parseGroup(raw, filePath) {
18717
+ if (typeof raw !== "string") return;
18718
+ const invalidSegment = raw.split("/").find((segment) => !NAME_RE.test(segment));
18719
+ if (invalidSegment !== void 0) throw new Error(`Invalid group segment "${invalidSegment}" in ${filePath}. Group segments must be lowercase alphanumeric with hyphens only.`);
18720
+ return raw;
18721
+ }
18722
+ /**
18723
+ * Extract the `version` field from parsed frontmatter.
18724
+ *
18725
+ * @private
18726
+ */
18727
+ function parseVersion(raw) {
18728
+ if (raw !== null && raw !== void 0) return String(raw);
18729
+ }
21630
18730
  /**
21631
18731
  * Parse the `schema` block from frontmatter into an array of variable definitions.
21632
18732
  *
@@ -21636,28 +18736,20 @@ function parseSchemaBlock(raw, filePath) {
21636
18736
  if (raw === null || raw === void 0) return [];
21637
18737
  if (typeof raw !== "object" || Array.isArray(raw)) throw new TypeError(`Invalid "schema" in ${filePath}: expected an object mapping variable names to definitions`);
21638
18738
  const schema = raw;
21639
- return Object.entries(schema).map(([varName, value]) => {
21640
- if (typeof value === "string") return {
18739
+ return Object.entries(schema).map(([varName, value]) => match(value).with(P.string, (v) => ({
18740
+ name: varName,
18741
+ type: v,
18742
+ required: true
18743
+ })).with(P.when((v) => typeof v === "object" && v !== null && !Array.isArray(v)), (def) => {
18744
+ return {
21641
18745
  name: varName,
21642
- type: value,
21643
- required: true
18746
+ type: stringOrDefault(def.type, "string"),
18747
+ required: def.required !== false,
18748
+ description: stringOrUndefined(def.description)
21644
18749
  };
21645
- if (typeof value === "object" && value !== null && !Array.isArray(value)) {
21646
- const def = value;
21647
- return {
21648
- name: varName,
21649
- type: (() => {
21650
- if (typeof def.type === "string") return def.type;
21651
- return "string";
21652
- })(),
21653
- required: def.required !== false,
21654
- description: (() => {
21655
- if (typeof def.description === "string") return def.description;
21656
- })()
21657
- };
21658
- }
18750
+ }).otherwise(() => {
21659
18751
  throw new Error(`Invalid schema definition for "${varName}" in ${filePath}. Expected a type string or an object with { type, required?, description? }.`);
21660
- });
18752
+ }));
21661
18753
  }
21662
18754
  var FRONTMATTER_RE, NAME_RE;
21663
18755
  var init_frontmatter = __esmMin((() => {
@@ -21670,22 +18762,28 @@ var init_frontmatter = __esmMin((() => {
21670
18762
  /**
21671
18763
  * Extract the `name` field from YAML frontmatter.
21672
18764
  *
21673
- * This is a lightweight extraction that avoids pulling in a full YAML parser.
21674
- * It looks for `name: <value>` in the frontmatter block.
18765
+ * Uses a proper YAML parser to handle quoted values and edge cases.
18766
+ *
18767
+ * @private
21675
18768
  */
21676
18769
  function extractName(content) {
21677
- const match = content.match(FRONTMATTER_RE);
21678
- if (!match) return;
21679
- const [, frontmatter] = match;
21680
- const nameLine = frontmatter.split("\n").find((line) => line.startsWith("name:"));
21681
- if (!nameLine) return;
21682
- return nameLine.slice(5).trim();
18770
+ const fmMatch = content.match(FRONTMATTER_RE);
18771
+ if (!fmMatch) return;
18772
+ try {
18773
+ const parsed = parse(fmMatch[1]);
18774
+ if (parsed !== null && parsed !== void 0 && typeof parsed.name === "string") return parsed.name;
18775
+ return;
18776
+ } catch {
18777
+ return;
18778
+ }
21683
18779
  }
21684
18780
  /**
21685
18781
  * Derive a prompt name from a file path when no frontmatter name is present.
21686
18782
  *
21687
18783
  * If the file is named `prompt.prompt`, uses the parent directory name.
21688
18784
  * Otherwise uses the file stem (e.g. `my-agent.prompt` -> `my-agent`).
18785
+ *
18786
+ * @private
21689
18787
  */
21690
18788
  function deriveNameFromPath(filePath) {
21691
18789
  const stem = basename(filePath, PROMPT_EXT);
@@ -21694,6 +18792,8 @@ function deriveNameFromPath(filePath) {
21694
18792
  }
21695
18793
  /**
21696
18794
  * Recursively scan a directory for `.prompt` files.
18795
+ *
18796
+ * @private
21697
18797
  */
21698
18798
  function scanDirectory(dir, depth) {
21699
18799
  if (depth > MAX_DEPTH) return [];
@@ -21743,6 +18843,7 @@ var init_paths = __esmMin((() => {
21743
18843
  /**
21744
18844
  * Resolve the list of partial directories to search.
21745
18845
  *
18846
+ * @private
21746
18847
  * @param customDir - Custom partials directory path.
21747
18848
  * @returns Array of directories to search for partials.
21748
18849
  */
@@ -21761,8 +18862,14 @@ function runLintPipeline(options) {
21761
18862
  const partialsDirs = resolvePartialsDirs(resolve(options.partials ?? ".prompts/partials"));
21762
18863
  const results = discovered.map((d) => {
21763
18864
  const raw = readFileSync(d.filePath, "utf8");
21764
- const frontmatter = parseFrontmatter(raw, d.filePath);
21765
- const templateVars = extractVariables(flattenPartials(clean(raw), partialsDirs));
18865
+ const frontmatter = parseFrontmatter({
18866
+ content: raw,
18867
+ filePath: d.filePath
18868
+ });
18869
+ const templateVars = extractVariables(flattenPartials({
18870
+ template: clean(raw),
18871
+ partialsDirs
18872
+ }));
21766
18873
  return lintPrompt(frontmatter.name, d.filePath, frontmatter.schema, templateVars);
21767
18874
  });
21768
18875
  return {
@@ -21783,8 +18890,14 @@ function runGeneratePipeline(options) {
21783
18890
  const partialsDirs = resolvePartialsDirs(resolve(options.partials ?? resolve(options.out, "../partials")));
21784
18891
  const processed = discovered.map((d) => {
21785
18892
  const raw = readFileSync(d.filePath, "utf8");
21786
- const frontmatter = parseFrontmatter(raw, d.filePath);
21787
- const template = flattenPartials(clean(raw), partialsDirs);
18893
+ const frontmatter = parseFrontmatter({
18894
+ content: raw,
18895
+ filePath: d.filePath
18896
+ });
18897
+ const template = flattenPartials({
18898
+ template: clean(raw),
18899
+ partialsDirs
18900
+ });
21788
18901
  const templateVars = extractVariables(template);
21789
18902
  return {
21790
18903
  lintResult: lintPrompt(frontmatter.name, d.filePath, frontmatter.schema, templateVars),
@@ -21816,11 +18929,9 @@ var init_pipeline = __esmMin((() => {
21816
18929
  /**
21817
18930
  * Shared handler for prompts code generation.
21818
18931
  *
21819
- * @param args - Parsed CLI arguments.
21820
- * @param logger - Logger instance from the command context.
21821
- * @param fail - Failure callback from the command context.
18932
+ * @param params - Handler context with args, logger, and fail callback.
21822
18933
  */
21823
- function handleGenerate(args, logger, fail) {
18934
+ function handleGenerate({ args, logger, fail }) {
21824
18935
  const { out, roots, partials, silent } = args;
21825
18936
  const { discovered, lintResults, prompts } = runGeneratePipeline({
21826
18937
  roots,
@@ -21829,14 +18940,12 @@ function handleGenerate(args, logger, fail) {
21829
18940
  });
21830
18941
  if (!silent) logger.info(`Found ${discovered} prompt(s)`);
21831
18942
  if (!silent) for (const prompt of prompts) {
21832
- const varList = (() => {
21833
- if (prompt.schema.length > 0) return ` (${prompt.schema.map((v) => v.name).join(", ")})`;
21834
- return "";
21835
- })();
18943
+ const varList = formatVarList(prompt.schema);
21836
18944
  logger.step(`${prompt.name}${varList}`);
21837
18945
  }
21838
- for (const result of lintResults) for (const diag of result.diagnostics) if (diag.level === "error") logger.error(diag.message);
21839
- else logger.warn(diag.message);
18946
+ for (const diag of lintResults.flatMap((result) => result.diagnostics)) match(diag.level).with("error", () => logger.error(diag.message)).with("warn", () => {
18947
+ if (!silent) logger.warn(diag.message);
18948
+ }).exhaustive();
21840
18949
  if (hasLintErrors(lintResults)) fail("Lint errors found. Fix them before generating.");
21841
18950
  const outDir = resolve(out);
21842
18951
  mkdirSync(outDir, { recursive: true });
@@ -21848,6 +18957,11 @@ function handleGenerate(args, logger, fail) {
21848
18957
  writeFileSync(resolve(outDir, "index.ts"), registryContent, "utf8");
21849
18958
  if (!silent) logger.success(`Generated ${prompts.length} prompt module(s) + registry → ${outDir}`);
21850
18959
  }
18960
+ /** @private */
18961
+ function formatVarList(schema) {
18962
+ if (schema.length > 0) return ` (${schema.map((v) => v.name).join(", ")})`;
18963
+ return "";
18964
+ }
21851
18965
  var generateArgs, generate_default$1;
21852
18966
  var init_generate$1 = __esmMin((() => {
21853
18967
  init_dist();
@@ -21864,7 +18978,11 @@ var init_generate$1 = __esmMin((() => {
21864
18978
  description: "Generate TypeScript modules from .prompt files",
21865
18979
  options: generateArgs,
21866
18980
  handler(ctx) {
21867
- handleGenerate(ctx.args, ctx.logger, ctx.fail);
18981
+ handleGenerate({
18982
+ args: ctx.args,
18983
+ logger: ctx.logger,
18984
+ fail: ctx.fail
18985
+ });
21868
18986
  }
21869
18987
  });
21870
18988
  }));
@@ -21881,7 +18999,11 @@ var init_generate = __esmMin((() => {
21881
18999
  handler(ctx) {
21882
19000
  const { silent } = ctx.args;
21883
19001
  if (!silent) ctx.logger.info("Running prompts code generation...");
21884
- handleGenerate(ctx.args, ctx.logger, ctx.fail);
19002
+ handleGenerate({
19003
+ args: ctx.args,
19004
+ logger: ctx.logger,
19005
+ fail: ctx.fail
19006
+ });
21885
19007
  }
21886
19008
  });
21887
19009
  }));
@@ -21908,11 +19030,9 @@ var init_setup$1 = __esmMin((() => {
21908
19030
  /**
21909
19031
  * Shared handler for prompts lint/validation.
21910
19032
  *
21911
- * @param args - Parsed CLI arguments.
21912
- * @param logger - Logger instance from the command context.
21913
- * @param fail - Failure callback from the command context.
19033
+ * @param params - Handler context with args, logger, and fail callback.
21914
19034
  */
21915
- function handleLint(args, logger, fail) {
19035
+ function handleLint({ args, logger, fail }) {
21916
19036
  const { roots, partials, silent } = args;
21917
19037
  const { discovered, results } = runLintPipeline({
21918
19038
  roots,
@@ -21920,8 +19040,7 @@ function handleLint(args, logger, fail) {
21920
19040
  });
21921
19041
  if (!silent) logger.info(`Linting ${discovered} prompt(s)...`);
21922
19042
  const diagnostics = results.flatMap((result) => result.diagnostics);
21923
- for (const diag of diagnostics) if (diag.level === "error") logger.error(diag.message);
21924
- else logger.warn(diag.message);
19043
+ for (const diag of diagnostics) match(diag.level).with("error", () => logger.error(diag.message)).with("warn", () => logger.warn(diag.message)).exhaustive();
21925
19044
  const errorCount = diagnostics.filter((d) => d.level === "error").length;
21926
19045
  const warnCount = diagnostics.filter((d) => d.level !== "error").length;
21927
19046
  if (!silent) {
@@ -21947,7 +19066,11 @@ var init_lint = __esmMin((() => {
21947
19066
  description: "Validate .prompt files for schema/template mismatches",
21948
19067
  options: lintArgs,
21949
19068
  handler(ctx) {
21950
- handleLint(ctx.args, ctx.logger, ctx.fail);
19069
+ handleLint({
19070
+ args: ctx.args,
19071
+ logger: ctx.logger,
19072
+ fail: ctx.fail
19073
+ });
21951
19074
  }
21952
19075
  });
21953
19076
  }));
@@ -21964,7 +19087,11 @@ var init_validate$1 = __esmMin((() => {
21964
19087
  handler(ctx) {
21965
19088
  const { silent } = ctx.args;
21966
19089
  if (!silent) ctx.logger.info("Running prompts validation...");
21967
- handleLint(ctx.args, ctx.logger, ctx.fail);
19090
+ handleLint({
19091
+ args: ctx.args,
19092
+ logger: ctx.logger,
19093
+ fail: ctx.fail
19094
+ });
21968
19095
  if (!silent) ctx.logger.success("All validations passed.");
21969
19096
  }
21970
19097
  });
@@ -22018,17 +19145,40 @@ name: ${name}
22018
19145
 
22019
19146
  //#endregion
22020
19147
  //#region src/commands/prompts/setup.ts
19148
+ /** @private */
19149
+ function errorMessage(error) {
19150
+ if (error instanceof Error) return error.message;
19151
+ return String(error);
19152
+ }
19153
+ /** @private */
19154
+ function ensureRecommendation(current, id) {
19155
+ if (current.includes(id)) return [...current];
19156
+ return [...current, id];
19157
+ }
19158
+ /** @private */
19159
+ function readFileOrEmpty(filePath) {
19160
+ if (existsSync(filePath)) return readFileSync(filePath, "utf8");
19161
+ return "";
19162
+ }
19163
+ /** @private */
19164
+ function trailingSeparator(content) {
19165
+ if (content.length > 0 && !content.endsWith("\n")) return "\n";
19166
+ return "";
19167
+ }
22021
19168
  /**
22022
- * Read a JSON file, returning an empty object if it doesn't exist
22023
- * or contains invalid JSON.
19169
+ * Read a JSON file, returning an empty object if it doesn't exist.
19170
+ * Throws if the file exists but contains invalid JSON, preventing
19171
+ * silent data loss from overwriting malformed config files.
19172
+ *
19173
+ * @private
22024
19174
  */
22025
19175
  function readJsonFile(filePath) {
22026
19176
  if (!existsSync(filePath)) return {};
19177
+ const content = readFileSync(filePath, "utf8");
22027
19178
  try {
22028
- const content = readFileSync(filePath, "utf8");
22029
19179
  return JSON.parse(content);
22030
- } catch {
22031
- return {};
19180
+ } catch (error) {
19181
+ throw new Error(`Failed to parse ${filePath}: ${errorMessage(error)}. Fix the JSON syntax or remove the file before running setup.`, { cause: error });
22032
19182
  }
22033
19183
  }
22034
19184
  var VSCODE_DIR, SETTINGS_FILE, EXTENSIONS_FILE, GITIGNORE_FILE, TSCONFIG_FILE, GITIGNORE_ENTRY, PROMPTS_ALIAS, PROMPTS_ALIAS_PATH, setup_default;
@@ -22073,12 +19223,7 @@ var init_setup = __esmMin((() => {
22073
19223
  mkdirSync(vscodeDir, { recursive: true });
22074
19224
  const extensionsPath = resolve(vscodeDir, EXTENSIONS_FILE);
22075
19225
  const extensions = readJsonFile(extensionsPath);
22076
- const currentRecs = extensions.recommendations ?? [];
22077
- const extensionId = "sissel.shopify-liquid";
22078
- const recommendations = (() => {
22079
- if (currentRecs.includes(extensionId)) return currentRecs;
22080
- return [...currentRecs, extensionId];
22081
- })();
19226
+ const recommendations = ensureRecommendation(extensions.recommendations ?? [], "sissel.shopify-liquid");
22082
19227
  const updatedExtensions = {
22083
19228
  ...extensions,
22084
19229
  recommendations
@@ -22091,16 +19236,10 @@ var init_setup = __esmMin((() => {
22091
19236
  initialValue: true
22092
19237
  })) {
22093
19238
  const gitignorePath = resolve(GITIGNORE_FILE);
22094
- const existing = (() => {
22095
- if (existsSync(gitignorePath)) return readFileSync(gitignorePath, "utf8");
22096
- return "";
22097
- })();
19239
+ const existing = readFileOrEmpty(gitignorePath);
22098
19240
  if (existing.includes(GITIGNORE_ENTRY)) ctx.logger.info(`${GITIGNORE_ENTRY} already in ${gitignorePath}`);
22099
19241
  else {
22100
- writeFileSync(gitignorePath, `${existing}${`${(() => {
22101
- if (existing.length > 0 && !existing.endsWith("\n")) return "\n";
22102
- return "";
22103
- })()}\n# Generated prompt client (created by \`funkai prompts generate\`)\n${GITIGNORE_ENTRY}\n`}`, "utf8");
19242
+ writeFileSync(gitignorePath, `${existing}${`${trailingSeparator(existing)}\n# Generated prompt client (created by \`funkai prompts generate\`)\n${GITIGNORE_ENTRY}\n`}`, "utf8");
22104
19243
  ctx.logger.success(`Added ${GITIGNORE_ENTRY} to ${gitignorePath}`);
22105
19244
  }
22106
19245
  }
@@ -22880,7 +20019,7 @@ async function createRuntime(options) {
22880
20019
  }
22881
20020
  });
22882
20021
  const finalHandler = command.handler ?? (async () => {});
22883
- const [execError] = await attemptAsync(() => runner.execute({
20022
+ const [execError] = await (0, fp_exports.attemptAsync)(() => runner.execute({
22884
20023
  ctx,
22885
20024
  handler: finalHandler,
22886
20025
  middleware: command.middleware
@@ -22919,7 +20058,7 @@ async function resolveConfig(configOptions, defaultName) {
22919
20058
  */
22920
20059
  async function cli(options) {
22921
20060
  const logger = createCliLogger();
22922
- const [uncaughtError, result] = await attemptAsync(async () => {
20061
+ const [uncaughtError, result] = await (0, fp_exports.attemptAsync)(async () => {
22923
20062
  const [versionError, version] = resolveVersion(options.version);
22924
20063
  if (versionError) return versionError;
22925
20064
  const program = Yargs(process.argv.slice(ARGV_SLICE_START)).scriptName(options.name).version(version).strict().help().option("cwd", {
@@ -23000,7 +20139,7 @@ function resolveVersion(explicit) {
23000
20139
  return err(VERSION_ERROR);
23001
20140
  }
23002
20141
  {
23003
- const parsed = VersionSchema.safeParse("0.1.4");
20142
+ const parsed = VersionSchema.safeParse("0.2.0");
23004
20143
  if (parsed.success) return ok(parsed.data);
23005
20144
  }
23006
20145
  return err(VERSION_ERROR);
@@ -23018,7 +20157,7 @@ function resolveVersion(explicit) {
23018
20157
  * @returns Resolved commands with optional order, or undefined.
23019
20158
  */
23020
20159
  async function resolveCommands(commands) {
23021
- return (0, fp_exports.match)(commands).when(isString, async (dir) => ({ commands: await autoload({ dir }) })).with(fp_exports.P.instanceOf(Promise), async (p) => ({ commands: await p })).when(isCommandsConfig, (cfg) => resolveCommandsConfig(cfg)).when(isPlainObject$2, (cmds) => ({ commands: cmds })).otherwise(() => resolveCommandsFromConfig());
20160
+ return (0, fp_exports.match)(commands).when(fp_exports.isString, async (dir) => ({ commands: await autoload({ dir }) })).with(fp_exports.P.instanceOf(Promise), async (p) => ({ commands: await p })).when(isCommandsConfig, (cfg) => resolveCommandsConfig(cfg)).when(fp_exports.isPlainObject, (cmds) => ({ commands: cmds })).otherwise(() => resolveCommandsFromConfig());
23022
20161
  }
23023
20162
  /**
23024
20163
  * Resolve a structured {@link CommandsConfig} into flat commands and order.
@@ -23033,7 +20172,7 @@ async function resolveCommands(commands) {
23033
20172
  async function resolveCommandsConfig(config) {
23034
20173
  const { order, path, commands: innerCommands } = config;
23035
20174
  return {
23036
- commands: await (0, fp_exports.match)(innerCommands).when(() => isString(path), async () => autoload({ dir: path })).with(fp_exports.P.instanceOf(Promise), async (p) => p).when(isPlainObject$2, (cmds) => cmds).otherwise(() => ({})),
20175
+ commands: await (0, fp_exports.match)(innerCommands).when(() => (0, fp_exports.isString)(path), async () => autoload({ dir: path })).with(fp_exports.P.instanceOf(Promise), async (p) => p).when(fp_exports.isPlainObject, (cmds) => cmds).otherwise(() => ({})),
23037
20176
  order
23038
20177
  };
23039
20178
  }
@@ -23062,7 +20201,7 @@ async function resolveCommandsFromConfig() {
23062
20201
  * @param argv - The parsed argv record from yargs.
23063
20202
  */
23064
20203
  function applyCwd(argv) {
23065
- if (isString(argv.cwd)) process.chdir(resolve(argv.cwd));
20204
+ if ((0, fp_exports.isString)(argv.cwd)) process.chdir(resolve(argv.cwd));
23066
20205
  }
23067
20206
  /**
23068
20207
  * Show help output when no command was matched.
@@ -23117,7 +20256,7 @@ function extractFooter(help) {
23117
20256
  */
23118
20257
  function resolveDirs(name, dirs) {
23119
20258
  const defaultDir = `.${name}`;
23120
- if (isNil(dirs)) return {
20259
+ if ((0, fp_exports.isNil)(dirs)) return {
23121
20260
  global: defaultDir,
23122
20261
  local: defaultDir
23123
20262
  };