@doubao-dev/cli 1.0.0-rc.11 → 1.0.0-rc.13

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/README.md CHANGED
@@ -20,6 +20,6 @@ App 工具按需从 npm 下载 `@doubao-dev/plugin-app-dev` 和 `@doubao-dev/kit
20
20
  通过 `DBX_KIT_PATH=/path/to/kit dbx dev --app` 使用本地 Kit 包;相对路径以当前工作目录为基准,跳过版本检查,路径或 SDK 入口无效时报错。
21
21
  Kit 默认版本随 CLI 固定。可用 `DBX_KIT_VERSION` 指定准确版本。用 `dbx --help` 查看命令,用 `dbx skills` 同步项目开发指引。
22
22
 
23
- 直接运行 `dbx init` 会询问项目名,并按发布类型显示可选能力。公开项目可选普通插件、普通插件(含 App)或定制工作台,企业专属项目可选普通插件或定制工作台。
23
+ 直接运行 `dbx init` 会询问项目名,并按发布类型显示可选能力。公开项目可选普通插件、应用插件或定制工作台,企业专属项目可选普通插件或定制工作台。
24
24
 
25
- `dbx dev` 在定制工作台项目中默认调试工作台,普通插件默认调试 Skill / MCP。含 App 时可在交互终端选择调试 App。`dbx dev --plugin`、`dbx dev --app` 和 `dbx dev --workbench` 显式指定目标,三个参数互斥。工作台调试将工作台和同工程的 MCP 同步到当前账号。交互终端调试 App 时,CLI 按需安装同版本的 TUI renderer。Skill / MCP 调试和非 TTY 环境使用普通日志。
25
+ `dbx dev` 在定制工作台项目中默认调试工作台,普通插件默认调试 Skill / MCP。应用插件可在交互终端选择调试 App。`dbx dev --plugin`、`dbx dev --app` 和 `dbx dev --workbench` 显式指定目标,三个参数互斥。工作台调试将工作台和同工程的 MCP 同步到当前账号。交互终端调试 App 时,CLI 按需安装同版本的 TUI renderer。Skill / MCP 调试和非 TTY 环境使用普通日志。
package/dist/691.js CHANGED
@@ -26,7 +26,7 @@ ${e}`})(tQ(e)&&tJ in e?e.originalMessage:String(e?.message??e),t));return""===r?
26
26
  ${E}`,w=`${F}: ${s}${C}`,_=[w,...void 0===t?[e[2],e[1]]:[t],...e.slice(3),r.map(e=>{let t;return"string"==typeof(t=e)?t:S(t)}).join("\n")].map(e=>{let t;return tp(nw(Array.isArray(t=e)?t.map(e=>nw(n0(e))).filter(Boolean).join("\n"):n0(t)))}).filter(Boolean).join("\n\n");return{originalMessage:E,shortMessage:w,message:_}})({stdio:d,all:p,ipcOutput:f,originalError:e,signal:w,signalDescription:_,exitCode:C,escapedCommand:r,timedOut:o,isCanceled:u,isGracefullyCanceled:a,isMaxBuffer:s,isForcefullyTerminated:l,forceKillAfterDelay:b,killSignal:y,maxBuffer:F,timeout:m,cwd:g}),A=new(E?tZ:tX)(T,e instanceof tK?{}:{cause:e});return Object.assign(A,n3({error:A,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:u,isGracefullyCanceled:a,isMaxBuffer:s,isForcefullyTerminated:l,exitCode:C,signal:w,signalDescription:_,stdio:d,all:p,ipcOutput:f,cwd:g,originalMessage:v,shortMessage:B})),A},n3=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:u,isGracefullyCanceled:a,isMaxBuffer:s,isForcefullyTerminated:l,exitCode:D,signal:c,signalDescription:d,stdio:p,all:f,ipcOutput:h,cwd:m,originalMessage:b,shortMessage:y})=>n6({shortMessage:y,originalMessage:b,command:t,escapedCommand:r,cwd:m,durationMs:tz(n),failed:!0,timedOut:o,isCanceled:u,isGracefullyCanceled:a,isTerminated:void 0!==c,isMaxBuffer:s,isForcefullyTerminated:l,exitCode:D,signal:c,signalDescription:d,code:e.cause?.code,stdout:p[1],stderr:p[2],all:f,stdio:p,ipcOutput:h,pipedFrom:[]}),n6=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e)),n9=(e,t)=>{let r=null===t?void 0:t,n=void 0===r?void 0:ro(t);return{exitCode:null===e?void 0:e,signal:r,signalDescription:n}},n7=e=>Number.isFinite(e)?e:0,n4=24n*60n*60n*1000n,n5=(e,t,{reject:r})=>{if((({verbose:e})=>"none"!==tl(e,void 0))(t)){var n,o;e.failed&&tI({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e}),n=e,o=t,tI({type:"duration",verboseMessage:`(done in ${function(e,t){let r="bigint"==typeof e;if(!r&&!Number.isFinite(e))throw TypeError("Expected a finite number or bigint");t={...t};let n=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],u=(e,r,n,u)=>{if(!((0===o.length||!t.colonNotation)&&(0===e||0n===e))||t.colonNotation&&"m"===n){if(u??=String(e),t.colonNotation){let e=u.includes(".")?u.split(".")[0].length:u.length,t=o.length>0?2:1;u="0".repeat(Math.max(0,t-e))+u}else u+=t.verbose?" "+(1===e||1n===e?r:`${r}s`):n;o.push(u)}},a=function(e){switch(typeof e){case"number":if(Number.isFinite(e))return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(n7(1e3*e)%1e3),nanoseconds:Math.trunc(n7(1e6*e)%1e3)};break;case"bigint":return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}throw TypeError("Expected a finite number or bigint")}(e),s=BigInt(a.days);if(t.hideYearAndDays?u(24n*BigInt(s)+BigInt(a.hours),"hour","h"):(t.hideYear?u(s,"day","d"):(u(s/365n,"year","y"),u(s%365n,"day","d")),u(Number(a.hours),"hour","h")),u(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let e=Number(a.seconds),r=Number(a.milliseconds),n=Number(a.microseconds),o=Number(a.nanoseconds);if(u(e,"second","s"),t.formatSubMilliseconds)u(r,"millisecond","ms"),u(n,"microsecond","\xb5s"),u(o,"nanosecond","ns");else{let e=r+n/1e3+o/1e6,a="number"==typeof t.millisecondsDecimalDigits?t.millisecondsDecimalDigits:0,s=e>=1?Math.round(e):Math.ceil(e),l=a?e.toFixed(a):s;u(Number.parseFloat(l),"millisecond","ms",l)}}else{let n=(r?Number(e%n4):e)/1e3%60,o="number"==typeof t.secondsDecimalDigits?t.secondsDecimalDigits:1,a=(Math.round(Math.floor(n*10**o+1e-7))/10**o).toFixed(o),s=t.keepDecimalsOnWholeSeconds?a:a.replace(/\.0+$/,"");u(Number.parseFloat(s),"second","s",s)}if(0===o.length)return n+"0"+(t.verbose?" milliseconds":"ms");let l=t.colonNotation?":":" ";return"number"==typeof t.unitCount&&(o=o.slice(0,Math.max(t.unitCount,1))),n+o.join(l)}(n.durationMs)})`,verboseInfo:o,result:n})}if(e.failed&&r)throw e;return e},oe=(e,t)=>(or(e,t,"Duplex stream"),"duplex"),ot=(e,t)=>(or(e,t,"web TransformStream"),"webTransform"),or=({final:e,binary:t,objectMode:r},n,o)=>{on(e,`${n}.final`,o),on(t,`${n}.binary`,o),oi(r,`${n}.objectMode`)},on=(e,t,r)=>{if(void 0!==e)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},oo=({transform:e,final:t,binary:r,objectMode:n},o)=>{if(void 0!==e&&!ou(e))throw TypeError(`The \`${o}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(n$(t,{checkOpen:!1}))throw TypeError(`The \`${o}.final\` option must not be a Duplex stream.`);if(oh(t))throw TypeError(`The \`${o}.final\` option must not be a web TransformStream.`);if(void 0!==t&&!ou(t))throw TypeError(`The \`${o}.final\` option must be a generator.`);return oi(r,`${o}.binary`),oi(n,`${o}.objectMode`),oa(e)||oa(t)?"asyncGenerator":"generator"},oi=(e,t)=>{if(void 0!==e&&"boolean"!=typeof e)throw TypeError(`The \`${t}\` option must use a boolean.`)},ou=e=>oa(e)||os(e),oa=e=>"[object AsyncGeneratorFunction]"===Object.prototype.toString.call(e),os=e=>"[object GeneratorFunction]"===Object.prototype.toString.call(e),ol=e=>"[object URL]"===Object.prototype.toString.call(e),oD=new Set(["file","append"]),oc=e=>"string"==typeof e,od=new Set(["ipc","ignore","inherit","overlapped","pipe"]),op=e=>"[object ReadableStream]"===Object.prototype.toString.call(e),of=e=>"[object WritableStream]"===Object.prototype.toString.call(e),oh=e=>op(e?.readable)&&of(e?.writable),om=e=>"object"==typeof e&&null!==e,ob=new Set(["generator","asyncGenerator","duplex","webTransform"]),oy=new Set(["fileUrl","filePath","fileNumber"]),og=new Set(["fileUrl","filePath"]),oF=new Set([...og,"webStream","nodeStream"]),oE=new Set(["webTransform","duplex"]),oC={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"},ow=(e,t,r,n)=>"output"===n?o_(e,t,r):ov(e,t,r),o_=(e,t,r)=>{let n=0!==t&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:e??n}},ov=(e,t,r)=>{let n=0===t?!0===e:r[t-1].value.readableObjectMode,o=t!==r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},oS=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:n,optionName:o,direction:u,encoding:a})=>"duplex"===t?oB({stdioItem:e,optionName:o}):"webTransform"===t?oT({stdioItem:e,index:r,newTransforms:n,direction:u}):oA({stdioItem:e,index:r,newTransforms:n,direction:u,encoding:a}),oB=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:o=n}},optionName:u})=>{if(o&&!n)throw TypeError(`The \`${u}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!o&&n)throw TypeError(`The \`${u}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:n}}},oT=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{let{transform:u,objectMode:a}=e$(t)?t:{transform:t},{writableObjectMode:s,readableObjectMode:l}=ow(a,r,n,o);return{...e,value:{transform:u,writableObjectMode:s,readableObjectMode:l}}},oA=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:n,direction:o,encoding:u})=>{let{transform:a,final:s,binary:l=!1,preserveNewlines:D=!1,objectMode:c}=e$(t)?t:{transform:t},d=l||np.has(u),{writableObjectMode:p,readableObjectMode:f}=ow(c,r,n,o);return{...e,value:{transform:a,final:s,binary:d,preserveNewlines:D,writableObjectMode:p,readableObjectMode:f}}},oR=(e,t)=>"input"===t?e.reverse():e,ox=["input","output","output"],oP=()=>void 0,o$=()=>"input",oO={generator:oP,asyncGenerator:oP,fileUrl:oP,filePath:oP,iterable:o$,asyncIterable:o$,uint8Array:o$,webStream:e=>of(e)?"output":"input",nodeStream:e=>nP(e,{checkOpen:!1})?nx(e,{checkOpen:!1})?void 0:"input":"output",webTransform:oP,duplex:oP,native(e){let t=ok(e);return void 0!==t?t:nR(e,{checkOpen:!1})?oO.nodeStream(e):void 0}},ok=e=>[0,R.stdin].includes(e)?"input":[1,2,R.stdout,R.stderr].includes(e)?"output":void 0,oj=e=>e8.some(t=>void 0!==e[t]),oI=(e,t)=>Array.isArray(e)?e.map(e=>oI(e,t)):null==e?t>=e8.length?"ignore":"pipe":e,oL=e=>"pipe"===e||Array.isArray(e)&&e.every(e=>"pipe"===e),oM=({value:e,optionName:t,fdNumber:r,direction:n})=>{let o=oU(e,r);if(void 0!==o){if("output"===n)return{type:"fileNumber",value:o,optionName:t};if(I.isatty(o))throw TypeError(`The \`${t}: ${r$(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:eN(et(o)),optionName:t}}},oU=(e,t)=>{if("inherit"===e)return t;if("number"==typeof e)return e;let r=e1.indexOf(e);if(-1!==r)return r},oN=(e,t,r)=>{let n=e1[e];if(void 0===n)throw TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n},oW=e=>{if(nP(e,{checkOpen:!1}))return"nodeStream";if("string"==typeof e)return"string";if(eU(e))return"uint8Array";throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},oq=e=>{if(ol(e))return{type:"fileUrl",value:e};if(oc(e))return{type:"filePath",value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")},oz=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{let u=e.filter(e=>oH(e,r));if(0!==u.length)return oG(u.find(e=>e.direction!==o),n,t),"output"===o?u[0].stream:void 0},oH=({type:e,value:t},r)=>"filePath"===e?t.file===r.file:"fileUrl"===e?t.href===r.href:t===r,oG=(e,t,r)=>{if(void 0!==e)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${oC[r]} that is the same.`)},oV=(e,t,r,n)=>{let o=o1({initialFileDescriptors:(({stdio:e,ipc:t,buffer:r,...n},o,u)=>{let a,s,l,D=((e,t)=>{if(void 0===e)return e8.map(e=>t[e]);if(oj(t))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${e8.map(e=>`\`${e}\``).join(", ")}`);if("string"==typeof e)return[e,e,e];if(!Array.isArray(e))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);return Array.from({length:Math.max(e.length,e8.length)},(t,r)=>e[r])})(e,n).map((e,t)=>oI(e,t));return u?(a=D,s=r,l=o,a.map((e,t)=>!s[t]&&0!==t&&!ts(l,t)&&oL(e)?"ignore":e)):t&&!D.includes("ipc")?[...D,"ipc"]:D})(t,r,n).map((e,r)=>oK({stdioOption:e,fdNumber:r,options:t,isSync:n})),addProperties:e,options:t,isSync:n});return t.stdio=o.map(({stdioItems:e})=>o9(e)),o},oK=({stdioOption:e,fdNumber:t,options:r,isSync:n})=>{let o,u,a=e3(t),{stdioItems:s,isStdioArray:l}=oY({stdioOption:e,fdNumber:t,options:r,optionName:a}),D=((e,t,r)=>{let n=e.map(e=>(({type:e,value:t},r)=>ox[r]??oO[e](t))(e,t));if(n.includes("input")&&n.includes("output"))throw TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return n.find(Boolean)??"output"})(s,t,a),c=(o=s.map(e=>(({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:u})=>r&&"native"===t?u?(({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{let u=oM({value:t,optionName:r,fdNumber:n,direction:o});if(void 0!==u)return u;if(nR(t,{checkOpen:!1}))throw TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e})({stdioItem:e,fdNumber:n,direction:o}):(({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>"inherit"===t?{type:"nodeStream",value:oN(n,t,r),optionName:r}:"number"==typeof t?{type:"nodeStream",value:oN(t,t,r),optionName:r}:nR(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e)({stdioItem:e,fdNumber:n}):e)({stdioItem:e,isStdioArray:l,fdNumber:t,direction:D,isSync:n})),[...o.filter(({type:e})=>!ob.has(e)),...((e,t,r,{encoding:n})=>{let o=e.filter(({type:e})=>ob.has(e)),u=Array.from({length:o.length});for(let[e,a]of Object.entries(o))u[e]=oS({stdioItem:a,index:Number(e),newTransforms:u,optionName:t,direction:r,encoding:n});return oR(u,r)})(o,a,D,r)]),d=void 0!==(u=c.findLast(({type:e})=>ob.has(e)))&&("input"===D?u.value.writableObjectMode:u.value.readableObjectMode);return o2(c,d),{direction:D,objectMode:d,stdioItems:c}},oY=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let o,u=(o=[...(Array.isArray(e)?e:[e]).map(e=>oJ(e,n)),...(({input:e,inputFile:t},r)=>{let n,o;return 0===r?[...void 0===(n=e)?[]:[{type:oW(n),value:n,optionName:"input"}],...void 0===(o=t)?[]:[{...oq(o),optionName:"inputFile"}]]:[]})(r,t)]).filter((e,t)=>o.every((r,n)=>e.value!==r.value||t>=n||"generator"===e.type||"asyncGenerator"===e.type)),a=u.length>1;return oQ(u,a,n),oZ(u),{stdioItems:u,isStdioArray:a}},oJ=(e,t)=>{let r,n,o,u,a,s,l;return{type:oa(e)?"asyncGenerator":os(e)?"generator":ol(e)?"fileUrl":e$(r=e)&&Object.keys(r).length>0&&Object.keys(r).every(e=>oD.has(e))&&oc(r.file)?"filePath":op(n=e)||of(n)?"webStream":nR(e,{checkOpen:!1})?"native":eU(e)?"uint8Array":om(o=e)&&"function"==typeof o[Symbol.asyncIterator]?"asyncIterable":om(u=e)&&"function"==typeof u[Symbol.iterator]?"iterable":oh(e)?ot({transform:e},t):e$(a=e)&&(void 0!==a.transform||void 0!==a.final)?(s=e,l=t,n$(s.transform,{checkOpen:!1})?oe(s,l):oh(s.transform)?ot(s,l):oo(s,l)):"native",value:e,optionName:t}},oQ=(e,t,r)=>{if(0===e.length)throw TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:t,optionName:r}of e)if(oX.has(t))throw Error(`The \`${r}\` option must not include \`${t}\`.`)}},oX=new Set(["ignore","ipc"]),oZ=e=>{for(let t of e)o0(t)},o0=({type:e,value:t,optionName:r})=>{if(ol(t)&&"file:"!==t.protocol)throw TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
27
27
  For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if("native"===e&&"string"==typeof t&&!od.has(t))throw TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},o2=(e,t)=>{if(!t)return;let r=e.find(({type:e})=>oy.has(e));if(void 0!==r)throw TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},o1=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let u of e)o.push(o8({fileDescriptor:u,fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(e){throw o6(o),e}},o8=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:u,isSync:a})=>{let s=r.map(t=>o3({stdioItem:t,addProperties:o,direction:e,options:u,fileDescriptors:n,isSync:a}));return{direction:e,objectMode:t,stdioItems:s}},o3=({stdioItem:e,addProperties:t,direction:r,options:n,fileDescriptors:o,isSync:u})=>{let a=(({stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:u})=>{let a,s,l=(a=o,s=e,a.flatMap(({direction:e,stdioItems:t})=>t.filter(e=>e.type===s).map(t=>({...t,direction:e}))));if(0!==l.length){if(u)return void(({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{og.has(t)&&oz({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})})({otherStdioItems:l,type:e,value:t,optionName:r,direction:n});if(oF.has(e))return oz({otherStdioItems:l,type:e,value:t,optionName:r,direction:n});oE.has(e)&&(({otherStdioItems:e,type:t,value:r,optionName:n})=>{oG(e.find(({value:{transform:e}})=>e===r.transform),n,t)})({otherStdioItems:l,type:e,value:t,optionName:r})}})({stdioItem:e,direction:r,fileDescriptors:o,isSync:u});return void 0!==a?{...e,stream:a}:{...e,...t[r][e.type](e,n)}},o6=e=>{for(let{stdioItems:t}of e)for(let{stream:e}of t)void 0===e||e2(e)||e.destroy()},o9=e=>{if(e.length>1)return e.some(({value:e})=>"overlapped"===e)?"overlapped":"pipe";let[{type:t,value:r}]=e;return"native"===t?r:"pipe"},o7=({type:e,optionName:t})=>{o4(t,oC[e])},o4=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},o5={generator(){},asyncGenerator:o7,webStream:o7,nodeStream:o7,webTransform:o7,duplex:o7,asyncIterable:o7,native:({optionName:e,value:t})=>(("ipc"===t||"overlapped"===t)&&o4(e,`"${t}"`),{})},ie={input:{...o5,fileUrl:({value:e})=>({contents:[eN(et(e))]}),filePath:({value:{file:e}})=>({contents:[eN(et(e))]}),fileNumber:o7,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...o5,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:o7,string:o7,uint8Array:o7}},it=(e,{stripFinalNewline:t},r)=>ir(t,r)&&void 0!==e&&!Array.isArray(e)?nw(e):e,ir=(e,t)=>"all"===t?e[1]||e[2]:e[t],io=(e,t,r,n)=>e||r?void 0:ia(t,n),ii=(e,t,r)=>r?e.flatMap(e=>iu(e,t)):iu(e,t),iu=(e,t)=>{let{transform:r,final:n}=ia(t,{});return[...r(e),...n()]},ia=(e,t)=>(t.previousChunks="",{transform:is.bind(void 0,t,e),final:iD.bind(void 0,t)}),is=function*(e,t,r){if("string"!=typeof r)return void(yield r);let{previousChunks:n}=e,o=-1;for(let u=0;u<r.length;u+=1)if("\n"===r[u]){let a=il(r,u,t,e),s=r.slice(o+1,u+1-a);n.length>0&&(s=id(n,s),n=""),yield s,o=u}o!==r.length-1&&(n=id(n,r.slice(o+1))),e.previousChunks=n},il=(e,t,r,n)=>r?0:(n.isWindowsNewline=0!==t&&"\r"===e[t-1],n.isWindowsNewline?2:1),iD=function*({previousChunks:e}){e.length>0&&(yield e)},ic=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:u}="string"==typeof t?ip:ih;t.at(-1)===o?yield t:yield u(t,e?n:r)},id=(e,t)=>`${e}${t}`,ip={windowsNewline:"\r\n",unixNewline:"\n",LF:"\n",concatBytes:id},ih={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}},im=function*(e,t){if("string"!=typeof t&&!eU(t)&&!ed.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},ib=function*(e,t){ig(e,t),yield t},iy=function*(e,t){if(ig(e,t),"string"!=typeof t&&!eU(t))throw TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},ig=(e,t)=>{if(null==t)throw TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
28
28
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
29
- if (condition) { yield value; }`)},iF=(e,t,r)=>{if(r)return;if(e)return{transform:iE.bind(void 0,new TextEncoder)};let n=new E(t);return{transform:iC.bind(void 0,n),final:iw.bind(void 0,n)}},iE=function*(e,t){ed.isBuffer(t)?yield eN(t):"string"==typeof t?yield e.encode(t):yield t},iC=function*(e,t){yield eU(t)?e.write(t):t},iw=function*(e){let t=e.end();""!==t&&(yield t)},i_=w(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let e of t.currentIterable)n.push(e)}finally{delete t.currentIterable}}),iv=async function*(e,t,r){if(r===t.length)return void(yield e);let{transform:n=iA}=t[r];for await(let o of n(e))yield*iv(o,t,r+1)},iS=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*iB(r,Number(t),e)},iB=async function*(e,t,r){if(void 0!==e)for await(let n of e())yield*iv(n,r,t+1)},iT=w(async({currentIterable:e},t)=>{if(void 0!==e)return void await (t?e.throw(t):e.return());if(t)throw t}),iA=function*(e){yield e},iR=(e,t,r,n)=>{try{for(let n of e(...t))r.push(n);n()}catch(e){n(e)}},ix=(e,t)=>[...t.flatMap(t=>[...iP(t,e,0)]),...i$(e)],iP=function*(e,t,r){if(r===t.length)return void(yield e);let{transform:n=ik}=t[r];for(let o of n(e))yield*iP(o,t,r+1)},i$=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*iO(r,Number(t),e)},iO=function*(e,t,r){if(void 0!==e)for(let n of e())yield*iP(n,r,t+1)},ik=function*(e){yield e},ij=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:u},{encoding:a})=>{let s={},l=iL(e,a,u),D=oa(t),c=oa(r),d=D?i_.bind(void 0,iv,s):iR.bind(void 0,iP),p=D||c?i_.bind(void 0,iS,s):iR.bind(void 0,i$),f=D||c?iT.bind(void 0,s):void 0;return{stream:new es({writableObjectMode:n,writableHighWaterMark:eD(n),readableObjectMode:o,readableHighWaterMark:eD(o),transform(e,t,r){d([e,l,0],this,r)},flush(e){p([l],this,e)},destroy:f})}},iI=(e,t,r,n)=>{let o=t.filter(({type:e})=>"generator"===e);for(let{value:t,optionName:u}of n?o.reverse():o)e=ix(iL(t,r,u),e);return e},iL=({transform:e,final:t,binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:u},a,s)=>{let l={};return[{transform:n?void 0:im.bind(void 0,s)},iF(r,a,n),io(r,u,n,l),{transform:e,final:t},{transform:o?ib.bind(void 0,s):iy.bind(void 0,s)},(({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:ic.bind(void 0,n)})({binary:r,preserveNewlines:u,readableObjectMode:o,state:l})].filter(Boolean)},iM=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:e})=>void 0!==e);if(0!==o.length){if(0!==t){let[{type:e,optionName:t}]=o;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${oC[e]} with synchronous methods.`)}r.input=ez(o.map(({contents:e})=>e).map(e=>iU(e,n)))}},iU=(e,t)=>{let r=iI(e,t,"utf8",!0);return iN(r),ez(r)},iN=e=>{let t=e.find(e=>"string"!=typeof e&&!eU(e));if(void 0!==t)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)},iW=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>"all"!==n&&ts(r,n)&&!np.has(t)&&iq(n)&&(e.some(({type:e,value:t})=>"native"===e&&iz.has(t))||e.every(({type:e})=>ob.has(e))),iq=e=>1===e||2===e,iz=new Set(["pipe","overlapped"]),iH=async(e,t,r,n)=>{for await(let o of e)iG(t)||iV(o,r,n)},iG=e=>e._readableState.pipes.length>0,iV=(e,t,r)=>{tI({type:"output",verboseMessage:tN(e),fdNumber:t,verboseInfo:r})},iK=(e,t,r,n)=>{try{return iI(e,t,r,!1)}catch(t){return n.error=t,e}},iY=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:u})=>{if(t)return{serializedResult:e};if("buffer"===r)return{serializedResult:ez(e)};let a=((e,t)=>{if("utf8"===t&&e.every(e=>"string"==typeof e))return e;let r=new E(t),n=e.map(e=>"string"==typeof e?eW.encode(e):e).map(e=>r.write(e)),o=r.end();return""===o?n:[...n,o]})(e,r).join("");return n[u]?{serializedResult:a,finalResult:ii(a,!o[u],t)}:{serializedResult:a}},iJ=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:u,objectMode:a})=>{if(!iW({stdioItems:u,encoding:o,verboseInfo:n,fdNumber:t}))return;let s=ii(e,!1,a);try{for(let e of s)iV(e,t,n)}catch(e){r.error??=e}},iQ=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:e})=>oy.has(e))){let t="string"==typeof n?n:n.toString();o||r.has(t)?Q(n,e):(r.add(t),en(n,e))}},iX=async(e,t)=>{let[r,n]=await iZ(e);return t.isForcefullyTerminated??=!1,[r,n]},iZ=async e=>{let[t,r]=await Promise.allSettled([V(e,"spawn"),V(e,"exit")]);return"rejected"===t.status?[]:"rejected"===r.status?i0(e):r.value},i0=async e=>{try{return await V(e,"exit")}catch{return i0(e)}},i2=async e=>{let[t,r]=await e;if(!i1(t,r)&&i8(t,r))throw new tK;return[t,r]},i1=(e,t)=>void 0===e&&void 0===t,i8=(e,t)=>0!==e||null!==t,i3=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,i6=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&i9("ipcInput"),e&&i9("ipc: true"),r&&i9("detached: true"),n&&i9("cancelSignal")},i9=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},i7=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:u,startTime:a})=>{try{let n;for(let e of(n=u,new Set(Object.entries(n).filter(([,{direction:e}])=>"input"===e).map(([e])=>Number(e)))))iM(u,e,r);let o=i4(r);return F(...nC(e,t,o))}catch(e){return n1({error:e,command:n,escapedCommand:o,fileDescriptors:u,options:r,startTime:a,isSync:!0})}},i4=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:(([,e])=>e)(t)}),i5=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:u,all:a,options:s,command:l,escapedCommand:D,startTime:c})=>void 0===e?n2({command:l,escapedCommand:D,stdio:u,all:a,ipcOutput:[],options:s,startTime:c}):n8({error:e,command:l,escapedCommand:D,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:u,all:a,ipcOutput:[],options:s,startTime:c,isSync:!0}),ue=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:u}={})=>(rd({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:rH(e)}),ut({anyProcess:e,channel:t,isSubprocess:r,filter:u,reference:o})),ut=async({anyProcess:e,channel:t,isSubprocess:r,filter:n,reference:o})=>{rk(t,o);let u=rW(e,t,r),a=new AbortController;try{return await Promise.race([ur(u,n,a),un(u,r,a),uo(u,r,a)])}catch(t){throw rE(e),t}finally{a.abort(),rI(t,o)}},ur=async(e,t,{signal:r})=>{if(void 0===t){let[t]=await V(e,"message",{signal:r});return t}for await(let[n]of G(e,"message",{signal:r}))if(t(n))return n},un=async(e,t,{signal:r})=>{await V(e,"disconnect",{signal:r});throw Error(`${ry("getOneMessage",t)} could not complete: the ${rF(t)} exited or disconnected.`)},uo=async(e,t,{signal:r})=>{let[n]=await V(e,"strict:error",{signal:r});throw rh(n,t)},ui=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>uu({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:!r,reference:o}),uu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:u})=>{rd({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:rH(e)}),rk(t,u);let a=rW(e,t,r),s=new AbortController,l={};return ua(e,a,s),us({ipcEmitter:a,isSubprocess:r,controller:s,state:l}),ul({anyProcess:e,channel:t,ipcEmitter:a,isSubprocess:r,shouldAwait:o,controller:s,state:l,reference:u})},ua=async(e,t,r)=>{try{await V(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},us=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await V(e,"strict:error",{signal:r.signal});n.error=rh(o,t),r.abort()}catch{}},ul=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:u,state:a,reference:s}){try{for await(let[e]of G(r,"message",{signal:u.signal}))uD(a),yield e}catch{uD(a)}finally{u.abort(),rI(t,s),n||rE(e),o&&await e}},uD=({error:e})=>{if(e)throw e},uc=(e,t,r)=>({sendMessage:r6.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:ue.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:ui.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}),ud=()=>{let e=new eu;return e.end(),e},up=()=>new ea({read(){}}),uf=()=>new el({write(){}}),uh=()=>new ei({read(){},write(){}}),um=async(e,t,r)=>n5(e,t,r),ub=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${oC[e]}.`)},uy={fileNumber:ub,generator:ij,asyncGenerator:ij,nodeStream:({value:e})=>({stream:e}),webTransform:({value:{transform:e,writableObjectMode:t,readableObjectMode:r}})=>({stream:ei.fromWeb(e,{objectMode:t||r})}),duplex:({value:{transform:e}})=>({stream:e}),native(){}},ug={input:{...uy,fileUrl:({value:e})=>({stream:X(e)}),filePath:({value:{file:e}})=>({stream:X(e)}),webStream:({value:e})=>({stream:ea.fromWeb(e)}),iterable:({value:e})=>({stream:ea.from(e)}),asyncIterable:({value:e})=>({stream:ea.from(e)}),string:({value:e})=>({stream:ea.from(e)}),uint8Array:({value:e})=>({stream:ea.from(ed.from(e))})},output:{...uy,fileUrl:({value:e})=>({stream:Z(e)}),filePath:({value:{file:e,append:t}})=>({stream:Z(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:el.fromWeb(e)}),iterable:ub,asyncIterable:ub,string:ub,uint8Array:ub}};function uF(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)uS(t);let t=e.some(({readableObjectMode:e})=>e),r=uE(e,t),n=new uC({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let t of e)n.add(t);return n}let uE=(e,t)=>0===e.length?eD(t):Math.max(...e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e));class uC extends eu{#u=new Set([]);#a=new Set([]);#s=new Set([]);#l;#D=Symbol("unpipe");#c=new WeakMap;add(e){if(uS(e),this.#u.has(e))return;this.#u.add(e),this.#l??=uw(this,this.#u,this.#D);let t=uB({passThroughStream:this,stream:e,streams:this.#u,ended:this.#a,aborted:this.#s,onFinished:this.#l,unpipeEvent:this.#D});this.#c.set(e,t),e.pipe(this,{end:!1})}async remove(e){if(uS(e),!this.#u.has(e))return!1;let t=this.#c.get(e);return void 0!==t&&(this.#c.delete(e),e.unpipe(this),await t,!0)}}let uw=async(e,t,r)=>{uI(e,uL);let n=new AbortController;try{await Promise.race([u_(e,n),uv(e,t,r,n)])}finally{n.abort(),uI(e,-uL)}},u_=async(e,{signal:t})=>{try{await ep(e,{signal:t,cleanup:!0})}catch(t){throw uP(e,t),t}},uv=async(e,t,r,{signal:n})=>{for await(let[o]of G(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},uS=e=>{if("function"!=typeof e?.pipe)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},uB=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:u,unpipeEvent:a})=>{uI(e,uM);let s=new AbortController;try{await Promise.race([uT(u,t,s),uA({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:s}),uR({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:a,controller:s})])}finally{s.abort(),uI(e,-uM)}r.size>0&&r.size===n.size+o.size&&(0===n.size&&o.size>0?uO(e):ux(e))},uT=async(e,t,{signal:r})=>{try{await e,r.aborted||uO(t)}catch(e){r.aborted||uP(t,e)}},uA=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:{signal:u}})=>{try{await ep(t,{signal:u,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(n){if(u.aborted||!r.has(t))return;u$(n)?o.add(t):uk(e,n)}},uR=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{signal:u}})=>{if(await V(e,o,{signal:u}),!e.readable)return V(u,"abort",{signal:u});t.delete(e),r.delete(e),n.delete(e)},ux=e=>{e.writable&&e.end()},uP=(e,t)=>{u$(t)?uO(e):uk(e,t)},u$=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",uO=e=>{(e.readable||e.writable)&&e.destroy()},uk=(e,t)=>{e.destroyed||(e.once("error",uj),e.destroy(t))},uj=()=>{},uI=(e,t)=>{let r=e.getMaxListeners();0!==r&&r!==1/0&&e.setMaxListeners(r+t)},uL=2,uM=1,uU=(e,t)=>{e.pipe(t),uN(e,t),uq(e,t)},uN=async(e,t)=>{if(!(e2(e)||e2(t))){try{await ep(e,{cleanup:!0,readable:!0,writable:!1})}catch{}uW(t)}},uW=e=>{e.writable&&e.end()},uq=async(e,t)=>{if(!(e2(e)||e2(t))){try{await ep(t,{cleanup:!0,readable:!1,writable:!0})}catch{}uz(e)}},uz=e=>{e.readable&&e.destroy()},uH=(e,t,r,n)=>{"output"===r?uU(e.stdio[n],t):uU(t,e.stdio[n]);let o=uG[n];void 0!==o&&(e[o]=t),e.stdio[n]=t},uG=["stdin","stdout","stderr"],uV=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:u})=>{if(void 0===t)return;uK(t,u);let[a,s]="output"===r?[t,e.stdio[n]]:[e.stdio[n],t],l=o.get(a)??[];o.set(a,[...l,s])},uK=(e,{signal:t})=>{e2(e)&&rO(e,uY,t)},uY=2,uJ=[];uJ.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&uJ.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&uJ.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");let uQ=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,uX=Symbol.for("signal-exit emitter"),uZ=globalThis,u0=Object.defineProperty.bind(Object);class u2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(uZ[uX])return uZ[uX];u0(uZ,uX,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let r=this.listeners[e],n=r.indexOf(t);-1!==n&&(0===n&&1===r.length?r.length=0:r.splice(n,1))}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let n=!1;for(let o of this.listeners[e])n=!0===o(t,r)||n;return"exit"===e&&(n=this.emit("afterExit",t,r)||n),n}}class u1{}class u8 extends u1{#d="win32"===u3.platform?"SIGINT":"SIGHUP";#p=new u2;#f;#h;#m;#b={};#y=!1;constructor(e){for(let t of(super(),this.#f=e,this.#b={},uJ))this.#b[t]=()=>{let r=this.#f.listeners(t),{count:n}=this.#p;if("object"==typeof e.__signal_exit_emitter__&&"number"==typeof e.__signal_exit_emitter__.count&&(n+=e.__signal_exit_emitter__.count),r.length===n){this.unload();let r=this.#p.emit("exit",null,t),n="SIGHUP"===t?this.#d:t;r||e.kill(e.pid,n)}};this.#m=e.reallyExit,this.#h=e.emit}onExit(e,t){if(!uQ(this.#f))return()=>{};!1===this.#y&&this.load();let r=t?.alwaysLast?"afterExit":"exit";return this.#p.on(r,e),()=>{this.#p.removeListener(r,e),0===this.#p.listeners.exit.length&&0===this.#p.listeners.afterExit.length&&this.unload()}}load(){if(!this.#y){for(let e of(this.#y=!0,this.#p.count+=1,uJ))try{let t=this.#b[e];t&&this.#f.on(e,t)}catch(e){}this.#f.emit=(e,...t)=>this.#g(e,...t),this.#f.reallyExit=e=>this.#F(e)}}unload(){this.#y&&(this.#y=!1,uJ.forEach(e=>{let t=this.#b[e];if(!t)throw Error("Listener not defined for signal: "+e);try{this.#f.removeListener(e,t)}catch(e){}}),this.#f.emit=this.#h,this.#f.reallyExit=this.#m,this.#p.count-=1)}#F(e){return uQ(this.#f)?(this.#f.exitCode=e||0,this.#p.emit("exit",this.#f.exitCode,null),this.#m.call(this.#f,this.#f.exitCode)):0}#g(e,...t){let r=this.#h;if(!("exit"===e&&uQ(this.#f)))return r.call(this.#f,e,...t);{"number"==typeof t[0]&&(this.#f.exitCode=t[0]);let n=r.call(this.#f,e,...t);return this.#p.emit("exit",this.#f.exitCode,null),n}}}let u3=globalThis.process,{onExit:u6,load:u9,unload:u7}=(r=uQ(u3)?new u8(u3):new class extends u1{onExit(){return()=>{}}load(){}unload(){}},{onExit:(e,t)=>r.onExit(e,t),load:()=>r.load(),unload:()=>r.unload()}),u4=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(u5,e)(r,...n),pipeOptions:e};if("string"==typeof r||r instanceof URL||ej(r)){if(Object.keys(e).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,u,a]=eL(r,...n);return{destination:t(u5)(o,u,a),pipeOptions:a}}if(rv.has(r)){if(Object.keys(e).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},u5=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),ae=({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>n1({error:e,command:at,escapedCommand:at,fileDescriptors:t,options:r,startTime:n,isSync:!1}),at="source.pipe(destination)",ar=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:u,value:a=u}]=await e;if(a.pipedFrom.includes(n)||a.pipedFrom.push(n),"rejected"===o)throw a;if("rejected"===t)throw n;return a},an=async e=>{try{await ep(e,{cleanup:!0,readable:!1,writable:!0})}catch{}ao.delete(e)},ao=new WeakMap,ai=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:u})=>{throw await C(e,t),await r.remove(t),ae({error:Error("Pipe canceled by `unpipeSignal` option."),fileDescriptors:n,sourceOptions:o,startTime:u})},au=(e,...t)=>{if(e$(t[0]))return au.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=(({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let u=$.bigint(),{destination:a,destinationStream:s,destinationError:l,from:D,unpipeSignal:c}=((e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:u,unpipeSignal:a}={}}=u4(e,t,...r),s=rw(n,u);return{destination:n,destinationStream:s,from:o,unpipeSignal:a}}catch(e){return{destinationError:e}}})(r,n,o),{sourceStream:d,sourceError:p}=((e,t)=>{try{return{sourceStream:r_(e,t)}}catch(e){return{sourceError:e}}})(e,D),{options:f,fileDescriptors:h}=rv.get(e);return{sourcePromise:t,sourceStream:d,sourceOptions:f,sourceError:p,destination:a,destinationStream:s,destinationError:l,unpipeSignal:c,fileDescriptors:h,startTime:u}})(e,...t),o=aa({...n,destination:r});return o.pipe=au.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},aa=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:u,destinationError:a,unpipeSignal:s,fileDescriptors:l,startTime:D})=>{let c=as(e,o);(({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:u,startTime:a})=>{let s=(({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>void 0!==t&&void 0!==n?n:void 0!==n?(uz(e),n):void 0!==t?(uW(r),t):void 0)({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(void 0!==s)throw ae({error:s,fileDescriptors:o,sourceOptions:u,startTime:a})})({sourceStream:t,sourceError:n,destinationStream:u,destinationError:a,fileDescriptors:l,sourceOptions:r,startTime:D});let d=new AbortController;try{var p,f,h,m;let e,n,o,a,b=(o=ao.has(u)?(p=t,f=u,(e=ao.get(f)).add(p),e):(h=t,m=u,n=uF([h]),uU(n,m),ao.set(m,n),n),rO(t,2,d.signal),rO(u,1,d.signal),an(u),o);return await Promise.race([ar(c),...(a={sourceStream:t,mergedStream:b,sourceOptions:r,fileDescriptors:l,startTime:D},void 0===s?[]:[ai(s,a)])])}finally{d.abort()}},as=(e,t)=>Promise.allSettled([e,t]),al=e=>e,aD=()=>void 0,ac=({contents:e})=>e,ad=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},ap=e=>e.length;async function af(e,t){return nH(e,ah,t)}let ah={init:()=>({contents:[]}),convertChunk:{string:al,buffer:al,arrayBuffer:al,dataView:al,typedArray:al,others:al},getSize:()=>1,truncateChunk:aD,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:aD,finalize:ac};async function am(e,t){return nH(e,aC,t)}let ab=new TextEncoder,ay=e=>new Uint8Array(e),ag=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),aF=e=>aE**Math.ceil(Math.log(e)/Math.log(aE)),aE=2,aC={init:()=>({contents:new ArrayBuffer(0)}),convertChunk:{string:e=>ab.encode(e),buffer:ay,arrayBuffer:ay,dataView:ag,typedArray:ag,others:ad},getSize:ap,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t,length:r},n)=>{let o="resize"in ArrayBuffer.prototype?((e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:aF(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r})(t,n):((e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(aF(t));return new Uint8Array(r).set(new Uint8Array(e),0),r})(t,n);return new Uint8Array(o).set(e,r),o},getFinalChunk:aD,finalize:({contents:e,length:t})=>"resize"in ArrayBuffer.prototype?e:e.slice(0,t)};async function aw(e,t){return nH(e,av,t)}let a_=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),av={init:()=>({contents:"",textDecoder:new TextDecoder}),convertChunk:{string:al,buffer:a_,arrayBuffer:a_,dataView:a_,typedArray:a_,others:ad},getSize:ap,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return""===t?void 0:t},finalize:ac},aS=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:u})=>{let a=new AbortController;return aB(t,a),aR({stream:e,controller:a,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,preserveNewlines:u})},aB=async(e,t)=>{try{await e}catch{}finally{t.abort()}},aT=({stream:e,onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:u})=>{let a=new AbortController;aA(t,a,e);let s=e.readableObjectMode&&!u;return aR({stream:e,controller:a,binary:"buffer"===n,shouldEncode:!s,encoding:n,shouldSplit:!s&&r,preserveNewlines:!o})},aA=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},aR=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a})=>a$({onStdoutChunk:G(e,"data",{signal:t.signal,highWaterMark:aP,highWatermark:aP}),controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a}),ax=eD(!0),aP=ax,a$=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a}){let s=aO({binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a});try{for await(let[t]of e)yield*iP(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*i$(s)}},aO=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[iF(e,r,!t),io(e,o,!n,{})].filter(Boolean),ak=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:u,lines:a,allMixed:s,stripFinalNewline:l,verboseInfo:D,streamInfo:c})=>{let d=aj({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:s,verboseInfo:D,streamInfo:c});if(!o)return void await Promise.all([aI(e),d]);let p=aT({stream:e,onStreamEnd:t,lines:a,encoding:n,stripFinalNewline:ir(l,r),allMixed:s}),[f]=await Promise.all([aL({stream:e,iterable:p,fdNumber:r,encoding:n,maxBuffer:u,lines:a}),d]);return f},aj=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:o,verboseInfo:u,streamInfo:{fileDescriptors:a}})=>{if(!iW({stdioItems:a[r]?.stdioItems,encoding:n,verboseInfo:u,fdNumber:r}))return;let s=aT({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});await iH(s,e,r,u)},aI=async e=>{await M(),null===e.readableFlowing&&e.resume()},aL=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:n,encoding:o,maxBuffer:u,lines:a})=>{try{if(t||a)return await af(r,{maxBuffer:u});if("buffer"===o)return new Uint8Array(await am(r,{maxBuffer:u}));return await aw(r,{maxBuffer:u})}catch(r){return aU((({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:u})=>{let a,s,l;if(!(e instanceof nQ))throw e;if("all"===u)return e;throw e.maxBufferInfo={fdNumber:u,unit:(a=r,s=n,l=o,a?"objects":s?"lines":"buffer"===l?"bytes":"characters")},t.destroy(),e})({error:r,stream:e,readableObjectMode:t,lines:a,encoding:o,fdNumber:n}))}},aM=async e=>{try{return await e}catch(e){return aU(e)}},aU=({bufferedData:e})=>"[object ArrayBuffer]"===eM.call(e)?new Uint8Array(e):e,aN=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let u=aW(e,r),a=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],ep(e,{cleanup:!0,signal:a.signal})])}catch(e){u.stdinCleanedUp||aH(e,t,r,n)}finally{a.abort()}},aW=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===t&&aq(e,r,n),n},aq=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{az(t,r),n.call(e,...o)}},az=({exitCode:e,signalCode:t},r)=>{(null!==e||null!==t)&&(r.stdinCleanedUp=!0)},aH=(e,t,r,n)=>{if(!aG(e,t,r,n))throw e},aG=(e,t,r,n=!0)=>r.propagating?aY(e)||aK(e):(r.propagating=!0,aV(r,t)===n?aY(e):aK(e)),aV=({fileDescriptors:e},t)=>"all"!==t&&"input"===e[t].direction,aK=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",aY=e=>e?.code==="EPIPE",aJ=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:u,allMixed:a,stripFinalNewline:s,verboseInfo:l,streamInfo:D})=>{if(!e)return;let c=aN(e,t,D);if(aV(D,t))return void await c;let[d]=await Promise.all([ak({stream:e,onStreamEnd:c,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:u,allMixed:a,stripFinalNewline:s,verboseInfo:l,streamInfo:D}),c]);return d},aQ=(e,t)=>{tI({type:"ipc",verboseMessage:tN(e),fdNumber:"ipc",verboseInfo:t})},aX=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:u})=>{if(!n)return o;let a=ts(u,"ipc"),s=ta(t,"ipc"),l=ta(r,"ipc");for await(let t of uu({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))s&&(nX(e,o,l),o.push(t)),a&&aQ(t,u);return o},aZ=async(e,t)=>(await Promise.allSettled([e]),t),a0=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:u,cancelSignal:a,gracefulCancel:s,forceKillAfterDelay:l,stripFinalNewline:D,ipc:c,ipcInput:d},context:p,verboseInfo:f,fileDescriptors:h,originalStreams:m,onInternalError:b,controller:y})=>{let g=iX(e,p),F={originalStreams:m,fileDescriptors:h,subprocess:e,exitPromise:g,propagating:!1},E=(({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:u,verboseInfo:a,streamInfo:s})=>e.stdio.map((e,l)=>aJ({stream:e,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,stripFinalNewline:u,verboseInfo:a,streamInfo:s})))({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:D,verboseInfo:f,streamInfo:F}),C=(({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:u,verboseInfo:a,streamInfo:s})=>aJ({...(({stdout:e,stderr:t,all:r},[,n,o])=>{let u=n||o;return u?n?o?{stream:r,buffer:u}:{stream:e,buffer:u}:{stream:t,buffer:u}:{stream:r,buffer:u}})(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:(({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode)(e),stripFinalNewline:u,verboseInfo:a,streamInfo:s}))({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:D,verboseInfo:f,streamInfo:F}),w=[],_=aX({subprocess:e,buffer:r,maxBuffer:n,ipc:c,ipcOutput:w,verboseInfo:f}),v=a2(m,e,F),S=a1(h,F);try{return await Promise.race([Promise.all([{},i2(g),Promise.all(E),C,_,nc(e,d),...v,...S]),b,a8(e,y),...0===u||void 0===u?[]:[nl(e,u,p,y)],...(({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,controller:o})=>void 0===t||r?[]:[rc(e,t,n,o)])({subprocess:e,cancelSignal:a,gracefulCancel:s,context:p,controller:y}),...(({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,context:o,controller:u})=>r?[na({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:u})]:[])({subprocess:e,cancelSignal:a,gracefulCancel:s,forceKillAfterDelay:l,context:p,controller:y})])}catch(e){return p.terminationReason??="other",Promise.all([{error:e},g,Promise.all(E.map(e=>aM(e))),aM(C),aZ(_,w),Promise.allSettled(v),Promise.allSettled(S)])}},a2=(e,t,r)=>e.map((e,n)=>e===t.stdio[n]?void 0:aN(e,n,r)),a1=(e,t)=>e.flatMap(({stdioItems:e},r)=>e.filter(({value:e,stream:t=e})=>nR(t,{checkOpen:!1})&&!e2(t)).map(({type:e,value:n,stream:o=n})=>aN(o,r,t,{isSameDirection:ob.has(e),stopOnExit:"native"===e}))),a8=async(e,{signal:t})=>{let[r]=await V(e,"error",{signal:t});throw r},a3=(e,t,r)=>{let n=e[r];n.has(t)||n.set(t,[]);let o=n.get(t),u=rC();return o.push(u),{resolve:u.resolve.bind(u),promises:o}},a6=async({resolve:e,promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n},a9=async e=>{if(void 0!==e)try{await a4(e)}catch{}},a7=async e=>{if(void 0!==e)try{await a5(e)}catch{}},a4=async e=>{await ep(e,{cleanup:!0,readable:!1,writable:!0})},a5=async e=>{await ep(e,{cleanup:!0,readable:!0,writable:!1})},se=async(e,t)=>{if(await e,t)throw t},st=(e,t,r)=>{r&&!aK(r)?e.destroy(r):t&&e.destroy()},sr=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:u=!0}={})=>{let a=o||np.has(r),{subprocessStdout:s,waitReadableDestroy:l}=sn(e,n,t),{readableEncoding:D,readableObjectMode:c,readableHighWaterMark:d}=so(s,a),{read:p,onStdoutDataDone:f}=si({subprocessStdout:s,subprocess:e,binary:a,encoding:r,preserveNewlines:u}),h=new ea({read:p,destroy:w(ss.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:l})),highWaterMark:d,objectMode:c,encoding:D});return sa({subprocessStdout:s,onStdoutDataDone:f,readable:h,subprocess:e}),h},sn=(e,t,r)=>{let n=r_(e,t),o=a3(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},so=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:ax},si=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let u=rC(),a=aS({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){su(this,a,u)},onStdoutDataDone:u}},su=async(e,t,r)=>{try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},sa=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:n,subprocessStdin:o})=>{try{await a5(e),await n,await a9(o),await t,r.readable&&r.push(null)}catch(e){await a9(o),sl(r,e)}},ss=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await a6(r,t)&&(sl(e,n),await se(t,n))},sl=(e,t)=>{st(e,e.readable,t)},sD=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:u}=sc(e,r,t),a=new el({...sd(n,e,o),destroy:w(sm.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:u})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sh(n,a),a},sc=(e,t,r)=>{let n=rw(e,t),o=a3(r,n,"writableFinal"),u=a3(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:u}},sd=(e,t,r)=>({write:sp.bind(void 0,e),final:w(sf.bind(void 0,e,t,r))}),sp=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},sf=async(e,t,r)=>{await a6(r,t)&&(e.writable&&e.end(),await t)},sh=async(e,t,r)=>{try{await a4(e),t.writable&&t.end()}catch(e){await a7(r),sb(t,e)}},sm=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await a6(r,t),await a6(n,t)&&(sb(e,o),await se(t,o))},sb=(e,t)=>{st(e,e.writable,t)},sy=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:u=!0,preserveNewlines:a=!0}={})=>{let s=u||np.has(r),{subprocessStdout:l,waitReadableDestroy:D}=sn(e,n,t),{subprocessStdin:c,waitWritableFinal:d,waitWritableDestroy:p}=sc(e,o,t),{readableEncoding:f,readableObjectMode:h,readableHighWaterMark:m}=so(l,s),{read:b,onStdoutDataDone:y}=si({subprocessStdout:l,subprocess:e,binary:s,encoding:r,preserveNewlines:a}),g=new ei({read:b,...sd(c,e,d),destroy:w(sg.bind(void 0,{subprocessStdout:l,subprocessStdin:c,subprocess:e,waitReadableDestroy:D,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:m,writableHighWaterMark:c.writableHighWaterMark,readableObjectMode:h,writableObjectMode:c.writableObjectMode,encoding:f});return sa({subprocessStdout:l,onStdoutDataDone:y,readable:g,subprocess:e,subprocessStdin:c}),sh(c,g,l),g},sg=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:u},a)=>{await Promise.all([ss({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},a),sm({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:u},a)])},sF=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let u=n||np.has(t),a=r_(e,r);return sE(aS({subprocessStdout:a,subprocess:e,binary:u,shouldEncode:!0,encoding:t,preserveNewlines:o}),a,e)},sE=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}},sC=(async()=>{})().constructor.prototype,sw=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(sC,e)]),s_=({timeout:e,signal:t,...r})=>{if(void 0!==t)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},sv=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:u,command:a,escapedCommand:s,context:l,onInternalError:D,controller:c})=>{let[d,[p,f],h,m,b]=await a0({subprocess:e,options:t,context:l,verboseInfo:n,fileDescriptors:o,originalStreams:u,onInternalError:D,controller:c});c.abort(),D.resolve();let y=sS({errorInfo:d,exitCode:p,signal:f,stdio:h.map((e,r)=>it(e,t,r)),all:it(m,t,"all"),ipcOutput:b,context:l,options:t,command:a,escapedCommand:s,startTime:r});return n5(y,n,t)},sS=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:u,context:a,options:s,command:l,escapedCommand:D,startTime:c})=>"error"in e?n8({error:e.error,command:l,escapedCommand:D,timedOut:"timeout"===a.terminationReason,isCanceled:"cancel"===a.terminationReason||"gracefulCancel"===a.terminationReason,isGracefullyCanceled:"gracefulCancel"===a.terminationReason,isMaxBuffer:e.error instanceof nQ,isForcefullyTerminated:a.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:u,options:s,startTime:c,isSync:!1}):n2({command:l,escapedCommand:D,stdio:n,all:o,ipcOutput:u,options:s,startTime:c}),sB=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([t,r])=>[t,sT(t,e[t],r)]));return{...e,...r}},sT=(e,t,r)=>sA.has(e)&&e$(t)&&e$(r)?{...t,...r}:r,sA=new Set(["env",...tu]),sR=(e,t,r,n)=>{let o=(e,t,n)=>sR(e,t,r,n),u=(...u)=>sx({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...u);return void 0!==n&&n(u,o,t),u},sx=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,createNested:o},u,...a)=>{if(e$(u))return o(e,sB(r,u),n);let{file:s,commandArguments:l,options:D,isSync:c}=sP({mapArguments:e,firstArgument:u,nextArguments:a,deepOptions:t,boundOptions:r});return c?((e,t,r)=>{let{file:n,commandArguments:o,command:u,escapedCommand:a,startTime:s,verboseInfo:l,options:D,fileDescriptors:c}=((e,t,r)=>{let{command:n,escapedCommand:o,startTime:u,verboseInfo:a}=tH(e,t,r),{file:s,commandArguments:l,options:D}=ng(e,t,i3(r));i6(D);let c=oV(ie,D,a,!0);return{file:s,commandArguments:l,command:n,escapedCommand:o,startTime:u,verboseInfo:a,options:D,fileDescriptors:c}})(e,t,r);return n5((({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:u,fileDescriptors:a,startTime:s})=>{let l=i7({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:a,startTime:s});if(l.failed)return l;let{resultError:D,exitCode:c,signal:d,timedOut:p,isMaxBuffer:f}=(({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let u,a,s,l=(u=e,a=t,s=r,void 0!==u?u:i8(a,s)?new tK:void 0),D=l?.code==="ETIMEDOUT",c=l?.code==="ENOBUFS"&&null!==n&&n.some(e=>null!==e&&e.length>(([,e])=>e)(o));return{resultError:l,exitCode:t,signal:r,timedOut:D,isMaxBuffer:c}})(l,r),{output:h,error:m=D}=(({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(null===t)return{output:Array.from({length:3})};let u={},a=new Set([]);return{output:t.map((t,s)=>(({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:u,verboseInfo:a},{buffer:s,encoding:l,lines:D,stripFinalNewline:c,maxBuffer:d})=>{if(null===e)return;let p=eN(((e,t,r)=>{if(!t)return e;let n=(([,e])=>e)(r);return e.length>n?e.slice(0,n):e})(e,u,d)),{stdioItems:f,objectMode:h}=t[r],{serializedResult:m,finalResult:b=m}=iY({chunks:iK([p],f,l,n),objectMode:h,encoding:l,lines:D,stripFinalNewline:c,fdNumber:r});iJ({serializedResult:m,fdNumber:r,state:n,verboseInfo:a,encoding:l,stdioItems:f,objectMode:h});let y=s[r]?b:void 0;try{return void 0===n.error&&iQ(m,f,o),y}catch(e){return n.error=e,y}})({result:t,fileDescriptors:e,fdNumber:s,state:u,outputFiles:a,isMaxBuffer:n,verboseInfo:o},r)),...u}})({fileDescriptors:a,syncResult:l,options:r,isMaxBuffer:f,verboseInfo:u});return i5({error:m,exitCode:c,signal:d,timedOut:p,isMaxBuffer:f,stdio:h.map((e,t)=>it(e,r,t)),all:it((([,e,t],r)=>{if(r.all)return void 0===e?t:void 0===t?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,it(t,r,"all")]:Array.isArray(t)?[it(e,r,"all"),...t]:eU(e)&&eU(t)?eG([e,t]):`${e}${t}`})(h,r),r,"all"),options:r,command:n,escapedCommand:o,startTime:s})})({file:n,commandArguments:o,options:D,command:u,escapedCommand:a,verboseInfo:l,fileDescriptors:c,startTime:s}),l,D)})(s,l,D):((e,t,r,n)=>{let{file:o,commandArguments:u,command:a,escapedCommand:s,startTime:l,verboseInfo:D,options:c,fileDescriptors:d}=((e,t,r)=>{let{command:n,escapedCommand:o,startTime:u,verboseInfo:a}=tH(e,t,r),{file:s,commandArguments:l,options:D}=ng(e,t,r),c=s_(D),d=oV(ug,c,a,!1);return{file:s,commandArguments:l,command:n,escapedCommand:o,startTime:u,verboseInfo:a,options:c,fileDescriptors:d}})(e,t,r),{subprocess:p,promise:f}=(({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,command:u,escapedCommand:a,fileDescriptors:s})=>{let l;try{l=g(...nC(e,t,r))}catch(e){return(({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:u,verboseInfo:a})=>{var s,l;let D,c,d,p,f,h;o6(n);let m=new b;return s=m,l=n,D=ud(),c=ud(),d=ud(),p=Array.from({length:l.length-3},ud),f=ud(),h=[D,c,d,...p],Object.assign(s,{stdin:D,stdout:c,stderr:d,all:f,stdio:h}),Object.assign(m,{readable:up,writable:uf,duplex:uh}),{subprocess:m,promise:um(n1({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:u,isSync:!1}),a,o)}})({error:e,command:u,escapedCommand:a,fileDescriptors:s,options:r,startTime:n,verboseInfo:o})}let D=new AbortController;K(1/0,D.signal);let c=[...l.stdio];var d=l;let p=new Map;for(let[e,{stdioItems:t,direction:r}]of Object.entries(s)){for(let{stream:n}of t.filter(({type:e})=>ob.has(e)))uH(d,n,r,e);for(let{stream:n}of t.filter(({type:e})=>!ob.has(e)))uV({subprocess:d,stream:n,direction:r,fdNumber:e,pipeGroups:p,controller:D})}for(let[e,t]of p.entries())uU(1===t.length?t[0]:uF(t),e);((e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=u6(()=>{e.kill()});H(n,()=>{o()})})(l,r,D);let f={},h=rC();l.kill=ri.bind(void 0,{kill:l.kill.bind(l),options:r,onInternalError:h,context:f,controller:D}),l.all=(({stdout:e,stderr:t},{all:r})=>r&&(e||t)?uF([e,t].filter(Boolean)):void 0)(l,r),((e,{encoding:t})=>{let r={readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap};e.readable=sr.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=sD.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=sy.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=sF.bind(void 0,e,t),e[Symbol.asyncIterator]=sF.bind(void 0,e,t,{})})(l,r),((e,{ipc:t})=>{Object.assign(e,uc(e,!1,t))})(l,r);let m=sv({subprocess:l,options:r,startTime:n,verboseInfo:o,fileDescriptors:s,originalStreams:c,command:u,escapedCommand:a,context:f,onInternalError:h,controller:D});return{subprocess:l,promise:m}})({file:o,commandArguments:u,options:c,startTime:l,verboseInfo:D,command:a,escapedCommand:s,fileDescriptors:d});p.pipe=au.bind(void 0,{source:p,sourcePromise:f,boundOptions:{},createNested:n});for(let[e,t]of sw){let r=t.value.bind(f);Reflect.defineProperty(p,e,{...t,value:r})}return rv.set(p,{options:c,fileDescriptors:d}),p})(s,l,D,o)},sP=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let[u,a,s]=eL(...Array.isArray(t)&&Array.isArray(t.raw)?((e,t)=>{let r=[];for(let[n,o]of e.entries())r=eK({templates:e,expressions:t,tokens:r,index:n,template:o});if(0===r.length)throw TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]})(t,r):[t,...r]),l=sB(sB(n,o),s),{file:D=u,commandArguments:c=a,options:d=l,isSync:p=!1}=e({file:u,commandArguments:a,options:l});return{file:D,commandArguments:c,options:d,isSync:p}},s$=(e,t)=>{if(t.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=sO(e);return{file:r,commandArguments:n}},sO=e=>{if("string"!=typeof e)throw TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(""===t)return[];let r=[];for(let e of t.split(sk)){let t=r.at(-1);t&&t.endsWith("\\")?r[r.length-1]=`${t.slice(0,-1)} ${e}`:r.push(e)}return r},sk=/ +/g,sj=({options:e})=>({...sI(e),isSync:!0}),sI=e=>({options:{...sL(e),...e}}),sL=({input:e,inputFile:t,stdio:r})=>void 0===e&&void 0===t&&void 0===r?{stdin:"inherit"}:{},sM=sR(()=>({}));sR(()=>({isSync:!0})),sR(({file:e,commandArguments:t})=>s$(e,t)),sR(({file:e,commandArguments:t})=>({...s$(e,t),isSync:!0})),sR(({options:e})=>{if(!1===e.node)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}}),sR(({options:e})=>sI(e),{},{preferLocal:!0},(e,t,r)=>{e.sync=t(sj,r),e.s=e.sync});let{sendMessage:sU,getOneMessage:sN,getEachMessage:sW,getCancelSignal:sq}=(n=void 0!==R.channel,{...uc(R,!0,n),getCancelSignal:ne.bind(void 0,{anyProcess:R,channel:R.channel,isSubprocess:!0,ipc:n})});var sz,sH,sG,sV,sK,sY=JSON.parse('{"UU":"@doubao-dev/cli","rE":"1.0.0-rc.11","h_":"Doubao Plugins CLI"}');let sJ={name:sY.UU,version:sY.rE,description:sY.h_,registry:"https://registry.npmjs.org",appDev:{name:"@doubao-dev/plugin-app-dev",version:sY.rE},kit:{name:"@doubao-dev/kit",version:process.env.DBX_KIT_VERSION?.trim()||"0.10.0",lockCdn:{version:"0.10.0",url:"https://lf3-static.bytednsdoc.com/obj/eden-cn/rkz-zwwh-vhibvk/ljhwZthlaukjlkulzlp/kit-locks/public/0.10.0/f49f1e56718bab3b17597f52f514baf5700413ddfea200202d4b67bd17c35134/package-lock.json",sha256:"f49f1e56718bab3b17597f52f514baf5700413ddfea200202d4b67bd17c35134"}??void 0},auth:{baseUrl:"https://open.doubao.com",verificationUrl:"https://open.doubao.com/apps-plugin/oauth/device"},apiUrl:"https://open.doubao.com",apiHeaders:{"User-Agent":`doubao-dev-cli-${sY.rE}`},deviceApiUrl:"https://developer.doubao.com",consoleUrl:"https://open.doubao.com/console/plugins/"},sQ=l.join(N.homedir(),".dbx","token"),sX=l.join(N.homedir(),".doubao","token"),sZ={};function s0(e={}){let t={...sZ,...e},r=s1(t.baseUrl??"https://developer.doubao.com","baseUrl"),n=t.tokenPath??sQ;return{...t,baseUrl:r,verificationUrl:s1(t.verificationUrl??new URL("/oauth/device",r).href,"verificationUrl"),allowedOrigins:function(e,t){let r=new Set([new URL(t).origin]);for(let t of e??[]){let e;try{e=new URL(t)}catch{throw Error(`allowedOrigins 中的来源必须是完整的 HTTPS 地址:${t}`)}if("https:"!==e.protocol)throw Error(`allowedOrigins 中的来源必须使用 HTTPS:${t}`);r.add(e.origin)}return[...r]}(t.allowedOrigins,r),tokenPath:n,legacyTokenPath:t.tokenPath?void 0:sX,requestHeaders:new Headers(t.requestHeaders)}}function s2(e){return e.replace(/\/+$/,"")}function s1(e,t){let r;try{r=new URL(s2(e))}catch{throw Error(`${t} 必须是完整的 HTTPS URL`)}if("https:"!==r.protocol)throw Error(`${t} 必须使用 HTTPS`);return s2(r.toString())}let s8=B(y),s3="byted-doubao-open-dbx-cli",s6="dbx-cli",s9="aes-256-gcm";class s7 extends Error{constructor(e){super(e),this.name="CredentialStoreError"}}class s4 extends s7{constructor(){super("无法读取本地登录凭证:用于解密凭证的密钥文件 master.key 已丢失。请运行 dbx auth login 重新登录。")}}class s5{constructor(e,t){this.primary=e,this.fallback=t}async get(e){let t;if(await this.isFallbackAuthoritative(e))return this.fallback.get(e);try{let t=await this.primary.get(e);if(t)return t}catch(e){t=e}try{let t=await this.fallback.get(e);if(t)return t}catch(e){if(t)throw new s7(`从系统凭证存储读取登录凭证失败(${lc(t)});从备用加密文件读取也失败:${lc(e)}`);throw e}if(t)throw t instanceof Error?t:new s7(`从系统凭证存储读取登录凭证失败:${String(t)}`)}async set(e,t){let r;try{await this.primary.set(e,t)}catch(e){r=e}try{await this.fallback.set(e,t)}catch(t){if(r)throw new s7(`向系统凭证存储写入登录凭证失败(${lc(r)}),写入备用加密文件也失败(${lc(t)})`);throw await this.removeStaleFallbackAfterPrimaryWrite(e,t),t}r?await this.markFallbackAuthoritative(e):await this.clearFallbackAuthority(e)}async delete(e){let t;try{await this.primary.delete(e)}catch(e){t=e}try{await this.fallback.delete(e)}catch(e){if(t)throw new s7(`从系统凭证存储删除登录凭证失败(${lc(t)}),从备用加密文件删除也失败(${lc(e)})`);throw e}t?await this.markFallbackAuthoritativeOrThrow(e,t):await this.clearFallbackAuthority(e)}async isFallbackAuthoritative(e){return!!li(this.fallback)&&this.fallback.isFallbackAuthoritative(e)}async markFallbackAuthoritative(e){li(this.fallback)&&await this.fallback.markFallbackAuthoritative(e)}async markFallbackAuthoritativeOrThrow(e,t){if(!li(this.fallback))throw t instanceof Error?t:new s7(`系统凭证删除失败,且备用存储无法记录删除状态:${String(t)}`);try{await this.fallback.markFallbackAuthoritative(e)}catch(e){throw new s7(`系统凭证删除失败(${lc(t)}),且无法记录备用凭证删除状态:${lc(e)}`)}}async clearFallbackAuthority(e){li(this.fallback)&&await this.fallback.clearFallbackAuthority(e)}async removeStaleFallbackAfterPrimaryWrite(e,t){let r=[];try{await this.fallback.delete(e)}catch(e){r.push(e)}try{await this.clearFallbackAuthority(e)}catch(e){r.push(e)}if(r.length>0)throw new s7(`系统凭证已写入,但备用加密文件写入失败(${lc(t)}),且清理旧备用凭证失败:${r.map(lc).join(";")}`)}}class le{constructor(e={}){this.baseDir=e.baseDir??("darwin"===process.platform?l.join(N.homedir(),"Library","Application Support",s6):"win32"===process.platform?l.join(process.env.APPDATA||l.join(N.homedir(),"AppData","Roaming"),s6):l.join(process.env.XDG_DATA_HOME||l.join(N.homedir(),".local","share"),s6))}async get(e){var t,r;let n,o,u=this.credentialFilePath(e);try{n=await ee.readFile(u,"utf8")}catch(e){if(lD(e)&&"ENOENT"===e.code)return;throw new s7(`读取加密凭证文件失败:${lc(e)}`)}try{o=JSON.parse(n)}catch(e){throw new s7(`加密凭证文件不是有效的 JSON:${lc(e)}`)}if(!((t=o)&&"object"==typeof t&&1===t.version&&t.algorithm===s9&&"string"==typeof t.iv&&"string"==typeof t.authTag&&"string"==typeof t.ciphertext))throw new s7("无法读取本地登录凭证:当前 CLI 不支持凭证文件中的格式或字段。");let a=await this.readMasterKey();try{let t=eh.createDecipheriv(s9,a,Buffer.from(o.iv,"base64url"));return t.setAAD(Buffer.from((r=e,`${s3}:${r}`),"utf8")),t.setAuthTag(Buffer.from(o.authTag,"base64url")),Buffer.concat([t.update(Buffer.from(o.ciphertext,"base64url")),t.final()]).toString("utf8")}catch(e){throw new s7(`解密凭证文件失败:${lc(e)}`)}}async set(e,t){var r;let n=await this.readOrCreateMasterKey(),o=eh.randomBytes(12),u=eh.createCipheriv(s9,n,o);u.setAAD(Buffer.from((r=e,`${s3}:${r}`),"utf8"));let a=Buffer.concat([u.update(t,"utf8"),u.final()]),s={version:1,algorithm:s9,iv:o.toString("base64url"),authTag:u.getAuthTag().toString("base64url"),ciphertext:a.toString("base64url")};await ln(this.credentialFilePath(e),`${JSON.stringify(s,null,2)}
29
+ if (condition) { yield value; }`)},iF=(e,t,r)=>{if(r)return;if(e)return{transform:iE.bind(void 0,new TextEncoder)};let n=new E(t);return{transform:iC.bind(void 0,n),final:iw.bind(void 0,n)}},iE=function*(e,t){ed.isBuffer(t)?yield eN(t):"string"==typeof t?yield e.encode(t):yield t},iC=function*(e,t){yield eU(t)?e.write(t):t},iw=function*(e){let t=e.end();""!==t&&(yield t)},i_=w(async(e,t,r,n)=>{t.currentIterable=e(...r);try{for await(let e of t.currentIterable)n.push(e)}finally{delete t.currentIterable}}),iv=async function*(e,t,r){if(r===t.length)return void(yield e);let{transform:n=iA}=t[r];for await(let o of n(e))yield*iv(o,t,r+1)},iS=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*iB(r,Number(t),e)},iB=async function*(e,t,r){if(void 0!==e)for await(let n of e())yield*iv(n,r,t+1)},iT=w(async({currentIterable:e},t)=>{if(void 0!==e)return void await (t?e.throw(t):e.return());if(t)throw t}),iA=function*(e){yield e},iR=(e,t,r,n)=>{try{for(let n of e(...t))r.push(n);n()}catch(e){n(e)}},ix=(e,t)=>[...t.flatMap(t=>[...iP(t,e,0)]),...i$(e)],iP=function*(e,t,r){if(r===t.length)return void(yield e);let{transform:n=ik}=t[r];for(let o of n(e))yield*iP(o,t,r+1)},i$=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*iO(r,Number(t),e)},iO=function*(e,t,r){if(void 0!==e)for(let n of e())yield*iP(n,r,t+1)},ik=function*(e){yield e},ij=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:u},{encoding:a})=>{let s={},l=iL(e,a,u),D=oa(t),c=oa(r),d=D?i_.bind(void 0,iv,s):iR.bind(void 0,iP),p=D||c?i_.bind(void 0,iS,s):iR.bind(void 0,i$),f=D||c?iT.bind(void 0,s):void 0;return{stream:new es({writableObjectMode:n,writableHighWaterMark:eD(n),readableObjectMode:o,readableHighWaterMark:eD(o),transform(e,t,r){d([e,l,0],this,r)},flush(e){p([l],this,e)},destroy:f})}},iI=(e,t,r,n)=>{let o=t.filter(({type:e})=>"generator"===e);for(let{value:t,optionName:u}of n?o.reverse():o)e=ix(iL(t,r,u),e);return e},iL=({transform:e,final:t,binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:u},a,s)=>{let l={};return[{transform:n?void 0:im.bind(void 0,s)},iF(r,a,n),io(r,u,n,l),{transform:e,final:t},{transform:o?ib.bind(void 0,s):iy.bind(void 0,s)},(({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:ic.bind(void 0,n)})({binary:r,preserveNewlines:u,readableObjectMode:o,state:l})].filter(Boolean)},iM=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:e})=>void 0!==e);if(0!==o.length){if(0!==t){let[{type:e,optionName:t}]=o;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${oC[e]} with synchronous methods.`)}r.input=ez(o.map(({contents:e})=>e).map(e=>iU(e,n)))}},iU=(e,t)=>{let r=iI(e,t,"utf8",!0);return iN(r),ez(r)},iN=e=>{let t=e.find(e=>"string"!=typeof e&&!eU(e));if(void 0!==t)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)},iW=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>"all"!==n&&ts(r,n)&&!np.has(t)&&iq(n)&&(e.some(({type:e,value:t})=>"native"===e&&iz.has(t))||e.every(({type:e})=>ob.has(e))),iq=e=>1===e||2===e,iz=new Set(["pipe","overlapped"]),iH=async(e,t,r,n)=>{for await(let o of e)iG(t)||iV(o,r,n)},iG=e=>e._readableState.pipes.length>0,iV=(e,t,r)=>{tI({type:"output",verboseMessage:tN(e),fdNumber:t,verboseInfo:r})},iK=(e,t,r,n)=>{try{return iI(e,t,r,!1)}catch(t){return n.error=t,e}},iY=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:u})=>{if(t)return{serializedResult:e};if("buffer"===r)return{serializedResult:ez(e)};let a=((e,t)=>{if("utf8"===t&&e.every(e=>"string"==typeof e))return e;let r=new E(t),n=e.map(e=>"string"==typeof e?eW.encode(e):e).map(e=>r.write(e)),o=r.end();return""===o?n:[...n,o]})(e,r).join("");return n[u]?{serializedResult:a,finalResult:ii(a,!o[u],t)}:{serializedResult:a}},iJ=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:u,objectMode:a})=>{if(!iW({stdioItems:u,encoding:o,verboseInfo:n,fdNumber:t}))return;let s=ii(e,!1,a);try{for(let e of s)iV(e,t,n)}catch(e){r.error??=e}},iQ=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:e})=>oy.has(e))){let t="string"==typeof n?n:n.toString();o||r.has(t)?Q(n,e):(r.add(t),en(n,e))}},iX=async(e,t)=>{let[r,n]=await iZ(e);return t.isForcefullyTerminated??=!1,[r,n]},iZ=async e=>{let[t,r]=await Promise.allSettled([V(e,"spawn"),V(e,"exit")]);return"rejected"===t.status?[]:"rejected"===r.status?i0(e):r.value},i0=async e=>{try{return await V(e,"exit")}catch{return i0(e)}},i2=async e=>{let[t,r]=await e;if(!i1(t,r)&&i8(t,r))throw new tK;return[t,r]},i1=(e,t)=>void 0===e&&void 0===t,i8=(e,t)=>0!==e||null!==t,i3=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,i6=({ipc:e,ipcInput:t,detached:r,cancelSignal:n})=>{t&&i9("ipcInput"),e&&i9("ipc: true"),r&&i9("detached: true"),n&&i9("cancelSignal")},i9=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},i7=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:u,startTime:a})=>{try{let n;for(let e of(n=u,new Set(Object.entries(n).filter(([,{direction:e}])=>"input"===e).map(([e])=>Number(e)))))iM(u,e,r);let o=i4(r);return F(...nC(e,t,o))}catch(e){return n1({error:e,command:n,escapedCommand:o,fileDescriptors:u,options:r,startTime:a,isSync:!0})}},i4=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:(([,e])=>e)(t)}),i5=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:u,all:a,options:s,command:l,escapedCommand:D,startTime:c})=>void 0===e?n2({command:l,escapedCommand:D,stdio:u,all:a,ipcOutput:[],options:s,startTime:c}):n8({error:e,command:l,escapedCommand:D,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:u,all:a,ipcOutput:[],options:s,startTime:c,isSync:!0}),ue=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:u}={})=>(rd({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:rH(e)}),ut({anyProcess:e,channel:t,isSubprocess:r,filter:u,reference:o})),ut=async({anyProcess:e,channel:t,isSubprocess:r,filter:n,reference:o})=>{rk(t,o);let u=rW(e,t,r),a=new AbortController;try{return await Promise.race([ur(u,n,a),un(u,r,a),uo(u,r,a)])}catch(t){throw rE(e),t}finally{a.abort(),rI(t,o)}},ur=async(e,t,{signal:r})=>{if(void 0===t){let[t]=await V(e,"message",{signal:r});return t}for await(let[n]of G(e,"message",{signal:r}))if(t(n))return n},un=async(e,t,{signal:r})=>{await V(e,"disconnect",{signal:r});throw Error(`${ry("getOneMessage",t)} could not complete: the ${rF(t)} exited or disconnected.`)},uo=async(e,t,{signal:r})=>{let[n]=await V(e,"strict:error",{signal:r});throw rh(n,t)},ui=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>uu({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:!r,reference:o}),uu=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:u})=>{rd({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:rH(e)}),rk(t,u);let a=rW(e,t,r),s=new AbortController,l={};return ua(e,a,s),us({ipcEmitter:a,isSubprocess:r,controller:s,state:l}),ul({anyProcess:e,channel:t,ipcEmitter:a,isSubprocess:r,shouldAwait:o,controller:s,state:l,reference:u})},ua=async(e,t,r)=>{try{await V(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},us=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await V(e,"strict:error",{signal:r.signal});n.error=rh(o,t),r.abort()}catch{}},ul=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:u,state:a,reference:s}){try{for await(let[e]of G(r,"message",{signal:u.signal}))uD(a),yield e}catch{uD(a)}finally{u.abort(),rI(t,s),n||rE(e),o&&await e}},uD=({error:e})=>{if(e)throw e},uc=(e,t,r)=>({sendMessage:r6.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:ue.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:ui.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}),ud=()=>{let e=new eu;return e.end(),e},up=()=>new ea({read(){}}),uf=()=>new el({write(){}}),uh=()=>new ei({read(){},write(){}}),um=async(e,t,r)=>n5(e,t,r),ub=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${oC[e]}.`)},uy={fileNumber:ub,generator:ij,asyncGenerator:ij,nodeStream:({value:e})=>({stream:e}),webTransform:({value:{transform:e,writableObjectMode:t,readableObjectMode:r}})=>({stream:ei.fromWeb(e,{objectMode:t||r})}),duplex:({value:{transform:e}})=>({stream:e}),native(){}},ug={input:{...uy,fileUrl:({value:e})=>({stream:X(e)}),filePath:({value:{file:e}})=>({stream:X(e)}),webStream:({value:e})=>({stream:ea.fromWeb(e)}),iterable:({value:e})=>({stream:ea.from(e)}),asyncIterable:({value:e})=>({stream:ea.from(e)}),string:({value:e})=>({stream:ea.from(e)}),uint8Array:({value:e})=>({stream:ea.from(ed.from(e))})},output:{...uy,fileUrl:({value:e})=>({stream:Z(e)}),filePath:({value:{file:e,append:t}})=>({stream:Z(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:el.fromWeb(e)}),iterable:ub,asyncIterable:ub,string:ub,uint8Array:ub}};function uF(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)uS(t);let t=e.some(({readableObjectMode:e})=>e),r=uE(e,t),n=new uC({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let t of e)n.add(t);return n}let uE=(e,t)=>0===e.length?eD(t):Math.max(...e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e));class uC extends eu{#u=new Set([]);#a=new Set([]);#s=new Set([]);#l;#D=Symbol("unpipe");#c=new WeakMap;add(e){if(uS(e),this.#u.has(e))return;this.#u.add(e),this.#l??=uw(this,this.#u,this.#D);let t=uB({passThroughStream:this,stream:e,streams:this.#u,ended:this.#a,aborted:this.#s,onFinished:this.#l,unpipeEvent:this.#D});this.#c.set(e,t),e.pipe(this,{end:!1})}async remove(e){if(uS(e),!this.#u.has(e))return!1;let t=this.#c.get(e);return void 0!==t&&(this.#c.delete(e),e.unpipe(this),await t,!0)}}let uw=async(e,t,r)=>{uI(e,uL);let n=new AbortController;try{await Promise.race([u_(e,n),uv(e,t,r,n)])}finally{n.abort(),uI(e,-uL)}},u_=async(e,{signal:t})=>{try{await ep(e,{signal:t,cleanup:!0})}catch(t){throw uP(e,t),t}},uv=async(e,t,r,{signal:n})=>{for await(let[o]of G(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},uS=e=>{if("function"!=typeof e?.pipe)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},uB=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:u,unpipeEvent:a})=>{uI(e,uM);let s=new AbortController;try{await Promise.race([uT(u,t,s),uA({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:s}),uR({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:a,controller:s})])}finally{s.abort(),uI(e,-uM)}r.size>0&&r.size===n.size+o.size&&(0===n.size&&o.size>0?uO(e):ux(e))},uT=async(e,t,{signal:r})=>{try{await e,r.aborted||uO(t)}catch(e){r.aborted||uP(t,e)}},uA=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:{signal:u}})=>{try{await ep(t,{signal:u,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(n){if(u.aborted||!r.has(t))return;u$(n)?o.add(t):uk(e,n)}},uR=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{signal:u}})=>{if(await V(e,o,{signal:u}),!e.readable)return V(u,"abort",{signal:u});t.delete(e),r.delete(e),n.delete(e)},ux=e=>{e.writable&&e.end()},uP=(e,t)=>{u$(t)?uO(e):uk(e,t)},u$=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",uO=e=>{(e.readable||e.writable)&&e.destroy()},uk=(e,t)=>{e.destroyed||(e.once("error",uj),e.destroy(t))},uj=()=>{},uI=(e,t)=>{let r=e.getMaxListeners();0!==r&&r!==1/0&&e.setMaxListeners(r+t)},uL=2,uM=1,uU=(e,t)=>{e.pipe(t),uN(e,t),uq(e,t)},uN=async(e,t)=>{if(!(e2(e)||e2(t))){try{await ep(e,{cleanup:!0,readable:!0,writable:!1})}catch{}uW(t)}},uW=e=>{e.writable&&e.end()},uq=async(e,t)=>{if(!(e2(e)||e2(t))){try{await ep(t,{cleanup:!0,readable:!1,writable:!0})}catch{}uz(e)}},uz=e=>{e.readable&&e.destroy()},uH=(e,t,r,n)=>{"output"===r?uU(e.stdio[n],t):uU(t,e.stdio[n]);let o=uG[n];void 0!==o&&(e[o]=t),e.stdio[n]=t},uG=["stdin","stdout","stderr"],uV=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:u})=>{if(void 0===t)return;uK(t,u);let[a,s]="output"===r?[t,e.stdio[n]]:[e.stdio[n],t],l=o.get(a)??[];o.set(a,[...l,s])},uK=(e,{signal:t})=>{e2(e)&&rO(e,uY,t)},uY=2,uJ=[];uJ.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&uJ.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&uJ.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");let uQ=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,uX=Symbol.for("signal-exit emitter"),uZ=globalThis,u0=Object.defineProperty.bind(Object);class u2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(uZ[uX])return uZ[uX];u0(uZ,uX,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let r=this.listeners[e],n=r.indexOf(t);-1!==n&&(0===n&&1===r.length?r.length=0:r.splice(n,1))}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let n=!1;for(let o of this.listeners[e])n=!0===o(t,r)||n;return"exit"===e&&(n=this.emit("afterExit",t,r)||n),n}}class u1{}class u8 extends u1{#d="win32"===u3.platform?"SIGINT":"SIGHUP";#p=new u2;#f;#h;#m;#b={};#y=!1;constructor(e){for(let t of(super(),this.#f=e,this.#b={},uJ))this.#b[t]=()=>{let r=this.#f.listeners(t),{count:n}=this.#p;if("object"==typeof e.__signal_exit_emitter__&&"number"==typeof e.__signal_exit_emitter__.count&&(n+=e.__signal_exit_emitter__.count),r.length===n){this.unload();let r=this.#p.emit("exit",null,t),n="SIGHUP"===t?this.#d:t;r||e.kill(e.pid,n)}};this.#m=e.reallyExit,this.#h=e.emit}onExit(e,t){if(!uQ(this.#f))return()=>{};!1===this.#y&&this.load();let r=t?.alwaysLast?"afterExit":"exit";return this.#p.on(r,e),()=>{this.#p.removeListener(r,e),0===this.#p.listeners.exit.length&&0===this.#p.listeners.afterExit.length&&this.unload()}}load(){if(!this.#y){for(let e of(this.#y=!0,this.#p.count+=1,uJ))try{let t=this.#b[e];t&&this.#f.on(e,t)}catch(e){}this.#f.emit=(e,...t)=>this.#g(e,...t),this.#f.reallyExit=e=>this.#F(e)}}unload(){this.#y&&(this.#y=!1,uJ.forEach(e=>{let t=this.#b[e];if(!t)throw Error("Listener not defined for signal: "+e);try{this.#f.removeListener(e,t)}catch(e){}}),this.#f.emit=this.#h,this.#f.reallyExit=this.#m,this.#p.count-=1)}#F(e){return uQ(this.#f)?(this.#f.exitCode=e||0,this.#p.emit("exit",this.#f.exitCode,null),this.#m.call(this.#f,this.#f.exitCode)):0}#g(e,...t){let r=this.#h;if(!("exit"===e&&uQ(this.#f)))return r.call(this.#f,e,...t);{"number"==typeof t[0]&&(this.#f.exitCode=t[0]);let n=r.call(this.#f,e,...t);return this.#p.emit("exit",this.#f.exitCode,null),n}}}let u3=globalThis.process,{onExit:u6,load:u9,unload:u7}=(r=uQ(u3)?new u8(u3):new class extends u1{onExit(){return()=>{}}load(){}unload(){}},{onExit:(e,t)=>r.onExit(e,t),load:()=>r.load(),unload:()=>r.unload()}),u4=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(u5,e)(r,...n),pipeOptions:e};if("string"==typeof r||r instanceof URL||ej(r)){if(Object.keys(e).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,u,a]=eL(r,...n);return{destination:t(u5)(o,u,a),pipeOptions:a}}if(rv.has(r)){if(Object.keys(e).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},u5=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),ae=({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>n1({error:e,command:at,escapedCommand:at,fileDescriptors:t,options:r,startTime:n,isSync:!1}),at="source.pipe(destination)",ar=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:u,value:a=u}]=await e;if(a.pipedFrom.includes(n)||a.pipedFrom.push(n),"rejected"===o)throw a;if("rejected"===t)throw n;return a},an=async e=>{try{await ep(e,{cleanup:!0,readable:!1,writable:!0})}catch{}ao.delete(e)},ao=new WeakMap,ai=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:u})=>{throw await C(e,t),await r.remove(t),ae({error:Error("Pipe canceled by `unpipeSignal` option."),fileDescriptors:n,sourceOptions:o,startTime:u})},au=(e,...t)=>{if(e$(t[0]))return au.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...n}=(({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let u=$.bigint(),{destination:a,destinationStream:s,destinationError:l,from:D,unpipeSignal:c}=((e,t,r)=>{try{let{destination:n,pipeOptions:{from:o,to:u,unpipeSignal:a}={}}=u4(e,t,...r),s=rw(n,u);return{destination:n,destinationStream:s,from:o,unpipeSignal:a}}catch(e){return{destinationError:e}}})(r,n,o),{sourceStream:d,sourceError:p}=((e,t)=>{try{return{sourceStream:r_(e,t)}}catch(e){return{sourceError:e}}})(e,D),{options:f,fileDescriptors:h}=rv.get(e);return{sourcePromise:t,sourceStream:d,sourceOptions:f,sourceError:p,destination:a,destinationStream:s,destinationError:l,unpipeSignal:c,fileDescriptors:h,startTime:u}})(e,...t),o=aa({...n,destination:r});return o.pipe=au.bind(void 0,{...e,source:r,sourcePromise:o,boundOptions:{}}),o},aa=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,destination:o,destinationStream:u,destinationError:a,unpipeSignal:s,fileDescriptors:l,startTime:D})=>{let c=as(e,o);(({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,sourceOptions:u,startTime:a})=>{let s=(({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n})=>void 0!==t&&void 0!==n?n:void 0!==n?(uz(e),n):void 0!==t?(uW(r),t):void 0)({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(void 0!==s)throw ae({error:s,fileDescriptors:o,sourceOptions:u,startTime:a})})({sourceStream:t,sourceError:n,destinationStream:u,destinationError:a,fileDescriptors:l,sourceOptions:r,startTime:D});let d=new AbortController;try{var p,f,h,m;let e,n,o,a,b=(o=ao.has(u)?(p=t,f=u,(e=ao.get(f)).add(p),e):(h=t,m=u,n=uF([h]),uU(n,m),ao.set(m,n),n),rO(t,2,d.signal),rO(u,1,d.signal),an(u),o);return await Promise.race([ar(c),...(a={sourceStream:t,mergedStream:b,sourceOptions:r,fileDescriptors:l,startTime:D},void 0===s?[]:[ai(s,a)])])}finally{d.abort()}},as=(e,t)=>Promise.allSettled([e,t]),al=e=>e,aD=()=>void 0,ac=({contents:e})=>e,ad=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},ap=e=>e.length;async function af(e,t){return nH(e,ah,t)}let ah={init:()=>({contents:[]}),convertChunk:{string:al,buffer:al,arrayBuffer:al,dataView:al,typedArray:al,others:al},getSize:()=>1,truncateChunk:aD,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:aD,finalize:ac};async function am(e,t){return nH(e,aC,t)}let ab=new TextEncoder,ay=e=>new Uint8Array(e),ag=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),aF=e=>aE**Math.ceil(Math.log(e)/Math.log(aE)),aE=2,aC={init:()=>({contents:new ArrayBuffer(0)}),convertChunk:{string:e=>ab.encode(e),buffer:ay,arrayBuffer:ay,dataView:ag,typedArray:ag,others:ad},getSize:ap,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t,length:r},n)=>{let o="resize"in ArrayBuffer.prototype?((e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:aF(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r})(t,n):((e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(aF(t));return new Uint8Array(r).set(new Uint8Array(e),0),r})(t,n);return new Uint8Array(o).set(e,r),o},getFinalChunk:aD,finalize:({contents:e,length:t})=>"resize"in ArrayBuffer.prototype?e:e.slice(0,t)};async function aw(e,t){return nH(e,av,t)}let a_=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),av={init:()=>({contents:"",textDecoder:new TextDecoder}),convertChunk:{string:al,buffer:a_,arrayBuffer:a_,dataView:a_,typedArray:a_,others:ad},getSize:ap,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return""===t?void 0:t},finalize:ac},aS=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:u})=>{let a=new AbortController;return aB(t,a),aR({stream:e,controller:a,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,shouldSplit:!e.readableObjectMode,preserveNewlines:u})},aB=async(e,t)=>{try{await e}catch{}finally{t.abort()}},aT=({stream:e,onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:u})=>{let a=new AbortController;aA(t,a,e);let s=e.readableObjectMode&&!u;return aR({stream:e,controller:a,binary:"buffer"===n,shouldEncode:!s,encoding:n,shouldSplit:!s&&r,preserveNewlines:!o})},aA=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},aR=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a})=>a$({onStdoutChunk:G(e,"data",{signal:t.signal,highWaterMark:aP,highWatermark:aP}),controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a}),ax=eD(!0),aP=ax,a$=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a}){let s=aO({binary:r,shouldEncode:n,encoding:o,shouldSplit:u,preserveNewlines:a});try{for await(let[t]of e)yield*iP(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*i$(s)}},aO=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[iF(e,r,!t),io(e,o,!n,{})].filter(Boolean),ak=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:u,lines:a,allMixed:s,stripFinalNewline:l,verboseInfo:D,streamInfo:c})=>{let d=aj({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:s,verboseInfo:D,streamInfo:c});if(!o)return void await Promise.all([aI(e),d]);let p=aT({stream:e,onStreamEnd:t,lines:a,encoding:n,stripFinalNewline:ir(l,r),allMixed:s}),[f]=await Promise.all([aL({stream:e,iterable:p,fdNumber:r,encoding:n,maxBuffer:u,lines:a}),d]);return f},aj=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:o,verboseInfo:u,streamInfo:{fileDescriptors:a}})=>{if(!iW({stdioItems:a[r]?.stdioItems,encoding:n,verboseInfo:u,fdNumber:r}))return;let s=aT({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});await iH(s,e,r,u)},aI=async e=>{await M(),null===e.readableFlowing&&e.resume()},aL=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:n,encoding:o,maxBuffer:u,lines:a})=>{try{if(t||a)return await af(r,{maxBuffer:u});if("buffer"===o)return new Uint8Array(await am(r,{maxBuffer:u}));return await aw(r,{maxBuffer:u})}catch(r){return aU((({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:u})=>{let a,s,l;if(!(e instanceof nQ))throw e;if("all"===u)return e;throw e.maxBufferInfo={fdNumber:u,unit:(a=r,s=n,l=o,a?"objects":s?"lines":"buffer"===l?"bytes":"characters")},t.destroy(),e})({error:r,stream:e,readableObjectMode:t,lines:a,encoding:o,fdNumber:n}))}},aM=async e=>{try{return await e}catch(e){return aU(e)}},aU=({bufferedData:e})=>"[object ArrayBuffer]"===eM.call(e)?new Uint8Array(e):e,aN=async(e,t,r,{isSameDirection:n,stopOnExit:o=!1}={})=>{let u=aW(e,r),a=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],ep(e,{cleanup:!0,signal:a.signal})])}catch(e){u.stdinCleanedUp||aH(e,t,r,n)}finally{a.abort()}},aW=(e,{originalStreams:[t],subprocess:r})=>{let n={stdinCleanedUp:!1};return e===t&&aq(e,r,n),n},aq=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{az(t,r),n.call(e,...o)}},az=({exitCode:e,signalCode:t},r)=>{(null!==e||null!==t)&&(r.stdinCleanedUp=!0)},aH=(e,t,r,n)=>{if(!aG(e,t,r,n))throw e},aG=(e,t,r,n=!0)=>r.propagating?aY(e)||aK(e):(r.propagating=!0,aV(r,t)===n?aY(e):aK(e)),aV=({fileDescriptors:e},t)=>"all"!==t&&"input"===e[t].direction,aK=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",aY=e=>e?.code==="EPIPE",aJ=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:u,allMixed:a,stripFinalNewline:s,verboseInfo:l,streamInfo:D})=>{if(!e)return;let c=aN(e,t,D);if(aV(D,t))return void await c;let[d]=await Promise.all([ak({stream:e,onStreamEnd:c,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:u,allMixed:a,stripFinalNewline:s,verboseInfo:l,streamInfo:D}),c]);return d},aQ=(e,t)=>{tI({type:"ipc",verboseMessage:tN(e),fdNumber:"ipc",verboseInfo:t})},aX=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:u})=>{if(!n)return o;let a=ts(u,"ipc"),s=ta(t,"ipc"),l=ta(r,"ipc");for await(let t of uu({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))s&&(nX(e,o,l),o.push(t)),a&&aQ(t,u);return o},aZ=async(e,t)=>(await Promise.allSettled([e]),t),a0=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:u,cancelSignal:a,gracefulCancel:s,forceKillAfterDelay:l,stripFinalNewline:D,ipc:c,ipcInput:d},context:p,verboseInfo:f,fileDescriptors:h,originalStreams:m,onInternalError:b,controller:y})=>{let g=iX(e,p),F={originalStreams:m,fileDescriptors:h,subprocess:e,exitPromise:g,propagating:!1},E=(({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:u,verboseInfo:a,streamInfo:s})=>e.stdio.map((e,l)=>aJ({stream:e,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,stripFinalNewline:u,verboseInfo:a,streamInfo:s})))({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:D,verboseInfo:f,streamInfo:F}),C=(({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:u,verboseInfo:a,streamInfo:s})=>aJ({...(({stdout:e,stderr:t,all:r},[,n,o])=>{let u=n||o;return u?n?o?{stream:r,buffer:u}:{stream:e,buffer:u}:{stream:t,buffer:u}:{stream:r,buffer:u}})(e,r),fdNumber:"all",encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:(({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode)(e),stripFinalNewline:u,verboseInfo:a,streamInfo:s}))({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:D,verboseInfo:f,streamInfo:F}),w=[],_=aX({subprocess:e,buffer:r,maxBuffer:n,ipc:c,ipcOutput:w,verboseInfo:f}),v=a2(m,e,F),S=a1(h,F);try{return await Promise.race([Promise.all([{},i2(g),Promise.all(E),C,_,nc(e,d),...v,...S]),b,a8(e,y),...0===u||void 0===u?[]:[nl(e,u,p,y)],...(({subprocess:e,cancelSignal:t,gracefulCancel:r,context:n,controller:o})=>void 0===t||r?[]:[rc(e,t,n,o)])({subprocess:e,cancelSignal:a,gracefulCancel:s,context:p,controller:y}),...(({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:n,context:o,controller:u})=>r?[na({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:o,controller:u})]:[])({subprocess:e,cancelSignal:a,gracefulCancel:s,forceKillAfterDelay:l,context:p,controller:y})])}catch(e){return p.terminationReason??="other",Promise.all([{error:e},g,Promise.all(E.map(e=>aM(e))),aM(C),aZ(_,w),Promise.allSettled(v),Promise.allSettled(S)])}},a2=(e,t,r)=>e.map((e,n)=>e===t.stdio[n]?void 0:aN(e,n,r)),a1=(e,t)=>e.flatMap(({stdioItems:e},r)=>e.filter(({value:e,stream:t=e})=>nR(t,{checkOpen:!1})&&!e2(t)).map(({type:e,value:n,stream:o=n})=>aN(o,r,t,{isSameDirection:ob.has(e),stopOnExit:"native"===e}))),a8=async(e,{signal:t})=>{let[r]=await V(e,"error",{signal:t});throw r},a3=(e,t,r)=>{let n=e[r];n.has(t)||n.set(t,[]);let o=n.get(t),u=rC();return o.push(u),{resolve:u.resolve.bind(u),promises:o}},a6=async({resolve:e,promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!n},a9=async e=>{if(void 0!==e)try{await a4(e)}catch{}},a7=async e=>{if(void 0!==e)try{await a5(e)}catch{}},a4=async e=>{await ep(e,{cleanup:!0,readable:!1,writable:!0})},a5=async e=>{await ep(e,{cleanup:!0,readable:!0,writable:!1})},se=async(e,t)=>{if(await e,t)throw t},st=(e,t,r)=>{r&&!aK(r)?e.destroy(r):t&&e.destroy()},sr=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:u=!0}={})=>{let a=o||np.has(r),{subprocessStdout:s,waitReadableDestroy:l}=sn(e,n,t),{readableEncoding:D,readableObjectMode:c,readableHighWaterMark:d}=so(s,a),{read:p,onStdoutDataDone:f}=si({subprocessStdout:s,subprocess:e,binary:a,encoding:r,preserveNewlines:u}),h=new ea({read:p,destroy:w(ss.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:l})),highWaterMark:d,objectMode:c,encoding:D});return sa({subprocessStdout:s,onStdoutDataDone:f,readable:h,subprocess:e}),h},sn=(e,t,r)=>{let n=r_(e,t),o=a3(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},so=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:ax},si=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let u=rC(),a=aS({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){su(this,a,u)},onStdoutDataDone:u}},su=async(e,t,r)=>{try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},sa=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:n,subprocessStdin:o})=>{try{await a5(e),await n,await a9(o),await t,r.readable&&r.push(null)}catch(e){await a9(o),sl(r,e)}},ss=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await a6(r,t)&&(sl(e,n),await se(t,n))},sl=(e,t)=>{st(e,e.readable,t)},sD=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:u}=sc(e,r,t),a=new el({...sd(n,e,o),destroy:w(sm.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:u})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return sh(n,a),a},sc=(e,t,r)=>{let n=rw(e,t),o=a3(r,n,"writableFinal"),u=a3(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:u}},sd=(e,t,r)=>({write:sp.bind(void 0,e),final:w(sf.bind(void 0,e,t,r))}),sp=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},sf=async(e,t,r)=>{await a6(r,t)&&(e.writable&&e.end(),await t)},sh=async(e,t,r)=>{try{await a4(e),t.writable&&t.end()}catch(e){await a7(r),sb(t,e)}},sm=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await a6(r,t),await a6(n,t)&&(sb(e,o),await se(t,o))},sb=(e,t)=>{st(e,e.writable,t)},sy=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,to:o,binary:u=!0,preserveNewlines:a=!0}={})=>{let s=u||np.has(r),{subprocessStdout:l,waitReadableDestroy:D}=sn(e,n,t),{subprocessStdin:c,waitWritableFinal:d,waitWritableDestroy:p}=sc(e,o,t),{readableEncoding:f,readableObjectMode:h,readableHighWaterMark:m}=so(l,s),{read:b,onStdoutDataDone:y}=si({subprocessStdout:l,subprocess:e,binary:s,encoding:r,preserveNewlines:a}),g=new ei({read:b,...sd(c,e,d),destroy:w(sg.bind(void 0,{subprocessStdout:l,subprocessStdin:c,subprocess:e,waitReadableDestroy:D,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:m,writableHighWaterMark:c.writableHighWaterMark,readableObjectMode:h,writableObjectMode:c.writableObjectMode,encoding:f});return sa({subprocessStdout:l,onStdoutDataDone:y,readable:g,subprocess:e,subprocessStdin:c}),sh(c,g,l),g},sg=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:u},a)=>{await Promise.all([ss({subprocessStdout:e,subprocess:r,waitReadableDestroy:n},a),sm({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:u},a)])},sF=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let u=n||np.has(t),a=r_(e,r);return sE(aS({subprocessStdout:a,subprocess:e,binary:u,shouldEncode:!0,encoding:t,preserveNewlines:o}),a,e)},sE=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}},sC=(async()=>{})().constructor.prototype,sw=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(sC,e)]),s_=({timeout:e,signal:t,...r})=>{if(void 0!==t)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},sv=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:u,command:a,escapedCommand:s,context:l,onInternalError:D,controller:c})=>{let[d,[p,f],h,m,b]=await a0({subprocess:e,options:t,context:l,verboseInfo:n,fileDescriptors:o,originalStreams:u,onInternalError:D,controller:c});c.abort(),D.resolve();let y=sS({errorInfo:d,exitCode:p,signal:f,stdio:h.map((e,r)=>it(e,t,r)),all:it(m,t,"all"),ipcOutput:b,context:l,options:t,command:a,escapedCommand:s,startTime:r});return n5(y,n,t)},sS=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:u,context:a,options:s,command:l,escapedCommand:D,startTime:c})=>"error"in e?n8({error:e.error,command:l,escapedCommand:D,timedOut:"timeout"===a.terminationReason,isCanceled:"cancel"===a.terminationReason||"gracefulCancel"===a.terminationReason,isGracefullyCanceled:"gracefulCancel"===a.terminationReason,isMaxBuffer:e.error instanceof nQ,isForcefullyTerminated:a.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:u,options:s,startTime:c,isSync:!1}):n2({command:l,escapedCommand:D,stdio:n,all:o,ipcOutput:u,options:s,startTime:c}),sB=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([t,r])=>[t,sT(t,e[t],r)]));return{...e,...r}},sT=(e,t,r)=>sA.has(e)&&e$(t)&&e$(r)?{...t,...r}:r,sA=new Set(["env",...tu]),sR=(e,t,r,n)=>{let o=(e,t,n)=>sR(e,t,r,n),u=(...u)=>sx({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...u);return void 0!==n&&n(u,o,t),u},sx=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,createNested:o},u,...a)=>{if(e$(u))return o(e,sB(r,u),n);let{file:s,commandArguments:l,options:D,isSync:c}=sP({mapArguments:e,firstArgument:u,nextArguments:a,deepOptions:t,boundOptions:r});return c?((e,t,r)=>{let{file:n,commandArguments:o,command:u,escapedCommand:a,startTime:s,verboseInfo:l,options:D,fileDescriptors:c}=((e,t,r)=>{let{command:n,escapedCommand:o,startTime:u,verboseInfo:a}=tH(e,t,r),{file:s,commandArguments:l,options:D}=ng(e,t,i3(r));i6(D);let c=oV(ie,D,a,!0);return{file:s,commandArguments:l,command:n,escapedCommand:o,startTime:u,verboseInfo:a,options:D,fileDescriptors:c}})(e,t,r);return n5((({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,verboseInfo:u,fileDescriptors:a,startTime:s})=>{let l=i7({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,fileDescriptors:a,startTime:s});if(l.failed)return l;let{resultError:D,exitCode:c,signal:d,timedOut:p,isMaxBuffer:f}=(({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let u,a,s,l=(u=e,a=t,s=r,void 0!==u?u:i8(a,s)?new tK:void 0),D=l?.code==="ETIMEDOUT",c=l?.code==="ENOBUFS"&&null!==n&&n.some(e=>null!==e&&e.length>(([,e])=>e)(o));return{resultError:l,exitCode:t,signal:r,timedOut:D,isMaxBuffer:c}})(l,r),{output:h,error:m=D}=(({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(null===t)return{output:Array.from({length:3})};let u={},a=new Set([]);return{output:t.map((t,s)=>(({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:u,verboseInfo:a},{buffer:s,encoding:l,lines:D,stripFinalNewline:c,maxBuffer:d})=>{if(null===e)return;let p=eN(((e,t,r)=>{if(!t)return e;let n=(([,e])=>e)(r);return e.length>n?e.slice(0,n):e})(e,u,d)),{stdioItems:f,objectMode:h}=t[r],{serializedResult:m,finalResult:b=m}=iY({chunks:iK([p],f,l,n),objectMode:h,encoding:l,lines:D,stripFinalNewline:c,fdNumber:r});iJ({serializedResult:m,fdNumber:r,state:n,verboseInfo:a,encoding:l,stdioItems:f,objectMode:h});let y=s[r]?b:void 0;try{return void 0===n.error&&iQ(m,f,o),y}catch(e){return n.error=e,y}})({result:t,fileDescriptors:e,fdNumber:s,state:u,outputFiles:a,isMaxBuffer:n,verboseInfo:o},r)),...u}})({fileDescriptors:a,syncResult:l,options:r,isMaxBuffer:f,verboseInfo:u});return i5({error:m,exitCode:c,signal:d,timedOut:p,isMaxBuffer:f,stdio:h.map((e,t)=>it(e,r,t)),all:it((([,e,t],r)=>{if(r.all)return void 0===e?t:void 0===t?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,it(t,r,"all")]:Array.isArray(t)?[it(e,r,"all"),...t]:eU(e)&&eU(t)?eG([e,t]):`${e}${t}`})(h,r),r,"all"),options:r,command:n,escapedCommand:o,startTime:s})})({file:n,commandArguments:o,options:D,command:u,escapedCommand:a,verboseInfo:l,fileDescriptors:c,startTime:s}),l,D)})(s,l,D):((e,t,r,n)=>{let{file:o,commandArguments:u,command:a,escapedCommand:s,startTime:l,verboseInfo:D,options:c,fileDescriptors:d}=((e,t,r)=>{let{command:n,escapedCommand:o,startTime:u,verboseInfo:a}=tH(e,t,r),{file:s,commandArguments:l,options:D}=ng(e,t,r),c=s_(D),d=oV(ug,c,a,!1);return{file:s,commandArguments:l,command:n,escapedCommand:o,startTime:u,verboseInfo:a,options:c,fileDescriptors:d}})(e,t,r),{subprocess:p,promise:f}=(({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,command:u,escapedCommand:a,fileDescriptors:s})=>{let l;try{l=g(...nC(e,t,r))}catch(e){return(({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:u,verboseInfo:a})=>{var s,l;let D,c,d,p,f,h;o6(n);let m=new b;return s=m,l=n,D=ud(),c=ud(),d=ud(),p=Array.from({length:l.length-3},ud),f=ud(),h=[D,c,d,...p],Object.assign(s,{stdin:D,stdout:c,stderr:d,all:f,stdio:h}),Object.assign(m,{readable:up,writable:uf,duplex:uh}),{subprocess:m,promise:um(n1({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:u,isSync:!1}),a,o)}})({error:e,command:u,escapedCommand:a,fileDescriptors:s,options:r,startTime:n,verboseInfo:o})}let D=new AbortController;K(1/0,D.signal);let c=[...l.stdio];var d=l;let p=new Map;for(let[e,{stdioItems:t,direction:r}]of Object.entries(s)){for(let{stream:n}of t.filter(({type:e})=>ob.has(e)))uH(d,n,r,e);for(let{stream:n}of t.filter(({type:e})=>!ob.has(e)))uV({subprocess:d,stream:n,direction:r,fdNumber:e,pipeGroups:p,controller:D})}for(let[e,t]of p.entries())uU(1===t.length?t[0]:uF(t),e);((e,{cleanup:t,detached:r},{signal:n})=>{if(!t||r)return;let o=u6(()=>{e.kill()});H(n,()=>{o()})})(l,r,D);let f={},h=rC();l.kill=ri.bind(void 0,{kill:l.kill.bind(l),options:r,onInternalError:h,context:f,controller:D}),l.all=(({stdout:e,stderr:t},{all:r})=>r&&(e||t)?uF([e,t].filter(Boolean)):void 0)(l,r),((e,{encoding:t})=>{let r={readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap};e.readable=sr.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=sD.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=sy.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=sF.bind(void 0,e,t),e[Symbol.asyncIterator]=sF.bind(void 0,e,t,{})})(l,r),((e,{ipc:t})=>{Object.assign(e,uc(e,!1,t))})(l,r);let m=sv({subprocess:l,options:r,startTime:n,verboseInfo:o,fileDescriptors:s,originalStreams:c,command:u,escapedCommand:a,context:f,onInternalError:h,controller:D});return{subprocess:l,promise:m}})({file:o,commandArguments:u,options:c,startTime:l,verboseInfo:D,command:a,escapedCommand:s,fileDescriptors:d});p.pipe=au.bind(void 0,{source:p,sourcePromise:f,boundOptions:{},createNested:n});for(let[e,t]of sw){let r=t.value.bind(f);Reflect.defineProperty(p,e,{...t,value:r})}return rv.set(p,{options:c,fileDescriptors:d}),p})(s,l,D,o)},sP=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let[u,a,s]=eL(...Array.isArray(t)&&Array.isArray(t.raw)?((e,t)=>{let r=[];for(let[n,o]of e.entries())r=eK({templates:e,expressions:t,tokens:r,index:n,template:o});if(0===r.length)throw TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]})(t,r):[t,...r]),l=sB(sB(n,o),s),{file:D=u,commandArguments:c=a,options:d=l,isSync:p=!1}=e({file:u,commandArguments:a,options:l});return{file:D,commandArguments:c,options:d,isSync:p}},s$=(e,t)=>{if(t.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...n]=sO(e);return{file:r,commandArguments:n}},sO=e=>{if("string"!=typeof e)throw TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(""===t)return[];let r=[];for(let e of t.split(sk)){let t=r.at(-1);t&&t.endsWith("\\")?r[r.length-1]=`${t.slice(0,-1)} ${e}`:r.push(e)}return r},sk=/ +/g,sj=({options:e})=>({...sI(e),isSync:!0}),sI=e=>({options:{...sL(e),...e}}),sL=({input:e,inputFile:t,stdio:r})=>void 0===e&&void 0===t&&void 0===r?{stdin:"inherit"}:{},sM=sR(()=>({}));sR(()=>({isSync:!0})),sR(({file:e,commandArguments:t})=>s$(e,t)),sR(({file:e,commandArguments:t})=>({...s$(e,t),isSync:!0})),sR(({options:e})=>{if(!1===e.node)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}}),sR(({options:e})=>sI(e),{},{preferLocal:!0},(e,t,r)=>{e.sync=t(sj,r),e.s=e.sync});let{sendMessage:sU,getOneMessage:sN,getEachMessage:sW,getCancelSignal:sq}=(n=void 0!==R.channel,{...uc(R,!0,n),getCancelSignal:ne.bind(void 0,{anyProcess:R,channel:R.channel,isSubprocess:!0,ipc:n})});var sz,sH,sG,sV,sK,sY=JSON.parse('{"UU":"@doubao-dev/cli","rE":"1.0.0-rc.13","h_":"Doubao Plugins CLI"}');let sJ={name:sY.UU,version:sY.rE,description:sY.h_,registry:"https://registry.npmjs.org",appDev:{name:"@doubao-dev/plugin-app-dev",version:sY.rE},kit:{name:"@doubao-dev/kit",version:process.env.DBX_KIT_VERSION?.trim()||"0.10.0",lockCdn:{version:"0.10.0",url:"https://lf3-static.bytednsdoc.com/obj/eden-cn/rkz-zwwh-vhibvk/ljhwZthlaukjlkulzlp/kit-locks/public/0.10.0/b9a6e37aa01033f8a0e66224310b6d02c7205c3ad57c8e46467b3b1e21fd8416/package-lock.json",sha256:"b9a6e37aa01033f8a0e66224310b6d02c7205c3ad57c8e46467b3b1e21fd8416"}??void 0},auth:{baseUrl:"https://open.doubao.com",verificationUrl:"https://open.doubao.com/apps-plugin/oauth/device"},apiUrl:"https://open.doubao.com",apiHeaders:{"User-Agent":`doubao-dev-cli-${sY.rE}`},deviceApiUrl:"https://developer.doubao.com",consoleUrl:"https://open.doubao.com/console/plugins/"},sQ=l.join(N.homedir(),".dbx","token"),sX=l.join(N.homedir(),".doubao","token"),sZ={};function s0(e={}){let t={...sZ,...e},r=s1(t.baseUrl??"https://developer.doubao.com","baseUrl"),n=t.tokenPath??sQ;return{...t,baseUrl:r,verificationUrl:s1(t.verificationUrl??new URL("/oauth/device",r).href,"verificationUrl"),allowedOrigins:function(e,t){let r=new Set([new URL(t).origin]);for(let t of e??[]){let e;try{e=new URL(t)}catch{throw Error(`allowedOrigins 中的来源必须是完整的 HTTPS 地址:${t}`)}if("https:"!==e.protocol)throw Error(`allowedOrigins 中的来源必须使用 HTTPS:${t}`);r.add(e.origin)}return[...r]}(t.allowedOrigins,r),tokenPath:n,legacyTokenPath:t.tokenPath?void 0:sX,requestHeaders:new Headers(t.requestHeaders)}}function s2(e){return e.replace(/\/+$/,"")}function s1(e,t){let r;try{r=new URL(s2(e))}catch{throw Error(`${t} 必须是完整的 HTTPS URL`)}if("https:"!==r.protocol)throw Error(`${t} 必须使用 HTTPS`);return s2(r.toString())}let s8=B(y),s3="byted-doubao-open-dbx-cli",s6="dbx-cli",s9="aes-256-gcm";class s7 extends Error{constructor(e){super(e),this.name="CredentialStoreError"}}class s4 extends s7{constructor(){super("无法读取本地登录凭证:用于解密凭证的密钥文件 master.key 已丢失。请运行 dbx auth login 重新登录。")}}class s5{constructor(e,t){this.primary=e,this.fallback=t}async get(e){let t;if(await this.isFallbackAuthoritative(e))return this.fallback.get(e);try{let t=await this.primary.get(e);if(t)return t}catch(e){t=e}try{let t=await this.fallback.get(e);if(t)return t}catch(e){if(t)throw new s7(`从系统凭证存储读取登录凭证失败(${lc(t)});从备用加密文件读取也失败:${lc(e)}`);throw e}if(t)throw t instanceof Error?t:new s7(`从系统凭证存储读取登录凭证失败:${String(t)}`)}async set(e,t){let r;try{await this.primary.set(e,t)}catch(e){r=e}try{await this.fallback.set(e,t)}catch(t){if(r)throw new s7(`向系统凭证存储写入登录凭证失败(${lc(r)}),写入备用加密文件也失败(${lc(t)})`);throw await this.removeStaleFallbackAfterPrimaryWrite(e,t),t}r?await this.markFallbackAuthoritative(e):await this.clearFallbackAuthority(e)}async delete(e){let t;try{await this.primary.delete(e)}catch(e){t=e}try{await this.fallback.delete(e)}catch(e){if(t)throw new s7(`从系统凭证存储删除登录凭证失败(${lc(t)}),从备用加密文件删除也失败(${lc(e)})`);throw e}t?await this.markFallbackAuthoritativeOrThrow(e,t):await this.clearFallbackAuthority(e)}async isFallbackAuthoritative(e){return!!li(this.fallback)&&this.fallback.isFallbackAuthoritative(e)}async markFallbackAuthoritative(e){li(this.fallback)&&await this.fallback.markFallbackAuthoritative(e)}async markFallbackAuthoritativeOrThrow(e,t){if(!li(this.fallback))throw t instanceof Error?t:new s7(`系统凭证删除失败,且备用存储无法记录删除状态:${String(t)}`);try{await this.fallback.markFallbackAuthoritative(e)}catch(e){throw new s7(`系统凭证删除失败(${lc(t)}),且无法记录备用凭证删除状态:${lc(e)}`)}}async clearFallbackAuthority(e){li(this.fallback)&&await this.fallback.clearFallbackAuthority(e)}async removeStaleFallbackAfterPrimaryWrite(e,t){let r=[];try{await this.fallback.delete(e)}catch(e){r.push(e)}try{await this.clearFallbackAuthority(e)}catch(e){r.push(e)}if(r.length>0)throw new s7(`系统凭证已写入,但备用加密文件写入失败(${lc(t)}),且清理旧备用凭证失败:${r.map(lc).join(";")}`)}}class le{constructor(e={}){this.baseDir=e.baseDir??("darwin"===process.platform?l.join(N.homedir(),"Library","Application Support",s6):"win32"===process.platform?l.join(process.env.APPDATA||l.join(N.homedir(),"AppData","Roaming"),s6):l.join(process.env.XDG_DATA_HOME||l.join(N.homedir(),".local","share"),s6))}async get(e){var t,r;let n,o,u=this.credentialFilePath(e);try{n=await ee.readFile(u,"utf8")}catch(e){if(lD(e)&&"ENOENT"===e.code)return;throw new s7(`读取加密凭证文件失败:${lc(e)}`)}try{o=JSON.parse(n)}catch(e){throw new s7(`加密凭证文件不是有效的 JSON:${lc(e)}`)}if(!((t=o)&&"object"==typeof t&&1===t.version&&t.algorithm===s9&&"string"==typeof t.iv&&"string"==typeof t.authTag&&"string"==typeof t.ciphertext))throw new s7("无法读取本地登录凭证:当前 CLI 不支持凭证文件中的格式或字段。");let a=await this.readMasterKey();try{let t=eh.createDecipheriv(s9,a,Buffer.from(o.iv,"base64url"));return t.setAAD(Buffer.from((r=e,`${s3}:${r}`),"utf8")),t.setAuthTag(Buffer.from(o.authTag,"base64url")),Buffer.concat([t.update(Buffer.from(o.ciphertext,"base64url")),t.final()]).toString("utf8")}catch(e){throw new s7(`解密凭证文件失败:${lc(e)}`)}}async set(e,t){var r;let n=await this.readOrCreateMasterKey(),o=eh.randomBytes(12),u=eh.createCipheriv(s9,n,o);u.setAAD(Buffer.from((r=e,`${s3}:${r}`),"utf8"));let a=Buffer.concat([u.update(t,"utf8"),u.final()]),s={version:1,algorithm:s9,iv:o.toString("base64url"),authTag:u.getAuthTag().toString("base64url"),ciphertext:a.toString("base64url")};await ln(this.credentialFilePath(e),`${JSON.stringify(s,null,2)}
30
30
  `)}async delete(e){try{await ee.unlink(this.credentialFilePath(e))}catch(e){if(!lD(e)||"ENOENT"!==e.code)throw new s7(`删除加密凭证文件失败:${lc(e)}`)}}async isFallbackAuthoritative(e){try{let t=await ee.readFile(this.authorityFilePath(e),"utf8"),r=JSON.parse(t);return 1===r.version&&"fallback"===r.authority}catch(e){if(lD(e)&&"ENOENT"===e.code)return!1;throw new s7(`读取登录凭证权威副本标记失败:${lc(e)}`)}}async markFallbackAuthoritative(e){await ln(this.authorityFilePath(e),`${JSON.stringify({version:1,authority:"fallback"},null,2)}
31
31
  `)}async clearFallbackAuthority(e){try{await ee.unlink(this.authorityFilePath(e))}catch(e){if(!lD(e)||"ENOENT"!==e.code)throw new s7(`清理登录凭证权威副本标记失败:${lc(e)}`)}}masterKeyPath(){return l.join(this.baseDir,"master.key")}credentialFilePath(e){let t=eh.createHash("sha256").update(e).digest("hex");return l.join(this.baseDir,"credentials",`${t}.json`)}authorityFilePath(e){let t=eh.createHash("sha256").update(e).digest("hex");return l.join(this.baseDir,"authorities",`${t}.json`)}async readMasterKey(){try{var e=await ee.readFile(this.masterKeyPath(),"utf8");let t=Buffer.from(e.trim(),"base64url");if(32!==t.length)throw new s7("无法读取本地登录凭证:密钥文件 master.key 的内容无法解析为 32 字节密钥。");return t}catch(e){if(lD(e)&&"ENOENT"===e.code)throw new s4;if(e instanceof s7)throw e;throw new s7(`无法读取用于解密本地登录凭证的密钥文件 master.key:${lc(e)}`)}}async readOrCreateMasterKey(){try{return await this.readMasterKey()}catch(e){if(!(e instanceof s4))throw e}let e=eh.randomBytes(32);try{return await lo(this.masterKeyPath(),`${e.toString("base64url")}
32
32
  `)?e:this.readMasterKey()}catch(e){throw new s7(`无法保存用于加密本地登录凭证的密钥文件 master.key:${lc(e)}`)}}}class lt{async get(e){try{let{stdout:t}=await s8("security",["find-generic-password","-a",e,"-s",s3,"-w"]);return String(t).replace(/\n$/,"")}catch(e){if(lu(e))return;throw new s7(`从 macOS 钥匙串读取登录凭证失败:${lc(e)}`)}}async set(e,t){try{await s8("security",["add-generic-password","-a",e,"-s",s3,"-w",t,"-U"])}catch(e){throw new s7(`向 macOS 钥匙串写入登录凭证失败:${lc(e)}`)}}async delete(e){try{await s8("security",["delete-generic-password","-a",e,"-s",s3])}catch(e){if(lu(e))return;throw new s7(`从 macOS 钥匙串删除登录凭证失败:${lc(e)}`)}}}class lr{async get(e){try{let{stdout:t}=await s8("secret-tool",["lookup","service",s3,"account",e]);return String(t).replace(/\n$/,"")}catch(e){if(la(e))return;throw new s7(`从 Secret Service 读取登录凭证失败:${lc(e)}`)}}async set(e,t){try{var r,n,o;await (r="secret-tool",n=["store","--label","Doubao Open CLI 登录凭证","service",s3,"account",e],o=t,new Promise((e,t)=>{let u=g(r,n,{stdio:["pipe","ignore","pipe"]}),a="";u.stderr.setEncoding("utf8"),u.stderr.on("data",e=>{a+=String(e)}),u.on("error",t),u.on("close",n=>{0===n?e():t(Error(a.trim()||`${r} 已退出,退出码为 ${n}`))}),u.stdin.end(o)}))}catch(e){throw new s7(`向 Secret Service 写入登录凭证失败:${lc(e)}`)}}async delete(e){try{await s8("secret-tool",["clear","service",s3,"account",e])}catch(e){if(la(e))return;throw new s7(`从 Secret Service 删除登录凭证失败:${lc(e)}`)}}}async function ln(e,t){let r=l.dirname(e);await ee.mkdir(r,{recursive:!0,mode:448}),"win32"!==process.platform&&await ee.chmod(r,448);let n=l.join(r,`.${l.basename(e)}.${process.pid}.${Date.now()}.tmp`);try{await ee.writeFile(n,t,{mode:384,flag:"wx"}),"win32"!==process.platform&&await ee.chmod(n,384),await ee.rename(n,e),"win32"!==process.platform&&await ee.chmod(e,384)}finally{try{await ee.unlink(n)}catch{}}}async function lo(e,t){let r=l.dirname(e);await ee.mkdir(r,{recursive:!0,mode:448}),"win32"!==process.platform&&await ee.chmod(r,448);let n=l.join(r,`.${l.basename(e)}.${process.pid}.${Date.now()}.${eh.randomBytes(8).toString("hex")}.tmp`);try{await ee.writeFile(n,t,{mode:384,flag:"wx"}),"win32"!==process.platform&&await ee.chmod(n,384);try{return await ee.link(n,e),"win32"!==process.platform&&await ee.chmod(e,384),!0}catch(e){if(lD(e)&&"EEXIST"===e.code)return!1;throw e}}finally{try{await ee.unlink(n)}catch{}}}function li(e){return"function"==typeof e.isFallbackAuthoritative&&"function"==typeof e.markFallbackAuthoritative&&"function"==typeof e.clearFallbackAuthority}function lu(e){let t=ls(e),r=ll(e);return(1===t||44===t)&&(r.includes("could not be found")||r.includes("The specified item could not be found"))}function la(e){let t=ls(e),r=ll(e);return 1===t&&(r.includes("could not be found")||r.includes("No matching items")||""===r.trim())}function ls(e){return"object"==typeof e&&null!==e&&"code"in e?e.code:void 0}function ll(e){return"object"==typeof e&&null!==e&&"stderr"in e?String(e.stderr??""):""}function lD(e){return e instanceof Error&&"code"in e}function lc(e){if("object"==typeof e&&null!==e&&"stderr"in e){let t=String(e.stderr??"").trim();if(t)return t}return e instanceof Error&&e.message?e.message:String(e)}class ld extends Error{constructor(e,t){super(e),this.code=t,this.name="AuthError"}}class lp extends ld{constructor(e="尚未登录,请运行 dbx auth login 完成登录。"){super(e,"NOT_LOGGED_IN"),this.name="NotLoggedInError"}}class lf extends ld{constructor(e="登录凭证已过期,请运行 dbx auth login 重新登录。"){super(e,"TOKEN_EXPIRED"),this.name="TokenExpiredError"}}class lh extends ld{constructor(e,t="DEVICE_AUTH_FAILED",r={}){super(e,t),this.name="DeviceAuthError",this.logId=r.logId}}async function lm(e,t={}){let r,n=process.env.DBX_ACCESS_TOKEN?.trim()||void 0;if(n)return{accessToken:n,tokenType:"Bearer",expiresAt:0xf4865700,baseUrl:t.envTokenBaseUrl??""};let o=await lC(e);if(void 0===o)return lw(e,t);try{r=JSON.parse(o)}catch(e){return}if(lE(r)){if(!t.allowExpired&&lg(r))return void await ly(e,t);let n=await l_(t).get(r.credentialAccount);if(!n)throw new s7("已找到登录记录,但登录凭证缺失或无法访问。请在能够访问凭证存储的终端中重新运行 dbx auth login。");return{accessToken:n,tokenType:r.tokenType,expiresAt:r.expiresAt,baseUrl:r.baseUrl}}if(lF(r))return!t.allowExpired&&lg(r)?void await ly(e,t):(await lb(e,r,t),r)}async function lb(e,t,r={}){let n={version:2,storage:"keychain",credentialAccount:lv(e),tokenType:t.tokenType,expiresAt:t.expiresAt,baseUrl:t.baseUrl};await l_(r).set(n.credentialAccount,t.accessToken),await ee.mkdir(l.dirname(e),{recursive:!0,mode:448}),"win32"!==process.platform&&await ee.chmod(l.dirname(e),448);let o=`${e}.${process.pid}.${Date.now()}.tmp`;await ee.writeFile(o,`${JSON.stringify(n,null,2)}
@@ -90,7 +90,7 @@ ${pb.cyan(p9)}
90
90
  `)},info:e=>{fD.message(e,{symbol:pb.blue(fe)})},success:e=>{fD.message(e,{symbol:pb.green(ft)})},step:e=>{fD.message(e,{symbol:pb.green(p3)})},warn:e=>{fD.message(e,{symbol:pb.yellow(fr)})},warning:e=>{fD.warn(e)},error:e=>{fD.message(e,{symbol:pb.red(fn)})}};function fc(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function fd(e){console.log(T(e))}function fp(e){console.error(T(e))}pb.gray(p6);let ff=fc()?fD:{info:fd,step:fd,success:fd,warn:fp,error:fp};(sV=sK||(sK={})).None=()=>({dispose(){}}),sV.once=function(e){return(t,r,n)=>{let o=!1,u=e(e=>{if(!o)return o=!0,t.call(r,e)},null,n);return o&&u.dispose(),u}},sV.map=function(e,t){return(r,n,o)=>e(e=>r.call(n,t(e)),null,o)},sV.filter=function(e,t){return(r,n,o)=>e(e=>t(e)&&r.call(n,e),null,o)},sV.debounce=function(e,t,r=100){let n,o,u;return(a,s,l)=>(n=e(e=>{o=t(o,e),clearTimeout(u),u=setTimeout(()=>{let e=o;o=void 0,a.call(s,e)},r)}),{dispose(){n.dispose(),clearTimeout(u)}})};class fh{constructor(){this._listeners=new Set,this._disposed=!1,this.event=e=>this._disposed?{dispose(){}}:(this._listeners.add(e),{dispose:()=>{this._listeners.delete(e)}})}fire(e){if(!this._disposed)for(let t of[...this._listeners])try{t(e)}catch{}}dispose(){this._disposed||(this._disposed=!0,this._listeners.clear())}get hasListeners(){return this._listeners.size>0}}class fm{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(0===this._toDispose.size)return;let e=this._toDispose.values();for(let t of(this._toDispose.clear(),e))try{t.dispose()}catch{}}add(e){return this._isDisposed?console.warn("Adding to a disposed DisposableStore"):this._toDispose.add(e),e}get size(){return this._toDispose.size}}class fb{constructor(){this._store=new fm}dispose(){this._store.dispose()}addDispose(e){return this._store.add(e)}}class fy extends fb{constructor(e,t){super(),this.valueOrFactoryInit=e,this._initialized=!1,this._onStateChangeEmitter=new fh,this.onStateChange=this._onStateChangeEmitter.event,this._options={},this._name="AnonymousState",this.addDispose(this._onStateChangeEmitter),this._options=t||{},this._name=t?.name||"AnonymousState"}get(){return this._initialized||("function"==typeof this.valueOrFactoryInit?this.set(this.valueOrFactoryInit()):this.set(this.valueOrFactoryInit)),this._value}waitUntil(e,t={}){let r=this.get();if(e(r))return Promise.resolve(r);let{timeoutMs:n,signal:o}=t;return new Promise((t,r)=>{let u=!1,a=e=>{u||(u=!0,clearTimeout(D),s.dispose(),o?.removeEventListener("abort",l),e())},s=this.onStateChange(({to:r})=>{e(r)&&a(()=>t(r))}),l=()=>{a(()=>r(o?.reason instanceof Error?o.reason:new fF))},D=void 0!==n?setTimeout(()=>a(()=>r(new fg(n))),n):void 0;o?.aborted?l():o?.addEventListener("abort",l,{once:!0})})}set(e){if(this._initialized){if(this._equals(this._value,e))return;let t=this._value;this._value=e,this._onStateChangeEmitter.fire({from:t,to:e})}else this._value=e,this._initialized=!0}_equals(e,t){return this._options.equals?.(e,t)||e===t}get name(){return this._name}}class fg extends Error{constructor(e){super(`State wait timed out after ${e}ms`),this.name="StateWaitTimeoutError"}}class fF extends Error{constructor(){super("State wait cancelled"),this.name="StateWaitCancelledError"}}function fE(e){if("string"==typeof e)try{return JSON.parse(e)}catch{return}}function fC(e=process.env){return!e.DBX_TUI_NO_BLOCKS&&("vscode"===e.TERM_PROGRAM||"WezTerm"===e.TERM_PROGRAM||"xterm-kitty"===e.TERM||"wezterm"===e.TERM||!!e.WT_SESSION)}let fw=(e=0)=>t=>`\u001B[${t+e}m`,f_=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,fv=(e=0)=>(t,r,n)=>`\u001B[${38+e};2;${t};${r};${n}m`,fS={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(fS.modifier),[...Object.keys(fS.color),...Object.keys(fS.bgColor)];let fB=function(){let e=new Map;for(let[t,r]of Object.entries(fS)){for(let[t,n]of Object.entries(r))fS[t]={open:`\u001B[${n[0]}m`,close:`\u001B[${n[1]}m`},r[t]=fS[t],e.set(n[0],n[1]);Object.defineProperty(fS,t,{value:r,enumerable:!1})}return Object.defineProperty(fS,"codes",{value:e,enumerable:!1}),fS.color.close="\x1b[39m",fS.bgColor.close="\x1b[49m",fS.color.ansi=fw(),fS.color.ansi256=f_(),fS.color.ansi16m=fv(),fS.bgColor.ansi=fw(10),fS.bgColor.ansi256=f_(10),fS.bgColor.ansi16m=fv(10),Object.defineProperties(fS,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map(e=>e+e).join(""));let n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>fS.rgbToAnsi256(...fS.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){let t,r,n;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)r=t=((e-232)*10+8)/255,n=t;else{let o=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(o/6)/5,n=o%6/5}let o=2*Math.max(t,r,n);if(0===o)return 30;let u=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===o&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>fS.ansi256ToAnsi(fS.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>fS.ansi256ToAnsi(fS.hexToAnsi256(e)),enumerable:!1}}),fS}();function fT(e,t=globalThis.Deno?globalThis.Deno.args:R.argv){let r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return -1!==n&&(-1===o||n<o)}let{env:fA}=R;function fR(t,r={}){var n;return 0!==(n=function(t,{streamIsTTY:r,sniffFlags:n=!0}={}){let o=function(){if("FORCE_COLOR"in fA)return"true"===fA.FORCE_COLOR?1:"false"===fA.FORCE_COLOR?0:0===fA.FORCE_COLOR.length?1:Math.min(Number.parseInt(fA.FORCE_COLOR,10),3)}();void 0!==o&&(e=o);let u=n?e:o;if(0===u)return 0;if(n){if(fT("color=16m")||fT("color=full")||fT("color=truecolor"))return 3;if(fT("color=256"))return 2}if("TF_BUILD"in fA&&"AGENT_NAME"in fA)return 1;if(t&&!r&&void 0===u)return 0;let a=u||0;if("dumb"===fA.TERM)return a;if("win32"===R.platform){let e=N.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in fA)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in fA)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in fA)||"codeship"===fA.CI_NAME?1:a;if("TEAMCITY_VERSION"in fA)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(fA.TEAMCITY_VERSION);if("truecolor"===fA.COLORTERM||"xterm-kitty"===fA.TERM||"xterm-ghostty"===fA.TERM||"wezterm"===fA.TERM)return 3;if("TERM_PROGRAM"in fA){let e=Number.parseInt((fA.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(fA.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(fA.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(fA.TERM)||"COLORTERM"in fA?1:a}(t,{streamIsTTY:t&&t.isTTY,...r}))&&{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}fT("no-color")||fT("no-colors")||fT("color=false")||fT("color=never")?e=0:(fT("color")||fT("colors")||fT("color=true")||fT("color=always"))&&(e=1);let{stdout:fx,stderr:fP}={stdout:fR({isTTY:I.isatty(1)}),stderr:fR({isTTY:I.isatty(2)})},f$=Symbol("GENERATOR"),fO=Symbol("STYLER"),fk=Symbol("IS_EMPTY"),fj=["ansi","ansi","ansi256","ansi16m"],fI=Object.create(null);function fL(e){let t;return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let r=fx?fx.level:0;e.level=void 0===t.level?r:t.level})(t=(...e)=>e.join(" "),e),Object.setPrototypeOf(t,fL.prototype),t}for(let[e,t]of(Object.setPrototypeOf(fL.prototype,Function.prototype),Object.entries(fB)))fI[e]={get(){let r=fW(this,fN(t.open,t.close,this[fO]),this[fk]);return Object.defineProperty(this,e,{value:r}),r}};fI.visible={get(){let e=fW(this,this[fO],!0);return Object.defineProperty(this,"visible",{value:e}),e}};let fM=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?fB[r].ansi16m(...n):"ansi256"===t?fB[r].ansi256(fB.rgbToAnsi256(...n)):fB[r].ansi(fB.rgbToAnsi(...n)):"hex"===e?fM("rgb",t,r,...fB.hexToRgb(...n)):fB[r][e](...n);for(let e of["rgb","hex","ansi256"])fI[e]={get(){let{level:t}=this;return function(...r){return fW(this,fN(fM(e,fj[t],"color",...r),fB.color.close,this[fO]),this[fk])}}},fI["bg"+e[0].toUpperCase()+e.slice(1)]={get(){let{level:t}=this;return function(...r){return fW(this,fN(fM(e,fj[t],"bgColor",...r),fB.bgColor.close,this[fO]),this[fk])}}};let fU=Object.defineProperties(()=>{},{...fI,level:{enumerable:!0,get(){return this[f$].level},set(e){this[f$].level=e}}}),fN=(e,t,r)=>{let n,o;return void 0===r?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},fW=(e,t,r)=>{let n=(...e)=>fq(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,fU),n[f$]=e,n[fO]=t,n[fk]=r,n},fq=(e,t)=>{if(e.level<=0||!t)return e[fk]?"":t;let r=e[fO];if(void 0===r)return t;let{openAll:n,closeAll:o}=r;if(t.includes("\x1b"))for(;void 0!==r;)t=function(e,t,r){let n=e.indexOf(t);if(-1===n)return e;let o=t.length,u=0,a="";do a+=e.slice(u,n)+t+r,u=n+o,n=e.indexOf(t,u);while(-1!==n);return a+e.slice(u)}(t,r.close,r.open),r=r.parent;let u=t.indexOf("\n");return -1!==u&&(t=function(e,t,r,n){let o=0,u="";do{let a="\r"===e[n-1];u+=e.slice(o,a?n-1:n)+t+(a?"\r\n":"\n")+r,o=n+1,n=e.indexOf("\n",o)}while(-1!==n);return u+e.slice(o)}(t,o,n,u)),n+t+o};Object.defineProperties(fL.prototype,fI);let fz=fL();fL({level:fP?fP.level:0});let fH=fz,fG=(e,t,r,n)=>{if("length"===r||"prototype"===r||"arguments"===r||"caller"===r)return;let o=Object.getOwnPropertyDescriptor(e,r),u=Object.getOwnPropertyDescriptor(t,r);(fV(o,u)||!n)&&Object.defineProperty(e,r,u)},fV=function(e,t){return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},fK=(e,t)=>`/* Wrapped ${e}*/
91
91
  ${t}`,fY=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),fJ=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),fQ=new WeakMap,fX=(e,t={})=>{let r;if("function"!=typeof e)throw TypeError("Expected a function");let n=0,o=e.displayName||e.name||"<anonymous>",u=function(...a){if(fQ.set(u,++n),1===n)r=e.apply(this,a),e=void 0;else if(!0===t.throw)throw Error(`Function \`${o}\` can only be called once`);return r};return!function(e,t,{ignoreNonConfigurable:r=!1}={}){let n,{name:o}=e;for(let n of Reflect.ownKeys(t))fG(e,t,n,r);(n=Object.getPrototypeOf(t))!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n),((e,t,r)=>{let n=""===r?"":`with ${r.trim()}() `,o=fK.bind(null,n,t.toString());Object.defineProperty(o,"name",fJ);let{writable:u,enumerable:a,configurable:s}=fY;Object.defineProperty(e,"toString",{value:o,writable:u,enumerable:a,configurable:s})})(e,t,o)}(u,e),fQ.set(u,n),u};fX.callCount=e=>{if(!fQ.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return fQ.get(e)};let fZ=R.stderr.isTTY?R.stderr:R.stdout.isTTY?R.stdout:void 0,f0=fZ?fX(()=>{u6(()=>{fZ.write("\x1b[?25h")},{alwaysLast:!0})}):()=>{},f2=!1,f1={};f1.show=(e=R.stderr)=>{e.isTTY&&(f2=!1,e.write("\x1b[?25h"))},f1.hide=(e=R.stderr)=>{e.isTTY&&(f0(),f2=!0,e.write("\x1b[?25l"))},f1.toggle=(e,t)=>{void 0!==e&&(f2=e),f2?f1.show(t):f1.hide(t)};let f8={info:fH.blue("ℹ"),success:fH.green("✔"),warning:fH.yellow("⚠"),error:fH.red("✖")},f3={info:fH.blue("i"),success:fH.green("√"),warning:fH.yellow("‼"),error:fH.red("\xd7")},f6=("win32"!==R.platform?"linux"!==R.env.TERM:R.env.CI||R.env.WT_SESSION||R.env.TERMINUS_SUBLIME||"{cmd::Cmder}"===R.env.ConEmuTask||"Terminus-Sublime"===R.env.TERM_PROGRAM||"vscode"===R.env.TERM_PROGRAM||"xterm-256color"===R.env.TERM||"alacritty"===R.env.TERM||"JetBrains-JediTerm"===R.env.TERMINAL_EMULATOR)?f8:f3,f9=function({onlyFirst:e=!1}={}){return RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}();function f7(e){if("string"!=typeof e)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(f9,"")}let f4=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],f5=[12288,12288,65281,65376,65504,65510],he=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101594,101631,101664,101760,101874,101888,102801,102816,102866,110576,110579,110581,110587,110589,110590,110592,110888,110898,110898,110928,110930,110933,110933,110948,110952,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127406,127406,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128729,128732,128735,128747,128748,128756,128764,128986,128986,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129734,129736,129736,129740,129757,129759,129771,129775,129786,131072,196605,196608,262141],ht=(e,t)=>{let r=0,n=Math.floor(e.length/2)-1;for(;r<=n;){let o=Math.floor((r+n)/2),u=2*o;if(t<e[u])n=o-1;else{if(!(t>e[u+1]))return!0;r=o+1}}return!1},[hr,hn]=function(e){let t=e[0],r=e[1];for(let n=0;n<e.length;n+=2){let o=e[n],u=e[n+1];if(19968>=o&&19968<=u)return[o,u];u-o>r-t&&(t=o,r=u)}return[t,r]}(he),ho=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,hi=new Intl.Segmenter,hu=/^\p{Default_Ignorable_Code_Point}$/u,ha=new class{#E=0;start(){this.#E++,1===this.#E&&this.#C()}stop(){if(this.#E<=0)throw Error("`stop` called more times than `start`");this.#E--,0===this.#E&&this.#w()}#C(){"win32"!==R.platform&&R.stdin.isTTY&&(R.stdin.setRawMode(!0),R.stdin.on("data",this.#_),R.stdin.resume())}#w(){R.stdin.isTTY&&(R.stdin.off("data",this.#_),R.stdin.pause(),R.stdin.setRawMode(!1))}#_(e){3===e[0]&&R.emit("SIGINT")}},hs=e_("../../../node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/index.js");class hl{#v=0;#S=!1;#B=0;#T=0;#A;#R;#x;#P;#$;#O;#k;#j;#I;#L;#M;color;constructor(e){"string"==typeof e&&(e={text:e}),this.#A={color:"cyan",stream:R.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#A.color,this.spinner=this.#A.spinner,this.#$=this.#A.interval,this.#x=this.#A.stream,this.#O="boolean"==typeof this.#A.isEnabled?this.#A.isEnabled:function({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&"dumb"!==process.env.TERM&&!("CI"in process.env))}({stream:this.#x}),this.#k="boolean"==typeof this.#A.isSilent&&this.#A.isSilent,this.text=this.#A.text,this.prefixText=this.#A.prefixText,this.suffixText=this.#A.suffixText,this.indent=this.#A.indent,"test"===R.env.NODE_ENV&&(this._stream=this.#x,this._isEnabled=this.#O,Object.defineProperty(this,"_linesToClear",{get(){return this.#v},set(e){this.#v=e}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#T}}),Object.defineProperty(this,"_lineCount",{get(){return this.#B}}))}get indent(){return this.#j}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw Error("The `indent` option must be an integer from 0 and up");this.#j=e,this.#U()}get interval(){return this.#$??this.#R.interval??100}get spinner(){return this.#R}set spinner(e){if(this.#T=0,this.#$=void 0,"object"==typeof e){if(void 0===e.frames)throw Error("The given spinner must have a `frames` property");this.#R=e}else if(tF())if(void 0===e)this.#R=hs.dots;else if("default"!==e&&hs[e])this.#R=hs[e];else throw Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);else this.#R=hs.line}get text(){return this.#I}set text(e=""){this.#I=e,this.#U()}get prefixText(){return this.#L}set prefixText(e=""){this.#L=e,this.#U()}get suffixText(){return this.#M}set suffixText(e=""){this.#M=e,this.#U()}get isSpinning(){return void 0!==this.#P}#N(e=this.#L,t=" "){return"string"==typeof e&&""!==e?e+t:"function"==typeof e?e()+t:""}#W(e=this.#M,t=" "){return"string"==typeof e&&""!==e?t+e:"function"==typeof e?t+e():""}#U(){let e=this.#x.columns??80,t=this.#N(this.#L,"-"),r=this.#W(this.#M,"-"),n=" ".repeat(this.#j)+t+"--"+this.#I+"--"+r;for(let t of(this.#B=0,f7(n).split("\n")))this.#B+=Math.max(1,Math.ceil(function(e,t={}){if("string"!=typeof e||0===e.length)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=f7(e)),0===e.length)return 0;let o=0,u={ambiguousAsWide:!r};for(let{segment:t}of hi.segment(e)){let e=t.codePointAt(0);if(!(e<=31)&&(!(e>=127)||!(e<=159))&&(!(e>=8203)||!(e<=8207))&&65279!==e&&(!(e>=768)||!(e<=879))&&(!(e>=6832)||!(e<=6911))&&(!(e>=7616)||!(e<=7679))&&(!(e>=8400)||!(e<=8447))&&(!(e>=65056)||!(e<=65071))&&(!(e>=55296)||!(e<=57343))&&(!(e>=65024)||!(e<=65039))&&!hu.test(t)){if(ho().test(t)){o+=2;continue}o+=function(e,{ambiguousAsWide:t=!1}={}){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`);return!(e<12288)&&!(e>65510)&&ht(f5,e)||e>=hr&&e<=hn||!(e<4352)&&!(e>262141)&&ht(he,e)||t&&!(e<161)&&!(e>1114109)&&ht(f4,e)?2:1}(e,u)}}return o}(t,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#O&&!this.#k}set isEnabled(e){if("boolean"!=typeof e)throw TypeError("The `isEnabled` option must be a boolean");this.#O=e}get isSilent(){return this.#k}set isSilent(e){if("boolean"!=typeof e)throw TypeError("The `isSilent` option must be a boolean");this.#k=e}frame(){let{frames:e}=this.#R,t=e[this.#T];return this.color&&(t=fH[this.color](t)),this.#T=++this.#T%e.length,("string"==typeof this.#L&&""!==this.#L?this.#L+" ":"")+t+("string"==typeof this.text?" "+this.text:"")+("string"==typeof this.#M&&""!==this.#M?" "+this.#M:"")}clear(){if(!this.#O||!this.#x.isTTY)return this;this.#x.cursorTo(0);for(let e=0;e<this.#v;e++)e>0&&this.#x.moveCursor(0,-1),this.#x.clearLine(1);return(this.#j||this.lastIndent!==this.#j)&&this.#x.cursorTo(this.#j),this.lastIndent=this.#j,this.#v=0,this}render(){return this.#k||(this.clear(),this.#x.write(this.frame()),this.#v=this.#B),this}start(e){return e&&(this.text=e),this.#k||(this.#O?this.isSpinning||(this.#A.hideCursor&&f1.hide(this.#x),this.#A.discardStdin&&R.stdin.isTTY&&(this.#S=!0,ha.start()),this.render(),this.#P=setInterval(this.render.bind(this),this.interval)):this.text&&this.#x.write(`- ${this.text}
92
92
  `)),this}stop(){return this.#O&&(clearInterval(this.#P),this.#P=void 0,this.#T=0,this.clear(),this.#A.hideCursor&&f1.show(this.#x),this.#A.discardStdin&&R.stdin.isTTY&&this.#S&&(ha.stop(),this.#S=!1)),this}succeed(e){return this.stopAndPersist({symbol:f6.success,text:e})}fail(e){return this.stopAndPersist({symbol:f6.error,text:e})}warn(e){return this.stopAndPersist({symbol:f6.warning,text:e})}info(e){return this.stopAndPersist({symbol:f6.info,text:e})}stopAndPersist(e={}){if(this.#k)return this;let t=e.prefixText??this.#L,r=this.#N(t," "),n=e.symbol??" ",o=e.text??this.text,u=e.suffixText??this.#M,a=r+n+("string"==typeof o?" "+o:"")+this.#W(u," ")+"\n";return this.stop(),this.#x.write(a),this}}async function hD(e,t){let r="function"==typeof e,n="function"==typeof e.then;if(!r&&!n)throw TypeError("Parameter `action` must be a Function or a Promise");let{successText:o,failText:u}="object"==typeof t?t:{successText:void 0,failText:void 0},a=new hl(t).start();try{let t=r?e(a):e,n=await t;return a.succeed(void 0===o?void 0:"string"==typeof o?o:o(n)),n}catch(e){throw a.fail(void 0===u?void 0:"string"==typeof u?u:u(e)),e}}let hc=_("dbx");async function hd(e,t,r,n){r?.throwIfAborted();let o=e.title??"应用开发工具",u=l.join(q(),".dbx/tools",e.name,e.version),a=()=>(function(e,t){let r=e.name===sJ.kit.name?process.env.DBX_KIT_PATH?.trim():void 0;if(!r)return;let n=hm(l.resolve(r,"package.json"),t);if(!n)throw Error(`本地 Kit 的 SDK 入口不存在,请先构建:${r}`);return n})(e,t)??hh(import.meta.url,e,t)??hh(l.join(u,"package.json"),e,t),s=a();if(!s){let l=performance.now(),D=()=>`(${Math.floor((performance.now()-l)/1e3)}s)`,c=!n&&fc()?new hl({text:` 正在安装${o}`,stream:process.stdout,discardStdin:!1}).start():void 0,d=n?.interactive?n.ui:void 0,p=`正在安装${o}`;c||(n?.log??ff).info(p),d?.update({message:`${p} ${D()}`});let f=(c||d)&&setInterval(()=>{let e=D();c&&(c.suffixText=e),d?.update({message:`${p} ${e}`})},1e3);try{await hb(e,t,u,r),c&&(c.suffixText=D(),c.succeed(` ${o}已安装`)),d?.update({message:`${o}已安装 ${D()}`})}catch(t){throw c?.fail(r?.aborted?` 已取消安装${o}`:` ${o}安装失败(${e.name}@${e.version})`),t}finally{clearInterval(f)}s=a()}if(!s)throw Error(`${e.name} 的入口 ${t} 不存在`);return m(s).href}async function hp(e,t){let r=sJ.kit.lockCdn;if(r&&e.name===sJ.kit.name&&r.version===e.version)try{let n=AbortSignal.timeout(3e3),o=await fetch(r.url,{redirect:"error",signal:t?AbortSignal.any([t,n]):n});if(!o.ok)throw Error(`Kit 依赖锁 CDN 返回 HTTP ${o.status}`);let u=Buffer.from(await o.arrayBuffer());if(em("sha256",u)!==r.sha256)throw Error("Kit 依赖锁 SHA-256 校验失败");let a=fE(u.toString("utf8"));if(a?.lockfileVersion===3&&a.packages?.[""]?.dependencies?.[e.name]===e.version)return{lock:a,contents:u}}catch(e){t?.throwIfAborted(),hc("无法使用 Kit CDN 依赖锁,回退到 npm install: %s",e)}}async function hf(e,t,r){let{failed:n,stdout:o}=await sM("npm",["config","list","--json","--loglevel=error"],{cwd:t,cancelSignal:r,reject:!1});r?.throwIfAborted();let u=!n&&fE(o);return!!u&&Object.keys(e.packages).every(e=>{let t=/(?:^|\/)node_modules\/(@[^/]+)\/[^/]+$/.exec(e)?.[1],r=t&&u[`${t}:registry`];return"string"!=typeof r||r.replace(/\/+$/,"")===sJ.registry})}function hh(e,t,r){let n;try{n=eC(e).resolve(`${t.name}/package.json`)}catch(e){if("MODULE_NOT_FOUND"===e.code)return;throw e}return hm(n,r,t.version)}function hm(e,t,r){let n=JSON.parse(J.readFileSync(e,"utf8"));if(r&&n.version!==r)return;let o=n.exports?.[t],u=("string"==typeof o?o:o?.import)??("."!==t||n.exports?void 0:n.main),a=u&&l.resolve(l.dirname(e),u);return a&&J.existsSync(a)?a:void 0}async function hb(e,t,r,n){J.mkdirSync(l.dirname(r),{recursive:!0});let o=J.mkdtempSync(`${r}-`);try{let u=await hp(e,n),a=u&&await hf(u.lock,o,n)?u:void 0;a&&(J.writeFileSync(l.join(o,"package.json"),JSON.stringify({...a.lock.packages[""],private:!0})),J.writeFileSync(l.join(o,"package-lock.json"),a.contents));let s=e=>sM("npm",[...e,"--registry",sJ.registry,"--no-audit","--no-fund","--loglevel=error"],{cwd:o,cancelSignal:n,stdin:"ignore",reject:!1}),D=["install",`${e.name}@${e.version}`,"--prefix",o],c=await s(a?["ci","--prefer-offline","--include=optional","--replace-registry-host=never","--json","--color=false"]:D);n?.throwIfAborted();let d=c.failed&&fE(c.stdout??"")?.error?.code;if(a&&("EBADPLATFORM"===d||"EUSAGE"===d)&&(J.rmSync(l.join(o,"package-lock.json"),{force:!0}),c=await s(D)),n?.throwIfAborted(),c.failed)throw Error(`未能安装 ${e.name}@${e.version}(npm 退出码:${c.exitCode??"未知"})
93
- ${c.stderr.trim()}`);if(!hh(l.join(o,"package.json"),e,t))throw Error(`${e.name}@${e.version} 安装后无法加载,请检查包版本和发布内容。`);try{J.renameSync(o,r)}catch{hh(l.join(r,"package.json"),e,t)||(J.rmSync(r,{recursive:!0,force:!0}),J.renameSync(o,r))}}finally{J.rmSync(o,{recursive:!0,force:!0})}}async function hy(e,t,r){return import(await hd(sJ.appDev,e,t,r))}let hg=(e,t)=>hd({...sJ.kit,title:"应用构建工具"},"./sdk",e,t),hF={name:"doubao-app",setup(e){e.init.addOption({flags:"--app",description:"普通插件(含 App)",capability:({options:e})=>"enterprise"!==e.type}),e.init.addOption({flags:"--no-install-deps",description:"创建 App 后不安装前端依赖"}),e.init.onPrepareTemplates(async({options:e})=>{if(!e.app)return[];if("enterprise"===e.type)throw Error("企业专属插件暂不支持 App");let{templatesRoot:t}=await hy("./assets");return await hg(),[t]}),e.init.onAfterCreate(async({directory:e,options:t})=>{t.app&&(!1!==t.installDeps&&await hE(d(e,d0)),ff.step(`cd ${D(e)}
94
- dbx dev --app`))}),e.skills.onProvide(async({project:e})=>{if(!e.app)return[];let{skillsRoot:t}=await hy("./assets");return[{name:pn,root:t,packageName:sJ.appDev.name,guide:`仅开发豆包 App 的 Page、Widget 或 Manifest 时,先阅读 [应用开发 Skill](.agents/skills/${pn}/SKILL.md)。普通 MCP 和 MCP Apps 不使用 App Manifest。`}]}),e.package.onExclude((e,t)=>"dev"===t?[d0]:[`${d0}/node_modules`]),e.upload.onSuccess(async(e,t)=>{if(!e.project.app||e.project.hasWorkbench)return;let{showPreview:r}=await import("./preview.js");await r(e.project,t.version)}),e.dev.addTarget({name:"app",title:"应用调试(App)",label:"App",option:{flags:"--app",description:"仅启动应用调试(App)"},watch:[dQ],appliesTo:({project:e})=>!!e.app,async start(e){let{startApp:t}=await hy(".",e.signal,e);e.signal.throwIfAborted(),await t(e,{loadKit:t=>hg(e.signal,{...t,ui:e.ui}),queryAppInfo:t=>{var r;return r=pc(e.project.plugin),dT("/devtool/plugin-mini-app-base-info",{query:{...r},signal:t})},requestTicket:dR,queryVersions:async()=>{let{items:t=[]}=await dN(pc(e.project.plugin),e.signal);return t}})}})}};async function hE(e){ff.info("正在使用 pnpm 安装应用依赖…");try{let t=await sM("pnpm",["install"],{cwd:e,stdin:fc()?"inherit":"ignore",stdout:"inherit",stderr:"inherit",reject:!1});if(t.failed)throw Error(`pnpm 安装失败,退出码:${t.exitCode??"未知"}`);ff.success("应用依赖已安装")}catch(t){ff.warn(`应用依赖未安装:${eB(t)}`),ff.info(`项目已保留,请进入 ${e} 后运行 pnpm install。`)}}function hC(e=sJ.name){let t=e.replace(/^@/,"").replace(/[\\/]/g,"+");return d(q(),".dbx","skills",t,"current")}async function hw(e,t){let r=[{name:pr,root:p(import.meta.dirname,"skills"),packageName:sJ.name,guide:eS.readFileSync(d(import.meta.dirname,"templates/standard/AGENTS.md"),"utf8")}];r.push(...await eP(t.provideSkills,{project:e}));let n=d(e.root,".gitignore"),o=d(e.root,"AGENTS.md");for(let{name:t,root:u,packageName:a,guide:s}of r){let r=hC(a);hv(u,r);let l=`.agents/skills/${t}`;hv(d(r,t),d(e.root,l));let D=eS.existsSync(n)?eS.readFileSync(n,"utf8"):"",c=`/${l}`;D.split(/\r?\n/).includes(c)||h_(n,D,`${c}
95
- `);let p=eS.existsSync(o)?eS.readFileSync(o,"utf8"):"";s&&!p.includes(`${l}/SKILL.md`)&&h_(o,p,`${p?"\n":""}${s.trim()}
96
- `)}}function h_(e,t,r){let n=t&&!t.endsWith("\n")?"\n":"";eS.writeFileSync(e,`${t}${n}${r}`)}function hv(e,t){let r=eS.lstatSync(t,{throwIfNoEntry:!1});if(!r?.isSymbolicLink()||p(c(t),eS.readlinkSync(t))!==e){if(r&&!r.isSymbolicLink())throw Error(`开发 Skill 路径已存在且不是软链接,请先确认并移走该路径:${t}`);eS.mkdirSync(c(t),{recursive:!0}),eS.rmSync(t,{recursive:!0,force:!0}),eS.symlinkSync(e,t,"win32"===process.platform?"junction":"dir")}}let hS={name:"builtin",setup(e){e.cli.onSetup(({program:e,hooks:t})=>{let r=new a("--cwd <path>","项目根目录").argParser(e=>p(e)).default(process.cwd()),n=e.command("init").description("创建应用插件项目").argument("[name]","项目名称,同时作为目录名").addOption(new a("--type <type>","发布类型:公开或企业专属").choices(["public","enterprise"])).action(async(e,r)=>{let{runInit:n}=await import("./command~3.js");return n(e,r,t)});for(let{flags:e,description:r}of t.initOptions)n.addOption(new a(e,r));e.command("upload").description("上传应用插件包到开放平台并保存版本").addOption(r).option("--version <version>","应用插件版本,格式为 x.y.z").action(hB(async(e,r)=>{let{runUpload:n}=await import("./command~5.js");await n(e,r,t)}));let o=t.devTargets.flatMap(({target:e})=>e.option?[new a(e.option.flags,e.option.description)]:[]),u=e.command("dev").description("启动本地开发调试,监听目录变化并同步插件开发包").option("--once","仅同步安装一次插件或工作台,完成后退出").addOption(new a("--plugin","仅运行默认调试目标").conflicts(o.map(e=>e.attributeName()).filter(e=>!["app","workbench"].includes(e))));o.forEach(e=>u.addOption(e)),u.addOption(r).hook("preAction",e=>{let{workbench:t,app:r,plugin:n}=e.opts();if(t&&(r||n))throw Error(`不能同时使用 --workbench 和 ${r?"--app":"--plugin"},请选择一个调试目标`);if(r&&n)throw Error("不能同时使用 --app 和 --plugin,请选择一个调试目标")}).action(hB(async(e,r)=>{let{runSession:n}=await import("./session.js");await n(e,r,t)})),e.command("uninstall").description("从当前用户卸载插件开发包").addOption(r).option("--workbench","卸载定制工作台开发包").action(hB(async(e,t)=>{let{runUninstall:r}=await import("./uninstall.js");await r(e,!0===t.workbench)})),e.command("categories").description("查询审核类目,输出包含 category_id 和 name 的 JSON 列表").addOption(new a("--type <type>","发布类型:公开插件或企业专属插件").choices(["public","enterprise"]).default("public")).action(async e=>{let{runCategories:t}=await import("./categories.js");await t(e.type)}),e.command("workbench").description("定制工作台工具").command("search").description("搜索可关联的插件和独立 Skill,最多返回 100 条").argument("[keyword]","按名称搜索").addOption(new a("--source <sources...>","按资源来源筛选").choices(Object.keys(d8))).option("--json","输出 JSON,供脚本和 AI 使用").action(async(e,t)=>{let{runWorkbenchSearch:r}=await import("./workbench-search.js");await r(e,t)}),e.command("audit").description("完善当前草稿审核材料、保存版本并提交审核").option("--input <path>","审核材料 JSON 文件;相对项目根目录,跳过交互提示").addOption(new a("--visibility <scope>","企业专属插件可见范围").choices(["self","tenant"])).addOption(r).action(hB(async(e,r)=>{let{runAudit:n}=await import("./command.js");await n(e,r,t)})),e.command("versions").description("查询应用插件各版本的状态和审核信息").addOption(r).action(hB(async e=>{let{runVersions:t}=await import("./versions.js");await t(e)})),e.command("cancel-audit").description("取消应用插件提审").addOption(r).action(hB(async e=>{let{runCancelAudit:t}=await import("./command~2.js");await t(e)})),e.command("skills").description("配置项目开发 Skill").addOption(r).action(hB(async e=>{await hw(e,t),ff.success("项目开发 Skill 已配置")})),e.command("inspect").description("启动本地调试界面,调试 MCP Server 和 MCP Apps").option("--mcp-server [endpoint]","调试 MCP Server,可带地址,如 http://localhost:8088/mcp").option("-H, --header <header>",'请求头,格式为 "Key: Value",可写多次',(e,t=[])=>[...t,e]).option("--port <port>","调试界面端口,默认 6274;被占用时自动顺延").option("--no-open","只启动服务,不打开窗口").action(async e=>{let{runInspect:t}=await import("./command~4.js");await t(e)});let s=e.command("auth").description("认证管理");s.command("login").description("登录").addOption(new a("--begin","发起设备授权并显示操作说明").conflicts("complete")).addOption(new a("--complete <device-code>","使用指定设备码完成授权").conflicts("begin")).action(async e=>{let{runLogin:t}=await import("./command~1.js");await t(e)}),s.command("logout").description("退出登录,清除本地登录凭据").action(async()=>{let{runLogout:e}=await import("./command~1.js");await e()}),s.command("status").description("查看登录状态").action(async()=>{let{runStatus:e}=await import("./command~1.js");await e()})})}};function hB(e){return async({cwd:t,...r})=>{let{PluginProject:n}=await import("./plugin.js");await e(new n(t),r)}}let hT=["skills",dQ,dK];async function hA(e,t=!1){try{if(t&&!e.project.hasWorkbench)throw Error(`未找到工作台配置:${d1}`);e.ui.update({status:"pending",message:"正在打包"});let r=await e.packDevelopment();e.signal.throwIfAborted(),e.ui.update({status:"pending",message:"正在上传"});let{package_id:n}=await d$(`${e.project.plugin.name}-${Date.now()}.zip`,r,{signal:e.signal,workbench:t});if(!n)throw Error("上传失败:服务端未返回 package_id");e.signal.throwIfAborted(),e.ui.update({status:"pending",message:"正在安装到当前账号"}),await dz({package_id:n,action:"Install"},e.signal,t),e.ui.update({status:"success",message:"已同步"}),t&&e.log.info("请在豆包工作 PC 的「我的」切换到工作台开发版。")}catch(r){!e.signal.aborted&&(t?e.ui.update({status:"error",message:`同步失败:${eB(r)}`}):(e.ui.update({status:"error",message:"同步失败"}),e.log.error(`平台同步失败:${eB(r)}`)),e.options.once&&(process.exitCode=1))}}let hR={name:"platform",setup(e){e.init.addOption({flags:"--workbench",description:"定制工作台",capability:!0}),e.init.onPrepareTemplates(({options:e})=>e.workbench?[d(import.meta.dirname,d4,"workbench")]:[]),e.dev.addTarget({name:"platform",title:"插件调试(Skill / MCP)",label:"Skill / MCP",watch:hT,async start(e){e.onFilesChanged(()=>hA(e)),await hA(e)}}),e.dev.addTarget({name:"workbench",title:"定制工作台调试",label:"定制工作台",option:{flags:"--workbench",description:"仅启动定制工作台调试"},watch:[dQ,dK,d2],appliesTo:({project:e})=>e.hasWorkbench,async start(e){let t=()=>hA(e,!0);e.onFilesChanged(t),await t()}})}};async function hx(e=process.argv,t={}){let r=new o().name("dbx").description(sJ.description).version(sJ.version,"-V, --version").enablePositionalOptions().configureOutput({outputError:e=>ff.error(e.trimEnd())}).exitOverride();try{await eR(r,[hS,hF,hR,...t.plugins??[]]),r.action(()=>r.outputHelp());let n=p(import.meta.dirname,"skills");if(!eS.statSync(d(n,pr,"SKILL.md")).isFile())throw Error("CLI 安装包中的开发 Skill 不完整,请重新安装 CLI。");hv(n,hC()),await r.parseAsync(e)}catch(e){if(e instanceof u){process.exitCode=e.exitCode;return}ff.error(eB(e)),process.exitCode=1}}export{d3 as APP_GENERATED_DIRECTORIES,dZ as APP_MANIFEST_FILENAME,d0 as DOUBAO_APP_DIRECTORY,dQ as MCP_CONFIG_FILENAME,lp as NotLoggedInError,dK as PLUGIN_MANIFEST_FILENAME,pt as PLUGIN_NAME_PLACEHOLDER,d6 as PROJECT_EXCLUDED_DIRECTORIES,d9 as PROJECT_EXCLUDED_FILES,d7 as PROJECT_ROOT_EXCLUDED_ENTRIES,dY as PUBLICATION_TYPE_LABELS,dX as SKILL_FILENAME,d5 as STANDARD_TEMPLATE_DIRECTORY,d4 as TEMPLATES_DIRECTORY,pe as TEMPLATE_SUFFIX,dJ as VISIBILITY_TYPE_LABELS,d2 as WORKBENCH_DIRECTORY,d1 as WORKBENCH_MANIFEST_PATH,d8 as WORKBENCH_RESOURCE_SOURCES,fC as blockGlyphsSafe,DT as br,ex as callHook,fH as chalk_source,eP as collectHooks,lA as completeLogin,dq as createPreview,fu as dist_ge,fi as dist_he,fs as dist_ve,fl as dist_xe,fa as dist_ye,eB as error_errorMessage,eT as formatValidationError,dV as getApproval,dW as getBuildStatus,dP as getCurrentUser,lN as getSandboxAuthHeaders,fc as isInteractive,pa as jsonObjectSchema,dj as listPluginCategories,dN as listPluginVersions,hd as loadPackage,ff as log,lB as login,lq as logout,hx as main,pD as mcpConfigSchema,hD as oraPromise,pU as pD,pc as pluginIdentity,pl as pluginManifestSchema,pd as projectIdentity,pi as projectNameSchema,ps as publicationTypeSchema,Dg as qn,pf as readProjectDraft,ph as resolvePublicationType,sJ as runtime,dU as savePluginVersion,dx as searchWorkbenchResources,lT as startLogin,fy as state_State,dH as submitApproval,hw as syncProjectSkill,dz as updateUserPlugin,d$ as uploadPackage,dL as upsertPluginDraft,dM as upsertWorkbenchDraft,dO as validateMaterial,dk as validateWorkbenchMaterial,pu as versionSchema,lz as whoami,dS as withRequestLog,dG as withdrawApproval};
93
+ ${c.stderr.trim()}`);if(!hh(l.join(o,"package.json"),e,t))throw Error(`${e.name}@${e.version} 安装后无法加载,请检查包版本和发布内容。`);try{J.renameSync(o,r)}catch{hh(l.join(r,"package.json"),e,t)||(J.rmSync(r,{recursive:!0,force:!0}),J.renameSync(o,r))}}finally{J.rmSync(o,{recursive:!0,force:!0})}}async function hy(e,t,r){return import(await hd(sJ.appDev,e,t,r))}let hg=(e,t)=>hd({...sJ.kit,title:"应用构建工具"},"./sdk",e,t),hF={name:"doubao-app",setup(e){e.init.addOption({flags:"--app",description:"应用插件",capability:({options:e})=>"enterprise"!==e.type}),e.init.addOption({flags:"--no-install-deps",description:"创建 App 后不安装前端依赖"}),e.init.onPrepareTemplates(async({options:e})=>{if(!e.app)return[];if("enterprise"===e.type)throw Error("企业专属插件暂不支持 App");let{templatesRoot:t}=await hy("./assets");return await hg(),[t]}),e.init.onAfterCreate(async({directory:e,options:t})=>{t.app&&(!1!==t.installDeps&&await hE(d(e,d0)),ff.step(`cd ${D(e)}
94
+ dbx dev --app`))}),e.skills.onProvide(async({project:e})=>{if(!e.app)return[];let{skillsRoot:t}=await hy("./assets");return[{name:pn,root:t,packageName:sJ.appDev.name,guide:`仅开发豆包 App 的 Page、Widget 或 Manifest 时,先阅读 [应用开发 Skill](.agents/skills/${pn}/SKILL.md)。普通 MCP 和 MCP Apps 不使用 App Manifest。`}]}),e.package.onExclude((e,t)=>"dev"===t?[d0]:[`${d0}/node_modules`]),e.upload.onSuccess(async(e,t)=>{if(!e.project.app||e.project.hasWorkbench)return;let{showPreview:r}=await import("./preview.js");await r(e.project,t.version)}),e.dev.addTarget({name:"app",title:"应用调试(App)",label:"App",option:{flags:"--app",description:"仅启动应用调试(App)"},watch:[dQ],appliesTo:({project:e})=>!!e.app,async start(e){let{startApp:t}=await hy(".",e.signal,e);e.signal.throwIfAborted(),await t(e,{loadKit:t=>hg(e.signal,{...t,ui:e.ui}),queryAppInfo:t=>{var r;return r=pc(e.project.plugin),dT("/devtool/plugin-mini-app-base-info",{query:{...r},signal:t})},requestTicket:dR,queryVersions:async()=>{let{items:t=[]}=await dN(pc(e.project.plugin),e.signal);return t}})}})}};async function hE(e){ff.info("正在使用 pnpm 安装应用依赖…");try{let t=await sM("pnpm",["install"],{cwd:e,stdin:fc()?"inherit":"ignore",stdout:"inherit",stderr:"inherit",reject:!1});if(t.failed)throw Error(`pnpm 安装失败,退出码:${t.exitCode??"未知"}`);ff.success("应用依赖已安装")}catch(t){ff.warn(`应用依赖未安装:${eB(t)}`),ff.info(`项目已保留,请进入 ${e} 后运行 pnpm install。`)}}function hC(e=sJ.name){let t=e.replace(/^@/,"").replace(/[\\/]/g,"+");return d(q(),".dbx","skills",t,"current")}async function hw(e,t){let r=p(import.meta.dirname,"skills"),n=eS.readdirSync(r,{withFileTypes:!0}).filter(e=>e.isDirectory()&&eS.existsSync(d(r,e.name,"SKILL.md"))).sort((e,t)=>e.name.localeCompare(t.name)).map(({name:e})=>({name:e,root:r,packageName:sJ.name,guide:e===pr?eS.readFileSync(d(import.meta.dirname,"templates/standard/AGENTS.md"),"utf8"):void 0}));n.push(...await eP(t.provideSkills,{project:e}));let o=d(e.root,".gitignore"),u=d(e.root,"AGENTS.md");for(let{name:t,root:r,packageName:a,guide:s}of n){let n=hC(a);hv(r,n);let l=`.agents/skills/${t}`;hv(d(n,t),d(e.root,l));let D=eS.existsSync(o)?eS.readFileSync(o,"utf8"):"",c=`/${l}`;D.split(/\r?\n/).includes(c)||h_(o,D,`${c}
95
+ `);let p=eS.existsSync(u)?eS.readFileSync(u,"utf8"):"";s&&!p.includes(`${l}/SKILL.md`)&&h_(u,p,`${p?"\n":""}${s.trim()}
96
+ `)}}function h_(e,t,r){let n=t&&!t.endsWith("\n")?"\n":"";eS.writeFileSync(e,`${t}${n}${r}`)}function hv(e,t){let r=eS.lstatSync(t,{throwIfNoEntry:!1});if(!r?.isSymbolicLink()||p(c(t),eS.readlinkSync(t))!==e){if(r&&!r.isSymbolicLink())throw Error(`开发 Skill 路径已存在且不是软链接,请先确认并移走该路径:${t}`);eS.mkdirSync(c(t),{recursive:!0}),eS.rmSync(t,{recursive:!0,force:!0}),eS.symlinkSync(e,t,"win32"===process.platform?"junction":"dir")}}let hS={name:"builtin",setup(e){e.cli.onSetup(({program:e,hooks:t})=>{let r=new a("--cwd <path>","项目根目录").argParser(e=>p(e)).default(process.cwd()),n=e.command("init").description("创建普通插件、应用插件或定制工作台").argument("[name]","项目名称,同时作为目录名").addOption(new a("--type <type>","发布类型:公开或企业专属").choices(["public","enterprise"])).action(async(e,r)=>{let{runInit:n}=await import("./command~3.js");return n(e,r,t)});for(let{flags:e,description:r}of t.initOptions)n.addOption(new a(e,r));e.command("upload").description("上传应用插件包到开放平台并保存版本").addOption(r).option("--version <version>","应用插件版本,格式为 x.y.z").action(hB(async(e,r)=>{let{runUpload:n}=await import("./command~5.js");await n(e,r,t)}));let o=t.devTargets.flatMap(({target:e})=>e.option?[new a(e.option.flags,e.option.description)]:[]),u=e.command("dev").description("启动本地开发调试,监听目录变化并同步插件开发包").option("--once","仅同步安装一次插件或工作台,完成后退出").addOption(new a("--plugin","仅运行默认调试目标").conflicts(o.map(e=>e.attributeName()).filter(e=>!["app","workbench"].includes(e))));o.forEach(e=>u.addOption(e)),u.addOption(r).hook("preAction",e=>{let{workbench:t,app:r,plugin:n}=e.opts();if(t&&(r||n))throw Error(`不能同时使用 --workbench 和 ${r?"--app":"--plugin"},请选择一个调试目标`);if(r&&n)throw Error("不能同时使用 --app 和 --plugin,请选择一个调试目标")}).action(hB(async(e,r)=>{let{runSession:n}=await import("./session.js");await n(e,r,t)})),e.command("uninstall").description("从当前用户卸载插件开发包").addOption(r).option("--workbench","卸载定制工作台开发包").action(hB(async(e,t)=>{let{runUninstall:r}=await import("./uninstall.js");await r(e,!0===t.workbench)})),e.command("categories").description("查询审核类目,输出包含 category_id 和 name 的 JSON 列表").addOption(new a("--type <type>","发布类型:公开插件或企业专属插件").choices(["public","enterprise"]).default("public")).action(async e=>{let{runCategories:t}=await import("./categories.js");await t(e.type)}),e.command("workbench").description("定制工作台工具").command("search").description("搜索可关联的插件和独立 Skill,最多返回 100 条").argument("[keyword]","按名称搜索").addOption(new a("--source <sources...>","按资源来源筛选").choices(Object.keys(d8))).option("--json","输出 JSON,供脚本和 AI 使用").action(async(e,t)=>{let{runWorkbenchSearch:r}=await import("./workbench-search.js");await r(e,t)}),e.command("audit").description("完善当前草稿审核材料、保存版本并提交审核").option("--input <path>","审核材料 JSON 文件;相对项目根目录,跳过交互提示").addOption(new a("--visibility <scope>","企业专属插件可见范围").choices(["self","tenant"])).addOption(r).action(hB(async(e,r)=>{let{runAudit:n}=await import("./command.js");await n(e,r,t)})),e.command("versions").description("查询应用插件各版本的状态和审核信息").addOption(r).action(hB(async e=>{let{runVersions:t}=await import("./versions.js");await t(e)})),e.command("cancel-audit").description("取消应用插件提审").addOption(r).action(hB(async e=>{let{runCancelAudit:t}=await import("./command~2.js");await t(e)})),e.command("skills").description("配置项目开发 Skill").addOption(r).action(hB(async e=>{await hw(e,t),ff.success("项目开发 Skill 已配置")})),e.command("inspect").description("启动本地调试界面,调试 MCP Server 和 MCP Apps").option("--mcp-server [endpoint]","调试 MCP Server,可带地址,如 http://localhost:8088/mcp").option("-H, --header <header>",'请求头,格式为 "Key: Value",可写多次',(e,t=[])=>[...t,e]).option("--port <port>","调试界面端口,默认 6274;被占用时自动顺延").option("--no-open","只启动服务,不打开窗口").action(async e=>{let{runInspect:t}=await import("./command~4.js");await t(e)});let s=e.command("auth").description("认证管理");s.command("login").description("登录").addOption(new a("--begin","发起设备授权并显示操作说明").conflicts("complete")).addOption(new a("--complete <device-code>","使用指定设备码完成授权").conflicts("begin")).action(async e=>{let{runLogin:t}=await import("./command~1.js");await t(e)}),s.command("logout").description("退出登录,清除本地登录凭据").action(async()=>{let{runLogout:e}=await import("./command~1.js");await e()}),s.command("status").description("查看登录状态").action(async()=>{let{runStatus:e}=await import("./command~1.js");await e()})})}};function hB(e){return async({cwd:t,...r})=>{let{PluginProject:n}=await import("./plugin.js");await e(new n(t),r)}}let hT=["skills",dQ,dK];async function hA(e,t=!1){try{if(t&&!e.project.hasWorkbench)throw Error(`未找到工作台配置:${d1}`);e.ui.update({status:"pending",message:"正在打包"});let r=await e.packDevelopment();e.signal.throwIfAborted(),e.ui.update({status:"pending",message:"正在上传"});let{package_id:n}=await d$(`${e.project.plugin.name}-${Date.now()}.zip`,r,{signal:e.signal,workbench:t});if(!n)throw Error("上传失败:服务端未返回 package_id");e.signal.throwIfAborted(),e.ui.update({status:"pending",message:"正在安装到当前账号"}),await dz({package_id:n,action:"Install"},e.signal,t),e.ui.update({status:"success",message:"已同步"}),t&&e.log.info("请在豆包工作 PC 的「我的」切换到工作台开发版。")}catch(r){!e.signal.aborted&&(t?e.ui.update({status:"error",message:`同步失败:${eB(r)}`}):(e.ui.update({status:"error",message:"同步失败"}),e.log.error(`平台同步失败:${eB(r)}`)),e.options.once&&(process.exitCode=1))}}let hR={name:"platform",setup(e){e.init.addOption({flags:"--workbench",description:"定制工作台",capability:!0}),e.init.onPrepareTemplates(({options:e})=>e.workbench?[d(import.meta.dirname,d4,"workbench")]:[]),e.dev.addTarget({name:"platform",title:"插件调试(Skill / MCP)",label:"Skill / MCP",watch:hT,async start(e){e.onFilesChanged(()=>hA(e)),await hA(e)}}),e.dev.addTarget({name:"workbench",title:"定制工作台调试",label:"定制工作台",option:{flags:"--workbench",description:"仅启动定制工作台调试"},watch:[dQ,dK,d2],appliesTo:({project:e})=>e.hasWorkbench,async start(e){let t=()=>hA(e,!0);e.onFilesChanged(t),await t()}})}};async function hx(e=process.argv,t={}){let r=new o().name("dbx").description(sJ.description).version(sJ.version,"-V, --version").enablePositionalOptions().configureOutput({outputError:e=>ff.error(e.trimEnd())}).exitOverride();try{await eR(r,[hS,hF,hR,...t.plugins??[]]),r.action(()=>r.outputHelp());let n=p(import.meta.dirname,"skills");if(!eS.statSync(d(n,pr,"SKILL.md")).isFile())throw Error("CLI 安装包中的开发 Skill 不完整,请重新安装 CLI。");hv(n,hC()),await r.parseAsync(e)}catch(e){if(e instanceof u){process.exitCode=e.exitCode;return}ff.error(eB(e)),process.exitCode=1}}export{d3 as APP_GENERATED_DIRECTORIES,dZ as APP_MANIFEST_FILENAME,d0 as DOUBAO_APP_DIRECTORY,dQ as MCP_CONFIG_FILENAME,lp as NotLoggedInError,dK as PLUGIN_MANIFEST_FILENAME,pt as PLUGIN_NAME_PLACEHOLDER,d6 as PROJECT_EXCLUDED_DIRECTORIES,d9 as PROJECT_EXCLUDED_FILES,d7 as PROJECT_ROOT_EXCLUDED_ENTRIES,dY as PUBLICATION_TYPE_LABELS,dX as SKILL_FILENAME,d5 as STANDARD_TEMPLATE_DIRECTORY,d4 as TEMPLATES_DIRECTORY,pe as TEMPLATE_SUFFIX,dJ as VISIBILITY_TYPE_LABELS,d2 as WORKBENCH_DIRECTORY,d1 as WORKBENCH_MANIFEST_PATH,d8 as WORKBENCH_RESOURCE_SOURCES,fC as blockGlyphsSafe,DT as br,ex as callHook,fH as chalk_source,eP as collectHooks,lA as completeLogin,dq as createPreview,fu as dist_ge,fi as dist_he,fs as dist_ve,fl as dist_xe,fa as dist_ye,eB as error_errorMessage,eT as formatValidationError,dV as getApproval,dW as getBuildStatus,dP as getCurrentUser,lN as getSandboxAuthHeaders,fc as isInteractive,pa as jsonObjectSchema,dj as listPluginCategories,dN as listPluginVersions,hd as loadPackage,ff as log,lB as login,lq as logout,hx as main,pD as mcpConfigSchema,hD as oraPromise,pU as pD,pc as pluginIdentity,pl as pluginManifestSchema,pd as projectIdentity,pi as projectNameSchema,ps as publicationTypeSchema,Dg as qn,pf as readProjectDraft,ph as resolvePublicationType,sJ as runtime,dU as savePluginVersion,dx as searchWorkbenchResources,lT as startLogin,fy as state_State,dH as submitApproval,hw as syncProjectSkill,dz as updateUserPlugin,d$ as uploadPackage,dL as upsertPluginDraft,dM as upsertWorkbenchDraft,dO as validateMaterial,dk as validateWorkbenchMaterial,pu as versionSchema,lz as whoami,dS as withRequestLog,dG as withdrawApproval};
package/dist/command~3.js CHANGED
@@ -1,2 +1,2 @@
1
- import{join as e,resolve as i}from"node:path";import{Option as t}from"commander";import{STANDARD_TEMPLATE_DIRECTORY as r,publicationTypeSchema as a,TEMPLATES_DIRECTORY as o,log as n,PUBLICATION_TYPE_LABELS as l,error_errorMessage as p,syncProjectSkill as s,TEMPLATE_SUFFIX as c,dist_he as f,dist_xe as u,projectNameSchema as m,collectHooks as y,dist_ve as d,dist_ye as w,PLUGIN_NAME_PLACEHOLDER as b,pD as _,isInteractive as h,getCurrentUser as S}from"./691.js";import{PluginProject as g,copySync as E}from"./plugin.js";import{ensureLogin as C}from"./command~1.js";import*as v from"node:fs";async function P(i,t){let{name:n,directory:l}=i,p=a.parse(String(i.options.type??"public").toUpperCase()),f=v.lstatSync(l,{throwIfNoEntry:!1});if(f&&(!f.isDirectory()||v.readdirSync(l).length>0))throw Error(`目标路径已存在且不是空目录:${l}`);let u=[e(import.meta.dirname,o,r)];for(let e of(u.push(...await y(t.prepareTemplates,i)),u))E(e,l);(function i(t,r){for(let a of v.readdirSync(t,{withFileTypes:!0})){let o=e(t,a.name),n=e(t,a.name.replaceAll(b,r));if(a.isDirectory())i(o,r);else if(a.isFile()&&a.name.endsWith(c)){n=n.slice(0,-c.length),v.writeFileSync(n,v.readFileSync(o,"utf8").replaceAll(b,r)),v.unlinkSync(o);continue}n!==o&&v.renameSync(o,n)}})(l,n),!0!==i.options.workbench&&v.mkdirSync(e(l,"skills"),{recursive:!0});let m=new g(l);await m.updatePublicationType(p),await s(m,t)}async function N(e,r,a){if(!0===r.app&&!0===r.workbench)throw Error("不能同时创建 app 和工作台,请分开创建");let o={...r},s=h(),c=!e;if(!e){if(!s)throw Error("请指定项目名称,例如 dbx init my-plugin");let i=await f({message:"项目名称",placeholder:"my-plugin",defaultValue:"my-plugin",validate:e=>m.safeParse(e||"my-plugin").error?.issues[0]?.message});if(_(i)){u("已取消创建。"),process.exitCode=130;return}e=i}let y=m.safeParse(e);if(!y.success)throw Error(`${y.error.issues[0].message}
2
- 有效名称示例:mcp-app-test`);if(void 0===o.type&&!0===o.app&&(o={...o,type:"public"}),!0!==o.app&&("enterprise"===o.type||void 0===o.type&&s)){let e;await C(s);let i=await S();if(!1===i.is_enterprise?e="当前账号不是企业账号,无法创建企业专属插件":i.is_enterprise_blocked?e="受企业管控限制,当前账号不允许创建企业专属插件":i.is_enterprise_publication_access||(e="当前账号没有创建企业插件权限,无法创建企业专属插件"),e){if("enterprise"===o.type)throw Error(e);n.info(`${e}。将创建公开项目`),o={...o,type:"public"}}}if(void 0===o.type&&s){let e=await d({message:"请选择发布类型,首次创建平台草稿后不可切换",options:[{value:"public",label:l.PUBLIC},{value:"enterprise",label:l.ENTERPRISE}],initialValue:"public"});if(_(e)){u("已取消创建。"),process.exitCode=130;return}o={...o,type:e}}o={...o,type:o.type??"public"};let b=i(e);if(c){let i={name:e,directory:b,options:o},r=a.initOptions.filter(({capability:e})=>"function"==typeof e?e(i):e).map(({flags:e,description:i})=>({value:new t(e).attributeName(),label:i}));if(r.length&&r.every(({value:e})=>void 0===o[e])){let e=await d({message:"请选择项目类型",options:[{value:"plugin",label:"普通插件"},...r],initialValue:"plugin"});if(_(e)){u("已取消创建。"),process.exitCode=130;return}o={...o,...Object.fromEntries(r.map(({value:i})=>[i,e===i]))}}for(let{flags:i,prompt:r}of a.initOptions){let a=new t(i).attributeName();if(!r||void 0!==o[a])continue;let n="function"==typeof r?r({name:e,directory:b,options:o}):r;if(!n)continue;let l=await w({message:n,initialValue:!1});if(_(l)){u("已取消创建。"),process.exitCode=130;return}o={...o,[a]:l}}}let g={name:e,directory:b,options:o};await P(g,a);let E=o.workbench?"定制工作台":"普通插件";for(let i of(n.success(`已创建${E}:${e}`),n.info(`发布类型:${"enterprise"===o.type?l.ENTERPRISE:l.PUBLIC}`),a.afterCreate))try{await i.callback(g)}catch(e){n.warn(`[${i.pluginName}] 项目已创建,后续处理失败:${p(e)}`)}}export{N as runInit};
1
+ import{join as e,resolve as i}from"node:path";import{Option as t}from"commander";import{STANDARD_TEMPLATE_DIRECTORY as r,publicationTypeSchema as a,TEMPLATES_DIRECTORY as o,log as n,PUBLICATION_TYPE_LABELS as p,error_errorMessage as l,syncProjectSkill as s,TEMPLATE_SUFFIX as c,dist_he as f,dist_xe as u,projectNameSchema as m,collectHooks as y,dist_ve as d,dist_ye as w,PLUGIN_NAME_PLACEHOLDER as _,pD as b,isInteractive as h,getCurrentUser as S}from"./691.js";import{PluginProject as g,copySync as E}from"./plugin.js";import{ensureLogin as C}from"./command~1.js";import*as v from"node:fs";async function P(i,t){let{name:n,directory:p}=i,l=a.parse(String(i.options.type??"public").toUpperCase()),f=v.lstatSync(p,{throwIfNoEntry:!1});if(f&&(!f.isDirectory()||v.readdirSync(p).length>0))throw Error(`目标路径已存在且不是空目录:${p}`);let u=[e(import.meta.dirname,o,r)];for(let e of(u.push(...await y(t.prepareTemplates,i)),u))E(e,p);(function i(t,r){for(let a of v.readdirSync(t,{withFileTypes:!0})){let o=e(t,a.name),n=e(t,a.name.replaceAll(_,r));if(a.isDirectory())i(o,r);else if(a.isFile()&&a.name.endsWith(c)){n=n.slice(0,-c.length),v.writeFileSync(n,v.readFileSync(o,"utf8").replaceAll(_,r)),v.unlinkSync(o);continue}n!==o&&v.renameSync(o,n)}})(p,n),!0!==i.options.workbench&&v.mkdirSync(e(p,"skills"),{recursive:!0});let m=new g(p);await m.updatePublicationType(l),await s(m,t)}async function N(e,r,a){if(!0===r.app&&!0===r.workbench)throw Error("不能同时创建 app 和工作台,请分开创建");let o={...r},s=h(),c=!e;if(!e){if(!s)throw Error("请指定项目名称,例如 dbx init my-plugin");let i=await f({message:"项目名称",placeholder:"my-plugin",defaultValue:"my-plugin",validate:e=>m.safeParse(e||"my-plugin").error?.issues[0]?.message});if(b(i)){u("已取消创建。"),process.exitCode=130;return}e=i}let y=m.safeParse(e);if(!y.success)throw Error(`${y.error.issues[0].message}
2
+ 有效名称示例:mcp-app-test`);if(void 0===o.type&&!0===o.app&&(o={...o,type:"public"}),!0!==o.app&&("enterprise"===o.type||void 0===o.type&&s)){let e;await C(s);let i=await S(),t=i.is_enterprise_blocked?!0===i.is_enterprise:i.is_enterprise_publication_access;if(!1===i.is_enterprise?e="当前账号不是企业账号,无法创建企业专属插件":t||(e="当前账号没有创建企业插件权限,无法创建企业专属插件"),e){if("enterprise"===o.type)throw Error(e);n.info(`${e}。将创建公开项目`),o={...o,type:"public"}}}if(void 0===o.type&&s){let e=await d({message:"请选择发布类型,首次创建平台草稿后不可切换",options:[{value:"public",label:p.PUBLIC},{value:"enterprise",label:p.ENTERPRISE}],initialValue:"public"});if(b(e)){u("已取消创建。"),process.exitCode=130;return}o={...o,type:e}}o={...o,type:o.type??"public"};let _=i(e);if(c){let i={name:e,directory:_,options:o},r=a.initOptions.filter(({capability:e})=>"function"==typeof e?e(i):e).map(({flags:e,description:i})=>({value:new t(e).attributeName(),label:i}));if(r.length&&r.every(({value:e})=>void 0===o[e])){let e=await d({message:"请选择项目类型",options:[{value:"plugin",label:"普通插件"},...r],initialValue:"plugin"});if(b(e)){u("已取消创建。"),process.exitCode=130;return}o={...o,...Object.fromEntries(r.map(({value:i})=>[i,e===i]))}}for(let{flags:i,prompt:r}of a.initOptions){let a=new t(i).attributeName();if(!r||void 0!==o[a])continue;let n="function"==typeof r?r({name:e,directory:_,options:o}):r;if(!n)continue;let p=await w({message:n,initialValue:!1});if(b(p)){u("已取消创建。"),process.exitCode=130;return}o={...o,[a]:p}}}let g={name:e,directory:_,options:o};await P(g,a);let E=o.workbench?"定制工作台":o.app?"应用插件":"普通插件";for(let i of(n.success(`已创建${E}:${e}`),n.info(`发布类型:${"enterprise"===o.type?p.ENTERPRISE:p.PUBLIC}`),a.afterCreate))try{await i.callback(g)}catch(e){n.warn(`[${i.pluginName}] 项目已创建,后续处理失败:${l(e)}`)}}export{N as runInit};
package/dist/draft.js CHANGED
@@ -1,2 +1,2 @@
1
- import{upsertPluginDraft as i,upsertWorkbenchDraft as a,VISIBILITY_TYPE_LABELS as t,resolvePublicationType as e,validateWorkbenchMaterial as r,log as o,validateMaterial as n,PUBLICATION_TYPE_LABELS as l,uploadPackage as p,projectIdentity as _}from"./691.js";import{withProgress as c}from"./progress.js";function s(i,a){if(i.passed)return;let t=i.issues?.map(i=>{let a=[i.path,i.field_path].filter(Boolean).join(":"),t=i.message||i.code||"未知问题";return`- ${a?`${a}:`:""}${t}`}).join("\n");throw Error(`${a}${t?`
2
- ${t}`:""}`)}async function d(d,u){let{project:w,options:y}=d,{name:$,id:f}=w.plugin,b=w.hasWorkbench,E=b?"定制工作台":"应用插件",h=f?await c("核对发布类型",()=>e(w)):await e(w),g=l[h];o.info(`发布类型:${g}${!f?";首次创建平台草稿后不可切换":""}`);let k={..._(w),publication_type:h},{version:m}=y,S=await c("打包项目",()=>w.pack({version:m,exclude:u})),A=`${$}-${Date.now()}.zip`,C=await c(`上传${E}包`,async()=>{let{package_id:i}=await p(A,S,{workbench:b});if(!i)throw Error("上传失败:服务端未返回 package_id");return i});await c("校验物料",async()=>{let i={package_id:C,...k,validate_list:["PACKAGE_PARSE"]};s(b?await r(i):await n(i),"物料校验未通过")});let D=await c("保存草稿",async()=>{let t=b?a:i,{draft:e}=await t({package_id:C,...k});if(!e?.name||!e.ability_id)throw Error(`草稿保存失败:服务端未返回${E}名称或 ID`);return{...e,ability_id:e.ability_id}}),K=D.ability_id;o.success(`${E} ID:${K}`);try{await w.updateManifest(({$schema:i,name:a,id:t,publicationType:e,...r})=>({$schema:i,name:a,id:K,publicationType:h,...r}))}catch(i){throw Error(`草稿已保存,但本地关联写入失败,请将 ID ${K} 和 publicationType ${h} 保存到 plugin.json`,{cause:i})}if("ENTERPRISE"===h){let i=D.visibility_config?.type,a=void 0===i?void 0:t[i];o.info(`草稿可见范围:${a??"由平台保存,首次默认仅本人"}`)}return{packageId:C,draft:D,isWorkbench:b,identity:{ability_id:K,publication_type:h}}}export{s as assertMaterialValidation,d as uploadDraft};
1
+ import{upsertPluginDraft as i,upsertWorkbenchDraft as a,VISIBILITY_TYPE_LABELS as t,resolvePublicationType as e,validateWorkbenchMaterial as r,log as o,validateMaterial as n,PUBLICATION_TYPE_LABELS as l,uploadPackage as p,projectIdentity as _,getCurrentUser as c}from"./691.js";import{withProgress as s}from"./progress.js";function d(i,a){if(i.passed)return;let t=i.issues?.map(i=>{let a=[i.path,i.field_path].filter(Boolean).join(":"),t=i.message||i.code||"未知问题";return`- ${a?`${a}:`:""}${t}`}).join("\n");throw Error(`${a}${t?`
2
+ ${t}`:""}`)}async function w(w,u){let{project:y,options:$}=w,{name:f,id:E}=y.plugin,b=y.hasWorkbench,h=b?"定制工作台":"应用插件",g=E?await s("核对发布类型",()=>e(y)):await e(y),k=l[g];if(o.info(`发布类型:${k}${!E?";首次创建平台草稿后不可切换":""}`),"ENTERPRISE"===g&&(await c()).is_enterprise_blocked)throw Error("受企业管控限制,当前账号不允许发布企业专属插件,请咨询企业管理员处理");let m={..._(y),publication_type:g},{version:R}=$,S=await s("打包项目",()=>y.pack({version:R,exclude:u})),P=`${f}-${Date.now()}.zip`,A=await s(`上传${h}包`,async()=>{let{package_id:i}=await p(P,S,{workbench:b});if(!i)throw Error("上传失败:服务端未返回 package_id");return i});await s("校验物料",async()=>{let i={package_id:A,...m,validate_list:["PACKAGE_PARSE"]};d(b?await r(i):await n(i),"物料校验未通过")});let C=await s("保存草稿",async()=>{let t=b?a:i,{draft:e}=await t({package_id:A,...m});if(!e?.name||!e.ability_id)throw Error(`草稿保存失败:服务端未返回${h}名称或 ID`);return{...e,ability_id:e.ability_id}}),D=C.ability_id;o.success(`${h} ID:${D}`);try{await y.updateManifest(({$schema:i,name:a,id:t,publicationType:e,...r})=>({$schema:i,name:a,id:D,publicationType:g,...r}))}catch(i){throw Error(`草稿已保存,但本地关联写入失败,请将 ID ${D} 和 publicationType ${g} 保存到 plugin.json`,{cause:i})}if("ENTERPRISE"===g){let i=C.visibility_config?.type,a=void 0===i?void 0:t[i];o.info(`草稿可见范围:${a??"由平台保存,首次默认仅本人"}`)}return{packageId:A,draft:C,isWorkbench:b,identity:{ability_id:D,publication_type:g}}}export{d as assertMaterialValidation,w as uploadDraft};