nry 1.1.0 → 1.1.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,73 @@
1
+ # 更新日志 📔
2
+
3
+ ## 1.1.2 (2026-10-1)
4
+
5
+ - 维护信息
6
+
7
+ ## 1.1.1 (2026-6-27)
8
+
9
+ ## 1.1.0 (2026-1-17)
10
+
11
+ ## v1.0.1 (2025-11-11)
12
+
13
+ ### 🐛 bug 修复
14
+
15
+ 在输入的自定义的源为非法 URL 后,再次通过本程序设置将导致设置实效,建议使用
16
+
17
+ ```bash
18
+ # npm 源
19
+ npm config set registry
20
+ # pnpm 源
21
+ pnpm config set registry
22
+ # yarn 源
23
+ yarn config set registry
24
+ ```
25
+
26
+ ## v1.0.0 (2025-11-11)
27
+
28
+ ### 🎨 UI 改进
29
+
30
+ #### 1. 让 npm 的 registry 值更规范
31
+
32
+ - 默认的 `npm config get registry` 的值应当是 `https://registry.npmjs.org/` 而不是 `https://registry.npmjs.org` 。修改默认预设值并修改已有配置的用户的配置
33
+
34
+ 所以,可能将之前标记为 ”曾用值“ 的带尾斜杠的修改为同 `value` (如果有)的下。
35
+
36
+ - 新增的自定义的 registry 将自动带上尾斜杠(如果没有的话)
37
+ - 移除旧的设置值并更新为带尾斜杠(在下一次交互时才会触发修改,但是使用 `nry` 设置时将自动追加尾斜杠)
38
+
39
+ ## v0.1.3 (2025-8-16)
40
+
41
+ - 修复致命错误
42
+
43
+ ## v0.1.2 (2025-7-30)
44
+
45
+ - 文档补充
46
+
47
+ ## v0.1.1 (2025-7-24)
48
+
49
+ - 根据调用的包管理器不同配置不同的源,支持 `npm`、`yarn`、`pnpm`
50
+
51
+ ## v0.1.0 (2025-7-19)
52
+
53
+ - 么事
54
+
55
+ ## v0.0.4 (2025-6-22)
56
+
57
+ - 文档补充
58
+
59
+ ## v0.0.3 (2025-6-17)
60
+
61
+ - list 时展示当前的非默认值的设定值(这会让 rs 命令看起来没有重置当前使用值)
62
+
63
+ ## v0.0.2 (2025-6-15)
64
+
65
+ - 文档完善
66
+
67
+ ## v0.0.1 (2025-6-15)
68
+
69
+ - 功能添加
70
+
71
+ ## v0.0.0 (2025-6-14)
72
+
73
+ - 创建项目
package/LICENSE CHANGED
@@ -13,13 +13,4 @@ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
13
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
14
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
15
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
-
17
- # MIT 许可证
18
-
19
- 版权所有 (c) [2025] [泥豆君]
20
-
21
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
22
-
23
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
24
-
25
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
16
+
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Npm RegistrY
2
2
 
3
- [![version](<https://img.shields.io/npm/v/nry.svg?logo=npm&logoColor=rgb(0,0,0)&label=版本号&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/nry) [![issues 提交](<https://img.shields.io/badge/issues-提交-rgb(255,0,63)?logo=github>)](https://github.com/MrMudBean/nry/issues)
3
+ [![version](<https://img.shields.io/npm/v/nry.svg?logo=npm&logoColor=rgb(0,0,0)&label=版本号&labelColor=rgb(73,73,228)&color=rgb(0,0,0)>)](https://www.npmjs.com/package/nry) [![issues 提交](<https://img.shields.io/badge/issues-提交-rgb(255,0,63)?logo=github>)](https://github.com/gleanings/nry/issues)
4
4
 
5
5
  一个用于 npm、yarn、pnpm registry 切换及管理的工具。
6
6
 
@@ -14,7 +14,7 @@ npm install -g nry
14
14
 
15
15
  ## 使用
16
16
 
17
- 本应用使用 [a-command](https://www.npmjs.com/package/a-command) ,所以屏蔽了 `Ctrl + C` 、`Ctrl + D` ,但可采用*双击 `Esc` 退出*。
17
+ 本应用使用 [@vvi/command](https://www.npmjs.com/package/@vvi/command) ,所以屏蔽了 `Ctrl + C` 、`Ctrl + D` ,但可采用*双击 `Esc` 退出*。
18
18
 
19
19
  执行能力可能根据当前执行的包管理器有关,
20
20
 
@@ -34,6 +34,8 @@ npm install -g nry
34
34
 
35
35
  相应的,对应的包管理器调用执行仅用于设置本包管理器的 `registry`。
36
36
 
37
- ## 文档地址
37
+ ## 状态
38
38
 
39
- 参看 [nry](https://earthnut.dev/npm/nry)
39
+ 此软件包是 `MrMudBean` 生态系统的一部分。
40
+ 它使用严格的 TypeScript 编写,并通过 Rollup 构建进行验证。
41
+ 虽然单元测试较少,但 API 稳定,并在生产环境中大量使用。
package/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{statSync as e,readFileSync as t,readdirSync as n,writeFileSync as r,unlinkSync as o,mkdirSync as i}from"node:fs";import{arch as s,homedir as a}from"node:os";import{dirname as c,normalize as l,join as u,resolve as f}from"node:path";import"node:fs/promises";import{fileURLToPath as h}from"node:url";import{spawn as d}from"node:child_process";import{emitKeypressEvents as g}from"node:readline";import{resolve as p}from"node:path/posix";function b(e){return e.prototype.apply=Function.apply,e.prototype.bind=Function.bind,e.prototype.call=Function.call,e.prototype.length=Function.length,e.prototype.name=Function.name,e.prototype.toString=Function.toString,e}function m(e,t){return Object.keys(t).forEach(n=>e[n]=t[n]),e}function w(e){const t=typeof e;if("object"!==t&&"function"!==t)return t;const n=Reflect.apply(Object.prototype.toString,e,[]).replace(/^.*\s(.*)]$/,"$1").toLowerCase();return"error"!==n?n:e instanceof SyntaxError?"syntaxerror":e instanceof TypeError?"typeerror":e instanceof URIError?"urierror":e instanceof ReferenceError?"referenceerror":e instanceof AggregateError?"aggregateerror":e instanceof RangeError?"rangeerror":e instanceof EvalError?"evalerror":"error"}function y(e){return"string"===w(e)}function v(e){return"regexp"===w(e)}function x(e){return y(e)&&""===e.valueOf()}function $(e){return y(e)&&""===e.valueOf().trim()}function k(e){return"number"===w(e)}function E(e){return Number.isNaN(e)}function C(e){return 0===e}function I(e){return"boolean"===w(e)}function T(e){return!0===e}function O(e){return!1===e}function S(e){return null===e}function j(e){return void 0===e}function R(e){return"function"===w(e)}function N(e){return Array.isArray(e)}function M(e){if(N(e))return 0===e.length;throw new TypeError("参数必须为数组")}function D(e){return"object"===w(e)}function L(e){return D(e)&&0===Reflect.ownKeys(e).length}function B(e){return"symbol"===w(e)}function P(e,t){return void 0===t||("function"==typeof t?t(e):t)}function F(e=1,t=0){if(!isFinite(e)||!isFinite(t)||E(e)||E(t)||!k(e)||!k(t))throw new TypeError("getRandomInt: max or min is NaN or is not a number");let n=Math.ceil(Number(t)),r=Math.floor(Number(e));return r===n?r:(n>r&&([r,n]=[n,r]),Math.round(Math.random()*(r-n)+n))}function W(e){if(!D(e)&&!k(e)||k(e)&&E(e)||k(e)&&!isFinite(e)||k(e)&&!Number.isInteger(e)||k(e)&&Number.isInteger(e)&&e<1||k(e)&&e<1||D(e)&&(!k(e.length)||e.length<1||!Number.isInteger(e.length)))throw new TypeError("参数类型错误 ❌ (getRandomString)");const t={length:32,chars:"abcdefghijklmnopqrstuvwxyz",chars2:"0123456789",chars3:"!@#$%^&*()_+~`|}{[]:;?><,./-=",type:"string",includeUppercaseLetters:!1,includeNumbers:!1,includeSpecial:!1};if("uuid"===t.type)return crypto.randomUUID();k(e)&&Number.isInteger(e)&&e>0&&m(t,{length:e}),D(e)&&(m(t,e),t.length=t.length<1?32:t.length);const n=t.chars.split("");t.includeUppercaseLetters&&s(n,t.chars.toUpperCase()),t.includeNumbers&&s(n,t.chars2),t.includeSpecial&&s(n,t.chars3);let r="";const o=n.join(""),i=o.length;if(globalThis&&globalThis.crypto&&globalThis.crypto.getRandomValues){globalThis.crypto.getRandomValues(new Uint8Array(t.length)).forEach(e=>r+=o[e%i])}else for(let e=0;e<t.length;e++)r+=o[F(i-1)];function s(e,t){const n=e.length,r=t.length,o=Math.max(n,r);for(let i=0;i<o;i++)i<n&&!j(t[i])?e[i]+=t[i]:i<r&&(e[i]=t[i])}if(!/[a-zA-Z]/.test(r))return String.fromCharCode(F(97,122)).concat(r.slice(1));for(;!/^[a-zA-Z]$/.test(r[0]);)r=r.slice(1)+r[0];return r}function A(e,t=200){if(!R(e))throw new TypeError("callback must be a function");let n;k(t)&&(t={delay:t,this:null}),(j(t.delay)||!isFinite(t.delay)||t.delay<0)&&(t.delay=200);const r=()=>{n&&(clearTimeout(n),n=void 0)},o=(...o)=>{r(),n=setTimeout(()=>{try{const n=t&&t.this?t.this:null;e.apply(n,o)}catch(e){console.log("Debounce callback throw an error",e)}},Math.max(t.delay||5,5))};return o.cancel=()=>r(),o}function q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _(){return!j(globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node||void 0)}async function z(e=1e3){if(!isFinite(e)||e<0)throw new TypeError("delay 应该是一个正常的数值");return C(e)?Promise.resolve():new Promise(t=>setTimeout(t,e))}const V=[!1,!0,"all","info","error","warn"];function G(e){return!!V.includes(e)&&e}function J(...e){}function H(){this.error=this.info=this.warn=J}const K=_()?"node":"browser",U="",Y=`${U}[`;function Z(){return new RegExp(`(\\x1b\\[(${["([1-4]?[0-9])(;([1-4]?[0-9]+))*m","[m]","\\?(25|7)[hl]","\\d*;?\\d*[HFr]","6n","\\d{0,4}[A-DTS]","[0-3]?[JKg]","[0-6]?W"].map(e=>`(${e})`).join("|")}))`.concat("|(\\x1b[78DMc])"),"g")}const Q=`${Y}0m`;function X(e,t=!0){if(T(t)){if(!y(e))throw new TypeError("`color` must be a string or number but not number[] when isHex is true");if(e.startsWith("0x"))e=e.replace(/0x/,"#");else if(!e.startsWith("#"))throw new TypeError("`color` must be a string or number but not number[] when isHex is true")}else{if(!O(t))throw new TypeError("The second variable `isHex` must be boolean");if(N(e)){if(e.some(e=>!isFinite(e))||3!==e.length)throw new TypeError("If the `color` is an array, it must be 3 in length and be of numeric type");e=`rgb(${e.join(",")})`}else{if(k(e))throw new TypeError("If the `color` is not number when isHex is false");if(y(e)){if(!e.startsWith("rgb(")||!e.endsWith(")"))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)");{const t=e.replace(/.*\((.*)\).*/,"$1").split(",");if(3!==t.length||t.some(e=>!isFinite(Number(e))||Number(e)<0||Number(e)>255))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)")}}}}let n=0,r=0,o=0;if(e.startsWith("#"))if(6==(e=e.slice(1)).length)n=ee(parseInt(e.slice(0,2),16)),r=ee(parseInt(e.slice(2,4),16)),o=ee(parseInt(e.slice(4,6),16));else{if(3!=e.length)return F(255);n=ee(parseInt(e.slice(0,1).repeat(2),16)),r=ee(parseInt(e.slice(1,2).repeat(2),16)),o=ee(parseInt(e.slice(2,3).repeat(2),16))}else if(e.startsWith("rgb")){const t=e.replace(/.*\((.*)\).*/,"$1").split(",");n=ee(Number(t[0])),r=ee(Number(t[1])),o=ee(Number(t[2]))}return 16+36*n+6*r+o}function ee(e){const t=isFinite(e)?Math.floor(6*e/256):F(6);return Math.min(5,Math.max(0,t))}function te(e,t,n,r=!0){const o=r?"38":"48";if(k(e)&&k(t)&&k(n))return`${o};5;${X([e,t,n],!1)}`;if(y(e)&&j(t)&&j(n)){if(e.startsWith("rgb"))return`${o};5;${X(e,!1)}`;if(e.startsWith("#")||e.startsWith("0x"))return`${o};5;${X(e,!0)}`;ne()}else{if(k(e)&&j(t)&&j(n))return`${o};5;${X(e,!0)}`;ne()}}function ne(){throw new TypeError(' 使用 color() 或 bgColor() 时,可使用三整数 `r , g , b` 或单字符串 `"rgb(r , g, b)"` 或十六进制数值 `0xrgb`、`0xrrggbb` 或十六进制字符串表达 `"#rgb"`、`"#rrggbb"` ,不接受其他格式的参数')}function re(e,t,n,r=!0){try{return te(e,t,n,r)}catch(e){throw console.error(e),new TypeError('使用 rgb() 或 bgRgb() 时,参数可以为单字符串 `"rgb(r, g, b)"` 或三个数值 `r , g ,b`。不接受其他格式')}}function oe(e,t=!0){try{return te(e,void 0,void 0,t)}catch(e){throw console.error(e),new TypeError('使用 hex() 或 bgHex() 时,参数可以为单字符串 `"0xnnnnnn"`、`"#rgb"` 、`"#rrggbb"` 或一个数值 `0xrrggbb`。不接受其他格式')}}function ie(e,t=!1){return e<0&&(e=0),e>255&&(e=255),e=isFinite(e)?Math.round(e):F(255),`${[48,38][Number(t)]};5;${e}`}const se={black:"38;5;0",red:"38;5;1",green:"38;5;2",yellow:"38;5;3",blue:"38;5;4",magenta:"38;5;5",cyan:"38;5;6",white:"38;5;7",brightBlack:"38;5;8",brightRed:"38;5;9",brightGreen:"38;5;10",brightYellow:"38;5;11",brightBlue:"38;5;12",brightMagenta:"38;5;13",brightCyan:"38;5;14",brightWhite:"38;5;15",bgBlack:"48;5;0",bgRed:"48;5;1",bgGreen:"48;5;2",bgYellow:"48;5;3",bgBlue:"48;5;4",bgMagenta:"48;5;5",bgCyan:"48;5;6",bgWhite:"48;5;7",bgBrightBlack:"48;5;8",bgBrightRed:"48;5;9",bgBrightGreen:"48;5;10",bgBrightYellow:"48;5;11",bgBrightBlue:"48;5;12",bgBrightMagenta:"48;5;13",bgBrightCyan:"48;5;14",bgBrightWhite:"48;5;15",bold:"1",dim:"2",italic:"3",underline:"4",blink:"5",reversed:"7",hide:"8",random:"random",bgRandom:"bgRandom",rgb:(e,t,n)=>re(e,t,n),hex:e=>oe(e),color:(e,t,n)=>te(e,t,n),number:e=>ie(e,!0),bgRgb:(e,t,n)=>re(e,t,n,!1),bgHex:e=>oe(e,!1),bgColor:(e,t,n)=>te(e,t,n,!1),bgNumber:e=>ie(e)};Object.freeze(se);const ae=["#000000","#c23621","#25bc24","#adad29","#492ee1","#dd38dd","#33bbc8","#cbcccd","#818383","#fc391f","#31e722","#eaec23","#5833ff","#f93578","#14f0f0","#ebeded"];function ce(e){let t=Number(e);if(!isFinite(t))throw new TypeError("色值反向解析出错");if(t<16){return ae[t]}const n=e=>Math.floor(256*e/6+F(42)).toString(16).padStart(2,"0");t-=16;const r=t%36;return`#${n(Math.floor(t/36))}${n(Math.floor(r/6))}${n(r%6)}`}class le{constructor(e){this.parse(e),this.build()}build(){this.hide&&(this.color="transparent"),this.reversed&&([this.color,this.bgColor]=[this.bgColor,this.color]),j(this.color)||(this.str+=`color: ${this.color};`),j(this.bgColor)||(this.str+=`background: ${this.bgColor};`),0!==this.bold&&(this.str+=`font-weight: ${1===this.bold?800:200};`),this.italic&&(this.str+="font-style: italic;"),this.underline&&(this.str+="border-bottom: 1px #666 solid;")}color=void 0;bgColor=void 0;bold=0;italic=!1;underline=!1;reversed=!1;hide=!1;str="";parse(e){e.replace(/38;5;(\d+)/g,"c-$1").replace(/48;5;(\d+)/g,"b-$1").split(";").reverse().forEach(e=>{0===this.bold&&e===se.bold?this.bold=1:0===this.bold&&e===se.dim?this.bold=-1:e===se.italic?this.italic=!0:e===se.underline?this.underline=!0:e===se.reversed?this.reversed=!0:e===se.hide?this.hide=!0:j(this.color)&&e.startsWith("c")?this.color=ce(e.split("-")[1]):j(this.bgColor)&&e.startsWith("b")&&(this.bgColor=ce(e.split("-")[1]))})}}function ue(e){return _()?[e]:function(e){e=e.replace(new RegExp("\\\\[0m","g"),"");const t=Z(),n=[""];let r,o=0,i="";const s=()=>{const t=e.substring(o,r?.index??e.length);n[0]+="%c".concat(t),n.push(i)};for(;!S(r=t.exec(e));)s(),i=j(r[7])?new le(r[3].slice(0,-1)).str:"",o=t.lastIndex;return s(),n}(e)}function fe(e,t){if(x(e=S(e)||j(e)?"":e.toString()))return"";if(M(t))return e;const n=e.indexOf(Y),r=e.indexOf(`${Y}0m`);return t=function(e){return e.map(e=>"random"===e?`38;5;${F(255)}`:"bgRandom"===e?`48;5;${F(255)}`:e)}(t),n>-1&&r>-1?fe(e.substring(0,n),t).concat(e.substring(n,r+4)).concat(fe(e.substring(r+4),t)):e.endsWith("\r\n")?(e=e.substring(0,e.length-2),`${Y}${t.join(";")}m${e}${Y}0m\r\n`):e.endsWith("\n")?(e=e.substring(0,e.length-1),`${Y}${t.join(";")}m${e}${Y}0m\n`):`${Y}${t.join(";")}m${e}${Y}0m`}function he(e,t){const n=parseInt(t);if(n>10){const r=T(38===n)?"38;5;":"48;5;",o=e.findIndex(e=>e.startsWith(r));return o>-1?e.toSpliced(o,1,t):[...e,t]}return e.includes(t)?[...e]:[...e,t]}const de=b(function(e=[]){const t=(t,...n)=>{if(P(t,()=>N(t)&&t.every(e=>y(e)))){let r="";for(let o=0;o<t.length;o++)r+=fe(t[o],e),o<n.length&&(r+=fe(n[o],e));return r}if(M(n))return fe(t,e);throw new Error("pen: 缺少参数")},n=Object.keys(se).map(t=>[t,{get:()=>function(e,t){let n=[];if(P(e,y(se[e])))return n=he(t,se[e]),new de(n);if("hex"===e||"bgHex"===e)return r=>(n=he(t,se[e](r)),new de(n));if("rgb"===e||"bgRgb"===e)return(r,o,i)=>{if(y(r)&&j(o)&&j(i))n=he(t,se[e](r));else{if(!(k(r)&&k(o)&&k(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=he(t,se[e](r,o,i))}return new de(n)};if("color"===e||"bgColor"===e)return(r,o,i)=>{if(y(r)&&j(o)&&j(i))n=he(t,se[e](r));else{if(!(k(r)&&k(o)&&k(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=he(t,se[e](r,o,i))}return new de(n)};if("number"===e||"bgNumber"===e)return r=>{if(k(r))return n=he(t,se[e](r)),new de(n);throw new TypeError(`${e} 的参数应为有效正整数数值,范围 0 - 255`)};throw new Error(`${e} 函数不存在`)}(t,e)}]),r=Object.fromEntries(n);return Object.defineProperties(t,r),t});const ge=new de([]),pe=new de([se.red]),be=new de([se.green]),me=new de([se.yellow]),we=new de([se.blue]),ye=new de([se.magenta]),ve=new de([se.cyan]);new de([se.white]);const xe=new de([se.brightBlack]),$e=new de([se.brightRed]),ke=new de([se.brightGreen]),Ee=new de([se.brightYellow]);new de([se.brightBlue]);new de([se.brightMagenta]);const Ce=new de([se.brightCyan]);new de([se.brightWhite]),new de([se.bgBlack]),new de([se.bgRed]),new de([se.bgGreen]),new de([se.bgYellow]),new de([se.bgBlue]),new de([se.bgMagenta]),new de([se.bgCyan]),new de([se.bgWhite]),new de([se.bgBrightBlack]),new de([se.bgBrightRed]),new de([se.bgBrightGreen]),new de([se.bgBrightYellow]),new de([se.bgBrightBlue]);const Ie=new de([se.bgBrightMagenta]);new de([se.bgBrightCyan]),new de([se.bgBrightWhite]);const Te=new de([se.bold]),Oe=new de([se.italic]),Se=new de([se.underline]),je=new de([se.hide]);new de([se.dim]),new de([se.blink]);const Re=new de([se.reversed]);ge.rgb;const Ne=ge.hex;ge.color,ge.bgRgb;const Me=ge.bgHex;function De(e){const t=Z(),n=e.replace(t,"");let r=0;for(let e=0,t=n.length;e<t;e++)r+=1+Number(Le(n[e]));return r}function Le(e){const t=e.codePointAt(0)||0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=131072&&t<=191471||t>=63744&&t<=64255||t>=65280&&t<=65519||t>=65381&&t<=65439||t>=127744&&t<=129750||t>=128512&&t<=128591||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=44032&&t<=55215||t>=12288&&t<=12351}function Be(e,t,n=!0){const r=t,o=e;if(0===r)return"";let i=!1;const s=De(o);if(s<=r)return o.concat(" ".repeat(r-s));const a=r>0,c=Z();c.lastIndex=0;const l=[...o.replaceAll(c,"")],u=a?l:l.reverse(),f=u.length,h=Math.abs(r);let d=Math.floor(h/2),g=u.slice(0,d).join(""),p=De(g);for(;d<f;){if(p+=De(u[d]),p===h){g+=u[d];break}if(p===h+1){n&&(i=!0);break}if(p>h+1)break;g+=u[d],d++}if(a&&o.startsWith(g)||!a&&o.endsWith(g=[...g].reverse().join("")))return i?g+" ":g;if(a){let e;for(c.lastIndex=0;null!==(e=c.exec(o));){const t=g;if(g=t.slice(0,e.index).concat(e[0]).concat(t.slice(e.index)),o.startsWith(g))break}g+=Q}else{const e=[...g];let t=e.length-1;g="";const n=[...o].reverse();for(let r=0,o=n.length;r<o;r++){const o=n[r];if(o===e[t])--t;else if(t<0)break;g=o+g}g=Q+g}return i?g+" ":g}function Pe(e){return`${Y}?7l${e.toString()}${Y}?7h`}function Fe(e){try{throw new Error}catch(t){const n=(t.stack?.split("\n")||[]).map(e=>{const t=/at\s(.*)\s\((.*):(\d*):(\d*)\)/.exec(e);return t?{name:t[1],path:t[2],line:t[3],column:t[4]}:{name:""}}),r=n.filter(e=>""!==e.name&&void 0!==e.path),o=r[3]??r[2]??r[1]??r[0],i=` ${"info"===e?"💡":"error"===e?"❌":"⚠️ "} ${(new Date).toLocaleString()} `,s=("info"===e?ge.bgCyan.brightWhite:"error"===e?ge.bgBlack.red:ge.bgBrightYellow.brightGreen)(i);console.log(`${s} ${o?.name??""} ${o?.line?.concat(" 行")} ${o?.column?.concat(" 列")}`)}}function We(...e){Fe("error"),console.error(...e)}function Ae(...e){Fe("warn"),console.warn(...e)}function qe(...e){Fe("info"),console.info(...e)}function _e(e,t,n){if("node"===K){const r=globalThis?.process.env[n.toUpperCase().concat("_DEV")]||globalThis?.process.env[n.toLowerCase().concat("_dev")];if(!1===e||j(r)||"false"===r)return Reflect.apply(H,t,[]);[...V,"true","false"].includes(r)&&(e="true"===r?"all":r),t.info=["all","info",!0].includes(e)?qe:J,t.error=["all","error",!0].includes(e)?We:J,t.warn=["all","warn",!0].includes(e)?Ae:J}else{if(!1===e)return Reflect.apply(H,t,[]);t.info=["all","info",!0].includes(e)?qe:J,t.error=["all","error",!0].includes(e)?We:J,t.warn=["all","warn",!0].includes(e)?Ae:J}}function ze(e){j(e)&&(e={name:W(10),type:!1}),I(e)&&(e={name:W(10),type:e}),y(e)&&(e={name:e,type:!1});let{name:t="",type:n=!1}=e;t=t.trim().replace(/\s+/g,"_");const r="node"===K&&(globalThis?.process.env[t.toUpperCase().concat("_DEV")]??globalThis?.process.env[t.toLowerCase().concat("_dev")])||!1;n="node"!==K||G(("false"!==r&&("true"===r||r))??n);const o={error:J,warn:J,info:J};_e(n,o,t);const i=(...e)=>{Reflect.apply(o.info,this,e)};return Object.setPrototypeOf(i,this),Object.defineProperties(this,{type:{get:()=>n||!1,set(e){const r=G(e);r!==n&&(n=r,_e(n,o,t))}},error:{value:(...e)=>Reflect.apply(o.error,this,e),configurable:!1,enumerable:!1,writable:!1},warn:{value:(...e)=>Reflect.apply(o.warn,this,e),configurable:!1,enumerable:!1,writable:!1}}),i}ge.bgColor,ge.random,ge.bgRandom,ge.number,ge.bgNumber,ze.prototype.clear=()=>{"browser"===K?console.clear():console.log(U.concat("c"))};const Ve=b(ze),Ge=new Ve({name:"nry",type:!1}),Je=O(Ge.type);function He(t){return e(t,{throwIfNoEntry:!1})}const Ke=new Ve({type:"error",name:"a node tools"});function Ue(...e){return l(u(...e))}function Ye(e,t="file",...n){n=n.filter(e=>y(e));let r=f(...n);const o=He(r);if(Ke("当前工作目录",r),!o)return Ke("🎯 工作目录不存在"),"";if(o.isFile())r=c(r);else if(!o.isDirectory())return;let i=20;const s=()=>{const n=He(Ue(r,e));if(n&&("file"==t&&n.isFile()||"directory"==t&&n.isDirectory()))return r;if(C(i))return;i--,Ke("♻️ 查找中...",r);const o=Ue(r,"..");return o!==r?(r=o,s()):void 0};return s()}function Ze(n){if(!/.json^/.test(n)&&!e(n,{throwIfNoEntry:!1}))return null;try{const e=t(n,{encoding:"utf-8"});return JSON.parse(e||"null")}catch(e){return Ke.error(e),null}}const Qe=function(e,t){try{return r(e,JSON.stringify(t,null,2),{encoding:"utf-8",flag:"w"}),!0}catch(e){return Ke.error(e),!1}},Xe=()=>_()&&process&&process.stdout&&process.stdout.isTTY||!1,et=_()&&"win32"===process.platform||!_()&&window.navigator.userAgent.includes("Windows");function tt(e){const t=new RegExp(e);let n;try{throw new Error}catch(e){n=e}const r=(n.stack?.replace(/\\/gm,"/").split("\n")).reverse(),o=r.findIndex((e,n,r)=>!t.test(e)&&t.test(r[n+1]));if(-1==o)return{name:"",line:0,row:0,originArr:r};let i=r[o];return/\(.*\)/.test(i)&&(i=i.replace(/^.*\((.*)\).*/,"$1")),/file:\/*/.test(i)&&(i=i.replace(/^.*file:\/*(.*)/,"$1")),et||i.startsWith("/")||(i="/"+i),{name:i.replace(/^(.*):\d+:\d+$/,"$1"),line:Number(i.replace(/^.*:(\d+):\d+$/,"$")),row:Number(i.replace(/^.*:\d+:(\d+)$/,"$1")),originArr:r}}function nt(){let e;try{new Function('import("")'),e=h(import.meta.url)}catch(t){Ke.error(t),e=__filename}et&&(e=e.replace(/\\/gm,"/")),e=tt(e).name;return[e,c(e)]}const{stdin:rt}=process,ot={list:[],listened:!1,on(e,t,n){O(this.listened)&&(this.listened=!0,g(process.stdin),Xe()&&process.stdin.setRawMode(!0),process.stdin.resume(),rt.on("keypress",at),process.on("beforeExit",it),process.stdin.on("end",st));const r=this.list,o={key:e,callback:t,resolve:n};return M(r)&&Ke("当前执行的栈中没有数据",o),r.push(e),this[e]=o,o},remove(){const e=this.list,t=e.shift();return t&&this.del(t),Ke("执行完毕一项,还有:",e),!(e.length>0)&&(this.listened=!1,it(),Ke("监听已移除"),!0)},del(e){Ke("开始移除",e);const t=this.list[0]===e&&!j(this[e]);if(Ke("当前 key 是否为当前执行项",t),t)return this.remove(),!0;{const t=this.list.includes(e),n=!j(this[e]);return t&&n?(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),delete this[e],!0):t?(this.list.splice(this.list.indexOf(e),1),!0):!!n&&(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),!0)}}};function it(){rt.removeListener("keypress",at),process.removeListener("beforeExit",it),process.stdin.removeListener("end",st),Xe()&&rt?.setRawMode(!1),rt.pause()}function st(){it()}function at(e,t){const n=ot[ot.list[0]],{callback:r,resolve:o}=n;Ke("当前执行的回调是",{...n,rl:"原始值为 readline 的 Interface 对象"}),R(r)?T(Reflect.apply(r,null,[e,t]))&&(Ke("回调遇见了想待的键,执行了退出操作,keyValue: < ",e,"> key: <",t,">"),ot.remove(),o(!0)):(ot.remove(),o(!1))}const ct=(e,t)=>async function(e,t){if(!_())throw new RangeError("当前环境不支持 readInput");const n=t??Symbol(W(3));return new Promise(t=>{ot.on(n,e,t)})}(e,t);function lt(e="",t=!0){let n="";const r=w(e);if(!I(t))throw Ke.error(""),new TypeError("lineFeed 的类型必须是 boolean ");if("bigint"===r){const r=Object.prototype.toString.call(e).concat("n");n=t?`${r}\n`:`${r}`}else if(["string","number","boolean","function","null"].includes(r))n=t?`${e}\n`:`${e}`;else{const r=JSON.stringify(e,(e,t)=>R(t)?`${t}`:null==t?"undefined":t,2);n=t?`${r}\n`:`${r}`}_()?process.stdout.write(n):console.log(...ue(n.replace(/\n$/,"")))}function ut(e,t=!0){lt(`${t?Y:U}${e}`,!1)}function ft(){ut("?25l")}function ht(){ut("?25h")}function dt(e=!1){e&&pt(1/0),ut("0J")}function gt(e=1,t=!1){ut(`${mt(e,"vertical")}A`),t&&pt(1/0)}function pt(e=1){ut(`${mt(e)}D`)}function bt(e=1){ut(`${mt(e)}C`)}function mt(e,t="horizontal"){(!k(e=Number(e))||isNaN(e)||e<1||!1===Number.isInteger(e)&&e!==1/0)&&(e=1);const n=_()?"horizontal"===t?process.stdout.columns:process.stdout.rows:80;return(1/0===e||e>n)&&(e=n),e}function wt(){ht()}function yt(e){const t=e[e.length-1];y(t)&&!t.endsWith("\n")&&e.push("\n"),e.forEach(e=>lt(e,!1))}function vt(e,t){const{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}=t??{show:!0,info:"请等待",prefix:0,interval:20,canCtrlCExit:!1,canCtrlDExit:!1,beforeDestroyed:()=>{}},l=I(e)?{show:e,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:y(e)?{show:n,info:e,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:j(e)?{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:k(e)?{show:!0,info:"请等待",prefix:isNaN(e)?o:Math.min(Math.max(0,e),2),interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c,...e};return l.interval=isFinite(l.interval)?Math.max(20,Math.min(2e3,l.interval)):i,l.info=l.info.replace(/\n/g,"\\n"),l}function xt(){ht()}Object.defineProperties(ct,{remove:{value:e=>ot.del(e)}});const $t=[".","..","...","....","...",".."],kt=[["⋯","⋱","⋮","⋰","⋯","⋱","⋮","⋰"],["🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚","🕛"],["🕜","🕝","🕞","🕟","🕠","🕡","🕢","🕣","🕤","🕥","🕦","🕧"],["👈","👆","👉","👇","🤘","🤟","🫳","🫴","👊"],["🌞","🌕","🌖","🌗","🌜","🌘","🌑","🌒","🌓","🌛","🌔","🌔","🌔","🌝"]];class Et{#e;#t=void 0;#n=Symbol("waiting-tips");#r=[];#o=(...e)=>yt(e);state="destroyed";#i=0;#s=4e4;#a=!1;async destroyed(){"destroyed"!==this.state&&(this.state="destroyed",this.#i=0,j(this.#t)||clearInterval(this.#t),ct.remove(this.#n),pt(1/0),dt(),process.removeListener("exit",wt),process.removeListener("SIGINT",xt),ht(),this.#r.forEach(e=>this.#o(...e)),this.#r.length=0,this.log=this.#o,!function(e){return"promise"===w(e)}(this.#e.beforeDestroyed)?this.#e.beforeDestroyed(this.#a):await this.#e.beforeDestroyed(this.#a),this.#a=!1)}log=this.#o;run(e){"run"===this.state&&this.destroyed(),this.#a=!1,this.state="run",this.#i=Date.now(),this.#e=j(e)?this.#e:vt(e,this.#e);const{prefix:t,info:n,interval:r,canCtrlCExit:o,canCtrlDExit:i}=this.#e;this.log=(...e)=>this.#r.push(e);const s=$t.length,a=kt[Math.min(kt.length-1,Math.max(t,0))],c=a.length,l=a.reduce((e,t)=>Math.max(e,De(t)),0);let u=0;ft(),process.on("exit",wt),process.on("SIGINT",xt),this.#t=setInterval(()=>{dt(!0),this.#r.forEach(e=>yt(e)),this.#r.length=0,lt("\n".repeat(2)),gt(3),ut(7,!1);const e=Be(a[++u%c],l);Date.now()-this.#i<this.#s?lt(Pe(`${e} ${n.replace(/\n/,"\\n")}${$t[Math.floor(u/10)%s]}`),!1):lt(Pe(`${e} ${n} ${ye`当前已执行 ${Math.ceil((Date.now()-this.#i)/1e3)} 秒`}\n \n\r${ve`可使用双击 esc 键退出(确保执行完成,若执行仍在期望时间内,请忽略)`}`),!1),ut(8,!1)},r),ct((e,t)=>!!(t?.meta&&t?.sequence===U.repeat(2)||T(t?.ctrl)&&(o&&"c"===t?.name||i&&"d"===t?.name))&&(this.#a=!0,this.destroyed(),!0),this.#n)}set timeout(e){this.#i=Date.now(),this.#s=!isFinite(e)||e<0?4e4:e<600?1e3*e:e}get timeout(){return this.#s}constructor(e){this.#e=vt(e),T(this.#e.show)&&this.run()}}function Ct(e,t,n){let r=e.toString().trim();return/\n$/.test(r)||(r=r.concat(et?"\r\n":"\n")),r=r.replace(/\n+/g,"\n"),dt(),t&&n.log(r),r}function It(e,t){if(O(_()))throw new RangeError("当前环境不支持 node 环境");const{env:r}=t;y(e)&&(r.code=e,e={code:e,waiting:!1});const o=process.cwd();let i=p(o,e.cwd||"");-1===function(e){try{const t=He(e);if(t&&t.isDirectory())return 0==n(e,{withFileTypes:!0}).length?1:0}catch(e){return Ke.error("is ",e),-1}return-1}(i)&&(Ke(`执行目录 ${pe(i)} 不存在,使用命令执行目录 ${ve(o)}`),i=o);const s=e.code.replace(/\s{2,}/g," ").trim().split(" ");Object.assign(t.env,{shell:!0,hideWaiting:!0,waitingMessage:"请稍等",printLog:!1,...e,cmd:s,cwd:i})}function Tt(e){const t={result:{success:!1,data:"",error:"",status:1,isSIGINT:!1,runCode:"",runCwd:""},env:{cmd:[],code:"",cwd:"",printLog:!1,shell:!0,callBack:()=>{},waiting:{show:!1,info:"",prefix:0,interval:10,canCtrlDExit:!1,canCtrlCExit:!1,async beforeDestroyed(){}}}},{env:n,result:r}=t;Ke("runOtherCode 方法 开始执行 "),It(e,t),Ke("执行参数",t);const{cmd:o,waiting:i,cwd:s,shell:a,code:c}=n,[l,u]=(()=>{if(i instanceof Et)return[i,"run"===i.state];const e=vt(i);return[(t=e,new Et(t)),e.show];var t})();r.runCode=c,r.runCwd=s||process.cwd();try{return new Promise(e=>{const n=T(a)?d(c,[],{cwd:s,shell:a}):d(o[0],o.slice(1),{cwd:s,shell:a});u&&l.run({beforeDestroyed:e=>{if(e){if(Ke("执行退出前"),et){try{n.killed||n.kill(-1)}catch(e){Ke.error("使用 child.kill(child.pid, -1 ) 关闭子进程失败",e),d("taskkill",["/pid",n.pid?.toString()||"","/T","/F"],{stdio:"pipe"})}Ke("终结在 windows 下的子进程")}else n.kill("SIGTERM"),Ke("终结在非 windows 下的子进程");t.result.isSIGINT=!0}}}),n.on("spawn",()=>function(e){const{result:t}=e;Ke("子线程已启动,运行状态良好"),t.success=!0,t.status=1}(t)),n.stdout.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=Ct(e,r.printLog,n);Ke(Ie`stdout on data`,i),o.data+=i}(e,t,l)),n.on("exit",(e,t)=>{Ke("子进程已退出了,退出码为 <",e,">"),S(t)||Ke.error("子进程被其他信号中断执行,执行的退出信号为:",t)}),n.stderr.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=Ct(e,r.printLog,n);Ke(Ie`stderr on data`,i),o.error+=i}(e,t,l)),n.on("error",e=>function(e,t,n){const{env:r,result:o}=t;{const t=Ct(e,r.printLog,n);Ke(Ie`error`,t),Ke.error("error",t),o.success=!1,o.status=""!==o.data?2:3,o.error+=t}}(e,t,l)),n.on("close",(n,r)=>function(e,t,n,r,o){const{env:i,result:s}=r,{callBack:a}=i;Ke("进行正常关闭",e),setTimeout(async()=>{a&&R(a)&&Reflect.apply(a,null,[]),await o.destroyed(),0!==e&&"SIGINT"!==t&&"SIGTERM"!==t?(s.success=!1,s.status=3):"SIGINT"!==t&&"SIGTERM"!==t||(s.success=!1,s.status=4,s.isSIGINT=!0),n(s)})}(n??0,r??"",e,t,l))})}catch(e){const t=e.toString();return Ke.error("创建(但是确是非 node 无法创建子进程,而是更上游的 node 创建的错误)子进程出错",e),new Promise(e=>{(async()=>{await l.destroyed()})(),r.error=t,r.success=!1,r.status=0,e(r)})}}const Ot=e=>Tt(e);async function St(e,t=10){if(!y(e))throw new TypeError("str 需是一个字符串");if(!isFinite(t)||t<0||t>1e4)throw new RangeError("delay 需是一个 0 到 10000 之间(不包括两端)的数值");const n=Array.from(e);if(0!==n.length){for(const r of n)await z(t),Ke(`当前字符 ${Te(r)} 长度为:`,r.length),Ke(`当前字符 ${ge.reversed(r)} 在 charCodeAt`,r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2)),1===r.length&&E(r.charCodeAt(1))?lt(r,!1):2===e.length&&e.charCodeAt(0)>=55296&&e.charCodeAt(0)<=56319&&e.charCodeAt(1)>=56320&&e.charCodeAt(1)<=57343?(lt(r,!1),lt(" ",!1)):2===e.length&&65039===e.charCodeAt(1)?(lt(r,!1),lt(" ",!1)):(lt(r,!1),lt(" ",!1));lt()}else lt()}const jt=process.argv.slice(2);Object.freeze(jt);class Rt{originalArg=jt.slice();name="";__filename="";get state(){return this._state}set state(e){this._state=[void 0,{code:1,text:"start"},{code:2,text:"bind over"},{code:3,text:"run over"},{code:4,text:"over",overCode:e}][k(e)?e:4]}_state={code:1,text:"start"};args=new Nt;abbr={};helpInfo="";hasShowVersion=!1;originalBind={};values=[]}class Nt extends Array{get $nomatch(){return[]}get $map(){return{}}get $arrMap(){return[]}get $only(){return[]}get $original(){return[]}get $isVoid(){return!1}}const Mt={},Dt=new Ve({name:"a command"}),Lt=O(Dt.type);function Bt(e){return[e.replace(/^(.*?)\s.*/gm,"$1")||"",/<.+>/.test(e)&&e.replace(/.*<(.+)>.*/,"$1")||"",e.replace(/.*?\((.*)\).*?/,"$1")||""]}function Pt(e,t){switch(t.state.code){case 3:return void Dt.warn("执行绑定","但是已经执行过 `run`");case 4:return void Dt.warn("执行绑定,但是 command 已完成全部应做动作");default:t.state=2}if(y(e)){const[n,r,o]=Bt(e);return Pt({name:n,abbr:r,info:o},t)}if(N(e))return e.forEach(e=>Pt(e,t));if(!j(e)&&!e.name&&!e.info)return function(e,t){const n={name:"",info:"",abbr:"",options:[]},r=Object.keys(e),o=Object.keys(n);return r.forEach(n=>{if(!o.includes(n)){const[r,o,i]=Bt(n);return Pt({name:r,info:i,abbr:o,options:e[n]},t)}})}(e,t);const n=e;n.abbr&&(t.abbr[n.abbr]=n.name),n.options?n.options=function(e,t,n){N(e)||(e=[e]);const r={};return e.forEach(e=>{let o={name:"",abbr:"",info:""};y(e)?[o.name,o.abbr,o.info]=Bt(e):o=Object.assign(o,e),o.abbr&&(n.abbr[`${t}^${o.abbr}`]=o.name),r[o.name]=o}),r}(n.options,n.name,t):n.options={},t.originalBind[n.name]={abbr:"",...n}}function Ft(){return new Proxy(new Rt,{get(e,t,n){if("args"===t){const t=JSON.parse(JSON.stringify(e[Symbol.for("_args")]||[]));return new Proxy(t,{get(n,r,o){return"$nomatch"===r?e.values.slice():"$map"===r?function(e){if(M(e))return{};const t=new Object;return e.forEach(e=>{const n=t[e.name]||{};n.value=[...n.value||[],...e.value||[]],e.options&&e.options.forEach(e=>{n[e.name]=[...n[e.name]||[],...e.value||[]]}),t[e.name]=n}),t}(t):"$arrMap"===r?M(i=t)?[]:i.map(e=>{const t={},n=t[e.name]||{};return e.value&&!M(e.value)&&(n.value=e.value),j(e)||j(e.options)||M(e.options)||(n.options=[],e.options.forEach(e=>{n.options?.push(Object.fromEntries([[e.name,e.value]]))})),t[e.name]=n,t}):"$only"===r?[...new Set(t.map(e=>e.name))]:"$original"===r?jt.slice():"$isVoid"===r?0==jt.slice().length:Reflect.get(n,r,o);var i},set:(e,t,n,r)=>(Reflect.set(e,t,n,r),!0)})}return Reflect.get(e,t,n)},set:(e,t,n,r)=>("args"===t?e[Symbol.for("_args")]=n:Reflect.set(e,t,n,r),!0)})}const Wt=" ".repeat(4);function At(e){return e.state="help",y(e.helpInfo)&&"help"!==e.helpInfo?function(e,t){const n=e.originalBind[t];if(lt(`${Wt}${n.name}${Wt}${ye(n.info)}\n`),n.options&&!L(n.options)){lt(`${me(`${Wt}使用:`)} ${e.name} ${t} [subOptions/subAbbr [value]]\n`),lt(`${ve(`${Wt}subOptions:`)} \n`),qt(n.options||{})}else{lt(`${be(`${Wt}使用:`)} ${e.name} ${t} [value]\n`)}}(e,e.helpInfo):N(e.helpInfo)&&2==e.helpInfo.length?function(e){const t=e.name,n=e.helpInfo.join(" "),r=e.originalBind[e.helpInfo[0]].options[e.helpInfo[1]].info;lt(`${ve(" 可使用:")} ${t} ${n} [value]\n${be(" 描述:")} ${r}`)}(e):function(e){lt(`${$e(" 可使用:")} ${e.name} options/abbr [subOptions/subAbbr [value]]\n\n选项:\n`);const t=qt(e.originalBind);!function(e){["version -v 版本描述","help -h 帮助查看"].forEach(t=>{const[n,r,o]=t.split(" ");lt(_t({len:e,name:n,info:o,abbr:r})),lt("")})}(t)}(e)}function qt(e){const t=Object.keys(e).sort();let n=8;t.forEach(e=>n=Math.max(n,e.length));const r=Math.min(15,n+1);return lt(_t({len:r,name:"子命令",info:"描述",abbr:"缩写",color:!1})),lt(""),t.forEach(t=>{const{name:n,abbr:o,info:i}=e[t];let s=!1;"options"in e[t]&&!L(e[t].options)&&(s=!0),lt(_t({len:r,name:n,info:i,abbr:o,textDecoration:s})),lt("")}),r}function _t(e){const t=Object.assign({name:"",info:"",abbr:"",len:15,color:!0,textDecoration:!1},e);let n=ge[t.color?"green":"black"](Wt);return n+=ge[t.textDecoration?"blue":"black"](t.name.slice(0,t.len)),n+=" ".repeat(t.len+1-zt(t.name,t.len)),n+=ge[t.color?"yellow":"black"]`${t.abbr?.slice(0,6)||""}${" ".repeat(7-zt(t.abbr||"",6))}`,n+=t.color?ye(t.info):t.info,n}function zt(e,t){return Math.min(e.replace(/[^\x00-\x7f]/,"11").length,t)}const Vt="";function Gt(e){const{name:t,object:n,item:r,result:o}=e;$(t)||(r.name&&n.options?.push(r),o.push(JSON.parse(JSON.stringify(n))))}function Jt(e,t){"true"==e?e=!0:"false"==e?e=!1:e==Number(e)&&(e=Number(e)),$(t.name)?t.values.push(e):t[t.item.name?"item":"object"].value.push(e)}function Ht(e,t){const n=[];let r="";const o=(e,t)=>j(t)||$(t)?n.push(e):n.push(e,t);function i(e,s){if(!$(r)){if(t.originalBind[r].options[e])return o(e,s);const n=t.abbr[`${r}^${e}`];if(!j(n))return o(n,s)}if(t.originalBind[e])return r=e,o(e,s);if(t.abbr[e])return e=t.abbr[e],r=e,o(e,s);if(e.includes("=")){const t=e.indexOf("=");if(0===t||t===e.length-1)return n.push(e);const[r,o]=[e.slice(0,t),e.slice(t+1)||"true"];return i(r,o)}return j(s)||$(s)?n.push(e):n.push(`${e}=${s}`)}return e.forEach(e=>i(e)),n}function Kt(e,t,n){n.init(),e=Ht(e.filter(e=>""!==e),t),e.forEach(e=>{const{name:r}=n;return e=e.trim(),/^([a-z]|[A-Z]|-|\$|_)/.test(e)?!$(r)&&t.originalBind[r].options&&t.originalBind[r].options[e]?function(e,t){const{item:n,object:r}=t;n.name&&r.options.push(n),t.resetItem(e)}(e,n):t.originalBind[e]?function(e,t){$(t.name)||(Gt(t),t.resetItem("")),t.resetObject(e)}(e,n):Jt(e,n):Jt(e,n)}),Gt(n)}function Ut(e){switch(e.state.code){case 3:return void lt("已经执行过 `run`");case 4:return void lt("已完成全部");default:e.state=3}!function(e){if(2==process.argv.length)return;const t=e.originalArg,n=`${Vt}${t.join(Vt)}${Vt}`,r=t.findIndex(e=>/^(-h|help)$/.test(e));if(new RegExp(`${Vt}(-v|version)${Vt}`,"i").test(n))return void(e.hasShowVersion=!0);if(C(r))return void(e.helpInfo="help");let o=[];const i={result:[],values:[],name:"",object:{name:"",value:[],options:[]},item:{name:"",value:[]},resetObject(e){this.name=e,this.object={name:e,value:[],options:[]}},resetItem(e){this.item={name:e,value:[]}},init(){this.result=[],this.values=[],this.resetItem(""),this.resetObject("")}};r>0?(Kt(t.slice(0,r+1),e,i),e.values=i.values,e.args=i.result,o=e.args,M(o)?e.helpInfo="help":[j,M].some(e=>e(o[0].options))?e.helpInfo=o[0].name:e.helpInfo=[o[0].name,o[0].options[0].name]):(Kt(t,e,i),e.values=i.values,e.args=i.result)}(e),function(e){["name","originBind","abbr"].forEach(t=>{const n=t;e[n]&&(Object.freeze(e[n]),Object.defineProperty(e,t,{value:e[n],writable:!1,enumerable:!0,configurable:!1}))})}(e)}function Yt(e){e.state="version";const t=Ye("package.json","file",tt(e.__filename).name);if(j(t))return Zt();const n=Ue(t,"package.json");if(!He(n))return Zt();const r=Ze(n);if(S(r))return Zt();const{platform:o}=process,i=ge.brightCyan(r.name),a=r.version,c="win32"==o?"Windows":"darwin"==o?"mac":o,l=ge.brightMagenta(s());lt(`${i} 版本 ${ge.brightRed(a)} (${c} ${l})`)}function Zt(){lt("抱歉,未找到版本定义说明")}const Qt=Ne("#333"),Xt=Ne("#666"),en=Ne("#aaa"),tn=Me("#666"),nn=Xt(".".repeat(3)),rn=(e="❖")=>ke(e),on=(e="▶︎")=>Ee(e),sn=(e="⚉")=>$e(e),an=(e="◦")=>Xt(e),cn=(e="●")=>ke.blink(e),ln=(e="□")=>Xt(e),un=(e="□")=>ke.blink(e),fn=(e="■")=>Xt(e),hn=(e="■")=>ke.blink(e);function dn(e,t="⚉"){lt(`${sn(t)} ${Ne("#612").italic(e)}`)}function gn(e,t="❖"){lt(`${rn(t)} ${e}`)}const pn={callList:[],on(e,t){const n=this.callList;M(n)&&(Dt("当前执行列表为空,直接执行任务",e),Reflect.apply(t,void 0,[])),n.push([e,t])},remove(e){const t=this.callList,n=t.findIndex(([t])=>t===e);return t.splice(n,1),M(t)?(Dt("当前执行列表为空,返回 true 结束执行"),!0):(Reflect.apply(t[0][1],null,[]),!1)}},bn={data:"",kind:0,multi:!1,progressCount:0,indexOfCursor:0,init:function(e){this.data=e,this.multi=N(e)}},mn={get kind(){return bn.kind},set kind(e){(!isFinite(e)||0!=e&&1!=e)&&(e=0),bn.kind=e},get multi(){return bn.multi},enterText:[],get progressCount(){return bn.progressCount},set progressCount(e){bn.progressCount=e,e<0&&Reflect.apply(wn,this,[])},get indexOfCursor(){return bn.indexOfCursor},set indexOfCursor(e){bn.indexOfCursor=e},currentIssue:{text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,canCtrlCExit:!1,canCtrlDExit:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]},results:[],assign(e){Object.keys(e).forEach(t=>{if(!Object.hasOwn(this,t)||j(e[t]))throw lt(`${t} is not exist`),new Error(`${t} is not exist`);this[t]=e[t]})},beforeStart(){this.results.length=this.enterText.length=this.indexOfCursor=0,this.progressCount=bn.multi?-bn.data.length:-1}};function wn(){const{multi:e,progressCount:t}=this,n=e&&N(bn.data)?bn.data[bn.data.length+t]:bn.data,r={text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,canCtrlCExit:!1,canCtrlDExit:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]};Object.assign(r,y(n)||k(n)?{text:n}:n);const o=N(r.tip)?1:0;let i;1==o?i=[r.tip[0]]:(i=[],[r.tip,r.defaultValue].every(e=>x(e))&&(r.required=!0),!$(r.defaultValue)&&x(r.tip)&&(r.tip=r.defaultValue)),r.text=$(r.text.toString())?"请使用你自己的问题":r.text,this.assign({indexOfCursor:0,kind:o,enterText:i,currentIssue:r})}const yn=A(()=>{const{kind:e,currentIssue:t,enterText:n}=mn,{mustInfo:r,text:o,required:i,tip:s,verify:a}=t;ft();let c="",l=!1;if(C(t.row)||(c+=`${Y}${t.row}A`,t.row=0),c+=`\r${Y}0J${Q}`,r)c=vn(c),l=!0;else if(!M(n)){const e=n.join("");for(const n of a)if(v(n.reg)&&y(n.info)&&[j,I].some(e=>e(n.inverse))){n.reg.lastIndex=0;const r=n.reg.test(e);if(T(n.inverse)&&T(r)||T(!n.inverse)&&O(r)){t.mustInfo=n.warn?Ee(n.info):n.info,c=vn(c),l=!0;break}}}const u=0===e&&i?$e.blink("*"):"";c+=`${on()} ${u}${o}${u}: `,t.row+=Number(t.isWrapLine),c+="\n".repeat(Number(t.isWrapLine)),C(e)?M(n)&&y(s)?x(s)?c+=Oe.dim.blink("I"):c+=" ".concat(tn.italic.dim(s[0])).concat(Oe.dim(s.slice(1))):(c+=" ",c=function(e){const{type:t,usableLength:n}=mn.currentIssue;e="text"===t?function(e,t){const{enterText:n,indexOfCursor:r}=mn,o=De(n.join(""))>t;r===n.length?(o?e=function(e,t){const{enterText:n}=mn;return e+=nn.concat([...Be(n.toReversed().join(""),t-3,!1)].reverse().join("")),e}(e,t):e+=n.join(""),e+=tn.hide(" ")):o?e=function(e,t){const{indexOfCursor:n,enterText:r}=mn,o=r.join(""),i=r.length,s=Math.floor(t/2),a=Be(o,s),c=a.length-1,l=a[c]===o[c]?c:c-1,u=Be(o,-s),f=u.length-1,h=u[f]===o[i-1-f]?i-1-f:i-f,d=r.map((e,t)=>t===n?tn(e):e).join("");if(n>=h)e+=nn,e+=Be(d,3-t,!1);else if(n<l)e+=Be(d,t-3,!1),e+=nn;else{const t=s-De(r[n])-3;e+=nn,e+=Be(o.slice(0,n),-t,!1),e+=tn(r[n]),e+=Be(o.slice(n+1),t,!1),e+=nn}return e}(e,t):e+=`${n.map((e,t)=>t===r?tn(e):e).join("")}`;return e}(e,n):function(e){const{enterText:t,indexOfCursor:n}=mn;n===t.length?(e+=` ${t.map(()=>"*").join("")}`,e+=tn.hide("1")):e+=` ${t.map((e,t)=>t===n?tn("*"):"*").join("")}`;return e}(e);return e}(c)):c=function(e){const{currentIssue:t,enterText:n}=mn;return e+t.tip.map(e=>e===n[0]?Se.bold.blink.cyan(e):ye(e)).join(" ")}(c),Dt("计算完成的文本为",c),lt(Pe(c)),t.row++,function(e){const{currentIssue:t,indexOfCursor:n,enterText:r}=mn,{text:o,required:i,mustInfoLen:s}=t;if(e)return bt(s);const a=r.slice(0,n).join(""),c=o.toString().concat(a),l=De(c),u=l+7+2*Number(i),f=u%process.stdout.columns;Dt("用户输入",r.join("")),Dt("光标所在的位置",n),Dt("实际参与计算的用户输入的文本为",a),Dt("计算总文本",c),Dt("计算文本长度",l),Dt("计算可用长度",u),Dt("屏幕宽",process.stdout.columns),Dt("光标偏移量",u%process.stdout.columns),bt(f)}(l),l||lt(je("I"),!1),ut("8m")},66);function vn(e){const{currentIssue:t}=mn;e+="\n\r",t.row++;let n="";if(I(t.mustInfo)){const e=t.required?" ":"";n+=" ".repeat(2).concat(e).concat(pe(t.text)).concat(e).concat(" ".repeat(3)),n+=pe.blink`👆`}else n+=ye(t.mustInfo);let r=De(n);const o=process.stderr.columns-4;return o<r&&(r=o,n=Be(n,o)),t.mustInfoLen=r,e+=n,e+=`\r${Y}1A`,t.row--,t.mustInfo=!1,e}function xn(){const{currentIssue:e}=mn;!function(){const{currentIssue:e}=mn,t=process.stdout.columns;let n=t-De(e.text.toString())-2*Number(e.required)-4-7;const r=n<5;r&&(n=t-4);e.isWrapLine=r,e.usableLength=n}();const{isWrapLine:t}=e,n=2+Number(t);lt("\n".repeat(n),!1),e.row+=n,gt(n),e.row-=n}async function $n(){try{await ct((e=this,(t,n)=>{const{kind:r,currentIssue:o,enterText:i,results:s}=e,{tip:a,text:c,canCtrlCExit:l,canCtrlDExit:u}=o;let f=[],h=0,d=0,g=!0;switch(C(r)||(f=a,h=f.length-1,d=f.indexOf(i[0])),Dt("\n 用户使用了",t,n),n.name){case"return":if(function(){const{enterText:e,currentIssue:t,results:n}=mn,r=t.text;let o=e.join("").trim();if(x(o)&&t.required)return t.mustInfo=!0,!1;const{len:i,minLen:s,maxLen:a,verify:c}=t,l=o.length;if(C(mn.kind)){if(c.length>0)for(const e of c)if([j,O].some(t=>t(e.warn))&&v(e.reg)&&y(e.info)&&[j,I].some(t=>t(e.inverse))){e.reg.lastIndex=0;const t=e.reg.test(o);if(T(e.inverse)&&t||!e.inverse&&!t)return!1}if(!C(i)&&l!==i)return t.mustInfo=`您输入的长度 ${be(l)} 不符合要求值 ${ve(i)}`,!1;if(!C(s)&&l<s)return t.mustInfo=`您输入的长度 ${be(l)} 小于最低要求${ve(s)}`,!1;if(a>s&&l>a)return t.mustInfo=`您输入的长度 ${be(l)} 大于最低要求${ve(a)}`,!1}return x(o)&&O(t.required)&&(o=t.defaultValue||t.tip||""),n.push({q:r,r:o}),!0}())return g=!1,!0;break;case"left":!function(e,t,n){const{kind:r,enterText:o}=mn;C(r)?mn.indexOfCursor=0===mn.indexOfCursor?o.length:mn.indexOfCursor-1:o[0]=e[0===t?n:t-1]}(f,d,h);break;case"right":!function(e,t,n){const{kind:r,enterText:o}=mn;C(r)?mn.indexOfCursor=mn.indexOfCursor==mn.enterText.length?0:mn.indexOfCursor+1:o[0]=e[t==n?0:t+1]}(f,d,h);break;case"delete":case"backspace":!function(){const{enterText:e,kind:t}=mn;C(t)&&!C(mn.indexOfCursor)&&(e.splice(mn.indexOfCursor-1,1),mn.indexOfCursor--)}();break;case"escape":if(n?.sequence===U.repeat(2))return s.push({q:c,r:void 0}),g=!1,!0;break;default:if(Dt("当前触发为含 ctrl 键的功能键",t,n),O(n?.ctrl))!function(e){const{enterText:t,kind:n}=mn;j(e)||0!==n||(mn.indexOfCursor==t.length?t.push(e):t.splice(mn.indexOfCursor,0,e),mn.indexOfCursor+=1)}(t);else if(g=!1,ut("m"),T(l)&&"c"===n?.name||T(u)&&"d"===n?.name)return s.push({q:c,r:void 0}),!0}return g&&yn(),!1}))}catch(e){Dt.error("接收用户输入出错",e),lt(e)}var e}function kn(e,t){const n=Symbol("question");try{return new Promise((r,o)=>{pn.on(n,async()=>{try{const o=await async function(e,t){process.stdout.removeListener("resize",En),process.stdout.on("resize",En),Dt("初始化问题"),bn.init(e),Dt("初始化当前问题"),mn.beforeStart(),Dt("开始绘制问题");do{xn(),yn();try{await Reflect.apply($n,mn,[])}catch(e){Dt.error(e)}const{currentIssue:e,results:t}=mn;C(e.row)||(gt(e.row,!0),e.row=0),ut("m"),ht(),dt(!0);const n=e.resultText||e.text,r=t[t.length-1].r;e.private||(j(r)?dn(e.errorText||n):gn(`${Xt(n)}: ${"text"===e.type?r:r.replace(/./gm,"*")}`)),++mn.progressCount}while(mn.progressCount<0);return process.stdout.removeListener("resize",En),ut("m"),ht(),dt(!0),mn.multi?T(t)&&N(e)?mn.results.map(e=>e.r):mn.results:mn.results[0].r}(e,t);pn.remove(n),r(o)}catch(e){Dt.error("\n\n\n\n\n执行出现错误",e),pn.remove(n),o(e)}})})}catch(e){return Dt.error("系统故障",e),lt("系统故障",!1),lt(e),new Promise((t,n)=>{n(e)})}}const En=A(()=>{const{currentIssue:e}=mn;C(e.row)||(gt(e.row,!0),e.row=0),lt(Q,!1),dt(!0),xn(),yn()}),Cn=async function(e,t){return kn(e,t)};function In(e=!0){return process.stdout.rows-4*(1+Number(e))}function Tn(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(P(r,e=>[y,k].some(t=>t(e))))t.push({value:r,label:r,checked:!1,tip:"",disable:!1});else{if(!P(r,e=>[y,y].some(t=>t(e.label))&&[y,k,B].some(t=>t(e.value))))throw new TypeError(`${r} 的类型非法(有可能是返回值类型更改后未在解析中兼容)`);{let e=r.checked;!j(e)&&I(e)||(e=!1);let n=r.tip;!j(n)&&y(n)||(n="");const o=r.value;if(j(o)||S(o))throw new TypeError("value 值类型非法");const i=r.label,s=T(r.disable);t.push({checked:e,tip:n,value:o,label:i,disable:s})}}}return t}const On="请使用键盘选择,请使用 Enter 键进行选择",Sn=!1,jn="radio",Rn={drawData:[],info:On,focus:0,renderInfo:{rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},resultText:"",errorText:"",private:Sn,required:Sn,kind:jn,canCtrlCExit:Sn,canCtrlDExit:Sn,mustInfo:Sn,maxRows:In(),data:[],initData(e){Dt("初始化数据"),this.reset(),N(e)?this.data=Tn(e):Object.keys(e).forEach(t=>{const n=e[t];switch(t){case"data":this.data=N(n)?Tn(n):[];break;case"info":this.info=y(n)?n:On;break;case"resultText":this.resultText=y(n)?n:this.info||"";break;case"errorText":this.errorText=y(n)?n:this.resultText||this.info||"";break;case"private":this.private=I(n)?n:Sn;break;case"required":this.required=I(n)?n:Sn;break;case"kind":this.kind="check"===n?"check":jn;break;case"canCtrlCExit":this.canCtrlCExit=I(n)?n:Sn;break;case"canCtrlDExit":this.canCtrlDExit=I(n)?n:Sn;break;case"maxRows":this.maxRows=isFinite(n)&&Number.isInteger(n)&&n>0?n+4:In()}});const t=this.data;for(const e in t){if(!t[e].disable)return this.focus=Number(e),!1}return!0},reset(){this.drawData.length=this.data.length=this.focus=0,this.maxRows=In(),this.renderInfo={rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},this.info=On,this.kind=jn,this.resultText=this.errorText="",this.private=!0,this.required=this.canCtrlCExit=this.canCtrlDExit=this.mustInfo=Sn}};function Nn(e){const{data:t}=Rn,n=process.stdout.columns-7,r=n-3,o=t[e].label.toString();return De(o)<=n?o:Be(o,r,!1).concat(nn)}const Mn=()=>{!function(){const{focus:e,drawData:t,data:n,kind:r}=Rn;for(let o=0,i=n.length;o<i;o++){const i=n[o];if(j(t[o])){const n=De(i.label.toString());t[o]={index:o,text:Nn(o),length:n,checked:"radio"!==r&&i.checked,focus:o===e,changed:!0,show:!0,disable:i.disable}}else o===e?(t[o].changed=!0,t[o].focus=!0):o!==e&&T(t[o].focus)&&(t[o].changed=!0,t[o].focus=!1)}}(),function(){const{drawData:e,renderInfo:t,focus:n}=Rn,{renderRows:r}=t,o=e.length;if(o===r)return void e.forEach(e=>e.show=!0);const i=o-1,s=Math.floor((r-1)/2);let a=1&r?n-s:n-s-1;a=a<0?0:a;let c=r+a-1;c>i&&(c=i,a=c-r+1);e.forEach(e=>{const{index:t}=e;t>c||t<a?e.show=!1:t===c&&t!==i||t===a&&0!==t?(e.show=!0,e.text=nn):e.text===nn?(e.show=!0,e.text=Nn(t)):e.show=!0})}();const{info:e,mustInfo:t,renderInfo:n,focus:r,data:o}=Rn,{rows:i,allowBelow:s,size:a}=n,{width:c}=a;let l=`${Y}${c}D`;l+="\n".repeat(i),l+=`${Y}${i}A`,l+=`${Y}J`,l+=Pe(`${on()} ${e} \n\n`),l+=function(){const{drawData:e,kind:t}=Rn;let n="";for(let r=0,o=e.length;r<o;r++){const o=e[r];o.show&&(o.focus?(n+=Pe(` ${"radio"===t?cn():o.checked?hn():un()} ${o.text}`),n+="\n"):o.text===nn?(n+=` ${nn}`,n+="\n"):o.disable?(n+=Pe(` ${"radio"===t?en`⊗`:o.checked?en`▣`:en`☒`} ${en(o.text)}`),n+="\n"):(n+=Pe(` ${"radio"===t?an():o.checked?fn():ln()} ${Qt(o.text||"")}`),n+="\n"))}return n}(),l+=`${Y}J`,s&&(t?l+=function(){const e=process.stdout.columns-7;Rn.mustInfo=!1;const t="抱歉,该项至少选择一项!!!请使用空格键或是左右键切换选择状态",n=De(t)<e?t:Be(t,e);return"\n".concat(pe(n))}():o[r].tip?(l+="\n",l+=Pe(`${ve(o[r].tip)}`)):l+="\n",l+="\n"),Lt&&(l+=`${Y}${c}D${Y}${i}A`),lt(l,!1)},Dn=A(Mn,66),Ln=A(Mn,600);function Bn(){const{data:e,renderInfo:t,maxRows:n}=Rn,[r,o]=[process.stdout.columns,process.stdout.rows],i=e.length;t.size={width:r,height:o};const s=t.rows=Math.max(Math.min(i+4,In(!1),n),5),a=t.allowBelow=In()>e.length||s>6,c=t.otherInfoRows=a?4:2;t.renderRows=s-c}async function Pn(){const{data:e,required:t,kind:n,drawData:r,canCtrlCExit:o,canCtrlDExit:i}=Rn,s={exit:!1};return await ct((a,c)=>{const{focus:l}=Rn;switch(c.name){case"return":return Dt("用户已选择,返回真值告诉等待程序可终结当前输入"),"check"!==n||!t||!M(r.filter(e=>e.checked))||(Rn.mustInfo=!0,Dn(),!1);case"up":Dt("用户使用了键盘键的 up 键"),Wn(!1),Dn();break;case"down":Dt("用户使用了键盘键的 down 键"),Wn(),Dn();break;case"right":Dt("用户使用了键盘键的右键");case"left":Dt("用户使用了键盘键的左键");case"space":Dt("用户使用了键盘键的空格键"),"check"===n&&(e[l].checked=r[l].checked=!r[l].checked,Dn());break;case"escape":if(c?.sequence===U.repeat(2))return s.exit=!0,!0;break;default:if(Dt("用户使用了键盘键的非方向键 <",a,">, <",c,">"),T(c?.ctrl)&&("check"===Rn.kind&&("a"===c?.name&&(Fn(),Dn()),"z"===c?.name&&(Fn(!1),Dn()),"r"===c?.name&&(Rn.data.forEach(e=>{e.disable||(e.checked=!e.checked)}),Rn.drawData.forEach(e=>{e.disable||(e.checked=!e.checked)}),Dn())),T(o)&&"c"===c?.name||T(i)&&"d"===c?.name))return s.exit=!0,!0}return!1}),s.exit}function Fn(e=!0){Rn.data.forEach(t=>{t.disable||(t.checked=e)}),Rn.drawData.forEach(t=>{t.disable||(t.checked=e)})}function Wn(e=!0){const{focus:t,drawData:n}=Rn,r=n.length-1,o=e?t===r?n:[...n.slice(t+1),...n.slice(0,t+1)]:0===t?n.toReversed():[...n.slice(t),...n.slice(0,t)].toReversed();for(const e of o)if(!e.disable)return void(Rn.focus=e.index)}async function An(e,t){const n=Symbol("selection");return new Promise((r,o)=>{pn.on(n,async()=>{try{const o=await async function(e,t){if(process.stdout.removeListener("resize",qn),process.stdout.on("resize",qn),Rn.initData(e))return;ft(),Dt("初始绘制问题选项"),Bn(),Dn(),Dt("绘制完成,等待用户操作");const n=await Pn();lt(Q,!1),process.stdout.removeListener("resize",qn);const{resultText:r,info:o,focus:i,kind:s,drawData:a,errorText:c}=Rn;if(ht(),dt(!0),n)return void(Rn.private||dn(c||r||o));const l=a.filter(e=>e.checked);if(!Rn.private){const e="radio"===s?[a[i].text]:l.map(e=>e.text);gn(`${Xt.italic.dim(r||o)}: ${Xt(e.join("、"))}`)}const u="radio"===s?Rn.data[i].value:l.map(e=>Rn.data[e.index].value),f="radio"===s?i:l.map(e=>e.index),h="string"==t||j(t)?u:f;return h}(e,t);pn.remove(n),r(o)}catch(e){Dt.error(e),pn.remove(n),o()}})})}const qn=A(()=>{const{drawData:e,renderInfo:t}=Rn,n=t.size.height;e.length=0,lt(Q,!1),dt(),Bn(),process.stdout.rows!==n?Ln():Dn()},33);function _n(e,t){return An(e,t)}const zn=new Ve({name:"qqi",type:!1});O(zn.type);const Vn=new class{#c;#l;constructor(e=""){if(y(e)||(e=`${e}`),this.#c=Symbol(e),Mt[this.#c])throw new Error(`${e} 已经存在,请更换初始化命令名称,若仍想在原命令上操作,请抽离为单独的文件做数据共享`);this.#l=Mt[this.#c]=Ft(),[this.#l.__filename]=nt(),this.#l.name=e||y(process.argv[1])&&process.argv.slice(1,2)[0].replace(/.*\/.*?$/,"$1")||"",Object.defineProperty(this,"#uniKey",{value:this.#c,writable:!1,enumerable:!1,configurable:!1})}get name(){return this.#l.name}get state(){return this.#l.state}isEnd(e=!1){const t=4===this.#l.state.code;return t&&T(e)&&this.end(),t}end(){return this.#l.state="end",process.exit()}error(){return this.#l.state="error",process.exit(1)}bind(e){return Pt(e,this.#l),this}run(){const e=this.#l;return Ut(e),$(e.helpInfo)||At(e),e.hasShowVersion&&Yt(e),this}get args(){return this.#l.args}get values(){return this.#l.values.slice()}help(e,t){const n=this.#l;y(e)&&n.originalBind[e]?y(t)&&n.originalBind[e].options&&n.originalBind[e].options[t]?n.helpInfo=[e,t]:n.helpInfo=e:n.helpInfo="help",At(this.#l)}version(){Yt(this.#l)}}("nry");async function Gn(e="好的,即将退出"){return $(e)||await St(e),ht(),Vn.end()}function Jn(e){return e.endsWith("/")?e:e+"/"}async function Hn(e){return new Promise(t=>{let n;try{return n=new URL(e),t(!0)}catch{return Ge.error("当前传入的",e,"有误"),t(!1)}})}Vn.bind(["add <a> (用于添加一个自定义的 npm、yarn、pnpm 源)","edit <ed> (用于编辑源) ",Je?"":"clean (移除本地数据)","delete <del> (用于移除某个或多个自定义的项)","list <ls> (用于展示当前的所有的源)","manage <mg> (用于管理当前源在列表中的显隐)",`reset <rs> (重制当前的源,将${$e`永久移除自定义源`}、${Ce`恢复已更改的源`})`]).run().isEnd(!0);const Kn={npm:"https://registry.npmjs.org/","tao-bao":"https://registry.npmmirror.com/","ten-xun":"https://mirrors.tencent.com/npm/",ustclug:"https://npmreg.proxy.ustclug.org/",yarn:"https://registry.yarnpkg.com/"},{npm:Un,"tao-bao":Yn,"ten-xun":Zn,ustclug:Qn,yarn:Xn}=Kn,er=[{value:Un,label:"官方",tip:Un},{value:Yn,label:"淘宝",tip:Yn},{value:Zn,label:"腾讯",tip:Zn},{value:Qn,label:"中科大",tip:Qn},{value:Xn,label:"yarn",tip:Xn}];function tr(e=!1){if(e)return[...er];if(!or.available)return[...er];const t=or.read();if(N(t)&&t.every(e=>y(e.value)&&!$(e.label)&&y(e.value)&&!$(e.value))){const e=t.map(e=>(e.value=Jn(e.value),e.tip=Jn(e.tip),e));return e}return[...er]}const nr=new class{#u;#f=!0;get available(){return this.#f}constructor(e){const t=function(){const e=a();if(zn("当前获取用户主目录为",e),!e||"/"===e||e.includes("Default"))throw new Error("未能获取到主目录路径 <"+e+">");try{const t=Ue(e,"test_write"+Date.now());return Qe(t,{}),o(t),e}catch(e){return void zn.error(e)}}();if(j(t))return this.#f=!1,void(this.#u="");this.#f=!0,this.#u=Ue(t,".earthnut.dev.data",`${e}`)}read(e){if(!this.available)return null;const t=Ue(this.#u,e);return j(He(t))?{}:Ze(t)||{}}write(e,t){if(!this.available)return!1;const n=Ue(this.#u,e),r=Ue(n,"../");zn("创建的文件路径为"),i(r,{recursive:!0}),zn("写入的文件路径为:",n),zn("写入文件内容为",t);const o=Qe(n,t);return zn("写入反馈",o),o}getPath(e){return Ue(this.#u,e)}}("nry"),rr="config",or={available:nr.available,read(){if(nr.available){const e=nr.read(rr);if(N(e))return e}return tr(!0)},addNew(e){if(nr.available){const t=this.read();return t.push(e),Ge("新写入的数据为",e),this.write(t)}return!1},write:e=>!!nr.available&&nr.write(rr,e),getPath:()=>nr.getPath(rr),clean(){const e=this.getPath();Ge("将要移除的文件",e),o(e)}},ir={add:!1,edit:!1,delete:!1,manage:!1,list:!1,noMatch:!1,reset:!1,clean:!1},sr={pkgManager:function(e=!1){if(O(e)){const e=e=>Boolean(Ye(e,"file"));if(e("pnpm-lock.yaml"))return"pnpm";if(e("yarn.lock"))return"yarn";if(e("package-lock.json"))return"npm"}const t=process.env.npm_config_user_agent||"";return t.includes("pnpm")?"pnpm":t.includes("yarn")?"yarn":t.includes("npm")?"npm":process.env.PNPM_HOME?"pnpm":process.env.YARN_IGNORE_PATH?"yarn":"npm"}(!0)};function ar(e){if(!or.available)return!1;const t=Jn(e.value);return or.addNew({value:t,label:e.label.toString(),tip:t,disable:!1})}const cr=b(function(e){return this.data=[],Object.setPrototypeOf(this,e),this});function lr(e,t){if(t.align&&(e.align=t.align),t.bgColor&&(e.bgColor=t.bgColor),t.color&&(e.color=t.color),t.italic&&(e.italic=t.italic),t.underline&&(e.underline=t.underline),t.border)if(P(t.border,e=>y(e))){const n=t.border;e.border={left:{color:void 0,style:n},right:{color:void 0,style:n},top:{color:void 0,style:n},bottom:{color:void 0,style:n}}}else if(P(t.border,e=>["color","style"].some(t=>!j(e[t])))){const n=t.border,r=n.style,o=n.color||void 0;e.border=JSON.parse(JSON.stringify({left:{color:o,style:r},right:{color:o,style:r},top:{color:o,style:r},bottom:{color:o,style:r}},(e,t)=>""===t?void 0:t))}else P(t.border,e=>["left","right","top","bottom"].some(t=>!j(e[t])))&&(e.border=t.border)}class ur{}function fr(e,t){N(e)&&(e={data:e});const n=new ur;lr(n,e);const r=new cr(n);return Object.setPrototypeOf(n,t),e.data?.forEach(e=>{e&&r.data.push(function(e,t){if(j(e))return;P(e,e=>!D(e))&&(e={content:e});const n={content:e.content};return lr(n,e),Object.setPrototypeOf(n,t),n}(e,n))}),r}class hr extends ur{border={left:{style:"bold",color:void 0},right:{style:"bold",color:void 0},top:{style:"bold",color:void 0},bottom:{style:"bold",color:void 0}}}function dr(e){const t=new hr;return Object.setPrototypeOf(t,e),t}const gr=!_(),pr={emojiLength:2.08,emojiRegex:/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F900}-\u{1F9FF}]/gu,chineseLength:1.8,chineseRegex:/[\u4E00-\u9FFF]/g};const br=new class{align="left";color="";bgColor="";bold=!1;underline=!1;italic=!1;border={left:{color:void 0,style:"simple"},right:{color:void 0,style:"simple"},top:{color:void 0,style:"simple"},bottom:{color:void 0,style:"simple"}}},mr=b(function(e){return this.body=[],this.header=void 0,Object.setPrototypeOf(this,e),this});class wr{}function yr(e){let t=ge;return P(e)&&(e.bold&&(t=t.bold),$(e.bgColor)||j(e.bgColor)||(t=t.bgColor(e.bgColor)),$(e.color)||j(e.color)||(t=t.color(e.color)),e.italic&&(t=t.italic),e.underline&&(t=t.underline)),t}const vr={fine:{lt:"┌",ct:"┬",rt:"┐",lc:"├",c:"┼",rc:"┤",lb:"└",cb:"┴",rb:"┘",l:"─",v:"│"}};function xr(e){let t=0;return[...e].forEach(e=>{pr.emojiRegex.lastIndex=0,pr.chineseRegex.lastIndex=0,e.match(pr.emojiRegex)?t+=pr.emojiLength:e.match(pr.chineseRegex)?t+=pr.chineseLength:t++}),Math.ceil(t)}function $r(e,t){const n=function(e){const t=[];return e.header&&e.header.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,gr?xr(r):De(r))}),e.body&&e.body.forEach(e=>{e.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,gr?xr(r):De(r))})}),t}(e);let r=!1,o="";e.header&&(r=!0,o+=function(e,t){let n="";const r=t.length-1,{fine:o}=vr,i=yr(e);return t.forEach((e,t)=>{0===t&&(n+=o.lt),n+=Q,n+=o.l.repeat(e+2),t===r?(n+=Q,n+=o.rt):(n+=Q,n+=o.ct)}),n+="\n",t.forEach((t,s)=>{n+=Q,n+=o.v;const a=e.data[s];if(j(a)||S(a))n+=Q,n+=i(" ".repeat(t+2));else{const e=yr(a);let r=a.content?.toString()??"";r=r.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),n+=Q,n+=e`\u2002${Be(r,t)}\u2002`}s===r&&(n+=o.v)}),n+="\n",n}(e.header,n)),o+=function(e,t,n){let r="";const o=t.length-1,{fine:i}=vr;return t.forEach((e,t)=>{0===t&&(r+=Q,r+=n?i.lc:i.lt),r+=Q,r+=i.l.repeat(e+2),t===o?(r+=Q,r+=n?i.rc:i.rt):(r+=Q,r+=n?i.c:i.ct)}),r+="\n",e.forEach((n,s)=>{const a=yr(n);t.forEach((e,t)=>{r+=Q,r+=i.v;const s=n.data[t];if(j(s)||S(s))r+=a`${" ".repeat(e+2)}`;else{const t=yr(s);let n=s.content?.toString()||"";n=n.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),r+=Q,r+=t`\u2002${Be(n,e)}\u2002`}t===o&&(r+=Q,r+=i.v)}),r+="\n";const c=e.length-1===s;t.forEach((e,t)=>{0===t&&(r+=Q,r+=c?i.lb:i.lc),r+=Q,r+=i.l.repeat(e+2),t===o?(r+=Q,r+=c?i.rb:i.rc):(r+=Q,r+=c?i.cb:i.c)}),r+="\n"}),r}(e.body,n,r);const i=ue(o);if(gr){const e=i[0].split("%c"),n=i.map((n,r)=>{if(r>0){const o=[...e[r]].reduce((e,t)=>De(t)>1?(pr.emojiRegex.lastIndex=0,t.match(pr.emojiRegex)?e-(pr.emojiLength-2):e+(2-pr.chineseLength)):e,0);return n+"font-family: Consolas,Monaco,Courier,'Courier New','等宽字体',monospace; font-size:"+t+"px;word-spacing:normal;padding:0;margin:0;padding-right:"+o*t+"px"}return n});console.log(...n)}else console.log(...i)}const kr=b(function(e){const[t,n]=function(e){j(e)&&(e={}),N(e)&&(e={body:e});const t=new wr;lr(t,e),Object.setPrototypeOf(t,br);const n=new mr(t);return e.header&&(n.header=fr(e.header,dr(t))),e.body?.forEach(e=>n.body.push(fr(e,t))),[n,t]}(e);let r=12;const o=()=>$r(t,r);return Object.setPrototypeOf(o,this),Object.defineProperties(o,{addRow:{value:e=>(t.body.push(fr(e,n)),o),configurable:!1,writable:!1,enumerable:!1},setHeader:{value:e=>(t.header=fr(e,dr(n)),o),configurable:!1,writable:!1,enumerable:!1},setFontSize:{value:e=>(r=e,o)}}),o});async function Er(){const{pkgManager:e}=sr,t=`${e} config get registry`;Ge("执行可写代码",t);const n=await Ot(t);if(Ge("获取当前的本地配置为",n),n.success)return n.data.replace(/\s/gm,"")}async function Cr(){const{pkgManager:e}=sr,t=tr(),n=await Er(),r=new kr({header:[`${e} registry 源`,"别名","当前可见"]}),o=t.findIndex(e=>e.value===n)>-1;!o&&y(n)&&t.push({value:n,tip:n,label:"曾用值"}),t.forEach(e=>r.addRow([(n===e.value?ye`* `:" ").concat(e.value),(n===e.value?ye`* `:" ").concat(be(e.label)),e.disable?"❌":"✅"])),r(),lt(xe`注:当前可见状态仅影响 npx nry 选择项`)}const{npm:Ir,yarn:Tr}=Kn;async function Or(e){const{pkgManager:t}=sr,n=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}];e.forEach(e=>{n.push({reg:new RegExp(`^${q(e.value)}/*$`,"mg"),info:`${be(e.value)}(${ve(e.label)}) 已存在`,inverse:!0})});const r=await Cn({text:"请输入自定义的源地址",tip:"yarn"===t?Tr:Ir,minLen:5,maxLen:120,verify:n,required:!1});return Ge("用户输入的地址",r),j(r)?await Gn():await Hn(r)?Jn(r):(lt(`当前设置 registry 「${Re(r)}」 不可用`),lt("请使用正确的源设置"),await Or(e))}async function Sr(){if(!or.available)return await Gn("读写受限,正在退出");const{pkgManager:e}=sr,t=tr(),n=await Or(t),r=await async function(e){const t=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}],{pkgManager:n}=sr;e.forEach(e=>{t.push({reg:new RegExp(`^${q(e.label)}$`,"mg"),info:`${be(e.label)}(${ve(e.value)}) 已存在`,inverse:!0})});const r=await Cn({text:`请输入自定义的 ${n} 的别名`,tip:"任意别名",minLen:1,maxLen:120,verify:t,defaultValue:"",required:!1});return Ge("用户输入的别名为",r),j(r)?await Gn():r}(t);if(ar({value:n,label:r})){lt(xe`当前的 ${e} registry 源列表为`),await Cr();const t=["退出","继续添加"],n=await Cn({text:"添加完成,是否持续添加",tip:t});return j(n)||n===t[0]?await Gn(""):await Sr()}return await Gn(`写入${$e`失败`},原因未知`)}async function jr(e="",t=!0,n=!0){$(e)&&(e=`请选择想使用的新的 ${sr.pkgManager} registry 源`);let r=!1;const o=tr(),i=await Er();if(!j(i)){for(const e of o)if(e.value===i){e.label=e.label.toString()+`(${ye`当前使用`})`,e.disable=!n,r=!0;break}if(O(r)){const e={value:i,label:"当前使用值",disable:!n};o.push(e),or.available&&ar({value:i,label:"曾用值"})}}Ge("处理完的数据",o);const s=t?o.filter(e=>!e.disable||e.disable&&e.value===i):o.map(e=>(e.value===i?e.disable=!n:e.disable=!1,e)),a=await _n({data:s,info:e},"number");return Ge("用户选择的项",a),j(a)?await Gn():(Ge("当前用户选择为",s[a]),s[a])}async function Rr(){const e=await jr();await async function(e){const{pkgManager:t}=sr,n=Jn(e.value);if(!await Hn(n))return await Gn(`选择的项 「${ye(n)}」 不可连接,无法被设置`);const r=`${t} config set registry "${n}"`;Ge("设置源执行代码",r);(await Ot(r)).success||await Gn();lt(`已将 ${t} registry 更改为 ${be(e.value)}(${we(e.label)})`)}(e)}async function Nr(){if(!or.available)return await Gn("当前读写受限,即将退出程序");const e=await jr("请选择要删除的项",!1,!1),{value:t,label:n}=e,r=tr();for(const e in r){const o=Number(e),i=r[o];if(i.value===t&&i.label===n){r.splice(o,1);break}}if(or.write(r)){lt("删除项后的列表为:"),await Cr();const e=["退出","继续删除"],t=await Cn({text:"是否继续删除其他项",tip:e});return j(t)||t===e[0]?await Gn(""):await Nr()}}async function Mr(){if(!or.available)return await Gn("当前读写权限不足,即将退出程序");const e=await jr("请选择你想要修改的项",!1),{value:t,label:n}=e;Ge("获取用户的选择",e),Ge("原始的值",t),Ge("原始的标签",n),await async function(e){const{pkgManager:t}=sr,n=await Cn({text:`请更改为新的 ${t} registry 值`,tip:e.value,defaultValue:e.value,required:!1});if(Ge("新值为",n),j(n))return;e.value=e.tip=Jn(n)}(e),await async function(e){const{pkgManager:t}=sr,n=await Cn({text:`请更改为新的 ${t} registry 别名`,tip:e.label,defaultValue:e.label.toString(),required:!1});if(Ge("新值为",n),j(n))return;e.label=n}(e);const{value:r,label:o}=e;Ge("更改后的值",r),Ge("更改的标签",o);const i=tr();for(const e of i)if(e.value===t&&e.label===n){e.value=r,e.label=o.toString();break}if(or.write(i)){lt("更改后的列表为:"),await Cr();const e=["退出","继续修改"],t=await Cn({text:"是否继续修改其他项",tip:e});return j(t)||t===e[0]?await Gn(""):await Mr()}}async function Dr(){return function(){const e=Vn.args,t=e.$map;Ge("源解析值",e),Ge("源解析值没有匹配项",e.$isVoid),["add","delete","edit","list","manage","reset","clean"].forEach(e=>ir[e]=O(j(t[e]))),ir.noMatch=e.$isVoid,Ge("解析完的值",ir)}(),Ge("解析参数完毕,开始执行",ir),ir.noMatch?(Ge("当前没有匹配值"),await Rr()):ir.reset?(Ge("重置项"),await async function(){if(!or.available)return await Gn("当前读写权限受限,正在退出程序");const e=["退出","重置"],t=await Cn({text:"请确认是否执行覆盖原数据,该操作无法复原",tip:e});return j(t)||t===e[0]?await Gn("好的,这就退出重置"):or.write(tr(!0))?(await St("写入"+be`成功`,60),await Cr()):await Gn("重置未能完成,原因未知")}()):ir.list?(Ge("当前为展示项"),await Cr()):ir.manage?(Ge("当前执行状态更改"),await async function(){if(!or.available)return await Gn("当前读写受限,即将退出程序。");const e=tr(),t=await Er(),n=await _n({data:e.map(e=>({...e,checked:!e.disable,disable:e.value===t})),kind:"check"},"number");if(Ge("交互结果",n),j(n))return await Gn("好的,将退出状态显隐管理");e.forEach((e,t)=>{e.disable=!n.includes(t)}),Ge("保存前的数据",e),or.write(e)&&await Cr()}()):ir.add?(Ge("添加新的项"),await Sr()):ir.edit?(Ge("编辑项"),await Mr()):ir.delete?(Ge("删除项"),await Nr()):ir.clean?(Ge("当前执行清理"),or.clean()):await Rr()}(async()=>{try{await Dr()}catch(e){Ge.error("系统级捕获 错误",e),console.log("当前出现未知错误",e)}})();
2
+ import{statSync as e,readFileSync as t,readdirSync as n,writeFileSync as r,mkdirSync as o,unlinkSync as i}from"node:fs";import{homedir as s,arch as a}from"node:os";import c,{dirname as l,normalize as u,join as f,resolve as h}from"node:path";import"node:fs/promises";import{fileURLToPath as d}from"node:url";import{spawn as g}from"node:child_process";import{emitKeypressEvents as p}from"node:readline";import{resolve as b}from"node:path/posix";function m(e){return e.prototype.apply=Function.apply,e.prototype.bind=Function.bind,e.prototype.call=Function.call,e.prototype.length=Function.length,e.prototype.name=Function.name,e.prototype.toString=Function.toString,e}function w(e,t){return Object.keys(t).forEach(n=>e[n]=t[n]),e}function y(e){const t=typeof e;if("object"!==t&&"function"!==t)return t;const n=Reflect.apply(Object.prototype.toString,e,[]).replace(/^.*\s(.*)]$/,"$1").toLowerCase();return"error"!==n?n:e instanceof SyntaxError?"syntaxerror":e instanceof TypeError?"typeerror":e instanceof URIError?"urierror":e instanceof ReferenceError?"referenceerror":e instanceof AggregateError?"aggregateerror":e instanceof RangeError?"rangeerror":e instanceof EvalError?"evalerror":"error"}function v(e){return"string"===y(e)}function x(e){return"regexp"===y(e)}function $(e){return v(e)&&""===e.valueOf()}function k(e){return v(e)&&""===e.valueOf().trim()}function E(e){return"number"===y(e)}function I(e){return 0===e}function C(e){return"boolean"===y(e)}function T(e){return!0===e}function O(e){return!1===e}function S(e){return null===e}function j(e){return void 0===e}function R(e){return"function"===y(e)}function N(e){return Array.isArray(e)}function M(e){if(N(e))return 0===e.length;throw new TypeError("参数必须为数组")}function L(e){return"object"===y(e)}function D(e){return L(e)&&0===Reflect.ownKeys(e).length}function B(e){return"symbol"===y(e)}function P(e,t){return void 0===t||("function"==typeof t?t(e):t)}function F(e=1,t=0){if(!isFinite(e)||!isFinite(t)||isNaN(e)||isNaN(t)||!E(e)||!E(t))throw new TypeError("getRandomInt: max or min is NaN or is not a number");let n=Math.ceil(Number(t)),r=Math.floor(Number(e));return r===n?r:(n>r&&([r,n]=[n,r]),Math.round(Math.random()*(r-n)+n))}function A(e){if(!L(e)&&!E(e)||E(e)&&isNaN(e)||E(e)&&!isFinite(e)||E(e)&&!Number.isInteger(e)||E(e)&&Number.isInteger(e)&&e<1||E(e)&&e<1||L(e)&&(!E(e.length)||e.length<1||!Number.isInteger(e.length)))throw new TypeError("参数类型错误 ❌ (getRandomString)");const t={length:32,chars:"abcdefghijklmnopqrstuvwxyz",chars2:"0123456789",chars3:"!@#$%^&*()_+~`|}{[]:;?><,./-=",type:"string",includeUppercaseLetters:!1,includeNumbers:!1,includeSpecial:!1};if("uuid"===t.type)return crypto.randomUUID();E(e)&&Number.isInteger(e)&&e>0&&w(t,{length:e}),L(e)&&(w(t,e),t.length=t.length<1?32:t.length);const n=t.chars.split("");t.includeUppercaseLetters&&s(n,t.chars.toUpperCase()),t.includeNumbers&&s(n,t.chars2),t.includeSpecial&&s(n,t.chars3);let r="";const o=n.join(""),i=o.length;if(globalThis&&globalThis.crypto&&globalThis.crypto.getRandomValues){globalThis.crypto.getRandomValues(new Uint8Array(t.length)).forEach(e=>r+=o[e%i])}else for(let e=0;e<t.length;e++)r+=o[F(i-1)];function s(e,t){const n=e.length,r=t.length,o=Math.max(n,r);for(let i=0;i<o;i++)i<n&&!j(t[i])?e[i]+=t[i]:i<r&&(e[i]=t[i])}if(!/[a-zA-Z]/.test(r))return String.fromCharCode(F(97,122)).concat(r.slice(1));for(;!/^[a-zA-Z]$/.test(r[0]);)r=r.slice(1)+r[0];return r}function W(e,t=200){if(!R(e))throw new TypeError("callback must be a function");let n;E(t)&&(t={delay:t,this:null}),(j(t.delay)||!isFinite(t.delay)||t.delay<0)&&(t.delay=200);const r=()=>{n&&(clearTimeout(n),n=void 0)},o=(...o)=>{r(),n=setTimeout(()=>{try{const n=t&&t.this?t.this:null;e.apply(n,o)}catch(e){console.log("Debounce callback throw an error",e)}},Math.max(t.delay||5,5))};return o.cancel=()=>r(),o}function _(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e,t){if(!v(e))throw new TypeError("pattern must be a 字符串");return e=_(e),j(t)?new RegExp(e):(t=function(e){if(v(e)&&(e={flags:e}),v(e.flags)){const t=/[migsuy]/g,n=e.flags.match(t);S(n)?e.flags="":e.flags=[...new Set(n)].join("")}else e.flags="";return e}(t),new RegExp(`${t.start?"^":""}${e}${t.end?"$":""}`,t.flags))}function z(){return!j(globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node||void 0)}async function V(e=1e3){if(!isFinite(e)||e<4)throw new TypeError("delay 应该是一个正常的数值");return I(e)?Promise.resolve():new Promise(t=>setTimeout(t,e))}const G="",J=`${G}[`;function H(){return new RegExp(`(\\x1b\\[(${["([1-4]?[0-9])(;([1-4]?[0-9]+))*m","[m]","\\?(25|7)[hl]","\\d*;?\\d*[HFr]","6n","\\d{0,4}[A-DTS]","[0-3]?[JKg]","[0-6]?W"].map(e=>`(${e})`).join("|")}))`.concat("|(\\x1b[78DMc])"),"g")}const K=`${J}0m`;function U(e,t=!0){if(T(t)){if(!v(e))throw new TypeError("`color` must be a string or number but not number[] when isHex is true");if(e.startsWith("0x"))e=e.replace(/0x/,"#");else if(!e.startsWith("#"))throw new TypeError("`color` must be a string or number but not number[] when isHex is true")}else{if(!O(t))throw new TypeError("The second variable `isHex` must be boolean");if(N(e)){if(e.some(e=>!isFinite(e))||3!==e.length)throw new TypeError("If the `color` is an array, it must be 3 in length and be of numeric type");e=`rgb(${e.join(",")})`}else{if(E(e))throw new TypeError("If the `color` is not number when isHex is false");if(v(e)){if(!e.startsWith("rgb(")||!e.endsWith(")"))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)");{const t=e.replace(/.*\((.*)\).*/,"$1").split(",");if(3!==t.length||t.some(e=>!isFinite(Number(e))||Number(e)<0||Number(e)>255))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)")}}}}let n=0,r=0,o=0;if(e.startsWith("#"))if(6==(e=e.slice(1)).length)n=Y(parseInt(e.slice(0,2),16)),r=Y(parseInt(e.slice(2,4),16)),o=Y(parseInt(e.slice(4,6),16));else{if(3!=e.length)return F(255);n=Y(parseInt(e.slice(0,1).repeat(2),16)),r=Y(parseInt(e.slice(1,2).repeat(2),16)),o=Y(parseInt(e.slice(2,3).repeat(2),16))}else if(e.startsWith("rgb")){const t=e.replace(/.*\((.*)\).*/,"$1").split(",");n=Y(Number(t[0])),r=Y(Number(t[1])),o=Y(Number(t[2]))}return 16+36*n+6*r+o}function Y(e){const t=isFinite(e)?Math.floor(6*e/256):F(6);return Math.min(5,Math.max(0,t))}function Z(e,t,n,r=!0){const o=r?"38":"48";if(E(e)&&E(t)&&E(n))return`${o};5;${U([e,t,n],!1)}`;if(v(e)&&j(t)&&j(n)){if(e.startsWith("rgb"))return`${o};5;${U(e,!1)}`;if(e.startsWith("#")||e.startsWith("0x"))return`${o};5;${U(e,!0)}`;Q()}else{if(E(e)&&j(t)&&j(n))return`${o};5;${U(e,!0)}`;Q()}}function Q(){throw new TypeError(' 使用 color() 或 bgColor() 时,可使用三整数 `r , g , b` 或单字符串 `"rgb(r , g, b)"` 或十六进制数值 `0xrgb`、`0xrrggbb` 或十六进制字符串表达 `"#rgb"`、`"#rrggbb"` ,不接受其他格式的参数')}function X(e,t=!0){try{return Z(e,void 0,void 0,t)}catch(e){throw console.error(e),new TypeError('使用 hex() 或 bgHex() 时,参数可以为单字符串 `"0xnnnnnn"`、`"#rgb"` 、`"#rrggbb"` 或一个数值 `0xrrggbb`。不接受其他格式')}}function ee(e,t=!1){return e<0&&(e=0),e>255&&(e=255),e=isFinite(e)?Math.round(e):F(255),`${[48,38][Number(t)]};5;${e}`}function te(e,t,n,r=!0){try{return Z(e,t,n,r)}catch(e){throw console.error(e),new TypeError('使用 rgb() 或 bgRgb() 时,参数可以为单字符串 `"rgb(r, g, b)"` 或三个数值 `r , g ,b`。不接受其他格式')}}const ne={black:"38;5;0",red:"38;5;1",green:"38;5;2",yellow:"38;5;3",blue:"38;5;4",magenta:"38;5;5",cyan:"38;5;6",white:"38;5;7",brightBlack:"38;5;8",brightRed:"38;5;9",brightGreen:"38;5;10",brightYellow:"38;5;11",brightBlue:"38;5;12",brightMagenta:"38;5;13",brightCyan:"38;5;14",brightWhite:"38;5;15",bgBlack:"48;5;0",bgRed:"48;5;1",bgGreen:"48;5;2",bgYellow:"48;5;3",bgBlue:"48;5;4",bgMagenta:"48;5;5",bgCyan:"48;5;6",bgWhite:"48;5;7",bgBrightBlack:"48;5;8",bgBrightRed:"48;5;9",bgBrightGreen:"48;5;10",bgBrightYellow:"48;5;11",bgBrightBlue:"48;5;12",bgBrightMagenta:"48;5;13",bgBrightCyan:"48;5;14",bgBrightWhite:"48;5;15",bold:"1",dim:"2",italic:"3",underline:"4",blink:"5",reversed:"7",hide:"8",random:"random",bgRandom:"bgRandom",rgb:(e,t,n)=>te(e,t,n),hex:e=>X(e),color:(e,t,n)=>Z(e,t,n),number:e=>ee(e,!0),bgRgb:(e,t,n)=>te(e,t,n,!1),bgHex:e=>X(e,!1),bgColor:(e,t,n)=>Z(e,t,n,!1),bgNumber:e=>ee(e)};Object.freeze(ne);const re=["#000000","#c23621","#25bc24","#adad29","#492ee1","#dd38dd","#33bbc8","#cbcccd","#818383","#fc391f","#31e722","#eaec23","#5833ff","#f93578","#14f0f0","#ebeded"];function oe(e){let t=Number(e);if(!isFinite(t))throw new TypeError("色值反向解析出错");if(t<16){return re[t]}const n=e=>Math.floor(256*e/6+F(42)).toString(16).padStart(2,"0");t-=16;const r=t%36;return`#${n(Math.floor(t/36))}${n(Math.floor(r/6))}${n(r%6)}`}class ie{constructor(e){this.parse(e),this.build()}build(){this.hide&&(this.color="transparent"),this.reversed&&([this.color,this.bgColor]=[this.bgColor,this.color]),j(this.color)||(this.str+=`color: ${this.color};`),j(this.bgColor)||(this.str+=`background: ${this.bgColor};`),0!==this.bold&&(this.str+=`font-weight: ${1===this.bold?800:200};`),this.italic&&(this.str+="font-style: italic;"),this.underline&&(this.str+="border-bottom: 1px #666 solid;")}color=void 0;bgColor=void 0;bold=0;italic=!1;underline=!1;reversed=!1;hide=!1;str="";parse(e){e.replace(/38;5;(\d+)/g,"c-$1").replace(/48;5;(\d+)/g,"b-$1").split(";").reverse().forEach(e=>{0===this.bold&&e===ne.bold?this.bold=1:0===this.bold&&e===ne.dim?this.bold=-1:e===ne.italic?this.italic=!0:e===ne.underline?this.underline=!0:e===ne.reversed?this.reversed=!0:e===ne.hide?this.hide=!0:j(this.color)&&e.startsWith("c")?this.color=oe(e.split("-")[1]):j(this.bgColor)&&e.startsWith("b")&&(this.bgColor=oe(e.split("-")[1]))})}}function se(e){return z()?[e]:function(e){e=e.replace(new RegExp("\\\\[0m","g"),"");const t=H(),n=[""];let r,o=0,i="";const s=()=>{const t=e.substring(o,r?.index??e.length);n[0]+="%c".concat(t),n.push(i)};for(;!S(r=t.exec(e));)s(),i=j(r[7])?new ie(r[3].slice(0,-1)).str:"",o=t.lastIndex;return s(),n}(e)}function ae(e,t){if($(e=S(e)||j(e)?"":e.toString()))return"";if(M(t))return e;const n=e.indexOf(J),r=e.indexOf(`${J}0m`);return t=function(e){return e.map(e=>"random"===e?`38;5;${F(255)}`:"bgRandom"===e?`48;5;${F(255)}`:e)}(t),n>-1&&r>-1?ae(e.substring(0,n),t).concat(e.substring(n,r+4)).concat(ae(e.substring(r+4),t)):e.endsWith("\r\n")?(e=e.substring(0,e.length-2),`${J}${t.join(";")}m${e}${J}0m\r\n`):e.endsWith("\n")?(e=e.substring(0,e.length-1),`${J}${t.join(";")}m${e}${J}0m\n`):`${J}${t.join(";")}m${e}${J}0m`}function ce(e,t){const n=parseInt(t);if(n>10){const r=T(38===n)?"38;5;":"48;5;",o=e.findIndex(e=>e.startsWith(r));return o>-1?e.toSpliced(o,1,t):[...e,t]}return e.includes(t)?[...e]:[...e,t]}const le=m(function(e=[]){const t=(t,...n)=>{if(P(t,()=>N(t)&&t.every(e=>v(e)))){let r="";for(let o=0;o<t.length;o++)r+=ae(t[o],e),o<n.length&&(r+=ae(n[o],e));return r}if(M(n))return ae(t,e);throw new Error("pen: 缺少参数")},n=Object.keys(ne).map(t=>[t,{get:()=>function(e,t){let n=[];if(P(e,v(ne[e])))return n=ce(t,ne[e]),new le(n);if("hex"===e||"bgHex"===e)return r=>(n=ce(t,ne[e](r)),new le(n));if("rgb"===e||"bgRgb"===e)return(r,o,i)=>{if(v(r)&&j(o)&&j(i))n=ce(t,ne[e](r));else{if(!(E(r)&&E(o)&&E(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=ce(t,ne[e](r,o,i))}return new le(n)};if("color"===e||"bgColor"===e)return(r,o,i)=>{if(v(r)&&j(o)&&j(i))n=ce(t,ne[e](r));else{if(!(E(r)&&E(o)&&E(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=ce(t,ne[e](r,o,i))}return new le(n)};if("number"===e||"bgNumber"===e)return r=>{if(E(r))return n=ce(t,ne[e](r)),new le(n);throw new TypeError(`${e} 的参数应为有效正整数数值,范围 0 - 255`)};throw new Error(`${e} 函数不存在`)}(t,e)}]),r=Object.fromEntries(n);return Object.defineProperties(t,r),t});const ue=new le([]),fe=new le([ne.red]),he=new le([ne.green]),de=new le([ne.yellow]),ge=new le([ne.blue]),pe=new le([ne.magenta]),be=new le([ne.cyan]);new le([ne.white]);const me=new le([ne.brightBlack]),we=new le([ne.brightRed]),ye=new le([ne.brightGreen]),ve=new le([ne.brightYellow]);new le([ne.brightBlue]);new le([ne.brightMagenta]);const xe=new le([ne.brightCyan]);new le([ne.brightWhite]);const $e=new le([ne.bgBlack]);new le([ne.bgRed]),new le([ne.bgGreen]),new le([ne.bgYellow]),new le([ne.bgBlue]),new le([ne.bgMagenta]);const ke=new le([ne.bgCyan]);new le([ne.bgWhite]),new le([ne.bgBrightBlack]),new le([ne.bgBrightRed]),new le([ne.bgBrightGreen]);const Ee=new le([ne.bgBrightYellow]);new le([ne.bgBrightBlue]);const Ie=new le([ne.bgBrightMagenta]);new le([ne.bgBrightCyan]),new le([ne.bgBrightWhite]);const Ce=new le([ne.bold]),Te=new le([ne.italic]),Oe=new le([ne.underline]),Se=new le([ne.hide]);new le([ne.dim]),new le([ne.blink]);const je=new le([ne.reversed]);ue.rgb;const Re=ue.hex;ue.color,ue.bgRgb;const Ne=ue.bgHex;function Me(e){const t=H(),n=e.replace(t,"");let r=0;for(let e=0,t=n.length;e<t;e++)r+=1+Number(Le(n[e]));return r}function Le(e){const t=e.codePointAt(0)||0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=131072&&t<=191471||t>=63744&&t<=64255||t>=65280&&t<=65519||t>=65381&&t<=65439||t>=127744&&t<=129750||t>=128512&&t<=128591||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=44032&&t<=55215||t>=12288&&t<=12351}function De(e,t,n=!0){const r=t,o=e;if(0===r)return"";let i=!1;const s=Me(o);if(s<=r)return o.concat(" ".repeat(r-s));const a=r>0,c=H();c.lastIndex=0;const l=[...o.replaceAll(c,"")],u=a?l:l.reverse(),f=u.length,h=Math.abs(r);let d=Math.floor(h/2),g=u.slice(0,d).join(""),p=Me(g);for(;d<f;){if(p+=Me(u[d]),p===h){g+=u[d];break}if(p===h+1){n&&(i=!0);break}if(p>h+1)break;g+=u[d],d++}if(a&&o.startsWith(g)||!a&&o.endsWith(g=[...g].reverse().join("")))return i?g+" ":g;if(a){let e;for(c.lastIndex=0;null!==(e=c.exec(o));){const t=g;if(g=t.slice(0,e.index).concat(e[0]).concat(t.slice(e.index)),o.startsWith(g))break}g+=K}else{const e=[...g];let t=e.length-1;g="";const n=[...o].reverse();for(let r=0,o=n.length;r<o;r++){const o=n[r];if(o===e[t])--t;else if(t<0)break;g=o+g}g=K+g}return i?g+" ":g}function Be(e){return`${J}?7l${e.toString()}${J}?7h`}ue.bgColor,ue.random,ue.bgRandom,ue.number,ue.bgNumber;const Pe=[!1,!0,"all","info","error","warn"];const Fe=z()?"node":"browser";const Ae=m(We);function We(e){const t=function(e){const t={name:A(10),type:!1,fold:!1};return j(e)?t:C(e)?(t.type=e,t):v(e)?(t.name=e.trim().replace(/\s+/g,"_"),t):(v(e.name)&&(e.name=e.name.trim().replace(/\s+/g,"_")),e.fold=Boolean(e.fold),e)}(e);this.name=t.name||A(12),this.fold=Boolean(t.fold);const n=function(e=A(10)){let t=!1;if("node"===Fe&&globalThis?.process?.env){const n=process.env;t=n[e.toUpperCase().concat("_DEV")]||n[e.toLowerCase().concat("_dev")]||!1}return"false"!==t&&("true"===t||t)}(this.name);let r=t.type||!1;this.mark="",this.type="node"!==Fe||function(e){return!!Pe.includes(e)&&e}(n??r);const o=e=>{try{throw new Error}catch(t){const n=(t.stack?.split("\n")||[]).map(e=>{const t=/at\s(.*)\s\((.*):(\d*):(\d*)\)/.exec(e);return t?{name:t[1],path:t[2],line:t[3],column:t[4]}:{name:""}}),r=n.filter(e=>""!==e.name&&void 0!==e.path),o=r[3]??r[2]??r[1]??r[0],i=` ${"info"===e?"💡":"error"===e?"❌":"⚠️ "} ${(new Date).toLocaleString()} `,s=("info"===e?ke.brightWhite:"error"===e?$e.red:Ee.brightGreen)(i),a=o?.name??"";this.fold&&a&&(a===this.mark||(this.mark&&console.groupEnd(),console.groupCollapsed(a))),this.mark=a;return se(`${s} ${a} ${o?.line?.concat(" 行")} ${o?.column?.concat(" 列")}`)}};this.info=(...e)=>{if("all"===this.type||"info"===this.type||!0===this.type){const t=o("info");console.log(...t),console.log(...e)}},this.warn=(...e)=>{if("all"===this.type||"warn"===this.type||!0===this.type){const t=o("warn");console.log(...t),console.warn.apply(console,e)}},this.error=(...e)=>{if("all"===this.type||"error"===this.type||!0===this.type){const t=o("error");console.log(...t),console.error.apply(console,e)}};const i=(...e)=>{this.info(...e)};Object.setPrototypeOf(i,this);const s=this;return new Proxy(i,{get:(e,t,n)=>"apply"===t?e:Reflect.get(e,t,n),set:(e,t,n)=>(Reflect.set(s,t,n),!0)})}We.prototype.clear=()=>{"browser"===Fe?console.clear():console.log(G.concat("c"))};const _e=new Ae({name:"nry",type:!1}),qe=O(_e.type);function ze(t){return e(t,{throwIfNoEntry:!1})}const Ve=new Ae({type:"error",name:"a node tools"});function Ge(...e){return u(f(...e))}function Je(e,t="file",...n){n=n.filter(e=>v(e));let r=h(...n);const o=ze(r);if(Ve("当前工作目录",r),!o)return Ve("🎯 工作目录不存在"),"";if(o.isFile())r=function(e){return l(e)}(r);else if(!o.isDirectory())return;let i=20;const s=()=>{const n=ze(Ge(r,e));if(n&&("file"==t&&n.isFile()||"directory"==t&&n.isDirectory()))return r;if(I(i))return;i--,Ve("♻️ 查找中...",r);const o=Ge(r,"..");return o!==r?(r=o,s()):void 0};return s()}function He(n){if(!/.json^/.test(n)&&!e(n,{throwIfNoEntry:!1}))return null;try{const e=t(n,{encoding:"utf-8"});return JSON.parse(e||"null")}catch(e){return Ve.error(e),null}}function Ke(e,t){try{return r(e,JSON.stringify(t,null,2),{encoding:"utf-8",flag:"w"}),!0}catch(e){return Ve.error(e),!1}}const Ue=()=>z()&&process&&process.stdout&&process.stdout.isTTY||!1,Ye=z()&&"win32"===process.platform||!z()&&window.navigator.userAgent.includes("Windows");function Ze(e){e=e.replaceAll(c.sep,"/"),/file:\/*/.test(e)&&(e=e.replace(/^.*file:\/*(.*)/,"$1"));const t=q(e);let n;try{throw new Error}catch(e){n=e}const r=(n.stack?.replace(/\\/gm,"/").split("\n")).reverse(),o=r.findIndex((e,n,r)=>!(t.test(e)||!t.test(r[n+1]))||!(!t.test(e)||0!==n));if(-1==o)return{name:"",line:0,row:0,originArr:r};let i=r[o];/\(.*\)/.test(i)&&(i=i.replace(/^.*\((.*)\).*/,"$1")),/file:\/*/.test(i)&&(i=i.replace(/^.*file:\/*(.*)/,"$1")),Ye||i.startsWith("/")||(i="/"+i);const s=i.match(/(.*?):(\d+):(\d+)/)??[i,i,0,0];return{name:s[1],line:Number(s[2]),row:Number(s[3]),originArr:r}}function Qe(){let e;try{new Function('import("")'),e=d(import.meta.url)}catch(t){Ve.error(t),e=__filename}Ye&&(e=e.replace(/\\/gm,"/")),e=Ze(e).name;return[e,l(e)]}const{stdin:Xe}=process,et={list:[],listened:!1,on(e,t,n){O(this.listened)&&(this.listened=!0,p(process.stdin),Ue()&&process.stdin.setRawMode(!0),process.stdin.resume(),Xe.on("keypress",rt),process.on("beforeExit",tt),process.stdin.on("end",nt));const r=this.list,o={key:e,callback:t,resolve:n};return M(r)&&Ve("当前执行的栈中没有数据",o),r.push(e),this[e]=o,o},remove(){const e=this.list,t=e.shift();return t&&this.del(t),Ve("执行完毕一项,还有:",e),!(e.length>0)&&(this.listened=!1,tt(),Ve("代理已移除"),!0)},del(e){Ve("开始移除",e);const t=this.list[0]===e&&!j(this[e]);if(Ve("当前 key 是否为当前执行项",t),t)return this.remove(),!0;{const t=this.list.includes(e),n=!j(this[e]);return t&&n?(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),delete this[e],!0):t?(this.list.splice(this.list.indexOf(e),1),!0):!!n&&(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),!0)}}};function tt(){Xe.removeListener("keypress",rt),process.removeListener("beforeExit",tt),process.stdin.removeListener("end",nt),Ue()&&Xe?.setRawMode(!1),Xe.pause()}function nt(){tt()}function rt(e,t){const n=et[et.list[0]],{callback:r,resolve:o}=n;Ve("当前执行的回调是",{...n,rl:"原始值为 readline 的 Interface 对象"}),R(r)?T(Reflect.apply(r,null,[e,t]))&&(Ve("回调遇见了想待的键,执行了退出操作,keyValue: < ",e,"> key: <",t,">"),et.remove(),o(!0)):(et.remove(),o(!1))}const ot=(e,t)=>async function(e,t){if(!z())throw new RangeError("当前环境不支持 readInput");const n=t??Symbol(A(3));return new Promise(t=>{et.on(n,e,t)})}(e,t);function it(e="",t=!0){let n="";const r=y(e);if(!C(t))throw Ve.error(""),new TypeError("lineFeed 的类型必须是 boolean ");if("bigint"===r){const r=Object.prototype.toString.call(e).concat("n");n=t?`${r}\n`:`${r}`}else if(["string","number","boolean","function","null"].includes(r))n=t?`${e}\n`:`${e}`;else{const r=JSON.stringify(e,(e,t)=>R(t)?`${t}`:null==t?"undefined":t,2);n=t?`${r}\n`:`${r}`}z()?process.stdout.write(n):console.log(...se(n.replace(/\n$/,"")))}function st(e,t=!0){it(`${t?J:G}${e}`,!1)}function at(){st("?25l")}function ct(){st("?25h")}function lt(e=!1){e&&ft(1/0),st("0J")}function ut(e=1,t=!1){st(`${dt(e,"vertical")}A`),t&&ft(1/0)}function ft(e=1){st(`${dt(e)}D`)}function ht(e=1){st(`${dt(e)}C`)}function dt(e,t="horizontal"){(!E(e=Number(e))||isNaN(e)||e<1||!1===Number.isInteger(e)&&e!==1/0)&&(e=1);const n=z()?"horizontal"===t?process.stdout.columns:process.stdout.rows:80;return(1/0===e||e>n)&&(e=n),e}function gt(){ct()}function pt(e){const t=e[e.length-1];v(t)&&!t.endsWith("\n")&&e.push("\n"),e.forEach(e=>it(e,!1))}function bt(e,t){const{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}=t??{show:!0,info:"请等待",prefix:0,interval:20,canCtrlCExit:!1,canCtrlDExit:!1,beforeDestroyed:()=>{}},l=C(e)?{show:e,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:v(e)?{show:n,info:e,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:j(e)?{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:E(e)?{show:!0,info:"请等待",prefix:isNaN(e)?o:Math.min(Math.max(0,e),2),interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c,...e};return l.interval=isFinite(l.interval)?Math.max(20,Math.min(2e3,l.interval)):i,l.info=l.info.replace(/\n/g,"\\n"),l}function mt(){ct()}Object.defineProperties(ot,{remove:{value:e=>et.del(e)}});const wt=[".","..","...","....","...",".."],yt=[["⋯","⋱","⋮","⋰","⋯","⋱","⋮","⋰"],["🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚","🕛"],["🕜","🕝","🕞","🕟","🕠","🕡","🕢","🕣","🕤","🕥","🕦","🕧"],["👈","👆","👉","👇","🤘","🤟","🫳","🫴","👊"],["🌞","🌕","🌖","🌗","🌜","🌘","🌑","🌒","🌓","🌛","🌔","🌔","🌔","🌝"]];class vt{#e;#t=void 0;#n=Symbol("waiting-tips");#r=[];#o=(...e)=>pt(e);state="destroyed";#i=0;#s=4e4;#a=!1;async destroyed(){"destroyed"!==this.state&&(this.state="destroyed",this.#i=0,j(this.#t)||clearInterval(this.#t),ot.remove(this.#n),ft(1/0),lt(),process.removeListener("exit",gt),process.removeListener("SIGINT",mt),ct(),this.#r.forEach(e=>this.#o(...e)),this.#r.length=0,this.log=this.#o,"promise"!==y(this.#e.beforeDestroyed)?this.#e.beforeDestroyed(this.#a):await this.#e.beforeDestroyed(this.#a),this.#a=!1)}log=this.#o;run(e){"run"===this.state&&this.destroyed(),this.#a=!1,this.state="run",this.#i=Date.now(),this.#e=j(e)?this.#e:bt(e,this.#e);const{prefix:t,info:n,interval:r,canCtrlCExit:o,canCtrlDExit:i}=this.#e;this.log=(...e)=>this.#r.push(e);const s=wt.length,a=yt[Math.min(yt.length-1,Math.max(t,0))],c=a.length,l=a.reduce((e,t)=>Math.max(e,Me(t)),0);let u=0;at(),process.on("exit",gt),process.on("SIGINT",mt),this.#t=setInterval(()=>{lt(!0),this.#r.forEach(e=>pt(e)),this.#r.length=0,it("\n".repeat(2)),ut(3),st(7,!1);const e=De(a[++u%c],l);Date.now()-this.#i<this.#s?it(Be(`${e} ${n.replace(/\n/,"\\n")}${wt[Math.floor(u/10)%s]}`),!1):it(Be(`${e} ${n} ${pe`当前已执行 ${Math.ceil((Date.now()-this.#i)/1e3)} 秒`}\n \n\r${be`可使用双击 esc 键退出(确保执行完成,若执行仍在期望时间内,请忽略)`}`),!1),st(8,!1)},r),ot((e,t)=>!!(t?.meta&&t?.sequence===G.repeat(2)||T(t?.ctrl)&&(o&&"c"===t?.name||i&&"d"===t?.name))&&(this.#a=!0,this.destroyed(),!0),this.#n)}set timeout(e){this.#i=Date.now(),this.#s=!isFinite(e)||e<0?4e4:e<600?1e3*e:e}get timeout(){return this.#s}constructor(e){this.#e=bt(e),T(this.#e.show)&&this.run()}}function xt(e,t,n){let r=e.toString().trim();return/\n$/.test(r)||(r=r.concat(Ye?"\r\n":"\n")),r=r.replace(/\n+/g,"\n"),lt(),t&&n.log(r),r}function $t(e,t){if(O(z()))throw new RangeError("当前环境不支持 node 环境");const{env:r}=t;v(e)&&(r.code=e,e={code:e,waiting:!1});const o=process.cwd();let i=b(o,e.cwd||"");-1===function(e){try{const t=ze(e);if(t&&t.isDirectory())return 0==n(e,{withFileTypes:!0}).length?1:0}catch(e){return Ve.error("is ",e),-1}return-1}(i)&&(Ve(`执行目录 ${fe(i)} 不存在,使用命令执行目录 ${be(o)}`),i=o);const s=e.code.replace(/\s{2,}/g," ").trim().split(" ");Object.assign(t.env,{shell:!0,hideWaiting:!0,waitingMessage:"请稍等",printLog:!1,...e,cmd:s,cwd:i})}function kt(e){const t={result:{success:!1,data:"",error:"",status:1,isSIGINT:!1,runCode:"",runCwd:""},env:{cmd:[],code:"",cwd:"",printLog:!1,shell:!0,callBack:()=>{},waiting:{show:!1,info:"",prefix:0,interval:10,canCtrlDExit:!1,canCtrlCExit:!1,async beforeDestroyed(){}}}},{env:n,result:r}=t;Ve("runOtherCode 方法 开始执行 "),$t(e,t),Ve("执行参数",t);const{cmd:o,waiting:i,cwd:s,shell:a,code:c}=n,[l,u]=(()=>{if(i instanceof vt)return[i,"run"===i.state];const e=bt(i);return[(t=e,new vt(t)),e.show];var t})();r.runCode=c,r.runCwd=s||process.cwd();try{return new Promise(e=>{const n=T(a)?g(c,[],{cwd:s,shell:a}):g(o[0],o.slice(1),{cwd:s,shell:a});u&&l.run({beforeDestroyed:e=>{if(e){if(Ve("执行退出前"),Ye){try{n.killed||n.kill(-1)}catch(e){Ve.error("使用 child.kill(child.pid, -1 ) 关闭子进程失败",e),g("taskkill",["/pid",n.pid?.toString()||"","/T","/F"],{stdio:"pipe"})}Ve("终结在 windows 下的子进程")}else n.kill("SIGTERM"),Ve("终结在非 windows 下的子进程");t.result.isSIGINT=!0}}}),n.on("spawn",()=>function(e){const{result:t}=e;Ve("子线程已启动,运行状态良好"),t.success=!0,t.status=1}(t)),n.stdout.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=xt(e,r.printLog,n);Ve(Ie`stdout on data`,i),o.data+=i}(e,t,l)),n.on("exit",(e,t)=>{Ve("子进程已退出了,退出码为 <",e,">"),S(t)||Ve.error("子进程被其他信号中断执行,执行的退出信号为:",t)}),n.stderr.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=xt(e,r.printLog,n);Ve(Ie`stderr on data`,i),o.error+=i}(e,t,l)),n.on("error",e=>function(e,t,n){const{env:r,result:o}=t;{const t=xt(e,r.printLog,n);Ve(Ie`error`,t),Ve.error("error",t),o.success=!1,o.status=""!==o.data?2:3,o.error+=t}}(e,t,l)),n.on("close",(n,r)=>function(e,t,n,r,o){const{env:i,result:s}=r,{callBack:a}=i;Ve("进行正常关闭",e),setTimeout(async()=>{a&&R(a)&&await Promise.resolve(Reflect.apply(a,null,[])),await o.destroyed(),0!==e&&"SIGINT"!==t&&"SIGTERM"!==t?(s.success=!1,s.status=3):"SIGINT"!==t&&"SIGTERM"!==t||(s.success=!1,s.status=4,s.isSIGINT=!0),n(s)})}(n??0,r??"",e,t,l))})}catch(e){const t=e.toString();return Ve.error("创建(但是确是非 node 无法创建子进程,而是更上游的 node 创建的错误)子进程出错",e),new Promise(e=>{(async()=>{await l.destroyed()})(),r.error=t,r.success=!1,r.status=0,e(r)})}}const Et=e=>kt(e);async function It(e,t=10){if(!v(e))throw new TypeError("str 需是一个字符串");if(!isFinite(t)||t<0||t>1e4)throw new RangeError("delay 需是一个 0 到 10000 之间(不包括两端)的数值");const n=Array.from(e);if(0!==n.length){for(const r of n)await V(t),Ve(`当前字符 ${Ce(r)} 长度为:`,r.length),Ve(`当前字符 ${ue.reversed(r)} 在 charCodeAt`,r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2)),1===r.length&&isNaN(r.charCodeAt(1))?it(r,!1):2===e.length&&e.charCodeAt(0)>=55296&&e.charCodeAt(0)<=56319&&e.charCodeAt(1)>=56320&&e.charCodeAt(1)<=57343?(it(r,!1),it(" ",!1)):2===e.length&&65039===e.charCodeAt(1)?(it(r,!1),it(" ",!1)):(it(r,!1),it(" ",!1));it()}else it()}const Ct=process.argv.slice(2);Object.freeze(Ct);class Tt{originalArg=Ct.slice();name="";__filename="";get state(){return this._state}set state(e){this._state=[void 0,{code:1,text:"start"},{code:2,text:"bind over"},{code:3,text:"run over"},{code:4,text:"over",overCode:e}][E(e)?e:4]}_state={code:1,text:"start"};args=new Ot;abbr={};helpInfo="";hasShowVersion=!1;originalBind={};values=[]}class Ot extends Array{get $nomatch(){return[]}get $map(){return{}}get $arrMap(){return[]}get $only(){return[]}get $original(){return[]}get $isVoid(){return!1}}const St={},jt=new Ae({name:"a command"}),Rt=O(jt.type);function Nt(e){return[e.replace(/^(.*?)\s.*/gm,"$1")||"",/<.+>/.test(e)&&e.replace(/.*<(.+)>.*/,"$1")||"",e.replace(/.*?\((.*)\).*?/,"$1")||""]}function Mt(e,t){switch(t.state.code){case 3:return void jt.warn("执行绑定","但是已经执行过 `run`");case 4:return void jt.warn("执行绑定,但是 command 已完成全部应做动作");default:t.state=2}if(v(e)){const[n,r,o]=Nt(e);return Mt({name:n,abbr:r,info:o},t)}if(N(e))return e.forEach(e=>Mt(e,t));if(!j(e)&&!e.name&&!e.info)return function(e,t){const n={name:"",info:"",abbr:"",options:[]},r=Object.keys(e),o=Object.keys(n);return r.forEach(n=>{if(!o.includes(n)){const[r,o,i]=Nt(n);return Mt({name:r,info:i,abbr:o,options:e[n]},t)}})}(e,t);const n=e;n.abbr&&(t.abbr[n.abbr]=n.name),n.options?n.options=function(e,t,n){N(e)||(e=[e]);const r={};return e.forEach(e=>{let o={name:"",abbr:"",info:""};v(e)?[o.name,o.abbr,o.info]=Nt(e):o=Object.assign(o,e),o.abbr&&(n.abbr[`${t}^${o.abbr}`]=o.name),r[o.name]=o}),r}(n.options,n.name,t):n.options={},t.originalBind[n.name]={abbr:"",...n}}function Lt(){return new Proxy(new Tt,{get(e,t,n){if("args"===t){const t=JSON.parse(JSON.stringify(e[Symbol.for("_args")]||[]));return new Proxy(t,{get(n,r,o){return"$nomatch"===r?e.values.slice():"$map"===r?function(e){if(M(e))return{};const t=new Object;return e.forEach(e=>{const n=t[e.name]||{};n.value=[...n.value||[],...e.value||[]],e.options&&e.options.forEach(e=>{n[e.name]=[...n[e.name]||[],...e.value||[]]}),t[e.name]=n}),t}(t):"$arrMap"===r?M(i=t)?[]:i.map(e=>{const t={},n=t[e.name]||{};return e.value&&!M(e.value)&&(n.value=e.value),j(e)||j(e.options)||M(e.options)||(n.options=[],e.options.forEach(e=>{n.options?.push(Object.fromEntries([[e.name,e.value]]))})),t[e.name]=n,t}):"$only"===r?[...new Set(t.map(e=>e.name))]:"$original"===r?Ct.slice():"$isVoid"===r?0==Ct.slice().length:Reflect.get(n,r,o);var i},set:(e,t,n,r)=>(Reflect.set(e,t,n,r),!0)})}return Reflect.get(e,t,n)},set:(e,t,n,r)=>("args"===t?e[Symbol.for("_args")]=n:Reflect.set(e,t,n,r),!0)})}const Dt=" ".repeat(4);function Bt(e){return e.state="help",v(e.helpInfo)&&"help"!==e.helpInfo?function(e,t){const n=e.originalBind[t];if(it(`${Dt}${n.name}${Dt}${pe(n.info)}\n`),n.options&&!D(n.options)){it(`${de(`${Dt}使用:`)} ${e.name} ${t} [subOptions/subAbbr [value]]\n`),it(`${be(`${Dt}subOptions:`)} \n`),Pt(n.options||{})}else{it(`${he(`${Dt}使用:`)} ${e.name} ${t} [value]\n`)}}(e,e.helpInfo):N(e.helpInfo)&&2==e.helpInfo.length?function(e){const t=e.name,n=e.helpInfo.join(" "),r=e.originalBind[e.helpInfo[0]].options[e.helpInfo[1]].info;it(`${be(" 可使用:")} ${t} ${n} [value]\n${he(" 描述:")} ${r}`)}(e):function(e){it(`${we(" 可使用:")} ${e.name} options/abbr [subOptions/subAbbr [value]]\n\n选项:\n`);const t=Pt(e.originalBind);!function(e){["version -v 版本描述","help -h 帮助查看"].forEach(t=>{const[n,r,o]=t.split(" ");it(Ft({len:e,name:n,info:o,abbr:r})),it("")})}(t)}(e)}function Pt(e){const t=Object.keys(e).sort();let n=8;t.forEach(e=>n=Math.max(n,e.length));const r=Math.min(15,n+1);return it(Ft({len:r,name:"子命令",info:"描述",abbr:"缩写",color:!1})),it(""),t.forEach(t=>{const{name:n,abbr:o,info:i}=e[t];let s=!1;"options"in e[t]&&!D(e[t].options)&&(s=!0),it(Ft({len:r,name:n,info:i,abbr:o,textDecoration:s})),it("")}),r}function Ft(e){const t=Object.assign({name:"",info:"",abbr:"",len:15,color:!0,textDecoration:!1},e);let n=ue[t.color?"green":"black"](Dt);return n+=ue[t.textDecoration?"blue":"black"](t.name.slice(0,t.len)),n+=" ".repeat(t.len+1-At(t.name,t.len)),n+=ue[t.color?"yellow":"black"]`${t.abbr?.slice(0,6)||""}${" ".repeat(7-At(t.abbr||"",6))}`,n+=t.color?pe(t.info):t.info,n}function At(e,t){return Math.min(e.replace(/[^\x00-\x7f]/,"11").length,t)}const Wt="";function _t(e){const{name:t,object:n,item:r,result:o}=e;k(t)||(r.name&&n.options?.push(r),o.push(JSON.parse(JSON.stringify(n))))}function qt(e,t){"true"==e?e=!0:"false"==e?e=!1:e==Number(e)&&(e=Number(e)),k(t.name)?t.values.push(e):t[t.item.name?"item":"object"].value.push(e)}function zt(e,t){const n=[];let r="";const o=(e,t)=>j(t)||k(t)?n.push(e):n.push(e,t);function i(e,s){if(!k(r)){if(t.originalBind[r].options[e])return o(e,s);const n=t.abbr[`${r}^${e}`];if(!j(n))return o(n,s)}if(t.originalBind[e])return r=e,o(e,s);if(t.abbr[e])return e=t.abbr[e],r=e,o(e,s);if(e.includes("=")){const t=e.indexOf("=");if(0===t||t===e.length-1)return n.push(e);const[r,o]=[e.slice(0,t),e.slice(t+1)||"true"];return i(r,o)}return j(s)||k(s)?n.push(e):n.push(`${e}=${s}`)}return e.forEach(e=>i(e)),n}function Vt(e,t,n){n.init(),(e=zt(e.filter(e=>""!==e),t)).forEach(e=>{const{name:r}=n;return e=e.trim(),/^([a-z]|[A-Z]|-|\$|_)/.test(e)?!k(r)&&t.originalBind[r].options&&t.originalBind[r].options[e]?function(e,t){const{item:n,object:r}=t;n.name&&r.options.push(n),t.resetItem(e)}(e,n):t.originalBind[e]?function(e,t){k(t.name)||(_t(t),t.resetItem("")),t.resetObject(e)}(e,n):qt(e,n):qt(e,n)}),_t(n)}function Gt(e){switch(e.state.code){case 3:return void it("已经执行过 `run`");case 4:return void it("已完成全部");default:e.state=3}!function(e){if(2==process.argv.length)return;const t=e.originalArg,n=`${Wt}${t.join(Wt)}${Wt}`,r=t.findIndex(e=>/^(-h|help)$/.test(e));if(new RegExp(`${Wt}(-v|version)${Wt}`,"i").test(n))return void(e.hasShowVersion=!0);if(I(r))return void(e.helpInfo="help");let o=[];const i={result:[],values:[],name:"",object:{name:"",value:[],options:[]},item:{name:"",value:[]},resetObject(e){this.name=e,this.object={name:e,value:[],options:[]}},resetItem(e){this.item={name:e,value:[]}},init(){this.result=[],this.values=[],this.resetItem(""),this.resetObject("")}};r>0?(Vt(t.slice(0,r+1),e,i),e.values=i.values,e.args=i.result,o=e.args,M(o)?e.helpInfo="help":[j,M].some(e=>e(o[0].options))?e.helpInfo=o[0].name:e.helpInfo=[o[0].name,o[0].options[0].name]):(Vt(t,e,i),e.values=i.values,e.args=i.result)}(e),function(e){["name","originBind","abbr"].forEach(t=>{const n=t;e[n]&&(Object.freeze(e[n]),Object.defineProperty(e,t,{value:e[n],writable:!1,enumerable:!0,configurable:!1}))})}(e)}function Jt(e){e.state="version";const t=Je("package.json","file",Ze(e.__filename).name);if(j(t))return Ht();const n=Ge(t,"package.json");if(!ze(n))return Ht();const r=He(n);if(S(r))return Ht();const{platform:o}=process,i=ue.brightCyan(r.name),s=r.version,c="win32"==o?"Windows":"darwin"==o?"mac":o,l=ue.brightMagenta(a());it(`${i} 版本 ${ue.brightRed(s)} (${c} ${l})`)}function Ht(){it("抱歉,未找到版本定义说明")}const Kt=Re("#333"),Ut=Re("#666"),Yt=Re("#aaa"),Zt=Ne("#666"),Qt=Ut(".".repeat(3)),Xt=(e="❖")=>ye(e),en=(e="▶︎")=>ve(e),tn=(e="⚉")=>we(e),nn=(e="◦")=>Ut(e),rn=(e="●")=>ye.blink(e),on=(e="□")=>Ut(e),sn=(e="□")=>ye.blink(e),an=(e="■")=>Ut(e),cn=(e="■")=>ye.blink(e);function ln(e,t="⚉"){it(`${tn(t)} ${Re("#612").italic(e)}`)}function un(e,t="❖"){it(`${Xt(t)} ${e}`)}const fn={callList:[],on(e,t){const n=this.callList;M(n)&&(jt("当前执行列表为空,直接执行任务",e),Reflect.apply(t,void 0,[])),n.push([e,t])},remove(e){const t=this.callList,n=t.findIndex(([t])=>t===e);return t.splice(n,1),M(t)?(jt("当前执行列表为空,返回 true 结束执行"),!0):(Reflect.apply(t[0][1],null,[]),!1)}};function hn(e=!0){return process.stdout.rows-4*(1+Number(e))}function dn(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(P(r,e=>[v,E].some(t=>t(e))))t.push({value:r,label:r,checked:!1,tip:"",disable:!1});else{if(!P(r,e=>[v,v].some(t=>t(e.label))&&[v,E,B].some(t=>t(e.value))))throw new TypeError(`${r} 的类型非法(有可能是返回值类型更改后未在解析中兼容)`);{let e=r.checked;!j(e)&&C(e)||(e=!1);let n=r.tip;!j(n)&&v(n)||(n="");const o=r.value;if(j(o)||S(o))throw new TypeError("value 值类型非法");const i=r.label,s=T(r.disable);t.push({checked:e,tip:n,value:o,label:i,disable:s})}}}return t}const gn="请使用键盘选择,请使用 Enter 键进行选择",pn=!1,bn="radio",mn={drawData:[],info:gn,focus:0,renderInfo:{rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},resultText:"",errorText:"",private:pn,required:pn,kind:bn,mustInfo:pn,maxRows:hn(),data:[],initData(e){jt("初始化数据"),this.reset(),N(e)?this.data=dn(e):Object.keys(e).forEach(t=>{const n=e[t];switch(t){case"data":this.data=N(n)?dn(n):[];break;case"info":this.info=v(n)?n:gn;break;case"resultText":this.resultText=v(n)?n:this.info||"";break;case"errorText":this.errorText=v(n)?n:this.resultText||this.info||"";break;case"private":this.private=C(n)?n:pn;break;case"required":this.required=C(n)?n:pn;break;case"kind":this.kind="check"===n?"check":bn;break;case"maxRows":this.maxRows=isFinite(n)&&Number.isInteger(n)&&n>0?n+4:hn()}});const t=this.data;for(const e in t){if(!t[e].disable)return this.focus=Number(e),!1}return!0},reset(){this.drawData.length=this.data.length=this.focus=0,this.maxRows=hn(),this.renderInfo={rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},this.info=gn,this.kind=bn,this.resultText=this.errorText="",this.private=!0,this.required=this.mustInfo=pn}};function wn(e){const{data:t}=mn,n=process.stdout.columns-7,r=n-3,o=t[e].label.toString();return Me(o)<=n?o:De(o,r,!1).concat(Qt)}const yn=()=>{!function(){const{focus:e,drawData:t,data:n,kind:r}=mn;for(let o=0,i=n.length;o<i;o++){const i=n[o];if(j(t[o])){const n=Me(i.label.toString());t[o]={index:o,text:wn(o),length:n,checked:"radio"!==r&&i.checked,focus:o===e,changed:!0,show:!0,disable:i.disable}}else o===e?(t[o].changed=!0,t[o].focus=!0):o!==e&&T(t[o].focus)&&(t[o].changed=!0,t[o].focus=!1)}}(),function(){const{drawData:e,renderInfo:t,focus:n}=mn,{renderRows:r}=t,o=e.length;if(o===r)return void e.forEach(e=>e.show=!0);const i=o-1,s=Math.floor((r-1)/2);let a=1&r?n-s:n-s-1;a=a<0?0:a;let c=r+a-1;c>i&&(c=i,a=c-r+1);e.forEach(e=>{const{index:t}=e;t>c||t<a?e.show=!1:t===c&&t!==i||t===a&&0!==t?(e.show=!0,e.text=Qt):e.text===Qt?(e.show=!0,e.text=wn(t)):e.show=!0})}();const{info:e,mustInfo:t,renderInfo:n,focus:r,data:o}=mn,{rows:i,allowBelow:s,size:a}=n,{width:c}=a;let l=`${J}${c}D`;l+="\n".repeat(i),l+=`${J}${i}A`,l+=`${J}J`,l+=Be(`${en()} ${e} \n\n`),l+=function(){const{drawData:e,kind:t}=mn;let n="";for(let r=0,o=e.length;r<o;r++){const o=e[r];o.show&&(o.focus?(n+=Be(` ${"radio"===t?rn():o.checked?cn():sn()} ${o.text}`),n+="\n"):o.text===Qt?(n+=` ${Qt}`,n+="\n"):o.disable?(n+=Be(` ${"radio"===t?Yt`⊗`:o.checked?Yt`▣`:Yt`☒`} ${Yt(o.text)}`),n+="\n"):(n+=Be(` ${"radio"===t?nn():o.checked?an():on()} ${Kt(o.text||"")}`),n+="\n"))}return n}(),l+=`${J}J`,s&&(t?l+=function(){const e=process.stdout.columns-7;mn.mustInfo=!1;const t="抱歉,该项至少选择一项!!!请使用空格键或是左右键切换选择状态",n=Me(t)<e?t:De(t,e);return"\n".concat(fe(n))}():o[r].tip?(l+="\n",l+=Be(`${be(o[r].tip)}`)):l+="\n",l+="\n"),Rt&&(l+=`${J}${c}D${J}${i}A`),it(l,!1)},vn=W(yn,66),xn=W(yn,600);function $n(){const{data:e,renderInfo:t,maxRows:n}=mn,[r,o]=[process.stdout.columns,process.stdout.rows],i=e.length;t.size={width:r,height:o};const s=t.rows=Math.max(Math.min(i+4,hn(!1),n),5),a=t.allowBelow=hn()>e.length||s>6,c=t.otherInfoRows=a?4:2;t.renderRows=s-c}async function kn(){const{data:e,required:t,kind:n,drawData:r}=mn,o={exit:!1};return await ot((i,s)=>{const{focus:a}=mn;switch(s.name){case"return":return jt("用户已选择,返回真值告诉等待程序可终结当前输入"),"check"!==n||!t||!M(r.filter(e=>e.checked))||(mn.mustInfo=!0,vn(),!1);case"up":jt("用户使用了键盘键的 up 键"),In(!1),vn();break;case"down":jt("用户使用了键盘键的 down 键"),In(),vn();break;case"right":jt("用户使用了键盘键的右键");case"left":jt("用户使用了键盘键的左键");case"space":jt("用户使用了键盘键的空格键"),"check"===n&&(e[a].checked=r[a].checked=!r[a].checked,vn());break;case"escape":if(s?.sequence===G.repeat(2))return o.exit=!0,!0;break;default:if(jt("用户使用了键盘键的非方向键 <",i,">, <",s,">"),"check"===mn.kind&&("a"===s?.name&&(En(),vn()),"z"===s?.name&&(En(!1),vn()),"r"===s?.name&&(mn.data.forEach(e=>{e.disable||(e.checked=!e.checked)}),mn.drawData.forEach(e=>{e.disable||(e.checked=!e.checked)}),vn())),T(s?.ctrl)&&("c"===s?.name||"d"===s?.name))return o.exit=!0,!0}return!1}),o.exit}function En(e=!0){mn.data.forEach(t=>{t.disable||(t.checked=e)}),mn.drawData.forEach(t=>{t.disable||(t.checked=e)})}function In(e=!0){const{focus:t,drawData:n}=mn,r=n.length-1,o=e?t===r?n:[...n.slice(t+1),...n.slice(0,t+1)]:0===t?n.toReversed():[...n.slice(t),...n.slice(0,t)].toReversed();for(const e of o)if(!e.disable)return void(mn.focus=e.index)}async function Cn(e,t){const n=Symbol("selection");return new Promise((r,o)=>{fn.on(n,async()=>{try{const o=await async function(e,t){if(process.stdout.removeListener("resize",Tn),process.stdout.on("resize",Tn),mn.initData(e))return;at(),jt("初始绘制问题选项"),$n(),vn(),jt("绘制完成,等待用户操作");const n=await kn();it(K,!1),process.stdout.removeListener("resize",Tn);const{resultText:r,info:o,focus:i,kind:s,drawData:a,errorText:c}=mn;if(ct(),lt(!0),n)return void(mn.private||ln(c||r||o));const l=a.filter(e=>e.checked);if(!mn.private){const e="radio"===s?[a[i].text]:l.map(e=>e.text);un(`${Ut.italic.dim(r||o)}: ${Ut(e.join("、"))}`)}const u="radio"===s?mn.data[i].value:l.map(e=>mn.data[e.index].value),f="radio"===s?i:l.map(e=>e.index),h="string"==t||j(t)?u:f;return h}(e,t);fn.remove(n),r(o)}catch(e){jt.error(e),fn.remove(n),o()}})})}const Tn=W(()=>{const{drawData:e,renderInfo:t}=mn,n=t.size.height;e.length=0,it(K,!1),lt(),$n(),process.stdout.rows!==n?xn():vn()},33);function On(e,t){return Cn(e,t)}const Sn={data:"",kind:0,multi:!1,progressCount:0,indexOfCursor:0,init:function(e){this.data=e,this.multi=N(e)}},jn={get kind(){return Sn.kind},set kind(e){(!isFinite(e)||0!=e&&1!=e)&&(e=0),Sn.kind=e},get multi(){return Sn.multi},enterText:[],get progressCount(){return Sn.progressCount},set progressCount(e){Sn.progressCount=e,e<0&&Reflect.apply(Rn,this,[])},get indexOfCursor(){return Sn.indexOfCursor},set indexOfCursor(e){Sn.indexOfCursor=e},currentIssue:{text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]},results:[],assign(e){Object.keys(e).forEach(t=>{if(!Object.hasOwn(this,t)||j(e[t]))throw it(`${t} is not exist`),new Error(`${t} is not exist`);this[t]=e[t]})},beforeStart(){this.results.length=this.enterText.length=this.indexOfCursor=0,this.progressCount=Sn.multi?-Sn.data.length:-1}};function Rn(){const{multi:e,progressCount:t}=this,n=e&&N(Sn.data)?Sn.data[Sn.data.length+t]:Sn.data,r={text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]};Object.assign(r,v(n)||E(n)?{text:n}:n);const o=N(r.tip)?1:0;let i;1==o?i=[r.tip[0]]:(i=[],[r.tip,r.defaultValue].every(e=>$(e))&&(r.required=!0),!k(r.defaultValue)&&$(r.tip)&&(r.tip=r.defaultValue)),r.text=k(r.text.toString())?"请使用你自己的问题":r.text,this.assign({indexOfCursor:0,kind:o,enterText:i,currentIssue:r})}const Nn=W(()=>{const{kind:e,currentIssue:t,enterText:n}=jn,{mustInfo:r,text:o,required:i,tip:s,verify:a}=t;at();let c="",l=!1;if(I(t.row)||(c+=`${J}${t.row}A`,t.row=0),c+=`\r${J}0J${K}`,r)c=Mn(c),l=!0;else if(!M(n)){const e=n.join("");for(const n of a)if(x(n.reg)&&v(n.info)&&[j,C].some(e=>e(n.inverse))){n.reg.lastIndex=0;const r=n.reg.test(e);if(T(n.inverse)&&T(r)||T(!n.inverse)&&O(r)){t.mustInfo=n.warn?ve(n.info):n.info,c=Mn(c),l=!0;break}}}const u=0===e&&i?we.blink("*"):"";c+=`${en()} ${u}${o}${u}: `,t.row+=Number(t.isWrapLine),c+="\n".repeat(Number(t.isWrapLine)),I(e)?M(n)&&v(s)?$(s)?c+=Te.dim.blink("I"):c+=" ".concat(Zt.italic.dim(s[0])).concat(Te.dim(s.slice(1))):(c+=" ",c=function(e){const{type:t,usableLength:n}=jn.currentIssue;e="text"===t?function(e,t){const{enterText:n,indexOfCursor:r}=jn,o=Me(n.join(""))>t;r===n.length?(o?e=function(e,t){const{enterText:n}=jn;return e+=Qt.concat([...De(n.toReversed().join(""),t-3,!1)].reverse().join("")),e}(e,t):e+=n.join(""),e+=Zt.hide(" ")):o?e=function(e,t){const{indexOfCursor:n,enterText:r}=jn,o=r.join(""),i=r.length,s=Math.floor(t/2),a=De(o,s),c=a.length-1,l=a[c]===o[c]?c:c-1,u=De(o,-s),f=u.length-1,h=u[f]===o[i-1-f]?i-1-f:i-f,d=r.map((e,t)=>t===n?Zt(e):e).join("");if(n>=h)e+=Qt,e+=De(d,3-t,!1);else if(n<l)e+=De(d,t-3,!1),e+=Qt;else{const t=s-Me(r[n])-3;e+=Qt,e+=De(o.slice(0,n),-t,!1),e+=Zt(r[n]),e+=De(o.slice(n+1),t,!1),e+=Qt}return e}(e,t):e+=`${n.map((e,t)=>t===r?Zt(e):e).join("")}`;return e}(e,n):function(e){const{enterText:t,indexOfCursor:n}=jn;n===t.length?(e+=` ${t.map(()=>"*").join("")}`,e+=Zt.hide("1")):e+=` ${t.map((e,t)=>t===n?Zt("*"):"*").join("")}`;return e}(e);return e}(c)):c=function(e){const{currentIssue:t,enterText:n}=jn;return e+t.tip.map(e=>e===n[0]?Oe.bold.blink.cyan(e):pe(e)).join(" ")}(c),jt("计算完成的文本为",c),it(Be(c)),t.row++,function(e){const{currentIssue:t,indexOfCursor:n,enterText:r}=jn,{text:o,required:i,mustInfoLen:s}=t;if(e)return ht(s);const a=r.slice(0,n).join(""),c=o.toString().concat(a),l=Me(c),u=l+7+2*Number(i),f=u%process.stdout.columns;jt("用户输入",r.join("")),jt("光标所在的位置",n),jt("实际参与计算的用户输入的文本为",a),jt("计算总文本",c),jt("计算文本长度",l),jt("计算可用长度",u),jt("屏幕宽",process.stdout.columns),jt("光标偏移量",u%process.stdout.columns),ht(f)}(l),l||it(Se("I"),!1),st("8m")},66);function Mn(e){const{currentIssue:t}=jn;e+="\n\r",t.row++;let n="";if(C(t.mustInfo)){const e=t.required?" ":"";n+=" ".repeat(2).concat(e).concat(fe(t.text)).concat(e).concat(" ".repeat(3)),n+=fe.blink`👆`}else n+=pe(t.mustInfo);let r=Me(n);const o=process.stderr.columns-4;return o<r&&(r=o,n=De(n,o)),t.mustInfoLen=r,e+=n,e+=`\r${J}1A`,t.row--,t.mustInfo=!1,e}function Ln(){const{currentIssue:e}=jn;!function(){const{currentIssue:e}=jn,t=process.stdout.columns;let n=t-Me(e.text.toString())-2*Number(e.required)-4-7;const r=n<5;r&&(n=t-4);e.isWrapLine=r,e.usableLength=n}();const{isWrapLine:t}=e,n=2+Number(t);it("\n".repeat(n),!1),e.row+=n,ut(n),e.row-=n}async function Dn(){try{await ot((e=this,(t,n)=>{const{kind:r,currentIssue:o,enterText:i,results:s}=e,{tip:a,text:c}=o;let l=[],u=0,f=0,h=!0;switch(I(r)||(l=a,u=l.length-1,f=l.indexOf(i[0])),jt("\n 用户使用了",t,n),n.name){case"return":if(function(){const{enterText:e,currentIssue:t,results:n}=jn,r=t.text;let o=e.join("").trim();if($(o)&&t.required)return t.mustInfo=!0,!1;const{len:i,minLen:s,maxLen:a,verify:c}=t,l=o.length;if(I(jn.kind)){if(c.length>0)for(const e of c)if([j,O].some(t=>t(e.warn))&&x(e.reg)&&v(e.info)&&[j,C].some(t=>t(e.inverse))){e.reg.lastIndex=0;const t=e.reg.test(o);if(T(e.inverse)&&t||!e.inverse&&!t)return!1}if(!I(i)&&l!==i)return t.mustInfo=`您输入的长度 ${he(l)} 不符合要求值 ${be(i)}`,!1;if(!I(s)&&l<s)return t.mustInfo=`您输入的长度 ${he(l)} 小于最低要求${be(s)}`,!1;if(a>s&&l>a)return t.mustInfo=`您输入的长度 ${he(l)} 大于最低要求${be(a)}`,!1}return $(o)&&O(t.required)&&(o=t.defaultValue||t.tip||""),n.push({q:r,r:o}),!0}())return h=!1,!0;break;case"left":!function(e,t,n){const{kind:r,enterText:o}=jn;I(r)?jn.indexOfCursor=0===jn.indexOfCursor?o.length:jn.indexOfCursor-1:o[0]=e[0===t?n:t-1]}(l,f,u);break;case"right":!function(e,t,n){const{kind:r,enterText:o}=jn;I(r)?jn.indexOfCursor=jn.indexOfCursor==jn.enterText.length?0:jn.indexOfCursor+1:o[0]=e[t==n?0:t+1]}(l,f,u);break;case"delete":case"backspace":!function(){const{enterText:e,kind:t}=jn;I(t)&&!I(jn.indexOfCursor)&&(e.splice(jn.indexOfCursor-1,1),jn.indexOfCursor--)}();break;case"escape":if(n?.sequence===G.repeat(2))return s.push({q:c,r:void 0}),h=!1,!0;break;default:if(jt("当前触发为含 ctrl 键的功能键",t,n),O(n?.ctrl))!function(e){const{enterText:t,kind:n}=jn;j(e)||0!==n||(jn.indexOfCursor==t.length?t.push(e):t.splice(jn.indexOfCursor,0,e),jn.indexOfCursor+=1)}(t);else if(h=!1,st("m"),"c"===n?.name||"d"===n?.name)return s.push({q:c,r:void 0}),!0}return h&&Nn(),!1}))}catch(e){jt.error("接收用户输入出错",e),it(e)}var e}function Bn(e,t){const n=Symbol("question");try{return new Promise((r,o)=>{fn.on(n,async()=>{try{const o=await async function(e,t){process.stdout.removeListener("resize",Pn),process.stdout.on("resize",Pn),jt("初始化问题"),Sn.init(e),jt("初始化当前问题"),jn.beforeStart(),jt("开始绘制问题");do{Ln(),Nn();try{await Reflect.apply(Dn,jn,[])}catch(e){jt.error(e)}const{currentIssue:e,results:t}=jn;I(e.row)||(ut(e.row,!0),e.row=0),st("m"),ct(),lt(!0);const n=e.resultText||e.text,r=t[t.length-1].r;e.private||(j(r)?ln(e.errorText||n):un(`${Ut(n)}: ${"text"===e.type?r:r.replace(/./gm,"*")}`)),++jn.progressCount}while(jn.progressCount<0);return process.stdout.removeListener("resize",Pn),st("m"),ct(),lt(!0),jn.multi?T(t)&&N(e)?jn.results.map(e=>e.r):jn.results:jn.results[0].r}(e,t);fn.remove(n),r(o)}catch(e){jt.error("\n\n\n\n\n执行出现错误",e),fn.remove(n),o(e)}})})}catch(e){return jt.error("系统故障",e),it("系统故障",!1),it(e),new Promise((t,n)=>{n(e)})}}const Pn=W(()=>{const{currentIssue:e}=jn;I(e.row)||(ut(e.row,!0),e.row=0),it(K,!1),lt(!0),Ln(),Nn()}),Fn=async function(e,t){return Bn(e,t)},An=new class{#c;#l;constructor(e=""){if(v(e)||(e=`${e}`),this.#c=Symbol(e),St[this.#c])throw new Error(`${e} 已经存在,请更换初始化命令名称,若仍想在原命令上操作,请抽离为单独的文件做数据共享`);this.#l=St[this.#c]=Lt(),[this.#l.__filename]=Qe(),this.#l.name=e||v(process.argv[1])&&process.argv.slice(1,2)[0].replace(/.*\/.*?$/,"$1")||"",Object.defineProperty(this,"#uniKey",{value:this.#c,writable:!1,enumerable:!1,configurable:!1})}get name(){return this.#l.name}get state(){return this.#l.state}isEnd(e=!1){const t=4===this.#l.state.code;return t&&T(e)&&this.end(),t}end(){return this.#l.state="end",process.exit()}error(){return this.#l.state="error",process.exit(1)}bind(e){return Mt(e,this.#l),this}run(){const e=this.#l;return Gt(e),k(e.helpInfo)||Bt(e),e.hasShowVersion&&Jt(e),this}get args(){return this.#l.args}get values(){return this.#l.values.slice()}help(e,t){const n=this.#l;v(e)&&n.originalBind[e]?v(t)&&n.originalBind[e].options&&n.originalBind[e].options[t]?n.helpInfo=[e,t]:n.helpInfo=e:n.helpInfo="help",Bt(this.#l)}version(){Jt(this.#l)}}("nry");async function Wn(e="好的,即将退出"){return k(e)||await It(e),ct(),An.end()}function _n(e){return e.endsWith("/")?e:e+"/"}async function qn(e){return new Promise(t=>{let n;try{return n=new URL(e),t(!0)}catch{return _e.error("当前传入的",e,"有误"),t(!1)}})}An.bind(["add <a> (用于添加一个自定义的 npm、yarn、pnpm 源)","edit <ed> (用于编辑源) ",qe?"":"clean (移除本地数据)","delete <del> (用于移除某个或多个自定义的项)","list <ls> (用于展示当前的所有的源)","manage <mg> (用于管理当前源在列表中的显隐)",`reset <rs> (重制当前的源,将${we`永久移除自定义源`}、${xe`恢复已更改的源`})`]).run().isEnd(!0);const zn={npm:"https://registry.npmjs.org/","tao-bao":"https://registry.npmmirror.com/","ten-xun":"https://mirrors.tencent.com/npm/",ustclug:"https://npmreg.proxy.ustclug.org/",yarn:"https://registry.yarnpkg.com/"},{npm:Vn,"tao-bao":Gn,"ten-xun":Jn,ustclug:Hn,yarn:Kn}=zn,Un=[{value:Vn,label:"官方",tip:Vn},{value:Gn,label:"淘宝",tip:Gn},{value:Jn,label:"腾讯",tip:Jn},{value:Hn,label:"中科大",tip:Hn},{value:Kn,label:"yarn",tip:Kn}];function Yn(e=!1){if(e)return[...Un];if(!Xn.available)return[...Un];const t=Xn.read();if(N(t)&&t.every(e=>v(e.value)&&!k(e.label)&&v(e.value)&&!k(e.value))){return t.map(e=>(e.value=_n(e.value),e.tip=_n(e.tip),e))}return[...Un]}const Zn=new class{#u;#f=!0;get available(){return this.#f}constructor(e){const t=function(){const e=s();if(Ve("当前获取用户主目录为",e),!e||"/"===e||e.includes("Default"))throw new Error("未能获取到主目录路径 <"+e+">");try{const t=Ge(e,"test_write"+Date.now());return Ke(t,{}),i(t),e}catch(e){return void Ve.error(e)}}();if(j(t))return this.#f=!1,void(this.#u="");this.#f=!0,this.#u=Ge(t,".mudbean.data",`${e}`)}read(e){if(!this.available)return null;const t=Ge(this.#u,e);return j(ze(t))?{}:He(t)||{}}write(e,t){if(!this.available)return!1;const n=Ge(this.#u,e),r=Ge(n,"../");Ve("创建的文件路径为"),o(r,{recursive:!0}),Ve("写入的文件路径为:",n),Ve("写入文件内容为",t);const i=Ke(n,t);return Ve("写入反馈",i),i}getPath(e){return Ge(this.#u,e)}}("nry"),Qn="config",Xn={available:Zn.available,read(){if(Zn.available){const e=Zn.read(Qn);if(N(e))return e}return Yn(!0)},addNew(e){if(Zn.available){const t=this.read();return t.push(e),_e("新写入的数据为",e),this.write(t)}return!1},write:e=>!!Zn.available&&Zn.write(Qn,e),getPath:()=>Zn.getPath(Qn),clean(){const e=this.getPath();_e("将要移除的文件",e),i(e)}},er={add:!1,edit:!1,delete:!1,manage:!1,list:!1,noMatch:!1,reset:!1,clean:!1},tr={pkgManager:function(e=!1){if(O(e)){const e=e=>Boolean(Je(e,"file"));if(e("pnpm-lock.yaml"))return"pnpm";if(e("yarn.lock"))return"yarn";if(e("package-lock.json"))return"npm"}const t=process.env.npm_config_user_agent||"";return t.includes("pnpm")?"pnpm":t.includes("yarn")?"yarn":t.includes("npm")?"npm":process.env.PNPM_HOME?"pnpm":process.env.YARN_IGNORE_PATH?"yarn":"npm"}(!0)};function nr(e){if(!Xn.available)return!1;const t=_n(e.value);return Xn.addNew({value:t,label:e.label.toString(),tip:t,disable:!1})}const rr=m(function(e){return this.data=[],Object.setPrototypeOf(this,e),this});function or(e,t){if(t.align&&(e.align=t.align),t.bgColor&&(e.bgColor=t.bgColor),t.color&&(e.color=t.color),t.italic&&(e.italic=t.italic),t.underline&&(e.underline=t.underline),t.border)if(P(t.border,e=>v(e))){const n=t.border;e.border={left:{color:void 0,style:n},right:{color:void 0,style:n},top:{color:void 0,style:n},bottom:{color:void 0,style:n}}}else if(P(t.border,e=>["color","style"].some(t=>!j(e[t])))){const n=t.border,r=n.style,o=n.color||void 0;e.border=JSON.parse(JSON.stringify({left:{color:o,style:r},right:{color:o,style:r},top:{color:o,style:r},bottom:{color:o,style:r}},(e,t)=>""===t?void 0:t))}else P(t.border,e=>["left","right","top","bottom"].some(t=>!j(e[t])))&&(e.border=t.border)}class ir{}function sr(e,t){N(e)&&(e={data:e});const n=new ir;or(n,e);const r=new rr(n);return Object.setPrototypeOf(n,t),e.data?.forEach(e=>{e&&r.data.push(function(e,t){if(j(e))return;P(e,e=>!L(e))&&(e={content:e});const n={content:e.content};return or(n,e),Object.setPrototypeOf(n,t),n}(e,n))}),r}class ar extends ir{border={left:{style:"bold",color:void 0},right:{style:"bold",color:void 0},top:{style:"bold",color:void 0},bottom:{style:"bold",color:void 0}}}function cr(e){const t=new ar;return Object.setPrototypeOf(t,e),t}const lr=!z(),ur={emojiLength:2.08,emojiRegex:/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F900}-\u{1F9FF}]/gu,chineseLength:1.8,chineseRegex:/[\u4E00-\u9FFF]/g};const fr=new class{align="left";color="";bgColor="";bold=!1;underline=!1;italic=!1;border={left:{color:void 0,style:"simple"},right:{color:void 0,style:"simple"},top:{color:void 0,style:"simple"},bottom:{color:void 0,style:"simple"}}},hr=m(function(e){return this.body=[],this.header=void 0,Object.setPrototypeOf(this,e),this});class dr{}function gr(e){let t=ue;return P(e)&&(e.bold&&(t=t.bold),k(e.bgColor)||j(e.bgColor)||(t=t.bgColor(e.bgColor)),k(e.color)||j(e.color)||(t=t.color(e.color)),e.italic&&(t=t.italic),e.underline&&(t=t.underline)),t}const pr={fine:{lt:"┌",ct:"┬",rt:"┐",lc:"├",c:"┼",rc:"┤",lb:"└",cb:"┴",rb:"┘",l:"─",v:"│"}};function br(e){let t=0;return[...e].forEach(e=>{ur.emojiRegex.lastIndex=0,ur.chineseRegex.lastIndex=0,e.match(ur.emojiRegex)?t+=ur.emojiLength:e.match(ur.chineseRegex)?t+=ur.chineseLength:t++}),Math.ceil(t)}function mr(e,t){const n=function(e){const t=[];return e.header&&e.header.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,lr?br(r):Me(r))}),e.body&&e.body.forEach(e=>{e.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,lr?br(r):Me(r))})}),t}(e);let r=!1,o="";e.header&&(r=!0,o+=function(e,t){let n="";const r=t.length-1,{fine:o}=pr,i=gr(e);return t.forEach((e,t)=>{0===t&&(n+=o.lt),n+=K,n+=o.l.repeat(e+2),t===r?(n+=K,n+=o.rt):(n+=K,n+=o.ct)}),n+="\n",t.forEach((t,s)=>{n+=K,n+=o.v;const a=e.data[s];if(j(a)||S(a))n+=K,n+=i(" ".repeat(t+2));else{const e=gr(a);let r=a.content?.toString()??"";r=r.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),n+=K,n+=e`\u2002${De(r,t)}\u2002`}s===r&&(n+=o.v)}),n+="\n",n}(e.header,n)),o+=function(e,t,n){let r="";const o=t.length-1,{fine:i}=pr;return t.forEach((e,t)=>{0===t&&(r+=K,r+=n?i.lc:i.lt),r+=K,r+=i.l.repeat(e+2),t===o?(r+=K,r+=n?i.rc:i.rt):(r+=K,r+=n?i.c:i.ct)}),r+="\n",e.forEach((n,s)=>{const a=gr(n);t.forEach((e,t)=>{r+=K,r+=i.v;const s=n.data[t];if(j(s)||S(s))r+=a`${" ".repeat(e+2)}`;else{const t=gr(s);let n=s.content?.toString()||"";n=n.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),r+=K,r+=t`\u2002${De(n,e)}\u2002`}t===o&&(r+=K,r+=i.v)}),r+="\n";const c=e.length-1===s;t.forEach((e,t)=>{0===t&&(r+=K,r+=c?i.lb:i.lc),r+=K,r+=i.l.repeat(e+2),t===o?(r+=K,r+=c?i.rb:i.rc):(r+=K,r+=c?i.cb:i.c)}),r+="\n"}),r}(e.body,n,r);const i=se(o);if(lr){const e=i[0].split("%c"),n=i.map((n,r)=>{if(r>0){const o=[...e[r]].reduce((e,t)=>Me(t)>1?(ur.emojiRegex.lastIndex=0,t.match(ur.emojiRegex)?e-(ur.emojiLength-2):e+(2-ur.chineseLength)):e,0);return n+"font-family: Consolas,Monaco,Courier,'Courier New','等宽字体',monospace; font-size:"+t+"px;word-spacing:normal;padding:0;margin:0;padding-right:"+o*t+"px"}return n});console.log(...n)}else console.log(...i)}const wr=m(function(e){const[t,n]=function(e){j(e)&&(e={}),N(e)&&(e={body:e});const t=new dr;or(t,e),Object.setPrototypeOf(t,fr);const n=new hr(t);return e.header&&(n.header=sr(e.header,cr(t))),e.body?.forEach(e=>n.body.push(sr(e,t))),[n,t]}(e);let r=12;const o=()=>mr(t,r);return Object.setPrototypeOf(o,this),Object.defineProperties(o,{addRow:{value:e=>(t.body.push(sr(e,n)),o),configurable:!1,writable:!1,enumerable:!1},setHeader:{value:e=>(t.header=sr(e,cr(n)),o),configurable:!1,writable:!1,enumerable:!1},setFontSize:{value:e=>(r=e,o)}}),o});async function yr(){const{pkgManager:e}=tr,t=`${e} config get registry`;_e("执行可写代码",t);const n=await Et(t);if(_e("获取当前的本地配置为",n),n.success)return n.data.replace(/\s/gm,"")}async function vr(){const{pkgManager:e}=tr,t=Yn(),n=await yr(),r=new wr({header:[`${e} registry 源`,"别名","当前可见"]});!(t.findIndex(e=>e.value===n)>-1)&&v(n)&&t.push({value:n,tip:n,label:"曾用值"}),t.forEach(e=>r.addRow([(n===e.value?pe`* `:" ").concat(e.value),(n===e.value?pe`* `:" ").concat(he(e.label)),e.disable?"❌":"✅"])),r(),it(me`注:当前可见状态仅影响 npx nry 选择项`)}const{npm:xr,yarn:$r}=zn;async function kr(e){const{pkgManager:t}=tr,n=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}];e.forEach(e=>{n.push({reg:new RegExp(`^${_(e.value)}/*$`,"mg"),info:`${he(e.value)}(${be(e.label)}) 已存在`,inverse:!0})});const r=await Fn({text:"请输入自定义的源地址",tip:"yarn"===t?$r:xr,minLen:5,maxLen:120,verify:n,required:!1});return _e("用户输入的地址",r),j(r)?await Wn():await qn(r)?_n(r):(it(`当前设置 registry 「${je(r)}」 不可用`),it("请使用正确的源设置"),await kr(e))}async function Er(){if(!Xn.available)return await Wn("读写受限,正在退出");const{pkgManager:e}=tr,t=Yn(),n=await kr(t),r=await async function(e){const t=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}],{pkgManager:n}=tr;e.forEach(e=>{t.push({reg:new RegExp(`^${_(e.label)}$`,"mg"),info:`${he(e.label)}(${be(e.value)}) 已存在`,inverse:!0})});const r=await Fn({text:`请输入自定义的 ${n} 的别名`,tip:"任意别名",minLen:1,maxLen:120,verify:t,defaultValue:"",required:!1});return _e("用户输入的别名为",r),j(r)?await Wn():r}(t);if(nr({value:n,label:r})){it(me`当前的 ${e} registry 源列表为`),await vr();const t=["退出","继续添加"],n=await Fn({text:"添加完成,是否持续添加",tip:t});return j(n)||n===t[0]?await Wn(""):await Er()}return await Wn(`写入${we`失败`},原因未知`)}async function Ir(e="",t=!0,n=!0){k(e)&&(e=`请选择想使用的新的 ${tr.pkgManager} registry 源`);let r=!1;const o=Yn(),i=await yr();if(!j(i)){for(const e of o)if(e.value===i){e.label=e.label.toString()+`(${pe`当前使用`})`,e.disable=!n,r=!0;break}if(O(r)){const e={value:i,label:"当前使用值",disable:!n};o.push(e),Xn.available&&nr({value:i,label:"曾用值"})}}_e("处理完的数据",o);const s=t?o.filter(e=>!e.disable||e.disable&&e.value===i):o.map(e=>(e.value===i?e.disable=!n:e.disable=!1,e)),a=await On({data:s,info:e},"number");return _e("用户选择的项",a),j(a)?await Wn():(_e("当前用户选择为",s[a]),s[a])}async function Cr(){const e=await Ir();await async function(e){const{pkgManager:t}=tr,n=_n(e.value);if(!await qn(n))return await Wn(`选择的项 「${pe(n)}」 不可连接,无法被设置`);const r=`${t} config set registry "${n}"`;_e("设置源执行代码",r);(await Et(r)).success||await Wn();it(`已将 ${t} registry 更改为 ${he(e.value)}(${ge(e.label)})`)}(e)}async function Tr(){if(!Xn.available)return await Wn("当前读写受限,即将退出程序");const e=await Ir("请选择要删除的项",!1,!1),{value:t,label:n}=e,r=Yn();for(const e in r){const o=Number(e),i=r[o];if(i.value===t&&i.label===n){r.splice(o,1);break}}if(Xn.write(r)){it("删除项后的列表为:"),await vr();const e=["退出","继续删除"],t=await Fn({text:"是否继续删除其他项",tip:e});return j(t)||t===e[0]?await Wn(""):await Tr()}}async function Or(){if(!Xn.available)return await Wn("当前读写权限不足,即将退出程序");const e=await Ir("请选择你想要修改的项",!1),{value:t,label:n}=e;_e("获取用户的选择",e),_e("原始的值",t),_e("原始的标签",n),await async function(e){const{pkgManager:t}=tr,n=await Fn({text:`请更改为新的 ${t} registry 值`,tip:e.value,defaultValue:e.value,required:!1});if(_e("新值为",n),j(n))return;e.value=e.tip=_n(n)}(e),await async function(e){const{pkgManager:t}=tr,n=await Fn({text:`请更改为新的 ${t} registry 别名`,tip:e.label,defaultValue:e.label.toString(),required:!1});if(_e("新值为",n),j(n))return;e.label=n}(e);const{value:r,label:o}=e;_e("更改后的值",r),_e("更改的标签",o);const i=Yn();for(const e of i)if(e.value===t&&e.label===n){e.value=r,e.label=o.toString();break}if(Xn.write(i)){it("更改后的列表为:"),await vr();const e=["退出","继续修改"],t=await Fn({text:"是否继续修改其他项",tip:e});return j(t)||t===e[0]?await Wn(""):await Or()}}async function Sr(){return function(){const e=An.args,t=e.$map;_e("源解析值",e),_e("源解析值没有匹配项",e.$isVoid),["add","delete","edit","list","manage","reset","clean"].forEach(e=>er[e]=O(j(t[e]))),er.noMatch=e.$isVoid,_e("解析完的值",er)}(),_e("解析参数完毕,开始执行",er),er.noMatch?(_e("当前没有匹配值"),await Cr()):er.reset?(_e("重置项"),await async function(){if(!Xn.available)return await Wn("当前读写权限受限,正在退出程序");const e=["退出","重置"],t=await Fn({text:"请确认是否执行覆盖原数据,该操作无法复原",tip:e});return j(t)||t===e[0]?await Wn("好的,这就退出重置"):Xn.write(Yn(!0))?(await It("写入"+he`成功`,60),await vr()):await Wn("重置未能完成,原因未知")}()):er.list?(_e("当前为展示项"),await vr()):er.manage?(_e("当前执行状态更改"),await async function(){if(!Xn.available)return await Wn("当前读写受限,即将退出程序。");const e=Yn(),t=await yr(),n=await On({data:e.map(e=>({...e,checked:!e.disable,disable:e.value===t})),kind:"check"},"number");if(_e("交互结果",n),j(n))return await Wn("好的,将退出状态显隐管理");e.forEach((e,t)=>{e.disable=!n.includes(t)}),_e("保存前的数据",e),Xn.write(e)&&await vr()}()):er.add?(_e("添加新的项"),await Er()):er.edit?(_e("编辑项"),await Or()):er.delete?(_e("删除项"),await Tr()):er.clean?(_e("当前执行清理"),Xn.clean()):await Cr()}(async()=>{try{await Sr()}catch(e){_e.error("系统级捕获 错误",e),console.log("当前出现未知错误",e)}})();
package/package.json CHANGED
@@ -1,35 +1,38 @@
1
1
  {
2
2
  "name": "nry",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "泥豆君",
7
7
  "email": "Mr.MudBean@outlook.com",
8
- "url": "https://earthnut.dev"
8
+ "url": "https://mudbean.cn"
9
9
  },
10
- "license": "MIT",
11
10
  "description": "更替及管理 npm、yarn、pnpm registry",
11
+ "license": "MIT",
12
12
  "files": [
13
13
  "bin.js",
14
14
  "LICENSE",
15
15
  "README.md",
16
- "THIRD-PARTY-LICENSES.txt"
16
+ "THIRD-PARTY-LICENSES.txt",
17
+ "CHANGELOG.md"
17
18
  ],
18
19
  "keywords": [
19
20
  "nry",
20
21
  "npm",
21
22
  "pnpm",
22
23
  "yarn",
23
- "registry"
24
+ "registry",
25
+ "mudbean",
26
+ "vvi"
24
27
  ],
25
- "homepage": "https://earthnut.dev/npm/nry",
28
+ "homepage": "https://npms.gleanings.cn/nry",
26
29
  "bugs": {
27
- "url": "https://github.com/MrMudBean/nry/issues",
30
+ "url": "https://github.com/gleanings/nry/issues",
28
31
  "email": "Mr.MudBean@outlook.com"
29
32
  },
30
33
  "repository": {
31
34
  "type": "git",
32
- "url": "git+https://github.com/MrMudBean/nry.git"
35
+ "url": "git+https://github.com/gleanings/nry.git"
33
36
  },
34
37
  "publishConfig": {
35
38
  "access": "public",
@@ -1,254 +0,0 @@
1
- THIRD-PARTY LICENSE
2
- ==================================================
3
-
4
- a-js-tools (2.0.1)
5
- ------------------------------
6
- # MIT License
7
-
8
- Copyright (c) <2024> <Mr.MudBean>
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted, provided that the above
12
- copyright notice and this permission notice appear in all copies.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
-
22
- # MIT 许可证
23
-
24
- 版权所有 (c) [2024] [泥豆君]
25
-
26
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
27
-
28
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
29
-
30
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
31
-
32
- a-type-of-js (2.0.0)
33
- ------------------------------
34
- # MIT License
35
-
36
- Copyright (c) <2025> <Mr.MudBean>
37
-
38
- Permission to use, copy, modify, and/or distribute this software for any
39
- purpose with or without fee is hereby granted, provided that the above
40
- copyright notice and this permission notice appear in all copies.
41
-
42
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
43
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
44
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
45
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
46
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
47
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
48
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
49
-
50
- # MIT 许可证
51
-
52
- 版权所有 (c) [2025] [花生亻]
53
-
54
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
55
-
56
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
57
-
58
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
59
-
60
- @qqi/log (1.0.0)
61
- ------------------------------
62
- # MIT License
63
-
64
- Copyright (c) <2025> <Mr.MudBean>
65
-
66
- Permission to use, copy, modify, and/or distribute this software for any
67
- purpose with or without fee is hereby granted, provided that the above
68
- copyright notice and this permission notice appear in all copies.
69
-
70
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
71
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
72
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
73
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
74
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
75
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
76
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
77
-
78
- # MIT 许可证
79
-
80
- 版权所有 (c) [2025] [泥豆君]
81
-
82
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
83
-
84
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
85
-
86
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
87
-
88
- @color-pen/static (1.1.1)
89
- ------------------------------
90
- # MIT License
91
-
92
- Copyright (c) <2025> <Mr.MudBean>
93
-
94
- Permission to use, copy, modify, and/or distribute this software for any
95
- purpose with or without fee is hereby granted, provided that the above
96
- copyright notice and this permission notice appear in all copies.
97
-
98
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
99
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
100
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
101
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
102
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
103
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
104
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
105
-
106
- # MIT 许可证
107
-
108
- 版权所有 (c) [2025] [泥豆君]
109
-
110
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
111
-
112
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
113
-
114
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
115
-
116
- color-pen (3.0.0)
117
- ------------------------------
118
- # MIT License
119
-
120
- Copyright (c) <2025> <Mr.MudBean>
121
-
122
- Permission to use, copy, modify, and/or distribute this software for any
123
- purpose with or without fee is hereby granted, provided that the above
124
- copyright notice and this permission notice appear in all copies.
125
-
126
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
127
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
128
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
129
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
130
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
131
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
132
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
133
-
134
- # MIT 许可证
135
-
136
- 版权所有 (c) [2025] [泥豆君]
137
-
138
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
139
-
140
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
141
-
142
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
143
-
144
- a-node-tools (4.4.2)
145
- ------------------------------
146
- # MIT License
147
-
148
- Copyright (c) <2024> <Mr.MudBean>
149
-
150
- Permission to use, copy, modify, and/or distribute this software for any
151
- purpose with or without fee is hereby granted, provided that the above
152
- copyright notice and this permission notice appear in all copies.
153
-
154
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
155
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
156
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
157
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
158
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
159
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
160
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
161
-
162
- # MIT 许可证
163
-
164
- 版权所有 (c) [2024] [泥豆君]
165
-
166
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
167
-
168
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
169
-
170
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
171
-
172
- a-command (3.0.1)
173
- ------------------------------
174
- # MIT License
175
-
176
- Copyright (c) <2024> <MrMudBean>
177
-
178
- Permission to use, copy, modify, and/or distribute this software for any
179
- purpose with or without fee is hereby granted, provided that the above
180
- copyright notice and this permission notice appear in all copies.
181
-
182
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
183
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
184
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
185
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
186
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
187
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
188
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
189
-
190
- # MIT 许可证
191
-
192
- 版权所有 (c) [2024] [泥豆君]
193
-
194
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
195
-
196
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
197
-
198
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
199
-
200
- qqi (1.0.0)
201
- ------------------------------
202
- # MIT License
203
-
204
- Copyright (c) <2025> <Mr.MudBean>
205
-
206
- Permission to use, copy, modify, and/or distribute this software for any
207
- purpose with or without fee is hereby granted, provided that the above
208
- copyright notice and this permission notice appear in all copies.
209
-
210
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
211
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
212
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
213
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
214
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
215
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
216
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
217
-
218
- # MIT 许可证
219
-
220
- 版权所有 (c) [2025] [泥豆君]
221
-
222
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
223
-
224
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
225
-
226
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
227
-
228
- colored-table (0.2.0)
229
- ------------------------------
230
- # MIT License
231
-
232
- Copyright (c) <2025> <Mr.MudBean>
233
-
234
- Permission to use, copy, modify, and/or distribute this software for any
235
- purpose with or without fee is hereby granted, provided that the above
236
- copyright notice and this permission notice appear in all copies.
237
-
238
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
239
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
240
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
241
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
242
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
243
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
244
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
245
-
246
- # MIT 许可证
247
-
248
- 版权所有 (c) [2025] [泥豆君]
249
-
250
- 特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
251
-
252
- 上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
253
-
254
- 软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。