mepcli 2.0.0-beta.2 → 2.0.0-beta.4

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 (358) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +20 -0
  3. package/dist/ansi.d.ts +36 -0
  4. package/dist/ansi.js +1 -0
  5. package/dist/base.d.ts +61 -0
  6. package/dist/base.js +1 -0
  7. package/dist/{src/core.js → core.d.ts} +181 -345
  8. package/dist/core.js +1 -0
  9. package/dist/data/countries.d.ts +2 -0
  10. package/dist/data/countries.js +1 -0
  11. package/dist/data/licenses.d.ts +2 -0
  12. package/dist/data/licenses.js +1 -0
  13. package/dist/highlight.d.ts +7 -0
  14. package/dist/highlight.js +1 -0
  15. package/dist/index.d.ts +52 -0
  16. package/dist/index.js +1 -0
  17. package/dist/input.d.ts +14 -0
  18. package/dist/input.js +1 -0
  19. package/dist/pipeline.d.ts +90 -0
  20. package/dist/pipeline.js +1 -0
  21. package/dist/prompts/autocomplete.d.ts +22 -0
  22. package/dist/prompts/autocomplete.js +1 -0
  23. package/dist/prompts/box.d.ts +21 -0
  24. package/dist/prompts/box.js +4 -0
  25. package/dist/prompts/breadcrumb-search.d.ts +14 -0
  26. package/dist/prompts/breadcrumb-search.js +2 -0
  27. package/dist/prompts/breadcrumb.d.ts +32 -0
  28. package/dist/prompts/breadcrumb.js +3 -0
  29. package/dist/prompts/byte.d.ts +13 -0
  30. package/dist/prompts/byte.js +5 -0
  31. package/dist/prompts/calculator.d.ts +17 -0
  32. package/dist/prompts/calculator.js +3 -0
  33. package/dist/prompts/calendar.d.ts +33 -0
  34. package/dist/prompts/calendar.js +3 -0
  35. package/dist/prompts/checkbox.d.ts +13 -0
  36. package/dist/prompts/checkbox.js +2 -0
  37. package/dist/prompts/code.d.ts +19 -0
  38. package/dist/prompts/code.js +4 -0
  39. package/dist/prompts/color.d.ts +14 -0
  40. package/dist/prompts/color.js +10 -0
  41. package/dist/prompts/confirm.d.ts +8 -0
  42. package/dist/prompts/confirm.js +1 -0
  43. package/dist/prompts/connection-string.d.ts +18 -0
  44. package/dist/prompts/connection-string.js +1 -0
  45. package/dist/prompts/cron.d.ts +13 -0
  46. package/dist/prompts/cron.js +4 -0
  47. package/dist/prompts/curl-utils.d.ts +25 -0
  48. package/dist/prompts/curl-utils.js +1 -0
  49. package/dist/prompts/curl.d.ts +41 -0
  50. package/dist/prompts/curl.js +12 -0
  51. package/dist/prompts/data-inspector.d.ts +22 -0
  52. package/dist/prompts/data-inspector.js +5 -0
  53. package/dist/prompts/date.d.ts +12 -0
  54. package/dist/prompts/date.js +2 -0
  55. package/dist/prompts/dependency.d.ts +16 -0
  56. package/dist/prompts/dependency.js +3 -0
  57. package/dist/prompts/dial.d.ts +10 -0
  58. package/dist/prompts/dial.js +3 -0
  59. package/dist/prompts/diff.d.ts +10 -0
  60. package/dist/prompts/diff.js +10 -0
  61. package/dist/prompts/draw.d.ts +20 -0
  62. package/dist/prompts/draw.js +6 -0
  63. package/dist/prompts/editor.d.ts +14 -0
  64. package/dist/prompts/editor.js +2 -0
  65. package/dist/prompts/emoji.d.ts +18 -0
  66. package/dist/prompts/emoji.js +5 -0
  67. package/dist/prompts/exec.d.ts +17 -0
  68. package/dist/prompts/exec.js +1 -0
  69. package/dist/prompts/file.d.ts +21 -0
  70. package/dist/prompts/file.js +2 -0
  71. package/dist/prompts/form.d.ts +18 -0
  72. package/dist/prompts/form.js +1 -0
  73. package/dist/prompts/fuzzy-multi-column.d.ts +12 -0
  74. package/dist/prompts/fuzzy-multi-column.js +2 -0
  75. package/dist/prompts/fuzzy.d.ts +12 -0
  76. package/dist/prompts/fuzzy.js +2 -0
  77. package/dist/prompts/gauge.d.ts +21 -0
  78. package/dist/prompts/gauge.js +4 -0
  79. package/dist/prompts/grid.d.ts +14 -0
  80. package/dist/prompts/grid.js +2 -0
  81. package/dist/prompts/heatmap.d.ts +13 -0
  82. package/dist/prompts/heatmap.js +2 -0
  83. package/dist/prompts/ip.d.ts +11 -0
  84. package/dist/prompts/ip.js +3 -0
  85. package/dist/prompts/kanban.d.ts +17 -0
  86. package/dist/prompts/kanban.js +4 -0
  87. package/dist/prompts/keypress.d.ts +7 -0
  88. package/dist/prompts/keypress.js +1 -0
  89. package/dist/prompts/license.d.ts +9 -0
  90. package/dist/prompts/license.js +13 -0
  91. package/dist/prompts/list.d.ts +9 -0
  92. package/dist/prompts/list.js +1 -0
  93. package/dist/prompts/map.d.ts +17 -0
  94. package/dist/prompts/map.js +5 -0
  95. package/dist/prompts/match.d.ts +19 -0
  96. package/dist/prompts/match.js +7 -0
  97. package/dist/prompts/miller.d.ts +15 -0
  98. package/dist/prompts/miller.js +2 -0
  99. package/dist/prompts/multi-column-select.d.ts +10 -0
  100. package/dist/prompts/multi-column-select.js +2 -0
  101. package/dist/prompts/multi-range.d.ts +9 -0
  102. package/dist/prompts/multi-range.js +3 -0
  103. package/dist/prompts/multi-select.d.ts +15 -0
  104. package/dist/prompts/multi-select.js +4 -0
  105. package/dist/prompts/number.d.ts +11 -0
  106. package/dist/prompts/number.js +2 -0
  107. package/dist/prompts/otp.d.ts +10 -0
  108. package/dist/prompts/otp.js +2 -0
  109. package/dist/prompts/pattern.d.ts +22 -0
  110. package/dist/prompts/pattern.js +4 -0
  111. package/dist/prompts/phone.d.ts +41 -0
  112. package/dist/prompts/phone.js +3 -0
  113. package/dist/prompts/quiz-select.d.ts +10 -0
  114. package/dist/prompts/quiz-select.js +7 -0
  115. package/dist/prompts/quiz-text.d.ts +11 -0
  116. package/dist/prompts/quiz-text.js +8 -0
  117. package/dist/prompts/range.d.ts +9 -0
  118. package/dist/prompts/range.js +1 -0
  119. package/dist/prompts/rating.d.ts +8 -0
  120. package/dist/prompts/rating.js +1 -0
  121. package/dist/prompts/regex.d.ts +13 -0
  122. package/dist/prompts/regex.js +5 -0
  123. package/dist/prompts/region.d.ts +11 -0
  124. package/dist/prompts/region.js +5 -0
  125. package/dist/prompts/schedule.d.ts +20 -0
  126. package/dist/prompts/schedule.js +5 -0
  127. package/dist/prompts/scroll.d.ts +13 -0
  128. package/dist/prompts/scroll.js +1 -0
  129. package/dist/prompts/seat.d.ts +17 -0
  130. package/dist/prompts/seat.js +5 -0
  131. package/dist/prompts/select-range.d.ts +8 -0
  132. package/dist/prompts/select-range.js +3 -0
  133. package/dist/prompts/select.d.ts +15 -0
  134. package/dist/prompts/select.js +2 -0
  135. package/dist/prompts/semver.d.ts +6 -0
  136. package/dist/prompts/semver.js +1 -0
  137. package/dist/prompts/shortcut.d.ts +9 -0
  138. package/dist/prompts/shortcut.js +1 -0
  139. package/dist/prompts/slider.d.ts +8 -0
  140. package/dist/prompts/slider.js +1 -0
  141. package/dist/prompts/slot.d.ts +16 -0
  142. package/dist/prompts/slot.js +8 -0
  143. package/dist/prompts/snippet.d.ts +19 -0
  144. package/dist/prompts/snippet.js +4 -0
  145. package/dist/prompts/sort-grid.d.ts +16 -0
  146. package/dist/prompts/sort-grid.js +2 -0
  147. package/dist/prompts/sort.d.ts +14 -0
  148. package/dist/prompts/sort.js +2 -0
  149. package/dist/prompts/spam.d.ts +17 -0
  150. package/dist/prompts/spam.js +2 -0
  151. package/dist/prompts/spreadsheet.d.ts +21 -0
  152. package/dist/prompts/spreadsheet.js +7 -0
  153. package/dist/prompts/table.d.ts +14 -0
  154. package/dist/prompts/table.js +3 -0
  155. package/dist/prompts/text.d.ts +17 -0
  156. package/dist/prompts/text.js +2 -0
  157. package/dist/prompts/time.d.ts +12 -0
  158. package/dist/prompts/time.js +2 -0
  159. package/dist/prompts/toggle.d.ts +8 -0
  160. package/dist/prompts/toggle.js +1 -0
  161. package/dist/prompts/transfer.d.ts +18 -0
  162. package/dist/prompts/transfer.js +5 -0
  163. package/dist/prompts/tree-select.d.ts +31 -0
  164. package/dist/prompts/tree-select.js +3 -0
  165. package/dist/prompts/tree.d.ts +20 -0
  166. package/dist/prompts/tree.js +3 -0
  167. package/dist/prompts/wait.d.ts +18 -0
  168. package/dist/prompts/wait.js +1 -0
  169. package/dist/spinner.d.ts +33 -0
  170. package/dist/spinner.js +3 -0
  171. package/dist/symbols.d.ts +33 -0
  172. package/dist/symbols.js +1 -0
  173. package/dist/tasks.d.ts +57 -0
  174. package/dist/tasks.js +1 -0
  175. package/dist/theme.d.ts +2 -0
  176. package/dist/theme.js +1 -0
  177. package/dist/types.d.ts +519 -0
  178. package/dist/types.js +1 -0
  179. package/dist/utils.d.ts +82 -0
  180. package/dist/utils.js +1 -0
  181. package/package.json +10 -10
  182. package/dist/src/ansi.js +0 -50
  183. package/dist/src/ansi.js.map +0 -1
  184. package/dist/src/base.js +0 -258
  185. package/dist/src/base.js.map +0 -1
  186. package/dist/src/core.js.map +0 -1
  187. package/dist/src/data/countries.js +0 -569
  188. package/dist/src/data/countries.js.map +0 -1
  189. package/dist/src/data/licenses.js +0 -480
  190. package/dist/src/data/licenses.js.map +0 -1
  191. package/dist/src/highlight.js +0 -185
  192. package/dist/src/highlight.js.map +0 -1
  193. package/dist/src/index.js +0 -66
  194. package/dist/src/index.js.map +0 -1
  195. package/dist/src/input.js +0 -158
  196. package/dist/src/input.js.map +0 -1
  197. package/dist/src/pipeline.js +0 -273
  198. package/dist/src/pipeline.js.map +0 -1
  199. package/dist/src/prompts/autocomplete.js +0 -171
  200. package/dist/src/prompts/autocomplete.js.map +0 -1
  201. package/dist/src/prompts/box.js +0 -225
  202. package/dist/src/prompts/box.js.map +0 -1
  203. package/dist/src/prompts/breadcrumb-search.js +0 -260
  204. package/dist/src/prompts/breadcrumb-search.js.map +0 -1
  205. package/dist/src/prompts/breadcrumb.js +0 -307
  206. package/dist/src/prompts/breadcrumb.js.map +0 -1
  207. package/dist/src/prompts/byte.js +0 -176
  208. package/dist/src/prompts/byte.js.map +0 -1
  209. package/dist/src/prompts/calculator.js +0 -243
  210. package/dist/src/prompts/calculator.js.map +0 -1
  211. package/dist/src/prompts/calendar.js +0 -430
  212. package/dist/src/prompts/calendar.js.map +0 -1
  213. package/dist/src/prompts/checkbox.js +0 -159
  214. package/dist/src/prompts/checkbox.js.map +0 -1
  215. package/dist/src/prompts/code.js +0 -271
  216. package/dist/src/prompts/code.js.map +0 -1
  217. package/dist/src/prompts/color.js +0 -165
  218. package/dist/src/prompts/color.js.map +0 -1
  219. package/dist/src/prompts/confirm.js +0 -55
  220. package/dist/src/prompts/confirm.js.map +0 -1
  221. package/dist/src/prompts/connection-string.js +0 -120
  222. package/dist/src/prompts/connection-string.js.map +0 -1
  223. package/dist/src/prompts/cron.js +0 -207
  224. package/dist/src/prompts/cron.js.map +0 -1
  225. package/dist/src/prompts/curl-utils.js +0 -71
  226. package/dist/src/prompts/curl-utils.js.map +0 -1
  227. package/dist/src/prompts/curl.js +0 -431
  228. package/dist/src/prompts/curl.js.map +0 -1
  229. package/dist/src/prompts/data-inspector.js +0 -261
  230. package/dist/src/prompts/data-inspector.js.map +0 -1
  231. package/dist/src/prompts/date.js +0 -185
  232. package/dist/src/prompts/date.js.map +0 -1
  233. package/dist/src/prompts/dependency.js +0 -283
  234. package/dist/src/prompts/dependency.js.map +0 -1
  235. package/dist/src/prompts/dial.js +0 -124
  236. package/dist/src/prompts/dial.js.map +0 -1
  237. package/dist/src/prompts/diff.js +0 -118
  238. package/dist/src/prompts/diff.js.map +0 -1
  239. package/dist/src/prompts/draw.js +0 -191
  240. package/dist/src/prompts/draw.js.map +0 -1
  241. package/dist/src/prompts/editor.js +0 -234
  242. package/dist/src/prompts/editor.js.map +0 -1
  243. package/dist/src/prompts/emoji.js +0 -226
  244. package/dist/src/prompts/emoji.js.map +0 -1
  245. package/dist/src/prompts/exec.js +0 -151
  246. package/dist/src/prompts/exec.js.map +0 -1
  247. package/dist/src/prompts/file.js +0 -217
  248. package/dist/src/prompts/file.js.map +0 -1
  249. package/dist/src/prompts/form.js +0 -241
  250. package/dist/src/prompts/form.js.map +0 -1
  251. package/dist/src/prompts/fuzzy-multi-column.js +0 -161
  252. package/dist/src/prompts/fuzzy-multi-column.js.map +0 -1
  253. package/dist/src/prompts/fuzzy.js +0 -147
  254. package/dist/src/prompts/fuzzy.js.map +0 -1
  255. package/dist/src/prompts/gauge.js +0 -137
  256. package/dist/src/prompts/gauge.js.map +0 -1
  257. package/dist/src/prompts/grid.js +0 -191
  258. package/dist/src/prompts/grid.js.map +0 -1
  259. package/dist/src/prompts/heatmap.js +0 -147
  260. package/dist/src/prompts/heatmap.js.map +0 -1
  261. package/dist/src/prompts/ip.js +0 -138
  262. package/dist/src/prompts/ip.js.map +0 -1
  263. package/dist/src/prompts/kanban.js +0 -233
  264. package/dist/src/prompts/kanban.js.map +0 -1
  265. package/dist/src/prompts/keypress.js +0 -54
  266. package/dist/src/prompts/keypress.js.map +0 -1
  267. package/dist/src/prompts/license.js +0 -144
  268. package/dist/src/prompts/license.js.map +0 -1
  269. package/dist/src/prompts/list.js +0 -124
  270. package/dist/src/prompts/list.js.map +0 -1
  271. package/dist/src/prompts/map.js +0 -262
  272. package/dist/src/prompts/map.js.map +0 -1
  273. package/dist/src/prompts/match.js +0 -271
  274. package/dist/src/prompts/match.js.map +0 -1
  275. package/dist/src/prompts/miller.js +0 -228
  276. package/dist/src/prompts/miller.js.map +0 -1
  277. package/dist/src/prompts/multi-column-select.js +0 -176
  278. package/dist/src/prompts/multi-column-select.js.map +0 -1
  279. package/dist/src/prompts/multi-range.js +0 -189
  280. package/dist/src/prompts/multi-range.js.map +0 -1
  281. package/dist/src/prompts/multi-select.js +0 -183
  282. package/dist/src/prompts/multi-select.js.map +0 -1
  283. package/dist/src/prompts/number.js +0 -166
  284. package/dist/src/prompts/number.js.map +0 -1
  285. package/dist/src/prompts/otp.js +0 -107
  286. package/dist/src/prompts/otp.js.map +0 -1
  287. package/dist/src/prompts/pattern.js +0 -252
  288. package/dist/src/prompts/pattern.js.map +0 -1
  289. package/dist/src/prompts/phone.js +0 -398
  290. package/dist/src/prompts/phone.js.map +0 -1
  291. package/dist/src/prompts/quiz-select.js +0 -114
  292. package/dist/src/prompts/quiz-select.js.map +0 -1
  293. package/dist/src/prompts/quiz-text.js +0 -98
  294. package/dist/src/prompts/quiz-text.js.map +0 -1
  295. package/dist/src/prompts/range.js +0 -164
  296. package/dist/src/prompts/range.js.map +0 -1
  297. package/dist/src/prompts/rating.js +0 -83
  298. package/dist/src/prompts/rating.js.map +0 -1
  299. package/dist/src/prompts/regex.js +0 -145
  300. package/dist/src/prompts/regex.js.map +0 -1
  301. package/dist/src/prompts/region.js +0 -170
  302. package/dist/src/prompts/region.js.map +0 -1
  303. package/dist/src/prompts/schedule.js +0 -270
  304. package/dist/src/prompts/schedule.js.map +0 -1
  305. package/dist/src/prompts/scroll.js +0 -155
  306. package/dist/src/prompts/scroll.js.map +0 -1
  307. package/dist/src/prompts/seat.js +0 -164
  308. package/dist/src/prompts/seat.js.map +0 -1
  309. package/dist/src/prompts/select-range.js +0 -148
  310. package/dist/src/prompts/select-range.js.map +0 -1
  311. package/dist/src/prompts/select.js +0 -163
  312. package/dist/src/prompts/select.js.map +0 -1
  313. package/dist/src/prompts/semver.js +0 -43
  314. package/dist/src/prompts/semver.js.map +0 -1
  315. package/dist/src/prompts/shortcut.js +0 -133
  316. package/dist/src/prompts/shortcut.js.map +0 -1
  317. package/dist/src/prompts/slider.js +0 -69
  318. package/dist/src/prompts/slider.js.map +0 -1
  319. package/dist/src/prompts/slot.js +0 -117
  320. package/dist/src/prompts/slot.js.map +0 -1
  321. package/dist/src/prompts/snippet.js +0 -228
  322. package/dist/src/prompts/snippet.js.map +0 -1
  323. package/dist/src/prompts/sort-grid.js +0 -151
  324. package/dist/src/prompts/sort-grid.js.map +0 -1
  325. package/dist/src/prompts/sort.js +0 -166
  326. package/dist/src/prompts/sort.js.map +0 -1
  327. package/dist/src/prompts/spam.js +0 -80
  328. package/dist/src/prompts/spam.js.map +0 -1
  329. package/dist/src/prompts/spreadsheet.js +0 -240
  330. package/dist/src/prompts/spreadsheet.js.map +0 -1
  331. package/dist/src/prompts/table.js +0 -120
  332. package/dist/src/prompts/table.js.map +0 -1
  333. package/dist/src/prompts/text.js +0 -317
  334. package/dist/src/prompts/text.js.map +0 -1
  335. package/dist/src/prompts/time.js +0 -211
  336. package/dist/src/prompts/time.js.map +0 -1
  337. package/dist/src/prompts/toggle.js +0 -53
  338. package/dist/src/prompts/toggle.js.map +0 -1
  339. package/dist/src/prompts/transfer.js +0 -207
  340. package/dist/src/prompts/transfer.js.map +0 -1
  341. package/dist/src/prompts/tree-select.js +0 -270
  342. package/dist/src/prompts/tree-select.js.map +0 -1
  343. package/dist/src/prompts/tree.js +0 -233
  344. package/dist/src/prompts/tree.js.map +0 -1
  345. package/dist/src/prompts/wait.js +0 -79
  346. package/dist/src/prompts/wait.js.map +0 -1
  347. package/dist/src/spinner.js +0 -105
  348. package/dist/src/spinner.js.map +0 -1
  349. package/dist/src/symbols.js +0 -66
  350. package/dist/src/symbols.js.map +0 -1
  351. package/dist/src/tasks.js +0 -231
  352. package/dist/src/tasks.js.map +0 -1
  353. package/dist/src/theme.js +0 -29
  354. package/dist/src/theme.js.map +0 -1
  355. package/dist/src/types.js +0 -8
  356. package/dist/src/types.js.map +0 -1
  357. package/dist/src/utils.js +0 -480
  358. package/dist/src/utils.js.map +0 -1
@@ -1,185 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: Object.getOwnPropertyDescriptor(all, name).get
9
- });
10
- }
11
- _export(exports, {
12
- get highlight () {
13
- return highlight;
14
- },
15
- get highlightCsv () {
16
- return highlightCsv;
17
- },
18
- get highlightEnv () {
19
- return highlightEnv;
20
- },
21
- get highlightJson () {
22
- return highlightJson;
23
- },
24
- get highlightProperties () {
25
- return highlightProperties;
26
- },
27
- get highlightShell () {
28
- return highlightShell;
29
- },
30
- get highlightToml () {
31
- return highlightToml;
32
- }
33
- });
34
- const _ansi = require("./ansi");
35
- const _theme = require("./theme");
36
- function highlightJson(json) {
37
- if (!json) return '';
38
- const tokenRegex = /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"?)|(-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)|(true|false|null)|([{}[\],:])/g;
39
- let result = '';
40
- let lastIndex = 0;
41
- let match;
42
- while((match = tokenRegex.exec(json)) !== null){
43
- if (match.index > lastIndex) {
44
- result += json.substring(lastIndex, match.index);
45
- }
46
- const token = match[0];
47
- if (token.startsWith('"')) {
48
- const remaining = json.substring(tokenRegex.lastIndex);
49
- // Heuristic for keys: followed by optional whitespace and a colon
50
- if (/^\s*:/.test(remaining)) {
51
- result += `${_theme.theme.syntax.key}${token}${_ansi.ANSI.RESET}`;
52
- } else {
53
- result += `${_theme.theme.syntax.string}${token}${_ansi.ANSI.RESET}`;
54
- }
55
- } else if (/^-?\d/.test(token)) {
56
- result += `${_theme.theme.syntax.number}${token}${_ansi.ANSI.RESET}`;
57
- } else if (/^(true|false|null)$/.test(token)) {
58
- result += token === 'null' ? `${_theme.theme.syntax.null}${token}${_ansi.ANSI.RESET}` : `${_theme.theme.syntax.boolean}${token}${_ansi.ANSI.RESET}`;
59
- } else if (/^[{}[\],:]$/.test(token)) {
60
- result += `${_theme.theme.syntax.punctuation}${token}${_ansi.ANSI.RESET}`;
61
- } else {
62
- result += token;
63
- }
64
- lastIndex = tokenRegex.lastIndex;
65
- }
66
- if (lastIndex < json.length) {
67
- result += json.substring(lastIndex);
68
- }
69
- return result;
70
- }
71
- function highlightEnv(env) {
72
- if (!env) return '';
73
- return env.split('\n').map((line)=>{
74
- if (line.trim().startsWith('#')) {
75
- return `${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`;
76
- }
77
- const match = line.match(/^([^=]+)=(.*)$/);
78
- if (match) {
79
- const [, key, value] = match;
80
- return `${_theme.theme.syntax.key}${key}${_theme.theme.syntax.punctuation}=${_theme.theme.syntax.string}${value}${_ansi.ANSI.RESET}`;
81
- }
82
- return line;
83
- }).join('\n');
84
- }
85
- function highlightToml(toml) {
86
- if (!toml) return '';
87
- return toml.split('\n').map((line)=>{
88
- const trimmed = line.trim();
89
- if (trimmed.startsWith('#')) {
90
- return `${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`;
91
- }
92
- // [section]
93
- if (trimmed.startsWith('[') && trimmed.endsWith(']')) {
94
- return `${_theme.theme.syntax.key}${line}${_ansi.ANSI.RESET}`;
95
- }
96
- // Key = Value
97
- const match = line.match(/^(\s*[\w\d_-]+)(\s*=)/);
98
- if (match) {
99
- const fullMatch = match[0];
100
- const keyPart = match[1];
101
- const eqPart = match[2];
102
- const rest = line.substring(fullMatch.length);
103
- return `${_theme.theme.syntax.key}${keyPart}${_ansi.ANSI.RESET}${_theme.theme.syntax.punctuation}${eqPart}${_theme.theme.syntax.string}${rest}${_ansi.ANSI.RESET}`;
104
- }
105
- return line;
106
- }).join('\n');
107
- }
108
- function highlightCsv(csv) {
109
- if (!csv) return '';
110
- // Cycle through colors to differentiate columns
111
- const colors = [
112
- _theme.theme.syntax.string,
113
- _theme.theme.syntax.key,
114
- _theme.theme.syntax.number,
115
- _theme.theme.syntax.boolean
116
- ];
117
- return csv.split('\n').map((line)=>{
118
- if (!line.trim()) return line;
119
- // Split by comma, ignoring commas inside double quotes
120
- // Regex explanation: Match comma only if followed by an even number of quotes (or 0) until end of line
121
- const parts = line.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
122
- return parts.map((part, index)=>{
123
- const color = colors[index % colors.length];
124
- return `${color}${part}${_ansi.ANSI.RESET}`;
125
- }).join(`${_theme.theme.syntax.punctuation},${_ansi.ANSI.RESET}`);
126
- }).join('\n');
127
- }
128
- function highlightShell(script) {
129
- if (!script) return '';
130
- // Simple replacements for common shell patterns
131
- // 1. Comments
132
- // 2. Keywords
133
- // 3. Variables
134
- const keywords = /\b(if|then|else|elif|fi|for|in|do|done|while|case|esac|return|exit|export|source|echo|printf)\b/g;
135
- return script.split('\n').map((line)=>{
136
- if (line.trim().startsWith('#')) {
137
- return `${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`;
138
- }
139
- // Temporarily hide strings properly is hard with regex replace,
140
- // so we just do best-effort highlights for keywords and vars outside of checking quote context.
141
- const processed = line.replace(keywords, (match)=>`${_theme.theme.syntax.boolean}${match}${_ansi.ANSI.RESET}`).replace(/(\$[\w\d_]+|\$\{[^}]+\})/g, (match)=>`${_theme.theme.syntax.key}${match}${_ansi.ANSI.RESET}`).replace(/(\s|^)(-{1,2}[a-zA-Z0-9_-]+)/g, (_match, prefix, flag)=>`${prefix}${_theme.theme.syntax.number}${flag}${_ansi.ANSI.RESET}`);
142
- return processed;
143
- }).join('\n');
144
- }
145
- function highlightProperties(props) {
146
- if (!props) return '';
147
- return props.split('\n').map((line)=>{
148
- const trimmed = line.trim();
149
- // Supports # or ! for comments
150
- if (trimmed.startsWith('#') || trimmed.startsWith('!')) {
151
- return `${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`;
152
- }
153
- // Keys can be separated by = or :
154
- const match = line.match(/^([^=:]+)([=:])(.*)$/);
155
- if (match) {
156
- const [, key, sep, value] = match;
157
- return `${_theme.theme.syntax.key}${key}${_theme.theme.syntax.punctuation}${sep}${_theme.theme.syntax.string}${value}${_ansi.ANSI.RESET}`;
158
- }
159
- return line;
160
- }).join('\n');
161
- }
162
- // --- Main Mapping ---
163
- const highlighters = {
164
- 'json': highlightJson,
165
- 'env': highlightEnv,
166
- 'toml': highlightToml,
167
- 'csv': highlightCsv,
168
- 'sh': highlightShell,
169
- 'bash': highlightShell,
170
- 'zsh': highlightShell,
171
- 'properties': highlightProperties,
172
- 'props': highlightProperties,
173
- 'conf': highlightProperties // loose convention
174
- };
175
- function highlight(code, language) {
176
- const lang = language.toLowerCase();
177
- const highlightFunc = highlighters[lang];
178
- if (highlightFunc) {
179
- return highlightFunc(code);
180
- }
181
- // Fallback: If no highlighter found, return original code
182
- return code;
183
- }
184
-
185
- //# sourceMappingURL=highlight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/highlight.ts"],"sourcesContent":["import { ANSI } from './ansi';\nimport { theme } from './theme';\n\ntype Highlighter = (code: string) => string;\n\n// --- 1. JSON Highlighter ---\nexport function highlightJson(json: string): string {\n if (!json) return '';\n const tokenRegex = /(\"(\\\\u[a-zA-Z0-9]{4}|\\\\[^u]|[^\\\\\"])*\"?)|(-?\\d+(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)|(true|false|null)|([{}[\\],:])/g;\n\n let result = '';\n let lastIndex = 0;\n let match;\n\n while ((match = tokenRegex.exec(json)) !== null) {\n if (match.index > lastIndex) {\n result += json.substring(lastIndex, match.index);\n }\n\n const token = match[0];\n\n if (token.startsWith('\"')) {\n const remaining = json.substring(tokenRegex.lastIndex);\n // Heuristic for keys: followed by optional whitespace and a colon\n if (/^\\s*:/.test(remaining)) {\n result += `${theme.syntax.key}${token}${ANSI.RESET}`;\n } else {\n result += `${theme.syntax.string}${token}${ANSI.RESET}`;\n }\n }\n else if (/^-?\\d/.test(token)) {\n result += `${theme.syntax.number}${token}${ANSI.RESET}`;\n }\n else if (/^(true|false|null)$/.test(token)) {\n result += (token === 'null')\n ? `${theme.syntax.null}${token}${ANSI.RESET}`\n : `${theme.syntax.boolean}${token}${ANSI.RESET}`;\n }\n else if (/^[{}[\\],:]$/.test(token)) {\n result += `${theme.syntax.punctuation}${token}${ANSI.RESET}`;\n }\n else {\n result += token;\n }\n\n lastIndex = tokenRegex.lastIndex;\n }\n\n if (lastIndex < json.length) {\n result += json.substring(lastIndex);\n }\n return result;\n}\n\n// --- 2. ENV Highlighter ---\nexport function highlightEnv(env: string): string {\n if (!env) return '';\n return env.split('\\n').map(line => {\n if (line.trim().startsWith('#')) {\n return `${theme.muted}${line}${ANSI.RESET}`;\n }\n const match = line.match(/^([^=]+)=(.*)$/);\n if (match) {\n const [, key, value] = match;\n return `${theme.syntax.key}${key}${theme.syntax.punctuation}=${theme.syntax.string}${value}${ANSI.RESET}`;\n }\n return line;\n }).join('\\n');\n}\n\n// --- 3. TOML Highlighter ---\nexport function highlightToml(toml: string): string {\n if (!toml) return '';\n return toml.split('\\n').map(line => {\n const trimmed = line.trim();\n if (trimmed.startsWith('#')) {\n return `${theme.muted}${line}${ANSI.RESET}`;\n }\n // [section]\n if (trimmed.startsWith('[') && trimmed.endsWith(']')) {\n return `${theme.syntax.key}${line}${ANSI.RESET}`;\n }\n // Key = Value\n const match = line.match(/^(\\s*[\\w\\d_-]+)(\\s*=)/);\n if (match) {\n const fullMatch = match[0];\n const keyPart = match[1];\n const eqPart = match[2];\n const rest = line.substring(fullMatch.length);\n return `${theme.syntax.key}${keyPart}${ANSI.RESET}${theme.syntax.punctuation}${eqPart}${theme.syntax.string}${rest}${ANSI.RESET}`;\n }\n return line;\n }).join('\\n');\n}\n\n// --- 4. CSV Highlighter ---\nexport function highlightCsv(csv: string): string {\n if (!csv) return '';\n // Cycle through colors to differentiate columns\n const colors = [theme.syntax.string, theme.syntax.key, theme.syntax.number, theme.syntax.boolean];\n\n return csv.split('\\n').map(line => {\n if (!line.trim()) return line;\n // Split by comma, ignoring commas inside double quotes\n // Regex explanation: Match comma only if followed by an even number of quotes (or 0) until end of line\n const parts = line.split(/,(?=(?:(?:[^\"]*\"){2})*[^\"]*$)/);\n\n return parts.map((part, index) => {\n const color = colors[index % colors.length];\n return `${color}${part}${ANSI.RESET}`;\n }).join(`${theme.syntax.punctuation},${ANSI.RESET}`);\n }).join('\\n');\n}\n\n// --- 5. Shell/Bash Highlighter ---\nexport function highlightShell(script: string): string {\n if (!script) return '';\n\n // Simple replacements for common shell patterns\n // 1. Comments\n // 2. Keywords\n // 3. Variables\n\n const keywords = /\\b(if|then|else|elif|fi|for|in|do|done|while|case|esac|return|exit|export|source|echo|printf)\\b/g;\n\n return script.split('\\n').map(line => {\n if (line.trim().startsWith('#')) {\n return `${theme.muted}${line}${ANSI.RESET}`;\n }\n\n // Temporarily hide strings properly is hard with regex replace, \n // so we just do best-effort highlights for keywords and vars outside of checking quote context.\n const processed = line\n .replace(keywords, match => `${theme.syntax.boolean}${match}${ANSI.RESET}`)\n .replace(/(\\$[\\w\\d_]+|\\$\\{[^}]+\\})/g, match => `${theme.syntax.key}${match}${ANSI.RESET}`)\n .replace(/(\\s|^)(-{1,2}[a-zA-Z0-9_-]+)/g, (_match, prefix, flag) => `${prefix}${theme.syntax.number}${flag}${ANSI.RESET}`);\n\n return processed;\n }).join('\\n');\n}\n\n// --- 6. Properties Highlighter ---\nexport function highlightProperties(props: string): string {\n if (!props) return '';\n return props.split('\\n').map(line => {\n const trimmed = line.trim();\n // Supports # or ! for comments\n if (trimmed.startsWith('#') || trimmed.startsWith('!')) {\n return `${theme.muted}${line}${ANSI.RESET}`;\n }\n // Keys can be separated by = or :\n const match = line.match(/^([^=:]+)([=:])(.*)$/);\n if (match) {\n const [, key, sep, value] = match;\n return `${theme.syntax.key}${key}${theme.syntax.punctuation}${sep}${theme.syntax.string}${value}${ANSI.RESET}`;\n }\n return line;\n }).join('\\n');\n}\n\n// --- Main Mapping ---\nconst highlighters: Record<string, Highlighter> = {\n 'json': highlightJson,\n 'env': highlightEnv,\n 'toml': highlightToml,\n 'csv': highlightCsv,\n 'sh': highlightShell,\n 'bash': highlightShell,\n 'zsh': highlightShell,\n 'properties': highlightProperties,\n 'props': highlightProperties,\n 'conf': highlightProperties // loose convention\n};\n\nexport function highlight(code: string, language: string): string {\n const lang = language.toLowerCase();\n const highlightFunc = highlighters[lang];\n\n if (highlightFunc) {\n return highlightFunc(code);\n }\n\n // Fallback: If no highlighter found, return original code\n return code;\n}"],"names":["highlight","highlightCsv","highlightEnv","highlightJson","highlightProperties","highlightShell","highlightToml","json","tokenRegex","result","lastIndex","match","exec","index","substring","token","startsWith","remaining","test","theme","syntax","key","ANSI","RESET","string","number","null","boolean","punctuation","length","env","split","map","line","trim","muted","value","join","toml","trimmed","endsWith","fullMatch","keyPart","eqPart","rest","csv","colors","parts","part","color","script","keywords","processed","replace","_match","prefix","flag","props","sep","highlighters","code","language","lang","toLowerCase","highlightFun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AkC;QAClC,MAAMZ,QAAQsB,KAAKtB,KAAK,CAAC;QACzB,IAAIA,OAAO;YACP,MAAM,GAAGU,KAAKqC,KAAKtB,MAAM,GAAGzB;YAC5B,OAAO,GAAGQ,YAAK,CAACC,MAAM,CAACC,GAAG,GAAGA,MAAMF,YAAK,CAACC,MAAM,CAACQ,WAAW,GAAG8B,MAAMvC,YAAK,CAACC,MAAM,CAACI,MAAM,GAAGY,QAAQd,UAAI,CAACC,KAAK,EAAE;QAClH;QACA,OAAOU;IACX,GAAGI,IAAI,CAAC;AACZ;AAEA,uBAAuB;AACvB,MAAMsB,eAA4C;IAC9C,QAAQxD;IACR,OAAOD;IACP,QAAQI;IACR,OAAOL;IACP,MAAMI;IACN,QAAQA;IACR,OAAOA;IACP,cAAcD;IACd,SAASA;IACT,QAAQA,oBAAoB,mBAAmB;AACnD;AAEO,SAASJ,UAAU4D,IAAY,EAAEC,QAAgB;IACpD,MAAMC,OAAOD,SAASE,WAAW;IACjC,MAAMC,gBAAgBL,YAAY,CAACG,KAAK;IAExC,IAAIE,eAAe;QACf,OAAOA,cAAcJ;IACzB;IAEA,0DAA0D;IAC1D,OAAOA;AACX"}
package/dist/src/index.js DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Mep (A Interactive CLI Prompt)
3
- * Export file
4
- */ "use strict";
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- _export_star(require("./types"), exports);
9
- _export_star(require("./core"), exports);
10
- _export_star(require("./prompts/map"), exports);
11
- _export_star(require("./prompts/semver"), exports);
12
- _export_star(require("./prompts/ip"), exports);
13
- _export_star(require("./prompts/kanban"), exports);
14
- _export_star(require("./prompts/time"), exports);
15
- _export_star(require("./prompts/heatmap"), exports);
16
- _export_star(require("./prompts/byte"), exports);
17
- _export_star(require("./prompts/slot"), exports);
18
- _export_star(require("./prompts/gauge"), exports);
19
- _export_star(require("./prompts/calculator"), exports);
20
- _export_star(require("./prompts/emoji"), exports);
21
- _export_star(require("./prompts/match"), exports);
22
- _export_star(require("./prompts/diff"), exports);
23
- _export_star(require("./prompts/dial"), exports);
24
- _export_star(require("./prompts/draw"), exports);
25
- _export_star(require("./prompts/multi-column-select"), exports);
26
- _export_star(require("./prompts/fuzzy"), exports);
27
- _export_star(require("./prompts/miller"), exports);
28
- _export_star(require("./prompts/pattern"), exports);
29
- _export_star(require("./prompts/region"), exports);
30
- _export_star(require("./prompts/spreadsheet"), exports);
31
- _export_star(require("./prompts/scroll"), exports);
32
- _export_star(require("./prompts/breadcrumb"), exports);
33
- _export_star(require("./prompts/schedule"), exports);
34
- _export_star(require("./prompts/data-inspector"), exports);
35
- _export_star(require("./prompts/exec"), exports);
36
- _export_star(require("./prompts/shortcut"), exports);
37
- _export_star(require("./prompts/seat"), exports);
38
- _export_star(require("./prompts/select-range"), exports);
39
- _export_star(require("./prompts/sort-grid"), exports);
40
- _export_star(require("./prompts/dependency"), exports);
41
- _export_star(require("./prompts/license"), exports);
42
- _export_star(require("./prompts/regex"), exports);
43
- _export_star(require("./prompts/box"), exports);
44
- _export_star(require("./prompts/connection-string"), exports);
45
- _export_star(require("./prompts/curl"), exports);
46
- _export_star(require("./prompts/phone"), exports);
47
- _export_star(require("./prompts/fuzzy-multi-column"), exports);
48
- _export_star(require("./prompts/multi-range"), exports);
49
- _export_star(require("./prompts/breadcrumb-search"), exports);
50
- _export_star(require("./pipeline"), exports);
51
- _export_star(require("./tasks"), exports);
52
- function _export_star(from, to) {
53
- Object.keys(from).forEach(function(k) {
54
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
55
- Object.defineProperty(to, k, {
56
- enumerable: true,
57
- get: function() {
58
- return from[k];
59
- }
60
- });
61
- }
62
- });
63
- return from;
64
- }
65
-
66
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * Mep (A Interactive CLI Prompt)\n * Export file\n */\n\nexport * from './types';\nexport * from './core';\nexport * from './prompts/map';\nexport * from './prompts/semver';\nexport * from './prompts/ip';\nexport * from './prompts/kanban';\nexport * from './prompts/time';\nexport * from './prompts/heatmap';\nexport * from './prompts/byte';\nexport * from './prompts/slot';\nexport * from './prompts/gauge';\nexport * from './prompts/calculator';\nexport * from './prompts/emoji';\nexport * from './prompts/match';\nexport * from './prompts/diff';\nexport * from './prompts/dial';\nexport * from './prompts/draw';\nexport * from './prompts/multi-column-select';\nexport * from './prompts/fuzzy';\nexport * from './prompts/miller';\nexport * from './prompts/pattern';\nexport * from './prompts/region';\nexport * from './prompts/spreadsheet';\nexport * from './prompts/scroll';\nexport * from './prompts/breadcrumb';\nexport * from './prompts/schedule';\nexport * from './prompts/data-inspector';\nexport * from './prompts/exec';\nexport * from './prompts/shortcut';\nexport * from './prompts/seat';\nexport * from './prompts/select-range';\nexport * from './prompts/sort-grid';\nexport * from './prompts/dependency';\nexport * from './prompts/license';\nexport * from './prompts/regex';\nexport * from './prompts/box';\nexport * from './prompts/connection-string';\nexport * from './prompts/curl';\nexport * from './prompts/phone';\nexport * from './prompts/fuzzy-multi-column';\nexport * from './prompts/multi-range';\nexport * from './prompts/breadcrumb-search';\nexport * from './pipeline';\nexport * from './tasks';\n"],"names":[],"mappings":"AAAA;;;CAGC;;;;qBAEa;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
package/dist/src/input.js DELETED
@@ -1,158 +0,0 @@
1
- // src/input.ts
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "InputParser", {
7
- enumerable: true,
8
- get: function() {
9
- return InputParser;
10
- }
11
- });
12
- const _events = require("events");
13
- function _define_property(obj, key, value) {
14
- if (key in obj) {
15
- Object.defineProperty(obj, key, {
16
- value: value,
17
- enumerable: true,
18
- configurable: true,
19
- writable: true
20
- });
21
- } else {
22
- obj[key] = value;
23
- }
24
- return obj;
25
- }
26
- let InputParser = class InputParser extends _events.EventEmitter {
27
- /**
28
- * Feed data into the parser.
29
- */ feed(data) {
30
- const input = data.toString('utf-8');
31
- for(let i = 0; i < input.length; i++){
32
- const char = input[i];
33
- this.processChar(char);
34
- }
35
- }
36
- processChar(char) {
37
- if (this.state === 'NORMAL') {
38
- if (char === '\x1b') {
39
- this.state = 'ESC';
40
- this.buffer = char;
41
- // Start a short timeout to detect bare ESC
42
- this.timeout = setTimeout(()=>{
43
- this.emitKey(this.buffer);
44
- this.buffer = '';
45
- this.state = 'NORMAL';
46
- }, 20); // 20ms timeout
47
- } else {
48
- this.emitKey(char);
49
- }
50
- } else if (this.state === 'ESC') {
51
- // Cancel timeout as we received more data
52
- if (this.timeout) clearTimeout(this.timeout);
53
- this.timeout = null;
54
- this.buffer += char;
55
- if (char === '[') {
56
- this.state = 'CSI';
57
- } else if (char === 'O') {
58
- // SS3 sequence like \x1b O A (Application Cursor Keys)
59
- // Treat as similar to CSI for collecting the next char
60
- this.state = 'CSI';
61
- } else {
62
- // Alt + Key or similar (\x1b + char)
63
- this.emitKey(this.buffer);
64
- this.buffer = '';
65
- this.state = 'NORMAL';
66
- }
67
- } else if (this.state === 'CSI') {
68
- this.buffer += char;
69
- if (char === '<') {
70
- this.state = 'MOUSE_SGR';
71
- this.buffer = '<';
72
- return;
73
- }
74
- // CSI sequences end with 0x40-0x7E
75
- if (char >= '@' && char <= '~') {
76
- this.emitKey(this.buffer);
77
- this.buffer = '';
78
- this.state = 'NORMAL';
79
- }
80
- // Otherwise, we keep buffering (params like 1;2)
81
- } else if (this.state === 'MOUSE_SGR') {
82
- this.buffer += char;
83
- // SGR sequences end with 'm' (release) or 'M' (press)
84
- if (char === 'm' || char === 'M') {
85
- this.parseSGRMouse(this.buffer);
86
- this.buffer = '';
87
- this.state = 'NORMAL';
88
- }
89
- }
90
- }
91
- parseSGRMouse(buffer) {
92
- // console.log('Parsing SGR:', buffer);
93
- // format: <b;x;yM or <b;x;ym
94
- // buffer includes the leading < and trailing M/m
95
- const content = buffer.slice(1, -1);
96
- const type = buffer.slice(-1); // m or M
97
- const parts = content.split(';').map(Number);
98
- if (parts.length >= 3) {
99
- const [b, x, y] = parts;
100
- let action = 'press';
101
- // Extract modifiers
102
- const shift = !!(b & 4);
103
- const meta = !!(b & 8);
104
- const ctrl = !!(b & 16);
105
- // Interpret button codes
106
- // 0: Left, 1: Middle, 2: Right
107
- // +32: Motion
108
- // 64: Scroll (bit 6)
109
- if (b & 64) {
110
- action = 'scroll';
111
- const scroll = b & 1 ? 'down' : 'up';
112
- this.emit('mouse', {
113
- name: 'mouse',
114
- x,
115
- y,
116
- button: 0,
117
- action,
118
- scroll,
119
- shift,
120
- ctrl,
121
- meta
122
- });
123
- if (scroll === 'up') this.emit('scrollup');
124
- else this.emit('scrolldown');
125
- return;
126
- }
127
- if (type === 'm') {
128
- action = 'release';
129
- } else {
130
- action = 'press';
131
- // Check if motion
132
- if (b & 32) {
133
- action = 'move';
134
- }
135
- }
136
- this.emit('mouse', {
137
- name: 'mouse',
138
- x,
139
- y,
140
- button: b & 3,
141
- action,
142
- shift,
143
- ctrl,
144
- meta
145
- });
146
- }
147
- }
148
- emitKey(key) {
149
- // Normalize Enter
150
- if (key === '\r') key = '\n';
151
- this.emit('keypress', key, Buffer.from(key));
152
- }
153
- constructor(){
154
- super(), _define_property(this, "buffer", ''), _define_property(this, "timeout", null), _define_property(this, "state", 'NORMAL');
155
- }
156
- };
157
-
158
- //# sourceMappingURL=input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/input.ts"],"sourcesContent":["// src/input.ts\n\nimport { EventEmitter } from 'events';\n\nexport class InputParser extends EventEmitter {\n private buffer: string = '';\n private timeout: NodeJS.Timeout | null = null;\n private state: 'NORMAL' | 'ESC' | 'CSI' | 'MOUSE_SGR' = 'NORMAL';\n\n constructor() {\n super();\n }\n\n /**\n * Feed data into the parser.\n */\n public feed(data: Buffer) {\n\n const input = data.toString('utf-8');\n\n for (let i = 0; i < input.length; i++) {\n const char = input[i];\n this.processChar(char);\n }\n }\n\n private processChar(char: string) {\n if (this.state === 'NORMAL') {\n if (char === '\\x1b') {\n this.state = 'ESC';\n this.buffer = char;\n // Start a short timeout to detect bare ESC\n this.timeout = setTimeout(() => {\n this.emitKey(this.buffer);\n this.buffer = '';\n this.state = 'NORMAL';\n }, 20); // 20ms timeout\n } else {\n this.emitKey(char);\n }\n } else if (this.state === 'ESC') {\n // Cancel timeout as we received more data\n if (this.timeout) clearTimeout(this.timeout);\n this.timeout = null;\n\n this.buffer += char;\n\n if (char === '[') {\n this.state = 'CSI';\n } else if (char === 'O') {\n // SS3 sequence like \\x1b O A (Application Cursor Keys)\n // Treat as similar to CSI for collecting the next char\n this.state = 'CSI';\n } else {\n // Alt + Key or similar (\\x1b + char)\n this.emitKey(this.buffer);\n this.buffer = '';\n this.state = 'NORMAL';\n }\n } else if (this.state === 'CSI') {\n this.buffer += char;\n\n if (char === '<') {\n this.state = 'MOUSE_SGR';\n this.buffer = '<';\n return;\n }\n\n // CSI sequences end with 0x40-0x7E\n if (char >= '@' && char <= '~') {\n this.emitKey(this.buffer);\n this.buffer = '';\n this.state = 'NORMAL';\n }\n // Otherwise, we keep buffering (params like 1;2)\n } else if (this.state === 'MOUSE_SGR') {\n this.buffer += char;\n // SGR sequences end with 'm' (release) or 'M' (press)\n if (char === 'm' || char === 'M') {\n this.parseSGRMouse(this.buffer);\n this.buffer = '';\n this.state = 'NORMAL';\n }\n }\n }\n\n private parseSGRMouse(buffer: string) {\n // console.log('Parsing SGR:', buffer);\n // format: <b;x;yM or <b;x;ym\n // buffer includes the leading < and trailing M/m\n const content = buffer.slice(1, -1);\n const type = buffer.slice(-1); // m or M\n const parts = content.split(';').map(Number);\n\n if (parts.length >= 3) {\n const [b, x, y] = parts;\n let action: 'press' | 'release' | 'move' | 'scroll' = 'press';\n\n // Extract modifiers\n const shift = !!(b & 4);\n const meta = !!(b & 8);\n const ctrl = !!(b & 16);\n\n // Interpret button codes\n // 0: Left, 1: Middle, 2: Right\n // +32: Motion\n // 64: Scroll (bit 6)\n\n if (b & 64) {\n action = 'scroll';\n const scroll = (b & 1) ? 'down' : 'up';\n this.emit('mouse', {\n name: 'mouse',\n x,\n y,\n button: 0,\n action,\n scroll,\n shift,\n ctrl,\n meta\n });\n if (scroll === 'up') this.emit('scrollup');\n else this.emit('scrolldown');\n return;\n }\n\n if (type === 'm') {\n action = 'release';\n } else {\n action = 'press';\n // Check if motion\n if (b & 32) {\n action = 'move';\n }\n }\n\n this.emit('mouse', {\n name: 'mouse',\n x,\n y,\n button: b & 3, // Strip modifiers to get raw button 0-2\n action,\n shift,\n ctrl,\n meta\n });\n }\n }\n\n private emitKey(key: string) {\n // Normalize Enter\n if (key === '\\r') key = '\\n';\n\n this.emit('keypress', key, Buffer.from(key));\n }\n}\n"],"names":["InputParser","EventEmitter","feed","data","input","toString","i","length","char","processChar","state","buffer","timeout","setTimeout","emitKey","clearTimeout","parseSGRMouse","content","slice","type","parts","split","map","Number","b","x","y","action","shift","meta","ctrl","scroll","emit","name","button","key","Buffer","from"],"mappings":"AAAA,eAAe;;;;;+BAIFA;;;eAAAA;;;wBAFgB;;;;;;;;;;;;;;AAEtB,IAAA,AAAMA,cAAN,MAAMA,oBAAoBC,oBAAY;IASzC;;KAEC,GACD,AAAOC,KAAKC,IAAY,EAAE;QAEtB,MAAMC,QAAQD,KAAKE,QAAQ,CAAC;QAE5B,IAAK,IAAIC,IAAI,GAAGA,IAAIF,MAAMG,MAAM,EAAED,IAAK;YACnC,MAAME,OAAOJ,KAAK,CAACE,EAAE;YACrB,IAAI,CAACG,WAAW,CAACD;QACrB;IACJ;IAEQC,YAAYD,IAAY,EAAE;QAC9B,IAAI,IAA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