create-dubhe 0.0.1
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/index.mjs +100 -0
- package/index.js +3 -0
- package/package.json +46 -0
- package/template/101/aptos-template/.dockerignore +7 -0
- package/template/101/aptos-template/.eslintrc.json +3 -0
- package/template/101/aptos-template/.prettierrc +8 -0
- package/template/101/aptos-template/Dockerfile +56 -0
- package/template/101/aptos-template/LICENSE +674 -0
- package/template/101/aptos-template/README.md +14 -0
- package/template/101/aptos-template/contracts/counter/Move.toml +16 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
- package/template/101/aptos-template/contracts/counter/sources/entity_key.move +31 -0
- package/template/101/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
- package/template/101/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
- package/template/101/aptos-template/dubhe.config.ts +13 -0
- package/template/101/aptos-template/jest.config.ts +17 -0
- package/template/101/aptos-template/next-env.d.ts +5 -0
- package/template/101/aptos-template/next-i18next.config.js +6 -0
- package/template/101/aptos-template/next.config.js +15 -0
- package/template/101/aptos-template/package.json +83 -0
- package/template/101/aptos-template/postcss.config.js +6 -0
- package/template/101/aptos-template/public/discord.svg +9 -0
- package/template/101/aptos-template/public/fail.svg +12 -0
- package/template/101/aptos-template/public/favicon.ico +0 -0
- package/template/101/aptos-template/public/locales/de/common.json +8 -0
- package/template/101/aptos-template/public/locales/de/footer.json +3 -0
- package/template/101/aptos-template/public/locales/de/second-page.json +5 -0
- package/template/101/aptos-template/public/locales/en/common.json +8 -0
- package/template/101/aptos-template/public/locales/en/footer.json +3 -0
- package/template/101/aptos-template/public/locales/en/second-page.json +5 -0
- package/template/101/aptos-template/public/locales/zn/common.json +8 -0
- package/template/101/aptos-template/public/locales/zn/footer.json +3 -0
- package/template/101/aptos-template/public/locales/zn/second-page.json +5 -0
- package/template/101/aptos-template/public/logo.svg +1 -0
- package/template/101/aptos-template/public/medium.svg +9 -0
- package/template/101/aptos-template/public/successful.svg +11 -0
- package/template/101/aptos-template/public/telegram.svg +9 -0
- package/template/101/aptos-template/public/twitter.svg +9 -0
- package/template/101/aptos-template/scripts/formatAccount.ts +35 -0
- package/template/101/aptos-template/scripts/generateAccount.ts +25 -0
- package/template/101/aptos-template/scripts/storeConfig.ts +54 -0
- package/template/101/aptos-template/src/chain/config.ts +7 -0
- package/template/101/aptos-template/src/css/font-awesome.css +2337 -0
- package/template/101/aptos-template/src/css/font-awesome.min.css +4 -0
- package/template/101/aptos-template/src/fonts/FontAwesome.otf +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/101/aptos-template/src/jotai/index.tsx +12 -0
- package/template/101/aptos-template/src/pages/_app.tsx +9 -0
- package/template/101/aptos-template/src/pages/home/index.tsx +78 -0
- package/template/101/aptos-template/src/pages/index.tsx +12 -0
- package/template/101/aptos-template/tailwind.config.js +56 -0
- package/template/101/aptos-template/tsconfig.json +25 -0
- package/template/101/sui-template/.dockerignore +7 -0
- package/template/101/sui-template/.eslintrc.json +3 -0
- package/template/101/sui-template/.prettierrc +8 -0
- package/template/101/sui-template/Dockerfile +52 -0
- package/template/101/sui-template/LICENSE +674 -0
- package/template/101/sui-template/README.md +14 -0
- package/template/101/sui-template/contracts/counter/Move.toml +13 -0
- package/template/101/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
- package/template/101/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
- package/template/101/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
- package/template/101/sui-template/contracts/counter/sources/system/counter.move +11 -0
- package/template/101/sui-template/docker-compose.yaml +29 -0
- package/template/101/sui-template/dubhe.config.ts +14 -0
- package/template/101/sui-template/jest.config.ts +17 -0
- package/template/101/sui-template/localnet/dubhe-framework/Move.toml +39 -0
- package/template/101/sui-template/localnet/dubhe-framework/README.md +18 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/access_control.move +35 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/events.move +23 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/resource_id.move +22 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/resource_types.move +18 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/schema.move +36 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/schemas/dapps/dapps.move +73 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/schemas/dapps/metadata.move +96 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/storages/double_map.move +156 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/storages/map.move +159 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/storages/value.move +100 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/systems/dapps.move +90 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/world.move +81 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/dapp.move +16 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/init.move +6 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/obelisk_framework_tests.move +19 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/storage.move +398 -0
- package/template/101/sui-template/next-env.d.ts +5 -0
- package/template/101/sui-template/next-i18next.config.js +6 -0
- package/template/101/sui-template/next.config.js +15 -0
- package/template/101/sui-template/package.json +82 -0
- package/template/101/sui-template/postcss.config.js +6 -0
- package/template/101/sui-template/public/discord.svg +9 -0
- package/template/101/sui-template/public/fail.svg +12 -0
- package/template/101/sui-template/public/favicon.ico +0 -0
- package/template/101/sui-template/public/locales/de/common.json +8 -0
- package/template/101/sui-template/public/locales/de/footer.json +3 -0
- package/template/101/sui-template/public/locales/de/second-page.json +5 -0
- package/template/101/sui-template/public/locales/en/common.json +8 -0
- package/template/101/sui-template/public/locales/en/footer.json +3 -0
- package/template/101/sui-template/public/locales/en/second-page.json +5 -0
- package/template/101/sui-template/public/locales/zn/common.json +8 -0
- package/template/101/sui-template/public/locales/zn/footer.json +3 -0
- package/template/101/sui-template/public/locales/zn/second-page.json +5 -0
- package/template/101/sui-template/public/logo.svg +1 -0
- package/template/101/sui-template/public/medium.svg +9 -0
- package/template/101/sui-template/public/successful.svg +11 -0
- package/template/101/sui-template/public/telegram.svg +9 -0
- package/template/101/sui-template/public/twitter.svg +9 -0
- package/template/101/sui-template/scripts/checkBalance.ts +40 -0
- package/template/101/sui-template/scripts/deployment/common.ts +60 -0
- package/template/101/sui-template/scripts/deployment/localnet/deploy.ts +42 -0
- package/template/101/sui-template/scripts/deployment/testnet/deploy.ts +48 -0
- package/template/101/sui-template/scripts/deployment/types.ts +13 -0
- package/template/101/sui-template/scripts/framework/common.ts +17 -0
- package/template/101/sui-template/scripts/framework/deploy.ts +199 -0
- package/template/101/sui-template/scripts/framework/parse-history.ts +76 -0
- package/template/101/sui-template/scripts/framework/types.ts +8 -0
- package/template/101/sui-template/scripts/generateAccount.ts +55 -0
- package/template/101/sui-template/scripts/storeConfig.ts +61 -0
- package/template/101/sui-template/scripts/waitNode.ts +9 -0
- package/template/101/sui-template/src/chain/config.ts +7 -0
- package/template/101/sui-template/src/css/font-awesome.css +2337 -0
- package/template/101/sui-template/src/css/font-awesome.min.css +4 -0
- package/template/101/sui-template/src/fonts/FontAwesome.otf +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/101/sui-template/src/jotai/index.tsx +12 -0
- package/template/101/sui-template/src/pages/_app.tsx +9 -0
- package/template/101/sui-template/src/pages/home/index.tsx +82 -0
- package/template/101/sui-template/src/pages/index.tsx +14 -0
- package/template/101/sui-template/tailwind.config.js +56 -0
- package/template/101/sui-template/tsconfig.json +25 -0
- package/template/cocos/aptos-template/.creator/asset-template/typescript/Custom Script Template Help Documentation.url +2 -0
- package/template/cocos/aptos-template/README.md +11 -0
- package/template/cocos/aptos-template/assets/Scripts/aptos.ts +87 -0
- package/template/cocos/aptos-template/assets/Scripts/aptos.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/chain/config.ts +12 -0
- package/template/cocos/aptos-template/assets/Scripts/chain/config.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/chain/key.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/chain.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts +13 -0
- package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts.meta +9 -0
- package/template/cocos/aptos-template/assets/lib/dubhe.js +22281 -0
- package/template/cocos/aptos-template/assets/lib/obelisk.js +22281 -0
- package/template/cocos/aptos-template/assets/lib/obelisk.js.meta +15 -0
- package/template/cocos/aptos-template/assets/lib.meta +12 -0
- package/template/cocos/aptos-template/assets/main.scene +875 -0
- package/template/cocos/aptos-template/assets/main.scene.meta +11 -0
- package/template/cocos/aptos-template/contracts/counter/Move.toml +16 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
- package/template/cocos/aptos-template/contracts/counter/sources/entity_key.move +31 -0
- package/template/cocos/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
- package/template/cocos/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
- package/template/cocos/aptos-template/package.json +39 -0
- package/template/cocos/aptos-template/scripts/formatAccount.ts +35 -0
- package/template/cocos/aptos-template/scripts/generateAccount.ts +25 -0
- package/template/cocos/aptos-template/scripts/storeConfig.ts +68 -0
- package/template/cocos/aptos-template/settings/v2/packages/builder.json +3 -0
- package/template/cocos/aptos-template/settings/v2/packages/cocos-service.json +23 -0
- package/template/cocos/aptos-template/settings/v2/packages/device.json +3 -0
- package/template/cocos/aptos-template/settings/v2/packages/engine.json +150 -0
- package/template/cocos/aptos-template/settings/v2/packages/information.json +23 -0
- package/template/cocos/aptos-template/settings/v2/packages/program.json +3 -0
- package/template/cocos/aptos-template/settings/v2/packages/project.json +3 -0
- package/template/cocos/aptos-template/tsconfig.json +12 -0
- package/template/cocos/sui-template/.creator/asset-template/typescript/Custom Script Template Help Documentation.url +2 -0
- package/template/cocos/sui-template/README.md +11 -0
- package/template/cocos/sui-template/assets/Scripts/chain/config.ts +12 -0
- package/template/cocos/sui-template/assets/Scripts/chain/config.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/chain/key.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/chain.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts +13 -0
- package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/sui.ts +120 -0
- package/template/cocos/sui-template/assets/Scripts/sui.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts.meta +12 -0
- package/template/cocos/sui-template/assets/lib/dubhe.js +55694 -0
- package/template/cocos/sui-template/assets/lib/dubhe.js.meta +15 -0
- package/template/cocos/sui-template/assets/lib.meta +12 -0
- package/template/cocos/sui-template/assets/main.scene +875 -0
- package/template/cocos/sui-template/assets/main.scene.meta +11 -0
- package/template/cocos/sui-template/contracts/counter/Move.toml +13 -0
- package/template/cocos/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
- package/template/cocos/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
- package/template/cocos/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
- package/template/cocos/sui-template/contracts/counter/sources/system/counter.move +11 -0
- package/template/cocos/sui-template/docker-compose.yaml +18 -0
- package/template/cocos/sui-template/package.json +27 -0
- package/template/cocos/sui-template/scripts/generateAccount.ts +55 -0
- package/template/cocos/sui-template/scripts/storeConfig.ts +75 -0
- package/template/cocos/sui-template/settings/v2/packages/builder.json +3 -0
- package/template/cocos/sui-template/settings/v2/packages/cocos-service.json +23 -0
- package/template/cocos/sui-template/settings/v2/packages/device.json +3 -0
- package/template/cocos/sui-template/settings/v2/packages/engine.json +150 -0
- package/template/cocos/sui-template/settings/v2/packages/information.json +23 -0
- package/template/cocos/sui-template/settings/v2/packages/program.json +3 -0
- package/template/cocos/sui-template/settings/v2/packages/project.json +3 -0
- package/template/cocos/sui-template/tsconfig.json +19 -0
- package/template/nextjs/aptos-template/.dockerignore +7 -0
- package/template/nextjs/aptos-template/.eslintrc.json +3 -0
- package/template/nextjs/aptos-template/.prettierrc +8 -0
- package/template/nextjs/aptos-template/Dockerfile +56 -0
- package/template/nextjs/aptos-template/LICENSE +674 -0
- package/template/nextjs/aptos-template/README.md +13 -0
- package/template/nextjs/aptos-template/contracts/counter/Move.toml +16 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/entity_key.move +31 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
- package/template/nextjs/aptos-template/dubhe.config.ts +13 -0
- package/template/nextjs/aptos-template/jest.config.ts +17 -0
- package/template/nextjs/aptos-template/next-env.d.ts +5 -0
- package/template/nextjs/aptos-template/next-i18next.config.js +6 -0
- package/template/nextjs/aptos-template/next.config.js +15 -0
- package/template/nextjs/aptos-template/package.json +82 -0
- package/template/nextjs/aptos-template/postcss.config.js +6 -0
- package/template/nextjs/aptos-template/public/discord.svg +9 -0
- package/template/nextjs/aptos-template/public/fail.svg +12 -0
- package/template/nextjs/aptos-template/public/favicon.ico +0 -0
- package/template/nextjs/aptos-template/public/locales/de/common.json +8 -0
- package/template/nextjs/aptos-template/public/locales/de/footer.json +3 -0
- package/template/nextjs/aptos-template/public/locales/de/second-page.json +5 -0
- package/template/nextjs/aptos-template/public/locales/en/common.json +8 -0
- package/template/nextjs/aptos-template/public/locales/en/footer.json +3 -0
- package/template/nextjs/aptos-template/public/locales/en/second-page.json +5 -0
- package/template/nextjs/aptos-template/public/locales/zn/common.json +8 -0
- package/template/nextjs/aptos-template/public/locales/zn/footer.json +3 -0
- package/template/nextjs/aptos-template/public/locales/zn/second-page.json +5 -0
- package/template/nextjs/aptos-template/public/logo.svg +1 -0
- package/template/nextjs/aptos-template/public/medium.svg +9 -0
- package/template/nextjs/aptos-template/public/successful.svg +11 -0
- package/template/nextjs/aptos-template/public/telegram.svg +9 -0
- package/template/nextjs/aptos-template/public/twitter.svg +9 -0
- package/template/nextjs/aptos-template/scripts/formatAccount.ts +35 -0
- package/template/nextjs/aptos-template/scripts/generateAccount.ts +25 -0
- package/template/nextjs/aptos-template/scripts/storeConfig.ts +54 -0
- package/template/nextjs/aptos-template/src/chain/config.ts +7 -0
- package/template/nextjs/aptos-template/src/components/Animation.tsx +80 -0
- package/template/nextjs/aptos-template/src/components/Container.tsx +11 -0
- package/template/nextjs/aptos-template/src/components/footer/index.tsx +138 -0
- package/template/nextjs/aptos-template/src/components/head/index.tsx +14 -0
- package/template/nextjs/aptos-template/src/components/header/index.tsx +173 -0
- package/template/nextjs/aptos-template/src/components/pop_up_box/index.tsx +149 -0
- package/template/nextjs/aptos-template/src/css/font-awesome.css +2337 -0
- package/template/nextjs/aptos-template/src/css/font-awesome.min.css +4 -0
- package/template/nextjs/aptos-template/src/fonts/FontAwesome.otf +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/nextjs/aptos-template/src/jotai/index.tsx +13 -0
- package/template/nextjs/aptos-template/src/pages/_app.tsx +32 -0
- package/template/nextjs/aptos-template/src/pages/home/index.tsx +112 -0
- package/template/nextjs/aptos-template/src/pages/index.tsx +15 -0
- package/template/nextjs/aptos-template/tailwind.config.js +59 -0
- package/template/nextjs/aptos-template/tsconfig.json +35 -0
- package/template/nextjs/sui-template/.dockerignore +7 -0
- package/template/nextjs/sui-template/.eslintrc.json +3 -0
- package/template/nextjs/sui-template/.prettierrc +8 -0
- package/template/nextjs/sui-template/Dockerfile +52 -0
- package/template/nextjs/sui-template/LICENSE +674 -0
- package/template/nextjs/sui-template/README.md +13 -0
- package/template/nextjs/sui-template/contracts/counter/Move.toml +13 -0
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
- package/template/nextjs/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
- package/template/nextjs/sui-template/contracts/counter/sources/system/counter.move +11 -0
- package/template/nextjs/sui-template/docker-compose.yaml +29 -0
- package/template/nextjs/sui-template/dubhe.config.ts +14 -0
- package/template/nextjs/sui-template/jest.config.ts +17 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/Move.toml +39 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/README.md +18 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/access_control.move +35 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/events.move +23 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/resource_id.move +22 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/resource_types.move +18 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schema.move +36 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/dapps.move +73 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/metadata.move +96 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/double_map.move +156 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/map.move +159 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/value.move +100 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/systems/dapps.move +90 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/world.move +81 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/dapp.move +16 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/init.move +6 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/obelisk_framework_tests.move +19 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/storage.move +398 -0
- package/template/nextjs/sui-template/next-env.d.ts +5 -0
- package/template/nextjs/sui-template/next-i18next.config.js +6 -0
- package/template/nextjs/sui-template/next.config.js +15 -0
- package/template/nextjs/sui-template/package.json +84 -0
- package/template/nextjs/sui-template/postcss.config.js +6 -0
- package/template/nextjs/sui-template/public/discord.svg +9 -0
- package/template/nextjs/sui-template/public/fail.svg +12 -0
- package/template/nextjs/sui-template/public/favicon.ico +0 -0
- package/template/nextjs/sui-template/public/locales/de/common.json +8 -0
- package/template/nextjs/sui-template/public/locales/de/footer.json +3 -0
- package/template/nextjs/sui-template/public/locales/de/second-page.json +5 -0
- package/template/nextjs/sui-template/public/locales/en/common.json +8 -0
- package/template/nextjs/sui-template/public/locales/en/footer.json +3 -0
- package/template/nextjs/sui-template/public/locales/en/second-page.json +5 -0
- package/template/nextjs/sui-template/public/locales/zn/common.json +8 -0
- package/template/nextjs/sui-template/public/locales/zn/footer.json +3 -0
- package/template/nextjs/sui-template/public/locales/zn/second-page.json +5 -0
- package/template/nextjs/sui-template/public/logo.svg +1 -0
- package/template/nextjs/sui-template/public/medium.svg +9 -0
- package/template/nextjs/sui-template/public/successful.svg +11 -0
- package/template/nextjs/sui-template/public/telegram.svg +9 -0
- package/template/nextjs/sui-template/public/twitter.svg +9 -0
- package/template/nextjs/sui-template/scripts/checkBalance.ts +40 -0
- package/template/nextjs/sui-template/scripts/deployment/common.ts +60 -0
- package/template/nextjs/sui-template/scripts/deployment/localnet/deploy.ts +42 -0
- package/template/nextjs/sui-template/scripts/deployment/testnet/deploy.ts +48 -0
- package/template/nextjs/sui-template/scripts/deployment/types.ts +13 -0
- package/template/nextjs/sui-template/scripts/framework/common.ts +17 -0
- package/template/nextjs/sui-template/scripts/framework/deploy.ts +199 -0
- package/template/nextjs/sui-template/scripts/framework/parse-history.ts +76 -0
- package/template/nextjs/sui-template/scripts/framework/types.ts +8 -0
- package/template/nextjs/sui-template/scripts/generateAccount.ts +55 -0
- package/template/nextjs/sui-template/scripts/storeConfig.ts +61 -0
- package/template/nextjs/sui-template/scripts/waitNode.ts +9 -0
- package/template/nextjs/sui-template/src/chain/config.ts +7 -0
- package/template/nextjs/sui-template/src/components/Animation.tsx +80 -0
- package/template/nextjs/sui-template/src/components/Container.tsx +11 -0
- package/template/nextjs/sui-template/src/components/footer/index.tsx +138 -0
- package/template/nextjs/sui-template/src/components/head/index.tsx +14 -0
- package/template/nextjs/sui-template/src/components/header/index.tsx +173 -0
- package/template/nextjs/sui-template/src/components/pop_up_box/index.tsx +149 -0
- package/template/nextjs/sui-template/src/css/font-awesome.css +2337 -0
- package/template/nextjs/sui-template/src/css/font-awesome.min.css +4 -0
- package/template/nextjs/sui-template/src/fonts/FontAwesome.otf +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/nextjs/sui-template/src/jotai/index.tsx +13 -0
- package/template/nextjs/sui-template/src/pages/_app.tsx +32 -0
- package/template/nextjs/sui-template/src/pages/home/index.tsx +147 -0
- package/template/nextjs/sui-template/src/pages/index.tsx +15 -0
- package/template/nextjs/sui-template/tailwind.config.js +56 -0
- package/template/nextjs/sui-template/tsconfig.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 eiinu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import E from"node:fs";import N from"node:path";import{fileURLToPath as Ti}from"node:url";import he from"readline";import le from"events";function qi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var G={},J,ue;function q(){if(ue)return J;ue=1;const{FORCE_COLOR:t,NODE_DISABLE_COLORS:s,TERM:a}=process.env,e={enabled:!s&&a!=="dumb"&&t!=="0",reset:r(0,0),bold:r(1,22),dim:r(2,22),italic:r(3,23),underline:r(4,24),inverse:r(7,27),hidden:r(8,28),strikethrough:r(9,29),black:r(30,39),red:r(31,39),green:r(32,39),yellow:r(33,39),blue:r(34,39),magenta:r(35,39),cyan:r(36,39),white:r(37,39),gray:r(90,39),grey:r(90,39),bgBlack:r(40,49),bgRed:r(41,49),bgGreen:r(42,49),bgYellow:r(43,49),bgBlue:r(44,49),bgMagenta:r(45,49),bgCyan:r(46,49),bgWhite:r(47,49)};function u(g,n){let l=0,i,f="",p="";for(;l<g.length;l++)i=g[l],f+=i.open,p+=i.close,n.includes(i.close)&&(n=n.replace(i.rgx,i.close+i.open));return f+n+p}function v(g,n){let l={has:g,keys:n};return l.reset=e.reset.bind(l),l.bold=e.bold.bind(l),l.dim=e.dim.bind(l),l.italic=e.italic.bind(l),l.underline=e.underline.bind(l),l.inverse=e.inverse.bind(l),l.hidden=e.hidden.bind(l),l.strikethrough=e.strikethrough.bind(l),l.black=e.black.bind(l),l.red=e.red.bind(l),l.green=e.green.bind(l),l.yellow=e.yellow.bind(l),l.blue=e.blue.bind(l),l.magenta=e.magenta.bind(l),l.cyan=e.cyan.bind(l),l.white=e.white.bind(l),l.gray=e.gray.bind(l),l.grey=e.grey.bind(l),l.bgBlack=e.bgBlack.bind(l),l.bgRed=e.bgRed.bind(l),l.bgGreen=e.bgGreen.bind(l),l.bgYellow=e.bgYellow.bind(l),l.bgBlue=e.bgBlue.bind(l),l.bgMagenta=e.bgMagenta.bind(l),l.bgCyan=e.bgCyan.bind(l),l.bgWhite=e.bgWhite.bind(l),l}function r(g,n){let l={open:`\x1B[${g}m`,close:`\x1B[${n}m`,rgx:new RegExp(`\\x1b\\[${n}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(g)||(this.has.push(g),this.keys.push(l)),i===void 0?this:e.enabled?u(this.keys,i+""):i+""):i===void 0?v([g],[l]):e.enabled?u([l],i+""):i+""}}return J=e,J}var B,ae;function Di(){return ae||(ae=1,B=(t,s)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(s){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}),B}var W,ce;function z(){return ce||(ce=1,W=t=>{const s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),a=new RegExp(s,"g");return typeof t=="string"?t.replace(a,""):t}),W}var K,de;function D(){if(de)return K;de=1;const t="\x1B",s=`${t}[`,a="\x07",e={to(r,g){return g?`${s}${g+1};${r+1}H`:`${s}${r+1}G`},move(r,g){let n="";return r<0?n+=`${s}${-r}D`:r>0&&(n+=`${s}${r}C`),g<0?n+=`${s}${-g}A`:g>0&&(n+=`${s}${g}B`),n},up:(r=1)=>`${s}${r}A`,down:(r=1)=>`${s}${r}B`,forward:(r=1)=>`${s}${r}C`,backward:(r=1)=>`${s}${r}D`,nextLine:(r=1)=>`${s}E`.repeat(r),prevLine:(r=1)=>`${s}F`.repeat(r),left:`${s}G`,hide:`${s}?25l`,show:`${s}?25h`,save:`${t}7`,restore:`${t}8`},u={up:(r=1)=>`${s}S`.repeat(r),down:(r=1)=>`${s}T`.repeat(r)},v={screen:`${s}2J`,up:(r=1)=>`${s}1J`.repeat(r),down:(r=1)=>`${s}J`.repeat(r),line:`${s}2K`,lineEnd:`${s}K`,lineStart:`${s}1K`,lines(r){let g="";for(let n=0;n<r;n++)g+=this.line+(n<r-1?e.up():"");return r&&(g+=e.left),g}};return K={cursor:e,scroll:u,erase:v,beep:a},K}var Z,fe;function _i(){if(fe)return Z;fe=1;function t(n,l){var i=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!i){if(Array.isArray(n)||(i=s(n))||l&&n&&typeof n.length=="number"){i&&(n=i);var f=0,p=function(){};return{s:p,n:function(){return f>=n.length?{done:!0}:{done:!1,value:n[f++]}},e:function(d){throw d},f:p}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,h=!1,b;return{s:function(){i=i.call(n)},n:function(){var d=i.next();return o=d.done,d},e:function(d){h=!0,b=d},f:function(){try{!o&&i.return!=null&&i.return()}finally{if(h)throw b}}}}function s(n,l){if(n){if(typeof n=="string")return a(n,l);var i=Object.prototype.toString.call(n).slice(8,-1);if(i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set")return Array.from(n);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return a(n,l)}}function a(n,l){(l==null||l>n.length)&&(l=n.length);for(var i=0,f=new Array(l);i<l;i++)f[i]=n[i];return f}const e=z(),u=D(),v=u.erase,r=u.cursor,g=n=>[...e(n)].length;return Z=function(n,l){if(!l)return v.line+r.to(0);let i=0;const f=n.split(/\r?\n/);var p=t(f),o;try{for(p.s();!(o=p.n()).done;){let h=o.value;i+=1+Math.floor(Math.max(g(h)-1,0)/l)}}catch(h){p.e(h)}finally{p.f()}return v.lines(i)},Z}var X,pe;function me(){if(pe)return X;pe=1;const t={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},s={arrowUp:t.arrowUp,arrowDown:t.arrowDown,arrowLeft:t.arrowLeft,arrowRight:t.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return X=process.platform==="win32"?s:t,X}var Q,ge;function Ri(){if(ge)return Q;ge=1;const t=q(),s=me(),a=Object.freeze({password:{scale:1,render:n=>"*".repeat(n.length)},emoji:{scale:2,render:n=>"\u{1F603}".repeat(n.length)},invisible:{scale:0,render:n=>""},default:{scale:1,render:n=>`${n}`}}),e=n=>a[n]||a.default,u=Object.freeze({aborted:t.red(s.cross),done:t.green(s.tick),exited:t.yellow(s.cross),default:t.cyan("?")});return Q={styles:a,render:e,symbols:u,symbol:(n,l,i)=>l?u.aborted:i?u.exited:n?u.done:u.default,delimiter:n=>t.gray(n?s.ellipsis:s.pointerSmall),item:(n,l)=>t.gray(n?l?s.pointerSmall:"+":s.line)},Q}var tt,ve;function Ci(){if(ve)return tt;ve=1;const t=z();return tt=function(s,a){let e=String(t(s)||"").split(/\r?\n/);return a?e.map(u=>Math.ceil(u.length/a)).reduce((u,v)=>u+v):e.length},tt}var et,be;function Ii(){return be||(be=1,et=(t,s={})=>{const a=Number.isSafeInteger(parseInt(s.margin))?new Array(parseInt(s.margin)).fill(" ").join(""):s.margin||"",e=s.width;return(t||"").split(/\r?\n/g).map(u=>u.split(/\s+/g).reduce((v,r)=>(r.length+a.length>=e||v[v.length-1].length+r.length+1<e?v[v.length-1]+=` ${r}`:v.push(`${a}${r}`),v),[a]).join(`
|
|
3
|
+
`)).join(`
|
|
4
|
+
`)}),et}var it,ye;function Ai(){return ye||(ye=1,it=(t,s,a)=>{a=a||s;let e=Math.min(s-a,t-Math.floor(a/2));e<0&&(e=0);let u=Math.min(e+a,s);return{startIndex:e,endIndex:u}}),it}var rt,we;function k(){return we||(we=1,rt={action:Di(),clear:_i(),style:Ri(),strip:z(),figures:me(),lines:Ci(),wrap:Ii(),entriesToDisplay:Ai()}),rt}var st,xe;function V(){if(xe)return st;xe=1;const t=he,s=k(),a=s.action,e=le,u=D(),v=u.beep,r=u.cursor,g=q();class n extends e{constructor(i={}){super(),this.firstRender=!0,this.in=i.stdin||process.stdin,this.out=i.stdout||process.stdout,this.onRender=(i.onRender||(()=>{})).bind(this);const f=t.createInterface({input:this.in,escapeCodeTimeout:50});t.emitKeypressEvents(this.in,f),this.in.isTTY&&this.in.setRawMode(!0);const p=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(h,b)=>{let m=a(b,p);m===!1?this._&&this._(h,b):typeof this[m]=="function"?this[m](b):this.bell()};this.close=()=>{this.out.write(r.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),f.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(v)}render(){this.onRender(g),this.firstRender&&(this.firstRender=!1)}}return st=n,st}var nt,Se;function ji(){if(Se)return nt;Se=1;function t(o,h,b,m,d,c,y){try{var x=o[c](y),w=x.value}catch(S){b(S);return}x.done?h(w):Promise.resolve(w).then(m,d)}function s(o){return function(){var h=this,b=arguments;return new Promise(function(m,d){var c=o.apply(h,b);function y(w){t(c,m,d,y,x,"next",w)}function x(w){t(c,m,d,y,x,"throw",w)}y(void 0)})}}const a=q(),e=V(),u=D(),v=u.erase,r=u.cursor,g=k(),n=g.style,l=g.clear,i=g.lines,f=g.figures;class p extends e{constructor(h={}){super(h),this.transform=n.render(h.style),this.scale=this.transform.scale,this.msg=h.message,this.initial=h.initial||"",this.validator=h.validate||(()=>!0),this.value="",this.errorMsg=h.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=l("",this.out.columns),this.render()}set value(h){!h&&this.initial?(this.placeholder=!0,this.rendered=a.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(h)),this._value=h,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
5
|
+
`),this.close()}validate(){var h=this;return s(function*(){let b=yield h.validator(h.value);typeof b=="string"&&(h.errorMsg=b,b=!1),h.error=!b})()}submit(){var h=this;return s(function*(){if(h.value=h.value||h.initial,h.cursorOffset=0,h.cursor=h.rendered.length,yield h.validate(),h.error){h.red=!0,h.fire(),h.render();return}h.done=!0,h.aborted=!1,h.fire(),h.render(),h.out.write(`
|
|
6
|
+
`),h.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(h){this.placeholder||(this.cursor=this.cursor+h,this.cursorOffset+=h)}_(h,b){let m=this.value.slice(0,this.cursor),d=this.value.slice(this.cursor);this.value=`${m}${h}${d}`,this.red=!1,this.cursor=this.placeholder?0:m.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let h=this.value.slice(0,this.cursor-1),b=this.value.slice(this.cursor);this.value=`${h}${b}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let h=this.value.slice(0,this.cursor),b=this.value.slice(this.cursor+1);this.value=`${h}${b}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(r.down(i(this.outputError,this.out.columns)-1)+l(this.outputError,this.out.columns)),this.out.write(l(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),a.bold(this.msg),n.delimiter(this.done),this.red?a.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
7
|
+
`).reduce((h,b,m)=>h+`
|
|
8
|
+
${m?" ":f.pointerSmall} ${a.red().italic(b)}`,"")),this.out.write(v.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore+r.move(this.cursorOffset,0)))}}return nt=p,nt}var ot,$e;function Ei(){if($e)return ot;$e=1;const t=q(),s=V(),a=k(),e=a.style,u=a.clear,v=a.figures,r=a.wrap,g=a.entriesToDisplay,n=D(),l=n.cursor;class i extends s{constructor(p={}){super(p),this.msg=p.message,this.hint=p.hint||"- Use arrow-keys. Return to submit.",this.warn=p.warn||"- This option is disabled",this.cursor=p.initial||0,this.choices=p.choices.map((o,h)=>(typeof o=="string"&&(o={title:o,value:h}),{title:o&&(o.title||o.value||o),value:o&&(o.value===void 0?h:o.value),description:o&&o.description,selected:o&&o.selected,disabled:o&&o.disabled})),this.optionsPerPage=p.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=u("",this.out.columns),this.render()}moveCursor(p){this.cursor=p,this.value=this.choices[p].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
9
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
10
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(p,o){if(p===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(l.hide):this.out.write(u(this.outputText,this.out.columns)),super.render();let p=g(this.cursor,this.choices.length,this.optionsPerPage),o=p.startIndex,h=p.endIndex;if(this.outputText=[e.symbol(this.done,this.aborted),t.bold(this.msg),e.delimiter(!1),this.done?this.selection.title:this.selection.disabled?t.yellow(this.warn):t.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
11
|
+
`;for(let b=o;b<h;b++){let m,d,c="",y=this.choices[b];b===o&&o>0?d=v.arrowUp:b===h-1&&h<this.choices.length?d=v.arrowDown:d=" ",y.disabled?(m=this.cursor===b?t.gray().underline(y.title):t.strikethrough().gray(y.title),d=(this.cursor===b?t.bold().gray(v.pointer)+" ":" ")+d):(m=this.cursor===b?t.cyan().underline(y.title):y.title,d=(this.cursor===b?t.cyan(v.pointer)+" ":" ")+d,y.description&&this.cursor===b&&(c=` - ${y.description}`,(d.length+m.length+c.length>=this.out.columns||y.description.split(/\r?\n/).length>1)&&(c=`
|
|
12
|
+
`+r(y.description,{margin:3,width:this.out.columns})))),this.outputText+=`${d} ${m}${t.gray(c)}
|
|
13
|
+
`}}this.out.write(this.outputText)}}return ot=i,ot}var ht,Me;function ki(){if(Me)return ht;Me=1;const t=q(),s=V(),a=k(),e=a.style,u=a.clear,v=D(),r=v.cursor,g=v.erase;class n extends s{constructor(i={}){super(i),this.msg=i.message,this.value=!!i.initial,this.active=i.active||"on",this.inactive=i.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
14
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
15
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(i,f){if(i===" ")this.value=!this.value;else if(i==="1")this.value=!0;else if(i==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(r.hide):this.out.write(u(this.outputText,this.out.columns)),super.render(),this.outputText=[e.symbol(this.done,this.aborted),t.bold(this.msg),e.delimiter(this.done),this.value?this.inactive:t.cyan().underline(this.inactive),t.gray("/"),this.value?t.cyan().underline(this.active):this.active].join(" "),this.out.write(g.line+r.to(0)+this.outputText))}}return ht=n,ht}var lt,Pe;function H(){if(Pe)return lt;Pe=1;class t{constructor({token:a,date:e,parts:u,locales:v}){this.token=a,this.date=e||new Date,this.parts=u||[this],this.locales=v||{}}up(){}down(){}next(){const a=this.parts.indexOf(this);return this.parts.find((e,u)=>u>a&&e instanceof t)}setTo(a){}prev(){let a=[].concat(this.parts).reverse();const e=a.indexOf(this);return a.find((u,v)=>v>e&&u instanceof t)}toString(){return String(this.date)}}return lt=t,lt}var ut,Oe;function Fi(){if(Oe)return ut;Oe=1;const t=H();class s extends t{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}return ut=s,ut}var at,Te;function Hi(){if(Te)return at;Te=1;const t=H(),s=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");class a extends t{constructor(u={}){super(u)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(u){this.date.setDate(parseInt(u.substr(-2)))}toString(){let u=this.date.getDate(),v=this.date.getDay();return this.token==="DD"?String(u).padStart(2,"0"):this.token==="Do"?u+s(u):this.token==="d"?v+1:this.token==="ddd"?this.locales.weekdaysShort[v]:this.token==="dddd"?this.locales.weekdays[v]:u}}return at=a,at}var ct,qe;function Yi(){if(qe)return ct;qe=1;const t=H();class s extends t{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}return ct=s,ct}var dt,De;function Ni(){if(De)return dt;De=1;const t=H();class s extends t{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return dt=s,dt}var ft,_e;function Vi(){if(_e)return ft;_e=1;const t=H();class s extends t{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}return ft=s,ft}var pt,Re;function Li(){if(Re)return pt;Re=1;const t=H();class s extends t{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),u=this.token.length;return u===2?String(e+1).padStart(2,"0"):u===3?this.locales.monthsShort[e]:u===4?this.locales.months[e]:String(e+1)}}return pt=s,pt}var mt,Ce;function Ui(){if(Ce)return mt;Ce=1;const t=H();class s extends t{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}return mt=s,mt}var gt,Ie;function Gi(){if(Ie)return gt;Ie=1;const t=H();class s extends t{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}}return gt=s,gt}var vt,Ae;function Ji(){return Ae||(Ae=1,vt={DatePart:H(),Meridiem:Fi(),Day:Hi(),Hours:Yi(),Milliseconds:Ni(),Minutes:Vi(),Month:Li(),Seconds:Ui(),Year:Gi()}),vt}var bt,je;function Bi(){if(je)return bt;je=1;function t($,M,T,I,_,R,j){try{var A=$[R](j),C=A.value}catch(U){T(U);return}A.done?M(C):Promise.resolve(C).then(I,_)}function s($){return function(){var M=this,T=arguments;return new Promise(function(I,_){var R=$.apply(M,T);function j(C){t(R,I,_,j,A,"next",C)}function A(C){t(R,I,_,j,A,"throw",C)}j(void 0)})}}const a=q(),e=V(),u=k(),v=u.style,r=u.clear,g=u.figures,n=D(),l=n.erase,i=n.cursor,f=Ji(),p=f.DatePart,o=f.Meridiem,h=f.Day,b=f.Hours,m=f.Milliseconds,d=f.Minutes,c=f.Month,y=f.Seconds,x=f.Year,w=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,S={1:({token:$})=>$.replace(/\\(.)/g,"$1"),2:$=>new h($),3:$=>new c($),4:$=>new x($),5:$=>new o($),6:$=>new b($),7:$=>new d($),8:$=>new y($),9:$=>new m($)},O={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class P extends e{constructor(M={}){super(M),this.msg=M.message,this.cursor=0,this.typed="",this.locales=Object.assign(O,M.locales),this._date=M.initial||new Date,this.errorMsg=M.error||"Please Enter A Valid Value",this.validator=M.validate||(()=>!0),this.mask=M.mask||"YYYY-MM-DD HH:mm:ss",this.clear=r("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(M){M&&this._date.setTime(M.getTime())}set mask(M){let T;for(this.parts=[];T=w.exec(M);){let _=T.shift(),R=T.findIndex(j=>j!=null);this.parts.push(R in S?S[R]({token:T[R]||_,date:this.date,parts:this.parts,locales:this.locales}):T[R]||_)}let I=this.parts.reduce((_,R)=>(typeof R=="string"&&typeof _[_.length-1]=="string"?_[_.length-1]+=R:_.push(R),_),[]);this.parts.splice(0),this.parts.push(...I),this.reset()}moveCursor(M){this.typed="",this.cursor=M,this.fire()}reset(){this.moveCursor(this.parts.findIndex(M=>M instanceof p)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
+
`),this.close()}validate(){var M=this;return s(function*(){let T=yield M.validator(M.value);typeof T=="string"&&(M.errorMsg=T,T=!1),M.error=!T})()}submit(){var M=this;return s(function*(){if(yield M.validate(),M.error){M.color="red",M.fire(),M.render();return}M.done=!0,M.aborted=!1,M.fire(),M.render(),M.out.write(`
|
|
17
|
+
`),M.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let M=this.parts[this.cursor].prev();if(M==null)return this.bell();this.moveCursor(this.parts.indexOf(M)),this.render()}right(){let M=this.parts[this.cursor].next();if(M==null)return this.bell();this.moveCursor(this.parts.indexOf(M)),this.render()}next(){let M=this.parts[this.cursor].next();this.moveCursor(M?this.parts.indexOf(M):this.parts.findIndex(T=>T instanceof p)),this.render()}_(M){/\d/.test(M)&&(this.typed+=M,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[v.symbol(this.done,this.aborted),a.bold(this.msg),v.delimiter(!1),this.parts.reduce((M,T,I)=>M.concat(I===this.cursor&&!this.done?a.cyan().underline(T.toString()):T),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
18
|
+
`).reduce((M,T,I)=>M+`
|
|
19
|
+
${I?" ":g.pointerSmall} ${a.red().italic(T)}`,"")),this.out.write(l.line+i.to(0)+this.outputText))}}return bt=P,bt}var yt,Ee;function Wi(){if(Ee)return yt;Ee=1;function t(m,d,c,y,x,w,S){try{var O=m[w](S),P=O.value}catch($){c($);return}O.done?d(P):Promise.resolve(P).then(y,x)}function s(m){return function(){var d=this,c=arguments;return new Promise(function(y,x){var w=m.apply(d,c);function S(P){t(w,y,x,S,O,"next",P)}function O(P){t(w,y,x,S,O,"throw",P)}S(void 0)})}}const a=q(),e=V(),u=D(),v=u.cursor,r=u.erase,g=k(),n=g.style,l=g.figures,i=g.clear,f=g.lines,p=/[0-9]/,o=m=>m!==void 0,h=(m,d)=>{let c=Math.pow(10,d);return Math.round(m*c)/c};class b extends e{constructor(d={}){super(d),this.transform=n.render(d.style),this.msg=d.message,this.initial=o(d.initial)?d.initial:"",this.float=!!d.float,this.round=d.round||2,this.inc=d.increment||1,this.min=o(d.min)?d.min:-1/0,this.max=o(d.max)?d.max:1/0,this.errorMsg=d.error||"Please Enter A Valid Value",this.validator=d.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(d){!d&&d!==0?(this.placeholder=!0,this.rendered=a.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${h(d,this.round)}`),this._value=h(d,this.round)),this.fire()}get value(){return this._value}parse(d){return this.float?parseFloat(d):parseInt(d)}valid(d){return d==="-"||d==="."&&this.float||p.test(d)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let d=this.value;this.value=d!==""?d:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
20
|
+
`),this.close()}validate(){var d=this;return s(function*(){let c=yield d.validator(d.value);typeof c=="string"&&(d.errorMsg=c,c=!1),d.error=!c})()}submit(){var d=this;return s(function*(){if(yield d.validate(),d.error){d.color="red",d.fire(),d.render();return}let c=d.value;d.value=c!==""?c:d.initial,d.done=!0,d.aborted=!1,d.error=!1,d.fire(),d.render(),d.out.write(`
|
|
21
|
+
`),d.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let d=this.value.toString();if(d.length===0)return this.bell();this.value=this.parse(d=d.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(d,c){if(!this.valid(d))return this.bell();const y=Date.now();if(y-this.lastHit>1e3&&(this.typed=""),this.typed+=d,this.lastHit=y,this.color="cyan",d===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(v.down(f(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),a.bold(this.msg),n.delimiter(this.done),!this.done||!this.done&&!this.placeholder?a[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
22
|
+
`).reduce((d,c,y)=>d+`
|
|
23
|
+
${y?" ":l.pointerSmall} ${a.red().italic(c)}`,"")),this.out.write(r.line+v.to(0)+this.outputText+v.save+this.outputError+v.restore))}}return yt=b,yt}var wt,ke;function Fe(){if(ke)return wt;ke=1;const t=q(),s=D(),a=s.cursor,e=V(),u=k(),v=u.clear,r=u.figures,g=u.style,n=u.wrap,l=u.entriesToDisplay;class i extends e{constructor(p={}){super(p),this.msg=p.message,this.cursor=p.cursor||0,this.scrollIndex=p.cursor||0,this.hint=p.hint||"",this.warn=p.warn||"- This option is disabled -",this.minSelected=p.min,this.showMinError=!1,this.maxChoices=p.max,this.instructions=p.instructions,this.optionsPerPage=p.optionsPerPage||10,this.value=p.choices.map((o,h)=>(typeof o=="string"&&(o={title:o,value:h}),{title:o&&(o.title||o.value||o),description:o&&o.description,value:o&&(o.value===void 0?h:o.value),selected:o&&o.selected,disabled:o&&o.disabled})),this.clear=v("",this.out.columns),p.overrideRender||this.render()}reset(){this.value.map(p=>!p.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(p=>p.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
24
|
+
`),this.close()}submit(){const p=this.value.filter(o=>o.selected);this.minSelected&&p.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
25
|
+
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(p=>p.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const p=this.value[this.cursor];if(p.selected)p.selected=!1,this.render();else{if(p.disabled||this.value.filter(o=>o.selected).length>=this.maxChoices)return this.bell();p.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const p=!this.value[this.cursor].selected;this.value.filter(o=>!o.disabled).forEach(o=>o.selected=p),this.render()}_(p,o){if(p===" ")this.handleSpaceToggle();else if(p==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
26
|
+
Instructions:
|
|
27
|
+
${r.arrowUp}/${r.arrowDown}: Highlight option
|
|
28
|
+
${r.arrowLeft}/${r.arrowRight}/[space]: Toggle selection
|
|
29
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
30
|
+
`:"")+" enter/return: Complete answer":""}renderOption(p,o,h,b){const m=(o.selected?t.green(r.radioOn):r.radioOff)+" "+b+" ";let d,c;return o.disabled?d=p===h?t.gray().underline(o.title):t.strikethrough().gray(o.title):(d=p===h?t.cyan().underline(o.title):o.title,p===h&&o.description&&(c=` - ${o.description}`,(m.length+d.length+c.length>=this.out.columns||o.description.split(/\r?\n/).length>1)&&(c=`
|
|
31
|
+
`+n(o.description,{margin:m.length,width:this.out.columns})))),m+d+t.gray(c||"")}paginateOptions(p){if(p.length===0)return t.red("No matches for this query.");let o=l(this.cursor,p.length,this.optionsPerPage),h=o.startIndex,b=o.endIndex,m,d=[];for(let c=h;c<b;c++)c===h&&h>0?m=r.arrowUp:c===b-1&&b<p.length?m=r.arrowDown:m=" ",d.push(this.renderOption(this.cursor,p[c],c,m));return`
|
|
32
|
+
`+d.join(`
|
|
33
|
+
`)}renderOptions(p){return this.done?"":this.paginateOptions(p)}renderDoneOrInstructions(){if(this.done)return this.value.filter(o=>o.selected).map(o=>o.title).join(", ");const p=[t.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&p.push(t.yellow(this.warn)),p.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(a.hide),super.render();let p=[g.symbol(this.done,this.aborted),t.bold(this.msg),g.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(p+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),p+=this.renderOptions(this.value),this.out.write(this.clear+p),this.clear=v(p,this.out.columns)}}return wt=i,wt}var xt,He;function zi(){if(He)return xt;He=1;function t(d,c,y,x,w,S,O){try{var P=d[S](O),$=P.value}catch(M){y(M);return}P.done?c($):Promise.resolve($).then(x,w)}function s(d){return function(){var c=this,y=arguments;return new Promise(function(x,w){var S=d.apply(c,y);function O($){t(S,x,w,O,P,"next",$)}function P($){t(S,x,w,O,P,"throw",$)}O(void 0)})}}const a=q(),e=V(),u=D(),v=u.erase,r=u.cursor,g=k(),n=g.style,l=g.clear,i=g.figures,f=g.wrap,p=g.entriesToDisplay,o=(d,c)=>d[c]&&(d[c].value||d[c].title||d[c]),h=(d,c)=>d[c]&&(d[c].title||d[c].value||d[c]),b=(d,c)=>{const y=d.findIndex(x=>x.value===c||x.title===c);return y>-1?y:void 0};class m extends e{constructor(c={}){super(c),this.msg=c.message,this.suggest=c.suggest,this.choices=c.choices,this.initial=typeof c.initial=="number"?c.initial:b(c.choices,c.initial),this.select=this.initial||c.cursor||0,this.i18n={noMatches:c.noMatches||"no matches found"},this.fallback=c.fallback||this.initial,this.clearFirst=c.clearFirst||!1,this.suggestions=[],this.input="",this.limit=c.limit||10,this.cursor=0,this.transform=n.render(c.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=l("",this.out.columns),this.complete(this.render),this.render()}set fallback(c){this._fb=Number.isSafeInteger(parseInt(c))?parseInt(c):c}get fallback(){let c;return typeof this._fb=="number"?c=this.choices[this._fb]:typeof this._fb=="string"&&(c={title:this._fb}),c||this._fb||{title:this.i18n.noMatches}}moveSelect(c){this.select=c,this.suggestions.length>0?this.value=o(this.suggestions,c):this.value=this.fallback.value,this.fire()}complete(c){var y=this;return s(function*(){const x=y.completing=y.suggest(y.input,y.choices),w=yield x;if(y.completing!==x)return;y.suggestions=w.map((O,P,$)=>({title:h($,P),value:o($,P),description:O.description})),y.completing=!1;const S=Math.max(w.length-1,0);y.moveSelect(Math.min(S,y.select)),c&&c()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
34
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
35
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
|
+
`),this.close()}_(c,y){let x=this.input.slice(0,this.cursor),w=this.input.slice(this.cursor);this.input=`${x}${c}${w}`,this.cursor=x.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let c=this.input.slice(0,this.cursor-1),y=this.input.slice(this.cursor);this.input=`${c}${y}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let c=this.input.slice(0,this.cursor),y=this.input.slice(this.cursor+1);this.input=`${c}${y}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(c,y,x,w){let S,O=x?i.arrowUp:w?i.arrowDown:" ",P=y?a.cyan().underline(c.title):c.title;return O=(y?a.cyan(i.pointer)+" ":" ")+O,c.description&&(S=` - ${c.description}`,(O.length+P.length+S.length>=this.out.columns||c.description.split(/\r?\n/).length>1)&&(S=`
|
|
37
|
+
`+f(c.description,{margin:3,width:this.out.columns}))),O+" "+P+a.gray(S||"")}render(){if(this.closed)return;this.firstRender?this.out.write(r.hide):this.out.write(l(this.outputText,this.out.columns)),super.render();let c=p(this.select,this.choices.length,this.limit),y=c.startIndex,x=c.endIndex;if(this.outputText=[n.symbol(this.done,this.aborted,this.exited),a.bold(this.msg),n.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const w=this.suggestions.slice(y,x).map((S,O)=>this.renderOption(S,this.select===O+y,O===0&&y>0,O+y===x-1&&x<this.choices.length)).join(`
|
|
38
|
+
`);this.outputText+=`
|
|
39
|
+
`+(w||a.gray(this.fallback.title))}this.out.write(v.line+r.to(0)+this.outputText)}}return xt=m,xt}var St,Ye;function Ki(){if(Ye)return St;Ye=1;const t=q(),s=D(),a=s.cursor,e=Fe(),u=k(),v=u.clear,r=u.style,g=u.figures;class n extends e{constructor(i={}){i.overrideRender=!0,super(i),this.inputValue="",this.clear=v("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const i=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(p=>this.inputValue?!!(typeof p.title=="string"&&p.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof p.value=="string"&&p.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const f=this.filteredOptions.findIndex(p=>p===i);this.cursor=f<0?0:f,this.render()}handleSpaceToggle(){const i=this.filteredOptions[this.cursor];if(i.selected)i.selected=!1,this.render();else{if(i.disabled||this.value.filter(f=>f.selected).length>=this.maxChoices)return this.bell();i.selected=!0,this.render()}}handleInputChange(i){this.inputValue=this.inputValue+i,this.updateFilteredOptions()}_(i,f){i===" "?this.handleSpaceToggle():this.handleInputChange(i)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
40
|
+
Instructions:
|
|
41
|
+
${g.arrowUp}/${g.arrowDown}: Highlight option
|
|
42
|
+
${g.arrowLeft}/${g.arrowRight}/[space]: Toggle selection
|
|
43
|
+
[a,b,c]/delete: Filter choices
|
|
44
|
+
enter/return: Complete answer
|
|
45
|
+
`:""}renderCurrentInput(){return`
|
|
46
|
+
Filtered results for: ${this.inputValue?this.inputValue:t.gray("Enter something to filter")}
|
|
47
|
+
`}renderOption(i,f,p){let o;return f.disabled?o=i===p?t.gray().underline(f.title):t.strikethrough().gray(f.title):o=i===p?t.cyan().underline(f.title):f.title,(f.selected?t.green(g.radioOn):g.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(f=>f.selected).map(f=>f.title).join(", ");const i=[t.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&i.push(t.yellow(this.warn)),i.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(a.hide),super.render();let i=[r.symbol(this.done,this.aborted),t.bold(this.msg),r.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(i+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),i+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+i),this.clear=v(i,this.out.columns)}}return St=n,St}var $t,Ne;function Zi(){if(Ne)return $t;Ne=1;const t=q(),s=V(),a=k(),e=a.style,u=a.clear,v=D(),r=v.erase,g=v.cursor;class n extends s{constructor(i={}){super(i),this.msg=i.message,this.value=i.initial,this.initialValue=!!i.initial,this.yesMsg=i.yes||"yes",this.yesOption=i.yesOption||"(Y/n)",this.noMsg=i.no||"no",this.noOption=i.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
48
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
49
|
+
`),this.close()}_(i,f){return i.toLowerCase()==="y"?(this.value=!0,this.submit()):i.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(g.hide):this.out.write(u(this.outputText,this.out.columns)),super.render(),this.outputText=[e.symbol(this.done,this.aborted),t.bold(this.msg),e.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:t.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(r.line+g.to(0)+this.outputText))}}return $t=n,$t}var Mt,Ve;function Xi(){return Ve||(Ve=1,Mt={TextPrompt:ji(),SelectPrompt:Ei(),TogglePrompt:ki(),DatePrompt:Bi(),NumberPrompt:Wi(),MultiselectPrompt:Fe(),AutocompletePrompt:zi(),AutocompleteMultiselectPrompt:Ki(),ConfirmPrompt:Zi()}),Mt}var Le;function Qi(){return Le||(Le=1,function(t){const s=t,a=Xi(),e=r=>r;function u(r,g,n={}){return new Promise((l,i)=>{const f=new a[r](g),p=n.onAbort||e,o=n.onSubmit||e,h=n.onExit||e;f.on("state",g.onState||e),f.on("submit",b=>l(o(b))),f.on("exit",b=>l(h(b))),f.on("abort",b=>i(p(b)))})}s.text=r=>u("TextPrompt",r),s.password=r=>(r.style="password",s.text(r)),s.invisible=r=>(r.style="invisible",s.text(r)),s.number=r=>u("NumberPrompt",r),s.date=r=>u("DatePrompt",r),s.confirm=r=>u("ConfirmPrompt",r),s.list=r=>{const g=r.separator||",";return u("TextPrompt",r,{onSubmit:n=>n.split(g).map(l=>l.trim())})},s.toggle=r=>u("TogglePrompt",r),s.select=r=>u("SelectPrompt",r),s.multiselect=r=>{r.choices=[].concat(r.choices||[]);const g=n=>n.filter(l=>l.selected).map(l=>l.value);return u("MultiselectPrompt",r,{onAbort:g,onSubmit:g})},s.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const g=n=>n.filter(l=>l.selected).map(l=>l.value);return u("AutocompleteMultiselectPrompt",r,{onAbort:g,onSubmit:g})};const v=(r,g)=>Promise.resolve(g.filter(n=>n.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));s.autocomplete=r=>(r.suggest=r.suggest||v,r.choices=[].concat(r.choices||[]),u("AutocompletePrompt",r))}(G)),G}var Pt,Ue;function tr(){if(Ue)return Pt;Ue=1;function t(m,d){var c=Object.keys(m);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(m);d&&(y=y.filter(function(x){return Object.getOwnPropertyDescriptor(m,x).enumerable})),c.push.apply(c,y)}return c}function s(m){for(var d=1;d<arguments.length;d++){var c=arguments[d]!=null?arguments[d]:{};d%2?t(Object(c),!0).forEach(function(y){a(m,y,c[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(c)):t(Object(c)).forEach(function(y){Object.defineProperty(m,y,Object.getOwnPropertyDescriptor(c,y))})}return m}function a(m,d,c){return d in m?Object.defineProperty(m,d,{value:c,enumerable:!0,configurable:!0,writable:!0}):m[d]=c,m}function e(m,d){var c=typeof Symbol<"u"&&m[Symbol.iterator]||m["@@iterator"];if(!c){if(Array.isArray(m)||(c=u(m))||d&&m&&typeof m.length=="number"){c&&(m=c);var y=0,x=function(){};return{s:x,n:function(){return y>=m.length?{done:!0}:{done:!1,value:m[y++]}},e:function($){throw $},f:x}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var w=!0,S=!1,O;return{s:function(){c=c.call(m)},n:function(){var $=c.next();return w=$.done,$},e:function($){S=!0,O=$},f:function(){try{!w&&c.return!=null&&c.return()}finally{if(S)throw O}}}}function u(m,d){if(m){if(typeof m=="string")return v(m,d);var c=Object.prototype.toString.call(m).slice(8,-1);if(c==="Object"&&m.constructor&&(c=m.constructor.name),c==="Map"||c==="Set")return Array.from(m);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return v(m,d)}}function v(m,d){(d==null||d>m.length)&&(d=m.length);for(var c=0,y=new Array(d);c<d;c++)y[c]=m[c];return y}function r(m,d,c,y,x,w,S){try{var O=m[w](S),P=O.value}catch($){c($);return}O.done?d(P):Promise.resolve(P).then(y,x)}function g(m){return function(){var d=this,c=arguments;return new Promise(function(y,x){var w=m.apply(d,c);function S(P){r(w,y,x,S,O,"next",P)}function O(P){r(w,y,x,S,O,"throw",P)}S(void 0)})}}const n=Qi(),l=["suggest","format","onState","validate","onRender","type"],i=()=>{};function f(){return p.apply(this,arguments)}function p(){return p=g(function*(m=[],{onSubmit:d=i,onCancel:c=i}={}){const y={},x=f._override||{};m=[].concat(m);let w,S,O,P,$,M;const T=function(){var A=g(function*(C,U,oe=!1){if(!(!oe&&C.validate&&C.validate(U)!==!0))return C.format?yield C.format(U,y):U});return function(U,oe){return A.apply(this,arguments)}}();var I=e(m),_;try{for(I.s();!(_=I.n()).done;){S=_.value;var R=S;if(P=R.name,$=R.type,typeof $=="function"&&($=yield $(w,s({},y),S),S.type=$),!!$){for(let A in S){if(l.includes(A))continue;let C=S[A];S[A]=typeof C=="function"?yield C(w,s({},y),M):C}if(M=S,typeof S.message!="string")throw new Error("prompt message is required");var j=S;if(P=j.name,$=j.type,n[$]===void 0)throw new Error(`prompt type (${$}) is not defined`);if(x[S.name]!==void 0&&(w=yield T(S,x[S.name]),w!==void 0)){y[P]=w;continue}try{w=f._injected?o(f._injected,S.initial):yield n[$](S),y[P]=w=yield T(S,w,!0),O=yield d(S,w,y)}catch{O=!(yield c(S,y))}if(O)return y}}}catch(A){I.e(A)}finally{I.f()}return y}),p.apply(this,arguments)}function o(m,d){const c=m.shift();if(c instanceof Error)throw c;return c===void 0?d:c}function h(m){f._injected=(f._injected||[]).concat(m)}function b(m){f._override=Object.assign({},m)}return Pt=Object.assign(f,{prompt:f,prompts:n,inject:h,override:b}),Pt}var Ot={},Tt,Ge;function er(){return Ge||(Ge=1,Tt=(t,s)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(s){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}),Tt}var qt,Je;function Dt(){return Je||(Je=1,qt=t=>{const s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),a=new RegExp(s,"g");return typeof t=="string"?t.replace(a,""):t}),qt}var _t,Be;function ir(){if(Be)return _t;Be=1;const t=Dt(),{erase:s,cursor:a}=D(),e=u=>[...t(u)].length;return _t=function(u,v){if(!v)return s.line+a.to(0);let r=0;const g=u.split(/\r?\n/);for(let n of g)r+=1+Math.floor(Math.max(e(n)-1,0)/v);return s.lines(r)},_t}var Rt,We;function ze(){if(We)return Rt;We=1;const t={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},s={arrowUp:t.arrowUp,arrowDown:t.arrowDown,arrowLeft:t.arrowLeft,arrowRight:t.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return Rt=process.platform==="win32"?s:t,Rt}var Ct,Ke;function rr(){if(Ke)return Ct;Ke=1;const t=q(),s=ze(),a=Object.freeze({password:{scale:1,render:n=>"*".repeat(n.length)},emoji:{scale:2,render:n=>"\u{1F603}".repeat(n.length)},invisible:{scale:0,render:n=>""},default:{scale:1,render:n=>`${n}`}}),e=n=>a[n]||a.default,u=Object.freeze({aborted:t.red(s.cross),done:t.green(s.tick),exited:t.yellow(s.cross),default:t.cyan("?")});return Ct={styles:a,render:e,symbols:u,symbol:(n,l,i)=>l?u.aborted:i?u.exited:n?u.done:u.default,delimiter:n=>t.gray(n?s.ellipsis:s.pointerSmall),item:(n,l)=>t.gray(n?l?s.pointerSmall:"+":s.line)},Ct}var It,Ze;function sr(){if(Ze)return It;Ze=1;const t=Dt();return It=function(s,a){let e=String(t(s)||"").split(/\r?\n/);return a?e.map(u=>Math.ceil(u.length/a)).reduce((u,v)=>u+v):e.length},It}var At,Xe;function nr(){return Xe||(Xe=1,At=(t,s={})=>{const a=Number.isSafeInteger(parseInt(s.margin))?new Array(parseInt(s.margin)).fill(" ").join(""):s.margin||"",e=s.width;return(t||"").split(/\r?\n/g).map(u=>u.split(/\s+/g).reduce((v,r)=>(r.length+a.length>=e||v[v.length-1].length+r.length+1<e?v[v.length-1]+=` ${r}`:v.push(`${a}${r}`),v),[a]).join(`
|
|
51
|
+
`)).join(`
|
|
52
|
+
`)}),At}var jt,Qe;function or(){return Qe||(Qe=1,jt=(t,s,a)=>{a=a||s;let e=Math.min(s-a,t-Math.floor(a/2));e<0&&(e=0);let u=Math.min(e+a,s);return{startIndex:e,endIndex:u}}),jt}var Et,ti;function F(){return ti||(ti=1,Et={action:er(),clear:ir(),style:rr(),strip:Dt(),figures:ze(),lines:sr(),wrap:nr(),entriesToDisplay:or()}),Et}var kt,ei;function L(){if(ei)return kt;ei=1;const t=he,{action:s}=F(),a=le,{beep:e,cursor:u}=D(),v=q();class r extends a{constructor(n={}){super(),this.firstRender=!0,this.in=n.stdin||process.stdin,this.out=n.stdout||process.stdout,this.onRender=(n.onRender||(()=>{})).bind(this);const l=t.createInterface({input:this.in,escapeCodeTimeout:50});t.emitKeypressEvents(this.in,l),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,f=(p,o)=>{let h=s(o,i);h===!1?this._&&this._(p,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(u.show),this.in.removeListener("keypress",f),this.in.isTTY&&this.in.setRawMode(!1),l.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",f)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(e)}render(){this.onRender(v),this.firstRender&&(this.firstRender=!1)}}return kt=r,kt}var Ft,ii;function hr(){if(ii)return Ft;ii=1;const t=q(),s=L(),{erase:a,cursor:e}=D(),{style:u,clear:v,lines:r,figures:g}=F();class n extends s{constructor(i={}){super(i),this.transform=u.render(i.style),this.scale=this.transform.scale,this.msg=i.message,this.initial=i.initial||"",this.validator=i.validate||(()=>!0),this.value="",this.errorMsg=i.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=v("",this.out.columns),this.render()}set value(i){!i&&this.initial?(this.placeholder=!0,this.rendered=t.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(i)),this._value=i,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
53
|
+
`),this.close()}async validate(){let i=await this.validator(this.value);typeof i=="string"&&(this.errorMsg=i,i=!1),this.error=!i}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
54
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(i){this.placeholder||(this.cursor=this.cursor+i,this.cursorOffset+=i)}_(i,f){let p=this.value.slice(0,this.cursor),o=this.value.slice(this.cursor);this.value=`${p}${i}${o}`,this.red=!1,this.cursor=this.placeholder?0:p.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let i=this.value.slice(0,this.cursor-1),f=this.value.slice(this.cursor);this.value=`${i}${f}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let i=this.value.slice(0,this.cursor),f=this.value.slice(this.cursor+1);this.value=`${i}${f}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(e.down(r(this.outputError,this.out.columns)-1)+v(this.outputError,this.out.columns)),this.out.write(v(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[u.symbol(this.done,this.aborted),t.bold(this.msg),u.delimiter(this.done),this.red?t.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
55
|
+
`).reduce((i,f,p)=>i+`
|
|
56
|
+
${p?" ":g.pointerSmall} ${t.red().italic(f)}`,"")),this.out.write(a.line+e.to(0)+this.outputText+e.save+this.outputError+e.restore+e.move(this.cursorOffset,0)))}}return Ft=n,Ft}var Ht,ri;function lr(){if(ri)return Ht;ri=1;const t=q(),s=L(),{style:a,clear:e,figures:u,wrap:v,entriesToDisplay:r}=F(),{cursor:g}=D();class n extends s{constructor(i={}){super(i),this.msg=i.message,this.hint=i.hint||"- Use arrow-keys. Return to submit.",this.warn=i.warn||"- This option is disabled",this.cursor=i.initial||0,this.choices=i.choices.map((f,p)=>(typeof f=="string"&&(f={title:f,value:p}),{title:f&&(f.title||f.value||f),value:f&&(f.value===void 0?p:f.value),description:f&&f.description,selected:f&&f.selected,disabled:f&&f.disabled})),this.optionsPerPage=i.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=e("",this.out.columns),this.render()}moveCursor(i){this.cursor=i,this.value=this.choices[i].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
57
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
58
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(i,f){if(i===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(g.hide):this.out.write(e(this.outputText,this.out.columns)),super.render();let{startIndex:i,endIndex:f}=r(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[a.symbol(this.done,this.aborted),t.bold(this.msg),a.delimiter(!1),this.done?this.selection.title:this.selection.disabled?t.yellow(this.warn):t.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
59
|
+
`;for(let p=i;p<f;p++){let o,h,b="",m=this.choices[p];p===i&&i>0?h=u.arrowUp:p===f-1&&f<this.choices.length?h=u.arrowDown:h=" ",m.disabled?(o=this.cursor===p?t.gray().underline(m.title):t.strikethrough().gray(m.title),h=(this.cursor===p?t.bold().gray(u.pointer)+" ":" ")+h):(o=this.cursor===p?t.cyan().underline(m.title):m.title,h=(this.cursor===p?t.cyan(u.pointer)+" ":" ")+h,m.description&&this.cursor===p&&(b=` - ${m.description}`,(h.length+o.length+b.length>=this.out.columns||m.description.split(/\r?\n/).length>1)&&(b=`
|
|
60
|
+
`+v(m.description,{margin:3,width:this.out.columns})))),this.outputText+=`${h} ${o}${t.gray(b)}
|
|
61
|
+
`}}this.out.write(this.outputText)}}return Ht=n,Ht}var Yt,si;function ur(){if(si)return Yt;si=1;const t=q(),s=L(),{style:a,clear:e}=F(),{cursor:u,erase:v}=D();class r extends s{constructor(n={}){super(n),this.msg=n.message,this.value=!!n.initial,this.active=n.active||"on",this.inactive=n.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
62
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
63
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(n,l){if(n===" ")this.value=!this.value;else if(n==="1")this.value=!0;else if(n==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(u.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[a.symbol(this.done,this.aborted),t.bold(this.msg),a.delimiter(this.done),this.value?this.inactive:t.cyan().underline(this.inactive),t.gray("/"),this.value?t.cyan().underline(this.active):this.active].join(" "),this.out.write(v.line+u.to(0)+this.outputText))}}return Yt=r,Yt}var Nt,ni;function Y(){if(ni)return Nt;ni=1;class t{constructor({token:a,date:e,parts:u,locales:v}){this.token=a,this.date=e||new Date,this.parts=u||[this],this.locales=v||{}}up(){}down(){}next(){const a=this.parts.indexOf(this);return this.parts.find((e,u)=>u>a&&e instanceof t)}setTo(a){}prev(){let a=[].concat(this.parts).reverse();const e=a.indexOf(this);return a.find((u,v)=>v>e&&u instanceof t)}toString(){return String(this.date)}}return Nt=t,Nt}var Vt,oi;function ar(){if(oi)return Vt;oi=1;const t=Y();class s extends t{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}return Vt=s,Vt}var Lt,hi;function cr(){if(hi)return Lt;hi=1;const t=Y(),s=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");class a extends t{constructor(u={}){super(u)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(u){this.date.setDate(parseInt(u.substr(-2)))}toString(){let u=this.date.getDate(),v=this.date.getDay();return this.token==="DD"?String(u).padStart(2,"0"):this.token==="Do"?u+s(u):this.token==="d"?v+1:this.token==="ddd"?this.locales.weekdaysShort[v]:this.token==="dddd"?this.locales.weekdays[v]:u}}return Lt=a,Lt}var Ut,li;function dr(){if(li)return Ut;li=1;const t=Y();class s extends t{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}return Ut=s,Ut}var Gt,ui;function fr(){if(ui)return Gt;ui=1;const t=Y();class s extends t{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return Gt=s,Gt}var Jt,ai;function pr(){if(ai)return Jt;ai=1;const t=Y();class s extends t{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}return Jt=s,Jt}var Bt,ci;function mr(){if(ci)return Bt;ci=1;const t=Y();class s extends t{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),u=this.token.length;return u===2?String(e+1).padStart(2,"0"):u===3?this.locales.monthsShort[e]:u===4?this.locales.months[e]:String(e+1)}}return Bt=s,Bt}var Wt,di;function gr(){if(di)return Wt;di=1;const t=Y();class s extends t{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}return Wt=s,Wt}var zt,fi;function vr(){if(fi)return zt;fi=1;const t=Y();class s extends t{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}}return zt=s,zt}var Kt,pi;function br(){return pi||(pi=1,Kt={DatePart:Y(),Meridiem:ar(),Day:cr(),Hours:dr(),Milliseconds:fr(),Minutes:pr(),Month:mr(),Seconds:gr(),Year:vr()}),Kt}var Zt,mi;function yr(){if(mi)return Zt;mi=1;const t=q(),s=L(),{style:a,clear:e,figures:u}=F(),{erase:v,cursor:r}=D(),{DatePart:g,Meridiem:n,Day:l,Hours:i,Milliseconds:f,Minutes:p,Month:o,Seconds:h,Year:b}=br(),m=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,d={1:({token:x})=>x.replace(/\\(.)/g,"$1"),2:x=>new l(x),3:x=>new o(x),4:x=>new b(x),5:x=>new n(x),6:x=>new i(x),7:x=>new p(x),8:x=>new h(x),9:x=>new f(x)},c={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class y extends s{constructor(w={}){super(w),this.msg=w.message,this.cursor=0,this.typed="",this.locales=Object.assign(c,w.locales),this._date=w.initial||new Date,this.errorMsg=w.error||"Please Enter A Valid Value",this.validator=w.validate||(()=>!0),this.mask=w.mask||"YYYY-MM-DD HH:mm:ss",this.clear=e("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(w){w&&this._date.setTime(w.getTime())}set mask(w){let S;for(this.parts=[];S=m.exec(w);){let P=S.shift(),$=S.findIndex(M=>M!=null);this.parts.push($ in d?d[$]({token:S[$]||P,date:this.date,parts:this.parts,locales:this.locales}):S[$]||P)}let O=this.parts.reduce((P,$)=>(typeof $=="string"&&typeof P[P.length-1]=="string"?P[P.length-1]+=$:P.push($),P),[]);this.parts.splice(0),this.parts.push(...O),this.reset()}moveCursor(w){this.typed="",this.cursor=w,this.fire()}reset(){this.moveCursor(this.parts.findIndex(w=>w instanceof g)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
64
|
+
`),this.close()}async validate(){let w=await this.validator(this.value);typeof w=="string"&&(this.errorMsg=w,w=!1),this.error=!w}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
65
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let w=this.parts[this.cursor].prev();if(w==null)return this.bell();this.moveCursor(this.parts.indexOf(w)),this.render()}right(){let w=this.parts[this.cursor].next();if(w==null)return this.bell();this.moveCursor(this.parts.indexOf(w)),this.render()}next(){let w=this.parts[this.cursor].next();this.moveCursor(w?this.parts.indexOf(w):this.parts.findIndex(S=>S instanceof g)),this.render()}_(w){/\d/.test(w)&&(this.typed+=w,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(r.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[a.symbol(this.done,this.aborted),t.bold(this.msg),a.delimiter(!1),this.parts.reduce((w,S,O)=>w.concat(O===this.cursor&&!this.done?t.cyan().underline(S.toString()):S),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
66
|
+
`).reduce((w,S,O)=>w+`
|
|
67
|
+
${O?" ":u.pointerSmall} ${t.red().italic(S)}`,"")),this.out.write(v.line+r.to(0)+this.outputText))}}return Zt=y,Zt}var Xt,gi;function wr(){if(gi)return Xt;gi=1;const t=q(),s=L(),{cursor:a,erase:e}=D(),{style:u,figures:v,clear:r,lines:g}=F(),n=/[0-9]/,l=p=>p!==void 0,i=(p,o)=>{let h=Math.pow(10,o);return Math.round(p*h)/h};class f extends s{constructor(o={}){super(o),this.transform=u.render(o.style),this.msg=o.message,this.initial=l(o.initial)?o.initial:"",this.float=!!o.float,this.round=o.round||2,this.inc=o.increment||1,this.min=l(o.min)?o.min:-1/0,this.max=l(o.max)?o.max:1/0,this.errorMsg=o.error||"Please Enter A Valid Value",this.validator=o.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(o){!o&&o!==0?(this.placeholder=!0,this.rendered=t.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${i(o,this.round)}`),this._value=i(o,this.round)),this.fire()}get value(){return this._value}parse(o){return this.float?parseFloat(o):parseInt(o)}valid(o){return o==="-"||o==="."&&this.float||n.test(o)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let o=this.value;this.value=o!==""?o:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
68
|
+
`),this.close()}async validate(){let o=await this.validator(this.value);typeof o=="string"&&(this.errorMsg=o,o=!1),this.error=!o}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let o=this.value;this.value=o!==""?o:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
69
|
+
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let o=this.value.toString();if(o.length===0)return this.bell();this.value=this.parse(o=o.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(o,h){if(!this.valid(o))return this.bell();const b=Date.now();if(b-this.lastHit>1e3&&(this.typed=""),this.typed+=o,this.lastHit=b,this.color="cyan",o===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(a.down(g(this.outputError,this.out.columns)-1)+r(this.outputError,this.out.columns)),this.out.write(r(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[u.symbol(this.done,this.aborted),t.bold(this.msg),u.delimiter(this.done),!this.done||!this.done&&!this.placeholder?t[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
70
|
+
`).reduce((o,h,b)=>o+`
|
|
71
|
+
${b?" ":v.pointerSmall} ${t.red().italic(h)}`,"")),this.out.write(e.line+a.to(0)+this.outputText+a.save+this.outputError+a.restore))}}return Xt=f,Xt}var Qt,vi;function bi(){if(vi)return Qt;vi=1;const t=q(),{cursor:s}=D(),a=L(),{clear:e,figures:u,style:v,wrap:r,entriesToDisplay:g}=F();class n extends a{constructor(i={}){super(i),this.msg=i.message,this.cursor=i.cursor||0,this.scrollIndex=i.cursor||0,this.hint=i.hint||"",this.warn=i.warn||"- This option is disabled -",this.minSelected=i.min,this.showMinError=!1,this.maxChoices=i.max,this.instructions=i.instructions,this.optionsPerPage=i.optionsPerPage||10,this.value=i.choices.map((f,p)=>(typeof f=="string"&&(f={title:f,value:p}),{title:f&&(f.title||f.value||f),description:f&&f.description,value:f&&(f.value===void 0?p:f.value),selected:f&&f.selected,disabled:f&&f.disabled})),this.clear=e("",this.out.columns),i.overrideRender||this.render()}reset(){this.value.map(i=>!i.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(i=>i.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
72
|
+
`),this.close()}submit(){const i=this.value.filter(f=>f.selected);this.minSelected&&i.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
73
|
+
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const i=this.value[this.cursor];if(i.selected)i.selected=!1,this.render();else{if(i.disabled||this.value.filter(f=>f.selected).length>=this.maxChoices)return this.bell();i.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const i=!this.value[this.cursor].selected;this.value.filter(f=>!f.disabled).forEach(f=>f.selected=i),this.render()}_(i,f){if(i===" ")this.handleSpaceToggle();else if(i==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
74
|
+
Instructions:
|
|
75
|
+
${u.arrowUp}/${u.arrowDown}: Highlight option
|
|
76
|
+
${u.arrowLeft}/${u.arrowRight}/[space]: Toggle selection
|
|
77
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
78
|
+
`:"")+" enter/return: Complete answer":""}renderOption(i,f,p,o){const h=(f.selected?t.green(u.radioOn):u.radioOff)+" "+o+" ";let b,m;return f.disabled?b=i===p?t.gray().underline(f.title):t.strikethrough().gray(f.title):(b=i===p?t.cyan().underline(f.title):f.title,i===p&&f.description&&(m=` - ${f.description}`,(h.length+b.length+m.length>=this.out.columns||f.description.split(/\r?\n/).length>1)&&(m=`
|
|
79
|
+
`+r(f.description,{margin:h.length,width:this.out.columns})))),h+b+t.gray(m||"")}paginateOptions(i){if(i.length===0)return t.red("No matches for this query.");let{startIndex:f,endIndex:p}=g(this.cursor,i.length,this.optionsPerPage),o,h=[];for(let b=f;b<p;b++)b===f&&f>0?o=u.arrowUp:b===p-1&&p<i.length?o=u.arrowDown:o=" ",h.push(this.renderOption(this.cursor,i[b],b,o));return`
|
|
80
|
+
`+h.join(`
|
|
81
|
+
`)}renderOptions(i){return this.done?"":this.paginateOptions(i)}renderDoneOrInstructions(){if(this.done)return this.value.filter(f=>f.selected).map(f=>f.title).join(", ");const i=[t.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&i.push(t.yellow(this.warn)),i.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(s.hide),super.render();let i=[v.symbol(this.done,this.aborted),t.bold(this.msg),v.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(i+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),i+=this.renderOptions(this.value),this.out.write(this.clear+i),this.clear=e(i,this.out.columns)}}return Qt=n,Qt}var te,yi;function xr(){if(yi)return te;yi=1;const t=q(),s=L(),{erase:a,cursor:e}=D(),{style:u,clear:v,figures:r,wrap:g,entriesToDisplay:n}=F(),l=(o,h)=>o[h]&&(o[h].value||o[h].title||o[h]),i=(o,h)=>o[h]&&(o[h].title||o[h].value||o[h]),f=(o,h)=>{const b=o.findIndex(m=>m.value===h||m.title===h);return b>-1?b:void 0};class p extends s{constructor(h={}){super(h),this.msg=h.message,this.suggest=h.suggest,this.choices=h.choices,this.initial=typeof h.initial=="number"?h.initial:f(h.choices,h.initial),this.select=this.initial||h.cursor||0,this.i18n={noMatches:h.noMatches||"no matches found"},this.fallback=h.fallback||this.initial,this.clearFirst=h.clearFirst||!1,this.suggestions=[],this.input="",this.limit=h.limit||10,this.cursor=0,this.transform=u.render(h.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=v("",this.out.columns),this.complete(this.render),this.render()}set fallback(h){this._fb=Number.isSafeInteger(parseInt(h))?parseInt(h):h}get fallback(){let h;return typeof this._fb=="number"?h=this.choices[this._fb]:typeof this._fb=="string"&&(h={title:this._fb}),h||this._fb||{title:this.i18n.noMatches}}moveSelect(h){this.select=h,this.suggestions.length>0?this.value=l(this.suggestions,h):this.value=this.fallback.value,this.fire()}async complete(h){const b=this.completing=this.suggest(this.input,this.choices),m=await b;if(this.completing!==b)return;this.suggestions=m.map((c,y,x)=>({title:i(x,y),value:l(x,y),description:c.description})),this.completing=!1;const d=Math.max(m.length-1,0);this.moveSelect(Math.min(d,this.select)),h&&h()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
82
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
83
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
|
+
`),this.close()}_(h,b){let m=this.input.slice(0,this.cursor),d=this.input.slice(this.cursor);this.input=`${m}${h}${d}`,this.cursor=m.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let h=this.input.slice(0,this.cursor-1),b=this.input.slice(this.cursor);this.input=`${h}${b}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let h=this.input.slice(0,this.cursor),b=this.input.slice(this.cursor+1);this.input=`${h}${b}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(h,b,m,d){let c,y=m?r.arrowUp:d?r.arrowDown:" ",x=b?t.cyan().underline(h.title):h.title;return y=(b?t.cyan(r.pointer)+" ":" ")+y,h.description&&(c=` - ${h.description}`,(y.length+x.length+c.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(c=`
|
|
85
|
+
`+g(h.description,{margin:3,width:this.out.columns}))),y+" "+x+t.gray(c||"")}render(){if(this.closed)return;this.firstRender?this.out.write(e.hide):this.out.write(v(this.outputText,this.out.columns)),super.render();let{startIndex:h,endIndex:b}=n(this.select,this.choices.length,this.limit);if(this.outputText=[u.symbol(this.done,this.aborted,this.exited),t.bold(this.msg),u.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const m=this.suggestions.slice(h,b).map((d,c)=>this.renderOption(d,this.select===c+h,c===0&&h>0,c+h===b-1&&b<this.choices.length)).join(`
|
|
86
|
+
`);this.outputText+=`
|
|
87
|
+
`+(m||t.gray(this.fallback.title))}this.out.write(a.line+e.to(0)+this.outputText)}}return te=p,te}var ee,wi;function Sr(){if(wi)return ee;wi=1;const t=q(),{cursor:s}=D(),a=bi(),{clear:e,style:u,figures:v}=F();class r extends a{constructor(n={}){n.overrideRender=!0,super(n),this.inputValue="",this.clear=e("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const n=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const l=this.filteredOptions.findIndex(i=>i===n);this.cursor=l<0?0:l,this.render()}handleSpaceToggle(){const n=this.filteredOptions[this.cursor];if(n.selected)n.selected=!1,this.render();else{if(n.disabled||this.value.filter(l=>l.selected).length>=this.maxChoices)return this.bell();n.selected=!0,this.render()}}handleInputChange(n){this.inputValue=this.inputValue+n,this.updateFilteredOptions()}_(n,l){n===" "?this.handleSpaceToggle():this.handleInputChange(n)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
88
|
+
Instructions:
|
|
89
|
+
${v.arrowUp}/${v.arrowDown}: Highlight option
|
|
90
|
+
${v.arrowLeft}/${v.arrowRight}/[space]: Toggle selection
|
|
91
|
+
[a,b,c]/delete: Filter choices
|
|
92
|
+
enter/return: Complete answer
|
|
93
|
+
`:""}renderCurrentInput(){return`
|
|
94
|
+
Filtered results for: ${this.inputValue?this.inputValue:t.gray("Enter something to filter")}
|
|
95
|
+
`}renderOption(n,l,i){let f;return l.disabled?f=n===i?t.gray().underline(l.title):t.strikethrough().gray(l.title):f=n===i?t.cyan().underline(l.title):l.title,(l.selected?t.green(v.radioOn):v.radioOff)+" "+f}renderDoneOrInstructions(){if(this.done)return this.value.filter(l=>l.selected).map(l=>l.title).join(", ");const n=[t.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&n.push(t.yellow(this.warn)),n.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(s.hide),super.render();let n=[u.symbol(this.done,this.aborted),t.bold(this.msg),u.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(n+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),n+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+n),this.clear=e(n,this.out.columns)}}return ee=r,ee}var ie,xi;function $r(){if(xi)return ie;xi=1;const t=q(),s=L(),{style:a,clear:e}=F(),{erase:u,cursor:v}=D();class r extends s{constructor(n={}){super(n),this.msg=n.message,this.value=n.initial,this.initialValue=!!n.initial,this.yesMsg=n.yes||"yes",this.yesOption=n.yesOption||"(Y/n)",this.noMsg=n.no||"no",this.noOption=n.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
96
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
97
|
+
`),this.close()}_(n,l){return n.toLowerCase()==="y"?(this.value=!0,this.submit()):n.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(v.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[a.symbol(this.done,this.aborted),t.bold(this.msg),a.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:t.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(u.line+v.to(0)+this.outputText))}}return ie=r,ie}var re,Si;function Mr(){return Si||(Si=1,re={TextPrompt:hr(),SelectPrompt:lr(),TogglePrompt:ur(),DatePrompt:yr(),NumberPrompt:wr(),MultiselectPrompt:bi(),AutocompletePrompt:xr(),AutocompleteMultiselectPrompt:Sr(),ConfirmPrompt:$r()}),re}var $i;function Pr(){return $i||($i=1,function(t){const s=t,a=Mr(),e=r=>r;function u(r,g,n={}){return new Promise((l,i)=>{const f=new a[r](g),p=n.onAbort||e,o=n.onSubmit||e,h=n.onExit||e;f.on("state",g.onState||e),f.on("submit",b=>l(o(b))),f.on("exit",b=>l(h(b))),f.on("abort",b=>i(p(b)))})}s.text=r=>u("TextPrompt",r),s.password=r=>(r.style="password",s.text(r)),s.invisible=r=>(r.style="invisible",s.text(r)),s.number=r=>u("NumberPrompt",r),s.date=r=>u("DatePrompt",r),s.confirm=r=>u("ConfirmPrompt",r),s.list=r=>{const g=r.separator||",";return u("TextPrompt",r,{onSubmit:n=>n.split(g).map(l=>l.trim())})},s.toggle=r=>u("TogglePrompt",r),s.select=r=>u("SelectPrompt",r),s.multiselect=r=>{r.choices=[].concat(r.choices||[]);const g=n=>n.filter(l=>l.selected).map(l=>l.value);return u("MultiselectPrompt",r,{onAbort:g,onSubmit:g})},s.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const g=n=>n.filter(l=>l.selected).map(l=>l.value);return u("AutocompleteMultiselectPrompt",r,{onAbort:g,onSubmit:g})};const v=(r,g)=>Promise.resolve(g.filter(n=>n.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));s.autocomplete=r=>(r.suggest=r.suggest||v,r.choices=[].concat(r.choices||[]),u("AutocompletePrompt",r))}(Ot)),Ot}var se,Mi;function Or(){if(Mi)return se;Mi=1;const t=Pr(),s=["suggest","format","onState","validate","onRender","type"],a=()=>{};async function e(g=[],{onSubmit:n=a,onCancel:l=a}={}){const i={},f=e._override||{};g=[].concat(g);let p,o,h,b,m,d;const c=async(y,x,w=!1)=>{if(!(!w&&y.validate&&y.validate(x)!==!0))return y.format?await y.format(x,i):x};for(o of g)if({name:b,type:m}=o,typeof m=="function"&&(m=await m(p,{...i},o),o.type=m),!!m){for(let y in o){if(s.includes(y))continue;let x=o[y];o[y]=typeof x=="function"?await x(p,{...i},d):x}if(d=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:b,type:m}=o,t[m]===void 0)throw new Error(`prompt type (${m}) is not defined`);if(f[o.name]!==void 0&&(p=await c(o,f[o.name]),p!==void 0)){i[b]=p;continue}try{p=e._injected?u(e._injected,o.initial):await t[m](o),i[b]=p=await c(o,p,!0),h=await n(o,p,i)}catch{h=!await l(o,i)}if(h)return i}return i}function u(g,n){const l=g.shift();if(l instanceof Error)throw l;return l===void 0?n:l}function v(g){e._injected=(e._injected||[]).concat(g)}function r(g){e._override=Object.assign({},g)}return se=Object.assign(e,{prompt:e,prompts:t,inject:v,override:r}),se}function Tr(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let s=0,a=process.versions.node.split(".").map(Number);for(;s<t.length;s++){if(a[s]>t[s])return!1;if(t[s]>a[s])return!0}return!1}var qr=Tr("8.6.0")?tr():Or();const Dr=qi(qr),ne=process.cwd(),_r={_gitignore:".gitignore"},Pi="dubhe-template-project",Rr=async()=>{const t=await Dr([{type:"text",name:"projectName",message:"Input your projectName.",initial:Pi},{type:"select",name:"chain",message:"Pick your chain.",choices:[{title:"sui",description:"Sui",value:"sui"},{title:"aptos",description:"Aptos",value:"aptos"}],initial:0},{type:"select",name:"platform",message:"Pick your platform.",choices:[{title:"101",description:"Quick start",value:"101"},{title:"Web",description:"Web template",value:"web"},{title:"Cocos",description:"Cocos Creator",value:"cocos"}],initial:0},{type:"select",name:"framework",message:"Pick your framework.",choices:b=>b==="101"?[{title:"Nextjs",value:"nextjs"}]:b==="web"?[{title:"Nextjs",value:"nextjs"}]:b==="cocos"?[{title:"Typescript",value:"ts"}]:null,initial:0}]),{projectName:s,chain:a,platform:e,framework:u}=t;let v="";e==="101"?v=`template/101/${a}-template`:e==="web"?v=`template/nextjs/${a}-template`:v=`template/cocos/${a}-template`;let r=s||Pi;const g=N.join(ne,r);E.existsSync(g)||E.mkdirSync(g,{recursive:!0});const n=Ir(process.env.npm_config_user_agent),l=n?n.name:"npm",i=N.resolve(Ti(import.meta.url),"../..",v);E.existsSync(i)||(console.error(`Template directory not found: ${i}`),process.exit(1));const f=(b,m)=>{const d=N.join(g,_r[b]??b);if(m)E.writeFileSync(d,m);else try{Oi(N.join(i,b),d)}catch(c){console.error(`Error copying file ${b}:`,c),process.exit(1)}},p=E.readdirSync(i);for(const b of p.filter(m=>m!=="package.json"&&m!=="node_modules"))f(b);const o=JSON.parse(E.readFileSync(N.join(i,"package.json"),"utf-8"));o.name=s,f("package.json",JSON.stringify(o,null,2)+`
|
|
98
|
+
`);const h=N.relative(ne,g);console.log(`
|
|
99
|
+
Done. Now run:
|
|
100
|
+
`),g!==ne&&console.log(` cd ${h.includes(" ")?`"${h}"`:h}`),e=="101"?(console.log(` ${l} install`),console.log(` ${l} run dev`)):e=="web"?(console.log(` ${l} install`),console.log(` ${l} run dev`)):e=="cocos"&&(console.log(" import project by cocos create ide "),console.log(` ${l} install`),console.log(` ${l} run dev`),console.log(" start you cocos project ")),console.log()};function Oi(t,s){E.statSync(t).isDirectory()?Cr(t,s):E.copyFileSync(t,s)}function Cr(t,s){E.mkdirSync(s,{recursive:!0});for(const a of E.readdirSync(t)){const e=N.resolve(t,a),u=N.resolve(s,a);Oi(e,u)}}function Ir(t){if(!t)return;const a=t.split(" ")[0].split("/");return{name:a[0],version:a[1]}}Rr().catch(t=>{console.error(t)});
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-dubhe",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "team@obelisk.build",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-dubhe": "index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"template",
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"main": "index.js",
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": "^18.16.0"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/0xobelisk/dubhe.git"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"browser-resolve": "^2.0.0",
|
|
28
|
+
"browser-sync": "^2.29.3"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/cross-spawn": "^6.0.2",
|
|
32
|
+
"@types/minimist": "^1.2.2",
|
|
33
|
+
"@types/prompts": "^2.4.3",
|
|
34
|
+
"cross-spawn": "^7.0.3",
|
|
35
|
+
"kolorist": "^1.7.0",
|
|
36
|
+
"prompts": "^2.4.2",
|
|
37
|
+
"tsc": "^2.0.4",
|
|
38
|
+
"unbuild": "^1.1.2",
|
|
39
|
+
"esmify": "^2.1.1"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"dev": "unbuild && node index.js",
|
|
43
|
+
"build": "unbuild && npm run cocos-js-build",
|
|
44
|
+
"cocos-js-build": "cd cocos-lib-builder && npm i && browserify aptos.js -p esmify > ../template/cocos/aptos-template/assets/lib/dubhe.js && browserify sui.js -p esmify > ../template/cocos/sui-template/assets/lib/dubhe.js"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Install dependencies only when needed
|
|
2
|
+
FROM node:18-alpine AS deps
|
|
3
|
+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
|
4
|
+
RUN apk add --no-cache libc6-compat
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
COPY package.json yarn.lock ./
|
|
7
|
+
RUN yarn install --frozen-lockfile
|
|
8
|
+
|
|
9
|
+
# If using npm with a `package-lock.json` comment out above and use below instead
|
|
10
|
+
# COPY package.json package-lock.json ./
|
|
11
|
+
# RUN npm ci
|
|
12
|
+
|
|
13
|
+
# Rebuild the source code only when needed
|
|
14
|
+
FROM node:18-alpine AS builder
|
|
15
|
+
WORKDIR /app
|
|
16
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
17
|
+
COPY . .
|
|
18
|
+
|
|
19
|
+
# Next.js collects completely anonymous telemetry data about general usage.
|
|
20
|
+
# Learn more here: https://nextjs.org/telemetry
|
|
21
|
+
# Uncomment the following line in case you want to disable telemetry during the build.
|
|
22
|
+
# ENV NEXT_TELEMETRY_DISABLED 1
|
|
23
|
+
|
|
24
|
+
RUN yarn build
|
|
25
|
+
|
|
26
|
+
# If using npm comment out above and use below instead
|
|
27
|
+
# RUN npm run build
|
|
28
|
+
|
|
29
|
+
# Production image, copy all the files and run next
|
|
30
|
+
FROM node:18-alpine AS runner
|
|
31
|
+
WORKDIR /app
|
|
32
|
+
|
|
33
|
+
ENV NODE_ENV production
|
|
34
|
+
# Uncomment the following line in case you want to disable telemetry during runtime.
|
|
35
|
+
# ENV NEXT_TELEMETRY_DISABLED 1
|
|
36
|
+
|
|
37
|
+
RUN addgroup --system --gid 1001 nodejs
|
|
38
|
+
RUN adduser --system --uid 1001 nextjs
|
|
39
|
+
|
|
40
|
+
# You only need to copy next.config.js if you are NOT using the default configuration
|
|
41
|
+
# COPY --from=builder /app/next.config.js ./
|
|
42
|
+
COPY --from=builder /app/public ./public
|
|
43
|
+
COPY --from=builder /app/package.json ./package.json
|
|
44
|
+
|
|
45
|
+
# Automatically leverage output traces to reduce image size
|
|
46
|
+
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
|
47
|
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
48
|
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
49
|
+
|
|
50
|
+
USER nextjs
|
|
51
|
+
|
|
52
|
+
EXPOSE 3000
|
|
53
|
+
|
|
54
|
+
ENV PORT 3000
|
|
55
|
+
|
|
56
|
+
CMD ["node", "server.js"]
|