@kecan0406/ttheme 0.1.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.
Files changed (782) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +203 -0
  3. package/bin/ttheme.js +4473 -0
  4. package/dist/alacritty/config/alma.toml +8 -0
  5. package/dist/alacritty/config/anko.toml +8 -0
  6. package/dist/alacritty/config/asuka.toml +8 -0
  7. package/dist/alacritty/config/azusa.toml +8 -0
  8. package/dist/alacritty/config/battler.toml +8 -0
  9. package/dist/alacritty/config/beatrice.toml +8 -0
  10. package/dist/alacritty/config/bernkastel.toml +8 -0
  11. package/dist/alacritty/config/bocchi.toml +8 -0
  12. package/dist/alacritty/config/cirno.toml +8 -0
  13. package/dist/alacritty/config/david.toml +8 -0
  14. package/dist/alacritty/config/determination.toml +8 -0
  15. package/dist/alacritty/config/dorothy.toml +8 -0
  16. package/dist/alacritty/config/eva01.toml +8 -0
  17. package/dist/alacritty/config/flandre.toml +8 -0
  18. package/dist/alacritty/config/fox.toml +8 -0
  19. package/dist/alacritty/config/glitch.toml +8 -0
  20. package/dist/alacritty/config/hinamizawa.toml +8 -0
  21. package/dist/alacritty/config/hitagi.toml +8 -0
  22. package/dist/alacritty/config/homura.toml +8 -0
  23. package/dist/alacritty/config/jill.toml +8 -0
  24. package/dist/alacritty/config/joker.toml +8 -0
  25. package/dist/alacritty/config/jupiter.toml +8 -0
  26. package/dist/alacritty/config/kagami.toml +8 -0
  27. package/dist/alacritty/config/kaito.toml +8 -0
  28. package/dist/alacritty/config/kaworu.toml +8 -0
  29. package/dist/alacritty/config/kita.toml +8 -0
  30. package/dist/alacritty/config/konata.toml +8 -0
  31. package/dist/alacritty/config/kou.toml +8 -0
  32. package/dist/alacritty/config/kumori.toml +8 -0
  33. package/dist/alacritty/config/kurisu.toml +8 -0
  34. package/dist/alacritty/config/kyoko.toml +8 -0
  35. package/dist/alacritty/config/kyubey.toml +8 -0
  36. package/dist/alacritty/config/lain.toml +8 -0
  37. package/dist/alacritty/config/lambdadelta.toml +8 -0
  38. package/dist/alacritty/config/len.toml +8 -0
  39. package/dist/alacritty/config/lucy.toml +8 -0
  40. package/dist/alacritty/config/luka.toml +8 -0
  41. package/dist/alacritty/config/madoka.toml +8 -0
  42. package/dist/alacritty/config/magi.toml +8 -0
  43. package/dist/alacritty/config/mami.toml +8 -0
  44. package/dist/alacritty/config/marisa.toml +8 -0
  45. package/dist/alacritty/config/mars.toml +8 -0
  46. package/dist/alacritty/config/mayuri.toml +8 -0
  47. package/dist/alacritty/config/meiko.toml +8 -0
  48. package/dist/alacritty/config/mercury.toml +8 -0
  49. package/dist/alacritty/config/mettaton.toml +8 -0
  50. package/dist/alacritty/config/miku.toml +8 -0
  51. package/dist/alacritty/config/mio.toml +8 -0
  52. package/dist/alacritty/config/mion.toml +8 -0
  53. package/dist/alacritty/config/misato.toml +8 -0
  54. package/dist/alacritty/config/miyuki.toml +8 -0
  55. package/dist/alacritty/config/monika.toml +8 -0
  56. package/dist/alacritty/config/moon.toml +8 -0
  57. package/dist/alacritty/config/mugi.toml +8 -0
  58. package/dist/alacritty/config/nadeko.toml +8 -0
  59. package/dist/alacritty/config/nagisa.toml +8 -0
  60. package/dist/alacritty/config/natsuki.toml +8 -0
  61. package/dist/alacritty/config/nazuna.toml +8 -0
  62. package/dist/alacritty/config/neutral.toml +8 -0
  63. package/dist/alacritty/config/nightcity.toml +8 -0
  64. package/dist/alacritty/config/nijika.toml +8 -0
  65. package/dist/alacritty/config/oracle.toml +8 -0
  66. package/dist/alacritty/config/panther.toml +8 -0
  67. package/dist/alacritty/config/papyrus.toml +8 -0
  68. package/dist/alacritty/config/patchouli.toml +8 -0
  69. package/dist/alacritty/config/queen.toml +8 -0
  70. package/dist/alacritty/config/rebecca.toml +8 -0
  71. package/dist/alacritty/config/rei.toml +8 -0
  72. package/dist/alacritty/config/reimu.toml +8 -0
  73. package/dist/alacritty/config/rena.toml +8 -0
  74. package/dist/alacritty/config/rika.toml +8 -0
  75. package/dist/alacritty/config/rin.toml +8 -0
  76. package/dist/alacritty/config/ritsu.toml +8 -0
  77. package/dist/alacritty/config/rokkenjima.toml +8 -0
  78. package/dist/alacritty/config/ryo.toml +8 -0
  79. package/dist/alacritty/config/sans.toml +8 -0
  80. package/dist/alacritty/config/satoko.toml +8 -0
  81. package/dist/alacritty/config/sayaka.toml +8 -0
  82. package/dist/alacritty/config/sayori.toml +8 -0
  83. package/dist/alacritty/config/sei.toml +8 -0
  84. package/dist/alacritty/config/seri.toml +8 -0
  85. package/dist/alacritty/config/shinobu.toml +8 -0
  86. package/dist/alacritty/config/skull.toml +8 -0
  87. package/dist/alacritty/config/stella.toml +8 -0
  88. package/dist/alacritty/config/suzuha.toml +8 -0
  89. package/dist/alacritty/config/toriel.toml +8 -0
  90. package/dist/alacritty/config/tsubasa.toml +8 -0
  91. package/dist/alacritty/config/tsukasa.toml +8 -0
  92. package/dist/alacritty/config/undyne.toml +8 -0
  93. package/dist/alacritty/config/valhalla.toml +8 -0
  94. package/dist/alacritty/config/velvet.toml +8 -0
  95. package/dist/alacritty/config/venus.toml +8 -0
  96. package/dist/alacritty/config/yofukashi.toml +8 -0
  97. package/dist/alacritty/config/youmu.toml +8 -0
  98. package/dist/alacritty/config/yui.toml +8 -0
  99. package/dist/alacritty/config/yuri.toml +8 -0
  100. package/dist/alacritty/themes/alma.toml +34 -0
  101. package/dist/alacritty/themes/anko.toml +34 -0
  102. package/dist/alacritty/themes/asuka.toml +34 -0
  103. package/dist/alacritty/themes/azusa.toml +34 -0
  104. package/dist/alacritty/themes/battler.toml +34 -0
  105. package/dist/alacritty/themes/beatrice.toml +34 -0
  106. package/dist/alacritty/themes/bernkastel.toml +34 -0
  107. package/dist/alacritty/themes/bocchi.toml +34 -0
  108. package/dist/alacritty/themes/cirno.toml +34 -0
  109. package/dist/alacritty/themes/david.toml +34 -0
  110. package/dist/alacritty/themes/determination.toml +34 -0
  111. package/dist/alacritty/themes/dorothy.toml +34 -0
  112. package/dist/alacritty/themes/eva01.toml +34 -0
  113. package/dist/alacritty/themes/flandre.toml +34 -0
  114. package/dist/alacritty/themes/fox.toml +34 -0
  115. package/dist/alacritty/themes/glitch.toml +34 -0
  116. package/dist/alacritty/themes/hinamizawa.toml +34 -0
  117. package/dist/alacritty/themes/hitagi.toml +34 -0
  118. package/dist/alacritty/themes/homura.toml +34 -0
  119. package/dist/alacritty/themes/jill.toml +34 -0
  120. package/dist/alacritty/themes/joker.toml +34 -0
  121. package/dist/alacritty/themes/jupiter.toml +34 -0
  122. package/dist/alacritty/themes/kagami.toml +34 -0
  123. package/dist/alacritty/themes/kaito.toml +34 -0
  124. package/dist/alacritty/themes/kaworu.toml +34 -0
  125. package/dist/alacritty/themes/kita.toml +34 -0
  126. package/dist/alacritty/themes/konata.toml +34 -0
  127. package/dist/alacritty/themes/kou.toml +34 -0
  128. package/dist/alacritty/themes/kumori.toml +34 -0
  129. package/dist/alacritty/themes/kurisu.toml +34 -0
  130. package/dist/alacritty/themes/kyoko.toml +34 -0
  131. package/dist/alacritty/themes/kyubey.toml +34 -0
  132. package/dist/alacritty/themes/lain.toml +34 -0
  133. package/dist/alacritty/themes/lambdadelta.toml +34 -0
  134. package/dist/alacritty/themes/len.toml +34 -0
  135. package/dist/alacritty/themes/lucy.toml +34 -0
  136. package/dist/alacritty/themes/luka.toml +34 -0
  137. package/dist/alacritty/themes/madoka.toml +34 -0
  138. package/dist/alacritty/themes/magi.toml +34 -0
  139. package/dist/alacritty/themes/mami.toml +34 -0
  140. package/dist/alacritty/themes/marisa.toml +34 -0
  141. package/dist/alacritty/themes/mars.toml +34 -0
  142. package/dist/alacritty/themes/mayuri.toml +34 -0
  143. package/dist/alacritty/themes/meiko.toml +34 -0
  144. package/dist/alacritty/themes/mercury.toml +34 -0
  145. package/dist/alacritty/themes/mettaton.toml +34 -0
  146. package/dist/alacritty/themes/miku.toml +34 -0
  147. package/dist/alacritty/themes/mio.toml +34 -0
  148. package/dist/alacritty/themes/mion.toml +34 -0
  149. package/dist/alacritty/themes/misato.toml +34 -0
  150. package/dist/alacritty/themes/miyuki.toml +34 -0
  151. package/dist/alacritty/themes/monika.toml +34 -0
  152. package/dist/alacritty/themes/moon.toml +34 -0
  153. package/dist/alacritty/themes/mugi.toml +34 -0
  154. package/dist/alacritty/themes/nadeko.toml +34 -0
  155. package/dist/alacritty/themes/nagisa.toml +34 -0
  156. package/dist/alacritty/themes/natsuki.toml +34 -0
  157. package/dist/alacritty/themes/nazuna.toml +34 -0
  158. package/dist/alacritty/themes/neutral.toml +34 -0
  159. package/dist/alacritty/themes/nightcity.toml +34 -0
  160. package/dist/alacritty/themes/nijika.toml +34 -0
  161. package/dist/alacritty/themes/oracle.toml +34 -0
  162. package/dist/alacritty/themes/panther.toml +34 -0
  163. package/dist/alacritty/themes/papyrus.toml +34 -0
  164. package/dist/alacritty/themes/patchouli.toml +34 -0
  165. package/dist/alacritty/themes/queen.toml +34 -0
  166. package/dist/alacritty/themes/rebecca.toml +34 -0
  167. package/dist/alacritty/themes/rei.toml +34 -0
  168. package/dist/alacritty/themes/reimu.toml +34 -0
  169. package/dist/alacritty/themes/rena.toml +34 -0
  170. package/dist/alacritty/themes/rika.toml +34 -0
  171. package/dist/alacritty/themes/rin.toml +34 -0
  172. package/dist/alacritty/themes/ritsu.toml +34 -0
  173. package/dist/alacritty/themes/rokkenjima.toml +34 -0
  174. package/dist/alacritty/themes/ryo.toml +34 -0
  175. package/dist/alacritty/themes/sans.toml +34 -0
  176. package/dist/alacritty/themes/satoko.toml +34 -0
  177. package/dist/alacritty/themes/sayaka.toml +34 -0
  178. package/dist/alacritty/themes/sayori.toml +34 -0
  179. package/dist/alacritty/themes/sei.toml +34 -0
  180. package/dist/alacritty/themes/seri.toml +34 -0
  181. package/dist/alacritty/themes/shinobu.toml +34 -0
  182. package/dist/alacritty/themes/skull.toml +34 -0
  183. package/dist/alacritty/themes/stella.toml +34 -0
  184. package/dist/alacritty/themes/suzuha.toml +34 -0
  185. package/dist/alacritty/themes/toriel.toml +34 -0
  186. package/dist/alacritty/themes/tsubasa.toml +34 -0
  187. package/dist/alacritty/themes/tsukasa.toml +34 -0
  188. package/dist/alacritty/themes/undyne.toml +34 -0
  189. package/dist/alacritty/themes/valhalla.toml +34 -0
  190. package/dist/alacritty/themes/velvet.toml +34 -0
  191. package/dist/alacritty/themes/venus.toml +34 -0
  192. package/dist/alacritty/themes/yofukashi.toml +34 -0
  193. package/dist/alacritty/themes/youmu.toml +34 -0
  194. package/dist/alacritty/themes/yui.toml +34 -0
  195. package/dist/alacritty/themes/yuri.toml +34 -0
  196. package/dist/ghostty/themes/alma +29 -0
  197. package/dist/ghostty/themes/anko +29 -0
  198. package/dist/ghostty/themes/asuka +29 -0
  199. package/dist/ghostty/themes/azusa +29 -0
  200. package/dist/ghostty/themes/battler +29 -0
  201. package/dist/ghostty/themes/beatrice +29 -0
  202. package/dist/ghostty/themes/bernkastel +29 -0
  203. package/dist/ghostty/themes/bocchi +29 -0
  204. package/dist/ghostty/themes/cirno +29 -0
  205. package/dist/ghostty/themes/david +29 -0
  206. package/dist/ghostty/themes/determination +29 -0
  207. package/dist/ghostty/themes/dorothy +29 -0
  208. package/dist/ghostty/themes/eva01 +29 -0
  209. package/dist/ghostty/themes/flandre +29 -0
  210. package/dist/ghostty/themes/fox +29 -0
  211. package/dist/ghostty/themes/glitch +29 -0
  212. package/dist/ghostty/themes/hinamizawa +29 -0
  213. package/dist/ghostty/themes/hitagi +29 -0
  214. package/dist/ghostty/themes/homura +29 -0
  215. package/dist/ghostty/themes/jill +29 -0
  216. package/dist/ghostty/themes/joker +29 -0
  217. package/dist/ghostty/themes/jupiter +29 -0
  218. package/dist/ghostty/themes/kagami +29 -0
  219. package/dist/ghostty/themes/kaito +29 -0
  220. package/dist/ghostty/themes/kaworu +29 -0
  221. package/dist/ghostty/themes/kita +29 -0
  222. package/dist/ghostty/themes/konata +29 -0
  223. package/dist/ghostty/themes/kou +29 -0
  224. package/dist/ghostty/themes/kumori +29 -0
  225. package/dist/ghostty/themes/kurisu +29 -0
  226. package/dist/ghostty/themes/kyoko +29 -0
  227. package/dist/ghostty/themes/kyubey +29 -0
  228. package/dist/ghostty/themes/lain +29 -0
  229. package/dist/ghostty/themes/lambdadelta +29 -0
  230. package/dist/ghostty/themes/len +29 -0
  231. package/dist/ghostty/themes/lucy +29 -0
  232. package/dist/ghostty/themes/luka +29 -0
  233. package/dist/ghostty/themes/madoka +29 -0
  234. package/dist/ghostty/themes/magi +29 -0
  235. package/dist/ghostty/themes/mami +29 -0
  236. package/dist/ghostty/themes/marisa +29 -0
  237. package/dist/ghostty/themes/mars +29 -0
  238. package/dist/ghostty/themes/mayuri +29 -0
  239. package/dist/ghostty/themes/meiko +29 -0
  240. package/dist/ghostty/themes/mercury +29 -0
  241. package/dist/ghostty/themes/mettaton +29 -0
  242. package/dist/ghostty/themes/miku +29 -0
  243. package/dist/ghostty/themes/mio +29 -0
  244. package/dist/ghostty/themes/mion +29 -0
  245. package/dist/ghostty/themes/misato +29 -0
  246. package/dist/ghostty/themes/miyuki +29 -0
  247. package/dist/ghostty/themes/monika +29 -0
  248. package/dist/ghostty/themes/moon +29 -0
  249. package/dist/ghostty/themes/mugi +29 -0
  250. package/dist/ghostty/themes/nadeko +29 -0
  251. package/dist/ghostty/themes/nagisa +29 -0
  252. package/dist/ghostty/themes/natsuki +29 -0
  253. package/dist/ghostty/themes/nazuna +29 -0
  254. package/dist/ghostty/themes/neutral +29 -0
  255. package/dist/ghostty/themes/nightcity +29 -0
  256. package/dist/ghostty/themes/nijika +29 -0
  257. package/dist/ghostty/themes/oracle +29 -0
  258. package/dist/ghostty/themes/panther +29 -0
  259. package/dist/ghostty/themes/papyrus +29 -0
  260. package/dist/ghostty/themes/patchouli +29 -0
  261. package/dist/ghostty/themes/queen +29 -0
  262. package/dist/ghostty/themes/rebecca +29 -0
  263. package/dist/ghostty/themes/rei +29 -0
  264. package/dist/ghostty/themes/reimu +29 -0
  265. package/dist/ghostty/themes/rena +29 -0
  266. package/dist/ghostty/themes/rika +29 -0
  267. package/dist/ghostty/themes/rin +29 -0
  268. package/dist/ghostty/themes/ritsu +29 -0
  269. package/dist/ghostty/themes/rokkenjima +29 -0
  270. package/dist/ghostty/themes/ryo +29 -0
  271. package/dist/ghostty/themes/sans +29 -0
  272. package/dist/ghostty/themes/satoko +29 -0
  273. package/dist/ghostty/themes/sayaka +29 -0
  274. package/dist/ghostty/themes/sayori +29 -0
  275. package/dist/ghostty/themes/sei +29 -0
  276. package/dist/ghostty/themes/seri +29 -0
  277. package/dist/ghostty/themes/shinobu +29 -0
  278. package/dist/ghostty/themes/skull +29 -0
  279. package/dist/ghostty/themes/stella +29 -0
  280. package/dist/ghostty/themes/suzuha +29 -0
  281. package/dist/ghostty/themes/toriel +29 -0
  282. package/dist/ghostty/themes/tsubasa +29 -0
  283. package/dist/ghostty/themes/tsukasa +29 -0
  284. package/dist/ghostty/themes/undyne +29 -0
  285. package/dist/ghostty/themes/valhalla +29 -0
  286. package/dist/ghostty/themes/velvet +29 -0
  287. package/dist/ghostty/themes/venus +29 -0
  288. package/dist/ghostty/themes/yofukashi +29 -0
  289. package/dist/ghostty/themes/youmu +29 -0
  290. package/dist/ghostty/themes/yui +29 -0
  291. package/dist/ghostty/themes/yuri +29 -0
  292. package/dist/ghostty/ttheme.conf +9 -0
  293. package/dist/iterm2/alma.itermcolors +305 -0
  294. package/dist/iterm2/anko.itermcolors +305 -0
  295. package/dist/iterm2/asuka.itermcolors +305 -0
  296. package/dist/iterm2/azusa.itermcolors +305 -0
  297. package/dist/iterm2/battler.itermcolors +305 -0
  298. package/dist/iterm2/beatrice.itermcolors +305 -0
  299. package/dist/iterm2/bernkastel.itermcolors +305 -0
  300. package/dist/iterm2/bocchi.itermcolors +305 -0
  301. package/dist/iterm2/cirno.itermcolors +305 -0
  302. package/dist/iterm2/david.itermcolors +305 -0
  303. package/dist/iterm2/determination.itermcolors +305 -0
  304. package/dist/iterm2/dorothy.itermcolors +305 -0
  305. package/dist/iterm2/eva01.itermcolors +305 -0
  306. package/dist/iterm2/flandre.itermcolors +305 -0
  307. package/dist/iterm2/fox.itermcolors +305 -0
  308. package/dist/iterm2/glitch.itermcolors +305 -0
  309. package/dist/iterm2/hinamizawa.itermcolors +305 -0
  310. package/dist/iterm2/hitagi.itermcolors +305 -0
  311. package/dist/iterm2/homura.itermcolors +305 -0
  312. package/dist/iterm2/jill.itermcolors +305 -0
  313. package/dist/iterm2/joker.itermcolors +305 -0
  314. package/dist/iterm2/jupiter.itermcolors +305 -0
  315. package/dist/iterm2/kagami.itermcolors +305 -0
  316. package/dist/iterm2/kaito.itermcolors +305 -0
  317. package/dist/iterm2/kaworu.itermcolors +305 -0
  318. package/dist/iterm2/kita.itermcolors +305 -0
  319. package/dist/iterm2/konata.itermcolors +305 -0
  320. package/dist/iterm2/kou.itermcolors +305 -0
  321. package/dist/iterm2/kumori.itermcolors +305 -0
  322. package/dist/iterm2/kurisu.itermcolors +305 -0
  323. package/dist/iterm2/kyoko.itermcolors +305 -0
  324. package/dist/iterm2/kyubey.itermcolors +305 -0
  325. package/dist/iterm2/lain.itermcolors +305 -0
  326. package/dist/iterm2/lambdadelta.itermcolors +305 -0
  327. package/dist/iterm2/len.itermcolors +305 -0
  328. package/dist/iterm2/lucy.itermcolors +305 -0
  329. package/dist/iterm2/luka.itermcolors +305 -0
  330. package/dist/iterm2/madoka.itermcolors +305 -0
  331. package/dist/iterm2/magi.itermcolors +305 -0
  332. package/dist/iterm2/mami.itermcolors +305 -0
  333. package/dist/iterm2/marisa.itermcolors +305 -0
  334. package/dist/iterm2/mars.itermcolors +305 -0
  335. package/dist/iterm2/mayuri.itermcolors +305 -0
  336. package/dist/iterm2/meiko.itermcolors +305 -0
  337. package/dist/iterm2/mercury.itermcolors +305 -0
  338. package/dist/iterm2/mettaton.itermcolors +305 -0
  339. package/dist/iterm2/miku.itermcolors +305 -0
  340. package/dist/iterm2/mio.itermcolors +305 -0
  341. package/dist/iterm2/mion.itermcolors +305 -0
  342. package/dist/iterm2/misato.itermcolors +305 -0
  343. package/dist/iterm2/miyuki.itermcolors +305 -0
  344. package/dist/iterm2/monika.itermcolors +305 -0
  345. package/dist/iterm2/moon.itermcolors +305 -0
  346. package/dist/iterm2/mugi.itermcolors +305 -0
  347. package/dist/iterm2/nadeko.itermcolors +305 -0
  348. package/dist/iterm2/nagisa.itermcolors +305 -0
  349. package/dist/iterm2/natsuki.itermcolors +305 -0
  350. package/dist/iterm2/nazuna.itermcolors +305 -0
  351. package/dist/iterm2/neutral.itermcolors +305 -0
  352. package/dist/iterm2/nightcity.itermcolors +305 -0
  353. package/dist/iterm2/nijika.itermcolors +305 -0
  354. package/dist/iterm2/oracle.itermcolors +305 -0
  355. package/dist/iterm2/panther.itermcolors +305 -0
  356. package/dist/iterm2/papyrus.itermcolors +305 -0
  357. package/dist/iterm2/patchouli.itermcolors +305 -0
  358. package/dist/iterm2/queen.itermcolors +305 -0
  359. package/dist/iterm2/rebecca.itermcolors +305 -0
  360. package/dist/iterm2/rei.itermcolors +305 -0
  361. package/dist/iterm2/reimu.itermcolors +305 -0
  362. package/dist/iterm2/rena.itermcolors +305 -0
  363. package/dist/iterm2/rika.itermcolors +305 -0
  364. package/dist/iterm2/rin.itermcolors +305 -0
  365. package/dist/iterm2/ritsu.itermcolors +305 -0
  366. package/dist/iterm2/rokkenjima.itermcolors +305 -0
  367. package/dist/iterm2/ryo.itermcolors +305 -0
  368. package/dist/iterm2/sans.itermcolors +305 -0
  369. package/dist/iterm2/satoko.itermcolors +305 -0
  370. package/dist/iterm2/sayaka.itermcolors +305 -0
  371. package/dist/iterm2/sayori.itermcolors +305 -0
  372. package/dist/iterm2/sei.itermcolors +305 -0
  373. package/dist/iterm2/seri.itermcolors +305 -0
  374. package/dist/iterm2/shinobu.itermcolors +305 -0
  375. package/dist/iterm2/skull.itermcolors +305 -0
  376. package/dist/iterm2/stella.itermcolors +305 -0
  377. package/dist/iterm2/suzuha.itermcolors +305 -0
  378. package/dist/iterm2/toriel.itermcolors +305 -0
  379. package/dist/iterm2/tsubasa.itermcolors +305 -0
  380. package/dist/iterm2/tsukasa.itermcolors +305 -0
  381. package/dist/iterm2/undyne.itermcolors +305 -0
  382. package/dist/iterm2/valhalla.itermcolors +305 -0
  383. package/dist/iterm2/velvet.itermcolors +305 -0
  384. package/dist/iterm2/venus.itermcolors +305 -0
  385. package/dist/iterm2/yofukashi.itermcolors +305 -0
  386. package/dist/iterm2/youmu.itermcolors +305 -0
  387. package/dist/iterm2/yui.itermcolors +305 -0
  388. package/dist/iterm2/yuri.itermcolors +305 -0
  389. package/dist/kitty/config/alma.conf +4 -0
  390. package/dist/kitty/config/anko.conf +4 -0
  391. package/dist/kitty/config/asuka.conf +4 -0
  392. package/dist/kitty/config/azusa.conf +4 -0
  393. package/dist/kitty/config/battler.conf +4 -0
  394. package/dist/kitty/config/beatrice.conf +4 -0
  395. package/dist/kitty/config/bernkastel.conf +4 -0
  396. package/dist/kitty/config/bocchi.conf +4 -0
  397. package/dist/kitty/config/cirno.conf +4 -0
  398. package/dist/kitty/config/david.conf +4 -0
  399. package/dist/kitty/config/determination.conf +4 -0
  400. package/dist/kitty/config/dorothy.conf +4 -0
  401. package/dist/kitty/config/eva01.conf +4 -0
  402. package/dist/kitty/config/flandre.conf +4 -0
  403. package/dist/kitty/config/fox.conf +4 -0
  404. package/dist/kitty/config/glitch.conf +4 -0
  405. package/dist/kitty/config/hinamizawa.conf +4 -0
  406. package/dist/kitty/config/hitagi.conf +4 -0
  407. package/dist/kitty/config/homura.conf +4 -0
  408. package/dist/kitty/config/jill.conf +4 -0
  409. package/dist/kitty/config/joker.conf +4 -0
  410. package/dist/kitty/config/jupiter.conf +4 -0
  411. package/dist/kitty/config/kagami.conf +4 -0
  412. package/dist/kitty/config/kaito.conf +4 -0
  413. package/dist/kitty/config/kaworu.conf +4 -0
  414. package/dist/kitty/config/kita.conf +4 -0
  415. package/dist/kitty/config/konata.conf +4 -0
  416. package/dist/kitty/config/kou.conf +4 -0
  417. package/dist/kitty/config/kumori.conf +4 -0
  418. package/dist/kitty/config/kurisu.conf +4 -0
  419. package/dist/kitty/config/kyoko.conf +4 -0
  420. package/dist/kitty/config/kyubey.conf +4 -0
  421. package/dist/kitty/config/lain.conf +4 -0
  422. package/dist/kitty/config/lambdadelta.conf +4 -0
  423. package/dist/kitty/config/len.conf +4 -0
  424. package/dist/kitty/config/lucy.conf +4 -0
  425. package/dist/kitty/config/luka.conf +4 -0
  426. package/dist/kitty/config/madoka.conf +4 -0
  427. package/dist/kitty/config/magi.conf +4 -0
  428. package/dist/kitty/config/mami.conf +4 -0
  429. package/dist/kitty/config/marisa.conf +4 -0
  430. package/dist/kitty/config/mars.conf +4 -0
  431. package/dist/kitty/config/mayuri.conf +4 -0
  432. package/dist/kitty/config/meiko.conf +4 -0
  433. package/dist/kitty/config/mercury.conf +4 -0
  434. package/dist/kitty/config/mettaton.conf +4 -0
  435. package/dist/kitty/config/miku.conf +4 -0
  436. package/dist/kitty/config/mio.conf +4 -0
  437. package/dist/kitty/config/mion.conf +4 -0
  438. package/dist/kitty/config/misato.conf +4 -0
  439. package/dist/kitty/config/miyuki.conf +4 -0
  440. package/dist/kitty/config/monika.conf +4 -0
  441. package/dist/kitty/config/moon.conf +4 -0
  442. package/dist/kitty/config/mugi.conf +4 -0
  443. package/dist/kitty/config/nadeko.conf +4 -0
  444. package/dist/kitty/config/nagisa.conf +4 -0
  445. package/dist/kitty/config/natsuki.conf +4 -0
  446. package/dist/kitty/config/nazuna.conf +4 -0
  447. package/dist/kitty/config/neutral.conf +4 -0
  448. package/dist/kitty/config/nightcity.conf +4 -0
  449. package/dist/kitty/config/nijika.conf +4 -0
  450. package/dist/kitty/config/oracle.conf +4 -0
  451. package/dist/kitty/config/panther.conf +4 -0
  452. package/dist/kitty/config/papyrus.conf +4 -0
  453. package/dist/kitty/config/patchouli.conf +4 -0
  454. package/dist/kitty/config/queen.conf +4 -0
  455. package/dist/kitty/config/rebecca.conf +4 -0
  456. package/dist/kitty/config/rei.conf +4 -0
  457. package/dist/kitty/config/reimu.conf +4 -0
  458. package/dist/kitty/config/rena.conf +4 -0
  459. package/dist/kitty/config/rika.conf +4 -0
  460. package/dist/kitty/config/rin.conf +4 -0
  461. package/dist/kitty/config/ritsu.conf +4 -0
  462. package/dist/kitty/config/rokkenjima.conf +4 -0
  463. package/dist/kitty/config/ryo.conf +4 -0
  464. package/dist/kitty/config/sans.conf +4 -0
  465. package/dist/kitty/config/satoko.conf +4 -0
  466. package/dist/kitty/config/sayaka.conf +4 -0
  467. package/dist/kitty/config/sayori.conf +4 -0
  468. package/dist/kitty/config/sei.conf +4 -0
  469. package/dist/kitty/config/seri.conf +4 -0
  470. package/dist/kitty/config/shinobu.conf +4 -0
  471. package/dist/kitty/config/skull.conf +4 -0
  472. package/dist/kitty/config/stella.conf +4 -0
  473. package/dist/kitty/config/suzuha.conf +4 -0
  474. package/dist/kitty/config/toriel.conf +4 -0
  475. package/dist/kitty/config/tsubasa.conf +4 -0
  476. package/dist/kitty/config/tsukasa.conf +4 -0
  477. package/dist/kitty/config/undyne.conf +4 -0
  478. package/dist/kitty/config/valhalla.conf +4 -0
  479. package/dist/kitty/config/velvet.conf +4 -0
  480. package/dist/kitty/config/venus.conf +4 -0
  481. package/dist/kitty/config/yofukashi.conf +4 -0
  482. package/dist/kitty/config/youmu.conf +4 -0
  483. package/dist/kitty/config/yui.conf +4 -0
  484. package/dist/kitty/config/yuri.conf +4 -0
  485. package/dist/kitty/themes/alma.conf +24 -0
  486. package/dist/kitty/themes/anko.conf +24 -0
  487. package/dist/kitty/themes/asuka.conf +24 -0
  488. package/dist/kitty/themes/azusa.conf +24 -0
  489. package/dist/kitty/themes/battler.conf +24 -0
  490. package/dist/kitty/themes/beatrice.conf +24 -0
  491. package/dist/kitty/themes/bernkastel.conf +24 -0
  492. package/dist/kitty/themes/bocchi.conf +24 -0
  493. package/dist/kitty/themes/cirno.conf +24 -0
  494. package/dist/kitty/themes/david.conf +24 -0
  495. package/dist/kitty/themes/determination.conf +24 -0
  496. package/dist/kitty/themes/dorothy.conf +24 -0
  497. package/dist/kitty/themes/eva01.conf +24 -0
  498. package/dist/kitty/themes/flandre.conf +24 -0
  499. package/dist/kitty/themes/fox.conf +24 -0
  500. package/dist/kitty/themes/glitch.conf +24 -0
  501. package/dist/kitty/themes/hinamizawa.conf +24 -0
  502. package/dist/kitty/themes/hitagi.conf +24 -0
  503. package/dist/kitty/themes/homura.conf +24 -0
  504. package/dist/kitty/themes/jill.conf +24 -0
  505. package/dist/kitty/themes/joker.conf +24 -0
  506. package/dist/kitty/themes/jupiter.conf +24 -0
  507. package/dist/kitty/themes/kagami.conf +24 -0
  508. package/dist/kitty/themes/kaito.conf +24 -0
  509. package/dist/kitty/themes/kaworu.conf +24 -0
  510. package/dist/kitty/themes/kita.conf +24 -0
  511. package/dist/kitty/themes/konata.conf +24 -0
  512. package/dist/kitty/themes/kou.conf +24 -0
  513. package/dist/kitty/themes/kumori.conf +24 -0
  514. package/dist/kitty/themes/kurisu.conf +24 -0
  515. package/dist/kitty/themes/kyoko.conf +24 -0
  516. package/dist/kitty/themes/kyubey.conf +24 -0
  517. package/dist/kitty/themes/lain.conf +24 -0
  518. package/dist/kitty/themes/lambdadelta.conf +24 -0
  519. package/dist/kitty/themes/len.conf +24 -0
  520. package/dist/kitty/themes/lucy.conf +24 -0
  521. package/dist/kitty/themes/luka.conf +24 -0
  522. package/dist/kitty/themes/madoka.conf +24 -0
  523. package/dist/kitty/themes/magi.conf +24 -0
  524. package/dist/kitty/themes/mami.conf +24 -0
  525. package/dist/kitty/themes/marisa.conf +24 -0
  526. package/dist/kitty/themes/mars.conf +24 -0
  527. package/dist/kitty/themes/mayuri.conf +24 -0
  528. package/dist/kitty/themes/meiko.conf +24 -0
  529. package/dist/kitty/themes/mercury.conf +24 -0
  530. package/dist/kitty/themes/mettaton.conf +24 -0
  531. package/dist/kitty/themes/miku.conf +24 -0
  532. package/dist/kitty/themes/mio.conf +24 -0
  533. package/dist/kitty/themes/mion.conf +24 -0
  534. package/dist/kitty/themes/misato.conf +24 -0
  535. package/dist/kitty/themes/miyuki.conf +24 -0
  536. package/dist/kitty/themes/monika.conf +24 -0
  537. package/dist/kitty/themes/moon.conf +24 -0
  538. package/dist/kitty/themes/mugi.conf +24 -0
  539. package/dist/kitty/themes/nadeko.conf +24 -0
  540. package/dist/kitty/themes/nagisa.conf +24 -0
  541. package/dist/kitty/themes/natsuki.conf +24 -0
  542. package/dist/kitty/themes/nazuna.conf +24 -0
  543. package/dist/kitty/themes/neutral.conf +24 -0
  544. package/dist/kitty/themes/nightcity.conf +24 -0
  545. package/dist/kitty/themes/nijika.conf +24 -0
  546. package/dist/kitty/themes/oracle.conf +24 -0
  547. package/dist/kitty/themes/panther.conf +24 -0
  548. package/dist/kitty/themes/papyrus.conf +24 -0
  549. package/dist/kitty/themes/patchouli.conf +24 -0
  550. package/dist/kitty/themes/queen.conf +24 -0
  551. package/dist/kitty/themes/rebecca.conf +24 -0
  552. package/dist/kitty/themes/rei.conf +24 -0
  553. package/dist/kitty/themes/reimu.conf +24 -0
  554. package/dist/kitty/themes/rena.conf +24 -0
  555. package/dist/kitty/themes/rika.conf +24 -0
  556. package/dist/kitty/themes/rin.conf +24 -0
  557. package/dist/kitty/themes/ritsu.conf +24 -0
  558. package/dist/kitty/themes/rokkenjima.conf +24 -0
  559. package/dist/kitty/themes/ryo.conf +24 -0
  560. package/dist/kitty/themes/sans.conf +24 -0
  561. package/dist/kitty/themes/satoko.conf +24 -0
  562. package/dist/kitty/themes/sayaka.conf +24 -0
  563. package/dist/kitty/themes/sayori.conf +24 -0
  564. package/dist/kitty/themes/sei.conf +24 -0
  565. package/dist/kitty/themes/seri.conf +24 -0
  566. package/dist/kitty/themes/shinobu.conf +24 -0
  567. package/dist/kitty/themes/skull.conf +24 -0
  568. package/dist/kitty/themes/stella.conf +24 -0
  569. package/dist/kitty/themes/suzuha.conf +24 -0
  570. package/dist/kitty/themes/toriel.conf +24 -0
  571. package/dist/kitty/themes/tsubasa.conf +24 -0
  572. package/dist/kitty/themes/tsukasa.conf +24 -0
  573. package/dist/kitty/themes/undyne.conf +24 -0
  574. package/dist/kitty/themes/valhalla.conf +24 -0
  575. package/dist/kitty/themes/velvet.conf +24 -0
  576. package/dist/kitty/themes/venus.conf +24 -0
  577. package/dist/kitty/themes/yofukashi.conf +24 -0
  578. package/dist/kitty/themes/youmu.conf +24 -0
  579. package/dist/kitty/themes/yui.conf +24 -0
  580. package/dist/kitty/themes/yuri.conf +24 -0
  581. package/dist/shell/palettes.zsh +387 -0
  582. package/dist/wezterm/colors/alma.toml +15 -0
  583. package/dist/wezterm/colors/anko.toml +15 -0
  584. package/dist/wezterm/colors/asuka.toml +15 -0
  585. package/dist/wezterm/colors/azusa.toml +15 -0
  586. package/dist/wezterm/colors/battler.toml +15 -0
  587. package/dist/wezterm/colors/beatrice.toml +15 -0
  588. package/dist/wezterm/colors/bernkastel.toml +15 -0
  589. package/dist/wezterm/colors/bocchi.toml +15 -0
  590. package/dist/wezterm/colors/cirno.toml +15 -0
  591. package/dist/wezterm/colors/david.toml +15 -0
  592. package/dist/wezterm/colors/determination.toml +15 -0
  593. package/dist/wezterm/colors/dorothy.toml +15 -0
  594. package/dist/wezterm/colors/eva01.toml +15 -0
  595. package/dist/wezterm/colors/flandre.toml +15 -0
  596. package/dist/wezterm/colors/fox.toml +15 -0
  597. package/dist/wezterm/colors/glitch.toml +15 -0
  598. package/dist/wezterm/colors/hinamizawa.toml +15 -0
  599. package/dist/wezterm/colors/hitagi.toml +15 -0
  600. package/dist/wezterm/colors/homura.toml +15 -0
  601. package/dist/wezterm/colors/jill.toml +15 -0
  602. package/dist/wezterm/colors/joker.toml +15 -0
  603. package/dist/wezterm/colors/jupiter.toml +15 -0
  604. package/dist/wezterm/colors/kagami.toml +15 -0
  605. package/dist/wezterm/colors/kaito.toml +15 -0
  606. package/dist/wezterm/colors/kaworu.toml +15 -0
  607. package/dist/wezterm/colors/kita.toml +15 -0
  608. package/dist/wezterm/colors/konata.toml +15 -0
  609. package/dist/wezterm/colors/kou.toml +15 -0
  610. package/dist/wezterm/colors/kumori.toml +15 -0
  611. package/dist/wezterm/colors/kurisu.toml +15 -0
  612. package/dist/wezterm/colors/kyoko.toml +15 -0
  613. package/dist/wezterm/colors/kyubey.toml +15 -0
  614. package/dist/wezterm/colors/lain.toml +15 -0
  615. package/dist/wezterm/colors/lambdadelta.toml +15 -0
  616. package/dist/wezterm/colors/len.toml +15 -0
  617. package/dist/wezterm/colors/lucy.toml +15 -0
  618. package/dist/wezterm/colors/luka.toml +15 -0
  619. package/dist/wezterm/colors/madoka.toml +15 -0
  620. package/dist/wezterm/colors/magi.toml +15 -0
  621. package/dist/wezterm/colors/mami.toml +15 -0
  622. package/dist/wezterm/colors/marisa.toml +15 -0
  623. package/dist/wezterm/colors/mars.toml +15 -0
  624. package/dist/wezterm/colors/mayuri.toml +15 -0
  625. package/dist/wezterm/colors/meiko.toml +15 -0
  626. package/dist/wezterm/colors/mercury.toml +15 -0
  627. package/dist/wezterm/colors/mettaton.toml +15 -0
  628. package/dist/wezterm/colors/miku.toml +15 -0
  629. package/dist/wezterm/colors/mio.toml +15 -0
  630. package/dist/wezterm/colors/mion.toml +15 -0
  631. package/dist/wezterm/colors/misato.toml +15 -0
  632. package/dist/wezterm/colors/miyuki.toml +15 -0
  633. package/dist/wezterm/colors/monika.toml +15 -0
  634. package/dist/wezterm/colors/moon.toml +15 -0
  635. package/dist/wezterm/colors/mugi.toml +15 -0
  636. package/dist/wezterm/colors/nadeko.toml +15 -0
  637. package/dist/wezterm/colors/nagisa.toml +15 -0
  638. package/dist/wezterm/colors/natsuki.toml +15 -0
  639. package/dist/wezterm/colors/nazuna.toml +15 -0
  640. package/dist/wezterm/colors/neutral.toml +15 -0
  641. package/dist/wezterm/colors/nightcity.toml +15 -0
  642. package/dist/wezterm/colors/nijika.toml +15 -0
  643. package/dist/wezterm/colors/oracle.toml +15 -0
  644. package/dist/wezterm/colors/panther.toml +15 -0
  645. package/dist/wezterm/colors/papyrus.toml +15 -0
  646. package/dist/wezterm/colors/patchouli.toml +15 -0
  647. package/dist/wezterm/colors/queen.toml +15 -0
  648. package/dist/wezterm/colors/rebecca.toml +15 -0
  649. package/dist/wezterm/colors/rei.toml +15 -0
  650. package/dist/wezterm/colors/reimu.toml +15 -0
  651. package/dist/wezterm/colors/rena.toml +15 -0
  652. package/dist/wezterm/colors/rika.toml +15 -0
  653. package/dist/wezterm/colors/rin.toml +15 -0
  654. package/dist/wezterm/colors/ritsu.toml +15 -0
  655. package/dist/wezterm/colors/rokkenjima.toml +15 -0
  656. package/dist/wezterm/colors/ryo.toml +15 -0
  657. package/dist/wezterm/colors/sans.toml +15 -0
  658. package/dist/wezterm/colors/satoko.toml +15 -0
  659. package/dist/wezterm/colors/sayaka.toml +15 -0
  660. package/dist/wezterm/colors/sayori.toml +15 -0
  661. package/dist/wezterm/colors/sei.toml +15 -0
  662. package/dist/wezterm/colors/seri.toml +15 -0
  663. package/dist/wezterm/colors/shinobu.toml +15 -0
  664. package/dist/wezterm/colors/skull.toml +15 -0
  665. package/dist/wezterm/colors/stella.toml +15 -0
  666. package/dist/wezterm/colors/suzuha.toml +15 -0
  667. package/dist/wezterm/colors/toriel.toml +15 -0
  668. package/dist/wezterm/colors/tsubasa.toml +15 -0
  669. package/dist/wezterm/colors/tsukasa.toml +15 -0
  670. package/dist/wezterm/colors/undyne.toml +15 -0
  671. package/dist/wezterm/colors/valhalla.toml +15 -0
  672. package/dist/wezterm/colors/velvet.toml +15 -0
  673. package/dist/wezterm/colors/venus.toml +15 -0
  674. package/dist/wezterm/colors/yofukashi.toml +15 -0
  675. package/dist/wezterm/colors/youmu.toml +15 -0
  676. package/dist/wezterm/colors/yui.toml +15 -0
  677. package/dist/wezterm/colors/yuri.toml +15 -0
  678. package/dist/wezterm/config/alma.lua +10 -0
  679. package/dist/wezterm/config/anko.lua +10 -0
  680. package/dist/wezterm/config/asuka.lua +10 -0
  681. package/dist/wezterm/config/azusa.lua +10 -0
  682. package/dist/wezterm/config/battler.lua +10 -0
  683. package/dist/wezterm/config/beatrice.lua +10 -0
  684. package/dist/wezterm/config/bernkastel.lua +10 -0
  685. package/dist/wezterm/config/bocchi.lua +10 -0
  686. package/dist/wezterm/config/cirno.lua +10 -0
  687. package/dist/wezterm/config/david.lua +10 -0
  688. package/dist/wezterm/config/determination.lua +10 -0
  689. package/dist/wezterm/config/dorothy.lua +10 -0
  690. package/dist/wezterm/config/eva01.lua +10 -0
  691. package/dist/wezterm/config/flandre.lua +10 -0
  692. package/dist/wezterm/config/fox.lua +10 -0
  693. package/dist/wezterm/config/glitch.lua +10 -0
  694. package/dist/wezterm/config/hinamizawa.lua +10 -0
  695. package/dist/wezterm/config/hitagi.lua +10 -0
  696. package/dist/wezterm/config/homura.lua +10 -0
  697. package/dist/wezterm/config/jill.lua +10 -0
  698. package/dist/wezterm/config/joker.lua +10 -0
  699. package/dist/wezterm/config/jupiter.lua +10 -0
  700. package/dist/wezterm/config/kagami.lua +10 -0
  701. package/dist/wezterm/config/kaito.lua +10 -0
  702. package/dist/wezterm/config/kaworu.lua +10 -0
  703. package/dist/wezterm/config/kita.lua +10 -0
  704. package/dist/wezterm/config/konata.lua +10 -0
  705. package/dist/wezterm/config/kou.lua +10 -0
  706. package/dist/wezterm/config/kumori.lua +10 -0
  707. package/dist/wezterm/config/kurisu.lua +10 -0
  708. package/dist/wezterm/config/kyoko.lua +10 -0
  709. package/dist/wezterm/config/kyubey.lua +10 -0
  710. package/dist/wezterm/config/lain.lua +10 -0
  711. package/dist/wezterm/config/lambdadelta.lua +10 -0
  712. package/dist/wezterm/config/len.lua +10 -0
  713. package/dist/wezterm/config/lucy.lua +10 -0
  714. package/dist/wezterm/config/luka.lua +10 -0
  715. package/dist/wezterm/config/madoka.lua +10 -0
  716. package/dist/wezterm/config/magi.lua +10 -0
  717. package/dist/wezterm/config/mami.lua +10 -0
  718. package/dist/wezterm/config/marisa.lua +10 -0
  719. package/dist/wezterm/config/mars.lua +10 -0
  720. package/dist/wezterm/config/mayuri.lua +10 -0
  721. package/dist/wezterm/config/meiko.lua +10 -0
  722. package/dist/wezterm/config/mercury.lua +10 -0
  723. package/dist/wezterm/config/mettaton.lua +10 -0
  724. package/dist/wezterm/config/miku.lua +10 -0
  725. package/dist/wezterm/config/mio.lua +10 -0
  726. package/dist/wezterm/config/mion.lua +10 -0
  727. package/dist/wezterm/config/misato.lua +10 -0
  728. package/dist/wezterm/config/miyuki.lua +10 -0
  729. package/dist/wezterm/config/monika.lua +10 -0
  730. package/dist/wezterm/config/moon.lua +10 -0
  731. package/dist/wezterm/config/mugi.lua +10 -0
  732. package/dist/wezterm/config/nadeko.lua +10 -0
  733. package/dist/wezterm/config/nagisa.lua +10 -0
  734. package/dist/wezterm/config/natsuki.lua +10 -0
  735. package/dist/wezterm/config/nazuna.lua +10 -0
  736. package/dist/wezterm/config/neutral.lua +10 -0
  737. package/dist/wezterm/config/nightcity.lua +10 -0
  738. package/dist/wezterm/config/nijika.lua +10 -0
  739. package/dist/wezterm/config/oracle.lua +10 -0
  740. package/dist/wezterm/config/panther.lua +10 -0
  741. package/dist/wezterm/config/papyrus.lua +10 -0
  742. package/dist/wezterm/config/patchouli.lua +10 -0
  743. package/dist/wezterm/config/queen.lua +10 -0
  744. package/dist/wezterm/config/rebecca.lua +10 -0
  745. package/dist/wezterm/config/rei.lua +10 -0
  746. package/dist/wezterm/config/reimu.lua +10 -0
  747. package/dist/wezterm/config/rena.lua +10 -0
  748. package/dist/wezterm/config/rika.lua +10 -0
  749. package/dist/wezterm/config/rin.lua +10 -0
  750. package/dist/wezterm/config/ritsu.lua +10 -0
  751. package/dist/wezterm/config/rokkenjima.lua +10 -0
  752. package/dist/wezterm/config/ryo.lua +10 -0
  753. package/dist/wezterm/config/sans.lua +10 -0
  754. package/dist/wezterm/config/satoko.lua +10 -0
  755. package/dist/wezterm/config/sayaka.lua +10 -0
  756. package/dist/wezterm/config/sayori.lua +10 -0
  757. package/dist/wezterm/config/sei.lua +10 -0
  758. package/dist/wezterm/config/seri.lua +10 -0
  759. package/dist/wezterm/config/shinobu.lua +10 -0
  760. package/dist/wezterm/config/skull.lua +10 -0
  761. package/dist/wezterm/config/stella.lua +10 -0
  762. package/dist/wezterm/config/suzuha.lua +10 -0
  763. package/dist/wezterm/config/toriel.lua +10 -0
  764. package/dist/wezterm/config/tsubasa.lua +10 -0
  765. package/dist/wezterm/config/tsukasa.lua +10 -0
  766. package/dist/wezterm/config/undyne.lua +10 -0
  767. package/dist/wezterm/config/valhalla.lua +10 -0
  768. package/dist/wezterm/config/velvet.lua +10 -0
  769. package/dist/wezterm/config/venus.lua +10 -0
  770. package/dist/wezterm/config/yofukashi.lua +10 -0
  771. package/dist/wezterm/config/youmu.lua +10 -0
  772. package/dist/wezterm/config/yui.lua +10 -0
  773. package/dist/wezterm/config/yuri.lua +10 -0
  774. package/ghostty/shaders/LICENSE +21 -0
  775. package/ghostty/shaders/README.md +31 -0
  776. package/ghostty/shaders/cursor_tail.glsl +243 -0
  777. package/ghostty/shaders/ripple_cursor.glsl +141 -0
  778. package/package.json +43 -0
  779. package/shell/adapters/_osc.zsh +35 -0
  780. package/shell/adapters/kitty.zsh +30 -0
  781. package/shell/launch-tab.zsh +11 -0
  782. package/shell/ttheme.zsh +583 -0
package/bin/ttheme.js ADDED
@@ -0,0 +1,4473 @@
1
+ #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+
34
+ // node_modules/sisteransi/src/index.js
35
+ var require_src = __commonJS((exports, module) => {
36
+ var ESC2 = "\x1B";
37
+ var CSI2 = `${ESC2}[`;
38
+ var beep = "\x07";
39
+ var cursor = {
40
+ to(x, y) {
41
+ if (!y)
42
+ return `${CSI2}${x + 1}G`;
43
+ return `${CSI2}${y + 1};${x + 1}H`;
44
+ },
45
+ move(x, y) {
46
+ let ret = "";
47
+ if (x < 0)
48
+ ret += `${CSI2}${-x}D`;
49
+ else if (x > 0)
50
+ ret += `${CSI2}${x}C`;
51
+ if (y < 0)
52
+ ret += `${CSI2}${-y}A`;
53
+ else if (y > 0)
54
+ ret += `${CSI2}${y}B`;
55
+ return ret;
56
+ },
57
+ up: (count = 1) => `${CSI2}${count}A`,
58
+ down: (count = 1) => `${CSI2}${count}B`,
59
+ forward: (count = 1) => `${CSI2}${count}C`,
60
+ backward: (count = 1) => `${CSI2}${count}D`,
61
+ nextLine: (count = 1) => `${CSI2}E`.repeat(count),
62
+ prevLine: (count = 1) => `${CSI2}F`.repeat(count),
63
+ left: `${CSI2}G`,
64
+ hide: `${CSI2}?25l`,
65
+ show: `${CSI2}?25h`,
66
+ save: `${ESC2}7`,
67
+ restore: `${ESC2}8`
68
+ };
69
+ var scroll = {
70
+ up: (count = 1) => `${CSI2}S`.repeat(count),
71
+ down: (count = 1) => `${CSI2}T`.repeat(count)
72
+ };
73
+ var erase = {
74
+ screen: `${CSI2}2J`,
75
+ up: (count = 1) => `${CSI2}1J`.repeat(count),
76
+ down: (count = 1) => `${CSI2}J`.repeat(count),
77
+ line: `${CSI2}2K`,
78
+ lineEnd: `${CSI2}K`,
79
+ lineStart: `${CSI2}1K`,
80
+ lines(count) {
81
+ let clear = "";
82
+ for (let i = 0;i < count; i++)
83
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
84
+ if (count)
85
+ clear += cursor.left;
86
+ return clear;
87
+ }
88
+ };
89
+ module.exports = { cursor, scroll, erase, beep };
90
+ });
91
+
92
+ // node_modules/commander/lib/error.js
93
+ class CommanderError extends Error {
94
+ constructor(exitCode, code, message) {
95
+ super(message);
96
+ Error.captureStackTrace(this, this.constructor);
97
+ this.name = this.constructor.name;
98
+ this.code = code;
99
+ this.exitCode = exitCode;
100
+ this.nestedError = undefined;
101
+ }
102
+ }
103
+
104
+ class InvalidArgumentError extends CommanderError {
105
+ constructor(message) {
106
+ super(1, "commander.invalidArgument", message);
107
+ Error.captureStackTrace(this, this.constructor);
108
+ this.name = this.constructor.name;
109
+ }
110
+ }
111
+
112
+ // node_modules/commander/lib/argument.js
113
+ class Argument {
114
+ constructor(name, description) {
115
+ this.description = description || "";
116
+ this.variadic = false;
117
+ this.parseArg = undefined;
118
+ this.defaultValue = undefined;
119
+ this.defaultValueDescription = undefined;
120
+ this.argChoices = undefined;
121
+ switch (name[0]) {
122
+ case "<":
123
+ this.required = true;
124
+ this._name = name.slice(1, -1);
125
+ break;
126
+ case "[":
127
+ this.required = false;
128
+ this._name = name.slice(1, -1);
129
+ break;
130
+ default:
131
+ this.required = true;
132
+ this._name = name;
133
+ break;
134
+ }
135
+ if (this._name.endsWith("...")) {
136
+ this.variadic = true;
137
+ this._name = this._name.slice(0, -3);
138
+ }
139
+ }
140
+ name() {
141
+ return this._name;
142
+ }
143
+ _collectValue(value, previous) {
144
+ if (previous === this.defaultValue || !Array.isArray(previous)) {
145
+ return [value];
146
+ }
147
+ previous.push(value);
148
+ return previous;
149
+ }
150
+ default(value, description) {
151
+ this.defaultValue = value;
152
+ this.defaultValueDescription = description;
153
+ return this;
154
+ }
155
+ argParser(fn) {
156
+ this.parseArg = fn;
157
+ return this;
158
+ }
159
+ choices(values) {
160
+ this.argChoices = values.slice();
161
+ this.parseArg = (arg, previous) => {
162
+ if (!this.argChoices.includes(arg)) {
163
+ throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
164
+ }
165
+ if (this.variadic) {
166
+ return this._collectValue(arg, previous);
167
+ }
168
+ return arg;
169
+ };
170
+ return this;
171
+ }
172
+ argRequired() {
173
+ this.required = true;
174
+ return this;
175
+ }
176
+ argOptional() {
177
+ this.required = false;
178
+ return this;
179
+ }
180
+ }
181
+ function humanReadableArgName(arg) {
182
+ const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
183
+ return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
184
+ }
185
+
186
+ // node_modules/commander/lib/command.js
187
+ import { EventEmitter } from "node:events";
188
+ import childProcess from "node:child_process";
189
+ import path from "node:path";
190
+ import fs from "node:fs";
191
+ import process2 from "node:process";
192
+ import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
193
+
194
+ // node_modules/commander/lib/help.js
195
+ import { stripVTControlCharacters } from "node:util";
196
+
197
+ class Help {
198
+ constructor() {
199
+ this.helpWidth = undefined;
200
+ this.minWidthToWrap = 40;
201
+ this.sortSubcommands = false;
202
+ this.sortOptions = false;
203
+ this.showGlobalOptions = false;
204
+ }
205
+ prepareContext(contextOptions) {
206
+ this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
207
+ }
208
+ visibleCommands(cmd) {
209
+ const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
210
+ const helpCommand = cmd._getHelpCommand();
211
+ if (helpCommand && !helpCommand._hidden) {
212
+ visibleCommands.push(helpCommand);
213
+ }
214
+ if (this.sortSubcommands) {
215
+ visibleCommands.sort((a, b) => {
216
+ return a.name().localeCompare(b.name());
217
+ });
218
+ }
219
+ return visibleCommands;
220
+ }
221
+ compareOptions(a, b) {
222
+ const getSortKey = (option) => {
223
+ return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
224
+ };
225
+ return getSortKey(a).localeCompare(getSortKey(b));
226
+ }
227
+ visibleOptions(cmd) {
228
+ const visibleOptions = cmd.options.filter((option) => !option.hidden);
229
+ const helpOption = cmd._getHelpOption();
230
+ if (helpOption && !helpOption.hidden) {
231
+ const removeShort = helpOption.short && cmd._findOption(helpOption.short);
232
+ const removeLong = helpOption.long && cmd._findOption(helpOption.long);
233
+ if (!removeShort && !removeLong) {
234
+ visibleOptions.push(helpOption);
235
+ } else if (helpOption.long && !removeLong) {
236
+ visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
237
+ } else if (helpOption.short && !removeShort) {
238
+ visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
239
+ }
240
+ }
241
+ if (this.sortOptions) {
242
+ visibleOptions.sort(this.compareOptions);
243
+ }
244
+ return visibleOptions;
245
+ }
246
+ visibleGlobalOptions(cmd) {
247
+ if (!this.showGlobalOptions)
248
+ return [];
249
+ const globalOptions = [];
250
+ for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
251
+ const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden);
252
+ globalOptions.push(...visibleOptions);
253
+ }
254
+ if (this.sortOptions) {
255
+ globalOptions.sort(this.compareOptions);
256
+ }
257
+ return globalOptions;
258
+ }
259
+ visibleArguments(cmd) {
260
+ if (cmd._argsDescription) {
261
+ cmd.registeredArguments.forEach((argument) => {
262
+ argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
263
+ });
264
+ }
265
+ if (cmd.registeredArguments.find((argument) => argument.description)) {
266
+ return cmd.registeredArguments;
267
+ }
268
+ return [];
269
+ }
270
+ subcommandTerm(cmd) {
271
+ const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
272
+ return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : "");
273
+ }
274
+ optionTerm(option) {
275
+ return option.flags;
276
+ }
277
+ argumentTerm(argument) {
278
+ return argument.name();
279
+ }
280
+ longestSubcommandTermLength(cmd, helper) {
281
+ return helper.visibleCommands(cmd).reduce((max, command) => {
282
+ return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
283
+ }, 0);
284
+ }
285
+ longestOptionTermLength(cmd, helper) {
286
+ return helper.visibleOptions(cmd).reduce((max, option) => {
287
+ return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
288
+ }, 0);
289
+ }
290
+ longestGlobalOptionTermLength(cmd, helper) {
291
+ return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
292
+ return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
293
+ }, 0);
294
+ }
295
+ longestArgumentTermLength(cmd, helper) {
296
+ return helper.visibleArguments(cmd).reduce((max, argument) => {
297
+ return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
298
+ }, 0);
299
+ }
300
+ commandUsage(cmd) {
301
+ let cmdName = cmd._name;
302
+ if (cmd._aliases[0]) {
303
+ cmdName = cmdName + "|" + cmd._aliases[0];
304
+ }
305
+ let ancestorCmdNames = "";
306
+ for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
307
+ ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
308
+ }
309
+ return ancestorCmdNames + cmdName + " " + cmd.usage();
310
+ }
311
+ commandDescription(cmd) {
312
+ return cmd.description();
313
+ }
314
+ subcommandDescription(cmd) {
315
+ return cmd.summary() || cmd.description();
316
+ }
317
+ optionDescription(option) {
318
+ const extraInfo = [];
319
+ if (option.argChoices) {
320
+ extraInfo.push(`choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
321
+ }
322
+ if (option.defaultValue !== undefined) {
323
+ const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean";
324
+ if (showDefault) {
325
+ extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`);
326
+ }
327
+ }
328
+ if (option.presetArg !== undefined && option.optional) {
329
+ extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);
330
+ }
331
+ if (option.envVar !== undefined) {
332
+ extraInfo.push(`env: ${option.envVar}`);
333
+ }
334
+ if (extraInfo.length > 0) {
335
+ const extraDescription = `(${extraInfo.join(", ")})`;
336
+ if (option.description) {
337
+ return `${option.description} ${extraDescription}`;
338
+ }
339
+ return extraDescription;
340
+ }
341
+ return option.description;
342
+ }
343
+ argumentDescription(argument) {
344
+ const extraInfo = [];
345
+ if (argument.argChoices) {
346
+ extraInfo.push(`choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
347
+ }
348
+ if (argument.defaultValue !== undefined) {
349
+ extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
350
+ }
351
+ if (extraInfo.length > 0) {
352
+ const extraDescription = `(${extraInfo.join(", ")})`;
353
+ if (argument.description) {
354
+ return `${argument.description} ${extraDescription}`;
355
+ }
356
+ return extraDescription;
357
+ }
358
+ return argument.description;
359
+ }
360
+ formatItemList(heading, items, helper) {
361
+ if (items.length === 0)
362
+ return [];
363
+ return [helper.styleTitle(heading), ...items, ""];
364
+ }
365
+ groupItems(unsortedItems, visibleItems, getGroup) {
366
+ const result = new Map;
367
+ unsortedItems.forEach((item) => {
368
+ const group = getGroup(item);
369
+ if (!result.has(group))
370
+ result.set(group, []);
371
+ });
372
+ visibleItems.forEach((item) => {
373
+ const group = getGroup(item);
374
+ if (!result.has(group)) {
375
+ result.set(group, []);
376
+ }
377
+ result.get(group).push(item);
378
+ });
379
+ return result;
380
+ }
381
+ formatHelp(cmd, helper) {
382
+ const termWidth = helper.padWidth(cmd, helper);
383
+ const helpWidth = helper.helpWidth ?? 80;
384
+ function callFormatItem(term, description) {
385
+ return helper.formatItem(term, termWidth, description, helper);
386
+ }
387
+ let output = [
388
+ `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
389
+ ""
390
+ ];
391
+ const commandDescription = helper.commandDescription(cmd);
392
+ if (commandDescription.length > 0) {
393
+ output = output.concat([
394
+ helper.boxWrap(helper.styleCommandDescription(commandDescription), helpWidth),
395
+ ""
396
+ ]);
397
+ }
398
+ const argumentList = helper.visibleArguments(cmd).map((argument) => {
399
+ return callFormatItem(helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)));
400
+ });
401
+ output = output.concat(this.formatItemList("Arguments:", argumentList, helper));
402
+ const optionGroups = this.groupItems(cmd.options, helper.visibleOptions(cmd), (option) => option.helpGroupHeading ?? "Options:");
403
+ optionGroups.forEach((options, group) => {
404
+ const optionList = options.map((option) => {
405
+ return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
406
+ });
407
+ output = output.concat(this.formatItemList(group, optionList, helper));
408
+ });
409
+ if (helper.showGlobalOptions) {
410
+ const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
411
+ return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
412
+ });
413
+ output = output.concat(this.formatItemList("Global Options:", globalOptionList, helper));
414
+ }
415
+ const commandGroups = this.groupItems(cmd.commands, helper.visibleCommands(cmd), (sub) => sub.helpGroup() || "Commands:");
416
+ commandGroups.forEach((commands, group) => {
417
+ const commandList = commands.map((sub) => {
418
+ return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(sub)), helper.styleSubcommandDescription(helper.subcommandDescription(sub)));
419
+ });
420
+ output = output.concat(this.formatItemList(group, commandList, helper));
421
+ });
422
+ return output.join(`
423
+ `);
424
+ }
425
+ displayWidth(str) {
426
+ return stripVTControlCharacters(str).length;
427
+ }
428
+ styleTitle(str) {
429
+ return str;
430
+ }
431
+ styleUsage(str) {
432
+ return str.split(" ").map((word) => {
433
+ if (word === "[options]")
434
+ return this.styleOptionText(word);
435
+ if (word === "[command]")
436
+ return this.styleSubcommandText(word);
437
+ if (word[0] === "[" || word[0] === "<")
438
+ return this.styleArgumentText(word);
439
+ return this.styleCommandText(word);
440
+ }).join(" ");
441
+ }
442
+ styleCommandDescription(str) {
443
+ return this.styleDescriptionText(str);
444
+ }
445
+ styleOptionDescription(str) {
446
+ return this.styleDescriptionText(str);
447
+ }
448
+ styleSubcommandDescription(str) {
449
+ return this.styleDescriptionText(str);
450
+ }
451
+ styleArgumentDescription(str) {
452
+ return this.styleDescriptionText(str);
453
+ }
454
+ styleDescriptionText(str) {
455
+ return str;
456
+ }
457
+ styleOptionTerm(str) {
458
+ return this.styleOptionText(str);
459
+ }
460
+ styleSubcommandTerm(str) {
461
+ return str.split(" ").map((word) => {
462
+ if (word === "[options]")
463
+ return this.styleOptionText(word);
464
+ if (word[0] === "[" || word[0] === "<")
465
+ return this.styleArgumentText(word);
466
+ return this.styleSubcommandText(word);
467
+ }).join(" ");
468
+ }
469
+ styleArgumentTerm(str) {
470
+ return this.styleArgumentText(str);
471
+ }
472
+ styleOptionText(str) {
473
+ return str;
474
+ }
475
+ styleArgumentText(str) {
476
+ return str;
477
+ }
478
+ styleSubcommandText(str) {
479
+ return str;
480
+ }
481
+ styleCommandText(str) {
482
+ return str;
483
+ }
484
+ padWidth(cmd, helper) {
485
+ return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
486
+ }
487
+ preformatted(str) {
488
+ return /\n[^\S\r\n]/.test(str);
489
+ }
490
+ formatItem(term, termWidth, description, helper) {
491
+ const itemIndent = 2;
492
+ const itemIndentStr = " ".repeat(itemIndent);
493
+ if (!description)
494
+ return itemIndentStr + term;
495
+ const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
496
+ const spacerWidth = 2;
497
+ const helpWidth = this.helpWidth ?? 80;
498
+ const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
499
+ let formattedDescription;
500
+ if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
501
+ formattedDescription = description;
502
+ } else {
503
+ const wrappedDescription = helper.boxWrap(description, remainingWidth);
504
+ formattedDescription = wrappedDescription.replace(/\n/g, `
505
+ ` + " ".repeat(termWidth + spacerWidth));
506
+ }
507
+ return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
508
+ ${itemIndentStr}`);
509
+ }
510
+ boxWrap(str, width) {
511
+ if (width < this.minWidthToWrap)
512
+ return str;
513
+ const rawLines = str.split(/\r\n|\n/);
514
+ const chunkPattern = /[\s]*[^\s]+/g;
515
+ const wrappedLines = [];
516
+ rawLines.forEach((line) => {
517
+ const chunks = line.match(chunkPattern);
518
+ if (chunks === null) {
519
+ wrappedLines.push("");
520
+ return;
521
+ }
522
+ let sumChunks = [chunks.shift()];
523
+ let sumWidth = this.displayWidth(sumChunks[0]);
524
+ chunks.forEach((chunk) => {
525
+ const visibleWidth = this.displayWidth(chunk);
526
+ if (sumWidth + visibleWidth <= width) {
527
+ sumChunks.push(chunk);
528
+ sumWidth += visibleWidth;
529
+ return;
530
+ }
531
+ wrappedLines.push(sumChunks.join(""));
532
+ const nextChunk = chunk.trimStart();
533
+ sumChunks = [nextChunk];
534
+ sumWidth = this.displayWidth(nextChunk);
535
+ });
536
+ wrappedLines.push(sumChunks.join(""));
537
+ });
538
+ return wrappedLines.join(`
539
+ `);
540
+ }
541
+ }
542
+
543
+ // node_modules/commander/lib/option.js
544
+ class Option {
545
+ constructor(flags, description) {
546
+ this.flags = flags;
547
+ this.description = description || "";
548
+ this.required = flags.includes("<");
549
+ this.optional = flags.includes("[");
550
+ this.variadic = /\w\.\.\.[>\]]$/.test(flags);
551
+ this.mandatory = false;
552
+ const optionFlags = splitOptionFlags(flags);
553
+ this.short = optionFlags.shortFlag;
554
+ this.long = optionFlags.longFlag;
555
+ this.negate = false;
556
+ if (this.long) {
557
+ this.negate = this.long.startsWith("--no-");
558
+ }
559
+ this.defaultValue = undefined;
560
+ this.defaultValueDescription = undefined;
561
+ this.presetArg = undefined;
562
+ this.envVar = undefined;
563
+ this.parseArg = undefined;
564
+ this.hidden = false;
565
+ this.argChoices = undefined;
566
+ this.conflictsWith = [];
567
+ this.implied = undefined;
568
+ this.helpGroupHeading = undefined;
569
+ }
570
+ default(value, description) {
571
+ this.defaultValue = value;
572
+ this.defaultValueDescription = description;
573
+ return this;
574
+ }
575
+ preset(arg) {
576
+ this.presetArg = arg;
577
+ return this;
578
+ }
579
+ conflicts(names) {
580
+ this.conflictsWith = this.conflictsWith.concat(names);
581
+ return this;
582
+ }
583
+ implies(impliedOptionValues) {
584
+ let newImplied = impliedOptionValues;
585
+ if (typeof impliedOptionValues === "string") {
586
+ newImplied = { [impliedOptionValues]: true };
587
+ }
588
+ this.implied = Object.assign(this.implied || {}, newImplied);
589
+ return this;
590
+ }
591
+ env(name) {
592
+ this.envVar = name;
593
+ return this;
594
+ }
595
+ argParser(fn) {
596
+ this.parseArg = fn;
597
+ return this;
598
+ }
599
+ makeOptionMandatory(mandatory = true) {
600
+ this.mandatory = !!mandatory;
601
+ return this;
602
+ }
603
+ hideHelp(hide = true) {
604
+ this.hidden = !!hide;
605
+ return this;
606
+ }
607
+ _collectValue(value, previous) {
608
+ if (previous === this.defaultValue || !Array.isArray(previous)) {
609
+ return [value];
610
+ }
611
+ previous.push(value);
612
+ return previous;
613
+ }
614
+ choices(values) {
615
+ this.argChoices = values.slice();
616
+ this.parseArg = (arg, previous) => {
617
+ if (!this.argChoices.includes(arg)) {
618
+ throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
619
+ }
620
+ if (this.variadic) {
621
+ return this._collectValue(arg, previous);
622
+ }
623
+ return arg;
624
+ };
625
+ return this;
626
+ }
627
+ name() {
628
+ if (this.long) {
629
+ return this.long.replace(/^--/, "");
630
+ }
631
+ return this.short.replace(/^-/, "");
632
+ }
633
+ attributeName() {
634
+ if (this.negate) {
635
+ return camelcase(this.name().replace(/^no-/, ""));
636
+ }
637
+ return camelcase(this.name());
638
+ }
639
+ helpGroup(heading) {
640
+ this.helpGroupHeading = heading;
641
+ return this;
642
+ }
643
+ is(arg) {
644
+ return this.short === arg || this.long === arg;
645
+ }
646
+ isBoolean() {
647
+ return !this.required && !this.optional && !this.negate;
648
+ }
649
+ }
650
+
651
+ class DualOptions {
652
+ constructor(options) {
653
+ this.positiveOptions = new Map;
654
+ this.negativeOptions = new Map;
655
+ this.dualOptions = new Set;
656
+ options.forEach((option) => {
657
+ if (option.negate) {
658
+ this.negativeOptions.set(option.attributeName(), option);
659
+ } else {
660
+ this.positiveOptions.set(option.attributeName(), option);
661
+ }
662
+ });
663
+ this.negativeOptions.forEach((value, key) => {
664
+ if (this.positiveOptions.has(key)) {
665
+ this.dualOptions.add(key);
666
+ }
667
+ });
668
+ }
669
+ valueFromOption(value, option) {
670
+ const optionKey = option.attributeName();
671
+ if (!this.dualOptions.has(optionKey))
672
+ return true;
673
+ const preset = this.negativeOptions.get(optionKey).presetArg;
674
+ const negativeValue = preset !== undefined ? preset : false;
675
+ return option.negate === (negativeValue === value);
676
+ }
677
+ }
678
+ function camelcase(str) {
679
+ return str.split("-").reduce((str2, word) => {
680
+ return str2 + word[0].toUpperCase() + word.slice(1);
681
+ });
682
+ }
683
+ function splitOptionFlags(flags) {
684
+ let shortFlag;
685
+ let longFlag;
686
+ const shortFlagExp = /^-[^-]$/;
687
+ const longFlagExp = /^--[^-]/;
688
+ const flagParts = flags.split(/[ |,]+/).concat("guard");
689
+ if (shortFlagExp.test(flagParts[0]))
690
+ shortFlag = flagParts.shift();
691
+ if (longFlagExp.test(flagParts[0]))
692
+ longFlag = flagParts.shift();
693
+ if (!shortFlag && shortFlagExp.test(flagParts[0]))
694
+ shortFlag = flagParts.shift();
695
+ if (!shortFlag && longFlagExp.test(flagParts[0])) {
696
+ shortFlag = longFlag;
697
+ longFlag = flagParts.shift();
698
+ }
699
+ if (flagParts[0].startsWith("-")) {
700
+ const unsupportedFlag = flagParts[0];
701
+ const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
702
+ if (/^-[^-][^-]/.test(unsupportedFlag))
703
+ throw new Error(`${baseError}
704
+ - a short flag is a single dash and a single character
705
+ - either use a single dash and a single character (for a short flag)
706
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
707
+ if (shortFlagExp.test(unsupportedFlag))
708
+ throw new Error(`${baseError}
709
+ - too many short flags`);
710
+ if (longFlagExp.test(unsupportedFlag))
711
+ throw new Error(`${baseError}
712
+ - too many long flags`);
713
+ throw new Error(`${baseError}
714
+ - unrecognised flag format`);
715
+ }
716
+ if (shortFlag === undefined && longFlag === undefined)
717
+ throw new Error(`option creation failed due to no flags found in '${flags}'.`);
718
+ return { shortFlag, longFlag };
719
+ }
720
+
721
+ // node_modules/commander/lib/suggestSimilar.js
722
+ var maxDistance = 3;
723
+ function editDistance(a, b) {
724
+ if (Math.abs(a.length - b.length) > maxDistance)
725
+ return Math.max(a.length, b.length);
726
+ const d = [];
727
+ for (let i = 0;i <= a.length; i++) {
728
+ d[i] = [i];
729
+ }
730
+ for (let j = 0;j <= b.length; j++) {
731
+ d[0][j] = j;
732
+ }
733
+ for (let j = 1;j <= b.length; j++) {
734
+ for (let i = 1;i <= a.length; i++) {
735
+ let cost;
736
+ if (a[i - 1] === b[j - 1]) {
737
+ cost = 0;
738
+ } else {
739
+ cost = 1;
740
+ }
741
+ d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
742
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
743
+ d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
744
+ }
745
+ }
746
+ }
747
+ return d[a.length][b.length];
748
+ }
749
+ function suggestSimilar(word, candidates) {
750
+ if (!candidates || candidates.length === 0)
751
+ return "";
752
+ candidates = Array.from(new Set(candidates));
753
+ const searchingOptions = word.startsWith("--");
754
+ if (searchingOptions) {
755
+ word = word.slice(2);
756
+ candidates = candidates.map((candidate) => candidate.slice(2));
757
+ }
758
+ let similar = [];
759
+ let bestDistance = maxDistance;
760
+ const minSimilarity = 0.4;
761
+ candidates.forEach((candidate) => {
762
+ if (candidate.length <= 1)
763
+ return;
764
+ const distance = editDistance(word, candidate);
765
+ const length = Math.max(word.length, candidate.length);
766
+ const similarity = (length - distance) / length;
767
+ if (similarity > minSimilarity) {
768
+ if (distance < bestDistance) {
769
+ bestDistance = distance;
770
+ similar = [candidate];
771
+ } else if (distance === bestDistance) {
772
+ similar.push(candidate);
773
+ }
774
+ }
775
+ });
776
+ similar.sort((a, b) => a.localeCompare(b));
777
+ if (searchingOptions) {
778
+ similar = similar.map((candidate) => `--${candidate}`);
779
+ }
780
+ if (similar.length > 1) {
781
+ return `
782
+ (Did you mean one of ${similar.join(", ")}?)`;
783
+ }
784
+ if (similar.length === 1) {
785
+ return `
786
+ (Did you mean ${similar[0]}?)`;
787
+ }
788
+ return "";
789
+ }
790
+
791
+ // node_modules/commander/lib/command.js
792
+ class Command extends EventEmitter {
793
+ constructor(name) {
794
+ super();
795
+ this.commands = [];
796
+ this.options = [];
797
+ this.parent = null;
798
+ this._allowUnknownOption = false;
799
+ this._allowExcessArguments = false;
800
+ this.registeredArguments = [];
801
+ this._args = this.registeredArguments;
802
+ this.args = [];
803
+ this.rawArgs = [];
804
+ this.processedArgs = [];
805
+ this._scriptPath = null;
806
+ this._name = name || "";
807
+ this._optionValues = {};
808
+ this._optionValueSources = {};
809
+ this._storeOptionsAsProperties = false;
810
+ this._actionHandler = null;
811
+ this._executableHandler = false;
812
+ this._executableFile = null;
813
+ this._executableDir = null;
814
+ this._defaultCommandName = null;
815
+ this._exitCallback = null;
816
+ this._aliases = [];
817
+ this._combineFlagAndOptionalValue = true;
818
+ this._description = "";
819
+ this._summary = "";
820
+ this._argsDescription = undefined;
821
+ this._enablePositionalOptions = false;
822
+ this._passThroughOptions = false;
823
+ this._lifeCycleHooks = {};
824
+ this._showHelpAfterError = false;
825
+ this._showSuggestionAfterError = true;
826
+ this._savedState = null;
827
+ this._outputConfiguration = {
828
+ writeOut: (str) => process2.stdout.write(str),
829
+ writeErr: (str) => process2.stderr.write(str),
830
+ outputError: (str, write) => write(str),
831
+ getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
832
+ getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
833
+ getOutHasColors: () => useColor() ?? (process2.stdout.isTTY && process2.stdout.hasColors?.()),
834
+ getErrHasColors: () => useColor() ?? (process2.stderr.isTTY && process2.stderr.hasColors?.()),
835
+ stripColor: (str) => stripVTControlCharacters2(str)
836
+ };
837
+ this._hidden = false;
838
+ this._helpOption = undefined;
839
+ this._addImplicitHelpCommand = undefined;
840
+ this._helpCommand = undefined;
841
+ this._helpConfiguration = {};
842
+ this._helpGroupHeading = undefined;
843
+ this._defaultCommandGroup = undefined;
844
+ this._defaultOptionGroup = undefined;
845
+ }
846
+ copyInheritedSettings(sourceCommand) {
847
+ this._outputConfiguration = sourceCommand._outputConfiguration;
848
+ this._helpOption = sourceCommand._helpOption;
849
+ this._helpCommand = sourceCommand._helpCommand;
850
+ this._helpConfiguration = sourceCommand._helpConfiguration;
851
+ this._exitCallback = sourceCommand._exitCallback;
852
+ this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;
853
+ this._combineFlagAndOptionalValue = sourceCommand._combineFlagAndOptionalValue;
854
+ this._allowExcessArguments = sourceCommand._allowExcessArguments;
855
+ this._enablePositionalOptions = sourceCommand._enablePositionalOptions;
856
+ this._showHelpAfterError = sourceCommand._showHelpAfterError;
857
+ this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;
858
+ return this;
859
+ }
860
+ _getCommandAndAncestors() {
861
+ const result = [];
862
+ for (let command = this;command; command = command.parent) {
863
+ result.push(command);
864
+ }
865
+ return result;
866
+ }
867
+ command(nameAndArgs, actionOptsOrExecDesc, execOpts) {
868
+ let desc = actionOptsOrExecDesc;
869
+ let opts = execOpts;
870
+ if (typeof desc === "object" && desc !== null) {
871
+ opts = desc;
872
+ desc = null;
873
+ }
874
+ opts = opts || {};
875
+ const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);
876
+ const cmd = this.createCommand(name);
877
+ if (desc) {
878
+ cmd.description(desc);
879
+ cmd._executableHandler = true;
880
+ }
881
+ if (opts.isDefault)
882
+ this._defaultCommandName = cmd._name;
883
+ cmd._hidden = !!(opts.noHelp || opts.hidden);
884
+ cmd._executableFile = opts.executableFile || null;
885
+ if (args)
886
+ cmd.arguments(args);
887
+ this._registerCommand(cmd);
888
+ cmd.parent = this;
889
+ cmd.copyInheritedSettings(this);
890
+ if (desc)
891
+ return this;
892
+ return cmd;
893
+ }
894
+ createCommand(name) {
895
+ return new Command(name);
896
+ }
897
+ createHelp() {
898
+ return Object.assign(new Help, this.configureHelp());
899
+ }
900
+ configureHelp(configuration) {
901
+ if (configuration === undefined)
902
+ return this._helpConfiguration;
903
+ this._helpConfiguration = configuration;
904
+ return this;
905
+ }
906
+ configureOutput(configuration) {
907
+ if (configuration === undefined)
908
+ return this._outputConfiguration;
909
+ this._outputConfiguration = {
910
+ ...this._outputConfiguration,
911
+ ...configuration
912
+ };
913
+ return this;
914
+ }
915
+ showHelpAfterError(displayHelp = true) {
916
+ if (typeof displayHelp !== "string")
917
+ displayHelp = !!displayHelp;
918
+ this._showHelpAfterError = displayHelp;
919
+ return this;
920
+ }
921
+ showSuggestionAfterError(displaySuggestion = true) {
922
+ this._showSuggestionAfterError = !!displaySuggestion;
923
+ return this;
924
+ }
925
+ addCommand(cmd, opts) {
926
+ if (!cmd._name) {
927
+ throw new Error(`Command passed to .addCommand() must have a name
928
+ - specify the name in Command constructor or using .name()`);
929
+ }
930
+ opts = opts || {};
931
+ if (opts.isDefault)
932
+ this._defaultCommandName = cmd._name;
933
+ if (opts.noHelp || opts.hidden)
934
+ cmd._hidden = true;
935
+ this._registerCommand(cmd);
936
+ cmd.parent = this;
937
+ cmd._checkForBrokenPassThrough();
938
+ return this;
939
+ }
940
+ createArgument(name, description) {
941
+ return new Argument(name, description);
942
+ }
943
+ argument(name, description, parseArg, defaultValue) {
944
+ const argument = this.createArgument(name, description);
945
+ if (typeof parseArg === "function") {
946
+ argument.default(defaultValue).argParser(parseArg);
947
+ } else {
948
+ argument.default(parseArg);
949
+ }
950
+ this.addArgument(argument);
951
+ return this;
952
+ }
953
+ arguments(names) {
954
+ names.trim().split(/ +/).forEach((detail) => {
955
+ this.argument(detail);
956
+ });
957
+ return this;
958
+ }
959
+ addArgument(argument) {
960
+ const previousArgument = this.registeredArguments.slice(-1)[0];
961
+ if (previousArgument?.variadic) {
962
+ throw new Error(`only the last argument can be variadic '${previousArgument.name()}'`);
963
+ }
964
+ if (argument.required && argument.defaultValue !== undefined && argument.parseArg === undefined) {
965
+ throw new Error(`a default value for a required argument is never used: '${argument.name()}'`);
966
+ }
967
+ this.registeredArguments.push(argument);
968
+ return this;
969
+ }
970
+ helpCommand(enableOrNameAndArgs, description) {
971
+ if (typeof enableOrNameAndArgs === "boolean") {
972
+ this._addImplicitHelpCommand = enableOrNameAndArgs;
973
+ if (enableOrNameAndArgs && this._defaultCommandGroup) {
974
+ this._initCommandGroup(this._getHelpCommand());
975
+ }
976
+ return this;
977
+ }
978
+ const nameAndArgs = enableOrNameAndArgs ?? "help [command]";
979
+ const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);
980
+ const helpDescription = description ?? "display help for command";
981
+ const helpCommand = this.createCommand(helpName);
982
+ helpCommand.helpOption(false);
983
+ if (helpArgs)
984
+ helpCommand.arguments(helpArgs);
985
+ if (helpDescription)
986
+ helpCommand.description(helpDescription);
987
+ this._addImplicitHelpCommand = true;
988
+ this._helpCommand = helpCommand;
989
+ if (enableOrNameAndArgs || description)
990
+ this._initCommandGroup(helpCommand);
991
+ return this;
992
+ }
993
+ addHelpCommand(helpCommand, deprecatedDescription) {
994
+ if (typeof helpCommand !== "object") {
995
+ this.helpCommand(helpCommand, deprecatedDescription);
996
+ return this;
997
+ }
998
+ this._addImplicitHelpCommand = true;
999
+ this._helpCommand = helpCommand;
1000
+ this._initCommandGroup(helpCommand);
1001
+ return this;
1002
+ }
1003
+ _getHelpCommand() {
1004
+ const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? (this.commands.length && !this._actionHandler && !this._findCommand("help"));
1005
+ if (hasImplicitHelpCommand) {
1006
+ if (this._helpCommand === undefined) {
1007
+ this.helpCommand(undefined, undefined);
1008
+ }
1009
+ return this._helpCommand;
1010
+ }
1011
+ return null;
1012
+ }
1013
+ hook(event, listener) {
1014
+ const allowedValues = ["preSubcommand", "preAction", "postAction"];
1015
+ if (!allowedValues.includes(event)) {
1016
+ throw new Error(`Unexpected value for event passed to hook : '${event}'.
1017
+ Expecting one of '${allowedValues.join("', '")}'`);
1018
+ }
1019
+ if (this._lifeCycleHooks[event]) {
1020
+ this._lifeCycleHooks[event].push(listener);
1021
+ } else {
1022
+ this._lifeCycleHooks[event] = [listener];
1023
+ }
1024
+ return this;
1025
+ }
1026
+ exitOverride(fn) {
1027
+ if (fn) {
1028
+ this._exitCallback = fn;
1029
+ } else {
1030
+ this._exitCallback = (err) => {
1031
+ if (err.code !== "commander.executeSubCommandAsync") {
1032
+ throw err;
1033
+ }
1034
+ };
1035
+ }
1036
+ return this;
1037
+ }
1038
+ _exit(exitCode, code, message) {
1039
+ if (this._exitCallback) {
1040
+ this._exitCallback(new CommanderError(exitCode, code, message));
1041
+ }
1042
+ process2.exit(exitCode);
1043
+ }
1044
+ action(fn) {
1045
+ const listener = (args) => {
1046
+ const expectedArgsCount = this.registeredArguments.length;
1047
+ const actionArgs = args.slice(0, expectedArgsCount);
1048
+ if (this._storeOptionsAsProperties) {
1049
+ actionArgs[expectedArgsCount] = this;
1050
+ } else {
1051
+ actionArgs[expectedArgsCount] = this.opts();
1052
+ }
1053
+ actionArgs.push(this);
1054
+ return fn.apply(this, actionArgs);
1055
+ };
1056
+ this._actionHandler = listener;
1057
+ return this;
1058
+ }
1059
+ createOption(flags, description) {
1060
+ return new Option(flags, description);
1061
+ }
1062
+ _callParseArg(target, value, previous, invalidArgumentMessage) {
1063
+ try {
1064
+ return target.parseArg(value, previous);
1065
+ } catch (err) {
1066
+ if (err.code === "commander.invalidArgument") {
1067
+ const message = `${invalidArgumentMessage} ${err.message}`;
1068
+ this.error(message, { exitCode: err.exitCode, code: err.code });
1069
+ }
1070
+ throw err;
1071
+ }
1072
+ }
1073
+ _registerOption(option) {
1074
+ const matchingOption = option.short && this._findOption(option.short) || option.long && this._findOption(option.long);
1075
+ if (matchingOption) {
1076
+ const matchingFlag = option.long && this._findOption(option.long) ? option.long : option.short;
1077
+ throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
1078
+ - already used by option '${matchingOption.flags}'`);
1079
+ }
1080
+ this._initOptionGroup(option);
1081
+ this.options.push(option);
1082
+ }
1083
+ _registerCommand(command) {
1084
+ const knownBy = (cmd) => {
1085
+ return [cmd.name()].concat(cmd.aliases());
1086
+ };
1087
+ const alreadyUsed = knownBy(command).find((name) => this._findCommand(name));
1088
+ if (alreadyUsed) {
1089
+ const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
1090
+ const newCmd = knownBy(command).join("|");
1091
+ throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
1092
+ }
1093
+ this._initCommandGroup(command);
1094
+ this.commands.push(command);
1095
+ }
1096
+ addOption(option) {
1097
+ this._registerOption(option);
1098
+ const oname = option.name();
1099
+ const name = option.attributeName();
1100
+ if (option.defaultValue !== undefined) {
1101
+ this.setOptionValueWithSource(name, option.defaultValue, "default");
1102
+ }
1103
+ const handleOptionValue = (val, invalidValueMessage, valueSource) => {
1104
+ if (val == null && option.presetArg !== undefined) {
1105
+ val = option.presetArg;
1106
+ }
1107
+ const oldValue = this.getOptionValue(name);
1108
+ if (val !== null && option.parseArg) {
1109
+ val = this._callParseArg(option, val, oldValue, invalidValueMessage);
1110
+ } else if (val !== null && option.variadic) {
1111
+ val = option._collectValue(val, oldValue);
1112
+ }
1113
+ if (val == null) {
1114
+ if (option.negate) {
1115
+ val = false;
1116
+ } else if (option.isBoolean() || option.optional) {
1117
+ val = true;
1118
+ } else {
1119
+ val = "";
1120
+ }
1121
+ }
1122
+ this.setOptionValueWithSource(name, val, valueSource);
1123
+ };
1124
+ this.on("option:" + oname, (val) => {
1125
+ const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
1126
+ handleOptionValue(val, invalidValueMessage, "cli");
1127
+ });
1128
+ if (option.envVar) {
1129
+ this.on("optionEnv:" + oname, (val) => {
1130
+ const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
1131
+ handleOptionValue(val, invalidValueMessage, "env");
1132
+ });
1133
+ }
1134
+ return this;
1135
+ }
1136
+ _optionEx(config, flags, description, fn, defaultValue) {
1137
+ if (typeof flags === "object" && flags instanceof Option) {
1138
+ throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
1139
+ }
1140
+ const option = this.createOption(flags, description);
1141
+ option.makeOptionMandatory(!!config.mandatory);
1142
+ if (typeof fn === "function") {
1143
+ option.default(defaultValue).argParser(fn);
1144
+ } else if (fn instanceof RegExp) {
1145
+ const regex = fn;
1146
+ fn = (val, def) => {
1147
+ const m = regex.exec(val);
1148
+ return m ? m[0] : def;
1149
+ };
1150
+ option.default(defaultValue).argParser(fn);
1151
+ } else {
1152
+ option.default(fn);
1153
+ }
1154
+ return this.addOption(option);
1155
+ }
1156
+ option(flags, description, parseArg, defaultValue) {
1157
+ return this._optionEx({}, flags, description, parseArg, defaultValue);
1158
+ }
1159
+ requiredOption(flags, description, parseArg, defaultValue) {
1160
+ return this._optionEx({ mandatory: true }, flags, description, parseArg, defaultValue);
1161
+ }
1162
+ combineFlagAndOptionalValue(combine = true) {
1163
+ this._combineFlagAndOptionalValue = !!combine;
1164
+ return this;
1165
+ }
1166
+ allowUnknownOption(allowUnknown = true) {
1167
+ this._allowUnknownOption = !!allowUnknown;
1168
+ return this;
1169
+ }
1170
+ allowExcessArguments(allowExcess = true) {
1171
+ this._allowExcessArguments = !!allowExcess;
1172
+ return this;
1173
+ }
1174
+ enablePositionalOptions(positional = true) {
1175
+ this._enablePositionalOptions = !!positional;
1176
+ return this;
1177
+ }
1178
+ passThroughOptions(passThrough = true) {
1179
+ this._passThroughOptions = !!passThrough;
1180
+ this._checkForBrokenPassThrough();
1181
+ return this;
1182
+ }
1183
+ _checkForBrokenPassThrough() {
1184
+ if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) {
1185
+ throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`);
1186
+ }
1187
+ }
1188
+ storeOptionsAsProperties(storeAsProperties = true) {
1189
+ if (this.options.length) {
1190
+ throw new Error("call .storeOptionsAsProperties() before adding options");
1191
+ }
1192
+ if (Object.keys(this._optionValues).length) {
1193
+ throw new Error("call .storeOptionsAsProperties() before setting option values");
1194
+ }
1195
+ this._storeOptionsAsProperties = !!storeAsProperties;
1196
+ return this;
1197
+ }
1198
+ getOptionValue(key) {
1199
+ if (this._storeOptionsAsProperties) {
1200
+ return this[key];
1201
+ }
1202
+ return this._optionValues[key];
1203
+ }
1204
+ setOptionValue(key, value) {
1205
+ return this.setOptionValueWithSource(key, value, undefined);
1206
+ }
1207
+ setOptionValueWithSource(key, value, source) {
1208
+ if (this._storeOptionsAsProperties) {
1209
+ this[key] = value;
1210
+ } else {
1211
+ this._optionValues[key] = value;
1212
+ }
1213
+ this._optionValueSources[key] = source;
1214
+ return this;
1215
+ }
1216
+ getOptionValueSource(key) {
1217
+ return this._optionValueSources[key];
1218
+ }
1219
+ getOptionValueSourceWithGlobals(key) {
1220
+ let source;
1221
+ this._getCommandAndAncestors().forEach((cmd) => {
1222
+ if (cmd.getOptionValueSource(key) !== undefined) {
1223
+ source = cmd.getOptionValueSource(key);
1224
+ }
1225
+ });
1226
+ return source;
1227
+ }
1228
+ _prepareUserArgs(argv, parseOptions) {
1229
+ if (argv !== undefined && !Array.isArray(argv)) {
1230
+ throw new Error("first parameter to parse must be array or undefined");
1231
+ }
1232
+ parseOptions = parseOptions || {};
1233
+ if (argv === undefined && parseOptions.from === undefined) {
1234
+ if (process2.versions?.electron) {
1235
+ parseOptions.from = "electron";
1236
+ }
1237
+ const execArgv = process2.execArgv ?? [];
1238
+ if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
1239
+ parseOptions.from = "eval";
1240
+ }
1241
+ }
1242
+ if (argv === undefined) {
1243
+ argv = process2.argv;
1244
+ }
1245
+ this.rawArgs = argv.slice();
1246
+ let userArgs;
1247
+ switch (parseOptions.from) {
1248
+ case undefined:
1249
+ case "node":
1250
+ this._scriptPath = argv[1];
1251
+ userArgs = argv.slice(2);
1252
+ break;
1253
+ case "electron":
1254
+ if (process2.defaultApp) {
1255
+ this._scriptPath = argv[1];
1256
+ userArgs = argv.slice(2);
1257
+ } else {
1258
+ userArgs = argv.slice(1);
1259
+ }
1260
+ break;
1261
+ case "user":
1262
+ userArgs = argv.slice(0);
1263
+ break;
1264
+ case "eval":
1265
+ userArgs = argv.slice(1);
1266
+ break;
1267
+ default:
1268
+ throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
1269
+ }
1270
+ if (!this._name && this._scriptPath)
1271
+ this.nameFromFilename(this._scriptPath);
1272
+ this._name = this._name || "program";
1273
+ return userArgs;
1274
+ }
1275
+ parse(argv, parseOptions) {
1276
+ this._prepareForParse();
1277
+ const userArgs = this._prepareUserArgs(argv, parseOptions);
1278
+ this._parseCommand([], userArgs);
1279
+ return this;
1280
+ }
1281
+ async parseAsync(argv, parseOptions) {
1282
+ this._prepareForParse();
1283
+ const userArgs = this._prepareUserArgs(argv, parseOptions);
1284
+ await this._parseCommand([], userArgs);
1285
+ return this;
1286
+ }
1287
+ _prepareForParse() {
1288
+ if (this._savedState === null) {
1289
+ this.options.filter((option) => option.negate && option.defaultValue === undefined && this.getOptionValue(option.attributeName()) === undefined).forEach((option) => {
1290
+ const positiveLongFlag = option.long.replace(/^--no-/, "--");
1291
+ if (!this._findOption(positiveLongFlag)) {
1292
+ this.setOptionValueWithSource(option.attributeName(), true, "default");
1293
+ }
1294
+ });
1295
+ this.saveStateBeforeParse();
1296
+ } else {
1297
+ this.restoreStateBeforeParse();
1298
+ }
1299
+ }
1300
+ saveStateBeforeParse() {
1301
+ this._savedState = {
1302
+ _name: this._name,
1303
+ _optionValues: { ...this._optionValues },
1304
+ _optionValueSources: { ...this._optionValueSources }
1305
+ };
1306
+ }
1307
+ restoreStateBeforeParse() {
1308
+ if (this._storeOptionsAsProperties)
1309
+ throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
1310
+ - either make a new Command for each call to parse, or stop storing options as properties`);
1311
+ this._name = this._savedState._name;
1312
+ this._scriptPath = null;
1313
+ this.rawArgs = [];
1314
+ this._optionValues = { ...this._savedState._optionValues };
1315
+ this._optionValueSources = { ...this._savedState._optionValueSources };
1316
+ this.args = [];
1317
+ this.processedArgs = [];
1318
+ }
1319
+ _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
1320
+ if (fs.existsSync(executableFile))
1321
+ return;
1322
+ const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
1323
+ const executableMissing = `'${executableFile}' does not exist
1324
+ - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
1325
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1326
+ - ${executableDirMessage}`;
1327
+ throw new Error(executableMissing);
1328
+ }
1329
+ _executeSubCommand(subcommand, args) {
1330
+ args = args.slice();
1331
+ const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1332
+ function findFile(baseDir, baseName) {
1333
+ const localBin = path.resolve(baseDir, baseName);
1334
+ if (fs.existsSync(localBin))
1335
+ return localBin;
1336
+ if (sourceExt.includes(path.extname(baseName)))
1337
+ return;
1338
+ const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
1339
+ if (foundExt)
1340
+ return `${localBin}${foundExt}`;
1341
+ return;
1342
+ }
1343
+ this._checkForMissingMandatoryOptions();
1344
+ this._checkForConflictingOptions();
1345
+ let executableFile = subcommand._executableFile || `${this._name}-${subcommand._name}`;
1346
+ let executableDir = this._executableDir || "";
1347
+ if (this._scriptPath) {
1348
+ let resolvedScriptPath;
1349
+ try {
1350
+ resolvedScriptPath = fs.realpathSync(this._scriptPath);
1351
+ } catch {
1352
+ resolvedScriptPath = this._scriptPath;
1353
+ }
1354
+ executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
1355
+ }
1356
+ if (executableDir) {
1357
+ let localFile = findFile(executableDir, executableFile);
1358
+ if (!localFile && !subcommand._executableFile && this._scriptPath) {
1359
+ const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
1360
+ if (legacyName !== this._name) {
1361
+ localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
1362
+ }
1363
+ }
1364
+ executableFile = localFile || executableFile;
1365
+ }
1366
+ const launchWithNode = sourceExt.includes(path.extname(executableFile));
1367
+ let proc;
1368
+ if (process2.platform !== "win32") {
1369
+ if (launchWithNode) {
1370
+ args.unshift(executableFile);
1371
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1372
+ proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
1373
+ } else {
1374
+ proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
1375
+ }
1376
+ } else {
1377
+ this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
1378
+ args.unshift(executableFile);
1379
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1380
+ proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
1381
+ }
1382
+ if (!proc.killed) {
1383
+ const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
1384
+ signals.forEach((signal) => {
1385
+ process2.on(signal, () => {
1386
+ if (proc.killed === false && proc.exitCode === null) {
1387
+ proc.kill(signal);
1388
+ }
1389
+ });
1390
+ });
1391
+ }
1392
+ const exitCallback = this._exitCallback;
1393
+ proc.on("close", (code) => {
1394
+ code = code ?? 1;
1395
+ if (!exitCallback) {
1396
+ process2.exit(code);
1397
+ } else {
1398
+ exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
1399
+ }
1400
+ });
1401
+ proc.on("error", (err) => {
1402
+ if (err.code === "ENOENT") {
1403
+ this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
1404
+ } else if (err.code === "EACCES") {
1405
+ throw new Error(`'${executableFile}' not executable`);
1406
+ }
1407
+ if (!exitCallback) {
1408
+ process2.exit(1);
1409
+ } else {
1410
+ const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
1411
+ wrappedError.nestedError = err;
1412
+ exitCallback(wrappedError);
1413
+ }
1414
+ });
1415
+ this.runningCommand = proc;
1416
+ }
1417
+ _dispatchSubcommand(commandName, operands, unknown) {
1418
+ const subCommand = this._findCommand(commandName);
1419
+ if (!subCommand)
1420
+ this.help({ error: true });
1421
+ subCommand._prepareForParse();
1422
+ let promiseChain;
1423
+ promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, "preSubcommand");
1424
+ promiseChain = this._chainOrCall(promiseChain, () => {
1425
+ if (subCommand._executableHandler) {
1426
+ this._executeSubCommand(subCommand, operands.concat(unknown));
1427
+ } else {
1428
+ return subCommand._parseCommand(operands, unknown);
1429
+ }
1430
+ });
1431
+ return promiseChain;
1432
+ }
1433
+ _dispatchHelpCommand(subcommandName) {
1434
+ if (!subcommandName) {
1435
+ this.help();
1436
+ }
1437
+ const subCommand = this._findCommand(subcommandName);
1438
+ if (subCommand && !subCommand._executableHandler) {
1439
+ subCommand.help();
1440
+ }
1441
+ return this._dispatchSubcommand(subcommandName, [], [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? "--help"]);
1442
+ }
1443
+ _checkNumberOfArguments() {
1444
+ this.registeredArguments.forEach((arg, i) => {
1445
+ if (arg.required && this.args[i] == null) {
1446
+ this.missingArgument(arg.name());
1447
+ }
1448
+ });
1449
+ if (this.registeredArguments.length > 0 && this.registeredArguments[this.registeredArguments.length - 1].variadic) {
1450
+ return;
1451
+ }
1452
+ if (this.args.length > this.registeredArguments.length) {
1453
+ this._excessArguments(this.args);
1454
+ }
1455
+ }
1456
+ _processArguments() {
1457
+ const myParseArg = (argument, value, previous) => {
1458
+ let parsedValue = value;
1459
+ if (value !== null && argument.parseArg) {
1460
+ const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;
1461
+ parsedValue = this._callParseArg(argument, value, previous, invalidValueMessage);
1462
+ }
1463
+ return parsedValue;
1464
+ };
1465
+ this._checkNumberOfArguments();
1466
+ const processedArgs = [];
1467
+ this.registeredArguments.forEach((declaredArg, index) => {
1468
+ let value = declaredArg.defaultValue;
1469
+ if (declaredArg.variadic) {
1470
+ if (index < this.args.length) {
1471
+ value = this.args.slice(index);
1472
+ if (declaredArg.parseArg) {
1473
+ value = value.reduce((processed, v) => {
1474
+ return myParseArg(declaredArg, v, processed);
1475
+ }, declaredArg.defaultValue);
1476
+ }
1477
+ } else if (value === undefined) {
1478
+ value = [];
1479
+ }
1480
+ } else if (index < this.args.length) {
1481
+ value = this.args[index];
1482
+ if (declaredArg.parseArg) {
1483
+ value = myParseArg(declaredArg, value, declaredArg.defaultValue);
1484
+ }
1485
+ }
1486
+ processedArgs[index] = value;
1487
+ });
1488
+ this.processedArgs = processedArgs;
1489
+ }
1490
+ _chainOrCall(promise, fn) {
1491
+ if (promise?.then && typeof promise.then === "function") {
1492
+ return promise.then(() => fn());
1493
+ }
1494
+ return fn();
1495
+ }
1496
+ _chainOrCallHooks(promise, event) {
1497
+ let result = promise;
1498
+ const hooks = [];
1499
+ this._getCommandAndAncestors().reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== undefined).forEach((hookedCommand) => {
1500
+ hookedCommand._lifeCycleHooks[event].forEach((callback) => {
1501
+ hooks.push({ hookedCommand, callback });
1502
+ });
1503
+ });
1504
+ if (event === "postAction") {
1505
+ hooks.reverse();
1506
+ }
1507
+ hooks.forEach((hookDetail) => {
1508
+ result = this._chainOrCall(result, () => {
1509
+ return hookDetail.callback(hookDetail.hookedCommand, this);
1510
+ });
1511
+ });
1512
+ return result;
1513
+ }
1514
+ _chainOrCallSubCommandHook(promise, subCommand, event) {
1515
+ let result = promise;
1516
+ if (this._lifeCycleHooks[event] !== undefined) {
1517
+ this._lifeCycleHooks[event].forEach((hook) => {
1518
+ result = this._chainOrCall(result, () => {
1519
+ return hook(this, subCommand);
1520
+ });
1521
+ });
1522
+ }
1523
+ return result;
1524
+ }
1525
+ _parseCommand(operands, unknown) {
1526
+ const parsed = this.parseOptions(unknown);
1527
+ this._parseOptionsEnv();
1528
+ this._parseOptionsImplied();
1529
+ operands = operands.concat(parsed.operands);
1530
+ unknown = parsed.unknown;
1531
+ this.args = operands.concat(unknown);
1532
+ if (operands && this._findCommand(operands[0])) {
1533
+ return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);
1534
+ }
1535
+ if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) {
1536
+ return this._dispatchHelpCommand(operands[1]);
1537
+ }
1538
+ if (this._defaultCommandName) {
1539
+ this._outputHelpIfRequested(unknown);
1540
+ return this._dispatchSubcommand(this._defaultCommandName, operands, unknown);
1541
+ }
1542
+ if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
1543
+ this.help({ error: true });
1544
+ }
1545
+ this._outputHelpIfRequested(parsed.unknown);
1546
+ this._checkForMissingMandatoryOptions();
1547
+ this._checkForConflictingOptions();
1548
+ const checkForUnknownOptions = () => {
1549
+ if (parsed.unknown.length > 0) {
1550
+ this.unknownOption(parsed.unknown[0]);
1551
+ }
1552
+ };
1553
+ const commandEvent = `command:${this.name()}`;
1554
+ if (this._actionHandler) {
1555
+ checkForUnknownOptions();
1556
+ this._processArguments();
1557
+ let promiseChain;
1558
+ promiseChain = this._chainOrCallHooks(promiseChain, "preAction");
1559
+ promiseChain = this._chainOrCall(promiseChain, () => this._actionHandler(this.processedArgs));
1560
+ if (this.parent) {
1561
+ promiseChain = this._chainOrCall(promiseChain, () => {
1562
+ this.parent.emit(commandEvent, operands, unknown);
1563
+ });
1564
+ }
1565
+ promiseChain = this._chainOrCallHooks(promiseChain, "postAction");
1566
+ return promiseChain;
1567
+ }
1568
+ if (this.parent?.listenerCount(commandEvent)) {
1569
+ checkForUnknownOptions();
1570
+ this._processArguments();
1571
+ this.parent.emit(commandEvent, operands, unknown);
1572
+ } else if (operands.length) {
1573
+ if (this._findCommand("*")) {
1574
+ return this._dispatchSubcommand("*", operands, unknown);
1575
+ }
1576
+ if (this.listenerCount("command:*")) {
1577
+ this.emit("command:*", operands, unknown);
1578
+ } else if (this.commands.length) {
1579
+ this.unknownCommand();
1580
+ } else {
1581
+ checkForUnknownOptions();
1582
+ this._processArguments();
1583
+ }
1584
+ } else if (this.commands.length) {
1585
+ checkForUnknownOptions();
1586
+ this.help({ error: true });
1587
+ } else {
1588
+ checkForUnknownOptions();
1589
+ this._processArguments();
1590
+ }
1591
+ }
1592
+ _findCommand(name) {
1593
+ if (!name)
1594
+ return;
1595
+ return this.commands.find((cmd) => cmd._name === name || cmd._aliases.includes(name));
1596
+ }
1597
+ _findOption(arg) {
1598
+ return this.options.find((option) => option.is(arg));
1599
+ }
1600
+ _checkForMissingMandatoryOptions() {
1601
+ this._getCommandAndAncestors().forEach((cmd) => {
1602
+ cmd.options.forEach((anOption) => {
1603
+ if (anOption.mandatory && cmd.getOptionValue(anOption.attributeName()) === undefined) {
1604
+ cmd.missingMandatoryOptionValue(anOption);
1605
+ }
1606
+ });
1607
+ });
1608
+ }
1609
+ _checkForConflictingLocalOptions() {
1610
+ const definedNonDefaultOptions = this.options.filter((option) => {
1611
+ const optionKey = option.attributeName();
1612
+ if (this.getOptionValue(optionKey) === undefined) {
1613
+ return false;
1614
+ }
1615
+ return this.getOptionValueSource(optionKey) !== "default";
1616
+ });
1617
+ const optionsWithConflicting = definedNonDefaultOptions.filter((option) => option.conflictsWith.length > 0);
1618
+ optionsWithConflicting.forEach((option) => {
1619
+ const conflictingAndDefined = definedNonDefaultOptions.find((defined) => option.conflictsWith.includes(defined.attributeName()));
1620
+ if (conflictingAndDefined) {
1621
+ this._conflictingOption(option, conflictingAndDefined);
1622
+ }
1623
+ });
1624
+ }
1625
+ _checkForConflictingOptions() {
1626
+ this._getCommandAndAncestors().forEach((cmd) => {
1627
+ cmd._checkForConflictingLocalOptions();
1628
+ });
1629
+ }
1630
+ parseOptions(args) {
1631
+ const operands = [];
1632
+ const unknown = [];
1633
+ let dest = operands;
1634
+ function maybeOption(arg) {
1635
+ return arg.length > 1 && arg[0] === "-";
1636
+ }
1637
+ const negativeNumberArg = (arg) => {
1638
+ if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg))
1639
+ return false;
1640
+ return !this._getCommandAndAncestors().some((cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short)));
1641
+ };
1642
+ let activeVariadicOption = null;
1643
+ let activeGroup = null;
1644
+ let i = 0;
1645
+ while (i < args.length || activeGroup) {
1646
+ const arg = activeGroup ?? args[i++];
1647
+ activeGroup = null;
1648
+ if (arg === "--") {
1649
+ if (dest === unknown)
1650
+ dest.push(arg);
1651
+ dest.push(...args.slice(i));
1652
+ break;
1653
+ }
1654
+ if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
1655
+ this.emit(`option:${activeVariadicOption.name()}`, arg);
1656
+ continue;
1657
+ }
1658
+ activeVariadicOption = null;
1659
+ if (maybeOption(arg)) {
1660
+ const option = this._findOption(arg);
1661
+ if (option) {
1662
+ if (option.required) {
1663
+ const value = args[i++];
1664
+ if (value === undefined)
1665
+ this.optionMissingArgument(option);
1666
+ this.emit(`option:${option.name()}`, value);
1667
+ } else if (option.optional) {
1668
+ let value = null;
1669
+ if (i < args.length && (!maybeOption(args[i]) || negativeNumberArg(args[i]))) {
1670
+ value = args[i++];
1671
+ }
1672
+ this.emit(`option:${option.name()}`, value);
1673
+ } else {
1674
+ this.emit(`option:${option.name()}`);
1675
+ }
1676
+ activeVariadicOption = option.variadic ? option : null;
1677
+ continue;
1678
+ }
1679
+ }
1680
+ if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
1681
+ const option = this._findOption(`-${arg[1]}`);
1682
+ if (option) {
1683
+ if (option.required || option.optional && this._combineFlagAndOptionalValue) {
1684
+ this.emit(`option:${option.name()}`, arg.slice(2));
1685
+ } else {
1686
+ this.emit(`option:${option.name()}`);
1687
+ activeGroup = `-${arg.slice(2)}`;
1688
+ }
1689
+ continue;
1690
+ }
1691
+ }
1692
+ if (/^--[^=]+=/.test(arg)) {
1693
+ const index = arg.indexOf("=");
1694
+ const option = this._findOption(arg.slice(0, index));
1695
+ if (option && (option.required || option.optional)) {
1696
+ this.emit(`option:${option.name()}`, arg.slice(index + 1));
1697
+ continue;
1698
+ }
1699
+ }
1700
+ if (dest === operands && maybeOption(arg) && !(this.commands.length === 0 && negativeNumberArg(arg))) {
1701
+ dest = unknown;
1702
+ }
1703
+ if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
1704
+ if (this._findCommand(arg)) {
1705
+ operands.push(arg);
1706
+ unknown.push(...args.slice(i));
1707
+ break;
1708
+ } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
1709
+ operands.push(arg, ...args.slice(i));
1710
+ break;
1711
+ } else if (this._defaultCommandName) {
1712
+ unknown.push(arg, ...args.slice(i));
1713
+ break;
1714
+ }
1715
+ }
1716
+ if (this._passThroughOptions) {
1717
+ dest.push(arg, ...args.slice(i));
1718
+ break;
1719
+ }
1720
+ dest.push(arg);
1721
+ }
1722
+ return { operands, unknown };
1723
+ }
1724
+ opts() {
1725
+ if (this._storeOptionsAsProperties) {
1726
+ const result = {};
1727
+ const len = this.options.length;
1728
+ for (let i = 0;i < len; i++) {
1729
+ const key = this.options[i].attributeName();
1730
+ result[key] = key === this._versionOptionName ? this._version : this[key];
1731
+ }
1732
+ return result;
1733
+ }
1734
+ return this._optionValues;
1735
+ }
1736
+ optsWithGlobals() {
1737
+ return this._getCommandAndAncestors().reduce((combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()), {});
1738
+ }
1739
+ error(message, errorOptions) {
1740
+ this._outputConfiguration.outputError(`${message}
1741
+ `, this._outputConfiguration.writeErr);
1742
+ if (typeof this._showHelpAfterError === "string") {
1743
+ this._outputConfiguration.writeErr(`${this._showHelpAfterError}
1744
+ `);
1745
+ } else if (this._showHelpAfterError) {
1746
+ this._outputConfiguration.writeErr(`
1747
+ `);
1748
+ this.outputHelp({ error: true });
1749
+ }
1750
+ const config = errorOptions || {};
1751
+ const exitCode = config.exitCode || 1;
1752
+ const code = config.code || "commander.error";
1753
+ this._exit(exitCode, code, message);
1754
+ }
1755
+ _parseOptionsEnv() {
1756
+ this.options.forEach((option) => {
1757
+ if (option.envVar && option.envVar in process2.env) {
1758
+ const optionKey = option.attributeName();
1759
+ if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
1760
+ if (option.required || option.optional) {
1761
+ this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
1762
+ } else {
1763
+ this.emit(`optionEnv:${option.name()}`);
1764
+ }
1765
+ }
1766
+ }
1767
+ });
1768
+ }
1769
+ _parseOptionsImplied() {
1770
+ const dualHelper = new DualOptions(this.options);
1771
+ const hasCustomOptionValue = (optionKey) => {
1772
+ return this.getOptionValue(optionKey) !== undefined && !["default", "implied"].includes(this.getOptionValueSource(optionKey));
1773
+ };
1774
+ this.options.filter((option) => option.implied !== undefined && hasCustomOptionValue(option.attributeName()) && dualHelper.valueFromOption(this.getOptionValue(option.attributeName()), option)).forEach((option) => {
1775
+ Object.keys(option.implied).filter((impliedKey) => !hasCustomOptionValue(impliedKey)).forEach((impliedKey) => {
1776
+ this.setOptionValueWithSource(impliedKey, option.implied[impliedKey], "implied");
1777
+ });
1778
+ });
1779
+ }
1780
+ missingArgument(name) {
1781
+ const message = `error: missing required argument '${name}'`;
1782
+ this.error(message, { code: "commander.missingArgument" });
1783
+ }
1784
+ optionMissingArgument(option) {
1785
+ const message = `error: option '${option.flags}' argument missing`;
1786
+ this.error(message, { code: "commander.optionMissingArgument" });
1787
+ }
1788
+ missingMandatoryOptionValue(option) {
1789
+ const message = `error: required option '${option.flags}' not specified`;
1790
+ this.error(message, { code: "commander.missingMandatoryOptionValue" });
1791
+ }
1792
+ _conflictingOption(option, conflictingOption) {
1793
+ const findBestOptionFromValue = (option2) => {
1794
+ const optionKey = option2.attributeName();
1795
+ const optionValue = this.getOptionValue(optionKey);
1796
+ const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
1797
+ const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
1798
+ if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
1799
+ return negativeOption;
1800
+ }
1801
+ return positiveOption || option2;
1802
+ };
1803
+ const getErrorMessage = (option2) => {
1804
+ const bestOption = findBestOptionFromValue(option2);
1805
+ const optionKey = bestOption.attributeName();
1806
+ const source = this.getOptionValueSource(optionKey);
1807
+ if (source === "env") {
1808
+ return `environment variable '${bestOption.envVar}'`;
1809
+ }
1810
+ return `option '${bestOption.flags}'`;
1811
+ };
1812
+ const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;
1813
+ this.error(message, { code: "commander.conflictingOption" });
1814
+ }
1815
+ unknownOption(flag) {
1816
+ if (this._allowUnknownOption)
1817
+ return;
1818
+ let suggestion = "";
1819
+ if (flag.startsWith("--") && this._showSuggestionAfterError) {
1820
+ let candidateFlags = [];
1821
+ let command = this;
1822
+ do {
1823
+ const moreFlags = command.createHelp().visibleOptions(command).filter((option) => option.long).map((option) => option.long);
1824
+ candidateFlags = candidateFlags.concat(moreFlags);
1825
+ command = command.parent;
1826
+ } while (command && !command._enablePositionalOptions);
1827
+ suggestion = suggestSimilar(flag, candidateFlags);
1828
+ }
1829
+ const message = `error: unknown option '${flag}'${suggestion}`;
1830
+ this.error(message, { code: "commander.unknownOption" });
1831
+ }
1832
+ _excessArguments(receivedArgs) {
1833
+ if (this._allowExcessArguments)
1834
+ return;
1835
+ const expected = this.registeredArguments.length;
1836
+ const s = expected === 1 ? "" : "s";
1837
+ const received = receivedArgs.length;
1838
+ const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
1839
+ const details = receivedArgs.join(", ");
1840
+ const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${received}: ${details}.`;
1841
+ this.error(message, { code: "commander.excessArguments" });
1842
+ }
1843
+ unknownCommand() {
1844
+ const unknownName = this.args[0];
1845
+ let suggestion = "";
1846
+ if (this._showSuggestionAfterError) {
1847
+ const candidateNames = [];
1848
+ this.createHelp().visibleCommands(this).forEach((command) => {
1849
+ candidateNames.push(command.name());
1850
+ if (command.alias())
1851
+ candidateNames.push(command.alias());
1852
+ });
1853
+ suggestion = suggestSimilar(unknownName, candidateNames);
1854
+ }
1855
+ const message = `error: unknown command '${unknownName}'${suggestion}`;
1856
+ this.error(message, { code: "commander.unknownCommand" });
1857
+ }
1858
+ version(str, flags, description) {
1859
+ if (str === undefined)
1860
+ return this._version;
1861
+ this._version = str;
1862
+ flags = flags || "-V, --version";
1863
+ description = description || "output the version number";
1864
+ const versionOption = this.createOption(flags, description);
1865
+ this._versionOptionName = versionOption.attributeName();
1866
+ this._registerOption(versionOption);
1867
+ this.on("option:" + versionOption.name(), () => {
1868
+ this._outputConfiguration.writeOut(`${str}
1869
+ `);
1870
+ this._exit(0, "commander.version", str);
1871
+ });
1872
+ return this;
1873
+ }
1874
+ description(str, argsDescription) {
1875
+ if (str === undefined && argsDescription === undefined)
1876
+ return this._description;
1877
+ this._description = str;
1878
+ if (argsDescription) {
1879
+ this._argsDescription = argsDescription;
1880
+ }
1881
+ return this;
1882
+ }
1883
+ summary(str) {
1884
+ if (str === undefined)
1885
+ return this._summary;
1886
+ this._summary = str;
1887
+ return this;
1888
+ }
1889
+ alias(alias) {
1890
+ if (alias === undefined)
1891
+ return this._aliases[0];
1892
+ let command = this;
1893
+ if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
1894
+ command = this.commands[this.commands.length - 1];
1895
+ }
1896
+ if (alias === command._name)
1897
+ throw new Error("Command alias can't be the same as its name");
1898
+ const matchingCommand = this.parent?._findCommand(alias);
1899
+ if (matchingCommand) {
1900
+ const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
1901
+ throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
1902
+ }
1903
+ command._aliases.push(alias);
1904
+ return this;
1905
+ }
1906
+ aliases(aliases) {
1907
+ if (aliases === undefined)
1908
+ return this._aliases;
1909
+ aliases.forEach((alias) => this.alias(alias));
1910
+ return this;
1911
+ }
1912
+ usage(str) {
1913
+ if (str === undefined) {
1914
+ if (this._usage)
1915
+ return this._usage;
1916
+ const args = this.registeredArguments.map((arg) => {
1917
+ return humanReadableArgName(arg);
1918
+ });
1919
+ return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
1920
+ }
1921
+ this._usage = str;
1922
+ return this;
1923
+ }
1924
+ name(str) {
1925
+ if (str === undefined)
1926
+ return this._name;
1927
+ this._name = str;
1928
+ return this;
1929
+ }
1930
+ helpGroup(heading) {
1931
+ if (heading === undefined)
1932
+ return this._helpGroupHeading ?? "";
1933
+ this._helpGroupHeading = heading;
1934
+ return this;
1935
+ }
1936
+ commandsGroup(heading) {
1937
+ if (heading === undefined)
1938
+ return this._defaultCommandGroup ?? "";
1939
+ this._defaultCommandGroup = heading;
1940
+ return this;
1941
+ }
1942
+ optionsGroup(heading) {
1943
+ if (heading === undefined)
1944
+ return this._defaultOptionGroup ?? "";
1945
+ this._defaultOptionGroup = heading;
1946
+ return this;
1947
+ }
1948
+ _initOptionGroup(option) {
1949
+ if (this._defaultOptionGroup && !option.helpGroupHeading)
1950
+ option.helpGroup(this._defaultOptionGroup);
1951
+ }
1952
+ _initCommandGroup(cmd) {
1953
+ if (this._defaultCommandGroup && !cmd.helpGroup())
1954
+ cmd.helpGroup(this._defaultCommandGroup);
1955
+ }
1956
+ nameFromFilename(filename) {
1957
+ this._name = path.basename(filename, path.extname(filename));
1958
+ return this;
1959
+ }
1960
+ executableDir(path2) {
1961
+ if (path2 === undefined)
1962
+ return this._executableDir;
1963
+ this._executableDir = path2;
1964
+ return this;
1965
+ }
1966
+ helpInformation(contextOptions) {
1967
+ const helper = this.createHelp();
1968
+ const context = this._getOutputContext(contextOptions);
1969
+ helper.prepareContext({
1970
+ error: context.error,
1971
+ helpWidth: context.helpWidth,
1972
+ outputHasColors: context.hasColors
1973
+ });
1974
+ const text = helper.formatHelp(this, helper);
1975
+ if (context.hasColors)
1976
+ return text;
1977
+ return this._outputConfiguration.stripColor(text);
1978
+ }
1979
+ _getOutputContext(contextOptions) {
1980
+ contextOptions = contextOptions || {};
1981
+ const error = !!contextOptions.error;
1982
+ let baseWrite;
1983
+ let hasColors;
1984
+ let helpWidth;
1985
+ if (error) {
1986
+ baseWrite = (str) => this._outputConfiguration.writeErr(str);
1987
+ hasColors = this._outputConfiguration.getErrHasColors();
1988
+ helpWidth = this._outputConfiguration.getErrHelpWidth();
1989
+ } else {
1990
+ baseWrite = (str) => this._outputConfiguration.writeOut(str);
1991
+ hasColors = this._outputConfiguration.getOutHasColors();
1992
+ helpWidth = this._outputConfiguration.getOutHelpWidth();
1993
+ }
1994
+ const write = (str) => {
1995
+ if (!hasColors)
1996
+ str = this._outputConfiguration.stripColor(str);
1997
+ return baseWrite(str);
1998
+ };
1999
+ return { error, write, hasColors, helpWidth };
2000
+ }
2001
+ outputHelp(contextOptions) {
2002
+ let deprecatedCallback;
2003
+ if (typeof contextOptions === "function") {
2004
+ deprecatedCallback = contextOptions;
2005
+ contextOptions = undefined;
2006
+ }
2007
+ const outputContext = this._getOutputContext(contextOptions);
2008
+ const eventContext = {
2009
+ error: outputContext.error,
2010
+ write: outputContext.write,
2011
+ command: this
2012
+ };
2013
+ this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
2014
+ this.emit("beforeHelp", eventContext);
2015
+ let helpInformation = this.helpInformation({ error: outputContext.error });
2016
+ if (deprecatedCallback) {
2017
+ helpInformation = deprecatedCallback(helpInformation);
2018
+ if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
2019
+ throw new Error("outputHelp callback must return a string or a Buffer");
2020
+ }
2021
+ }
2022
+ outputContext.write(helpInformation);
2023
+ if (this._getHelpOption()?.long) {
2024
+ this.emit(this._getHelpOption().long);
2025
+ }
2026
+ this.emit("afterHelp", eventContext);
2027
+ this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
2028
+ }
2029
+ helpOption(flags, description) {
2030
+ if (typeof flags === "boolean") {
2031
+ if (flags) {
2032
+ if (this._helpOption === null)
2033
+ this._helpOption = undefined;
2034
+ if (this._defaultOptionGroup) {
2035
+ this._initOptionGroup(this._getHelpOption());
2036
+ }
2037
+ } else {
2038
+ this._helpOption = null;
2039
+ }
2040
+ return this;
2041
+ }
2042
+ this._helpOption = this.createOption(flags ?? "-h, --help", description ?? "display help for command");
2043
+ if (flags || description)
2044
+ this._initOptionGroup(this._helpOption);
2045
+ return this;
2046
+ }
2047
+ _getHelpOption() {
2048
+ if (this._helpOption === undefined) {
2049
+ this.helpOption(undefined, undefined);
2050
+ }
2051
+ return this._helpOption;
2052
+ }
2053
+ addHelpOption(option) {
2054
+ this._helpOption = option;
2055
+ this._initOptionGroup(option);
2056
+ return this;
2057
+ }
2058
+ help(contextOptions) {
2059
+ this.outputHelp(contextOptions);
2060
+ let exitCode = Number(process2.exitCode ?? 0);
2061
+ if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2062
+ exitCode = 1;
2063
+ }
2064
+ this._exit(exitCode, "commander.help", "(outputHelp)");
2065
+ }
2066
+ addHelpText(position, text) {
2067
+ const allowedValues = ["beforeAll", "before", "after", "afterAll"];
2068
+ if (!allowedValues.includes(position)) {
2069
+ throw new Error(`Unexpected value for position to addHelpText.
2070
+ Expecting one of '${allowedValues.join("', '")}'`);
2071
+ }
2072
+ const helpEvent = `${position}Help`;
2073
+ this.on(helpEvent, (context) => {
2074
+ let helpStr;
2075
+ if (typeof text === "function") {
2076
+ helpStr = text({ error: context.error, command: context.command });
2077
+ } else {
2078
+ helpStr = text;
2079
+ }
2080
+ if (helpStr) {
2081
+ context.write(`${helpStr}
2082
+ `);
2083
+ }
2084
+ });
2085
+ return this;
2086
+ }
2087
+ _outputHelpIfRequested(args) {
2088
+ const helpOption = this._getHelpOption();
2089
+ const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
2090
+ if (helpRequested) {
2091
+ this.outputHelp();
2092
+ this._exit(0, "commander.helpDisplayed", "(outputHelp)");
2093
+ }
2094
+ }
2095
+ }
2096
+ function incrementNodeInspectorPort(args) {
2097
+ return args.map((arg) => {
2098
+ if (!arg.startsWith("--inspect")) {
2099
+ return arg;
2100
+ }
2101
+ let debugOption;
2102
+ let debugHost = "127.0.0.1";
2103
+ let debugPort = "9229";
2104
+ let match;
2105
+ if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
2106
+ debugOption = match[1];
2107
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
2108
+ debugOption = match[1];
2109
+ if (/^\d+$/.test(match[3])) {
2110
+ debugPort = match[3];
2111
+ } else {
2112
+ debugHost = match[3];
2113
+ }
2114
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
2115
+ debugOption = match[1];
2116
+ debugHost = match[3];
2117
+ debugPort = match[4];
2118
+ }
2119
+ if (debugOption && debugPort !== "0") {
2120
+ return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
2121
+ }
2122
+ return arg;
2123
+ });
2124
+ }
2125
+ function useColor() {
2126
+ if (process2.env.NO_COLOR || process2.env.FORCE_COLOR === "0" || process2.env.FORCE_COLOR === "false")
2127
+ return false;
2128
+ if (process2.env.FORCE_COLOR || process2.env.CLICOLOR_FORCE !== undefined)
2129
+ return true;
2130
+ return;
2131
+ }
2132
+
2133
+ // node_modules/commander/index.js
2134
+ var program = new Command;
2135
+ // package.json
2136
+ var package_default = {
2137
+ name: "@kecan0406/ttheme",
2138
+ version: "0.1.0",
2139
+ type: "module",
2140
+ bin: {
2141
+ ttheme: "bin/ttheme.js"
2142
+ },
2143
+ files: [
2144
+ "bin",
2145
+ "dist",
2146
+ "shell",
2147
+ "ghostty/shaders"
2148
+ ],
2149
+ description: "Character terminal palettes for ghostty, kitty, alacritty, wezterm and iTerm2",
2150
+ license: "MIT",
2151
+ author: "kecan0406",
2152
+ repository: {
2153
+ type: "git",
2154
+ url: "git+https://github.com/kecan0406/ttheme.git"
2155
+ },
2156
+ homepage: "https://github.com/kecan0406/ttheme#readme",
2157
+ bugs: "https://github.com/kecan0406/ttheme/issues",
2158
+ keywords: [
2159
+ "terminal",
2160
+ "theme",
2161
+ "ghostty",
2162
+ "kitty",
2163
+ "alacritty",
2164
+ "wezterm",
2165
+ "iterm2"
2166
+ ],
2167
+ devDependencies: {
2168
+ "@biomejs/biome": "^2.3.0",
2169
+ "@clack/prompts": "^1.7.0",
2170
+ "@types/bun": "^1.3.0",
2171
+ commander: "^15.0.0",
2172
+ typescript: "^5.8.2"
2173
+ },
2174
+ engines: {
2175
+ bun: ">=1.3",
2176
+ node: ">=20.11"
2177
+ }
2178
+ };
2179
+
2180
+ // src/build.ts
2181
+ import { rmSync } from "node:fs";
2182
+ import { join as join2 } from "node:path";
2183
+
2184
+ // src/color.ts
2185
+ var HEX = /^#[0-9a-f]{6}$/;
2186
+ function isHex(value) {
2187
+ return HEX.test(value);
2188
+ }
2189
+ function rgb(hex) {
2190
+ const n = Number.parseInt(hex.slice(1), 16);
2191
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
2192
+ }
2193
+ function luminance(hex) {
2194
+ const [r, g, b] = rgb(hex).map((c) => {
2195
+ const s = c / 255;
2196
+ return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
2197
+ });
2198
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
2199
+ }
2200
+ function contrast(a, b) {
2201
+ const la = luminance(a);
2202
+ const lb = luminance(b);
2203
+ return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
2204
+ }
2205
+ function ratio(a, b) {
2206
+ return Math.round(contrast(a, b) * 100) / 100;
2207
+ }
2208
+
2209
+ // src/contrast.ts
2210
+ var BODY_MIN = 7;
2211
+ var ACCENT_MIN = 3;
2212
+ var ANSI0_MAX_LUMINANCE = 0.15;
2213
+ var ANSI8_MIN = 1.6;
2214
+ function at(theme, index) {
2215
+ const color = theme.ansi[index];
2216
+ if (color === undefined)
2217
+ throw new Error(`${theme.name}: missing ANSI ${index}`);
2218
+ return color;
2219
+ }
2220
+ function belowMin(theme, indices, min) {
2221
+ const bg = theme.background;
2222
+ return indices.flatMap((i) => {
2223
+ const color = at(theme, i);
2224
+ return contrast(color, bg) < min ? [`ANSI ${i} ${color} on ${bg} is ${ratio(color, bg)}:1, needs ${min}:1`] : [];
2225
+ });
2226
+ }
2227
+ var CHECKS = [
2228
+ {
2229
+ rule: "foreground",
2230
+ check: ({ foreground, background }) => contrast(foreground, background) < BODY_MIN ? [`foreground ${foreground} on ${background} is ${ratio(foreground, background)}:1, needs ${BODY_MIN}:1`] : []
2231
+ },
2232
+ {
2233
+ rule: "accents",
2234
+ check: (theme) => belowMin(theme, [1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14], ACCENT_MIN)
2235
+ },
2236
+ {
2237
+ rule: "ansi0-dark",
2238
+ check: (theme) => {
2239
+ const ansi0 = at(theme, 0);
2240
+ return luminance(ansi0) > ANSI0_MAX_LUMINANCE ? [`ANSI 0 ${ansi0} has luminance ${luminance(ansi0).toFixed(3)}, needs <= ${ANSI0_MAX_LUMINANCE}`] : [];
2241
+ }
2242
+ },
2243
+ {
2244
+ rule: "light-ansi",
2245
+ check: (theme) => belowMin(theme, [7, 15], BODY_MIN)
2246
+ },
2247
+ {
2248
+ rule: "ansi8-visible",
2249
+ check: (theme) => belowMin(theme, [8], ANSI8_MIN)
2250
+ }
2251
+ ];
2252
+ var RULES = CHECKS.map((c) => c.rule);
2253
+ function check(theme) {
2254
+ return CHECKS.filter((c) => !theme.waive.includes(c.rule)).flatMap((c) => c.check(theme).map((detail) => ({ theme: theme.name, rule: c.rule, detail })));
2255
+ }
2256
+ function checkAll(themes) {
2257
+ return themes.flatMap(check);
2258
+ }
2259
+
2260
+ // src/emit/alacritty.ts
2261
+ var NAMES = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"];
2262
+ function block(header, colors) {
2263
+ return [header, ...NAMES.map((name, i) => `${name} = '${colors[i]}'`), ""].join(`
2264
+ `);
2265
+ }
2266
+ var alacritty = {
2267
+ id: "alacritty",
2268
+ limits: "no shaders, no runtime color API (OSC only)",
2269
+ emit(theme) {
2270
+ const colors = [
2271
+ ...banner(theme),
2272
+ "",
2273
+ "[colors.primary]",
2274
+ `background = '${theme.background}'`,
2275
+ `foreground = '${theme.foreground}'`,
2276
+ "",
2277
+ "[colors.cursor]",
2278
+ `cursor = '${theme.cursor}'`,
2279
+ `text = '${theme.background}'`,
2280
+ "",
2281
+ "[colors.selection]",
2282
+ `background = '${theme.selectionBackground}'`,
2283
+ `text = '${theme.foreground}'`,
2284
+ "",
2285
+ block("[colors.normal]", theme.ansi.slice(0, 8)),
2286
+ block("[colors.bright]", theme.ansi.slice(8, 16))
2287
+ ].join(`
2288
+ `);
2289
+ const config = [
2290
+ `# ${theme.name} — font settings.`,
2291
+ `# Pair with the palette: import = ["~/.config/alacritty/themes/${theme.name}.toml"]`,
2292
+ "",
2293
+ "[font]",
2294
+ `size = ${theme.font.size}`,
2295
+ "",
2296
+ "[font.normal]",
2297
+ `family = '${theme.font.family}'`,
2298
+ ""
2299
+ ].join(`
2300
+ `);
2301
+ return [
2302
+ { path: `alacritty/themes/${theme.name}.toml`, content: colors },
2303
+ { path: `alacritty/config/${theme.name}.toml`, content: config }
2304
+ ];
2305
+ }
2306
+ };
2307
+ // src/emit/ghostty.ts
2308
+ import { isDeepStrictEqual } from "node:util";
2309
+ var ghostty = {
2310
+ id: "ghostty",
2311
+ emit(theme) {
2312
+ const colors = [
2313
+ ...banner(theme),
2314
+ `background = ${theme.background}`,
2315
+ `foreground = ${theme.foreground}`,
2316
+ `cursor-color = ${theme.cursor}`,
2317
+ `selection-background = ${theme.selectionBackground}`,
2318
+ `selection-foreground = ${theme.foreground}`,
2319
+ ...theme.ansi.map((c, i) => `palette = ${i}=${c}`),
2320
+ "palette-generate = true",
2321
+ "",
2322
+ "macos-icon = custom-style",
2323
+ `macos-icon-ghost-color = ${theme.ghostty.iconGhost}`,
2324
+ `macos-icon-screen-color = ${theme.ghostty.iconScreen.join(",")}`,
2325
+ "macos-icon-frame = chrome",
2326
+ ""
2327
+ ].join(`
2328
+ `);
2329
+ return [{ path: `ghostty/themes/${theme.name}`, content: colors }];
2330
+ },
2331
+ emitShared(themes) {
2332
+ const [first] = themes;
2333
+ if (!first)
2334
+ return [];
2335
+ for (const t of themes) {
2336
+ if (!isDeepStrictEqual(t.font, first.font) || t.ghostty.shader !== first.ghostty.shader) {
2337
+ throw new Error(`${t.name}: per-theme font/shader overrides cannot be expressed in the shared ghostty/ttheme.conf`);
2338
+ }
2339
+ }
2340
+ const config = [
2341
+ "# ttheme — shared font and shader, identical for every palette.",
2342
+ "# Pick colors with: theme = <palette>",
2343
+ `font-family = ${first.font.family}`,
2344
+ `font-size = ${first.font.size}`,
2345
+ ...first.font.codepointMap.map((m) => `font-codepoint-map = ${m.range}=${m.family}`),
2346
+ ...first.ghostty.shader ? ["", `custom-shader = ~/.config/ghostty/shaders/${first.ghostty.shader}`, "custom-shader-animation = true"] : [],
2347
+ ""
2348
+ ].join(`
2349
+ `);
2350
+ return [{ path: "ghostty/ttheme.conf", content: config }];
2351
+ }
2352
+ };
2353
+ // src/emit/iterm2.ts
2354
+ function color(key, hex) {
2355
+ const [r, g, b] = rgb(hex);
2356
+ const real = (c) => (c / 255).toFixed(4);
2357
+ return [
2358
+ ` <key>${key}</key>`,
2359
+ "\t<dict>",
2360
+ "\t\t<key>Alpha Component</key>",
2361
+ "\t\t<real>1</real>",
2362
+ "\t\t<key>Blue Component</key>",
2363
+ ` <real>${real(b)}</real>`,
2364
+ "\t\t<key>Color Space</key>",
2365
+ "\t\t<string>sRGB</string>",
2366
+ "\t\t<key>Green Component</key>",
2367
+ ` <real>${real(g)}</real>`,
2368
+ "\t\t<key>Red Component</key>",
2369
+ ` <real>${real(r)}</real>`,
2370
+ "\t</dict>"
2371
+ ].join(`
2372
+ `);
2373
+ }
2374
+ var iterm2 = {
2375
+ id: "iterm2",
2376
+ limits: "colors only — font lives in the profile; ignores OSC 12, so the cursor keeps its profile color at runtime",
2377
+ emit(theme) {
2378
+ const entries = [
2379
+ ...theme.ansi.map((c, i) => color(`Ansi ${i} Color`, c)),
2380
+ color("Background Color", theme.background),
2381
+ color("Bold Color", theme.foreground),
2382
+ color("Cursor Color", theme.cursor),
2383
+ color("Cursor Text Color", theme.background),
2384
+ color("Foreground Color", theme.foreground),
2385
+ color("Selected Text Color", theme.foreground),
2386
+ color("Selection Color", theme.selectionBackground)
2387
+ ];
2388
+ const content = [
2389
+ '<?xml version="1.0" encoding="UTF-8"?>',
2390
+ '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
2391
+ '<plist version="1.0">',
2392
+ "<dict>",
2393
+ ...entries,
2394
+ "</dict>",
2395
+ "</plist>",
2396
+ ""
2397
+ ].join(`
2398
+ `);
2399
+ return [{ path: `iterm2/${theme.name}.itermcolors`, content }];
2400
+ }
2401
+ };
2402
+ // src/emit/kitty.ts
2403
+ var kitty = {
2404
+ id: "kitty",
2405
+ limits: "no GLSL shaders, no per-codepoint font mapping",
2406
+ emit(theme) {
2407
+ const colors = [
2408
+ ...banner(theme),
2409
+ `background ${theme.background}`,
2410
+ `foreground ${theme.foreground}`,
2411
+ `cursor ${theme.cursor}`,
2412
+ `cursor_text_color ${theme.background}`,
2413
+ `selection_background ${theme.selectionBackground}`,
2414
+ `selection_foreground ${theme.foreground}`,
2415
+ ...theme.ansi.map((c, i) => `color${i} ${c}`),
2416
+ ""
2417
+ ].join(`
2418
+ `);
2419
+ const config = [
2420
+ `# ${theme.name} — font settings.`,
2421
+ `# Pair with the palette: include themes/${theme.name}.conf`,
2422
+ `font_family ${theme.font.family}`,
2423
+ `font_size ${theme.font.size}`,
2424
+ ""
2425
+ ].join(`
2426
+ `);
2427
+ return [
2428
+ { path: `kitty/themes/${theme.name}.conf`, content: colors },
2429
+ { path: `kitty/config/${theme.name}.conf`, content: config }
2430
+ ];
2431
+ }
2432
+ };
2433
+ // src/emit/wezterm.ts
2434
+ var list = (colors) => `[${colors.map((c) => `"${c}"`).join(", ")}]`;
2435
+ var wezterm = {
2436
+ id: "wezterm",
2437
+ limits: "no shaders; runtime overrides are per-window, never per-pane",
2438
+ emit(theme) {
2439
+ const colors = [
2440
+ "[metadata]",
2441
+ `name = "${theme.name}"`,
2442
+ `origin_url = "${theme.ansiSource}"`,
2443
+ "",
2444
+ "[colors]",
2445
+ `foreground = "${theme.foreground}"`,
2446
+ `background = "${theme.background}"`,
2447
+ `cursor_bg = "${theme.cursor}"`,
2448
+ `cursor_border = "${theme.cursor}"`,
2449
+ `cursor_fg = "${theme.background}"`,
2450
+ `selection_bg = "${theme.selectionBackground}"`,
2451
+ `selection_fg = "${theme.foreground}"`,
2452
+ "",
2453
+ `ansi = ${list(theme.ansi.slice(0, 8))}`,
2454
+ `brights = ${list(theme.ansi.slice(8, 16))}`,
2455
+ ""
2456
+ ].join(`
2457
+ `);
2458
+ const config = [
2459
+ `-- ${theme.name} — font settings.`,
2460
+ `-- Merge into your wezterm.lua config table:`,
2461
+ `-- local t = require("ttheme.${theme.name}")`,
2462
+ `-- config.color_scheme = "${theme.name}"`,
2463
+ `-- config.font = t.font`,
2464
+ `-- config.font_size = t.font_size`,
2465
+ "return {",
2466
+ ` font = require("wezterm").font("${theme.font.family}"),`,
2467
+ ` font_size = ${theme.font.size},`,
2468
+ "}",
2469
+ ""
2470
+ ].join(`
2471
+ `);
2472
+ return [
2473
+ { path: `wezterm/colors/${theme.name}.toml`, content: colors },
2474
+ { path: `wezterm/config/${theme.name}.lua`, content: config }
2475
+ ];
2476
+ }
2477
+ };
2478
+
2479
+ // src/emit/index.ts
2480
+ function banner(theme) {
2481
+ return [`# ${theme.name} — ${theme.group}${theme.native ? ` (${theme.native})` : ""}`, `# ANSI: ${theme.ansiSource}`];
2482
+ }
2483
+
2484
+ // src/theme.ts
2485
+ import { readdirSync, readFileSync } from "node:fs";
2486
+ import { basename, join } from "node:path";
2487
+ var DEFAULTS_FILE = "_defaults.toml";
2488
+ var RESERVED_NAMES = new Set(["next", "current", "help", "preview"]);
2489
+ function fail(file, message) {
2490
+ throw new Error(`${file}: ${message}`);
2491
+ }
2492
+ function hex(file, field, value) {
2493
+ if (typeof value !== "string" || !isHex(value)) {
2494
+ fail(file, `${field} must be "#rrggbb" (lowercase), got ${JSON.stringify(value)}`);
2495
+ }
2496
+ return value;
2497
+ }
2498
+ function str(file, field, value) {
2499
+ if (typeof value !== "string" || value.length === 0) {
2500
+ fail(file, `${field} must be a non-empty string`);
2501
+ }
2502
+ return value;
2503
+ }
2504
+ function table(value) {
2505
+ return value && typeof value === "object" ? value : {};
2506
+ }
2507
+ function readFont(file, own, base) {
2508
+ const font = { ...table(base), ...table(own) };
2509
+ const raw = font.codepoint_map ?? [];
2510
+ if (!Array.isArray(raw))
2511
+ fail(file, "font.codepoint_map must be an array");
2512
+ return {
2513
+ family: str(file, "font.family", font.family),
2514
+ size: Number(font.size),
2515
+ codepointMap: raw.map((entry) => {
2516
+ const e = table(entry);
2517
+ return {
2518
+ range: str(file, "font.codepoint_map[].range", e.range),
2519
+ family: str(file, "font.codepoint_map[].family", e.family)
2520
+ };
2521
+ })
2522
+ };
2523
+ }
2524
+ function readIconScreen(file, value, colors) {
2525
+ if (value === undefined) {
2526
+ return [colors.cursor, colors.selectionBackground, colors.background];
2527
+ }
2528
+ const raw = Array.isArray(value) ? value : [value];
2529
+ if (raw.length === 0)
2530
+ fail(file, "ghostty.icon_screen must not be empty");
2531
+ return raw.map((c, i) => hex(file, `ghostty.icon_screen[${i}]`, c));
2532
+ }
2533
+ function readGhostty(file, own, base, colors) {
2534
+ const g = { ...table(base), ...table(own) };
2535
+ return {
2536
+ shader: g.shader === undefined ? undefined : str(file, "ghostty.shader", g.shader),
2537
+ iconGhost: g.icon_ghost === undefined ? colors.cursor : hex(file, "ghostty.icon_ghost", g.icon_ghost),
2538
+ iconScreen: readIconScreen(file, g.icon_screen, colors)
2539
+ };
2540
+ }
2541
+ function readTheme(file, source, defaults) {
2542
+ const doc = Bun.TOML.parse(source);
2543
+ const meta = table(doc.meta);
2544
+ const colors = table(doc.colors);
2545
+ const contrastRules = table(doc.contrast);
2546
+ const ansiRaw = colors.ansi;
2547
+ if (!Array.isArray(ansiRaw) || ansiRaw.length !== 16) {
2548
+ fail(file, `colors.ansi must hold exactly 16 colors, got ${Array.isArray(ansiRaw) ? ansiRaw.length : typeof ansiRaw}`);
2549
+ }
2550
+ const name = str(file, "meta.name", meta.name);
2551
+ if (name !== basename(file, ".toml")) {
2552
+ fail(file, `meta.name "${name}" does not match the filename`);
2553
+ }
2554
+ if (RESERVED_NAMES.has(name)) {
2555
+ fail(file, `meta.name "${name}" collides with a ttheme subcommand`);
2556
+ }
2557
+ if (name.startsWith("-")) {
2558
+ fail(file, `meta.name "${name}" would be read as a flag by the ttheme CLI`);
2559
+ }
2560
+ const role = meta.role;
2561
+ if (role !== undefined && role !== "default") {
2562
+ fail(file, `meta.role must be "default", got ${JSON.stringify(role)}`);
2563
+ }
2564
+ const background = hex(file, "colors.background", colors.background);
2565
+ const cursor = hex(file, "colors.cursor", colors.cursor);
2566
+ const selectionBackground = hex(file, "colors.selection_background", colors.selection_background);
2567
+ const waive = Array.isArray(contrastRules.waive) ? contrastRules.waive.map(String) : [];
2568
+ if (waive.length > 0 && typeof contrastRules.reason !== "string") {
2569
+ fail(file, "contrast.waive needs a contrast.reason explaining why");
2570
+ }
2571
+ return {
2572
+ name,
2573
+ group: str(file, "meta.group", meta.group),
2574
+ native: meta.native === undefined ? undefined : str(file, "meta.native", meta.native),
2575
+ order: Number(meta.order),
2576
+ role,
2577
+ ansiSource: str(file, "meta.ansi_source", meta.ansi_source),
2578
+ background,
2579
+ foreground: hex(file, "colors.foreground", colors.foreground),
2580
+ cursor,
2581
+ selectionBackground,
2582
+ ansi: ansiRaw.map((c, i) => hex(file, `colors.ansi[${i}]`, c)),
2583
+ font: readFont(file, doc.font, defaults.font),
2584
+ ghostty: readGhostty(file, doc.ghostty, defaults.ghostty, {
2585
+ background,
2586
+ cursor,
2587
+ selectionBackground
2588
+ }),
2589
+ waive,
2590
+ waiveReason: typeof contrastRules.reason === "string" ? contrastRules.reason : undefined
2591
+ };
2592
+ }
2593
+ function loadThemes(dir) {
2594
+ const defaults = Bun.TOML.parse(readFileSync(join(dir, DEFAULTS_FILE), "utf8"));
2595
+ const themes = readdirSync(dir).filter((f) => f.endsWith(".toml") && f !== DEFAULTS_FILE).map((f) => readTheme(f, readFileSync(join(dir, f), "utf8"), defaults)).sort((a, b) => a.order - b.order);
2596
+ const orders = new Set(themes.map((t) => t.order));
2597
+ if (orders.size !== themes.length) {
2598
+ throw new Error("themes: meta.order must be unique across all themes");
2599
+ }
2600
+ return themes;
2601
+ }
2602
+ function rotation(themes) {
2603
+ return themes.filter((t) => t.role === undefined);
2604
+ }
2605
+
2606
+ // src/build.ts
2607
+ var root = join2(import.meta.dirname, "..");
2608
+ var THEMES = join2(root, "themes");
2609
+ var DIST = join2(root, "dist");
2610
+ var EMITTERS = [ghostty, kitty, alacritty, wezterm, iterm2];
2611
+ var TERMINALS = EMITTERS.map((e) => e.id);
2612
+ function shellPalettes(themes) {
2613
+ for (const t of themes) {
2614
+ for (const field of [t.name, t.group, t.native ?? "", t.ansiSource]) {
2615
+ if (/["$`\\]/.test(field)) {
2616
+ throw new Error(`${t.name}: "${field}" contains a character that breaks zsh quoting`);
2617
+ }
2618
+ }
2619
+ }
2620
+ const pad = Math.max(...themes.map((t) => t.name.length));
2621
+ const entry = (t, value) => ` ${t.name.padEnd(pad)} "${value}"`;
2622
+ return [
2623
+ "# Generated by `mise run build` — do not edit.",
2624
+ "# Source of truth: themes/*.toml in the ttheme repo.",
2625
+ "",
2626
+ "typeset -gA TTHEME_PALETTE=(",
2627
+ ...themes.map((t) => entry(t, [t.background, t.foreground, t.cursor, t.selectionBackground, ...t.ansi].join(" "))),
2628
+ ")",
2629
+ "",
2630
+ "# display order for `ttheme`, and the order new tabs are assigned in",
2631
+ `typeset -ga TTHEME_ORDER=(${themes.map((t) => t.name).join(" ")})`,
2632
+ "",
2633
+ "# themes new tabs cycle through (the default role sits out)",
2634
+ `typeset -ga TTHEME_ROTATION=(${rotation(themes).map((t) => t.name).join(" ")})`,
2635
+ "",
2636
+ "typeset -gA TTHEME_GROUP=(",
2637
+ ...themes.map((t) => entry(t, t.group)),
2638
+ ")",
2639
+ "",
2640
+ "# original-language title, rendered dim next to the group",
2641
+ "typeset -gA TTHEME_NATIVE=(",
2642
+ ...themes.filter((t) => t.native).map((t) => entry(t, t.native ?? "")),
2643
+ ")",
2644
+ "",
2645
+ "# where each palette's 16 ANSI colors came from",
2646
+ "typeset -gA TTHEME_SRC=(",
2647
+ ...themes.map((t) => entry(t, t.ansiSource)),
2648
+ ")",
2649
+ ""
2650
+ ].join(`
2651
+ `);
2652
+ }
2653
+ async function build({ only } = {}) {
2654
+ if (typeof Bun === "undefined") {
2655
+ throw new Error("ttheme build needs bun — run it from a checkout: bun src/bin.ts build");
2656
+ }
2657
+ const emitters = only && only.length > 0 ? EMITTERS.filter((e) => only.includes(e.id)) : EMITTERS;
2658
+ const themes = loadThemes(THEMES);
2659
+ const violations = checkAll(themes);
2660
+ if (violations.length > 0) {
2661
+ for (const v of violations) {
2662
+ console.error(` ✗ ${v.theme} [${v.rule}] ${v.detail}`);
2663
+ }
2664
+ throw new Error(`${violations.length} contrast violation(s). Fix the palette, or waive the rule in its [contrast] section with a reason.`);
2665
+ }
2666
+ if (emitters.length === EMITTERS.length) {
2667
+ rmSync(DIST, { recursive: true, force: true });
2668
+ } else {
2669
+ for (const e of emitters) {
2670
+ rmSync(join2(DIST, e.id), { recursive: true, force: true });
2671
+ }
2672
+ }
2673
+ let count = 0;
2674
+ const write = async (out) => {
2675
+ await Bun.write(join2(DIST, out.path), out.content);
2676
+ count++;
2677
+ };
2678
+ for (const emitter of emitters) {
2679
+ for (const theme of themes) {
2680
+ for (const out of emitter.emit(theme)) {
2681
+ await write(out);
2682
+ }
2683
+ }
2684
+ for (const out of emitter.emitShared?.(themes) ?? []) {
2685
+ await write(out);
2686
+ }
2687
+ console.log(` ${emitter.id.padEnd(10)} ${themes.length} themes${emitter.limits ? ` (${emitter.limits})` : ""}`);
2688
+ }
2689
+ await Bun.write(join2(DIST, "shell", "palettes.zsh"), shellPalettes(themes));
2690
+ count++;
2691
+ console.log(` ${"shell".padEnd(10)} palettes.zsh`);
2692
+ console.log(`
2693
+ ${themes.length} themes (${rotation(themes).length} in the new-tab rotation) -> ${count} files in dist/`);
2694
+ }
2695
+
2696
+ // src/init.ts
2697
+ import {
2698
+ chmodSync,
2699
+ copyFileSync,
2700
+ existsSync,
2701
+ mkdirSync,
2702
+ readdirSync as readdirSync2,
2703
+ readFileSync as readFileSync2,
2704
+ rmSync as rmSync2,
2705
+ symlinkSync,
2706
+ writeFileSync
2707
+ } from "node:fs";
2708
+ import { homedir } from "node:os";
2709
+ import { dirname, join as join3 } from "node:path";
2710
+
2711
+ // node_modules/@clack/core/dist/index.mjs
2712
+ import { styleText } from "node:util";
2713
+ import { stdout, stdin } from "node:process";
2714
+ import l__default from "node:readline";
2715
+
2716
+ // node_modules/fast-string-truncated-width/dist/utils.js
2717
+ var getCodePointsLength = (() => {
2718
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
2719
+ return (input) => {
2720
+ let surrogatePairsNr = 0;
2721
+ SURROGATE_PAIR_RE.lastIndex = 0;
2722
+ while (SURROGATE_PAIR_RE.test(input)) {
2723
+ surrogatePairsNr += 1;
2724
+ }
2725
+ return input.length - surrogatePairsNr;
2726
+ };
2727
+ })();
2728
+ var isFullWidth = (x) => {
2729
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
2730
+ };
2731
+ var isWideNotCJKTNotEmoji = (x) => {
2732
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
2733
+ };
2734
+
2735
+ // node_modules/fast-string-truncated-width/dist/index.js
2736
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
2737
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
2738
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
2739
+ var TAB_RE = /\t{1,1000}/y;
2740
+ var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
2741
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
2742
+ var MODIFIER_RE = /\p{M}+/gu;
2743
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
2744
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
2745
+ const LIMIT = truncationOptions.limit ?? Infinity;
2746
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
2747
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
2748
+ const ANSI_WIDTH = 0;
2749
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
2750
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
2751
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
2752
+ const FULL_WIDTH_WIDTH = 2;
2753
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
2754
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
2755
+ const PARSE_BLOCKS = [
2756
+ [LATIN_RE, REGULAR_WIDTH],
2757
+ [ANSI_RE, ANSI_WIDTH],
2758
+ [CONTROL_RE, CONTROL_WIDTH],
2759
+ [TAB_RE, TAB_WIDTH],
2760
+ [EMOJI_RE, EMOJI_WIDTH],
2761
+ [CJKT_WIDE_RE, WIDE_WIDTH]
2762
+ ];
2763
+ let indexPrev = 0;
2764
+ let index = 0;
2765
+ let length = input.length;
2766
+ let lengthExtra = 0;
2767
+ let truncationEnabled = false;
2768
+ let truncationIndex = length;
2769
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
2770
+ let unmatchedStart = 0;
2771
+ let unmatchedEnd = 0;
2772
+ let width = 0;
2773
+ let widthExtra = 0;
2774
+ outer:
2775
+ while (true) {
2776
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
2777
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
2778
+ lengthExtra = 0;
2779
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
2780
+ const codePoint = char.codePointAt(0) || 0;
2781
+ if (isFullWidth(codePoint)) {
2782
+ widthExtra = FULL_WIDTH_WIDTH;
2783
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
2784
+ widthExtra = WIDE_WIDTH;
2785
+ } else {
2786
+ widthExtra = REGULAR_WIDTH;
2787
+ }
2788
+ if (width + widthExtra > truncationLimit) {
2789
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
2790
+ }
2791
+ if (width + widthExtra > LIMIT) {
2792
+ truncationEnabled = true;
2793
+ break outer;
2794
+ }
2795
+ lengthExtra += char.length;
2796
+ width += widthExtra;
2797
+ }
2798
+ unmatchedStart = unmatchedEnd = 0;
2799
+ }
2800
+ if (index >= length) {
2801
+ break outer;
2802
+ }
2803
+ for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
2804
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
2805
+ BLOCK_RE.lastIndex = index;
2806
+ if (BLOCK_RE.test(input)) {
2807
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
2808
+ widthExtra = lengthExtra * BLOCK_WIDTH;
2809
+ if (width + widthExtra > truncationLimit) {
2810
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
2811
+ }
2812
+ if (width + widthExtra > LIMIT) {
2813
+ truncationEnabled = true;
2814
+ break outer;
2815
+ }
2816
+ width += widthExtra;
2817
+ unmatchedStart = indexPrev;
2818
+ unmatchedEnd = index;
2819
+ index = indexPrev = BLOCK_RE.lastIndex;
2820
+ continue outer;
2821
+ }
2822
+ }
2823
+ index += 1;
2824
+ }
2825
+ return {
2826
+ width: truncationEnabled ? truncationLimit : width,
2827
+ index: truncationEnabled ? truncationIndex : length,
2828
+ truncated: truncationEnabled,
2829
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
2830
+ };
2831
+ };
2832
+ var dist_default = getStringTruncatedWidth;
2833
+
2834
+ // node_modules/fast-string-width/dist/index.js
2835
+ var NO_TRUNCATION2 = {
2836
+ limit: Infinity,
2837
+ ellipsis: "",
2838
+ ellipsisWidth: 0
2839
+ };
2840
+ var fastStringWidth = (input, options = {}) => {
2841
+ return dist_default(input, NO_TRUNCATION2, options).width;
2842
+ };
2843
+ var dist_default2 = fastStringWidth;
2844
+
2845
+ // node_modules/fast-wrap-ansi/lib/main.js
2846
+ var ESC = "\x1B";
2847
+ var CSI = "›";
2848
+ var END_CODE = 39;
2849
+ var ANSI_ESCAPE_BELL = "\x07";
2850
+ var ANSI_CSI = "[";
2851
+ var ANSI_OSC = "]";
2852
+ var ANSI_SGR_TERMINATOR = "m";
2853
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
2854
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
2855
+ var getClosingCode = (openingCode) => {
2856
+ if (openingCode >= 30 && openingCode <= 37)
2857
+ return 39;
2858
+ if (openingCode >= 90 && openingCode <= 97)
2859
+ return 39;
2860
+ if (openingCode >= 40 && openingCode <= 47)
2861
+ return 49;
2862
+ if (openingCode >= 100 && openingCode <= 107)
2863
+ return 49;
2864
+ if (openingCode === 1 || openingCode === 2)
2865
+ return 22;
2866
+ if (openingCode === 3)
2867
+ return 23;
2868
+ if (openingCode === 4)
2869
+ return 24;
2870
+ if (openingCode === 7)
2871
+ return 27;
2872
+ if (openingCode === 8)
2873
+ return 28;
2874
+ if (openingCode === 9)
2875
+ return 29;
2876
+ if (openingCode === 0)
2877
+ return 0;
2878
+ return;
2879
+ };
2880
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
2881
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
2882
+ var wrapWord = (rows, word, columns) => {
2883
+ const characters = word[Symbol.iterator]();
2884
+ let isInsideEscape = false;
2885
+ let isInsideLinkEscape = false;
2886
+ let lastRow = rows.at(-1);
2887
+ let visible = lastRow === undefined ? 0 : dist_default2(lastRow);
2888
+ let currentCharacter = characters.next();
2889
+ let nextCharacter = characters.next();
2890
+ let rawCharacterIndex = 0;
2891
+ while (!currentCharacter.done) {
2892
+ const character = currentCharacter.value;
2893
+ const characterLength = dist_default2(character);
2894
+ if (visible + characterLength <= columns) {
2895
+ rows[rows.length - 1] += character;
2896
+ } else {
2897
+ rows.push(character);
2898
+ visible = 0;
2899
+ }
2900
+ if (character === ESC || character === CSI) {
2901
+ isInsideEscape = true;
2902
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
2903
+ }
2904
+ if (isInsideEscape) {
2905
+ if (isInsideLinkEscape) {
2906
+ if (character === ANSI_ESCAPE_BELL) {
2907
+ isInsideEscape = false;
2908
+ isInsideLinkEscape = false;
2909
+ }
2910
+ } else if (character === ANSI_SGR_TERMINATOR) {
2911
+ isInsideEscape = false;
2912
+ }
2913
+ } else {
2914
+ visible += characterLength;
2915
+ if (visible === columns && !nextCharacter.done) {
2916
+ rows.push("");
2917
+ visible = 0;
2918
+ }
2919
+ }
2920
+ currentCharacter = nextCharacter;
2921
+ nextCharacter = characters.next();
2922
+ rawCharacterIndex += character.length;
2923
+ }
2924
+ lastRow = rows.at(-1);
2925
+ if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
2926
+ rows[rows.length - 2] += rows.pop();
2927
+ }
2928
+ };
2929
+ var stringVisibleTrimSpacesRight = (string) => {
2930
+ const words = string.split(" ");
2931
+ let last = words.length;
2932
+ while (last) {
2933
+ if (dist_default2(words[last - 1])) {
2934
+ break;
2935
+ }
2936
+ last--;
2937
+ }
2938
+ if (last === words.length) {
2939
+ return string;
2940
+ }
2941
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
2942
+ };
2943
+ var exec = (string, columns, options = {}) => {
2944
+ if (options.trim !== false && string.trim() === "") {
2945
+ return "";
2946
+ }
2947
+ let returnValue = "";
2948
+ let escapeCode;
2949
+ let escapeUrl;
2950
+ const words = string.split(" ");
2951
+ let rows = [""];
2952
+ let rowLength = 0;
2953
+ for (let index = 0;index < words.length; index++) {
2954
+ const word = words[index];
2955
+ if (options.trim !== false) {
2956
+ const row = rows.at(-1) ?? "";
2957
+ const trimmed = row.trimStart();
2958
+ if (row.length !== trimmed.length) {
2959
+ rows[rows.length - 1] = trimmed;
2960
+ rowLength = dist_default2(trimmed);
2961
+ }
2962
+ }
2963
+ if (index !== 0) {
2964
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
2965
+ rows.push("");
2966
+ rowLength = 0;
2967
+ }
2968
+ if (rowLength || options.trim === false) {
2969
+ rows[rows.length - 1] += " ";
2970
+ rowLength++;
2971
+ }
2972
+ }
2973
+ const wordLength = dist_default2(word);
2974
+ if (options.hard && wordLength > columns) {
2975
+ const remainingColumns = columns - rowLength;
2976
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
2977
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
2978
+ if (breaksStartingNextLine < breaksStartingThisLine) {
2979
+ rows.push("");
2980
+ }
2981
+ wrapWord(rows, word, columns);
2982
+ rowLength = dist_default2(rows.at(-1) ?? "");
2983
+ continue;
2984
+ }
2985
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
2986
+ if (options.wordWrap === false && rowLength < columns) {
2987
+ wrapWord(rows, word, columns);
2988
+ rowLength = dist_default2(rows.at(-1) ?? "");
2989
+ continue;
2990
+ }
2991
+ rows.push("");
2992
+ rowLength = 0;
2993
+ }
2994
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
2995
+ wrapWord(rows, word, columns);
2996
+ rowLength = dist_default2(rows.at(-1) ?? "");
2997
+ continue;
2998
+ }
2999
+ rows[rows.length - 1] += word;
3000
+ rowLength += wordLength;
3001
+ }
3002
+ if (options.trim !== false) {
3003
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
3004
+ }
3005
+ const preString = rows.join(`
3006
+ `);
3007
+ let inSurrogate = false;
3008
+ for (let i = 0;i < preString.length; i++) {
3009
+ const character = preString[i];
3010
+ returnValue += character;
3011
+ if (!inSurrogate) {
3012
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
3013
+ if (inSurrogate) {
3014
+ continue;
3015
+ }
3016
+ } else {
3017
+ inSurrogate = false;
3018
+ }
3019
+ if (character === ESC || character === CSI) {
3020
+ GROUP_REGEX.lastIndex = i + 1;
3021
+ const groupsResult = GROUP_REGEX.exec(preString);
3022
+ const groups = groupsResult?.groups;
3023
+ if (groups?.code !== undefined) {
3024
+ const code = Number.parseFloat(groups.code);
3025
+ escapeCode = code === END_CODE ? undefined : code;
3026
+ } else if (groups?.uri !== undefined) {
3027
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
3028
+ }
3029
+ }
3030
+ if (preString[i + 1] === `
3031
+ `) {
3032
+ if (escapeUrl) {
3033
+ returnValue += wrapAnsiHyperlink("");
3034
+ }
3035
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
3036
+ if (escapeCode && closingCode) {
3037
+ returnValue += wrapAnsiCode(closingCode);
3038
+ }
3039
+ } else if (character === `
3040
+ `) {
3041
+ if (escapeCode && getClosingCode(escapeCode)) {
3042
+ returnValue += wrapAnsiCode(escapeCode);
3043
+ }
3044
+ if (escapeUrl) {
3045
+ returnValue += wrapAnsiHyperlink(escapeUrl);
3046
+ }
3047
+ }
3048
+ }
3049
+ return returnValue;
3050
+ };
3051
+ var CRLF_OR_LF = /\r?\n/;
3052
+ function wrapAnsi(string, columns, options) {
3053
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
3054
+ `);
3055
+ }
3056
+
3057
+ // node_modules/@clack/core/dist/index.mjs
3058
+ var import_sisteransi = __toESM(require_src(), 1);
3059
+ function findCursor(s, o, l) {
3060
+ if (!l.some((r) => !r.disabled))
3061
+ return s;
3062
+ const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
3063
+ return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
3064
+ }
3065
+ function findTextCursor(s, o, l, i) {
3066
+ const t = i.split(`
3067
+ `);
3068
+ let n = 0, e = s;
3069
+ for (const r of t) {
3070
+ if (e <= r.length)
3071
+ break;
3072
+ e -= r.length + 1, n++;
3073
+ }
3074
+ for (n = Math.max(0, Math.min(t.length - 1, n + l)), e = Math.min(e, t[n].length) + o;e < 0 && n > 0; )
3075
+ n--, e += t[n].length + 1;
3076
+ for (;e > t[n].length && n < t.length - 1; )
3077
+ e -= t[n].length + 1, n++;
3078
+ e = Math.max(0, Math.min(t[n].length, e));
3079
+ let h = 0;
3080
+ for (let r = 0;r < n; r++)
3081
+ h += t[r].length + 1;
3082
+ return h + e;
3083
+ }
3084
+ var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
3085
+ var t = [
3086
+ "January",
3087
+ "February",
3088
+ "March",
3089
+ "April",
3090
+ "May",
3091
+ "June",
3092
+ "July",
3093
+ "August",
3094
+ "September",
3095
+ "October",
3096
+ "November",
3097
+ "December"
3098
+ ];
3099
+ var settings = {
3100
+ actions: new Set(a$1),
3101
+ aliases: /* @__PURE__ */ new Map([
3102
+ ["k", "up"],
3103
+ ["j", "down"],
3104
+ ["h", "left"],
3105
+ ["l", "right"],
3106
+ ["\x03", "cancel"],
3107
+ ["escape", "cancel"]
3108
+ ]),
3109
+ messages: {
3110
+ cancel: "Canceled",
3111
+ error: "Something went wrong"
3112
+ },
3113
+ withGuide: true,
3114
+ date: {
3115
+ monthNames: [...t],
3116
+ messages: {
3117
+ required: "Please enter a valid date",
3118
+ invalidMonth: "There are only 12 months in a year",
3119
+ invalidDay: (n, e) => `There are only ${n} days in ${e}`,
3120
+ afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
3121
+ beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
3122
+ }
3123
+ }
3124
+ };
3125
+ function isActionKey(n, e) {
3126
+ if (typeof n == "string")
3127
+ return settings.aliases.get(n) === e;
3128
+ for (const s of n)
3129
+ if (s !== undefined && isActionKey(s, e))
3130
+ return true;
3131
+ return false;
3132
+ }
3133
+ function diffLines(i, s) {
3134
+ if (i === s)
3135
+ return;
3136
+ const e = i.split(`
3137
+ `), t2 = s.split(`
3138
+ `), r = Math.max(e.length, t2.length), f = [];
3139
+ for (let n = 0;n < r; n++)
3140
+ e[n] !== t2[n] && f.push(n);
3141
+ return {
3142
+ lines: f,
3143
+ numLinesBefore: e.length,
3144
+ numLinesAfter: t2.length,
3145
+ numLines: r
3146
+ };
3147
+ }
3148
+ var R = globalThis.process.platform.startsWith("win");
3149
+ var CANCEL_SYMBOL = Symbol("clack:cancel");
3150
+ function isCancel(e) {
3151
+ return e === CANCEL_SYMBOL;
3152
+ }
3153
+ function setRawMode(e, r) {
3154
+ const o = e;
3155
+ o.isTTY && o.setRawMode(r);
3156
+ }
3157
+ var getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80;
3158
+ var getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20;
3159
+ function wrapTextWithPrefix(e, r, o, t2 = o, s = o, n) {
3160
+ const f = getColumns(e ?? stdout);
3161
+ return wrapAnsi(r, f - o.length, {
3162
+ hard: true,
3163
+ trim: false
3164
+ }).split(`
3165
+ `).map((c, i, m) => {
3166
+ const d = n ? n(c, i) : c;
3167
+ return i === 0 ? `${t2}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
3168
+ }).join(`
3169
+ `);
3170
+ }
3171
+ function runValidation(e, n) {
3172
+ if ("~standard" in e) {
3173
+ const a = e["~standard"].validate(n);
3174
+ if (a instanceof Promise)
3175
+ throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
3176
+ return a.issues?.at(0)?.message;
3177
+ }
3178
+ return e(n);
3179
+ }
3180
+
3181
+ class V {
3182
+ input;
3183
+ output;
3184
+ _abortSignal;
3185
+ rl;
3186
+ opts;
3187
+ _render;
3188
+ _track = false;
3189
+ _prevFrame = "";
3190
+ _subscribers = /* @__PURE__ */ new Map;
3191
+ _cursor = 0;
3192
+ state = "initial";
3193
+ error = "";
3194
+ value;
3195
+ userInput = "";
3196
+ constructor(t2, e = true) {
3197
+ const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t2;
3198
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
3199
+ }
3200
+ unsubscribe() {
3201
+ this._subscribers.clear();
3202
+ }
3203
+ setSubscriber(t2, e) {
3204
+ const i = this._subscribers.get(t2) ?? [];
3205
+ i.push(e), this._subscribers.set(t2, i);
3206
+ }
3207
+ on(t2, e) {
3208
+ this.setSubscriber(t2, { cb: e });
3209
+ }
3210
+ once(t2, e) {
3211
+ this.setSubscriber(t2, { cb: e, once: true });
3212
+ }
3213
+ emit(t2, ...e) {
3214
+ const i = this._subscribers.get(t2) ?? [], n = [];
3215
+ for (const s of i)
3216
+ s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
3217
+ for (const s of n)
3218
+ s();
3219
+ }
3220
+ prompt() {
3221
+ return new Promise((t2) => {
3222
+ if (this._abortSignal) {
3223
+ if (this._abortSignal.aborted)
3224
+ return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
3225
+ this._abortSignal.addEventListener("abort", () => {
3226
+ this.state = "cancel", this.close();
3227
+ }, { once: true });
3228
+ }
3229
+ this.rl = l__default.createInterface({
3230
+ input: this.input,
3231
+ tabSize: 2,
3232
+ prompt: "",
3233
+ escapeCodeTimeout: 50,
3234
+ terminal: true
3235
+ }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
3236
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
3237
+ }), this.once("cancel", () => {
3238
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
3239
+ });
3240
+ });
3241
+ }
3242
+ _isActionKey(t2, e) {
3243
+ return t2 === "\t";
3244
+ }
3245
+ _shouldSubmit(t2, e) {
3246
+ return true;
3247
+ }
3248
+ _setValue(t2) {
3249
+ this.value = t2, this.emit("value", this.value);
3250
+ }
3251
+ _setUserInput(t2, e) {
3252
+ this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
3253
+ }
3254
+ _clearUserInput() {
3255
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
3256
+ }
3257
+ onKeypress(t2, e) {
3258
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
3259
+ if (this.opts.validate) {
3260
+ const i = runValidation(this.opts.validate, this.value);
3261
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
3262
+ }
3263
+ this.state !== "error" && (this.state = "submit");
3264
+ }
3265
+ isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
3266
+ }
3267
+ close() {
3268
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
3269
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
3270
+ }
3271
+ restoreCursor() {
3272
+ const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
3273
+ `).length - 1;
3274
+ this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
3275
+ }
3276
+ render() {
3277
+ const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
3278
+ hard: true,
3279
+ trim: false
3280
+ });
3281
+ if (t2 !== this._prevFrame) {
3282
+ if (this.state === "initial")
3283
+ this.output.write(import_sisteransi.cursor.hide);
3284
+ else {
3285
+ const e = diffLines(this._prevFrame, t2), i = getRows(this.output);
3286
+ if (this.restoreCursor(), e) {
3287
+ const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
3288
+ let r = e.lines.find((o) => o >= n);
3289
+ if (r === undefined) {
3290
+ this._prevFrame = t2;
3291
+ return;
3292
+ }
3293
+ if (e.lines.length === 1) {
3294
+ this.output.write(import_sisteransi.cursor.move(0, r - s)), this.output.write(import_sisteransi.erase.lines(1));
3295
+ const o = t2.split(`
3296
+ `);
3297
+ this.output.write(o[r]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - r - 1));
3298
+ return;
3299
+ } else if (e.lines.length > 1) {
3300
+ if (n < s)
3301
+ r = n;
3302
+ else {
3303
+ const h = r - s;
3304
+ h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
3305
+ }
3306
+ this.output.write(import_sisteransi.erase.down());
3307
+ const f = t2.split(`
3308
+ `).slice(r);
3309
+ this.output.write(f.join(`
3310
+ `)), this._prevFrame = t2;
3311
+ return;
3312
+ }
3313
+ }
3314
+ this.output.write(import_sisteransi.erase.down());
3315
+ }
3316
+ this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
3317
+ }
3318
+ }
3319
+ }
3320
+ function p$1(l, e) {
3321
+ if (l === undefined || e.length === 0)
3322
+ return 0;
3323
+ const i = e.findIndex((s) => s.value === l);
3324
+ return i !== -1 ? i : 0;
3325
+ }
3326
+ function g(l, e) {
3327
+ return (e.label ?? String(e.value)).toLowerCase().includes(l.toLowerCase());
3328
+ }
3329
+ function m(l, e) {
3330
+ if (e)
3331
+ return l ? e : e[0];
3332
+ }
3333
+ var T$1 = class T extends V {
3334
+ filteredOptions;
3335
+ multiple;
3336
+ isNavigating = false;
3337
+ selectedValues = [];
3338
+ focusedValue;
3339
+ #e = 0;
3340
+ #s = "";
3341
+ #t;
3342
+ #i;
3343
+ #n;
3344
+ get cursor() {
3345
+ return this.#e;
3346
+ }
3347
+ get userInputWithCursor() {
3348
+ if (!this.userInput)
3349
+ return styleText(["inverse", "hidden"], "_");
3350
+ if (this._cursor >= this.userInput.length)
3351
+ return `${this.userInput}█`;
3352
+ const e = this.userInput.slice(0, this.cursor), t2 = this.userInput.slice(this.cursor, this.cursor + 1), i = this.userInput.slice(this.cursor + 1);
3353
+ return `${e}${styleText("inverse", t2)}${i}`;
3354
+ }
3355
+ get options() {
3356
+ return typeof this.#i == "function" ? this.#i() : this.#i;
3357
+ }
3358
+ constructor(e) {
3359
+ super(e), this.#i = e.options, this.#n = e.placeholder;
3360
+ const t2 = this.options;
3361
+ this.filteredOptions = [...t2], this.multiple = e.multiple === true, this.#t = typeof e.options == "function" ? e.filter : e.filter ?? g;
3362
+ let i;
3363
+ if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0]?.value]), i)
3364
+ for (const s of i) {
3365
+ const n = t2.findIndex((o) => o.value === s);
3366
+ n !== -1 && (this.toggleSelected(s), this.#e = n);
3367
+ }
3368
+ this.focusedValue = this.options[this.#e]?.value, this.on("key", (s, n) => this.#l(s, n)), this.on("userInput", (s) => this.#u(s));
3369
+ }
3370
+ _isActionKey(e, t2) {
3371
+ return e === "\t" || this.multiple && this.isNavigating && t2.name === "space" && e !== undefined && e !== "";
3372
+ }
3373
+ #l(e, t2) {
3374
+ const i = t2.name === "up", s = t2.name === "down", n = t2.name === "return", o = this.userInput === "" || this.userInput === "\t", u = this.#n, a = this.options, f = u !== undefined && u !== "" && a.some((r) => !r.disabled && (this.#t ? this.#t(u, r) : true));
3375
+ if (t2.name === "tab" && o && f) {
3376
+ this.userInput === "\t" && this._clearUserInput(), this._setUserInput(u, true), this.isNavigating = false;
3377
+ return;
3378
+ }
3379
+ i || s ? (this.#e = findCursor(this.#e, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = m(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (t2.name === "tab" || this.isNavigating && t2.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
3380
+ }
3381
+ deselectAll() {
3382
+ this.selectedValues = [];
3383
+ }
3384
+ toggleSelected(e) {
3385
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t2) => t2 !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
3386
+ }
3387
+ #u(e) {
3388
+ if (e !== this.#s) {
3389
+ this.#s = e;
3390
+ const t2 = this.options;
3391
+ e && this.#t ? this.filteredOptions = t2.filter((n) => this.#t?.(e, n)) : this.filteredOptions = [...t2];
3392
+ const i = p$1(this.focusedValue, this.filteredOptions);
3393
+ this.#e = findCursor(i, 0, this.filteredOptions);
3394
+ const s = this.filteredOptions[this.#e];
3395
+ s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
3396
+ }
3397
+ }
3398
+ };
3399
+
3400
+ class r extends V {
3401
+ get cursor() {
3402
+ return this.value ? 0 : 1;
3403
+ }
3404
+ get _value() {
3405
+ return this.cursor === 0;
3406
+ }
3407
+ constructor(t2) {
3408
+ super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
3409
+ this.value = this._value;
3410
+ }), this.on("confirm", (i) => {
3411
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
3412
+ }), this.on("cursor", () => {
3413
+ this.value = !this.value;
3414
+ });
3415
+ }
3416
+ }
3417
+ var _ = {
3418
+ Y: { type: "year", len: 4 },
3419
+ M: { type: "month", len: 2 },
3420
+ D: { type: "day", len: 2 }
3421
+ };
3422
+ function M(r2) {
3423
+ return [...r2].map((t2) => _[t2]);
3424
+ }
3425
+ function P(r2) {
3426
+ const i = new Intl.DateTimeFormat(r2, {
3427
+ year: "numeric",
3428
+ month: "2-digit",
3429
+ day: "2-digit"
3430
+ }).formatToParts(new Date(2000, 0, 15)), s = [];
3431
+ let n = "/";
3432
+ for (const e of i)
3433
+ e.type === "literal" ? n = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({ type: e.type, len: e.type === "year" ? 4 : 2 });
3434
+ return { segments: s, separator: n };
3435
+ }
3436
+ function p(r2) {
3437
+ return Number.parseInt((r2 || "0").replace(/_/g, "0"), 10) || 0;
3438
+ }
3439
+ function f(r2) {
3440
+ return {
3441
+ year: p(r2.year),
3442
+ month: p(r2.month),
3443
+ day: p(r2.day)
3444
+ };
3445
+ }
3446
+ function c(r2, t2) {
3447
+ return new Date(r2 || 2001, t2 || 1, 0).getDate();
3448
+ }
3449
+ function b(r2) {
3450
+ const { year: t2, month: i, day: s } = f(r2);
3451
+ if (!t2 || t2 < 0 || t2 > 9999 || !i || i < 1 || i > 12 || !s || s < 1)
3452
+ return;
3453
+ const n = new Date(Date.UTC(t2, i - 1, s));
3454
+ if (!(n.getUTCFullYear() !== t2 || n.getUTCMonth() !== i - 1 || n.getUTCDate() !== s))
3455
+ return { year: t2, month: i, day: s };
3456
+ }
3457
+ function C(r2) {
3458
+ const t2 = b(r2);
3459
+ return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : undefined;
3460
+ }
3461
+ function T2(r2, t2, i, s) {
3462
+ const n = i ? {
3463
+ year: i.getUTCFullYear(),
3464
+ month: i.getUTCMonth() + 1,
3465
+ day: i.getUTCDate()
3466
+ } : null, e = s ? {
3467
+ year: s.getUTCFullYear(),
3468
+ month: s.getUTCMonth() + 1,
3469
+ day: s.getUTCDate()
3470
+ } : null;
3471
+ return r2 === "year" ? { min: n?.year ?? 1, max: e?.year ?? 9999 } : r2 === "month" ? {
3472
+ min: n && t2.year === n.year ? n.month : 1,
3473
+ max: e && t2.year === e.year ? e.month : 12
3474
+ } : {
3475
+ min: n && t2.year === n.year && t2.month === n.month ? n.day : 1,
3476
+ max: e && t2.year === e.year && t2.month === e.month ? e.day : c(t2.year, t2.month)
3477
+ };
3478
+ }
3479
+
3480
+ class U extends V {
3481
+ #i;
3482
+ #o;
3483
+ #t;
3484
+ #h;
3485
+ #u;
3486
+ #e = { segmentIndex: 0, positionInSegment: 0 };
3487
+ #n = true;
3488
+ #s = null;
3489
+ inlineError = "";
3490
+ get segmentCursor() {
3491
+ return { ...this.#e };
3492
+ }
3493
+ get segmentValues() {
3494
+ return { ...this.#t };
3495
+ }
3496
+ get segments() {
3497
+ return this.#i;
3498
+ }
3499
+ get separator() {
3500
+ return this.#o;
3501
+ }
3502
+ get formattedValue() {
3503
+ return this.#l(this.#t);
3504
+ }
3505
+ #l(t2) {
3506
+ return this.#i.map((i) => t2[i.type]).join(this.#o);
3507
+ }
3508
+ #r() {
3509
+ this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? undefined);
3510
+ }
3511
+ constructor(t2) {
3512
+ const i = t2.format ? { segments: M(t2.format), separator: t2.separator ?? "/" } : P(t2.locale), s = t2.separator ?? i.separator, n = t2.format ? M(t2.format) : i.segments, e = t2.initialValue ?? t2.defaultValue, m2 = e ? {
3513
+ year: String(e.getUTCFullYear()).padStart(4, "0"),
3514
+ month: String(e.getUTCMonth() + 1).padStart(2, "0"),
3515
+ day: String(e.getUTCDate()).padStart(2, "0")
3516
+ } : { year: "____", month: "__", day: "__" }, o = n.map((a) => m2[a.type]).join(s);
3517
+ super({ ...t2, initialUserInput: o }, false), this.#i = n, this.#o = s, this.#t = m2, this.#h = t2.minDate, this.#u = t2.maxDate, this.#r(), this.on("cursor", (a) => this.#f(a)), this.on("key", (a, u) => this.#y(a, u)), this.on("finalize", () => this.#p(t2));
3518
+ }
3519
+ #a() {
3520
+ const t2 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i = this.#i[t2];
3521
+ if (i)
3522
+ return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i.len - 1)), { segment: i, index: t2 };
3523
+ }
3524
+ #m(t2) {
3525
+ this.inlineError = "", this.#s = null;
3526
+ const i = this.#a();
3527
+ i && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i.index + t2)), this.#e.positionInSegment = 0, this.#n = true);
3528
+ }
3529
+ #d(t2) {
3530
+ const i = this.#a();
3531
+ if (!i)
3532
+ return;
3533
+ const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m2 = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T2(s.type, f(this.#t), this.#h, this.#u);
3534
+ let a;
3535
+ e ? a = t2 === 1 ? o.min : o.max : a = Math.max(Math.min(o.max, m2 + t2), o.min), this.#t = {
3536
+ ...this.#t,
3537
+ [s.type]: a.toString().padStart(s.len, "0")
3538
+ }, this.#n = true, this.#s = null, this.#r();
3539
+ }
3540
+ #f(t2) {
3541
+ if (t2)
3542
+ switch (t2) {
3543
+ case "right":
3544
+ return this.#m(1);
3545
+ case "left":
3546
+ return this.#m(-1);
3547
+ case "up":
3548
+ return this.#d(1);
3549
+ case "down":
3550
+ return this.#d(-1);
3551
+ }
3552
+ }
3553
+ #y(t2, i) {
3554
+ if (i?.name === "backspace" || i?.sequence === "" || i?.sequence === "\b" || t2 === "" || t2 === "\b") {
3555
+ this.inlineError = "";
3556
+ const n = this.#a();
3557
+ if (!n)
3558
+ return;
3559
+ if (!this.#t[n.segment.type].replace(/_/g, "")) {
3560
+ this.#m(-1);
3561
+ return;
3562
+ }
3563
+ this.#t[n.segment.type] = "_".repeat(n.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
3564
+ return;
3565
+ }
3566
+ if (i?.name === "tab") {
3567
+ this.inlineError = "";
3568
+ const n = this.#a();
3569
+ if (!n)
3570
+ return;
3571
+ const e = i.shift ? -1 : 1, m2 = n.index + e;
3572
+ m2 >= 0 && m2 < this.#i.length && (this.#e.segmentIndex = m2, this.#e.positionInSegment = 0, this.#n = true);
3573
+ return;
3574
+ }
3575
+ if (t2 && /^[0-9]$/.test(t2)) {
3576
+ const n = this.#a();
3577
+ if (!n)
3578
+ return;
3579
+ const { segment: e } = n, m2 = !this.#t[e.type].replace(/_/g, "");
3580
+ if (this.#n && this.#s !== null && !m2) {
3581
+ const h = this.#s + t2, d = { ...this.#t, [e.type]: h }, g2 = this.#g(d, e);
3582
+ if (g2) {
3583
+ this.inlineError = g2, this.#s = null, this.#n = false;
3584
+ return;
3585
+ }
3586
+ this.inlineError = "", this.#t[e.type] = h, this.#s = null, this.#n = false, this.#r(), n.index < this.#i.length - 1 && (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true);
3587
+ return;
3588
+ }
3589
+ this.#n && !m2 && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
3590
+ const o = this.#t[e.type], a = o.indexOf("_"), u = a >= 0 ? a : Math.min(this.#e.positionInSegment, e.len - 1);
3591
+ if (u < 0 || u >= e.len)
3592
+ return;
3593
+ let l = o.slice(0, u) + t2 + o.slice(u + 1), D = false;
3594
+ if (u === 0 && o === "__" && (e.type === "month" || e.type === "day")) {
3595
+ const h = Number.parseInt(t2, 10);
3596
+ l = `0${t2}`, D = h <= (e.type === "month" ? 1 : 2);
3597
+ }
3598
+ if (e.type === "year" && (l = (o.replace(/_/g, "") + t2).padStart(e.len, "_")), !l.includes("_")) {
3599
+ const h = { ...this.#t, [e.type]: l }, d = this.#g(h, e);
3600
+ if (d) {
3601
+ this.inlineError = d;
3602
+ return;
3603
+ }
3604
+ }
3605
+ this.inlineError = "", this.#t[e.type] = l;
3606
+ const y = l.includes("_") ? undefined : b(this.#t);
3607
+ if (y) {
3608
+ const { year: h, month: d } = y, g2 = c(h, d);
3609
+ this.#t = {
3610
+ year: String(Math.max(0, Math.min(9999, h))).padStart(4, "0"),
3611
+ month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
3612
+ day: String(Math.max(1, Math.min(g2, y.day))).padStart(2, "0")
3613
+ };
3614
+ }
3615
+ this.#r();
3616
+ const S = l.indexOf("_");
3617
+ D ? (this.#n = true, this.#s = t2) : S >= 0 ? this.#e.positionInSegment = S : a >= 0 && n.index < this.#i.length - 1 ? (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u + 1, e.len - 1);
3618
+ }
3619
+ }
3620
+ #g(t2, i) {
3621
+ const { month: s, day: n } = f(t2);
3622
+ if (i.type === "month" && (s < 0 || s > 12))
3623
+ return settings.date.messages.invalidMonth;
3624
+ if (i.type === "day" && (n < 0 || n > 31))
3625
+ return settings.date.messages.invalidDay(31, "any month");
3626
+ }
3627
+ #p(t2) {
3628
+ const { year: i, month: s, day: n } = f(this.#t);
3629
+ if (i && s && n) {
3630
+ const e = c(i, s);
3631
+ this.#t = {
3632
+ ...this.#t,
3633
+ day: String(Math.min(n, e)).padStart(2, "0")
3634
+ };
3635
+ }
3636
+ this.value = C(this.#t) ?? t2.defaultValue ?? undefined;
3637
+ }
3638
+ }
3639
+ var u$2 = class u extends V {
3640
+ options;
3641
+ cursor = 0;
3642
+ #t;
3643
+ getGroupItems(t2) {
3644
+ return this.options.filter((r2) => r2.group === t2);
3645
+ }
3646
+ isGroupSelected(t2) {
3647
+ const r2 = this.getGroupItems(t2), e = this.value;
3648
+ return e === undefined ? false : r2.every((s) => e.includes(s.value));
3649
+ }
3650
+ toggleValue() {
3651
+ const t2 = this.options[this.cursor];
3652
+ if (t2 !== undefined)
3653
+ if (this.value === undefined && (this.value = []), t2.group === true) {
3654
+ const r2 = t2.value, e = this.getGroupItems(r2);
3655
+ this.isGroupSelected(r2) ? this.value = this.value.filter((s) => e.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
3656
+ } else {
3657
+ const r2 = this.value.includes(t2.value);
3658
+ this.value = r2 ? this.value.filter((e) => e !== t2.value) : [...this.value, t2.value];
3659
+ }
3660
+ }
3661
+ constructor(t2) {
3662
+ super(t2, false);
3663
+ const { options: r2 } = t2;
3664
+ this.#t = t2.selectableGroups !== false, this.options = Object.entries(r2).flatMap(([e, s]) => [
3665
+ { value: e, group: true, label: e },
3666
+ ...s.map((i) => ({ ...i, group: e }))
3667
+ ]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e) => {
3668
+ switch (e) {
3669
+ case "left":
3670
+ case "up": {
3671
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
3672
+ const s = this.options[this.cursor]?.group === true;
3673
+ !this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
3674
+ break;
3675
+ }
3676
+ case "down":
3677
+ case "right": {
3678
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
3679
+ const s = this.options[this.cursor]?.group === true;
3680
+ !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
3681
+ break;
3682
+ }
3683
+ case "space":
3684
+ this.toggleValue();
3685
+ break;
3686
+ }
3687
+ });
3688
+ }
3689
+ };
3690
+ var o = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
3691
+
3692
+ class h extends V {
3693
+ #t = false;
3694
+ #s;
3695
+ focused = "editor";
3696
+ get userInputWithCursor() {
3697
+ if (this.state === "submit")
3698
+ return this.userInput;
3699
+ const t2 = this.userInput;
3700
+ if (this.cursor >= t2.length)
3701
+ return `${t2}█`;
3702
+ const s = t2.slice(0, this.cursor), r2 = t2.slice(this.cursor, this.cursor + 1), i = t2.slice(this.cursor + 1);
3703
+ return r2 === `
3704
+ ` ? `${s}█
3705
+ ${i}` : `${s}${styleText("inverse", r2)}${i}`;
3706
+ }
3707
+ get cursor() {
3708
+ return this._cursor;
3709
+ }
3710
+ #r(t2) {
3711
+ if (this.userInput.length === 0) {
3712
+ this._setUserInput(t2);
3713
+ return;
3714
+ }
3715
+ this._setUserInput(this.userInput.slice(0, this.cursor) + t2 + this.userInput.slice(this.cursor));
3716
+ }
3717
+ #i(t2) {
3718
+ const s = this.value ?? "";
3719
+ switch (t2) {
3720
+ case "up":
3721
+ this._cursor = findTextCursor(this._cursor, 0, -1, s);
3722
+ return;
3723
+ case "down":
3724
+ this._cursor = findTextCursor(this._cursor, 0, 1, s);
3725
+ return;
3726
+ case "left":
3727
+ this._cursor = findTextCursor(this._cursor, -1, 0, s);
3728
+ return;
3729
+ case "right":
3730
+ this._cursor = findTextCursor(this._cursor, 1, 0, s);
3731
+ return;
3732
+ }
3733
+ }
3734
+ _shouldSubmit(t2, s) {
3735
+ if (this.#s)
3736
+ return this.focused === "submit" ? true : (this.#r(`
3737
+ `), this._cursor++, false);
3738
+ const r2 = this.#t;
3739
+ return this.#t = true, r2 && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `
3740
+ ` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
3741
+ `), this._cursor++, false);
3742
+ }
3743
+ constructor(t2) {
3744
+ const s = t2.initialUserInput ?? t2.initialValue;
3745
+ super({
3746
+ ...t2,
3747
+ initialUserInput: s
3748
+ }, false), s !== undefined && (this._cursor = s.length), this.#s = t2.showSubmit ?? false, this.on("key", (r2, i) => {
3749
+ if (i?.name && o.has(i.name)) {
3750
+ this.#t = false, this.#i(i.name);
3751
+ return;
3752
+ }
3753
+ if (r2 === "\t" && this.#s) {
3754
+ this.focused = this.focused === "editor" ? "submit" : "editor";
3755
+ return;
3756
+ }
3757
+ if (i?.name !== "return") {
3758
+ if (this.#t = false, i?.name === "backspace" && this.cursor > 0) {
3759
+ this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
3760
+ return;
3761
+ }
3762
+ if (i?.name === "delete" && this.cursor < this.userInput.length) {
3763
+ this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
3764
+ return;
3765
+ }
3766
+ r2 && (this.#s && this.focused === "submit" && (this.focused = "editor"), this.#r(r2 ?? ""), this._cursor++);
3767
+ }
3768
+ }), this.on("userInput", (r2) => {
3769
+ this._setValue(r2);
3770
+ }), this.on("finalize", () => {
3771
+ this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
3772
+ });
3773
+ }
3774
+ }
3775
+
3776
+ class a extends V {
3777
+ options;
3778
+ cursor = 0;
3779
+ get _value() {
3780
+ return this.options[this.cursor]?.value;
3781
+ }
3782
+ get _enabledOptions() {
3783
+ return this.options.filter((e) => e.disabled !== true);
3784
+ }
3785
+ toggleAll() {
3786
+ const e = this._enabledOptions, i = this.value !== undefined && this.value.length === e.length;
3787
+ this.value = i ? [] : e.map((t2) => t2.value);
3788
+ }
3789
+ toggleInvert() {
3790
+ const e = this.value;
3791
+ if (!e)
3792
+ return;
3793
+ const i = this._enabledOptions.filter((t2) => !e.includes(t2.value));
3794
+ this.value = i.map((t2) => t2.value);
3795
+ }
3796
+ toggleValue() {
3797
+ this.value === undefined && (this.value = []);
3798
+ const e = this.value.includes(this._value);
3799
+ this.value = e ? this.value.filter((i) => i !== this._value) : [...this.value, this._value];
3800
+ }
3801
+ constructor(e) {
3802
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
3803
+ const i = Math.max(this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt), 0);
3804
+ this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t2, l) => {
3805
+ l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
3806
+ }), this.on("cursor", (t2) => {
3807
+ switch (t2) {
3808
+ case "left":
3809
+ case "up":
3810
+ this.cursor = findCursor(this.cursor, -1, this.options);
3811
+ break;
3812
+ case "down":
3813
+ case "right":
3814
+ this.cursor = findCursor(this.cursor, 1, this.options);
3815
+ break;
3816
+ case "space":
3817
+ this.toggleValue();
3818
+ break;
3819
+ }
3820
+ });
3821
+ }
3822
+ }
3823
+ var n$1 = class n extends V {
3824
+ options;
3825
+ cursor = 0;
3826
+ get _selectedValue() {
3827
+ return this.options[this.cursor];
3828
+ }
3829
+ changeValue() {
3830
+ const e = this._selectedValue;
3831
+ this.value = e === undefined ? undefined : e.value;
3832
+ }
3833
+ constructor(e) {
3834
+ super(e, false), this.options = e.options;
3835
+ const o2 = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o2 === -1 ? 0 : o2;
3836
+ this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
3837
+ switch (s) {
3838
+ case "left":
3839
+ case "up":
3840
+ this.cursor = findCursor(this.cursor, -1, this.options);
3841
+ break;
3842
+ case "down":
3843
+ case "right":
3844
+ this.cursor = findCursor(this.cursor, 1, this.options);
3845
+ break;
3846
+ }
3847
+ this.changeValue();
3848
+ });
3849
+ }
3850
+ };
3851
+
3852
+ // node_modules/@clack/prompts/dist/index.mjs
3853
+ import { styleText as styleText2, stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
3854
+ import process$1 from "node:process";
3855
+ var import_sisteransi2 = __toESM(require_src(), 1);
3856
+ function isUnicodeSupported() {
3857
+ if (process$1.platform !== "win32") {
3858
+ return process$1.env.TERM !== "linux";
3859
+ }
3860
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
3861
+ }
3862
+ var unicode = isUnicodeSupported();
3863
+ var unicodeOr = (o2, e) => unicode ? o2 : e;
3864
+ var S_STEP_ACTIVE = unicodeOr("◆", "*");
3865
+ var S_STEP_CANCEL = unicodeOr("■", "x");
3866
+ var S_STEP_ERROR = unicodeOr("▲", "x");
3867
+ var S_STEP_SUBMIT = unicodeOr("◇", "o");
3868
+ var S_BAR_START = unicodeOr("┌", "T");
3869
+ var S_BAR = unicodeOr("│", "|");
3870
+ var S_BAR_END = unicodeOr("└", "—");
3871
+ var S_BAR_START_RIGHT = unicodeOr("┐", "T");
3872
+ var S_BAR_END_RIGHT = unicodeOr("┘", "—");
3873
+ var S_RADIO_ACTIVE = unicodeOr("●", ">");
3874
+ var S_RADIO_INACTIVE = unicodeOr("○", " ");
3875
+ var S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]");
3876
+ var S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]");
3877
+ var S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]");
3878
+ var S_PASSWORD_MASK = unicodeOr("▪", "•");
3879
+ var S_BAR_H = unicodeOr("─", "-");
3880
+ var S_CORNER_TOP_RIGHT = unicodeOr("╮", "+");
3881
+ var S_CONNECT_LEFT = unicodeOr("├", "+");
3882
+ var S_CORNER_BOTTOM_RIGHT = unicodeOr("╯", "+");
3883
+ var S_CORNER_BOTTOM_LEFT = unicodeOr("╰", "+");
3884
+ var S_CORNER_TOP_LEFT = unicodeOr("╭", "+");
3885
+ var S_INFO = unicodeOr("●", "•");
3886
+ var S_SUCCESS = unicodeOr("◆", "*");
3887
+ var S_WARN = unicodeOr("▲", "!");
3888
+ var S_ERROR = unicodeOr("■", "x");
3889
+ var symbol = (o2) => {
3890
+ switch (o2) {
3891
+ case "initial":
3892
+ case "active":
3893
+ return styleText2("cyan", S_STEP_ACTIVE);
3894
+ case "cancel":
3895
+ return styleText2("red", S_STEP_CANCEL);
3896
+ case "error":
3897
+ return styleText2("yellow", S_STEP_ERROR);
3898
+ case "submit":
3899
+ return styleText2("green", S_STEP_SUBMIT);
3900
+ }
3901
+ };
3902
+ var symbolBar = (o2) => {
3903
+ switch (o2) {
3904
+ case "initial":
3905
+ case "active":
3906
+ return styleText2("cyan", S_BAR);
3907
+ case "cancel":
3908
+ return styleText2("red", S_BAR);
3909
+ case "error":
3910
+ return styleText2("yellow", S_BAR);
3911
+ case "submit":
3912
+ return styleText2("green", S_BAR);
3913
+ }
3914
+ };
3915
+ function formatInstructionFooter(o2, e) {
3916
+ const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o2.join(" • ")}`];
3917
+ return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
3918
+ }
3919
+ var I = (l, e, w, p2, b2, C2 = false) => {
3920
+ let r2 = e, O = 0;
3921
+ if (C2)
3922
+ for (let i = p2 - 1;i >= w; i--) {
3923
+ const m2 = l[i];
3924
+ if (m2 && (r2 -= m2.length), O++, r2 <= b2)
3925
+ break;
3926
+ }
3927
+ else
3928
+ for (let i = w;i < p2; i++) {
3929
+ const m2 = l[i];
3930
+ if (m2 && (r2 -= m2.length), O++, r2 <= b2)
3931
+ break;
3932
+ }
3933
+ return { lineCount: r2, removals: O };
3934
+ };
3935
+ var limitOptions = ({
3936
+ cursor: l,
3937
+ options: e,
3938
+ style: w,
3939
+ output: p2 = process.stdout,
3940
+ maxItems: b2 = Number.POSITIVE_INFINITY,
3941
+ columnPadding: C2 = 0,
3942
+ rowPadding: r2 = 4
3943
+ }) => {
3944
+ const i = getColumns(p2) - C2, m2 = getRows(p2), M2 = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b2, v), 5);
3945
+ let f2 = 0;
3946
+ l >= a2 - 3 && (f2 = Math.max(Math.min(l - a2 + 3, e.length - a2), 0));
3947
+ let d = a2 < e.length && f2 > 0, c2 = a2 < e.length && f2 + a2 < e.length;
3948
+ const W = Math.min(f2 + a2, e.length), s = [];
3949
+ let g2 = 0;
3950
+ d && g2++, c2 && g2++;
3951
+ const T3 = f2 + (d ? 1 : 0), y = W - (c2 ? 1 : 0);
3952
+ for (let t2 = T3;t2 < y; t2++) {
3953
+ const n3 = e[t2], o2 = n3 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o2, i, {
3954
+ hard: true,
3955
+ trim: false
3956
+ }).split(`
3957
+ `);
3958
+ s.push(h2), g2 += h2.length;
3959
+ }
3960
+ if (g2 > v) {
3961
+ let t2 = 0, n3 = 0, o2 = g2;
3962
+ const h2 = l - T3;
3963
+ let u3 = v;
3964
+ const L = () => I(s, o2, 0, h2, u3), E = () => I(s, o2, h2 + 1, s.length, u3, true);
3965
+ d ? ({ lineCount: o2, removals: t2 } = L(), o2 > u3 && (c2 || (u3 -= 1), { lineCount: o2, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o2, removals: n3 } = E(), o2 > u3 && (u3 -= 1, { lineCount: o2, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
3966
+ }
3967
+ const x = [];
3968
+ d && x.push(M2);
3969
+ for (const t2 of s)
3970
+ for (const n3 of t2)
3971
+ x.push(n3);
3972
+ return c2 && x.push(M2), x;
3973
+ };
3974
+ var confirm = (i) => {
3975
+ const a2 = i.active ?? "Yes", s = i.inactive ?? "No";
3976
+ return new r({
3977
+ active: a2,
3978
+ inactive: s,
3979
+ signal: i.signal,
3980
+ input: i.input,
3981
+ output: i.output,
3982
+ initialValue: i.initialValue ?? true,
3983
+ render() {
3984
+ const e = i.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l = e ? `${styleText2("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(i.output, i.message, l, u3), o2 = `${e ? `${styleText2("gray", S_BAR)}
3985
+ ` : ""}${f2}
3986
+ `, c2 = this.value ? a2 : s;
3987
+ switch (this.state) {
3988
+ case "submit": {
3989
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
3990
+ return `${o2}${r2}${styleText2("dim", c2)}`;
3991
+ }
3992
+ case "cancel": {
3993
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
3994
+ return `${o2}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
3995
+ ${styleText2("gray", S_BAR)}` : ""}`;
3996
+ }
3997
+ default: {
3998
+ const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g2 = e ? styleText2("cyan", S_BAR_END) : "";
3999
+ return `${o2}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i.vertical ? e ? `
4000
+ ${styleText2("cyan", S_BAR)} ` : `
4001
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
4002
+ ${g2}
4003
+ `;
4004
+ }
4005
+ }
4006
+ }
4007
+ }).prompt();
4008
+ };
4009
+ var MULTISELECT_INSTRUCTIONS = [
4010
+ `${styleText2("dim", "↑/↓")} to navigate`,
4011
+ `${styleText2("dim", "Space:")} select`,
4012
+ `${styleText2("dim", "Enter:")} confirm`
4013
+ ];
4014
+ var m2 = (i, u3) => i.split(`
4015
+ `).map((d) => u3(d)).join(`
4016
+ `);
4017
+ var multiselect = (i) => {
4018
+ const u3 = (t2, a2) => {
4019
+ const r2 = t2.label ?? String(t2.value);
4020
+ return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => styleText2(["strikethrough", "gray"], o2))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m2(r2, (o2) => styleText2("dim", o2))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m2(r2, (o2) => styleText2(["strikethrough", "dim"], o2))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m2(r2, (o2) => styleText2("dim", o2))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => styleText2("dim", o2))}`;
4021
+ }, d = i.required ?? true, v = i.showInstructions ?? true;
4022
+ return new a({
4023
+ options: i.options,
4024
+ signal: i.signal,
4025
+ input: i.input,
4026
+ output: i.output,
4027
+ initialValues: i.initialValues,
4028
+ required: d,
4029
+ cursorAt: i.cursorAt,
4030
+ validate(t2) {
4031
+ if (d && (t2 === undefined || t2.length === 0))
4032
+ return `Please select at least one option.
4033
+ ${styleText2("reset", styleText2("dim", `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2("gray", styleText2("bgWhite", styleText2("inverse", " enter ")))} to submit`))}`;
4034
+ },
4035
+ render() {
4036
+ const t2 = i.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(i.output, i.message, t2 ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
4037
+ ` : ""}${a2}
4038
+ `, o2 = this.value ?? [], p2 = (n3, l) => {
4039
+ if (n3.disabled)
4040
+ return u3(n3, "disabled");
4041
+ const s = o2.includes(n3.value);
4042
+ return l && s ? u3(n3, "active-selected") : s ? u3(n3, "selected") : u3(n3, l ? "active" : "inactive");
4043
+ };
4044
+ switch (this.state) {
4045
+ case "submit": {
4046
+ const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(i.output, n3, t2 ? `${styleText2("gray", S_BAR)} ` : "");
4047
+ return `${r2}${l}`;
4048
+ }
4049
+ case "cancel": {
4050
+ const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
4051
+ if (n3.trim() === "")
4052
+ return `${r2}${styleText2("gray", S_BAR)}`;
4053
+ const l = wrapTextWithPrefix(i.output, n3, t2 ? `${styleText2("gray", S_BAR)} ` : "");
4054
+ return `${r2}${l}${t2 ? `
4055
+ ${styleText2("gray", S_BAR)}` : ""}`;
4056
+ }
4057
+ case "error": {
4058
+ const n3 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
4059
+ `).map(($, C2) => C2 === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`).join(`
4060
+ `), s = r2.split(`
4061
+ `).length, h2 = l.split(`
4062
+ `).length + 1;
4063
+ return `${r2}${n3}${limitOptions({
4064
+ output: i.output,
4065
+ options: this.options,
4066
+ cursor: this.cursor,
4067
+ maxItems: i.maxItems,
4068
+ columnPadding: n3.length,
4069
+ rowPadding: s + h2,
4070
+ style: p2
4071
+ }).join(`
4072
+ ${n3}`)}
4073
+ ${l}
4074
+ `;
4075
+ }
4076
+ default: {
4077
+ const n3 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
4078
+ `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
4079
+ `), $ = s.length + 1;
4080
+ return `${r2}${n3}${limitOptions({
4081
+ output: i.output,
4082
+ options: this.options,
4083
+ cursor: this.cursor,
4084
+ maxItems: i.maxItems,
4085
+ columnPadding: n3.length,
4086
+ rowPadding: l + $,
4087
+ style: p2
4088
+ }).join(`
4089
+ ${n3}`)}
4090
+ ${h2}
4091
+ `;
4092
+ }
4093
+ }
4094
+ }
4095
+ }).prompt();
4096
+ };
4097
+ var cancel = (o2 = "", t2) => {
4098
+ const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
4099
+ i.write(`${e}${styleText2("red", o2)}
4100
+
4101
+ `);
4102
+ };
4103
+ var intro = (o2 = "", t2) => {
4104
+ const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
4105
+ i.write(`${e}${o2}
4106
+ `);
4107
+ };
4108
+ var outro = (o2 = "", t2) => {
4109
+ const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
4110
+ ${styleText2("gray", S_BAR_END)} ` : "";
4111
+ i.write(`${e}${o2}
4112
+
4113
+ `);
4114
+ };
4115
+ var W$1 = (o2) => o2;
4116
+ var C2 = (o2, e, s) => {
4117
+ const a2 = {
4118
+ hard: true,
4119
+ trim: false
4120
+ }, i = wrapAnsi(o2, e, a2).split(`
4121
+ `), c2 = i.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g2 = e - (u3 - c2);
4122
+ return wrapAnsi(o2, g2, a2);
4123
+ };
4124
+ var note = (o2 = "", e = "", s) => {
4125
+ const a2 = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g2 = ["", ...C2(o2, getColumns(a2) - 6, c2).split(`
4126
+ `).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(g2.reduce((m3, F) => {
4127
+ const O = dist_default2(F);
4128
+ return O > m3 ? O : m3;
4129
+ }, 0), n3) + 2, h2 = g2.map((m3) => `${styleText2("gray", S_BAR)} ${m3}${" ".repeat(t2 - dist_default2(m3))}${styleText2("gray", S_BAR)}`).join(`
4130
+ `), T3 = i ? `${styleText2("gray", S_BAR)}
4131
+ ` : "", l$1 = i ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
4132
+ a2.write(`${T3}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2("gray", S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT)}
4133
+ ${h2}
4134
+ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
4135
+ `);
4136
+ };
4137
+ var u3 = {
4138
+ light: unicodeOr("─", "-"),
4139
+ heavy: unicodeOr("━", "="),
4140
+ block: unicodeOr("█", "#")
4141
+ };
4142
+ var SELECT_INSTRUCTIONS = [
4143
+ `${styleText2("dim", "↑/↓")} to navigate`,
4144
+ `${styleText2("dim", "Enter:")} confirm`
4145
+ ];
4146
+ var c2 = (t2, o2) => t2.includes(`
4147
+ `) ? t2.split(`
4148
+ `).map((d) => o2(d)).join(`
4149
+ `) : o2(t2);
4150
+ var select = (t2) => {
4151
+ const o2 = (n3, m3) => {
4152
+ if (n3 === undefined)
4153
+ return "";
4154
+ const s = n3.label ?? String(n3.value);
4155
+ switch (m3) {
4156
+ case "disabled":
4157
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i) => styleText2("gray", i))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
4158
+ case "selected":
4159
+ return `${c2(s, (i) => styleText2("dim", i))}`;
4160
+ case "active":
4161
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
4162
+ case "cancelled":
4163
+ return `${c2(s, (i) => styleText2(["strikethrough", "dim"], i))}`;
4164
+ default:
4165
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i) => styleText2("dim", i))}`;
4166
+ }
4167
+ }, d = t2.showInstructions ?? true;
4168
+ return new n$1({
4169
+ options: t2.options,
4170
+ signal: t2.signal,
4171
+ input: t2.input,
4172
+ output: t2.output,
4173
+ initialValue: t2.initialValue,
4174
+ render() {
4175
+ const n3 = t2.withGuide ?? settings.withGuide, m3 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t2.output, t2.message, s, m3), u4 = `${n3 ? `${styleText2("gray", S_BAR)}
4176
+ ` : ""}${i}
4177
+ `;
4178
+ switch (this.state) {
4179
+ case "submit": {
4180
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(t2.output, o2(this.options[this.cursor], "selected"), r2);
4181
+ return `${u4}${a2}`;
4182
+ }
4183
+ case "cancel": {
4184
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(t2.output, o2(this.options[this.cursor], "cancelled"), r2);
4185
+ return `${u4}${a2}${n3 ? `
4186
+ ${styleText2("gray", S_BAR)}` : ""}`;
4187
+ }
4188
+ default: {
4189
+ const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u4.split(`
4190
+ `).length, p2 = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b2 = p2.join(`
4191
+ `), f2 = p2.length + 1;
4192
+ return `${u4}${r2}${limitOptions({
4193
+ output: t2.output,
4194
+ cursor: this.cursor,
4195
+ options: this.options,
4196
+ maxItems: t2.maxItems,
4197
+ columnPadding: r2.length,
4198
+ rowPadding: a2 + f2,
4199
+ style: (g2, x) => o2(g2, g2.disabled ? "disabled" : x ? "active" : "inactive")
4200
+ }).join(`
4201
+ ${r2}`)}
4202
+ ${b2}
4203
+ `;
4204
+ }
4205
+ }
4206
+ }
4207
+ }).prompt();
4208
+ };
4209
+ var i = `${styleText2("gray", S_BAR)} `;
4210
+
4211
+ // src/wiring.ts
4212
+ var INIT_TERMINALS = ["ghostty", "kitty", "alacritty"];
4213
+ var BEGIN = "# ttheme begin";
4214
+ var END = "# ttheme end";
4215
+ var BLOCK = /# ttheme begin\n[\s\S]*?# ttheme end\n?/;
4216
+ function upsertBlock(content, body) {
4217
+ const block3 = `${BEGIN}
4218
+ ${body}
4219
+ ${END}
4220
+ `;
4221
+ if (BLOCK.test(content)) {
4222
+ return content.replace(BLOCK, block3);
4223
+ }
4224
+ if (content === "") {
4225
+ return block3;
4226
+ }
4227
+ return `${content.replace(/\n*$/, `
4228
+ `)}
4229
+ ${block3}`;
4230
+ }
4231
+ function detectTerminal(env) {
4232
+ if (env.GHOSTTY_RESOURCES_DIR || env.TERM_PROGRAM === "ghostty") {
4233
+ return "ghostty";
4234
+ }
4235
+ if (env.KITTY_WINDOW_ID) {
4236
+ return "kitty";
4237
+ }
4238
+ if (env.WEZTERM_PANE) {
4239
+ return "wezterm";
4240
+ }
4241
+ if (env.ALACRITTY_WINDOW_ID) {
4242
+ return "alacritty";
4243
+ }
4244
+ if (env.ITERM_SESSION_ID || env.TERM_PROGRAM === "iTerm.app") {
4245
+ return "iterm2";
4246
+ }
4247
+ if (env.TERM?.startsWith("foot")) {
4248
+ return "foot";
4249
+ }
4250
+ return "unknown";
4251
+ }
4252
+ function ghosttyBlock(tthemeDir, palette, tabPalette) {
4253
+ const lines = tabPalette === "seq" ? [`command = ${tthemeDir}/launch-tab.zsh`, "shell-integration = zsh"] : [];
4254
+ lines.push(`theme = ${palette}`, `config-file = ${tthemeDir}/ttheme.conf`);
4255
+ return lines.join(`
4256
+ `);
4257
+ }
4258
+ function zshrcBlock(tthemeDir, opts) {
4259
+ const lines = [];
4260
+ if (opts.tabPalette === "off") {
4261
+ lines.push("export TTHEME_TAB_PALETTE=off");
4262
+ }
4263
+ if (!opts.announce) {
4264
+ lines.push("export TTHEME_ANNOUNCE=0");
4265
+ }
4266
+ lines.push(`source ${tthemeDir}/ttheme.zsh`);
4267
+ return lines.join(`
4268
+ `);
4269
+ }
4270
+ function kittyBlock(palette) {
4271
+ return `include themes/${palette}.conf`;
4272
+ }
4273
+ function alacrittyBlock(themePath) {
4274
+ return `[general]
4275
+ import = ["${themePath}"]`;
4276
+ }
4277
+ function weztermSnippet(palette) {
4278
+ return `config.color_scheme = "${palette}"`;
4279
+ }
4280
+
4281
+ // src/init.ts
4282
+ function listPalettes(root2) {
4283
+ return readdirSync2(join3(root2, "dist", "ghostty", "themes")).sort();
4284
+ }
4285
+ function copyDir(copies, from, to) {
4286
+ for (const f2 of readdirSync2(from)) {
4287
+ copies.push({ from: join3(from, f2), to: join3(to, f2) });
4288
+ }
4289
+ }
4290
+ function planInit(opts, paths) {
4291
+ const dist = join3(paths.root, "dist");
4292
+ const home = join3(paths.configHome, "ttheme");
4293
+ const copies = [
4294
+ { from: join3(paths.root, "shell", "ttheme.zsh"), to: join3(home, "ttheme.zsh") },
4295
+ { from: join3(paths.root, "shell", "launch-tab.zsh"), to: join3(home, "launch-tab.zsh"), executable: true },
4296
+ { from: join3(dist, "shell", "palettes.zsh"), to: join3(home, "palettes.zsh") },
4297
+ { from: join3(dist, "ghostty", "ttheme.conf"), to: join3(home, "ttheme.conf") }
4298
+ ];
4299
+ copyDir(copies, join3(paths.root, "shell", "adapters"), join3(home, "adapters"));
4300
+ const edits = [{ file: join3(paths.zdotdir, ".zshrc"), block: zshrcBlock(home, opts) }];
4301
+ const notes = [];
4302
+ if (opts.terminals.includes("ghostty")) {
4303
+ copyDir(copies, join3(dist, "ghostty", "themes"), join3(paths.configHome, "ghostty", "themes"));
4304
+ copyDir(copies, join3(paths.root, "ghostty", "shaders"), join3(paths.configHome, "ghostty", "shaders"));
4305
+ edits.push({
4306
+ file: join3(paths.configHome, "ghostty", "config"),
4307
+ block: ghosttyBlock(home, opts.palette, opts.tabPalette)
4308
+ });
4309
+ }
4310
+ if (opts.terminals.includes("kitty")) {
4311
+ copyDir(copies, join3(dist, "kitty", "themes"), join3(paths.configHome, "kitty", "themes"));
4312
+ edits.push({ file: join3(paths.configHome, "kitty", "kitty.conf"), block: kittyBlock(opts.palette) });
4313
+ }
4314
+ if (opts.terminals.includes("alacritty")) {
4315
+ copyDir(copies, join3(dist, "alacritty", "themes"), join3(paths.configHome, "alacritty", "themes"));
4316
+ const config = join3(paths.configHome, "alacritty", "alacritty.toml");
4317
+ const block3 = alacrittyBlock(join3(paths.configHome, "alacritty", "themes", `${opts.palette}.toml`));
4318
+ if (!existsSync(config) || readFileSync2(config, "utf8").includes("# ttheme begin")) {
4319
+ edits.push({ file: config, block: block3 });
4320
+ } else {
4321
+ notes.push(`alacritty.toml already exists — add this to it yourself:
4322
+ ${block3}`);
4323
+ }
4324
+ }
4325
+ notes.push(`wezterm: copy colors/ from the release archive, then ${weztermSnippet(opts.palette)}`);
4326
+ notes.push("iterm2: import the .itermcolors files from the release archive");
4327
+ return { copies, edits, notes };
4328
+ }
4329
+ function applyInit(plan, link) {
4330
+ for (const c3 of plan.copies) {
4331
+ mkdirSync(dirname(c3.to), { recursive: true });
4332
+ rmSync2(c3.to, { force: true });
4333
+ if (link) {
4334
+ symlinkSync(c3.from, c3.to);
4335
+ } else {
4336
+ copyFileSync(c3.from, c3.to);
4337
+ if (c3.executable) {
4338
+ chmodSync(c3.to, 493);
4339
+ }
4340
+ }
4341
+ }
4342
+ for (const e of plan.edits) {
4343
+ mkdirSync(dirname(e.file), { recursive: true });
4344
+ const current = existsSync(e.file) ? readFileSync2(e.file, "utf8") : "";
4345
+ writeFileSync(e.file, upsertBlock(current, e.block));
4346
+ }
4347
+ }
4348
+ function accepted(value) {
4349
+ if (isCancel(value)) {
4350
+ cancel("nothing changed");
4351
+ process.exit(1);
4352
+ }
4353
+ return value;
4354
+ }
4355
+ async function ask(root2, detected, preselected, link) {
4356
+ intro("ttheme init");
4357
+ const terminals = accepted(await multiselect({
4358
+ message: "wire which terminals?",
4359
+ options: INIT_TERMINALS.map((t2) => ({ value: t2, hint: t2 === detected ? "detected" : undefined })),
4360
+ initialValues: preselected,
4361
+ required: true
4362
+ }));
4363
+ const palette = accepted(await select({
4364
+ message: "startup palette",
4365
+ options: listPalettes(root2).map((v) => ({ value: v })),
4366
+ initialValue: "neutral",
4367
+ maxItems: 12
4368
+ }));
4369
+ const tabPalette = accepted(await select({
4370
+ message: "new tabs",
4371
+ options: [
4372
+ { value: "seq", label: "rotate through the palettes", hint: "default" },
4373
+ { value: "off", label: "inherit the window colors" }
4374
+ ],
4375
+ initialValue: "seq"
4376
+ }));
4377
+ const announce = accepted(await confirm({ message: 'show the palette name under "Last login:"?', initialValue: true }));
4378
+ return { terminals, palette, tabPalette, announce, link };
4379
+ }
4380
+ function report(plan, opts, interactive) {
4381
+ const missing = [
4382
+ ...plan.copies.filter((c3) => !existsSync(c3.to)).map((c3) => c3.to),
4383
+ ...plan.edits.filter((e) => !readFileSync2(e.file, "utf8").includes("# ttheme begin")).map((e) => e.file)
4384
+ ];
4385
+ if (missing.length > 0) {
4386
+ throw new Error(`init left gaps:
4387
+ ${missing.join(`
4388
+ `)}`);
4389
+ }
4390
+ const lines = [`placed ${plan.copies.length} files`, ...plan.edits.map((e) => `wired ${e.file}`)];
4391
+ if (opts.terminals.includes("ghostty")) {
4392
+ lines.push("restart ghostty to pick up its config");
4393
+ }
4394
+ if (opts.terminals.includes("kitty")) {
4395
+ lines.push("open a new kitty window to pick up its config");
4396
+ }
4397
+ lines.push(...plan.notes);
4398
+ if (interactive) {
4399
+ note(lines.join(`
4400
+ `), "done");
4401
+ outro("open a new tab and run `ttheme`");
4402
+ } else {
4403
+ console.log(lines.join(`
4404
+ `));
4405
+ console.log("open a new tab and run `ttheme`");
4406
+ }
4407
+ }
4408
+ async function runInit(flags = {}) {
4409
+ const root2 = join3(import.meta.dirname, "..");
4410
+ const link = flags.link === true;
4411
+ if (link && !existsSync(join3(root2, "src"))) {
4412
+ throw new Error("--link needs a repo checkout");
4413
+ }
4414
+ if (!existsSync(join3(root2, "dist"))) {
4415
+ if (typeof Bun === "undefined") {
4416
+ throw new Error("this package is missing dist/ — reinstall @kecan0406/ttheme");
4417
+ }
4418
+ await build();
4419
+ }
4420
+ const home = homedir();
4421
+ const configHome = process.env.XDG_CONFIG_HOME ?? join3(home, ".config");
4422
+ const zdotdir = process.env.ZDOTDIR ?? home;
4423
+ const paths = { root: root2, home, configHome, zdotdir };
4424
+ const detected = detectTerminal(process.env);
4425
+ const preselected = INIT_TERMINALS.filter((t2) => t2 === detected || existsSync(join3(configHome, t2)));
4426
+ const interactive = !flags.yes && process.stdin.isTTY === true && process.stdout.isTTY === true;
4427
+ let opts;
4428
+ if (interactive) {
4429
+ opts = await ask(root2, detected, preselected, link);
4430
+ } else {
4431
+ if (preselected.length === 0) {
4432
+ throw new Error("no supported terminal detected — run this inside ghostty, kitty or alacritty");
4433
+ }
4434
+ opts = { terminals: preselected, palette: "neutral", tabPalette: "seq", announce: true, link };
4435
+ }
4436
+ const plan = planInit(opts, paths);
4437
+ if (interactive) {
4438
+ note([`copy ${plan.copies.length} files under ${configHome}`, ...plan.edits.map((e) => `edit ${e.file}`)].join(`
4439
+ `), `wiring ${opts.terminals.join(", ")}`);
4440
+ const go = accepted(await confirm({ message: "apply these changes?" }));
4441
+ if (!go) {
4442
+ cancel("nothing changed");
4443
+ process.exit(1);
4444
+ }
4445
+ }
4446
+ applyInit(plan, opts.link);
4447
+ report(plan, opts, interactive);
4448
+ }
4449
+
4450
+ // src/cli.ts
4451
+ function createProgram() {
4452
+ const program2 = new Command;
4453
+ program2.name("ttheme").description(package_default.description).version(package_default.version).showHelpAfterError().exitOverride();
4454
+ program2.command("build").description("emit dist/ for every terminal, plus the zsh palette table").addOption(new Option("--only <terminal...>", "rebuild just these terminals").choices(TERMINALS)).action((opts) => build(opts));
4455
+ program2.command("init").description("install the palettes and wire your terminal configs").option("--yes", "accept every default without prompting").option("--link", "symlink from this checkout instead of copying").action((opts) => runInit(opts));
4456
+ return program2;
4457
+ }
4458
+ async function runCli(argv) {
4459
+ try {
4460
+ await createProgram().parseAsync(argv);
4461
+ return 0;
4462
+ } catch (error) {
4463
+ if (error instanceof CommanderError) {
4464
+ return error.exitCode;
4465
+ }
4466
+ console.error(`
4467
+ ${error instanceof Error ? error.message : String(error)}`);
4468
+ return 1;
4469
+ }
4470
+ }
4471
+
4472
+ // src/bin.ts
4473
+ process.exitCode = await runCli(process.argv);