@fastgpt-plugin/cli 0.1.0-alpha.3 → 0.1.0-alpha.5

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/dist/index.js CHANGED
@@ -1,445 +1,107 @@
1
1
  #!/usr/bin/env node
2
- import path, { join } from "node:path";
3
- import { consola } from "consola";
4
- import { Command } from "commander";
5
- import fs from "node:fs/promises";
6
- import { input, select } from "@inquirer/prompts";
7
- import { build } from "tsdown";
8
- import { parse } from "@babel/parser";
9
- import * as $traverse from "@babel/traverse";
10
- import * as $generate from "@babel/generator";
11
- import { existsSync, readdirSync } from "node:fs";
2
+ import e,{builtinModules as t,createRequire as n,isBuiltin as r}from"node:module";import i,{delimiter as a,dirname as o,isAbsolute as s,join as c,normalize as l,parse as u,resolve as d,sep as f}from"node:path";import{formatWithOptions as p,inspect as m,promisify as h,stripVTControlCharacters as g,styleText as _}from"node:util";import v,{cwd as ee,env as y}from"node:process";import*as b from"node:tty";import{isatty as x}from"node:tty";import{spawn as te}from"node:child_process";import S,{existsSync as ne,readFileSync as re,writeFileSync as ie}from"node:fs";import C,{access as ae,chmod as w,cp as oe,mkdtemp as T,readFile as se,rm as ce,stat as E,writeFile as D}from"node:fs/promises";import{AsyncLocalStorage as le,AsyncResource as ue}from"node:async_hooks";import*as de from"node:readline";import O from"node:readline";import*as k from"fs";import A from"fs";import j,{tmpdir as fe}from"node:os";import{createHash as pe}from"node:crypto";import{fileURLToPath as me,pathToFileURL as M}from"node:url";import he,{basename as ge,dirname as N,normalize as P,posix as _e,relative as ve,resolve as ye,sep as be}from"path";import{fileURLToPath as xe}from"url";import{createRequire as Se}from"module";import{Buffer as Ce}from"node:buffer";import{brotliCompress as we,gzip as Te}from"node:zlib";import{Worker as Ee,isMainThread as De}from"node:worker_threads";import{PassThrough as Oe}from"node:stream";var ke=Object.create,Ae=Object.defineProperty,je=Object.getOwnPropertyDescriptor,Me=Object.getOwnPropertyNames,Ne=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty,Fe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ie=(e,t)=>{let n={};for(var r in e)Ae(n,r,{get:e[r],enumerable:!0});return t&&Ae(n,Symbol.toStringTag,{value:`Module`}),n},Le=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Me(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Pe.call(e,s)&&s!==n&&Ae(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=je(t,s))||r.enumerable});return e},Re=(e,t,n)=>(n=e==null?{}:ke(Ne(e)),Le(t||!e||!e.__esModule?Ae(n,`default`,{value:e,enumerable:!0}):n,e)),ze=n(import.meta.url),Be=`@fastgpt-plugin/cli`,Ve=`0.1.0-alpha.5`;const He=Be,Ue=Ve,We=`This is a FastGPT plugin`,Ge=i.join(import.meta.dirname,`../templates`),Ke={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},qe={silent:{level:-1},fatal:{level:Ke.fatal},error:{level:Ke.error},warn:{level:Ke.warn},log:{level:Ke.log},info:{level:Ke.info},success:{level:Ke.success},fail:{level:Ke.fail},ready:{level:Ke.info},start:{level:Ke.info},box:{level:Ke.info},debug:{level:Ke.debug},trace:{level:Ke.trace},verbose:{level:Ke.verbose}};function Je(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function Ye(e,t,n=`.`,r){if(!Je(t))return Ye(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Je(a)&&Je(i[t])?i[t]=Ye(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Xe(e){return(...t)=>t.reduce((t,n)=>Ye(t,n,``,e),{})}const Ze=Xe();function Qe(e){return Object.prototype.toString.call(e)===`[object Object]`}function $e(e){return!(!Qe(e)||!e.message&&!e.args||e.stack)}let et=!1;const tt=[];var nt=class e{options;_lastLog;_mockFn;constructor(e={}){let t=e.types||qe;for(let n in this.options=Ze({...e,defaults:{...e.defaults},level:rt(e.level,t),reporters:[...e.reporters||[]]},{types:qe,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}}),t){let e={type:n,...this.options.defaults,...t[n]};this[n]=this._wrapLogFn(e),this[n].raw=this._wrapLogFn(e,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=rt(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,t)}create(t){let n=new e({...this.options,...t});return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(t!==-1)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,t){e&&(e.__write||=e.write,e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){et=!0}resumeLogs(){et=!1;let e=tt.splice(0);for(let t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,typeof t==`function`)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>{if(et){tt.push([this,e,n,t]);return}return this._logFn(e,n,t)}}_logFn(e,t,n){if((e.level||0)>this.level)return!1;let r={date:new Date,args:[],...e,level:rt(e.level,this.options.types)};!n&&t.length===1&&$e(t[0])?Object.assign(r,t[0]):r.args=[...t],r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split(`
3
+ `)),r.args.push(`
4
+ `+r.additional.join(`
5
+ `)),delete r.additional),r.type=typeof r.type==`string`?r.type.toLowerCase():`log`,r.tag=typeof r.tag==`string`?r.tag:``;let i=(e=!1)=>{let t=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&t>0){let e=[...this._lastLog.object.args];t>1&&e.push(`(repeated ${t} times)`),this._log({...this._lastLog.object,args:e}),this._lastLog.count=1}e&&(this._lastLog.object=r,this._log(r))};clearTimeout(this._lastLog.timeout);let a=this._lastLog.time&&r.date?r.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=r.date,a<this.options.throttle)try{let e=JSON.stringify([r.type,r.tag,r.args]),t=this._lastLog.serialized===e;if(this._lastLog.serialized=e,t&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(i,this.options.throttle);return}}catch{}i(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}};function rt(e,t={},n=3){return e===void 0?n:typeof e==`number`?e:t[e]&&t[e].level!==void 0?t[e].level:n}nt.prototype.add=nt.prototype.addReporter,nt.prototype.remove=nt.prototype.removeReporter,nt.prototype.clear=nt.prototype.removeReporter,nt.prototype.withScope=nt.prototype.withTag,nt.prototype.mock=nt.prototype.mockTypes,nt.prototype.pause=nt.prototype.pauseLogs,nt.prototype.resume=nt.prototype.resumeLogs;function it(e={}){return new nt(e)}function at(e,t){let n=process.cwd()+f;return e.split(`
6
+ `).splice(t.split(`
7
+ `).length).map(e=>e.trim().replace(`file://`,``).replace(n,``))}function ot(e,t){return(t.__write||t.write).call(t,e)}const st=e=>e?`[${e}]`:``;var ct=class{formatStack(e,t,n){let r=` `.repeat((n?.errorLevel||0)+1);return r+at(e,t).join(`
8
+ ${r}`)}formatError(e,t){let n=e.message??p(t,e),r=e.stack?this.formatStack(e.stack,n,t):``,i=t?.errorLevel||0,a=i>0?`${` `.repeat(i)}[cause]: `:``,o=e.cause?`
12
9
 
13
- //#region package.json
14
- var name = "@fastgpt-plugin/cli";
15
- var version = "0.1.0-alpha.1";
10
+ `+this.formatError(e.cause,{...t,errorLevel:i+1}):``;return a+n+`
11
+ `+r+o}formatArgs(e,t){return p(t,...e.map(e=>e&&typeof e.stack==`string`?this.formatError(e,t):e))}formatDate(e,t){return t.date?e.toLocaleTimeString():``}filterAndJoin(e){return e.filter(Boolean).join(` `)}formatLogObj(e,t){let n=this.formatArgs(e.args,t);return e.type===`box`?`
12
+ `+[st(e.tag),e.title&&e.title,...n.split(`
13
+ `)].filter(Boolean).map(e=>` > `+e).join(`
14
+ `)+`
15
+ `:this.filterAndJoin([st(e.type),st(e.tag),n])}log(e,t){return ot(this.formatLogObj(e,{columns:t.options.stdout.columns||0,...t.options.formatOptions})+`
16
+ `,e.level<2?t.options.stderr||process.stderr:t.options.stdout||process.stdout)}};const{env:lt={},argv:ut=[],platform:dt=``}=typeof process>`u`?{}:process,ft=`NO_COLOR`in lt||ut.includes(`--no-color`),pt=`FORCE_COLOR`in lt||ut.includes(`--color`),mt=dt===`win32`,ht=lt.TERM===`dumb`,gt=b&&b.isatty&&b.isatty(1)&&lt.TERM&&!ht,_t=`CI`in lt&&(`GITHUB_ACTIONS`in lt||`GITLAB_CI`in lt||`CIRCLECI`in lt),vt=!ft&&(pt||mt&&!ht||gt||_t);function yt(e,t,n,r,i=t.slice(0,Math.max(0,e))+r,a=t.slice(Math.max(0,e+n.length)),o=a.indexOf(n)){return i+(o<0?a:yt(o,a,n,r))}function bt(e,t,n,r,i){return e<0?n+t+r:n+yt(e,t,r,i)+r}function xt(e,t,n=e,r=e.length+1){return i=>i||!(i===``||i===void 0)?bt((``+i).indexOf(t,r),i,e,t,n):``}function F(e,t,n){return xt(`\x1B[${e}m`,`\x1B[${t}m`,n)}const St={reset:F(0,0),bold:F(1,22,`\x1B[22m\x1B[1m`),dim:F(2,22,`\x1B[22m\x1B[2m`),italic:F(3,23),underline:F(4,24),inverse:F(7,27),hidden:F(8,28),strikethrough:F(9,29),black:F(30,39),red:F(31,39),green:F(32,39),yellow:F(33,39),blue:F(34,39),magenta:F(35,39),cyan:F(36,39),white:F(37,39),gray:F(90,39),bgBlack:F(40,49),bgRed:F(41,49),bgGreen:F(42,49),bgYellow:F(43,49),bgBlue:F(44,49),bgMagenta:F(45,49),bgCyan:F(46,49),bgWhite:F(47,49),blackBright:F(90,39),redBright:F(91,39),greenBright:F(92,39),yellowBright:F(93,39),blueBright:F(94,39),magentaBright:F(95,39),cyanBright:F(96,39),whiteBright:F(97,39),bgBlackBright:F(100,49),bgRedBright:F(101,49),bgGreenBright:F(102,49),bgYellowBright:F(103,49),bgBlueBright:F(104,49),bgMagentaBright:F(105,49),bgCyanBright:F(106,49),bgWhiteBright:F(107,49)};function Ct(e=vt){return e?St:Object.fromEntries(Object.keys(St).map(e=>[e,String]))}const wt=Ct();function Tt(e,t=`reset`){return wt[e]||wt[t]}const Et=[String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);function Dt(e){return e.replace(new RegExp(Et,`g`),``)}const Ot={solid:{tl:`┌`,tr:`┐`,bl:`└`,br:`┘`,h:`─`,v:`│`},double:{tl:`╔`,tr:`╗`,bl:`╚`,br:`╝`,h:`═`,v:`║`},doubleSingle:{tl:`╓`,tr:`╖`,bl:`╙`,br:`╜`,h:`─`,v:`║`},doubleSingleRounded:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`,h:`─`,v:`║`},singleThick:{tl:`┏`,tr:`┓`,bl:`┗`,br:`┛`,h:`━`,v:`┃`},singleDouble:{tl:`╒`,tr:`╕`,bl:`╘`,br:`╛`,h:`═`,v:`│`},singleDoubleRounded:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`,h:`═`,v:`│`},rounded:{tl:`╭`,tr:`╮`,bl:`╰`,br:`╯`,h:`─`,v:`│`}},kt={borderColor:`white`,borderStyle:`rounded`,valign:`center`,padding:2,marginLeft:1,marginTop:1,marginBottom:1};function At(e,t={}){let n={...t,style:{...kt,...t.style}},r=e.split(`
17
+ `),i=[],a=Tt(n.style.borderColor),o={...typeof n.style.borderStyle==`string`?Ot[n.style.borderStyle]||Ot.solid:n.style.borderStyle};if(a)for(let e in o)o[e]=a(o[e]);let s=n.style.padding%2==0?n.style.padding:n.style.padding+1,c=r.length+s,l=Math.max(...r.map(e=>Dt(e).length),n.title?Dt(n.title).length:0)+s,u=l+s,d=n.style.marginLeft>0?` `.repeat(n.style.marginLeft):``;if(n.style.marginTop>0&&i.push(``.repeat(n.style.marginTop)),n.title){let e=a?a(n.title):n.title,t=o.h.repeat(Math.floor((l-Dt(n.title).length)/2)),r=o.h.repeat(l-Dt(n.title).length-Dt(t).length+s);i.push(`${d}${o.tl}${t}${e}${r}${o.tr}`)}else i.push(`${d}${o.tl}${o.h.repeat(u)}${o.tr}`);let f=n.style.valign===`center`?Math.floor((c-r.length)/2):n.style.valign===`top`?c-r.length-s:c-r.length;for(let e=0;e<c;e++)if(e<f||e>=f+r.length)i.push(`${d}${o.v}${` `.repeat(u)}${o.v}`);else{let t=r[e-f],n=` `.repeat(s),a=` `.repeat(l-Dt(t).length);i.push(`${d}${o.v}${n}${t}${a}${o.v}`)}return i.push(`${d}${o.bl}${o.h.repeat(u)}${o.br}`),n.style.marginBottom>0&&i.push(``.repeat(n.style.marginBottom)),i.join(`
18
+ `)}const jt=Object.create(null),Mt=e=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?jt:globalThis),Nt=new Proxy(jt,{get(e,t){return Mt()[t]??jt[t]},has(e,t){return t in Mt()||t in jt},set(e,t,n){let r=Mt(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=Mt(!0);return delete n[t],!0},ownKeys(){let e=Mt(!0);return Object.keys(e)}}),Pt=typeof process<`u`&&process.env&&process.env.NODE_ENV||``,Ft=[[`APPVEYOR`],[`AWS_AMPLIFY`,`AWS_APP_ID`,{ci:!0}],[`AZURE_PIPELINES`,`SYSTEM_TEAMFOUNDATIONCOLLECTIONURI`],[`AZURE_STATIC`,`INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN`],[`APPCIRCLE`,`AC_APPCIRCLE`],[`BAMBOO`,`bamboo_planKey`],[`BITBUCKET`,`BITBUCKET_COMMIT`],[`BITRISE`,`BITRISE_IO`],[`BUDDY`,`BUDDY_WORKSPACE_ID`],[`BUILDKITE`],[`CIRCLE`,`CIRCLECI`],[`CIRRUS`,`CIRRUS_CI`],[`CLOUDFLARE_PAGES`,`CF_PAGES`,{ci:!0}],[`CODEBUILD`,`CODEBUILD_BUILD_ARN`],[`CODEFRESH`,`CF_BUILD_ID`],[`DRONE`],[`DRONE`,`DRONE_BUILD_EVENT`],[`DSARI`],[`GITHUB_ACTIONS`],[`GITLAB`,`GITLAB_CI`],[`GITLAB`,`CI_MERGE_REQUEST_ID`],[`GOCD`,`GO_PIPELINE_LABEL`],[`LAYERCI`],[`HUDSON`,`HUDSON_URL`],[`JENKINS`,`JENKINS_URL`],[`MAGNUM`],[`NETLIFY`],[`NETLIFY`,`NETLIFY_LOCAL`,{ci:!1}],[`NEVERCODE`],[`RENDER`],[`SAIL`,`SAILCI`],[`SEMAPHORE`],[`SCREWDRIVER`],[`SHIPPABLE`],[`SOLANO`,`TDDIUM`],[`STRIDER`],[`TEAMCITY`,`TEAMCITY_VERSION`],[`TRAVIS`],[`VERCEL`,`NOW_BUILDER`],[`VERCEL`,`VERCEL`,{ci:!1}],[`VERCEL`,`VERCEL_ENV`,{ci:!1}],[`APPCENTER`,`APPCENTER_BUILD_ID`],[`CODESANDBOX`,`CODESANDBOX_SSE`,{ci:!1}],[`CODESANDBOX`,`CODESANDBOX_HOST`,{ci:!1}],[`STACKBLITZ`],[`STORMKIT`],[`CLEAVR`],[`ZEABUR`],[`CODESPHERE`,`CODESPHERE_APP_ID`,{ci:!0}],[`RAILWAY`,`RAILWAY_PROJECT_ID`],[`RAILWAY`,`RAILWAY_SERVICE_ID`],[`DENO-DEPLOY`,`DENO_DEPLOYMENT_ID`],[`FIREBASE_APP_HOSTING`,`FIREBASE_APP_HOSTING`,{ci:!0}]];function It(){if(globalThis.process?.env)for(let e of Ft){let t=e[1]||e[0];if(globalThis.process?.env[t])return{name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL===`/bin/jsh`&&globalThis.process?.versions?.webcontainer?{name:`stackblitz`,ci:!1}:{name:``,ci:!1}}const Lt=It();Lt.name;function Rt(e){return e?e!==`false`:!1}const zt=globalThis.process?.platform||``,Bt=Rt(Nt.CI)||Lt.ci!==!1,Vt=Rt(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),Ht=Rt(Nt.DEBUG),Ut=Pt===`test`||Rt(Nt.TEST);Nt.MINIMAL;const Wt=/^win/i.test(zt);!Rt(Nt.NO_COLOR)&&(Rt(Nt.FORCE_COLOR)||(Vt||Wt)&&Nt.TERM);const Gt=(globalThis.process?.versions?.node||``).replace(/^v/,``)||null;Number(Gt?.split(`.`)[0]);const Kt=globalThis.process||Object.create(null),qt={versions:{}};new Proxy(Kt,{get(e,t){if(t===`env`)return Nt;if(t in e)return e[t];if(t in qt)return qt[t]}});const Jt=globalThis.process?.release?.name===`node`,Yt=!!globalThis.Bun||!!globalThis.process?.versions?.bun,Xt=!!globalThis.Deno,Zt=!!globalThis.fastly,Qt=!!globalThis.Netlify,$t=!!globalThis.EdgeRuntime,en=globalThis.navigator?.userAgent===`Cloudflare-Workers`,tn=[[Qt,`netlify`],[$t,`edge-light`],[en,`workerd`],[Zt,`fastly`],[Xt,`deno`],[Yt,`bun`],[Jt,`node`]];function nn(){let e=tn.find(e=>e[0]);if(e)return{name:e[1]}}nn()?.name;function rn({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}const an=rn();function on(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(an,``)}function sn(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function cn(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function ln(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101631&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129673||e>=129679&&e<=129734||e>=129742&&e<=129756||e>=129759&&e<=129769||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function un(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function dn(e,{ambiguousAsWide:t=!1}={}){return un(e),cn(e)||ln(e)||t&&sn(e)?2:1}const fn=()=>/[#*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\uDC70\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-\uDED7\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\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\uDD3D\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-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\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]|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\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,pn=globalThis.Intl?.Segmenter?new Intl.Segmenter:{segment:e=>e.split(``)},mn=/^\p{Default_Ignorable_Code_Point}$/u;function hn(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=on(e)),e.length===0)return 0;let i=0,a={ambiguousAsWide:!n};for(let{segment:t}of pn.segment(e)){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159)&&!(e>=8203&&e<=8207||e===65279)&&!(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)&&!mn.test(t)){if(fn().test(t)){i+=2;continue}i+=dn(e,a)}}return i}function gn(){let{env:e}=v,{TERM:t,TERM_PROGRAM:n}=e;return v.platform===`win32`?!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask===`{cmd::Cmder}`||n===`Terminus-Sublime`||n===`vscode`||t===`xterm-256color`||t===`alacritty`||t===`rxvt-unicode`||t===`rxvt-unicode-256color`||e.TERMINAL_EMULATOR===`JetBrains-JediTerm`:t!==`linux`}const _n={info:`cyan`,fail:`red`,success:`green`,ready:`green`,start:`magenta`},vn={0:`red`,1:`yellow`},yn=gn(),bn=(e,t)=>yn?e:t,xn={error:bn(`✖`,`×`),fatal:bn(`✖`,`×`),ready:bn(`✔`,`√`),warn:bn(`⚠`,`‼`),info:bn(`ℹ`,`i`),success:bn(`✔`,`√`),debug:bn(`⚙`,`D`),trace:bn(`→`,`→`),fail:bn(`✖`,`×`),start:bn(`◐`,`o`),log:``};function Sn(e){return typeof Intl!=`object`||!Intl.Segmenter?Dt(e).length:hn(e)}var Cn=class extends ct{formatStack(e,t,n){let r=` `.repeat((n?.errorLevel||0)+1);return`
19
+ ${r}`+at(e,t).map(e=>` `+e.replace(/^at +/,e=>wt.gray(e)).replace(/\((.+)\)/,(e,t)=>`(${wt.cyan(t)})`)).join(`
20
+ ${r}`)}formatType(e,t,n){let r=_n[e.type]||vn[e.level]||`gray`;if(t)return En(r)(wt.black(` ${e.type.toUpperCase()} `));let i=typeof xn[e.type]==`string`?xn[e.type]:e.icon||e.type;return i?Tn(r)(i):``}formatLogObj(e,t){let[n,...r]=this.formatArgs(e.args,t).split(`
21
+ `);if(e.type===`box`)return At(wn(n+(r.length>0?`
22
+ `+r.join(`
23
+ `):``)),{title:e.title?wn(e.title):void 0,style:e.style});let i=this.formatDate(e.date,t),a=i&&wt.gray(i),o=e.badge??e.level<2,s=this.formatType(e,o,t),c=e.tag?wt.gray(e.tag):``,l,u=this.filterAndJoin([s,wn(n)]),d=this.filterAndJoin(t.columns?[c,a]:[c]),f=(t.columns||0)-Sn(u)-Sn(d)-2;if(l=f>0&&(t.columns||0)>=80?u+` `.repeat(f)+d:(d?`${wt.gray(`[${d}]`)} `:``)+u,l+=wn(r.length>0?`
24
+ `+r.join(`
25
+ `):``),e.type===`trace`){let t=Error(`Trace: `+e.message);l+=this.formatStack(t.stack||``,t.message)}return o?`
26
+ `+l+`
27
+ `:l}};function wn(e){return e.replace(/`([^`]+)`/gm,(e,t)=>wt.cyan(t)).replace(/\s+_([^_]+)_\s+/gm,(e,t)=>` ${wt.underline(t)} `)}function Tn(e=`white`){return wt[e]||wt.white}function En(e=`bgWhite`){return wt[`bg${e[0].toUpperCase()}${e.slice(1)}`]||wt.bgWhite}function Dn(e={}){let t=On();return process.env.CONSOLA_LEVEL&&(t=Number.parseInt(process.env.CONSOLA_LEVEL)??t),it({level:t,defaults:{level:t},stdout:process.stdout,stderr:process.stderr,prompt:(...e)=>import(`./prompt-ob7l3SPy.js`).then(t=>t.prompt(...e)),reporters:e.reporters||[e.fancy??!(Bt||Ut)?new Cn:new ct],...e})}function On(){return Ht?Ke.debug:Ut?Ke.warn:Ke.info}const kn=Dn().withTag(He);var An=Fe((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),jn=Fe((e=>{let{InvalidArgumentError:t}=An();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Mn=Fe((e=>{let{humanReadableArgName:t}=jn();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
28
+ `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
29
+ `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
30
+ `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),Nn=Fe((e=>{let{InvalidArgumentError:t}=An();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
31
+ - a short flag is a single dash and a single character
32
+ - either use a single dash and a single character (for a short flag)
33
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
34
+ - too many short flags`):i.test(t)?Error(`${n}
35
+ - too many long flags`):Error(`${n}
36
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),Pn=Fe((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),Fn=Fe((e=>{let t=ze(`node:events`).EventEmitter,n=ze(`node:child_process`),r=ze(`node:path`),i=ze(`node:fs`),a=ze(`node:process`),{Argument:o,humanReadableArgName:s}=jn(),{CommanderError:c}=An(),{Help:l,stripColor:u}=Mn(),{Option:d,DualOptions:f}=Nn(),{suggestSimilar:p}=Pn();var m=class e extends t{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>g()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>g()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:e=>u(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new l,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
37
+ - specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new o(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
38
+ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new c(e,t,n)),a.exit(e)}action(e){return this._actionHandler=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)},this}createOption(e,t){return new d(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
39
+ - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{r(t,`error: option '${e.flags}' argument '${t}' is invalid.`,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{r(t,`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof d)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){a.versions?.electron&&(t.from=`electron`);let e=a.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=a.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:a.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
40
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(i.existsSync(e))return;let r=`'${e}' does not exist
41
+ - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
42
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
43
+ - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let o=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function l(e,t){let n=r.resolve(e,t);if(i.existsSync(n))return n;if(s.includes(r.extname(t)))return;let a=s.find(e=>i.existsSync(`${n}${e}`));if(a)return`${n}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=i.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=l(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=l(d,`${n}-${e._name}`))}u=t||u}o=s.includes(r.extname(u));let f;a.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.execPath,t,{stdio:`inherit`})):o?(t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.argv[0],t,{stdio:`inherit`})):f=n.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{a.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new c(e,`commander.executeSubCommandAsync`,`(close)`)):a.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)a.exit(1);else{let e=new c(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
44
+ `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=p(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=p(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>s(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(a.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
45
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g}));const{program:In,createCommand:Ln,createArgument:Rn,createOption:zn,CommanderError:Bn,InvalidArgumentError:Vn,InvalidOptionArgumentError:Hn,Command:Un,Argument:Wn,Option:Gn,Help:Kn}=Re(Fe((e=>{let{Argument:t}=jn(),{Command:n}=Fn(),{CommanderError:r,InvalidArgumentError:i}=An(),{Help:a}=Mn(),{Option:o}=Nn();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var qn=class{};const Jn=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Yn=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Xn=e=>e.name===`backspace`,Zn=e=>e.name===`tab`,Qn=e=>`1234567890`.includes(e.name),$n=e=>e.name===`enter`||e.name===`return`;var er=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},tr=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},nr=class extends Error{name=`ExitPromptError`},rr=class extends Error{name=`HookError`},ir=class extends Error{name=`ValidationError`};const ar=new le;function or(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function sr(e,t){let n=or(e);return ar.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function cr(){let e=ar.getStore();if(!e)throw new rr(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function lr(){return cr().rl}function ur(e){return ue.bind((...t)=>{let n=cr(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function dr(e){let t=cr(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function fr(){cr().handleChange()}const pr={queue(e){let t=cr(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(lr());if(r!=null&&typeof r!=`function`)throw new ir(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=cr();ur(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=cr();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function mr(e){return dr(t=>{let n=ue.bind(function(e){t.get()!==e&&(t.set(e),fr())});if(t.initialized)return[t.get(),n];let r=typeof e==`function`?e():e;return t.set(r),[r,n]})}function hr(e,t){dr(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&pr.queue(e),n.set(t)})}function gr(){return v.platform===`win32`?!!v.env.WT_SESSION||!!v.env.TERMINUS_SUBLIME||v.env.ConEmuTask===`{cmd::Cmder}`||v.env.TERM_PROGRAM===`Terminus-Sublime`||v.env.TERM_PROGRAM===`vscode`||v.env.TERM===`xterm-256color`||v.env.TERM===`alacritty`||v.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:v.env.TERM!==`linux`}const _r={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},vr={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},yr={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},br={..._r,...vr},xr={..._r,...yr};var Sr=gr()?br:xr;Object.entries(vr);const Cr={prefix:{idle:_(`blue`,`?`),done:_(`green`,Sr.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>_(`yellow`,e))},style:{answer:e=>_(`cyan`,e),message:e=>_(`bold`,e),error:e=>_(`red`,`> ${e}`),defaultAnswer:e=>_(`dim`,`(${e})`),help:e=>_(`dim`,e),highlight:e=>_(`cyan`,e),key:e=>_(`cyan`,_(`bold`,`<${e}>`))}};function wr(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Tr(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=wr(n)&&wr(r)?Tr(n,r):r}return t}function Er(...e){return Tr(Cr,...e.filter(e=>e!=null))}function Dr({status:e=`idle`,theme:t}){let[n,r]=mr(!1),[i,a]=mr(0),{prefix:o,spinner:s}=Er(t);return hr(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function Or(e,t){return dr(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function kr(e){return mr({current:e})[0]}function Ar(e){let t=kr(e);t.current=e,hr(e=>{let n=!1,r=ur((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var jr=Fe(((e,t)=>{t.exports=r;function n(e){let t={defaultWidth:0,output:process.stdout,tty:ze(`tty`)};return e?(Object.keys(t).forEach(function(n){e[n]||(e[n]=t[n])}),e):t}function r(e){let t=n(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));function Mr({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`)}const Nr=Mr();function Pr(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Nr,``)}function Fr(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function Ir(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Lr(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||e===129736||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function Rr(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function zr(e,{ambiguousAsWide:t=!1}={}){return Rr(e),Ir(e)||Lr(e)||t&&Fr(e)?2:1}var Br=Re(Fe(((e,t)=>{t.exports=()=>/[#*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}))(),1);const Vr=new Intl.Segmenter,Hr=/^\p{Default_Ignorable_Code_Point}$/u;function Ur(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t;if(r||(e=Pr(e)),e.length===0)return 0;let i=0,a={ambiguousAsWide:!n};for(let{segment:t}of Vr.segment(e)){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159)&&!(e>=8203&&e<=8207||e===65279)&&!(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)&&!Hr.test(t)){if((0,Br.default)().test(t)){i+=2;continue}i+=zr(e,a)}}return i}const Wr=(e=0)=>t=>`\u001B[${t+e}m`,Gr=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,Kr=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,qr={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(qr.modifier);const Jr=Object.keys(qr.color),Yr=Object.keys(qr.bgColor);[...Jr,...Yr];function Xr(){let e=new Map;for(let[t,n]of Object.entries(qr)){for(let[t,r]of Object.entries(n))qr[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=qr[t],e.set(r[0],r[1]);Object.defineProperty(qr,t,{value:n,enumerable:!1})}return Object.defineProperty(qr,`codes`,{value:e,enumerable:!1}),qr.color.close=`\x1B[39m`,qr.bgColor.close=`\x1B[49m`,qr.color.ansi=Wr(),qr.color.ansi256=Gr(),qr.color.ansi16m=Kr(),qr.bgColor.ansi=Wr(10),qr.bgColor.ansi256=Gr(10),qr.bgColor.ansi16m=Kr(10),Object.defineProperties(qr,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?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(n/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[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>qr.rgbToAnsi256(...qr.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>qr.ansi256ToAnsi(qr.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>qr.ansi256ToAnsi(qr.hexToAnsi256(e)),enumerable:!1}}),qr}var Zr=Xr();const Qr=new Set([`\x1B`,`›`]),$r=`]8;;`,ei=e=>`${Qr.values().next().value}[${e}m`,ti=e=>`${Qr.values().next().value}${$r}${e}`,ni=e=>e.split(` `).map(e=>Ur(e)),ri=(e,t,n)=>{let r=[...t],i=!1,a=!1,o=Ur(Pr(e.at(-1)));for(let[t,s]of r.entries()){let c=Ur(s);if(o+c<=n?e[e.length-1]+=s:(e.push(s),o=0),Qr.has(s)&&(i=!0,a=r.slice(t+1,t+1+4).join(``)===$r),i){a?s===`\x07`&&(i=!1,a=!1):s===`m`&&(i=!1);continue}o+=c,o===n&&t<r.length-1&&(e.push(``),o=0)}!o&&e.at(-1).length>0&&e.length>1&&(e[e.length-2]+=e.pop())},ii=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(Ur(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},ai=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=ni(e),s=[``];for(let[r,i]of e.split(` `).entries()){n.trim!==!1&&(s[s.length-1]=s.at(-1).trimStart());let e=Ur(s.at(-1));if(r!==0&&(e>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),e=0),(e>0||n.trim===!1)&&(s[s.length-1]+=` `,e++)),n.hard&&o[r]>t){let n=t-e,a=1+Math.floor((o[r]-n-1)/t);Math.floor((o[r]-1)/t)<a&&s.push(``),ri(s,i,t);continue}if(e+o[r]>t&&e>0&&o[r]>0){if(n.wordWrap===!1&&e<t){ri(s,i,t);continue}s.push(``)}if(e+o[r]>t&&n.wordWrap===!1){ri(s,i,t);continue}s[s.length-1]+=i}n.trim!==!1&&(s=s.map(e=>ii(e)));let c=s.join(`
46
+ `),l=[...c],u=0;for(let[e,t]of l.entries()){if(r+=t,Qr.has(t)){let{groups:e}=RegExp(`(?:\\[(?<code>\\d+)m|\\${$r}(?<uri>.*))`).exec(c.slice(u))||{groups:{}};if(e.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=Zr.codes.get(Number(i));l[e+1]===`
47
+ `?(a&&(r+=ti(``)),i&&n&&(r+=ei(n))):t===`
48
+ `&&(i&&n&&(r+=ei(i)),a&&(r+=ti(a))),u+=t.length}return r};function oi(e,t,n){return String(e).normalize().replaceAll(`\r
49
+ `,`
50
+ `).split(`
51
+ `).map(e=>ai(e,t,n)).join(`
52
+ `)}var si=Re(jr(),1);function ci(e,t){return e.split(`
53
+ `).flatMap(e=>oi(e,t,{trim:!1,hard:!0}).split(`
54
+ `).map(e=>e.trimEnd())).join(`
55
+ `)}function li(){return(0,si.default)({defaultWidth:80,output:lr().output})}function ui({active:e,renderedItems:t,pageSize:n,loop:r}){let i=kr({lastPointer:e,lastActive:void 0}),{lastPointer:a,lastActive:o}=i.current,s=Math.floor(n/2),c=t.reduce((e,t)=>e+t.length,0),l=t.slice(0,e).reduce((e,t)=>e+t.length,0),u=l;if(c>n)if(r)u=a,o!=null&&o<e&&e-o<n&&(u=Math.min(s,Math.abs(e-o)===1?Math.min(a+(t[o]?.length??0),Math.max(l,a)):a+e-o));else{let r=t.slice(e).reduce((e,t)=>e+t.length,0);u=r<n-s?n-r:Math.min(l,s)}return i.current.lastPointer=u,i.current.lastActive=e,u}function di({items:e,active:t,renderItem:n,pageSize:r,loop:i=!0}){let a=li(),o=t=>(t%e.length+e.length)%e.length,s=e.map((e,r)=>e==null?[]:ci(n({item:e,index:r,isActive:r===t}),a).split(`
56
+ `)),c=s.reduce((e,t)=>e+t.length,0),l=e=>s[e]??[],u=ui({active:t,renderedItems:s,pageSize:r,loop:i}),d=l(t).slice(0,r),f=u+d.length<=r?u:r-d.length,p=Array.from({length:r});p.splice(f,d.length,...d);let m=new Set([t]),h=f+d.length,g=o(t+1);for(;h<r&&!m.has(g)&&(i&&c>r?g!==t:g>t);){let e=l(g).slice(0,r-h);p.splice(h,e.length,...e),m.add(g),h+=e.length,g=o(g+1)}for(h=f-1,g=o(t-1);h>=0&&!m.has(g)&&(i&&c>r?g!==t:g<t);){let e=l(g),t=e.slice(Math.max(0,e.length-h-1));p.splice(h-t.length+1,t.length,...t),m.add(g),h-=t.length,g=o(g-1)}return p.filter(e=>typeof e==`string`).join(`
57
+ `)}var fi=Fe(((e,t)=>{let n=ze(`stream`);t.exports=class extends n{#e=null;constructor(e={}){super(e),this.writable=this.readable=!0,this.muted=!1,this.on(`pipe`,this._onpipe),this.replace=e.replace,this._prompt=e.prompt||null,this._hadControl=!1}#t(e,t){return this._dest?this._dest[e]:this._src?this._src[e]:t}#n(e,...t){typeof this._dest?.[e]==`function`&&this._dest[e](...t),typeof this._src?.[e]==`function`&&this._src[e](...t)}get isTTY(){return this.#e===null?this.#t(`isTTY`,!1):this.#e}set isTTY(e){this.#e=e}get rows(){return this.#t(`rows`)}get columns(){return this.#t(`columns`)}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(e){this._src=e}pipe(e,t){return this._dest=e,super.pipe(e,t)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(e){if(this.muted){if(!this.replace)return!0;if(e.match(/^\u001b/))return e.indexOf(this._prompt)===0&&(e=e.slice(this._prompt.length),e=e.replace(/./g,this.replace),e=this._prompt+e),this._hadControl=!0,this.emit(`data`,e);this._prompt&&this._hadControl&&e.indexOf(this._prompt)===0&&(this._hadControl=!1,this.emit(`data`,this._prompt),e=e.slice(this._prompt.length)),e=e.toString().replace(/./g,this.replace)}this.emit(`data`,e)}end(e){this.muted&&(e=e&&this.replace?e.toString().replace(/./g,this.replace):null),e&&this.emit(`data`,e),this.emit(`end`)}destroy(...e){return this.#n(`destroy`,...e)}destroySoon(...e){return this.#n(`destroySoon`,...e)}close(...e){return this.#n(`close`,...e)}}}));const pi=[];pi.push(`SIGHUP`,`SIGINT`,`SIGTERM`),process.platform!==`win32`&&pi.push(`SIGALRM`,`SIGABRT`,`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&pi.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`);const mi=e=>!!e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`,hi=Symbol.for(`signal-exit emitter`),gi=globalThis,_i=Object.defineProperty.bind(Object);var vi=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(gi[hi])return gi[hi];_i(gi,hi,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],r=n.indexOf(t);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let i of this.listeners[e])r=i(t,n)===!0||r;return e===`exit`&&(r=this.emit(`afterExit`,t,n)||r),r}},yi=class{};const bi=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}});var xi=class extends yi{onExit(){return()=>{}}load(){}unload(){}},Si=class extends yi{#e=Ci.platform===`win32`?`SIGINT`:`SIGHUP`;#t=new vi;#n;#r;#i;#a={};#o=!1;constructor(e){super(),this.#n=e,this.#a={};for(let t of pi)this.#a[t]=()=>{let n=this.#n.listeners(t),{count:r}=this.#t,i=e;if(typeof i.__signal_exit_emitter__==`object`&&typeof i.__signal_exit_emitter__.count==`number`&&(r+=i.__signal_exit_emitter__.count),n.length===r){this.unload();let n=this.#t.emit(`exit`,null,t),r=t===`SIGHUP`?this.#e:t;n||e.kill(e.pid,r)}};this.#i=e.reallyExit,this.#r=e.emit}onExit(e,t){if(!mi(this.#n))return()=>{};this.#o===!1&&this.load();let n=t?.alwaysLast?`afterExit`:`exit`;return this.#t.on(n,e),()=>{this.#t.removeListener(n,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(let e of pi)try{let t=this.#a[e];t&&this.#n.on(e,t)}catch{}this.#n.emit=(e,...t)=>this.#c(e,...t),this.#n.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,pi.forEach(e=>{let t=this.#a[e];if(!t)throw Error(`Listener not defined for signal: `+e);try{this.#n.removeListener(e,t)}catch{}}),this.#n.emit=this.#r,this.#n.reallyExit=this.#i,--this.#t.count)}#s(e){return mi(this.#n)?(this.#n.exitCode=e||0,this.#t.emit(`exit`,this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...t){let n=this.#r;if(e===`exit`&&mi(this.#n)){typeof t[0]==`number`&&(this.#n.exitCode=t[0]);let r=n.call(this.#n,e,...t);return this.#t.emit(`exit`,this.#n.exitCode,null),r}else return n.call(this.#n,e,...t)}};const Ci=globalThis.process,{onExit:wi,load:Ti,unload:Ei}=bi(mi(Ci)?new Si(Ci):new xi),Di=(e=1)=>e>0?`[${e}A`:``,Oi=(e=1)=>e>0?`[${e}B`:``,ki=(e,t)=>typeof t==`number`&&!Number.isNaN(t)?`[${t+1};${e+1}H`:`[${e+1}G`,Ai=`\x1B[2K`,ji=e=>e>0?(Ai+Di(1)).repeat(e-1)+Ai+`\x1B[G`:``,Mi=e=>e.split(`
58
+ `).length,Ni=e=>e.split(`
59
+ `).pop()??``;var Pi=class{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(e){this.rl=e,this.cursorPos=e.getCursorPos()}write(e){this.rl.output.unmute(),this.rl.output.write(e),this.rl.output.mute()}render(e,t=``){let n=g(Ni(e)),r=n;this.rl.line.length>0&&(r=r.slice(0,-this.rl.line.length)),this.rl.setPrompt(r),this.cursorPos=this.rl.getCursorPos();let i=li();e=ci(e,i),t=ci(t,i),n.length%i===0&&(e+=`
60
+ `);let a=e+(t?`
61
+ `+t:``),o=Math.floor(n.length/i)-this.cursorPos.rows+(t?Mi(t):0);o>0&&(a+=Di(o)),a+=ki(this.cursorPos.cols),this.write(Oi(this.extraLinesUnderPrompt)+ji(this.height)+a),this.extraLinesUnderPrompt=o,this.height=Mi(a)}checkCursorPos(){let e=this.rl.getCursorPos();e.cols!==this.cursorPos.cols&&(this.write(ki(e.cols)),this.cursorPos=e)}done({clearContent:e}){this.rl.setPrompt(``);let t=Oi(this.extraLinesUnderPrompt);t+=e?ji(this.height):`
62
+ `,t+=`\x1B[?25h`,this.write(t),this.rl.close()}},Fi=class extends Promise{static withResolver(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}},Ii=Re(fi(),1);function Li(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,n)=>{let r=n.slice(1);return t=r,r},Error().stack}catch{return t}return Error.prepareStackTrace=e,t}function Ri(e){let t=Li();return(n,r={})=>{let{input:i=process.stdin,signal:a}=r,o=new Set,s=new Ii.default;s.pipe(r.output??process.stdout);let c=de.createInterface({terminal:!0,input:i,output:s}),l=new Pi(c),{promise:u,resolve:d,reject:f}=Fi.withResolver(),p=()=>f(new tr);if(a){let e=()=>f(new er({cause:a.reason}));if(a.aborted)return e(),Object.assign(u,{cancel:p});a.addEventListener(`abort`,e),o.add(()=>a.removeEventListener(`abort`,e))}o.add(wi((e,t)=>{f(new nr(`User force closed the prompt with ${e} ${t}`))}));let m=()=>f(new nr(`User force closed the prompt with SIGINT`));c.on(`SIGINT`,m),o.add(()=>c.removeListener(`SIGINT`,m));let h=()=>l.checkCursorPos();return c.input.on(`keypress`,h),o.add(()=>c.input.removeListener(`keypress`,h)),sr(c,i=>{let a=ue.bind(()=>pr.clearAll());return c.on(`close`,a),o.add(()=>c.removeListener(`close`,a)),i(()=>{try{let r=e(n,e=>{setImmediate(()=>d(e))});if(r===void 0){let e=t[1]?.getFileName();throw Error(`Prompt functions must return a string.\n at ${e}`)}let[i,a]=typeof r==`string`?[r]:r;l.render(i,a),pr.run()}catch(e){f(e)}}),Object.assign(u.then(e=>(pr.clearAll(),e),e=>{throw pr.clearAll(),e}).finally(()=>{o.forEach(e=>e()),l.done({clearContent:!!r.clearPromptOnDone}),s.end()}).then(()=>u),{cancel:p})})}}var zi=class{separator=_(`dim`,Array.from({length:15}).join(Sr.line));type=`separator`;constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`separator`)}};const Bi={validationFailureMode:`keep`};var Vi=Ri((e,t)=>{let{prefill:n=`tab`}=e,r=Er(Bi,e.theme),[i,a]=mr(`idle`),[o=``,s]=mr(e.default),[c,l]=mr(),[u,d]=mr(``),f=Dr({status:i,theme:r});async function p(t){let{required:n,pattern:r,patternError:i=`Invalid input`}=e;return n&&!t?`You must provide a value`:r&&!r.test(t)?i:typeof e.validate==`function`?await e.validate(t)||`You must provide a valid value`:!0}Ar(async(e,n)=>{if(i===`idle`)if($n(e)){let e=u||o;a(`loading`);let i=await p(e);i===!0?(d(e),a(`done`),t(e)):(r.validationFailureMode===`clear`?d(``):n.write(u),l(i),a(`idle`))}else Xn(e)&&!u?s(void 0):Zn(e)&&!u?(s(void 0),n.clearLine(0),n.write(o),d(o)):(d(n.line),l(void 0))}),hr(e=>{n===`editable`&&o&&(e.write(o),d(o))},[]);let m=r.style.message(e.message,i),h=u;typeof e.transformer==`function`?h=e.transformer(u,{isFinal:i===`done`}):i===`done`&&(h=r.style.answer(u));let g;o&&i!==`done`&&!u&&(g=r.style.defaultAnswer(o));let _=``;return c&&(_=r.style.error(c)),[[f,m,g,h].filter(e=>e!==void 0).join(` `),_]});const Hi={icon:{cursor:Sr.pointer},style:{disabled:e=>_(`dim`,`- ${e}`),description:e=>_(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${_(`bold`,e)} ${_(`dim`,t)}`).join(_(`dim`,` • `))},indexMode:`hidden`,keybindings:[]};function Ui(e){return!zi.isSeparator(e)&&!e.disabled}function Wi(e){return e.map(e=>{if(zi.isSeparator(e))return e;if(typeof e!=`object`||!e||!(`value`in e)){let t=String(e);return{value:e,name:t,short:t,disabled:!1}}let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(n.description=e.description),n})}const Gi={input:Vi,select:Ri((e,t)=>{let{loop:n=!0,pageSize:r=7}=e,i=Er(Hi,e.theme),{keybindings:a}=i,[o,s]=mr(`idle`),c=Dr({status:o,theme:i}),l=kr(),u=!a.includes(`vim`),d=Or(()=>Wi(e.choices),[e.choices]),f=Or(()=>{let e=d.findIndex(Ui),t=d.findLastIndex(Ui);if(e===-1)throw new ir(`[select prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[d]),p=Or(()=>`default`in e?d.findIndex(t=>Ui(t)&&t.value===e.default):-1,[e.default,d]),[m,h]=mr(p===-1?f.first:p),g=d[m];Ar((e,r)=>{if(clearTimeout(l.current),$n(e))s(`done`),t(g.value);else if(Jn(e,a)||Yn(e,a)){if(r.clearLine(0),n||Jn(e,a)&&m!==f.first||Yn(e,a)&&m!==f.last){let t=Jn(e,a)?-1:1,n=m;do n=(n+t+d.length)%d.length;while(!Ui(d[n]));h(n)}}else if(Qn(e)&&!Number.isNaN(Number(r.line))){let e=Number(r.line)-1,t=-1,n=d.findIndex(n=>zi.isSeparator(n)?!1:(t++,t===e)),i=d[n];i!=null&&Ui(i)&&h(n),l.current=setTimeout(()=>{r.clearLine(0)},700)}else if(Xn(e))r.clearLine(0);else if(u){let e=r.line.toLowerCase(),t=d.findIndex(t=>zi.isSeparator(t)||!Ui(t)?!1:t.name.toLowerCase().startsWith(e));t!==-1&&h(t),l.current=setTimeout(()=>{r.clearLine(0)},700)}}),hr(()=>()=>{clearTimeout(l.current)},[]);let _=i.style.message(e.message,o),v=i.style.keysHelpTip([[`↑↓`,`navigate`],[`⏎`,`select`]]),ee=0,y=di({items:d,active:m,renderItem({item:e,isActive:t,index:n}){if(zi.isSeparator(e))return ee++,` ${e.separator}`;let r=i.indexMode===`number`?`${n+1-ee}. `:``;if(e.disabled){let t=typeof e.disabled==`string`?e.disabled:`(disabled)`;return i.style.disabled(`${r}${e.name} ${t}`)}return(t?i.style.highlight:e=>e)(`${t?i.icon.cursor:` `} ${r}${e.name}`)},pageSize:r,loop:n});if(o===`done`)return[c,_,i.style.answer(g.short)].filter(Boolean).join(` `);let{description:b}=g;return`${[[c,_].filter(Boolean).join(` `),y,` `,b?i.style.description(b):``,v].filter(Boolean).join(`
63
+ `).trimEnd()}[?25l`})};async function Ki(e,t){return e.input({...t,validate:e=>!e||e.trim().length===0?`请输入有效的内容`:!0})}var qi=class{deps;constructor(e=Gi){this.deps=e}async run(e){let t=(()=>{if(e.typeFlag)return e.typeFlag===`tool-suite`?`tool-suite`:`tool`})();if(e.nameArg&&t&&e.descriptionFlag!==void 0)return{name:e.nameArg,cwd:e.cwd,type:t,description:e.descriptionFlag};let n=e.nameArg??await(async()=>await Ki(this.deps,{message:`插件名称`,default:`./packages/my-tool`}))(),r=t??await(async()=>await this.deps.select({message:`选择插件类型`,choices:[{name:`单工具`,value:`tool`,description:`创建一个独立的工具`},{name:`工具集`,value:`tool-suite`,description:`创建一个包含多个子工具的工具集`}]}))(),i=e.descriptionFlag??await(async()=>await Ki(this.deps,{message:`插件描述`,default:We}))();return{name:n,cwd:e.cwd,type:r,description:i}}};const Ji=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function Yi(e){return Array.from(e.match(Ji)??[])}function Xi(e){return Yi(e).map(e=>e.toLowerCase()).join(`-`)}var Zi=class extends qn{register(e){e.command(`create`).description(`创建新的 FastGPT 插件项目`).argument(`[name]`,`插件名称`).option(`-t, --type <type>`,`插件类型: 单工具 | 工具集`).option(`-d, --description <desc>`,`插件描述`).option(`--cwd <path>`,`工作目录`,process.cwd()).action(async(e,t)=>{let n=await new qi().run({nameArg:e,typeFlag:t.type,descriptionFlag:t.description,cwd:t.cwd});await this.run(n)})}async run(e){let t=i.resolve(e.cwd,e.name),n=i.join(Ge,e.type===`tool-suite`?`tool-suite`:`tool`),r=await this.collectTemplateFiles(n),a=e.description??We;await this.ensureDir(t);for(let o of r){let r=i.join(n,o),s=i.join(t,o);await this.ensureDir(i.dirname(s));let c=await C.readFile(r,`utf-8`),l=this.applyPlaceholders(c,e.name,a);await C.writeFile(s,l,`utf-8`)}kn.success(`创建插件项目: ${e.name} (${e.type})`,{cwd:e.cwd})}applyPlaceholders(e,t,n){return t=i.basename(t),t=Xi(t),e.replace(/\{\{name\}\}/g,t).replace(/\{\{description\}\}/g,n)}async collectTemplateFiles(e){let t=[],n=async r=>{let a=await C.readdir(r,{withFileTypes:!0});for(let o of a){let a=i.join(r,o.name);if(o.isDirectory())await n(a);else{let n=i.relative(e,a).replace(/\\/g,`/`);t.push(n)}}};return await n(e),t.sort()}async ensureDir(e){await C.mkdir(e,{recursive:!0})}};const{Ansis:Qi,fg:$i,bg:ea,rgb:ta,bgRgb:na,hex:ra,bgHex:ia,reset:aa,inverse:oa,hidden:sa,visible:ca,bold:la,dim:ua,italic:da,underline:fa,strikethrough:pa,black:ma,red:ha,green:ga,yellow:_a,blue:va,magenta:ya,cyan:ba,white:xa,gray:Sa,redBright:Ca,greenBright:wa,yellowBright:Ta,blueBright:Ea,magentaBright:Da,cyanBright:Oa,whiteBright:ka,bgBlack:Aa,bgRed:ja,bgGreen:Ma,bgYellow:Na,bgBlue:Pa,bgMagenta:Fa,bgCyan:Ia,bgWhite:La,bgGray:Ra,bgRedBright:za,bgGreenBright:Ba,bgYellowBright:Va,bgBlueBright:Ha,bgMagentaBright:Ua,bgCyanBright:Wa,bgWhiteBright:Ga}=Re(Fe(((e,t)=>{let n,r,i,{defineProperty:a,setPrototypeOf:o,create:s,keys:c}=Object,{round:l,max:u}=Math,d=e=>{let t=/([a-f\d]{3,6})/i.exec(e)?.[1],n=t?.length,r=parseInt(6^n?3^n?`0`:t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,16);return[r>>16&255,r>>8&255,255&r]},f=(e,t,n)=>e^t||t^n?16+36*l(e/51)+6*l(t/51)+l(n/51):8>e?16:e>248?231:l(24*(e-8)/247)+232,p=e=>{let t,n,r,i,a;return 8>e?30+e:16>e?e-8+90:(232>e?(a=(e-=16)%36,t=(e/36|0)/5,n=(a/6|0)/5,r=a%6/5):t=n=r=(10*(e-232)+8)/255,i=2*u(t,n,r),i?30+(l(r)<<2|l(n)<<1|l(t))+(2^i?0:60):30)},m=(()=>{let e=e=>a.some((t=>e.test(t))),t=globalThis,i=t.process??{},a=i.argv??[],o=i.env??{},s=-1;try{n=`,`+c(o).join(`,`)}catch{o={},s=0}let l=`FORCE_COLOR`,u={false:0,0:0,1:1,2:2,3:3}[o[l]]??-1,d=l in o&&u||e(/^--color=?(true|always)?$/);return d&&(s=u),~s||(s=((e,t,i)=>(r=e.TERM,{"24bit":3,truecolor:3,ansi256:2,ansi:1}[e.COLORTERM]||(e.CI?/,GITHUB/.test(n)?3:1:t&&r!==`dumb`?i?3:/-256/.test(r)?2:1:0)))(o,!!o.PM2_HOME||o.NEXT_RUNTIME?.includes(`edge`)||!!i.stdout?.isTTY,i.platform===`win32`)),!u||o.NO_COLOR||e(/^--(no-color|color=(false|never))$/)?0:t.window?.chrome||d&&!s?3:s})(),h={open:``,close:``},g={},_=({p:e},{open:t,close:n})=>{let r=(e,...i)=>{if(!e){if(t&&t===n)return t;if((e??``)===``)return``}let a,o=e.raw?String.raw({raw:e},...i):``+e,s=r.p,c=s.o,l=s.c;if(o.includes(`\x1B`))for(;s;s=s.p){let{open:e,close:t}=s,n=t.length,r=``,i=0;if(n)for(;~(a=o.indexOf(t,i));i=a+n)r+=o.slice(i,a)+e;o=r+o.slice(i)}return c+(o.includes(`
64
+ `)?o.replace(/(\r?\n)/g,l+`$1`+c):o)+l},a=t,s=n;return e&&(a=e.o+t,s=n+e.c),o(r,i),r.p={open:t,close:n,o:a,c:s,p:e},r.open=a,r.close=s,r},v=new function e(t=m){let n={Ansis:e,level:t,isSupported:()=>c,strip:e=>e.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,``),extend(e){for(let t in e){let n=e[t],i=(typeof n)[0];i===`s`?(r(t,b(...d(n))),r(ie(t),x(...d(n)))):r(t,n,i===`f`)}return i=s({},g),o(n,i),n}},r=(e,t,n)=>{g[e]={get(){let r=n?(...e)=>_(this,t(...e)):_(this,t);return a(this,e,{value:r}),r}}},c=t>0,l=(e,t)=>c?{open:`[${e}m`,close:`[${t}m`}:h,u=e=>t=>e(...d(t)),v=(e,t)=>(n,r,i)=>l(`${e}8;2;${n};${r};${i}`,t),ee=(e,t)=>(n,r,i)=>l(((e,t,n)=>p(f(e,t,n)))(n,r,i)+e,t),y=e=>(t,n,r)=>e(f(t,n,r)),b=v(3,39),x=v(4,49),te=e=>l(`38;5;`+e,39),S=e=>l(`48;5;`+e,49);t===2?(b=y(te),x=y(S)):t===1&&(b=ee(0,39),x=ee(10,49),te=e=>l(p(e),39),S=e=>l(p(e)+10,49));let ne,re={fg:te,bg:S,rgb:b,bgRgb:x,hex:u(b),bgHex:u(x),visible:h,reset:l(0,0),bold:l(1,22),dim:l(2,22),italic:l(3,23),underline:l(4,24),inverse:l(7,27),hidden:l(8,28),strikethrough:l(9,29)},ie=e=>`bg`+e[0].toUpperCase()+e.slice(1),C=`Bright`;return`black,red,green,yellow,blue,magenta,cyan,white,gray`.split(`,`).map(((e,t)=>{ne=ie(e),8>t?(re[e+C]=l(90+t,39),re[ne+C]=l(100+t,49)):t=60,re[e]=l(30+t,39),re[ne]=l(40+t,49)})),n.extend(re)};t.exports=v,v.default=v}))(),1).default,Ka=n(import.meta.url)(`picomatch`);var qa=n(import.meta.url);function Ja(e,t){return Array.isArray(e)?e:e==null?t?[t]:[]:[e]}function Ya(e){return e.flatMap(e=>e.split(`,`))}function Xa(e){return typeof e==`string`&&e.length>2&&e[0]===`/`&&e.at(-1)===`/`?new RegExp(e.slice(1,-1)):e}function Za(e){return e.replaceAll(`\\`,`/`)}const Qa=e=>e;function $a(e,t){return t.some(t=>t instanceof RegExp?(t.lastIndex=0,t.test(e)):e===t||Ka(t)(e))}function eo(e){try{return import.meta.resolve(e),!0}catch{}return!1}async function to(e,t){let n;t&&(n=M(qa.resolve(e,{paths:t})).href);try{return await import(n||e)}catch(t){throw Error(`Failed to import module "${e}". Please ensure it is installed.`,{cause:t})}}function no(){let e;return{promise:new Promise(t=>{e=t}),resolve:e}}const ro={silent:0,error:1,warn:2,info:3};function io(e){return e.filter(e=>e!==void 0&&e!==!1).join(` `)}function ao(){let e=v.stdout.rows-2,t=e>0?`
65
+ `.repeat(e):``;console.info(t),O.cursorTo(v.stdout,0,0),O.clearScreenDown(v.stdout)}const oo=new Set;function so(e=`info`,{customLogger:t,console:n=globalThis.console,failOnWarn:r=!1,allowClearScreen:i=!0}={}){if(t)return t;function a(e,t){ro[s.level]<ro[e]||n[e===`info`?`log`:e](t)}let o=i&&v.stdout.isTTY&&!v.env.CI?ao:()=>{},s={level:e,info(...e){a(`info`,`${va`ℹ`} ${io(e)}`)},warn(...e){if(r)return this.error(...e);let t=io(e);oo.add(t),a(`warn`,`\n${Na` WARN `} ${t}\n`)},warnOnce(...e){let t=io(e);if(!oo.has(t)){if(r)return this.error(...e);oo.add(t),a(`warn`,`\n${Na` WARN `} ${t}\n`)}},error(...e){a(`error`,`\n${ja` ERROR `} ${io(e)}\n`),v.exitCode=1},success(...e){a(`info`,`${ga`✔`} ${io(e)}`)},clearScreen(e){ro[s.level]>=ro[e]&&o()}};return s}const co=so();function lo(e,t){if(t)return e(`[${t}]`)}function uo(e){let t=e===`es`?va:e===`cjs`?_a:Qa,n;switch(e){case`es`:n=`ESM`;break;default:n=e.toUpperCase();break}return t(`[${n}]`)}const fo=new Map;function po(e=`default`){if(fo.has(e))return fo.get(e);let t;if(e===`default`)t=va;else{let n=0;for(let t=0;t<e.length;t++)n=e.charCodeAt(t)+((n<<5)-n);t=ta(...mo(n%360,35,55))}return fo.set(e,t),t}function mo(e,t,n){e%=360,e/=360,t/=100,n/=100;let r,i,a;if(t===0)r=i=a=n;else{let o=n<.5?n*(1+t):n+t-n*t,s=2*n-o;r=ho(s,o,e+1/3),i=ho(s,o,e),a=ho(s,o,e-1/3)}return[Math.max(0,Math.round(r*255)),Math.max(0,Math.round(i*255)),Math.max(0,Math.round(a*255))]}function ho(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function go(e){return ae(e).then(()=>!0,()=>!1)}function _o(e){return E(e).catch(()=>null)}function vo(e){return ce(e,{force:!0,recursive:!0}).catch(()=>{})}function yo(e,t){return oe(e,t,{recursive:!0,force:!0})}function bo(...e){if(e.length===0)return``;if(e.length===1)return i.dirname(e[0]);e=e.map(i.normalize);let[t,...n]=e,r=t.split(i.sep);for(let e of n){let t=e.split(i.sep,r.length),n=0;for(let e of t)if(e===r[n])n+=1;else{r=r.slice(0,n);break}r=r.slice(0,n)}return r.length<=1&&r[0]===``?i.sep+r[0]:r.join(i.sep)}function xo(e){let t=i.extname(e);return t.length?e.slice(0,-t.length):e}function So(e){if(e!==1/0)return`${(e/1e3).toFixed(2)} kB`}function Co(e){let t=e.split(/\r?\n/);for(let e of t){let t=e.match(/^(\s+)\S/);if(t)return t[1].includes(` `)?` `:t[1].length}return 2}function wo(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function To(e,t,n=`.`,r){if(!wo(t))return To(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:wo(a)&&wo(i[t])?i[t]=To(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Eo(e){return(...t)=>t.reduce((t,n)=>To(t,n,``,e),{})}function Do(e){return e instanceof Error?e.stack||e.message:e}function Oo(e,t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e[Math.abs(n)%e.length]}function ko(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function Ao(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}let jo=``;function Mo(e,t){let n,r,i,a,o=(...e)=>{if(!o.enabled)return;let r=Date.now(),i=r-(n||r);n=r,e[0]=Do(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-z%])/gi,(n,r)=>{if(n===`%%`)return`%`;a++;let i=t.formatters[r];if(typeof i==`function`){let t=e[a];n=i.call(o,t),e.splice(a,1),a--}return n}),t.formatArgs.call(o,i,e),o.log(...e)};return o.extend=function(e,t=`:`){return Mo(this.namespace+t+e,{useColors:this.useColors,color:this.color,formatArgs:this.formatArgs,formatters:this.formatters,inspectOpts:this.inspectOpts,log:this.log,humanize:this.humanize})},Object.assign(o,t),o.namespace=e,Object.defineProperty(o,`enabled`,{enumerable:!0,configurable:!1,get:()=>r??(i!==jo&&(i=jo,a=Io(e)),a),set:e=>{r=e}}),o}let No=[],Po=[];function Fo(e){jo=e,No=[],Po=[];let t=jo.trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?Po.push(e.slice(1)):No.push(e)}function Io(e){for(let t of Po)if(ko(e,t))return!1;for(let t of No)if(ko(e,t))return!0;return!1}const Lo=process.stderr.getColorDepth&&process.stderr.getColorDepth()>2?[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]:[6,2,3,4,5,1],Ro=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.slice(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t],i=typeof r==`string`&&r.toLowerCase();return r=r===`null`?null:i===`yes`||i===`on`||i===`true`||i===`enabled`?!0:i===`no`||i===`off`||i===`false`||i===`disabled`?!1:Number(r),e[n]=r,e},{});function zo(){return`colors`in Ro?!!Ro.colors:x(process.stderr.fd)}function Bo(){return Ro.hideDate?``:`${new Date().toISOString()} `}function Vo(e,t){let{namespace:n,useColors:r}=this;if(r){let r=this.color,i=`\u001B[3${r<8?r:`8;5;${r}`}`,a=` ${i};1m${n} \u001B[0m`;t[0]=a+t[0].split(`
66
+ `).join(`\n${a}`),t.push(`${i}m+${this.humanize(e)}\u001B[0m`)}else t[0]=`${Bo()}${n} ${t[0]}`}function Ho(...e){process.stderr.write(`${p(this.inspectOpts,...e)}\n`)}const Uo={useColors:zo(),formatArgs:Vo,formatters:{o(e){return this.inspectOpts.colors=this.useColors,m(e,this.inspectOpts).split(`
67
+ `).map(e=>e.trim()).join(` `)},O(e){return this.inspectOpts.colors=this.useColors,m(e,this.inspectOpts)}},inspectOpts:Ro,log:Ho,humanize:Ao};function Wo(e,t){let n=(t&&t.color)??Oo(Lo,e);return Mo(e,Object.assign(Uo,{color:n},t))}Fo(process.env.DEBUG||``);var Go=Se(import.meta.url);function Ko(e){let t=P(e);return t.length>1&&t[t.length-1]===be&&(t=t.substring(0,t.length-1)),t}const qo=/[\\/]/g;function Jo(e,t){return e.replace(qo,t)}const Yo=/^[a-z]:[\\/]$/i;function Xo(e){return e===`/`||Yo.test(e)}function Zo(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=ye(e)),(r||a)&&(e=Ko(e)),e===`.`?``:Jo(e[e.length-1]===i?e:e+i,i)}function Qo(e,t){return t+e}function $o(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:Jo(ve(e,r),t.pathSeparator)+t.pathSeparator+n}}function es(e){return e}function ts(e,t,n){return t+e+n}function ns(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?$o(e,t):r?Qo:es}function rs(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function is(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}const as=(e,t)=>{t.push(e||`.`)},os=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},ss=()=>{};function cs(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?is(e):rs(e):r&&r.length?os:as:ss}const ls=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},us=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},ds=(e,t,n,r)=>{n.files++},fs=(e,t)=>{t.push(e)},ps=()=>{};function ms(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?ps:n&&n.length?r?ls:us:r?ds:fs}const hs=e=>e,gs=()=>[``].slice(0,0);function _s(e){return e.group?gs:hs}const vs=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},ys=()=>{};function bs(e){return e.group?vs:ys}const xs=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue(),i.realpath(e,(o,s)=>{if(o)return r.dequeue(a?null:o,t);i.stat(s,(i,o)=>{if(i)return r.dequeue(a?null:i,t);if(o.isDirectory()&&ws(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},Ss=function(e,t,n){let{queue:r,fs:i,options:{suppressErrors:a}}=t;r.enqueue();try{let r=i.realpathSync(e),a=i.statSync(r);if(a.isDirectory()&&ws(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function Cs(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?Ss:xs}function ws(e,t,n){if(n.options.useRealPaths)return Ts(t,n);let r=N(e),i=1;for(;r!==n.root&&i<2;){let e=n.symlinks.get(r);e&&(e===t||e.startsWith(t)||t.startsWith(e))?i++:r=N(r)}return n.symlinks.set(e,t),i>1}function Ts(e,t){return t.visited.includes(e+t.options.pathSeparator)}const Es=e=>e.counts,Ds=e=>e.groups,Os=e=>e.paths,ks=e=>e.paths.slice(0,e.options.maxFiles),As=(e,t,n)=>(Ps(t,n,e.counts,e.options.suppressErrors),null),js=(e,t,n)=>(Ps(t,n,e.paths,e.options.suppressErrors),null),Ms=(e,t,n)=>(Ps(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),Ns=(e,t,n)=>(Ps(t,n,e.groups,e.options.suppressErrors),null);function Ps(e,t,n,r){t(e&&!r?e:null,n)}function Fs(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?Es:As:r?t?Ds:Ns:i?t?ks:Ms:t?Os:js}const Is={withFileTypes:!0},Ls=(e,t,n,r,i)=>{if(e.queue.enqueue(),r<0)return e.queue.dequeue(null,e);let{fs:a}=e;e.visited.push(t),e.counts.directories++,a.readdir(t||`.`,Is,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},Rs=(e,t,n,r,i)=>{let{fs:a}=e;if(r<0)return;e.visited.push(t),e.counts.directories++;let o=[];try{o=a.readdirSync(t||`.`,Is)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function zs(e){return e?Rs:Ls}var Bs=class{count=0;constructor(e){this.onQueueEmpty=e}enqueue(){return this.count++,this.count}dequeue(e,t){this.onQueueEmpty&&(--this.count<=0||e)&&(this.onQueueEmpty(e,t),e&&(t.controller.abort(),this.onQueueEmpty=void 0))}},Vs=class{_files=0;_directories=0;set files(e){this._files=e}get files(){return this._files}set directories(e){this._directories=e}get directories(){return this._directories}get dirs(){return this._directories}},Hs=class{aborted=!1;abort(){this.aborted=!0}},Us=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=Fs(t,this.isSynchronous),this.root=Zo(e,t),this.state={root:Xo(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new Vs,options:t,queue:new Bs((e,t)=>this.callbackInvoker(t,e,n)),symlinks:new Map,visited:[``].slice(0,0),controller:new Hs,fs:t.fs||k},this.joinPath=ns(this.root,t),this.pushDirectory=cs(this.root,t),this.pushFile=ms(t),this.getArray=_s(t),this.groupFiles=bs(t),this.resolveSymlink=Cs(t,this.isSynchronous),this.walkDirectory=zs(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,t,n)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:o,exclude:s,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&r.length>c)return;let p=this.getArray(this.state.paths);for(let c=0;c<e.length;++c){let l=e[c];if(l.isFile()||l.isSymbolicLink()&&!a&&!o){let e=this.joinPath(l.name,t);this.pushFile(e,p,this.state.counts,i)}else if(l.isDirectory()){let e=ts(l.name,t,this.state.options.pathSeparator);if(s&&s(l.name,e))continue;this.pushDirectory(e,r,i),this.walkDirectory(this.state,e,e,n-1,this.walk)}else if(this.resolveSymlink&&l.isSymbolicLink()){let e=Qo(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=Zo(r,this.state.options),s&&s(l.name,u?r:e+d))return;this.walkDirectory(this.state,r,u?r:e+d,n-1,this.walk)}else{r=u?r:e;let t=ge(r),n=Zo(N(r),this.state.options);r=this.joinPath(t,n),this.pushFile(r,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,p)}};function Ws(e,t){return new Promise((n,r)=>{Gs(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function Gs(e,t,n){new Us(e,t,n).start()}function Ks(e,t){return new Us(e,t).start()}var qs=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return Ws(this.root,this.options)}withCallback(e){Gs(this.root,this.options,e)}sync(){return Ks(this.root,this.options)}};let Js=null;try{Go.resolve(`picomatch`),Js=Go(`picomatch`)}catch{}var Ys=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:be,filters:[]};globFunction;constructor(e){this.options={...this.options,...e},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(e){return this.options.pathSeparator=e,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(e){return this.options.maxDepth=e,this}withMaxFiles(e){return this.options.maxFiles=e,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:e=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=e,this.withFullPaths()}withAbortSignal(e){return this.options.signal=e,this}normalize(){return this.options.normalizePath=!0,this}filter(e){return this.options.filters.push(e),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(e){return this.options.exclude=e,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(e){return new qs(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}crawlWithOptions(e,t){return this.options={...this.options,...t},new qs(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||Js;if(!n)throw Error(`Please specify a glob function to use glob matching.`);var r=this.globCache[e.join(`\0`)];return r||(r=n(e,...t),this.globCache[e.join(`\0`)]=r),this.options.filters.push(e=>r(e)),this}},Xs=Fe(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),Zs=Fe((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Xs();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),Qs=Fe(((e,t)=>{let n=Zs(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=Xs(),v=e=>e===l||e===a,ee=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let y=t||{},b=e.length-1,x=y.parts===!0||y.scanToEnd===!0,te=[],S=[],ne=[],re=e,ie=-1,C=0,ae=0,w=!1,oe=!1,T=!1,se=!1,ce=!1,E=!1,D=!1,le=!1,ue=!1,de=!1,O=0,k,A,j={value:``,depth:0,isGlob:!1},fe=()=>ie>=b,pe=()=>re.charCodeAt(ie+1),me=()=>(k=A,re.charCodeAt(++ie));for(;ie<b;){A=me();let e;if(A===a){D=j.backslashes=!0,A=me(),A===u&&(E=!0);continue}if(E===!0||A===u){for(O++;fe()!==!0&&(A=me());){if(A===a){D=j.backslashes=!0,me();continue}if(A===u){O++;continue}if(E!==!0&&A===s&&(A=me())===s){if(w=j.isBrace=!0,T=j.isGlob=!0,de=!0,x===!0)continue;break}if(E!==!0&&A===o){if(w=j.isBrace=!0,T=j.isGlob=!0,de=!0,x===!0)continue;break}if(A===h&&(O--,O===0)){E=!1,w=j.isBrace=!0,de=!0;break}}if(x===!0)continue;break}if(A===l){if(te.push(ie),S.push(j),j={value:``,depth:0,isGlob:!1},de===!0)continue;if(k===s&&ie===C+1){C+=2;continue}ae=ie+1;continue}if(y.noext!==!0&&(A===p||A===i||A===r||A===m||A===c)&&pe()===d){if(T=j.isGlob=!0,se=j.isExtglob=!0,de=!0,A===c&&ie===C&&(ue=!0),x===!0){for(;fe()!==!0&&(A=me());){if(A===a){D=j.backslashes=!0,A=me();continue}if(A===g){T=j.isGlob=!0,de=!0;break}}continue}break}if(A===r){if(k===r&&(ce=j.isGlobstar=!0),T=j.isGlob=!0,de=!0,x===!0)continue;break}if(A===m){if(T=j.isGlob=!0,de=!0,x===!0)continue;break}if(A===f){for(;fe()!==!0&&(e=me());){if(e===a){D=j.backslashes=!0,me();continue}if(e===_){oe=j.isBracket=!0,T=j.isGlob=!0,de=!0;break}}if(x===!0)continue;break}if(y.nonegate!==!0&&A===c&&ie===C){le=j.negated=!0,C++;continue}if(y.noparen!==!0&&A===d){if(T=j.isGlob=!0,x===!0){for(;fe()!==!0&&(A=me());){if(A===d){D=j.backslashes=!0,A=me();continue}if(A===g){de=!0;break}}continue}break}if(T===!0){if(de=!0,x===!0)continue;break}}y.noext===!0&&(se=!1,T=!1);let M=re,he=``,ge=``;C>0&&(he=re.slice(0,C),re=re.slice(C),ae-=C),M&&T===!0&&ae>0?(M=re.slice(0,ae),ge=re.slice(ae)):T===!0?(M=``,ge=re):M=re,M&&M!==``&&M!==`/`&&M!==re&&v(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),y.unescape===!0&&(ge&&=n.removeBackslashes(ge),M&&D===!0&&(M=n.removeBackslashes(M)));let N={prefix:he,input:e,start:C,base:M,glob:ge,isBrace:w,isBracket:oe,isGlob:T,isExtglob:se,isGlobstar:ce,negated:le,negatedExtglob:ue};if(y.tokens===!0&&(N.maxDepth=0,v(A)||S.push(j),N.tokens=S),y.parts===!0||y.tokens===!0){let t;for(let n=0;n<te.length;n++){let r=t?t+1:C,i=te[n],a=e.slice(r,i);y.tokens&&(n===0&&C!==0?(S[n].isPrefix=!0,S[n].value=he):S[n].value=a,ee(S[n]),N.maxDepth+=S[n].depth),(n!==0||a!==``)&&ne.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);ne.push(n),y.tokens&&(S[S.length-1].value=n,ee(S[S.length-1]),N.maxDepth+=S[S.length-1].depth)}N.slashes=te,N.parts=ne}return N}})),$s=Fe(((e,t)=>{let n=Xs(),r=Zs(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let f={...t},p=typeof f.maxLength==`number`?Math.min(i,f.maxLength):i,m=e.length;if(m>p)throw SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${p}`);let h={type:`bos`,value:``,output:f.prepend||``},g=[h],_=f.capture?``:`?:`,v=n.globChars(f.windows),ee=n.extglobChars(v),{DOT_LITERAL:y,PLUS_LITERAL:b,SLASH_LITERAL:x,ONE_CHAR:te,DOTS_SLASH:S,NO_DOT:ne,NO_DOT_SLASH:re,NO_DOTS_SLASH:ie,QMARK:C,QMARK_NO_DOT:ae,STAR:w,START_ANCHOR:oe}=v,T=e=>`(${_}(?:(?!${oe}${e.dot?S:y}).)*?)`,se=f.dot?``:ne,ce=f.dot?C:ae,E=f.bash===!0?T(f):w;f.capture&&(E=`(${E})`),typeof f.noext==`boolean`&&(f.noextglob=f.noext);let D={input:e,index:-1,start:0,dot:f.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=r.removePrefix(e,D),m=e.length;let le=[],ue=[],de=[],O=h,k,A=()=>D.index===m-1,j=D.peek=(t=1)=>e[D.index+t],fe=D.advance=()=>e[++D.index]||``,pe=()=>e.slice(D.index+1),me=(e=``,t=0)=>{D.consumed+=e,D.index+=t},M=e=>{D.output+=e.output==null?e.value:e.output,me(e.value)},he=()=>{let e=1;for(;j()===`!`&&(j(2)!==`(`||j(3)===`?`);)fe(),D.start++,e++;return e%2==0?!1:(D.negated=!0,D.start++,!0)},ge=e=>{D[e]++,de.push(e)},N=e=>{D[e]--,de.pop()},P=e=>{if(O.type===`globstar`){let t=D.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||le.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(D.output=D.output.slice(0,-O.output.length),O.type=`star`,O.value=`*`,O.output=E,D.output+=O.output)}if(le.length&&e.type!==`paren`&&(le[le.length-1].inner+=e.value),(e.value||e.output)&&M(e),O&&O.type===`text`&&e.type===`text`){O.output=(O.output||O.value)+e.value,O.value+=e.value;return}e.prev=O,g.push(e),O=e},_e=(e,t)=>{let n={...ee[t],conditions:1,inner:``};n.prev=O,n.parens=D.parens,n.output=D.output;let r=(f.capture?`(`:``)+n.open;ge(`parens`),P({type:e,value:t,output:D.output?``:te}),P({type:`paren`,extglob:!0,value:fe(),output:r}),le.push(n)},ve=e=>{let n=e.close+(f.capture?`)`:``),r;if(e.type===`negate`){let i=E;e.inner&&e.inner.length>1&&e.inner.includes(`/`)&&(i=T(f)),(i!==E||A()||/^\)+$/.test(pe()))&&(n=e.close=`)$))${i}`),e.inner.includes(`*`)&&(r=pe())&&/^\.[^\\/.]+$/.test(r)&&(n=e.close=`)${d(r,{...t,fastpaths:!1}).output})${i})`),e.prev.type===`bos`&&(D.negatedExtglob=!0)}P({type:`paren`,extglob:!0,value:k,output:n}),N(`parens`)};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?C.repeat(a.length):``):o===0?ce+(a?C.repeat(a.length):``):C.repeat(r.length):i===`.`?y.repeat(r.length):i===`*`?t?t+i+(a?E:``):E:t?e:`\\${e}`);return n===!0&&(i=f.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&f.contains===!0?(D.output=e,D):(D.output=r.wrapOutput(i,D,t),D)}for(;!A();){if(k=fe(),k===`\0`)continue;if(k===`\\`){let e=j();if(e===`/`&&f.bash!==!0||e===`.`||e===`;`)continue;if(!e){k+=`\\`,P({type:`text`,value:k});continue}let t=/^\\+/.exec(pe()),n=0;if(t&&t[0].length>2&&(n=t[0].length,D.index+=n,n%2!=0&&(k+=`\\`)),f.unescape===!0?k=fe():k+=fe(),D.brackets===0){P({type:`text`,value:k});continue}}if(D.brackets>0&&(k!==`]`||O.value===`[`||O.value===`[^`)){if(f.posix!==!1&&k===`:`){let e=O.value.slice(1);if(e.includes(`[`)&&(O.posix=!0,e.includes(`:`))){let e=O.value.lastIndexOf(`[`),t=O.value.slice(0,e),n=a[O.value.slice(e+2)];if(n){O.value=t+n,D.backtrack=!0,fe(),!h.output&&g.indexOf(O)===1&&(h.output=te);continue}}}(k===`[`&&j()!==`:`||k===`-`&&j()===`]`)&&(k=`\\${k}`),k===`]`&&(O.value===`[`||O.value===`[^`)&&(k=`\\${k}`),f.posix===!0&&k===`!`&&O.value===`[`&&(k=`^`),O.value+=k,M({value:k});continue}if(D.quotes===1&&k!==`"`){k=r.escapeRegex(k),O.value+=k,M({value:k});continue}if(k===`"`){D.quotes=D.quotes===1?0:1,f.keepQuotes===!0&&P({type:`text`,value:k});continue}if(k===`(`){ge(`parens`),P({type:`paren`,value:k});continue}if(k===`)`){if(D.parens===0&&f.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=le[le.length-1];if(e&&D.parens===e.parens+1){ve(le.pop());continue}P({type:`paren`,value:k,output:D.parens?`)`:`\\)`}),N(`parens`);continue}if(k===`[`){if(f.nobracket===!0||!pe().includes(`]`)){if(f.nobracket!==!0&&f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));k=`\\${k}`}else ge(`brackets`);P({type:`bracket`,value:k});continue}if(k===`]`){if(f.nobracket===!0||O&&O.type===`bracket`&&O.value.length===1){P({type:`text`,value:k,output:`\\${k}`});continue}if(D.brackets===0){if(f.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));P({type:`text`,value:k,output:`\\${k}`});continue}N(`brackets`);let e=O.value.slice(1);if(O.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(k=`/${k}`),O.value+=k,M({value:k}),f.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(O.value);if(D.output=D.output.slice(0,-O.value.length),f.literalBrackets===!0){D.output+=t,O.value=t;continue}O.value=`(${_}${t}|${O.value})`,D.output+=O.value;continue}if(k===`{`&&f.nobrace!==!0){ge(`braces`);let e={type:`brace`,value:k,output:`(`,outputIndex:D.output.length,tokensIndex:D.tokens.length};ue.push(e),P(e);continue}if(k===`}`){let e=ue[ue.length-1];if(f.nobrace===!0||!e){P({type:`text`,value:k,output:k});continue}let t=`)`;if(e.dots===!0){let e=g.slice(),n=[];for(let t=e.length-1;t>=0&&(g.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,f),D.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=D.output.slice(0,e.outputIndex),r=D.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,k=t=`\\}`,D.output=n;for(let e of r)D.output+=e.output||e.value}P({type:`brace`,value:k,output:t}),N(`braces`),ue.pop();continue}if(k===`|`){le.length>0&&le[le.length-1].conditions++,P({type:`text`,value:k});continue}if(k===`,`){let e=k,t=ue[ue.length-1];t&&de[de.length-1]===`braces`&&(t.comma=!0,e=`|`),P({type:`comma`,value:k,output:e});continue}if(k===`/`){if(O.type===`dot`&&D.index===D.start+1){D.start=D.index+1,D.consumed=``,D.output=``,g.pop(),O=h;continue}P({type:`slash`,value:k,output:x});continue}if(k===`.`){if(D.braces>0&&O.type===`dot`){O.value===`.`&&(O.output=y);let e=ue[ue.length-1];O.type=`dots`,O.output+=k,O.value+=k,e.dots=!0;continue}if(D.braces+D.parens===0&&O.type!==`bos`&&O.type!==`slash`){P({type:`text`,value:k,output:y});continue}P({type:`dot`,value:k,output:y});continue}if(k===`?`){if(!(O&&O.value===`(`)&&f.noextglob!==!0&&j()===`(`&&j(2)!==`?`){_e(`qmark`,k);continue}if(O&&O.type===`paren`){let e=j(),t=k;(O.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(pe()))&&(t=`\\${k}`),P({type:`text`,value:k,output:t});continue}if(f.dot!==!0&&(O.type===`slash`||O.type===`bos`)){P({type:`qmark`,value:k,output:ae});continue}P({type:`qmark`,value:k,output:C});continue}if(k===`!`){if(f.noextglob!==!0&&j()===`(`&&(j(2)!==`?`||!/[!=<:]/.test(j(3)))){_e(`negate`,k);continue}if(f.nonegate!==!0&&D.index===0){he();continue}}if(k===`+`){if(f.noextglob!==!0&&j()===`(`&&j(2)!==`?`){_e(`plus`,k);continue}if(O&&O.value===`(`||f.regex===!1){P({type:`plus`,value:k,output:b});continue}if(O&&(O.type===`bracket`||O.type===`paren`||O.type===`brace`)||D.parens>0){P({type:`plus`,value:k});continue}P({type:`plus`,value:b});continue}if(k===`@`){if(f.noextglob!==!0&&j()===`(`&&j(2)!==`?`){P({type:`at`,extglob:!0,value:k,output:``});continue}P({type:`text`,value:k});continue}if(k!==`*`){(k===`$`||k===`^`)&&(k=`\\${k}`);let e=o.exec(pe());e&&(k+=e[0],D.index+=e[0].length),P({type:`text`,value:k});continue}if(O&&(O.type===`globstar`||O.star===!0)){O.type=`star`,O.star=!0,O.value+=k,O.output=E,D.backtrack=!0,D.globstar=!0,me(k);continue}let t=pe();if(f.noextglob!==!0&&/^\([^?]/.test(t)){_e(`star`,k);continue}if(O.type===`star`){if(f.noglobstar===!0){me(k);continue}let n=O.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(f.bash===!0&&(!i||t[0]&&t[0]!==`/`)){P({type:`star`,value:k,output:``});continue}let o=D.braces>0&&(n.type===`comma`||n.type===`brace`),s=le.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){P({type:`star`,value:k,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[D.index+4];if(n&&n!==`/`)break;t=t.slice(3),me(`/**`,3)}if(n.type===`bos`&&A()){O.type=`globstar`,O.value+=k,O.output=T(f),D.output=O.output,D.globstar=!0,me(k);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&A()){D.output=D.output.slice(0,-(n.output+O.output).length),n.output=`(?:${n.output}`,O.type=`globstar`,O.output=T(f)+(f.strictSlashes?`)`:`|$)`),O.value+=k,D.globstar=!0,D.output+=n.output+O.output,me(k);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;D.output=D.output.slice(0,-(n.output+O.output).length),n.output=`(?:${n.output}`,O.type=`globstar`,O.output=`${T(f)}${x}|${x}${e})`,O.value+=k,D.output+=n.output+O.output,D.globstar=!0,me(k+fe()),P({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){O.type=`globstar`,O.value+=k,O.output=`(?:^|${x}|${T(f)}${x})`,D.output=O.output,D.globstar=!0,me(k+fe()),P({type:`slash`,value:`/`,output:``});continue}D.output=D.output.slice(0,-O.output.length),O.type=`globstar`,O.output=T(f),O.value+=k,D.output+=O.output,D.globstar=!0,me(k);continue}let n={type:`star`,value:k,output:E};if(f.bash===!0){n.output=`.*?`,(O.type===`bos`||O.type===`slash`)&&(n.output=se+n.output),P(n);continue}if(O&&(O.type===`bracket`||O.type===`paren`)&&f.regex===!0){n.output=k,P(n);continue}(D.index===D.start||O.type===`slash`||O.type===`dot`)&&(O.type===`dot`?(D.output+=re,O.output+=re):f.dot===!0?(D.output+=ie,O.output+=ie):(D.output+=se,O.output+=se),j()!==`*`&&(D.output+=te,O.output+=te)),P(n)}for(;D.brackets>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));D.output=r.escapeLast(D.output,`[`),N(`brackets`)}for(;D.parens>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));D.output=r.escapeLast(D.output,`(`),N(`parens`)}for(;D.braces>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));D.output=r.escapeLast(D.output,`{`),N(`braces`)}if(f.strictSlashes!==!0&&(O.type===`star`||O.type===`bracket`)&&P({type:`maybe_slash`,value:``,output:`${x}?`}),D.backtrack===!0){D.output=``;for(let e of D.tokens)D.output+=e.output==null?e.value:e.output,e.suffix&&(D.output+=e.suffix)}return D};d.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,ee=a.dot?h:p,y=a.capture?``:`?:`,b={negated:!1,prefix:``},x=a.bash===!0?`.*?`:g;a.capture&&(x=`(${x})`);let te=e=>e.noglobstar===!0?x:`(${y}(?:(?!${_}${e.dot?f:l}).)*?)`,S=e=>{switch(e){case`*`:return`${v}${d}${x}`;case`.*`:return`${l}${d}${x}`;case`*.*`:return`${v}${x}${l}${d}${x}`;case`*/*`:return`${v}${x}${u}${d}${ee}${x}`;case`**`:return v+te(a);case`**/*`:return`(?:${v}${te(a)}${u})?${ee}${d}${x}`;case`**/*.*`:return`(?:${v}${te(a)}${u})?${ee}${x}${l}${d}${x}`;case`**/.*`:return`(?:${v}${te(a)}${u})?${l}${d}${x}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=S(t[1]);return n?n+l+t[2]:void 0}}},ne=S(r.removePrefix(e,b));return ne&&a.strictSlashes!==!0&&(ne+=`${u}?`),ne},t.exports=d})),ec=Fe(((e,t)=>{let n=Qs(),r=$s(),i=Zs(),a=Xs(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),r?p:!0)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),tc=Re(Fe(((e,t)=>{let n=ec(),r=Zs();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i}))(),1);const nc=Array.isArray,rc=process.platform===`win32`,ic=/^(\/?\.\.)+$/;function ac(e,t={}){let n=e.length,r=Array(n),i=Array(n),a=!t.noglobstar;for(let a=0;a<n;a++){let n=dc(e[a]);r[a]=n;let o=n.length,s=Array(o);for(let e=0;e<o;e++)s[e]=(0,tc.default)(n[e],t);i[a]=s}return t=>{let n=t.split(`/`);if(n[0]===`..`&&ic.test(t))return!0;for(let t=0;t<e.length;t++){let e=r[t],o=i[t],s=n.length,c=Math.min(s,e.length),l=0;for(;l<c;){let t=e[l];if(t.includes(`/`))return!0;if(!o[l](n[l]))break;if(a&&t===`**`)return!0;l++}if(l===s)return!0}return!1}}const oc=/^[A-Z]:\/$/i,sc=rc?e=>oc.test(e):e=>e===`/`;function cc(e,t,n){if(e===t||t.startsWith(`${e}/`)){if(n){let t=sc(e)?e.length:e.length+1;return(e,n)=>e.slice(t,n?-1:void 0)||`.`}let r=t.slice(e.length+1);return r?(e,t)=>{if(e===`.`)return r;let n=`${r}/${e}`;return t?n.slice(0,-1):n}:(e,t)=>t&&e!==`.`?e.slice(0,-1):e}return n?t=>_e.relative(e,t)||`.`:n=>_e.relative(e,`${t}/${n}`)||`.`}function lc(e,t){if(t.startsWith(`${e}/`)){let n=t.slice(e.length+1);return e=>`${n}/${e}`}return n=>{let r=_e.relative(e,`${t}/${n}`);return n.endsWith(`/`)&&r!==``?`${r}/`:r||`.`}}const uc={parts:!0};function dc(e){let t=tc.default.scan(e,uc);return t.parts?.length?t.parts:[e]}const fc=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,pc=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,mc=rc?e=>e.replace(pc,`\\$&`):e=>e.replace(fc,`\\$&`);function hc(e,t){if(t?.caseSensitiveMatch===!1)return!0;let n=tc.default.scan(e);return n.isGlob||n.negated}function gc(...e){console.log(`[tinyglobby ${new Date().toLocaleTimeString(`es`)}]`,...e)}const _c=/^(\/?\.\.)+/,vc=/\\(?=[()[\]{}!*+?@|])/g,yc=/\\/g;function bc(e,t,n,r,i){let a=e;e.endsWith(`/`)&&(a=e.slice(0,-1)),!a.endsWith(`*`)&&t&&(a+=`/**`);let o=mc(n);a=he.isAbsolute(a.replace(vc,``))?_e.relative(o,a):_e.normalize(a);let s=_c.exec(a),c=dc(a);if(s?.[0]){let e=(s[0].length+1)/3,t=0,i=o.split(`/`);for(;t<e&&c[t+e]===i[i.length+t-e];)a=a.slice(0,(e-t-1)*3)+a.slice((e-t)*3+c[t+e].length+1)||`.`,t++;let l=_e.join(n,s[0].slice(t*3));!l.startsWith(`.`)&&r.root.length>l.length&&(r.root=l,r.depthOffset=-e+t)}if(!i&&r.depthOffset>=0){r.commonPath??=c;let e=[],t=Math.min(r.commonPath.length,c.length);for(let n=0;n<t;n++){let t=c[n];if(t===`**`&&!c[n+1]){e.pop();break}if(t!==r.commonPath[n]||hc(t)||n===c.length-1)break;e.push(t)}r.depthOffset=e.length,r.commonPath=e,r.root=e.length>0?_e.join(n,...e):n}return a}function xc({patterns:e=[`**/*`],ignore:t=[],expandDirectories:n=!0},r,i){typeof e==`string`&&(e=[e]),typeof t==`string`&&(t=[t]);let a=[],o=[];for(let e of t)e&&(e[0]!==`!`||e[1]===`(`)&&o.push(bc(e,n,r,i,!0));for(let t of e)t&&(t[0]!==`!`||t[1]===`(`?a.push(bc(t,n,r,i,!1)):(t[1]!==`!`||t[2]===`(`)&&o.push(bc(t.slice(1),n,r,i,!0)));return{match:a,ignore:o}}function Sc(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];e[n]=t(r)}return e}function Cc(e){return e?e instanceof URL?xe(e).replace(yc,`/`):he.resolve(e).replace(yc,`/`):process.cwd().replace(yc,`/`)}function wc(e,t={}){let n=process.env.TINYGLOBBY_DEBUG?{...t,debug:!0}:t,r=Cc(n.cwd);if(n.debug&&gc(`globbing with:`,{patterns:e,options:n,cwd:r}),Array.isArray(e)&&e.length===0)return[{sync:()=>[],withPromise:async()=>[]},!1];let i={root:r,commonPath:null,depthOffset:0},a=xc({...n,patterns:e},r,i);n.debug&&gc(`internal processing patterns:`,a);let o={dot:n.dot,nobrace:n.braceExpansion===!1,nocase:n.caseSensitiveMatch===!1,noextglob:n.extglob===!1,noglobstar:n.globstar===!1,posix:!0},s=(0,tc.default)(a.match,{...o,ignore:a.ignore}),c=(0,tc.default)(a.ignore,o),l=ac(a.match,o),u=cc(r,i.root,n.absolute),d=n.absolute?u:cc(r,i.root,!0),f={filters:[n.debug?(e,t)=>{let n=u(e,t),r=s(n);return r&&gc(`matched ${n}`),r}:(e,t)=>s(u(e,t))],exclude:n.debug?(e,t)=>{let n=d(t,!0),r=n!==`.`&&!l(n)||c(n);return gc(r?`skipped ${t}`:`crawling ${t}`),r}:(e,t)=>{let n=d(t,!0);return n!==`.`&&!l(n)||c(n)},fs:n.fs?{readdir:n.fs.readdir||A.readdir,readdirSync:n.fs.readdirSync||A.readdirSync,realpath:n.fs.realpath||A.realpath,realpathSync:n.fs.realpathSync||A.realpathSync,stat:n.fs.stat||A.stat,statSync:n.fs.statSync||A.statSync}:void 0,pathSeparator:`/`,relativePaths:!0,resolveSymlinks:!0,signal:n.signal};n.deep!==void 0&&(f.maxDepth=Math.round(n.deep-i.depthOffset)),n.absolute&&(f.relativePaths=!1,f.resolvePaths=!0,f.includeBasePath=!0),n.followSymbolicLinks===!1&&(f.resolveSymlinks=!1,f.excludeSymlinks=!0),n.onlyDirectories?(f.excludeFiles=!0,f.includeDirs=!0):n.onlyFiles===!1&&(f.includeDirs=!0),i.root=i.root.replace(yc,``);let p=i.root;n.debug&&gc(`internal properties:`,i);let m=r!==p&&!n.absolute&&lc(r,i.root);return[new Ys(f).crawl(p),m]}async function Tc(e,t){if(e&&t?.patterns)throw Error(`Cannot pass patterns as both an argument and an option`);let n=nc(e)||typeof e==`string`,r=n?t:e,[i,a]=wc(n?e:e.patterns,r);return a?Sc(await i.withPromise(),a):i.withPromise()}const Ec=/\.([cm]?)jsx?$/,Dc=/\.([cm]?)tsx?$/,Oc=/\.d\.([cm]?)ts$/,kc=/\.d\.([cm]?)ts\.map$/,Ac=/[\\/]node_modules[\\/]/,jc=/\.css$/,Mc=/\.vue$/,Nc=/\.json$/;function Pc(e){return e.replace(Ec,`.d.$1ts`)}function Fc(e){return e.replace(Mc,`.vue.ts`).replace(Dc,`.d.$1ts`).replace(Ec,`.d.$1ts`).replace(Nc,`.json.d.ts`)}function Ic(e,t){return e.replace(Oc,`.$1${t}`)}function Lc(e,t){return typeof e==`function`?e(t):e}function Rc(e,t){return e.replaceAll(`[name]`,t)}function zc(e,t){return s(e)?e:d(t||`.`,e)}function Bc(e,t){let{last:n,cwd:r}=t||{},i=zc(e,r),a=zc(n||`/`,r),s,c=[];for(;s!==a&&(c.push(i),i=o(s=i),i!==s););return c}function Vc(e,t){let n,r;for(n of Bc(t&&t.cwd||``,t))if(r=c(n,e),ne(r))return r}function Hc(e){return Vc(`package.json`,e)}var Uc=n(import.meta.url);const Wc=!!e.registerHooks,Gc=/[/\\]node_modules[/\\]/;let Kc;function qc({skipNodeModules:t}={}){if(v.versions.bun)throw Error(`init is unnecessary in Bun, use clearRequireCache() instead.`);if(!Wc)throw Error(`import-without-cache requires Node.js v22.15.0 or higher.`);if(Kc)return Kc;let n=e.registerHooks({resolve(e,n,r){let i=n.importAttributes?.cache===`no`;e.startsWith(`no-cache://`)&&(e=e.slice(11),i=!0);let a=r(e,n);if(t&&Gc.test(a.url)||!a.url.startsWith(`file://`))return a;let o=Yc(n.parentURL);return!i&&!o||(a.url=Xc(a.url,o||crypto.randomUUID())),a},load(e,t,n){return Zc(t),n(e,t)}});return Kc=()=>{n.deregister(),Kc=void 0}}function Jc(){for(let e of Object.keys(Uc.cache))delete Uc.cache[e]}function Yc(e){if(e)return new URL(e).searchParams.get(`no-cache`)??void 0}function Xc(e,t){let n=new URL(e);return n.searchParams.set(`no-cache`,t),n.toString()}function Zc(e){if(!e.importAttributes?.cache)return;let t=Object.assign(Object.create(null),e.importAttributes);delete t.cache,e.importAttributes=t,Object.freeze(e.importAttributes)}const Qc=Symbol.for(`quansync.getIsAsync`);var $c=class extends Error{constructor(e=`Unexpected promise in sync context`){super(e),this.name=`QuansyncError`}};function el(e){return e&&typeof e==`object`&&typeof e.then==`function`}function tl(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`&&`__quansync`in e}function nl(e){let t=function*(...t){return(yield Qc)?yield e.async.apply(this,t):e.sync.apply(this,t)};function n(...n){let r=t.apply(this,n);return r.then=(...t)=>e.async.apply(this,n).then(...t),r.__quansync=!0,r}return n.sync=e.sync,n.async=e.async,n}function rl(e){return nl({async:()=>Promise.resolve(e),sync:()=>{if(el(e))throw new $c;return e}})}function il(e,t){if(e===Qc)return t;if(tl(e))return t?sl(e):ol(e);if(!t&&el(e))throw new $c;return e}const al=e=>e;function ol(e,t=al){let n=e.next();for(;!n.done;)try{n=e.next(il(t(n.value,!1)))}catch(t){n=e.throw(t)}return il(n.value)}async function sl(e,t=al){let n=e.next();for(;!n.done;)try{n=e.next(await il(t(n.value,!0),!0))}catch(t){n=e.throw(t)}return n.value}function cl(e,t){return nl({name:e.name,async(...n){return sl(e.apply(this,n),t?.onYield)},sync(...n){return ol(e.apply(this,n),t?.onYield)}})}function ll(e,t){return el(e)?rl(e):typeof e==`function`?cl(e,t):nl(e)}ll({async:()=>Promise.resolve(!0),sync:()=>!1});const ul=ll;ll({sync:S.readFileSync,async:S.promises.readFile}),ll({sync:S.writeFileSync,async:S.promises.writeFile}),ll({sync:S.unlinkSync,async:S.promises.unlink}),ll({sync:S.accessSync,async:S.promises.access});const dl=ll({sync:S.statSync,async:S.promises.stat}),fl=ll({sync:S.lstatSync,async:S.promises.lstat});ll({sync:S.copyFileSync,async:S.promises.copyFile}),ll({sync:S.rmSync,async:S.promises.rm}),ll({sync:S.mkdirSync,async:S.promises.mkdir}),ll({sync:S.renameSync,async:S.promises.rename}),ll({sync:S.readdirSync,async:S.promises.readdir}),ll({sync:S.realpathSync,async:S.promises.realpath}),ll({sync:S.readlinkSync,async:S.promises.readlink}),ll({sync:S.symlinkSync,async:S.promises.symlink}),ll({sync:S.chownSync,async:S.promises.chown}),ll({sync:S.lchownSync,async:S.promises.lchown}),ll({sync:S.chmodSync,async:S.promises.chmod}),ll({sync:S.utimesSync,async:S.promises.utimes}),ll({sync:S.lutimesSync,async:S.promises.lutimes}),ll({sync:S.mkdtempSync,async:S.promises.mkdtemp});const pl=ul(function*(e,t){try{return(yield(t?dl:fl)(e)).isFile()}catch{return!1}}),ml=ul(function*(e,t={}){let{cwd:n=v.cwd(),stopAt:r=u(n).root,multiple:i=!1,allowSymlinks:a=!0}=t,s=n,c=[];for(;s&&s!==r;){for(let t of e){let e=d(s,t);if((yield pl(e,a))&&(c.push(e),!i))return c}let t=o(s);if(t===s)break;s=t}return c}),hl=ul(function*(e,t){try{let n=yield t.parser(e);return n?{config:n,source:e}:void 0}catch(e){if(t.skipOnError)return;throw e}});function gl(e){let{cwd:t=v.cwd(),multiple:n,sources:r}=e,i=[],a,o=ul(function*(){a??=[],a.length=0;for(let i of r){let{extensions:r}=i,o=yield ml(i.files.flatMap(e=>r?.length?r.map(t=>t?`${e}.${t}`:e):[e]),{cwd:t,stopAt:e.stopAt,multiple:n});a.push([i,o])}return a.flatMap(e=>e[1])});return{load:ul(function*(e=!1){(a==null||e)&&(yield o());for(let[e,t]of a)if(t.length)if(n)for(let n of t){let t=yield hl(n,e);t&&i.push(t)}else{let n=yield hl(t[0],e);if(n)return[n]}return i}),findConfigs:o}}const _l=n(import.meta.url),vl=_l(`picomatch`),yl=_l(`semver/ranges/min-version.js`),bl=e=>e in y&&y[e]!==`0`&&y[e]!==`false`;var xl=bl(`CI`)||bl(`CONTINUOUS_INTEGRATION`);const Sl=Wo(`tsdown:clean`),Cl=/[/\\]$/;async function wl(e){let t=new Set;for(let n of e){if(n.devtools&&(n.devtools.clean??!0)&&n.clean.push(`node_modules/.rolldown`),!n.clean.length)continue;let e=await Tc(n.clean,{cwd:n.cwd,absolute:!0,onlyFiles:!1,dot:!0}),r=n.outDir.replace(Cl,``);for(let n of e)n.replace(Cl,``)!==r&&t.add(n)}t.size&&(co.info(`Cleaning ${t.size} files`),await Promise.all([...t].map(async e=>{Sl(`Removing`,e),await vo(e)})),Sl(`Removed %d files`,t.size))}function Tl(e,t,n){if(e===!0?e=[Za(t)]:e||=[],e.some(e=>i.resolve(e)===n))throw Error(`Cannot clean the current working directory. Please specify a different path to clean option.`);return e}async function El(e,t){await Promise.all(t.map(async t=>{let n=i.resolve(e,t.fileName);Sl(`Removing chunk file`,n),await vo(n)}))}const Dl=`style.css`;function Ol(e={}){return{splitting:e.splitting??!0,fileName:e.fileName??Dl}}async function kl(e,t,n,r,a){if(!t||Object.keys(t).length===0){let e=i.resolve(n,`src/index.ts`);if(await go(e))t={index:e};else throw Error(`${a} No input files, try "tsdown <your-file>" or create src/index.ts`)}let o=await Al(t,n),s=Object.values(o);if(s.length===0)throw Error(`${a} Cannot find entry: ${JSON.stringify(t)}`);return e.info(a,`entry: ${r(s.map(e=>i.relative(n,e)).join(`, `))}`),o}function Al(e,t){return typeof e==`string`&&(e=[e]),Array.isArray(e)?Ml(e,t):jl(e,t)}async function jl(e,t){return Object.fromEntries((await Promise.all(Object.entries(e).map(async([e,n])=>{if(!e.includes(`*`)){if(Array.isArray(n))throw TypeError(`Object entry "${e}" cannot have an array value when the key is not a glob pattern.`);return[[e,n]]}let r=Ja(n),a=await Tc(r,{cwd:t,expandDirectories:!1});if(!a.length)throw Error(`Cannot find files for entry key "${e}" with patterns: ${JSON.stringify(r)}`);let o;for(let t of r){if(t.startsWith(`!`))continue;let n=vl.scan(t).base;if(o===void 0)o=n;else if(o!==n)throw Error(`When using object entry with glob pattern key "${e}", all value glob patterns must have the same base directory.`)}if(o===void 0)throw Error(`Cannot determine base directory for value glob patterns of key "${e}".`);return a.map(n=>[Za(e.replaceAll(`*`,xo(i.relative(o,n)))),i.resolve(t,n)])}))).flat())}async function Ml(e,t){let n=[],r=[];for(let t of e)typeof t==`string`?n.push(t):r.push(t);let a=n.some(e=>hc(e)),o;o=a?(await Tc(n,{cwd:t,expandDirectories:!1,absolute:!0})).map(e=>i.resolve(e)):n;let s=bo(...o),c=Object.fromEntries(o.map(e=>[Za(xo(i.relative(s,e))),e]));return Object.assign({},c,...await Promise.all(r.map(e=>jl(e,t))))}async function Nl(e,t){let{pkg:n}=e,{publishExports:r,...i}=await Fl(n,t,e),a={...n,...i,packageJsonPath:void 0};r&&(a.publishConfig||={},a.publishConfig.exports=r);let o=re(n.packageJsonPath,`utf8`),s=JSON.stringify(a,null,Co(o));o.endsWith(`
68
+ `)&&(s+=`
69
+ `),s!==o&&ie(n.packageJsonPath,s,`utf8`)}function Pl(e,t){return t?.length?$a(e,t):!1}async function Fl(e,t,n){let{exports:{devExports:r,all:a,packageJson:o=!0,exclude:s,customExports:c,legacy:l},css:u,logger:d}=n,f=i.dirname(e.packageJsonPath),p,m,h,g,_=new Map,v=Object.keys(t);!v.includes(`cjs`)&&!v.includes(`es`)&&d.warn(`No CJS or ESM formats found in chunks for package ${e.name}`);let ee=v.length===1&&v[0]===`es`;l??=!ee;for(let[e,n]of Object.entries(t)){if(e!==`es`&&e!==`cjs`)continue;let t=n.filter(e=>{if(e.type!==`chunk`||!e.isEntry)return!1;let[t]=Bl(e);return!Pl(t,s)}),r=t.filter(e=>!Oc.test(e.fileName)).length===1;for(let n of t){let[t,a,o]=Bl(n),s=r||t===`index`,c=Vl(f,n.outDir,a);s?(t=`.`,e===`cjs`?o?h=c:p=c:e===`es`&&(o?g=c:m=c)):t=t.endsWith(`/index`)?`./${t.slice(0,-6)}`:`./${t}`;let l=_.get(t);l||(l={},_.set(t,l)),o||(l[e]=c,n.facadeModuleId&&!l.src&&(l.src=`./${Za(i.relative(f,n.facadeModuleId))}`))}}let y=Array.from(_.entries()).toSorted(([e],[t])=>e===`index`?-1:e.localeCompare(t)),b=Object.fromEntries(y.map(([e,t])=>[e,Il(r,t)]));Ll(b,a,o),Rl(b,t,u,f),c&&(b=await c(b,{pkg:e,chunks:t,isPublish:!1}));let x;return r&&(x=Object.fromEntries(y.map(([e,t])=>[e,Il(!1,t)])),Ll(x,a,o),Rl(x,t,u,f),c&&(x=await c(x,{pkg:e,chunks:t,isPublish:!0}))),{main:l?p||m||e.main:void 0,module:l?m||e.module:void 0,types:l&&(h||g)||e.types,exports:b,publishExports:x}}function Il(e,{src:t,es:n,cjs:r}){if(e===!0)return t;let i,a=n&&r;return!a&&!e?i=r||n:(i={},typeof e==`string`&&(i[e]=t),r&&(i[a?`require`:`default`]=r),n&&(i[a?`import`:`default`]=n)),i}function Ll(e,t,n){t?e[`./*`]=`./*`:n&&(e[`./package.json`]=`./package.json`)}function Rl(e,t,{splitting:n},r){if(!n){for(let n of Object.values(t))for(let t of n)if(t.type===`asset`&&jc.test(t.fileName)){let n=Za(t.fileName);e[`./${n}`]=Vl(r,t.outDir,n);return}}}function zl(e){let t=e?.exports;if(!t)return!1;if(typeof t==`object`&&t&&!Array.isArray(t)){if(`types`in t)return!0;if(`.`in t){let e=t[`.`];if(typeof e==`object`&&e&&`types`in e)return!0}}return!1}function Bl(e){let t=Za(e.fileName),n=xo(t),r=n.endsWith(`.d`);return r&&(n=n.slice(0,-2)),[n,t,r]}function Vl(e,t,n){let r=Za(i.relative(e,t));return`${r?`./${r}`:`.`}/${n}`}function Hl(e,t,n,r,i){if(t===!1)return;if(t==null){let e=Ul(r);if(e)t=e;else return}if(typeof t==`number`)throw TypeError(`Invalid target: ${t}`);let a=Ya(Ja(t));return a.length&&e.info(i,`target${a.length>1?`s`:``}: ${n(a.join(`, `))}`),a}function Ul(e){let t=e?.engines?.node;if(!t)return;let n=yl(t);if(n&&n.version!==`0.0.0`)return`node${n.version}`}function Wl(e,t=`tsconfig.json`){return Vc(t,{cwd:e})||!1}async function Gl(e,t,n,r,a){let o=t;if(t!==!1){if(t===!0||t==null)t=Wl(n),o&&!t&&e.warn(`No tsconfig found in ${va(n)}`);else{let r=i.resolve(n,t),a=await _o(r);a?.isFile()?t=r:a?.isDirectory()?(t=Wl(r),t||e.warn(`No tsconfig found in ${va(r)}`)):(t=Wl(n,t),t||e.warn(`tsconfig ${va(o)} doesn't exist`))}t&&e.info(a,`tsconfig: ${r(i.relative(n,t))}`)}return t}const Kl=Wo(`tsdown:package`);async function ql(e){let t=Hc({cwd:e});if(!t)return;Kl(`Reading package.json:`,t);let n=await se(t,`utf8`);return{...JSON.parse(n),packageJsonPath:t}}function Jl(e){if(e?.type){if(![`module`,`commonjs`].includes(e.type))throw Error(`Invalid package.json type: ${e.type}`);return e.type}}function Yl(e){switch(e){case`es`:case`esm`:case`module`:return`es`;case`cjs`:case`commonjs`:return`cjs`;default:return e}}const Xl=Wo(`tsdown:config:file`);async function Zl(e,t,n){let r=ru(n);Xl(`Loading Vite config via loader: `,r);let i=iu(r),[a]=await gl({sources:[{files:[`${e}.config`],extensions:[`js`,`mjs`,`ts`,`cjs`,`mts`,`cts`],parser:i}],cwd:t}).load(!0);if(!a)return;let{config:o,source:s}=a;co.info(`Using Vite config: ${fa(s)}`);let c=await o;return typeof c==`function`?c({command:`build`,mode:`production`}):c}const Ql=`tsdown.config`;async function $l(e,t){let n=e.cwd||v.cwd(),r=!1,{config:a}=e;if(a===!1)return{configs:[{}]};if(typeof a==`string`){let e=await _o(a);if(e){let t=i.resolve(a);e.isFile()?(r=!0,a=t,n=i.dirname(a)):e.isDirectory()&&(n=t)}}let o=ru(e.configLoader);Xl(`Using config loader:`,o);let s=iu(o),[c]=await gl({sources:r?[{files:[a],extensions:[],parser:s}]:[{files:[Ql],extensions:[`ts`,`mts`,`cts`,`js`,`mjs`,`cjs`,`json`],parser:s},{files:[`package.json`],parser:s}],cwd:n,stopAt:t&&i.dirname(t)}).load(!0),l=[],u;if(c&&({config:l,source:u}=c,co.info(`config file: ${fa(u)}`,o===`native`?``:`(${o})`),l=await l,typeof l==`function`&&(l=await l(e,{ci:xl}))),l=Ja(l),l.length===0&&l.push({}),l.some(e=>typeof e==`function`))throw Error(`Function should not be nested within multiple tsdown configurations. It must be at the top level.
70
+ Example: export default defineConfig(() => [...])`);return{configs:l.map(e=>({...e,cwd:e.cwd?i.resolve(n,e.cwd):n})),file:u}}const eu=!!v.versions.bun,tu=v.features.typescript||v.versions.deno,nu=eu||tu&&Wc?`native`:`unrun`;function ru(e=`auto`){return e===`auto`?nu:e===`native`?`native`:`unrun`}function iu(e){return async t=>{let n=i.basename(t),r=n===`package.json`;if(n===Ql||r||n.endsWith(`.json`)){let e=await se(t,`utf8`),n=JSON.parse(e);return r?n?.tsdown:n}return e===`native`?au(t):ou(t)}}async function au(e){let t=M(e),n=Object.create(null);Wc?(n.cache=`no`,qc({skipNodeModules:!0})):eu||t.searchParams.set(`no-cache`,crypto.randomUUID());let r=await import(t.href,{with:n}).catch(e=>{throw e?.message?.includes?.(`Cannot find module`)?Error(`Failed to load the config file. Try setting the --config-loader CLI flag to \`unrun\`.\n\n${e.message}`,{cause:e}):e});return r.default||r}async function ou(e){let{unrun:t}=await import(`./dist-Bvnjjx3Q.js`),{module:n}=await t({path:M(e).href});return n}const su=Wo(`tsdown:config:options`),cu=v.getBuiltinModule(`node:util`).parseEnv;async function lu(e,t){let{entry:n,format:r=[`es`],plugins:a=[],clean:o=!0,logLevel:s=`info`,failOnWarn:c=`ci-only`,customLogger:l,treeshake:u=!0,platform:d=`node`,outDir:f=`dist`,sourcemap:p=!1,dts:m,unused:h=!1,watch:g=!1,ignoreWatch:_,shims:ee=!1,skipNodeModulesBundle:y=!1,publint:b=!1,attw:x=!1,fromVite:te,alias:S,tsconfig:ne,report:re=!0,target:ie,env:C={},envFile:ae,envPrefix:w=`TSDOWN_`,copy:oe,publicDir:T,hash:ce=!0,cwd:E=v.cwd(),name:D,workspace:le,external:ue,noExternal:de,exports:O=!1,bundle:k,unbundle:A=typeof k==`boolean`?!k:!1,removeNodeProtocol:j,nodeProtocol:fe,cjsDefault:pe=!0,globImport:me=!0,inlineOnly:M,css:he,fixedExtension:ge=d===`node`,devtools:N=!1,write:P=!0}=e,_e=await ql(E);le&&(D||=_e?.name);let ve=po(D),ye=lo(ve,D);if(!hu(t.filter,E,D))return su(`[filter] skipping config %s`,E),[];let be=so(s,{customLogger:l,failOnWarn:pu(c,!0)});if(typeof k==`boolean`&&be.warn("`bundle` option is deprecated. Use `unbundle` instead."),j){if(fe)throw TypeError("`removeNodeProtocol` is deprecated. Please only use `nodeProtocol` instead.");be.warn('`removeNodeProtocol` is deprecated. Use `nodeProtocol: "strip"` instead.')}fe??=j?`strip`:!1,f=i.resolve(E,f),o=Tl(o,f,E);let xe=await kl(be,n,E,ve,ye);if(m??=!!(_e?.types||_e?.typings||zl(_e)),ie=Hl(be,ie,ve,_e,ye),ne=await Gl(be,ne,E,ve,ye),typeof ue==`string`&&(ue=Xa(ue)),typeof de==`string`&&(de=Xa(de)),b=pu(b,{}),x=pu(x,{}),O=pu(O,{}),h=pu(h,{}),re=pu(re,{}),m=pu(m,{}),!_e){if(O)throw Error("`package.json` not found, cannot write exports");b&&be.warn(ye,`publint is enabled but package.json is not found`),x&&be.warn(ye,`attw is enabled but package.json is not found`)}if(T){if(oe)throw TypeError("`publicDir` is deprecated. Cannot be used with `copy`");be.warn(`${va`publicDir`} is deprecated. Use ${va`copy`} instead.`)}w=Ja(w),w.includes(``)&&be.warn("`envPrefix` includes an empty string; filtering is disabled. All environment variables from the env file and process.env will be injected into the build. Ensure this is intended to avoid accidental leakage of sensitive information.");let Se=uu(v.env,w);if(ae){if(!cu)throw Error(`Your runtime does not support 'util.parseEnv()'. Please upgrade to Node.js v20.12.0 or later.`);let e=i.resolve(E,ae);be.info(ye,`env file: ${ve(e)}`),C={...uu(cu(await se(e,`utf8`)),w),...Se,...C}}else C={...Se,...C};if(su(`Environment variables: %O`,C),te){let e=await Zl(te===!0?`vite`:te,E,t.configLoader);if(e){let t=e.resolve?.alias;if(Array.isArray(t))throw TypeError(`Unsupported resolve.alias in Vite config. Use object instead of array`);t&&(S={...S,...t}),e.plugins&&(a=[e.plugins,a])}}if(_=Ja(_).map(e=>(e=Xa(e),typeof e==`string`?i.resolve(E,e):e)),de!=null&&typeof de!=`function`){let e=Ja(de);de=t=>$a(t,e)}M!=null&&M!==!1&&(M=Ja(M)),N=pu(N,{}),N&&(g?(N.ui&&be.warn(`Devtools UI is not supported in watch mode, disabling it.`),N.ui=!1):N.ui??=!!eo(`@vitejs/devtools/cli`));let Ce={...e,alias:S,attw:x,cjsDefault:pe,clean:o,copy:T||oe,css:Ol(he),cwd:E,devtools:N,dts:m,entry:xe,env:C,exports:O,external:ue,fixedExtension:ge,globImport:me,hash:ce,ignoreWatch:_,inlineOnly:M,logger:be,name:D,nameLabel:ye,nodeProtocol:fe,noExternal:de,outDir:f,pkg:_e,platform:d,plugins:a,publint:b,report:re,shims:ee,skipNodeModulesBundle:y,sourcemap:p,target:ie,treeshake:u,tsconfig:ne,unbundle:A,unused:h,watch:g,write:P},we=typeof r==`object`&&!Array.isArray(r);return(we?Object.keys(r):Ya(Ja(r,`es`))).map((e,t)=>{let n=t===0,i=we?r[e]:void 0;return{...Ce,copy:n?Ce.copy:void 0,onSuccess:n?Ce.onSuccess:void 0,format:Yl(e),...i}})}function uu(e,t){let n={};for(let[r,i]of Object.entries(e))i!=null&&t.some(e=>r.startsWith(e))&&(n[r]=i);return n}const du=Eo((e,t,n)=>{if(Array.isArray(e[t])&&Array.isArray(n))return e[t]=n,!0});async function fu(e,t,n){let r=typeof t==`function`?await t(e,...n):t;return r?du(r,e):e}function pu(e,t){return typeof e==`object`&&e?mu(e.enabled??!0)?e:!1:mu(e)?t:!1}function mu(e){return e===`ci-only`?!!xl:e===`local-only`?!xl:e}function hu(e,t,n){if(!e)return!0;let r=i.relative(v.cwd(),t);return r===``&&(r=`.`),e instanceof RegExp?n&&e.test(n)||e.test(r):Ja(e).some(e=>n&&n===e||r===e)}var gu=`0.20.1`;function _u(e){return Array.isArray(e)?e:[e]}function vu(e){throw e?Error(`unimplemented: ${e}`):Error(`unimplemented`)}function yu(e){throw e?Error(`unreachable: ${e}`):Error(`unreachable`)}function bu(e){throw Error(`UNSUPPORTED: ${e}`)}function xu(...e){}var Su=class{kind;args;constructor(...e){if(e.length===0)throw Error("`And` expects at least one operand");this.args=e,this.kind=`and`}},Cu=class{kind;pattern;params;constructor(e,t){this.pattern=e,this.kind=`id`,this.params=t??{cleanUrl:!1}}},wu=class{kind;pattern;params;constructor(e,t){this.pattern=e,this.kind=`importerId`,this.params=t??{cleanUrl:!1}}},Tu=class{kind;expr;constructor(e){this.expr=e,this.kind=`include`}};function Eu(...e){return new Su(...e)}function Du(e,t){return new Cu(e,t)}function Ou(e,t){return new wu(e,t)}function ku(e){return new Tu(e)}const Au=i.resolve(import.meta.dirname,`..`,`esm-shims.js`);function ju(e,t){if(e===`es`&&t===`node`)return{__dirname:[Au,`__dirname`],__filename:[Au,`__filename`]}}const Mu=Wo(`tsdown:dep`);function Nu({pkg:e,noExternal:t,inlineOnly:n,skipNodeModulesBundle:i,logger:a,nameLabel:o}){let s=e&&Array.from(Pu(e));return{name:`tsdown:external`,resolveId:{filter:[ku(Eu(Du(/^[^.]/),Ou(/./)))],async handler(e,t,n){if(n.isEntry)return;let i=await c(this,e,t,n),a=r(e);if(Mu(`shouldExternal: %o = %o`,e,i),i===!0||i===`absolute`)return{id:e,external:i,moduleSideEffects:a?!1:void 0}}},generateBundle:n===!1?void 0:{order:`post`,handler(e,t){let r=new Set,i=new Map;for(let e of Object.values(t))if(e.type!==`asset`)for(let t of e.moduleIds){if(!Ac.test(t))continue;let e=Za(t).split(`/node_modules/`).at(-1)?.split(`/`);if(!e)continue;let n;n=e[0][0]===`@`?`${e[0]}/${e[1]}`:e[0],r.add(n);let a=this.getModuleInfo(t);a&&i.set(n,new Set([...a.importers,...i.get(n)||[]]))}if(Mu(`found deps in bundle: %o`,r),n){let e=Array.from(r).filter(e=>!$a(e,n)).map(e=>`${_a(e)} is located in ${va`node_modules`} but is not included in ${va`inlineOnly`} option.\nTo fix this, either add it to ${va`inlineOnly`}, declare it as a production or peer dependency in your package.json, or externalize it manually.\nImported by\n${[...i.get(e)||[]].map(e=>`- ${fa(e)}`).join(`
71
+ `)}`);e.length&&this.error(e.join(`
16
72
 
17
- //#endregion
18
- //#region src/constants.ts
19
- const CLI_NAME = name;
20
- const CLI_VERSION = version;
21
- const DEFAULT_PLUGIN_NAME = "./packages/my-tool";
22
- const DEFAULT_PLUGIN_DESCRIPTION = "This is a FastGPT plugin";
23
- const TOOL_TEMPLATES_DIR = path.join(import.meta.dirname, "../templates");
24
-
25
- //#endregion
26
- //#region src/helpers.ts
27
- const logger = consola.withTag(CLI_NAME);
28
-
29
- //#endregion
30
- //#region src/commands/base.ts
31
- /**
32
- * 所有子命令的基类:
33
- * - 统一命令接口类型
34
- * - 强制实现 register 方法,用于向 Commander 注册自身
35
- */
36
- var BaseCommand = class {};
37
-
38
- //#endregion
39
- //#region src/prompts/create/deps.ts
40
- const defaultDeps = {
41
- input,
42
- select
43
- };
44
-
45
- //#endregion
46
- //#region src/prompts/create/input-prompt.ts
47
- async function inputPrompt(deps, options) {
48
- return deps.input({
49
- ...options,
50
- validate: (value) => {
51
- if (!value || value.trim().length === 0) return "请输入有效的内容";
52
- return true;
53
- }
54
- });
55
- }
56
-
57
- //#endregion
58
- //#region src/prompts/create/prompt.ts
59
- var CreatePrompt = class {
60
- deps;
61
- constructor(deps = defaultDeps) {
62
- this.deps = deps;
63
- }
64
- /**
65
- * 根据 CLI 传入的原始参数,交互式补全缺失字段,生成完整的 CreatePluginCommandOptions。
66
- * - 如果 name、type、description 都已提供,则不进入交互流程,直接返回
67
- * - 否则使用交互式 prompt 补全缺失部分
68
- */
69
- async run(input) {
70
- const getPluginType = () => {
71
- if (!input.typeFlag) return void 0;
72
- return input.typeFlag === "tool-suite" ? "tool-suite" : "tool";
73
- };
74
- const pluginType = getPluginType();
75
- if (input.nameArg && pluginType && input.descriptionFlag !== void 0) return {
76
- name: input.nameArg,
77
- cwd: input.cwd,
78
- type: pluginType,
79
- description: input.descriptionFlag
80
- };
81
- const getPluginNameInputPrompt = async () => {
82
- return await inputPrompt(this.deps, {
83
- message: "插件名称",
84
- default: DEFAULT_PLUGIN_NAME
85
- });
86
- };
87
- const name = input.nameArg ?? await getPluginNameInputPrompt();
88
- const getPluginTypeSelectPrompt = async () => {
89
- return await this.deps.select({
90
- message: "选择插件类型",
91
- choices: [{
92
- name: "单工具",
93
- value: "tool",
94
- description: "创建一个独立的工具"
95
- }, {
96
- name: "工具集",
97
- value: "tool-suite",
98
- description: "创建一个包含多个子工具的工具集"
99
- }]
100
- });
101
- };
102
- const type = pluginType ?? await getPluginTypeSelectPrompt();
103
- const getPluginDescriptionInputPrompt = async () => {
104
- return await inputPrompt(this.deps, {
105
- message: "插件描述",
106
- default: DEFAULT_PLUGIN_DESCRIPTION
107
- });
108
- };
109
- const description = input.descriptionFlag ?? await getPluginDescriptionInputPrompt();
110
- return {
111
- name,
112
- cwd: input.cwd,
113
- type,
114
- description
115
- };
116
- }
117
- };
118
-
119
- //#endregion
120
- //#region src/commands/create.ts
121
- var CreateCommand = class extends BaseCommand {
122
- register(parent) {
123
- parent.command("create").description("创建新的 FastGPT 插件项目").argument("[name]", "插件名称").option("-t, --type <type>", "插件类型: 单工具 | 工具集").option("-d, --description <desc>", "插件描述").option("--cwd <path>", "工作目录", process.cwd()).action(async (name, opts) => {
124
- const options = await new CreatePrompt().run({
125
- nameArg: name,
126
- typeFlag: opts.type,
127
- descriptionFlag: opts.description,
128
- cwd: opts.cwd
129
- });
130
- await this.run(options);
131
- });
132
- }
133
- async run(options) {
134
- const targetDir = path.resolve(options.cwd, options.name);
135
- const templateDir = path.join(TOOL_TEMPLATES_DIR, options.type === "tool-suite" ? "tool-suite" : "tool");
136
- const files = await this.collectTemplateFiles(templateDir);
137
- const description = options.description ?? DEFAULT_PLUGIN_DESCRIPTION;
138
- await this.ensureDir(targetDir);
139
- for (const rel of files) {
140
- const templatePath = path.join(templateDir, rel);
141
- const filePath = path.join(targetDir, rel);
142
- await this.ensureDir(path.dirname(filePath));
143
- const raw = await fs.readFile(templatePath, "utf-8");
144
- const content = this.applyPlaceholders(raw, options.name, description);
145
- await fs.writeFile(filePath, content, "utf-8");
146
- }
147
- logger.success(`创建插件项目: ${options.name} (${options.type})`, { cwd: options.cwd });
148
- }
149
- applyPlaceholders(text, name, description) {
150
- name = path.basename(name);
151
- return text.replace(/\{\{name\}\}/g, name).replace(/\{\{description\}\}/g, description);
152
- }
153
- async collectTemplateFiles(root) {
154
- const result = [];
155
- const walk = async (dir) => {
156
- const entries = await fs.readdir(dir, { withFileTypes: true });
157
- for (const entry of entries) {
158
- const full = path.join(dir, entry.name);
159
- if (entry.isDirectory()) await walk(full);
160
- else {
161
- const rel = path.relative(root, full).replace(/\\/g, "/");
162
- result.push(rel);
163
- }
164
- }
165
- };
166
- await walk(root);
167
- return result.sort();
168
- }
169
- async ensureDir(dir) {
170
- await fs.mkdir(dir, { recursive: true });
171
- }
172
- };
173
-
174
- //#endregion
175
- //#region src/build/ast-transform.ts
176
- const traverse = $traverse.default;
177
- const generate = $generate.default;
178
- function extractToolId(filePath) {
179
- const stack = filePath.split("/");
180
- if (stack.at(-3) === "children") return `${stack.at(-4)}/${stack.at(-2)}`;
181
- return stack.at(-2) || "unknown";
182
- }
183
- function transformToolConfig({ sourceCode, filePath }) {
184
- if (sourceCode.includes("toolId:")) return {
185
- code: sourceCode,
186
- hasToolId: true
187
- };
188
- const ast = parse(sourceCode, {
189
- plugins: ["typescript"],
190
- sourceType: "module"
191
- });
192
- const toolId = extractToolId(filePath);
193
- let modified = false;
194
- const childrenDir = join(filePath, "..", "children");
195
- let childrenList = [];
196
- if (existsSync(childrenDir)) try {
197
- childrenList = readdirSync(childrenDir);
198
- } catch {}
199
- traverse(ast, { CallExpression(path) {
200
- if (path.node.callee.type === "Identifier" && path.node.arguments[0] && path.node.arguments[0].type === "ObjectExpression") {
201
- const objExpr = path.node.arguments[0];
202
- let hasToolId = false;
203
- traverse(path.node, { ObjectProperty(innerPath) {
204
- if (innerPath.node.key.type === "Identifier" && innerPath.node.key.name === "toolId") hasToolId = true;
205
- } }, path.scope, path.parentPath);
206
- if (!hasToolId) {
207
- const toolIdProp = {
208
- type: "ObjectProperty",
209
- key: {
210
- type: "Identifier",
211
- name: "toolId"
212
- },
213
- value: {
214
- type: "StringLiteral",
215
- value: toolId
216
- },
217
- computed: false,
218
- shorthand: false
219
- };
220
- objExpr.properties.push(toolIdProp);
221
- modified = true;
222
- }
223
- if (path.node.callee.type === "Identifier" && path.node.callee.name === "defineToolSet") {
224
- let hasCustomChildren = false;
225
- traverse(path.node, { ObjectProperty(innerPath) {
226
- if (innerPath.node.key.type === "Identifier" && innerPath.node.key.name === "children") hasCustomChildren = true;
227
- } }, path.scope, path.parentPath);
228
- if (!hasCustomChildren && childrenList.length > 0) {
229
- for (const child of childrenList) {
230
- const importDecl = {
231
- type: "ImportDeclaration",
232
- source: {
233
- type: "StringLiteral",
234
- value: `./children/${child}`
235
- },
236
- importKind: "value",
237
- specifiers: [{
238
- type: "ImportDefaultSpecifier",
239
- local: {
240
- type: "Identifier",
241
- name: child
242
- }
243
- }]
244
- };
245
- ast.program.body.unshift(importDecl);
246
- }
247
- const childrenProp = {
248
- type: "ObjectProperty",
249
- key: {
250
- type: "Identifier",
251
- name: "children"
252
- },
253
- value: {
254
- type: "ArrayExpression",
255
- elements: childrenList.map((child) => ({
256
- type: "Identifier",
257
- name: child
258
- }))
259
- },
260
- computed: false,
261
- shorthand: false
262
- };
263
- objExpr.properties.push(childrenProp);
264
- modified = true;
265
- }
266
- }
267
- }
268
- } });
269
- return {
270
- code: generate(ast).code,
271
- hasToolId: !modified && sourceCode.includes("toolId:")
272
- };
273
- }
274
-
275
- //#endregion
276
- //#region src/build/index.ts
277
- /**
278
- * 核心构建逻辑:给定入口目录和输出目录,完成一次工具构建。
279
- * - 不做日志输出
280
- * - 不调用 process.exit
281
- * - 失败时抛出 Error
73
+ `))}else r.size&&a.warn(o,`Consider adding ${va`inlineOnly`} option to avoid unintended bundling of dependencies, or set ${va`inlineOnly: false`} to disable this warning.\nDetected dependencies in bundle:\n${Array.from(r).map(e=>`- ${_a(e)}`).join(`
74
+ `)}`)}}};async function c(e,n,r,a){if(n===Au)return!1;if(t?.(n,r))return`no-external`;if(i){let t=await e.resolve(n,r,a);if(t&&(t.external||Ac.test(t.id)))return!0}return!!(s&&(s.includes(n)||s.some(e=>n.startsWith(`${e}/`))))}}function Pu(e){return new Set([...Object.keys(e.dependencies||{}),...Object.keys(e.peerDependencies||{})])}function Fu(e){let n=t.filter(e=>!e.startsWith(`node:`));return{name:`tsdown:node-protocol`,resolveId:{order:`pre`,filter:{id:e===`strip`?RegExp(`^node:(${n.join(`|`)})$`):RegExp(`^(${n.join(`|`)})$`)},handler:e===`strip`?e=>({id:e.slice(5),external:!0,moduleSideEffects:!1}):e=>({id:`node:${e}`,external:!0,moduleSideEffects:!1})}}}const Iu=Wo(`tsdown:report`),Lu=h(we),Ru=h(Te),zu={gzip:!0,brotli:!1,maxCompressSize:1e6};function Bu(e,t,n,r,a,o){let s={...zu,...e};return{name:`tsdown:report`,async writeBundle(e,c){let l=i.relative(n,e.file?i.resolve(n,e.file,`..`):i.resolve(n,e.dir)),u=[];for(let e of Object.values(c)){let t=await Vu(s,e);u.push(t)}let d=Math.max(...u.map(e=>e.filename.length)),f=Math.max(...u.map(e=>e.rawText.length)),p=Math.max(...u.map(e=>e.gzipText==null?0:e.gzipText.length)),m=Math.max(...u.map(e=>e.brotliText==null?0:e.brotliText.length)),h=0;for(let e of u)e.rawText=e.rawText.padStart(f),e.gzipText=e.gzipText?.padStart(p),e.brotliText=e.brotliText?.padStart(m),h+=e.raw;u.sort((e,t)=>e.dts===t.dts?e.isEntry===t.isEntry?t.raw-e.raw:e.isEntry?-1:1:e.dts?1:-1);let g=o&&uo(r?`cjs`:e.format);for(let e of u){let n=e.dts?ga:Qa,r=i.normalize(e.filename);t.info(a,g,ua(l+i.sep)+n((e.isEntry?la:Qa)(r)),` `.repeat(d-e.filename.length),ua(e.rawText),s.gzip&&e.gzipText&&ua`│ gzip: ${e.gzipText}`,s.brotli&&e.brotliText&&ua`│ brotli: ${e.brotliText}`)}let _=So(h);t.info(a,g,`${u.length} files, total: ${_}`)}}}async function Vu(e,t){Iu(`Calculating size for`,t.fileName);let n=t.type===`chunk`?t.code:t.source,r=Ce.byteLength(n,`utf8`);Iu(`[size]`,t.fileName,r);let i=1/0,a=1/0;return r>e.maxCompressSize?Iu(t.fileName,`file size exceeds limit, skip gzip/brotli`):(e.gzip&&(i=(await Ru(n)).length,Iu(`[gzip]`,t.fileName,i)),e.brotli&&(a=(await Lu(n)).length,Iu(`[brotli]`,t.fileName,a))),{filename:t.fileName,dts:Oc.test(t.fileName),isEntry:t.type===`chunk`&&t.isEntry,raw:r,rawText:So(r),gzip:i,gzipText:So(i),brotli:a,brotliText:So(a)}}const Hu=/^#!.*/;function Uu(e,t,n,r){return{name:`tsdown:shebang`,async writeBundle(a,o){for(let s of Object.values(o)){if(s.type!==`chunk`||!s.isEntry||!Hu.test(s.code))continue;let o=i.resolve(t,a.file||i.join(a.dir,s.fileName));await go(o)&&(e.info(n,r&&uo(a.format),`Granting execute permission to ${fa(i.relative(t,o))}`),await w(o,493))}}}}function Wu(e,t){return e.map(e=>(e.outDir=t,e))}const Gu=/[\\/](?:tsdown\.config.*|package\.json|tsconfig\.json)$/;function Ku(e,{config:t,chunks:n}){return{name:`tsdown:watch`,options:t.ignoreWatch.length?e=>{e.watch||={},e.watch.exclude=Ja(e.watch.exclude),e.watch.exclude.push(...t.ignoreWatch)}:void 0,buildStart(){t.tsconfig&&this.addWatchFile(t.tsconfig);for(let t of e)this.addWatchFile(t);if(typeof t.watch!=`boolean`)for(let e of Ya(Ja(t.watch)))this.addWatchFile(e);t.pkg&&this.addWatchFile(t.pkg.packageJsonPath)},generateBundle:{order:`post`,handler(e,r){n.push(...Wu(Object.values(r),t.outDir))}}}}var qu=Object.create,Ju=Object.defineProperty,Yu=Object.getOwnPropertyDescriptor,Xu=Object.getOwnPropertyNames,Zu=Object.getPrototypeOf,Qu=Object.prototype.hasOwnProperty,$u=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ed=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Xu(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Qu.call(e,s)&&s!==n&&Ju(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Yu(t,s))||r.enumerable});return e},td=(e,t,n)=>(n=e==null?{}:qu(Zu(e)),ed(t||!e||!e.__esModule?Ju(n,`default`,{value:e,enumerable:!0}):n,e)),I=n(import.meta.url),nd=$u(((e,t)=>{let n=I(`node:fs`),r=I(`node:child_process`),i=JSON.parse(n.readFileSync(I.resolve(`rolldown/package.json`),`utf-8`)).version,a=`/tmp/rolldown-${i}`,o=`${a}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;if(!n.existsSync(o)){let e=`@rolldown/binding-wasm32-wasi@${i}`;n.rmSync(a,{recursive:!0,force:!0}),n.mkdirSync(a,{recursive:!0}),console.log(`[rolldown] Downloading ${e} on WebContainer...`),r.execFileSync(`pnpm`,[`i`,e],{cwd:a,stdio:`inherit`})}t.exports=I(o)})),rd=$u(((e,t)=>{let{readFileSync:n}=I(`node:fs`),r=null,i=[],a=()=>{let e=!1;return process.platform===`linux`&&(e=s(),e===null&&(e=c()),e===null&&(e=l())),e},o=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),s=()=>{try{return n(`/usr/bin/ldd`,`utf-8`).includes(`musl`)}catch{return null}},c=()=>{let e=null;return typeof process.report?.getReport==`function`&&(process.report.excludeNetwork=!0,e=process.report.getReport()),e?e.header&&e.header.glibcVersionRuntime?!1:!!(Array.isArray(e.sharedObjects)&&e.sharedObjects.some(o)):null},l=()=>{try{return I(`child_process`).execSync(`ldd --version`,{encoding:`utf8`}).includes(`musl`)}catch{return!1}};function u(){if(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)try{return I(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)}catch(e){i.push(e)}else if(process.platform===`android`)if(process.arch===`arm64`){try{return I(`./rolldown-binding.android-arm64.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-android-arm64`),t=I(`@rolldown/binding-android-arm64/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`arm`){try{return I(`./rolldown-binding.android-arm-eabi.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-android-arm-eabi`),t=I(`@rolldown/binding-android-arm-eabi/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else i.push(Error(`Unsupported architecture on Android ${process.arch}`));else if(process.platform===`win32`)if(process.arch===`x64`)if(process.config?.variables?.shlib_suffix===`dll.a`||process.config?.variables?.node_target_type===`shared_library`){try{return I(`./rolldown-binding.win32-x64-gnu.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-win32-x64-gnu`),t=I(`@rolldown/binding-win32-x64-gnu/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else{try{return I(`./rolldown-binding.win32-x64-msvc.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-win32-x64-msvc`),t=I(`@rolldown/binding-win32-x64-msvc/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`ia32`){try{return I(`./rolldown-binding.win32-ia32-msvc.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-win32-ia32-msvc`),t=I(`@rolldown/binding-win32-ia32-msvc/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`arm64`){try{return I(`./rolldown-binding.win32-arm64-msvc.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-win32-arm64-msvc`),t=I(`@rolldown/binding-win32-arm64-msvc/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else i.push(Error(`Unsupported architecture on Windows: ${process.arch}`));else if(process.platform===`darwin`){try{return I(`./rolldown-binding.darwin-universal.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-darwin-universal`),t=I(`@rolldown/binding-darwin-universal/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}if(process.arch===`x64`){try{return I(`./rolldown-binding.darwin-x64.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-darwin-x64`),t=I(`@rolldown/binding-darwin-x64/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`arm64`){try{return I(`./rolldown-binding.darwin-arm64.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-darwin-arm64`),t=I(`@rolldown/binding-darwin-arm64/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else i.push(Error(`Unsupported architecture on macOS: ${process.arch}`))}else if(process.platform===`freebsd`)if(process.arch===`x64`){try{return I(`./rolldown-binding.freebsd-x64.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-freebsd-x64`),t=I(`@rolldown/binding-freebsd-x64/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`arm64`){try{return I(`./rolldown-binding.freebsd-arm64.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-freebsd-arm64`),t=I(`@rolldown/binding-freebsd-arm64/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else i.push(Error(`Unsupported architecture on FreeBSD: ${process.arch}`));else if(process.platform===`linux`)if(process.arch===`x64`)if(a()){try{return I(`./rolldown-binding.linux-x64-musl.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-x64-musl`),t=I(`@rolldown/binding-linux-x64-musl/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else{try{return I(`../rolldown-binding.linux-x64-gnu.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-x64-gnu`),t=I(`@rolldown/binding-linux-x64-gnu/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`arm64`)if(a()){try{return I(`./rolldown-binding.linux-arm64-musl.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-arm64-musl`),t=I(`@rolldown/binding-linux-arm64-musl/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else{try{return I(`./rolldown-binding.linux-arm64-gnu.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-arm64-gnu`),t=I(`@rolldown/binding-linux-arm64-gnu/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`arm`)if(a()){try{return I(`./rolldown-binding.linux-arm-musleabihf.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-arm-musleabihf`),t=I(`@rolldown/binding-linux-arm-musleabihf/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else{try{return I(`./rolldown-binding.linux-arm-gnueabihf.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-arm-gnueabihf`),t=I(`@rolldown/binding-linux-arm-gnueabihf/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`loong64`)if(a()){try{return I(`./rolldown-binding.linux-loong64-musl.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-loong64-musl`),t=I(`@rolldown/binding-linux-loong64-musl/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else{try{return I(`./rolldown-binding.linux-loong64-gnu.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-loong64-gnu`),t=I(`@rolldown/binding-linux-loong64-gnu/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`riscv64`)if(a()){try{return I(`./rolldown-binding.linux-riscv64-musl.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-riscv64-musl`),t=I(`@rolldown/binding-linux-riscv64-musl/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else{try{return I(`./rolldown-binding.linux-riscv64-gnu.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-riscv64-gnu`),t=I(`@rolldown/binding-linux-riscv64-gnu/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`ppc64`){try{return I(`./rolldown-binding.linux-ppc64-gnu.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-ppc64-gnu`),t=I(`@rolldown/binding-linux-ppc64-gnu/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`s390x`){try{return I(`./rolldown-binding.linux-s390x-gnu.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-linux-s390x-gnu`),t=I(`@rolldown/binding-linux-s390x-gnu/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else i.push(Error(`Unsupported architecture on Linux: ${process.arch}`));else if(process.platform===`openharmony`)if(process.arch===`arm64`){try{return I(`./rolldown-binding.openharmony-arm64.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-openharmony-arm64`),t=I(`@rolldown/binding-openharmony-arm64/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`x64`){try{return I(`./rolldown-binding.openharmony-x64.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-openharmony-x64`),t=I(`@rolldown/binding-openharmony-x64/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else if(process.arch===`arm`){try{return I(`./rolldown-binding.openharmony-arm.node`)}catch(e){i.push(e)}try{let e=I(`@rolldown/binding-openharmony-arm`),t=I(`@rolldown/binding-openharmony-arm/package.json`).version;if(t!==`1.0.0-rc.1`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 1.0.0-rc.1 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){i.push(e)}}else i.push(Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));else i.push(Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))}if(r=u(),!r||process.env.NAPI_RS_FORCE_WASI){let e=null,t=null;try{e=I(`../rolldown-binding.wasi.cjs`),r=e}catch(e){process.env.NAPI_RS_FORCE_WASI&&(t=e)}if(!r||process.env.NAPI_RS_FORCE_WASI)try{e=I(`@rolldown/binding-wasm32-wasi`),r=e}catch(e){process.env.NAPI_RS_FORCE_WASI&&(t?t.cause=e:t=e,i.push(e))}if(process.env.NAPI_RS_FORCE_WASI===`error`&&!e){let e=Error(`WASI binding not found and NAPI_RS_FORCE_WASI is set to error`);throw e.cause=t,e}}if(!r&&globalThis.process?.versions?.webcontainer)try{r=nd()}catch(e){i.push(e)}if(!r)throw i.length>0?Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.",{cause:i.reduce((e,t)=>(t.cause=e,t))}):Error(`Failed to load native binding`);t.exports=r,t.exports.minify=r.minify,t.exports.minifySync=r.minifySync,t.exports.Severity=r.Severity,t.exports.ParseResult=r.ParseResult,t.exports.ExportExportNameKind=r.ExportExportNameKind,t.exports.ExportImportNameKind=r.ExportImportNameKind,t.exports.ExportLocalNameKind=r.ExportLocalNameKind,t.exports.ImportNameKind=r.ImportNameKind,t.exports.parse=r.parse,t.exports.parseSync=r.parseSync,t.exports.rawTransferSupported=r.rawTransferSupported,t.exports.ResolverFactory=r.ResolverFactory,t.exports.EnforceExtension=r.EnforceExtension,t.exports.ModuleType=r.ModuleType,t.exports.sync=r.sync,t.exports.HelperMode=r.HelperMode,t.exports.isolatedDeclaration=r.isolatedDeclaration,t.exports.isolatedDeclarationSync=r.isolatedDeclarationSync,t.exports.moduleRunnerTransform=r.moduleRunnerTransform,t.exports.moduleRunnerTransformSync=r.moduleRunnerTransformSync,t.exports.transform=r.transform,t.exports.transformSync=r.transformSync,t.exports.BindingBundleEndEventData=r.BindingBundleEndEventData,t.exports.BindingBundleErrorEventData=r.BindingBundleErrorEventData,t.exports.BindingBundler=r.BindingBundler,t.exports.BindingCallableBuiltinPlugin=r.BindingCallableBuiltinPlugin,t.exports.BindingChunkingContext=r.BindingChunkingContext,t.exports.BindingDecodedMap=r.BindingDecodedMap,t.exports.BindingDevEngine=r.BindingDevEngine,t.exports.BindingMagicString=r.BindingMagicString,t.exports.BindingModuleInfo=r.BindingModuleInfo,t.exports.BindingNormalizedOptions=r.BindingNormalizedOptions,t.exports.BindingOutputAsset=r.BindingOutputAsset,t.exports.BindingOutputChunk=r.BindingOutputChunk,t.exports.BindingPluginContext=r.BindingPluginContext,t.exports.BindingRenderedChunk=r.BindingRenderedChunk,t.exports.BindingRenderedChunkMeta=r.BindingRenderedChunkMeta,t.exports.BindingRenderedModule=r.BindingRenderedModule,t.exports.BindingSourceMap=r.BindingSourceMap,t.exports.BindingTransformPluginContext=r.BindingTransformPluginContext,t.exports.BindingWatcher=r.BindingWatcher,t.exports.BindingWatcherBundler=r.BindingWatcherBundler,t.exports.BindingWatcherChangeData=r.BindingWatcherChangeData,t.exports.BindingWatcherEvent=r.BindingWatcherEvent,t.exports.ParallelJsPluginRegistry=r.ParallelJsPluginRegistry,t.exports.ScheduledBuild=r.ScheduledBuild,t.exports.TraceSubscriberGuard=r.TraceSubscriberGuard,t.exports.BindingAttachDebugInfo=r.BindingAttachDebugInfo,t.exports.BindingBuiltinPluginName=r.BindingBuiltinPluginName,t.exports.BindingChunkModuleOrderBy=r.BindingChunkModuleOrderBy,t.exports.BindingLogLevel=r.BindingLogLevel,t.exports.BindingPluginOrder=r.BindingPluginOrder,t.exports.BindingPropertyReadSideEffects=r.BindingPropertyReadSideEffects,t.exports.BindingPropertyWriteSideEffects=r.BindingPropertyWriteSideEffects,t.exports.BindingRebuildStrategy=r.BindingRebuildStrategy,t.exports.createTokioRuntime=r.createTokioRuntime,t.exports.FilterTokenKind=r.FilterTokenKind,t.exports.initTraceSubscriber=r.initTraceSubscriber,t.exports.registerPlugins=r.registerPlugins,t.exports.shutdownAsyncRuntime=r.shutdownAsyncRuntime,t.exports.startAsyncRuntime=r.startAsyncRuntime}));function id(e){let t=``;for(;e--;)t+=` `;return t}function ad(e){return e.replace(/^\t+/,e=>e.split(` `).join(` `))}function od(e,t,n){let r=e.split(`
75
+ `);if(t>r.length)return``;let i=Math.max(ad(r[t-1].slice(0,n)).length+10+3,120),a=Math.max(0,t-3),o=Math.min(t+2,r.length);for(r=r.slice(a,o);!/\S/.test(r[r.length-1]);)r.pop(),--o;let s=String(o).length;return r.map((e,r)=>{let o=a+r+1===t,c=String(r+a+1);for(;c.length<s;)c=` ${c}`;let l=ad(e);if(l.length>i&&(l=`${l.slice(0,i-3)}...`),o){let t=id(s+2+ad(e.slice(0,n)).length)+`^`;return`${c}: ${l}\n${t}`}return`${c}: ${l}`}).join(`
76
+ `)}function sd(e,t){return e.start<=t&&t<e.end}function cd(e,t={}){let{offsetLine:n=0,offsetColumn:r=0}=t,i=0,a=e.split(`
77
+ `).map((e,t)=>{let n=i+e.length+1,r={start:i,end:n,line:t};return i=n,r}),o=0;function s(t,i){if(typeof t==`string`&&(t=e.indexOf(t,i??0)),t===-1)return;let s=a[o],c=t>=s.end?1:-1;for(;s;){if(sd(s,t))return{line:n+s.line,column:r+t-s.start,character:t};o+=c,s=a[o]}}return s}function ld(e,t,n){return cd(e,n)(t,n&&n.startIndex)}function ud(e,t,n){return{code:`PARSE_ERROR`,id:t,message:e,pos:n}}function dd(e){return{code:`INVALID_LOG_POSITION`,message:`Plugin "${e}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`}}function fd(e,t){return{code:`INPUT_HOOK_IN_OUTPUT_PLUGIN`,message:`The "${t}" hook used by the output plugin ${e} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`}}function pd(e,t){return{code:`CYCLE_LOADING`,message:`Found the module "${t}" cycle loading at ${e} plugin, it maybe blocking fetching modules.`}}function md(){return{code:`MULTIPLY_NOTIFY_OPTION`,message:`Found multiply notify option at watch options, using first one to start notify watcher.`}}function hd(e,t,{hook:n,id:r}={}){try{let i=e.code;!e.pluginCode&&i!=null&&(typeof i!=`string`||!i.startsWith(`PLUGIN_`))&&(e.pluginCode=i),e.code=`PLUGIN_ERROR`,e.plugin=t,n&&(e.hook=n),r&&(e.id=r)}catch{}finally{return e}}function gd(e){throw e instanceof Error||(e=Object.assign(Error(e.message),e),Object.defineProperty(e,`name`,{value:`RollupError`,writable:!0})),e}function _d(e,t,n,r){if(typeof t==`object`){let{line:n,column:i}=t;e.loc={column:i,file:r,line:n}}else{e.pos=t;let i=ld(n,t,{offsetLine:1});if(!i)return;let{line:a,column:o}=i;e.loc={column:o,file:r,line:a}}if(e.frame===void 0){let{line:t,column:r}=e.loc;e.frame=od(n,t,r)}}rd();var vd=class{enforce;constructor(e,t){this.name=e,this._options=t}};function yd(e){return{__name:e.name,options:e._options}}function bd(e,t){let{isOutputOptionsForLegacyChunks:n,...r}=e._options;return{__name:e.name,options:{...r,isLegacy:n?e=>n(t.getOutputOptions(e)):void 0}}}function xd(e){if(e)return Sd(e)?e:[e]}function Sd(e){return Array.isArray(e)}function Cd(e){let t,n,r,i;return{get program(){return t||=wd(e.program),t},get module(){return n||=e.module,n},get comments(){return r||=e.comments,r},get errors(){return i||=e.errors,i}}}function wd(e){let{node:t,fixes:n}=JSON.parse(e);for(let e of n)Td(t,e);return t}function Td(e,t){let n=e;for(let e of t)n=n[e];if(n.bigint)n.value=BigInt(n.bigint);else try{n.value=RegExp(n.regex.pattern,n.regex.flags)}catch{}}var Ed=td(rd(),1);function Dd(e,t,n){return Cd((0,Ed.parseSync)(e,t,n))}function Od(e,t,n){return e.errors.length>0?kd(t,n,e.errors):e.program}function kd(e,t,n){let r=`Parse failed with ${n.length} error${n.length<2?``:`s`}:\n`,i=n[0]?.labels?.[0]?.start;for(let e=0;e<n.length;e++){if(e>=5){r+=`
78
+ ...`;break}let i=n[e];r+=i.message+`
79
+ `+i.labels.map(e=>{let n=ld(t,e.start,{offsetLine:1});if(n)return od(t,n.line,n.column)}).filter(Boolean).join(`
80
+ `)}let a=ud(r,e,i);return i!==void 0&&e&&_d(a,i,t,e),gd(a)}const Ad={lang:`js`,preserveParens:!1};function jd(e,t,n){return Od(Dd(n??`file.js`,e,{...Ad,...t}),n,e)}var Md=class{kind;args;constructor(...e){if(e.length===0)throw Error("`And` expects at least one operand");this.args=e,this.kind=`and`}},Nd=class{kind;args;constructor(...e){if(e.length===0)throw Error("`Or` expects at least one operand");this.args=e,this.kind=`or`}},Pd=class{kind;pattern;params;constructor(e,t){this.pattern=e,this.kind=`id`,this.params=t??{cleanUrl:!1}}},Fd=class{kind;pattern;constructor(e){this.pattern=e,this.kind=`moduleType`}},Id=class{kind;pattern;constructor(e){this.pattern=e,this.kind=`code`}},Ld=class{kind;expr;constructor(e){this.expr=e,this.kind=`include`}},Rd=class{kind;expr;constructor(e){this.expr=e,this.kind=`exclude`}};function zd(...e){return new Md(...e)}function Bd(...e){return new Nd(...e)}function Vd(e,t){return new Pd(e,t)}function Hd(e){return new Fd(e)}function Ud(e){return new Id(e)}function Wd(e){return new Ld(e)}function Gd(e){return new Rd(e)}const Kd=`1.0.0-rc.1`,qd=`warn`,Jd=`info`,Yd=`debug`,Xd={[Yd]:0,[Jd]:1,[qd]:2,silent:3},Zd=e=>typeof e==`string`?{message:e}:typeof e==`function`?Zd(e()):e;function Qd(e,t,n,r,i){return Xd[e]<Xd[i]?xu:(i,a)=>{a!=null&&n(qd,dd(r)),i=Zd(i),i.code&&!i.pluginCode&&(i.pluginCode=i.code),i.code=t,i.plugin=r,n(e,i)}}function $d(e){if(typeof e==`function`||typeof e==`string`)return{handler:e,options:{},meta:{}};if(typeof e==`object`&&e){let{handler:t,order:n,...r}=e;return{handler:t,options:r,meta:{order:n}}}yu(`Invalid hook type`)}var ef=class{info;warn;debug;meta;constructor(e,t,n,r,i){this.pluginName=n,this.hookName=i,this.debug=Qd(Yd,`PLUGIN_LOG`,e,n,t),this.info=Qd(Jd,`PLUGIN_LOG`,e,n,t),this.warn=Qd(qd,`PLUGIN_WARNING`,e,n,t),this.meta={rollupVersion:`4.23.0`,rolldownVersion:Kd,watchMode:r}}error(e){return gd(hd(Zd(e),this.pluginName,{hook:this.hookName}))}};const tf=Symbol(`__lazy_fields__`);var nf=class{constructor(){rf(this)}};function rf(e){let t=e.constructor[tf];if(t)for(let[n,r]of t.entries()){let t,i=!1;Object.defineProperty(e,n,{get(){return i||=(t=r.call(this),!0),t},enumerable:!0,configurable:!0})}}function af(e){let t=e.constructor[tf];return t?new Set(t.keys()):new Set}function L(e,t,n){e.constructor[tf]||(e.constructor[tf]=new Map);let r=n.get;return e.constructor[tf].set(t,r),{enumerable:!1,configurable:!0}}function of(e){return e.inner}function sf(e){return{inner:e}}function R(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var cf=class extends nf{type=`asset`;constructor(e){super(),this.bindingAsset=e}get fileName(){return this.bindingAsset.getFileName()}get originalFileName(){return this.bindingAsset.getOriginalFileName()||null}get originalFileNames(){return this.bindingAsset.getOriginalFileNames()}get name(){return this.bindingAsset.getName()??void 0}get names(){return this.bindingAsset.getNames()}get source(){return of(this.bindingAsset.getSource())}__rolldown_external_memory_handle__(e){return e&&this.#e(),this.bindingAsset.dropInner()}#e(){for(let e of af(this))this[e]}};R([L],cf.prototype,`fileName`,null),R([L],cf.prototype,`originalFileName`,null),R([L],cf.prototype,`originalFileNames`,null),R([L],cf.prototype,`name`,null),R([L],cf.prototype,`names`,null),R([L],cf.prototype,`source`,null);function lf(e){return{get code(){return e.code},get renderedLength(){return e.code?.length||0},get renderedExports(){return e.renderedExports}}}function uf(e){let t=null;return{type:`chunk`,get name(){return e.name},get isEntry(){return e.isEntry},get isDynamicEntry(){return e.isDynamicEntry},get facadeModuleId(){return e.facadeModuleId},get moduleIds(){return e.moduleIds},get exports(){return e.exports},get fileName(){return e.fileName},get imports(){return e.imports},get dynamicImports(){return e.dynamicImports},get modules(){return t||=df(e.modules),t}}}function df(e){let t={};for(let n=0;n<e.values.length;n++){let r=e.keys[n],i=e.values[n];t[r]=lf(i)}return t}var ff=class extends nf{type=`chunk`;constructor(e){super(),this.bindingChunk=e}get fileName(){return this.bindingChunk.getFileName()}get name(){return this.bindingChunk.getName()}get exports(){return this.bindingChunk.getExports()}get isEntry(){return this.bindingChunk.getIsEntry()}get facadeModuleId(){return this.bindingChunk.getFacadeModuleId()||null}get isDynamicEntry(){return this.bindingChunk.getIsDynamicEntry()}get sourcemapFileName(){return this.bindingChunk.getSourcemapFileName()||null}get preliminaryFileName(){return this.bindingChunk.getPreliminaryFileName()}get code(){return this.bindingChunk.getCode()}get modules(){return df(this.bindingChunk.getModules())}get imports(){return this.bindingChunk.getImports()}get dynamicImports(){return this.bindingChunk.getDynamicImports()}get moduleIds(){return this.bindingChunk.getModuleIds()}get map(){let e=this.bindingChunk.getMap();return e?mf(e):null}__rolldown_external_memory_handle__(e){return e&&this.#e(),this.bindingChunk.dropInner()}#e(){for(let e of af(this))this[e]}};R([L],ff.prototype,`fileName`,null),R([L],ff.prototype,`name`,null),R([L],ff.prototype,`exports`,null),R([L],ff.prototype,`isEntry`,null),R([L],ff.prototype,`facadeModuleId`,null),R([L],ff.prototype,`isDynamicEntry`,null),R([L],ff.prototype,`sourcemapFileName`,null),R([L],ff.prototype,`preliminaryFileName`,null),R([L],ff.prototype,`code`,null),R([L],ff.prototype,`modules`,null),R([L],ff.prototype,`imports`,null),R([L],ff.prototype,`dynamicImports`,null),R([L],ff.prototype,`moduleIds`,null),R([L],ff.prototype,`map`,null);function pf(e){if(e!=null)return{inner:typeof e==`string`?e:{file:e.file??void 0,mappings:e.mappings,sourceRoot:`sourceRoot`in e?e.sourceRoot??void 0:void 0,sources:e.sources?.map(e=>e??void 0),sourcesContent:e.sourcesContent?.map(e=>e??void 0),names:e.names,x_google_ignoreList:e.x_google_ignoreList,debugId:`debugId`in e?e.debugId:void 0}}}function mf(e){let t={...JSON.parse(e),toString(){return JSON.stringify(t)},toUrl(){return`data:application/json;charset=utf-8;base64,${Buffer.from(t.toString(),`utf-8`).toString(`base64`)}`}};return t}function hf(e){return new ff(e)}function gf(e,t){let n={type:`chunk`,get code(){return e.getCode()},fileName:e.getFileName(),name:e.getName(),get modules(){return df(e.getModules())},get imports(){return e.getImports()},get dynamicImports(){return e.getDynamicImports()},exports:e.getExports(),isEntry:e.getIsEntry(),facadeModuleId:e.getFacadeModuleId()||null,isDynamicEntry:e.getIsDynamicEntry(),get moduleIds(){return e.getModuleIds()},get map(){let t=e.getMap();return t?mf(t):null},sourcemapFileName:e.getSourcemapFileName()||null,preliminaryFileName:e.getPreliminaryFileName()},r={};return new Proxy(n,{get(e,t){if(t in r)return r[t];let n=e[t];return r[t]=n,n},set(n,i,a){return r[i]=a,t.updated.add(e.getFileName()),!0},has(e,t){return t in r?!0:t in e}})}function _f(e){return new cf(e)}function vf(e,t){let n={type:`asset`,fileName:e.getFileName(),originalFileName:e.getOriginalFileName()||null,originalFileNames:e.getOriginalFileNames(),get source(){return of(e.getSource())},name:e.getName()??void 0,names:e.getNames()},r={};return new Proxy(n,{get(e,t){if(t in r)return r[t];let n=e[t];return r[t]=n,n},set(n,i,a){return r[i]=a,t.updated.add(e.getFileName()),!0}})}function yf(e){let{chunks:t,assets:n}=e;return{output:[...t.map(e=>hf(e)),...n.map(e=>_f(e))]}}function bf(e,t){let{chunks:n,assets:r}=e;return{output:[...n.map(e=>gf(e,t)),...r.map(e=>vf(e,t))]}}function xf(e,t,n){let r=Object.fromEntries(bf(t,n).output.map(e=>[e.fileName,e]));return new Proxy(r,{set(t,n,r,i){let a=Error.stackTraceLimit;Error.stackTraceLimit=2;let o=`This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.`,s=Error(o).stack??o;return Error.stackTraceLimit=a,e.warn({message:s,code:`UNSUPPORTED_BUNDLE_ASSIGNMENT`}),!0},deleteProperty(e,t){return typeof t==`string`&&n.deleted.add(t),!0}})}function Sf(e,t){let n={};for(let r in t){if(e.deleted.has(r)||!e.updated.has(r))continue;let i=t[r];i.type===`asset`?n[r]={filename:i.fileName,originalFileNames:i.originalFileNames,source:sf(i.source),names:i.names}:n[r]={code:i.code,filename:i.fileName,name:i.name,isEntry:i.isEntry,exports:i.exports,modules:{},imports:i.imports,dynamicImports:i.dynamicImports,facadeModuleId:i.facadeModuleId||void 0,isDynamicEntry:i.isDynamicEntry,moduleIds:i.moduleIds,map:pf(i.map),sourcemapFilename:i.sourcemapFileName||void 0,preliminaryFilename:i.preliminaryFileName}}return{changes:n,deleted:e.deleted}}var Cf=td(rd(),1);function wf(e){if(typeof e==`object`&&e&&`isBindingErrors`in e&&e.isBindingErrors)throw Ef(e.errors);return e}function Tf(e){return e.type===`JsError`?e.field0:Object.assign(Error(),{code:e.field0.kind,kind:e.field0.kind,message:e.field0.message,id:e.field0.id,exporter:e.field0.exporter,loc:e.field0.loc,pos:e.field0.pos,stack:void 0})}function Ef(e){let t=e.map(Tf),n=`Build failed with ${t.length} error${t.length<2?``:`s`}:\n`;for(let e=0;e<t.length;e++){if(n+=`
81
+ `,e>=5){n+=`...`;break}n+=Df(t[e])}let r=Error(n);return Object.defineProperty(r,`errors`,{configurable:!0,enumerable:!0,get:()=>t,set:e=>Object.defineProperty(r,`errors`,{configurable:!0,enumerable:!0,value:e})}),r}function Df(e){if(Object.hasOwn(e,`kind`))return e.message;let t=``;e.plugin&&(t+=`[plugin ${e.plugin}]`);let n=e.id??e.loc?.file;n&&(t+=` `+n,e.loc&&(t+=`:${e.loc.line}:${e.loc.column}`)),t&&(t+=`
82
+ `);let r=`${e.name??`Error`}: ${e.message}`;return t+=r,e.frame&&(t=Of(t,e.frame)),e.stack&&(t=Of(t,e.stack.replace(r,``))),e.cause&&(t=Of(t,`Caused by:`),t=Of(t,Df(e.cause).split(`
83
+ `).map(e=>` `+e).join(`
84
+ `))),t}function Of(e,t){return e.replace(/\n+$/,``)+`
85
+ `+t.replace(/^\n+/,``)}function kf(e,t){return{get ast(){return bu(`ModuleInfo#ast`)},get code(){return e.code},id:e.id,importers:e.importers,dynamicImporters:e.dynamicImporters,importedIds:e.importedIds,dynamicallyImportedIds:e.dynamicallyImportedIds,exports:e.exports,isEntry:e.isEntry,...t}}function Af(e){return!e||e.length===0||!e[0]}function jf(e,t,n){if(!n)return;let r=typeof n==`object`?n:JSON.parse(n);return Af(r.sourcesContent)&&(r.sourcesContent=[t]),(Af(r.sources)||r.sources&&r.sources.length===1&&r.sources[0]!==e)&&(r.sources=[e]),r}function Mf(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}function Nf(e,t,n){let r=e.length-t.length;if(r===0)return e(...t);if(r===1)return Mf(e,t,n);throw Error(`Wrong number of arguments`)}function Pf(...e){return Nf(Ff,e)}const Ff=(e,t)=>{let n=[[],[]];for(let[r,i]of e.entries())t(i,r,e)?n[0].push(i):n[1].push(i);return n};function If(e,t){if(typeof e==`string`||e instanceof RegExp)return[Wd(Lf(t,e))];if(Array.isArray(e))return e.map(e=>Wd(Lf(t,e)));let n=[];return e.exclude&&n.push(..._u(e.exclude).map(e=>Gd(Lf(t,e)))),e.include&&n.push(..._u(e.include).map(e=>Wd(Lf(t,e)))),n}function Lf(e,t){return e===`code`?Ud(t):Vd(t)}function Rf(e){if(!e)return;if(Array.isArray(e))return e;let{id:t,code:n,moduleType:r}=e,i=[],a=[],o=[],s=[],c=[];t&&([a,o]=Pf(If(t,`id`)??[],e=>e.kind===`include`)),n&&([s,c]=Pf(If(n,`code`)??[],e=>e.kind===`include`)),i.push(...o),i.push(...c);let l=[];if(r){let e=Array.isArray(r)?r:r.include??[];l.push(Bd(...e.map(e=>Hd(e))))}return a.length&&l.push(Bd(...a.map(e=>e.expr))),s.length&&l.push(Bd(...s.map(e=>e.expr))),l.length&&i.push(Wd(zd(...l))),i}function zf(e,t){let n=If(t,e),r=[];return n&&(r=n.map(Bf)),r.length>0?{value:r}:void 0}function Bf(e){let t=[];return Uf(e,t),t}function Vf(e){switch(e.kind){case`and`:case`or`:return e.args.some(Vf);case`not`:case`include`:case`exclude`:return Vf(e.expr);case`importerId`:return!0;default:return!1}}function Hf(e,t){if(e?.some(Vf))throw Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${t}\` hook.`)}function Uf(e,t){switch(e.kind){case`and`:{let n=e.args;for(let e=n.length-1;e>=0;e--)Uf(n[e],t);t.push({kind:`And`,payload:n.length});break}case`or`:{let n=e.args;for(let e=n.length-1;e>=0;e--)Uf(n[e],t);t.push({kind:`Or`,payload:n.length});break}case`not`:Uf(e.expr,t),t.push({kind:`Not`});break;case`id`:t.push({kind:`Id`,payload:e.pattern}),e.params.cleanUrl&&t.push({kind:`CleanUrl`});break;case`importerId`:t.push({kind:`ImporterId`,payload:e.pattern}),e.params.cleanUrl&&t.push({kind:`CleanUrl`});break;case`moduleType`:t.push({kind:`ModuleType`,payload:e.pattern});break;case`code`:t.push({kind:`Code`,payload:e.pattern});break;case`include`:Uf(e.expr,t),t.push({kind:`Include`});break;case`exclude`:Uf(e.expr,t),t.push({kind:`Exclude`});break;case`query`:t.push({kind:`QueryKey`,payload:e.key}),t.push({kind:`QueryValue`,payload:e.pattern});break;default:throw Error(`Unknown filter expression: ${e}`)}}function Wf(e){if(e)return Array.isArray(e)?{value:e.map(Bf)}:e.id?zf(`id`,e.id):void 0}function Gf(e){if(e)return Array.isArray(e)?(Hf(e,`load`),{value:e.map(Bf)}):e.id?zf(`id`,e.id):void 0}function Kf(e){if(!e)return;let t=Rf(e);Hf(t,`transform`);let n=[];return t&&(n=t.map(Bf)),{value:n.length>0?n:void 0}}function qf(e){if(e)return Array.isArray(e)?(Hf(e,`renderChunk`),{value:e.map(Bf)}):e.code?zf(`code`,e.code):void 0}function Jf(e){return{order:Yf(e.order)}}function Yf(e){switch(e){case`post`:return Cf.BindingPluginOrder.Post;case`pre`:return Cf.BindingPluginOrder.Pre;case null:case void 0:return;default:throw Error(`Unknown plugin order: ${e}`)}}const Xf={appendFile:C.appendFile,copyFile:C.copyFile,mkdir:C.mkdir,mkdtemp:C.mkdtemp,readdir:C.readdir,readFile:C.readFile,realpath:C.realpath,rename:C.rename,rmdir:C.rmdir,stat:C.stat,lstat:C.lstat,unlink:C.unlink,writeFile:C.writeFile};var Zf=class extends ef{fs=Xf;getModuleInfo;constructor(e,t,n,r,i,a,o,s){super(i,a,n.name,o),this.outputOptions=e,this.context=t,this.data=r,this.onLog=i,this.currentLoadingModule=s,this.getModuleInfo=e=>this.data.getModuleInfo(e,t)}async load(e){let t=e.id;t===this.currentLoadingModule&&this.onLog(qd,pd(this.pluginName,this.currentLoadingModule));let n=this.data.getModuleInfo(t,this.context);if(n&&n.code!==null)return n;let r={meta:e.meta||{},moduleSideEffects:e.moduleSideEffects||null,invalidate:!1};this.data.updateModuleOption(t,r);let i=this.data.loadModulePromiseMap.get(t);return i||(i=this.context.load(t,e.moduleSideEffects??void 0,e.packageJsonPath??void 0).catch(()=>{this.data.loadModulePromiseMap.delete(t)}),this.data.loadModulePromiseMap.set(t,i)),await i,this.data.getModuleInfo(t,this.context)}async resolve(e,t,n){let r;n!=null&&(r=this.data.saveResolveOptions(n));let i=Object.entries(n?.custom??{}).reduce((e,[t,n])=>(t.startsWith(`vite:`)&&((e??={})[t]=n),e),void 0),a=await this.context.resolve(e,t,{importKind:n?.kind,custom:r,isEntry:n?.isEntry,skipSelf:n?.skipSelf,vitePluginCustom:i});if(r!=null&&this.data.removeSavedResolveOptions(r),a==null)return null;let o=this.data.getModuleOption(a.id)||{};return{...a,external:a.external===`relative`?yu(`The PluginContext resolve result external couldn't be 'relative'`):a.external,...o,moduleSideEffects:o.moduleSideEffects??a.moduleSideEffects??null,packageJsonPath:a.packageJsonPath}}emitFile=e=>{if(e.type===`prebuilt-chunk`)return this.context.emitPrebuiltChunk({fileName:e.fileName,code:e.code,exports:e.exports,map:pf(e.map),sourcemapFileName:e.sourcemapFileName});if(e.type===`chunk`)return this.context.emitChunk({preserveEntrySignatures:Vp(e.preserveSignature),...e});let t=e.fileName||typeof this.outputOptions.sanitizeFileName!=`function`?void 0:this.outputOptions.sanitizeFileName(e.name||`asset`),n=e.fileName?void 0:this.getAssetFileNames(e);return this.context.emitFile({...e,originalFileName:e.originalFileName||void 0,source:sf(e.source)},n,t)};getAssetFileNames(e){if(typeof this.outputOptions.assetFileNames==`function`)return this.outputOptions.assetFileNames({type:`asset`,name:e.name,names:e.name?[e.name]:[],originalFileName:e.originalFileName,originalFileNames:e.originalFileName?[e.originalFileName]:[],source:e.source})}getFileName(e){return this.context.getFileName(e)}getModuleIds(){return this.data.getModuleIds(this.context)}addWatchFile(e){this.context.addWatchFile(e)}parse(e,t){return jd(e,t)}},Qf=class extends Zf{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,s,c,l,a),this.inner=i,this.moduleId=a,this.moduleSource=o;let u=e=>(t,n)=>{t=Zd(t),n&&_d(t,n,o,a),t.id=a,t.hook=`transform`,e(t)};this.debug=u(this.debug),this.warn=u(this.warn),this.info=u(this.info)}error(e,t){return typeof e==`string`&&(e={message:e}),t&&_d(e,t,this.moduleSource,this.moduleId),e.id=this.moduleId,e.hook=`transform`,gd(hd(Zd(e),this.pluginName))}getCombinedSourcemap(){return JSON.parse(this.inner.getCombinedSourcemap())}addWatchFile(e){this.inner.addWatchFile(e)}sendMagicString(e){this.inner.sendMagicString(e)}};function $f(e){let t=e.plugin.buildStart;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>{await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),e.pluginContextData.getInputOptions(r))},meta:Jf(r)}}function ep(e){let t=e.plugin.buildEnd;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>{await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),r?Ef(r):void 0)},meta:Jf(r)}}function tp(e){let t=e.plugin.resolveId;if(!t)return{};let{handler:n,meta:r,options:i}=$d(t);return{plugin:async(t,r,i,a)=>{let o=a.custom==null?void 0:e.pluginContextData.getSavedResolveOptions(a.custom),s=await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),r,i??void 0,{...a,custom:o?.custom});if(s==null)return;if(s===!1)return{id:r,external:!0,normalizeExternalId:!0};if(typeof s==`string`)return{id:s,normalizeExternalId:!1};let c=e.pluginContextData.updateModuleOption(s.id,{meta:s.meta||{},moduleSideEffects:s.moduleSideEffects??null,invalidate:!1});return{id:s.id,external:s.external,normalizeExternalId:!1,moduleSideEffects:c.moduleSideEffects??void 0,packageJsonPath:s.packageJsonPath}},meta:Jf(r),filter:Wf(i.filter)}}function np(e){let t=e.plugin.resolveDynamicImport;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r,i)=>{let a=await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),r,i??void 0);if(a==null)return;if(a===!1)return{id:r,external:!0};if(typeof a==`string`)return{id:a};let o={id:a.id,external:a.external,packageJsonPath:a.packageJsonPath};return a.moduleSideEffects!==null&&(o.moduleSideEffects=a.moduleSideEffects),e.pluginContextData.updateModuleOption(a.id,{meta:a.meta||{},moduleSideEffects:a.moduleSideEffects||null,invalidate:!1}),o},meta:Jf(r)}}function rp(e){let t=e.plugin.transform;if(!t)return{};let{handler:n,meta:r,options:i}=$d(t);return{plugin:async(t,r,i,a)=>{let o,s;Object.defineProperties(a,{magicString:{get(){return o||(o=new Cf.BindingMagicString(r),o)}},ast:{get(){if(s)return s;let e=`js`;switch(a.moduleType){case`js`:case`jsx`:case`ts`:case`tsx`:e=a.moduleType;break;default:break}return s=jd(r,{astType:a.moduleType.includes(`ts`)?`ts`:`js`,lang:e}),s}}});let c=new Qf(e.outputOptions,t.inner(),e.plugin,e.pluginContextData,t,i,r,e.onLog,e.logLevel,e.watchMode),l=await n.call(c,r,i,a);if(l==null)return;if(typeof l==`string`)return{code:l};let u=e.pluginContextData.updateModuleOption(i,{meta:l.meta??{},moduleSideEffects:l.moduleSideEffects??null,invalidate:!1}),d,f=l.map;if(typeof l.code==`string`)d=l.code;else if(l.code instanceof Cf.BindingMagicString){let e=l.code;d=e.toString();let n=t.sendMagicString(e);n!=null&&(f=n)}return{code:d,map:pf(jf(i,r,f)),moduleSideEffects:u.moduleSideEffects??void 0,moduleType:l.moduleType}},meta:Jf(r),filter:Kf(i.filter)}}function ip(e){let t=e.plugin.load;if(!t)return{};let{handler:n,meta:r,options:i}=$d(t);return{plugin:async(t,r)=>{let i=await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode,r),r);if(i==null)return;if(typeof i==`string`)return{code:i};let a=e.pluginContextData.updateModuleOption(r,{meta:i.meta||{},moduleSideEffects:i.moduleSideEffects??null,invalidate:!1}),o=ap(i,r);return{code:i.code,map:pf(o),moduleType:i.moduleType,moduleSideEffects:a.moduleSideEffects??void 0}},meta:Jf(r),filter:Gf(i.filter)}}function ap(e,t){if(!e.map)return;let n=typeof e.map==`object`?e.map:JSON.parse(e.map);if(!Af(n.sources)){let e=i.dirname(t)||`.`,r=n.sourceRoot||`.`;n.sources=n.sources.map(t=>i.resolve(e,r,t))}return n}function op(e){let t=e.plugin.moduleParsed;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>{await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),kf(r,e.pluginContextData.getModuleOption(r.id)))},meta:Jf(r)}}function sp(e){let t=e.plugin.renderStart;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>{n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),e.pluginContextData.getOutputOptions(r),e.pluginContextData.getInputOptions(r))},meta:Jf(r)}}function cp(e){let t=e.plugin.renderChunk;if(!t)return{};let{handler:n,meta:r,options:i}=$d(t);return{plugin:async(t,r,i,a,o)=>{e.pluginContextData.getRenderChunkMeta()??e.pluginContextData.setRenderChunkMeta({chunks:Object.fromEntries(Object.entries(o.chunks).map(([e,t])=>[e,uf(t)]))});let s=e.pluginContextData.getRenderChunkMeta(),c;e.options.experimental?.nativeMagicString&&Object.defineProperty(s,`magicString`,{get(){return c||(c=new Cf.BindingMagicString(r),c)},configurable:!0});let l=await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),r,uf(i),e.pluginContextData.getOutputOptions(a),s);if(l!=null){if(l instanceof Cf.BindingMagicString){let e=l.toString(),t=l.generateMap();return{code:e,map:pf({file:t.file,mappings:t.mappings,names:t.names,sources:t.sources,sourcesContent:t.sourcesContent.map(e=>e??null)})}}if(typeof l==`string`)return{code:l};if(l.code instanceof Cf.BindingMagicString){let e=l.code,t=e.toString();if(l.map===null)return{code:t};if(l.map===void 0){let n=e.generateMap();return{code:t,map:pf({file:n.file,mappings:n.mappings,names:n.names,sources:n.sources,sourcesContent:n.sourcesContent.map(e=>e??null)})}}return{code:t,map:pf(l.map)}}return l.map?{code:l.code,map:pf(l.map)}:{code:l.code}}},meta:Jf(r),filter:qf(i.filter)}}function lp(e){let t=e.plugin.augmentChunkHash;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),uf(r)),meta:Jf(r)}}function up(e){let t=e.plugin.renderError;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>{n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),Ef(r))},meta:Jf(r)}}function dp(e){let t=e.plugin.generateBundle;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r,i,a)=>{let o={updated:new Set,deleted:new Set},s=new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),c=xf(s,wf(r),o);return await n.call(s,e.pluginContextData.getOutputOptions(a),c,i),Sf(o,c)},meta:Jf(r)}}function fp(e){let t=e.plugin.writeBundle;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r,i)=>{let a={updated:new Set,deleted:new Set},o=new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),s=xf(o,wf(r),a);return await n.call(o,e.pluginContextData.getOutputOptions(i),s),Sf(a,s)},meta:Jf(r)}}function pp(e){let t=e.plugin.closeBundle;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>{await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),r?Ef(r):void 0)},meta:Jf(r)}}function mp(e){let t=e.plugin.banner;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>typeof n==`string`?n:n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),uf(r)),meta:Jf(r)}}function hp(e){let t=e.plugin.footer;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>typeof n==`string`?n:n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),uf(r)),meta:Jf(r)}}function gp(e){let t=e.plugin.intro;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>typeof n==`string`?n:n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),uf(r)),meta:Jf(r)}}function _p(e){let t=e.plugin.outro;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r)=>typeof n==`string`?n:n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),uf(r)),meta:Jf(r)}}function vp(e){let t=e.plugin.watchChange;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async(t,r,i)=>{await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode),r,{event:i})},meta:Jf(r)}}function yp(e){let t=e.plugin.closeWatcher;if(!t)return{};let{handler:n,meta:r}=$d(t);return{plugin:async t=>{await n.call(new Zf(e.outputOptions,t,e.plugin,e.pluginContextData,e.onLog,e.logLevel,e.watchMode))},meta:Jf(r)}}let bp=function(e){return e[e.buildStart=1]=`buildStart`,e[e.resolveId=2]=`resolveId`,e[e.resolveDynamicImport=4]=`resolveDynamicImport`,e[e.load=8]=`load`,e[e.transform=16]=`transform`,e[e.moduleParsed=32]=`moduleParsed`,e[e.buildEnd=64]=`buildEnd`,e[e.renderStart=128]=`renderStart`,e[e.renderError=256]=`renderError`,e[e.renderChunk=512]=`renderChunk`,e[e.augmentChunkHash=1024]=`augmentChunkHash`,e[e.generateBundle=2048]=`generateBundle`,e[e.writeBundle=4096]=`writeBundle`,e[e.closeBundle=8192]=`closeBundle`,e[e.watchChange=16384]=`watchChange`,e[e.closeWatcher=32768]=`closeWatcher`,e[e.transformAst=65536]=`transformAst`,e[e.banner=131072]=`banner`,e[e.footer=262144]=`footer`,e[e.intro=524288]=`intro`,e[e.outro=1048576]=`outro`,e}({});var xp=class{bitflag=BigInt(0);constructor(){}union(e){this.bitflag|=BigInt(e)}inner(){return Number(this.bitflag)}};function Sp(e){let t=new xp;return e.buildStart&&t.union(bp.buildStart),e.resolveId&&t.union(bp.resolveId),e.resolveDynamicImport&&t.union(bp.resolveDynamicImport),e.load&&t.union(bp.load),e.transform&&t.union(bp.transform),e.moduleParsed&&t.union(bp.moduleParsed),e.buildEnd&&t.union(bp.buildEnd),e.renderStart&&t.union(bp.renderStart),e.renderError&&t.union(bp.renderError),e.renderChunk&&t.union(bp.renderChunk),e.augmentChunkHash&&t.union(bp.augmentChunkHash),e.generateBundle&&t.union(bp.generateBundle),e.writeBundle&&t.union(bp.writeBundle),e.closeBundle&&t.union(bp.closeBundle),e.watchChange&&t.union(bp.watchChange),e.closeWatcher&&t.union(bp.closeWatcher),e.banner&&t.union(bp.banner),e.footer&&t.union(bp.footer),e.intro&&t.union(bp.intro),e.outro&&t.union(bp.outro),t}function Cp(e,t,n,r,i,a,o,s){let c={plugin:e,options:t,outputOptions:n,pluginContextData:r,onLog:a,logLevel:o,watchMode:s,normalizedOutputPlugins:i},{plugin:l,meta:u}=$f(c),{plugin:d,meta:f,filter:p}=tp(c),{plugin:m,meta:h}=np(c),{plugin:g,meta:_}=ep(c),{plugin:v,meta:ee,filter:y}=rp(c),{plugin:b,meta:x}=op(c),{plugin:te,meta:S,filter:ne}=ip(c),{plugin:re,meta:ie,filter:C}=cp(c),{plugin:ae,meta:w}=lp(c),{plugin:oe,meta:T}=sp(c),{plugin:se,meta:ce}=up(c),{plugin:E,meta:D}=dp(c),{plugin:le,meta:ue}=fp(c),{plugin:de,meta:O}=pp(c),{plugin:k,meta:A}=mp(c),{plugin:j,meta:fe}=hp(c),{plugin:pe,meta:me}=gp(c),{plugin:M,meta:he}=_p(c),{plugin:ge,meta:N}=vp(c),{plugin:P,meta:_e}=yp(c),ve=Sp(e).inner();return wp({name:e.name,buildStart:l,buildStartMeta:u,resolveId:d,resolveIdMeta:f,resolveIdFilter:p,resolveDynamicImport:m,resolveDynamicImportMeta:h,buildEnd:g,buildEndMeta:_,transform:v,transformMeta:ee,transformFilter:y,moduleParsed:b,moduleParsedMeta:x,load:te,loadMeta:S,loadFilter:ne,renderChunk:re,renderChunkMeta:ie,renderChunkFilter:C,augmentChunkHash:ae,augmentChunkHashMeta:w,renderStart:oe,renderStartMeta:T,renderError:se,renderErrorMeta:ce,generateBundle:E,generateBundleMeta:D,writeBundle:le,writeBundleMeta:ue,closeBundle:de,closeBundleMeta:O,banner:k,bannerMeta:A,footer:j,footerMeta:fe,intro:pe,introMeta:me,outro:M,outroMeta:he,watchChange:ge,watchChangeMeta:N,closeWatcher:P,closeWatcherMeta:_e,hookUsage:ve})}function wp(e){for(let t of[`buildStart`,`resolveId`,`resolveDynamicImport`,`buildEnd`,`transform`,`moduleParsed`,`load`,`renderChunk`,`augmentChunkHash`,`renderStart`,`renderError`,`generateBundle`,`writeBundle`,`closeBundle`,`banner`,`footer`,`intro`,`outro`,`watchChange`,`closeWatcher`]){let n=e[t];n&&(e[t]=async(...r)=>{try{return await n(...r)}catch(n){return gd(hd(n,e.name,{hook:t,id:t===`transform`?r[2]:void 0}))}})}return e}var Tp=class extends nf{inner;constructor(e,t){super(),this.onLog=t,this.inner=e}get shimMissingExports(){return this.inner.shimMissingExports}get input(){return this.inner.input}get cwd(){return this.inner.cwd}get platform(){return this.inner.platform}get context(){return this.inner.context}};R([L],Tp.prototype,`shimMissingExports`,null),R([L],Tp.prototype,`input`,null),R([L],Tp.prototype,`cwd`,null),R([L],Tp.prototype,`platform`,null),R([L],Tp.prototype,`context`,null);var z=class extends nf{constructor(e,t,n){super(),this.inner=e,this.outputOptions=t,this.normalizedOutputPlugins=n}get dir(){return this.inner.dir??void 0}get entryFileNames(){return this.inner.entryFilenames||this.outputOptions.entryFileNames}get chunkFileNames(){return this.inner.chunkFilenames||this.outputOptions.chunkFileNames}get assetFileNames(){return this.inner.assetFilenames||this.outputOptions.assetFileNames}get format(){return this.inner.format}get exports(){return this.inner.exports}get sourcemap(){return this.inner.sourcemap}get sourcemapBaseUrl(){return this.inner.sourcemapBaseUrl??void 0}get cssEntryFileNames(){return this.inner.cssEntryFilenames||this.outputOptions.cssEntryFileNames}get cssChunkFileNames(){return this.inner.cssChunkFilenames||this.outputOptions.cssChunkFileNames}get shimMissingExports(){return this.inner.shimMissingExports}get name(){return this.inner.name??void 0}get file(){return this.inner.file??void 0}get codeSplitting(){return this.inner.codeSplitting}get inlineDynamicImports(){return!this.inner.codeSplitting}get dynamicImportInCjs(){return this.inner.dynamicImportInCjs}get externalLiveBindings(){return this.inner.externalLiveBindings}get banner(){return Ep(this.outputOptions.banner)}get footer(){return Ep(this.outputOptions.footer)}get postBanner(){return Ep(this.outputOptions.postBanner)}get postFooter(){return Ep(this.outputOptions.postFooter)}get intro(){return Ep(this.outputOptions.intro)}get outro(){return Ep(this.outputOptions.outro)}get esModule(){return this.inner.esModule}get extend(){return this.inner.extend}get globals(){return this.inner.globals||this.outputOptions.globals}get paths(){return this.outputOptions.paths}get hashCharacters(){return this.inner.hashCharacters}get sourcemapDebugIds(){return this.inner.sourcemapDebugIds}get sourcemapIgnoreList(){return this.outputOptions.sourcemapIgnoreList}get sourcemapPathTransform(){return this.outputOptions.sourcemapPathTransform}get minify(){let e=this.inner.minify;return typeof e==`object`&&e&&(delete e.codegen,delete e.module,delete e.sourcemap),e}get legalComments(){return this.inner.legalComments}get polyfillRequire(){return this.inner.polyfillRequire}get plugins(){return this.normalizedOutputPlugins}get preserveModules(){return this.inner.preserveModules}get preserveModulesRoot(){return this.inner.preserveModulesRoot}get virtualDirname(){return this.inner.virtualDirname}get topLevelVar(){return this.inner.topLevelVar??!1}get minifyInternalExports(){return this.inner.minifyInternalExports??!1}};R([L],z.prototype,`dir`,null),R([L],z.prototype,`entryFileNames`,null),R([L],z.prototype,`chunkFileNames`,null),R([L],z.prototype,`assetFileNames`,null),R([L],z.prototype,`format`,null),R([L],z.prototype,`exports`,null),R([L],z.prototype,`sourcemap`,null),R([L],z.prototype,`sourcemapBaseUrl`,null),R([L],z.prototype,`cssEntryFileNames`,null),R([L],z.prototype,`cssChunkFileNames`,null),R([L],z.prototype,`shimMissingExports`,null),R([L],z.prototype,`name`,null),R([L],z.prototype,`file`,null),R([L],z.prototype,`codeSplitting`,null),R([L],z.prototype,`inlineDynamicImports`,null),R([L],z.prototype,`dynamicImportInCjs`,null),R([L],z.prototype,`externalLiveBindings`,null),R([L],z.prototype,`banner`,null),R([L],z.prototype,`footer`,null),R([L],z.prototype,`postBanner`,null),R([L],z.prototype,`postFooter`,null),R([L],z.prototype,`intro`,null),R([L],z.prototype,`outro`,null),R([L],z.prototype,`esModule`,null),R([L],z.prototype,`extend`,null),R([L],z.prototype,`globals`,null),R([L],z.prototype,`paths`,null),R([L],z.prototype,`hashCharacters`,null),R([L],z.prototype,`sourcemapDebugIds`,null),R([L],z.prototype,`sourcemapIgnoreList`,null),R([L],z.prototype,`sourcemapPathTransform`,null),R([L],z.prototype,`minify`,null),R([L],z.prototype,`legalComments`,null),R([L],z.prototype,`polyfillRequire`,null),R([L],z.prototype,`plugins`,null),R([L],z.prototype,`preserveModules`,null),R([L],z.prototype,`preserveModulesRoot`,null),R([L],z.prototype,`virtualDirname`,null),R([L],z.prototype,`topLevelVar`,null),R([L],z.prototype,`minifyInternalExports`,null);function Ep(e){return typeof e==`function`?e:()=>e||``}var Dp=class{moduleOptionMap=new Map;resolveOptionsMap=new Map;loadModulePromiseMap=new Map;renderedChunkMeta=null;normalizedInputOptions=null;normalizedOutputOptions=null;constructor(e,t,n){this.onLog=e,this.outputOptions=t,this.normalizedOutputPlugins=n}updateModuleOption(e,t){let n=this.moduleOptionMap.get(e);if(n)t.moduleSideEffects!=null&&(n.moduleSideEffects=t.moduleSideEffects),t.meta!=null&&Object.assign(n.meta,t.meta),t.invalidate!=null&&(n.invalidate=t.invalidate);else return this.moduleOptionMap.set(e,t),t;return n}getModuleOption(e){let t=this.moduleOptionMap.get(e);if(!t){let t={moduleSideEffects:null,meta:{}};return this.moduleOptionMap.set(e,t),t}return t}getModuleInfo(e,t){let n=t.getModuleInfo(e);if(n){let t=kf(n,this.getModuleOption(e));return this.proxyModuleInfo(e,t)}return null}proxyModuleInfo(e,t){let n=t.moduleSideEffects;return Object.defineProperty(t,`moduleSideEffects`,{get(){return n},set:r=>{this.updateModuleOption(e,{moduleSideEffects:r,meta:t.meta,invalidate:!0}),n=r}}),t}getModuleIds(e){return e.getModuleIds().values()}saveResolveOptions(e){let t=this.resolveOptionsMap.size;return this.resolveOptionsMap.set(t,e),t}getSavedResolveOptions(e){return this.resolveOptionsMap.get(e)}removeSavedResolveOptions(e){this.resolveOptionsMap.delete(e)}setRenderChunkMeta(e){this.renderedChunkMeta=e}getRenderChunkMeta(){return this.renderedChunkMeta}getInputOptions(e){return this.normalizedInputOptions??=new Tp(e,this.onLog),this.normalizedInputOptions}getOutputOptions(e){return this.normalizedOutputOptions??=new z(e,this.outputOptions,this.normalizedOutputPlugins),this.normalizedOutputOptions}clear(){this.renderedChunkMeta=null,this.loadModulePromiseMap.clear()}};function Op(e){let t=e.transform,n=t?.define?Object.entries(t.define):void 0,r=t?.inject,i=t?.dropLabels,a;if(t){let{define:e,inject:n,dropLabels:r,...i}=t;Object.keys(i).length>0&&(i.jsx===!1&&(i.jsx=`disable`),a=i)}return{define:n,inject:r,dropLabels:i,oxcTransformOptions:a}}function kp(e,t,n,r,i,a,o){let s=new Dp(i,n,r),c=e.map(e=>{if(!(`_parallel`in e)){if(e instanceof vd)switch(e.name){case`builtin:vite-manifest`:return bd(e,s);default:return yd(e)}return Cp(e,t,n,s,r,i,a,o)}}),l=Op(t);return{input:Lp(t.input),plugins:c,cwd:t.cwd??process.cwd(),external:Mp(t.external),resolve:Pp(t.resolve),platform:t.platform,shimMissingExports:t.shimMissingExports,logLevel:Ip(a),onLog:async(e,t)=>i(e,t),treeshake:zp(t.treeshake),moduleTypes:t.moduleTypes,define:l.define,inject:Fp(l.inject),experimental:Np(t.experimental),profilerNames:n.generatedCode?.profilerNames,transform:l.oxcTransformOptions,watch:Rp(t.watch),dropLabels:l.dropLabels,keepNames:n.keepNames,checks:t.checks,deferSyncScanData:()=>{let e=[];return s.moduleOptionMap.forEach((t,n)=>{t.invalidate&&e.push({id:n,sideEffects:t.moduleSideEffects??void 0})}),e},makeAbsoluteExternalsRelative:Bp(t.makeAbsoluteExternalsRelative),devtools:t.devtools,invalidateJsSideCache:s.clear.bind(s),preserveEntrySignatures:Vp(t.preserveEntrySignatures),optimization:t.optimization,context:t.context,tsconfig:t.resolve?.tsconfigFilename??t.tsconfig}}function Ap(e){if(e)return typeof e==`boolean`?e?{}:void 0:e}function jp(e){switch(e){case void 0:return;case`full`:return Cf.BindingAttachDebugInfo.Full;case`simple`:return Cf.BindingAttachDebugInfo.Simple;case`none`:return Cf.BindingAttachDebugInfo.None}}function Mp(e){if(e)return typeof e==`function`?(t,n,r)=>t.startsWith(`\0`)?!1:e(t,n,r)??!1:_u(e)}function Np(e){let t=Cf.BindingChunkModuleOrderBy.ExecOrder;if(e?.chunkModulesOrder)switch(e.chunkModulesOrder){case`exec-order`:t=Cf.BindingChunkModuleOrderBy.ExecOrder;break;case`module-id`:t=Cf.BindingChunkModuleOrderBy.ModuleId;break;default:throw Error(`Unexpected chunkModulesOrder: ${e.chunkModulesOrder}`)}return{viteMode:e?.viteMode,resolveNewUrlToAsset:e?.resolveNewUrlToAsset,devMode:Ap(e?.devMode),attachDebugInfo:jp(e?.attachDebugInfo),chunkModulesOrder:t,chunkImportMap:e?.chunkImportMap,onDemandWrapping:e?.onDemandWrapping,incrementalBuild:e?.incrementalBuild,nativeMagicString:e?.nativeMagicString,chunkOptimization:e?.chunkOptimization}}function Pp(e){let t=typeof process==`object`&&!!process.versions?.pnp;if(e){let{alias:n,extensionAlias:r,...i}=e;return{alias:n?Object.entries(n).map(([e,t])=>({find:e,replacements:t===!1?[void 0]:_u(t)})):void 0,extensionAlias:r?Object.entries(r).map(([e,t])=>({target:e,replacements:t})):void 0,yarnPnp:t,...i}}else return{yarnPnp:t}}function Fp(e){if(e)return Object.entries(e).map(([e,t])=>Array.isArray(t)?t[1]===`*`?{tagNamespace:!0,alias:e,from:t[0]}:{tagNamed:!0,alias:e,from:t[0],imported:t[1]}:{tagNamed:!0,imported:`default`,alias:e,from:t})}function Ip(e){switch(e){case`silent`:return Cf.BindingLogLevel.Silent;case`debug`:return Cf.BindingLogLevel.Debug;case`warn`:return Cf.BindingLogLevel.Warn;case`info`:return Cf.BindingLogLevel.Info;default:throw Error(`Unexpected log level: ${e}`)}}function Lp(e){return e===void 0?[]:typeof e==`string`?[{import:e}]:Array.isArray(e)?e.map(e=>({import:e})):Object.entries(e).map(([e,t])=>({name:e,import:t}))}function Rp(e){if(e)return{buildDelay:e.buildDelay,skipWrite:e.skipWrite,include:xd(e.include),exclude:xd(e.exclude),onInvalidate:(...t)=>e.onInvalidate?.(...t)}}function zp(e){if(e===!1)return;if(e===!0||e===void 0)return{moduleSideEffects:!0};let t={moduleSideEffects:!0,annotations:e.annotations,manualPureFunctions:e.manualPureFunctions,unknownGlobalSideEffects:e.unknownGlobalSideEffects,invalidImportSideEffects:e.invalidImportSideEffects,commonjs:e.commonjs};switch(e.propertyReadSideEffects){case`always`:t.propertyReadSideEffects=Cf.BindingPropertyReadSideEffects.Always;break;case!1:t.propertyReadSideEffects=Cf.BindingPropertyReadSideEffects.False;break;default:}switch(e.propertyWriteSideEffects){case`always`:t.propertyWriteSideEffects=Cf.BindingPropertyWriteSideEffects.Always;break;case!1:t.propertyWriteSideEffects=Cf.BindingPropertyWriteSideEffects.False;break;default:}return e.moduleSideEffects===void 0?t.moduleSideEffects=!0:e.moduleSideEffects===`no-external`?t.moduleSideEffects=[{external:!0,sideEffects:!1},{external:!1,sideEffects:!0}]:t.moduleSideEffects=e.moduleSideEffects,t}function Bp(e){if(e===`ifRelativeSource`)return{type:`IfRelativeSource`};if(typeof e==`boolean`)return{type:`Bool`,field0:e}}function Vp(e){if(e!=null)return typeof e==`string`?{type:`String`,field0:e}:{type:`Bool`,field0:e}}function Hp(e,t,n,r){let i=Xd[n],a=(n,o,s=new Set)=>{if(!(Xd[n]<i)){for(let t of rm(`onLog`,e)){if(s.has(t))continue;let{onLog:e}=t;if(e){let c=e=>Xd[e]<i?()=>{}:n=>a(e,Zd(n),new Set(s).add(t));if((`handler`in e?e.handler:e).call({debug:c(Yd),error:e=>gd(Zd(e)),info:c(Jd),meta:{rollupVersion:`4.23.0`,rolldownVersion:Kd,watchMode:r},warn:c(qd),pluginName:t.name||`unknown`},n,o)===!1)return}}t(n,o)}};return a}const Up=(e,t,n=Kp)=>{let{onwarn:r,onLog:i}=e,a=Wp(n,r);if(i){let e=Xd[t];return(t,n)=>i(t,Gp(n),(t,n)=>{if(t===`error`)return gd(Zd(n));Xd[t]>=e&&a(t,Zd(n))})}return a},Wp=(e,t)=>t?(n,r)=>{n===qd?t(Gp(r),t=>e(qd,Zd(t))):e(n,r)}:e,Gp=e=>(Object.defineProperty(e,`toString`,{value:()=>qp(e),writable:!0}),e),Kp=(e,t)=>{let n=qp(t);switch(e){case qd:return console.warn(n);case Yd:return console.debug(n);default:return console.info(n)}},qp=e=>{let t=``;return e.plugin&&(t+=`(${e.plugin} plugin) `),e.loc&&(t+=`${Jp(e.loc.file)} (${e.loc.line}:${e.loc.column}) `),t+e.message};function Jp(e){return i.isAbsolute(e)?i.relative(i.resolve(),e):e}const Yp=[`options`,`buildStart`,`resolveId`,`load`,`transform`,`moduleParsed`,`buildEnd`,`onLog`,`resolveDynamicImport`,`closeBundle`,`closeWatcher`,`watchChange`],Xp=[`augmentChunkHash`,`outputOptions`,`renderChunk`,`renderStart`,`renderError`,`writeBundle`,`generateBundle`],B=[...Yp,...Xp,`footer`,`banner`,`intro`,`outro`];B[0],B[0],B[1],B[1],B[2],B[2],B[3],B[3],B[4],B[4],B[5],B[5],B[6],B[6],B[7],B[7],B[8],B[8],B[9],B[9],B[10],B[10],B[11],B[11],B[12],B[12],B[13],B[13],B[14],B[14],B[15],B[15],B[16],B[16],B[17],B[17],B[18],B[18],B[19],B[19],B[20],B[20],B[21],B[21],B[22],B[22];async function Zp(e){do e=(await Promise.all(e)).flat(1/0);while(e.some(e=>e?.then));return e}const Qp=async e=>(await Zp([e])).filter(Boolean);function $p(e,t){for(let n of e)for(let e of Yp)e in n&&(delete n[e],t(qd,fd(n.name,e)));return e}function em(e,t){for(let[n,r]of e.entries())`_parallel`in r||r instanceof vd||(r.name||=`${t}${n+1}`);return e}var tm=class{static async callOptionsHook(e,t=!1){let n=e.logLevel||Jd,r=rm(`options`,nm(await Qp(e.plugins))),i=Hp(r,Up(e,n),n,t);for(let a of r){let r=a.name||`unknown`,o=a.options;if(o){let{handler:a}=$d(o),s=await a.call(new ef(i,n,r,t,`onLog`),e);s&&(e=s)}}return e}static callOutputOptionsHook(e,t,n,r,i){let a=rm(`outputOptions`,nm(e));for(let e of a){let a=e.name||`unknown`,o=e.outputOptions;if(o){let{handler:e}=$d(o),s=e.call(new ef(n,r,a,i),t);s&&(t=s)}}return t}};function nm(e){return e.filter(e=>{if(e&&!(`_parallel`in e)&&!(e instanceof vd))return e})}function rm(e,t){let n=[],r=[],i=[];for(let a of t){let t=a[e];if(t){if(typeof t==`object`){if(t.order===`pre`){n.push(a);continue}if(t.order===`post`){i.push(a);continue}}r.push(a)}}return[...n,...r,...i]}function im(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function am(e){return(void 0)?.get(e)}function om(e){return(void 0)?.get(e)}function sm(e,t){return(void 0)?.get(e)?.get(t)}function cm(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function lm(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??cm(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??sm(e.reference,c.lang)??(l?om(c.lang):null)??r.message??am(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function V(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},im())}}}function um(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function dm(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var fm=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function pm(e){return{kind:`transformation`,type:`args`,reference:pm,async:!1,schema:e,"~run"(e,t){let n=e.value;return e.value=(...e)=>{let r=this.schema[`~run`]({value:e},t);if(r.issues)throw new fm(r.issues);return n(...r.value)},e}}}function mm(){return{kind:`transformation`,type:`await`,reference:mm,async:!0,async"~run"(e){return e.value=await e.value,e}}}function H(e){return{kind:`metadata`,type:`description`,reference:H,description:e}}function hm(e){return{kind:`transformation`,type:`returns`,reference:hm,async:!1,schema:e,"~run"(e,t){let n=e.value;return e.value=(...e)=>{let r=this.schema[`~run`]({value:n(...e)},t);if(r.issues)throw new fm(r.issues);return r.value},e}}}function gm(e){return{kind:`transformation`,type:`returns`,reference:gm,async:!1,schema:e,"~run"(e,t){let n=e.value;return e.value=async(...e)=>{let r=await this.schema[`~run`]({value:await n(...e)},t);if(r.issues)throw new fm(r.issues);return r.value},e}}}function _m(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function vm(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function ym(){return{kind:`schema`,type:`any`,reference:ym,expects:`any`,async:!1,get"~standard"(){return V(this)},"~run"(e){return e.typed=!0,e}}}function bm(e,t){return{kind:`schema`,type:`array`,reference:bm,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else lm(this,`type`,e,t);return e}}}function U(e){return{kind:`schema`,type:`boolean`,reference:U,expects:`boolean`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:lm(this,`type`,e,t),e}}}function xm(e,t){return{kind:`schema`,type:`custom`,reference:xm,expects:`unknown`,async:!1,check:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:lm(this,`type`,e,t),e}}}function Sm(e){return{kind:`schema`,type:`function`,reference:Sm,expects:`Function`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return typeof e.value==`function`?e.typed=!0:lm(this,`type`,e,t),e}}}function Cm(e,t){return{kind:`schema`,type:`instance`,reference:Cm,expects:e.name,async:!1,class:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){return e.value instanceof this.class?e.typed=!0:lm(this,`type`,e,t),e}}}function W(e,t){return{kind:`schema`,type:`literal`,reference:W,expects:cm(e),async:!1,literal:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:lm(this,`type`,e,t),e}}}function wm(e,t){return{kind:`schema`,type:`loose_object`,reference:wm,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:vm(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=_m(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(lm(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(let t in n)um(n,t)&&!(t in this.entries)&&(e.value[t]=n[t])}else lm(this,`type`,e,t);return e}}}function Tm(e){return{kind:`schema`,type:`never`,reference:Tm,expects:`never`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return lm(this,`type`,e,t),e}}}function Em(e,t){return{kind:`schema`,type:`nullish`,reference:Em,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return V(this)},"~run"(e,t){return(e.value===null||e.value===void 0)&&(this.default!==void 0&&(e.value=vm(this,e,t)),e.value===null||e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Dm(e){return{kind:`schema`,type:`number`,reference:Dm,expects:`number`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:lm(this,`type`,e,t),e}}}function Om(e,t){return{kind:`schema`,type:`object`,reference:Om,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`)for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:vm(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=_m(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(lm(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}else lm(this,`type`,e,t);return e}}}function G(e,t){return{kind:`schema`,type:`optional`,reference:G,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return V(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=vm(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function km(e){return{kind:`schema`,type:`promise`,reference:km,expects:`Promise`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return e.value instanceof Promise?e.typed=!0:lm(this,`type`,e,t),e}}}function Am(e,t,n){return{kind:`schema`,type:`record`,reference:Am,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return V(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},n)if(um(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else lm(this,`type`,e,t);return e}}}function K(e,t){return{kind:`schema`,type:`strict_object`,reference:K,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:vm(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=_m(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(lm(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly){for(let r in n)if(!(r in this.entries)){lm(this,`key`,e,t,{input:r,expected:`never`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]});break}}}else lm(this,`type`,e,t);return e}}}function q(e){return{kind:`schema`,type:`string`,reference:q,expects:`string`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:lm(this,`type`,e,t),e}}}function jm(e,t){return{kind:`schema`,type:`tuple`,reference:jm,expects:`Array`,async:!1,items:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<this.items.length;r++){let i=n[r],a=this.items[r][`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else lm(this,`type`,e,t);return e}}}function Mm(e){return{kind:`schema`,type:`undefined`,reference:Mm,expects:`undefined`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return e.value===void 0?e.typed=!0:lm(this,`type`,e,t),e}}}function Nm(e){let t;if(e)for(let n of e)t?t.push(...n.issues):t=n.issues;return t}function J(e,t){return{kind:`schema`,type:`union`,reference:J,expects:dm(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,get"~standard"(){return V(this)},"~run"(e,t){let n,r,i;for(let a of this.options){let o=a[`~run`]({value:e.value},t);if(o.typed)if(o.issues)r?r.push(o):r=[o];else{n=o;break}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];lm(this,`type`,e,t,{issues:Nm(r)}),e.typed=!0}else if(i?.length===1)return i[0];else lm(this,`type`,e,t,{issues:Nm(i)});return e}}}function Pm(e,t){return{kind:`schema`,type:`union`,reference:Pm,expects:dm(e.map(e=>e.expects),`|`),async:!0,options:e,message:t,get"~standard"(){return V(this)},async"~run"(e,t){let n,r,i;for(let a of this.options){let o=await a[`~run`]({value:e.value},t);if(o.typed)if(o.issues)r?r.push(o):r=[o];else{n=o;break}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];lm(this,`type`,e,t,{issues:Nm(r)}),e.typed=!0}else if(i?.length===1)return i[0];else lm(this,`type`,e,t,{issues:Nm(i)});return e}}}function Fm(e){return{kind:`schema`,type:`void`,reference:Fm,expects:`void`,async:!1,message:e,get"~standard"(){return V(this)},"~run"(e,t){return e.value===void 0?e.typed=!0:lm(this,`type`,e,t),e}}}function Im(e,t){let n={...e.entries};for(let e of t)delete n[e];return{...e,entries:n,get"~standard"(){return V(this)}}}function Lm(e,t){let n={};for(let r in e.entries)n[r]=!t||t.includes(r)?G(e.entries[r]):e.entries[r];return{...e,entries:n,get"~standard"(){return V(this)}}}function Y(...e){return{...e[0],pipe:e,get"~standard"(){return V(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}function Rm(...e){return{...e[0],pipe:e,async:!0,get"~standard"(){return V(this)},async"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=await r[`~run`](t,n))}return t}}}function zm(e,t,n){let r=e[`~run`]({value:t},im(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}function Bm(...e){return _(...e)}const Vm=J([q(),Cm(RegExp)]);function Hm(){return Sm()}const Um=J([W(`debug`),W(`info`),W(`warn`)]),Wm=J([Um,W(`silent`)]),Gm=J([Um,W(`error`)]),Km=ym(),qm=J([Km,q()]),Jm=J([q(),bm(q()),Am(q(),q())]),Ym=Y(Hm(),pm(jm([q(),G(q()),U()])),hm(Em(U()))),Xm=J([Vm,bm(Vm),Ym]),Zm=Am(q(),J([W(`asset`),W(`base64`),W(`binary`),W(`css`),W(`dataurl`),W(`empty`),W(`js`),W(`json`),W(`jsx`),W(`text`),W(`ts`),W(`tsx`)])),Qm=Om({assumptions:G(Om({ignoreFunctionLength:G(U()),noDocumentAll:G(U()),objectRestNoSymbols:G(U()),pureGetters:G(U()),setPublicClassFields:G(U())})),typescript:G(Om({jsxPragma:G(q()),jsxPragmaFrag:G(q()),onlyRemoveTypeImports:G(U()),allowNamespaces:G(U()),allowDeclareFields:G(U()),declaration:G(Om({stripInternal:G(U()),sourcemap:G(U())})),rewriteImportExtensions:G(J([W(`rewrite`),W(`remove`),U()]))})),helpers:G(Om({mode:G(J([W(`Runtime`),W(`External`)]))})),decorators:G(Om({legacy:G(U()),emitDecoratorMetadata:G(U())})),jsx:G(J([W(!1),W(`preserve`),W(`react`),W(`react-jsx`),K({runtime:Y(G(J([W(`classic`),W(`automatic`)])),H(`Which runtime to use`)),development:Y(G(U()),H(`Development specific information`)),throwIfNamespace:Y(G(U()),H(`Toggles whether to throw an error when a tag name uses an XML namespace`)),importSource:Y(G(q()),H(`Import the factory of element and fragment if mode is classic`)),pragma:Y(G(q()),H(`Jsx element transformation`)),pragmaFrag:Y(G(q()),H(`Jsx fragment transformation`)),refresh:Y(G(U()),H(`Enable react fast refresh`))})])),target:Y(G(J([q(),bm(q())])),H(`The JavaScript target environment`)),define:Y(G(Am(q(),q())),H(`Define global variables (syntax: key=value,key2=value2)`)),inject:Y(G(Am(q(),J([q(),jm([q(),q()])]))),H(`Inject import statements on demand`)),dropLabels:Y(G(bm(q())),H(`Remove labeled statements with these label names`))}),$m=K({chokidar:G(Tm(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),exclude:G(J([Vm,bm(Vm)])),include:G(J([Vm,bm(Vm)])),notify:Y(G(K({compareContents:G(U()),pollInterval:G(Dm())})),H(`Notify options`)),skipWrite:Y(G(U()),H(`Skip the bundle.write() step`)),buildDelay:Y(G(Dm()),H(`Throttle watch rebuilds`)),clearScreen:Y(G(U()),H(`Whether to clear the screen when a rebuild is triggered`)),onInvalidate:Y(G(Y(Sm(),pm(jm([q()])))),H(`An optional function that will be called immediately every time a module changes that is part of the build.`))}),eh=K({circularDependency:Y(G(U()),H(`Whether to emit warnings when detecting circular dependency`)),eval:Y(G(U()),H("Whether to emit warnings when detecting uses of direct `eval`s")),missingGlobalName:Y(G(U()),H("Whether to emit warnings when the `output.globals` option is missing when needed")),missingNameOptionForIifeExport:Y(G(U()),H("Whether to emit warnings when the `output.name` option is missing when needed")),mixedExports:Y(G(U()),H(`Whether to emit warnings when the way to export values is ambiguous`)),unresolvedEntry:Y(G(U()),H(`Whether to emit warnings when an entrypoint cannot be resolved`)),unresolvedImport:Y(G(U()),H(`Whether to emit warnings when an import cannot be resolved`)),filenameConflict:Y(G(U()),H(`Whether to emit warnings when files generated have the same name with different contents`)),commonJsVariableInEsm:Y(G(U()),H(`Whether to emit warnings when a CommonJS variable is used in an ES module`)),importIsUndefined:Y(G(U()),H(`Whether to emit warnings when an imported variable is not exported`)),emptyImportMeta:Y(G(U()),H("Whether to emit warnings when `import.meta` is not supported with the output format and is replaced with an empty object (`{}`)")),toleratedTransform:Y(G(U()),H(`Whether to emit warnings when detecting tolerated transform`)),cannotCallNamespace:Y(G(U()),H(`Whether to emit warnings when a namespace is called as a function`)),configurationFieldConflict:Y(G(U()),H(`Whether to emit warnings when a config value is overridden by another config value with a higher priority`)),preferBuiltinFeature:Y(G(U()),H(`Whether to emit warnings when a plugin that is covered by a built-in feature is used`)),couldNotCleanDirectory:Y(G(U()),H(`Whether to emit warnings when Rolldown could not clean the output directory`)),pluginTimings:Y(G(U()),H(`Whether to emit warnings when plugins take significant time during the build process`))}),th=K({compress:G(J([U(),K({target:G(J([W(`esnext`),W(`es2015`),W(`es2016`),W(`es2017`),W(`es2018`),W(`es2019`),W(`es2020`),W(`es2021`),W(`es2022`),W(`es2023`),W(`es2024`)])),dropConsole:G(U()),dropDebugger:G(U()),keepNames:G(K({function:U(),class:U()})),unused:G(J([U(),W(`keep_assign`)]))})])),mangle:G(J([U(),K({toplevel:G(U()),keepNames:G(J([U(),K({function:U(),class:U()})])),debug:G(U())})])),codegen:G(J([U(),K({removeWhitespace:G(U())})]))}),nh=K({alias:G(Am(q(),J([W(!1),q(),bm(q())]))),aliasFields:G(bm(bm(q()))),conditionNames:G(bm(q())),extensionAlias:G(Am(q(),bm(q()))),exportsFields:G(bm(bm(q()))),extensions:G(bm(q())),mainFields:G(bm(q())),mainFiles:G(bm(q())),modules:G(bm(q())),symlinks:G(U()),yarnPnp:G(U())}),rh=J([U(),wm({annotations:G(U()),manualPureFunctions:G(bm(q())),unknownGlobalSideEffects:G(U()),invalidImportSideEffects:G(U()),commonjs:G(U()),propertyReadSideEffects:G(J([W(!1),W(`always`)])),propertyWriteSideEffects:G(J([W(!1),W(`always`)]))})]),ih=K({inlineConst:Y(G(J([U(),K({mode:G(J([W(`all`),W(`smart`)])),pass:G(Dm())})])),H(`Enable crossmodule constant inlining`)),pifeForModuleWrappers:Y(G(U()),H(`Use PIFE pattern for module wrappers`))}),ah=Y(Hm(),pm(jm([Gm,qm]))),oh=Y(Hm(),pm(jm([Um,Km,ah]))),sh=Y(Hm(),pm(jm([Km,Y(Hm(),pm(jm([J([qm,Y(Hm(),hm(qm))])])))]))),ch=J([U(),K({port:G(Dm()),host:G(q()),implement:G(q()),lazy:G(U())})]),lh=K({input:G(Jm),plugins:G(xm(()=>!0)),external:G(Xm),makeAbsoluteExternalsRelative:G(J([U(),W(`ifRelativeSource`)])),resolve:G(nh),cwd:Y(G(q()),H(`Current working directory`)),platform:Y(G(J([W(`browser`),W(`neutral`),W(`node`)])),H(`Platform for which the code should be generated (node, ${Bm(`underline`,`browser`)}, neutral)`)),shimMissingExports:Y(G(U()),H(`Create shim variables for missing exports`)),treeshake:G(rh),optimization:G(ih),logLevel:Y(G(Wm),H(`Log level (${Bm(`dim`,`silent`)}, ${Bm([`underline`,`gray`],`info`)}, debug, ${Bm(`yellow`,`warn`)})`)),onLog:G(oh),onwarn:G(sh),moduleTypes:Y(G(Zm),H(`Module types for customized extensions`)),experimental:G(K({enableComposingJsPlugins:G(U()),viteMode:G(U()),resolveNewUrlToAsset:G(U()),strictExecutionOrder:G(U()),onDemandWrapping:G(U()),incrementalBuild:G(U()),devMode:G(ch),attachDebugInfo:G(J([W(`none`),W(`simple`),W(`full`)])),chunkModulesOrder:G(J([W(`module-id`),W(`exec-order`)])),chunkImportMap:G(J([U(),Om({baseUrl:G(q()),fileName:G(q())})])),nativeMagicString:G(U()),chunkOptimization:G(U())})),transform:G(Qm),watch:G(J([$m,W(!1)])),checks:G(eh),devtools:Y(G(Om({sessionId:Y(G(q()),H(`Used to name the build.`))})),H(`Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.`)),preserveEntrySignatures:Y(G(J([W(`strict`),W(`allow-extension`),W(`exports-only`),W(!1)]))),tsconfig:Y(G(J([U(),q()])),H(`Path to the tsconfig.json file.`))}),uh=K({input:Y(G(bm(q())),H(`Entry file`)),external:Y(G(bm(q())),H("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),treeshake:Y(G(U()),H(`enable treeshaking`)),makeAbsoluteExternalsRelative:Y(G(U()),H(`Prevent normalization of external imports`)),preserveEntrySignatures:Y(G(W(!1)),H(`Avoid facade chunks for entry points`)),context:Y(G(q()),H("The entity top-level `this` represents."))}),dh=Im(K({...lh.entries,...uh.entries}),[`plugins`,`onwarn`,`onLog`,`resolve`,`experimental`,`watch`]),fh=J([W(`es`),W(`cjs`),W(`esm`),W(`module`),W(`commonjs`),W(`iife`),W(`umd`)]),ph=Y(Hm(),pm(jm([xm(()=>!0)])),gm(Pm([q(),Rm(km(),mm(),q())]))),mh=Y(Hm(),pm(jm([xm(()=>!0)])),hm(q())),hh=J([q(),mh]),gh=Y(Hm(),pm(jm([xm(()=>!0)])),hm(q())),_h=J([q(),gh]),vh=Y(Hm(),pm(jm([q()])),hm(q())),yh=J([U(),vh]),bh=Y(Hm(),pm(jm([q()])),hm(q())),xh=Y(Hm(),pm(jm([q()])),hm(q())),Sh=Y(Hm(),pm(jm([q(),Om({})])),hm(Em(q()))),Ch=Y(Hm(),pm(jm([q(),Om({})])),hm(Em(q()))),wh=Y(Hm(),pm(jm([q()])),hm(J([U(),Fm(),Mm()]))),Th=K({includeDependenciesRecursively:G(U()),minSize:G(Dm()),maxSize:G(Dm()),minModuleSize:G(Dm()),maxModuleSize:G(Dm()),minShareCount:G(Dm()),groups:G(bm(K({name:J([q(),Ch]),test:G(J([Vm,wh])),priority:G(Dm()),minSize:G(Dm()),minShareCount:G(Dm()),maxSize:G(Dm()),minModuleSize:G(Dm()),maxModuleSize:G(Dm())})))}),Eh=K({symbols:Y(G(U()),H(`Whether to use Symbol.toStringTag for namespace objects`)),preset:J([W(`es5`),W(`es2015`)]),profilerNames:Y(G(U()),H(`Whether to add readable names to internal variables for profiling purposes`))}),Dh=K({dir:Y(G(q()),H("Output directory, defaults to `dist` if `file` is not set")),file:Y(G(q()),H(`Single output file`)),exports:Y(G(J([W(`auto`),W(`named`),W(`default`),W(`none`)])),H(`Specify a export mode (${Bm(`underline`,`auto`)}, named, default, none)`)),hashCharacters:Y(G(J([W(`base64`),W(`base36`),W(`hex`)])),H(`Use the specified character set for file hashes`)),format:Y(G(fh),H(`Output format of the generated bundle (supports ${Bm(`underline`,`esm`)}, cjs, and iife)`)),sourcemap:Y(G(J([U(),W(`inline`),W(`hidden`)])),H(`Generate sourcemap (\`-s inline\` for inline, or ${Bm(`bold`,"pass the `-s` on the last argument if you want to generate `.map` file")})`)),sourcemapBaseUrl:Y(G(q()),H(`Base URL used to prefix sourcemap paths`)),sourcemapDebugIds:Y(G(U()),H(`Inject sourcemap debug IDs`)),sourcemapIgnoreList:G(J([U(),xm(()=>!0),Vm])),sourcemapPathTransform:G(xm(()=>!0)),banner:G(J([q(),ph])),footer:G(J([q(),ph])),postBanner:G(J([q(),ph])),postFooter:G(J([q(),ph])),intro:G(J([q(),ph])),outro:G(J([q(),ph])),extend:Y(G(U()),H(`Extend global variable defined by name in IIFE / UMD formats`)),esModule:G(J([U(),W(`if-default-prop`)])),assetFileNames:G(_h),entryFileNames:G(hh),chunkFileNames:G(hh),cssEntryFileNames:G(hh),cssChunkFileNames:G(hh),sanitizeFileName:G(yh),minify:Y(G(J([U(),W(`dce-only`),th])),H(`Minify the bundled file`)),name:Y(G(q()),H(`Name for UMD / IIFE format outputs`)),globals:Y(G(J([Am(q(),q()),bh])),H("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),paths:Y(G(J([Am(q(),q()),xh])),H(`Maps external module IDs to paths`)),generatedCode:Y(G(Lm(Eh)),H(`Generated code options`)),externalLiveBindings:Y(G(U()),H(`external live bindings`)),inlineDynamicImports:Y(G(U()),H(`Inline dynamic imports`)),dynamicImportInCjs:Y(G(U()),H(`Dynamic import in CJS output`)),manualChunks:G(Sh),codeSplitting:G(J([U(),Th])),advancedChunks:G(Th),legalComments:Y(G(J([W(`none`),W(`inline`)])),H(`Control comments in the output`)),plugins:G(xm(()=>!0)),polyfillRequire:Y(G(U()),H(`Disable require polyfill injection`)),hoistTransitiveImports:G(W(!1)),preserveModules:Y(G(U()),H(`Preserve module structure`)),preserveModulesRoot:Y(G(q()),H(`Put preserved modules under this path at root level`)),virtualDirname:G(q()),minifyInternalExports:Y(G(U()),H(`Minify internal exports`)),topLevelVar:Y(G(U()),H("Rewrite top-level declarations to use `var`.")),cleanDir:Y(G(U()),H(`Clean output directory before emitting output`)),keepNames:Y(G(U()),H(`Keep function and class names after bundling`))}),Oh=(e,t)=>`Code to insert the ${Bm(`bold`,e)} of the bundled file (${Bm(`bold`,t)} the wrapper function)`,kh=K({assetFileNames:Y(G(q()),H(`Name pattern for asset files`)),entryFileNames:Y(G(q()),H(`Name pattern for emitted entry chunks`)),chunkFileNames:Y(G(q()),H(`Name pattern for emitted secondary chunks`)),cssEntryFileNames:Y(G(q()),H(`Name pattern for emitted css entry chunks`)),cssChunkFileNames:Y(G(q()),H(`Name pattern for emitted css secondary chunks`)),sanitizeFileName:Y(G(U()),H(`Sanitize file name`)),banner:Y(G(q()),H(Oh(`top`,`outside`))),footer:Y(G(q()),H(Oh(`bottom`,`outside`))),postBanner:Y(G(q()),H("A string to prepend to the top of each chunk. Applied after the `renderChunk` hook and minification")),postFooter:Y(G(q()),H("A string to append to the bottom of each chunk. Applied after the `renderChunk` hook and minification")),intro:Y(G(q()),H(Oh(`top`,`inside`))),outro:Y(G(q()),H(Oh(`bottom`,`inside`))),esModule:Y(G(U()),H("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),globals:Y(G(Am(q(),q())),H("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),codeSplitting:Y(G(J([U(),K({minSize:Y(G(Dm()),H(`Minimum size of the chunk`)),minShareCount:Y(G(Dm()),H(`Minimum share count of the chunk`))})])),H(`Code splitting options (true, false, or object)`)),advancedChunks:Y(G(K({minSize:Y(G(Dm()),H(`Minimum size of the chunk`)),minShareCount:Y(G(Dm()),H(`Minimum share count of the chunk`))})),H(`Deprecated: use codeSplitting instead`)),minify:Y(G(U()),H(`Minify the bundled file`))}),Ah=Im(K({...Dh.entries,...kh.entries}),[`sourcemapIgnoreList`,`sourcemapPathTransform`,`plugins`,`hoistTransitiveImports`]);({...dh.entries,...Ah.entries});const jh={output:{ignored:!0},"resolve.tsconfigFilename":{issueMsg:"It is deprecated. Please use the top-level `tsconfig` option instead."}},Mh={};function Nh(e,t){if(typeof t!=`object`)throw Error(`Invalid ${e} options. Expected an Object but received ${JSON.stringify(t)}.`);if(globalThis.process?.env?.ROLLUP_TEST)return;let n=zm(e===`input`?lh:Dh,t);if(!n.success){let t=n.issues.map(t=>{let n=t.message,r=t.path.map(e=>e.key);if(t.type===`union`){let e=t.issues?.find(e=>!(e.type!==t.received&&e.input===t.input));e&&(e.path&&r.push(e.path.map(e=>e.key)),n=e.message)}let i=r.join(`.`),a=e===`input`?jh[i]:Mh[i];return a&&a.ignored?``:`- For the "${i}". ${a?.issueMsg||n+`.`} ${a?.help?`\n Help: ${a.help}`:``}`}).filter(Boolean);t.length&&console.warn(`\x1b[33mWarning: Invalid ${e} options (${t.length} issue${t.length===1?``:`s`} found)\n${t.join(`
86
+ `)}\x1b[0m`)}}var Ph=class extends nf{constructor(e){super(),this.bindingOutputs=e}get output(){return yf(this.bindingOutputs).output}__rolldown_external_memory_handle__(e){let t=this.output.map(t=>t.__rolldown_external_memory_handle__(e));if(!t.every(e=>e.freed)){let e=t.filter(e=>!e.freed).map(e=>e.reason).filter(Boolean);return{freed:!1,reason:`Failed to free ${e.length} item(s): ${e.join(`; `)}`}}return{freed:!0}}};R([L],Ph.prototype,`output`,null);var Fh=class{constructor(e){this.context=e}getModuleInfo(e){let t=this.context.getModuleInfo(e);return t?kf(t,{moduleSideEffects:null,meta:{}}):null}};function Ih(e){let{dir:t,format:n,exports:r,hashCharacters:i,sourcemap:a,sourcemapBaseUrl:o,sourcemapDebugIds:s,sourcemapIgnoreList:c,sourcemapPathTransform:l,name:u,assetFileNames:d,entryFileNames:f,chunkFileNames:p,cssEntryFileNames:m,cssChunkFileNames:h,banner:g,footer:_,postBanner:v,postFooter:ee,intro:y,outro:b,esModule:x,globals:te,paths:S,generatedCode:ne,file:re,sanitizeFileName:ie,preserveModules:C,virtualDirname:ae,legalComments:w,preserveModulesRoot:oe,manualChunks:T,topLevelVar:se,cleanDir:ce,strictExecutionOrder:E}=e,{inlineDynamicImports:D,advancedChunks:le}=Vh(e.codeSplitting,e.inlineDynamicImports,e.advancedChunks,T);return{dir:t,file:re??void 0,format:Rh(n),exports:r,hashCharacters:i,sourcemap:zh(a),sourcemapBaseUrl:o,sourcemapDebugIds:s,sourcemapIgnoreList:c??/node_modules/,sourcemapPathTransform:l,banner:Lh(g),footer:Lh(_),postBanner:Lh(v),postFooter:Lh(ee),intro:Lh(y),outro:Lh(b),extend:e.extend,globals:te,paths:S,generatedCode:ne,esModule:x,name:u,assetFileNames:Bh(d),entryFileNames:f,chunkFileNames:p,cssEntryFileNames:m,cssChunkFileNames:h,plugins:[],minify:e.minify,externalLiveBindings:e.externalLiveBindings,inlineDynamicImports:D,dynamicImportInCjs:e.dynamicImportInCjs,manualCodeSplitting:le,polyfillRequire:e.polyfillRequire,sanitizeFileName:ie,preserveModules:C,virtualDirname:ae,legalComments:w,preserveModulesRoot:oe,topLevelVar:se,minifyInternalExports:e.minifyInternalExports,cleanDir:ce,strictExecutionOrder:E}}function Lh(e){if(!(e==null||e===``))return typeof e==`function`?async t=>e(uf(t)):e}function Rh(e){switch(e){case void 0:case`es`:case`esm`:case`module`:return`es`;case`cjs`:case`commonjs`:return`cjs`;case`iife`:return`iife`;case`umd`:return`umd`;default:vu(`output.format: ${e}`)}}function zh(e){switch(e){case!0:return`file`;case`inline`:return`inline`;case!1:case void 0:return;case`hidden`:return`hidden`;default:throw Error(`unknown sourcemap: ${e}`)}}function Bh(e){return typeof e==`function`?t=>e({name:t.name,names:t.names,originalFileName:t.originalFileName,originalFileNames:t.originalFileNames,source:of(t.source),type:`asset`}):e}function Vh(e,t,n,r){let i,a;if(e===!1){if(t!=null&&console.warn("`inlineDynamicImports` option is ignored because `codeSplitting: false` is set."),r!=null)throw Error(`Invalid configuration: "output.manualChunks" cannot be used when "output.codeSplitting" is set to false.`);return n!=null&&console.warn("`advancedChunks` option is ignored because `codeSplitting` is set to `false`."),{inlineDynamicImports:!0,advancedChunks:void 0}}else e===!0?t!=null&&console.warn("`inlineDynamicImports` option is ignored because `codeSplitting: true` is set."):e==null?t!=null&&(console.warn("`inlineDynamicImports` option is deprecated, please use `codeSplitting: false` instead."),i=t):(a=e,t!=null&&console.warn("`inlineDynamicImports` option is ignored because the `codeSplitting` option is specified."));if(i===!0&&r!=null)throw Error(`Invalid value "true" for option "output.inlineDynamicImports" - this option is not supported for "output.manualChunks".`);a==null?n!=null&&(console.warn("`advancedChunks` option is deprecated, please use `codeSplitting` instead."),a=n):n!=null&&console.warn("`advancedChunks` option is ignored because the `codeSplitting` option is specified."),r!=null&&a!=null?console.warn("`manualChunks` option is ignored because the `codeSplitting` option is specified."):r!=null&&(a={groups:[{name(e,t){return r(e,{getModuleInfo:e=>t.getModuleInfo(e)})}}]});let o;if(a!=null){let{groups:e,...t}=a;o={...t,groups:e?.map(e=>{let{name:t,...n}=e;return{...n,name:typeof t==`function`?(e,n)=>t(e,new Fh(n)):t}})}}return{inlineDynamicImports:i,advancedChunks:o}}var Hh=td(rd(),1);async function Uh(e){let t=[];for(let[n,r]of e.entries())if(`_parallel`in r){let{fileUrl:e,options:i}=r._parallel;t.push({index:n,fileUrl:e,options:i})}if(t.length<=0)return;let n=Kh(),r=new Hh.ParallelJsPluginRegistry(n),i=r.id,a=await Wh(i,n,t);return{registry:r,stopWorkers:async()=>{await Promise.all(a.map(e=>e.terminate()))}}}function Wh(e,t,n){return Promise.all(Array.from({length:t},(t,r)=>Gh(e,n,r)))}async function Gh(e,t,n){let r=import.meta.resolve(`#parallel-plugin-worker`),i={registryId:e,pluginInfos:t,threadNumber:n},a;try{return a=new Ee(new URL(r),{workerData:i}),a.unref(),await new Promise((e,t)=>{a.once(`message`,async n=>{n.type===`error`?t(n.error):e()})}),a}catch(e){throw a?.terminate(),e}}const Kh=()=>{let e=1;try{e=j.availableParallelism()}catch{let t=j.cpus();Array.isArray(t)&&t.length>0&&(e=t.length)}return Math.min(e,8)};async function qh(e,t,n){let r=await Qp(e.plugins),i=await Qp(t.plugins),a=e.logLevel||Jd,o=Hp(nm(r),Up(e,a),a,n);t=tm.callOutputOptionsHook([...r,...i],t,o,a,n);let s=await Qp(t.plugins),c=[...em(r,`at position `),...$p(em(s,`at output position `),o)],l=await Uh(c);e.experimental?.strictExecutionOrder!==void 0&&console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");try{return{bundlerOptions:{inputOptions:kp(c,e,t,s,o,a,n),outputOptions:Ih(t),parallelPluginsRegistry:l?.registry},inputOptions:e,onLog:o,stopWorkers:l?.stopWorkers}}catch(e){throw await l?.stopWorkers(),e}}Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);var Jh=class e{#e;#t;#n;static asyncRuntimeShutdown=!1;constructor(e){this.#e=e,this.#t=new Hh.BindingBundler}get closed(){return this.#t.closed}async generate(e={}){return this.#r(!1,e)}async write(e={}){return this.#r(!0,e)}async close(){await this.#n?.(),await this.#t.close(),(0,Hh.shutdownAsyncRuntime)(),e.asyncRuntimeShutdown=!0,this.#n=void 0}async[Symbol.asyncDispose](){await this.close()}get watchFiles(){return Promise.resolve(this.#t.getWatchFiles())}async#r(t,n){Nh(`output`,n),await this.#n?.();let r=await qh(this.#e,n,!1);e.asyncRuntimeShutdown&&(0,Hh.startAsyncRuntime)();try{this.#n=r.stopWorkers;let e;return e=t?await this.#t.write(r.bundlerOptions):await this.#t.generate(r.bundlerOptions),new Ph(wf(e))}catch(e){throw await r.stopWorkers?.(),e}}};const Yh=[];Yh.push(`SIGHUP`,`SIGINT`,`SIGTERM`),process.platform!==`win32`&&Yh.push(`SIGALRM`,`SIGABRT`,`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&Yh.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`);const Xh=e=>!!e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`,Zh=Symbol.for(`signal-exit emitter`),Qh=globalThis,$h=Object.defineProperty.bind(Object);var eg=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Qh[Zh])return Qh[Zh];$h(Qh,Zh,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],r=n.indexOf(t);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let i of this.listeners[e])r=i(t,n)===!0||r;return e===`exit`&&(r=this.emit(`afterExit`,t,n)||r),r}},tg=class{};const ng=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}});var rg=class extends tg{onExit(){return()=>{}}load(){}unload(){}},ig=class extends tg{#e=ag.platform===`win32`?`SIGINT`:`SIGHUP`;#t=new eg;#n;#r;#i;#a={};#o=!1;constructor(e){super(),this.#n=e,this.#a={};for(let t of Yh)this.#a[t]=()=>{let n=this.#n.listeners(t),{count:r}=this.#t,i=e;if(typeof i.__signal_exit_emitter__==`object`&&typeof i.__signal_exit_emitter__.count==`number`&&(r+=i.__signal_exit_emitter__.count),n.length===r){this.unload();let n=this.#t.emit(`exit`,null,t),r=t===`SIGHUP`?this.#e:t;n||e.kill(e.pid,r)}};this.#i=e.reallyExit,this.#r=e.emit}onExit(e,t){if(!Xh(this.#n))return()=>{};this.#o===!1&&this.load();let n=t?.alwaysLast?`afterExit`:`exit`;return this.#t.on(n,e),()=>{this.#t.removeListener(n,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(let e of Yh)try{let t=this.#a[e];t&&this.#n.on(e,t)}catch{}this.#n.emit=(e,...t)=>this.#c(e,...t),this.#n.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,Yh.forEach(e=>{let t=this.#a[e];if(!t)throw Error(`Listener not defined for signal: `+e);try{this.#n.removeListener(e,t)}catch{}}),this.#n.emit=this.#r,this.#n.reallyExit=this.#i,--this.#t.count)}#s(e){return Xh(this.#n)?(this.#n.exitCode=e||0,this.#t.emit(`exit`,this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...t){let n=this.#r;if(e===`exit`&&Xh(this.#n)){typeof t[0]==`number`&&(this.#n.exitCode=t[0]);let r=n.call(this.#n,e,...t);return this.#t.emit(`exit`,this.#n.exitCode,null),r}else return n.call(this.#n,e,...t)}};const ag=globalThis.process,{onExit:og,load:sg,unload:cg}=ng(Xh(ag)?new ig(ag):new rg);function lg(...e){if(typeof process==`object`&&process.versions.webcontainer){process.on(`exit`,t=>{e[0](t,null)});return}og(...e)}var ug=td(rd()),dg=class{listeners=new Map;timer;constructor(){this.timer=setInterval(()=>{},1e9)}on(e,t){let n=this.listeners.get(e);return n?n.push(t):this.listeners.set(e,[t]),this}off(e,t){let n=this.listeners.get(e);if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}return this}clear(e){this.listeners.has(e)&&this.listeners.delete(e)}async onEvent(e){let t=this.listeners.get(e.eventKind());if(t)switch(e.eventKind()){case`close`:case`restart`:for(let e of t)await e();break;case`event`:for(let n of t){let t=e.bundleEventKind();switch(t){case`BUNDLE_END`:let{duration:r,output:i,result:a}=e.bundleEndData();await n({code:`BUNDLE_END`,duration:r,output:[i],result:a});break;case`ERROR`:let o=e.bundleErrorData();await n({code:`ERROR`,error:Ef(o.error),result:o.result});break;default:await n({code:t});break}}break;case`change`:for(let n of t){let{path:t,kind:r}=e.watchChangeData();await n(t,{event:r})}break;default:throw Error(`Unknown event: ${e}`)}}async close(){clearInterval(this.timer)}},fg=class{closed;inner;emitter;stopWorkers;constructor(e,t,n){this.closed=!1,this.inner=t,this.emitter=e;let r=e.close.bind(e);e.close=async()=>{await this.close(),r()},this.stopWorkers=n}async close(){if(!this.closed){this.closed=!0;for(let e of this.stopWorkers)await e?.();await this.inner.close(),(0,ug.shutdownAsyncRuntime)()}}start(){process.nextTick(()=>this.inner.start(this.emitter.onEvent.bind(this.emitter)))}};async function pg(e,t){let n=_u(t),r=await Promise.all(n.map(e=>_u(e.output||{}).map(async t=>qh(await tm.callOptionsHook(e,!0),t,!0))).flat()),i=mg(r);new fg(e,new ug.BindingWatcher(r.map(e=>e.bundlerOptions),i),r.map(e=>e.stopWorkers)).start()}function mg(e){let t;for(let n of e)if(n.inputOptions.watch){let e=n.inputOptions.watch.notify;if(e){if(t)return n.onLog(qd,md()),t;t=e}}}const hg=e=>{let t=new dg;return pg(t,e),t},gg=async e=>(Nh(`input`,e),new Jh(await tm.callOptionsHook(e)));var _g=td(rd(),1);if(De){let e=(0,_g.initTraceSubscriber)();lg(()=>{e?.close()})}async function vg(e){if(Array.isArray(e))return Promise.all(e.map(e=>vg(e)));{let{output:t,write:n=!0,...r}=e,i=await gg(r);try{return n?await i.write(t):await i.generate(t)}finally{await i.close()}}}_g.BindingMagicString;function yg(e,t={},n){for(let r in e){let i=e[r],a=n?`${n}:${r}`:r;typeof i==`object`&&i?yg(i,t,a):typeof i==`function`&&(t[a]=i)}return t}const bg=(()=>{if(console.createTask)return console.createTask;let e={run:e=>e()};return()=>e})();function xg(e,t,n,r){for(let i=n;i<e.length;i+=1)try{let n=r?r.run(()=>e[i](...t)):e[i](...t);if(n instanceof Promise)return n.then(()=>xg(e,t,i+1,r))}catch(e){return Promise.reject(e)}}function Sg(e,t,n){if(e.length>0)return xg(e,t,0,bg(n))}function Cg(e,t,n){if(e.length>0){let r=bg(n);return Promise.all(e.map(e=>r.run(()=>e(...t))))}}function wg(e,t){for(let n of[...e])n(t)}var Tg=class{_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(e,t,n={}){if(!e||typeof t!=`function`)return()=>{};let r=e,i;for(;this._deprecatedHooks[e];)i=this._deprecatedHooks[e],e=i.to;if(i&&!n.allowDeprecated){let e=i.message;e||=`${r} hook has been deprecated`+(i.to?`, please use ${i.to}`:``),this._deprecatedMessages||=new Set,this._deprecatedMessages.has(e)||(console.warn(e),this._deprecatedMessages.add(e))}if(!t.name)try{Object.defineProperty(t,`name`,{get:()=>`_`+e.replace(/\W+/g,`_`)+`_hook_cb`,configurable:!0})}catch{}return this._hooks[e]=this._hooks[e]||[],this._hooks[e].push(t),()=>{t&&=(this.removeHook(e,t),void 0)}}hookOnce(e,t){let n,r=(...e)=>(typeof n==`function`&&n(),n=void 0,r=void 0,t(...e));return n=this.hook(e,r),n}removeHook(e,t){let n=this._hooks[e];if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&(this._hooks[e]=void 0)}}deprecateHook(e,t){this._deprecatedHooks[e]=typeof t==`string`?{to:t}:t;let n=this._hooks[e]||[];this._hooks[e]=void 0;for(let t of n)this.hook(e,t)}deprecateHooks(e){for(let t in e)this.deprecateHook(t,e[t])}addHooks(e){let t=yg(e),n=Object.keys(t).map(e=>this.hook(e,t[e]));return()=>{for(let e of n)e();n.length=0}}removeHooks(e){let t=yg(e);for(let e in t)this.removeHook(e,t[e])}removeAllHooks(){this._hooks={}}callHook(e,...t){return this.callHookWith(Sg,e,t)}callHookParallel(e,...t){return this.callHookWith(Cg,e,t)}callHookWith(e,t,n){let r=this._before||this._after?{name:t,args:n,context:{}}:void 0;this._before&&wg(this._before,r);let i=e(this._hooks[t]?[...this._hooks[t]]:[],n,t);return i instanceof Promise?i.finally(()=>{this._after&&r&&wg(this._after,r)}):(this._after&&r&&wg(this._after,r),i)}beforeEach(e){return this._before=this._before||[],this._before.push(e),()=>{if(this._before!==void 0){let t=this._before.indexOf(e);t!==-1&&this._before.splice(t,1)}}}afterEach(e){return this._after=this._after||[],this._after.push(e),()=>{if(this._after!==void 0){let t=this._after.indexOf(e);t!==-1&&this._after.splice(t,1)}}}},Eg=Object.create,Dg=Object.defineProperty,Og=Object.getOwnPropertyDescriptor,kg=Object.getOwnPropertyNames,Ag=Object.getPrototypeOf,jg=Object.prototype.hasOwnProperty,Mg=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ng=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=kg(t),a=0,o=i.length,s;a<o;a++)s=i[a],!jg.call(e,s)&&s!==n&&Dg(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Og(t,s))||r.enumerable});return e},Pg=(e,t,n)=>(n=e==null?{}:Eg(Ag(e)),Ng(t||!e||!e.__esModule?Dg(n,`default`,{value:e,enumerable:!0}):n,e)),Fg=Se(import.meta.url);const Ig=/^path$/i,Lg={key:`PATH`,value:``};function Rg(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!Ig.test(t))continue;let n=e[t];return n?{key:t,value:n}:Lg}return Lg}function zg(e,t){let n=t.value.split(a),r=e,i;do n.push(d(r,`node_modules`,`.bin`)),i=r,r=o(r);while(r!==i);return{key:t.key,value:n.join(a)}}function Bg(e,t){let n={...process.env,...t},r=zg(e,Rg(n));return n[r.key]=r.value,n}const Vg=e=>{let t=e.length,n=new Oe,r=()=>{--t===0&&n.emit(`end`)};for(let t of e)t.pipe(n,{end:!1}),t.on(`end`,r);return n};var Hg=Mg((e,t)=>{t.exports=a,a.sync=o;var n=Fg(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}}),Ug=Mg((e,t)=>{t.exports=r,r.sync=i;var n=Fg(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}}),Wg=Mg((e,t)=>{Fg(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Hg():Ug();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}}),Gg=Mg((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=Fg(`path`),i=n?`;`:`:`,a=Wg(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}}),Kg=Mg((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n}),qg=Mg((e,t)=>{let n=Fg(`path`),r=Gg(),i=Kg();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o}),Jg=Mg((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,`$1$1\\"`),e=e.replace(/(\\*)$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i}),Yg=Mg((e,t)=>{t.exports=/^#!(.*)/}),Xg=Mg((e,t)=>{let n=Yg();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}}),Zg=Mg((e,t)=>{let n=Fg(`fs`),r=Xg();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i}),Qg=Mg((e,t)=>{let n=Fg(`path`),r=qg(),i=Jg(),a=Zg(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d}),$g=Mg((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t,`spawn`);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}}),e_=Pg(Mg((e,t)=>{let n=Fg(`child_process`),r=Qg(),i=$g();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})(),1),t_=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t}};const n_={timeout:void 0,persist:!1},r_={windowsHide:!0};function i_(e,t){return{command:l(e),args:t??[]}}function a_(e){let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(),n;n.addEventListener(`abort`,()=>{t.abort(n.reason)},{signal:t.signal})}return t.signal}async function o_(e){let t=``;for await(let n of e)t+=n.toString();return t}var s_=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,n){this._options={...n_,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(e=>{this._resolveClose=e})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return c_(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=Vg(t),r=O.createInterface({input:n});for await(let e of r)yield e.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new t_(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error(`No process was started`);let[t,n]=await Promise.all([this._streamOut?o_(this._streamOut):``,this._streamErr?o_(this._streamErr):``]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new t_(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=ee(),t=this._options,n={...r_,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===!0&&(n.detached=!0),r.length>0&&(n.signal=a_(r)),n.env=Bg(e,n.env);let{command:i,args:a}=i_(this._command,this._args),o=(0,e_._parse)(i,a,n),s=te(o.command,o.args,o.options);if(s.stderr&&(this._streamErr=s.stderr),s.stdout&&(this._streamOut=s.stdout),this._process=s,s.once(`error`,this._onError),s.once(`close`,this._onClose),t.stdin!==void 0&&s.stdin&&t.stdin.process){let{stdout:e}=t.stdin.process;e&&e.pipe(s.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{if(e.name===`AbortError`&&(!(e.cause instanceof Error)||e.cause.name!==`TimeoutError`)){this._aborted=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const c_=(e,t,n)=>{let r=new s_(e,t,n);return r.spawn(),r};function l_(e){return new vd(`builtin:vite-import-glob`,e)}var u_=td(rd(),1);u_.BindingRebuildStrategy;var d_=u_.ResolverFactory;u_.createTokioRuntime,u_.isolatedDeclaration;var f_=u_.isolatedDeclarationSync;u_.minify,u_.minifySync,u_.moduleRunnerTransform,u_.transform,u_.transformSync;const p_=n(import.meta.url),m_=p_(`semver/functions/coerce.js`),h_=p_(`semver/functions/satisfies.js`),g_=p_(`tree-kill`),__=Wo(`tsdown:config:workspace`),v_=[`**/node_modules/**`,`**/dist/**`,`**/test?(s)/**`,`**/t?(e)mp/**`];async function y_(e,t){let n={...e,...t},r=n.cwd||v.cwd(),{workspace:a}=n;if(!a)return{configs:[n],files:[]};a===!0?a={}:(typeof a==`string`||Array.isArray(a))&&(a={include:a});let{include:o=`auto`,exclude:s=v_,config:c}=a;if(o=o===`auto`?(await Tc(`**/package.json`,{ignore:s,cwd:r,expandDirectories:!1})).filter(e=>e!==`package.json`).map(e=>Za(i.resolve(r,e,`..`))):(await Tc(o,{ignore:s,cwd:r,onlyDirectories:!0,absolute:!0,expandDirectories:!1})).map(e=>Za(i.resolve(e))),o.length===0)throw Error(`No workspace packages found, please check your config`);let l=[];return{configs:(await Promise.all(o.map(async e=>{__(`loading workspace config %s`,e);let{configs:r,file:i}=await $l({...t,config:c,cwd:e},e);return i?(__(`loaded workspace config file %s`,i),l.push(i)):__(`no workspace config file found in %s`,e),r.map(e=>({...n,...e}))}))).flat(),files:l}}const b_=Wo(`tsdown:config`);async function x_(e){b_(`inline config %O`,e),e.cwd&&=i.resolve(e.cwd);let{configs:t,file:n}=await $l(e),r=[];n?(r.push(n),b_(`loaded root user config file %s`,n),b_(`root user configs %O`,t)):b_(`no root user config file found`);let a=(await Promise.all(t.map(async t=>{let{configs:n,files:i}=await y_(t,e);return b_(`workspace configs %O`,n),i&&r.push(...i),(await Promise.all(n.filter(e=>!e.workspace||e.entry).map(t=>lu(t,e)))).flat().filter(e=>!!e)}))).flat();if(b_(`resolved configs %O`,a),a.length===0)throw Error(`No valid configuration found.`);return{configs:a,files:r}}function S_(e){!e.target||!(e.checks?.legacyCjs??!0)||!e.format.includes(`cjs`)||e.target.some(e=>{let t=m_(e.split(`node`)[1]);return t&&h_(t,`^20.19.0 || >=22.12.0`)})&&e.logger.warnOnce(`We recommend using the ESM format instead of CommonJS.
87
+ The ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.
88
+ Learn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here`)}async function C_(e){if(!e.copy)return;let t=typeof e.copy==`function`?await e.copy(e):e.copy,n=(await Promise.all(Ja(t).map(async t=>{typeof t==`string`&&(t={from:[t]});let n=Ja(t.from);return n.some(e=>hc(e))&&(n=await Tc(n,{cwd:e.cwd,onlyFiles:!0,expandDirectories:!1})),n.map(e=>r({...t,from:e}))}))).flat();if(!n.length){e.logger.warn(e.nameLabel,`No files matched for copying.`);return}await Promise.all(n.map(({from:t,to:n,verbose:r})=>(r&&e.logger.info(e.nameLabel,`Copying files from ${i.relative(e.cwd,t)} to ${i.relative(e.cwd,n)}`),yo(t,n))));function r(t){let{flatten:n=!0,rename:r}=t,a=i.resolve(e.cwd,t.from),o=t.to?i.resolve(e.cwd,t.to):e.outDir,{base:s,dir:c}=i.parse(i.relative(e.cwd,a)),l=n||!n&&!c?o:c.replace(c.split(i.sep)[0],o),u=i.join(l,r?w_(s,r,a):s);return{...t,from:a,to:u}}}function w_(e,t,n){let r=i.parse(e);return typeof t==`string`?t:t(r.name,r.ext.replace(`.`,``),n)}async function T_(e){let{start:t}=await to(`@vitejs/devtools/cli-commands`);await t({host:`127.0.0.1`,open:!0,...typeof e.ui==`object`?e.ui:{}})}async function E_(e){let t=new Tg;return typeof e.hooks==`object`?t.addHooks(e.hooks):typeof e.hooks==`function`&&await e.hooks(t),{hooks:t,context:{options:e,hooks:t}}}function D_(e){if(!e.onSuccess)return;let t=new AbortController;if(typeof e.onSuccess==`string`){let n=c_(e.onSuccess,[],{nodeOptions:{shell:!0,stdio:`inherit`}});n.then(({exitCode:e})=>{e&&(v.exitCode=e)}),t.signal.addEventListener(`abort`,()=>{typeof n.pid==`number`&&g_(n.pid)})}else e.onSuccess(e,t.signal);return t}const O_=Wo(`tsdown:attw`),k_=ua`[attw]`,A_={NoResolution:`no-resolution`,UntypedResolution:`untyped-resolution`,FalseCJS:`false-cjs`,FalseESM:`false-esm`,CJSResolvesToESM:`cjs-resolves-to-esm`,FallbackCondition:`fallback-condition`,CJSOnlyExportsDefault:`cjs-only-exports-default`,NamedExports:`named-exports`,FalseExportDefault:`false-export-default`,MissingExportEquals:`missing-export-equals`,UnexpectedModuleSyntax:`unexpected-module-syntax`,InternalResolutionError:`internal-resolution-error`},j_={strict:[],node16:[`node10`],"esm-only":[`node10`,`node16-cjs`]};async function M_(e){if(!e.attw)return;if(!e.pkg){e.logger.warn(`attw is enabled but package.json is not found`);return}let{profile:t=`strict`,level:n=`warn`,ignoreRules:r=[],...a}=e.attw,o=r.filter(e=>!Object.values(A_).includes(e));o.length&&e.logger.warn(`attw config option 'ignoreRules' contains invalid value '${o.join(`, `)}'.`);let s=performance.now();O_(`Running attw check`);let c=await T(i.join(fe(),`tsdown-attw-`)),l=await to(`@arethetypeswrong/core`,e.attw.resolvePaths),u;try{let{stdout:t}=await c_(`npm`,[`pack`,`--json`,`--ignore-scripts`,`--pack-destination`,c],{nodeOptions:{cwd:e.cwd}}),n=JSON.parse(t);if(!Array.isArray(n)||!n[0]?.filename)throw Error(`Invalid npm pack output format`);let r=await se(i.join(c,n[0].filename)),o=l.createPackageFromTarballData(r);u=await l.checkPackage(o,a)}catch(t){e.logger.error(`ATTW check failed:`,t);return}finally{await vo(c)}let d;if(u.types){let e=u.problems.filter(e=>r.includes(A_[e.kind])?!1:`resolutionKind`in e?!j_[t]?.includes(e.resolutionKind):!0);e.length&&(d=`problems found:\n${e.map(e=>N_(u.packageName,e)).join(`
89
+ `)}`)}else d=`Package has no types`;d?e.logger[n](e.nameLabel,k_,d):e.logger.success(e.nameLabel,k_,`No problems found`,ua`(${Math.round(performance.now()-s)}ms)`)}function N_(e,t){let n=`resolutionKind`in t?` (${t.resolutionKind})`:``,r=`entrypoint`in t?` at ${Za(i.join(e,t.entrypoint))}`:``;switch(t.kind){case`NoResolution`:return` ❌ No resolution${n}${r}`;case`UntypedResolution`:return` ⚠️ Untyped resolution${n}${r}`;case`FalseESM`:return` 🔄 False ESM: Types indicate ESM (${t.typesModuleKind}) but implementation is CJS (${t.implementationModuleKind})\n Types: ${t.typesFileName} | Implementation: ${t.implementationFileName}`;case`FalseCJS`:return` 🔄 False CJS: Types indicate CJS (${t.typesModuleKind}) but implementation is ESM (${t.implementationModuleKind})\n Types: ${t.typesFileName} | Implementation: ${t.implementationFileName}`;case`CJSResolvesToESM`:return` ⚡ CJS resolves to ESM${n}${r}`;case`NamedExports`:{let e=t.missing?.length>0?` Missing: ${t.missing.join(`, `)}`:``;return` 📤 Named exports problem${t.isMissingAllNamed?` (all named exports missing)`:``}${e}\n Types: ${t.typesFileName} | Implementation: ${t.implementationFileName}`}case`FallbackCondition`:return` 🎯 Fallback condition used${n}${r}`;case`FalseExportDefault`:return` 🎭 False export default\n Types: ${t.typesFileName} | Implementation: ${t.implementationFileName}`;case`MissingExportEquals`:return` 📝 Missing export equals\n Types: ${t.typesFileName} | Implementation: ${t.implementationFileName}`;case`InternalResolutionError`:return` 💥 Internal resolution error in ${t.fileName} (${t.resolutionOption})\n Module: ${t.moduleSpecifier} | Mode: ${t.resolutionMode}`;case`UnexpectedModuleSyntax`:return` 📋 Unexpected module syntax in ${t.fileName}\n Expected: ${t.moduleKind} | Found: ${t.syntax===99?`ESM`:`CJS`}`;case`CJSOnlyExportsDefault`:return` 🏷️ CJS only exports default in ${t.fileName}`;default:return` ❓ Unknown problem: ${JSON.stringify(t)}`}}const P_=Wo(`tsdown:publint`),F_=ua`[publint]`;async function I_(e){if(!e.publint)return;if(!e.pkg){e.logger.warn(e.nameLabel,`publint is enabled but package.json is not found`);return}let t=performance.now();P_(`Running publint`);let{publint:n}=await to(`publint`,e.publint.resolvePaths),{formatMessage:r}=await to(`publint/utils`,e.publint.resolvePaths),{messages:a}=await n({...e.publint,pkgDir:i.dirname(e.pkg.packageJsonPath)});if(P_(`Found %d issues`,a.length),!a.length){e.logger.success(e.nameLabel,F_,`No issues found`,ua`(${Math.round(performance.now()-t)}ms)`);return}for(let t of a){let n=r(t,e.pkg),i={error:`error`,warning:`warn`,suggestion:`info`}[t.type];e.logger[i](e.nameLabel,F_,n)}}function L_(e){let t={};for(let n of e){let e=n.pkg?.packageJsonPath;if(e){if(!t[e]){let{promise:n,resolve:r}=no();t[e]={promise:n,resolve:r,count:0,formats:new Set,bundles:[]}}t[e].count++,t[e].formats.add(n.format)}}return t}async function R_(e,t){let n=t.config.pkg;if(!n)return;let r=e[n.packageJsonPath];if(r.bundles.push(t),r.bundles.length<r.count)return r.promise;let i=r.bundles.map(({config:e})=>e),a=z_(i,`exports`);if(a.length){if(a.length>1)throw Error(`Conflicting exports options for package at ${n.packageJsonPath}. Please merge them:\n${a.map(e=>`- ${p({colors:!0},e.exports)}`).join(`
90
+ `)}`);let e={};for(let t of r.bundles)t.config.exports&&(e[t.config.format]||=[],e[t.config.format].push(...t.chunks));await Nl(a[0],e)}let o=z_(i,`publint`),s=z_(i,`attw`);(o.length>1||s.length>1)&&o[1].logger.warn(`Multiple publint or attw configurations found for package at ${n.packageJsonPath}. Consider merging them for better consistency and performance.`),await Promise.all([...o.map(e=>I_(e)),...s.map(e=>M_(e))]),r.resolve()}function z_(e,t){let n=e.filter(e=>e[t]);if(!n.length)return[];let r=new Set,i=n.filter(e=>!Object.keys(e[t]).length||r.has(e[t])?!1:(r.add(e[t]),!0));return i.length===0?[n[0]]:i}function B_(e){let t,n=[...e.join(` `).toLowerCase().matchAll(V_)];for(let e of n){let n=H_[e[1]];if(!n)continue;let r=e[2],i=U_(r);i!=null&&(t||={},t[n]=i)}return t}const V_=/([a-z]+)(\d+(?:\.\d+)*)/g,H_={chrome:`chrome`,edge:`edge`,firefox:`firefox`,ie:`ie`,ios:`ios_saf`,opera:`opera`,safari:`safari`};function U_(e){let[t,n=0,r=0]=e.split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10));return Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r)?null:t<<16|n<<8|r}async function W_(e){let t=await import(`unplugin-lightningcss/rolldown`).catch(()=>void 0);if(!t)return;let n=e.target&&B_(e.target);if(n)return t.default({options:{targets:n}})}function G_(e){let{splitting:t,fileName:n}=e.css;if(!t)return{name:`tsdown:css:splitting`,generateBundle(e,t){let r=Object.values(t),i=new Map;for(let e of r)e.type===`asset`&&typeof e.source==`string`&&jc.test(n)&&i.set(e.fileName,e.source);if(!i.size)return;let a=new Map;for(let e of r)if(e.type===`chunk`){for(let t of e.moduleIds)if(jc.test(t)){a.has(e.fileName)||a.set(e.fileName,[]);break}}for(let e of i.keys()){let t=Y_(e);for(let n of a.keys())if(X_(n)===t||n.startsWith(`${t}-`)){a.get(n).push(e);break}}let o=``,s=new Set,c=new Set;function l(e){if(!e||e.type!==`chunk`||s.has(e))return;s.add(e),e.imports.forEach(e=>{l(t[e])}),e.dynamicImports.forEach(e=>{c.add(e)});let n=a.get(e.fileName);if(n&&n.length>0)for(let e of n)o+=i.get(e)??``}for(let e of r)e.type===`chunk`&&e.isEntry&&l(e);for(let e of c)l(t[e]);if(o){for(let e of i.keys())delete t[e];this.emitFile({type:`asset`,source:o,fileName:n,originalFileName:Dl})}}}}const K_=/-[\w-]+\.css$/,q_=/-[\w-]+\.(m?js|cjs)$/,J_=/\.(m?js|cjs)$/;function Y_(e){return e.replace(K_,``).replace(jc,``)}function X_(e){return e.replace(q_,``).replace(J_,``)}function Z_(e,t,n){switch(t){case`es`:return!n&&e===`module`?`js`:`mjs`;case`cjs`:return n||e===`module`?`cjs`:`js`;default:return`js`}}function Q_({outExtensions:e,fixedExtension:t,pkg:n,hash:r},i,a){let o=Jl(n),s,c;if(e){let{js:t,dts:n}=e({options:i,format:a,pkgType:o})||{};s=t,c=n}s??=`.${Z_(o,a,t)}`;let l=a===`iife`||a===`umd`?`.${a}`:``;return[$_(`[name]${l}`,s,c),$_(`[name]${l}${r?`-[hash]`:``}`,s,c)]}function $_(e,t,n){return n===void 0?`${e}${t}`:r=>`${e}${r.name.endsWith(`.d`)?n:t}`}function ev(e,t){if(e)return n=>{if(typeof e==`function`&&(e=e({format:t,fileName:n.fileName})),typeof e==`string`)return e;switch(!0){case Ec.test(n.fileName):return e?.js||``;case jc.test(n.fileName):return e?.css||``;case Oc.test(n.fileName):return e?.dts||``;default:return``}}}const tv=Wo(`tsdown:rolldown`);async function nv(e,t,n,r,i=!1,a){let o=await rv(e,t,n,r,i,a),s=await iv(o,e,t,i),c={...o,output:s,write:e.write};return tv(`rolldown config with format "%s" %O`,i?`cjs dts`:t,c),c}async function rv(e,t,n,r,i,a){let{alias:o,checks:{legacyCjs:s,...c}={},cjsDefault:l,cwd:u,devtools:d,dts:f,entry:p,env:m,external:h,globImport:g,loader:_,logger:v,nameLabel:ee,nodeProtocol:y,platform:b,plugins:x,report:te,shims:S,target:ne,treeshake:re,tsconfig:ie,unused:C,watch:ae}=e,w=[];if(y&&w.push(Fu(y)),(e.pkg||e.skipNodeModulesBundle)&&w.push(Nu(e)),f){let{dts:e}=await import(`./dist-mM4pkTG1.js`),n={tsconfig:ie,...f};t===`es`?w.push(e(n)):i&&w.push(e({...n,emitDtsOnly:!0,cjsDefault:l}))}if(!i){if(C){let{Unused:e}=await to(`unplugin-unused`);w.push(e.rolldown({root:u,...C}))}ne&&w.push(await W_({target:ne}));let t=G_(e);t&&w.push(t),w.push(Uu(v,u,ee,a)),g&&w.push(l_({root:u}))}te&&ro[v.level]>=3&&w.push(Bu(te,v,u,i,ee,a)),ae&&w.push(Ku(n,r)),i||w.push(x);let oe={...e.define,...Object.keys(m).reduce((e,t)=>{let n=JSON.stringify(m[t]);return e[`process.env.${t}`]=n,e[`import.meta.env.${t}`]=n,e},Object.create(null))},T=S&&!i?ju(t,b):void 0;return await fu({input:p,cwd:u,external:h,resolve:{alias:o},tsconfig:ie||void 0,treeshake:re,platform:i||t===`cjs`?`node`:b,transform:{target:ne,define:oe,inject:T},plugins:w,moduleTypes:_,logLevel:v.level===`error`?`silent`:v.level,onLog:l?(e,t,n)=>{t.code!==`MIXED_EXPORT`&&n(e,t)}:void 0,devtools:d||void 0,checks:c},e.inputOptions,[t,{cjsDts:i}])}async function iv(e,t,n,r){let{banner:i,cjsDefault:a,entry:o,footer:s,minify:c,outDir:l,sourcemap:u,unbundle:d}=t,[f,p]=Q_(t,e,n);return await fu({format:r?`es`:n,name:t.globalName,sourcemap:u,dir:l,exports:a?`auto`:`named`,minify:!r&&c,entryFileNames:f,chunkFileNames:p,preserveModules:d,preserveModulesRoot:d?bo(...Object.values(o)):void 0,postBanner:ev(i,n),postFooter:ev(s,n)},t.outputOptions,[n,{cjsDts:r}])}async function av(){if(tv.enabled)return await T(i.join(fe(),`tsdown-config-`))}async function ov(e,t,n,r){let a=i.join(e,`rolldown.config.${n}.js`);sv(r.plugins);let o=p({depth:null,maxArrayLength:null,maxStringLength:null},r);await D(a,`/*
91
+ Auto-generated rolldown config for tsdown debug purposes
92
+ tsdown v${gu}, rolldown v${Kd}
93
+ Generated on ${new Date().toISOString()}
94
+ Package name: ${t||`not specified`}
282
95
  */
283
- async function buildToolPackage(options) {
284
- const entryDir = path.resolve(options.entry);
285
- await assertPathExists(entryDir, `入口目录不存在: ${entryDir}`);
286
- const configPath = path.join(entryDir, "config.ts");
287
- await assertPathExists(configPath, `找不到 config.ts 文件: ${configPath}`);
288
- const indexPath = path.join(entryDir, "index.ts");
289
- await assertPathExists(indexPath, `找不到 index.ts 文件: ${indexPath}`);
290
- const tempDir = path.join(entryDir, ".build-temp");
291
- await ensureDir(tempDir);
292
- try {
293
- const transformed = transformToolConfig({
294
- sourceCode: await fs.readFile(configPath, "utf-8"),
295
- filePath: configPath
296
- });
297
- await fs.writeFile(path.join(tempDir, "config.ts"), transformed.code, "utf-8");
298
- await copySourceFiles(entryDir, tempDir, entryDir);
299
- const outputDir = path.resolve(options.output);
300
- await ensureDir(outputDir);
301
- await build({
302
- entry: [path.join(tempDir, "index.ts")],
303
- outDir: outputDir,
304
- format: [options.format],
305
- clean: true,
306
- minify: options.minify,
307
- platform: "node",
308
- target: "node22",
309
- dts: {
310
- enabled: true,
311
- sourcemap: false
312
- },
313
- treeshake: true,
314
- skipNodeModulesBundle: process.env.NODE_ENV === "test",
315
- external: process.env.NODE_ENV === "test" ? ["@fastgpt-plugin/helpers"] : []
316
- });
317
- return {
318
- entryDir,
319
- outputDir,
320
- files: (await fs.readdir(outputDir)).map((f) => f)
321
- };
322
- } finally {
323
- try {
324
- await fs.rm(tempDir, {
325
- recursive: true,
326
- force: true
327
- });
328
- } catch {}
329
- }
330
- }
331
- /**
332
- * 从入口目录复制源码到临时目录:
333
- * - 根目录的 config.ts 已被转换,不再复制
334
- * - 子目录中的 config.ts 需要保留(子工具自身的配置)
335
- */
336
- async function copySourceFiles(sourceDir, targetDir, rootDir) {
337
- const files = await fs.readdir(sourceDir, { withFileTypes: true });
338
- for (const file of files) {
339
- if (file.name === "node_modules" || file.name === "dist" || file.name.startsWith(".build-")) continue;
340
- const sourcePath = path.join(sourceDir, file.name);
341
- const targetPath = path.join(targetDir, file.name);
342
- if (file.isDirectory()) {
343
- await ensureDir(targetPath);
344
- await copySourceFiles(sourcePath, targetPath, rootDir);
345
- } else if (file.isFile()) {
346
- if (!(file.name === "config.ts" && sourceDir === rootDir)) if (file.name === "config.ts") {
347
- const transformed = transformToolConfig({
348
- sourceCode: await fs.readFile(sourcePath, "utf-8"),
349
- filePath: sourcePath
350
- });
351
- await fs.writeFile(targetPath, transformed.code, "utf-8");
352
- } else await fs.copyFile(sourcePath, targetPath);
353
- }
354
- }
355
- }
356
- async function ensureDir(dir) {
357
- await fs.mkdir(dir, { recursive: true });
358
- }
359
- async function assertPathExists(p, message) {
360
- try {
361
- await fs.access(p);
362
- } catch {
363
- throw new Error(message);
364
- }
365
- }
366
-
367
- //#endregion
368
- //#region src/commands/build.ts
369
- var BuildCommand = class extends BaseCommand {
370
- register(parent) {
371
- parent.command("build").description("构建 FastGPT 插件为可分发的包").option("-e, --entry <path>", "工具入口目录", process.cwd()).option("-o, --output <path>", "输出目录", "./dist").option("-m, --minify", "压缩输出代码", false).option("-w, --watch", "监听模式", false).option("-f, --format <format>", "输出格式: esm | cjs", "esm").action(async (opts) => {
372
- await this.run({
373
- entry: opts.entry,
374
- output: opts.output,
375
- minify: opts.minify,
376
- watch: opts.watch,
377
- format: opts.format
378
- });
379
- });
380
- }
381
- async run(options) {
382
- const start = Date.now();
383
- logger.box([
384
- "FastGPT 插件构建",
385
- "",
386
- `入口目录: ${options.entry}`,
387
- `输出目录: ${options.output}`,
388
- `代码压缩: ${options.minify ? "开启" : "关闭"}`,
389
- `输出格式: ${options.format}`,
390
- ""
391
- ].join("\n"));
392
- logger.start("准备构建插件...");
393
- try {
394
- const result = await buildToolPackage(options);
395
- const duration = ((Date.now() - start) / 1e3).toFixed(2);
396
- logger.success(`构建完成,用时 ${duration}s`);
397
- logger.info(`输出目录: ${result.outputDir}`);
398
- if (result.files.length > 0) {
399
- logger.info("生成的文件列表:");
400
- result.files.forEach((file) => {
401
- logger.info(` • ${file}`);
402
- });
403
- } else logger.info("未检测到输出文件,请检查配置。");
404
- logger.info("\n下一步: 可以将该目录作为 npm 包发布,或在 FastGPT 中作为插件安装使用。");
405
- if (options.watch) logger.info("\n监听模式暂不支持,请使用 --no-watch 选项");
406
- } catch (error) {
407
- logger.error("构建失败,详情如下:");
408
- logger.error(error instanceof Error ? error : new Error(String(error)));
409
- logger.info("如果这是在 CI 中发生的,请查看上方构建日志以获取更多信息。");
410
- process.exit(1);
411
- }
412
- }
413
- };
414
-
415
- //#endregion
416
- //#region src/cmd.ts
417
- function createProgram() {
418
- const program = new Command();
419
- program.name(CLI_NAME).version(CLI_VERSION).description("FastGPT 插件开发 CLI");
420
- new CreateCommand().register(program);
421
- new BuildCommand().register(program);
422
- return program;
423
- }
424
- /**
425
- * 运行 CLI,解析 process.argv。
426
- * @param argv 可选,用于测试时注入参数(如 ['node', 'cli', '--version'])
427
- */
428
- async function run(argv) {
429
- await createProgram().parseAsync(argv ?? process.argv);
430
- }
431
-
432
- //#endregion
433
- //#region src/index.ts
434
- const main = async () => {
435
- try {
436
- await run();
437
- } catch (error) {
438
- logger.error(error);
439
- process.exitCode = 1;
440
- }
441
- };
442
- if (import.meta.main) main();
443
96
 
444
- //#endregion
445
- export { };
97
+ export default ${o}\n`),tv(`Wrote debug rolldown config for "%s" (%s) -> %s`,t||`default name`,n,a)}function sv(e){if(Array.isArray(e))for(let t of e)sv(t);else typeof e==`object`&&e&&`name`in e&&(e[m.custom]=function(t,n,r){return`_options`in e?r({name:e.name,options:e._options},n):`"rolldown plugin: ${e.name}"`})}function cv(e){let t=!1;async function n(n){if(t)return;n=n.trim().toLowerCase();let r=[{key:`r`,description:`reload config and rebuild`,action(){e()}},{key:`c`,description:`clear console`,action(){console.clear()}},{key:`q`,description:`quit`,action(){v.exit(0)}}];if(n===`h`){let e=new Set;co.info(` Shortcuts`);for(let t of r)e.has(t.key)||(e.add(t.key),t.action!=null&&co.info(ua` press `+la`${t.key} + enter`+ua` to ${t.description}`));return}let i=r.find(e=>e.key===n);i&&(t=!0,await i.action(),t=!1)}let r=O.createInterface({input:v.stdin});return r.on(`line`,n),()=>r.close()}const lv=Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`);async function uv(e={}){co.level=e.logLevel||`info`;let{configs:t,files:n}=await x_(e);return dv(t,n,()=>uv(e))}async function dv(e,t,n){let r,i=()=>r||=wl(e),a=[],o=!1;async function s(){o||(o=!0,await Promise.all(a.map(e=>e())),Jc(),n())}let c=L_(e);function l(e){return R_(c,e)}co.info(`Build start`);let u=await Promise.all(e.map(e=>fv(e,t,e.pkg?c[e.pkg.packageJsonPath].formats.size>1:!0,i,s,l))),d=e.find(e=>e.devtools&&e.devtools.ui);if(e.some(e=>e.watch)){a.push(cv(s));for(let e of u)a.push(e[lv])}else d&&T_(d.devtools);return u}async function fv(e,t,n,r,i,a){let{format:o,dts:s,watch:c,logger:l,outDir:u}=e,{hooks:d,context:f}=await E_(e);S_(e);let p=performance.now();await d.callHook(`build:prepare`,f),await r();let m=await av(),h=[],g,_,v=!1,ee={chunks:h,config:e,async[lv](){_?.abort(),await g?.close()}},y=await x();if(c)g=hg(y),b(g);else{let e=await vg(y);for(let{output:t}of e)h.push(...Wu(t,u))}return c||(l.success(e.nameLabel,`Build complete in ${ga(`${Math.round(performance.now()-p)}ms`)}`),await te()),ee;function b(n){let r=[],a=!1;n.on(`change`,(e,n)=>{n.event===`update`&&r.push(e),(t.includes(e)||Gu.test(e))&&(co.info(`Reload config: ${e}, restarting...`),i())}),n.on(`event`,async t=>{switch(t.code){case`START`:e.clean.length&&await El(e.outDir,h),h.length=0,a=!1;break;case`END`:a||await te();break;case`BUNDLE_START`:r.length&&(l.clearScreen(`info`),l.info(`Found ${la(r.join(`, `))} changed, rebuilding...`)),r.length=0;break;case`BUNDLE_END`:await t.result.close(),l.success(e.nameLabel,`Rebuilt in ${t.duration}ms.`);break;case`ERROR`:await t.result.close(),l.error(t.error),a=!0;break}})}async function x(){let r=await nv(e,o,t,ee,!1,n);await d.callHook(`build:before`,{...f,buildOptions:r}),m&&await ov(m,e.name,o,r);let i=[r];return o===`cjs`&&s&&i.push(await nv(e,o,t,ee,!0,n)),i}async function te(){await C_(e),v||await a(ee),await d.callHook(`build:done`,{...f,chunks:h}),v=!0,_?.abort(),_=D_(e)}}Wo(`tsdown:debug`);const X=n(import.meta.url);new URL(`.`,import.meta.url).pathname;const{readFileSync:pv}=X(`node:fs`);let mv=null;const Z=[],hv=()=>{let e=!1;return process.platform===`linux`&&(e=_v(),e===null&&(e=vv()),e===null&&(e=yv())),e},gv=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),_v=()=>{try{return pv(`/usr/bin/ldd`,`utf-8`).includes(`musl`)}catch{return null}},vv=()=>{let e=null;return typeof process.report?.getReport==`function`&&(process.report.excludeNetwork=!0,e=process.report.getReport()),e?e.header&&e.header.glibcVersionRuntime?!1:!!(Array.isArray(e.sharedObjects)&&e.sharedObjects.some(gv)):null},yv=()=>{try{return X(`child_process`).execSync(`ldd --version`,{encoding:`utf8`}).includes(`musl`)}catch{return!1}};function bv(){if(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)try{return X(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)}catch(e){Z.push(e)}else if(process.platform===`android`)if(process.arch===`arm64`){try{return X(`./parser.android-arm64.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-android-arm64`),t=X(`@oxc-parser/binding-android-arm64/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`arm`){try{return X(`./parser.android-arm-eabi.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-android-arm-eabi`),t=X(`@oxc-parser/binding-android-arm-eabi/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else Z.push(Error(`Unsupported architecture on Android ${process.arch}`));else if(process.platform===`win32`)if(process.arch===`x64`)if(process.config?.variables?.shlib_suffix===`dll.a`||process.config?.variables?.node_target_type===`shared_library`){try{return X(`./parser.win32-x64-gnu.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-win32-x64-gnu`),t=X(`@oxc-parser/binding-win32-x64-gnu/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else{try{return X(`./parser.win32-x64-msvc.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-win32-x64-msvc`),t=X(`@oxc-parser/binding-win32-x64-msvc/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`ia32`){try{return X(`./parser.win32-ia32-msvc.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-win32-ia32-msvc`),t=X(`@oxc-parser/binding-win32-ia32-msvc/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`arm64`){try{return X(`./parser.win32-arm64-msvc.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-win32-arm64-msvc`),t=X(`@oxc-parser/binding-win32-arm64-msvc/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else Z.push(Error(`Unsupported architecture on Windows: ${process.arch}`));else if(process.platform===`darwin`){try{return X(`./parser.darwin-universal.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-darwin-universal`),t=X(`@oxc-parser/binding-darwin-universal/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}if(process.arch===`x64`){try{return X(`./parser.darwin-x64.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-darwin-x64`),t=X(`@oxc-parser/binding-darwin-x64/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`arm64`){try{return X(`./parser.darwin-arm64.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-darwin-arm64`),t=X(`@oxc-parser/binding-darwin-arm64/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else Z.push(Error(`Unsupported architecture on macOS: ${process.arch}`))}else if(process.platform===`freebsd`)if(process.arch===`x64`){try{return X(`./parser.freebsd-x64.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-freebsd-x64`),t=X(`@oxc-parser/binding-freebsd-x64/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`arm64`){try{return X(`./parser.freebsd-arm64.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-freebsd-arm64`),t=X(`@oxc-parser/binding-freebsd-arm64/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else Z.push(Error(`Unsupported architecture on FreeBSD: ${process.arch}`));else if(process.platform===`linux`)if(process.arch===`x64`)if(hv()){try{return X(`./parser.linux-x64-musl.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-x64-musl`),t=X(`@oxc-parser/binding-linux-x64-musl/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else{try{return X(`./parser.linux-x64-gnu.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-x64-gnu`),t=X(`@oxc-parser/binding-linux-x64-gnu/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`arm64`)if(hv()){try{return X(`./parser.linux-arm64-musl.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-arm64-musl`),t=X(`@oxc-parser/binding-linux-arm64-musl/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else{try{return X(`./parser.linux-arm64-gnu.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-arm64-gnu`),t=X(`@oxc-parser/binding-linux-arm64-gnu/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`arm`)if(hv()){try{return X(`./parser.linux-arm-musleabihf.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-arm-musleabihf`),t=X(`@oxc-parser/binding-linux-arm-musleabihf/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else{try{return X(`./parser.linux-arm-gnueabihf.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-arm-gnueabihf`),t=X(`@oxc-parser/binding-linux-arm-gnueabihf/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`loong64`)if(hv()){try{return X(`./parser.linux-loong64-musl.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-loong64-musl`),t=X(`@oxc-parser/binding-linux-loong64-musl/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else{try{return X(`./parser.linux-loong64-gnu.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-loong64-gnu`),t=X(`@oxc-parser/binding-linux-loong64-gnu/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`riscv64`)if(hv()){try{return X(`./parser.linux-riscv64-musl.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-riscv64-musl`),t=X(`@oxc-parser/binding-linux-riscv64-musl/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else{try{return X(`./parser.linux-riscv64-gnu.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-riscv64-gnu`),t=X(`@oxc-parser/binding-linux-riscv64-gnu/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`ppc64`){try{return X(`./parser.linux-ppc64-gnu.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-ppc64-gnu`),t=X(`@oxc-parser/binding-linux-ppc64-gnu/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`s390x`){try{return X(`./parser.linux-s390x-gnu.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-linux-s390x-gnu`),t=X(`@oxc-parser/binding-linux-s390x-gnu/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else Z.push(Error(`Unsupported architecture on Linux: ${process.arch}`));else if(process.platform===`openharmony`)if(process.arch===`arm64`){try{return X(`./parser.openharmony-arm64.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-openharmony-arm64`),t=X(`@oxc-parser/binding-openharmony-arm64/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`x64`){try{return X(`./parser.openharmony-x64.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-openharmony-x64`),t=X(`@oxc-parser/binding-openharmony-x64/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else if(process.arch===`arm`){try{return X(`./parser.openharmony-arm.node`)}catch(e){Z.push(e)}try{let e=X(`@oxc-parser/binding-openharmony-arm`),t=X(`@oxc-parser/binding-openharmony-arm/package.json`).version;if(t!==`0.112.0`&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK!==`0`)throw Error(`Native binding package version mismatch, expected 0.112.0 but got ${t}. You can reinstall dependencies to fix this issue.`);return e}catch(e){Z.push(e)}}else Z.push(Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));else Z.push(Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))}if(mv=bv(),!mv||process.env.NAPI_RS_FORCE_WASI){let e=null,t=null;try{e=X(`./parser.wasi.cjs`),mv=e}catch(e){process.env.NAPI_RS_FORCE_WASI&&(t=e)}if(!mv||process.env.NAPI_RS_FORCE_WASI)try{e=X(`@oxc-parser/binding-wasm32-wasi`),mv=e}catch(e){process.env.NAPI_RS_FORCE_WASI&&(t?t.cause=e:t=e,Z.push(e))}if(process.env.NAPI_RS_FORCE_WASI===`error`&&!e){let e=Error(`WASI binding not found and NAPI_RS_FORCE_WASI is set to error`);throw e.cause=t,e}}if(!mv&&globalThis.process?.versions?.webcontainer)try{mv=X(`./webcontainer-fallback.cjs`)}catch(e){Z.push(e)}if(!mv)throw Z.length>0?Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.",{cause:Z.reduce((e,t)=>(t.cause=e,t))}):Error(`Failed to load native binding`);const{Severity:xv,ParseResult:Sv,ExportExportNameKind:Cv,ExportImportNameKind:wv,ExportLocalNameKind:Tv,ImportNameKind:Ev,parse:Dv,parseSync:Ov,rawTransferSupported:kv}=mv,{getBufferOffset:Av,parseRaw:jv,parseRawSync:Mv}=mv;function Nv(e){let t,n,r,i;return{get program(){return t||=Pv(e.program),t},get module(){return n||=e.module,n},get comments(){return r||=e.comments,r},get errors(){return i||=e.errors,i}}}function Pv(e){let{node:t,fixes:n}=JSON.parse(e);for(let e of n)Fv(t,e);return t}function Fv(e,t){let n=e;for(let e of t)n=n[e];if(n.bigint)n.value=BigInt(n.bigint);else try{n.value=RegExp(n.regex.pattern,n.regex.flags)}catch{}}const{freeze:Q}=Object,$=Q([]),Iv=Q([`decorators`,`key`,`typeAnnotation`,`value`]),Lv=Q([`left`,`right`]),Rv=Q([`argument`]),zv=Q([`body`]),Bv=Q([`label`]),Vv=Q([`callee`,`typeArguments`,`arguments`]),Hv=Q([`expression`]),Uv=Q([`decorators`,`id`,`typeParameters`,`superClass`,`superTypeArguments`,`implements`,`body`]),Wv=Q([`test`,`consequent`,`alternate`]),Gv=Q([`left`,`right`,`body`]),Kv=Q([`id`,`typeParameters`,`params`,`returnType`,`body`]),qv=Q([`key`,`value`]),Jv=Q([`local`]),Yv=Q([`object`,`property`]),Xv=Q([`decorators`,`key`,`typeAnnotation`]),Zv=Q([`expression`,`typeAnnotation`]),Qv=Q([`typeParameters`,`params`,`returnType`]),$v=Q([`expression`,`typeArguments`]),ey=Q([`members`]),ty=Q([`id`,`body`]),ny=Q([`types`]),ry=Q([`typeAnnotation`]),iy=Q([`params`]);Q({DebuggerStatement:$,EmptyStatement:$,Literal:$,PrivateIdentifier:$,Super:$,TemplateElement:$,ThisExpression:$,JSXClosingFragment:$,JSXEmptyExpression:$,JSXIdentifier:$,JSXOpeningFragment:$,JSXText:$,TSAnyKeyword:$,TSBigIntKeyword:$,TSBooleanKeyword:$,TSIntrinsicKeyword:$,TSJSDocUnknownType:$,TSNeverKeyword:$,TSNullKeyword:$,TSNumberKeyword:$,TSObjectKeyword:$,TSStringKeyword:$,TSSymbolKeyword:$,TSThisType:$,TSUndefinedKeyword:$,TSUnknownKeyword:$,TSVoidKeyword:$,AccessorProperty:Iv,ArrayExpression:Q([`elements`]),ArrayPattern:Q([`decorators`,`elements`,`typeAnnotation`]),ArrowFunctionExpression:Q([`typeParameters`,`params`,`returnType`,`body`]),AssignmentExpression:Lv,AssignmentPattern:Q([`decorators`,`left`,`right`,`typeAnnotation`]),AwaitExpression:Rv,BinaryExpression:Lv,BlockStatement:zv,BreakStatement:Bv,CallExpression:Vv,CatchClause:Q([`param`,`body`]),ChainExpression:Hv,ClassBody:zv,ClassDeclaration:Uv,ClassExpression:Uv,ConditionalExpression:Wv,ContinueStatement:Bv,Decorator:Hv,DoWhileStatement:Q([`body`,`test`]),ExportAllDeclaration:Q([`exported`,`source`,`attributes`]),ExportDefaultDeclaration:Q([`declaration`]),ExportNamedDeclaration:Q([`declaration`,`specifiers`,`source`,`attributes`]),ExportSpecifier:Q([`local`,`exported`]),ExpressionStatement:Hv,ForInStatement:Gv,ForOfStatement:Gv,ForStatement:Q([`init`,`test`,`update`,`body`]),FunctionDeclaration:Kv,FunctionExpression:Kv,Identifier:Q([`decorators`,`typeAnnotation`]),IfStatement:Wv,ImportAttribute:qv,ImportDeclaration:Q([`specifiers`,`source`,`attributes`]),ImportDefaultSpecifier:Jv,ImportExpression:Q([`source`,`options`]),ImportNamespaceSpecifier:Jv,ImportSpecifier:Q([`imported`,`local`]),LabeledStatement:Q([`label`,`body`]),LogicalExpression:Lv,MemberExpression:Yv,MetaProperty:Q([`meta`,`property`]),MethodDefinition:Q([`decorators`,`key`,`value`]),NewExpression:Vv,ObjectExpression:Q([`properties`]),ObjectPattern:Q([`decorators`,`properties`,`typeAnnotation`]),ParenthesizedExpression:Hv,Program:zv,Property:qv,PropertyDefinition:Iv,RestElement:Q([`decorators`,`argument`,`typeAnnotation`]),ReturnStatement:Rv,SequenceExpression:Q([`expressions`]),SpreadElement:Rv,StaticBlock:zv,SwitchCase:Q([`test`,`consequent`]),SwitchStatement:Q([`discriminant`,`cases`]),TaggedTemplateExpression:Q([`tag`,`typeArguments`,`quasi`]),TemplateLiteral:Q([`quasis`,`expressions`]),ThrowStatement:Rv,TryStatement:Q([`block`,`handler`,`finalizer`]),UnaryExpression:Rv,UpdateExpression:Rv,V8IntrinsicExpression:Q([`name`,`arguments`]),VariableDeclaration:Q([`declarations`]),VariableDeclarator:Q([`id`,`init`]),WhileStatement:Q([`test`,`body`]),WithStatement:Q([`object`,`body`]),YieldExpression:Rv,JSXAttribute:Q([`name`,`value`]),JSXClosingElement:Q([`name`]),JSXElement:Q([`openingElement`,`children`,`closingElement`]),JSXExpressionContainer:Hv,JSXFragment:Q([`openingFragment`,`children`,`closingFragment`]),JSXMemberExpression:Yv,JSXNamespacedName:Q([`namespace`,`name`]),JSXOpeningElement:Q([`name`,`typeArguments`,`attributes`]),JSXSpreadAttribute:Rv,JSXSpreadChild:Hv,TSAbstractAccessorProperty:Xv,TSAbstractMethodDefinition:qv,TSAbstractPropertyDefinition:Xv,TSArrayType:Q([`elementType`]),TSAsExpression:Zv,TSCallSignatureDeclaration:Qv,TSClassImplements:$v,TSConditionalType:Q([`checkType`,`extendsType`,`trueType`,`falseType`]),TSConstructSignatureDeclaration:Qv,TSConstructorType:Qv,TSDeclareFunction:Kv,TSEmptyBodyFunctionExpression:Q([`id`,`typeParameters`,`params`,`returnType`]),TSEnumBody:ey,TSEnumDeclaration:ty,TSEnumMember:Q([`id`,`initializer`]),TSExportAssignment:Hv,TSExternalModuleReference:Hv,TSFunctionType:Qv,TSImportEqualsDeclaration:Q([`id`,`moduleReference`]),TSImportType:Q([`source`,`options`,`qualifier`,`typeArguments`]),TSIndexSignature:Q([`parameters`,`typeAnnotation`]),TSIndexedAccessType:Q([`objectType`,`indexType`]),TSInferType:Q([`typeParameter`]),TSInstantiationExpression:$v,TSInterfaceBody:zv,TSInterfaceDeclaration:Q([`id`,`typeParameters`,`extends`,`body`]),TSInterfaceHeritage:$v,TSIntersectionType:ny,TSJSDocNonNullableType:ry,TSJSDocNullableType:ry,TSLiteralType:Q([`literal`]),TSMappedType:Q([`key`,`constraint`,`nameType`,`typeAnnotation`]),TSMethodSignature:Q([`key`,`typeParameters`,`params`,`returnType`]),TSModuleBlock:zv,TSModuleDeclaration:ty,TSNamedTupleMember:Q([`label`,`elementType`]),TSNamespaceExportDeclaration:Q([`id`]),TSNonNullExpression:Hv,TSOptionalType:ry,TSParameterProperty:Q([`decorators`,`parameter`]),TSParenthesizedType:ry,TSPropertySignature:Q([`key`,`typeAnnotation`]),TSQualifiedName:Lv,TSRestType:ry,TSSatisfiesExpression:Zv,TSTemplateLiteralType:Q([`quasis`,`types`]),TSTupleType:Q([`elementTypes`]),TSTypeAliasDeclaration:Q([`id`,`typeParameters`,`typeAnnotation`]),TSTypeAnnotation:ry,TSTypeAssertion:Q([`typeAnnotation`,`expression`]),TSTypeLiteral:ey,TSTypeOperator:ry,TSTypeParameter:Q([`name`,`constraint`,`default`]),TSTypeParameterDeclaration:iy,TSTypeParameterInstantiation:iy,TSTypePredicate:Q([`parameterName`,`typeAnnotation`]),TSTypeQuery:Q([`exprName`,`typeArguments`]),TSTypeReference:Q([`typeName`,`typeArguments`]),TSUnionType:ny});let ay=null,oy,sy,cy;var ly=class{#e=null;constructor(e){if(ay===null){let e=n(import.meta.url);({walkProgram:ay}=e(`../generated/visit/walk.js`)),{addVisitorToCompiled:oy,createCompiledVisitor:sy,finalizeCompiledVisitor:cy}=e(`./visitor.js`)}let t=sy();oy(e),cy()&&(this.#e=t)}visit(e){let t=this.#e;t!==null&&ay(e,t)}};const uy=n(import.meta.url);let dy=null,fy,py=null,my,hy;function gy(){dy===null&&({parseSyncRaw:dy,parse:fy}=uy(`./raw-transfer/eager.js`))}function _y(){py===null&&({parseSyncLazy:py,parse:my,Visitor:hy}=uy(`./raw-transfer/lazy.js`))}function vy(e,t,n){return n?.experimentalRawTransfer?(gy(),dy(e,t,n)):n?.experimentalLazy?(_y(),py(e,t,n)):Nv(Ov(e,t,n))}async function yy(e){let t=i.join(e.rootDir,`src`);if(!await xy(t))return Sy(``);let n=[],r=async t=>{let a=await C.readdir(t,{withFileTypes:!0});for(let o of a){let a=i.join(t,o.name);if(o.isDirectory()){if(o.name===`__tests__`)continue;await r(a);continue}if(!o.isFile())continue;let s=o.name;if(s.includes(`.test.`)||s.includes(`.spec.`))continue;let c=i.relative(e.rootDir,a).split(i.sep).join(`/`);c.startsWith(`src/`)&&n.push({rel:c,abs:a})}};await r(t),n.sort((e,t)=>e.rel.localeCompare(t.rel));let a=``;for(let e of n){let t=Sy(await C.readFile(e.abs));a+=`${e.rel}:${t}\n`}return Sy(a)}async function by(e){let{rootDir:t,toolId:n}=e,r=[...e.children].sort(),a=[];for(let e of r){let r=await yy({rootDir:i.join(t,`children`,e)});a.push(`${n}/${e}:${r}`)}return Sy(a.length>0?`${a.join(`
98
+ `)}\n`:``)}async function xy(e){try{return await C.access(e),!0}catch{return!1}}function Sy(e){let t=pe(`md5`);return t.update(e),t.digest(`hex`)}function Cy(e){let t=e.split(`/`);return t.at(-3)===`children`?`${t.at(-4)}/${t.at(-2)}`:t.at(-2)||`unknown`}async function wy(e){let t=i.join(e,`children`);try{await C.access(t)}catch{return[]}try{return await C.readdir(t)}catch{return[]}}function Ty(e,t){return e.some(e=>e.type===`Property`&&e.key?.type===`Identifier`&&e.key?.name===t)}function Ey(e,t){let n=t.sort((e,t)=>t.start-e.start),r=e;for(let e of n)r=r.slice(0,e.start)+e.content+r.slice(e.end);return r}async function Dy({sourceCode:e,filePath:t}){if(e.includes(`toolId:`))return{code:e,hasToolId:!0};let n=Cy(t),r=i.dirname(t),a=await wy(r),o=await yy({rootDir:r}),s=a.length>0?await by({rootDir:r,toolId:n,children:a}):null,c=vy(i.basename(t),e,{sourceType:`module`});if(c.errors.length>0)throw Error(`Parse errors: ${c.errors.map(e=>e.message).join(`, `)}`);let l=[],u=[];new ly({CallExpression(e){e.callee?.type===`Identifier`&&(e.callee.name===`defineTool`||e.callee.name===`defineToolSet`)&&e.arguments?.[0]?.type===`ObjectExpression`&&u.push(e)}}).visit(c.program);for(let e of u){let t=e.arguments[0];if(t?.type!==`ObjectExpression`)continue;let r=t,i=r.properties||[],c=e.callee?.type===`Identifier`&&e.callee.name===`defineToolSet`,u=!Ty(i,`toolId`),d=!Ty(i,`etag`),f=c&&!Ty(i,`children`)&&a.length>0;if(!u&&!d&&!f)continue;let p=i[i.length-1],m=p?p.end:(r.start??0)+1,h=[];if(u&&h.push(`toolId: '${n}'`),d){let e=c&&s?s:o;h.push(`etag: '${e}'`)}if(f){let e=a.map(e=>e).join(`, `);h.push(`children: [${e}]`);let t=a.map(e=>`import ${e} from './children/${e}';`).join(`
99
+ `);l.push({start:0,end:0,content:t+`
100
+ `})}if(h.length>0){let e=(p?`,
101
+ `:`
102
+ `)+h.join(`,
103
+ `);l.push({start:m,end:m,content:e})}}return l.length===0?{code:e,hasToolId:!1}:{code:Ey(e,l),hasToolId:!0}}async function Oy(e){let t=i.resolve(e.entry);await jy(t,`入口目录不存在: ${t}`);let n=i.join(t,`config.ts`);await jy(n,`找不到 config.ts 文件: ${n}`);let r=i.join(t,`index.ts`);await jy(r,`找不到 index.ts 文件: ${r}`);let a=i.join(t,`.build-temp`);await Ay(a);let o=Date.now(),s=0,c=0,l=0;try{let r=Date.now(),u=await Dy({sourceCode:await C.readFile(n,`utf-8`),filePath:n});await C.writeFile(i.join(a,`config.ts`),u.code,`utf-8`),s=Date.now()-r;let d=Date.now();await ky(t,a,t),c=Date.now()-d;let f=i.resolve(e.output);await Ay(f);let p=i.join(a,`index.ts`),m=Date.now();await uv({entry:[p],outDir:f,format:[e.format],clean:!0,minify:e.minify,platform:`node`,target:`node22`,dts:{enabled:!0,sourcemap:!1},treeshake:!0,skipNodeModulesBundle:process.env.NODE_ENV===`test`,external:process.env.NODE_ENV===`test`?[`@fastgpt-plugin/helpers`]:[]}),l=Date.now()-m;let h=await C.readdir(f),g=Date.now()-o;return kn.info([`构建阶段耗时统计:`,` • config 转换: ${My(s)}`,` • 源码复制: ${My(c)}`,` • tsdown 构建: ${My(l)}`,` • 总耗时: ${My(g)}`].join(`
104
+ `)),{entryDir:t,outputDir:f,files:h.map(e=>e)}}finally{try{await C.rm(a,{recursive:!0,force:!0})}catch{}}}async function ky(e,t,n){let r=await C.readdir(e,{withFileTypes:!0});for(let a of r){if(a.name===`node_modules`||a.name===`dist`||a.name.startsWith(`.build-`))continue;let r=i.join(e,a.name),o=i.join(t,a.name);if(a.isDirectory())await Ay(o),await ky(r,o,n);else if(a.isFile()&&!(a.name===`config.ts`&&e===n))if(a.name===`config.ts`){let e=await Dy({sourceCode:await C.readFile(r,`utf-8`),filePath:r});await C.writeFile(o,e.code,`utf-8`)}else await C.copyFile(r,o)}}async function Ay(e){await C.mkdir(e,{recursive:!0})}async function jy(e,t){try{await C.access(e)}catch{throw Error(t)}}function My(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var Ny=class extends qn{register(e){e.command(`build`).description(`构建 FastGPT 插件为可分发的包`).option(`-e, --entry <path>`,`工具入口目录`,process.cwd()).option(`-o, --output <path>`,`输出目录`,`./dist`).option(`-m, --minify`,`压缩输出代码`,!1).option(`-w, --watch`,`监听模式`,!1).option(`-f, --format <format>`,`输出格式: esm | cjs`,`esm`).action(async e=>{await this.run({entry:e.entry,output:e.output,minify:e.minify,watch:e.watch,format:e.format})})}async run(e){let t=Date.now();kn.box([`FastGPT 插件构建`,``,`入口目录: ${e.entry}`,`输出目录: ${e.output}`,`代码压缩: ${e.minify?`开启`:`关闭`}`,`输出格式: ${e.format}`,``].join(`
105
+ `)),kn.start(`准备构建插件...`);try{let n=await Oy(e),r=((Date.now()-t)/1e3).toFixed(2);kn.success(`构建完成,用时 ${r}s`),kn.info(`输出目录: ${n.outputDir}`),n.files.length>0?(kn.info(`生成的文件列表:`),n.files.forEach(e=>{kn.info(` • ${e}`)})):kn.info(`未检测到输出文件,请检查配置。`),kn.info(`
106
+ 下一步: 可以将该目录作为 npm 包发布,或在 FastGPT 中作为插件安装使用。`),e.watch&&kn.info(`
107
+ 监听模式暂不支持,请使用 --no-watch 选项`)}catch(e){kn.error(`构建失败,详情如下:`),kn.error(e instanceof Error?e:Error(String(e))),kn.info(`如果这是在 CI 中发生的,请查看上方构建日志以获取更多信息。`),process.exit(1)}}};function Py(){let e=new Un;return e.name(He).version(Ue).description(`FastGPT 插件开发 CLI`),new Zi().register(e),new Ny().register(e),e}async function Fy(e){await Py().parseAsync(e??process.argv)}(async()=>{try{await Fy()}catch(e){kn.error(e),process.exitCode=1}})();export{Re as S,Rc as _,ku as a,Fe as b,kc as c,Ac as d,Dc as f,Fc as g,Pc as h,Ou as i,Ec as l,Ic as m,f_ as n,jc as o,Mc as p,gg as r,Oc as s,d_ as t,Nc as u,Lc as v,Ie as x,Wo as y};