hokit 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- import{a as e,i as t,n,r,t as i}from"../watch-BO-aYzLX.js";switch(process.argv[2]){case`build`:await e();break;case`doctor`:await r();break;case`lint`:await n();break;case`watch`:await i();break;case`docs`:await t();break;default:console.log(`
2
+ import{a as e,i as t,n,o as r,r as i,t as a}from"../init-D1KDW1xO.js";switch(process.argv[2]){case`init`:await a(process.argv.find(e=>e.startsWith(`--`))?.replace(`--`,``)??`empty`);break;case`build`:await r();break;case`doctor`:await t();break;case`lint`:await i();break;case`watch`:await n();break;case`docs`:await e();break;default:console.log(`
3
3
  Hokit
4
4
 
5
5
  Usage:
package/dist/index.d.ts CHANGED
@@ -61,4 +61,7 @@ declare class HokitError extends Error {
61
61
  constructor(title: string, sections?: Record<string, string | string[]>);
62
62
  }
63
63
  //#endregion
64
- export { Build, BuildConfig, BuildOptions, HokitError, KnownScope, Module, ModuleOptions, Scope, Snippet, SnippetOptions, build, compile, defineConfig, discover, docs, doctor, lint, scopes, watchMode };
64
+ //#region src/init/init.d.ts
65
+ declare function init(template?: "empty" | "react"): Promise<void>;
66
+ //#endregion
67
+ export { Build, BuildConfig, BuildOptions, HokitError, KnownScope, Module, ModuleOptions, Scope, Snippet, SnippetOptions, build, compile, defineConfig, discover, docs, doctor, init, lint, scopes, watchMode };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./watch-BO-aYzLX.js";function _(e){return e}const v=c({output:i()});function y(e){return r(v,e),t=>{o.set(t,e)}}const b=c({scopes:g(m(i())),tags:g(m(i()))});function x(e){return r(b,e),t=>{a.set(t,e)}}const S=c({name:i(),prefix:i(),body:m(i()),description:g(i()),template:g(n())});function C(t){return r(S,t),(n,r)=>{let i=n.constructor,a=e.get(i)??[];a.push({propertyKey:r,options:t}),e.set(i,a)}}const w=[`typescript`,`typescriptreact`,`javascript`,`javascriptreact`,`html`,`json`,`swift`,`kotlin`,`rust`,`go`,`python`,`java`,`c`,`cpp`,`dart`,`ruby`,`php`,`lua`,`elixir`,`zig`,`toml`,`yaml`,`markdown`];export{y as Build,d as HokitError,x as Module,C as Snippet,t as build,l as compile,_ as defineConfig,f as discover,s as docs,p as doctor,u as lint,w as scopes,h as watchMode};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g,v as _}from"./init-D1KDW1xO.js";function v(e){return e}const y=g({output:f()});function b(e){return i(y,e),t=>{a.set(t,e)}}const x=g({scopes:r(n(f())),tags:r(n(f()))});function S(t){return i(x,t),n=>{e.set(n,t)}}const C=g({name:f(),prefix:f(),body:n(f()),description:r(f()),template:r(c())});function w(e){return i(C,e),(t,n)=>{let r=t.constructor,i=_.get(r)??[];i.push({propertyKey:n,options:e}),_.set(r,i)}}const T=[`typescript`,`typescriptreact`,`javascript`,`javascriptreact`,`html`,`json`,`swift`,`kotlin`,`rust`,`go`,`python`,`java`,`c`,`cpp`,`dart`,`ruby`,`php`,`lua`,`elixir`,`zig`,`toml`,`yaml`,`markdown`];export{b as Build,m as HokitError,S as Module,w as Snippet,d as build,o as compile,v as defineConfig,l as discover,t as docs,s as doctor,h as init,p as lint,T as scopes,u as watchMode};
@@ -0,0 +1,112 @@
1
+ import{createRequire as e}from"node:module";import t from"node:fs/promises";import n from"node:path";import{fileURLToPath as r,pathToFileURL as i}from"node:url";import*as a from"fs";import{readdir as o,readdirSync as s,realpath as c,realpathSync as l,stat as u,statSync as d}from"fs";import{basename as f,dirname as p,isAbsolute as m,normalize as h,posix as g,relative as _,resolve as v,sep as y}from"path";import{fileURLToPath as b}from"url";import{createRequire as x}from"module";import{appendFileSync as S,createReadStream as C,createWriteStream as w,readFileSync as T,statSync as E,watch as D,writeFileSync as O}from"node:fs";import{ChildProcess as k,execFile as ee,spawn as te,spawnSync as A}from"node:child_process";import{StringDecoder as j}from"node:string_decoder";import{aborted as ne,callbackify as M,debuglog as N,inspect as P,promisify as F,stripVTControlCharacters as I}from"node:util";import L,{execArgv as R,execPath as z,hrtime as B,platform as V}from"node:process";import H from"node:tty";import{scheduler as U,setImmediate as W,setTimeout as re}from"node:timers/promises";import{constants as G}from"node:os";import{EventEmitter as K,addAbortListener as ie,on as q,once as J,setMaxListeners as ae}from"node:events";import{serialize as oe}from"node:v8";import{Duplex as se,PassThrough as ce,Readable as le,Transform as ue,Writable as de,getDefaultHighWaterMark as fe}from"node:stream";import{Buffer as pe}from"node:buffer";import{finished as me}from"node:stream/promises";var he=Object.create,ge=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,ve=Object.getOwnPropertyNames,ye=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty,Y=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),xe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ve(t),a=0,o=i.length,s;a<o;a++)s=i[a],!be.call(e,s)&&s!==n&&ge(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=_e(t,s))||r.enumerable});return e},Se=(e,t,n)=>(n=e==null?{}:he(ye(e)),xe(t||!e||!e.__esModule?ge(n,`default`,{value:e,enumerable:!0}):n,e)),Ce=e(import.meta.url);const we=new Map,Te=new Map,Ee=new Map;function De(e){let t=we.get(e),n=(Te.get(e)??[]).sort((e,t)=>e.options.name.localeCompare(t.options.name)),r={};for(let e of n){let n=e.options;r[n.name]={prefix:n.prefix,body:n.body,scope:t?.scopes?.join(`,`),description:n.description??n.name,isFileTemplate:n.template??!1}}return r}var Oe=x(import.meta.url);function ke(e){let t=h(e);return t.length>1&&t[t.length-1]===y&&(t=t.substring(0,t.length-1)),t}const Ae=/[\\/]/g;function je(e,t){return e.replace(Ae,t)}const Me=/^[a-z]:[\\/]$/i;function Ne(e){return e===`/`||Me.test(e)}function Pe(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=v(e)),(r||a)&&(e=ke(e)),e===`.`?``:je(e[e.length-1]===i?e:e+i,i)}function Fe(e,t){return t+e}function Ie(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:je(_(e,r),t.pathSeparator)+t.pathSeparator+n}}function Le(e){return e}function Re(e,t,n){return t+e+n}function ze(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?Ie(e,t):r?Fe:Le}function Be(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function Ve(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}const He=(e,t)=>{t.push(e||`.`)},Ue=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},We=()=>{};function Ge(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?Ve(e):Be(e):r&&r.length?Ue:He:We}const Ke=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},qe=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},Je=(e,t,n,r)=>{n.files++},Ye=(e,t)=>{t.push(e)},Xe=()=>{};function Ze(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?Xe:n&&n.length?r?Ke:qe:r?Je:Ye}const Qe=e=>e,$e=()=>[``].slice(0,0);function et(e){return e.group?$e:Qe}const tt=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},nt=()=>{};function rt(e){return e.group?tt:nt}const it=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()&&st(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},at=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()&&st(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function ot(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?at:it}function st(e,t,n){if(n.options.useRealPaths)return ct(t,n);let r=p(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=p(r)}return n.symlinks.set(e,t),i>1}function ct(e,t){return t.visited.includes(e+t.options.pathSeparator)}const lt=e=>e.counts,ut=e=>e.groups,dt=e=>e.paths,ft=e=>e.paths.slice(0,e.options.maxFiles),pt=(e,t,n)=>(_t(t,n,e.counts,e.options.suppressErrors),null),mt=(e,t,n)=>(_t(t,n,e.paths,e.options.suppressErrors),null),ht=(e,t,n)=>(_t(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),gt=(e,t,n)=>(_t(t,n,e.groups,e.options.suppressErrors),null);function _t(e,t,n,r){t(e&&!r?e:null,n)}function vt(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?lt:pt:r?t?ut:gt:i?t?ft:ht:t?dt:mt}const yt={withFileTypes:!0},bt=(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||`.`,yt,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},xt=(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||`.`,yt)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function St(e){return e?xt:bt}var Ct=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))}},wt=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}},Tt=class{aborted=!1;abort(){this.aborted=!0}},Et=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=vt(t,this.isSynchronous),this.root=Pe(e,t),this.state={root:Ne(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new wt,options:t,queue:new Ct((e,t)=>this.callbackInvoker(t,e,n)),symlinks:new Map,visited:[``].slice(0,0),controller:new Tt,fs:t.fs||a},this.joinPath=ze(this.root,t),this.pushDirectory=Ge(this.root,t),this.pushFile=Ze(t),this.getArray=et(t),this.groupFiles=rt(t),this.resolveSymlink=ot(t,this.isSynchronous),this.walkDirectory=St(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:m}=this.state;if(m.aborted||l&&l.aborted||c&&r.length>c)return;let h=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,h,this.state.counts,i)}else if(l.isDirectory()){let e=Re(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=Fe(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=Pe(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=f(r),n=Pe(p(r),this.state.options);r=this.joinPath(t,n),this.pushFile(r,h,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,h)}};function Dt(e,t){return new Promise((n,r)=>{Ot(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function Ot(e,t,n){new Et(e,t,n).start()}function kt(e,t){return new Et(e,t).start()}var At=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return Dt(this.root,this.options)}withCallback(e){Ot(this.root,this.options,e)}sync(){return kt(this.root,this.options)}};let jt=null;try{Oe.resolve(`picomatch`),jt=Oe(`picomatch`)}catch{}var Mt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:y,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 At(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}crawlWithOptions(e,t){return this.options={...this.options,...t},new At(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||jt;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}},Nt=Y(((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={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{__proto__:null,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}}})),Pt=Y((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Nt();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}})),Ft=Y(((e,t)=>{let n=Pt(),{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:_}=Nt(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,ee=!1,te=!1,A=!1,j=!1,ne=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=0,R,z,B={value:``,depth:0,isGlob:!1},V=()=>D>=x,H=()=>E.charCodeAt(D+1),U=()=>(R=z,E.charCodeAt(++D));for(;D<x;){z=U();let e;if(z===a){N=B.backslashes=!0,z=U(),z===u&&(M=!0);continue}if(M===!0||z===u){for(L++;V()!==!0&&(z=U());){if(z===a){N=B.backslashes=!0,U();continue}if(z===u){L++;continue}if(M!==!0&&z===s&&(z=U())===s){if(ee=B.isBrace=!0,A=B.isGlob=!0,I=!0,S===!0)continue;break}if(M!==!0&&z===o){if(ee=B.isBrace=!0,A=B.isGlob=!0,I=!0,S===!0)continue;break}if(z===h&&(L--,L===0)){M=!1,ee=B.isBrace=!0,I=!0;break}}if(S===!0)continue;break}if(z===l){if(C.push(D),w.push(B),B={value:``,depth:0,isGlob:!1},I===!0)continue;if(R===s&&D===O+1){O+=2;continue}k=D+1;continue}if(b.noext!==!0&&(z===p||z===i||z===r||z===m||z===c)&&H()===d){if(A=B.isGlob=!0,j=B.isExtglob=!0,I=!0,z===c&&D===O&&(F=!0),S===!0){for(;V()!==!0&&(z=U());){if(z===a){N=B.backslashes=!0,z=U();continue}if(z===g){A=B.isGlob=!0,I=!0;break}}continue}break}if(z===r){if(R===r&&(ne=B.isGlobstar=!0),A=B.isGlob=!0,I=!0,S===!0)continue;break}if(z===m){if(A=B.isGlob=!0,I=!0,S===!0)continue;break}if(z===f){for(;V()!==!0&&(e=U());){if(e===a){N=B.backslashes=!0,U();continue}if(e===_){te=B.isBracket=!0,A=B.isGlob=!0,I=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&z===c&&D===O){P=B.negated=!0,O++;continue}if(b.noparen!==!0&&z===d){if(A=B.isGlob=!0,S===!0){for(;V()!==!0&&(z=U());){if(z===d){N=B.backslashes=!0,z=U();continue}if(z===g){I=!0;break}}continue}break}if(A===!0){if(I=!0,S===!0)continue;break}}b.noext===!0&&(j=!1,A=!1);let W=E,re=``,G=``;O>0&&(re=E.slice(0,O),E=E.slice(O),k-=O),W&&A===!0&&k>0?(W=E.slice(0,k),G=E.slice(k)):A===!0?(W=``,G=E):W=E,W&&W!==``&&W!==`/`&&W!==E&&v(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),b.unescape===!0&&(G&&=n.removeBackslashes(G),W&&N===!0&&(W=n.removeBackslashes(W)));let K={prefix:re,input:e,start:O,base:W,glob:G,isBrace:ee,isBracket:te,isGlob:A,isExtglob:j,isGlobstar:ne,negated:P,negatedExtglob:F};if(b.tokens===!0&&(K.maxDepth=0,v(z)||w.push(B),K.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=re):w[n].value=a,y(w[n]),K.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),b.tokens&&(w[w.length-1].value=n,y(w[w.length-1]),K.maxDepth+=w[w.length-1].depth)}K.slashes=C,K.parts=T}return K}})),It=Y(((e,t)=>{let n=Nt(),r=Pt(),{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=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(!(!a||r!==a.repeat(r.length)||i!==a.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return`${n.length===1?r.escapeRegex(n[0]):`[${n.map(e=>r.escapeRegex(e)).join(``)}]`}*`},_=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},v=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};for(let e of i){let t=g(e);if(t)return{risky:!0,safeOutput:t};if(_(e)>r)return{risky:!0}}return{risky:!1}},y=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),b=n.extglobChars(_),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:D,NO_DOTS_SLASH:O,QMARK:k,QMARK_NO_DOT:ee,STAR:te,START_ANCHOR:A}=_,j=e=>`(${g}(?:(?!${A}${e.dot?T:x}).)*?)`,ne=d.dot?``:E,M=d.dot?k:ee,N=d.bash===!0?j(d):te;d.capture&&(N=`(${N})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let P={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,P),p=e.length;let F=[],I=[],L=[],R=m,z,B=()=>P.index===p-1,V=P.peek=(t=1)=>e[P.index+t],H=P.advance=()=>e[++P.index]||``,U=()=>e.slice(P.index+1),W=(e=``,t=0)=>{P.consumed+=e,P.index+=t},re=e=>{P.output+=e.output==null?e.value:e.output,W(e.value)},G=()=>{let e=1;for(;V()===`!`&&(V(2)!==`(`||V(3)===`?`);)H(),P.start++,e++;return e%2==0?!1:(P.negated=!0,P.start++,!0)},K=e=>{P[e]++,L.push(e)},ie=e=>{P[e]--,L.pop()},q=e=>{if(R.type===`globstar`){let t=P.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||F.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(P.output=P.output.slice(0,-R.output.length),R.type=`star`,R.value=`*`,R.output=N,P.output+=R.output)}if(F.length&&e.type!==`paren`&&(F[F.length-1].inner+=e.value),(e.value||e.output)&&re(e),R&&R.type===`text`&&e.type===`text`){R.output=(R.output||R.value)+e.value,R.value+=e.value;return}e.prev=R,h.push(e),R=e},J=(e,t)=>{let n={...b[t],conditions:1,inner:``};n.prev=R,n.parens=P.parens,n.output=P.output,n.startIndex=P.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;K(`parens`),q({type:e,value:t,output:P.output?``:w}),q({type:`paren`,extglob:!0,value:H(),output:r}),F.push(n)},ae=n=>{let i=e.slice(n.startIndex,P.index+1),a=v(e.slice(n.startIndex+2,P.index),d);if((n.type===`plus`||n.type===`star`)&&a.risky){let e=a.safeOutput?(n.output?``:w)+(d.capture?`(${a.safeOutput})`:a.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;P.output=n.output+t.output,P.backtrack=!0,q({type:`paren`,extglob:!0,value:z,output:``}),ie(`parens`);return}let o=n.close+(d.capture?`)`:``),s;if(n.type===`negate`){let e=N;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=j(d)),(e!==N||B()||/^\)+$/.test(U()))&&(o=n.close=`)$))${e}`),n.inner.includes(`*`)&&(s=U())&&/^\.[^\\/.]+$/.test(s)&&(o=n.close=`)${y(s,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(P.negatedExtglob=!0)}q({type:`paren`,extglob:!0,value:z,output:o}),ie(`parens`)};if(d.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?k.repeat(a.length):``):o===0?M+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?N:``):N:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(P.output=e,P):(P.output=r.wrapOutput(i,P,t),P)}for(;!B();){if(z=H(),z===`\0`)continue;if(z===`\\`){let e=V();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){z+=`\\`,q({type:`text`,value:z});continue}let t=/^\\+/.exec(U()),n=0;if(t&&t[0].length>2&&(n=t[0].length,P.index+=n,n%2!=0&&(z+=`\\`)),d.unescape===!0?z=H():z+=H(),P.brackets===0){q({type:`text`,value:z});continue}}if(P.brackets>0&&(z!==`]`||R.value===`[`||R.value===`[^`)){if(d.posix!==!1&&z===`:`){let e=R.value.slice(1);if(e.includes(`[`)&&(R.posix=!0,e.includes(`:`))){let e=R.value.lastIndexOf(`[`),t=R.value.slice(0,e),n=a[R.value.slice(e+2)];if(n){R.value=t+n,P.backtrack=!0,H(),!m.output&&h.indexOf(R)===1&&(m.output=w);continue}}}(z===`[`&&V()!==`:`||z===`-`&&V()===`]`)&&(z=`\\${z}`),z===`]`&&(R.value===`[`||R.value===`[^`)&&(z=`\\${z}`),d.posix===!0&&z===`!`&&R.value===`[`&&(z=`^`),R.value+=z,re({value:z});continue}if(P.quotes===1&&z!==`"`){z=r.escapeRegex(z),R.value+=z,re({value:z});continue}if(z===`"`){P.quotes=P.quotes===1?0:1,d.keepQuotes===!0&&q({type:`text`,value:z});continue}if(z===`(`){K(`parens`),q({type:`paren`,value:z});continue}if(z===`)`){if(P.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=F[F.length-1];if(e&&P.parens===e.parens+1){ae(F.pop());continue}q({type:`paren`,value:z,output:P.parens?`)`:`\\)`}),ie(`parens`);continue}if(z===`[`){if(d.nobracket===!0||!U().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));z=`\\${z}`}else K(`brackets`);q({type:`bracket`,value:z});continue}if(z===`]`){if(d.nobracket===!0||R&&R.type===`bracket`&&R.value.length===1){q({type:`text`,value:z,output:`\\${z}`});continue}if(P.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));q({type:`text`,value:z,output:`\\${z}`});continue}ie(`brackets`);let e=R.value.slice(1);if(R.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(z=`/${z}`),R.value+=z,re({value:z}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(R.value);if(P.output=P.output.slice(0,-R.value.length),d.literalBrackets===!0){P.output+=t,R.value=t;continue}R.value=`(${g}${t}|${R.value})`,P.output+=R.value;continue}if(z===`{`&&d.nobrace!==!0){K(`braces`);let e={type:`brace`,value:z,output:`(`,outputIndex:P.output.length,tokensIndex:P.tokens.length};I.push(e),q(e);continue}if(z===`}`){let e=I[I.length-1];if(d.nobrace===!0||!e){q({type:`text`,value:z,output:z});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),P.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=P.output.slice(0,e.outputIndex),r=P.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,z=t=`\\}`,P.output=n;for(let e of r)P.output+=e.output||e.value}q({type:`brace`,value:z,output:t}),ie(`braces`),I.pop();continue}if(z===`|`){F.length>0&&F[F.length-1].conditions++,q({type:`text`,value:z});continue}if(z===`,`){let e=z,t=I[I.length-1];t&&L[L.length-1]===`braces`&&(t.comma=!0,e=`|`),q({type:`comma`,value:z,output:e});continue}if(z===`/`){if(R.type===`dot`&&P.index===P.start+1){P.start=P.index+1,P.consumed=``,P.output=``,h.pop(),R=m;continue}q({type:`slash`,value:z,output:C});continue}if(z===`.`){if(P.braces>0&&R.type===`dot`){R.value===`.`&&(R.output=x);let e=I[I.length-1];R.type=`dots`,R.output+=z,R.value+=z,e.dots=!0;continue}if(P.braces+P.parens===0&&R.type!==`bos`&&R.type!==`slash`){q({type:`text`,value:z,output:x});continue}q({type:`dot`,value:z,output:x});continue}if(z===`?`){if(!(R&&R.value===`(`)&&d.noextglob!==!0&&V()===`(`&&V(2)!==`?`){J(`qmark`,z);continue}if(R&&R.type===`paren`){let e=V(),t=z;(R.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(U()))&&(t=`\\${z}`),q({type:`text`,value:z,output:t});continue}if(d.dot!==!0&&(R.type===`slash`||R.type===`bos`)){q({type:`qmark`,value:z,output:ee});continue}q({type:`qmark`,value:z,output:k});continue}if(z===`!`){if(d.noextglob!==!0&&V()===`(`&&(V(2)!==`?`||!/[!=<:]/.test(V(3)))){J(`negate`,z);continue}if(d.nonegate!==!0&&P.index===0){G();continue}}if(z===`+`){if(d.noextglob!==!0&&V()===`(`&&V(2)!==`?`){J(`plus`,z);continue}if(R&&R.value===`(`||d.regex===!1){q({type:`plus`,value:z,output:S});continue}if(R&&(R.type===`bracket`||R.type===`paren`||R.type===`brace`)||P.parens>0){q({type:`plus`,value:z});continue}q({type:`plus`,value:S});continue}if(z===`@`){if(d.noextglob!==!0&&V()===`(`&&V(2)!==`?`){q({type:`at`,extglob:!0,value:z,output:``});continue}q({type:`text`,value:z});continue}if(z!==`*`){(z===`$`||z===`^`)&&(z=`\\${z}`);let e=o.exec(U());e&&(z+=e[0],P.index+=e[0].length),q({type:`text`,value:z});continue}if(R&&(R.type===`globstar`||R.star===!0)){R.type=`star`,R.star=!0,R.value+=z,R.output=N,P.backtrack=!0,P.globstar=!0,W(z);continue}let t=U();if(d.noextglob!==!0&&/^\([^?]/.test(t)){J(`star`,z);continue}if(R.type===`star`){if(d.noglobstar===!0){W(z);continue}let n=R.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){q({type:`star`,value:z,output:``});continue}let o=P.braces>0&&(n.type===`comma`||n.type===`brace`),s=F.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){q({type:`star`,value:z,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[P.index+4];if(n&&n!==`/`)break;t=t.slice(3),W(`/**`,3)}if(n.type===`bos`&&B()){R.type=`globstar`,R.value+=z,R.output=j(d),P.output=R.output,P.globstar=!0,W(z);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&B()){P.output=P.output.slice(0,-(n.output+R.output).length),n.output=`(?:${n.output}`,R.type=`globstar`,R.output=j(d)+(d.strictSlashes?`)`:`|$)`),R.value+=z,P.globstar=!0,P.output+=n.output+R.output,W(z);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;P.output=P.output.slice(0,-(n.output+R.output).length),n.output=`(?:${n.output}`,R.type=`globstar`,R.output=`${j(d)}${C}|${C}${e})`,R.value+=z,P.output+=n.output+R.output,P.globstar=!0,W(z+H()),q({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){R.type=`globstar`,R.value+=z,R.output=`(?:^|${C}|${j(d)}${C})`,P.output=R.output,P.globstar=!0,W(z+H()),q({type:`slash`,value:`/`,output:``});continue}P.output=P.output.slice(0,-R.output.length),R.type=`globstar`,R.output=j(d),R.value+=z,P.output+=R.output,P.globstar=!0,W(z);continue}let n={type:`star`,value:z,output:N};if(d.bash===!0){n.output=`.*?`,(R.type===`bos`||R.type===`slash`)&&(n.output=ne+n.output),q(n);continue}if(R&&(R.type===`bracket`||R.type===`paren`)&&d.regex===!0){n.output=z,q(n);continue}(P.index===P.start||R.type===`slash`||R.type===`dot`)&&(R.type===`dot`?(P.output+=D,R.output+=D):d.dot===!0?(P.output+=O,R.output+=O):(P.output+=ne,R.output+=ne),V()!==`*`&&(P.output+=w,R.output+=w)),q(n)}for(;P.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));P.output=r.escapeLast(P.output,`[`),ie(`brackets`)}for(;P.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));P.output=r.escapeLast(P.output,`(`),ie(`parens`)}for(;P.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));P.output=r.escapeLast(P.output,`{`),ie(`braces`)}if(d.strictSlashes!==!0&&(R.type===`star`||R.type===`bracket`)&&q({type:`maybe_slash`,value:``,output:`${C}?`}),P.backtrack===!0){P.output=``;for(let e of P.tokens)P.output+=e.output==null?e.value:e.output,e.suffix&&(P.output+=e.suffix)}return P};y.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,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=y})),Lt=Y(((e,t)=>{let n=Ft(),r=It(),i=Pt(),a=Nt(),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})),Rt=Se(Y(((e,t)=>{let n=Lt(),r=Pt();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 zt=Array.isArray,Bt=/\\/g,Vt=/^[A-Za-z]:$/,Ht=process.platform===`win32`,Ut=/^(\/?\.\.)+$/;function Wt(e,t={}){let n=e.length,r=Array(n),i=Array(n),a,o;for(a=0;a<n;a++){let n=Zt(e[a]);r[a]=n;let s=n.length,c=Array(s);for(o=0;o<s;o++)c[o]=(0,Rt.default)(n[o],t);i[a]=c}return e=>{let s=e.split(`/`);if(s[0]===`..`&&Ut.test(e))return!0;for(a=0;a<n;a++){let e=r[a],n=i[a],c=s.length,l=Math.min(c,e.length);for(o=0;o<l;){let r=e[o];if(r.includes(`/`))return!0;if(!n[o](s[o]))break;if(!t.noglobstar&&r===`**`)return!0;o++}if(o===c)return!0}return!1}}const Gt=/^[A-Z]:\/$/i,Kt=Ht?e=>Gt.test(e):e=>e===`/`;function qt(e,t,n){if(e===t||t.startsWith(`${e}/`)){if(n){let t=e.length+ +!Kt(e);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=>g.relative(e,t)||`.`:n=>g.relative(e,`${t}/${n}`)||`.`}function Jt(e,t){if(t.startsWith(`${e}/`)){let n=t.slice(e.length+1);return e=>`${n}/${e}`}return n=>{let r=g.relative(e,`${t}/${n}`);return n[n.length-1]===`/`&&r!==``?`${r}/`:r||`.`}}function Yt(e){return e.replace(Vt,e=>`${e}/`)}const Xt={parts:!0};function Zt(e){let t=Rt.default.scan(e,Xt);return t.parts?.length?t.parts:[e]}const Qt=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,$t=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,en=Ht?e=>e.replace($t,`\\$&`):e=>e.replace(Qt,`\\$&`);function tn(e,t){if(t?.caseSensitiveMatch===!1)return!0;let n=Rt.default.scan(e);return n.isGlob||n.negated}function nn(...e){console.log(`[tinyglobby ${new Date().toLocaleTimeString(`es`)}]`,...e)}function rn(e){return typeof e==`string`?[e]:e??[]}const an=/^(\/?\.\.)+/,on=/\\(?=[()[\]{}!*+?@|])/g;function sn(e,t,n,r){let i=t.cwd,a=e;e[e.length-1]===`/`&&(a=e.slice(0,-1)),a[a.length-1]!==`*`&&t.expandDirectories&&(a+=`/**`);let o=en(i);a=m(a.replace(on,``))?g.relative(o,a):g.normalize(a);let s=an.exec(a)?.[0],c=Zt(a);if(s){let e=(s.length+1)/3,t=0,r=o.split(`/`);for(;t<e&&c[t+e]===r[r.length+t-e];)a=a.slice(0,(e-t-1)*3)+a.slice((e-t)*3+c[t+e].length+1)||`.`,t++;let l=g.join(i,s.slice(t*3));l[0]!==`.`&&n.root.length>l.length&&(n.root=Yt(l),n.depthOffset=-e+t)}if(!r&&n.depthOffset>=0){n.commonPath??=c;let e=[],t=Math.min(n.commonPath.length,c.length);for(let r=0;r<t;r++){let t=c[r];if(t===`**`&&!c[r+1]){e.pop();break}if(r===c.length-1||t!==n.commonPath[r]||tn(t))break;e.push(t)}n.depthOffset=e.length,n.commonPath=e,n.root=Yt(e.length>0?g.join(i,...e):i)}return a}function cn(e,t,n){let r=[],i=[];for(let t of e.ignore)t&&(t[0]!==`!`||t[1]===`(`)&&i.push(sn(t,e,n,!0));for(let a of t)a&&(a[0]!==`!`||a[1]===`(`?r.push(sn(a,e,n,!1)):(a[1]!==`!`||a[2]===`(`)&&i.push(sn(a.slice(1),e,n,!0)));return{match:r,ignore:i}}function ln(e,t){let n=e.cwd,r={root:n,depthOffset:0},i=cn(e,t,r);e.debug&&nn(`internal processing patterns:`,i);let{absolute:a,caseSensitiveMatch:o,debug:s,dot:c,followSymbolicLinks:l,onlyDirectories:u}=e,d=r.root.replace(Bt,``),f={dot:c,nobrace:e.braceExpansion===!1,nocase:!o,noextglob:e.extglob===!1,noglobstar:e.globstar===!1,posix:!0},p=(0,Rt.default)(i.match,f),m=(0,Rt.default)(i.ignore,f),h=Wt(i.match,f),g=qt(n,d,a),_=a?g:qt(n,d,!0),v=(e,t)=>{let n=_(t,!0);return n!==`.`&&!h(n)||m(n)},y;e.deep!==void 0&&(y=Math.round(e.deep-r.depthOffset));let b=new Mt({filters:[s?(e,t)=>{let n=g(e,t),r=p(n)&&!m(n);return r&&nn(`matched ${n}`),r}:(e,t)=>{let n=g(e,t);return p(n)&&!m(n)}],exclude:s?(e,t)=>{let n=v(e,t);return nn(`${n?`skipped`:`crawling`} ${t}`),n}:v,fs:e.fs,pathSeparator:`/`,relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!e.onlyFiles,maxDepth:y,signal:e.signal}).crawl(d);return e.debug&&nn(`internal properties:`,{...r,root:d}),[b,n!==d&&!a&&Jt(n,d)]}function un(e,t){if(t)for(let n=e.length-1;n>=0;n--)e[n]=t(e[n]);return e}const dn={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function fn(e){let t=Object.assign({},e);for(let e in dn)t[e]===void 0&&Object.assign(t,{[e]:dn[e]});return t.cwd=(t.cwd instanceof URL?b(t.cwd):v(t.cwd||process.cwd())).replace(Bt,`/`),t.ignore=rn(t.ignore),t.fs&&={readdir:t.fs.readdir||o,readdirSync:t.fs.readdirSync||s,realpath:t.fs.realpath||c,realpathSync:t.fs.realpathSync||l,stat:t.fs.stat||u,statSync:t.fs.statSync||d},t.debug&&nn(`globbing with options:`,t),t}function pn(e,t={}){if(e&&t?.patterns)throw Error(`Cannot pass patterns as both an argument and an option`);let n=zt(e)||typeof e==`string`,r=rn((n?e:e.patterns)??`**/*`),i=fn(n?t:e);return r.length>0?ln(i,r):[]}async function mn(e,t){let[n,r]=pn(e,t);return n?un(await n.withPromise(),r):[]}async function hn(e={}){let t=await mn(e.include??[e.pattern??`**/*.module.ts`],{cwd:e.cwd??`src`,absolute:!0,ignore:e.exclude});await Promise.all(t.map(e=>import(i(e).href)))}const gn={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function _n(e){return e?{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}:gn}function vn(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 yn(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??vn(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??(e.reference,c.lang,void 0)??(l?(c.lang,void 0):null)??r.message??(c.lang,void 0);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}const bn=new WeakMap;function xn(e){let t=bn.get(e);return t||(t={version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},_n())}},bn.set(e,t)),t}var Sn=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function Cn(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function wn(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function Tn(e,t){return{kind:`schema`,type:`array`,reference:Tn,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return xn(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 yn(this,`type`,e,t);return e}}}function En(e){return{kind:`schema`,type:`boolean`,reference:En,expects:`boolean`,async:!1,message:e,get"~standard"(){return xn(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:yn(this,`type`,e,t),e}}}function Dn(e,t){return{kind:`schema`,type:`object`,reference:Dn,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return xn(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in 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]:wn(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]=Cn(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(yn(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 yn(this,`type`,e,t);return e}}}function On(e,t){return{kind:`schema`,type:`optional`,reference:On,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return xn(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=wn(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function kn(e){return{kind:`schema`,type:`string`,reference:kn,expects:`string`,async:!1,message:e,get"~standard"(){return xn(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:yn(this,`type`,e,t),e}}}function An(e,t,n){let r=e[`~run`]({value:t},_n(n));if(r.issues)throw new Sn(r.issues);return r.value}const jn=Dn({cwd:On(kn()),pattern:On(kn()),include:On(Tn(kn())),exclude:On(Tn(kn()))});async function Mn(){try{return An(jn,(await import(i(n.join(process.cwd(),`hokit.config.ts`)).href)).default??{})}catch{return{}}}var Nn=Se(Y(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}))(),1);const X={success(e){console.log(`${Nn.default.green(`✔`)} ${e}`)},info(e){console.log(`${Nn.default.cyan(`ℹ`)} ${e}`)}};var Pn=class extends Error{constructor(e,t={}){let n=[];n.push(`${Nn.default.red(`✖`)} ${Nn.default.bold(e)}`);for(let[e,r]of Object.entries(t))if(n.push(``),n.push(Nn.default.cyan(`${e}:`)),Array.isArray(r))for(let e of r)n.push(` • ${e}`);else n.push(` ${r}`);super(n.join(`
2
+ `)),this.name=`HokitError`}};function Fn(){let e=new Map;for(let[t,n]of Te)for(let r of n){let n=r.options.name,i=`${t.name}.${String(r.propertyKey)}`,a=e.get(n)??[];a.push(i),e.set(n,a)}for(let[t,n]of e)if(n.length>1)throw new Pn(`Duplicate snippet name "${t}"`,{"Found in":n})}function In(){let e=new Map;for(let[t,n]of Ee){let r=e.get(n.output)??[];r.push(t.name),e.set(n.output,r)}for(let[t,n]of e)if(n.length>1)throw new Pn(`Duplicate output "${t}"`,{"Found in":n})}function Ln(){let e=new Map;for(let[t,n]of Te){let r=we.get(t)?.scopes?.sort().join(`,`)??``;for(let i of n){let n=`${r}:${i.options.prefix}`,a=`${t.name}.${String(i.propertyKey)}`,o=e.get(n)??[];o.push(a),e.set(n,o)}}for(let[t,n]of e)if(n.length>1){let[e,r]=t.split(`:`);throw new Pn(`Duplicate prefix "${r}"`,{Scope:e,"Found in":n})}}async function Rn(e={}){e={...await Mn(),...e},await hn(e),Fn(),Ln(),In(),await Promise.all([...Ee].map(async([e,r])=>{let i=De(e);await t.mkdir(n.dirname(r.output),{recursive:!0}),await t.writeFile(r.output,JSON.stringify(i,null,4)),X.success(`Generated ${r.output}`)}))}async function zn(){await hn(await Mn());let e=`# Snippets
3
+
4
+ `;for(let[t]of Ee){let n=De(t);e+=`# ${t.name}\n\n`,e+="```json\n",e+=JSON.stringify(n,null,2),e+=`
5
+ \`\`\`
6
+
7
+ `}await t.writeFile(`SNIPPETS.md`,e),X.success(`Generated SNIPPETS.md`)}async function Bn(){if(await hn(await Mn()),Ee.size===0){X.info(`No modules found.`);return}X.success(`Discovered ${Ee.size} module(s).`);let e=[...Te.values()].reduce((e,t)=>e+t.length,0);X.success(`Loaded ${e} snippet(s).`),Fn(),X.success(`No duplicate names.`),Ln(),X.success(`No duplicate prefixes.`),In(),X.success(`No duplicate outputs.`)}async function Vn(){await Bn()}async function Hn(){await Rn(),D(process.cwd(),{recursive:!0},async(e,t)=>{X.info(`Change detected: ${t}`);try{await Rn()}catch(e){console.error(e)}})}async function Un(){let e=`hokit.config.ts`;try{await t.access(e),X.info(`Skipped hokit.config.ts`);return}catch{}await t.writeFile(e,`import { defineConfig } from "hokit"
8
+
9
+ export default defineConfig({
10
+ cwd: "src/modules",
11
+ pattern:
12
+ "**/*.module.ts"
13
+
14
+ })`),X.success(`Created hokit.config.ts`)}const Wn={filename:`.oxfmtrc.json`,content:JSON.stringify({arrowParens:`always`,bracketSpacing:!0,printWidth:80,semi:!1,singleQuote:!1,sortImports:!0,tabWidth:4,trailingComma:`none`},null,4)},Gn={filename:`.oxlintrc.json`,content:JSON.stringify({plugins:[`typescript`,`import`,`unicorn`],rules:{"no-unused-vars":`error`,"no-console":`off`,"typescript/no-explicit-any":`warn`}},null,4)},Kn={filename:`.vscode/settings.json`,content:JSON.stringify({"editor.formatOnSave":!0,"editor.defaultFormatter":`oxc.oxc-vscode`,"editor.formatOnSaveMode":`file`,"editor.codeActionsOnSave":{"source.fixAll.oxc":`explicit`,"source.format.oxc":`explicit`,"source.organizeImports":`explicit`,"source.removeUnusedImports":`explicit`,"source.addMissingImports.ts":`explicit`},"files.autoSave":`afterDelay`,"files.autoSaveDelay":1e3,"[typescript][typescriptreact][javascript][javascriptreact]":{"editor.defaultFormatter":`oxc.oxc-vscode`}},null,4)};async function qn(e,n){try{await t.access(e),X.info(`Skipped ${e}`);return}catch{}await t.mkdir(e.includes(`/`)?e.substring(0,e.lastIndexOf(`/`)):`.`,{recursive:!0}),await t.writeFile(e,n),X.success(`Created ${e}`)}async function Jn(){await qn(Wn.filename,Wn.content),await qn(Gn.filename,Gn.content),await qn(Kn.filename,Kn.content)}const Yn={empty:{name:`empty`,filename:`example.module.ts`,content:`import {
15
+ Build,
16
+ Module,
17
+ Snippet
18
+ } from "hokit"
19
+
20
+ @Build({
21
+ output:
22
+ "dist/snippets/example.json"
23
+ })
24
+ @Module({
25
+ scopes: [
26
+ "typescript"
27
+ ]
28
+ })
29
+ export class ExampleModule {
30
+ @Snippet({
31
+ name:
32
+ "Example snippet",
33
+ prefix:
34
+ "example",
35
+ body: [
36
+ "$0"
37
+ ]
38
+ })
39
+ public example!: void
40
+ }`},react:{name:`react`,filename:`react.module.ts`,content:`import {
41
+ Build,
42
+ Module,
43
+ Snippet
44
+ } from "hokit"
45
+
46
+
47
+ @Build({
48
+ output:
49
+ "dist/snippets/react.json"
50
+ })
51
+
52
+
53
+ @Module({
54
+ scopes: [
55
+ "typescriptreact"
56
+ ],
57
+ tags: [
58
+ "react",
59
+ "web"
60
+ ]
61
+ })
62
+
63
+
64
+ export class ReactModule {
65
+ @Snippet({
66
+ name:
67
+ "React Functional Component",
68
+ prefix:
69
+ "rfc",
70
+ description:
71
+ "Creates a React component.",
72
+ body: [
73
+ "$0"
74
+ ]
75
+
76
+ })
77
+ public rfc!: void
78
+ }`}};async function Xn(e){let r=Yn[e],i=n.join(`src/modules`,r.filename);try{await t.access(i),X.info(`Skipped ${i}`);return}catch{}await t.mkdir(`src/modules`,{recursive:!0}),await t.writeFile(i,r.content),X.success(`Created ${i}`)}async function Zn(){let e=`tsconfig.json`;try{await t.access(e),X.info(`Skipped tsconfig.json`);return}catch{}await t.writeFile(e,JSON.stringify({compilerOptions:{target:`ES2022`,module:`ESNext`,moduleResolution:`Bundler`,strict:!0,experimentalDecorators:!0,skipLibCheck:!0}},null,4)),X.success(`Created tsconfig.json`)}function Z(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const Qn=(e,t)=>{let n=tr($n(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},$n=e=>er(e)?e.toString():e,er=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,tr=e=>e instanceof URL?r(e):e,nr=(e,t=[],n={})=>{let r=Qn(e,`First argument`),[i,a]=Z(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!Z(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]},{toString:rr}=Object.prototype,ir=e=>rr.call(e)===`[object ArrayBuffer]`,Q=e=>rr.call(e)===`[object Uint8Array]`,ar=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),or=new TextEncoder,sr=e=>or.encode(e),cr=new TextDecoder,lr=e=>cr.decode(e),ur=(e,t)=>dr(e,t).join(``),dr=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new j(t),r=e.map(e=>typeof e==`string`?sr(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},fr=e=>e.length===1&&Q(e[0])?e[0]:mr(pr(e)),pr=e=>e.map(e=>typeof e==`string`?sr(e):e),mr=e=>{let t=new Uint8Array(hr(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},hr=e=>{let t=0;for(let n of e)t+=n.length;return t},gr=e=>Array.isArray(e)&&Array.isArray(e.raw),_r=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=vr({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},vr=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=yr(i,e.raw[r]),c=Sr(n,a,o);if(r===t.length)return c;let l=t[r];return Sr(c,Array.isArray(l)?l.map(e=>Cr(e)):[Cr(l)],s)},yr=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=br.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(br.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
79
+ `?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=xr[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},br=new Set([` `,` `,`\r`,`
80
+ `]),xr={x:3,u:5},Sr=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Cr=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(Z(e)&&(`stdout`in e||`isMaxBuffer`in e))return wr(e);throw e instanceof k||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},wr=({stdout:e})=>{if(typeof e==`string`)return e;if(Q(e))return lr(e);throw TypeError(e===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${typeof e}" stdout in template expression`)},Tr=e=>Er.includes(e),Er=[L.stdin,L.stdout,L.stderr],Dr=[`stdin`,`stdout`,`stderr`],Or=e=>Dr[e]??`stdio[${e}]`,kr=e=>{let t={...e};for(let n of Vr)t[n]=Ar(e,n);return t},Ar=(e,t)=>{let n=Array.from({length:jr(e)+1});return zr(Mr(e[t],n,t),t)},jr=({stdio:e})=>Array.isArray(e)?Math.max(e.length,Dr.length):Dr.length,Mr=(e,t,n)=>Z(e)?Nr(e,t,n):t.fill(e),Nr=(e,t,n)=>{for(let r of Object.keys(e).sort(Pr))for(let i of Ir(r,n,t))t[i]=e[r];return t},Pr=(e,t)=>Fr(e)<Fr(t)?1:-1,Fr=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,Ir=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=Lr(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
81
+ It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
82
+ Please set the "stdio" option to ensure that file descriptor exists.`);return r===`all`?[1,2]:[r]},Lr=e=>{if(e===`all`)return e;if(Dr.includes(e))return Dr.indexOf(e);let t=Rr.exec(e);if(t!==null)return Number(t[1])},Rr=/^fd(\d+)$/,zr=(e,t)=>e.map(e=>e===void 0?Br[t]:e),Br={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:N(`execa`).enabled?`full`:`none`,stripFinalNewline:!0},Vr=[`lines`,`buffer`,`maxBuffer`,`verbose`,`stripFinalNewline`],Hr=(e,t)=>t===`ipc`?e.at(-1):e[t],Ur=({verbose:e},t)=>Kr(e,t)!==`none`,Wr=({verbose:e},t)=>![`none`,`short`].includes(Kr(e,t)),Gr=({verbose:e},t)=>{let n=Kr(e,t);return Jr(n)?n:void 0},Kr=(e,t)=>t===void 0?qr(e):Hr(e,t),qr=e=>e.find(e=>Jr(e))??Yr.findLast(t=>e.includes(t)),Jr=e=>typeof e==`function`,Yr=[`none`,`short`,`full`],Xr=(e,t)=>{let n=[e,...t];return{command:n.join(` `),escapedCommand:n.map(e=>ri(Qr(e))).join(` `)}},Zr=e=>I(e).split(`
83
+ `).map(e=>Qr(e)).join(`
84
+ `),Qr=e=>e.replaceAll(ei,e=>$r(e)),$r=e=>{let t=ti[e];if(t!==void 0)return t;let n=e.codePointAt(0),r=n.toString(16);return n<=ni?`\\u${r.padStart(4,`0`)}`:`\\U${r}`},ei=(()=>{try{return RegExp(`\\p{Separator}|\\p{Other}`,`gu`)}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}})(),ti={" ":` `,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},ni=65535,ri=e=>ii.test(e)?e:V===`win32`?`"${e.replaceAll(`"`,`""`)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`,ii=/^[\w./-]+$/;function ai(){let{env:e}=L,{TERM:t,TERM_PROGRAM:n}=e;return L.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 oi={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:`╱`},si={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:`⅒`},ci={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`},li={...oi,...si},ui={...oi,...ci},di=ai()?li:ui;Object.entries(si);const fi=H?.WriteStream?.prototype?.hasColors?.()??!1,$=(e,t)=>{if(!fi)return e=>e;let n=`\u001B[${e}m`,r=`\u001B[${t}m`;return e=>{let i=e+``,a=i.indexOf(r);if(a===-1)return n+i+r;let o=n,s=0,c=(t===22?r:``)+n;for(;a!==-1;)o+=i.slice(s,a)+c,s=a+r.length,a=i.indexOf(r,s);return o+=i.slice(s)+r,o}};$(0,0);const pi=$(1,22);$(2,22),$(3,23),$(4,24),$(53,55),$(7,27),$(8,28),$(9,29),$(30,39),$(31,39),$(32,39),$(33,39),$(34,39),$(35,39),$(36,39),$(37,39);const mi=$(90,39);$(40,49),$(41,49),$(42,49),$(43,49),$(44,49),$(45,49),$(46,49),$(47,49),$(100,49);const hi=$(91,39);$(92,39);const gi=$(93,39);$(94,39),$(95,39),$(96,39),$(97,39),$(101,49),$(102,49),$(103,49),$(104,49),$(105,49),$(106,49),$(107,49);const _i=({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:a=!1}={},options:{reject:o=!0}})=>{let s=vi(n),c=xi[e]({failed:a,reject:o,piped:r}),l=Ci[e]({reject:o});return`${mi(`[${s}]`)} ${mi(`[${i}]`)} ${l(c)} ${l(t)}`},vi=e=>`${yi(e.getHours(),2)}:${yi(e.getMinutes(),2)}:${yi(e.getSeconds(),2)}.${yi(e.getMilliseconds(),3)}`,yi=(e,t)=>String(e).padStart(t,`0`),bi=({failed:e,reject:t})=>e?t?di.cross:di.warning:di.tick,xi={command:({piped:e})=>e?`|`:`$`,output:()=>` `,ipc:()=>`*`,error:bi,duration:bi},Si=e=>e,Ci={command:()=>pi,output:()=>Si,ipc:()=>Si,error:({reject:e})=>e?hi:gi,duration:()=>mi},wi=(e,t,n)=>{let r=Gr(t,n);return e.map(({verboseLine:e,verboseObject:t})=>Ti(e,t,r)).filter(e=>e!==void 0).map(e=>Ei(e)).join(``)},Ti=(e,t,n)=>{if(n===void 0)return e;let r=n(e,t);if(typeof r==`string`)return r},Ei=e=>e.endsWith(`
85
+ `)?e:`${e}\n`,Di=({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{let a=wi(ki(t,Oi({type:e,result:i,verboseInfo:r})),r,n);a!==``&&console.warn(a.slice(0,-1))},Oi=({type:e,result:t,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...a}}})=>({type:e,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:t,options:a}),ki=(e,t)=>e.split(`
86
+ `).map(e=>Ai({...t,message:e})),Ai=e=>({verboseLine:_i(e),verboseObject:e}),ji=e=>Zr(typeof e==`string`?e:P(e)).replaceAll(` `,` `.repeat(Mi)),Mi=2,Ni=(e,t)=>{Ur(t)&&Di({type:`command`,verboseMessage:e,verboseInfo:t})},Pi=(e,t,n)=>(Li(e),{verbose:e,escapedCommand:t,commandId:Fi(e),rawOptions:n}),Fi=e=>Ur({verbose:e})?Ii++:void 0;let Ii=0n;const Li=e=>{for(let t of e){if(t===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Yr.includes(t)&&!Jr(t)){let e=Yr.map(e=>`'${e}'`).join(`, `);throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}},Ri=()=>B.bigint(),zi=e=>Number(B.bigint()-e)/1e6,Bi=(e,t,n)=>{let r=Ri(),{command:i,escapedCommand:a}=Xr(e,t),o=Pi(Ar(n,`verbose`),a,{...n});return Ni(a,o),{command:i,escapedCommand:a,startTime:r,verboseInfo:o}};var Vi=Y(((e,t)=>{t.exports=a,a.sync=o;var n=Ce(`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)}})),Hi=Y(((e,t)=>{t.exports=r,r.sync=i;var n=Ce(`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}})),Ui=Y(((e,t)=>{Ce(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Vi():Hi();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}}})),Wi=Y(((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=Ce(`path`),i=n?`;`:`:`,a=Ui(),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)}})),Gi=Y(((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})),Ki=Y(((e,t)=>{let n=Ce(`path`),r=Wi(),i=Gi();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})),qi=Y(((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(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),Ji=Y(((e,t)=>{t.exports=/^#!(.*)/})),Yi=Y(((e,t)=>{let n=Ji();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}})),Xi=Y(((e,t)=>{let n=Ce(`fs`),r=Yi();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})),Zi=Y(((e,t)=>{let n=Ce(`path`),r=Ki(),i=qi(),a=Xi(),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})),Qi=Y(((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);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}})),$i=Se(Y(((e,t)=>{let n=Ce(`child_process`),r=Zi(),i=Qi();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);function ea(e={}){let{env:t=process.env,platform:n=process.platform}=e;return n===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`}F(ee);function ta(e){return e instanceof URL?r(e):e}function na(e){return{*[Symbol.iterator](){let t=n.resolve(ta(e)),r;for(;r!==t;)yield t,r=t,t=n.resolve(t,`..`)}}}const ra=({cwd:e=L.cwd(),path:t=L.env[ea()],preferLocal:r=!0,execPath:i=L.execPath,addExecPath:a=!0}={})=>{let o=n.resolve(ta(e)),s=[],c=t.split(n.delimiter);return r&&ia(s,c,o),a&&aa(s,c,i,o),t===``||t===n.delimiter?`${s.join(n.delimiter)}${t}`:[...s,t].join(n.delimiter)},ia=(e,t,r)=>{for(let i of na(r)){let r=n.join(i,`node_modules/.bin`);t.includes(r)||e.push(r)}},aa=(e,t,r,i)=>{let a=n.resolve(i,ta(r),`..`);t.includes(a)||e.push(a)},oa=({env:e=L.env,...t}={})=>{e={...e};let n=ea({env:e});return t.path=e[n],e[n]=ra(t),e},sa=(e,t,n)=>new(n?ma:pa)(t,e instanceof ca?{}:{cause:e});var ca=class extends Error{};const la=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,da,{value:!0,writable:!1,enumerable:!1,configurable:!1})},ua=e=>fa(e)&&da in e,da=Symbol(`isExecaError`),fa=e=>Object.prototype.toString.call(e)===`[object Error]`;var pa=class extends Error{};la(pa,pa.name);var ma=class extends Error{};la(ma,ma.name);const ha=()=>{let e=64-_a+1;return Array.from({length:e},ga)},ga=(e,t)=>({name:`SIGRT${t+1}`,number:_a+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),_a=34,va=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}],ya=()=>{let e=ha();return[...va,...e].map(ba)},ba=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=G,s=o!==void 0;return{name:e,number:s?o:t,description:n,supported:s,action:r,forced:i,standard:a}},xa=()=>{let e=ya();return Object.fromEntries(e.map(Sa))},Sa=({name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o}],Ca=xa(),wa=()=>{let e=ya(),t=Array.from({length:65},(t,n)=>Ta(n,e));return Object.assign({},...t)},Ta=(e,t)=>{let n=Ea(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:c}}},Ea=(e,t)=>{let n=t.find(({name:t})=>G.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n};wa();const Da=e=>{let t="option `killSignal`";if(e===0)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return ka(e,t)},Oa=e=>e===0?e:ka(e,"`subprocess.kill()`'s argument"),ka=(e,t)=>{if(Number.isInteger(e))return Aa(e,t);if(typeof e==`string`)return Ma(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.\n${Na()}`)},Aa=(e,t)=>{if(ja.has(e))return ja.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.\n${Na()}`)},ja=new Map(Object.entries(G.signals).reverse().map(([e,t])=>[t,e])),Ma=(e,t)=>{if(e in G.signals)return e;throw e.toUpperCase()in G.signals?TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):TypeError(`Invalid ${t} '${e}': this signal name does not exist.\n${Na()}`)},Na=()=>`Available signal names: ${Pa()}.
87
+ Available signal numbers: ${Fa()}.`,Pa=()=>Object.keys(G.signals).sort().map(e=>`'${e}'`).join(`, `),Fa=()=>[...new Set(Object.values(G.signals).sort((e,t)=>e-t))].join(`, `),Ia=e=>Ca[e].description,La=e=>{if(e===!1)return e;if(e===!0)return Ra;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Ra=1e3*5,za=({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:a},o,s)=>{let{signal:c,error:l}=Ba(o,s,n);Va(l,r);let u=e(c);return Ha({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:u,context:i,controller:a}),u},Ba=(e,t,n)=>{let[r=n,i]=fa(e)?[void 0,e]:[e,t];if(typeof r!=`string`&&!Number.isInteger(r))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!fa(i))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:Oa(r),error:i}},Va=(e,t)=>{e!==void 0&&t.reject(e)},Ha=async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:a,controller:o})=>{t===r&&i&&Ua({kill:e,forceKillAfterDelay:n,context:a,controllerSignal:o.signal})},Ua=async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await re(t,void 0,{signal:r}),e(`SIGKILL`)&&(n.isForcefullyTerminated??=!0)}catch{}},Wa=async(e,t)=>{e.aborted||await J(e,`abort`,{signal:t})},Ga=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!==`[object AbortSignal]`)throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Ka=({subprocess:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[qa(e,t,r,i)],qa=async(e,t,n,{signal:r})=>{throw await Wa(t,r),n.terminationReason??=`cancel`,e.kill(),t.reason},Ja=({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{Ya(e,t,n),Xa(e,t,r)},Ya=(e,t,n)=>{if(!n)throw Error(`${lo(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Xa=(e,t,n)=>{if(!n)throw Error(`${lo(e,t)} cannot be used: the ${fo(t)} has already exited or disconnected.`)},Za=e=>{throw Error(`${lo(`getOneMessage`,e)} could not complete: the ${fo(e)} exited or disconnected.`)},Qa=e=>{throw Error(`${lo(`sendMessage`,e)} failed: the ${fo(e)} is sending a message too, instead of listening to incoming messages.
88
+ This can be fixed by both sending a message and listening to incoming messages at the same time:
89
+
90
+ const [receivedMessage] = await Promise.all([
91
+ ${lo(`getOneMessage`,e)},
92
+ ${lo(`sendMessage`,e,`message, {strict: true}`)},
93
+ ]);`)},$a=(e,t)=>Error(`${lo(`sendMessage`,t)} failed when sending an acknowledgment response to the ${fo(t)}.`,{cause:e}),eo=e=>{throw Error(`${lo(`sendMessage`,e)} failed: the ${fo(e)} is not listening to incoming messages.`)},to=e=>{throw Error(`${lo(`sendMessage`,e)} failed: the ${fo(e)} exited without listening to incoming messages.`)},no=()=>Error(`\`cancelSignal\` aborted: the ${fo(!0)} disconnected.`),ro=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},io=({error:e,methodName:t,isSubprocess:n})=>{if(e.code===`EPIPE`)throw Error(`${lo(t,n)} cannot be used: the ${fo(n)} is disconnecting.`,{cause:e})},ao=({error:e,methodName:t,isSubprocess:n,message:r})=>{if(oo(e))throw Error(`${lo(t,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:e})},oo=({code:e,message:t})=>so.has(e)||co.some(e=>t.includes(e)),so=new Set([`ERR_MISSING_ARGS`,`ERR_INVALID_ARG_TYPE`]),co=[`could not be cloned`,`circular structure`,`call stack size exceeded`],lo=(e,t,n=``)=>e===`cancelSignal`?"`cancelSignal`'s `controller.abort()`":`${uo(t)}${e}(${n})`,uo=e=>e?``:`subprocess.`,fo=e=>e?`parent process`:`subprocess`,po=e=>{e.connected&&e.disconnect()},mo=()=>{let e={},t=new Promise((t,n)=>{Object.assign(e,{resolve:t,reject:n})});return Object.assign(t,e)},ho=(e,t=`stdin`)=>{let{options:n,fileDescriptors:r}=_o.get(e),i=vo(r,t,!0),a=e.stdio[i];if(a===null)throw TypeError(xo(i,t,n,!0));return a},go=(e,t=`stdout`)=>{let{options:n,fileDescriptors:r}=_o.get(e),i=vo(r,t,!1),a=i===`all`?e.all:e.stdio[i];if(a==null)throw TypeError(xo(i,t,n,!1));return a},_o=new WeakMap,vo=(e,t,n)=>{let r=yo(t,n);return bo(r,t,n,e),r},yo=(e,t)=>{let n=Lr(e);if(n!==void 0)return n;let{validOptions:r,defaultValue:i}=t?{validOptions:`"stdin"`,defaultValue:`stdin`}:{validOptions:`"stdout", "stderr", "all"`,defaultValue:`stdout`};throw TypeError(`"${wo(t)}" must not be "${e}".
94
+ It must be ${r} or "fd3", "fd4" (and so on).
95
+ It is optional and defaults to "${i}".`)},bo=(e,t,n,r)=>{let i=r[Co(e)];if(i===void 0)throw TypeError(`"${wo(n)}" must not be ${t}. That file descriptor does not exist.
96
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction===`input`&&!n)throw TypeError(`"${wo(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(i.direction!==`input`&&n)throw TypeError(`"${wo(n)}" must not be ${t}. It must be a writable stream, not readable.`)},xo=(e,t,n,r)=>{if(e===`all`&&!n.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:a}=So(e,n);return`The "${i}: ${To(a)}" option is incompatible with using "${wo(r)}: ${To(t)}".
97
+ Please set this option with "pipe" instead.`},So=(e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{let a=Co(e);return a===0&&t!==void 0?{optionName:`stdin`,optionValue:t}:a===1&&n!==void 0?{optionName:`stdout`,optionValue:n}:a===2&&r!==void 0?{optionName:`stderr`,optionValue:r}:{optionName:`stdio[${a}]`,optionValue:i[a]}},Co=e=>e===`all`?1:e,wo=e=>e?`to`:`from`,To=e=>typeof e==`string`?`'${e}'`:typeof e==`number`?`${e}`:`Stream`,Eo=(e,t,n)=>{let r=e.getMaxListeners();r===0||r===1/0||(e.setMaxListeners(r+t),ie(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},Do=(e,t)=>{t&&Oo(e)},Oo=e=>{e.refCounted()},ko=(e,t)=>{t&&Ao(e)},Ao=e=>{e.unrefCounted()},jo=(e,t)=>{t&&(Ao(e),Ao(e))},Mo=(e,t)=>{t&&(Oo(e),Oo(e))},No=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if(Wo(i)||ds(i))return;Fo.has(e)||Fo.set(e,[]);let a=Fo.get(e);if(a.push(i),!(a.length>1))for(;a.length>0;){await Qo(e,r,i),await U.yield();let o=await Uo({wrappedMessage:a[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});a.shift(),r.emit(`message`,o),r.emit(`message:done`)}},Po=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{ps();let a=Fo.get(e);for(;a?.length>0;)await J(r,`message:done`);e.removeListener(`message`,i),Mo(t,n),r.connected=!1,r.emit(`disconnect`)},Fo=new WeakMap,Io=(e,t,n)=>{if(Lo.has(e))return Lo.get(e);let r=new K;return r.connected=!0,Lo.set(e,r),Ro({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},Lo=new WeakMap,Ro=({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{let i=No.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on(`message`,i),t.once(`disconnect`,Po.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),jo(n,r)},zo=e=>{let t=Lo.get(e);return t===void 0?e.channel!==null:t.connected},Bo=({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;let a=es(e,Io(e,t,n));return{id:Vo++,type:Jo,message:r,hasListeners:a}};let Vo=0n;const Ho=(e,t)=>{if(!(t?.type!==Jo||t.hasListeners))for(let{id:t}of e)t!==void 0&&Ko[t].resolve({isDeadlock:!0,hasListeners:!1})},Uo=async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(e?.type!==Jo||!t.connected)return e;let{id:a,message:o}=e,s={id:a,type:Yo,message:es(t,i)};try{await ns({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},s)}catch(e){i.emit(`strict:error`,e)}return o},Wo=e=>{if(e?.type!==Yo)return!1;let{id:t,message:n}=e;return Ko[t]?.resolve({isDeadlock:!1,hasListeners:n}),!0},Go=async(e,t,n)=>{if(e?.type!==Jo)return;let r=mo();Ko[e.id]=r;let i=new AbortController;try{let{isDeadlock:e,hasListeners:a}=await Promise.race([r,qo(t,n,i)]);e&&Qa(n),a||eo(n)}finally{i.abort(),delete Ko[e.id]}},Ko={},qo=async(e,t,{signal:n})=>{Eo(e,1,n),await J(e,`disconnect`,{signal:n}),to(t)},Jo=`execa:ipc:request`,Yo=`execa:ipc:response`,Xo=(e,t,n)=>{$o.has(e)||$o.set(e,new Set);let r=$o.get(e),i={onMessageSent:mo(),id:n?t.id:void 0};return r.add(i),{outgoingMessages:r,outgoingMessage:i}},Zo=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Qo=async(e,t,n)=>{for(;!es(e,t)&&$o.get(e)?.size>0;){let t=[...$o.get(e)];Ho(t,n),await Promise.all(t.map(({onMessageSent:e})=>e))}},$o=new WeakMap,es=(e,t)=>t.listenerCount(`message`)>ts(e),ts=e=>_o.has(e)&&!Hr(_o.get(e).options.buffer,`ipc`)?1:0,ns=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,{strict:a=!1}={})=>{let o=`sendMessage`;return Ja({methodName:o,isSubprocess:n,ipc:r,isConnected:e.connected}),rs({anyProcess:e,channel:t,methodName:o,isSubprocess:n,message:i,strict:a})},rs=async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:a})=>{let o=Bo({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:a}),s=Xo(e,o,a);try{await is({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(t){throw po(e),t}finally{Zo(s)}},is=async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i})=>{let a=as(e);try{await Promise.all([Go(r,e,n),a(r)])}catch(e){throw io({error:e,methodName:t,isSubprocess:n}),ao({error:e,methodName:t,isSubprocess:n,message:i}),e}},as=e=>{if(os.has(e))return os.get(e);let t=F(e.send.bind(e));return os.set(e,t),t},os=new WeakMap,ss=(e,t)=>{let n=`cancelSignal`;return Xa(n,!1,e.connected),is({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:fs,message:t},message:t})},cs=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await ls({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),ms.signal),ls=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{if(!us){if(us=!0,!r){ro();return}if(t===null){ps();return}Io(e,t,n),await U.yield()}};let us=!1;const ds=e=>e?.type===fs?(ms.abort(e.message),!0):!1,fs=`execa:ipc:cancel`,ps=()=>{ms.abort(no())},ms=new AbortController,hs=({gracefulCancel:e,cancelSignal:t,ipc:n,serialization:r})=>{if(e){if(t===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r===`json`)throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},gs=({subprocess:e,cancelSignal:t,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:a})=>n?[_s({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:a})]:[],_s=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{throw await Wa(t,i),await ss(e,vs(t)),Ua({kill:e.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??=`gracefulCancel`,t.reason},vs=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t},ys=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},bs=(e,t,n,r)=>t===0||t===void 0?[]:[xs(e,t,n,r)],xs=async(e,t,n,{signal:r})=>{throw await re(t,void 0,{signal:r}),n.terminationReason??=`timeout`,e.kill(),new ca},Ss=({options:e})=>{if(e.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},Cs=(e,t,{node:r=!1,nodePath:i=z,nodeOptions:a=R.filter(e=>!e.startsWith(`--inspect`)),cwd:o,execPath:s,...c})=>{if(s!==void 0)throw TypeError(`The "execPath" option has been removed. Please use the "nodePath" option instead.`);let l=Qn(i,`The "nodePath" option`),u=n.resolve(o,l),d={...c,nodePath:u,node:r,cwd:o};if(!r)return[e,t,d];if(n.basename(e,`.exe`)===`node`)throw TypeError(`When the "node" option is true, the first argument does not need to be "node".`);return[u,[...a,e,...t],{ipc:!0,...d,shell:!1}]},ws=({ipcInput:e,ipc:t,serialization:n})=>{if(e!==void 0){if(!t)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Ts[n](e)}},Ts={advanced:e=>{try{oe(e)}catch(e){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},json:e=>{try{JSON.stringify(e)}catch(e){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}}},Es=async(e,t)=>{t!==void 0&&await e.sendMessage(t)},Ds=({encoding:e})=>{if(As.has(e))return;let t=js(e);if(t!==void 0)throw TypeError(`Invalid option \`encoding: ${Ns(e)}\`.
98
+ Please rename it to ${Ns(t)}.`);let n=[...As].map(e=>Ns(e)).join(`, `);throw TypeError(`Invalid option \`encoding: ${Ns(e)}\`.
99
+ Please rename it to one of: ${n}.`)},Os=new Set([`utf8`,`utf16le`]),ks=new Set([`buffer`,`hex`,`base64`,`base64url`,`latin1`,`ascii`]),As=new Set([...Os,...ks]),js=e=>{if(e===null)return`buffer`;if(typeof e!=`string`)return;let t=e.toLowerCase();if(t in Ms)return Ms[t];if(As.has(t))return t},Ms={"utf-8":`utf8`,"utf-16le":`utf16le`,"ucs-2":`utf16le`,ucs2:`utf16le`,binary:`latin1`},Ns=e=>typeof e==`string`?`"${e}"`:String(e),Ps=(e=Fs())=>{let t=Qn(e,`The "cwd" option`);return n.resolve(t)},Fs=()=>{try{return L.cwd()}catch(e){throw e.message=`The current directory does not exist.\n${e.message}`,e}},Is=(e,t)=>{if(t===Fs())return e;let n;try{n=E(t)}catch(n){return`The "cwd" option is invalid: ${t}.\n${n.message}\n${e}`}return n.isDirectory()?e:`The "cwd" option is not a directory: ${t}.\n${e}`},Ls=(e,t,r)=>{r.cwd=Ps(r.cwd);let[i,a,o]=Cs(e,t,r),{command:s,args:c,options:l}=$i.default._parse(i,a,o),u=Rs(kr(l));return ys(u),Ds(u),ws(u),Ga(u),hs(u),u.shell=tr(u.shell),u.env=zs(u),u.killSignal=Da(u.killSignal),u.forceKillAfterDelay=La(u.forceKillAfterDelay),u.lines=u.lines.map((e,t)=>e&&!ks.has(u.encoding)&&u.buffer[t]),L.platform===`win32`&&n.basename(s,`.exe`)===`cmd`&&c.unshift(`/q`),{file:s,commandArguments:c,options:u}},Rs=({extendEnv:e=!0,preferLocal:t=!1,cwd:n,localDir:r=n,encoding:i=`utf8`,reject:a=!0,cleanup:o=!0,all:s=!1,windowsHide:c=!0,killSignal:l=`SIGTERM`,forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m=`advanced`,...h})=>({...h,extendEnv:e,preferLocal:t,cwd:n,localDirectory:r,encoding:i,reject:a,cleanup:o,all:s,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),zs=({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:a})=>{let o=t?{...L.env,...e}:e;return n||r?oa({env:o,cwd:i,execPath:a,preferLocal:n,addExecPath:r}):o},Bs=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n];function Vs(e){if(typeof e==`string`)return Hs(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw Error(`Input must be a string or a Uint8Array`);return Us(e)}const Hs=e=>e.at(-1)===Ws?e.slice(0,e.at(-2)===Ks?-2:-1):e,Us=e=>e.at(-1)===Gs?e.subarray(0,e.at(-2)===qs?-2:-1):e,Ws=`
100
+ `,Gs=`
101
+ `.codePointAt(0),Ks=`\r`,qs=`\r`.codePointAt(0);function Js(e,{checkOpen:t=!0}={}){return typeof e==`object`&&!!e&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe==`function`}function Ys(e,{checkOpen:t=!0}={}){return Js(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write==`function`&&typeof e.end==`function`&&typeof e.writable==`boolean`&&typeof e.writableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function Xs(e,{checkOpen:t=!0}={}){return Js(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read==`function`&&typeof e.readable==`boolean`&&typeof e.readableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function Zs(e,t){return Ys(e,t)&&Xs(e,t)}const Qs=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);var $s=class{#e;#t;#n=!1;#r=void 0;constructor(e,t){this.#e=e,this.#t=t}next(){let e=()=>this.#i();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){let t=()=>this.#a(e);return this.#r?this.#r.then(t,t):t()}async#i(){if(this.#n)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(e){throw this.#r=void 0,this.#n=!0,this.#e.releaseLock(),e}return e.done&&(this.#r=void 0,this.#n=!0,this.#e.releaseLock()),e}async#a(e){if(this.#n)return{done:!0,value:e};if(this.#n=!0,!this.#t){let t=this.#e.cancel(e);return this.#e.releaseLock(),await t,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}};const ec=Symbol();function tc(){return this[ec].next()}Object.defineProperty(tc,"name",{value:`next`});function nc(e){return this[ec].return(e)}Object.defineProperty(nc,"name",{value:`return`});const rc=Object.create(Qs,{next:{enumerable:!0,configurable:!0,writable:!0,value:tc},return:{enumerable:!0,configurable:!0,writable:!0,value:nc}});function ic({preventCancel:e=!1}={}){let t=new $s(this.getReader(),e),n=Object.create(rc);return n[ec]=t,n}const ac=e=>{if(Xs(e,{checkOpen:!1})&&lc.on!==void 0)return sc(e);if(typeof e?.[Symbol.asyncIterator]==`function`)return e;if(oc.call(e)===`[object ReadableStream]`)return ic.call(e);throw TypeError(`The first argument must be a Readable, a ReadableStream, or an async iterable.`)},{toString:oc}=Object.prototype,sc=async function*(e){let t=new AbortController,n={};cc(e,t,n);try{for await(let[n]of lc.on(e,`data`,{signal:t.signal}))yield n}catch(e){if(n.error!==void 0)throw n.error;if(!t.signal.aborted)throw e}finally{e.destroy()}},cc=async(e,t,n)=>{try{await lc.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){n.error=e}finally{t.abort()}},lc={},uc=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{let l=ac(e),u=t();u.length=0;try{for await(let e of l)fc({convertedChunk:n[mc(e)](e,u),state:u,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c});return dc({state:u,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,maxBuffer:c}),s(u)}catch(e){let t=typeof e==`object`&&e?e:Error(e);throw t.bufferedData=s(u),t}},dc=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&fc({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},fc=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){pc(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&pc(c,t,i,a),new gc},pc=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},mc=e=>{let t=typeof e;if(t===`string`)return`string`;if(t!==`object`||e===null)return`others`;if(globalThis.Buffer?.isBuffer(e))return`buffer`;let n=hc.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&hc.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:hc}=Object.prototype;var gc=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const _c=e=>e,vc=()=>void 0,yc=({contents:e})=>e,bc=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},xc=e=>e.length;async function Sc(e,t){return uc(e,Cc,t)}const Cc={init:()=>({contents:[]}),convertChunk:{string:_c,buffer:_c,arrayBuffer:_c,dataView:_c,typedArray:_c,others:_c},getSize:()=>1,truncateChunk:vc,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:vc,finalize:yc};async function wc(e,t){return uc(e,Rc,t)}const Tc=()=>({contents:new ArrayBuffer(0)}),Ec=e=>Dc.encode(e),Dc=new TextEncoder,Oc=e=>new Uint8Array(e),kc=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ac=(e,t)=>e.slice(0,t),jc=(e,{contents:t,length:n},r)=>{let i=Lc()?Nc(t,r):Mc(t,r);return new Uint8Array(i).set(e,n),i},Mc=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(Pc(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},Nc=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:Pc(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},Pc=e=>Fc**Math.ceil(Math.log(e)/Math.log(Fc)),Fc=2,Ic=({contents:e,length:t})=>Lc()?e:e.slice(0,t),Lc=()=>`resize`in ArrayBuffer.prototype,Rc={init:Tc,convertChunk:{string:Ec,buffer:Oc,arrayBuffer:Oc,dataView:kc,typedArray:kc,others:bc},getSize:xc,truncateChunk:Ac,addChunk:jc,getFinalChunk:vc,finalize:Ic};async function zc(e,t){return uc(e,Hc,t)}const Bc=()=>({contents:``,textDecoder:new TextDecoder}),Vc=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Hc={init:Bc,convertChunk:{string:_c,buffer:Vc,arrayBuffer:Vc,dataView:Vc,typedArray:Vc,others:bc},getSize:xc,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},finalize:yc},Uc=({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:a})=>{if(!(e instanceof gc))throw e;if(a===`all`)return e;throw e.maxBufferInfo={fdNumber:a,unit:Wc(n,r,i)},t.destroy(),e},Wc=(e,t,n)=>e?`objects`:t?`lines`:n===`buffer`?`bytes`:`characters`,Gc=(e,t,n)=>{if(t.length!==n)return;let r=new gc;throw r.maxBufferInfo={fdNumber:`ipc`},r},Kc=(e,t)=>{let{streamName:n,threshold:r,unit:i}=qc(e,t);return`Command's ${n} was larger than ${r} ${i}`},qc=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:`output`,threshold:t[1],unit:`bytes`};let{maxBufferInfo:{fdNumber:n,unit:r}}=e;delete e.maxBufferInfo;let i=Hr(t,n);return n===`ipc`?{streamName:`IPC output`,threshold:i,unit:`messages`}:{streamName:Or(n),threshold:i,unit:r}},Jc=(e,t,n)=>e?.code===`ENOBUFS`&&t!==null&&t.some(e=>e!==null&&e.length>Xc(n)),Yc=(e,t,n)=>{if(!t)return e;let r=Xc(n);return e.length>r?e.slice(0,r):e},Xc=([,e])=>e,Zc=({stdio:e,all:t,ipcOutput:n,originalError:r,signal:i,signalDescription:a,exitCode:o,escapedCommand:s,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:_})=>{let v=r?.code,y=Qc({originalError:r,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:v,signal:i,signalDescription:a,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),b=el(r,_),x=`${y}: ${s}${b===void 0?``:`\n${b}`}`;return{originalMessage:b,shortMessage:x,message:[x,...t===void 0?[e[2],e[1]]:[t],...e.slice(3),n.map(e=>tl(e)).join(`
102
+ `)].map(e=>Zr(Vs(nl(e)))).filter(Boolean).join(`
103
+
104
+ `)}},Qc=({originalError:e,timedOut:t,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:a,signal:o,signalDescription:s,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=$c(d,f);return t?`Command timed out after ${n} milliseconds${m}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${o} (${s})`:l?`Command was canceled${m}`:r?`${Kc(e,i)}${m}`:a===void 0?d?`Command was killed with ${p} (${Ia(p)})${m}`:o===void 0?c===void 0?`Command failed`:`Command failed with exit code ${c}`:`Command was killed with ${o} (${s})`:`Command failed with ${a}${m}`},$c=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:``,el=(e,t)=>{if(e instanceof ca)return;let n=Zr(Is(ua(e)?e.originalMessage:String(e?.message??e),t));return n===``?void 0:n},tl=e=>typeof e==`string`?e:P(e),nl=e=>Array.isArray(e)?e.map(e=>Vs(rl(e))).filter(Boolean).join(`
105
+ `):rl(e),rl=e=>typeof e==`string`?e:Q(e)?lr(e):``,il=({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:a},startTime:o})=>cl({command:e,escapedCommand:t,cwd:a,durationMs:zi(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),al=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:o})=>ol({error:e,command:t,escapedCommand:n,startTime:a,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:o}),ol=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:_,cwd:v,maxBuffer:y},isSync:b})=>{let{exitCode:x,signal:S,signalDescription:C}=ll(l,u),{originalMessage:w,shortMessage:T,message:E}=Zc({stdio:d,all:f,ipcOutput:p,originalError:e,signal:S,signalDescription:C,exitCode:x,escapedCommand:n,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:_,maxBuffer:y,timeout:h,cwd:v}),D=sa(e,E,b);return Object.assign(D,sl({error:D,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:x,signal:S,signalDescription:C,stdio:d,all:f,ipcOutput:p,cwd:v,originalMessage:w,shortMessage:T})),D},sl=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:_})=>cl({shortMessage:_,originalMessage:g,command:t,escapedCommand:n,cwd:h,durationMs:zi(r),failed:!0,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:e.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),cl=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)),ll=(e,t)=>{let n=e===null?void 0:e,r=t===null?void 0:t;return{exitCode:n,signal:r,signalDescription:r===void 0?void 0:Ia(t)}},ul=e=>Number.isFinite(e)?e:0;function dl(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(ul(e*1e3)%1e3),nanoseconds:Math.trunc(ul(e*1e6)%1e3)}}function fl(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function pl(e){switch(typeof e){case`number`:if(Number.isFinite(e))return dl(e);break;case`bigint`:return fl(e)}throw TypeError(`Expected a finite number or bigint`)}const ml=e=>e===0||e===0n,hl=(e,t)=>t===1||t===1n?e:`${e}s`,gl=24n*60n*60n*1000n;function _l(e,t){let n=typeof e==`bigint`;if(!n&&!Number.isFinite(e))throw TypeError(`Expected a finite number or bigint`);t={...t};let r=e<0?`-`:``;e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let i=[],a=(e,t)=>{let n=Math.floor(e*10**t+1e-7);return(Math.round(n)/10**t).toFixed(t)},o=(e,n,r,a)=>{if(!((i.length===0||!t.colonNotation)&&ml(e)&&!(t.colonNotation&&r===`m`))){if(a??=String(e),t.colonNotation){let e=a.includes(`.`)?a.split(`.`)[0].length:a.length,t=i.length>0?2:1;a=`0`.repeat(Math.max(0,t-e))+a}else a+=t.verbose?` `+hl(n,e):r;i.push(a)}},s=pl(e),c=BigInt(s.days);if(t.hideYearAndDays?o(BigInt(c)*24n+BigInt(s.hours),`hour`,`h`):(t.hideYear?o(c,`day`,`d`):(o(c/365n,`year`,`y`),o(c%365n,`day`,`d`)),o(Number(s.hours),`hour`,`h`)),o(Number(s.minutes),`minute`,`m`),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let e=Number(s.seconds),n=Number(s.milliseconds),r=Number(s.microseconds),i=Number(s.nanoseconds);if(o(e,`second`,`s`),t.formatSubMilliseconds)o(n,`millisecond`,`ms`),o(r,`microsecond`,`µs`),o(i,`nanosecond`,`ns`);else{let e=n+r/1e3+i/1e6,a=typeof t.millisecondsDecimalDigits==`number`?t.millisecondsDecimalDigits:0,s=a?e.toFixed(a):e>=1?Math.round(e):Math.ceil(e);o(Number.parseFloat(s),`millisecond`,`ms`,s)}}else{let r=a((n?Number(e%gl):e)/1e3%60,typeof t.secondsDecimalDigits==`number`?t.secondsDecimalDigits:1),i=t.keepDecimalsOnWholeSeconds?r:r.replace(/\.0+$/,``);o(Number.parseFloat(i),`second`,`s`,i)}if(i.length===0)return r+`0`+(t.verbose?` milliseconds`:`ms`);let l=t.colonNotation?`:`:` `;return typeof t.unitCount==`number`&&(i=i.slice(0,Math.max(t.unitCount,1))),r+i.join(l)}const vl=(e,t)=>{e.failed&&Di({type:`error`,verboseMessage:e.shortMessage,verboseInfo:t,result:e})},yl=(e,t)=>{Ur(t)&&(vl(e,t),bl(e,t))},bl=(e,t)=>{Di({type:`duration`,verboseMessage:`(done in ${_l(e.durationMs)})`,verboseInfo:t,result:e})},xl=(e,t,{reject:n})=>{if(yl(e,t),e.failed&&n)throw e;return e},Sl=(e,t)=>jl(e)?`asyncGenerator`:Ml(e)?`generator`:Pl(e)?`fileUrl`:Il(e)?`filePath`:Ul(e)?`webStream`:Js(e,{checkOpen:!1})?`native`:Q(e)?`uint8Array`:Gl(e)?`asyncIterable`:Kl(e)?`iterable`:Wl(e)?Tl({transform:e},t):Nl(e)?Cl(e,t):`native`,Cl=(e,t)=>Zs(e.transform,{checkOpen:!1})?wl(e,t):Wl(e.transform)?Tl(e,t):Ol(e,t),wl=(e,t)=>(El(e,t,`Duplex stream`),`duplex`),Tl=(e,t)=>(El(e,t,`web TransformStream`),`webTransform`),El=({final:e,binary:t,objectMode:n},r,i)=>{Dl(e,`${r}.final`,i),Dl(t,`${r}.binary`,i),kl(n,`${r}.objectMode`)},Dl=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${n}.`)},Ol=({transform:e,final:t,binary:n,objectMode:r},i)=>{if(e!==void 0&&!Al(e))throw TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Zs(t,{checkOpen:!1}))throw TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(Wl(t))throw TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!Al(t))throw TypeError(`The \`${i}.final\` option must be a generator.`);return kl(n,`${i}.binary`),kl(r,`${i}.objectMode`),jl(e)||jl(t)?`asyncGenerator`:`generator`},kl=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`The \`${t}\` option must use a boolean.`)},Al=e=>jl(e)||Ml(e),jl=e=>Object.prototype.toString.call(e)===`[object AsyncGeneratorFunction]`,Ml=e=>Object.prototype.toString.call(e)===`[object GeneratorFunction]`,Nl=e=>Z(e)&&(e.transform!==void 0||e.final!==void 0),Pl=e=>Object.prototype.toString.call(e)===`[object URL]`,Fl=e=>Pl(e)&&e.protocol!==`file:`,Il=e=>Z(e)&&Object.keys(e).length>0&&Object.keys(e).every(e=>Ll.has(e))&&Rl(e.file),Ll=new Set([`file`,`append`]),Rl=e=>typeof e==`string`,zl=(e,t)=>e===`native`&&typeof t==`string`&&!Bl.has(t),Bl=new Set([`ipc`,`ignore`,`inherit`,`overlapped`,`pipe`]),Vl=e=>Object.prototype.toString.call(e)===`[object ReadableStream]`,Hl=e=>Object.prototype.toString.call(e)===`[object WritableStream]`,Ul=e=>Vl(e)||Hl(e),Wl=e=>Vl(e?.readable)&&Hl(e?.writable),Gl=e=>ql(e)&&typeof e[Symbol.asyncIterator]==`function`,Kl=e=>ql(e)&&typeof e[Symbol.iterator]==`function`,ql=e=>typeof e==`object`&&!!e,Jl=new Set([`generator`,`asyncGenerator`,`duplex`,`webTransform`]),Yl=new Set([`fileUrl`,`filePath`,`fileNumber`]),Xl=new Set([`fileUrl`,`filePath`]),Zl=new Set([...Xl,`webStream`,`nodeStream`]),Ql=new Set([`webTransform`,`duplex`]),$l={generator:`a generator`,asyncGenerator:`an async generator`,fileUrl:`a file URL`,filePath:`a file path string`,fileNumber:`a file descriptor number`,webStream:`a web stream`,nodeStream:`a Node.js stream`,webTransform:`a web TransformStream`,duplex:`a Duplex stream`,native:`any value`,iterable:`an iterable`,asyncIterable:`an async iterable`,string:`a string`,uint8Array:`a Uint8Array`},eu=(e,t,n,r)=>r===`output`?tu(e,t,n):nu(e,t,n),tu=(e,t,n)=>{let r=t!==0&&n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:e??r}},nu=(e,t,n)=>{let r=t===0?e===!0:n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t!==n.length-1&&(e??r)}},ru=(e,t)=>{let n=e.findLast(({type:e})=>Jl.has(e));return n===void 0?!1:t===`input`?n.value.writableObjectMode:n.value.readableObjectMode},iu=(e,t,n,r)=>[...e.filter(({type:e})=>!Jl.has(e)),...au(e,t,n,r)],au=(e,t,n,{encoding:r})=>{let i=e.filter(({type:e})=>Jl.has(e)),a=Array.from({length:i.length});for(let[e,o]of Object.entries(i))a[e]=ou({stdioItem:o,index:Number(e),newTransforms:a,optionName:t,direction:n,encoding:r});return uu(a,n)},ou=({stdioItem:e,stdioItem:{type:t},index:n,newTransforms:r,optionName:i,direction:a,encoding:o})=>t===`duplex`?su({stdioItem:e,optionName:i}):t===`webTransform`?cu({stdioItem:e,index:n,newTransforms:r,direction:a}):lu({stdioItem:e,index:n,newTransforms:r,direction:a,encoding:o}),su=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:n,readableObjectMode:r},objectMode:i=r}},optionName:a})=>{if(i&&!r)throw TypeError(`The \`${a}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&r)throw TypeError(`The \`${a}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:n,readableObjectMode:r}}},cu=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i})=>{let{transform:a,objectMode:o}=Z(t)?t:{transform:t},{writableObjectMode:s,readableObjectMode:c}=eu(o,n,r,i);return{...e,value:{transform:a,writableObjectMode:s,readableObjectMode:c}}},lu=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i,encoding:a})=>{let{transform:o,final:s,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=Z(t)?t:{transform:t},d=c||ks.has(a),{writableObjectMode:f,readableObjectMode:p}=eu(u,n,r,i);return{...e,value:{transform:o,final:s,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},uu=(e,t)=>t===`input`?e.reverse():e,du=(e,t,n)=>{let r=e.map(e=>fu(e,t));if(r.includes(`input`)&&r.includes(`output`))throw TypeError(`The \`${n}\` option must not be an array of both readable and writable values.`);return r.find(Boolean)??vu},fu=({type:e,value:t},n)=>pu[n]??gu[e](t),pu=[`input`,`output`,`output`],mu=()=>void 0,hu=()=>`input`,gu={generator:mu,asyncGenerator:mu,fileUrl:mu,filePath:mu,iterable:hu,asyncIterable:hu,uint8Array:hu,webStream:e=>Hl(e)?`output`:`input`,nodeStream(e){return Xs(e,{checkOpen:!1})?Ys(e,{checkOpen:!1})?void 0:`input`:`output`},webTransform:mu,duplex:mu,native(e){let t=_u(e);if(t!==void 0)return t;if(Js(e,{checkOpen:!1}))return gu.nodeStream(e)}},_u=e=>{if([0,L.stdin].includes(e))return`input`;if([1,2,L.stdout,L.stderr].includes(e))return`output`},vu=`output`,yu=(e,t)=>t&&!e.includes(`ipc`)?[...e,`ipc`]:e,bu=({stdio:e,ipc:t,buffer:n,...r},i,a)=>{let o=xu(e,r).map((e,t)=>Cu(e,t));return a?wu(o,n,i):yu(o,t)},xu=(e,t)=>{if(e===void 0)return Dr.map(e=>t[e]);if(Su(t))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${Dr.map(e=>`\`${e}\``).join(`, `)}`);if(typeof e==`string`)return[e,e,e];if(!Array.isArray(e))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let n=Math.max(e.length,Dr.length);return Array.from({length:n},(t,n)=>e[n])},Su=e=>Dr.some(t=>e[t]!==void 0),Cu=(e,t)=>Array.isArray(e)?e.map(e=>Cu(e,t)):e??(t>=Dr.length?`ignore`:`pipe`),wu=(e,t,n)=>e.map((e,r)=>!t[r]&&r!==0&&!Wr(n,r)&&Tu(e)?`ignore`:e),Tu=e=>e===`pipe`||Array.isArray(e)&&e.every(e=>e===`pipe`),Eu=({stdioItem:e,stdioItem:{type:t},isStdioArray:n,fdNumber:r,direction:i,isSync:a})=>!n||t!==`native`?e:a?Du({stdioItem:e,fdNumber:r,direction:i}):Au({stdioItem:e,fdNumber:r}),Du=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r,direction:i})=>{let a=Ou({value:t,optionName:n,fdNumber:r,direction:i});if(a!==void 0)return a;if(Js(t,{checkOpen:!1}))throw TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},Ou=({value:e,optionName:t,fdNumber:n,direction:r})=>{let i=ku(e,n);if(i!==void 0){if(r===`output`)return{type:`fileNumber`,value:i,optionName:t};if(H.isatty(i))throw TypeError(`The \`${t}: ${To(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:`uint8Array`,value:ar(T(i)),optionName:t}}},ku=(e,t)=>{if(e===`inherit`)return t;if(typeof e==`number`)return e;let n=Er.indexOf(e);if(n!==-1)return n},Au=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r})=>t===`inherit`?{type:`nodeStream`,value:ju(r,t,n),optionName:n}:typeof t==`number`?{type:`nodeStream`,value:ju(t,t,n),optionName:n}:Js(t,{checkOpen:!1})?{type:`nodeStream`,value:t,optionName:n}:e,ju=(e,t,n)=>{let r=Er[e];if(r===void 0)throw TypeError(`The \`${n}: ${t}\` option is invalid: no such standard stream.`);return r},Mu=({input:e,inputFile:t},n)=>n===0?[...Nu(e),...Fu(t)]:[],Nu=e=>e===void 0?[]:[{type:Pu(e),value:e,optionName:`input`}],Pu=e=>{if(Xs(e,{checkOpen:!1}))return`nodeStream`;if(typeof e==`string`)return`string`;if(Q(e))return`uint8Array`;throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Fu=e=>e===void 0?[]:[{...Iu(e),optionName:`inputFile`}],Iu=e=>{if(Pl(e))return{type:`fileUrl`,value:e};if(Rl(e))return{type:`filePath`,value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")},Lu=e=>e.filter((t,n)=>e.every((e,r)=>t.value!==e.value||n>=r||t.type===`generator`||t.type===`asyncGenerator`)),Ru=({stdioItem:{type:e,value:t,optionName:n},direction:r,fileDescriptors:i,isSync:a})=>{let o=zu(i,e);if(o.length!==0){if(a){Bu({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});return}if(Zl.has(e))return Vu({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});Ql.has(e)&&Uu({otherStdioItems:o,type:e,value:t,optionName:n})}},zu=(e,t)=>e.flatMap(({direction:e,stdioItems:n})=>n.filter(e=>e.type===t).map((t=>({...t,direction:e})))),Bu=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{Xl.has(t)&&Vu({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})},Vu=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{let a=e.filter(e=>Hu(e,n));if(a.length!==0)return Wu(a.find(e=>e.direction!==i),r,t),i===`output`?a[0].stream:void 0},Hu=({type:e,value:t},n)=>e===`filePath`?t.file===n.file:e===`fileUrl`?t.href===n.href:t===n,Uu=({otherStdioItems:e,type:t,value:n,optionName:r})=>{Wu(e.find(({value:{transform:e}})=>e===n.transform),r,t)},Wu=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${$l[n]} that is the same.`)},Gu=(e,t,n,r)=>{let i=ed({initialFileDescriptors:bu(t,n,r).map((e,n)=>Ku({stdioOption:e,fdNumber:n,options:t,isSync:r})),addProperties:e,options:t,isSync:r});return t.stdio=i.map(({stdioItems:e})=>id(e)),i},Ku=({stdioOption:e,fdNumber:t,options:n,isSync:r})=>{let i=Or(t),{stdioItems:a,isStdioArray:o}=qu({stdioOption:e,fdNumber:t,options:n,optionName:i}),s=du(a,t,i),c=iu(a.map(e=>Eu({stdioItem:e,isStdioArray:o,fdNumber:t,direction:s,isSync:r})),i,s,n),l=ru(c,s);return $u(c,l),{direction:s,objectMode:l,stdioItems:c}},qu=({stdioOption:e,fdNumber:t,options:n,optionName:r})=>{let i=Lu([...(Array.isArray(e)?e:[e]).map(e=>Ju(e,r)),...Mu(n,t)]),a=i.length>1;return Yu(i,a,r),Zu(i),{stdioItems:i,isStdioArray:a}},Ju=(e,t)=>({type:Sl(e,t),value:e,optionName:t}),Yu=(e,t,n)=>{if(e.length===0)throw TypeError(`The \`${n}\` option must not be an empty array.`);if(t){for(let{value:t,optionName:n}of e)if(Xu.has(t))throw Error(`The \`${n}\` option must not include \`${t}\`.`)}},Xu=new Set([`ignore`,`ipc`]),Zu=e=>{for(let t of e)Qu(t)},Qu=({type:e,value:t,optionName:n})=>{if(Fl(t))throw TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
106
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(zl(e,t))throw TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},$u=(e,t)=>{if(!t)return;let n=e.find(({type:e})=>Yl.has(e));if(n!==void 0)throw TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},ed=({initialFileDescriptors:e,addProperties:t,options:n,isSync:r})=>{let i=[];try{for(let a of e)i.push(td({fileDescriptor:a,fileDescriptors:i,addProperties:t,options:n,isSync:r}));return i}catch(e){throw rd(i),e}},td=({fileDescriptor:{direction:e,objectMode:t,stdioItems:n},fileDescriptors:r,addProperties:i,options:a,isSync:o})=>({direction:e,objectMode:t,stdioItems:n.map(t=>nd({stdioItem:t,addProperties:i,direction:e,options:a,fileDescriptors:r,isSync:o}))}),nd=({stdioItem:e,addProperties:t,direction:n,options:r,fileDescriptors:i,isSync:a})=>{let o=Ru({stdioItem:e,direction:n,fileDescriptors:i,isSync:a});return o===void 0?{...e,...t[n][e.type](e,r)}:{...e,stream:o}},rd=e=>{for(let{stdioItems:t}of e)for(let{stream:e}of t)e!==void 0&&!Tr(e)&&e.destroy()},id=e=>{if(e.length>1)return e.some(({value:e})=>e===`overlapped`)?`overlapped`:`pipe`;let[{type:t,value:n}]=e;return t===`native`?n:`pipe`},ad=(e,t)=>Gu(ud,e,t,!0),od=({type:e,optionName:t})=>{cd(t,$l[e])},sd=({optionName:e,value:t})=>((t===`ipc`||t===`overlapped`)&&cd(e,`"${t}"`),{}),cd=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},ld={generator(){},asyncGenerator:od,webStream:od,nodeStream:od,webTransform:od,duplex:od,asyncIterable:od,native:sd},ud={input:{...ld,fileUrl:({value:e})=>({contents:[ar(T(e))]}),filePath:({value:{file:e}})=>({contents:[ar(T(e))]}),fileNumber:od,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...ld,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:od,string:od,uint8Array:od}},dd=(e,{stripFinalNewline:t},n)=>fd(t,n)&&e!==void 0&&!Array.isArray(e)?Vs(e):e,fd=(e,t)=>t===`all`?e[1]||e[2]:e[t],pd=(e,t,n,r)=>e||n?void 0:gd(t,r),md=(e,t,n)=>n?e.flatMap(e=>hd(e,t)):hd(e,t),hd=(e,t)=>{let{transform:n,final:r}=gd(t,{});return[...n(e),...r()]},gd=(e,t)=>(t.previousChunks=``,{transform:_d.bind(void 0,t,e),final:yd.bind(void 0,t)}),_d=function*(e,t,n){if(typeof n!=`string`){yield n;return}let{previousChunks:r}=e,i=-1;for(let a=0;a<n.length;a+=1)if(n[a]===`
107
+ `){let o=vd(n,a,t,e),s=n.slice(i+1,a+1-o);r.length>0&&(s=Sd(r,s),r=``),yield s,i=a}i!==n.length-1&&(r=Sd(r,n.slice(i+1))),e.previousChunks=r},vd=(e,t,n,r)=>n?0:(r.isWindowsNewline=t!==0&&e[t-1]===`\r`,r.isWindowsNewline?2:1),yd=function*({previousChunks:e}){e.length>0&&(yield e)},bd=({binary:e,preserveNewlines:t,readableObjectMode:n,state:r})=>e||t||n?void 0:{transform:xd.bind(void 0,r)},xd=function*({isWindowsNewline:e=!1},t){let{unixNewline:n,windowsNewline:r,LF:i,concatBytes:a}=typeof t==`string`?Cd:wd;if(t.at(-1)===i){yield t;return}yield a(t,e?r:n)},Sd=(e,t)=>`${e}${t}`,Cd={windowsNewline:`\r
108
+ `,unixNewline:`
109
+ `,LF:`
110
+ `,concatBytes:Sd},wd={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}},Td=(e,t)=>e?void 0:Ed.bind(void 0,t),Ed=function*(e,t){if(typeof t!=`string`&&!Q(t)&&!pe.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},Dd=(e,t)=>e?Od.bind(void 0,t):kd.bind(void 0,t),Od=function*(e,t){Ad(e,t),yield t},kd=function*(e,t){if(Ad(e,t),typeof t!=`string`&&!Q(t))throw TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},Ad=(e,t)=>{if(t==null)throw TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
111
+ Instead, \`yield\` should either be called with a value, or not be called at all. For example:
112
+ if (condition) { yield value; }`)},jd=(e,t,n)=>{if(n)return;if(e)return{transform:Md.bind(void 0,new TextEncoder)};let r=new j(t);return{transform:Nd.bind(void 0,r),final:Pd.bind(void 0,r)}},Md=function*(e,t){pe.isBuffer(t)?yield ar(t):typeof t==`string`?yield e.encode(t):yield t},Nd=function*(e,t){yield Q(t)?e.write(t):t},Pd=function*(e){let t=e.end();t!==``&&(yield t)},Fd=M(async(e,t,n,r)=>{t.currentIterable=e(...n);try{for await(let e of t.currentIterable)r.push(e)}finally{delete t.currentIterable}}),Id=async function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Bd}=t[n];for await(let i of r(e))yield*Id(i,t,n+1)},Ld=async function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Rd(n,Number(t),e)},Rd=async function*(e,t,n){if(e!==void 0)for await(let r of e())yield*Id(r,n,t+1)},zd=M(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Bd=function*(e){yield e},Vd=(e,t,n,r)=>{try{for(let r of e(...t))n.push(r);r()}catch(e){r(e)}},Hd=(e,t)=>[...t.flatMap(t=>[...Ud(t,e,0)]),...Wd(e)],Ud=function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Kd}=t[n];for(let i of r(e))yield*Ud(i,t,n+1)},Wd=function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Gd(n,Number(t),e)},Gd=function*(e,t,n){if(e!==void 0)for(let r of e())yield*Ud(r,n,t+1)},Kd=function*(e){yield e},qd=({value:e,value:{transform:t,final:n,writableObjectMode:r,readableObjectMode:i},optionName:a},{encoding:o})=>{let s={},c=Yd(e,o,a),l=jl(t),u=jl(n),d=l?Fd.bind(void 0,Id,s):Vd.bind(void 0,Ud),f=l||u?Fd.bind(void 0,Ld,s):Vd.bind(void 0,Wd),p=l||u?zd.bind(void 0,s):void 0;return{stream:new ue({writableObjectMode:r,writableHighWaterMark:fe(r),readableObjectMode:i,readableHighWaterMark:fe(i),transform(e,t,n){d([e,c,0],this,n)},flush(e){f([c],this,e)},destroy:p})}},Jd=(e,t,n,r)=>{let i=t.filter(({type:e})=>e===`generator`),a=r?i.reverse():i;for(let{value:t,optionName:r}of a)e=Hd(Yd(t,n,r),e);return e},Yd=({transform:e,final:t,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:a},o,s)=>{let c={};return[{transform:Td(r,s)},jd(n,o,r),pd(n,a,r,c),{transform:e,final:t},{transform:Dd(i,s)},bd({binary:n,preserveNewlines:a,readableObjectMode:i,state:c})].filter(Boolean)},Xd=(e,t)=>{for(let n of Zd(e))Qd(e,n,t)},Zd=e=>new Set(Object.entries(e).filter(([,{direction:e}])=>e===`input`).map(([e])=>Number(e))),Qd=(e,t,n)=>{let{stdioItems:r}=e[t],i=r.filter(({contents:e})=>e!==void 0);if(i.length!==0){if(t!==0){let[{type:e,optionName:t}]=i;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${$l[e]} with synchronous methods.`)}n.input=fr(i.map(({contents:e})=>e).map(e=>$d(e,r)))}},$d=(e,t)=>{let n=Jd(e,t,`utf8`,!0);return ef(n),fr(n)},ef=e=>{let t=e.find(e=>typeof e!=`string`&&!Q(e));if(t!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)},tf=({stdioItems:e,encoding:t,verboseInfo:n,fdNumber:r})=>r!==`all`&&Wr(n,r)&&!ks.has(t)&&nf(r)&&(e.some(({type:e,value:t})=>e===`native`&&rf.has(t))||e.every(({type:e})=>Jl.has(e))),nf=e=>e===1||e===2,rf=new Set([`pipe`,`overlapped`]),af=async(e,t,n,r)=>{for await(let i of e)sf(t)||cf(i,n,r)},of=(e,t,n)=>{for(let r of e)cf(r,t,n)},sf=e=>e._readableState.pipes.length>0,cf=(e,t,n)=>{Di({type:`output`,verboseMessage:ji(e),fdNumber:t,verboseInfo:n})},lf=({fileDescriptors:e,syncResult:{output:t},options:n,isMaxBuffer:r,verboseInfo:i})=>{if(t===null)return{output:Array.from({length:3})};let a={},o=new Set([]);return{output:t.map((t,s)=>uf({result:t,fileDescriptors:e,fdNumber:s,state:a,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...a}},uf=({result:e,fileDescriptors:t,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:a,verboseInfo:o},{buffer:s,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let f=ar(Yc(e,a,d)),{stdioItems:p,objectMode:m}=t[n],{serializedResult:h,finalResult:g=h}=ff({chunks:df([f],p,c,r),objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:n});pf({serializedResult:h,fdNumber:n,state:r,verboseInfo:o,encoding:c,stdioItems:p,objectMode:m});let _=s[n]?g:void 0;try{return r.error===void 0&&mf(h,p,i),_}catch(e){return r.error=e,_}},df=(e,t,n,r)=>{try{return Jd(e,t,n,!1)}catch(t){return r.error=t,e}},ff=({chunks:e,objectMode:t,encoding:n,lines:r,stripFinalNewline:i,fdNumber:a})=>{if(t)return{serializedResult:e};if(n===`buffer`)return{serializedResult:fr(e)};let o=ur(e,n);return r[a]?{serializedResult:o,finalResult:md(o,!i[a],t)}:{serializedResult:o}},pf=({serializedResult:e,fdNumber:t,state:n,verboseInfo:r,encoding:i,stdioItems:a,objectMode:o})=>{if(!tf({stdioItems:a,encoding:i,verboseInfo:r,fdNumber:t}))return;let s=md(e,!1,o);try{of(s,t,r)}catch(e){n.error??=e}},mf=(e,t,n)=>{for(let{path:r,append:i}of t.filter(({type:e})=>Yl.has(e))){let t=typeof r==`string`?r:r.toString();i||n.has(t)?S(r,e):(n.add(t),O(r,e))}},hf=([,e,t],n)=>{if(n.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,dd(t,n,`all`)]:Array.isArray(t)?[dd(e,n,`all`),...t]:Q(e)&&Q(t)?mr([e,t]):`${e}${t}`},gf=async(e,t)=>{let[n,r]=await _f(e);return t.isForcefullyTerminated??=!1,[n,r]},_f=async e=>{let[t,n]=await Promise.allSettled([J(e,`spawn`),J(e,`exit`)]);return t.status===`rejected`?[]:n.status===`rejected`?vf(e):n.value},vf=async e=>{try{return await J(e,`exit`)}catch{return vf(e)}},yf=async e=>{let[t,n]=await e;if(!bf(t,n)&&xf(t,n))throw new ca;return[t,n]},bf=(e,t)=>e===void 0&&t===void 0,xf=(e,t)=>e!==0||t!==null,Sf=({error:e,status:t,signal:n,output:r},{maxBuffer:i})=>{let a=Cf(e,t,n);return{resultError:a,exitCode:t,signal:n,timedOut:a?.code===`ETIMEDOUT`,isMaxBuffer:Jc(a,r,i)}},Cf=(e,t,n)=>e===void 0?xf(t,n)?new ca:void 0:e,wf=(e,t,n)=>{let{file:r,commandArguments:i,command:a,escapedCommand:o,startTime:s,verboseInfo:c,options:l,fileDescriptors:u}=Tf(e,t,n);return xl(kf({file:r,commandArguments:i,options:l,command:a,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:s}),c,l)},Tf=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Bi(e,t,n),{file:s,commandArguments:c,options:l}=Ls(e,t,Ef(n));return Df(l),{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:l,fileDescriptors:ad(l,o)}},Ef=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,Df=({ipc:e,ipcInput:t,detached:n,cancelSignal:r})=>{t&&Of(`ipcInput`),e&&Of(`ipc: true`),n&&Of(`detached: true`),r&&Of(`cancelSignal`)},Of=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},kf=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,verboseInfo:a,fileDescriptors:o,startTime:s})=>{let c=Af({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:s});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Sf(c,n),{output:m,error:h=l}=lf({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:p,verboseInfo:a});return Mf({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:m.map((e,t)=>dd(e,n,t)),all:dd(hf(m,n),n,`all`),options:n,command:r,escapedCommand:i,startTime:s})},Af=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:a,startTime:o})=>{try{return Xd(a,n),A(...Bs(e,t,jf(n)))}catch(e){return al({error:e,command:r,escapedCommand:i,fileDescriptors:a,options:n,startTime:o,isSync:!0})}},jf=({encoding:e,maxBuffer:t,...n})=>({...n,encoding:`buffer`,maxBuffer:Xc(t)}),Mf=({error:e,exitCode:t,signal:n,timedOut:r,isMaxBuffer:i,stdio:a,all:o,options:s,command:c,escapedCommand:l,startTime:u})=>e===void 0?il({command:c,escapedCommand:l,stdio:a,all:o,ipcOutput:[],options:s,startTime:u}):ol({error:e,command:c,escapedCommand:l,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:t,signal:n,stdio:a,all:o,ipcOutput:[],options:s,startTime:u,isSync:!0}),Nf=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0,filter:a}={})=>(Ja({methodName:`getOneMessage`,isSubprocess:n,ipc:r,isConnected:zo(e)}),Pf({anyProcess:e,channel:t,isSubprocess:n,filter:a,reference:i})),Pf=async({anyProcess:e,channel:t,isSubprocess:n,filter:r,reference:i})=>{Do(t,i);let a=Io(e,t,n),o=new AbortController;try{return await Promise.race([Ff(a,r,o),If(a,n,o),Lf(a,n,o)])}catch(t){throw po(e),t}finally{o.abort(),ko(t,i)}},Ff=async(e,t,{signal:n})=>{if(t===void 0){let[t]=await J(e,`message`,{signal:n});return t}for await(let[r]of q(e,`message`,{signal:n}))if(t(r))return r},If=async(e,t,{signal:n})=>{await J(e,`disconnect`,{signal:n}),Za(t)},Lf=async(e,t,{signal:n})=>{let[r]=await J(e,`strict:error`,{signal:n});throw $a(r,t)},Rf=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0}={})=>zf({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),zf=({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:i,reference:a})=>{Ja({methodName:`getEachMessage`,isSubprocess:n,ipc:r,isConnected:zo(e)}),Do(t,a);let o=Io(e,t,n),s=new AbortController,c={};return Bf(e,o,s),Vf({ipcEmitter:o,isSubprocess:n,controller:s,state:c}),Hf({anyProcess:e,channel:t,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:s,state:c,reference:a})},Bf=async(e,t,n)=>{try{await J(t,`disconnect`,{signal:n.signal}),n.abort()}catch{}},Vf=async({ipcEmitter:e,isSubprocess:t,controller:n,state:r})=>{try{let[i]=await J(e,`strict:error`,{signal:n.signal});r.error=$a(i,t),n.abort()}catch{}},Hf=async function*({anyProcess:e,channel:t,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:a,state:o,reference:s}){try{for await(let[e]of q(n,`message`,{signal:a.signal}))Uf(o),yield e}catch{Uf(o)}finally{a.abort(),ko(t,s),r||po(e),i&&await e}},Uf=({error:e})=>{if(e)throw e},Wf=(e,{ipc:t})=>{Object.assign(e,Kf(e,!1,t))},Gf=()=>{let e=L,t=L.channel!==void 0;return{...Kf(e,!0,t),getCancelSignal:cs.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:!0,ipc:t})}},Kf=(e,t,n)=>({sendMessage:ns.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getOneMessage:Nf.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getEachMessage:Rf.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})}),qf=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,verboseInfo:o})=>{rd(r);let s=new k;return Jf(s,r),Object.assign(s,{readable:Xf,writable:Zf,duplex:Qf}),{subprocess:s,promise:$f(al({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:!1}),o,i)}},Jf=(e,t)=>{let n=Yf(),r=Yf(),i=Yf(),a=Array.from({length:t.length-3},Yf),o=Yf(),s=[n,r,i,...a];Object.assign(e,{stdin:n,stdout:r,stderr:i,all:o,stdio:s})},Yf=()=>{let e=new ce;return e.end(),e},Xf=()=>new le({read(){}}),Zf=()=>new de({write(){}}),Qf=()=>new se({read(){},write(){}}),$f=async(e,t,n)=>xl(e,t,n),ep=(e,t)=>Gu(rp,e,t,!1),tp=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${$l[e]}.`)},np={fileNumber:tp,generator:qd,asyncGenerator:qd,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:n}}){let r=t||n;return{stream:se.fromWeb(e,{objectMode:r})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},rp={input:{...np,fileUrl:({value:e})=>({stream:C(e)}),filePath:({value:{file:e}})=>({stream:C(e)}),webStream:({value:e})=>({stream:le.fromWeb(e)}),iterable:({value:e})=>({stream:le.from(e)}),asyncIterable:({value:e})=>({stream:le.from(e)}),string:({value:e})=>({stream:le.from(e)}),uint8Array:({value:e})=>({stream:le.from(pe.from(e))})},output:{...np,fileUrl:({value:e})=>({stream:w(e)}),filePath:({value:{file:e,append:t}})=>({stream:w(e,t?{flags:`a`}:{})}),webStream:({value:e})=>({stream:de.fromWeb(e)}),iterable:tp,asyncIterable:tp,string:tp,uint8Array:tp}};function ip(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)up(t);let t=e.some(({readableObjectMode:e})=>e),n=ap(e,t),r=new op({objectMode:t,writableHighWaterMark:n,readableHighWaterMark:n});for(let t of e)r.add(t);return r}const ap=(e,t)=>{if(e.length===0)return fe(t);let n=e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e);return Math.max(...n)};var op=class extends ce{#e=new Set([]);#t=new Set([]);#n=new Set([]);#r;#i=Symbol(`unpipe`);#a=new WeakMap;add(e){if(up(e),this.#e.has(e))return;this.#e.add(e),this.#r??=sp(this,this.#e,this.#i);let t=dp({passThroughStream:this,stream:e,streams:this.#e,ended:this.#t,aborted:this.#n,onFinished:this.#r,unpipeEvent:this.#i});this.#a.set(e,t),e.pipe(this,{end:!1})}async remove(e){if(up(e),!this.#e.has(e))return!1;let t=this.#a.get(e);return t===void 0?!1:(this.#a.delete(e),e.unpipe(this),await t,!0)}};const sp=async(e,t,n)=>{xp(e,Sp);let r=new AbortController;try{await Promise.race([cp(e,r),lp(e,t,n,r)])}finally{r.abort(),xp(e,-Sp)}},cp=async(e,{signal:t})=>{try{await me(e,{signal:t,cleanup:!0})}catch(t){throw gp(e,t),t}},lp=async(e,t,n,{signal:r})=>{for await(let[i]of q(e,`unpipe`,{signal:r}))t.has(i)&&i.emit(n)},up=e=>{if(typeof e?.pipe!=`function`)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},dp=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,onFinished:a,unpipeEvent:o})=>{xp(e,Cp);let s=new AbortController;try{await Promise.race([fp(a,t,s),pp({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:s}),mp({stream:t,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:s})])}finally{s.abort(),xp(e,-Cp)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?vp(e):hp(e))},fp=async(e,t,{signal:n})=>{try{await e,n.aborted||vp(t)}catch(e){n.aborted||gp(t,e)}},pp=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:{signal:a}})=>{try{await me(t,{signal:a,cleanup:!0,readable:!0,writable:!1}),n.has(t)&&r.add(t)}catch(r){if(a.aborted||!n.has(t))return;_p(r)?i.add(t):yp(e,r)}},mp=async({stream:e,streams:t,ended:n,aborted:r,unpipeEvent:i,controller:{signal:a}})=>{if(await J(e,i,{signal:a}),!e.readable)return J(a,`abort`,{signal:a});t.delete(e),n.delete(e),r.delete(e)},hp=e=>{e.writable&&e.end()},gp=(e,t)=>{_p(t)?vp(e):yp(e,t)},_p=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,vp=e=>{(e.readable||e.writable)&&e.destroy()},yp=(e,t)=>{e.destroyed||(e.once(`error`,bp),e.destroy(t))},bp=()=>{},xp=(e,t)=>{let n=e.getMaxListeners();n!==0&&n!==1/0&&e.setMaxListeners(n+t)},Sp=2,Cp=1,wp=(e,t)=>{e.pipe(t),Tp(e,t),Dp(e,t)},Tp=async(e,t)=>{if(!(Tr(e)||Tr(t))){try{await me(e,{cleanup:!0,readable:!0,writable:!1})}catch{}Ep(t)}},Ep=e=>{e.writable&&e.end()},Dp=async(e,t)=>{if(!(Tr(e)||Tr(t))){try{await me(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Op(e)}},Op=e=>{e.readable&&e.destroy()},kp=(e,t,n)=>{let r=new Map;for(let[i,{stdioItems:a,direction:o}]of Object.entries(t)){for(let{stream:t}of a.filter(({type:e})=>Jl.has(e)))Ap(e,t,o,i);for(let{stream:t}of a.filter(({type:e})=>!Jl.has(e)))Mp({subprocess:e,stream:t,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(let[e,t]of r.entries())wp(t.length===1?t[0]:ip(t),e)},Ap=(e,t,n,r)=>{n===`output`?wp(e.stdio[r],t):wp(t,e.stdio[r]);let i=jp[r];i!==void 0&&(e[i]=t),e.stdio[r]=t},jp=[`stdin`,`stdout`,`stderr`],Mp=({subprocess:e,stream:t,direction:n,fdNumber:r,pipeGroups:i,controller:a})=>{if(t===void 0)return;Np(t,a);let[o,s]=n===`output`?[t,e.stdio[r]]:[e.stdio[r],t],c=i.get(o)??[];i.set(o,[...c,s])},Np=(e,{signal:t})=>{Tr(e)&&Eo(e,Pp,t)},Pp=2,Fp=[];Fp.push(`SIGHUP`,`SIGINT`,`SIGTERM`),process.platform!==`win32`&&Fp.push(`SIGALRM`,`SIGABRT`,`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&Fp.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`);const Ip=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`,Lp=Symbol.for(`signal-exit emitter`),Rp=globalThis,zp=Object.defineProperty.bind(Object);var Bp=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Rp[Lp])return Rp[Lp];zp(Rp,Lp,{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}},Vp=class{};const Hp=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}});var Up=class extends Vp{onExit(){return()=>{}}load(){}unload(){}},Wp=class extends Vp{#e=Gp.platform===`win32`?`SIGINT`:`SIGHUP`;#t=new Bp;#n;#r;#i;#a={};#o=!1;constructor(e){super(),this.#n=e,this.#a={};for(let t of Fp)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(!Ip(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 Fp)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,Fp.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 Ip(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`&&Ip(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 Gp=globalThis.process,{onExit:Kp,load:qp,unload:Jp}=Hp(Ip(Gp)?new Wp(Gp):new Up),Yp=(e,{cleanup:t,detached:n},{signal:r})=>{if(!t||n)return;let i=Kp(()=>{e.kill()});ie(r,()=>{i()})},Xp=({source:e,sourcePromise:t,boundOptions:n,createNested:r},...i)=>{let a=Ri(),{destination:o,destinationStream:s,destinationError:c,from:l,unpipeSignal:u}=Zp(n,r,i),{sourceStream:d,sourceError:f}=em(e,l),{options:p,fileDescriptors:m}=_o.get(e);return{sourcePromise:t,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:s,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:a}},Zp=(e,t,n)=>{try{let{destination:r,pipeOptions:{from:i,to:a,unpipeSignal:o}={}}=Qp(e,t,...n);return{destination:r,destinationStream:ho(r,a),from:i,unpipeSignal:o}}catch(e){return{destinationError:e}}},Qp=(e,t,n,...r)=>{if(Array.isArray(n))return{destination:t($p,e)(n,...r),pipeOptions:e};if(typeof n==`string`||n instanceof URL||er(n)){if(Object.keys(e).length>0)throw TypeError(`Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).`);let[i,a,o]=nr(n,...r);return{destination:t($p)(i,a,o),pipeOptions:o}}if(_o.has(n)){if(Object.keys(e).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:n,pipeOptions:r[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},$p=({options:e})=>({options:{...e,stdin:`pipe`,piped:!0}}),em=(e,t)=>{try{return{sourceStream:go(e,t)}}catch(e){return{sourceError:e}}},tm=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:a,startTime:o})=>{let s=nm({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r});if(s!==void 0)throw rm({error:s,fileDescriptors:i,sourceOptions:a,startTime:o})},nm=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r})=>{if(t!==void 0&&r!==void 0)return r;if(r!==void 0)return Op(e),r;if(t!==void 0)return Ep(n),t},rm=({error:e,fileDescriptors:t,sourceOptions:n,startTime:r})=>al({error:e,command:im,escapedCommand:im,fileDescriptors:t,options:n,startTime:r,isSync:!1}),im=`source.pipe(destination)`,am=async e=>{let[{status:t,reason:n,value:r=n},{status:i,reason:a,value:o=a}]=await e;if(o.pipedFrom.includes(r)||o.pipedFrom.push(r),i===`rejected`)throw o;if(t===`rejected`)throw r;return o},om=(e,t,n)=>{let r=um.has(t)?cm(e,t):sm(e,t);return Eo(e,dm,n.signal),Eo(t,fm,n.signal),lm(t),r},sm=(e,t)=>{let n=ip([e]);return wp(n,t),um.set(t,n),n},cm=(e,t)=>{let n=um.get(t);return n.add(e),n},lm=async e=>{try{await me(e,{cleanup:!0,readable:!1,writable:!0})}catch{}um.delete(e)},um=new WeakMap,dm=2,fm=1,pm=(e,t)=>e===void 0?[]:[mm(e,t)],mm=async(e,{sourceStream:t,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:a})=>{throw await ne(e,t),await n.remove(t),rm({error:Error("Pipe canceled by `unpipeSignal` option."),fileDescriptors:r,sourceOptions:i,startTime:a})},hm=(e,...t)=>{if(Z(t[0]))return hm.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:n,...r}=Xp(e,...t),i=gm({...r,destination:n});return i.pipe=hm.bind(void 0,{...e,source:n,sourcePromise:i,boundOptions:{}}),i},gm=async({sourcePromise:e,sourceStream:t,sourceOptions:n,sourceError:r,destination:i,destinationStream:a,destinationError:o,unpipeSignal:s,fileDescriptors:c,startTime:l})=>{let u=_m(e,i);tm({sourceStream:t,sourceError:r,destinationStream:a,destinationError:o,fileDescriptors:c,sourceOptions:n,startTime:l});let d=new AbortController;try{let e=om(t,a,d);return await Promise.race([am(u),...pm(s,{sourceStream:t,mergedStream:e,sourceOptions:n,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_m=(e,t)=>Promise.allSettled([e,t]),vm=({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:r,encoding:i,preserveNewlines:a})=>{let o=new AbortController;return ym(t,o),Sm({stream:e,controller:o,binary:n,shouldEncode:!e.readableObjectMode&&r,encoding:i,shouldSplit:!e.readableObjectMode,preserveNewlines:a})},ym=async(e,t)=>{try{await e}catch{}finally{t.abort()}},bm=({stream:e,onStreamEnd:t,lines:n,encoding:r,stripFinalNewline:i,allMixed:a})=>{let o=new AbortController;xm(t,o,e);let s=e.readableObjectMode&&!a;return Sm({stream:e,controller:o,binary:r===`buffer`,shouldEncode:!s,encoding:r,shouldSplit:!s&&n,preserveNewlines:!i})},xm=async(e,t,n)=>{try{await e}catch{n.destroy()}finally{t.abort()}},Sm=({stream:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})=>Tm({onStdoutChunk:q(e,`data`,{signal:t.signal,highWaterMark:wm,highWatermark:wm}),controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}),Cm=fe(!0),wm=Cm,Tm=async function*({onStdoutChunk:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}){let s=Em({binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o});try{for await(let[t]of e)yield*Ud(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*Wd(s)}},Em=({binary:e,shouldEncode:t,encoding:n,shouldSplit:r,preserveNewlines:i})=>[jd(e,n,!t),pd(e,i,!r,{})].filter(Boolean),Dm=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,buffer:i,maxBuffer:a,lines:o,allMixed:s,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=Om({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:s,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([km(e),d]);return}let f=bm({stream:e,onStreamEnd:t,lines:o,encoding:r,stripFinalNewline:fd(c,n),allMixed:s}),[p]=await Promise.all([Am({stream:e,iterable:f,fdNumber:n,encoding:r,maxBuffer:a,lines:o}),d]);return p},Om=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:i,verboseInfo:a,streamInfo:{fileDescriptors:o}})=>{tf({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:a,fdNumber:n})&&await af(bm({stream:e,onStreamEnd:t,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i}),e,n,a)},km=async e=>{await W(),e.readableFlowing===null&&e.resume()},Am=async({stream:e,stream:{readableObjectMode:t},iterable:n,fdNumber:r,encoding:i,maxBuffer:a,lines:o})=>{try{return t||o?await Sc(n,{maxBuffer:a}):i===`buffer`?new Uint8Array(await wc(n,{maxBuffer:a})):await zc(n,{maxBuffer:a})}catch(n){return Mm(Uc({error:n,stream:e,readableObjectMode:t,lines:o,encoding:i,fdNumber:r}))}},jm=async e=>{try{return await e}catch(e){return Mm(e)}},Mm=({bufferedData:e})=>ir(e)?new Uint8Array(e):e,Nm=async(e,t,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{let a=Pm(e,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],me(e,{cleanup:!0,signal:o.signal})])}catch(e){a.stdinCleanedUp||Lm(e,t,n,r)}finally{o.abort()}},Pm=(e,{originalStreams:[t],subprocess:n})=>{let r={stdinCleanedUp:!1};return e===t&&Fm(e,n,r),r},Fm=(e,t,n)=>{let{_destroy:r}=e;e._destroy=(...i)=>{Im(t,n),r.call(e,...i)}},Im=({exitCode:e,signalCode:t},n)=>{(e!==null||t!==null)&&(n.stdinCleanedUp=!0)},Lm=(e,t,n,r)=>{if(!Rm(e,t,n,r))throw e},Rm=(e,t,n,r=!0)=>n.propagating?Vm(e)||Bm(e):(n.propagating=!0,zm(n,t)===r?Vm(e):Bm(e)),zm=({fileDescriptors:e},t)=>t!==`all`&&e[t].direction===`input`,Bm=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,Vm=e=>e?.code===`EPIPE`,Hm=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>e.stdio.map((e,c)=>Um({stream:e,fdNumber:c,encoding:t,buffer:n[c],maxBuffer:r[c],lines:i[c],allMixed:!1,stripFinalNewline:a,verboseInfo:o,streamInfo:s})),Um=async({stream:e,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,verboseInfo:c,streamInfo:l})=>{if(!e)return;let u=Nm(e,t,l);if(zm(l,t)){await u;return}let[d]=await Promise.all([Dm({stream:e,onStreamEnd:u,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,verboseInfo:c,streamInfo:l}),u]);return d},Wm=({stdout:e,stderr:t},{all:n})=>n&&(e||t)?ip([e,t].filter(Boolean)):void 0,Gm=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>Um({...Km(e,n),fdNumber:`all`,encoding:t,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:qm(e),stripFinalNewline:a,verboseInfo:o,streamInfo:s}),Km=({stdout:e,stderr:t,all:n},[,r,i])=>{let a=r||i;return a?r?i?{stream:n,buffer:a}:{stream:e,buffer:a}:{stream:t,buffer:a}:{stream:n,buffer:a}},qm=({all:e,stdout:t,stderr:n})=>e&&t&&n&&t.readableObjectMode!==n.readableObjectMode,Jm=e=>Wr(e,`ipc`),Ym=(e,t)=>{Di({type:`ipc`,verboseMessage:ji(e),fdNumber:`ipc`,verboseInfo:t})},Xm=async({subprocess:e,buffer:t,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:a})=>{if(!r)return i;let o=Jm(a),s=Hr(t,`ipc`),c=Hr(n,`ipc`);for await(let t of zf({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))s&&(Gc(e,i,c),i.push(t)),o&&Ym(t,a);return i},Zm=async(e,t)=>(await Promise.allSettled([e]),t),Qm=async({subprocess:e,options:{encoding:t,buffer:n,maxBuffer:r,lines:i,timeoutDuration:a,cancelSignal:o,gracefulCancel:s,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:_})=>{let v=gf(e,f),y={originalStreams:h,fileDescriptors:m,subprocess:e,exitPromise:v,propagating:!1},b=Hm({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),x=Gm({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),S=[],C=Xm({subprocess:e,buffer:n,maxBuffer:r,ipc:u,ipcOutput:S,verboseInfo:p}),w=$m(h,e,y),T=eh(m,y);try{return await Promise.race([Promise.all([{},yf(v),Promise.all(b),x,C,Es(e,d),...w,...T]),g,th(e,_),...bs(e,a,f,_),...Ka({subprocess:e,cancelSignal:o,gracefulCancel:s,context:f,controller:_}),...gs({subprocess:e,cancelSignal:o,gracefulCancel:s,forceKillAfterDelay:c,context:f,controller:_})])}catch(e){return f.terminationReason??=`other`,Promise.all([{error:e},v,Promise.all(b.map(e=>jm(e))),jm(x),Zm(C,S),Promise.allSettled(w),Promise.allSettled(T)])}},$m=(e,t,n)=>e.map((e,r)=>e===t.stdio[r]?void 0:Nm(e,r,n)),eh=(e,t)=>e.flatMap(({stdioItems:e},n)=>e.filter(({value:e,stream:t=e})=>Js(t,{checkOpen:!1})&&!Tr(t)).map(({type:e,value:r,stream:i=r})=>Nm(i,n,t,{isSameDirection:Jl.has(e),stopOnExit:e===`native`}))),th=async(e,{signal:t})=>{let[n]=await J(e,`error`,{signal:t});throw n},nh=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rh=(e,t,n)=>{let r=e[n];r.has(t)||r.set(t,[]);let i=r.get(t),a=mo();return i.push(a),{resolve:a.resolve.bind(a),promises:i}},ih=async({resolve:e,promises:t},n)=>{e();let[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...t])]);return!r},ah=async e=>{if(e!==void 0)try{await sh(e)}catch{}},oh=async e=>{if(e!==void 0)try{await ch(e)}catch{}},sh=async e=>{await me(e,{cleanup:!0,readable:!1,writable:!0})},ch=async e=>{await me(e,{cleanup:!0,readable:!0,writable:!1})},lh=async(e,t)=>{if(await e,t)throw t},uh=(e,t,n)=>{n&&!Bm(n)?e.destroy(n):t&&e.destroy()},dh=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,binary:i=!0,preserveNewlines:a=!0}={})=>{let o=i||ks.has(n),{subprocessStdout:s,waitReadableDestroy:c}=fh(e,r,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=ph(s,o),{read:f,onStdoutDataDone:p}=mh({subprocessStdout:s,subprocess:e,binary:o,encoding:n,preserveNewlines:a}),m=new le({read:f,destroy:M(_h.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return gh({subprocessStdout:s,onStdoutDataDone:p,readable:m,subprocess:e}),m},fh=(e,t,n)=>{let r=go(e,t);return{subprocessStdout:r,waitReadableDestroy:rh(n,r,`readableDestroy`)}},ph=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n},r)=>r?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Cm},mh=({subprocessStdout:e,subprocess:t,binary:n,encoding:r,preserveNewlines:i})=>{let a=mo(),o=vm({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){hh(this,o,a)},onStdoutDataDone:a}},hh=async(e,t,n)=>{try{let{value:r,done:i}=await t.next();i?n.resolve():e.push(r)}catch{}},gh=async({subprocessStdout:e,onStdoutDataDone:t,readable:n,subprocess:r,subprocessStdin:i})=>{try{await ch(e),await r,await ah(i),await t,n.readable&&n.push(null)}catch(e){await ah(i),vh(n,e)}},_h=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:n},r)=>{await ih(n,t)&&(vh(e,r),await lh(t,r))},vh=(e,t)=>{uh(e,e.readable,t)},yh=({subprocess:e,concurrentStreams:t},{to:n}={})=>{let{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:a}=bh(e,n,t),o=new de({...xh(r,e,i),destroy:M(Th.bind(void 0,{subprocessStdin:r,subprocess:e,waitWritableFinal:i,waitWritableDestroy:a})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return wh(r,o),o},bh=(e,t,n)=>{let r=ho(e,t);return{subprocessStdin:r,waitWritableFinal:rh(n,r,`writableFinal`),waitWritableDestroy:rh(n,r,`writableDestroy`)}},xh=(e,t,n)=>({write:Sh.bind(void 0,e),final:M(Ch.bind(void 0,e,t,n))}),Sh=(e,t,n,r)=>{e.write(t,n)?r():e.once(`drain`,r)},Ch=async(e,t,n)=>{await ih(n,t)&&(e.writable&&e.end(),await t)},wh=async(e,t,n)=>{try{await sh(e),t.writable&&t.end()}catch(e){await oh(n),Eh(t,e)}},Th=async({subprocessStdin:e,subprocess:t,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await ih(n,t),await ih(r,t)&&(Eh(e,i),await lh(t,i))},Eh=(e,t)=>{uh(e,e.writable,t)},Dh=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,to:i,binary:a=!0,preserveNewlines:o=!0}={})=>{let s=a||ks.has(n),{subprocessStdout:c,waitReadableDestroy:l}=fh(e,r,t),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=bh(e,i,t),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=ph(c,s),{read:g,onStdoutDataDone:_}=mh({subprocessStdout:c,subprocess:e,binary:s,encoding:n,preserveNewlines:o}),v=new se({read:g,...xh(u,e,d),destroy:M(Oh.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return gh({subprocessStdout:c,onStdoutDataDone:_,readable:v,subprocess:e,subprocessStdin:u}),wh(u,v,c),v},Oh=async({subprocessStdout:e,subprocessStdin:t,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:a},o)=>{await Promise.all([_h({subprocessStdout:e,subprocess:n,waitReadableDestroy:r},o),Th({subprocessStdin:t,subprocess:n,waitWritableFinal:i,waitWritableDestroy:a},o)])},kh=(e,t,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{let a=r||ks.has(t),o=go(e,n);return Ah(vm({subprocessStdout:o,subprocess:e,binary:a,shouldEncode:!0,encoding:t,preserveNewlines:i}),o,e)},Ah=async function*(e,t,n){try{yield*e}finally{t.readable&&t.destroy(),await n}},jh=(e,{encoding:t})=>{let n=nh();e.readable=dh.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.writable=yh.bind(void 0,{subprocess:e,concurrentStreams:n}),e.duplex=Dh.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.iterable=kh.bind(void 0,e,t),e[Symbol.asyncIterator]=kh.bind(void 0,e,t,{})},Mh=(e,t)=>{for(let[n,r]of Ph){let i=r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:i})}},Nh=(async()=>{})().constructor.prototype,Ph=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(Nh,e)]),Fh=(e,t,n,r)=>{let{file:i,commandArguments:a,command:o,escapedCommand:s,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Ih(e,t,n),{subprocess:f,promise:p}=Rh({file:i,commandArguments:a,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:s,fileDescriptors:d});return f.pipe=hm.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:r}),Mh(f,p),_o.set(f,{options:u,fileDescriptors:d}),f},Ih=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Bi(e,t,n),{file:s,commandArguments:c,options:l}=Ls(e,t,n),u=Lh(l);return{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:ep(u,o)}},Lh=({timeout:e,signal:t,...n})=>{if(t!==void 0)throw TypeError(`The "signal" option has been renamed to "cancelSignal" instead.`);return{...n,timeoutDuration:e}},Rh=({file:e,commandArguments:t,options:n,startTime:r,verboseInfo:i,command:a,escapedCommand:o,fileDescriptors:s})=>{let c;try{c=te(...Bs(e,t,n))}catch(e){return qf({error:e,command:a,escapedCommand:o,fileDescriptors:s,options:n,startTime:r,verboseInfo:i})}let l=new AbortController;ae(1/0,l.signal);let u=[...c.stdio];kp(c,s,l),Yp(c,n,l);let d={},f=mo();c.kill=za.bind(void 0,{kill:c.kill.bind(c),options:n,onInternalError:f,context:d,controller:l}),c.all=Wm(c,n),jh(c,n),Wf(c,n);let p=zh({subprocess:c,options:n,startTime:r,verboseInfo:i,fileDescriptors:s,originalStreams:u,command:a,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},zh=async({subprocess:e,options:t,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:a,command:o,escapedCommand:s,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await Qm({subprocess:e,options:t,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:a,onInternalError:l,controller:u});return u.abort(),l.resolve(),xl(Bh({errorInfo:d,exitCode:f,signal:p,stdio:m.map((e,n)=>dd(e,t,n)),all:dd(h,t,`all`),ipcOutput:g,context:c,options:t,command:o,escapedCommand:s,startTime:n}),r,t)},Bh=({errorInfo:e,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,context:o,options:s,command:c,escapedCommand:l,startTime:u})=>`error`in e?ol({error:e.error,command:c,escapedCommand:l,timedOut:o.terminationReason===`timeout`,isCanceled:o.terminationReason===`cancel`||o.terminationReason===`gracefulCancel`,isGracefullyCanceled:o.terminationReason===`gracefulCancel`,isMaxBuffer:e.error instanceof gc,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,options:s,startTime:u,isSync:!1}):il({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:a,options:s,startTime:u}),Vh=(e,t)=>{let n=Object.fromEntries(Object.entries(t).map(([t,n])=>[t,Hh(t,e[t],n)]));return{...e,...n}},Hh=(e,t,n)=>Uh.has(e)&&Z(t)&&Z(n)?{...t,...n}:n,Uh=new Set([`env`,...Vr]),Wh=(e,t,n,r)=>{let i=(e,t,r)=>Wh(e,t,n,r),a=(...a)=>Gh({mapArguments:e,deepOptions:n,boundOptions:t,setBoundExeca:r,createNested:i},...a);return r!==void 0&&r(a,i,t),a},Gh=({mapArguments:e,deepOptions:t={},boundOptions:n={},setBoundExeca:r,createNested:i},a,...o)=>{if(Z(a))return i(e,Vh(n,a),r);let{file:s,commandArguments:c,options:l,isSync:u}=Kh({mapArguments:e,firstArgument:a,nextArguments:o,deepOptions:t,boundOptions:n});return u?wf(s,c,l):Fh(s,c,l,i)},Kh=({mapArguments:e,firstArgument:t,nextArguments:n,deepOptions:r,boundOptions:i})=>{let[a,o,s]=nr(...gr(t)?_r(t,n):[t,...n]),c=Vh(Vh(r,i),s),{file:l=a,commandArguments:u=o,options:d=c,isSync:f=!1}=e({file:a,commandArguments:o,options:c});return{file:l,commandArguments:u,options:d,isSync:f}},qh=({file:e,commandArguments:t})=>Yh(e,t),Jh=({file:e,commandArguments:t})=>({...Yh(e,t),isSync:!0}),Yh=(e,t)=>{if(t.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[n,...r]=Xh(e);return{file:n,commandArguments:r}},Xh=e=>{if(typeof e!=`string`)throw TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t===``)return[];let n=[];for(let e of t.split(Zh)){let t=n.at(-1);t&&t.endsWith(`\\`)?n[n.length-1]=`${t.slice(0,-1)} ${e}`:n.push(e)}return n},Zh=/ +/g,Qh=(e,t,n)=>{e.sync=t(eg,n),e.s=e.sync},$h=({options:e})=>tg(e),eg=({options:e})=>({...tg(e),isSync:!0}),tg=e=>({options:{...ng(e),...e}}),ng=({input:e,inputFile:t,stdio:n})=>e===void 0&&t===void 0&&n===void 0?{stdin:`inherit`}:{},rg={preferLocal:!0},ig=Wh(()=>({}));Wh(()=>({isSync:!0})),Wh(qh),Wh(Jh),Wh(Ss),Wh($h,{},rg,Qh);const{sendMessage:ag,getOneMessage:og,getEachMessage:sg,getCancelSignal:cg}=Gf();async function lg(){X.info(`Installing development dependencies...`),await ig(`bun`,[`add`,`-d`,`typescript@latest`,`oxfmt`,`oxlint`],{stdio:`inherit`}),X.success(`Development dependencies installed.`)}async function ug(){try{let e=await t.readFile(`package.json`,`utf8`),n=JSON.parse(e);n.scripts??={},Object.assign(n.scripts,{build:`hokit build`,lint:`hokit lint`,doctor:`hokit doctor`,watch:`hokit watch`,docs:`hokit docs`}),await t.writeFile(`package.json`,JSON.stringify(n,null,4)),X.success(`Updated package.json`)}catch{X.info(`Skipped package.json`)}}async function dg(e=`empty`){await Un(),await Zn(),await Xn(e),await ug(),await Jn(),await lg(),X.success(`Hokit project initialized.`)}export{we as _,zn as a,Tn as c,On as d,An as f,Ee as g,De as h,Bn as i,En as l,hn as m,Hn as n,Rn as o,kn as p,Vn as r,Pn as s,dg as t,Dn as u,Te as v};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hokit",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "A type-safe snippet registry and compiler for VSCode and Cursor.",
5
5
  "keywords": [
6
6
  "cursor",
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^25.9.3",
43
+ "execa": "^9.6.1",
43
44
  "oxfmt": "^0.55.0",
44
45
  "oxlint": "^1.70.0",
45
46
  "picocolors": "^1.1.1",
package/readme.md CHANGED
@@ -18,29 +18,139 @@
18
18
  - 🎨 Colorful diagnostics
19
19
  - ⚡ Built for Bun and modern TypeScript
20
20
 
21
- ---
21
+ ## Usage
22
+
23
+ After installing Hokit:
22
24
 
23
- ## Installation
25
+ ```bash
26
+ bun add hokit
27
+ ```
24
28
 
25
- Using Bun:
29
+ Initialize a project:
26
30
 
27
31
  ```bash
28
- bun add -D hokit
32
+ hokit init
29
33
  ```
30
34
 
31
- Using npm:
35
+ Generated structure:
36
+
37
+ ```txt
38
+ .
39
+ ├── src
40
+ │ └── modules
41
+ │ └── example.module.ts
42
+ ├── hokit.config.ts
43
+ ├── tsconfig.json
44
+ ├── .oxfmtrc.json
45
+ ├── .oxlintrc.json
46
+ └── .vscode
47
+ └── settings.json
48
+ ```
49
+
50
+ ## Templates
51
+
52
+ Hokit supports templates to bootstrap snippet projects.
53
+
54
+ ### Empty Template
32
55
 
33
56
  ```bash
34
- npm install -D hokit
57
+ bunx hokit init --empty
58
+ ```
59
+
60
+ Creates:
61
+
62
+ ```txt
63
+ src/modules/example.module.ts
35
64
  ```
36
65
 
37
- Using pnpm:
66
+ ### React Template
38
67
 
39
68
  ```bash
40
- pnpm add -D hokit
69
+ bunx hokit init --react
41
70
  ```
42
71
 
43
- ---
72
+ Creates:
73
+
74
+ ```txt
75
+ src/modules/react.module.ts
76
+ ```
77
+
78
+ ```ts
79
+ import { Build, Module, Snippet } from "hokit"
80
+
81
+ @Build({
82
+ output: "dist/snippets/react.json"
83
+ })
84
+ @Module({
85
+ scopes: ["typescriptreact"],
86
+ tags: ["react", "web"]
87
+ })
88
+ export class ReactModule {
89
+ @Snippet({
90
+ name: "React Functional Component",
91
+ prefix: "rfc",
92
+ description: "Creates a React component.",
93
+ body: [
94
+ "export default function Component() {",
95
+ "\treturn (",
96
+ "\t\t<div>$0</div>",
97
+ "\t)",
98
+ "}"
99
+ ]
100
+ })
101
+ public rfc!: void
102
+ }
103
+ ```
104
+
105
+ ## Development Setup
106
+
107
+ `hokit init` automatically configures the development environment.
108
+
109
+ Generated tools:
110
+
111
+ - TypeScript
112
+ - oxfmt
113
+ - oxlint
114
+ - VS Code OXC integration
115
+
116
+ Generated files:
117
+
118
+ ```txt
119
+ .oxfmtrc.json
120
+ .oxlintrc.json
121
+ .vscode/settings.json
122
+ ```
123
+
124
+ The VS Code configuration enables:
125
+
126
+ - Format on save
127
+ - Automatic fixes
128
+ - Import organization
129
+ - Removing unused imports
130
+
131
+ ## Package Scripts
132
+
133
+ If `package.json` exists, Hokit adds:
134
+
135
+ ```json
136
+ {
137
+ "scripts": {
138
+ "build": "hokit build",
139
+ "lint": "hokit lint",
140
+ "doctor": "hokit doctor",
141
+ "watch": "hokit watch",
142
+ "docs": "hokit docs"
143
+ }
144
+ }
145
+ ```
146
+
147
+ After initialization:
148
+
149
+ ```bash
150
+ hokit build
151
+ ```
152
+
153
+ will discover modules automatically and generate snippet files.
44
154
 
45
155
  ## Project structure
46
156
 
@@ -59,8 +169,6 @@ dist/
59
169
  hokit.config.ts
60
170
  ```
61
171
 
62
- ---
63
-
64
172
  ## Configuration
65
173
 
66
174
  Create a `hokit.config.ts` file:
@@ -70,9 +178,7 @@ import { defineConfig } from "hokit"
70
178
 
71
179
  export default defineConfig({
72
180
  cwd: "src/modules",
73
-
74
181
  pattern: "**/*.module.ts",
75
-
76
182
  exclude: ["**/*.test.ts"]
77
183
  })
78
184
  ```
@@ -86,8 +192,6 @@ export default defineConfig({
86
192
  | `include` | Explicit include patterns | `undefined` |
87
193
  | `exclude` | Ignore patterns | `undefined` |
88
194
 
89
- ---
90
-
91
195
  ## Creating modules
92
196
 
93
197
  A module groups snippets that share metadata.
@@ -132,8 +236,6 @@ export class ReactModule {
132
236
  }
133
237
  ```
134
238
 
135
- ---
136
-
137
239
  ## Decorators
138
240
 
139
241
  ### `@Build`
@@ -181,8 +283,6 @@ Defines an individual snippet.
181
283
  })
182
284
  ```
183
285
 
184
- ---
185
-
186
286
  ## Available scopes
187
287
 
188
288
  ```ts
@@ -212,8 +312,6 @@ type Scope =
212
312
  | "markdown"
213
313
  ```
214
314
 
215
- ---
216
-
217
315
  ## CLI
218
316
 
219
317
  ### Build
@@ -230,8 +328,6 @@ Output:
230
328
  ✔ Generated dist/snippets/react.json
231
329
  ```
232
330
 
233
- ---
234
-
235
331
  ### Doctor
236
332
 
237
333
  Runs diagnostics.
@@ -250,8 +346,6 @@ Example output:
250
346
  ✔ No duplicate outputs.
251
347
  ```
252
348
 
253
- ---
254
-
255
349
  ### Lint
256
350
 
257
351
  Runs validations.
@@ -260,8 +354,6 @@ Runs validations.
260
354
  hokit lint
261
355
  ```
262
356
 
263
- ---
264
-
265
357
  ### Watch
266
358
 
267
359
  Rebuilds automatically on file changes.
@@ -277,8 +369,6 @@ Output:
277
369
  ✔ Generated dist/snippets/react.json
278
370
  ```
279
371
 
280
- ---
281
-
282
372
  ### Docs
283
373
 
284
374
  Generates documentation.
@@ -293,8 +383,6 @@ Generates:
293
383
  SNIPPETS.md
294
384
  ```
295
385
 
296
- ---
297
-
298
386
  ## Validation
299
387
 
300
388
  Hokit validates your project in two ways:
@@ -333,8 +421,6 @@ Found in:
333
421
  • AnotherModule.rfc
334
422
  ```
335
423
 
336
- ---
337
-
338
424
  #### Duplicate prefixes
339
425
 
340
426
  ```txt
@@ -348,8 +434,6 @@ Found in:
348
434
  • AnotherModule.rfc
349
435
  ```
350
436
 
351
- ---
352
-
353
437
  #### Duplicate outputs
354
438
 
355
439
  ```txt
@@ -360,8 +444,6 @@ Found in:
360
444
  • AnotherModule
361
445
  ```
362
446
 
363
- ---
364
-
365
447
  ## Generated output
366
448
 
367
449
  The following snippet:
@@ -392,8 +474,6 @@ Generates:
392
474
  }
393
475
  ```
394
476
 
395
- ---
396
-
397
477
  ## Why Hokit?
398
478
 
399
479
  Traditional snippet JSON quickly becomes difficult to maintain.
@@ -414,8 +494,6 @@ Inspired by:
414
494
  - Drizzle
415
495
  - Vite
416
496
 
417
- ---
418
-
419
497
  ## License
420
498
 
421
499
  MIT
@@ -1,7 +0,0 @@
1
- import e from"node:fs/promises";import t from"node:path";import{pathToFileURL as n}from"node:url";import*as r from"fs";import{readdir as i,readdirSync as a,realpath as o,realpathSync as s,stat as c,statSync as l}from"fs";import{basename as u,dirname as d,isAbsolute as f,normalize as p,posix as m,relative as h,resolve as g,sep as _}from"path";import{fileURLToPath as v}from"url";import{createRequire as y}from"module";import{watch as b}from"node:fs";var x=Object.create,S=Object.defineProperty,C=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,T=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty,D=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),O=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=w(t),a=0,o=i.length,s;a<o;a++)s=i[a],!E.call(e,s)&&s!==n&&S(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=C(t,s))||r.enumerable});return e},k=(e,t,n)=>(n=e==null?{}:x(T(e)),O(t||!e||!e.__esModule?S(n,`default`,{value:e,enumerable:!0}):n,e));const A=new Map,j=new Map,M=new Map;function N(e){let t=A.get(e),n=(j.get(e)??[]).sort((e,t)=>e.options.name.localeCompare(t.options.name)),r={};for(let e of n){let n=e.options;r[n.name]={prefix:n.prefix,body:n.body,scope:t?.scopes?.join(`,`),description:n.description??n.name,isFileTemplate:n.template??!1}}return r}var P=y(import.meta.url);function F(e){let t=p(e);return t.length>1&&t[t.length-1]===_&&(t=t.substring(0,t.length-1)),t}const I=/[\\/]/g;function L(e,t){return e.replace(I,t)}const R=/^[a-z]:[\\/]$/i;function z(e){return e===`/`||R.test(e)}function B(e,t){let{resolvePaths:n,normalizePath:r,pathSeparator:i}=t,a=process.platform===`win32`&&e.includes(`/`)||e.startsWith(`.`);return n&&(e=g(e)),(r||a)&&(e=F(e)),e===`.`?``:L(e[e.length-1]===i?e:e+i,i)}function V(e,t){return t+e}function H(e,t){return function(n,r){return r.startsWith(e)?r.slice(e.length)+n:L(h(e,r),t.pathSeparator)+t.pathSeparator+n}}function U(e){return e}function W(e,t,n){return t+e+n}function G(e,t){let{relativePaths:n,includeBasePath:r}=t;return n&&e?H(e,t):r?V:U}function K(e){return function(t,n){n.push(t.substring(e.length)||`.`)}}function q(e){return function(t,n,r){let i=t.substring(e.length)||`.`;r.every(e=>e(i,!0))&&n.push(i)}}const J=(e,t)=>{t.push(e||`.`)},Y=(e,t,n)=>{let r=e||`.`;n.every(e=>e(r,!0))&&t.push(r)},X=()=>{};function Z(e,t){let{includeDirs:n,filters:r,relativePaths:i}=t;return n?i?r&&r.length?q(e):K(e):r&&r.length?Y:J:X}const Q=(e,t,n,r)=>{r.every(t=>t(e,!1))&&n.files++},ee=(e,t,n,r)=>{r.every(t=>t(e,!1))&&t.push(e)},te=(e,t,n,r)=>{n.files++},ne=(e,t)=>{t.push(e)},re=()=>{};function ie(e){let{excludeFiles:t,filters:n,onlyCounts:r}=e;return t?re:n&&n.length?r?Q:ee:r?te:ne}const ae=e=>e,oe=()=>[``].slice(0,0);function se(e){return e.group?oe:ae}const ce=(e,t,n)=>{e.push({directory:t,files:n,dir:t})},le=()=>{};function ue(e){return e.group?ce:le}const de=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()&&me(e,s,t))return r.dequeue(null,t);n(o,s),r.dequeue(null,t)})})},fe=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()&&me(e,r,t))return;n(a,r)}catch(e){if(!a)throw e}};function pe(e,t){return!e.resolveSymlinks||e.excludeSymlinks?null:t?fe:de}function me(e,t,n){if(n.options.useRealPaths)return he(t,n);let r=d(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=d(r)}return n.symlinks.set(e,t),i>1}function he(e,t){return t.visited.includes(e+t.options.pathSeparator)}const ge=e=>e.counts,_e=e=>e.groups,ve=e=>e.paths,ye=e=>e.paths.slice(0,e.options.maxFiles),be=(e,t,n)=>(we(t,n,e.counts,e.options.suppressErrors),null),xe=(e,t,n)=>(we(t,n,e.paths,e.options.suppressErrors),null),Se=(e,t,n)=>(we(t,n,e.paths.slice(0,e.options.maxFiles),e.options.suppressErrors),null),Ce=(e,t,n)=>(we(t,n,e.groups,e.options.suppressErrors),null);function we(e,t,n,r){t(e&&!r?e:null,n)}function Te(e,t){let{onlyCounts:n,group:r,maxFiles:i}=e;return n?t?ge:be:r?t?_e:Ce:i?t?ye:Se:t?ve:xe}const Ee={withFileTypes:!0},De=(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||`.`,Ee,(t,a=[])=>{i(a,n,r),e.queue.dequeue(e.options.suppressErrors?null:t,e)})},Oe=(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||`.`,Ee)}catch(t){if(!e.options.suppressErrors)throw t}i(o,n,r)};function ke(e){return e?Oe:De}var Ae=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))}},je=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}},Me=class{aborted=!1;abort(){this.aborted=!0}},Ne=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,t,n){this.isSynchronous=!n,this.callbackInvoker=Te(t,this.isSynchronous),this.root=B(e,t),this.state={root:z(this.root)?this.root:this.root.slice(0,-1),paths:[``].slice(0,0),groups:[],counts:new je,options:t,queue:new Ae((e,t)=>this.callbackInvoker(t,e,n)),symlinks:new Map,visited:[``].slice(0,0),controller:new Me,fs:t.fs||r},this.joinPath=G(this.root,t),this.pushDirectory=Z(this.root,t),this.pushFile=ie(t),this.getArray=se(t),this.groupFiles=ue(t),this.resolveSymlink=pe(t,this.isSynchronous),this.walkDirectory=ke(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:f,pathSeparator:p},controller:m}=this.state;if(m.aborted||l&&l.aborted||c&&r.length>c)return;let h=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,h,this.state.counts,i)}else if(l.isDirectory()){let e=W(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=V(l.name,t);this.resolveSymlink(e,this.state,(t,r)=>{if(t.isDirectory()){if(r=B(r,this.state.options),s&&s(l.name,f?r:e+p))return;this.walkDirectory(this.state,r,f?r:e+p,n-1,this.walk)}else{r=f?r:e;let t=u(r),n=B(d(r),this.state.options);r=this.joinPath(t,n),this.pushFile(r,h,this.state.counts,i)}})}}this.groupFiles(this.state.groups,t,h)}};function Pe(e,t){return new Promise((n,r)=>{Fe(e,t,(e,t)=>{if(e)return r(e);n(t)})})}function Fe(e,t,n){new Ne(e,t,n).start()}function Ie(e,t){return new Ne(e,t).start()}var Le=class{constructor(e,t){this.root=e,this.options=t}withPromise(){return Pe(this.root,this.options)}withCallback(e){Fe(this.root,this.options,e)}sync(){return Ie(this.root,this.options)}};let Re=null;try{P.resolve(`picomatch`),Re=P(`picomatch`)}catch{}var ze=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:_,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 Le(e||`.`,this.options)}withGlobFunction(e){return this.globFunction=e,this}crawlWithOptions(e,t){return this.options={...this.options,...t},new Le(e||`.`,this.options)}glob(...e){return this.globFunction?this.globWithOptions(e):this.globWithOptions(e,{dot:!0})}globWithOptions(e,...t){let n=this.globFunction||Re;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}},Be=D(((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={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{__proto__:null,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}}})),Ve=D((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Be();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}})),He=D(((e,t)=>{let n=Ve(),{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:_}=Be(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=!1,z=!1,B=0,V,H,U={value:``,depth:0,isGlob:!1},W=()=>D>=x,G=()=>E.charCodeAt(D+1),K=()=>(V=H,E.charCodeAt(++D));for(;D<x;){H=K();let e;if(H===a){I=U.backslashes=!0,H=K(),H===u&&(F=!0);continue}if(F===!0||H===u){for(B++;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,K();continue}if(H===u){B++;continue}if(F!==!0&&H===s&&(H=K())===s){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(F!==!0&&H===o){if(A=U.isBrace=!0,M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===h&&(B--,B===0)){F=!1,A=U.isBrace=!0,z=!0;break}}if(S===!0)continue;break}if(H===l){if(C.push(D),w.push(U),U={value:``,depth:0,isGlob:!1},z===!0)continue;if(V===s&&D===O+1){O+=2;continue}k=D+1;continue}if(b.noext!==!0&&(H===p||H===i||H===r||H===m||H===c)&&G()===d){if(M=U.isGlob=!0,N=U.isExtglob=!0,z=!0,H===c&&D===O&&(R=!0),S===!0){for(;W()!==!0&&(H=K());){if(H===a){I=U.backslashes=!0,H=K();continue}if(H===g){M=U.isGlob=!0,z=!0;break}}continue}break}if(H===r){if(V===r&&(P=U.isGlobstar=!0),M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===m){if(M=U.isGlob=!0,z=!0,S===!0)continue;break}if(H===f){for(;W()!==!0&&(e=K());){if(e===a){I=U.backslashes=!0,K();continue}if(e===_){j=U.isBracket=!0,M=U.isGlob=!0,z=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&H===c&&D===O){L=U.negated=!0,O++;continue}if(b.noparen!==!0&&H===d){if(M=U.isGlob=!0,S===!0){for(;W()!==!0&&(H=K());){if(H===d){I=U.backslashes=!0,H=K();continue}if(H===g){z=!0;break}}continue}break}if(M===!0){if(z=!0,S===!0)continue;break}}b.noext===!0&&(N=!1,M=!1);let q=E,J=``,Y=``;O>0&&(J=E.slice(0,O),E=E.slice(O),k-=O),q&&M===!0&&k>0?(q=E.slice(0,k),Y=E.slice(k)):M===!0?(q=``,Y=E):q=E,q&&q!==``&&q!==`/`&&q!==E&&v(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),b.unescape===!0&&(Y&&=n.removeBackslashes(Y),q&&I===!0&&(q=n.removeBackslashes(q)));let X={prefix:J,input:e,start:O,base:q,glob:Y,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:P,negated:L,negatedExtglob:R};if(b.tokens===!0&&(X.maxDepth=0,v(H)||w.push(U),X.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=J):w[n].value=a,y(w[n]),X.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),b.tokens&&(w[w.length-1].value=n,y(w[w.length-1]),X.maxDepth+=w[w.length-1].depth)}X.slashes=C,X.parts=T}return X}})),Ue=D(((e,t)=>{let n=Be(),r=Ve(),{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=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(!(!a||r!==a.repeat(r.length)||i!==a.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return`${n.length===1?r.escapeRegex(n[0]):`[${n.map(e=>r.escapeRegex(e)).join(``)}]`}*`},_=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},v=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};for(let e of i){let t=g(e);if(t)return{risky:!0,safeOutput:t};if(_(e)>r)return{risky:!0}}return{risky:!1}},y=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),b=n.extglobChars(_),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:D,NO_DOTS_SLASH:O,QMARK:k,QMARK_NO_DOT:A,STAR:j,START_ANCHOR:M}=_,N=e=>`(${g}(?:(?!${M}${e.dot?T:x}).)*?)`,P=d.dot?``:E,F=d.dot?k:A,I=d.bash===!0?N(d):j;d.capture&&(I=`(${I})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let L={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,L),p=e.length;let R=[],z=[],B=[],V=m,H,U=()=>L.index===p-1,W=L.peek=(t=1)=>e[L.index+t],G=L.advance=()=>e[++L.index]||``,K=()=>e.slice(L.index+1),q=(e=``,t=0)=>{L.consumed+=e,L.index+=t},J=e=>{L.output+=e.output==null?e.value:e.output,q(e.value)},Y=()=>{let e=1;for(;W()===`!`&&(W(2)!==`(`||W(3)===`?`);)G(),L.start++,e++;return e%2==0?!1:(L.negated=!0,L.start++,!0)},X=e=>{L[e]++,B.push(e)},Z=e=>{L[e]--,B.pop()},Q=e=>{if(V.type===`globstar`){let t=L.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||R.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(L.output=L.output.slice(0,-V.output.length),V.type=`star`,V.value=`*`,V.output=I,L.output+=V.output)}if(R.length&&e.type!==`paren`&&(R[R.length-1].inner+=e.value),(e.value||e.output)&&J(e),V&&V.type===`text`&&e.type===`text`){V.output=(V.output||V.value)+e.value,V.value+=e.value;return}e.prev=V,h.push(e),V=e},ee=(e,t)=>{let n={...b[t],conditions:1,inner:``};n.prev=V,n.parens=L.parens,n.output=L.output,n.startIndex=L.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;X(`parens`),Q({type:e,value:t,output:L.output?``:w}),Q({type:`paren`,extglob:!0,value:G(),output:r}),R.push(n)},te=n=>{let i=e.slice(n.startIndex,L.index+1),a=v(e.slice(n.startIndex+2,L.index),d);if((n.type===`plus`||n.type===`star`)&&a.risky){let e=a.safeOutput?(n.output?``:w)+(d.capture?`(${a.safeOutput})`:a.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;L.output=n.output+t.output,L.backtrack=!0,Q({type:`paren`,extglob:!0,value:H,output:``}),Z(`parens`);return}let o=n.close+(d.capture?`)`:``),s;if(n.type===`negate`){let e=I;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=N(d)),(e!==I||U()||/^\)+$/.test(K()))&&(o=n.close=`)$))${e}`),n.inner.includes(`*`)&&(s=K())&&/^\.[^\\/.]+$/.test(s)&&(o=n.close=`)${y(s,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(L.negatedExtglob=!0)}Q({type:`paren`,extglob:!0,value:H,output:o}),Z(`parens`)};if(d.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?k.repeat(a.length):``):o===0?F+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?I:``):I:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(L.output=e,L):(L.output=r.wrapOutput(i,L,t),L)}for(;!U();){if(H=G(),H===`\0`)continue;if(H===`\\`){let e=W();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){H+=`\\`,Q({type:`text`,value:H});continue}let t=/^\\+/.exec(K()),n=0;if(t&&t[0].length>2&&(n=t[0].length,L.index+=n,n%2!=0&&(H+=`\\`)),d.unescape===!0?H=G():H+=G(),L.brackets===0){Q({type:`text`,value:H});continue}}if(L.brackets>0&&(H!==`]`||V.value===`[`||V.value===`[^`)){if(d.posix!==!1&&H===`:`){let e=V.value.slice(1);if(e.includes(`[`)&&(V.posix=!0,e.includes(`:`))){let e=V.value.lastIndexOf(`[`),t=V.value.slice(0,e),n=a[V.value.slice(e+2)];if(n){V.value=t+n,L.backtrack=!0,G(),!m.output&&h.indexOf(V)===1&&(m.output=w);continue}}}(H===`[`&&W()!==`:`||H===`-`&&W()===`]`)&&(H=`\\${H}`),H===`]`&&(V.value===`[`||V.value===`[^`)&&(H=`\\${H}`),d.posix===!0&&H===`!`&&V.value===`[`&&(H=`^`),V.value+=H,J({value:H});continue}if(L.quotes===1&&H!==`"`){H=r.escapeRegex(H),V.value+=H,J({value:H});continue}if(H===`"`){L.quotes=L.quotes===1?0:1,d.keepQuotes===!0&&Q({type:`text`,value:H});continue}if(H===`(`){X(`parens`),Q({type:`paren`,value:H});continue}if(H===`)`){if(L.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=R[R.length-1];if(e&&L.parens===e.parens+1){te(R.pop());continue}Q({type:`paren`,value:H,output:L.parens?`)`:`\\)`}),Z(`parens`);continue}if(H===`[`){if(d.nobracket===!0||!K().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));H=`\\${H}`}else X(`brackets`);Q({type:`bracket`,value:H});continue}if(H===`]`){if(d.nobracket===!0||V&&V.type===`bracket`&&V.value.length===1){Q({type:`text`,value:H,output:`\\${H}`});continue}if(L.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));Q({type:`text`,value:H,output:`\\${H}`});continue}Z(`brackets`);let e=V.value.slice(1);if(V.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(H=`/${H}`),V.value+=H,J({value:H}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(V.value);if(L.output=L.output.slice(0,-V.value.length),d.literalBrackets===!0){L.output+=t,V.value=t;continue}V.value=`(${g}${t}|${V.value})`,L.output+=V.value;continue}if(H===`{`&&d.nobrace!==!0){X(`braces`);let e={type:`brace`,value:H,output:`(`,outputIndex:L.output.length,tokensIndex:L.tokens.length};z.push(e),Q(e);continue}if(H===`}`){let e=z[z.length-1];if(d.nobrace===!0||!e){Q({type:`text`,value:H,output:H});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),L.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=L.output.slice(0,e.outputIndex),r=L.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,H=t=`\\}`,L.output=n;for(let e of r)L.output+=e.output||e.value}Q({type:`brace`,value:H,output:t}),Z(`braces`),z.pop();continue}if(H===`|`){R.length>0&&R[R.length-1].conditions++,Q({type:`text`,value:H});continue}if(H===`,`){let e=H,t=z[z.length-1];t&&B[B.length-1]===`braces`&&(t.comma=!0,e=`|`),Q({type:`comma`,value:H,output:e});continue}if(H===`/`){if(V.type===`dot`&&L.index===L.start+1){L.start=L.index+1,L.consumed=``,L.output=``,h.pop(),V=m;continue}Q({type:`slash`,value:H,output:C});continue}if(H===`.`){if(L.braces>0&&V.type===`dot`){V.value===`.`&&(V.output=x);let e=z[z.length-1];V.type=`dots`,V.output+=H,V.value+=H,e.dots=!0;continue}if(L.braces+L.parens===0&&V.type!==`bos`&&V.type!==`slash`){Q({type:`text`,value:H,output:x});continue}Q({type:`dot`,value:H,output:x});continue}if(H===`?`){if(!(V&&V.value===`(`)&&d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){ee(`qmark`,H);continue}if(V&&V.type===`paren`){let e=W(),t=H;(V.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(K()))&&(t=`\\${H}`),Q({type:`text`,value:H,output:t});continue}if(d.dot!==!0&&(V.type===`slash`||V.type===`bos`)){Q({type:`qmark`,value:H,output:A});continue}Q({type:`qmark`,value:H,output:k});continue}if(H===`!`){if(d.noextglob!==!0&&W()===`(`&&(W(2)!==`?`||!/[!=<:]/.test(W(3)))){ee(`negate`,H);continue}if(d.nonegate!==!0&&L.index===0){Y();continue}}if(H===`+`){if(d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){ee(`plus`,H);continue}if(V&&V.value===`(`||d.regex===!1){Q({type:`plus`,value:H,output:S});continue}if(V&&(V.type===`bracket`||V.type===`paren`||V.type===`brace`)||L.parens>0){Q({type:`plus`,value:H});continue}Q({type:`plus`,value:S});continue}if(H===`@`){if(d.noextglob!==!0&&W()===`(`&&W(2)!==`?`){Q({type:`at`,extglob:!0,value:H,output:``});continue}Q({type:`text`,value:H});continue}if(H!==`*`){(H===`$`||H===`^`)&&(H=`\\${H}`);let e=o.exec(K());e&&(H+=e[0],L.index+=e[0].length),Q({type:`text`,value:H});continue}if(V&&(V.type===`globstar`||V.star===!0)){V.type=`star`,V.star=!0,V.value+=H,V.output=I,L.backtrack=!0,L.globstar=!0,q(H);continue}let t=K();if(d.noextglob!==!0&&/^\([^?]/.test(t)){ee(`star`,H);continue}if(V.type===`star`){if(d.noglobstar===!0){q(H);continue}let n=V.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){Q({type:`star`,value:H,output:``});continue}let o=L.braces>0&&(n.type===`comma`||n.type===`brace`),s=R.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){Q({type:`star`,value:H,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[L.index+4];if(n&&n!==`/`)break;t=t.slice(3),q(`/**`,3)}if(n.type===`bos`&&U()){V.type=`globstar`,V.value+=H,V.output=N(d),L.output=V.output,L.globstar=!0,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&U()){L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=N(d)+(d.strictSlashes?`)`:`|$)`),V.value+=H,L.globstar=!0,L.output+=n.output+V.output,q(H);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;L.output=L.output.slice(0,-(n.output+V.output).length),n.output=`(?:${n.output}`,V.type=`globstar`,V.output=`${N(d)}${C}|${C}${e})`,V.value+=H,L.output+=n.output+V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){V.type=`globstar`,V.value+=H,V.output=`(?:^|${C}|${N(d)}${C})`,L.output=V.output,L.globstar=!0,q(H+G()),Q({type:`slash`,value:`/`,output:``});continue}L.output=L.output.slice(0,-V.output.length),V.type=`globstar`,V.output=N(d),V.value+=H,L.output+=V.output,L.globstar=!0,q(H);continue}let n={type:`star`,value:H,output:I};if(d.bash===!0){n.output=`.*?`,(V.type===`bos`||V.type===`slash`)&&(n.output=P+n.output),Q(n);continue}if(V&&(V.type===`bracket`||V.type===`paren`)&&d.regex===!0){n.output=H,Q(n);continue}(L.index===L.start||V.type===`slash`||V.type===`dot`)&&(V.type===`dot`?(L.output+=D,V.output+=D):d.dot===!0?(L.output+=O,V.output+=O):(L.output+=P,V.output+=P),W()!==`*`&&(L.output+=w,V.output+=w)),Q(n)}for(;L.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L.output=r.escapeLast(L.output,`[`),Z(`brackets`)}for(;L.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));L.output=r.escapeLast(L.output,`(`),Z(`parens`)}for(;L.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));L.output=r.escapeLast(L.output,`{`),Z(`braces`)}if(d.strictSlashes!==!0&&(V.type===`star`||V.type===`bracket`)&&Q({type:`maybe_slash`,value:``,output:`${C}?`}),L.backtrack===!0){L.output=``;for(let e of L.tokens)L.output+=e.output==null?e.value:e.output,e.suffix&&(L.output+=e.suffix)}return L};y.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,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=y})),We=D(((e,t)=>{let n=He(),r=Ue(),i=Ve(),a=Be(),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})),Ge=k(D(((e,t)=>{let n=We(),r=Ve();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 Ke=Array.isArray,qe=/\\/g,Je=/^[A-Za-z]:$/,Ye=process.platform===`win32`,Xe=/^(\/?\.\.)+$/;function Ze(e,t={}){let n=e.length,r=Array(n),i=Array(n),a,o;for(a=0;a<n;a++){let n=it(e[a]);r[a]=n;let s=n.length,c=Array(s);for(o=0;o<s;o++)c[o]=(0,Ge.default)(n[o],t);i[a]=c}return e=>{let s=e.split(`/`);if(s[0]===`..`&&Xe.test(e))return!0;for(a=0;a<n;a++){let e=r[a],n=i[a],c=s.length,l=Math.min(c,e.length);for(o=0;o<l;){let r=e[o];if(r.includes(`/`))return!0;if(!n[o](s[o]))break;if(!t.noglobstar&&r===`**`)return!0;o++}if(o===c)return!0}return!1}}const Qe=/^[A-Z]:\/$/i,$e=Ye?e=>Qe.test(e):e=>e===`/`;function et(e,t,n){if(e===t||t.startsWith(`${e}/`)){if(n){let t=e.length+ +!$e(e);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=>m.relative(e,t)||`.`:n=>m.relative(e,`${t}/${n}`)||`.`}function tt(e,t){if(t.startsWith(`${e}/`)){let n=t.slice(e.length+1);return e=>`${n}/${e}`}return n=>{let r=m.relative(e,`${t}/${n}`);return n[n.length-1]===`/`&&r!==``?`${r}/`:r||`.`}}function nt(e){return e.replace(Je,e=>`${e}/`)}const rt={parts:!0};function it(e){let t=Ge.default.scan(e,rt);return t.parts?.length?t.parts:[e]}const at=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,ot=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,st=Ye?e=>e.replace(ot,`\\$&`):e=>e.replace(at,`\\$&`);function ct(e,t){if(t?.caseSensitiveMatch===!1)return!0;let n=Ge.default.scan(e);return n.isGlob||n.negated}function lt(...e){console.log(`[tinyglobby ${new Date().toLocaleTimeString(`es`)}]`,...e)}function ut(e){return typeof e==`string`?[e]:e??[]}const dt=/^(\/?\.\.)+/,ft=/\\(?=[()[\]{}!*+?@|])/g;function pt(e,t,n,r){let i=t.cwd,a=e;e[e.length-1]===`/`&&(a=e.slice(0,-1)),a[a.length-1]!==`*`&&t.expandDirectories&&(a+=`/**`);let o=st(i);a=f(a.replace(ft,``))?m.relative(o,a):m.normalize(a);let s=dt.exec(a)?.[0],c=it(a);if(s){let e=(s.length+1)/3,t=0,r=o.split(`/`);for(;t<e&&c[t+e]===r[r.length+t-e];)a=a.slice(0,(e-t-1)*3)+a.slice((e-t)*3+c[t+e].length+1)||`.`,t++;let l=m.join(i,s.slice(t*3));l[0]!==`.`&&n.root.length>l.length&&(n.root=nt(l),n.depthOffset=-e+t)}if(!r&&n.depthOffset>=0){n.commonPath??=c;let e=[],t=Math.min(n.commonPath.length,c.length);for(let r=0;r<t;r++){let t=c[r];if(t===`**`&&!c[r+1]){e.pop();break}if(r===c.length-1||t!==n.commonPath[r]||ct(t))break;e.push(t)}n.depthOffset=e.length,n.commonPath=e,n.root=nt(e.length>0?m.join(i,...e):i)}return a}function mt(e,t,n){let r=[],i=[];for(let t of e.ignore)t&&(t[0]!==`!`||t[1]===`(`)&&i.push(pt(t,e,n,!0));for(let a of t)a&&(a[0]!==`!`||a[1]===`(`?r.push(pt(a,e,n,!1)):(a[1]!==`!`||a[2]===`(`)&&i.push(pt(a.slice(1),e,n,!0)));return{match:r,ignore:i}}function ht(e,t){let n=e.cwd,r={root:n,depthOffset:0},i=mt(e,t,r);e.debug&&lt(`internal processing patterns:`,i);let{absolute:a,caseSensitiveMatch:o,debug:s,dot:c,followSymbolicLinks:l,onlyDirectories:u}=e,d=r.root.replace(qe,``),f={dot:c,nobrace:e.braceExpansion===!1,nocase:!o,noextglob:e.extglob===!1,noglobstar:e.globstar===!1,posix:!0},p=(0,Ge.default)(i.match,f),m=(0,Ge.default)(i.ignore,f),h=Ze(i.match,f),g=et(n,d,a),_=a?g:et(n,d,!0),v=(e,t)=>{let n=_(t,!0);return n!==`.`&&!h(n)||m(n)},y;e.deep!==void 0&&(y=Math.round(e.deep-r.depthOffset));let b=new ze({filters:[s?(e,t)=>{let n=g(e,t),r=p(n)&&!m(n);return r&&lt(`matched ${n}`),r}:(e,t)=>{let n=g(e,t);return p(n)&&!m(n)}],exclude:s?(e,t)=>{let n=v(e,t);return lt(`${n?`skipped`:`crawling`} ${t}`),n}:v,fs:e.fs,pathSeparator:`/`,relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!e.onlyFiles,maxDepth:y,signal:e.signal}).crawl(d);return e.debug&&lt(`internal properties:`,{...r,root:d}),[b,n!==d&&!a&&tt(n,d)]}function gt(e,t){if(t)for(let n=e.length-1;n>=0;n--)e[n]=t(e[n]);return e}const _t={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function vt(e){let t=Object.assign({},e);for(let e in _t)t[e]===void 0&&Object.assign(t,{[e]:_t[e]});return t.cwd=(t.cwd instanceof URL?v(t.cwd):g(t.cwd||process.cwd())).replace(qe,`/`),t.ignore=ut(t.ignore),t.fs&&={readdir:t.fs.readdir||i,readdirSync:t.fs.readdirSync||a,realpath:t.fs.realpath||o,realpathSync:t.fs.realpathSync||s,stat:t.fs.stat||c,statSync:t.fs.statSync||l},t.debug&&lt(`globbing with options:`,t),t}function yt(e,t={}){if(e&&t?.patterns)throw Error(`Cannot pass patterns as both an argument and an option`);let n=Ke(e)||typeof e==`string`,r=ut((n?e:e.patterns)??`**/*`),i=vt(n?t:e);return r.length>0?ht(i,r):[]}async function bt(e,t){let[n,r]=yt(e,t);return n?gt(await n.withPromise(),r):[]}async function xt(e={}){let t=await bt(e.include??[e.pattern??`**/*.module.ts`],{cwd:e.cwd??`src`,absolute:!0,ignore:e.exclude});await Promise.all(t.map(e=>import(n(e).href)))}const St={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Ct(e){return e?{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}:St}function wt(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 Tt(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??wt(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??(e.reference,c.lang,void 0)??(l?(c.lang,void 0):null)??r.message??(c.lang,void 0);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}const Et=new WeakMap;function Dt(e){let t=Et.get(e);return t||(t={version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},Ct())}},Et.set(e,t)),t}var Ot=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function kt(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function At(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function jt(e,t){return{kind:`schema`,type:`array`,reference:jt,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return Dt(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 Tt(this,`type`,e,t);return e}}}function Mt(e){return{kind:`schema`,type:`boolean`,reference:Mt,expects:`boolean`,async:!1,message:e,get"~standard"(){return Dt(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:Tt(this,`type`,e,t),e}}}function Nt(e,t){return{kind:`schema`,type:`object`,reference:Nt,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return Dt(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in 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]:At(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]=kt(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(Tt(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 Tt(this,`type`,e,t);return e}}}function Pt(e,t){return{kind:`schema`,type:`optional`,reference:Pt,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return Dt(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=At(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Ft(e){return{kind:`schema`,type:`string`,reference:Ft,expects:`string`,async:!1,message:e,get"~standard"(){return Dt(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:Tt(this,`type`,e,t),e}}}function It(e,t,n){let r=e[`~run`]({value:t},Ct(n));if(r.issues)throw new Ot(r.issues);return r.value}const Lt=Nt({cwd:Pt(Ft()),pattern:Pt(Ft()),include:Pt(jt(Ft())),exclude:Pt(jt(Ft()))});async function Rt(){try{return It(Lt,(await import(n(t.join(process.cwd(),`hokit.config.ts`)).href)).default??{})}catch{return{}}}var zt=k(D(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}))(),1);const $={success(e){console.log(`${zt.default.green(`✔`)} ${e}`)},info(e){console.log(`${zt.default.cyan(`ℹ`)} ${e}`)}};var Bt=class extends Error{constructor(e,t={}){let n=[];n.push(`${zt.default.red(`✖`)} ${zt.default.bold(e)}`);for(let[e,r]of Object.entries(t))if(n.push(``),n.push(zt.default.cyan(`${e}:`)),Array.isArray(r))for(let e of r)n.push(` • ${e}`);else n.push(` ${r}`);super(n.join(`
2
- `)),this.name=`HokitError`}};function Vt(){let e=new Map;for(let[t,n]of j)for(let r of n){let n=r.options.name,i=`${t.name}.${String(r.propertyKey)}`,a=e.get(n)??[];a.push(i),e.set(n,a)}for(let[t,n]of e)if(n.length>1)throw new Bt(`Duplicate snippet name "${t}"`,{"Found in":n})}function Ht(){let e=new Map;for(let[t,n]of M){let r=e.get(n.output)??[];r.push(t.name),e.set(n.output,r)}for(let[t,n]of e)if(n.length>1)throw new Bt(`Duplicate output "${t}"`,{"Found in":n})}function Ut(){let e=new Map;for(let[t,n]of j){let r=A.get(t)?.scopes?.sort().join(`,`)??``;for(let i of n){let n=`${r}:${i.options.prefix}`,a=`${t.name}.${String(i.propertyKey)}`,o=e.get(n)??[];o.push(a),e.set(n,o)}}for(let[t,n]of e)if(n.length>1){let[e,r]=t.split(`:`);throw new Bt(`Duplicate prefix "${r}"`,{Scope:e,"Found in":n})}}async function Wt(n={}){n={...await Rt(),...n},await xt(n),Vt(),Ut(),Ht(),await Promise.all([...M].map(async([n,r])=>{let i=N(n);await e.mkdir(t.dirname(r.output),{recursive:!0}),await e.writeFile(r.output,JSON.stringify(i,null,4)),$.success(`Generated ${r.output}`)}))}async function Gt(){await xt(await Rt());let t=`# Snippets
3
-
4
- `;for(let[e]of M){let n=N(e);t+=`# ${e.name}\n\n`,t+="```json\n",t+=JSON.stringify(n,null,2),t+=`
5
- \`\`\`
6
-
7
- `}await e.writeFile(`SNIPPETS.md`,t),$.success(`Generated SNIPPETS.md`)}async function Kt(){if(await xt(await Rt()),M.size===0){$.info(`No modules found.`);return}$.success(`Discovered ${M.size} module(s).`);let e=[...j.values()].reduce((e,t)=>e+t.length,0);$.success(`Loaded ${e} snippet(s).`),Vt(),$.success(`No duplicate names.`),Ut(),$.success(`No duplicate prefixes.`),Ht(),$.success(`No duplicate outputs.`)}async function qt(){await Kt()}async function Jt(){await Wt(),b(process.cwd(),{recursive:!0},async(e,t)=>{$.info(`Change detected: ${t}`);try{await Wt()}catch(e){console.error(e)}})}export{j as _,Wt as a,Mt as c,It as d,Ft as f,A as g,M as h,Gt as i,Nt as l,N as m,qt as n,Bt as o,xt as p,Kt as r,jt as s,Jt as t,Pt as u};