void 0.1.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_PROMPT.md +15 -0
- package/README.md +62 -123
- package/dist/auth-BdsJ0Aff.d.mts +43 -0
- package/dist/auth-cmd-Dx8oPKZC.mjs +43 -0
- package/dist/auth-migrations-BAtAck2g.mjs +117 -0
- package/dist/better-auth-shared-C9_GHSkR.d.mts +71 -0
- package/dist/better-auth-shared-CdYmQGry.mjs +163 -0
- package/dist/cache-W82I8ihI.mjs +47 -0
- package/dist/cancel-deploy-BOBTqqh0.mjs +59 -0
- package/dist/cf-access-Dee5cXxL.mjs +22 -0
- package/dist/chunk-DJd-R1mw.mjs +34 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +1807 -0
- package/dist/client-snXOjrp1.mjs +565 -0
- package/dist/collect-CjeZgz5D.mjs +55 -0
- package/dist/config-BIa9HwVX.mjs +573 -0
- package/dist/config-BzM9Dy7T.mjs +37 -0
- package/dist/config-CvHtTM0q.mjs +30 -0
- package/dist/create-project-BIA15W7z.mjs +90 -0
- package/dist/db-DsRoMcfN.mjs +895 -0
- package/dist/defer-DcxEsVH1.mjs +49 -0
- package/dist/delete-DAP6yDc7.mjs +64 -0
- package/dist/deploy-BPKblFx6.mjs +2424 -0
- package/dist/discover-B7FkXBLB.mjs +40 -0
- package/dist/dist-DUyXJLkq.mjs +2667 -0
- package/dist/dist-Dayj3gCK.mjs +1287 -0
- package/dist/domain-BGofcQ6I.mjs +79 -0
- package/dist/dotenv-DwO4ti0Z.mjs +173 -0
- package/dist/drizzle-NnudE_UN.mjs +232 -0
- package/dist/env-CyG3tvU0.mjs +301 -0
- package/dist/env-helpers-Dr9Y7RnE.d.mts +52 -0
- package/dist/env-raw-BDL4TvdN.mjs +32 -0
- package/dist/env-types-DknSA4SO.mjs +64 -0
- package/dist/env-validation-DJKjR_8q.mjs +163 -0
- package/dist/fetch-error-BQ8sZ5Nd.mjs +266 -0
- package/dist/fetch-error-CVZ5CGA-.d.mts +20 -0
- package/dist/gen-U0Ktr4Zd.mjs +761 -0
- package/dist/handler-B0ds0OHJ.d.mts +269 -0
- package/dist/head-P-egrtFE.d.mts +45 -0
- package/dist/headers-DCXc7mDs.mjs +279 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.mjs +4695 -0
- package/dist/init-C7wS5iGP.mjs +2625 -0
- package/dist/link-p2R6NbgN.mjs +49 -0
- package/dist/list-Bfel-QLc.mjs +113 -0
- package/dist/log-DXdqnmhF.mjs +26 -0
- package/dist/login-CkcXUiIu.mjs +72 -0
- package/dist/logs-DmkrRvx6.mjs +98 -0
- package/dist/magic-string.es-D6g9UnIy.mjs +1011 -0
- package/dist/mcp-CaQzfeUi.mjs +373 -0
- package/dist/node-DDfXj10V.mjs +54 -0
- package/dist/output-BwlcIYSR.mjs +139 -0
- package/dist/pages/client.d.mts +198 -0
- package/dist/pages/client.mjs +980 -0
- package/dist/pages/head-client.d.mts +15 -0
- package/dist/pages/head-client.mjs +90 -0
- package/dist/pages/head.d.mts +2 -0
- package/dist/pages/head.mjs +112 -0
- package/dist/pages/index.d.mts +38 -0
- package/dist/pages/index.mjs +76 -0
- package/dist/pages/islands-plugin.d.mts +50 -0
- package/dist/pages/islands-plugin.mjs +195 -0
- package/dist/pages/prefetch.d.mts +31 -0
- package/dist/pages/prefetch.mjs +90 -0
- package/dist/pages/protocol.d.mts +3 -0
- package/dist/pages/protocol.mjs +193 -0
- package/dist/pages/serialize.d.mts +10 -0
- package/dist/pages/serialize.mjs +14 -0
- package/dist/pathe.M-eThtNZ-D-kmWkCS.mjs +150 -0
- package/dist/plugin-inference-oZ6Ybu2_.mjs +2447 -0
- package/dist/prepare-BAtWufvm.mjs +99 -0
- package/dist/preset-D4I73kT4.mjs +221 -0
- package/dist/project-TqORyHn8.mjs +72 -0
- package/dist/project-cmd-B7lQp3F3.mjs +67 -0
- package/dist/project-slug-CKam8lF9.mjs +11 -0
- package/dist/project-tsconfig-DfkESbDL.mjs +63 -0
- package/dist/protocol-BWzXs2A2.d.mts +34 -0
- package/dist/providers-B3aMxWzP.mjs +67 -0
- package/dist/resolve-project-Br5BR03U.mjs +29 -0
- package/dist/rollback-gyC59l7U.mjs +92 -0
- package/dist/route-types-DReF1gUY.mjs +255 -0
- package/dist/routes-stub.d.mts +55 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/runner-6Ep3fNQu.mjs +123 -0
- package/dist/runner-pg-D0wWHYnr.mjs +57 -0
- package/dist/runtime/ai.d.mts +127 -0
- package/dist/runtime/ai.mjs +348 -0
- package/dist/runtime/auth-client-react.d.mts +8 -0
- package/dist/runtime/auth-client-react.mjs +6 -0
- package/dist/runtime/auth-client-solid.d.mts +8 -0
- package/dist/runtime/auth-client-solid.mjs +6 -0
- package/dist/runtime/auth-client-svelte.d.mts +8 -0
- package/dist/runtime/auth-client-svelte.mjs +6 -0
- package/dist/runtime/auth-client-vue.d.mts +8 -0
- package/dist/runtime/auth-client-vue.mjs +6 -0
- package/dist/runtime/auth-client.d.mts +8 -0
- package/dist/runtime/auth-client.mjs +6 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +22 -0
- package/dist/runtime/better-auth-pg.d.mts +11 -0
- package/dist/runtime/better-auth-pg.mjs +51 -0
- package/dist/runtime/better-auth.d.mts +11 -0
- package/dist/runtime/better-auth.mjs +33 -0
- package/dist/runtime/client.d.mts +6 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +30 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/env-helpers.d.mts +2 -0
- package/dist/runtime/env-helpers.mjs +173 -0
- package/dist/runtime/env-public-client.d.mts +22 -0
- package/dist/runtime/env-public-client.mjs +54 -0
- package/dist/runtime/env-public.d.mts +143 -0
- package/dist/runtime/env-public.mjs +366 -0
- package/dist/runtime/env.d.mts +13 -0
- package/dist/runtime/env.mjs +51 -0
- package/dist/runtime/fetch-stream.d.mts +51 -0
- package/dist/runtime/fetch-stream.mjs +81 -0
- package/dist/runtime/fetch.d.mts +59 -0
- package/dist/runtime/fetch.mjs +18 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +85 -0
- package/dist/runtime/isr.d.mts +26 -0
- package/dist/runtime/isr.mjs +43 -0
- package/dist/runtime/kv.d.mts +48 -0
- package/dist/runtime/kv.mjs +106 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +31 -0
- package/dist/runtime/migration-handler-pg.d.mts +6 -0
- package/dist/runtime/migration-handler-pg.mjs +85 -0
- package/dist/runtime/migration-handler.d.mts +19 -0
- package/dist/runtime/migration-handler.mjs +92 -0
- package/dist/runtime/queues.d.mts +7 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +15 -0
- package/dist/runtime/remote/binding-handler.mjs +208 -0
- package/dist/runtime/remote/index.d.mts +8 -0
- package/dist/runtime/remote/index.mjs +461 -0
- package/dist/runtime/response.d.mts +14 -0
- package/dist/runtime/response.mjs +30 -0
- package/dist/runtime/sandbox.d.mts +17 -0
- package/dist/runtime/sandbox.mjs +19 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +30 -0
- package/dist/runtime/seed.mjs +6 -0
- package/dist/runtime/storage.d.mts +7 -0
- package/dist/runtime/storage.mjs +14 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +72 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +296 -0
- package/dist/runtime/ws.d.mts +123 -0
- package/dist/runtime/ws.mjs +103 -0
- package/dist/scan-Ba4hFwlH.mjs +324 -0
- package/dist/scan-C6HMEIdW.mjs +318 -0
- package/dist/secret-CeRSukgM.mjs +109 -0
- package/dist/skills-ipldjlKE.mjs +62 -0
- package/dist/standard-schema-9CRjx-uR.d.mts +42 -0
- package/dist/subcommand-prompt-BKjuNAPb.mjs +349 -0
- package/dist/sveltekit.d.mts +20 -0
- package/dist/sveltekit.mjs +61 -0
- package/dist/types-mHOEwpW4.d.mts +57 -0
- package/dist/validate-CaMavMxu.mjs +146 -0
- package/dist/yarn-pnp-BFqMV_bl.mjs +196 -0
- package/getting-started-prompt.txt +26 -0
- package/package.json +322 -30
- package/schema.json +364 -0
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/SKILL.md +75 -0
- package/skills/void/command/void.md +7 -0
- package/skills/void/docs/guide/ai.md +235 -0
- package/skills/void/docs/guide/app-types.md +103 -0
- package/skills/void/docs/guide/auth.md +257 -0
- package/skills/void/docs/guide/database/d1.md +106 -0
- package/skills/void/docs/guide/database/postgresql.md +106 -0
- package/skills/void/docs/guide/database.md +418 -0
- package/skills/void/docs/guide/deployment.md +98 -0
- package/skills/void/docs/guide/edge/headers.md +79 -0
- package/skills/void/docs/guide/edge/prerendering.md +83 -0
- package/skills/void/docs/guide/edge/redirects.md +116 -0
- package/skills/void/docs/guide/edge/revalidation.md +131 -0
- package/skills/void/docs/guide/edge/rewrites.md +354 -0
- package/skills/void/docs/guide/edge/static-assets.md +72 -0
- package/skills/void/docs/guide/env-vars.md +298 -0
- package/skills/void/docs/guide/index.md +80 -0
- package/skills/void/docs/guide/jobs.md +91 -0
- package/skills/void/docs/guide/kv.md +107 -0
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +419 -0
- package/skills/void/docs/guide/pages-routing/head.md +130 -0
- package/skills/void/docs/guide/pages-routing/islands.md +405 -0
- package/skills/void/docs/guide/pages-routing/layouts.md +362 -0
- package/skills/void/docs/guide/pages-routing/loaders.md +267 -0
- package/skills/void/docs/guide/pages-routing/markdown.md +625 -0
- package/skills/void/docs/guide/pages-routing/overview.md +236 -0
- package/skills/void/docs/guide/pages-routing/view-transitions.md +140 -0
- package/skills/void/docs/guide/queues.md +140 -0
- package/skills/void/docs/guide/quickstart.md +233 -0
- package/skills/void/docs/guide/remote-dev.md +67 -0
- package/skills/void/docs/guide/sandboxes.md +82 -0
- package/skills/void/docs/guide/server-routing.md +246 -0
- package/skills/void/docs/guide/ssg.md +74 -0
- package/skills/void/docs/guide/ssr.md +105 -0
- package/skills/void/docs/guide/storage.md +67 -0
- package/skills/void/docs/guide/type-safety.md +179 -0
- package/skills/void/docs/guide/typed-fetch.md +113 -0
- package/skills/void/docs/guide/websockets.md +190 -0
- package/skills/void/docs/index.md +48 -0
- package/skills/void/docs/integrations/agents.md +84 -0
- package/skills/void/docs/integrations/cloudflare.md +284 -0
- package/skills/void/docs/integrations/frameworks/analog.md +182 -0
- package/skills/void/docs/integrations/frameworks/astro.md +197 -0
- package/skills/void/docs/integrations/frameworks/nuxt.md +164 -0
- package/skills/void/docs/integrations/frameworks/overview.md +136 -0
- package/skills/void/docs/integrations/frameworks/react-router.md +137 -0
- package/skills/void/docs/integrations/frameworks/sveltekit.md +191 -0
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +140 -0
- package/skills/void/docs/integrations/hono.md +97 -0
- package/skills/void/docs/integrations/nodejs-bun-deno.md +210 -0
- package/skills/void/docs/node_modules/@iconify/vue/README.md +408 -0
- package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +5 -0
- package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +103 -0
- package/skills/void/docs/node_modules/oxc-minify/README.md +78 -0
- package/skills/void/docs/node_modules/reka-ui/README.md +80 -0
- package/skills/void/docs/node_modules/vitepress/README.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/api-examples.md +49 -0
- package/skills/void/docs/node_modules/vitepress/template/index.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +85 -0
- package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +101 -0
- package/skills/void/docs/node_modules/void/AGENTS.md +204 -0
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +15 -0
- package/skills/void/docs/node_modules/void/README.md +89 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +591 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +375 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +174 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +37 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +189 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +143 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +1272 -0
- package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +19 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +22 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +69 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +152 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +24 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +565 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +124 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +600 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +386 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +101 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +58 -0
- package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +32 -0
- package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +99 -0
- package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +108 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +79 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +44 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +65 -0
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +390 -0
- package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +48 -0
- package/skills/void/docs/node_modules/void/node_modules/hono/README.md +85 -0
- package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +452 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/{LICENSE → skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md} +21 -21
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +364 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +325 -0
- package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +398 -0
- package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +63 -0
- package/skills/void/docs/node_modules/void/node_modules/zod/README.md +191 -0
- package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +75 -0
- package/skills/void/docs/node_modules/void/skills/void/command/void.md +7 -0
- package/skills/void/docs/reference/api.md +917 -0
- package/skills/void/docs/reference/cli.md +561 -0
- package/skills/void/docs/reference/config.md +408 -0
- package/skills/void/docs/reference/resource-inference.md +149 -0
- package/skills/void/docs/reference/structure.md +176 -0
- package/.npmignore +0 -29
- package/.travis.yml +0 -9
- package/favicon.ico +0 -0
- package/index.js +0 -14
- package/lib/Job.js +0 -150
- package/lib/Void.js +0 -99
- package/lib/scan.js +0 -19
- package/test/credentials.js +0 -20
- package/test/job.js +0 -64
- package/test/static/dir1/test6.html +0 -0
- package/test/static/dir2/test7.html +0 -0
- package/test/static/dir2/test8.html +0 -0
- package/test/static/dir2/test9.html +0 -0
- package/test/static/test1.html +0 -0
- package/test/static/test2.html +0 -0
- package/test/static/test3.html +0 -0
- package/test/void.js +0 -31
- /package/{test/static/dir1/test4.html → skills/void/docs/integrations/auth-providers.md} +0 -0
- /package/{test/static/dir1/test5.html → skills/void/docs/integrations/payment-processors.md} +0 -0
|
@@ -0,0 +1,1287 @@
|
|
|
1
|
+
import { n as __exportAll, t as __commonJSMin } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
+
import "node:fs";
|
|
3
|
+
import { stripVTControlCharacters, styleText } from "node:util";
|
|
4
|
+
import j, { stdin, stdout } from "node:process";
|
|
5
|
+
import * as b from "node:readline";
|
|
6
|
+
import E from "node:readline";
|
|
7
|
+
import { ReadStream } from "node:tty";
|
|
8
|
+
import "node:path";
|
|
9
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
10
|
+
const getCodePointsLength = (() => {
|
|
11
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
12
|
+
return (input) => {
|
|
13
|
+
let surrogatePairsNr = 0;
|
|
14
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
15
|
+
while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
|
|
16
|
+
return input.length - surrogatePairsNr;
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
const isFullWidth = (x) => {
|
|
20
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
21
|
+
};
|
|
22
|
+
const isWideNotCJKTNotEmoji = (x) => {
|
|
23
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
27
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
28
|
+
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
29
|
+
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
30
|
+
const TAB_RE = /\t{1,1000}/y;
|
|
31
|
+
const EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy;
|
|
32
|
+
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
33
|
+
const MODIFIER_RE = /\p{M}+/gu;
|
|
34
|
+
const NO_TRUNCATION$1 = {
|
|
35
|
+
limit: Infinity,
|
|
36
|
+
ellipsis: ""
|
|
37
|
+
};
|
|
38
|
+
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
39
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
40
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
41
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
42
|
+
const ANSI_WIDTH = 0;
|
|
43
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
44
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
45
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
46
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
47
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
48
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
49
|
+
const PARSE_BLOCKS = [
|
|
50
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
51
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
52
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
53
|
+
[TAB_RE, TAB_WIDTH],
|
|
54
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
55
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
56
|
+
];
|
|
57
|
+
let indexPrev = 0;
|
|
58
|
+
let index = 0;
|
|
59
|
+
let length = input.length;
|
|
60
|
+
let lengthExtra = 0;
|
|
61
|
+
let truncationEnabled = false;
|
|
62
|
+
let truncationIndex = length;
|
|
63
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
64
|
+
let unmatchedStart = 0;
|
|
65
|
+
let unmatchedEnd = 0;
|
|
66
|
+
let width = 0;
|
|
67
|
+
let widthExtra = 0;
|
|
68
|
+
outer: while (true) {
|
|
69
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
70
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
71
|
+
lengthExtra = 0;
|
|
72
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
73
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
74
|
+
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
75
|
+
else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
|
|
76
|
+
else widthExtra = REGULAR_WIDTH;
|
|
77
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
78
|
+
if (width + widthExtra > LIMIT) {
|
|
79
|
+
truncationEnabled = true;
|
|
80
|
+
break outer;
|
|
81
|
+
}
|
|
82
|
+
lengthExtra += char.length;
|
|
83
|
+
width += widthExtra;
|
|
84
|
+
}
|
|
85
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
86
|
+
}
|
|
87
|
+
if (index >= length) break outer;
|
|
88
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
89
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
90
|
+
BLOCK_RE.lastIndex = index;
|
|
91
|
+
if (BLOCK_RE.test(input)) {
|
|
92
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
93
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
94
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
95
|
+
if (width + widthExtra > LIMIT) {
|
|
96
|
+
truncationEnabled = true;
|
|
97
|
+
break outer;
|
|
98
|
+
}
|
|
99
|
+
width += widthExtra;
|
|
100
|
+
unmatchedStart = indexPrev;
|
|
101
|
+
unmatchedEnd = index;
|
|
102
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
103
|
+
continue outer;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
index += 1;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
110
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
111
|
+
truncated: truncationEnabled,
|
|
112
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
117
|
+
const NO_TRUNCATION = {
|
|
118
|
+
limit: Infinity,
|
|
119
|
+
ellipsis: "",
|
|
120
|
+
ellipsisWidth: 0
|
|
121
|
+
};
|
|
122
|
+
const fastStringWidth = (input, options = {}) => {
|
|
123
|
+
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
124
|
+
};
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
|
|
127
|
+
const ESC = "\x1B";
|
|
128
|
+
const CSI = "";
|
|
129
|
+
const END_CODE = 39;
|
|
130
|
+
const ANSI_ESCAPE_BELL = "\x07";
|
|
131
|
+
const ANSI_CSI = "[";
|
|
132
|
+
const ANSI_OSC = "]";
|
|
133
|
+
const ANSI_SGR_TERMINATOR = "m";
|
|
134
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
135
|
+
const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
136
|
+
const getClosingCode = (openingCode) => {
|
|
137
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
138
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
139
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
140
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
141
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
142
|
+
if (openingCode === 3) return 23;
|
|
143
|
+
if (openingCode === 4) return 24;
|
|
144
|
+
if (openingCode === 7) return 27;
|
|
145
|
+
if (openingCode === 8) return 28;
|
|
146
|
+
if (openingCode === 9) return 29;
|
|
147
|
+
if (openingCode === 0) return 0;
|
|
148
|
+
};
|
|
149
|
+
const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
150
|
+
const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
151
|
+
const wrapWord = (rows, word, columns) => {
|
|
152
|
+
const characters = word[Symbol.iterator]();
|
|
153
|
+
let isInsideEscape = false;
|
|
154
|
+
let isInsideLinkEscape = false;
|
|
155
|
+
let lastRow = rows.at(-1);
|
|
156
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
|
|
157
|
+
let currentCharacter = characters.next();
|
|
158
|
+
let nextCharacter = characters.next();
|
|
159
|
+
let rawCharacterIndex = 0;
|
|
160
|
+
while (!currentCharacter.done) {
|
|
161
|
+
const character = currentCharacter.value;
|
|
162
|
+
const characterLength = fastStringWidth(character);
|
|
163
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
164
|
+
else {
|
|
165
|
+
rows.push(character);
|
|
166
|
+
visible = 0;
|
|
167
|
+
}
|
|
168
|
+
if (character === ESC || character === CSI) {
|
|
169
|
+
isInsideEscape = true;
|
|
170
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
171
|
+
}
|
|
172
|
+
if (isInsideEscape) {
|
|
173
|
+
if (isInsideLinkEscape) {
|
|
174
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
175
|
+
isInsideEscape = false;
|
|
176
|
+
isInsideLinkEscape = false;
|
|
177
|
+
}
|
|
178
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
179
|
+
} else {
|
|
180
|
+
visible += characterLength;
|
|
181
|
+
if (visible === columns && !nextCharacter.done) {
|
|
182
|
+
rows.push("");
|
|
183
|
+
visible = 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
currentCharacter = nextCharacter;
|
|
187
|
+
nextCharacter = characters.next();
|
|
188
|
+
rawCharacterIndex += character.length;
|
|
189
|
+
}
|
|
190
|
+
lastRow = rows.at(-1);
|
|
191
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
192
|
+
};
|
|
193
|
+
const stringVisibleTrimSpacesRight = (string) => {
|
|
194
|
+
const words = string.split(" ");
|
|
195
|
+
let last = words.length;
|
|
196
|
+
while (last) {
|
|
197
|
+
if (fastStringWidth(words[last - 1])) break;
|
|
198
|
+
last--;
|
|
199
|
+
}
|
|
200
|
+
if (last === words.length) return string;
|
|
201
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
202
|
+
};
|
|
203
|
+
const exec = (string, columns, options = {}) => {
|
|
204
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
205
|
+
let returnValue = "";
|
|
206
|
+
let escapeCode;
|
|
207
|
+
let escapeUrl;
|
|
208
|
+
const words = string.split(" ");
|
|
209
|
+
let rows = [""];
|
|
210
|
+
let rowLength = 0;
|
|
211
|
+
for (let index = 0; index < words.length; index++) {
|
|
212
|
+
const word = words[index];
|
|
213
|
+
if (options.trim !== false) {
|
|
214
|
+
const row = rows.at(-1) ?? "";
|
|
215
|
+
const trimmed = row.trimStart();
|
|
216
|
+
if (row.length !== trimmed.length) {
|
|
217
|
+
rows[rows.length - 1] = trimmed;
|
|
218
|
+
rowLength = fastStringWidth(trimmed);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (index !== 0) {
|
|
222
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
223
|
+
rows.push("");
|
|
224
|
+
rowLength = 0;
|
|
225
|
+
}
|
|
226
|
+
if (rowLength || options.trim === false) {
|
|
227
|
+
rows[rows.length - 1] += " ";
|
|
228
|
+
rowLength++;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const wordLength = fastStringWidth(word);
|
|
232
|
+
if (options.hard && wordLength > columns) {
|
|
233
|
+
const remainingColumns = columns - rowLength;
|
|
234
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
235
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
236
|
+
wrapWord(rows, word, columns);
|
|
237
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
241
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
242
|
+
wrapWord(rows, word, columns);
|
|
243
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
rows.push("");
|
|
247
|
+
rowLength = 0;
|
|
248
|
+
}
|
|
249
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
250
|
+
wrapWord(rows, word, columns);
|
|
251
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
rows[rows.length - 1] += word;
|
|
255
|
+
rowLength += wordLength;
|
|
256
|
+
}
|
|
257
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
258
|
+
const preString = rows.join("\n");
|
|
259
|
+
let inSurrogate = false;
|
|
260
|
+
for (let i = 0; i < preString.length; i++) {
|
|
261
|
+
const character = preString[i];
|
|
262
|
+
returnValue += character;
|
|
263
|
+
if (!inSurrogate) {
|
|
264
|
+
inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
265
|
+
if (inSurrogate) continue;
|
|
266
|
+
} else inSurrogate = false;
|
|
267
|
+
if (character === ESC || character === CSI) {
|
|
268
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
269
|
+
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
270
|
+
if (groups?.code !== void 0) {
|
|
271
|
+
const code = Number.parseFloat(groups.code);
|
|
272
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
273
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
274
|
+
}
|
|
275
|
+
if (preString[i + 1] === "\n") {
|
|
276
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
277
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
278
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
|
|
279
|
+
} else if (character === "\n") {
|
|
280
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
|
|
281
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return returnValue;
|
|
285
|
+
};
|
|
286
|
+
const CRLF_OR_LF = /\r?\n/;
|
|
287
|
+
function wrapAnsi(string, columns, options) {
|
|
288
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region ../../node_modules/.pnpm/@clack+core@1.3.0/node_modules/@clack/core/dist/index.mjs
|
|
292
|
+
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293
|
+
const ESC = "\x1B";
|
|
294
|
+
const CSI = `${ESC}[`;
|
|
295
|
+
const beep = "\x07";
|
|
296
|
+
const cursor = {
|
|
297
|
+
to(x, y) {
|
|
298
|
+
if (!y) return `${CSI}${x + 1}G`;
|
|
299
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
300
|
+
},
|
|
301
|
+
move(x, y) {
|
|
302
|
+
let ret = "";
|
|
303
|
+
if (x < 0) ret += `${CSI}${-x}D`;
|
|
304
|
+
else if (x > 0) ret += `${CSI}${x}C`;
|
|
305
|
+
if (y < 0) ret += `${CSI}${-y}A`;
|
|
306
|
+
else if (y > 0) ret += `${CSI}${y}B`;
|
|
307
|
+
return ret;
|
|
308
|
+
},
|
|
309
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
310
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
311
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
312
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
313
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
314
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
315
|
+
left: `${CSI}G`,
|
|
316
|
+
hide: `${CSI}?25l`,
|
|
317
|
+
show: `${CSI}?25h`,
|
|
318
|
+
save: `${ESC}7`,
|
|
319
|
+
restore: `${ESC}8`
|
|
320
|
+
};
|
|
321
|
+
module.exports = {
|
|
322
|
+
cursor,
|
|
323
|
+
scroll: {
|
|
324
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
325
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
326
|
+
},
|
|
327
|
+
erase: {
|
|
328
|
+
screen: `${CSI}2J`,
|
|
329
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
330
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
331
|
+
line: `${CSI}2K`,
|
|
332
|
+
lineEnd: `${CSI}K`,
|
|
333
|
+
lineStart: `${CSI}1K`,
|
|
334
|
+
lines(count) {
|
|
335
|
+
let clear = "";
|
|
336
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
337
|
+
if (count) clear += cursor.left;
|
|
338
|
+
return clear;
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
beep
|
|
342
|
+
};
|
|
343
|
+
})))();
|
|
344
|
+
function d(r, t, s) {
|
|
345
|
+
if (!s.some((o) => !o.disabled)) return r;
|
|
346
|
+
const e = r + t, i = Math.max(s.length - 1, 0), n = e < 0 ? i : e > i ? 0 : e;
|
|
347
|
+
return s[n].disabled ? d(n, t < 0 ? -1 : 1, s) : n;
|
|
348
|
+
}
|
|
349
|
+
const h = {
|
|
350
|
+
actions: new Set([
|
|
351
|
+
"up",
|
|
352
|
+
"down",
|
|
353
|
+
"left",
|
|
354
|
+
"right",
|
|
355
|
+
"space",
|
|
356
|
+
"enter",
|
|
357
|
+
"cancel"
|
|
358
|
+
]),
|
|
359
|
+
aliases: new Map([
|
|
360
|
+
["k", "up"],
|
|
361
|
+
["j", "down"],
|
|
362
|
+
["h", "left"],
|
|
363
|
+
["l", "right"],
|
|
364
|
+
["", "cancel"],
|
|
365
|
+
["escape", "cancel"]
|
|
366
|
+
]),
|
|
367
|
+
messages: {
|
|
368
|
+
cancel: "Canceled",
|
|
369
|
+
error: "Something went wrong"
|
|
370
|
+
},
|
|
371
|
+
withGuide: !0,
|
|
372
|
+
date: {
|
|
373
|
+
monthNames: [...[
|
|
374
|
+
"January",
|
|
375
|
+
"February",
|
|
376
|
+
"March",
|
|
377
|
+
"April",
|
|
378
|
+
"May",
|
|
379
|
+
"June",
|
|
380
|
+
"July",
|
|
381
|
+
"August",
|
|
382
|
+
"September",
|
|
383
|
+
"October",
|
|
384
|
+
"November",
|
|
385
|
+
"December"
|
|
386
|
+
]],
|
|
387
|
+
messages: {
|
|
388
|
+
required: "Please enter a valid date",
|
|
389
|
+
invalidMonth: "There are only 12 months in a year",
|
|
390
|
+
invalidDay: (r, t) => `There are only ${r} days in ${t}`,
|
|
391
|
+
afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`,
|
|
392
|
+
beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}`
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
function C(r, t) {
|
|
397
|
+
if (typeof r == "string") return h.aliases.get(r) === t;
|
|
398
|
+
for (const s of r) if (s !== void 0 && C(s, t)) return !0;
|
|
399
|
+
return !1;
|
|
400
|
+
}
|
|
401
|
+
function z$1(r, t) {
|
|
402
|
+
if (r === t) return;
|
|
403
|
+
const s = r.split(`
|
|
404
|
+
`), e = t.split(`
|
|
405
|
+
`), i = Math.max(s.length, e.length), n = [];
|
|
406
|
+
for (let o = 0; o < i; o++) s[o] !== e[o] && n.push(o);
|
|
407
|
+
return {
|
|
408
|
+
lines: n,
|
|
409
|
+
numLinesBefore: s.length,
|
|
410
|
+
numLinesAfter: e.length,
|
|
411
|
+
numLines: i
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
const Y$1 = globalThis.process.platform.startsWith("win"), k = Symbol("clack:cancel");
|
|
415
|
+
function q(r) {
|
|
416
|
+
return r === k;
|
|
417
|
+
}
|
|
418
|
+
function w$1(r, t) {
|
|
419
|
+
const s = r;
|
|
420
|
+
s.isTTY && s.setRawMode(t);
|
|
421
|
+
}
|
|
422
|
+
function R$1({ input: r = stdin, output: t = stdout, overwrite: s = !0, hideCursor: e = !0 } = {}) {
|
|
423
|
+
const i = b.createInterface({
|
|
424
|
+
input: r,
|
|
425
|
+
output: t,
|
|
426
|
+
prompt: "",
|
|
427
|
+
tabSize: 1
|
|
428
|
+
});
|
|
429
|
+
b.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(!0);
|
|
430
|
+
const n = (o, { name: u, sequence: a }) => {
|
|
431
|
+
if (C([
|
|
432
|
+
String(o),
|
|
433
|
+
u,
|
|
434
|
+
a
|
|
435
|
+
], "cancel")) {
|
|
436
|
+
e && t.write(import_src.cursor.show), process.exit(0);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (!s) return;
|
|
440
|
+
const f = u === "return" ? 0 : -1, y = u === "return" ? -1 : 0;
|
|
441
|
+
b.moveCursor(t, f, y, () => {
|
|
442
|
+
b.clearLine(t, 1, () => {
|
|
443
|
+
r.once("keypress", n);
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
};
|
|
447
|
+
return e && t.write(import_src.cursor.hide), r.once("keypress", n), () => {
|
|
448
|
+
r.off("keypress", n), e && t.write(import_src.cursor.show), r instanceof ReadStream && r.isTTY && !Y$1 && r.setRawMode(!1), i.terminal = !1, i.close();
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
const A = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80, L = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
452
|
+
function W(r, t, s, e = s, i) {
|
|
453
|
+
return wrapAnsi(t, A(r ?? stdout) - s.length, {
|
|
454
|
+
hard: !0,
|
|
455
|
+
trim: !1
|
|
456
|
+
}).split(`
|
|
457
|
+
`).map((o, u) => {
|
|
458
|
+
const a = i ? i(o, u) : o;
|
|
459
|
+
return `${u === 0 ? e : s}${a}`;
|
|
460
|
+
}).join(`
|
|
461
|
+
`);
|
|
462
|
+
}
|
|
463
|
+
let p = class {
|
|
464
|
+
input;
|
|
465
|
+
output;
|
|
466
|
+
_abortSignal;
|
|
467
|
+
rl;
|
|
468
|
+
opts;
|
|
469
|
+
_render;
|
|
470
|
+
_track = !1;
|
|
471
|
+
_prevFrame = "";
|
|
472
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
473
|
+
_cursor = 0;
|
|
474
|
+
state = "initial";
|
|
475
|
+
error = "";
|
|
476
|
+
value;
|
|
477
|
+
userInput = "";
|
|
478
|
+
constructor(t, s = !0) {
|
|
479
|
+
const { input: e = stdin, output: i = stdout, render: n, signal: o, ...u } = t;
|
|
480
|
+
this.opts = u, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = o, this.input = e, this.output = i;
|
|
481
|
+
}
|
|
482
|
+
unsubscribe() {
|
|
483
|
+
this._subscribers.clear();
|
|
484
|
+
}
|
|
485
|
+
setSubscriber(t, s) {
|
|
486
|
+
const e = this._subscribers.get(t) ?? [];
|
|
487
|
+
e.push(s), this._subscribers.set(t, e);
|
|
488
|
+
}
|
|
489
|
+
on(t, s) {
|
|
490
|
+
this.setSubscriber(t, { cb: s });
|
|
491
|
+
}
|
|
492
|
+
once(t, s) {
|
|
493
|
+
this.setSubscriber(t, {
|
|
494
|
+
cb: s,
|
|
495
|
+
once: !0
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
emit(t, ...s) {
|
|
499
|
+
const e = this._subscribers.get(t) ?? [], i = [];
|
|
500
|
+
for (const n of e) n.cb(...s), n.once && i.push(() => e.splice(e.indexOf(n), 1));
|
|
501
|
+
for (const n of i) n();
|
|
502
|
+
}
|
|
503
|
+
prompt() {
|
|
504
|
+
return new Promise((t) => {
|
|
505
|
+
if (this._abortSignal) {
|
|
506
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(k);
|
|
507
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
508
|
+
this.state = "cancel", this.close();
|
|
509
|
+
}, { once: !0 });
|
|
510
|
+
}
|
|
511
|
+
this.rl = E.createInterface({
|
|
512
|
+
input: this.input,
|
|
513
|
+
tabSize: 2,
|
|
514
|
+
prompt: "",
|
|
515
|
+
escapeCodeTimeout: 50,
|
|
516
|
+
terminal: !0
|
|
517
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), w$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
518
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(this.value);
|
|
519
|
+
}), this.once("cancel", () => {
|
|
520
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(k);
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
_isActionKey(t, s) {
|
|
525
|
+
return t === " ";
|
|
526
|
+
}
|
|
527
|
+
_shouldSubmit(t, s) {
|
|
528
|
+
return !0;
|
|
529
|
+
}
|
|
530
|
+
_setValue(t) {
|
|
531
|
+
this.value = t, this.emit("value", this.value);
|
|
532
|
+
}
|
|
533
|
+
_setUserInput(t, s) {
|
|
534
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
535
|
+
}
|
|
536
|
+
_clearUserInput() {
|
|
537
|
+
this.rl?.write(null, {
|
|
538
|
+
ctrl: !0,
|
|
539
|
+
name: "u"
|
|
540
|
+
}), this._setUserInput("");
|
|
541
|
+
}
|
|
542
|
+
onKeypress(t, s) {
|
|
543
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(t, s) && this.rl?.write(null, {
|
|
544
|
+
ctrl: !0,
|
|
545
|
+
name: "h"
|
|
546
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && h.aliases.has(s.name) && this.emit("cursor", h.aliases.get(s.name)), h.actions.has(s.name) && this.emit("cursor", s.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), s), s?.name === "return" && this._shouldSubmit(t, s)) {
|
|
547
|
+
if (this.opts.validate) {
|
|
548
|
+
const e = this.opts.validate(this.value);
|
|
549
|
+
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
|
|
550
|
+
}
|
|
551
|
+
this.state !== "error" && (this.state = "submit");
|
|
552
|
+
}
|
|
553
|
+
C([
|
|
554
|
+
t,
|
|
555
|
+
s?.name,
|
|
556
|
+
s?.sequence
|
|
557
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
558
|
+
}
|
|
559
|
+
close() {
|
|
560
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
561
|
+
`), w$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
562
|
+
}
|
|
563
|
+
restoreCursor() {
|
|
564
|
+
const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
|
|
565
|
+
hard: !0,
|
|
566
|
+
trim: !1
|
|
567
|
+
}).split(`
|
|
568
|
+
`).length - 1;
|
|
569
|
+
this.output.write(import_src.cursor.move(-999, t * -1));
|
|
570
|
+
}
|
|
571
|
+
render() {
|
|
572
|
+
const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
|
|
573
|
+
hard: !0,
|
|
574
|
+
trim: !1
|
|
575
|
+
});
|
|
576
|
+
if (t !== this._prevFrame) {
|
|
577
|
+
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
578
|
+
else {
|
|
579
|
+
const s = z$1(this._prevFrame, t), e = L(this.output);
|
|
580
|
+
if (this.restoreCursor(), s) {
|
|
581
|
+
const i = Math.max(0, s.numLinesAfter - e), n = Math.max(0, s.numLinesBefore - e);
|
|
582
|
+
let o = s.lines.find((u) => u >= i);
|
|
583
|
+
if (o === void 0) {
|
|
584
|
+
this._prevFrame = t;
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
if (s.lines.length === 1) {
|
|
588
|
+
this.output.write(import_src.cursor.move(0, o - n)), this.output.write(import_src.erase.lines(1));
|
|
589
|
+
const u = t.split(`
|
|
590
|
+
`);
|
|
591
|
+
this.output.write(u[o]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, u.length - o - 1));
|
|
592
|
+
return;
|
|
593
|
+
} else if (s.lines.length > 1) {
|
|
594
|
+
if (i < n) o = i;
|
|
595
|
+
else {
|
|
596
|
+
const a = o - n;
|
|
597
|
+
a > 0 && this.output.write(import_src.cursor.move(0, a));
|
|
598
|
+
}
|
|
599
|
+
this.output.write(import_src.erase.down());
|
|
600
|
+
const u = t.split(`
|
|
601
|
+
`).slice(o);
|
|
602
|
+
this.output.write(u.join(`
|
|
603
|
+
`)), this._prevFrame = t;
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
this.output.write(import_src.erase.down());
|
|
608
|
+
}
|
|
609
|
+
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
function B(r, t) {
|
|
614
|
+
if (r === void 0 || t.length === 0) return 0;
|
|
615
|
+
const s = t.findIndex((e) => e.value === r);
|
|
616
|
+
return s !== -1 ? s : 0;
|
|
617
|
+
}
|
|
618
|
+
function J$1(r, t) {
|
|
619
|
+
return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
|
|
620
|
+
}
|
|
621
|
+
function H$1(r, t) {
|
|
622
|
+
if (t) return r ? t : t[0];
|
|
623
|
+
}
|
|
624
|
+
let Q$1 = class extends p {
|
|
625
|
+
filteredOptions;
|
|
626
|
+
multiple;
|
|
627
|
+
isNavigating = !1;
|
|
628
|
+
selectedValues = [];
|
|
629
|
+
focusedValue;
|
|
630
|
+
#s = 0;
|
|
631
|
+
#r = "";
|
|
632
|
+
#t;
|
|
633
|
+
#n;
|
|
634
|
+
#u;
|
|
635
|
+
get cursor() {
|
|
636
|
+
return this.#s;
|
|
637
|
+
}
|
|
638
|
+
get userInputWithCursor() {
|
|
639
|
+
if (!this.userInput) return styleText(["inverse", "hidden"], "_");
|
|
640
|
+
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
641
|
+
const t = this.userInput.slice(0, this._cursor), [s, ...e] = this.userInput.slice(this._cursor);
|
|
642
|
+
return `${t}${styleText("inverse", s)}${e.join("")}`;
|
|
643
|
+
}
|
|
644
|
+
get options() {
|
|
645
|
+
return typeof this.#n == "function" ? this.#n() : this.#n;
|
|
646
|
+
}
|
|
647
|
+
constructor(t) {
|
|
648
|
+
super(t), this.#n = t.options, this.#u = t.placeholder;
|
|
649
|
+
const s = this.options;
|
|
650
|
+
this.filteredOptions = [...s], this.multiple = t.multiple === !0, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? J$1;
|
|
651
|
+
let e;
|
|
652
|
+
if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? e = t.initialValue : e = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (e = [this.options[0].value]), e) for (const i of e) {
|
|
653
|
+
const n = s.findIndex((o) => o.value === i);
|
|
654
|
+
n !== -1 && (this.toggleSelected(i), this.#s = n);
|
|
655
|
+
}
|
|
656
|
+
this.focusedValue = this.options[this.#s]?.value, this.on("key", (i, n) => this.#e(i, n)), this.on("userInput", (i) => this.#i(i));
|
|
657
|
+
}
|
|
658
|
+
_isActionKey(t, s) {
|
|
659
|
+
return t === " " || this.multiple && this.isNavigating && s.name === "space" && t !== void 0 && t !== "";
|
|
660
|
+
}
|
|
661
|
+
#e(t, s) {
|
|
662
|
+
const e = s.name === "up", i = s.name === "down", n = s.name === "return", o = this.userInput === "" || this.userInput === " ", u = this.#u, a = this.options, l = u !== void 0 && u !== "" && a.some((f) => !f.disabled && (this.#t ? this.#t(u, f) : !0));
|
|
663
|
+
if (s.name === "tab" && o && l) {
|
|
664
|
+
this.userInput === " " && this._clearUserInput(), this._setUserInput(u, !0), this.isNavigating = !1;
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
e || i ? (this.#s = d(this.#s, e ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#s]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = !0) : n ? this.value = H$1(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = !1);
|
|
668
|
+
}
|
|
669
|
+
deselectAll() {
|
|
670
|
+
this.selectedValues = [];
|
|
671
|
+
}
|
|
672
|
+
toggleSelected(t) {
|
|
673
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((s) => s !== t) : this.selectedValues = [...this.selectedValues, t] : this.selectedValues = [t]);
|
|
674
|
+
}
|
|
675
|
+
#i(t) {
|
|
676
|
+
if (t !== this.#r) {
|
|
677
|
+
this.#r = t;
|
|
678
|
+
const s = this.options;
|
|
679
|
+
t && this.#t ? this.filteredOptions = s.filter((n) => this.#t?.(t, n)) : this.filteredOptions = [...s];
|
|
680
|
+
const e = B(this.focusedValue, this.filteredOptions);
|
|
681
|
+
this.#s = d(e, 0, this.filteredOptions);
|
|
682
|
+
const i = this.filteredOptions[this.#s];
|
|
683
|
+
i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
var X = class extends p {
|
|
688
|
+
get cursor() {
|
|
689
|
+
return this.value ? 0 : 1;
|
|
690
|
+
}
|
|
691
|
+
get _value() {
|
|
692
|
+
return this.cursor === 0;
|
|
693
|
+
}
|
|
694
|
+
constructor(t) {
|
|
695
|
+
super(t, !1), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
696
|
+
this.value = this._value;
|
|
697
|
+
}), this.on("confirm", (s) => {
|
|
698
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
|
|
699
|
+
}), this.on("cursor", () => {
|
|
700
|
+
this.value = !this.value;
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
var ot$1 = class extends p {
|
|
705
|
+
_mask = "•";
|
|
706
|
+
get cursor() {
|
|
707
|
+
return this._cursor;
|
|
708
|
+
}
|
|
709
|
+
get masked() {
|
|
710
|
+
return this.userInput.replaceAll(/./g, this._mask);
|
|
711
|
+
}
|
|
712
|
+
get userInputWithCursor() {
|
|
713
|
+
if (this.state === "submit" || this.state === "cancel") return this.masked;
|
|
714
|
+
const t = this.userInput;
|
|
715
|
+
if (this.cursor >= t.length) return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
|
|
716
|
+
const s = this.masked, e = s.slice(0, this.cursor), i = s.slice(this.cursor);
|
|
717
|
+
return `${e}${styleText("inverse", i[0])}${i.slice(1)}`;
|
|
718
|
+
}
|
|
719
|
+
clear() {
|
|
720
|
+
this._clearUserInput();
|
|
721
|
+
}
|
|
722
|
+
constructor({ mask: t, ...s }) {
|
|
723
|
+
super(s), this._mask = t ?? "•", this.on("userInput", (e) => {
|
|
724
|
+
this._setValue(e);
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
var ut$1 = class extends p {
|
|
729
|
+
options;
|
|
730
|
+
cursor = 0;
|
|
731
|
+
get _selectedValue() {
|
|
732
|
+
return this.options[this.cursor];
|
|
733
|
+
}
|
|
734
|
+
changeValue() {
|
|
735
|
+
this.value = this._selectedValue.value;
|
|
736
|
+
}
|
|
737
|
+
constructor(t) {
|
|
738
|
+
super(t, !1), this.options = t.options;
|
|
739
|
+
const s = this.options.findIndex(({ value: i }) => i === t.initialValue), e = s === -1 ? 0 : s;
|
|
740
|
+
this.cursor = this.options[e].disabled ? d(e, 1, this.options) : e, this.changeValue(), this.on("cursor", (i) => {
|
|
741
|
+
switch (i) {
|
|
742
|
+
case "left":
|
|
743
|
+
case "up":
|
|
744
|
+
this.cursor = d(this.cursor, -1, this.options);
|
|
745
|
+
break;
|
|
746
|
+
case "down":
|
|
747
|
+
case "right":
|
|
748
|
+
this.cursor = d(this.cursor, 1, this.options);
|
|
749
|
+
break;
|
|
750
|
+
}
|
|
751
|
+
this.changeValue();
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
var ht$1 = class extends p {
|
|
756
|
+
get userInputWithCursor() {
|
|
757
|
+
if (this.state === "submit") return this.userInput;
|
|
758
|
+
const t = this.userInput;
|
|
759
|
+
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
760
|
+
const s = t.slice(0, this.cursor), [e, ...i] = t.slice(this.cursor);
|
|
761
|
+
return `${s}${styleText("inverse", e)}${i.join("")}`;
|
|
762
|
+
}
|
|
763
|
+
get cursor() {
|
|
764
|
+
return this._cursor;
|
|
765
|
+
}
|
|
766
|
+
constructor(t) {
|
|
767
|
+
super({
|
|
768
|
+
...t,
|
|
769
|
+
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
770
|
+
}), this.on("userInput", (s) => {
|
|
771
|
+
this._setValue(s);
|
|
772
|
+
}), this.on("finalize", () => {
|
|
773
|
+
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
//#endregion
|
|
778
|
+
//#region ../../node_modules/.pnpm/@clack+prompts@1.3.0/node_modules/@clack/prompts/dist/index.mjs
|
|
779
|
+
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
780
|
+
S_BAR: () => $,
|
|
781
|
+
S_BAR_END: () => E$1,
|
|
782
|
+
S_BAR_END_RIGHT: () => Et,
|
|
783
|
+
S_BAR_H: () => st,
|
|
784
|
+
S_BAR_START: () => lt,
|
|
785
|
+
S_BAR_START_RIGHT: () => It,
|
|
786
|
+
S_CHECKBOX_ACTIVE: () => et,
|
|
787
|
+
S_CHECKBOX_INACTIVE: () => J,
|
|
788
|
+
S_CHECKBOX_SELECTED: () => U,
|
|
789
|
+
S_CONNECT_LEFT: () => xt,
|
|
790
|
+
S_CORNER_BOTTOM_LEFT: () => dt,
|
|
791
|
+
S_CORNER_BOTTOM_RIGHT: () => $t,
|
|
792
|
+
S_CORNER_TOP_LEFT: () => Ot,
|
|
793
|
+
S_CORNER_TOP_RIGHT: () => ct,
|
|
794
|
+
S_ERROR: () => gt,
|
|
795
|
+
S_INFO: () => ht,
|
|
796
|
+
S_PASSWORD_MASK: () => Gt,
|
|
797
|
+
S_RADIO_ACTIVE: () => z,
|
|
798
|
+
S_RADIO_INACTIVE: () => H,
|
|
799
|
+
S_STEP_ACTIVE: () => _t,
|
|
800
|
+
S_STEP_CANCEL: () => ot,
|
|
801
|
+
S_STEP_ERROR: () => ut,
|
|
802
|
+
S_STEP_SUBMIT: () => F,
|
|
803
|
+
S_SUCCESS: () => pt,
|
|
804
|
+
S_WARN: () => mt,
|
|
805
|
+
autocomplete: () => At,
|
|
806
|
+
cancel: () => me,
|
|
807
|
+
confirm: () => ue,
|
|
808
|
+
intro: () => ge,
|
|
809
|
+
isCI: () => at,
|
|
810
|
+
isCancel: () => q,
|
|
811
|
+
isTTY: () => Tt,
|
|
812
|
+
limitOptions: () => Y,
|
|
813
|
+
log: () => R,
|
|
814
|
+
note: () => Se,
|
|
815
|
+
outro: () => ye,
|
|
816
|
+
password: () => Ce,
|
|
817
|
+
select: () => Ee,
|
|
818
|
+
spinner: () => ft,
|
|
819
|
+
stream: () => K,
|
|
820
|
+
symbol: () => M,
|
|
821
|
+
symbolBar: () => yt,
|
|
822
|
+
text: () => Re,
|
|
823
|
+
unicode: () => tt,
|
|
824
|
+
unicodeOr: () => w
|
|
825
|
+
});
|
|
826
|
+
function te() {
|
|
827
|
+
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";
|
|
828
|
+
}
|
|
829
|
+
const tt = te(), at = () => process.env.CI === "true", Tt = (t) => t.isTTY === !0, w = (t, r) => tt ? t : r, _t = w("◆", "*"), ot = w("■", "x"), ut = w("▲", "x"), F = w("◇", "o"), lt = w("┌", "T"), $ = w("│", "|"), E$1 = w("└", "—"), It = w("┐", "T"), Et = w("┘", "—"), z = w("●", ">"), H = w("○", " "), et = w("◻", "[•]"), U = w("◼", "[+]"), J = w("◻", "[ ]"), Gt = w("▪", "•"), st = w("─", "-"), ct = w("╮", "+"), xt = w("├", "+"), $t = w("╯", "+"), dt = w("╰", "+"), Ot = w("╭", "+"), ht = w("●", "•"), pt = w("◆", "*"), mt = w("▲", "!"), gt = w("■", "x"), M = (t) => {
|
|
830
|
+
switch (t) {
|
|
831
|
+
case "initial":
|
|
832
|
+
case "active": return styleText("cyan", _t);
|
|
833
|
+
case "cancel": return styleText("red", ot);
|
|
834
|
+
case "error": return styleText("yellow", ut);
|
|
835
|
+
case "submit": return styleText("green", F);
|
|
836
|
+
}
|
|
837
|
+
}, yt = (t) => {
|
|
838
|
+
switch (t) {
|
|
839
|
+
case "initial":
|
|
840
|
+
case "active": return styleText("cyan", $);
|
|
841
|
+
case "cancel": return styleText("red", $);
|
|
842
|
+
case "error": return styleText("yellow", $);
|
|
843
|
+
case "submit": return styleText("green", $);
|
|
844
|
+
}
|
|
845
|
+
}, ee = (t, r, s, i, u) => {
|
|
846
|
+
let n = r, o = 0;
|
|
847
|
+
for (let c = s; c < i; c++) {
|
|
848
|
+
const a = t[c];
|
|
849
|
+
if (n = n - a.length, o++, n <= u) break;
|
|
850
|
+
}
|
|
851
|
+
return {
|
|
852
|
+
lineCount: n,
|
|
853
|
+
removals: o
|
|
854
|
+
};
|
|
855
|
+
}, Y = ({ cursor: t, options: r, style: s, output: i = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
|
|
856
|
+
const c = A(i) - n, a = L(i), l = styleText("dim", "..."), d = Math.max(a - o, 0), y = Math.max(Math.min(u, d), 5);
|
|
857
|
+
let p = 0;
|
|
858
|
+
t >= y - 3 && (p = Math.max(Math.min(t - y + 3, r.length - y), 0));
|
|
859
|
+
let m = y < r.length && p > 0, g = y < r.length && p + y < r.length;
|
|
860
|
+
const S = Math.min(p + y, r.length), h = [];
|
|
861
|
+
let f = 0;
|
|
862
|
+
m && f++, g && f++;
|
|
863
|
+
const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
|
|
864
|
+
for (let b = v; b < T; b++) {
|
|
865
|
+
const G = wrapAnsi(s(r[b], b === t), c, {
|
|
866
|
+
hard: !0,
|
|
867
|
+
trim: !1
|
|
868
|
+
}).split(`
|
|
869
|
+
`);
|
|
870
|
+
h.push(G), f += G.length;
|
|
871
|
+
}
|
|
872
|
+
if (f > d) {
|
|
873
|
+
let b = 0, G = 0, x = f;
|
|
874
|
+
const A = t - v, P = (N, D) => ee(h, x, N, D, d);
|
|
875
|
+
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));
|
|
876
|
+
}
|
|
877
|
+
const C = [];
|
|
878
|
+
m && C.push(l);
|
|
879
|
+
for (const b of h) for (const G of b) C.push(G);
|
|
880
|
+
return g && C.push(l), C;
|
|
881
|
+
};
|
|
882
|
+
function Mt(t) {
|
|
883
|
+
return t.label ?? String(t.value ?? "");
|
|
884
|
+
}
|
|
885
|
+
function Rt(t, r) {
|
|
886
|
+
if (!t) return !0;
|
|
887
|
+
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), u = String(r.value).toLowerCase(), n = t.toLowerCase();
|
|
888
|
+
return s.includes(n) || i.includes(n) || u.includes(n);
|
|
889
|
+
}
|
|
890
|
+
function se(t, r) {
|
|
891
|
+
const s = [];
|
|
892
|
+
for (const i of r) t.includes(i.value) && s.push(i);
|
|
893
|
+
return s;
|
|
894
|
+
}
|
|
895
|
+
const At = (t) => new Q$1({
|
|
896
|
+
options: t.options,
|
|
897
|
+
initialValue: t.initialValue ? [t.initialValue] : void 0,
|
|
898
|
+
initialUserInput: t.initialUserInput,
|
|
899
|
+
placeholder: t.placeholder,
|
|
900
|
+
filter: t.filter ?? ((r, s) => Rt(r, s)),
|
|
901
|
+
signal: t.signal,
|
|
902
|
+
input: t.input,
|
|
903
|
+
output: t.output,
|
|
904
|
+
validate: t.validate,
|
|
905
|
+
render() {
|
|
906
|
+
const r = t.withGuide ?? h.withGuide, s = r ? [`${styleText("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) => {
|
|
907
|
+
const d = Mt(a), y = a.hint && a.value === this.focusedValue ? styleText("dim", ` (${a.hint})`) : "";
|
|
908
|
+
switch (l) {
|
|
909
|
+
case "active": return `${styleText("green", z)} ${d}${y}`;
|
|
910
|
+
case "inactive": return `${styleText("dim", H)} ${styleText("dim", d)}`;
|
|
911
|
+
case "disabled": return `${styleText("gray", H)} ${styleText(["strikethrough", "gray"], d)}`;
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
switch (this.state) {
|
|
915
|
+
case "submit": {
|
|
916
|
+
const a = se(this.selectedValues, u), l = a.length > 0 ? ` ${styleText("dim", a.map(Mt).join(", "))}` : "", d = r ? styleText("gray", $) : "";
|
|
917
|
+
return `${s.join(`
|
|
918
|
+
`)}
|
|
919
|
+
${d}${l}`;
|
|
920
|
+
}
|
|
921
|
+
case "cancel": {
|
|
922
|
+
const a = i ? ` ${styleText(["strikethrough", "dim"], i)}` : "", l = r ? styleText("gray", $) : "";
|
|
923
|
+
return `${s.join(`
|
|
924
|
+
`)}
|
|
925
|
+
${l}${a}`;
|
|
926
|
+
}
|
|
927
|
+
default: {
|
|
928
|
+
const a = this.state === "error" ? "yellow" : "cyan", l = r ? `${styleText(a, $)} ` : "", d = r ? styleText(a, E$1) : "";
|
|
929
|
+
let y = "";
|
|
930
|
+
if (this.isNavigating || o) {
|
|
931
|
+
const v = o ? n : i;
|
|
932
|
+
y = v !== "" ? ` ${styleText("dim", v)}` : "";
|
|
933
|
+
} else y = ` ${this.userInputWithCursor}`;
|
|
934
|
+
const p = this.filteredOptions.length !== u.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", m = this.filteredOptions.length === 0 && i ? [`${l}${styleText("yellow", "No matches found")}`] : [], g = this.state === "error" ? [`${l}${styleText("yellow", this.error)}`] : [];
|
|
935
|
+
r && s.push(`${l.trimEnd()}`), s.push(`${l}${styleText("dim", "Search:")}${y}${p}`, ...m, ...g);
|
|
936
|
+
const h = [`${l}${[
|
|
937
|
+
`${styleText("dim", "↑/↓")} to select`,
|
|
938
|
+
`${styleText("dim", "Enter:")} confirm`,
|
|
939
|
+
`${styleText("dim", "Type:")} to search`
|
|
940
|
+
].join(" • ")}`, d], f = this.filteredOptions.length === 0 ? [] : Y({
|
|
941
|
+
cursor: this.cursor,
|
|
942
|
+
options: this.filteredOptions,
|
|
943
|
+
columnPadding: r ? 3 : 0,
|
|
944
|
+
rowPadding: s.length + h.length,
|
|
945
|
+
style: (v, T) => c(v, v.disabled ? "disabled" : T ? "active" : "inactive"),
|
|
946
|
+
maxItems: t.maxItems,
|
|
947
|
+
output: t.output
|
|
948
|
+
});
|
|
949
|
+
return [
|
|
950
|
+
...s,
|
|
951
|
+
...f.map((v) => `${l}${v}`),
|
|
952
|
+
...h
|
|
953
|
+
].join(`
|
|
954
|
+
`);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}).prompt(), ue = (t) => {
|
|
959
|
+
const r = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
960
|
+
return new X({
|
|
961
|
+
active: r,
|
|
962
|
+
inactive: s,
|
|
963
|
+
signal: t.signal,
|
|
964
|
+
input: t.input,
|
|
965
|
+
output: t.output,
|
|
966
|
+
initialValue: t.initialValue ?? !0,
|
|
967
|
+
render() {
|
|
968
|
+
const i = t.withGuide ?? h.withGuide, u = `${M(this.state)} `, n = i ? `${styleText("gray", $)} ` : "", o = W(t.output, t.message, n, u), c = `${i ? `${styleText("gray", $)}
|
|
969
|
+
` : ""}${o}
|
|
970
|
+
`, a = this.value ? r : s;
|
|
971
|
+
switch (this.state) {
|
|
972
|
+
case "submit": return `${c}${i ? `${styleText("gray", $)} ` : ""}${styleText("dim", a)}`;
|
|
973
|
+
case "cancel": return `${c}${i ? `${styleText("gray", $)} ` : ""}${styleText(["strikethrough", "dim"], a)}${i ? `
|
|
974
|
+
${styleText("gray", $)}` : ""}`;
|
|
975
|
+
default: {
|
|
976
|
+
const l = i ? `${styleText("cyan", $)} ` : "", d = i ? styleText("cyan", E$1) : "";
|
|
977
|
+
return `${c}${l}${this.value ? `${styleText("green", z)} ${r}` : `${styleText("dim", H)} ${styleText("dim", r)}`}${t.vertical ? i ? `
|
|
978
|
+
${styleText("cyan", $)} ` : `
|
|
979
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
980
|
+
${d}
|
|
981
|
+
`;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}).prompt();
|
|
986
|
+
}, R = {
|
|
987
|
+
message: (t = [], { symbol: r = styleText("gray", $), secondarySymbol: s = styleText("gray", $), output: i = process.stdout, spacing: u = 1, withGuide: n } = {}) => {
|
|
988
|
+
const o = [], c = n ?? h.withGuide, a = c ? s : "", l = c ? `${r} ` : "", d = c ? `${s} ` : "";
|
|
989
|
+
for (let p = 0; p < u; p++) o.push(a);
|
|
990
|
+
const y = Array.isArray(t) ? t : t.split(`
|
|
991
|
+
`);
|
|
992
|
+
if (y.length > 0) {
|
|
993
|
+
const [p, ...m] = y;
|
|
994
|
+
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? r : "");
|
|
995
|
+
for (const g of m) g.length > 0 ? o.push(`${d}${g}`) : o.push(c ? s : "");
|
|
996
|
+
}
|
|
997
|
+
i.write(`${o.join(`
|
|
998
|
+
`)}
|
|
999
|
+
`);
|
|
1000
|
+
},
|
|
1001
|
+
info: (t, r) => {
|
|
1002
|
+
R.message(t, {
|
|
1003
|
+
...r,
|
|
1004
|
+
symbol: styleText("blue", ht)
|
|
1005
|
+
});
|
|
1006
|
+
},
|
|
1007
|
+
success: (t, r) => {
|
|
1008
|
+
R.message(t, {
|
|
1009
|
+
...r,
|
|
1010
|
+
symbol: styleText("green", pt)
|
|
1011
|
+
});
|
|
1012
|
+
},
|
|
1013
|
+
step: (t, r) => {
|
|
1014
|
+
R.message(t, {
|
|
1015
|
+
...r,
|
|
1016
|
+
symbol: styleText("green", F)
|
|
1017
|
+
});
|
|
1018
|
+
},
|
|
1019
|
+
warn: (t, r) => {
|
|
1020
|
+
R.message(t, {
|
|
1021
|
+
...r,
|
|
1022
|
+
symbol: styleText("yellow", mt)
|
|
1023
|
+
});
|
|
1024
|
+
},
|
|
1025
|
+
warning: (t, r) => {
|
|
1026
|
+
R.warn(t, r);
|
|
1027
|
+
},
|
|
1028
|
+
error: (t, r) => {
|
|
1029
|
+
R.message(t, {
|
|
1030
|
+
...r,
|
|
1031
|
+
symbol: styleText("red", gt)
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
}, me = (t = "", r) => {
|
|
1035
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? h.withGuide ? `${styleText("gray", E$1)} ` : "";
|
|
1036
|
+
s.write(`${i}${styleText("red", t)}
|
|
1037
|
+
|
|
1038
|
+
`);
|
|
1039
|
+
}, ge = (t = "", r) => {
|
|
1040
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? h.withGuide ? `${styleText("gray", lt)} ` : "";
|
|
1041
|
+
s.write(`${i}${t}
|
|
1042
|
+
`);
|
|
1043
|
+
}, ye = (t = "", r) => {
|
|
1044
|
+
const s = r?.output ?? process.stdout, i = r?.withGuide ?? h.withGuide ? `${styleText("gray", $)}
|
|
1045
|
+
${styleText("gray", E$1)} ` : "";
|
|
1046
|
+
s.write(`${i}${t}
|
|
1047
|
+
|
|
1048
|
+
`);
|
|
1049
|
+
}, we = (t) => styleText("dim", t), be = (t, r, s) => {
|
|
1050
|
+
const i = {
|
|
1051
|
+
hard: !0,
|
|
1052
|
+
trim: !1
|
|
1053
|
+
}, u = wrapAnsi(t, r, i).split(`
|
|
1054
|
+
`), n = u.reduce((a, l) => Math.max(fastStringWidth(l), a), 0);
|
|
1055
|
+
return wrapAnsi(t, r - (u.map(s).reduce((a, l) => Math.max(fastStringWidth(l), a), 0) - n), i);
|
|
1056
|
+
}, Se = (t = "", r = "", s) => {
|
|
1057
|
+
const i = s?.output ?? j.stdout, u = s?.withGuide ?? h.withGuide, n = s?.format ?? we, o = [
|
|
1058
|
+
"",
|
|
1059
|
+
...be(t, A(i) - 6, n).split(`
|
|
1060
|
+
`).map(n),
|
|
1061
|
+
""
|
|
1062
|
+
], c = fastStringWidth(r), a = Math.max(o.reduce((p, m) => {
|
|
1063
|
+
const g = fastStringWidth(m);
|
|
1064
|
+
return g > p ? g : p;
|
|
1065
|
+
}, 0), c) + 2, l = o.map((p) => `${styleText("gray", $)} ${p}${" ".repeat(a - fastStringWidth(p))}${styleText("gray", $)}`).join(`
|
|
1066
|
+
`), d = u ? `${styleText("gray", $)}
|
|
1067
|
+
` : "", y = u ? xt : dt;
|
|
1068
|
+
i.write(`${d}${styleText("green", F)} ${styleText("reset", r)} ${styleText("gray", st.repeat(Math.max(a - c - 1, 1)) + ct)}
|
|
1069
|
+
${l}
|
|
1070
|
+
${styleText("gray", y + st.repeat(a + 2) + $t)}
|
|
1071
|
+
`);
|
|
1072
|
+
}, Ce = (t) => new ot$1({
|
|
1073
|
+
validate: t.validate,
|
|
1074
|
+
mask: t.mask ?? Gt,
|
|
1075
|
+
signal: t.signal,
|
|
1076
|
+
input: t.input,
|
|
1077
|
+
output: t.output,
|
|
1078
|
+
render() {
|
|
1079
|
+
const r = t.withGuide ?? h.withGuide, s = `${r ? `${styleText("gray", $)}
|
|
1080
|
+
` : ""}${M(this.state)} ${t.message}
|
|
1081
|
+
`, i = this.userInputWithCursor, u = this.masked;
|
|
1082
|
+
switch (this.state) {
|
|
1083
|
+
case "error": {
|
|
1084
|
+
const n = r ? `${styleText("yellow", $)} ` : "", o = r ? `${styleText("yellow", E$1)} ` : "", c = u ?? "";
|
|
1085
|
+
return t.clearOnError && this.clear(), `${s.trim()}
|
|
1086
|
+
${n}${c}
|
|
1087
|
+
${o}${styleText("yellow", this.error)}
|
|
1088
|
+
`;
|
|
1089
|
+
}
|
|
1090
|
+
case "submit": return `${s}${r ? `${styleText("gray", $)} ` : ""}${u ? styleText("dim", u) : ""}`;
|
|
1091
|
+
case "cancel": return `${s}${r ? `${styleText("gray", $)} ` : ""}${u ? styleText(["strikethrough", "dim"], u) : ""}${u && r ? `
|
|
1092
|
+
${styleText("gray", $)}` : ""}`;
|
|
1093
|
+
default: return `${s}${r ? `${styleText("cyan", $)} ` : ""}${i}
|
|
1094
|
+
${r ? styleText("cyan", E$1) : ""}
|
|
1095
|
+
`;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}).prompt(), _e = (t) => styleText("magenta", t), ft = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: u, frames: n = tt ? [
|
|
1099
|
+
"◒",
|
|
1100
|
+
"◐",
|
|
1101
|
+
"◓",
|
|
1102
|
+
"◑"
|
|
1103
|
+
] : [
|
|
1104
|
+
"•",
|
|
1105
|
+
"o",
|
|
1106
|
+
"O",
|
|
1107
|
+
"0"
|
|
1108
|
+
], delay: o = tt ? 80 : 120, signal: c, ...a } = {}) => {
|
|
1109
|
+
const l = at();
|
|
1110
|
+
let d, y, p = !1, m = !1, g = "", S, h$2 = performance.now();
|
|
1111
|
+
const f = A(s), v = a?.styleFrame ?? _e, T = (I) => {
|
|
1112
|
+
const V = I > 1 ? u ?? h.messages.error : i ?? h.messages.cancel;
|
|
1113
|
+
m = I === 1, p && (W(V, I), m && typeof r == "function" && r());
|
|
1114
|
+
}, C = () => T(2), b = () => T(1), G = () => {
|
|
1115
|
+
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);
|
|
1116
|
+
}, x = () => {
|
|
1117
|
+
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);
|
|
1118
|
+
}, A$2 = () => {
|
|
1119
|
+
if (S === void 0) return;
|
|
1120
|
+
l && s.write(`
|
|
1121
|
+
`);
|
|
1122
|
+
const I = wrapAnsi(S, f, {
|
|
1123
|
+
hard: !0,
|
|
1124
|
+
trim: !1
|
|
1125
|
+
}).split(`
|
|
1126
|
+
`);
|
|
1127
|
+
I.length > 1 && s.write(import_src.cursor.up(I.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1128
|
+
}, P = (I) => I.replace(/\.+$/, ""), N = (I) => {
|
|
1129
|
+
const V = (performance.now() - I) / 1e3, B = Math.floor(V / 60), L = Math.floor(V % 60);
|
|
1130
|
+
return B > 0 ? `[${B}m ${L}s]` : `[${L}s]`;
|
|
1131
|
+
}, D = a.withGuide ?? h.withGuide, rt = (I = "") => {
|
|
1132
|
+
p = !0, d = R$1({ output: s }), g = P(I), h$2 = performance.now(), D && s.write(`${styleText("gray", $)}
|
|
1133
|
+
`);
|
|
1134
|
+
let V = 0, B = 0;
|
|
1135
|
+
G(), y = setInterval(() => {
|
|
1136
|
+
if (l && g === S) return;
|
|
1137
|
+
A$2(), S = g;
|
|
1138
|
+
const L = v(n[V]);
|
|
1139
|
+
let Z;
|
|
1140
|
+
if (l) Z = `${L} ${g}...`;
|
|
1141
|
+
else if (t === "timer") Z = `${L} ${g} ${N(h$2)}`;
|
|
1142
|
+
else {
|
|
1143
|
+
const kt = ".".repeat(Math.floor(B)).slice(0, 3);
|
|
1144
|
+
Z = `${L} ${g}${kt}`;
|
|
1145
|
+
}
|
|
1146
|
+
const Nt = wrapAnsi(Z, f, {
|
|
1147
|
+
hard: !0,
|
|
1148
|
+
trim: !1
|
|
1149
|
+
});
|
|
1150
|
+
s.write(Nt), V = V + 1 < n.length ? V + 1 : 0, B = B < 4 ? B + .125 : 0;
|
|
1151
|
+
}, o);
|
|
1152
|
+
}, W = (I = "", V = 0, B = !1) => {
|
|
1153
|
+
if (!p) return;
|
|
1154
|
+
p = !1, clearInterval(y), A$2();
|
|
1155
|
+
const L = V === 0 ? styleText("green", F) : V === 1 ? styleText("red", ot) : styleText("red", ut);
|
|
1156
|
+
g = I ?? g, B || (t === "timer" ? s.write(`${L} ${g} ${N(h$2)}
|
|
1157
|
+
`) : s.write(`${L} ${g}
|
|
1158
|
+
`)), x(), d();
|
|
1159
|
+
};
|
|
1160
|
+
return {
|
|
1161
|
+
start: rt,
|
|
1162
|
+
stop: (I = "") => W(I, 0),
|
|
1163
|
+
message: (I = "") => {
|
|
1164
|
+
g = P(I ?? g);
|
|
1165
|
+
},
|
|
1166
|
+
cancel: (I = "") => W(I, 1),
|
|
1167
|
+
error: (I = "") => W(I, 2),
|
|
1168
|
+
clear: () => W("", 0, !0),
|
|
1169
|
+
get isCancelled() {
|
|
1170
|
+
return m;
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
};
|
|
1174
|
+
w("─", "-"), w("━", "="), w("█", "#");
|
|
1175
|
+
const it = (t, r) => t.includes(`
|
|
1176
|
+
`) ? t.split(`
|
|
1177
|
+
`).map((s) => r(s)).join(`
|
|
1178
|
+
`) : r(t), Ee = (t) => {
|
|
1179
|
+
const r = (s, i) => {
|
|
1180
|
+
const u = s.label ?? String(s.value);
|
|
1181
|
+
switch (i) {
|
|
1182
|
+
case "disabled": return `${styleText("gray", H)} ${it(u, (n) => styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1183
|
+
case "selected": return `${it(u, (n) => styleText("dim", n))}`;
|
|
1184
|
+
case "active": return `${styleText("green", z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
1185
|
+
case "cancelled": return `${it(u, (n) => styleText(["strikethrough", "dim"], n))}`;
|
|
1186
|
+
default: return `${styleText("dim", H)} ${it(u, (n) => styleText("dim", n))}`;
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
return new ut$1({
|
|
1190
|
+
options: t.options,
|
|
1191
|
+
signal: t.signal,
|
|
1192
|
+
input: t.input,
|
|
1193
|
+
output: t.output,
|
|
1194
|
+
initialValue: t.initialValue,
|
|
1195
|
+
render() {
|
|
1196
|
+
const s = t.withGuide ?? h.withGuide, i = `${M(this.state)} `, u = `${yt(this.state)} `, n = W(t.output, t.message, u, i), o = `${s ? `${styleText("gray", $)}
|
|
1197
|
+
` : ""}${n}
|
|
1198
|
+
`;
|
|
1199
|
+
switch (this.state) {
|
|
1200
|
+
case "submit": {
|
|
1201
|
+
const c = s ? `${styleText("gray", $)} ` : "";
|
|
1202
|
+
return `${o}${W(t.output, r(this.options[this.cursor], "selected"), c)}`;
|
|
1203
|
+
}
|
|
1204
|
+
case "cancel": {
|
|
1205
|
+
const c = s ? `${styleText("gray", $)} ` : "";
|
|
1206
|
+
return `${o}${W(t.output, r(this.options[this.cursor], "cancelled"), c)}${s ? `
|
|
1207
|
+
${styleText("gray", $)}` : ""}`;
|
|
1208
|
+
}
|
|
1209
|
+
default: {
|
|
1210
|
+
const c = s ? `${styleText("cyan", $)} ` : "", a = s ? styleText("cyan", E$1) : "", l = o.split(`
|
|
1211
|
+
`).length, d = s ? 2 : 1;
|
|
1212
|
+
return `${o}${c}${Y({
|
|
1213
|
+
output: t.output,
|
|
1214
|
+
cursor: this.cursor,
|
|
1215
|
+
options: this.options,
|
|
1216
|
+
maxItems: t.maxItems,
|
|
1217
|
+
columnPadding: c.length,
|
|
1218
|
+
rowPadding: l + d,
|
|
1219
|
+
style: (y, p) => r(y, y.disabled ? "disabled" : p ? "active" : "inactive")
|
|
1220
|
+
}).join(`
|
|
1221
|
+
${c}`)}
|
|
1222
|
+
${a}
|
|
1223
|
+
`;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}).prompt();
|
|
1228
|
+
}, jt = `${styleText("gray", $)} `, K = {
|
|
1229
|
+
message: async (t, { symbol: r = styleText("gray", $) } = {}) => {
|
|
1230
|
+
process.stdout.write(`${styleText("gray", $)}
|
|
1231
|
+
${r} `);
|
|
1232
|
+
let s = 3;
|
|
1233
|
+
for await (let i of t) {
|
|
1234
|
+
i = i.replace(/\n/g, `
|
|
1235
|
+
${jt}`), i.includes(`
|
|
1236
|
+
`) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
1237
|
+
`))).length);
|
|
1238
|
+
const u = stripVTControlCharacters(i).length;
|
|
1239
|
+
s + u < process.stdout.columns ? (s += u, process.stdout.write(i)) : (process.stdout.write(`
|
|
1240
|
+
${jt}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
|
|
1241
|
+
}
|
|
1242
|
+
process.stdout.write(`
|
|
1243
|
+
`);
|
|
1244
|
+
},
|
|
1245
|
+
info: (t) => K.message(t, { symbol: styleText("blue", ht) }),
|
|
1246
|
+
success: (t) => K.message(t, { symbol: styleText("green", pt) }),
|
|
1247
|
+
step: (t) => K.message(t, { symbol: styleText("green", F) }),
|
|
1248
|
+
warn: (t) => K.message(t, { symbol: styleText("yellow", mt) }),
|
|
1249
|
+
warning: (t) => K.warn(t),
|
|
1250
|
+
error: (t) => K.message(t, { symbol: styleText("red", gt) })
|
|
1251
|
+
}, Re = (t) => new ht$1({
|
|
1252
|
+
validate: t.validate,
|
|
1253
|
+
placeholder: t.placeholder,
|
|
1254
|
+
defaultValue: t.defaultValue,
|
|
1255
|
+
initialValue: t.initialValue,
|
|
1256
|
+
output: t.output,
|
|
1257
|
+
signal: t.signal,
|
|
1258
|
+
input: t.input,
|
|
1259
|
+
render() {
|
|
1260
|
+
const r = t?.withGuide ?? h.withGuide, s = `${`${r ? `${styleText("gray", $)}
|
|
1261
|
+
` : ""}${M(this.state)} `}${t.message}
|
|
1262
|
+
`, i = t.placeholder ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), u = this.userInput ? this.userInputWithCursor : i, n = this.value ?? "";
|
|
1263
|
+
switch (this.state) {
|
|
1264
|
+
case "error": {
|
|
1265
|
+
const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c = r ? `${styleText("yellow", $)} ` : "", a = r ? styleText("yellow", E$1) : "";
|
|
1266
|
+
return `${s.trim()}
|
|
1267
|
+
${c}${u}
|
|
1268
|
+
${a}${o}
|
|
1269
|
+
`;
|
|
1270
|
+
}
|
|
1271
|
+
case "submit": {
|
|
1272
|
+
const o = n ? ` ${styleText("dim", n)}` : "";
|
|
1273
|
+
return `${s}${r ? styleText("gray", $) : ""}${o}`;
|
|
1274
|
+
}
|
|
1275
|
+
case "cancel": {
|
|
1276
|
+
const o = n ? ` ${styleText(["strikethrough", "dim"], n)}` : "", c = r ? styleText("gray", $) : "";
|
|
1277
|
+
return `${s}${c}${o}${n.trim() ? `
|
|
1278
|
+
${c}` : ""}`;
|
|
1279
|
+
}
|
|
1280
|
+
default: return `${s}${r ? `${styleText("cyan", $)} ` : ""}${u}
|
|
1281
|
+
${r ? styleText("cyan", E$1) : ""}
|
|
1282
|
+
`;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}).prompt();
|
|
1286
|
+
//#endregion
|
|
1287
|
+
export { me as _, F as a, z as b, R as c, _t as d, at as f, ge as g, ft as h, Ee as i, Re as l, et as m, Ce as n, H as o, dist_exports as p, E$1 as r, J as s, $ as t, Se as u, ue as v, q as x, ye as y };
|