jiek 0.4.7-alpha.10 → 0.4.7-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.cjs +4 -4
- package/dist/cli.js +4 -4
- package/dist/cli.min.cjs +4 -4
- package/dist/cli.min.js +4 -4
- package/dist/rollup/index.cjs +2 -1
- package/dist/rollup/index.js +2 -1
- package/dist/rollup/index.min.cjs +1 -1
- package/dist/rollup/index.min.js +1 -1
- package/package.json +1 -1
- package/src/commands/build.ts +1 -2
- package/src/utils/tsRegister.ts +4 -0
package/dist/cli.cjs
CHANGED
@@ -132,7 +132,7 @@ async function getSelectedProjectsGraph() {
|
|
132
132
|
|
133
133
|
var name = "jiek";
|
134
134
|
var type = "module";
|
135
|
-
var version = "0.4.7-alpha.
|
135
|
+
var version = "0.4.7-alpha.10";
|
136
136
|
var description = "YiJie's personal kits.";
|
137
137
|
var bin = {
|
138
138
|
jiek: "bin/jiek.js",
|
@@ -229,9 +229,10 @@ function actionRestore() {
|
|
229
229
|
new Promise((r) => resolve = r);
|
230
230
|
}
|
231
231
|
|
232
|
+
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
232
233
|
function packageIsExist(name) {
|
233
234
|
try {
|
234
|
-
require.resolve(name);
|
235
|
+
require$2.resolve(name);
|
235
236
|
return true;
|
236
237
|
} catch (e) {
|
237
238
|
return false;
|
@@ -326,8 +327,7 @@ function loadConfig(dir) {
|
|
326
327
|
}
|
327
328
|
|
328
329
|
const FILE_TEMPLATE = (manifest) => `
|
329
|
-
|
330
|
-
module.exports = require('jiek/rollup').template(manifest)
|
330
|
+
module.exports = require('jiek/rollup').template(${JSON.stringify(manifest, null, 2)})
|
331
331
|
`.trimStart();
|
332
332
|
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
333
333
|
commander.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 ({
|
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.10";
|
114
114
|
var description = "YiJie's personal kits.";
|
115
115
|
var bin = {
|
116
116
|
jiek: "bin/jiek.js",
|
@@ -207,9 +207,10 @@ function actionRestore() {
|
|
207
207
|
new Promise((r) => resolve = r);
|
208
208
|
}
|
209
209
|
|
210
|
+
const require$2 = createRequire(import.meta.url);
|
210
211
|
function packageIsExist(name) {
|
211
212
|
try {
|
212
|
-
require.resolve(name);
|
213
|
+
require$2.resolve(name);
|
213
214
|
return true;
|
214
215
|
} catch (e) {
|
215
216
|
return false;
|
@@ -304,8 +305,7 @@ function loadConfig(dir) {
|
|
304
305
|
}
|
305
306
|
|
306
307
|
const FILE_TEMPLATE = (manifest) => `
|
307
|
-
|
308
|
-
module.exports = require('jiek/rollup').template(manifest)
|
308
|
+
module.exports = require('jiek/rollup').template(${JSON.stringify(manifest, null, 2)})
|
309
309
|
`.trimStart();
|
310
310
|
const require$1 = createRequire(import.meta.url);
|
311
311
|
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 ({
|
package/dist/cli.min.cjs
CHANGED
@@ -1,19 +1,19 @@
|
|
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"),s=require("js-yaml"),a=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),p=require("detect-indent"),l=require("inquirer"),c=require("jsonc-parser"),f=require("util"),g=require("path"),d=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(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 m=R(d);let E,_;function b(){if(E)return E;const e=o.program.getOptionValue("root");return E=e?n.isAbsolute(e)?e:n.resolve(process.cwd(),e):void 0,E}let S=!1;function C(){if(_)return{wd:_,notWorkspace:S};const e=b();if(void 0!==e){const t=a.isWorkspaceDir(e,v);return S=!t,_=e,{wd:_,notWorkspace:S}}try{_=a.getWorkspaceDir(v)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;_=e,S=!0}return{wd:_,notWorkspace:S}}let v="";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"),v="pnpm"}catch{}async function $(){let t=o.program.getOptionValue("filter");const a=b(),{wd:i,notWorkspace:u}=C();if(!u&&"pnpm"===v){const o=n.resolve(i,"pnpm-workspace.yaml"),u=e.readFileSync(o,"utf-8"),p=s.load(u);if(a===i&&!t)throw new Error("root path is workspace root, please provide a filter");if(a!==i&&!t){if(!e.existsSync(n.resolve(a,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const r=JSON.parse(e.readFileSync(n.resolve(a,"package.json"),"utf-8"));if(!r.name)throw new Error("root path is not workspace root, please provide a filter");t=r.name}const{selectedProjectsGraph:l}=await r.filterPackagesFromDir(i,[{filter:t??"",followProdDepsOnly:!0}],{prefix:a,workspaceDir:i,patterns:p.packages});return{wd:i,root:a,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:i,root:a,value:{[i]:JSON.parse(e.readFileSync(n.resolve(i,"package.json"),"utf-8"))}}}""!==v&&o.program.option("-f, --filter <filter>","filter packages");var x="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"),s=require("js-yaml"),a=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),p=require("detect-indent"),l=require("inquirer"),c=require("jsonc-parser"),f=require("util"),g=require("path"),d=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(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 m=R(d);let E,_;function b(){if(E)return E;const e=o.program.getOptionValue("root");return E=e?n.isAbsolute(e)?e:n.resolve(process.cwd(),e):void 0,E}let S=!1;function C(){if(_)return{wd:_,notWorkspace:S};const e=b();if(void 0!==e){const t=a.isWorkspaceDir(e,v);return S=!t,_=e,{wd:_,notWorkspace:S}}try{_=a.getWorkspaceDir(v)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;_=e,S=!0}return{wd:_,notWorkspace:S}}let v="";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"),v="pnpm"}catch{}async function $(){let t=o.program.getOptionValue("filter");const a=b(),{wd:i,notWorkspace:u}=C();if(!u&&"pnpm"===v){const o=n.resolve(i,"pnpm-workspace.yaml"),u=e.readFileSync(o,"utf-8"),p=s.load(u);if(a===i&&!t)throw new Error("root path is workspace root, please provide a filter");if(a!==i&&!t){if(!e.existsSync(n.resolve(a,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const r=JSON.parse(e.readFileSync(n.resolve(a,"package.json"),"utf-8"));if(!r.name)throw new Error("root path is not workspace root, please provide a filter");t=r.name}const{selectedProjectsGraph:l}=await r.filterPackagesFromDir(i,[{filter:t??"",followProdDepsOnly:!0}],{prefix:a,workspaceDir:i,patterns:p.packages});return{wd:i,root:a,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:i,root:a,value:{[i]:JSON.parse(e.readFileSync(n.resolve(i,"package.json"),"utf-8"))}}}""!==v&&o.program.option("-f, --filter <filter>","filter packages");var x="0.4.7-alpha.10",w="YiJie's personal kits.";let H;function k(){H()}function O(){new Promise((e=>H=e))}o.program.version(x).description(w).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const T=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);function L(e){try{return T.resolve(e),!0}catch(e){return!1}}let N;const I=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of I)if(L(e)){N=e;break}let M="jiek.config";function j(t){const{wd:r}=C();let a=o.program.getOptionValue("configPath");if(a){if(!e.existsSync(a))throw new Error(`config file not found: ${a}`);n.isAbsolute(a)||(a=n.resolve(r,a))}else a=function(t,r){const o=!!N;function s(o){const s=[n.resolve(process.cwd(),`${M}.${o}`),n.resolve(process.cwd(),`.${M}.${o}`),n.resolve(t,`${M}.${o}`),n.resolve(t,`.${M}.${o}`)];r&&s.unshift(n.resolve(r,`${M}.${o}`),n.resolve(r,`.${M}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return M=s("js")??M,M=s("json")??M,M=s("yaml")??M,o&&(M=s("ts")??M),n.resolve(t,M)}(r,t);const i=n.extname(a);let u;switch(i){case".js":u=require(a);break;case".json":return require(a);case".yaml":return s.load(e.readFileSync(a,"utf-8"));case".ts":if(N){require(N),u=require(a);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":u={};break;default:throw new Error(`unsupported config file type: ${i}`)}if(!u)throw new Error("config file is empty");return u.default??u}const B=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:t,entries:r})=>{O();const{build:o}=j();t=t??o?.silent??!1;const{wd:s,value:a={}}=await $()??{};if(0===Object.keys(a).length)throw new Error("no package found");const p=n.resolve(s,"node_modules");e.existsSync(p)||e.mkdirSync(p);const l=(...e)=>n.resolve(p,".jiek",...e);e.existsSync(l())||e.mkdirSync(l());const c=B.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),f=new i.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},i.Presets.shades_classic);let g=0;await Promise.all(Object.entries(a).map((async([n,o])=>{const a=o.name?.replace(/^@/g,"").replace(/\//g,"+"),i=l(`${a??"anonymous-"+g++}.rollup.config.js`);e.writeFileSync(i,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(o));let p="";N&&(p=`node -r ${N} `);const d=`${p}${c} --silent -c ${i}`,h=u.execaCommand(d,{ipc:!0,cwd:n,env:{...process.env,JIEK_ROOT:s,JIEK_ENTRIES:r}}),y={};let A=10;h.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!t&&h.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})=>{A=Math.max(A,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;y[n]||(y[n]=f.create(50,0,{input:e.padEnd(A),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:s}=e.data,a=y[`${r}:${t}`];if(!a)return;a.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(A),status:o?.padEnd(10),message:`${n?.join(", ")}: ${s}`})}})),await new Promise(((e,t)=>{let n="";h.stderr?.on("data",(e=>{n+=e})),h.once("exit",(r=>0===r?e():t(new Error(`rollup build failed:\n${n}`))))}))}))).finally((()=>{f.stop()})),k()}));var P,D,U,G,F,K,q,Q,W,X,Z,J,z,Y,V,ee,te,ne,re,oe={};function se(){return P||(P=1,(e=oe).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}),oe;var e}function ae(){if(U)return D;U=1;const e=se();return D=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(s||a)&&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
|
*
|
5
5
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
6
6
|
* Released under the MIT License.
|
7
|
-
*/function
|
7
|
+
*/function ie(){return F?G:(F=1,G=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))})}
|
8
8
|
/*!
|
9
9
|
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
10
10
|
*
|
11
11
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
12
12
|
* Released under the MIT License.
|
13
|
-
*/function
|
13
|
+
*/function ue(){if(q)return K;q=1;const e=ie(),t=(n,s,a)=>{if(!1===e(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let i={relaxZeros:!0,...a};"boolean"==typeof i.strictZeros&&(i.relaxZeros=!1===i.strictZeros);let u=n+":"+s+"="+String(i.relaxZeros)+String(i.shorthand)+String(i.capture)+String(i.wrap);if(t.cache.hasOwnProperty(u))return t.cache[u].result;let p=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(p-l)){let e=n+"|"+s;return i.capture?`(${e})`:!1===i.wrap?e:`(?:${e})`}let f=c(n)||c(s),g={min:n,max:s,a:p,b:l},d=[],h=[];if(f&&(g.isPadded=f,g.maxLen=String(g.max).length),p<0){h=r(l<0?Math.abs(l):1,Math.abs(p),g,i),p=g.a=0}return l>=0&&(d=r(p,l,g,i)),g.negatives=h,g.positives=d,g.result=function(e,t,n){let r=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],a=o(e,t,"-?",!0)||[];return r.concat(a).concat(s).join("|")}(h,d),!0===i.capture?g.result=`(${g.result})`:!1!==i.wrap&&d.length+h.length>1&&(g.result=`(?:${g.result})`),t.cache[u]=g,g.result};function n(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}(e,t),o=r.length,s="",a=0;for(let e=0;e<o;e++){let[t,n]=r[e];t===n?s+=t:"0"!==t||"9"!==n?s+=l(t,n):a++}return a&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function r(e,t,r,o){let a,l=function(e,t){let n=1,r=1,o=i(e,n),a=new Set([t]);for(;e<=o&&o<=t;)a.add(o),n+=1,o=i(e,n);for(o=u(t+1,r)-1;e<o&&o<=t;)a.add(o),r+=1,o=u(t+1,r)-1;return a=[...a],a.sort(s),a}(e,t),c=[],g=e;for(let e=0;e<l.length;e++){let t=l[e],s=n(String(g),String(t),o),i="";r.isPadded||!a||a.pattern!==s.pattern?(r.isPadded&&(i=f(t,r,o)),s.string=i+s.pattern+p(s.count),c.push(s),g=t+1,a=s):(a.count.length>1&&a.count.pop(),a.count.push(s.count[0]),a.string=a.pattern+p(a.count),g=t+1)}return c}function o(e,t,n,r,o){let s=[];for(let o of e){let{string:e}=o;r||a(t,"string",e)||s.push(n+e),r&&a(t,"string",e)&&s.push(n+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function a(e,t,n){return e.some((e=>e[t]===n))}function i(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function u(e,t){return e-e%Math.pow(10,t)}function p(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function l(e,t,n){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return t.cache={},t.clearCache=()=>t.cache={},K=t}
|
14
14
|
/*!
|
15
15
|
* fill-range <https://github.com/jonschlinkert/fill-range>
|
16
16
|
*
|
17
17
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
18
18
|
* Licensed under the MIT License.
|
19
|
-
*/function ue(){if(Q)return q;Q=1;const e=f,t=ie(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},a=(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 s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(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)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},g=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),h=String(n);n=Math.max(Math.abs(n),1);let y=s(g)||s(d)||s(h),A=y?Math.max(g.length,d.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(a(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="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(E,r):p(_,null,{wrap:!1,...r}):_},d=(e,t,s,a={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,a);if("function"==typeof s)return d(e,t,1,{transform:s});if(n(s))return d(e,t,0,s);let i={...a};return!0===i.capture&&(i.wrap=!0),s=s||i.step||1,o(s)?o(e)&&o(t)?g(e,t,s,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),l=a>i,f=Math.min(a,i),g=Math.max(a,i);if(r.toRegex&&1===n)return u(f,g,!1,r);let d=[],h=0;for(;l?a>=i:a<=i;)d.push(s(a,h)),a=l?a-n:a+n,h++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),i):null==s||n(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,i)};return q=d}function pe(){if(ee)return V;ee=1;const e=se(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=Y?z:(Y=1,z={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 V=(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!==d)if(E!==n)if(E!==c)if(E!==l)if(E!==a)if(E!==i)if(E!==f&&E!==g&&E!==r)if(E!==u)if(E!==p)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===s&&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!==l)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"}),_},V}function le(){if(ne)return te;ne=1;const e=se(),t=function(){if(X)return W;X=1;const e=ue(),t=oe();return W=(n,r={})=>{let o=(n,s={})=>{let a=t.isInvalidBrace(s),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===a||!0===i,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+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),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(J)return Z;J=1;const e=ue(),t=se(),n=oe(),r=(e="",t="",o=!1)=>{let s=[];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)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return Z=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,i=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,g=o;for(;"brace"!==g.type&&"root"!==g.type&&g.parent;)g=g.parent,f=g.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):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=pe(),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),te=o}var ce,fe,ge,de,he,ye,Ae,Re,me,Ee,_e,be,Se,Ce={};function ve(){if(fe)return ce;fe=1;const e=g,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${a}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${a})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:i},l={...p,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 ce={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?l:p}}function $e(){return ge||(ge=1,function(e){const t=g,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=ve();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$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}}(Ce)),Ce}function xe(){if(me)return Re;me=1;const e=g,t=function(){if(he)return de;he=1;const e=$e(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:h}=ve(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return de=(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,G=!1,U=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(U++;!0!==K()&&(x=q());)if(x!==r)if(x!==u){if(!0!==j&&x===s&&(x=q())===s){if(T=F.isBrace=!0,N=F.isGlob=!0,G=!0,!0===b)continue;break}if(!0!==j&&x===o){if(T=F.isBrace=!0,N=F.isGlob=!0,G=!0,!0===b)continue;break}if(x===g&&(U--,0===U)){j=!1,T=F.isBrace=!0,G=!0;break}}else U++;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===a)&&w.charCodeAt(H+1)===p){if(N=F.isGlob=!0,I=F.isExtglob=!0,G=!0,x===a&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===d){N=F.isGlob=!0,G=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(M=F.isGlobstar=!0),N=F.isGlob=!0,G=!0,!0===b)continue;break}if(x===f){if(N=F.isGlob=!0,G=!0,!0===b)continue;break}if(x===l){for(;!0!==K()&&(e=q());)if(e!==r){if(e===h){L=F.isBracket=!0,N=F.isGlob=!0,G=!0;break}}else B=F.backslashes=!0,q();if(!0===b)continue;break}if(!0===E.nonegate||x!==a||H!==k){if(!0!==E.noparen&&x===p){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==p){if(x===d){G=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(!0===N){if(G=!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===G)continue;if($===s&&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(Ae)return ye;Ae=1;const e=ve(),t=$e(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=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`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=a[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);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:l,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};l=t.removePrefix(l,j),d=l.length;const B=[],P=[],D=[];let G,U=h;const F=()=>j.index===d-1,K=j.peek=(e=1)=>l[j.index+e],q=j.advance=()=>l[++j.index]||"",Q=()=>l.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"===U.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,-U.output.length),U.type="star",U.value="*",U.output=M,j.output+=U.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&X(e),U&&"text"===U.type&&"text"===e.type)return U.value+=e.value,void(U.output=(U.output||"")+e.value);e.prev=U,y.push(e),U=e},V=(e,t)=>{const n={...E[t],conditions:1,inner:""};n.prev=U,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=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:G,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?H.repeat(s.length):""):0===a?I+(s?H.repeat(s.length):""):H.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(s?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===l&&!0===f.contains?(j.output=l,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!F();){if(G=q(),"\0"===G)continue;if("\\"===G){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){G+="\\",Y({type:"text",value:G});continue}const t=/^\\+/.exec(Q());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(G+="\\")),!0===f.unescape?G=q():G+=q(),0===j.brackets){Y({type:"text",value:G});continue}}if(j.brackets>0&&("]"!==G||"["===U.value||"[^"===U.value)){if(!1!==f.posix&&":"===G){const e=U.value.slice(1);if(e.includes("[")&&(U.posix=!0,e.includes(":"))){const e=U.value.lastIndexOf("["),t=U.value.slice(0,e),n=U.value.slice(e+2),o=r[n];if(o){U.value=t+o,j.backtrack=!0,q(),h.output||1!==y.indexOf(U)||(h.output=C);continue}}}("["===G&&":"!==K()||"-"===G&&"]"===K())&&(G=`\\${G}`),"]"!==G||"["!==U.value&&"[^"!==U.value||(G=`\\${G}`),!0===f.posix&&"!"===G&&"["===U.value&&(G="^"),U.value+=G,X({value:G});continue}if(1===j.quotes&&'"'!==G){G=t.escapeRegex(G),U.value+=G,X({value:G});continue}if('"'===G){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:G});continue}if("("===G){J("parens"),Y({type:"paren",value:G});continue}if(")"===G){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:G,output:j.parens?")":"\\)"}),z("parens");continue}if("["===G){if(!0!==f.nobracket&&Q().includes("]"))J("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));G=`\\${G}`}Y({type:"bracket",value:G});continue}if("]"===G){if(!0===f.nobracket||U&&"bracket"===U.type&&1===U.value.length){Y({type:"text",value:G,output:`\\${G}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:G,output:`\\${G}`});continue}z("brackets");const e=U.value.slice(1);if(!0===U.posix||"^"!==e[0]||e.includes("/")||(G=`/${G}`),U.value+=G,X({value:G}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(U.value);if(j.output=j.output.slice(0,-U.value.length),!0===f.literalBrackets){j.output+=n,U.value=n;continue}U.value=`(${A}${n}|${U.value})`,j.output+=U.value;continue}if("{"===G&&!0!==f.nobrace){J("braces");const e={type:"brace",value:G,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),Y(e);continue}if("}"===G){const e=P[P.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:G,output:G});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="\\{",G=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}Y({type:"brace",value:G,output:t}),z("braces"),P.pop();continue}if("|"===G){B.length>0&&B[B.length-1].conditions++,Y({type:"text",value:G});continue}if(","===G){let e=G;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:G,output:e});continue}if("/"===G){if("dot"===U.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",y.pop(),U=h;continue}Y({type:"slash",value:G,output:S});continue}if("."===G){if(j.braces>0&&"dot"===U.type){"."===U.value&&(U.output=_);const e=P[P.length-1];U.type="dots",U.output+=G,U.value+=G,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==U.type&&"slash"!==U.type){Y({type:"text",value:G,output:_});continue}Y({type:"dot",value:G,output:_});continue}if("?"===G){if((!U||"("!==U.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("qmark",G);continue}if(U&&"paren"===U.type){const e=K();let n=G;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===U.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(Q()))&&(n=`\\${G}`),Y({type:"text",value:G,output:n});continue}if(!0!==f.dot&&("slash"===U.type||"bos"===U.type)){Y({type:"qmark",value:G,output:k});continue}Y({type:"qmark",value:G,output:H});continue}if("!"===G){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){V("negate",G);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===G){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("plus",G);continue}if(U&&"("===U.value||!1===f.regex){Y({type:"plus",value:G,output:b});continue}if(U&&("bracket"===U.type||"paren"===U.type||"brace"===U.type)||j.parens>0){Y({type:"plus",value:G});continue}Y({type:"plus",value:b});continue}if("@"===G){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y({type:"at",extglob:!0,value:G,output:""});continue}Y({type:"text",value:G});continue}if("*"!==G){"$"!==G&&"^"!==G||(G=`\\${G}`);const e=o.exec(Q());e&&(G+=e[0],j.index+=e[0].length),Y({type:"text",value:G});continue}if(U&&("globstar"===U.type||!0===U.star)){U.type="star",U.star=!0,U.value+=G,U.output=M,j.backtrack=!0,j.globstar=!0,W(G);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",G);continue}if("star"===U.type){if(!0===f.noglobstar){W(G);continue}const t=U.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:G,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!a){Y({type:"star",value:G,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&F()){U.type="globstar",U.value+=G,U.output=L(f),j.output=U.output,j.globstar=!0,W(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){j.output=j.output.slice(0,-(t.output+U.output).length),t.output=`(?:${t.output}`,U.type="globstar",U.output=L(f)+(f.strictSlashes?")":"|$)"),U.value+=G,j.globstar=!0,j.output+=t.output+U.output,W(G);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+U.output).length),t.output=`(?:${t.output}`,U.type="globstar",U.output=`${L(f)}${S}|${S}${n})`,U.value+=G,j.output+=t.output+U.output,j.globstar=!0,W(G+q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){U.type="globstar",U.value+=G,U.output=`(?:^|${S}|${L(f)}${S})`,j.output=U.output,j.globstar=!0,W(G+q()),Y({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-U.output.length),U.type="globstar",U.output=L(f),U.value+=G,j.output+=U.output,j.globstar=!0,W(G);continue}const n={type:"star",value:G,output:M};!0!==f.bash?!U||"bracket"!==U.type&&"paren"!==U.type||!0!==f.regex?(j.index!==j.start&&"slash"!==U.type&&"dot"!==U.type||("dot"===U.type?(j.output+=x,U.output+=x):!0===f.dot?(j.output+=w,U.output+=w):(j.output+=N,U.output+=N),"*"!==K()&&(j.output+=C,U.output+=C)),Y(n)):(n.output=G,Y(n)):(n.output=".*?","bos"!==U.type&&"slash"!==U.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"!==U.type&&"bracket"!==U.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 p.fastpaths=(r,o)=>{const s={...o},i="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=a[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:h,NO_DOTS_SLASH:y,STAR:A,START_ANCHOR:R}=e.globChars(p),m=s.dot?h:d,E=s.dot?y:d,_=s.capture?"":"?:";let b=!0===s.bash?".*?":A;s.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${_}(?:(?!${R}${e.dot?g:l}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${l}${f}${b}`;case"*.*":return`${m}${b}${l}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${E}${b}`;case"**":return m+S(s);case"**/*":return`(?:${m}${S(s)}${c})?${E}${f}${b}`;case"**/*.*":return`(?:${m}${S(s)}${c})?${E}${b}${l}${f}${b}`;case"**/.*":return`(?:${m}${S(s)}${c})?${l}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==s.strictSlashes&&($+=`${c}?`),$},ye=p}(),r=$e(),o=ve(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:a,output:f}=s.test(n,p,t,{glob:e,posix:u}),g={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:a,isMatch:o};return"function"==typeof i.onResult&&i.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof i.onMatch&&i.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:a}={})=>{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||(a?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==i.capture||(p=!0===i.matchBase||!0===i.basename?s.matchBase(e,t,n,a):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,a=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},a=o.contains?"":"^",i=o.contains?"":"$";let u=`${a}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=n.fastpaths(e,t)),a.output||(a=n(e,t)),s.compileRe(a,t,r,o)},s.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/$^/}},s.constants=o,Re=s}function we(){return _e?Ee:(_e=1,Ee=xe())}var He=function(){if(Se)return be;Se=1;const e=f,t=le(),n=we(),r=$e(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,i=0,u=e=>{a.add(e.output),r&&r.onResult&&r.onResult(e)};for(let a=0;a<t.length;a++){let p=n(String(t[a]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&i++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(i===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.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 p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],a=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||r.add(e);return[...r]},s.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=>s.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 s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),a={};for(let t of o)a[t]=e[t];return a},s.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},s.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},s.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)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),a=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},be=s}();const ke='{\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(),Oe="# $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 Te=new Map;function Le(t,r){if(Te.has(t))return Te.get(t)[r];const o=n.resolve(t,"package.json"),s=JSON.parse(e.readFileSync(o,"utf-8"));return Te.set(t,s),s[r]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,t]=o.program.args,r=process.cwd(),{init:s={}}=M()??{},{wd:a}=C(),i=n.basename(a),{named:u,template:f,bug:g={},readme:d=Oe,readmeTemplate:h}=s,y={template:"bug_report.yml",labels:["bug"],...g};let A=d;if(h){const t=n.resolve(a,h);A=e.readFileSync(t,"utf-8")}const R=function(t,r){let o=r??ke,s=!1;try{r&&JSON.parse(r)}catch(e){s=!0}if(s){const s=n.resolve(t,r);o=e.readFileSync(s,"utf-8")}return o}(a,f),{indent:m=" "}=p(R),E={tabSize:m.length,insertSpaces:!0},_=["license","author"];let b=R;for(const e of _)b=c.applyEdits(b,c.modify(b,[e],Le(a,e),{formattingOptions:E}));let[S,v]=await async function(e,t,{wd:r,cwd:o,workspaceName:s}){const a=o.replace(`${r}/`,"");let i=n.basename(o);if("function"==typeof e)return e(t,{full:r,relative:o});let u,p,c=!1;if("object"==typeof e)if(o===r){const{rule:t}=await l.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(u=t,p=e[t])}else for(const[t,n]of Object.entries(e)){if(He.isMatch(a,t)){u=t,p=n;break}if(He.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){c=!0,u=t,p=n;break}}if(p||(u="packages/*",p=`@${s}/$basename`),!p)throw new Error("no matched rule");if(!t&&c&&(i=await l.prompt({type:"input",name:"name",message:`the matched rule is \`${String(p)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof p)return p(t,{full:r,relative:o,basename:i});if("string"==typeof p){const e=t??i;return[p.replace(/\$basename/g,e),u?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(u,t,{wd:a,cwd:r,workspaceName:i});if(!v){const{dir:e}=await l.prompt({type:"input",name:"dir",message:"package directory",default:t});v=e}if(!S){const{name:e}=await l.prompt({type:"input",name:"name",message:"package name",default:t});S=e}b=c.applyEdits(b,c.modify(b,["name"],S,{formattingOptions:E}));let $=Le(a,"repository");"string"==typeof $&&($={type:"git",url:$,directory:v}),b=c.applyEdits(b,c.modify(b,["repository"],$,{formattingOptions:E}));const x=`${$?.url}/blob/master/${v}/README.md`;b=c.applyEdits(b,c.modify(b,["homepage"],x,{formattingOptions:E}));let w=y.labels;"function"==typeof w&&(w=w({name:S,dir:v})),w.push(`scope:${S}`);const H=`${$?.url}/issues/new?template=${y.template}&labels=${w.join(",")}`;function k(e){if(!v)throw new Error("pkgDir is not defined");return n.resolve(v,e)}b=c.applyEdits(b,c.modify(b,["bugs"],H,{formattingOptions:E})),e.existsSync(v)||e.mkdirSync(v);const O=k("package.json");if(e.existsSync(O))throw new Error("package.json already exists");e.writeFileSync(O,b),console.log(b,"written to",O);const T=Le(a,"license"),L=k("README.md");"function"==typeof A&&(A=A({dir:v,packageJson:JSON.parse(b)}));const N=A.replace(/\$name/g,S).replace(/\$license/g,T);e.writeFileSync(L,N)}));const Ne=(e,t)=>new Set([...e].filter((e=>t.has(e))));function Ie({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:s,noFilter:a,withSource:i,withSuffix:u}){const{build:p={}}=o??{},{crossModuleConvertor:l=!0}=p,c=`./${f=((...e)=>n.resolve(s??process.cwd(),...e))(("object"==typeof p?.output?.dir?p.output.dir.js:p?.output?.dir)??"dist"),n.relative(s??process.cwd(),f)}`;var f;const[,g]=y.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>He.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const d=a?g:y.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),h=l?{import:e=>!t&&0===Ne(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ne(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[d,y.entrypoints2Exports(d,{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:t,bumper:r,...o})=>{T();const{value:s={}}=await $()??{},a=Object.entries(s);if(0===a.length)throw new Error("no packages selected");const i=a.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,s={...t},[a,i]=Ie({entrypoints:r,pkgIsModule:o,config:M(e),dir:e,noFilter:!0,withSource:!0,withSuffix:!0});return s.exports={...a,...i},[e,s]})),u=Object.entries(o).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[o,s]of i){const a=e.readFileSync(n.join(o,"package.json"),"utf-8"),i=JSON.parse(a)??"0.0.0",l=h.bump(i.version,r),{indent:f=" "}=p(a),g={tabSize:f.length,insertSpaces:!0};let d=a;d=c.applyEdits(d,c.modify(d,["version"],l,{formattingOptions:g}));for(const[e,t]of Object.entries(s))if(JSON.stringify(t)!==JSON.stringify(i[e]))if("exports"!==e)d=c.applyEdits(d,c.modify(d,["publishConfig",e],t,{formattingOptions:g}));else{const e=t;for(const[t,n]of Object.entries(e))d=c.applyEdits(d,c.modify(d,["publishConfig","exports",t],n,{formattingOptions:g}));const n=e?.["."],r={};if(n){switch(typeof n){case"string":r["module"===s?.type?"module":"main"]=n;break;case"object":{const e=n;r.main=e.require??e.default,r.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(r))void 0!==t&&(d=c.applyEdits(d,c.modify(d,["publishConfig",e],t,{formattingOptions:g})))}}try{if(e.renameSync(n.join(o,"package.json"),n.join(o,"package.json.bak")),e.writeFileSync(n.join(o,"package.json"),d),console.log(d),t){console.warn("preview mode");continue}m.execSync(["pnpm","publish","--access","public","--no-git-checks",...u].join(" "),{cwd:o,stdio:"inherit"});const r=c.applyEdits(a,c.modify(a,["version"],l,{}));e.writeFileSync(n.join(o,"package.json.bak"),r)}finally{e.unlinkSync(n.join(o,"package.json")),e.renameSync(n.join(o,"package.json.bak"),n.join(o,"package.json"))}}O()})),o.program.parse(process.argv);
|
19
|
+
*/function pe(){if(W)return Q;W=1;const e=f,t=ue(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},a=(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 s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(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)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},g=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),h=String(n);n=Math.max(Math.abs(n),1);let y=s(g)||s(d)||s(h),A=y?Math.max(g.length,d.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(a(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="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(E,r):p(_,null,{wrap:!1,...r}):_},d=(e,t,s,a={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,a);if("function"==typeof s)return d(e,t,1,{transform:s});if(n(s))return d(e,t,0,s);let i={...a};return!0===i.capture&&(i.wrap=!0),s=s||i.step||1,o(s)?o(e)&&o(t)?g(e,t,s,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),l=a>i,f=Math.min(a,i),g=Math.max(a,i);if(r.toRegex&&1===n)return u(f,g,!1,r);let d=[],h=0;for(;l?a>=i:a<=i;)d.push(s(a,h)),a=l?a-n:a+n,h++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),i):null==s||n(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,i)};return Q=d}function le(){if(te)return ee;te=1;const e=ae(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=V?Y:(V=1,Y={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 ee=(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!==d)if(E!==n)if(E!==c)if(E!==l)if(E!==a)if(E!==i)if(E!==f&&E!==g&&E!==r)if(E!==u)if(E!==p)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===s&&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!==l)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"}),_},ee}function ce(){if(re)return ne;re=1;const e=ae(),t=function(){if(Z)return X;Z=1;const e=pe(),t=se();return X=(n,r={})=>{let o=(n,s={})=>{let a=t.isInvalidBrace(s),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===a||!0===i,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+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),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(z)return J;z=1;const e=pe(),t=ae(),n=se(),r=(e="",t="",o=!1)=>{let s=[];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)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return J=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,i=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,g=o;for(;"brace"!==g.type&&"root"!==g.type&&g.parent;)g=g.parent,f=g.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):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=le(),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),ne=o}var fe,ge,de,he,ye,Ae,Re,me,Ee,_e,be,Se,Ce,ve={};function $e(){if(ge)return fe;ge=1;const e=g,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${a}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${a})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:i},l={...p,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 fe={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?l:p}}function xe(){return de||(de=1,function(e){const t=g,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=$e();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$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}}(ve)),ve}function we(){if(Ee)return me;Ee=1;const e=g,t=function(){if(ye)return he;ye=1;const e=xe(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:h}=$e(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return he=(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===s&&(x=q())===s){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===g&&(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===a)&&w.charCodeAt(H+1)===p){if(N=F.isGlob=!0,I=F.isExtglob=!0,U=!0,x===a&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===d){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===l){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!==a||H!==k){if(!0!==E.noparen&&x===p){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==p){if(x===d){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($===s&&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(Re)return Ae;Re=1;const e=$e(),t=xe(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=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`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=a[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);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:l,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};l=t.removePrefix(l,j),d=l.length;const B=[],P=[],D=[];let U,G=h;const F=()=>j.index===d-1,K=j.peek=(e=1)=>l[j.index+e],q=j.advance=()=>l[++j.index]||"",Q=()=>l.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=p(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(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?H.repeat(s.length):""):0===a?I+(s?H.repeat(s.length):""):H.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(s?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===l&&!0===f.contains?(j.output=l,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 s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!a){Y({type:"star",value:U,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[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 p.fastpaths=(r,o)=>{const s={...o},i="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=a[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:h,NO_DOTS_SLASH:y,STAR:A,START_ANCHOR:R}=e.globChars(p),m=s.dot?h:d,E=s.dot?y:d,_=s.capture?"":"?:";let b=!0===s.bash?".*?":A;s.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${_}(?:(?!${R}${e.dot?g:l}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${l}${f}${b}`;case"*.*":return`${m}${b}${l}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${E}${b}`;case"**":return m+S(s);case"**/*":return`(?:${m}${S(s)}${c})?${E}${f}${b}`;case"**/*.*":return`(?:${m}${S(s)}${c})?${E}${b}${l}${f}${b}`;case"**/.*":return`(?:${m}${S(s)}${c})?${l}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==s.strictSlashes&&($+=`${c}?`),$},Ae=p}(),r=xe(),o=$e(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:a,output:f}=s.test(n,p,t,{glob:e,posix:u}),g={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:a,isMatch:o};return"function"==typeof i.onResult&&i.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof i.onMatch&&i.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:a}={})=>{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||(a?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==i.capture||(p=!0===i.matchBase||!0===i.basename?s.matchBase(e,t,n,a):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,a=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},a=o.contains?"":"^",i=o.contains?"":"$";let u=`${a}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=n.fastpaths(e,t)),a.output||(a=n(e,t)),s.compileRe(a,t,r,o)},s.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/$^/}},s.constants=o,me=s}function He(){return be?_e:(be=1,_e=we())}var ke=function(){if(Ce)return Se;Ce=1;const e=f,t=ce(),n=He(),r=xe(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,i=0,u=e=>{a.add(e.output),r&&r.onResult&&r.onResult(e)};for(let a=0;a<t.length;a++){let p=n(String(t[a]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&i++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(i===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.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 p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],a=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||r.add(e);return[...r]},s.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=>s.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 s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),a={};for(let t of o)a[t]=e[t];return a},s.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},s.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},s.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)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),a=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},Se=s}();const Oe='{\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(),Te="# $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 Le=new Map;function Ne(t,r){if(Le.has(t))return Le.get(t)[r];const o=n.resolve(t,"package.json"),s=JSON.parse(e.readFileSync(o,"utf-8"));return Le.set(t,s),s[r]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,t]=o.program.args,r=process.cwd(),{init:s={}}=j()??{},{wd:a}=C(),i=n.basename(a),{named:u,template:f,bug:g={},readme:d=Te,readmeTemplate:h}=s,y={template:"bug_report.yml",labels:["bug"],...g};let A=d;if(h){const t=n.resolve(a,h);A=e.readFileSync(t,"utf-8")}const R=function(t,r){let o=r??Oe,s=!1;try{r&&JSON.parse(r)}catch(e){s=!0}if(s){const s=n.resolve(t,r);o=e.readFileSync(s,"utf-8")}return o}(a,f),{indent:m=" "}=p(R),E={tabSize:m.length,insertSpaces:!0},_=["license","author"];let b=R;for(const e of _)b=c.applyEdits(b,c.modify(b,[e],Ne(a,e),{formattingOptions:E}));let[S,v]=await async function(e,t,{wd:r,cwd:o,workspaceName:s}){const a=o.replace(`${r}/`,"");let i=n.basename(o);if("function"==typeof e)return e(t,{full:r,relative:o});let u,p,c=!1;if("object"==typeof e)if(o===r){const{rule:t}=await l.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(u=t,p=e[t])}else for(const[t,n]of Object.entries(e)){if(ke.isMatch(a,t)){u=t,p=n;break}if(ke.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){c=!0,u=t,p=n;break}}if(p||(u="packages/*",p=`@${s}/$basename`),!p)throw new Error("no matched rule");if(!t&&c&&(i=await l.prompt({type:"input",name:"name",message:`the matched rule is \`${String(p)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof p)return p(t,{full:r,relative:o,basename:i});if("string"==typeof p){const e=t??i;return[p.replace(/\$basename/g,e),u?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(u,t,{wd:a,cwd:r,workspaceName:i});if(!v){const{dir:e}=await l.prompt({type:"input",name:"dir",message:"package directory",default:t});v=e}if(!S){const{name:e}=await l.prompt({type:"input",name:"name",message:"package name",default:t});S=e}b=c.applyEdits(b,c.modify(b,["name"],S,{formattingOptions:E}));let $=Ne(a,"repository");"string"==typeof $&&($={type:"git",url:$,directory:v}),b=c.applyEdits(b,c.modify(b,["repository"],$,{formattingOptions:E}));const x=`${$?.url}/blob/master/${v}/README.md`;b=c.applyEdits(b,c.modify(b,["homepage"],x,{formattingOptions:E}));let w=y.labels;"function"==typeof w&&(w=w({name:S,dir:v})),w.push(`scope:${S}`);const H=`${$?.url}/issues/new?template=${y.template}&labels=${w.join(",")}`;function k(e){if(!v)throw new Error("pkgDir is not defined");return n.resolve(v,e)}b=c.applyEdits(b,c.modify(b,["bugs"],H,{formattingOptions:E})),e.existsSync(v)||e.mkdirSync(v);const O=k("package.json");if(e.existsSync(O))throw new Error("package.json already exists");e.writeFileSync(O,b),console.log(b,"written to",O);const T=Ne(a,"license"),L=k("README.md");"function"==typeof A&&(A=A({dir:v,packageJson:JSON.parse(b)}));const N=A.replace(/\$name/g,S).replace(/\$license/g,T);e.writeFileSync(L,N)}));const Ie=(e,t)=>new Set([...e].filter((e=>t.has(e))));function Me({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:s,noFilter:a,withSource:i,withSuffix:u}){const{build:p={}}=o??{},{crossModuleConvertor:l=!0}=p,c=`./${f=((...e)=>n.resolve(s??process.cwd(),...e))(("object"==typeof p?.output?.dir?p.output.dir.js:p?.output?.dir)??"dist"),n.relative(s??process.cwd(),f)}`;var f;const[,g]=y.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>ke.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const d=a?g:y.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),h=l?{import:e=>!t&&0===Ie(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ie(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[d,y.entrypoints2Exports(d,{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:t,bumper:r,...o})=>{O();const{value:s={}}=await $()??{},a=Object.entries(s);if(0===a.length)throw new Error("no packages selected");const i=a.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,s={...t},[a,i]=Me({entrypoints:r,pkgIsModule:o,config:j(e),dir:e,noFilter:!0,withSource:!0,withSuffix:!0});return s.exports={...a,...i},[e,s]})),u=Object.entries(o).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[o,s]of i){const a=e.readFileSync(n.join(o,"package.json"),"utf-8"),i=JSON.parse(a)??"0.0.0",l=h.bump(i.version,r),{indent:f=" "}=p(a),g={tabSize:f.length,insertSpaces:!0};let d=a;d=c.applyEdits(d,c.modify(d,["version"],l,{formattingOptions:g}));for(const[e,t]of Object.entries(s))if(JSON.stringify(t)!==JSON.stringify(i[e]))if("exports"!==e)d=c.applyEdits(d,c.modify(d,["publishConfig",e],t,{formattingOptions:g}));else{const e=t;for(const[t,n]of Object.entries(e))d=c.applyEdits(d,c.modify(d,["publishConfig","exports",t],n,{formattingOptions:g}));const n=e?.["."],r={};if(n){switch(typeof n){case"string":r["module"===s?.type?"module":"main"]=n;break;case"object":{const e=n;r.main=e.require??e.default,r.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(r))void 0!==t&&(d=c.applyEdits(d,c.modify(d,["publishConfig",e],t,{formattingOptions:g})))}}try{if(e.renameSync(n.join(o,"package.json"),n.join(o,"package.json.bak")),e.writeFileSync(n.join(o,"package.json"),d),console.log(d),t){console.warn("preview mode");continue}m.execSync(["pnpm","publish","--access","public","--no-git-checks",...u].join(" "),{cwd:o,stdio:"inherit"});const r=c.applyEdits(a,c.modify(a,["version"],l,{}));e.writeFileSync(n.join(o,"package.json.bak"),r)}finally{e.unlinkSync(n.join(o,"package.json")),e.renameSync(n.join(o,"package.json.bak"),n.join(o,"package.json"))}}k()})),o.program.parse(process.argv);
|