@maizzle/framework 6.0.0-rc.22 → 6.0.0-rc.23

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 (210) hide show
  1. package/dist/build.d.ts.map +1 -1
  2. package/dist/build.js +11 -0
  3. package/dist/build.js.map +1 -1
  4. package/dist/components/Heading.vue +1 -1
  5. package/dist/components/Img.vue +60 -10
  6. package/dist/components/Link.vue +1 -1
  7. package/dist/components/Preheader.vue +4 -2
  8. package/dist/components/Tailwind.vue +4 -2
  9. package/dist/components/Text.vue +1 -1
  10. package/dist/components/Vml.vue +354 -0
  11. package/dist/components/utils.d.ts.map +1 -1
  12. package/dist/components/utils.js.map +1 -1
  13. package/dist/composables/defineConfig.js.map +1 -1
  14. package/dist/composables/renderContext.d.ts.map +1 -1
  15. package/dist/composables/renderContext.js.map +1 -1
  16. package/dist/composables/useBaseUrl.d.ts.map +1 -1
  17. package/dist/composables/useBaseUrl.js.map +1 -1
  18. package/dist/composables/useConfig.d.ts.map +1 -1
  19. package/dist/composables/useConfig.js.map +1 -1
  20. package/dist/composables/useCurrentTemplate.d.ts.map +1 -1
  21. package/dist/composables/useCurrentTemplate.js +10 -3
  22. package/dist/composables/useCurrentTemplate.js.map +1 -1
  23. package/dist/composables/useDoctype.d.ts.map +1 -1
  24. package/dist/composables/useDoctype.js.map +1 -1
  25. package/dist/composables/useEvent.js.map +1 -1
  26. package/dist/composables/useFont.d.ts.map +1 -1
  27. package/dist/composables/useFont.js.map +1 -1
  28. package/dist/composables/useOutlookFallback.d.ts.map +1 -1
  29. package/dist/composables/useOutlookFallback.js.map +1 -1
  30. package/dist/composables/usePlaintext.d.ts.map +1 -1
  31. package/dist/composables/usePlaintext.js.map +1 -1
  32. package/dist/composables/usePreheader.d.ts.map +1 -1
  33. package/dist/composables/usePreheader.js.map +1 -1
  34. package/dist/composables/useTransformers.d.ts.map +1 -1
  35. package/dist/composables/useTransformers.js.map +1 -1
  36. package/dist/composables/useUrlQuery.d.ts.map +1 -1
  37. package/dist/composables/useUrlQuery.js.map +1 -1
  38. package/dist/config/defaults.d.ts.map +1 -1
  39. package/dist/config/defaults.js.map +1 -1
  40. package/dist/config/index.js +12 -0
  41. package/dist/config/index.js.map +1 -1
  42. package/dist/events/index.d.ts +5 -0
  43. package/dist/events/index.d.ts.map +1 -1
  44. package/dist/events/index.js +5 -0
  45. package/dist/events/index.js.map +1 -1
  46. package/dist/plaintext.d.ts.map +1 -1
  47. package/dist/plaintext.js.map +1 -1
  48. package/dist/plugin.js.map +1 -1
  49. package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -1
  50. package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -1
  51. package/dist/plugins/postcss/pruneVars.d.ts.map +1 -1
  52. package/dist/plugins/postcss/pruneVars.js.map +1 -1
  53. package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -1
  54. package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -1
  55. package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -1
  56. package/dist/plugins/postcss/removeDeclarations.js.map +1 -1
  57. package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -1
  58. package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -1
  59. package/dist/plugins/postcss/resolveProps.d.ts.map +1 -1
  60. package/dist/plugins/postcss/resolveProps.js +14 -0
  61. package/dist/plugins/postcss/resolveProps.js.map +1 -1
  62. package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -1
  63. package/dist/plugins/postcss/tailwindCleanup.js.map +1 -1
  64. package/dist/prepare.d.ts.map +1 -1
  65. package/dist/prepare.js.map +1 -1
  66. package/dist/render/active.d.ts.map +1 -1
  67. package/dist/render/active.js.map +1 -1
  68. package/dist/render/createRenderer.d.ts.map +1 -1
  69. package/dist/render/createRenderer.js +89 -1
  70. package/dist/render/createRenderer.js.map +1 -1
  71. package/dist/render/index.d.ts.map +1 -1
  72. package/dist/render/index.js +6 -0
  73. package/dist/render/index.js.map +1 -1
  74. package/dist/render/injectFonts.js.map +1 -1
  75. package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -1
  76. package/dist/render/plugins/codeBlockExtract.js +4 -0
  77. package/dist/render/plugins/codeBlockExtract.js.map +1 -1
  78. package/dist/render/plugins/markdownExtract.d.ts.map +1 -1
  79. package/dist/render/plugins/markdownExtract.js.map +1 -1
  80. package/dist/render/plugins/rawExtract.d.ts.map +1 -1
  81. package/dist/render/plugins/rawExtract.js.map +1 -1
  82. package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -1
  83. package/dist/render/plugins/rowSourceLocation.js.map +1 -1
  84. package/dist/serve.d.ts.map +1 -1
  85. package/dist/serve.js +48 -15
  86. package/dist/serve.js.map +1 -1
  87. package/dist/server/compatibility.d.ts.map +1 -1
  88. package/dist/server/compatibility.js +48 -0
  89. package/dist/server/compatibility.js.map +1 -1
  90. package/dist/server/email.js.map +1 -1
  91. package/dist/server/linter.js +6 -0
  92. package/dist/server/linter.js.map +1 -1
  93. package/dist/server/sfc-utils.d.ts.map +1 -1
  94. package/dist/server/sfc-utils.js.map +1 -1
  95. package/dist/server/ui/App.vue +17 -16
  96. package/dist/server/ui/components/Markdown.vue +17 -0
  97. package/dist/server/ui/components/SidebarClose.vue +1 -1
  98. package/dist/server/ui/components/ui/checkbox/Checkbox.vue +1 -1
  99. package/dist/server/ui/components/ui/command/CommandInput.vue +2 -2
  100. package/dist/server/ui/components/ui/dialog/DialogContent.vue +1 -1
  101. package/dist/server/ui/components/ui/dialog/DialogScrollContent.vue +1 -1
  102. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
  103. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +1 -1
  104. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  105. package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
  106. package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +1 -1
  107. package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +1 -1
  108. package/dist/server/ui/lib/emulated-dark-mode.ts +25 -10
  109. package/dist/server/ui/pages/Home.vue +1 -1
  110. package/dist/server/ui/pages/Preview.vue +32 -18
  111. package/dist/tests/render/_helpers.js.map +1 -1
  112. package/dist/transformers/addAttributes.d.ts.map +1 -1
  113. package/dist/transformers/addAttributes.js.map +1 -1
  114. package/dist/transformers/attributeToStyle.d.ts.map +1 -1
  115. package/dist/transformers/attributeToStyle.js.map +1 -1
  116. package/dist/transformers/base.d.ts.map +1 -1
  117. package/dist/transformers/base.js +4 -0
  118. package/dist/transformers/base.js.map +1 -1
  119. package/dist/transformers/columnWidth.d.ts.map +1 -1
  120. package/dist/transformers/columnWidth.js.map +1 -1
  121. package/dist/transformers/entities.d.ts.map +1 -1
  122. package/dist/transformers/entities.js.map +1 -1
  123. package/dist/transformers/filters/defaults.d.ts.map +1 -1
  124. package/dist/transformers/filters/defaults.js.map +1 -1
  125. package/dist/transformers/filters/index.d.ts.map +1 -1
  126. package/dist/transformers/filters/index.js.map +1 -1
  127. package/dist/transformers/format.d.ts.map +1 -1
  128. package/dist/transformers/format.js.map +1 -1
  129. package/dist/transformers/index.d.ts.map +1 -1
  130. package/dist/transformers/index.js +26 -0
  131. package/dist/transformers/index.js.map +1 -1
  132. package/dist/transformers/inlineCss.d.ts.map +1 -1
  133. package/dist/transformers/inlineCss.js +25 -2
  134. package/dist/transformers/inlineCss.js.map +1 -1
  135. package/dist/transformers/inlineLink.d.ts.map +1 -1
  136. package/dist/transformers/inlineLink.js.map +1 -1
  137. package/dist/transformers/minify.d.ts.map +1 -1
  138. package/dist/transformers/minify.js.map +1 -1
  139. package/dist/transformers/minifyCodeInline.d.ts.map +1 -1
  140. package/dist/transformers/minifyCodeInline.js.map +1 -1
  141. package/dist/transformers/msoPlaceholders.d.ts.map +1 -1
  142. package/dist/transformers/msoPlaceholders.js.map +1 -1
  143. package/dist/transformers/purgeCss.d.ts.map +1 -1
  144. package/dist/transformers/purgeCss.js +29 -3
  145. package/dist/transformers/purgeCss.js.map +1 -1
  146. package/dist/transformers/removeAttributes.d.ts.map +1 -1
  147. package/dist/transformers/removeAttributes.js.map +1 -1
  148. package/dist/transformers/replaceStrings.d.ts.map +1 -1
  149. package/dist/transformers/replaceStrings.js.map +1 -1
  150. package/dist/transformers/safeSelectors.d.ts.map +1 -1
  151. package/dist/transformers/safeSelectors.js +13 -1
  152. package/dist/transformers/safeSelectors.js.map +1 -1
  153. package/dist/transformers/shorthandCss.d.ts.map +1 -1
  154. package/dist/transformers/shorthandCss.js.map +1 -1
  155. package/dist/transformers/sixHex.d.ts.map +1 -1
  156. package/dist/transformers/sixHex.js.map +1 -1
  157. package/dist/transformers/tailwindComponent.js +9 -0
  158. package/dist/transformers/tailwindComponent.js.map +1 -1
  159. package/dist/transformers/tailwindcss.d.ts.map +1 -1
  160. package/dist/transformers/tailwindcss.js +22 -0
  161. package/dist/transformers/tailwindcss.js.map +1 -1
  162. package/dist/transformers/urlQuery.d.ts.map +1 -1
  163. package/dist/transformers/urlQuery.js.map +1 -1
  164. package/dist/types/config.d.ts +4 -8
  165. package/dist/types/config.d.ts.map +1 -1
  166. package/dist/types/index.d.ts +1 -1
  167. package/dist/utils/ast/parser.d.ts.map +1 -1
  168. package/dist/utils/ast/parser.js.map +1 -1
  169. package/dist/utils/ast/serializer.d.ts.map +1 -1
  170. package/dist/utils/ast/serializer.js.map +1 -1
  171. package/dist/utils/ast/walker.d.ts.map +1 -1
  172. package/dist/utils/ast/walker.js.map +1 -1
  173. package/dist/utils/compileTailwindCss.d.ts.map +1 -1
  174. package/dist/utils/compileTailwindCss.js.map +1 -1
  175. package/dist/utils/componentSources.d.ts.map +1 -1
  176. package/dist/utils/componentSources.js.map +1 -1
  177. package/dist/utils/cssBox.d.ts.map +1 -1
  178. package/dist/utils/cssBox.js.map +1 -1
  179. package/dist/utils/decodeStyleEntities.d.ts.map +1 -1
  180. package/dist/utils/decodeStyleEntities.js.map +1 -1
  181. package/dist/utils/detect.d.ts.map +1 -1
  182. package/dist/utils/detect.js.map +1 -1
  183. package/dist/utils/output-markers.d.ts.map +1 -1
  184. package/dist/utils/output-markers.js.map +1 -1
  185. package/dist/utils/url.d.ts.map +1 -1
  186. package/dist/utils/url.js.map +1 -1
  187. package/dist/utils/watchPaths.js.map +1 -1
  188. package/node_modules/@clack/core/CHANGELOG.md +6 -0
  189. package/node_modules/@clack/core/dist/index.d.mts +1 -1
  190. package/node_modules/@clack/core/dist/index.mjs +8 -8
  191. package/node_modules/@clack/core/dist/index.mjs.map +1 -1
  192. package/node_modules/@clack/core/package.json +1 -1
  193. package/node_modules/@clack/prompts/CHANGELOG.md +13 -0
  194. package/node_modules/@clack/prompts/README.md +2 -2
  195. package/node_modules/@clack/prompts/dist/index.d.mts +98 -0
  196. package/node_modules/@clack/prompts/dist/index.mjs +122 -121
  197. package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
  198. package/node_modules/@clack/prompts/package.json +2 -2
  199. package/node_modules/fast-wrap-ansi/lib/main.js +0 -1
  200. package/node_modules/fast-wrap-ansi/package.json +10 -10
  201. package/node_modules/maizzle/dist/commands/make/config.mjs +7 -6
  202. package/node_modules/maizzle/dist/commands/new.mjs +15 -84
  203. package/node_modules/maizzle/package.json +2 -2
  204. package/node_modules/tinyexec/README.md +8 -0
  205. package/node_modules/tinyexec/dist/main.d.mts +16 -1
  206. package/node_modules/tinyexec/dist/main.mjs +163 -457
  207. package/node_modules/tinyexec/package.json +12 -14
  208. package/package.json +3 -4
  209. package/node_modules/fast-wrap-ansi/lib/main.js.map +0 -1
  210. package/node_modules/tinyexec/dist/LICENSES.txt +0 -83
@@ -214,6 +214,7 @@ interface GroupMultiSelectOptions<Value> extends CommonOptions {
214
214
  message: string;
215
215
  options: Record<string, Option<Value>[]>;
216
216
  initialValues?: Value[];
217
+ maxItems?: number;
217
218
  required?: boolean;
218
219
  cursorAt?: Value;
219
220
  selectableGroups?: boolean;
@@ -251,18 +252,83 @@ declare const cancel: (message?: string, opts?: CommonOptions) => void;
251
252
  declare const intro: (title?: string, opts?: CommonOptions) => void;
252
253
  declare const outro: (message?: string, opts?: CommonOptions) => void;
253
254
 
255
+ /**
256
+ * Options for the {@link text} prompt
257
+ */
254
258
  interface TextOptions extends CommonOptions {
259
+ /**
260
+ * The prompt message or question shown to the user above the input.
261
+ */
255
262
  message: string;
263
+ /**
264
+ * A visual hint shown when the field has no content.
265
+ */
256
266
  placeholder?: string;
267
+ /**
268
+ * A fallback value returned when the user provides nothing (empty input).
269
+ */
257
270
  defaultValue?: string;
271
+ /**
272
+ * The starting value shown when the prompt first renders.
273
+ * Users can edit this value before submitting.
274
+ */
258
275
  initialValue?: string;
276
+ /**
277
+ * A function that validates user input. Return a `string` or `Error` to show as a
278
+ * validation error, or `undefined` to accept the result.
279
+ */
259
280
  validate?: (value: string | undefined) => string | Error | undefined;
260
281
  }
282
+ /**
283
+ * The text prompt accepts a single line of text.
284
+ *
285
+ * @see https://bomb.sh/docs/clack/packages/prompts/#text-input
286
+ *
287
+ * @example
288
+ * ```ts
289
+ * import { text } from '@clack/prompts';
290
+ *
291
+ * const name = await text({
292
+ * message: 'What is your name?',
293
+ * placeholder: 'John Doe',
294
+ * validate: (value) => {
295
+ * if (!value || value.length < 2) return 'Name must be at least 2 characters';
296
+ * return undefined;
297
+ * },
298
+ * });
299
+ * ```
300
+ */
261
301
  declare const text: (opts: TextOptions) => Promise<string | symbol>;
262
302
 
303
+ /**
304
+ * Options for the {@link multiline} prompt
305
+ */
263
306
  interface MultiLineOptions extends TextOptions {
307
+ /**
308
+ * When enabled it shows a `[ submit ]` button that can be focused with tab.
309
+ * By default, pressing `Enter` twice submits the input
310
+ *
311
+ * @default false
312
+ */
264
313
  showSubmit?: boolean;
265
314
  }
315
+ /**
316
+ * The multi-line prompt accepts multiple lines of text input.
317
+ * By default, pressing `Enter` twice submits the input.
318
+ *
319
+ * @see https://bomb.sh/docs/clack/packages/prompts/#multi-line-text
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * import { multiline } from '@clack/prompts';
324
+ *
325
+ * const bio = await multiline({
326
+ * message: 'Enter your bio',
327
+ * placeholder: 'Tell us about yourself...',
328
+ * showSubmit: true,
329
+ * });
330
+ * ```
331
+ */
266
332
  declare const multiline: (opts: MultiLineOptions) => Promise<string | symbol>;
267
333
 
268
334
  interface MultiSelectOptions<Value> extends CommonOptions {
@@ -281,12 +347,44 @@ interface NoteOptions extends CommonOptions {
281
347
  }
282
348
  declare const note: (message?: string, title?: string, opts?: NoteOptions) => void;
283
349
 
350
+ /**
351
+ * Options for the {@link password} prompt
352
+ */
284
353
  interface PasswordOptions extends CommonOptions {
354
+ /**
355
+ * The prompt message or question shown to the user above the input.
356
+ */
285
357
  message: string;
358
+ /**
359
+ * Character to use for masking input.
360
+ * @default ▪/•
361
+ */
286
362
  mask?: string;
363
+ /**
364
+ * A function that validates user input. Return a `string` or `Error` to show as a
365
+ * validation error, or `undefined` to accept the result.
366
+ */
287
367
  validate?: (value: string | undefined) => string | Error | undefined;
368
+ /**
369
+ * When enabled it causes the input to be cleared if/when validation fails.
370
+ * @default false
371
+ */
288
372
  clearOnError?: boolean;
289
373
  }
374
+ /**
375
+ * The password prompt behaves like the {@link text} prompt, but the input is masked.
376
+ *
377
+ * @see https://bomb.sh/docs/clack/packages/prompts/#password-input
378
+ *
379
+ * @example
380
+ * ```ts
381
+ * import { password } from '@clack/prompts';
382
+ *
383
+ * const result = await password({
384
+ * message: 'Enter your password',
385
+ * });
386
+ * ```
387
+ */
290
388
  declare const password: (opts: PasswordOptions) => Promise<string | symbol>;
291
389
 
292
390
  interface PathOptions extends CommonOptions {
@@ -1,144 +1,145 @@
1
- import{getColumns as X,getRows as Bt,AutocompletePrompt as vt,settings as _,ConfirmPrompt as Lt,wrapTextWithPrefix as O,DatePrompt as Dt,isCancel as Wt,GroupMultiSelectPrompt as Ft,MultiLinePrompt as Ht,MultiSelectPrompt as Ut,PasswordPrompt as Kt,block as qt,SelectPrompt as Jt,SelectKeyPrompt as Yt,TextPrompt as Xt}from"@clack/core";export{isCancel,settings,updateSettings}from"@clack/core";import{styleText as e,stripVTControlCharacters as nt}from"node:util";import j from"node:process";import{wrapAnsi as q}from"fast-wrap-ansi";import k from"fast-string-width";import{existsSync as zt,lstatSync as wt,readdirSync as Qt}from"node:fs";import{dirname as bt,join as Zt}from"node:path";import{cursor as St,erase as Ct}from"sisteransi";function te(){return j.platform!=="win32"?j.env.TERM!=="linux":!!j.env.CI||!!j.env.WT_SESSION||!!j.env.TERMINUS_SUBLIME||j.env.ConEmuTask==="{cmd::Cmder}"||j.env.TERM_PROGRAM==="Terminus-Sublime"||j.env.TERM_PROGRAM==="vscode"||j.env.TERM==="xterm-256color"||j.env.TERM==="alacritty"||j.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const tt=te(),at=()=>process.env.CI==="true",Tt=t=>t.isTTY===!0,w=(t,r)=>tt?t:r,_t=w("\u25C6","*"),ot=w("\u25A0","x"),ut=w("\u25B2","x"),F=w("\u25C7","o"),lt=w("\u250C","T"),$=w("\u2502","|"),E=w("\u2514","\u2014"),It=w("\u2510","T"),Et=w("\u2518","\u2014"),z=w("\u25CF",">"),H=w("\u25CB"," "),et=w("\u25FB","[\u2022]"),U=w("\u25FC","[+]"),J=w("\u25FB","[ ]"),Gt=w("\u25AA","\u2022"),st=w("\u2500","-"),ct=w("\u256E","+"),xt=w("\u251C","+"),$t=w("\u256F","+"),dt=w("\u2570","+"),Ot=w("\u256D","+"),ht=w("\u25CF","\u2022"),pt=w("\u25C6","*"),mt=w("\u25B2","!"),gt=w("\u25A0","x"),M=t=>{switch(t){case"initial":case"active":return e("cyan",_t);case"cancel":return e("red",ot);case"error":return e("yellow",ut);case"submit":return e("green",F)}},yt=t=>{switch(t){case"initial":case"active":return e("cyan",$);case"cancel":return e("red",$);case"error":return e("yellow",$);case"submit":return e("green",$)}},ee=(t,r,s,i,u)=>{let n=r,o=0;for(let c=s;c<i;c++){const a=t[c];if(n=n-a.length,o++,n<=u)break}return{lineCount:n,removals:o}},Y=({cursor:t,options:r,style:s,output:i=process.stdout,maxItems:u=Number.POSITIVE_INFINITY,columnPadding:n=0,rowPadding:o=4})=>{const c=X(i)-n,a=Bt(i),l=e("dim","..."),d=Math.max(a-o,0),y=Math.max(Math.min(u,d),5);let p=0;t>=y-3&&(p=Math.max(Math.min(t-y+3,r.length-y),0));let m=y<r.length&&p>0,g=y<r.length&&p+y<r.length;const S=Math.min(p+y,r.length),h=[];let f=0;m&&f++,g&&f++;const v=p+(m?1:0),T=S-(g?1:0);for(let b=v;b<T;b++){const G=q(s(r[b],b===t),c,{hard:!0,trim:!1}).split(`
2
- `);h.push(G),f+=G.length}if(f>d){let b=0,G=0,x=f;const A=t-v,P=(N,D)=>ee(h,x,N,D,d);m?({lineCount:x,removals:b}=P(0,A),x>d&&({lineCount:x,removals:G}=P(A+1,h.length))):({lineCount:x,removals:G}=P(A+1,h.length),x>d&&({lineCount:x,removals:b}=P(0,A))),b>0&&(m=!0,h.splice(0,b)),G>0&&(g=!0,h.splice(h.length-G,G))}const C=[];m&&C.push(l);for(const b of h)for(const G of b)C.push(G);return g&&C.push(l),C};function Mt(t){return t.label??String(t.value??"")}function Rt(t,r){if(!t)return!0;const s=(r.label??String(r.value??"")).toLowerCase(),i=(r.hint??"").toLowerCase(),u=String(r.value).toLowerCase(),n=t.toLowerCase();return s.includes(n)||i.includes(n)||u.includes(n)}function se(t,r){const s=[];for(const i of r)t.includes(i.value)&&s.push(i);return s}const At=t=>new vt({options:t.options,initialValue:t.initialValue?[t.initialValue]:void 0,initialUserInput:t.initialUserInput,placeholder:t.placeholder,filter:t.filter??((r,s)=>Rt(r,s)),signal:t.signal,input:t.input,output:t.output,validate:t.validate,render(){const r=t.withGuide??_.withGuide,s=r?[`${e("gray",$)}`,`${M(this.state)} ${t.message}`]:[`${M(this.state)} ${t.message}`],i=this.userInput,u=this.options,n=t.placeholder,o=i===""&&n!==void 0,c=(a,l)=>{const d=Mt(a),y=a.hint&&a.value===this.focusedValue?e("dim",` (${a.hint})`):"";switch(l){case"active":return`${e("green",z)} ${d}${y}`;case"inactive":return`${e("dim",H)} ${e("dim",d)}`;case"disabled":return`${e("gray",H)} ${e(["strikethrough","gray"],d)}`}};switch(this.state){case"submit":{const a=se(this.selectedValues,u),l=a.length>0?` ${e("dim",a.map(Mt).join(", "))}`:"",d=r?e("gray",$):"";return`${s.join(`
1
+ import{getColumns as X,getRows as Lt,AutocompletePrompt as vt,settings as T,ConfirmPrompt as Dt,wrapTextWithPrefix as E,DatePrompt as Wt,isCancel as Ft,GroupMultiSelectPrompt as Ht,MultiLinePrompt as Ut,MultiSelectPrompt as Kt,PasswordPrompt as qt,block as Jt,SelectPrompt as Yt,SelectKeyPrompt as Xt,TextPrompt as zt}from"@clack/core";export{isCancel,settings,updateSettings}from"@clack/core";import{styleText as e,stripVTControlCharacters as nt}from"node:util";import V from"node:process";import{wrapAnsi as J}from"fast-wrap-ansi";import B from"fast-string-width";import{existsSync as Qt,lstatSync as wt,readdirSync as Zt}from"node:fs";import{dirname as bt,join as te}from"node:path";import{cursor as St,erase as Ct}from"sisteransi";function ee(){return V.platform!=="win32"?V.env.TERM!=="linux":!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask==="{cmd::Cmder}"||V.env.TERM_PROGRAM==="Terminus-Sublime"||V.env.TERM_PROGRAM==="vscode"||V.env.TERM==="xterm-256color"||V.env.TERM==="alacritty"||V.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const tt=ee(),ot=()=>process.env.CI==="true",It=t=>t.isTTY===!0,w=(t,i)=>tt?t:i,Tt=w("\u25C6","*"),at=w("\u25A0","x"),ut=w("\u25B2","x"),H=w("\u25C7","o"),lt=w("\u250C","T"),$=w("\u2502","|"),x=w("\u2514","\u2014"),_t=w("\u2510","T"),xt=w("\u2518","\u2014"),z=w("\u25CF",">"),U=w("\u25CB"," "),et=w("\u25FB","[\u2022]"),K=w("\u25FC","[+]"),Y=w("\u25FB","[ ]"),Et=w("\u25AA","\u2022"),st=w("\u2500","-"),ct=w("\u256E","+"),Gt=w("\u251C","+"),$t=w("\u256F","+"),dt=w("\u2570","+"),Mt=w("\u256D","+"),ht=w("\u25CF","\u2022"),pt=w("\u25C6","*"),mt=w("\u25B2","!"),gt=w("\u25A0","x"),P=t=>{switch(t){case"initial":case"active":return e("cyan",Tt);case"cancel":return e("red",at);case"error":return e("yellow",ut);case"submit":return e("green",H)}},yt=t=>{switch(t){case"initial":case"active":return e("cyan",$);case"cancel":return e("red",$);case"error":return e("yellow",$);case"submit":return e("green",$)}},Ot=(t,i,s,r,u,n=!1)=>{let a=i,c=0;if(n)for(let o=r-1;o>=s&&(a-=t[o].length,c++,!(a<=u));o--);else for(let o=s;o<r&&(a-=t[o].length,c++,!(a<=u));o++);return{lineCount:a,removals:c}},F=({cursor:t,options:i,style:s,output:r=process.stdout,maxItems:u=Number.POSITIVE_INFINITY,columnPadding:n=0,rowPadding:a=4})=>{const c=X(r)-n,o=Lt(r),l=e("dim","..."),d=Math.max(o-a,0),g=Math.max(Math.min(u,d),5);let p=0;t>=g-3&&(p=Math.max(Math.min(t-g+3,i.length-g),0));let f=g<i.length&&p>0,h=g<i.length&&p+g<i.length;const I=Math.min(p+g,i.length),m=[];let y=0;f&&y++,h&&y++;const v=p+(f?1:0),C=I-(h?1:0);for(let b=v;b<C;b++){const G=J(s(i[b],b===t),c,{hard:!0,trim:!1}).split(`
2
+ `);m.push(G),y+=G.length}if(y>d){let b=0,G=0,M=y;const N=t-v;let O=d;const j=()=>Ot(m,M,0,N,O),k=()=>Ot(m,M,N+1,m.length,O,!0);f?({lineCount:M,removals:b}=j(),M>O&&(h||(O-=1),{lineCount:M,removals:G}=k())):(h||(O-=1),{lineCount:M,removals:G}=k(),M>O&&(O-=1,{lineCount:M,removals:b}=j())),b>0&&(f=!0,m.splice(0,b)),G>0&&(h=!0,m.splice(m.length-G,G))}const S=[];f&&S.push(l);for(const b of m)for(const G of b)S.push(G);return h&&S.push(l),S};function Pt(t){return t.label??String(t.value??"")}function Rt(t,i){if(!t)return!0;const s=(i.label??String(i.value??"")).toLowerCase(),r=(i.hint??"").toLowerCase(),u=String(i.value).toLowerCase(),n=t.toLowerCase();return s.includes(n)||r.includes(n)||u.includes(n)}function se(t,i){const s=[];for(const r of i)t.includes(r.value)&&s.push(r);return s}const At=t=>new vt({options:t.options,initialValue:t.initialValue?[t.initialValue]:void 0,initialUserInput:t.initialUserInput,placeholder:t.placeholder,filter:t.filter??((i,s)=>Rt(i,s)),signal:t.signal,input:t.input,output:t.output,validate:t.validate,render(){const i=t.withGuide??T.withGuide,s=i?[`${e("gray",$)}`,`${P(this.state)} ${t.message}`]:[`${P(this.state)} ${t.message}`],r=this.userInput,u=this.options,n=t.placeholder,a=r===""&&n!==void 0,c=(o,l)=>{const d=Pt(o),g=o.hint&&o.value===this.focusedValue?e("dim",` (${o.hint})`):"";switch(l){case"active":return`${e("green",z)} ${d}${g}`;case"inactive":return`${e("dim",U)} ${e("dim",d)}`;case"disabled":return`${e("gray",U)} ${e(["strikethrough","gray"],d)}`}};switch(this.state){case"submit":{const o=se(this.selectedValues,u),l=o.length>0?` ${e("dim",o.map(Pt).join(", "))}`:"",d=i?e("gray",$):"";return`${s.join(`
3
3
  `)}
4
- ${d}${l}`}case"cancel":{const a=i?` ${e(["strikethrough","dim"],i)}`:"",l=r?e("gray",$):"";return`${s.join(`
4
+ ${d}${l}`}case"cancel":{const o=r?` ${e(["strikethrough","dim"],r)}`:"",l=i?e("gray",$):"";return`${s.join(`
5
5
  `)}
6
- ${l}${a}`}default:{const a=this.state==="error"?"yellow":"cyan",l=r?`${e(a,$)} `:"",d=r?e(a,E):"";let y="";if(this.isNavigating||o){const v=o?n:i;y=v!==""?` ${e("dim",v)}`:""}else y=` ${this.userInputWithCursor}`;const p=this.filteredOptions.length!==u.length?e("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",m=this.filteredOptions.length===0&&i?[`${l}${e("yellow","No matches found")}`]:[],g=this.state==="error"?[`${l}${e("yellow",this.error)}`]:[];r&&s.push(`${l.trimEnd()}`),s.push(`${l}${e("dim","Search:")}${y}${p}`,...m,...g);const S=[`${e("dim","\u2191/\u2193")} to select`,`${e("dim","Enter:")} confirm`,`${e("dim","Type:")} to search`],h=[`${l}${S.join(" \u2022 ")}`,d],f=this.filteredOptions.length===0?[]:Y({cursor:this.cursor,options:this.filteredOptions,columnPadding:r?3:0,rowPadding:s.length+h.length,style:(v,T)=>c(v,v.disabled?"disabled":T?"active":"inactive"),maxItems:t.maxItems,output:t.output});return[...s,...f.map(v=>`${l}${v}`),...h].join(`
7
- `)}}}}).prompt(),ie=t=>{const r=(i,u,n,o)=>{const c=n.includes(i.value),a=i.label??String(i.value??""),l=i.hint&&o!==void 0&&i.value===o?e("dim",` (${i.hint})`):"",d=c?e("green",U):e("dim",J);return i.disabled?`${e("gray",J)} ${e(["strikethrough","gray"],a)}`:u?`${d} ${a}${l}`:`${d} ${e("dim",a)}`},s=new vt({options:t.options,multiple:!0,placeholder:t.placeholder,filter:t.filter??((i,u)=>Rt(i,u)),validate:()=>{if(t.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:t.initialValues,signal:t.signal,input:t.input,output:t.output,render(){const i=t.withGuide??_.withGuide,u=`${i?`${e("gray",$)}
8
- `:""}${M(this.state)} ${t.message}
9
- `,n=this.userInput,o=t.placeholder,c=n===""&&o!==void 0,a=this.isNavigating||c?e("dim",c?o:n):this.userInputWithCursor,l=this.options,d=this.filteredOptions.length!==l.length?e("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${u}${i?`${e("gray",$)} `:""}${e("dim",`${this.selectedValues.length} items selected`)}`;case"cancel":return`${u}${i?`${e("gray",$)} `:""}${e(["strikethrough","dim"],n)}`;default:{const y=this.state==="error"?"yellow":"cyan",p=i?`${e(y,$)} `:"",m=i?e(y,E):"",g=[`${e("dim","\u2191/\u2193")} to navigate`,`${e("dim",this.isNavigating?"Space/Tab:":"Tab:")} select`,`${e("dim","Enter:")} confirm`,`${e("dim","Type:")} to search`],S=this.filteredOptions.length===0&&n?[`${p}${e("yellow","No matches found")}`]:[],h=this.state==="error"?[`${p}${e("yellow",this.error)}`]:[],f=[...`${u}${i?e(y,$):""}`.split(`
10
- `),`${p}${e("dim","Search:")} ${a}${d}`,...S,...h],v=[`${p}${g.join(" \u2022 ")}`,m],T=Y({cursor:this.cursor,options:this.filteredOptions,style:(C,b)=>r(C,b,this.selectedValues,this.focusedValue),maxItems:t.maxItems,output:t.output,rowPadding:f.length+v.length});return[...f,...T.map(C=>`${p}${C}`),...v].join(`
11
- `)}}}});return s.prompt()},re=[Ot,ct,dt,$t],ne=[lt,It,E,Et];function Pt(t,r,s,i){let u=s,n=s;return i==="center"?u=Math.floor((r-t)/2):i==="right"&&(u=r-t-s),n=r-u-t,[u,n]}const ae=t=>t,oe=(t="",r="",s)=>{const i=s?.output??process.stdout,u=X(i),n=2,o=s?.titlePadding??1,c=s?.contentPadding??2,a=s?.width===void 0||s.width==="auto"?1:Math.min(1,s.width),l=s?.withGuide??_.withGuide?`${$} `:"",d=s?.formatBorder??ae,y=(s?.rounded?re:ne).map(d),p=d(st),m=d($),g=k(l),S=k(r),h=u-g;let f=Math.floor(u*a)-g;if(s?.width==="auto"){const P=t.split(`
12
- `);let N=S+o*2;for(const rt of P){const W=k(rt)+c*2;W>N&&(N=W)}const D=N+n;D<f&&(f=D)}f%2!==0&&(f<h?f++:f--);const v=f-n,T=v-o*2,C=S>T?`${r.slice(0,T-3)}...`:r,[b,G]=Pt(k(C),v,o,s?.titleAlign),x=q(t,v-c*2,{hard:!0,trim:!1});i.write(`${l}${y[0]}${p.repeat(b)}${C}${p.repeat(G)}${y[1]}
13
- `);const A=x.split(`
14
- `);for(const P of A){const[N,D]=Pt(k(P),v,c,s?.contentAlign);i.write(`${l}${m}${" ".repeat(N)}${P}${" ".repeat(D)}${m}
15
- `)}i.write(`${l}${y[2]}${p.repeat(v)}${y[3]}
16
- `)},ue=t=>{const r=t.active??"Yes",s=t.inactive??"No";return new Lt({active:r,inactive:s,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue??!0,render(){const i=t.withGuide??_.withGuide,u=`${M(this.state)} `,n=i?`${e("gray",$)} `:"",o=O(t.output,t.message,n,u),c=`${i?`${e("gray",$)}
17
- `:""}${o}
18
- `,a=this.value?r:s;switch(this.state){case"submit":{const l=i?`${e("gray",$)} `:"";return`${c}${l}${e("dim",a)}`}case"cancel":{const l=i?`${e("gray",$)} `:"";return`${c}${l}${e(["strikethrough","dim"],a)}${i?`
19
- ${e("gray",$)}`:""}`}default:{const l=i?`${e("cyan",$)} `:"",d=i?e("cyan",E):"";return`${c}${l}${this.value?`${e("green",z)} ${r}`:`${e("dim",H)} ${e("dim",r)}`}${t.vertical?i?`
6
+ ${l}${o}`}default:{const o=this.state==="error"?"yellow":"cyan",l=i?`${e(o,$)} `:"",d=i?e(o,x):"";let g="";if(this.isNavigating||a){const v=a?n:r;g=v!==""?` ${e("dim",v)}`:""}else g=` ${this.userInputWithCursor}`;const p=this.filteredOptions.length!==u.length?e("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",f=this.filteredOptions.length===0&&r?[`${l}${e("yellow","No matches found")}`]:[],h=this.state==="error"?[`${l}${e("yellow",this.error)}`]:[];i&&s.push(`${l.trimEnd()}`),s.push(`${l}${e("dim","Search:")}${g}${p}`,...f,...h);const I=[`${e("dim","\u2191/\u2193")} to select`,`${e("dim","Enter:")} confirm`,`${e("dim","Type:")} to search`],m=[`${l}${I.join(" \u2022 ")}`,d],y=this.filteredOptions.length===0?[]:F({cursor:this.cursor,options:this.filteredOptions,columnPadding:i?3:0,rowPadding:s.length+m.length,style:(v,C)=>c(v,v.disabled?"disabled":C?"active":"inactive"),maxItems:t.maxItems,output:t.output});return[...s,...y.map(v=>`${l}${v}`),...m].join(`
7
+ `)}}}}).prompt(),ie=t=>{const i=(r,u,n,a)=>{const c=n.includes(r.value),o=r.label??String(r.value??""),l=r.hint&&a!==void 0&&r.value===a?e("dim",` (${r.hint})`):"",d=c?e("green",K):e("dim",Y);return r.disabled?`${e("gray",Y)} ${e(["strikethrough","gray"],o)}`:u?`${d} ${o}${l}`:`${d} ${e("dim",o)}`},s=new vt({options:t.options,multiple:!0,placeholder:t.placeholder,filter:t.filter??((r,u)=>Rt(r,u)),validate:()=>{if(t.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:t.initialValues,signal:t.signal,input:t.input,output:t.output,render(){const r=t.withGuide??T.withGuide,u=`${r?`${e("gray",$)}
8
+ `:""}${P(this.state)} ${t.message}
9
+ `,n=this.userInput,a=t.placeholder,c=n===""&&a!==void 0,o=this.isNavigating||c?e("dim",c?a:n):this.userInputWithCursor,l=this.options,d=this.filteredOptions.length!==l.length?e("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${u}${r?`${e("gray",$)} `:""}${e("dim",`${this.selectedValues.length} items selected`)}`;case"cancel":return`${u}${r?`${e("gray",$)} `:""}${e(["strikethrough","dim"],n)}`;default:{const g=this.state==="error"?"yellow":"cyan",p=r?`${e(g,$)} `:"",f=r?e(g,x):"",h=[`${e("dim","\u2191/\u2193")} to navigate`,`${e("dim",this.isNavigating?"Space/Tab:":"Tab:")} select`,`${e("dim","Enter:")} confirm`,`${e("dim","Type:")} to search`],I=this.filteredOptions.length===0&&n?[`${p}${e("yellow","No matches found")}`]:[],m=this.state==="error"?[`${p}${e("yellow",this.error)}`]:[],y=[...`${u}${r?e(g,$):""}`.split(`
10
+ `),`${p}${e("dim","Search:")} ${o}${d}`,...I,...m],v=[`${p}${h.join(" \u2022 ")}`,f],C=F({cursor:this.cursor,options:this.filteredOptions,style:(S,b)=>i(S,b,this.selectedValues,this.focusedValue),maxItems:t.maxItems,output:t.output,rowPadding:y.length+v.length});return[...y,...C.map(S=>`${p}${S}`),...v].join(`
11
+ `)}}}});return s.prompt()},re=[Mt,ct,dt,$t],ne=[lt,_t,x,xt];function Vt(t,i,s,r){let u=s,n=s;return r==="center"?u=Math.floor((i-t)/2):r==="right"&&(u=i-t-s),n=i-u-t,[u,n]}const oe=t=>t,ae=(t="",i="",s)=>{const r=s?.output??process.stdout,u=X(r),n=2,a=s?.titlePadding??1,c=s?.contentPadding??2,o=s?.width===void 0||s.width==="auto"?1:Math.min(1,s.width),l=s?.withGuide??T.withGuide?`${$} `:"",d=s?.formatBorder??oe,g=(s?.rounded?re:ne).map(d),p=d(st),f=d($),h=B(l),I=B(i),m=u-h;let y=Math.floor(u*o)-h;if(s?.width==="auto"){const O=t.split(`
12
+ `);let j=I+a*2;for(const rt of O){const W=B(rt)+c*2;W>j&&(j=W)}const k=j+n;k<y&&(y=k)}y%2!==0&&(y<m?y++:y--);const v=y-n,C=v-a*2,S=I>C?`${i.slice(0,C-3)}...`:i,[b,G]=Vt(B(S),v,a,s?.titleAlign),M=J(t,v-c*2,{hard:!0,trim:!1});r.write(`${l}${g[0]}${p.repeat(b)}${S}${p.repeat(G)}${g[1]}
13
+ `);const N=M.split(`
14
+ `);for(const O of N){const[j,k]=Vt(B(O),v,c,s?.contentAlign);r.write(`${l}${f}${" ".repeat(j)}${O}${" ".repeat(k)}${f}
15
+ `)}r.write(`${l}${g[2]}${p.repeat(v)}${g[3]}
16
+ `)},ue=t=>{const i=t.active??"Yes",s=t.inactive??"No";return new Dt({active:i,inactive:s,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue??!0,render(){const r=t.withGuide??T.withGuide,u=`${P(this.state)} `,n=r?`${e("gray",$)} `:"",a=E(t.output,t.message,n,u),c=`${r?`${e("gray",$)}
17
+ `:""}${a}
18
+ `,o=this.value?i:s;switch(this.state){case"submit":{const l=r?`${e("gray",$)} `:"";return`${c}${l}${e("dim",o)}`}case"cancel":{const l=r?`${e("gray",$)} `:"";return`${c}${l}${e(["strikethrough","dim"],o)}${r?`
19
+ ${e("gray",$)}`:""}`}default:{const l=r?`${e("cyan",$)} `:"",d=r?e("cyan",x):"";return`${c}${l}${this.value?`${e("green",z)} ${i}`:`${e("dim",U)} ${e("dim",i)}`}${t.vertical?r?`
20
20
  ${e("cyan",$)} `:`
21
- `:` ${e("dim","/")} `}${this.value?`${e("dim",H)} ${e("dim",s)}`:`${e("green",z)} ${s}`}
21
+ `:` ${e("dim","/")} `}${this.value?`${e("dim",U)} ${e("dim",s)}`:`${e("green",z)} ${s}`}
22
22
  ${d}
23
- `}}}}).prompt()},le=t=>{const r=t.validate;return new Dt({...t,validate(s){if(s===void 0)return t.defaultValue!==void 0?void 0:r?r(s):_.date.messages.required;const i=u=>u.toISOString().slice(0,10);if(t.minDate&&i(s)<i(t.minDate))return _.date.messages.afterMin(t.minDate);if(t.maxDate&&i(s)>i(t.maxDate))return _.date.messages.beforeMax(t.maxDate);if(r)return r(s)},render(){const s=(t?.withGuide??_.withGuide)!==!1,i=`${`${s?`${e("gray",$)}
24
- `:""}${M(this.state)} `}${t.message}
25
- `,u=this.state!=="initial"?this.state:"active",n=ce(this,u),o=this.value instanceof Date?this.formattedValue:"";switch(this.state){case"error":{const c=this.error?` ${e("yellow",this.error)}`:"",a=s?`${e("yellow",$)} `:"",l=s?e("yellow",E):"";return`${i.trim()}
26
- ${a}${n}
23
+ `}}}}).prompt()},le=t=>{const i=t.validate;return new Wt({...t,validate(s){if(s===void 0)return t.defaultValue!==void 0?void 0:i?i(s):T.date.messages.required;const r=u=>u.toISOString().slice(0,10);if(t.minDate&&r(s)<r(t.minDate))return T.date.messages.afterMin(t.minDate);if(t.maxDate&&r(s)>r(t.maxDate))return T.date.messages.beforeMax(t.maxDate);if(i)return i(s)},render(){const s=(t?.withGuide??T.withGuide)!==!1,r=`${`${s?`${e("gray",$)}
24
+ `:""}${P(this.state)} `}${t.message}
25
+ `,u=this.state!=="initial"?this.state:"active",n=ce(this,u),a=this.value instanceof Date?this.formattedValue:"";switch(this.state){case"error":{const c=this.error?` ${e("yellow",this.error)}`:"",o=s?`${e("yellow",$)} `:"",l=s?e("yellow",x):"";return`${r.trim()}
26
+ ${o}${n}
27
27
  ${l}${c}
28
- `}case"submit":{const c=o?` ${e("dim",o)}`:"",a=s?e("gray",$):"";return`${i}${a}${c}`}case"cancel":{const c=o?` ${e(["strikethrough","dim"],o)}`:"",a=s?e("gray",$):"";return`${i}${a}${c}${o.trim()?`
29
- ${a}`:""}`}default:{const c=s?`${e("cyan",$)} `:"",a=s?e("cyan",E):"",l=s?`${e("cyan",$)} `:"",d=this.inlineError?`
30
- ${l}${e("yellow",this.inlineError)}`:"";return`${i}${c}${n}${d}
31
- ${a}
32
- `}}}}).prompt()};function ce(t,r){const s=t.segmentValues,i=t.segmentCursor;if(r==="submit"||r==="cancel")return t.formattedValue;const u=e("gray",t.separator);return t.segments.map((n,o)=>{const c=o===i.segmentIndex&&!["submit","cancel"].includes(r),a=de[n.type];return $e(s[n.type],{isActive:c,label:a})}).join(u)}function $e(t,r){const s=!t||t.replace(/_/g,"")==="";return r.isActive?e("inverse",s?r.label:t.replace(/_/g," ")):s?e("dim",r.label):t.replace(/_/g,e("dim"," "))}const de={year:"yyyy",month:"mm",day:"dd"},he=async(t,r)=>{const s={},i=Object.keys(t);for(const u of i){const n=t[u],o=await n({results:s})?.catch(c=>{throw c});if(typeof r?.onCancel=="function"&&Wt(o)){s[u]="canceled",r.onCancel({results:s});continue}s[u]=o}return s},pe=t=>{const{selectableGroups:r=!0,groupSpacing:s=0}=t,i=(n,o,c=[])=>{const a=n.label??String(n.value),l=typeof n.group=="string",d=l&&(c[c.indexOf(n)+1]??{group:!0}),y=l&&d&&d.group===!0,p=l?r?`${y?E:$} `:" ":"";let m="";if(s>0&&!l){const S=`
33
- ${e("cyan",$)}`;m=`${S.repeat(s-1)}${S} `}if(o==="active")return`${m}${e("dim",p)}${e("cyan",et)} ${a}${n.hint?` ${e("dim",`(${n.hint})`)}`:""}`;if(o==="group-active")return`${m}${p}${e("cyan",et)} ${e("dim",a)}`;if(o==="group-active-selected")return`${m}${p}${e("green",U)} ${e("dim",a)}`;if(o==="selected"){const S=l||r?e("green",U):"";return`${m}${e("dim",p)}${S} ${e("dim",a)}${n.hint?` ${e("dim",`(${n.hint})`)}`:""}`}if(o==="cancelled")return`${e(["strikethrough","dim"],a)}`;if(o==="active-selected")return`${m}${e("dim",p)}${e("green",U)} ${a}${n.hint?` ${e("dim",`(${n.hint})`)}`:""}`;if(o==="submitted")return`${e("dim",a)}`;const g=l||r?e("dim",J):"";return`${m}${e("dim",p)}${g} ${e("dim",a)}`},u=t.required??!0;return new Ft({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValues:t.initialValues,required:u,cursorAt:t.cursorAt,selectableGroups:r,validate(n){if(u&&(n===void 0||n.length===0))return`Please select at least one option.
34
- ${e("reset",e("dim",`Press ${e(["gray","bgWhite","inverse"]," space ")} to select, ${e("gray",e(["bgWhite","inverse"]," enter "))} to submit`))}`},render(){const n=t.withGuide??_.withGuide,o=`${n?`${e("gray",$)}
35
- `:""}${M(this.state)} ${t.message}
36
- `,c=this.value??[];switch(this.state){case"submit":{const a=this.options.filter(({value:d})=>c.includes(d)).map(d=>i(d,"submitted")),l=a.length===0?"":` ${a.join(e("dim",", "))}`;return`${o}${n?e("gray",$):""}${l}`}case"cancel":{const a=this.options.filter(({value:l})=>c.includes(l)).map(l=>i(l,"cancelled")).join(e("dim",", "));return`${o}${n?`${e("gray",$)} `:""}${a.trim()?`${a}${n?`
37
- ${e("gray",$)}`:""}`:""}`}case"error":{const a=this.error.split(`
38
- `).map((l,d)=>d===0?`${n?`${e("yellow",E)} `:""}${e("yellow",l)}`:` ${l}`).join(`
39
- `);return`${o}${n?`${e("yellow",$)} `:""}${this.options.map((l,d,y)=>{const p=c.includes(l.value)||l.group===!0&&this.isGroupSelected(`${l.value}`),m=d===this.cursor;return!m&&typeof l.group=="string"&&this.options[this.cursor].value===l.group?i(l,p?"group-active-selected":"group-active",y):m&&p?i(l,"active-selected",y):p?i(l,"selected",y):i(l,m?"active":"inactive",y)}).join(`
40
- ${n?`${e("yellow",$)} `:""}`)}
41
- ${a}
42
- `}default:{const a=this.options.map((d,y,p)=>{const m=c.includes(d.value)||d.group===!0&&this.isGroupSelected(`${d.value}`),g=y===this.cursor,S=!g&&typeof d.group=="string"&&this.options[this.cursor].value===d.group;let h="";return S?h=i(d,m?"group-active-selected":"group-active",p):g&&m?h=i(d,"active-selected",p):m?h=i(d,"selected",p):h=i(d,g?"active":"inactive",p),`${y!==0&&!h.startsWith(`
43
- `)?" ":""}${h}`}).join(`
44
- ${n?e("cyan",$):""}`),l=a.startsWith(`
45
- `)?"":" ";return`${o}${n?e("cyan",$):""}${l}${a}
46
- ${n?e("cyan",E):""}
47
- `}}}}).prompt()},R={message:(t=[],{symbol:r=e("gray",$),secondarySymbol:s=e("gray",$),output:i=process.stdout,spacing:u=1,withGuide:n}={})=>{const o=[],c=n??_.withGuide,a=c?s:"",l=c?`${r} `:"",d=c?`${s} `:"";for(let p=0;p<u;p++)o.push(a);const y=Array.isArray(t)?t:t.split(`
48
- `);if(y.length>0){const[p,...m]=y;p.length>0?o.push(`${l}${p}`):o.push(c?r:"");for(const g of m)g.length>0?o.push(`${d}${g}`):o.push(c?s:"")}i.write(`${o.join(`
28
+ `}case"submit":{const c=a?` ${e("dim",a)}`:"",o=s?e("gray",$):"";return`${r}${o}${c}`}case"cancel":{const c=a?` ${e(["strikethrough","dim"],a)}`:"",o=s?e("gray",$):"";return`${r}${o}${c}${a.trim()?`
29
+ ${o}`:""}`}default:{const c=s?`${e("cyan",$)} `:"",o=s?e("cyan",x):"",l=s?`${e("cyan",$)} `:"",d=this.inlineError?`
30
+ ${l}${e("yellow",this.inlineError)}`:"";return`${r}${c}${n}${d}
31
+ ${o}
32
+ `}}}}).prompt()};function ce(t,i){const s=t.segmentValues,r=t.segmentCursor;if(i==="submit"||i==="cancel")return t.formattedValue;const u=e("gray",t.separator);return t.segments.map((n,a)=>{const c=a===r.segmentIndex&&!["submit","cancel"].includes(i),o=de[n.type];return $e(s[n.type],{isActive:c,label:o})}).join(u)}function $e(t,i){const s=!t||t.replace(/_/g,"")==="";return i.isActive?e("inverse",s?i.label:t.replace(/_/g," ")):s?e("dim",i.label):t.replace(/_/g,e("dim"," "))}const de={year:"yyyy",month:"mm",day:"dd"},he=async(t,i)=>{const s={},r=Object.keys(t);for(const u of r){const n=t[u],a=await n({results:s})?.catch(c=>{throw c});if(typeof i?.onCancel=="function"&&Ft(a)){s[u]="canceled",i.onCancel({results:s});continue}s[u]=a}return s},pe=t=>{const{selectableGroups:i=!0,groupSpacing:s=0}=t,r=(n,a,c=[])=>{const o=n.label??String(n.value),l=typeof n.group=="string",d=l&&(c[c.indexOf(n)+1]??{group:!0}),g=l&&d&&d.group===!0;let p="",f="";l&&(i?(p=g?`${x} `:`${$} `,f=g?" ":`${$} `):p=" ");let h="";if(s>0&&!l&&(h=`
33
+ `.repeat(s)),a==="active")return E(t.output,`${o}${n.hint?` ${e("dim",`(${n.hint})`)}`:""}`,`${h}${e("dim",p)} `,`${h}${e("dim",p)}${e("cyan",et)} `,`${h}${e("dim",f)} `);if(a==="group-active")return E(t.output,o,`${h}${p} `,`${h}${p}${e("cyan",et)} `,`${h}${f} `,m=>e("dim",m));if(a==="group-active-selected")return E(t.output,o,`${h}${p} `,`${h}${p}${e("green",K)} `,`${h}${f} `,m=>e("dim",m));if(a==="selected"){const m=l||i?e("green",K):"";return E(t.output,`${o}${n.hint?` (${n.hint})`:""}`,`${h}${e("dim",p)} `,`${h}${e("dim",p)}${m} `,`${h}${e("dim",f)} `,y=>e("dim",y))}if(a==="cancelled")return`${e(["strikethrough","dim"],o)}`;if(a==="active-selected")return E(t.output,`${o}${n.hint?` ${e("dim",`(${n.hint})`)}`:""}`,`${h}${e("dim",p)} `,`${h}${e("dim",p)}${e("green",K)} `,`${h}${e("dim",f)} `);if(a==="submitted")return`${e("dim",o)}`;const I=l||i?e("dim",Y):"";return E(t.output,o,`${h}${e("dim",p)} `,`${h}${e("dim",p)}${I} `,`${h}${e("dim",f)} `,m=>e("dim",m))},u=t.required??!0;return new Ht({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValues:t.initialValues,required:u,cursorAt:t.cursorAt,selectableGroups:i,validate(n){if(u&&(n===void 0||n.length===0))return`Please select at least one option.
34
+ ${e("reset",e("dim",`Press ${e(["gray","bgWhite","inverse"]," space ")} to select, ${e("gray",e(["bgWhite","inverse"]," enter "))} to submit`))}`},render(){const n=t.withGuide??T.withGuide,a=`${n?`${e("gray",$)}
35
+ `:""}${P(this.state)} ${t.message}
36
+ `,c=this.value??[],o=(l,d)=>{const g=this.options,p=c.includes(l.value)||l.group===!0&&this.isGroupSelected(`${l.value}`);return!d&&typeof l.group=="string"&&this.options[this.cursor].value===l.group?r(l,p?"group-active-selected":"group-active",g):d&&p?r(l,"active-selected",g):p?r(l,"selected",g):r(l,d?"active":"inactive",g)};switch(this.state){case"submit":{const l=this.options.filter(({value:g})=>c.includes(g)).map(g=>r(g,"submitted")),d=l.length===0?"":` ${l.join(e("dim",", "))}`;return`${a}${n?e("gray",$):""}${d}`}case"cancel":{const l=this.options.filter(({value:d})=>c.includes(d)).map(d=>r(d,"cancelled")).join(e("dim",", "));return`${a}${n?`${e("gray",$)} `:""}${l.trim()?`${l}${n?`
37
+ ${e("gray",$)}`:""}`:""}`}case"error":{const l=n?`${e("yellow",$)} `:"",d=this.error.split(`
38
+ `).map((h,I)=>I===0?`${n?`${e("yellow",x)} `:""}${e("yellow",h)}`:` ${h}`).join(`
39
+ `),g=a.split(`
40
+ `).length,p=d.split(`
41
+ `).length+1,f=F({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:l.length,rowPadding:g+p,style:o}).join(`
42
+ ${l}`);return`${a}${l}${f}
43
+ ${d}
44
+ `}default:{const l=n?`${e("cyan",$)} `:"",d=a.split(`
45
+ `).length,g=(n?1:0)+1,p=F({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:l.length,rowPadding:d+g,style:o}).join(`
46
+ ${l}`);return`${a}${l}${p}
47
+ ${n?e("cyan",x):""}
48
+ `}}}}).prompt()},R={message:(t=[],{symbol:i=e("gray",$),secondarySymbol:s=e("gray",$),output:r=process.stdout,spacing:u=1,withGuide:n}={})=>{const a=[],c=n??T.withGuide,o=c?s:"",l=c?`${i} `:"",d=c?`${s} `:"";for(let p=0;p<u;p++)a.push(o);const g=Array.isArray(t)?t:t.split(`
49
+ `);if(g.length>0){const[p,...f]=g;p.length>0?a.push(`${l}${p}`):a.push(c?i:"");for(const h of f)h.length>0?a.push(`${d}${h}`):a.push(c?s:"")}r.write(`${a.join(`
49
50
  `)}
50
- `)},info:(t,r)=>{R.message(t,{...r,symbol:e("blue",ht)})},success:(t,r)=>{R.message(t,{...r,symbol:e("green",pt)})},step:(t,r)=>{R.message(t,{...r,symbol:e("green",F)})},warn:(t,r)=>{R.message(t,{...r,symbol:e("yellow",mt)})},warning:(t,r)=>{R.warn(t,r)},error:(t,r)=>{R.message(t,{...r,symbol:e("red",gt)})}},me=(t="",r)=>{const s=r?.output??process.stdout,i=r?.withGuide??_.withGuide?`${e("gray",E)} `:"";s.write(`${i}${e("red",t)}
51
+ `)},info:(t,i)=>{R.message(t,{...i,symbol:e("blue",ht)})},success:(t,i)=>{R.message(t,{...i,symbol:e("green",pt)})},step:(t,i)=>{R.message(t,{...i,symbol:e("green",H)})},warn:(t,i)=>{R.message(t,{...i,symbol:e("yellow",mt)})},warning:(t,i)=>{R.warn(t,i)},error:(t,i)=>{R.message(t,{...i,symbol:e("red",gt)})}},me=(t="",i)=>{const s=i?.output??process.stdout,r=i?.withGuide??T.withGuide?`${e("gray",x)} `:"";s.write(`${r}${e("red",t)}
51
52
 
52
- `)},ge=(t="",r)=>{const s=r?.output??process.stdout,i=r?.withGuide??_.withGuide?`${e("gray",lt)} `:"";s.write(`${i}${t}
53
- `)},ye=(t="",r)=>{const s=r?.output??process.stdout,i=r?.withGuide??_.withGuide?`${e("gray",$)}
54
- ${e("gray",E)} `:"";s.write(`${i}${t}
53
+ `)},ge=(t="",i)=>{const s=i?.output??process.stdout,r=i?.withGuide??T.withGuide?`${e("gray",lt)} `:"";s.write(`${r}${t}
54
+ `)},ye=(t="",i)=>{const s=i?.output??process.stdout,r=i?.withGuide??T.withGuide?`${e("gray",$)}
55
+ ${e("gray",x)} `:"";s.write(`${r}${t}
55
56
 
56
- `)},fe=t=>new Ht({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,showSubmit:t.showSubmit,output:t.output,signal:t.signal,input:t.input,render(){const r=t?.withGuide??_.withGuide,s=`${`${r?`${e("gray",$)}
57
- `:""}${M(this.state)} `}${t.message}
58
- `,i=t.placeholder?e("inverse",t.placeholder[0])+e("dim",t.placeholder.slice(1)):e(["inverse","hidden"],"_"),u=this.userInput?this.userInputWithCursor:i,n=this.value??"",o=t.showSubmit?`
59
- ${e(this.focused==="submit"?"cyan":"dim","[ submit ]")}`:"";switch(this.state){case"error":{const c=`${e("yellow",$)} `,a=r?O(t.output,u,c,void 0):u,l=e("yellow",E);return`${s}${a}
60
- ${l} ${e("yellow",this.error)}${o}
61
- `}case"submit":{const c=`${e("gray",$)} `,a=r?O(t.output,n,c,void 0,l=>e("dim",l)):n?e("dim",n):"";return`${s}${a}`}case"cancel":{const c=`${e("gray",$)} `,a=r?O(t.output,n,c,void 0,l=>e(["strikethrough","dim"],l)):n?e(["strikethrough","dim"],n):"";return`${s}${a}`}default:{const c=r?`${e("cyan",$)} `:"",a=r?e("cyan",E):"",l=r?O(t.output,u,c):u;return`${s}${l}
62
- ${a}${o}
63
- `}}}}).prompt(),Q=(t,r)=>t.split(`
64
- `).map(s=>r(s)).join(`
65
- `),ve=t=>{const r=(i,u)=>{const n=i.label??String(i.value);return u==="disabled"?`${e("gray",J)} ${Q(n,o=>e(["strikethrough","gray"],o))}${i.hint?` ${e("dim",`(${i.hint??"disabled"})`)}`:""}`:u==="active"?`${e("cyan",et)} ${n}${i.hint?` ${e("dim",`(${i.hint})`)}`:""}`:u==="selected"?`${e("green",U)} ${Q(n,o=>e("dim",o))}${i.hint?` ${e("dim",`(${i.hint})`)}`:""}`:u==="cancelled"?`${Q(n,o=>e(["strikethrough","dim"],o))}`:u==="active-selected"?`${e("green",U)} ${n}${i.hint?` ${e("dim",`(${i.hint})`)}`:""}`:u==="submitted"?`${Q(n,o=>e("dim",o))}`:`${e("dim",J)} ${Q(n,o=>e("dim",o))}`},s=t.required??!0;return new Ut({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValues:t.initialValues,required:s,cursorAt:t.cursorAt,validate(i){if(s&&(i===void 0||i.length===0))return`Please select at least one option.
66
- ${e("reset",e("dim",`Press ${e(["gray","bgWhite","inverse"]," space ")} to select, ${e("gray",e("bgWhite",e("inverse"," enter ")))} to submit`))}`},render(){const i=t.withGuide??_.withGuide,u=O(t.output,t.message,i?`${yt(this.state)} `:"",`${M(this.state)} `),n=`${i?`${e("gray",$)}
57
+ `)},fe=t=>new Ut({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,showSubmit:t.showSubmit,output:t.output,signal:t.signal,input:t.input,render(){const i=t?.withGuide??T.withGuide,s=`${`${i?`${e("gray",$)}
58
+ `:""}${P(this.state)} `}${t.message}
59
+ `,r=t.placeholder?e("inverse",t.placeholder[0])+e("dim",t.placeholder.slice(1)):e(["inverse","hidden"],"_"),u=this.userInput?this.userInputWithCursor:r,n=this.value??"",a=t.showSubmit?`
60
+ ${e(this.focused==="submit"?"cyan":"dim","[ submit ]")}`:"";switch(this.state){case"error":{const c=`${e("yellow",$)} `,o=i?E(t.output,u,c,void 0):u,l=e("yellow",x);return`${s}${o}
61
+ ${l} ${e("yellow",this.error)}${a}
62
+ `}case"submit":{const c=`${e("gray",$)} `,o=i?E(t.output,n,c,void 0,void 0,l=>e("dim",l)):n?e("dim",n):"";return`${s}${o}`}case"cancel":{const c=`${e("gray",$)} `,o=i?E(t.output,n,c,void 0,void 0,l=>e(["strikethrough","dim"],l)):n?e(["strikethrough","dim"],n):"";return`${s}${o}`}default:{const c=i?`${e("cyan",$)} `:"",o=i?e("cyan",x):"",l=i?E(t.output,u,c):u;return`${s}${l}
63
+ ${o}${a}
64
+ `}}}}).prompt(),Q=(t,i)=>t.split(`
65
+ `).map(s=>i(s)).join(`
66
+ `),ve=t=>{const i=(r,u)=>{const n=r.label??String(r.value);return u==="disabled"?`${e("gray",Y)} ${Q(n,a=>e(["strikethrough","gray"],a))}${r.hint?` ${e("dim",`(${r.hint??"disabled"})`)}`:""}`:u==="active"?`${e("cyan",et)} ${n}${r.hint?` ${e("dim",`(${r.hint})`)}`:""}`:u==="selected"?`${e("green",K)} ${Q(n,a=>e("dim",a))}${r.hint?` ${e("dim",`(${r.hint})`)}`:""}`:u==="cancelled"?`${Q(n,a=>e(["strikethrough","dim"],a))}`:u==="active-selected"?`${e("green",K)} ${n}${r.hint?` ${e("dim",`(${r.hint})`)}`:""}`:u==="submitted"?`${Q(n,a=>e("dim",a))}`:`${e("dim",Y)} ${Q(n,a=>e("dim",a))}`},s=t.required??!0;return new Kt({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValues:t.initialValues,required:s,cursorAt:t.cursorAt,validate(r){if(s&&(r===void 0||r.length===0))return`Please select at least one option.
67
+ ${e("reset",e("dim",`Press ${e(["gray","bgWhite","inverse"]," space ")} to select, ${e("gray",e("bgWhite",e("inverse"," enter ")))} to submit`))}`},render(){const r=t.withGuide??T.withGuide,u=E(t.output,t.message,r?`${yt(this.state)} `:"",`${P(this.state)} `),n=`${r?`${e("gray",$)}
67
68
  `:""}${u}
68
- `,o=this.value??[],c=(a,l)=>{if(a.disabled)return r(a,"disabled");const d=o.includes(a.value);return l&&d?r(a,"active-selected"):d?r(a,"selected"):r(a,l?"active":"inactive")};switch(this.state){case"submit":{const a=this.options.filter(({value:d})=>o.includes(d)).map(d=>r(d,"submitted")).join(e("dim",", "))||e("dim","none"),l=O(t.output,a,i?`${e("gray",$)} `:"");return`${n}${l}`}case"cancel":{const a=this.options.filter(({value:d})=>o.includes(d)).map(d=>r(d,"cancelled")).join(e("dim",", "));if(a.trim()==="")return`${n}${e("gray",$)}`;const l=O(t.output,a,i?`${e("gray",$)} `:"");return`${n}${l}${i?`
69
- ${e("gray",$)}`:""}`}case"error":{const a=i?`${e("yellow",$)} `:"",l=this.error.split(`
70
- `).map((p,m)=>m===0?`${i?`${e("yellow",E)} `:""}${e("yellow",p)}`:` ${p}`).join(`
69
+ `,a=this.value??[],c=(o,l)=>{if(o.disabled)return i(o,"disabled");const d=a.includes(o.value);return l&&d?i(o,"active-selected"):d?i(o,"selected"):i(o,l?"active":"inactive")};switch(this.state){case"submit":{const o=this.options.filter(({value:d})=>a.includes(d)).map(d=>i(d,"submitted")).join(e("dim",", "))||e("dim","none"),l=E(t.output,o,r?`${e("gray",$)} `:"");return`${n}${l}`}case"cancel":{const o=this.options.filter(({value:d})=>a.includes(d)).map(d=>i(d,"cancelled")).join(e("dim",", "));if(o.trim()==="")return`${n}${e("gray",$)}`;const l=E(t.output,o,r?`${e("gray",$)} `:"");return`${n}${l}${r?`
70
+ ${e("gray",$)}`:""}`}case"error":{const o=r?`${e("yellow",$)} `:"",l=this.error.split(`
71
+ `).map((p,f)=>f===0?`${r?`${e("yellow",x)} `:""}${e("yellow",p)}`:` ${p}`).join(`
71
72
  `),d=n.split(`
72
- `).length,y=l.split(`
73
- `).length+1;return`${n}${a}${Y({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:a.length,rowPadding:d+y,style:c}).join(`
74
- ${a}`)}
73
+ `).length,g=l.split(`
74
+ `).length+1;return`${n}${o}${F({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:o.length,rowPadding:d+g,style:c}).join(`
75
+ ${o}`)}
75
76
  ${l}
76
- `}default:{const a=i?`${e("cyan",$)} `:"",l=n.split(`
77
- `).length,d=i?2:1;return`${n}${a}${Y({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:a.length,rowPadding:l+d,style:c}).join(`
78
- ${a}`)}
79
- ${i?e("cyan",E):""}
80
- `}}}}).prompt()},we=t=>e("dim",t),be=(t,r,s)=>{const i={hard:!0,trim:!1},u=q(t,r,i).split(`
81
- `),n=u.reduce((a,l)=>Math.max(k(l),a),0),o=u.map(s).reduce((a,l)=>Math.max(k(l),a),0),c=r-(o-n);return q(t,c,i)},Se=(t="",r="",s)=>{const i=s?.output??j.stdout,u=s?.withGuide??_.withGuide,n=s?.format??we,o=["",...be(t,X(i)-6,n).split(`
82
- `).map(n),""],c=k(r),a=Math.max(o.reduce((p,m)=>{const g=k(m);return g>p?g:p},0),c)+2,l=o.map(p=>`${e("gray",$)} ${p}${" ".repeat(a-k(p))}${e("gray",$)}`).join(`
77
+ `}default:{const o=r?`${e("cyan",$)} `:"",l=n.split(`
78
+ `).length,d=r?2:1;return`${n}${o}${F({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:o.length,rowPadding:l+d,style:c}).join(`
79
+ ${o}`)}
80
+ ${r?e("cyan",x):""}
81
+ `}}}}).prompt()},we=t=>e("dim",t),be=(t,i,s)=>{const r={hard:!0,trim:!1},u=J(t,i,r).split(`
82
+ `),n=u.reduce((o,l)=>Math.max(B(l),o),0),a=u.map(s).reduce((o,l)=>Math.max(B(l),o),0),c=i-(a-n);return J(t,c,r)},Se=(t="",i="",s)=>{const r=s?.output??V.stdout,u=s?.withGuide??T.withGuide,n=s?.format??we,a=["",...be(t,X(r)-6,n).split(`
83
+ `).map(n),""],c=B(i),o=Math.max(a.reduce((p,f)=>{const h=B(f);return h>p?h:p},0),c)+2,l=a.map(p=>`${e("gray",$)} ${p}${" ".repeat(o-B(p))}${e("gray",$)}`).join(`
83
84
  `),d=u?`${e("gray",$)}
84
- `:"",y=u?xt:dt;i.write(`${d}${e("green",F)} ${e("reset",r)} ${e("gray",st.repeat(Math.max(a-c-1,1))+ct)}
85
+ `:"",g=u?Gt:dt;r.write(`${d}${e("green",H)} ${e("reset",i)} ${e("gray",st.repeat(Math.max(o-c-1,1))+ct)}
85
86
  ${l}
86
- ${e("gray",y+st.repeat(a+2)+$t)}
87
- `)},Ce=t=>new Kt({validate:t.validate,mask:t.mask??Gt,signal:t.signal,input:t.input,output:t.output,render(){const r=t.withGuide??_.withGuide,s=`${r?`${e("gray",$)}
88
- `:""}${M(this.state)} ${t.message}
89
- `,i=this.userInputWithCursor,u=this.masked;switch(this.state){case"error":{const n=r?`${e("yellow",$)} `:"",o=r?`${e("yellow",E)} `:"",c=u??"";return t.clearOnError&&this.clear(),`${s.trim()}
87
+ ${e("gray",g+st.repeat(o+2)+$t)}
88
+ `)},Ce=t=>new qt({validate:t.validate,mask:t.mask??Et,signal:t.signal,input:t.input,output:t.output,render(){const i=t.withGuide??T.withGuide,s=`${i?`${e("gray",$)}
89
+ `:""}${P(this.state)} ${t.message}
90
+ `,r=this.userInputWithCursor,u=this.masked;switch(this.state){case"error":{const n=i?`${e("yellow",$)} `:"",a=i?`${e("yellow",x)} `:"",c=u??"";return t.clearOnError&&this.clear(),`${s.trim()}
90
91
  ${n}${c}
91
- ${o}${e("yellow",this.error)}
92
- `}case"submit":{const n=r?`${e("gray",$)} `:"",o=u?e("dim",u):"";return`${s}${n}${o}`}case"cancel":{const n=r?`${e("gray",$)} `:"",o=u?e(["strikethrough","dim"],u):"";return`${s}${n}${o}${u&&r?`
93
- ${e("gray",$)}`:""}`}default:{const n=r?`${e("cyan",$)} `:"",o=r?e("cyan",E):"";return`${s}${n}${i}
94
- ${o}
95
- `}}}}).prompt(),Te=t=>{const r=t.validate;return At({...t,initialUserInput:t.initialValue??t.root??process.cwd(),maxItems:5,validate(s){if(!Array.isArray(s)){if(!s)return"Please select a path";if(r)return r(s)}},options(){const s=this.userInput;if(s==="")return[];try{let i;zt(s)?wt(s).isDirectory()&&(!t.directory||s.endsWith("/"))?i=s:i=bt(s):i=bt(s);const u=s.length>1&&s.endsWith("/")?s.slice(0,-1):s;return Qt(i).map(n=>{const o=Zt(i,n),c=wt(o);return{name:n,path:o,isDirectory:c.isDirectory()}}).filter(({path:n,isDirectory:o})=>n.startsWith(u)&&(o||!t.directory)).map(n=>({value:n.path}))}catch{return[]}}})},_e=t=>e("magenta",t),ft=({indicator:t="dots",onCancel:r,output:s=process.stdout,cancelMessage:i,errorMessage:u,frames:n=tt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:o=tt?80:120,signal:c,...a}={})=>{const l=at();let d,y,p=!1,m=!1,g="",S,h=performance.now();const f=X(s),v=a?.styleFrame??_e,T=I=>{const V=I>1?u??_.messages.error:i??_.messages.cancel;m=I===1,p&&(W(V,I),m&&typeof r=="function"&&r())},C=()=>T(2),b=()=>T(1),G=()=>{process.on("uncaughtExceptionMonitor",C),process.on("unhandledRejection",C),process.on("SIGINT",b),process.on("SIGTERM",b),process.on("exit",T),c&&c.addEventListener("abort",b)},x=()=>{process.removeListener("uncaughtExceptionMonitor",C),process.removeListener("unhandledRejection",C),process.removeListener("SIGINT",b),process.removeListener("SIGTERM",b),process.removeListener("exit",T),c&&c.removeEventListener("abort",b)},A=()=>{if(S===void 0)return;l&&s.write(`
96
- `);const I=q(S,f,{hard:!0,trim:!1}).split(`
97
- `);I.length>1&&s.write(St.up(I.length-1)),s.write(St.to(0)),s.write(Ct.down())},P=I=>I.replace(/\.+$/,""),N=I=>{const V=(performance.now()-I)/1e3,B=Math.floor(V/60),L=Math.floor(V%60);return B>0?`[${B}m ${L}s]`:`[${L}s]`},D=a.withGuide??_.withGuide,rt=(I="")=>{p=!0,d=qt({output:s}),g=P(I),h=performance.now(),D&&s.write(`${e("gray",$)}
98
- `);let V=0,B=0;G(),y=setInterval(()=>{if(l&&g===S)return;A(),S=g;const L=v(n[V]);let Z;if(l)Z=`${L} ${g}...`;else if(t==="timer")Z=`${L} ${g} ${N(h)}`;else{const kt=".".repeat(Math.floor(B)).slice(0,3);Z=`${L} ${g}${kt}`}const Nt=q(Z,f,{hard:!0,trim:!1});s.write(Nt),V=V+1<n.length?V+1:0,B=B<4?B+.125:0},o)},W=(I="",V=0,B=!1)=>{if(!p)return;p=!1,clearInterval(y),A();const L=V===0?e("green",F):V===1?e("red",ot):e("red",ut);g=I??g,B||(t==="timer"?s.write(`${L} ${g} ${N(h)}
99
- `):s.write(`${L} ${g}
100
- `)),x(),d()};return{start:rt,stop:(I="")=>W(I,0),message:(I="")=>{g=P(I??g)},cancel:(I="")=>W(I,1),error:(I="")=>W(I,2),clear:()=>W("",0,!0),get isCancelled(){return m}}},Vt={light:w("\u2500","-"),heavy:w("\u2501","="),block:w("\u2588","#")};function Ie({style:t="heavy",max:r=100,size:s=40,...i}={}){const u=ft(i);let n=0,o="";const c=Math.max(1,r),a=Math.max(1,s),l=m=>{switch(m){case"initial":case"active":return g=>e("magenta",g);case"error":case"cancel":return g=>e("red",g);case"submit":return g=>e("green",g);default:return g=>e("magenta",g)}},d=(m,g)=>{const S=Math.floor(n/c*a);return`${l(m)(Vt[t].repeat(S))}${e("dim",Vt[t].repeat(a-S))} ${g}`},y=(m="")=>{o=m,u.start(d("initial",m))},p=(m=1,g)=>{n=Math.min(c,m+n),u.message(d("active",g??o)),o=g??o};return{start:y,stop:u.stop,cancel:u.cancel,error:u.error,clear:u.clear,advance:p,isCancelled:u.isCancelled,message:m=>p(0,m)}}const it=(t,r)=>t.includes(`
92
+ ${a}${e("yellow",this.error)}
93
+ `}case"submit":{const n=i?`${e("gray",$)} `:"",a=u?e("dim",u):"";return`${s}${n}${a}`}case"cancel":{const n=i?`${e("gray",$)} `:"",a=u?e(["strikethrough","dim"],u):"";return`${s}${n}${a}${u&&i?`
94
+ ${e("gray",$)}`:""}`}default:{const n=i?`${e("cyan",$)} `:"",a=i?e("cyan",x):"";return`${s}${n}${r}
95
+ ${a}
96
+ `}}}}).prompt(),Ie=t=>{const i=t.validate;return At({...t,initialUserInput:t.initialValue??t.root??process.cwd(),maxItems:5,validate(s){if(!Array.isArray(s)){if(!s)return"Please select a path";if(i)return i(s)}},options(){const s=this.userInput;if(s==="")return[];try{let r;Qt(s)?wt(s).isDirectory()&&(!t.directory||s.endsWith("/"))?r=s:r=bt(s):r=bt(s);const u=s.length>1&&s.endsWith("/")?s.slice(0,-1):s;return Zt(r).map(n=>{const a=te(r,n),c=wt(a);return{name:n,path:a,isDirectory:c.isDirectory()}}).filter(({path:n,isDirectory:a})=>n.startsWith(u)&&(a||!t.directory)).map(n=>({value:n.path}))}catch{return[]}}})},Te=t=>e("magenta",t),ft=({indicator:t="dots",onCancel:i,output:s=process.stdout,cancelMessage:r,errorMessage:u,frames:n=tt?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:a=tt?80:120,signal:c,...o}={})=>{const l=ot();let d,g,p=!1,f=!1,h="",I,m=performance.now();const y=X(s),v=o?.styleFrame??Te,C=_=>{const A=_>1?u??T.messages.error:r??T.messages.cancel;f=_===1,p&&(W(A,_),f&&typeof i=="function"&&i())},S=()=>C(2),b=()=>C(1),G=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",b),process.on("SIGTERM",b),process.on("exit",C),c&&c.addEventListener("abort",b)},M=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",b),process.removeListener("SIGTERM",b),process.removeListener("exit",C),c&&c.removeEventListener("abort",b)},N=()=>{if(I===void 0)return;l&&s.write(`
97
+ `);const _=J(I,y,{hard:!0,trim:!1}).split(`
98
+ `);_.length>1&&s.write(St.up(_.length-1)),s.write(St.to(0)),s.write(Ct.down())},O=_=>_.replace(/\.+$/,""),j=_=>{const A=(performance.now()-_)/1e3,L=Math.floor(A/60),D=Math.floor(A%60);return L>0?`[${L}m ${D}s]`:`[${D}s]`},k=o.withGuide??T.withGuide,rt=(_="")=>{p=!0,d=Jt({output:s}),h=O(_),m=performance.now(),k&&s.write(`${e("gray",$)}
99
+ `);let A=0,L=0;G(),g=setInterval(()=>{if(l&&h===I)return;N(),I=h;const D=v(n[A]);let Z;if(l)Z=`${D} ${h}...`;else if(t==="timer")Z=`${D} ${h} ${j(m)}`;else{const kt=".".repeat(Math.floor(L)).slice(0,3);Z=`${D} ${h}${kt}`}const Bt=J(Z,y,{hard:!0,trim:!1});s.write(Bt),A=A+1<n.length?A+1:0,L=L<4?L+.125:0},a)},W=(_="",A=0,L=!1)=>{if(!p)return;p=!1,clearInterval(g),N();const D=A===0?e("green",H):A===1?e("red",at):e("red",ut);h=_??h,L||(t==="timer"?s.write(`${D} ${h} ${j(m)}
100
+ `):s.write(`${D} ${h}
101
+ `)),M(),d()};return{start:rt,stop:(_="")=>W(_,0),message:(_="")=>{h=O(_??h)},cancel:(_="")=>W(_,1),error:(_="")=>W(_,2),clear:()=>W("",0,!0),get isCancelled(){return f}}},jt={light:w("\u2500","-"),heavy:w("\u2501","="),block:w("\u2588","#")};function _e({style:t="heavy",max:i=100,size:s=40,...r}={}){const u=ft(r);let n=0,a="";const c=Math.max(1,i),o=Math.max(1,s),l=f=>{switch(f){case"initial":case"active":return h=>e("magenta",h);case"error":case"cancel":return h=>e("red",h);case"submit":return h=>e("green",h);default:return h=>e("magenta",h)}},d=(f,h)=>{const I=Math.floor(n/c*o);return`${l(f)(jt[t].repeat(I))}${e("dim",jt[t].repeat(o-I))} ${h}`},g=(f="")=>{a=f,u.start(d("initial",f))},p=(f=1,h)=>{n=Math.min(c,f+n),u.message(d("active",h??a)),a=h??a};return{start:g,stop:u.stop,cancel:u.cancel,error:u.error,clear:u.clear,advance:p,isCancelled:u.isCancelled,message:f=>p(0,f)}}const it=(t,i)=>t.includes(`
101
102
  `)?t.split(`
102
- `).map(s=>r(s)).join(`
103
- `):r(t),Ee=t=>{const r=(s,i)=>{const u=s.label??String(s.value);switch(i){case"disabled":return`${e("gray",H)} ${it(u,n=>e("gray",n))}${s.hint?` ${e("dim",`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${it(u,n=>e("dim",n))}`;case"active":return`${e("green",z)} ${u}${s.hint?` ${e("dim",`(${s.hint})`)}`:""}`;case"cancelled":return`${it(u,n=>e(["strikethrough","dim"],n))}`;default:return`${e("dim",H)} ${it(u,n=>e("dim",n))}`}};return new Jt({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){const s=t.withGuide??_.withGuide,i=`${M(this.state)} `,u=`${yt(this.state)} `,n=O(t.output,t.message,u,i),o=`${s?`${e("gray",$)}
103
+ `).map(s=>i(s)).join(`
104
+ `):i(t),xe=t=>{const i=(s,r)=>{const u=s.label??String(s.value);switch(r){case"disabled":return`${e("gray",U)} ${it(u,n=>e("gray",n))}${s.hint?` ${e("dim",`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${it(u,n=>e("dim",n))}`;case"active":return`${e("green",z)} ${u}${s.hint?` ${e("dim",`(${s.hint})`)}`:""}`;case"cancelled":return`${it(u,n=>e(["strikethrough","dim"],n))}`;default:return`${e("dim",U)} ${it(u,n=>e("dim",n))}`}};return new Yt({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){const s=t.withGuide??T.withGuide,r=`${P(this.state)} `,u=`${yt(this.state)} `,n=E(t.output,t.message,u,r),a=`${s?`${e("gray",$)}
104
105
  `:""}${n}
105
- `;switch(this.state){case"submit":{const c=s?`${e("gray",$)} `:"",a=O(t.output,r(this.options[this.cursor],"selected"),c);return`${o}${a}`}case"cancel":{const c=s?`${e("gray",$)} `:"",a=O(t.output,r(this.options[this.cursor],"cancelled"),c);return`${o}${a}${s?`
106
- ${e("gray",$)}`:""}`}default:{const c=s?`${e("cyan",$)} `:"",a=s?e("cyan",E):"",l=o.split(`
107
- `).length,d=s?2:1;return`${o}${c}${Y({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:c.length,rowPadding:l+d,style:(y,p)=>r(y,y.disabled?"disabled":p?"active":"inactive")}).join(`
106
+ `;switch(this.state){case"submit":{const c=s?`${e("gray",$)} `:"",o=E(t.output,i(this.options[this.cursor],"selected"),c);return`${a}${o}`}case"cancel":{const c=s?`${e("gray",$)} `:"",o=E(t.output,i(this.options[this.cursor],"cancelled"),c);return`${a}${o}${s?`
107
+ ${e("gray",$)}`:""}`}default:{const c=s?`${e("cyan",$)} `:"",o=s?e("cyan",x):"",l=a.split(`
108
+ `).length,d=s?2:1;return`${a}${c}${F({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:c.length,rowPadding:l+d,style:(g,p)=>i(g,g.disabled?"disabled":p?"active":"inactive")}).join(`
108
109
  ${c}`)}
109
- ${a}
110
- `}}}}).prompt()},Ge=t=>{const r=(s,i="inactive")=>{const u=s.label??String(s.value);return i==="selected"?`${e("dim",u)}`:i==="cancelled"?`${e(["strikethrough","dim"],u)}`:i==="active"?`${e(["bgCyan","gray"],` ${s.value} `)} ${u}${s.hint?` ${e("dim",`(${s.hint})`)}`:""}`:`${e(["gray","bgWhite","inverse"],` ${s.value} `)} ${u}${s.hint?` ${e("dim",`(${s.hint})`)}`:""}`};return new Yt({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,caseSensitive:t.caseSensitive,render(){const s=t.withGuide??_.withGuide,i=`${s?`${e("gray",$)}
111
- `:""}${M(this.state)} ${t.message}
112
- `;switch(this.state){case"submit":{const u=s?`${e("gray",$)} `:"",n=this.options.find(c=>c.value===this.value)??t.options[0],o=O(t.output,r(n,"selected"),u);return`${i}${o}`}case"cancel":{const u=s?`${e("gray",$)} `:"",n=O(t.output,r(this.options[0],"cancelled"),u);return`${i}${n}${s?`
113
- ${e("gray",$)}`:""}`}default:{const u=s?`${e("cyan",$)} `:"",n=s?e("cyan",E):"",o=this.options.map((c,a)=>O(t.output,r(c,a===this.cursor?"active":"inactive"),u)).join(`
114
- `);return`${i}${o}
110
+ ${o}
111
+ `}}}}).prompt()},Ee=t=>{const i=(s,r="inactive")=>{const u=s.label??String(s.value);return r==="selected"?`${e("dim",u)}`:r==="cancelled"?`${e(["strikethrough","dim"],u)}`:r==="active"?`${e(["bgCyan","gray"],` ${s.value} `)} ${u}${s.hint?` ${e("dim",`(${s.hint})`)}`:""}`:`${e(["gray","bgWhite","inverse"],` ${s.value} `)} ${u}${s.hint?` ${e("dim",`(${s.hint})`)}`:""}`};return new Xt({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,caseSensitive:t.caseSensitive,render(){const s=t.withGuide??T.withGuide,r=`${s?`${e("gray",$)}
112
+ `:""}${P(this.state)} ${t.message}
113
+ `;switch(this.state){case"submit":{const u=s?`${e("gray",$)} `:"",n=this.options.find(c=>c.value===this.value)??t.options[0],a=E(t.output,i(n,"selected"),u);return`${r}${a}`}case"cancel":{const u=s?`${e("gray",$)} `:"",n=E(t.output,i(this.options[0],"cancelled"),u);return`${r}${n}${s?`
114
+ ${e("gray",$)}`:""}`}default:{const u=s?`${e("cyan",$)} `:"",n=s?e("cyan",x):"",a=this.options.map((c,o)=>E(t.output,i(c,o===this.cursor?"active":"inactive"),u)).join(`
115
+ `);return`${r}${a}
115
116
  ${n}
116
- `}}}}).prompt()},jt=`${e("gray",$)} `,K={message:async(t,{symbol:r=e("gray",$)}={})=>{process.stdout.write(`${e("gray",$)}
117
- ${r} `);let s=3;for await(let i of t){i=i.replace(/\n/g,`
118
- ${jt}`),i.includes(`
119
- `)&&(s=3+nt(i.slice(i.lastIndexOf(`
120
- `))).length);const u=nt(i).length;s+u<process.stdout.columns?(s+=u,process.stdout.write(i)):(process.stdout.write(`
121
- ${jt}${i.trimStart()}`),s=3+nt(i.trimStart()).length)}process.stdout.write(`
122
- `)},info:t=>K.message(t,{symbol:e("blue",ht)}),success:t=>K.message(t,{symbol:e("green",pt)}),step:t=>K.message(t,{symbol:e("green",F)}),warn:t=>K.message(t,{symbol:e("yellow",mt)}),warning:t=>K.warn(t),error:t=>K.message(t,{symbol:e("red",gt)})},xe=async(t,r)=>{for(const s of t){if(s.enabled===!1)continue;const i=ft(r);i.start(s.title);const u=await s.task(i.message);i.stop(u||s.title)}},Oe=t=>t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,""),Me=t=>{const r=t.output??process.stdout,s=X(r),i=e("gray",$),u=t.spacing??1,n=3,o=t.retainLog===!0,c=!at()&&Tt(r);r.write(`${i}
123
- `),r.write(`${e("green",F)} ${t.title}
124
- `);for(let h=0;h<u;h++)r.write(`${i}
125
- `);const a=[{value:"",full:""}];let l=!1;const d=h=>{if(a.length===0)return;let f=0;h&&(f+=u+2);for(const v of a){const{value:T,result:C}=v;let b=C?.message??T;if(b.length===0)continue;C===void 0&&v.header!==void 0&&v.header!==""&&(b+=`
117
+ `}}}}).prompt()},Nt=`${e("gray",$)} `,q={message:async(t,{symbol:i=e("gray",$)}={})=>{process.stdout.write(`${e("gray",$)}
118
+ ${i} `);let s=3;for await(let r of t){r=r.replace(/\n/g,`
119
+ ${Nt}`),r.includes(`
120
+ `)&&(s=3+nt(r.slice(r.lastIndexOf(`
121
+ `))).length);const u=nt(r).length;s+u<process.stdout.columns?(s+=u,process.stdout.write(r)):(process.stdout.write(`
122
+ ${Nt}${r.trimStart()}`),s=3+nt(r.trimStart()).length)}process.stdout.write(`
123
+ `)},info:t=>q.message(t,{symbol:e("blue",ht)}),success:t=>q.message(t,{symbol:e("green",pt)}),step:t=>q.message(t,{symbol:e("green",H)}),warn:t=>q.message(t,{symbol:e("yellow",mt)}),warning:t=>q.warn(t),error:t=>q.message(t,{symbol:e("red",gt)})},Ge=async(t,i)=>{for(const s of t){if(s.enabled===!1)continue;const r=ft(i);r.start(s.title);const u=await s.task(r.message);r.stop(u||s.title)}},Me=t=>t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,""),Oe=t=>{const i=t.output??process.stdout,s=X(i),r=e("gray",$),u=t.spacing??1,n=3,a=t.retainLog===!0,c=!ot()&&It(i);i.write(`${r}
124
+ `),i.write(`${e("green",H)} ${t.title}
125
+ `);for(let m=0;m<u;m++)i.write(`${r}
126
+ `);const o=[{value:"",full:""}];let l=!1;const d=m=>{if(o.length===0)return;let y=0;m&&(y+=u+2);for(const v of o){const{value:C,result:S}=v;let b=S?.message??C;if(b.length===0)continue;S===void 0&&v.header!==void 0&&v.header!==""&&(b+=`
126
127
  ${v.header}`);const G=b.split(`
127
- `).reduce((x,A)=>A===""?x+1:x+Math.ceil((A.length+n)/s),0);f+=G}f>0&&(f+=1,r.write(Ct.lines(f)))},y=(h,f,v)=>{const T=v?`${h.full}
128
- ${h.value}`:h.value;h.header!==void 0&&h.header!==""&&R.message(h.header.split(`
129
- `).map(C=>e("bold",C)),{output:r,secondarySymbol:i,symbol:i,spacing:0}),R.message(T.split(`
130
- `).map(C=>e("dim",C)),{output:r,secondarySymbol:i,symbol:i,spacing:f??u})},p=()=>{for(const h of a){const{header:f,value:v,full:T}=h;(f===void 0||f.length===0)&&v.length===0||y(h,void 0,o===!0&&T.length>0)}},m=(h,f,v)=>{if(d(!1),(v?.raw!==!0||!l)&&h.value!==""&&(h.value+=`
131
- `),h.value+=Oe(f),l=v?.raw===!0,t.limit!==void 0){const T=h.value.split(`
132
- `),C=T.length-t.limit;if(C>0){const b=T.splice(0,C);o&&(h.full+=(h.full===""?"":`
128
+ `).reduce((M,N)=>N===""?M+1:M+Math.ceil((N.length+n)/s),0);y+=G}y>0&&(y+=1,i.write(Ct.lines(y)))},g=(m,y,v)=>{const C=v?`${m.full}
129
+ ${m.value}`:m.value;m.header!==void 0&&m.header!==""&&R.message(m.header.split(`
130
+ `).map(S=>e("bold",S)),{output:i,secondarySymbol:r,symbol:r,spacing:0}),R.message(C.split(`
131
+ `).map(S=>e("dim",S)),{output:i,secondarySymbol:r,symbol:r,spacing:y??u})},p=()=>{for(const m of o){const{header:y,value:v,full:C}=m;(y===void 0||y.length===0)&&v.length===0||g(m,void 0,a===!0&&C.length>0)}},f=(m,y,v)=>{if(d(!1),(v?.raw!==!0||!l)&&m.value!==""&&(m.value+=`
132
+ `),m.value+=Me(y),l=v?.raw===!0,t.limit!==void 0){const C=m.value.split(`
133
+ `),S=C.length-t.limit;if(S>0){const b=C.splice(0,S);a&&(m.full+=(m.full===""?"":`
133
134
  `)+b.join(`
134
- `))}h.value=T.join(`
135
- `)}c&&g()},g=()=>{for(const h of a)h.result?h.result.status==="error"?R.error(h.result.message,{output:r,secondarySymbol:i,spacing:0}):R.success(h.result.message,{output:r,secondarySymbol:i,spacing:0}):h.value!==""&&y(h,0)},S=(h,f)=>{d(!1),h.result=f,c&&g()};return{message(h,f){m(a[0],h,f)},group(h){const f={header:h,value:"",full:""};return a.push(f),{message(v,T){m(f,v,T)},error(v){S(f,{status:"error",message:v})},success(v){S(f,{status:"success",message:v})}}},error(h,f){d(!0),R.error(h,{output:r,secondarySymbol:i,spacing:1}),f?.showLog!==!1&&p(),a.splice(1,a.length-1),a[0].value="",a[0].full=""},success(h,f){d(!0),R.success(h,{output:r,secondarySymbol:i,spacing:1}),f?.showLog===!0&&p(),a.splice(1,a.length-1),a[0].value="",a[0].full=""}}},Re=t=>new Xt({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){const r=t?.withGuide??_.withGuide,s=`${`${r?`${e("gray",$)}
136
- `:""}${M(this.state)} `}${t.message}
137
- `,i=t.placeholder?e("inverse",t.placeholder[0])+e("dim",t.placeholder.slice(1)):e(["inverse","hidden"],"_"),u=this.userInput?this.userInputWithCursor:i,n=this.value??"";switch(this.state){case"error":{const o=this.error?` ${e("yellow",this.error)}`:"",c=r?`${e("yellow",$)} `:"",a=r?e("yellow",E):"";return`${s.trim()}
135
+ `))}m.value=C.join(`
136
+ `)}c&&h()},h=()=>{for(const m of o)m.result?m.result.status==="error"?R.error(m.result.message,{output:i,secondarySymbol:r,spacing:0}):R.success(m.result.message,{output:i,secondarySymbol:r,spacing:0}):m.value!==""&&g(m,0)},I=(m,y)=>{d(!1),m.result=y,c&&h()};return{message(m,y){f(o[0],m,y)},group(m){const y={header:m,value:"",full:""};return o.push(y),{message(v,C){f(y,v,C)},error(v){I(y,{status:"error",message:v})},success(v){I(y,{status:"success",message:v})}}},error(m,y){d(!0),R.error(m,{output:i,secondarySymbol:r,spacing:1}),y?.showLog!==!1&&p(),o.splice(1,o.length-1),o[0].value="",o[0].full=""},success(m,y){d(!0),R.success(m,{output:i,secondarySymbol:r,spacing:1}),y?.showLog===!0&&p(),o.splice(1,o.length-1),o[0].value="",o[0].full=""}}},Pe=t=>new zt({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){const i=t?.withGuide??T.withGuide,s=`${`${i?`${e("gray",$)}
137
+ `:""}${P(this.state)} `}${t.message}
138
+ `,r=t.placeholder?e("inverse",t.placeholder[0])+e("dim",t.placeholder.slice(1)):e(["inverse","hidden"],"_"),u=this.userInput?this.userInputWithCursor:r,n=this.value??"";switch(this.state){case"error":{const a=this.error?` ${e("yellow",this.error)}`:"",c=i?`${e("yellow",$)} `:"",o=i?e("yellow",x):"";return`${s.trim()}
138
139
  ${c}${u}
139
- ${a}${o}
140
- `}case"submit":{const o=n?` ${e("dim",n)}`:"",c=r?e("gray",$):"";return`${s}${c}${o}`}case"cancel":{const o=n?` ${e(["strikethrough","dim"],n)}`:"",c=r?e("gray",$):"";return`${s}${c}${o}${n.trim()?`
141
- ${c}`:""}`}default:{const o=r?`${e("cyan",$)} `:"",c=r?e("cyan",E):"";return`${s}${o}${u}
140
+ ${o}${a}
141
+ `}case"submit":{const a=n?` ${e("dim",n)}`:"",c=i?e("gray",$):"";return`${s}${c}${a}`}case"cancel":{const a=n?` ${e(["strikethrough","dim"],n)}`:"",c=i?e("gray",$):"";return`${s}${c}${a}${n.trim()?`
142
+ ${c}`:""}`}default:{const a=i?`${e("cyan",$)} `:"",c=i?e("cyan",x):"";return`${s}${a}${u}
142
143
  ${c}
143
- `}}}}).prompt();export{$ as S_BAR,E as S_BAR_END,Et as S_BAR_END_RIGHT,st as S_BAR_H,lt as S_BAR_START,It as S_BAR_START_RIGHT,et as S_CHECKBOX_ACTIVE,J as S_CHECKBOX_INACTIVE,U as S_CHECKBOX_SELECTED,xt as S_CONNECT_LEFT,dt as S_CORNER_BOTTOM_LEFT,$t as S_CORNER_BOTTOM_RIGHT,Ot as S_CORNER_TOP_LEFT,ct as S_CORNER_TOP_RIGHT,gt as S_ERROR,ht as S_INFO,Gt as S_PASSWORD_MASK,z as S_RADIO_ACTIVE,H as S_RADIO_INACTIVE,_t as S_STEP_ACTIVE,ot as S_STEP_CANCEL,ut as S_STEP_ERROR,F as S_STEP_SUBMIT,pt as S_SUCCESS,mt as S_WARN,At as autocomplete,ie as autocompleteMultiselect,oe as box,me as cancel,ue as confirm,le as date,he as group,pe as groupMultiselect,ge as intro,at as isCI,Tt as isTTY,Y as limitOptions,R as log,fe as multiline,ve as multiselect,Se as note,ye as outro,Ce as password,Te as path,Ie as progress,Ee as select,Ge as selectKey,ft as spinner,K as stream,M as symbol,yt as symbolBar,Me as taskLog,xe as tasks,Re as text,tt as unicode,w as unicodeOr};
144
+ `}}}}).prompt();export{$ as S_BAR,x as S_BAR_END,xt as S_BAR_END_RIGHT,st as S_BAR_H,lt as S_BAR_START,_t as S_BAR_START_RIGHT,et as S_CHECKBOX_ACTIVE,Y as S_CHECKBOX_INACTIVE,K as S_CHECKBOX_SELECTED,Gt as S_CONNECT_LEFT,dt as S_CORNER_BOTTOM_LEFT,$t as S_CORNER_BOTTOM_RIGHT,Mt as S_CORNER_TOP_LEFT,ct as S_CORNER_TOP_RIGHT,gt as S_ERROR,ht as S_INFO,Et as S_PASSWORD_MASK,z as S_RADIO_ACTIVE,U as S_RADIO_INACTIVE,Tt as S_STEP_ACTIVE,at as S_STEP_CANCEL,ut as S_STEP_ERROR,H as S_STEP_SUBMIT,pt as S_SUCCESS,mt as S_WARN,At as autocomplete,ie as autocompleteMultiselect,ae as box,me as cancel,ue as confirm,le as date,he as group,pe as groupMultiselect,ge as intro,ot as isCI,It as isTTY,F as limitOptions,R as log,fe as multiline,ve as multiselect,Se as note,ye as outro,Ce as password,Ie as path,_e as progress,xe as select,Ee as selectKey,ft as spinner,q as stream,P as symbol,yt as symbolBar,Oe as taskLog,Ge as tasks,Pe as text,tt as unicode,w as unicodeOr};
144
145
  //# sourceMappingURL=index.mjs.map