jiek 0.4.7-alpha.13 → 0.4.7-alpha.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.cjs +12 -8
- package/dist/cli.d.cts +15 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.js +12 -8
- package/dist/cli.min.cjs +2 -2
- package/dist/cli.min.js +2 -2
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/rollup/index.cjs +10 -5
- package/dist/rollup/index.js +10 -5
- package/dist/rollup/index.min.cjs +1 -1
- package/dist/rollup/index.min.js +1 -1
- package/package.json +1 -11
- package/src/commands/publish.ts +16 -2
- package/src/utils/getExports.ts +11 -7
package/dist/cli.cjs
CHANGED
@@ -141,7 +141,7 @@ async function getSelectedProjectsGraph() {
|
|
141
141
|
|
142
142
|
var name = "jiek";
|
143
143
|
var type = "module";
|
144
|
-
var version = "0.4.7-alpha.
|
144
|
+
var version = "0.4.7-alpha.13";
|
145
145
|
var description = "YiJie's personal kits.";
|
146
146
|
var bin = {
|
147
147
|
jiek: "bin/jiek.js",
|
@@ -4852,12 +4852,17 @@ function getExports({
|
|
4852
4852
|
config,
|
4853
4853
|
dir,
|
4854
4854
|
noFilter,
|
4855
|
-
|
4856
|
-
withSuffix
|
4855
|
+
isPublish
|
4857
4856
|
}) {
|
4858
4857
|
const dirResolve = (...paths) => path.resolve(dir ?? process.cwd(), ...paths);
|
4859
4858
|
const dirRelative = (path$1) => path.relative(dir ?? process.cwd(), path$1);
|
4860
|
-
const {
|
4859
|
+
const {
|
4860
|
+
build = {},
|
4861
|
+
publish: {
|
4862
|
+
withSuffix = false,
|
4863
|
+
withSource = true
|
4864
|
+
} = {}
|
4865
|
+
} = config ?? {};
|
4861
4866
|
const {
|
4862
4867
|
crossModuleConvertor = true
|
4863
4868
|
} = build;
|
@@ -4896,8 +4901,8 @@ function getExports({
|
|
4896
4901
|
filteredResolvedEntrypoints,
|
4897
4902
|
entrypoints.entrypoints2Exports(filteredResolvedEntrypoints, {
|
4898
4903
|
outdir: jsOutdir,
|
4899
|
-
|
4900
|
-
|
4904
|
+
withSuffix: isPublish ? withSuffix : void 0,
|
4905
|
+
withSource: isPublish ? withSource : void 0,
|
4901
4906
|
withConditional: {
|
4902
4907
|
...crossModuleWithConditional
|
4903
4908
|
}
|
@@ -4922,8 +4927,7 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
|
|
4922
4927
|
config: loadConfig(dir),
|
4923
4928
|
dir,
|
4924
4929
|
noFilter: true,
|
4925
|
-
|
4926
|
-
withSuffix: true
|
4930
|
+
isPublish: true
|
4927
4931
|
});
|
4928
4932
|
newManifest.exports = {
|
4929
4933
|
...resolvedEntrypoints,
|
package/dist/cli.d.cts
CHANGED
@@ -95,3 +95,18 @@ declare module 'jiek' {
|
|
95
95
|
};
|
96
96
|
}
|
97
97
|
}
|
98
|
+
|
99
|
+
declare module 'jiek' {
|
100
|
+
interface Config {
|
101
|
+
publish?: {
|
102
|
+
/**
|
103
|
+
* @default false
|
104
|
+
*/
|
105
|
+
withSuffix?: boolean;
|
106
|
+
/**
|
107
|
+
* @default true
|
108
|
+
*/
|
109
|
+
withSource?: boolean;
|
110
|
+
};
|
111
|
+
}
|
112
|
+
}
|
package/dist/cli.d.ts
CHANGED
@@ -95,3 +95,18 @@ declare module 'jiek' {
|
|
95
95
|
};
|
96
96
|
}
|
97
97
|
}
|
98
|
+
|
99
|
+
declare module 'jiek' {
|
100
|
+
interface Config {
|
101
|
+
publish?: {
|
102
|
+
/**
|
103
|
+
* @default false
|
104
|
+
*/
|
105
|
+
withSuffix?: boolean;
|
106
|
+
/**
|
107
|
+
* @default true
|
108
|
+
*/
|
109
|
+
withSource?: boolean;
|
110
|
+
};
|
111
|
+
}
|
112
|
+
}
|
package/dist/cli.js
CHANGED
@@ -110,7 +110,7 @@ async function getSelectedProjectsGraph() {
|
|
110
110
|
|
111
111
|
var name = "jiek";
|
112
112
|
var type = "module";
|
113
|
-
var version = "0.4.7-alpha.
|
113
|
+
var version = "0.4.7-alpha.13";
|
114
114
|
var description = "YiJie's personal kits.";
|
115
115
|
var bin = {
|
116
116
|
jiek: "bin/jiek.js",
|
@@ -4821,12 +4821,17 @@ function getExports({
|
|
4821
4821
|
config,
|
4822
4822
|
dir,
|
4823
4823
|
noFilter,
|
4824
|
-
|
4825
|
-
withSuffix
|
4824
|
+
isPublish
|
4826
4825
|
}) {
|
4827
4826
|
const dirResolve = (...paths) => resolve$1(dir ?? process.cwd(), ...paths);
|
4828
4827
|
const dirRelative = (path) => relative(dir ?? process.cwd(), path);
|
4829
|
-
const {
|
4828
|
+
const {
|
4829
|
+
build = {},
|
4830
|
+
publish: {
|
4831
|
+
withSuffix = false,
|
4832
|
+
withSource = true
|
4833
|
+
} = {}
|
4834
|
+
} = config ?? {};
|
4830
4835
|
const {
|
4831
4836
|
crossModuleConvertor = true
|
4832
4837
|
} = build;
|
@@ -4865,8 +4870,8 @@ function getExports({
|
|
4865
4870
|
filteredResolvedEntrypoints,
|
4866
4871
|
entrypoints2Exports(filteredResolvedEntrypoints, {
|
4867
4872
|
outdir: jsOutdir,
|
4868
|
-
|
4869
|
-
|
4873
|
+
withSuffix: isPublish ? withSuffix : void 0,
|
4874
|
+
withSource: isPublish ? withSource : void 0,
|
4870
4875
|
withConditional: {
|
4871
4876
|
...crossModuleWithConditional
|
4872
4877
|
}
|
@@ -4891,8 +4896,7 @@ program.command("publish").aliases(["pub", "p"]).option("-b, --bumper <bumper>",
|
|
4891
4896
|
config: loadConfig(dir),
|
4892
4897
|
dir,
|
4893
4898
|
noFilter: true,
|
4894
|
-
|
4895
|
-
withSuffix: true
|
4899
|
+
isPublish: true
|
4896
4900
|
});
|
4897
4901
|
newManifest.exports = {
|
4898
4902
|
...resolvedEntrypoints,
|
package/dist/cli.min.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";var e=require("node:fs"),t=require("node:module"),n=require("node:path"),r=require("@pnpm/filter-workspace-packages"),o=require("commander"),a=require("js-yaml"),s=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),l=require("detect-indent"),p=require("inquirer"),c=require("jsonc-parser"),f=require("util"),d=require("path"),g=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(e){return e&&e.__esModule?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var E=R(e),_=R(n),b=R(l),S=R(p),C=R(f),v=R(d),$=m(g);let x,w;function H(){if(x)return x;const e=o.program.getOptionValue("root");return x=e?_.default.isAbsolute(e)?e:_.default.resolve(process.cwd(),e):void 0,x}let k=!1;function O(){if(w)return{wd:w,notWorkspace:k};const e=H();if(void 0!==e){const t=s.isWorkspaceDir(e,T);return k=!t,w=e,{wd:w,notWorkspace:k}}try{w=s.getWorkspaceDir(T)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;w=e,k=!0}return{wd:w,notWorkspace:k}}let T="";try{t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),T="pnpm"}catch{}async function L(){let e=o.program.getOptionValue("filter");const t=H(),{wd:n,notWorkspace:s}=O();if(!s&&"pnpm"===T){const o=_.default.resolve(n,"pnpm-workspace.yaml"),s=E.default.readFileSync(o,"utf-8"),i=a.load(s);if(t===n&&!e)throw new Error("root path is workspace root, please provide a filter");if(t!==n&&!e){if(!E.default.existsSync(_.default.resolve(t,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const n=JSON.parse(E.default.readFileSync(_.default.resolve(t,"package.json"),"utf-8"));if(!n.name)throw new Error("root path is not workspace root, please provide a filter");e=n.name}const{selectedProjectsGraph:u}=await r.filterPackagesFromDir(n,[{filter:e??"",followProdDepsOnly:!0}],{prefix:t,workspaceDir:n,patterns:i.packages});return{wd:n,root:t,value:Object.entries(u).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:n,root:t,value:{[n]:JSON.parse(E.default.readFileSync(_.default.resolve(n,"package.json"),"utf-8"))}}}""!==T&&o.program.option("-f, --filter <filter>","filter packages");var N="0.4.7-alpha.
|
1
|
+
"use strict";var e=require("node:fs"),t=require("node:module"),n=require("node:path"),r=require("@pnpm/filter-workspace-packages"),o=require("commander"),a=require("js-yaml"),s=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),l=require("detect-indent"),p=require("inquirer"),c=require("jsonc-parser"),f=require("util"),d=require("path"),g=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(e){return e&&e.__esModule?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var E=R(e),_=R(n),b=R(l),S=R(p),C=R(f),v=R(d),$=m(g);let x,w;function H(){if(x)return x;const e=o.program.getOptionValue("root");return x=e?_.default.isAbsolute(e)?e:_.default.resolve(process.cwd(),e):void 0,x}let k=!1;function O(){if(w)return{wd:w,notWorkspace:k};const e=H();if(void 0!==e){const t=s.isWorkspaceDir(e,T);return k=!t,w=e,{wd:w,notWorkspace:k}}try{w=s.getWorkspaceDir(T)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;w=e,k=!0}return{wd:w,notWorkspace:k}}let T="";try{t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),T="pnpm"}catch{}async function L(){let e=o.program.getOptionValue("filter");const t=H(),{wd:n,notWorkspace:s}=O();if(!s&&"pnpm"===T){const o=_.default.resolve(n,"pnpm-workspace.yaml"),s=E.default.readFileSync(o,"utf-8"),i=a.load(s);if(t===n&&!e)throw new Error("root path is workspace root, please provide a filter");if(t!==n&&!e){if(!E.default.existsSync(_.default.resolve(t,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const n=JSON.parse(E.default.readFileSync(_.default.resolve(t,"package.json"),"utf-8"));if(!n.name)throw new Error("root path is not workspace root, please provide a filter");e=n.name}const{selectedProjectsGraph:u}=await r.filterPackagesFromDir(n,[{filter:e??"",followProdDepsOnly:!0}],{prefix:t,workspaceDir:n,patterns:i.packages});return{wd:n,root:t,value:Object.entries(u).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:n,root:t,value:{[n]:JSON.parse(E.default.readFileSync(_.default.resolve(n,"package.json"),"utf-8"))}}}""!==T&&o.program.option("-f, --filter <filter>","filter packages");var N="0.4.7-alpha.13",I="YiJie's personal kits.";let M;function j(){M()}function P(){new Promise((e=>M=e))}o.program.version(N).description(I).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const B=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);function D(e){try{return B.resolve(e),!0}catch(e){return!1}}let U;const G=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of G)if(D(e)){U=e;break}let F="jiek.config";function K(e){const{wd:t}=O();let n=o.program.getOptionValue("configPath");if(n){if(!E.default.existsSync(n))throw new Error(`config file not found: ${n}`);_.default.isAbsolute(n)||(n=_.default.resolve(t,n))}else n=function(e,t){const n=!!U;function r(n){const r=[_.default.resolve(process.cwd(),`${F}.${n}`),_.default.resolve(process.cwd(),`.${F}.${n}`),_.default.resolve(e,`${F}.${n}`),_.default.resolve(e,`.${F}.${n}`)];t&&r.unshift(_.default.resolve(t,`${F}.${n}`),_.default.resolve(t,`.${F}.${n}`));for(const e of r)if(E.default.existsSync(e)&&E.default.lstatSync(e).isFile())return e}return F=r("js")??F,F=r("json")??F,F=r("yaml")??F,n&&(F=r("ts")??F),_.default.resolve(e,F)}(t,e);const r=_.default.extname(n);let s;switch(r){case".js":s=require(n);break;case".json":return require(n);case".yaml":return a.load(E.default.readFileSync(n,"utf-8"));case".ts":if(U){require(U),s=require(n);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":s={};break;default:throw new Error(`unsupported config file type: ${r}`)}if(!s)throw new Error("config file is empty");return s.default??s}const q=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);o.program.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").action((async({silent:e,entries:t})=>{P();const{build:n}=K();e=e??n?.silent??!1;const{wd:r,value:o={}}=await L()??{};if(0===Object.keys(o).length)throw new Error("no package found");const a=_.default.resolve(r,"node_modules");E.default.existsSync(a)||E.default.mkdirSync(a);const s=(...e)=>_.default.resolve(a,".jiek",...e);E.default.existsSync(s())||E.default.mkdirSync(s());const l=q.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),p=new i.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},i.Presets.shades_classic);let c=0;await Promise.all(Object.entries(o).map((async([n,o])=>{const a=o.name?.replace(/^@/g,"").replace(/\//g,"+"),i=s(`${a??"anonymous-"+c++}.rollup.config.js`);E.default.writeFileSync(i,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(o));let f="";U&&(f=`node -r ${U} `);const d=`${f}${l} --silent -c ${i}`,g=u.execaCommand(d,{ipc:!0,cwd:n,env:{...process.env,JIEK_ROOT:r,JIEK_ENTRIES:t}}),h={};let y=10;g.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!e&&g.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${o.name}' has ${n} targets to build`),r.forEach((({input:e})=>{y=Math.max(y,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;h[n]||(h[n]=p.create(50,0,{input:e.padEnd(y),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:a}=e.data,s=h[`${r}:${t}`];if(!s)return;s.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(y),status:o?.padEnd(10),message:`${n?.join(", ")}: ${a}`})}})),await new Promise(((e,t)=>{let n="";g.stderr?.on("data",(e=>{n+=e})),g.once("exit",(r=>0===r?e():t(new Error(`rollup build failed:\n${n}`))))}))}))).finally((()=>{p.stop()})),j()}));var Q,W,X,Z,J,z,Y,V,ee,te,ne,re,oe,ae,se,ie,ue,le,pe,ce={};function fe(){return Q||(Q=1,(e=ce).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),ce;var e}function de(){if(X)return W;X=1;const e=fe();return W=(t,n={})=>{let r=(t,o={})=>{let a=n.escapeInvalid&&e.isInvalidBrace(o),s=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(a||s)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
|
2
2
|
/*!
|
3
3
|
* is-number <https://github.com/jonschlinkert/is-number>
|
4
4
|
*
|
@@ -16,4 +16,4 @@
|
|
16
16
|
*
|
17
17
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
18
18
|
* Licensed under the MIT License.
|
19
|
-
*/function ye(){if(ee)return V;ee=1;const e=C.default,t=he(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),a=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},s=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let a=String.fromCharCode(e);return e===n?a:`[${a}-${String.fromCharCode(n)}]`},l=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw p([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw p([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(n);n=Math.max(Math.abs(n),1);let y=a(d)||a(g)||a(h),A=y?Math.max(d.length,g.length,h.length):0,R=!1===y&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),m=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,A),i(t,A),!0,r);let E={negatives:[],positives:[]},_=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?E[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):_.push(s(m(o,b),A,R)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",a="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(a=`-(${r}${e.negatives.join("|")})`),n=o&&a?`${o}|${a}`:o||a,t.wrap?`(${r}${n})`:n})(E,r):l(_,null,{wrap:!1,...r}):_},d=(e,t,a,s={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,s);if("function"==typeof a)return d(e,t,1,{transform:a});if(n(a))return d(e,t,0,a);let i={...s};return!0===i.capture&&(i.wrap=!0),a=a||i.step||1,o(a)?o(e)&&o(t)?f(e,t,a,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let a=r.transform||(e=>String.fromCharCode(e)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),p=s>i,f=Math.min(s,i),d=Math.max(s,i);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;p?s>=i:s<=i;)g.push(a(s,h)),s=p?s-n:s+n,h++;return!0===r.toRegex?l(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(a),1),i):null==a||n(a)?d(e,t,1,a):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(a,i)};return V=d}function Ae(){if(ue)return ie;ue=1;const e=de(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=se?ae:(se=1,ae={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return ie=(y,A={})=>{if("string"!=typeof y)throw new TypeError("Expected a string");let R=A||{},m="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(y.length>m)throw new SyntaxError(`Input length (${y.length}), exceeds max characters (${m})`);let E,_={type:"root",input:y,nodes:[]},b=[_],S=_,C=_,v=0,$=y.length,x=0,w=0;const H=()=>y[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],E=H(),E!==h&&E!==g)if(E!==n)if(E!==c)if(E!==p)if(E!==s)if(E!==i)if(E!==f&&E!==d&&E!==r)if(E!==u)if(E!==l)if(E===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:E}),S.commas++}else if(E===a&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:E});continue}if("dot"===C.type){if(S.range=[],C.value+=E,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+E,C=t,S.ranges--;continue}k({type:"dot",value:E})}else k({type:"text",value:E});else{if("brace"!==S.type){k({type:"text",value:E});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:E}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:E})}else{let e,t=E;for(!0!==A.keepQuotes&&(E="");x<$&&(e=H());)if(e!==n){if(e===t){!0===A.keepQuotes&&(E+=e);break}E+=e}else E+=e+H();k({type:"text",value:E})}else{if("paren"!==S.type){k({type:"text",value:E});continue}S=b.pop(),k({type:"text",value:E}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:E});else{let e;for(v++;x<$&&(e=H());)if(E+=e,e!==p)if(e!==n){if(e===c&&(v--,0===v))break}else E+=H();else v++;k({type:"text",value:E})}else k({type:"text",value:"\\"+E});else k({type:"text",value:(A.keepEscaping?E:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),_},ie}function Re(){if(pe)return le;pe=1;const e=de(),t=function(){if(ne)return te;ne=1;const e=ye(),t=fe();return te=(n,r={})=>{let o=(n,a={})=>{let s=t.isInvalidBrace(a),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===s||!0===i,l=!0===r.escapeInvalid?"\\":"",p="";if(!0===n.isOpen)return l+n.value;if(!0===n.isClose)return l+n.value;if("open"===n.type)return u?l+n.value:"(";if("close"===n.type)return u?l+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),a=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==a.length)return o.length>1&&a.length>1?`(${a})`:a}if(n.nodes)for(let e of n.nodes)p+=o(e,n);return p};return o(n)}}(),n=function(){if(oe)return re;oe=1;const e=ye(),t=de(),n=fe(),r=(e="",t="",o=!1)=>{let a=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)a.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),a.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(a)};return re=(o,a={})=>{let s=void 0===a.rangeLimit?1e3:a.rangeLimit,i=(o,u={})=>{o.queue=[];let l=u,p=u.queue;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)l=l.parent,p=l.queue;if(o.invalid||o.dollar)return void p.push(r(p.pop(),t(o,a)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(r(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,a.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,a);return 0===u.length&&(u=t(o,a)),p.push(r(p.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):p.push(r(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=Ae(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),le=o}var me,Ee,_e,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te={};function Le(){if(Ee)return me;Ee=1;const e=v.default,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",a="[^/]",s=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${s}`,l={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:a,END_ANCHOR:s,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${s})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${a}*?`,START_ANCHOR:i},p={...l,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return me={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},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,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?p:l}}function Ne(){return _e||(_e=1,function(e){const t=v.default,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:s}=Le();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>a.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(s,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},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!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Te)),Te}function Ie(){if(xe)return $e;xe=1;const e=v.default,t=function(){if(Se)return be;Se=1;const e=Ne(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=Le(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return be=(R,m)=>{const E=m||{},_=R.length-1,b=!0===E.parts||!0===E.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,D=!1,U=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>H>=_,q=()=>($=x,w.charCodeAt(++H));for(;H<_;){let e;if(x=q(),x!==r){if(!0===j||x===u){for(G++;!0!==K()&&(x=q());)if(x!==r)if(x!==u){if(!0!==j&&x===a&&(x=q())===a){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(!0!==j&&x===o){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===d&&(G--,0===G)){j=!1,T=F.isBrace=!0,U=!0;break}}else G++;else B=F.backslashes=!0,q();if(!0===b)continue;break}if(x!==i){if(!0!==E.noext&&!0==(x===c||x===n||x===t||x===f||x===s)&&w.charCodeAt(H+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,U=!0,x===s&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===g){N=F.isGlob=!0,U=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(M=F.isGlobstar=!0),N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===f){if(N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===p){for(;!0!==K()&&(e=q());)if(e!==r){if(e===h){L=F.isBracket=!0,N=F.isGlob=!0,U=!0;break}}else B=F.backslashes=!0,q();if(!0===b)continue;break}if(!0===E.nonegate||x!==s||H!==k){if(!0!==E.noparen&&x===l){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==l){if(x===g){U=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(!0===N){if(U=!0,!0===b)continue;break}}else P=F.negated=!0,k++}else{if(S.push(H),C.push(F),F={value:"",depth:0,isGlob:!1},!0===U)continue;if($===a&&H===k+1){k+=2;continue}O=H+1}}else B=F.backslashes=!0,x=q(),x===u&&(j=!0)}!0===E.noext&&(I=!1,N=!1);let Q=w,W="",X="";k>0&&(W=w.slice(0,k),w=w.slice(k),O-=k),Q&&!0===N&&O>0?(Q=w.slice(0,O),X=w.slice(O)):!0===N?(Q="",X=w):Q=w,Q&&""!==Q&&"/"!==Q&&Q!==w&&y(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===E.unescape&&(X&&(X=e.removeBackslashes(X)),Q&&!0===B&&(Q=e.removeBackslashes(Q)));const Z={prefix:W,input:R,start:k,base:Q,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:D};if(!0===E.tokens&&(Z.maxDepth=0,y(x)||C.push(F),Z.tokens=C),!0===E.parts||!0===E.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);E.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=W):C[t].value=o,A(C[t]),Z.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),E.tokens&&(C[C.length-1].value=t,A(C[C.length-1]),Z.maxDepth+=C[C.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(ve)return Ce;ve=1;const e=Le(),t=Ne(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:s}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=s[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let g=p.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},y=[h],A=f.capture?"":"?:",R=t.isWindows(c),m=e.globChars(R),E=e.extglobChars(m),{DOT_LITERAL:_,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=m,L=e=>`(${A}(?:(?!${T}${e.dot?v:_}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let M=!0===f.bash?L(f):O;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:p,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};p=t.removePrefix(p,j),g=p.length;const B=[],P=[],D=[];let U,G=h;const F=()=>j.index===g-1,K=j.peek=(e=1)=>p[j.index+e],q=j.advance=()=>p[++j.index]||"",Q=()=>p.slice(j.index+1),W=(e="",t=0)=>{j.consumed+=e,j.index+=t},X=e=>{j.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},J=e=>{j[e]++,D.push(e)},z=e=>{j[e]--,D.pop()},Y=e=>{if("globstar"===G.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=M,j.output+=G.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&X(e),G&&"text"===G.type&&"text"===e.type)return G.value+=e.value,void(G.output=(G.output||"")+e.value);e.prev=G,y.push(e),G=e},V=(e,t)=>{const n={...E[t],conditions:1,inner:""};n.prev=G,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;J("parens"),Y({type:e,value:t,output:j.output?"":C}),Y({type:"paren",extglob:!0,value:q(),output:r}),B.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==M||F()||/^\)+$/.test(Q()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=Q())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:U,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,n=p.replace(a,((t,n,r,o,a,s)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(a?H.repeat(a.length):""):0===s?I+(a?H.repeat(a.length):""):H.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(a?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===p&&!0===f.contains?(j.output=p,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!F();){if(U=q(),"\0"===U)continue;if("\\"===U){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){U+="\\",Y({type:"text",value:U});continue}const t=/^\\+/.exec(Q());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(U+="\\")),!0===f.unescape?U=q():U+=q(),0===j.brackets){Y({type:"text",value:U});continue}}if(j.brackets>0&&("]"!==U||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===U){const e=G.value.slice(1);if(e.includes("[")&&(G.posix=!0,e.includes(":"))){const e=G.value.lastIndexOf("["),t=G.value.slice(0,e),n=G.value.slice(e+2),o=r[n];if(o){G.value=t+o,j.backtrack=!0,q(),h.output||1!==y.indexOf(G)||(h.output=C);continue}}}("["===U&&":"!==K()||"-"===U&&"]"===K())&&(U=`\\${U}`),"]"!==U||"["!==G.value&&"[^"!==G.value||(U=`\\${U}`),!0===f.posix&&"!"===U&&"["===G.value&&(U="^"),G.value+=U,X({value:U});continue}if(1===j.quotes&&'"'!==U){U=t.escapeRegex(U),G.value+=U,X({value:U});continue}if('"'===U){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:U});continue}if("("===U){J("parens"),Y({type:"paren",value:U});continue}if(")"===U){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}Y({type:"paren",value:U,output:j.parens?")":"\\)"}),z("parens");continue}if("["===U){if(!0!==f.nobracket&&Q().includes("]"))J("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));U=`\\${U}`}Y({type:"bracket",value:U});continue}if("]"===U){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){Y({type:"text",value:U,output:`\\${U}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:U,output:`\\${U}`});continue}z("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(U=`/${U}`),G.value+=U,X({value:U}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(G.value);if(j.output=j.output.slice(0,-G.value.length),!0===f.literalBrackets){j.output+=n,G.value=n;continue}G.value=`(${A}${n}|${G.value})`,j.output+=G.value;continue}if("{"===U&&!0!==f.nobrace){J("braces");const e={type:"brace",value:U,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),Y(e);continue}if("}"===U){const e=P[P.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:U,output:U});continue}let t=")";if(!0===e.dots){const e=y.slice(),n=[];for(let t=e.length-1;t>=0&&(y.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",U=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}Y({type:"brace",value:U,output:t}),z("braces"),P.pop();continue}if("|"===U){B.length>0&&B[B.length-1].conditions++,Y({type:"text",value:U});continue}if(","===U){let e=U;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:U,output:e});continue}if("/"===U){if("dot"===G.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",y.pop(),G=h;continue}Y({type:"slash",value:U,output:S});continue}if("."===U){if(j.braces>0&&"dot"===G.type){"."===G.value&&(G.output=_);const e=P[P.length-1];G.type="dots",G.output+=U,G.value+=U,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==G.type&&"slash"!==G.type){Y({type:"text",value:U,output:_});continue}Y({type:"dot",value:U,output:_});continue}if("?"===U){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("qmark",U);continue}if(G&&"paren"===G.type){const e=K();let n=U;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(Q()))&&(n=`\\${U}`),Y({type:"text",value:U,output:n});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){Y({type:"qmark",value:U,output:k});continue}Y({type:"qmark",value:U,output:H});continue}if("!"===U){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){V("negate",U);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("plus",U);continue}if(G&&"("===G.value||!1===f.regex){Y({type:"plus",value:U,output:b});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||j.parens>0){Y({type:"plus",value:U});continue}Y({type:"plus",value:b});continue}if("@"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y({type:"at",extglob:!0,value:U,output:""});continue}Y({type:"text",value:U});continue}if("*"!==U){"$"!==U&&"^"!==U||(U=`\\${U}`);const e=o.exec(Q());e&&(U+=e[0],j.index+=e[0].length),Y({type:"text",value:U});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=U,G.output=M,j.backtrack=!0,j.globstar=!0,W(U);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",U);continue}if("star"===G.type){if(!0===f.noglobstar){W(U);continue}const t=G.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){Y({type:"star",value:U,output:""});continue}const a=j.braces>0&&("comma"===t.type||"brace"===t.type),s=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!a&&!s){Y({type:"star",value:U,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=U,G.output=L(f),j.output=G.output,j.globstar=!0,W(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=L(f)+(f.strictSlashes?")":"|$)"),G.value+=U,j.globstar=!0,j.output+=t.output+G.output,W(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${L(f)}${S}|${S}${n})`,G.value+=U,j.output+=t.output+G.output,j.globstar=!0,W(U+q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=U,G.output=`(?:^|${S}|${L(f)}${S})`,j.output=G.output,j.globstar=!0,W(U+q()),Y({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-G.output.length),G.type="globstar",G.output=L(f),G.value+=U,j.output+=G.output,j.globstar=!0,W(U);continue}const n={type:"star",value:U,output:M};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(j.index!==j.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(j.output+=x,G.output+=x):!0===f.dot?(j.output+=w,G.output+=w):(j.output+=N,G.output+=N),"*"!==K()&&(j.output+=C,G.output+=C)),Y(n)):(n.output=U,Y(n)):(n.output=".*?","bos"!==G.type&&"slash"!==G.type||(n.output=N+n.output),Y(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return l.fastpaths=(r,o)=>{const a={...o},i="number"==typeof a.maxLength?Math.min(n,a.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=s[r]||r;const l=t.isWindows(o),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:y,STAR:A,START_ANCHOR:R}=e.globChars(l),m=a.dot?h:g,E=a.dot?y:g,_=a.capture?"":"?:";let b=!0===a.bash?".*?":A;a.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${_}(?:(?!${R}${e.dot?d:p}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${p}${f}${b}`;case"*.*":return`${m}${b}${p}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${E}${b}`;case"**":return m+S(a);case"**/*":return`(?:${m}${S(a)}${c})?${E}${f}${b}`;case"**/*.*":return`(?:${m}${S(a)}${c})?${E}${b}${p}${f}${b}`;case"**/.*":return`(?:${m}${S(a)}${c})?${p}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+p+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==a.strictSlashes&&($+=`${c}?`),$},Ce=l}(),r=Ne(),o=Le(),a=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>a(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(s=e)&&"object"==typeof s&&!Array.isArray(s)&&e.tokens&&e.input;var s;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),l=o?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=a(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:s,output:f}=a.test(n,l,t,{glob:e,posix:u}),d={glob:e,state:p,regex:l,posix:u,input:n,output:f,match:s,isMatch:o};return"function"==typeof i.onResult&&i.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof i.onMatch&&i.onMatch(d),!r||d)};return n&&(f.state=p),f};return a.test=(e,t,n,{glob:o,posix:s}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(s?r.toPosixSlashes:null);let l=e===o,p=l&&u?u(e):e;return!1===l&&(p=u?u(e):e,l=p===o),!1!==l&&!0!==i.capture||(l=!0===i.matchBase||!0===i.basename?a.matchBase(e,t,n,s):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},a.matchBase=(t,n,o,s=r.isWindows(o))=>(n instanceof RegExp?n:a.makeRe(n,o)).test(e.basename(t)),a.isMatch=(e,t,n)=>a(t,n)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,n)=>t(e,n),a.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},s=o.contains?"":"^",i=o.contains?"":"$";let u=`${s}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const l=a.toRegex(u,t);return!0===r&&(l.state=e),l},a.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(s.output=n.fastpaths(e,t)),s.output||(s=n(e,t)),a.compileRe(s,t,r,o)},a.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},a.constants=o,$e=a}function Me(){return He?we:(He=1,we=Ie())}var je=function(){if(Oe)return ke;Oe=1;const e=C.default,t=Re(),n=Me(),r=Ne(),o=e=>""===e||"./"===e,a=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,a=new Set,s=new Set,i=0,u=e=>{s.add(e.output),r&&r.onResult&&r.onResult(e)};for(let s=0;s<t.length;s++){let l=n(String(t[s]),{...r,onResult:u},!0),p=l.state.negated||l.state.negatedExtglob;p&&i++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),a.add(e.output)))}}let l=(i===t.length?[...s]:[...a]).filter((e=>!o.has(e)));if(r&&0===l.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return l};return a.match=a,a.matcher=(e,t)=>n(e,t),a.any=a.isMatch=(e,t,r)=>n(t,r)(e),a.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=new Set(a(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)s.has(e)||r.add(e);return[...r]},a.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>a.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return a.isMatch(t,n,{...r,contains:!0})},a.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(e),t,n),s={};for(let t of o)s[t]=e[t];return s},a.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},a.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},a.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},a.capture=(e,t,o)=>{let a=r.isWindows(o),s=n.makeRe(String(e),{...o,capture:!0}).exec(a?r.toPosixSlashes(t):t);if(s)return s.slice(1).map((e=>void 0===e?"":e))},a.makeRe=(...e)=>n.makeRe(...e),a.scan=(...e)=>n.scan(...e),a.parse=(e,r)=>{let o=[];for(let a of[].concat(e||[]))for(let e of t(String(a),r))o.push(n.parse(e,r));return o},a.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},a.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return a.braces(e,{...t,expand:!0})},ke=a}();const Be='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Pe="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const De=new Map;function Ue(e,t){if(De.has(e))return De.get(e)[t];const n=_.default.resolve(e,"package.json"),r=JSON.parse(E.default.readFileSync(n,"utf-8"));return De.set(e,r),r[t]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,e]=o.program.args,t=process.cwd(),{init:n={}}=K()??{},{wd:r}=O(),a=_.default.basename(r),{named:s,template:i,bug:u={},readme:l=Pe,readmeTemplate:p}=n,f={template:"bug_report.yml",labels:["bug"],...u};let d=l;if(p){const e=_.default.resolve(r,p);d=E.default.readFileSync(e,"utf-8")}const g=function(e,t){let n=t??Be,r=!1;try{t&&JSON.parse(t)}catch(e){r=!0}if(r){const r=_.default.resolve(e,t);n=E.default.readFileSync(r,"utf-8")}return n}(r,i),{indent:h=" "}=b.default(g),y={tabSize:h.length,insertSpaces:!0},A=["license","author"];let R=g;for(const e of A)R=c.applyEdits(R,c.modify(R,[e],Ue(r,e),{formattingOptions:y}));let[m,C]=await async function(e,t,{wd:n,cwd:r,workspaceName:o}){const a=r.replace(`${n}/`,"");let s=_.default.basename(r);if("function"==typeof e)return e(t,{full:n,relative:r});let i,u,l=!1;if("object"==typeof e)if(r===n){const{rule:t}=await S.default.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(i=t,u=e[t])}else for(const[t,n]of Object.entries(e)){if(je.isMatch(a,t)){i=t,u=n;break}if(je.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,i=t,u=n;break}}if(u||(i="packages/*",u=`@${o}/$basename`),!u)throw new Error("no matched rule");if(!t&&l&&(s=await S.default.prompt({type:"input",name:"name",message:`the matched rule is \`${String(u)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof u)return u(t,{full:n,relative:r,basename:s});if("string"==typeof u){const e=t??s;return[u.replace(/\$basename/g,e),i?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(s,e,{wd:r,cwd:t,workspaceName:a});if(!C){const{dir:t}=await S.default.prompt({type:"input",name:"dir",message:"package directory",default:e});C=t}if(!m){const{name:t}=await S.default.prompt({type:"input",name:"name",message:"package name",default:e});m=t}R=c.applyEdits(R,c.modify(R,["name"],m,{formattingOptions:y}));let v=Ue(r,"repository");"string"==typeof v&&(v={type:"git",url:v,directory:C}),R=c.applyEdits(R,c.modify(R,["repository"],v,{formattingOptions:y}));const $=`${v?.url}/blob/master/${C}/README.md`;R=c.applyEdits(R,c.modify(R,["homepage"],$,{formattingOptions:y}));let x=f.labels;"function"==typeof x&&(x=x({name:m,dir:C})),x.push(`scope:${m}`);const w=`${v?.url}/issues/new?template=${f.template}&labels=${x.join(",")}`;function H(e){if(!C)throw new Error("pkgDir is not defined");return _.default.resolve(C,e)}R=c.applyEdits(R,c.modify(R,["bugs"],w,{formattingOptions:y})),E.default.existsSync(C)||E.default.mkdirSync(C);const k=H("package.json");if(E.default.existsSync(k))throw new Error("package.json already exists");E.default.writeFileSync(k,R),console.log(R,"written to",k);const T=Ue(r,"license"),L=H("README.md");"function"==typeof d&&(d=d({dir:C,packageJson:JSON.parse(R)}));const N=d.replace(/\$name/g,m).replace(/\$license/g,T);E.default.writeFileSync(L,N)}));const Ge=(e,t)=>new Set([...e].filter((e=>t.has(e))));function Fe({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:a,noFilter:s,withSource:i,withSuffix:u}){const{build:l={}}=o??{},{crossModuleConvertor:p=!0}=l,c=`./${f=((...e)=>n.resolve(a??process.cwd(),...e))(("object"==typeof l?.output?.dir?l.output.dir.js:l?.output?.dir)??"dist"),n.relative(a??process.cwd(),f)}`;var f;const[,d]=y.resolveEntrypoints(e);r&&Object.entries(d).forEach((([e])=>{r.some((t=>je.isMatch(e,t,{matchBase:!0})))||delete d[e]}));const g=s?d:y.filterLeafs(d,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),h=p?{import:e=>!t&&0===Ge(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ge(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[g,y.entrypoints2Exports(g,{outdir:c,withSource:i,withSuffix:u,withConditional:{...h}})]}o.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-p, --preview","preview publish").action((async({preview:e,bumper:t,...n})=>{B();const{value:r={}}=await L()??{},o=Object.entries(r);if(0===o.length)throw new Error("no packages selected");const a=o.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,a={...t},[s,i]=Fe({entrypoints:r,pkgIsModule:o,config:K(e),dir:e,noFilter:!0,withSource:!0,withSuffix:!0});return a.exports={...s,...i},[e,a]})),s=Object.entries(n).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,r]of a){const o=E.default.readFileSync(_.default.join(n,"package.json"),"utf-8"),a=JSON.parse(o)??"0.0.0",i=h.bump(a.version,t),{indent:u=" "}=b.default(o),l={tabSize:u.length,insertSpaces:!0};let p=o;p=c.applyEdits(p,c.modify(p,["version"],i,{formattingOptions:l}));for(const[e,t]of Object.entries(r))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l}));else{const e=t;for(const[t,n]of Object.entries(e))p=c.applyEdits(p,c.modify(p,["publishConfig","exports",t],n,{formattingOptions:l}));const n=e?.["."],o={};if(n){switch(typeof n){case"string":o["module"===r?.type?"module":"main"]=n;break;case"object":{const e=n;o.main=e.require??e.default,o.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(o))void 0!==t&&(p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l})))}}try{if(E.default.renameSync(_.default.join(n,"package.json"),_.default.join(n,"package.json.bak")),E.default.writeFileSync(_.default.join(n,"package.json"),p),console.log(p),e){console.warn("preview mode");continue}$.execSync(["pnpm","publish","--access","public","--no-git-checks",...s].join(" "),{cwd:n,stdio:"inherit"});const t=c.applyEdits(o,c.modify(o,["version"],i,{}));E.default.writeFileSync(_.default.join(n,"package.json.bak"),t)}finally{E.default.unlinkSync(_.default.join(n,"package.json")),E.default.renameSync(_.default.join(n,"package.json.bak"),_.default.join(n,"package.json"))}}j()})),o.program.parse(process.argv);
|
19
|
+
*/function ye(){if(ee)return V;ee=1;const e=C.default,t=he(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),a=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},s=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let a=String.fromCharCode(e);return e===n?a:`[${a}-${String.fromCharCode(n)}]`},l=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw p([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw p([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(n);n=Math.max(Math.abs(n),1);let y=a(d)||a(g)||a(h),A=y?Math.max(d.length,g.length,h.length):0,R=!1===y&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),m=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,A),i(t,A),!0,r);let E={negatives:[],positives:[]},_=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?E[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):_.push(s(m(o,b),A,R)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",a="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(a=`-(${r}${e.negatives.join("|")})`),n=o&&a?`${o}|${a}`:o||a,t.wrap?`(${r}${n})`:n})(E,r):l(_,null,{wrap:!1,...r}):_},d=(e,t,a,s={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,s);if("function"==typeof a)return d(e,t,1,{transform:a});if(n(a))return d(e,t,0,a);let i={...s};return!0===i.capture&&(i.wrap=!0),a=a||i.step||1,o(a)?o(e)&&o(t)?f(e,t,a,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let a=r.transform||(e=>String.fromCharCode(e)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),p=s>i,f=Math.min(s,i),d=Math.max(s,i);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;p?s>=i:s<=i;)g.push(a(s,h)),s=p?s-n:s+n,h++;return!0===r.toRegex?l(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(a),1),i):null==a||n(a)?d(e,t,1,a):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(a,i)};return V=d}function Ae(){if(ue)return ie;ue=1;const e=de(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=se?ae:(se=1,ae={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return ie=(y,A={})=>{if("string"!=typeof y)throw new TypeError("Expected a string");let R=A||{},m="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(y.length>m)throw new SyntaxError(`Input length (${y.length}), exceeds max characters (${m})`);let E,_={type:"root",input:y,nodes:[]},b=[_],S=_,C=_,v=0,$=y.length,x=0,w=0;const H=()=>y[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],E=H(),E!==h&&E!==g)if(E!==n)if(E!==c)if(E!==p)if(E!==s)if(E!==i)if(E!==f&&E!==d&&E!==r)if(E!==u)if(E!==l)if(E===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:E}),S.commas++}else if(E===a&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:E});continue}if("dot"===C.type){if(S.range=[],C.value+=E,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+E,C=t,S.ranges--;continue}k({type:"dot",value:E})}else k({type:"text",value:E});else{if("brace"!==S.type){k({type:"text",value:E});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:E}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:E})}else{let e,t=E;for(!0!==A.keepQuotes&&(E="");x<$&&(e=H());)if(e!==n){if(e===t){!0===A.keepQuotes&&(E+=e);break}E+=e}else E+=e+H();k({type:"text",value:E})}else{if("paren"!==S.type){k({type:"text",value:E});continue}S=b.pop(),k({type:"text",value:E}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:E});else{let e;for(v++;x<$&&(e=H());)if(E+=e,e!==p)if(e!==n){if(e===c&&(v--,0===v))break}else E+=H();else v++;k({type:"text",value:E})}else k({type:"text",value:"\\"+E});else k({type:"text",value:(A.keepEscaping?E:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),_},ie}function Re(){if(pe)return le;pe=1;const e=de(),t=function(){if(ne)return te;ne=1;const e=ye(),t=fe();return te=(n,r={})=>{let o=(n,a={})=>{let s=t.isInvalidBrace(a),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===s||!0===i,l=!0===r.escapeInvalid?"\\":"",p="";if(!0===n.isOpen)return l+n.value;if(!0===n.isClose)return l+n.value;if("open"===n.type)return u?l+n.value:"(";if("close"===n.type)return u?l+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),a=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==a.length)return o.length>1&&a.length>1?`(${a})`:a}if(n.nodes)for(let e of n.nodes)p+=o(e,n);return p};return o(n)}}(),n=function(){if(oe)return re;oe=1;const e=ye(),t=de(),n=fe(),r=(e="",t="",o=!1)=>{let a=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)a.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),a.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(a)};return re=(o,a={})=>{let s=void 0===a.rangeLimit?1e3:a.rangeLimit,i=(o,u={})=>{o.queue=[];let l=u,p=u.queue;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)l=l.parent,p=l.queue;if(o.invalid||o.dollar)return void p.push(r(p.pop(),t(o,a)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(r(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,a.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,a);return 0===u.length&&(u=t(o,a)),p.push(r(p.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):p.push(r(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=Ae(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),le=o}var me,Ee,_e,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te={};function Le(){if(Ee)return me;Ee=1;const e=v.default,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",a="[^/]",s=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${s}`,l={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:a,END_ANCHOR:s,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${s})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${a}*?`,START_ANCHOR:i},p={...l,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return me={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},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,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?p:l}}function Ne(){return _e||(_e=1,function(e){const t=v.default,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:s}=Le();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>a.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(s,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},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!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(Te)),Te}function Ie(){if(xe)return $e;xe=1;const e=v.default,t=function(){if(Se)return be;Se=1;const e=Ne(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=Le(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return be=(R,m)=>{const E=m||{},_=R.length-1,b=!0===E.parts||!0===E.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,M=!1,j=!1,P=!1,B=!1,D=!1,U=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>H>=_,q=()=>($=x,w.charCodeAt(++H));for(;H<_;){let e;if(x=q(),x!==r){if(!0===j||x===u){for(G++;!0!==K()&&(x=q());)if(x!==r)if(x!==u){if(!0!==j&&x===a&&(x=q())===a){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(!0!==j&&x===o){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===d&&(G--,0===G)){j=!1,T=F.isBrace=!0,U=!0;break}}else G++;else P=F.backslashes=!0,q();if(!0===b)continue;break}if(x!==i){if(!0!==E.noext&&!0==(x===c||x===n||x===t||x===f||x===s)&&w.charCodeAt(H+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,U=!0,x===s&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===g){N=F.isGlob=!0,U=!0;break}}else P=F.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(M=F.isGlobstar=!0),N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===f){if(N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===p){for(;!0!==K()&&(e=q());)if(e!==r){if(e===h){L=F.isBracket=!0,N=F.isGlob=!0,U=!0;break}}else P=F.backslashes=!0,q();if(!0===b)continue;break}if(!0===E.nonegate||x!==s||H!==k){if(!0!==E.noparen&&x===l){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==l){if(x===g){U=!0;break}}else P=F.backslashes=!0,x=q();continue}break}if(!0===N){if(U=!0,!0===b)continue;break}}else B=F.negated=!0,k++}else{if(S.push(H),C.push(F),F={value:"",depth:0,isGlob:!1},!0===U)continue;if($===a&&H===k+1){k+=2;continue}O=H+1}}else P=F.backslashes=!0,x=q(),x===u&&(j=!0)}!0===E.noext&&(I=!1,N=!1);let Q=w,W="",X="";k>0&&(W=w.slice(0,k),w=w.slice(k),O-=k),Q&&!0===N&&O>0?(Q=w.slice(0,O),X=w.slice(O)):!0===N?(Q="",X=w):Q=w,Q&&""!==Q&&"/"!==Q&&Q!==w&&y(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===E.unescape&&(X&&(X=e.removeBackslashes(X)),Q&&!0===P&&(Q=e.removeBackslashes(Q)));const Z={prefix:W,input:R,start:k,base:Q,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:M,negated:B,negatedExtglob:D};if(!0===E.tokens&&(Z.maxDepth=0,y(x)||C.push(F),Z.tokens=C),!0===E.parts||!0===E.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);E.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=W):C[t].value=o,A(C[t]),Z.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),E.tokens&&(C[C.length-1].value=t,A(C[C.length-1]),Z.maxDepth+=C[C.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(ve)return Ce;ve=1;const e=Le(),t=Ne(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:s}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=s[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let g=p.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},y=[h],A=f.capture?"":"?:",R=t.isWindows(c),m=e.globChars(R),E=e.extglobChars(m),{DOT_LITERAL:_,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=m,L=e=>`(${A}(?:(?!${T}${e.dot?v:_}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let M=!0===f.bash?L(f):O;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:p,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};p=t.removePrefix(p,j),g=p.length;const P=[],B=[],D=[];let U,G=h;const F=()=>j.index===g-1,K=j.peek=(e=1)=>p[j.index+e],q=j.advance=()=>p[++j.index]||"",Q=()=>p.slice(j.index+1),W=(e="",t=0)=>{j.consumed+=e,j.index+=t},X=e=>{j.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},J=e=>{j[e]++,D.push(e)},z=e=>{j[e]--,D.pop()},Y=e=>{if("globstar"===G.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||P.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=M,j.output+=G.output)}if(P.length&&"paren"!==e.type&&(P[P.length-1].inner+=e.value),(e.value||e.output)&&X(e),G&&"text"===G.type&&"text"===e.type)return G.value+=e.value,void(G.output=(G.output||"")+e.value);e.prev=G,y.push(e),G=e},V=(e,t)=>{const n={...E[t],conditions:1,inner:""};n.prev=G,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;J("parens"),Y({type:e,value:t,output:j.output?"":C}),Y({type:"paren",extglob:!0,value:q(),output:r}),P.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==M||F()||/^\)+$/.test(Q()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=Q())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:U,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,n=p.replace(a,((t,n,r,o,a,s)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(a?H.repeat(a.length):""):0===s?I+(a?H.repeat(a.length):""):H.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(a?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===p&&!0===f.contains?(j.output=p,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!F();){if(U=q(),"\0"===U)continue;if("\\"===U){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){U+="\\",Y({type:"text",value:U});continue}const t=/^\\+/.exec(Q());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(U+="\\")),!0===f.unescape?U=q():U+=q(),0===j.brackets){Y({type:"text",value:U});continue}}if(j.brackets>0&&("]"!==U||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===U){const e=G.value.slice(1);if(e.includes("[")&&(G.posix=!0,e.includes(":"))){const e=G.value.lastIndexOf("["),t=G.value.slice(0,e),n=G.value.slice(e+2),o=r[n];if(o){G.value=t+o,j.backtrack=!0,q(),h.output||1!==y.indexOf(G)||(h.output=C);continue}}}("["===U&&":"!==K()||"-"===U&&"]"===K())&&(U=`\\${U}`),"]"!==U||"["!==G.value&&"[^"!==G.value||(U=`\\${U}`),!0===f.posix&&"!"===U&&"["===G.value&&(U="^"),G.value+=U,X({value:U});continue}if(1===j.quotes&&'"'!==U){U=t.escapeRegex(U),G.value+=U,X({value:U});continue}if('"'===U){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:U});continue}if("("===U){J("parens"),Y({type:"paren",value:U});continue}if(")"===U){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=P[P.length-1];if(e&&j.parens===e.parens+1){ee(P.pop());continue}Y({type:"paren",value:U,output:j.parens?")":"\\)"}),z("parens");continue}if("["===U){if(!0!==f.nobracket&&Q().includes("]"))J("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));U=`\\${U}`}Y({type:"bracket",value:U});continue}if("]"===U){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){Y({type:"text",value:U,output:`\\${U}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:U,output:`\\${U}`});continue}z("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(U=`/${U}`),G.value+=U,X({value:U}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(G.value);if(j.output=j.output.slice(0,-G.value.length),!0===f.literalBrackets){j.output+=n,G.value=n;continue}G.value=`(${A}${n}|${G.value})`,j.output+=G.value;continue}if("{"===U&&!0!==f.nobrace){J("braces");const e={type:"brace",value:U,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};B.push(e),Y(e);continue}if("}"===U){const e=B[B.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:U,output:U});continue}let t=")";if(!0===e.dots){const e=y.slice(),n=[];for(let t=e.length-1;t>=0&&(y.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",U=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}Y({type:"brace",value:U,output:t}),z("braces"),B.pop();continue}if("|"===U){P.length>0&&P[P.length-1].conditions++,Y({type:"text",value:U});continue}if(","===U){let e=U;const t=B[B.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:U,output:e});continue}if("/"===U){if("dot"===G.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",y.pop(),G=h;continue}Y({type:"slash",value:U,output:S});continue}if("."===U){if(j.braces>0&&"dot"===G.type){"."===G.value&&(G.output=_);const e=B[B.length-1];G.type="dots",G.output+=U,G.value+=U,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==G.type&&"slash"!==G.type){Y({type:"text",value:U,output:_});continue}Y({type:"dot",value:U,output:_});continue}if("?"===U){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("qmark",U);continue}if(G&&"paren"===G.type){const e=K();let n=U;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(Q()))&&(n=`\\${U}`),Y({type:"text",value:U,output:n});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){Y({type:"qmark",value:U,output:k});continue}Y({type:"qmark",value:U,output:H});continue}if("!"===U){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){V("negate",U);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("plus",U);continue}if(G&&"("===G.value||!1===f.regex){Y({type:"plus",value:U,output:b});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||j.parens>0){Y({type:"plus",value:U});continue}Y({type:"plus",value:b});continue}if("@"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y({type:"at",extglob:!0,value:U,output:""});continue}Y({type:"text",value:U});continue}if("*"!==U){"$"!==U&&"^"!==U||(U=`\\${U}`);const e=o.exec(Q());e&&(U+=e[0],j.index+=e[0].length),Y({type:"text",value:U});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=U,G.output=M,j.backtrack=!0,j.globstar=!0,W(U);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",U);continue}if("star"===G.type){if(!0===f.noglobstar){W(U);continue}const t=G.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){Y({type:"star",value:U,output:""});continue}const a=j.braces>0&&("comma"===t.type||"brace"===t.type),s=P.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!a&&!s){Y({type:"star",value:U,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=U,G.output=L(f),j.output=G.output,j.globstar=!0,W(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=L(f)+(f.strictSlashes?")":"|$)"),G.value+=U,j.globstar=!0,j.output+=t.output+G.output,W(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${L(f)}${S}|${S}${n})`,G.value+=U,j.output+=t.output+G.output,j.globstar=!0,W(U+q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=U,G.output=`(?:^|${S}|${L(f)}${S})`,j.output=G.output,j.globstar=!0,W(U+q()),Y({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-G.output.length),G.type="globstar",G.output=L(f),G.value+=U,j.output+=G.output,j.globstar=!0,W(U);continue}const n={type:"star",value:U,output:M};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(j.index!==j.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(j.output+=x,G.output+=x):!0===f.dot?(j.output+=w,G.output+=w):(j.output+=N,G.output+=N),"*"!==K()&&(j.output+=C,G.output+=C)),Y(n)):(n.output=U,Y(n)):(n.output=".*?","bos"!==G.type&&"slash"!==G.type||(n.output=N+n.output),Y(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return l.fastpaths=(r,o)=>{const a={...o},i="number"==typeof a.maxLength?Math.min(n,a.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=s[r]||r;const l=t.isWindows(o),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:y,STAR:A,START_ANCHOR:R}=e.globChars(l),m=a.dot?h:g,E=a.dot?y:g,_=a.capture?"":"?:";let b=!0===a.bash?".*?":A;a.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${_}(?:(?!${R}${e.dot?d:p}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${p}${f}${b}`;case"*.*":return`${m}${b}${p}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${E}${b}`;case"**":return m+S(a);case"**/*":return`(?:${m}${S(a)}${c})?${E}${f}${b}`;case"**/*.*":return`(?:${m}${S(a)}${c})?${E}${b}${p}${f}${b}`;case"**/.*":return`(?:${m}${S(a)}${c})?${p}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+p+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==a.strictSlashes&&($+=`${c}?`),$},Ce=l}(),r=Ne(),o=Le(),a=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>a(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(s=e)&&"object"==typeof s&&!Array.isArray(s)&&e.tokens&&e.input;var s;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),l=o?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=a(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:s,output:f}=a.test(n,l,t,{glob:e,posix:u}),d={glob:e,state:p,regex:l,posix:u,input:n,output:f,match:s,isMatch:o};return"function"==typeof i.onResult&&i.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof i.onMatch&&i.onMatch(d),!r||d)};return n&&(f.state=p),f};return a.test=(e,t,n,{glob:o,posix:s}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(s?r.toPosixSlashes:null);let l=e===o,p=l&&u?u(e):e;return!1===l&&(p=u?u(e):e,l=p===o),!1!==l&&!0!==i.capture||(l=!0===i.matchBase||!0===i.basename?a.matchBase(e,t,n,s):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},a.matchBase=(t,n,o,s=r.isWindows(o))=>(n instanceof RegExp?n:a.makeRe(n,o)).test(e.basename(t)),a.isMatch=(e,t,n)=>a(t,n)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,n)=>t(e,n),a.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},s=o.contains?"":"^",i=o.contains?"":"$";let u=`${s}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const l=a.toRegex(u,t);return!0===r&&(l.state=e),l},a.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(s.output=n.fastpaths(e,t)),s.output||(s=n(e,t)),a.compileRe(s,t,r,o)},a.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},a.constants=o,$e=a}function Me(){return He?we:(He=1,we=Ie())}var je=function(){if(Oe)return ke;Oe=1;const e=C.default,t=Re(),n=Me(),r=Ne(),o=e=>""===e||"./"===e,a=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,a=new Set,s=new Set,i=0,u=e=>{s.add(e.output),r&&r.onResult&&r.onResult(e)};for(let s=0;s<t.length;s++){let l=n(String(t[s]),{...r,onResult:u},!0),p=l.state.negated||l.state.negatedExtglob;p&&i++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),a.add(e.output)))}}let l=(i===t.length?[...s]:[...a]).filter((e=>!o.has(e)));if(r&&0===l.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return l};return a.match=a,a.matcher=(e,t)=>n(e,t),a.any=a.isMatch=(e,t,r)=>n(t,r)(e),a.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=new Set(a(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)s.has(e)||r.add(e);return[...r]},a.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>a.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return a.isMatch(t,n,{...r,contains:!0})},a.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(e),t,n),s={};for(let t of o)s[t]=e[t];return s},a.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},a.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},a.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},a.capture=(e,t,o)=>{let a=r.isWindows(o),s=n.makeRe(String(e),{...o,capture:!0}).exec(a?r.toPosixSlashes(t):t);if(s)return s.slice(1).map((e=>void 0===e?"":e))},a.makeRe=(...e)=>n.makeRe(...e),a.scan=(...e)=>n.scan(...e),a.parse=(e,r)=>{let o=[];for(let a of[].concat(e||[]))for(let e of t(String(a),r))o.push(n.parse(e,r));return o},a.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},a.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return a.braces(e,{...t,expand:!0})},ke=a}();const Pe='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Be="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const De=new Map;function Ue(e,t){if(De.has(e))return De.get(e)[t];const n=_.default.resolve(e,"package.json"),r=JSON.parse(E.default.readFileSync(n,"utf-8"));return De.set(e,r),r[t]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,e]=o.program.args,t=process.cwd(),{init:n={}}=K()??{},{wd:r}=O(),a=_.default.basename(r),{named:s,template:i,bug:u={},readme:l=Be,readmeTemplate:p}=n,f={template:"bug_report.yml",labels:["bug"],...u};let d=l;if(p){const e=_.default.resolve(r,p);d=E.default.readFileSync(e,"utf-8")}const g=function(e,t){let n=t??Pe,r=!1;try{t&&JSON.parse(t)}catch(e){r=!0}if(r){const r=_.default.resolve(e,t);n=E.default.readFileSync(r,"utf-8")}return n}(r,i),{indent:h=" "}=b.default(g),y={tabSize:h.length,insertSpaces:!0},A=["license","author"];let R=g;for(const e of A)R=c.applyEdits(R,c.modify(R,[e],Ue(r,e),{formattingOptions:y}));let[m,C]=await async function(e,t,{wd:n,cwd:r,workspaceName:o}){const a=r.replace(`${n}/`,"");let s=_.default.basename(r);if("function"==typeof e)return e(t,{full:n,relative:r});let i,u,l=!1;if("object"==typeof e)if(r===n){const{rule:t}=await S.default.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(i=t,u=e[t])}else for(const[t,n]of Object.entries(e)){if(je.isMatch(a,t)){i=t,u=n;break}if(je.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,i=t,u=n;break}}if(u||(i="packages/*",u=`@${o}/$basename`),!u)throw new Error("no matched rule");if(!t&&l&&(s=await S.default.prompt({type:"input",name:"name",message:`the matched rule is \`${String(u)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof u)return u(t,{full:n,relative:r,basename:s});if("string"==typeof u){const e=t??s;return[u.replace(/\$basename/g,e),i?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(s,e,{wd:r,cwd:t,workspaceName:a});if(!C){const{dir:t}=await S.default.prompt({type:"input",name:"dir",message:"package directory",default:e});C=t}if(!m){const{name:t}=await S.default.prompt({type:"input",name:"name",message:"package name",default:e});m=t}R=c.applyEdits(R,c.modify(R,["name"],m,{formattingOptions:y}));let v=Ue(r,"repository");"string"==typeof v&&(v={type:"git",url:v,directory:C}),R=c.applyEdits(R,c.modify(R,["repository"],v,{formattingOptions:y}));const $=`${v?.url}/blob/master/${C}/README.md`;R=c.applyEdits(R,c.modify(R,["homepage"],$,{formattingOptions:y}));let x=f.labels;"function"==typeof x&&(x=x({name:m,dir:C})),x.push(`scope:${m}`);const w=`${v?.url}/issues/new?template=${f.template}&labels=${x.join(",")}`;function H(e){if(!C)throw new Error("pkgDir is not defined");return _.default.resolve(C,e)}R=c.applyEdits(R,c.modify(R,["bugs"],w,{formattingOptions:y})),E.default.existsSync(C)||E.default.mkdirSync(C);const k=H("package.json");if(E.default.existsSync(k))throw new Error("package.json already exists");E.default.writeFileSync(k,R),console.log(R,"written to",k);const T=Ue(r,"license"),L=H("README.md");"function"==typeof d&&(d=d({dir:C,packageJson:JSON.parse(R)}));const N=d.replace(/\$name/g,m).replace(/\$license/g,T);E.default.writeFileSync(L,N)}));const Ge=(e,t)=>new Set([...e].filter((e=>t.has(e))));function Fe({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:a,noFilter:s,isPublish:i}){const{build:u={},publish:{withSuffix:l=!1,withSource:p=!0}={}}=o??{},{crossModuleConvertor:c=!0}=u,f=`./${d=((...e)=>n.resolve(a??process.cwd(),...e))(("object"==typeof u?.output?.dir?u.output.dir.js:u?.output?.dir)??"dist"),n.relative(a??process.cwd(),d)}`;var d;const[,g]=y.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>je.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const h=s?g:y.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),A=c?{import:e=>!t&&0===Ge(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ge(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[h,y.entrypoints2Exports(h,{outdir:f,withSuffix:i?l:void 0,withSource:i?p:void 0,withConditional:{...A}})]}o.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-p, --preview","preview publish").action((async({preview:e,bumper:t,...n})=>{P();const{value:r={}}=await L()??{},o=Object.entries(r);if(0===o.length)throw new Error("no packages selected");const a=o.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,a={...t},[s,i]=Fe({entrypoints:r,pkgIsModule:o,config:K(e),dir:e,noFilter:!0,isPublish:!0});return a.exports={...s,...i},[e,a]})),s=Object.entries(n).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,r]of a){const o=E.default.readFileSync(_.default.join(n,"package.json"),"utf-8"),a=JSON.parse(o)??"0.0.0",i=h.bump(a.version,t),{indent:u=" "}=b.default(o),l={tabSize:u.length,insertSpaces:!0};let p=o;p=c.applyEdits(p,c.modify(p,["version"],i,{formattingOptions:l}));for(const[e,t]of Object.entries(r))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l}));else{const e=t;for(const[t,n]of Object.entries(e))p=c.applyEdits(p,c.modify(p,["publishConfig","exports",t],n,{formattingOptions:l}));const n=e?.["."],o={};if(n){switch(typeof n){case"string":o["module"===r?.type?"module":"main"]=n;break;case"object":{const e=n;o.main=e.require??e.default,o.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(o))void 0!==t&&(p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l})))}}try{if(E.default.renameSync(_.default.join(n,"package.json"),_.default.join(n,"package.json.bak")),E.default.writeFileSync(_.default.join(n,"package.json"),p),console.log(p),e){console.warn("preview mode");continue}$.execSync(["pnpm","publish","--access","public","--no-git-checks",...s].join(" "),{cwd:n,stdio:"inherit"});const t=c.applyEdits(o,c.modify(o,["version"],i,{}));E.default.writeFileSync(_.default.join(n,"package.json.bak"),t)}finally{E.default.unlinkSync(_.default.join(n,"package.json")),E.default.renameSync(_.default.join(n,"package.json.bak"),_.default.join(n,"package.json"))}}j()})),o.program.parse(process.argv);
|