@integration-app/membrane-cli
Version:
CLI tool for importing and exporting Integration.app workspace data
11 lines • 1.56 MB
JavaScript
var v6=Object.defineProperty;var a=(e,r)=>v6(e,"name",{value:r,configurable:!0});import{createRequire as S6}from"node:module";const Xf=S6(import.meta.url);import ot,{promises as PC,lstatSync as C6,fstatSync as w6,readFileSync as E6}from"fs";import tt,{sep as _6,join as Qo,dirname as k6}from"path";import{fileURLToPath as A6}from"url";import Ee from"chalk";import{Command as T6}from"commander";import MC from"inquirer";import*as aa from"node:fs";import D6 from"node:fs";import*as zl from"node:path";import B6 from"node:path";import Yr from"js-yaml";import{IntegrationAppClient as Qf,WorkspaceElementType as xr,WorkspaceElementSpecs as bc,setValueAtLocator as em,extractIntegrationAppErrorData as ya,getDataCollectionCreateFields as tm,excludeWriteOnlyFieldsFromSchema as IC,valueToSchema as Fc,getRequiredFieldsFromSchema as R6,getValueAtLocator as x6,walkSchema as OC,makeDataLocationPath as LC,getDataCollectionUpdateFields as rm}from"@integration-app/sdk";import{z as ga}from"zod";import NC from"jsonwebtoken";import Za from"events";import P6 from"constants";import Zr,{Duplex as M6,Readable as Ri,Writable as nm,PassThrough as HC}from"stream";import Xr from"util";import I6 from"assert";import ia,{Buffer as ql}from"buffer";import GC from"node:url";import O6 from"node:fs/promises";import L6 from"node:events";import N6,{Readable as H6}from"node:stream";import G6 from"node:string_decoder";import*as WC from"zlib";import vc from"zlib";import W6 from"form-data";import j6 from"async_hooks";import{Agent as jC,request as $6}from"http";import{Agent as $C,request as z6}from"https";import"http2";import{homedir as q6,platform as U6,release as K6}from"os";import{createHash as zC,createHmac as V6}from"crypto";import{versions as J6,env as qC}from"process";import{toCamelCase as am}from"js-convert-case";import Y6 from"@anthropic-ai/sdk";class Z6{static{a(this,"CommandBuilder")}constructor(r){this.program=r}addCommand(r){const t=this.program.command(r.name).description(r.description);return r.arguments?.forEach(n=>{t.argument(n.required?`<${n.name}>`:`[${n.name}]`,n.description)}),r.options?.forEach(n=>{t.option(n.flags,n.description,n.defaultValue)}),t.configureHelp({sortSubcommands:!0,subcommandTerm:a(n=>Ee.cyan(n.name()),"subcommandTerm"),commandUsage:a(n=>`${Ee.cyan(n.name())} ${Ee.gray("[options]")}`,"commandUsage"),optionTerm:a(n=>{const i=n.flags;return`${Ee.gray("\u25B8")} ${Ee.cyan(i)}`},"optionTerm"),argumentTerm:a(n=>{const i=n.required?`<${n.name}>`:`[${n.name}]`;return Ee.cyan(i)},"argumentTerm"),subcommandDescription:a(n=>Ee.gray(n.description()),"subcommandDescription"),optionDescription:a(n=>Ee.gray(n.description),"optionDescription"),argumentDescription:a(n=>Ee.gray(n.description),"argumentDescription"),commandDescription:a(n=>Ee.gray(n.description()),"commandDescription")}),r.examples?.length&&t.addHelpText("after",["",Ee.bold("Examples:"),...r.examples.map(n=>` ${Ee.gray("\u25B8")} ${Ee.cyan(n)}`),"",Ee.gray("For more information, visit:"),Ee.blue(" https://docs.integration.app/cli"),""].join(`
`)),r.afterHelp&&t.addHelpText("after",r.afterHelp),t.action(r.action),r.subcommands?.forEach(n=>{this.addSubCommand(t,n)}),this}addSubCommand(r,t){const n=r.command(t.name).description(t.description);return t.arguments?.forEach(i=>{n.argument(i.required?`<${i.name}>`:`[${i.name}]`,i.description)}),t.options?.forEach(i=>{n.option(i.flags,i.description,i.defaultValue)}),n.configureHelp({sortSubcommands:!0,subcommandTerm:a(i=>Ee.cyan(i.name()),"subcommandTerm"),commandUsage:a(i=>`${Ee.cyan(i.name())} ${Ee.gray("[options]")}`,"commandUsage"),optionTerm:a(i=>{const o=i.flags;return`${Ee.gray("\u25B8")} ${Ee.cyan(o)}`},"optionTerm"),argumentTerm:a(i=>{const o=i.required?`<${i.name}>`:`[${i.name}]`;return Ee.cyan(o)},"argumentTerm"),subcommandDescription:a(i=>Ee.gray(i.description()),"subcommandDescription"),optionDescription:a(i=>Ee.gray(i.description),"optionDescription"),argumentDescription:a(i=>Ee.gray(i.description),"argumentDescription"),commandDescription:a(i=>Ee.gray(i.description()),"commandDescription")}),t.examples?.length&&n.addHelpText("after",["",Ee.bold("Examples:"),...t.examples.map(i=>` ${Ee.gray("\u25B8")} ${Ee.cyan(i)}`),"",Ee.gray("For more information, visit:"),Ee.blue(" https://docs.integration.app/cli"),""].join(`
`)),t.afterHelp&&n.addHelpText("after",t.afterHelp),n.action(t.action),t.subcommands?.forEach(i=>{this.addSubCommand(n,i)}),n}getProgram(){return this.program}}const X6="membrane",Q6="membrane.config.yml",Xa="default";function Sc(){const e=process.cwd(),r=zl.join(e,X6),t=zl.join(e,Q6),n=r,i=zl.join(n,"workspace.yaml");return{membraneDirPath:r,configPath:t,payloadDirPath:n,workspaceDataFilePath:i}}a(Sc,"getPaths");function Ul(){return Sc().membraneDirPath}a(Ul,"getBasePath");class Cc{static{a(this,"BaseRunner")}constructor(r){if(this.options=r,this.fsPaths=Sc(),r&&typeof r=="object"){const t=r;"client"in t&&t.client&&(this.client=t.client),"workspace"in t&&(this.workspace=t.workspace)}}client;workspace;fsPaths}async function UC(e,r){return NC.sign({name:"Membrane CLI",isAdmin:!0,exp:Math.floor(Date.now()/1e3)+3600,iss:e},r,{algorithm:"HS512"})}a(UC,"generateAccessToken");const e9={info:"\u{1F4DD}",success:"\u2728",warning:"\u26A0\uFE0F",error:"\u274C",debug:"\u{1F50D}"},t9={info:Ee.blue,success:Ee.green,warning:Ee.yellow,error:Ee.red,debug:Ee.gray};class ke{static{a(this,"Logger")}static formatMessage(r,t,n={}){const i=n.timestamp?`${Ee.gray(new Date().toISOString())} `:"",o=n.prefix?`${Ee.gray(n.prefix)} `:"",s=n.suffix?` ${Ee.gray(n.suffix)}`:"",l=e9[t],u=t9[t];return`${i}${l} ${o}${u(r)}${s}`}static info(r,t){let n=Ee.blue;if(t?.color&&(n=Ee[t.color.toLowerCase()]||Ee.blue),t?.timestamp){const i=new Date().toLocaleTimeString();console.debug(`${Ee.gray(`[${i}]`)} ${n(r)}`)}else console.debug(n(r))}static group(r,t){}static groupEnd(){}static newLine(){}static success(r,t){console.debug(Ee.green(r))}static warning(r,t){}static error(r,t){console.error(this.formatMessage(r,"error",t))}static debug(r,t){t?.prefix?console.debug(Ee.gray(`[${t.prefix}] ${r}`),t.error?`
${Ee.red(t.error)}`:""):console.debug(Ee.gray(r),t?.error?`
${Ee.red(t.error)}`:"")}static step(r,t){}static header(r){}static table(r,t){if(r.length===0)return;const n=t||Object.keys(r[0]),i=r.map(o=>{const s={};return n.forEach(l=>{s[l]=o[l]}),s});console.table(i,n)}static divider(){}}const wc=ga.object({workspaces:ga.record(ga.object({key:ga.string(),secret:ga.string(),apiUri:ga.string().optional(),testCustomerId:ga.string().optional()})),testing:ga.object({anthropicApiKey:ga.string().optional()}).optional()});ga.enum(["pull","push"]);class r9{static{a(this,"MembraneConfigManager")}config=null;paths=Sc();loadConfig(){try{const r=aa.readFileSync(this.paths.configPath,"utf8");this.config=Yr.load(r)}catch{throw new Error("No membrane.config.yml found. Please run `membrane init` first.")}if(!this.config)throw new Error("Failed to read or parse config file")}async saveConfig(r){this.config||this.loadConfig(),this.config.workspaces=r;const t=wc.safeParse(this.config);if(!t.success)throw new Error(`Invalid configuration: ${t.error.message}`);aa.writeFileSync(this.paths.configPath,Yr.dump(this.config)),ke.success("Configuration saved successfully")}async validateConfig(r){const t=await this.getWorkspaceConfig(r);if(!t.key||!t.secret)throw new Error(`Missing ${r} workspace credentials`);return!0}async getWorkspaces(){return this.config||this.loadConfig(),this.config.workspaces}async getWorkspaceConfig(r=Xa){this.config||(this.loadConfig(),await this.validateConfig(r));const t=this.config.workspaces[r];if(!t)throw new Error(`Workspace "${r}" not found in config`);return t}async getPullConfig(r){const t=await this.getWorkspaceConfig(r.workspace);return{workspace:r.workspace,allConnectors:r.allConnectors,workspaceKey:t.key,workspaceSecret:t.secret,apiUri:t.apiUri}}async getPushConfig(r){const t=await this.getWorkspaceConfig(r.workspace),n=new Qf({token:await UC(t.key,t.secret),apiUri:t.apiUri});return{workspace:r.workspace,workspaceKey:t.key,workspaceSecret:t.secret,apiUri:t.apiUri,client:n}}}const jn=new r9;class n9 extends Cc{static{a(this,"InitRunner")}constructor(r){super(r)}async initialize(){ke.debug("Initializing membrane.config.yml",{prefix:"InitRunner"}),aa.existsSync(this.fsPaths.configPath)||this.createConfigFile()}createConfigFile(){ke.debug("Creating membrane.config.yml",{prefix:"InitRunner"}),aa.mkdirSync(zl.dirname(this.fsPaths.configPath),{recursive:!0}),ke.debug("Created membrane.config.yml",{prefix:"InitRunner"})}async run(){if(!this.options?.key||!this.options?.secret)throw new Error("Missing required workspace credentials");const r={workspaces:{default:{key:this.options.key,secret:this.options.secret,apiUri:this.options.apiUri||"https://api.integration.app"}}},t=wc.safeParse(r);if(!t.success)throw new Error(`Invalid configuration structure: ${t.error.message}`);aa.writeFileSync(this.fsPaths.configPath,Yr.dump(t.data),"utf8"),ke.debug("Wrote config-manager.yml file",{prefix:"InitRunner"})}}const a9={name:"init",description:"Initialize or update workspace configuration",examples:["membrane init # Initialize with prompts","membrane init --key KEY --secret SECRET # Initialize with values"],options:[{flags:"-k, --key <key>",description:"Workspace key"},{flags:"-s, --secret <secret>",description:"Workspace secret"},{flags:"-u, --api-uri <uri>",description:"API URI (optional)"}],action:a(async e=>{try{if(ke.header("Initializing Membrane Configuration"),ke.divider(),!e.key||!e.secret){ke.info("Please provide your workspace credentials");const t=await MC.prompt([{type:"input",name:"key",message:"Enter your workspace key",when:!e.key,validate:a(n=>n?!0:"Workspace key is required","validate")},{type:"input",name:"secret",message:"Enter your workspace secret",when:!e.secret,validate:a(n=>n?!0:"Workspace secret is required","validate")},{type:"input",name:"apiUri",message:"Enter your API URI (press Enter for default)",default:"https://api.integration.app",when:!e.apiUri}]);e={...e,...t}}const r=new n9(e);await r.initialize(),await r.run(),ke.divider(),ke.success("Configuration initialized successfully")}catch(r){r instanceof Error&&(ke.error(r.message),process.exit(1)),ke.error("An unknown error occurred"),process.exit(1)}},"action")},i9={name:"open",description:"Open the workspace in the browser",examples:["membrane open # Open default workspace","membrane open -w prod # Open prod workspace","membrane open -w dev # Open dev workspace"],options:[{flags:"-w, --workspace <workspace>",description:"Workspace to open",defaultValue:Xa}],action:a(async e=>{try{ke.header("Opening Workspace in Browser"),ke.info("Loading configuration..."),jn.loadConfig();const r=e.workspace||Xa;await jn.validateConfig(r),ke.info("Retrieving workspace ID...");const o=`https://console.integration.app/w/${(await(await jn.getPushConfig({workspace:r})).client.get("org-workspace-id")).id}`;ke.info(`Opening ${o}...`);const{default:s}=await import("open");await s(o),ke.success("Browser opened successfully")}catch(r){r instanceof Error&&(ke.error(r.message),process.exit(1)),ke.error("An unknown error occurred"),process.exit(1)}},"action")};function Kl(e){return bc[e].apiPath}a(Kl,"getWorkspaceElementTypePath");function KC(e,r){for(const t of Object.keys(r))e[t]=[...e[t]||[],...r[t]];return e}a(KC,"mergeWorkspaceData");const VC=[xr.Integration,xr.Scenario,xr.Action,xr.Flow,xr.AppDataSchema,xr.AppEventType,xr.DataLinkTable,xr.DataSource,xr.FieldMapping];var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}a(es,"getDefaultExportFromCjs");function im(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var t=a(function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)},"a");t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:a(function(){return e[n]},"get")})}),t}a(im,"getAugmentedNamespace");var om,JC;function o9(){return JC||(JC=1,om=typeof process=="object"&&process&&process.platform==="win32"?{sep:"\\"}:{sep:"/"}),om}a(o9,"requirePath");var sm,YC;function s9(){if(YC)return sm;YC=1,sm=e;function e(n,i,o){n instanceof RegExp&&(n=r(n,o)),i instanceof RegExp&&(i=r(i,o));var s=t(n,i,o);return s&&{start:s[0],end:s[1],pre:o.slice(0,s[0]),body:o.slice(s[0]+n.length,s[1]),post:o.slice(s[1]+i.length)}}a(e,"balanced");function r(n,i){var o=i.match(n);return o?o[0]:null}a(r,"maybeMatch"),e.range=t;function t(n,i,o){var s,l,u,c,d,f=o.indexOf(n),y=o.indexOf(i,f+1),m=f;if(f>=0&&y>0){if(n===i)return[f,y];for(s=[],u=o.length;m>=0&&!d;)m==f?(s.push(m),f=o.indexOf(n,m+1)):s.length==1?d=[s.pop(),y]:(l=s.pop(),l<u&&(u=l,c=y),y=o.indexOf(i,m+1)),m=f<y&&f>=0?f:y;s.length&&(d=[u,c])}return d}return a(t,"range"),sm}a(s9,"requireBalancedMatch");var lm,ZC;function XC(){if(ZC)return lm;ZC=1;var e=s9();lm=d;var r="\0SLASH"+Math.random()+"\0",t="\0OPEN"+Math.random()+"\0",n="\0CLOSE"+Math.random()+"\0",i="\0COMMA"+Math.random()+"\0",o="\0PERIOD"+Math.random()+"\0";function s(p){return parseInt(p,10)==p?parseInt(p,10):p.charCodeAt(0)}a(s,"numeric");function l(p){return p.split("\\\\").join(r).split("\\{").join(t).split("\\}").join(n).split("\\,").join(i).split("\\.").join(o)}a(l,"escapeBraces");function u(p){return p.split(r).join("\\").split(t).join("{").split(n).join("}").split(i).join(",").split(o).join(".")}a(u,"unescapeBraces");function c(p){if(!p)return[""];var h=[],g=e("{","}",p);if(!g)return p.split(",");var v=g.pre,w=g.body,T=g.post,P=v.split(",");P[P.length-1]+="{"+w+"}";var M=c(T);return T.length&&(P[P.length-1]+=M.shift(),P.push.apply(P,M)),h.push.apply(h,P),h}a(c,"parseCommaParts");function d(p){return p?(p.substr(0,2)==="{}"&&(p="\\{\\}"+p.substr(2)),F(l(p),!0).map(u)):[]}a(d,"expandTop");function f(p){return"{"+p+"}"}a(f,"embrace");function y(p){return/^-?0\d/.test(p)}a(y,"isPadded");function m(p,h){return p<=h}a(m,"lte");function b(p,h){return p>=h}a(b,"gte");function F(p,h){var g=[],v=e("{","}",p);if(!v)return[p];var w=v.pre,T=v.post.length?F(v.post,!1):[""];if(/\$$/.test(v.pre))for(var P=0;P<T.length;P++){var M=w+"{"+v.body+"}"+T[P];g.push(M)}else{var A=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(v.body),L=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(v.body),B=A||L,D=v.body.indexOf(",")>=0;if(!B&&!D)return v.post.match(/,(?!,).*\}/)?(p=v.pre+"{"+v.body+n+v.post,F(p)):[p];var N;if(B)N=v.body.split(/\.\./);else if(N=c(v.body),N.length===1&&(N=F(N[0],!1).map(f),N.length===1))return T.map(function(se){return v.pre+N[0]+se});var x;if(B){var Y=s(N[0]),he=s(N[1]),fe=Math.max(N[0].length,N[1].length),G=N.length==3?Math.abs(s(N[2])):1,O=m,H=he<Y;H&&(G*=-1,O=b);var W=N.some(y);x=[];for(var K=Y;O(K,he);K+=G){var re;if(L)re=String.fromCharCode(K),re==="\\"&&(re="");else if(re=String(K),W){var R=fe-re.length;if(R>0){var Z=new Array(R+1).join("0");K<0?re="-"+Z+re.slice(1):re=Z+re}}x.push(re)}}else{x=[];for(var ne=0;ne<N.length;ne++)x.push.apply(x,F(N[ne],!1))}for(var ne=0;ne<x.length;ne++)for(var P=0;P<T.length;P++){var M=w+x[ne]+T[P];(!h||B||M)&&g.push(M)}}return g}return a(F,"expand"),lm}a(XC,"requireBraceExpansion");var Ec,QC;function l9(){if(QC)return Ec;QC=1;const e=Ec=a((M,A,L={})=>(p(A),!L.nocomment&&A.charAt(0)==="#"?!1:new P(A,L).match(M)),"minimatch_1");Ec=e;const r=o9();e.sep=r.sep;const t=Symbol("globstar **");e.GLOBSTAR=t;const n=XC(),i={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},o="[^/]",s=o+"*?",l="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",u="(?:(?!(?:\\/|^)\\.).)*?",c=a(M=>M.split("").reduce((A,L)=>(A[L]=!0,A),{}),"charSet"),d=c("().*{}+?[]^$\\!"),f=c("[.("),y=/\/+/;e.filter=(M,A={})=>(L,B,D)=>e(L,M,A);const m=a((M,A={})=>{const L={};return Object.keys(M).forEach(B=>L[B]=M[B]),Object.keys(A).forEach(B=>L[B]=A[B]),L},"ext");e.defaults=M=>{if(!M||typeof M!="object"||!Object.keys(M).length)return e;const A=e,L=a((B,D,N)=>A(B,D,m(M,N)),"m");return L.Minimatch=class extends A.Minimatch{static{a(this,"Minimatch")}constructor(D,N){super(D,m(M,N))}},L.Minimatch.defaults=B=>A.defaults(m(M,B)).Minimatch,L.filter=(B,D)=>A.filter(B,m(M,D)),L.defaults=B=>A.defaults(m(M,B)),L.makeRe=(B,D)=>A.makeRe(B,m(M,D)),L.braceExpand=(B,D)=>A.braceExpand(B,m(M,D)),L.match=(B,D,N)=>A.match(B,D,m(M,N)),L},e.braceExpand=(M,A)=>b(M,A);const b=a((M,A={})=>(p(M),A.nobrace||!/\{(?:(?!\{).)*\}/.test(M)?[M]:n(M)),"braceExpand"),F=1024*64,p=a(M=>{if(typeof M!="string")throw new TypeError("invalid pattern");if(M.length>F)throw new TypeError("pattern is too long")},"assertValidPattern"),h=Symbol("subparse");e.makeRe=(M,A)=>new P(M,A||{}).makeRe(),e.match=(M,A,L={})=>{const B=new P(A,L);return M=M.filter(D=>B.match(D)),B.options.nonull&&!M.length&&M.push(A),M};const g=a(M=>M.replace(/\\(.)/g,"$1"),"globUnescape"),v=a(M=>M.replace(/\\([^-\]])/g,"$1"),"charUnescape"),w=a(M=>M.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),T=a(M=>M.replace(/[[\]\\]/g,"\\$&"),"braExpEscape");class P{static{a(this,"Minimatch")}constructor(A,L){p(A),L||(L={}),this.options=L,this.set=[],this.pattern=A,this.windowsPathsNoEscape=!!L.windowsPathsNoEscape||L.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!L.partial,this.make()}debug(){}make(){const A=this.pattern,L=this.options;if(!L.nocomment&&A.charAt(0)==="#"){this.comment=!0;return}if(!A){this.empty=!0;return}this.parseNegate();let B=this.globSet=this.braceExpand();L.debug&&(this.debug=(...D)=>console.error(...D)),this.debug(this.pattern,B),B=this.globParts=B.map(D=>D.split(y)),this.debug(this.pattern,B),B=B.map((D,N,x)=>D.map(this.parse,this)),this.debug(this.pattern,B),B=B.filter(D=>D.indexOf(!1)===-1),this.debug(this.pattern,B),this.set=B}parseNegate(){if(this.options.nonegate)return;const A=this.pattern;let L=!1,B=0;for(let D=0;D<A.length&&A.charAt(D)==="!";D++)L=!L,B++;B&&(this.pattern=A.slice(B)),this.negate=L}matchOne(A,L,B){var D=this.options;this.debug("matchOne",{this:this,file:A,pattern:L}),this.debug("matchOne",A.length,L.length);for(var N=0,x=0,Y=A.length,he=L.length;N<Y&&x<he;N++,x++){this.debug("matchOne loop");var fe=L[x],G=A[N];if(this.debug(L,fe,G),fe===!1)return!1;if(fe===t){this.debug("GLOBSTAR",[L,fe,G]);var O=N,H=x+1;if(H===he){for(this.debug("** at the end");N<Y;N++)if(A[N]==="."||A[N]===".."||!D.dot&&A[N].charAt(0)===".")return!1;return!0}for(;O<Y;){var W=A[O];if(this.debug(`
globstar while`,A,O,L,H,W),this.matchOne(A.slice(O),L.slice(H),B))return this.debug("globstar found match!",O,Y,W),!0;if(W==="."||W===".."||!D.dot&&W.charAt(0)==="."){this.debug("dot detected!",A,O,L,H);break}this.debug("globstar swallow a segment, and continue"),O++}return!!(B&&(this.debug(`
>>> no match, partial?`,A,O,L,H),O===Y))}var K;if(typeof fe=="string"?(K=G===fe,this.debug("string match",fe,G,K)):(K=G.match(fe),this.debug("pattern match",fe,G,K)),!K)return!1}if(N===Y&&x===he)return!0;if(N===Y)return B;if(x===he)return N===Y-1&&A[N]==="";throw new Error("wtf?")}braceExpand(){return b(this.pattern,this.options)}parse(A,L){p(A);const B=this.options;if(A==="**")if(B.noglobstar)A="*";else return t;if(A==="")return"";let D="",N=!1,x=!1;const Y=[],he=[];let fe,G=!1,O=-1,H=-1,W,K,re,R=A.charAt(0)===".",Z=B.dot||R;const ne=a(()=>R?"":Z?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)","patternStart"),se=a(j=>j.charAt(0)==="."?"":B.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)","subPatternStart"),C=a(()=>{if(fe){switch(fe){case"*":D+=s,N=!0;break;case"?":D+=o,N=!0;break;default:D+="\\"+fe;break}this.debug("clearStateChar %j %j",fe,D),fe=!1}},"clearStateChar");for(let j=0,z;j<A.length&&(z=A.charAt(j));j++){if(this.debug("%s %s %s %j",A,j,D,z),x){if(z==="/")return!1;d[z]&&(D+="\\"),D+=z,x=!1;continue}switch(z){case"/":return!1;case"\\":if(G&&A.charAt(j+1)==="-"){D+=z;continue}C(),x=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",A,j,D,z),G){this.debug(" in class"),z==="!"&&j===H+1&&(z="^"),D+=z;continue}this.debug("call clearStateChar %j",fe),C(),fe=z,B.noext&&C();continue;case"(":{if(G){D+="(";continue}if(!fe){D+="\\(";continue}const U={type:fe,start:j-1,reStart:D.length,open:i[fe].open,close:i[fe].close};this.debug(this.pattern," ",U),Y.push(U),D+=U.open,U.start===0&&U.type!=="!"&&(R=!0,D+=se(A.slice(j+1))),this.debug("plType %j %j",fe,D),fe=!1;continue}case")":{const U=Y[Y.length-1];if(G||!U){D+="\\)";continue}Y.pop(),C(),N=!0,K=U,D+=K.close,K.type==="!"&&he.push(Object.assign(K,{reEnd:D.length}));continue}case"|":{const U=Y[Y.length-1];if(G||!U){D+="\\|";continue}C(),D+="|",U.start===0&&U.type!=="!"&&(R=!0,D+=se(A.slice(j+1)));continue}case"[":if(C(),G){D+="\\"+z;continue}G=!0,H=j,O=D.length,D+=z;continue;case"]":if(j===H+1||!G){D+="\\"+z;continue}W=A.substring(H+1,j);try{RegExp("["+T(v(W))+"]"),D+=z}catch{D=D.substring(0,O)+"(?:$.)"}N=!0,G=!1;continue;default:C(),d[z]&&!(z==="^"&&G)&&(D+="\\"),D+=z;break}}for(G&&(W=A.slice(H+1),re=this.parse(W,h),D=D.substring(0,O)+"\\["+re[0],N=N||re[1]),K=Y.pop();K;K=Y.pop()){let j;j=D.slice(K.reStart+K.open.length),this.debug("setting tail",D,K),j=j.replace(/((?:\\{2}){0,64})(\\?)\|/g,(U,I,S)=>(S||(S="\\"),I+I+S+"|")),this.debug(`tail=%j
%s`,j,j,K,D);const z=K.type==="*"?s:K.type==="?"?o:"\\"+K.type;N=!0,D=D.slice(0,K.reStart)+z+"\\("+j}C(),x&&(D+="\\\\");const E=f[D.charAt(0)];for(let j=he.length-1;j>-1;j--){const z=he[j],U=D.slice(0,z.reStart),I=D.slice(z.reStart,z.reEnd-8);let S=D.slice(z.reEnd);const k=D.slice(z.reEnd-8,z.reEnd)+S,$=U.split(")").length,Q=U.split("(").length-$;let le=S;for(let ce=0;ce<Q;ce++)le=le.replace(/\)[+*?]?/,"");S=le;const ee=S===""&&L!==h?"(?:$|\\/)":"";D=U+I+S+ee+k}if(D!==""&&N&&(D="(?=.)"+D),E&&(D=ne()+D),L===h)return[D,N];if(B.nocase&&!N&&(N=A.toUpperCase()!==A.toLowerCase()),!N)return g(A);const q=B.nocase?"i":"";try{return Object.assign(new RegExp("^"+D+"$",q),{_glob:A,_src:D})}catch{return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;const A=this.set;if(!A.length)return this.regexp=!1,this.regexp;const L=this.options,B=L.noglobstar?s:L.dot?l:u,D=L.nocase?"i":"";let N=A.map(x=>(x=x.map(Y=>typeof Y=="string"?w(Y):Y===t?t:Y._src).reduce((Y,he)=>(Y[Y.length-1]===t&&he===t||Y.push(he),Y),[]),x.forEach((Y,he)=>{Y!==t||x[he-1]===t||(he===0?x.length>1?x[he+1]="(?:\\/|"+B+"\\/)?"+x[he+1]:x[he]=B:he===x.length-1?x[he-1]+="(?:\\/|"+B+")?":(x[he-1]+="(?:\\/|\\/"+B+"\\/)"+x[he+1],x[he+1]=t))}),x.filter(Y=>Y!==t).join("/"))).join("|");N="^(?:"+N+")$",this.negate&&(N="^(?!"+N+").*$");try{this.regexp=new RegExp(N,D)}catch{this.regexp=!1}return this.regexp}match(A,L=this.partial){if(this.debug("match",A,this.pattern),this.comment)return!1;if(this.empty)return A==="";if(A==="/"&&L)return!0;const B=this.options;r.sep!=="/"&&(A=A.split(r.sep).join("/")),A=A.split(y),this.debug(this.pattern,"split",A);const D=this.set;this.debug(this.pattern,"set",D);let N;for(let x=A.length-1;x>=0&&(N=A[x],!N);x--);for(let x=0;x<D.length;x++){const Y=D[x];let he=A;if(B.matchBase&&Y.length===1&&(he=[N]),this.matchOne(he,Y,L))return B.flipNegate?!0:!this.negate}return B.flipNegate?!1:this.negate}static defaults(A){return e.defaults(A).Minimatch}}return e.Minimatch=P,Ec}a(l9,"requireMinimatch");var um,ew;function u9(){if(ew)return um;ew=1,um=d;const e=ot,{EventEmitter:r}=Za,{Minimatch:t}=l9(),{resolve:n}=tt;function i(f,y){return new Promise((m,b)=>{e.readdir(f,{withFileTypes:!0},(F,p)=>{if(F)switch(F.code){case"ENOTDIR":y?b(F):m([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":m([]);break;case"ELOOP":default:b(F);break}else m(p)})})}a(i,"readdir");function o(f,y){return new Promise((m,b)=>{(y?e.stat:e.lstat)(f,(p,h)=>{if(p)switch(p.code){case"ENOENT":m(y?o(f,!1):null);break;default:m(null);break}else m(h)})})}a(o,"stat");async function*s(f,y,m,b,F,p){let h=await i(y+f,p);for(const g of h){let v=g.name;v===void 0&&(v=g,b=!0);const w=f+"/"+v,T=w.slice(1),P=y+"/"+T;let M=null;(b||m)&&(M=await o(P,m)),!M&&g.name!==void 0&&(M=g),M===null&&(M={isDirectory:a(()=>!1,"isDirectory")}),M.isDirectory()?F(T)||(yield{relative:T,absolute:P,stats:M},yield*s(w,y,m,b,F,!1)):yield{relative:T,absolute:P,stats:M}}}a(s,"exploreWalkAsync");async function*l(f,y,m,b){yield*s("",f,y,m,b,!0)}a(l,"explore");function u(f){return{pattern:f.pattern,dot:!!f.dot,noglobstar:!!f.noglobstar,matchBase:!!f.matchBase,nocase:!!f.nocase,ignore:f.ignore,skip:f.skip,follow:!!f.follow,stat:!!f.stat,nodir:!!f.nodir,mark:!!f.mark,silent:!!f.silent,absolute:!!f.absolute}}a(u,"readOptions");class c extends r{static{a(this,"ReaddirGlob")}constructor(y,m,b){if(super(),typeof m=="function"&&(b=m,m=null),this.options=u(m||{}),this.matchers=[],this.options.pattern){const F=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=F.map(p=>new t(p,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){const F=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=F.map(p=>new t(p,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){const F=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=F.map(p=>new t(p,{dot:!0}))}this.iterator=l(n(y||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,b&&(this._matches=[],this.on("match",F=>this._matches.push(this.options.absolute?F.absolute:F.relative)),this.on("error",F=>b(F)),this.on("end",()=>b(null,this._matches))),setTimeout(()=>this._next(),0)}_shouldSkipDirectory(y){return this.skipMatchers.some(m=>m.match(y))}_fileMatches(y,m){const b=y+(m?"/":"");return(this.matchers.length===0||this.matchers.some(F=>F.match(b)))&&!this.ignoreMatchers.some(F=>F.match(b))&&(!this.options.nodir||!m)}_next(){!this.paused&&!this.aborted?this.iterator.next().then(y=>{if(y.done)this.emit("end");else{const m=y.value.stats.isDirectory();if(this._fileMatches(y.value.relative,m)){let b=y.value.relative,F=y.value.absolute;this.options.mark&&m&&(b+="/",F+="/"),this.options.stat?this.emit("match",{relative:b,absolute:F,stat:y.value.stats}):this.emit("match",{relative:b,absolute:F})}this._next(this.iterator)}}).catch(y=>{this.abort(),this.emit("error",y),!y.code&&!this.options.silent&&console.error(y)}):this.inactive=!0}abort(){this.aborted=!0}pause(){this.paused=!0}resume(){this.paused=!1,this.inactive&&(this.inactive=!1,this._next())}}function d(f,y,m){return new c(f,y,m)}return a(d,"readdirGlob"),d.ReaddirGlob=c,um}a(u9,"requireReaddirGlob");function tw(e,...r){return(...t)=>e(...r,...t)}a(tw,"apply");function Vl(e){return function(...r){var t=r.pop();return e.call(this,r,t)}}a(Vl,"initialParams");var c9=typeof queueMicrotask=="function"&&queueMicrotask,rw=typeof setImmediate=="function"&&setImmediate,nw=typeof process=="object"&&typeof process.nextTick=="function";function aw(e){setTimeout(e,0)}a(aw,"fallback");function iw(e){return(r,...t)=>e(()=>r(...t))}a(iw,"wrap");var Jl;c9?Jl=queueMicrotask:rw?Jl=setImmediate:nw?Jl=process.nextTick:Jl=aw;var Qa=iw(Jl);function Yl(e){return Zl(e)?function(...r){const t=r.pop(),n=e.apply(this,r);return ow(n,t)}:Vl(function(r,t){var n;try{n=e.apply(this,r)}catch(i){return t(i)}if(n&&typeof n.then=="function")return ow(n,t);t(null,n)})}a(Yl,"asyncify");function ow(e,r){return e.then(t=>{sw(r,null,t)},t=>{sw(r,t&&(t instanceof Error||t.message)?t:new Error(t))})}a(ow,"handlePromise");function sw(e,r,t){try{e(r,t)}catch(n){Qa(i=>{throw i},n)}}a(sw,"invokeCallback");function Zl(e){return e[Symbol.toStringTag]==="AsyncFunction"}a(Zl,"isAsync");function d9(e){return e[Symbol.toStringTag]==="AsyncGenerator"}a(d9,"isAsyncGenerator");function h9(e){return typeof e[Symbol.asyncIterator]=="function"}a(h9,"isAsyncIterable");function kt(e){if(typeof e!="function")throw new Error("expected a function");return Zl(e)?Yl(e):e}a(kt,"wrapAsync");function Et(e,r){if(r||(r=e.length),!r)throw new Error("arity is undefined");function t(...n){return typeof n[r-1]=="function"?e.apply(this,n):new Promise((i,o)=>{n[r-1]=(s,...l)=>{if(s)return o(s);i(l.length>1?l:l[0])},e.apply(this,n)})}return a(t,"awaitable"),t}a(Et,"awaitify");function lw(e){return a(function(t,...n){return Et(function(o){var s=this;return e(t,(l,u)=>{kt(l).apply(s,n.concat(u))},o)})},"applyEach2")}a(lw,"applyEach$1");function cm(e,r,t,n){r=r||[];var i=[],o=0,s=kt(t);return e(r,(l,u,c)=>{var d=o++;s(l,(f,y)=>{i[d]=y,c(f)})},l=>{n(l,i)})}a(cm,"_asyncMap");function _c(e){return e&&typeof e.length=="number"&&e.length>=0&&e.length%1===0}a(_c,"isArrayLike");const kc={};function ei(e){function r(...t){if(e!==null){var n=e;e=null,n.apply(this,t)}}return a(r,"wrapper"),Object.assign(r,e),r}a(ei,"once");function f9(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}a(f9,"getIterator");function m9(e){var r=-1,t=e.length;return a(function(){return++r<t?{value:e[r],key:r}:null},"next")}a(m9,"createArrayIterator");function p9(e){var r=-1;return a(function(){var n=e.next();return n.done?null:(r++,{value:n.value,key:r})},"next")}a(p9,"createES2015Iterator");function y9(e){var r=e?Object.keys(e):[],t=-1,n=r.length;return a(function i(){var o=r[++t];return o==="__proto__"?i():t<n?{value:e[o],key:o}:null},"next")}a(y9,"createObjectIterator");function g9(e){if(_c(e))return m9(e);var r=f9(e);return r?p9(r):y9(e)}a(g9,"createIterator");function ti(e){return function(...r){if(e===null)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,r)}}a(ti,"onlyOnce");function uw(e,r,t,n){let i=!1,o=!1,s=!1,l=0,u=0;function c(){l>=r||s||i||(s=!0,e.next().then(({value:y,done:m})=>{if(!(o||i)){if(s=!1,m){i=!0,l<=0&&n(null);return}l++,t(y,u,d),u++,c()}}).catch(f))}a(c,"replenish");function d(y,m){if(l-=1,!o){if(y)return f(y);if(y===!1){i=!0,o=!0;return}if(m===kc||i&&l<=0)return i=!0,n(null);c()}}a(d,"iterateeCallback");function f(y){o||(s=!1,i=!0,n(y))}a(f,"handleError"),c()}a(uw,"asyncEachOfLimit");var oa=a(e=>(r,t,n)=>{if(n=ei(n),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!r)return n(null);if(d9(r))return uw(r,e,t,n);if(h9(r))return uw(r[Symbol.asyncIterator](),e,t,n);var i=g9(r),o=!1,s=!1,l=0,u=!1;function c(f,y){if(!s)if(l-=1,f)o=!0,n(f);else if(f===!1)o=!0,s=!0;else{if(y===kc||o&&l<=0)return o=!0,n(null);u||d()}}a(c,"iterateeCallback");function d(){for(u=!0;l<e&&!o;){var f=i();if(f===null){o=!0,l<=0&&n(null);return}l+=1,t(f.value,f.key,ti(c))}u=!1}a(d,"replenish"),d()},"eachOfLimit$2");function b9(e,r,t,n){return oa(r)(e,kt(t),n)}a(b9,"eachOfLimit");var ts=Et(b9,4);function F9(e,r,t){t=ei(t);var n=0,i=0,{length:o}=e,s=!1;o===0&&t(null);function l(u,c){u===!1&&(s=!0),s!==!0&&(u?t(u):(++i===o||c===kc)&&t(null))}for(a(l,"iteratorCallback");n<o;n++)r(e[n],n,ti(l))}a(F9,"eachOfArrayLike");function v9(e,r,t){return ts(e,1/0,r,t)}a(v9,"eachOfGeneric");function S9(e,r,t){var n=_c(e)?F9:v9;return n(e,kt(r),t)}a(S9,"eachOf");var Mn=Et(S9,3);function C9(e,r,t){return cm(Mn,e,r,t)}a(C9,"map$2");var Ac=Et(C9,3),cw=lw(Ac);function w9(e,r,t){return ts(e,1,r,t)}a(w9,"eachOfSeries");var sa=Et(w9,3);function E9(e,r,t){return cm(sa,e,r,t)}a(E9,"mapSeries");var dm=Et(E9,3),dw=lw(dm);const rs=Symbol("promiseCallback");function ns(){let e,r;function t(n,...i){if(n)return r(n);e(i.length>1?i:i[0])}return a(t,"callback"),t[rs]=new Promise((n,i)=>{e=n,r=i}),t}a(ns,"promiseCallback");function hm(e,r,t){typeof r!="number"&&(t=r,r=null),t=ei(t||ns());var n=Object.keys(e).length;if(!n)return t(null);r||(r=n);var i={},o=0,s=!1,l=!1,u=Object.create(null),c=[],d=[],f={};Object.keys(e).forEach(v=>{var w=e[v];if(!Array.isArray(w)){y(v,[w]),d.push(v);return}var T=w.slice(0,w.length-1),P=T.length;if(P===0){y(v,w),d.push(v);return}f[v]=P,T.forEach(M=>{if(!e[M])throw new Error("async.auto task `"+v+"` has a non-existent dependency `"+M+"` in "+T.join(", "));b(M,()=>{P--,P===0&&y(v,w)})})}),h(),m();function y(v,w){c.push(()=>p(v,w))}a(y,"enqueueTask");function m(){if(!s){if(c.length===0&&o===0)return t(null,i);for(;c.length&&o<r;){var v=c.shift();v()}}}a(m,"processQueue");function b(v,w){var T=u[v];T||(T=u[v]=[]),T.push(w)}a(b,"addListener");function F(v){var w=u[v]||[];w.forEach(T=>T()),m()}a(F,"taskComplete");function p(v,w){if(!l){var T=ti((M,...A)=>{if(o--,M===!1){s=!0;return}if(A.length<2&&([A]=A),M){var L={};if(Object.keys(i).forEach(B=>{L[B]=i[B]}),L[v]=A,l=!0,u=Object.create(null),s)return;t(M,L)}else i[v]=A,F(v)});o++;var P=kt(w[w.length-1]);w.length>1?P(i,T):P(T)}}a(p,"runTask");function h(){for(var v,w=0;d.length;)v=d.pop(),w++,g(v).forEach(T=>{--f[T]===0&&d.push(T)});if(w!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}a(h,"checkForDeadlocks");function g(v){var w=[];return Object.keys(e).forEach(T=>{const P=e[T];Array.isArray(P)&&P.indexOf(v)>=0&&w.push(T)}),w}return a(g,"getDependents"),t[rs]}a(hm,"auto");var _9=/^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/,k9=/^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/,A9=/,/,T9=/(=.+)?(\s*)$/;function D9(e){let r="",t=0,n=e.indexOf("*/");for(;t<e.length;)if(e[t]==="/"&&e[t+1]==="/"){let i=e.indexOf(`
`,t);t=i===-1?e.length:i}else if(n!==-1&&e[t]==="/"&&e[t+1]==="*"){let i=e.indexOf("*/",t);i!==-1?(t=i+2,n=e.indexOf("*/",t)):(r+=e[t],t++)}else r+=e[t],t++;return r}a(D9,"stripComments");function B9(e){const r=D9(e.toString());let t=r.match(_9);if(t||(t=r.match(k9)),!t)throw new Error(`could not parse args in autoInject
Source:
`+r);let[,n]=t;return n.replace(/\s/g,"").split(A9).map(i=>i.replace(T9,"").trim())}a(B9,"parseParams");function hw(e,r){var t={};return Object.keys(e).forEach(n=>{var i=e[n],o,s=Zl(i),l=!s&&i.length===1||s&&i.length===0;if(Array.isArray(i))o=[...i],i=o.pop(),t[n]=o.concat(o.length>0?u:i);else if(l)t[n]=i;else{if(o=B9(i),i.length===0&&!s&&o.length===0)throw new Error("autoInject task functions require explicit parameters.");s||o.pop(),t[n]=o.concat(u)}function u(c,d){var f=o.map(y=>c[y]);f.push(d),kt(i)(...f)}a(u,"newTask")}),hm(t,r)}a(hw,"autoInject");class R9{static{a(this,"DLL")}constructor(){this.head=this.tail=null,this.length=0}removeLink(r){return r.prev?r.prev.next=r.next:this.head=r.next,r.next?r.next.prev=r.prev:this.tail=r.prev,r.prev=r.next=null,this.length-=1,r}empty(){for(;this.head;)this.shift();return this}insertAfter(r,t){t.prev=r,t.next=r.next,r.next?r.next.prev=t:this.tail=t,r.next=t,this.length+=1}insertBefore(r,t){t.prev=r.prev,t.next=r,r.prev?r.prev.next=t:this.head=t,r.prev=t,this.length+=1}unshift(r){this.head?this.insertBefore(this.head,r):fw(this,r)}push(r){this.tail?this.insertAfter(this.tail,r):fw(this,r)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var r=this.head;r;)yield r.data,r=r.next}remove(r){for(var t=this.head;t;){var{next:n}=t;r(t)&&this.removeLink(t),t=n}return this}}function fw(e,r){e.length=1,e.head=e.tail=r}a(fw,"setInitial");function fm(e,r,t){if(r==null)r=1;else if(r===0)throw new RangeError("Concurrency must not be zero");var n=kt(e),i=0,o=[];const s={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function l(g,v){s[g].push(v)}a(l,"on");function u(g,v){const w=a((...T)=>{c(g,w),v(...T)},"handleAndRemove");s[g].push(w)}a(u,"once2");function c(g,v){if(!g)return Object.keys(s).forEach(w=>s[w]=[]);if(!v)return s[g]=[];s[g]=s[g].filter(w=>w!==v)}a(c,"off");function d(g,...v){s[g].forEach(w=>w(...v))}a(d,"trigger");var f=!1;function y(g,v,w,T){if(T!=null&&typeof T!="function")throw new Error("task callback must be a function");h.started=!0;var P,M;function A(B,...D){if(B)return w?M(B):P();if(D.length<=1)return P(D[0]);P(D)}a(A,"promiseCallback2");var L=h._createTaskItem(g,w?A:T||A);if(v?h._tasks.unshift(L):h._tasks.push(L),f||(f=!0,Qa(()=>{f=!1,h.process()})),w||!T)return new Promise((B,D)=>{P=B,M=D})}a(y,"_insert");function m(g){return function(v,...w){i-=1;for(var T=0,P=g.length;T<P;T++){var M=g[T],A=o.indexOf(M);A===0?o.shift():A>0&&o.splice(A,1),M.callback(v,...w),v!=null&&d("error",v,M.data)}i<=h.concurrency-h.buffer&&d("unsaturated"),h.idle()&&d("drain"),h.process()}}a(m,"_createCB");function b(g){return g.length===0&&h.idle()?(Qa(()=>d("drain")),!0):!1}a(b,"_maybeDrain");const F=a(g=>v=>{if(!v)return new Promise((w,T)=>{u(g,(P,M)=>{if(P)return T(P);w(M)})});c(g),l(g,v)},"eventMethod");var p=!1,h={_tasks:new R9,_createTaskItem(g,v){return{data:g,callback:v}},*[Symbol.iterator](){yield*h._tasks[Symbol.iterator]()},concurrency:r,payload:t,buffer:r/4,started:!1,paused:!1,push(g,v){return Array.isArray(g)?b(g)?void 0:g.map(w=>y(w,!1,!1,v)):y(g,!1,!1,v)},pushAsync(g,v){return Array.isArray(g)?b(g)?void 0:g.map(w=>y(w,!1,!0,v)):y(g,!1,!0,v)},kill(){c(),h._tasks.empty()},unshift(g,v){return Array.isArray(g)?b(g)?void 0:g.map(w=>y(w,!0,!1,v)):y(g,!0,!1,v)},unshiftAsync(g,v){return Array.isArray(g)?b(g)?void 0:g.map(w=>y(w,!0,!0,v)):y(g,!0,!0,v)},remove(g){h._tasks.remove(g)},process(){if(!p){for(p=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var g=[],v=[],w=h._tasks.length;h.payload&&(w=Math.min(w,h.payload));for(var T=0;T<w;T++){var P=h._tasks.shift();g.push(P),o.push(P),v.push(P.data)}i+=1,h._tasks.length===0&&d("empty"),i===h.concurrency&&d("saturated");var M=ti(m(g));n(v,M)}p=!1}},length(){return h._tasks.length},running(){return i},workersList(){return o},idle(){return h._tasks.length+i===0},pause(){h.paused=!0},resume(){h.paused!==!1&&(h.paused=!1,Qa(h.process))}};return Object.defineProperties(h,{saturated:{writable:!1,value:F("saturated")},unsaturated:{writable:!1,value:F("unsaturated")},empty:{writable:!1,value:F("empty")},drain:{writable:!1,value:F("drain")},error:{writable:!1,value:F("error")}}),h}a(fm,"queue$1");function mw(e,r){return fm(e,1,r)}a(mw,"cargo$1");function pw(e,r,t){return fm(e,r,t)}a(pw,"cargo");function x9(e,r,t,n){n=ei(n);var i=kt(t);return sa(e,(o,s,l)=>{i(r,o,(u,c)=>{r=c,l(u)})},o=>n(o,r))}a(x9,"reduce$1");var ri=Et(x9,4);function mm(...e){var r=e.map(kt);return function(...t){var n=this,i=t[t.length-1];return typeof i=="function"?t.pop():i=ns(),ri(r,t,(o,s,l)=>{s.apply(n,o.concat((u,...c)=>{l(u,c)}))},(o,s)=>i(o,...s)),i[rs]}}a(mm,"seq");function yw(...e){return mm(...e.reverse())}a(yw,"compose$1");function P9(e,r,t,n){return cm(oa(r),e,t,n)}a(P9,"mapLimit");var Xl=Et(P9,4);function M9(e,r,t,n){var i=kt(t);return Xl(e,r,(o,s)=>{i(o,(l,...u)=>l?s(l):s(l,u))},(o,s)=>{for(var l=[],u=0;u<s.length;u++)s[u]&&(l=l.concat(...s[u]));return n(o,l)})}a(M9,"concatLimit");var as=Et(M9,4);function I9(e,r,t){return as(e,1/0,r,t)}a(I9,"concat");var Tc=Et(I9,3);function O9(e,r,t){return as(e,1,r,t)}a(O9,"concatSeries");var Dc=Et(O9,3);function gw(...e){return function(...r){var t=r.pop();return t(null,...e)}}a(gw,"constant$1");function Oa(e,r){return(t,n,i,o)=>{var s=!1,l;const u=kt(i);t(n,(c,d,f)=>{u(c,(y,m)=>{if(y||y===!1)return f(y);if(e(m)&&!l)return s=!0,l=r(!0,c),f(null,kc);f()})},c=>{if(c)return o(c);o(null,s?l:r(!1))})}}a(Oa,"_createTester");function L9(e,r,t){return Oa(n=>n,(n,i)=>i)(Mn,e,r,t)}a(L9,"detect");var Bc=Et(L9,3);function N9(e,r,t,n){return Oa(i=>i,(i,o)=>o)(oa(r),e,t,n)}a(N9,"detectLimit");var Rc=Et(N9,4);function H9(e,r,t){return Oa(n=>n,(n,i)=>i)(oa(1),e,r,t)}a(H9,"detectSeries");var xc=Et(H9,3);function bw(e){return(r,...t)=>kt(r)(...t,(n,...i)=>{typeof console=="object"&&(n?console.error&&console.error(n):console[e]&&i.forEach(o=>console[e](o)))})}a(bw,"consoleFunc");var Fw=bw("dir");function G9(e,r,t){t=ti(t);var n=kt(e),i=kt(r),o;function s(u,...c){if(u)return t(u);u!==!1&&(o=c,i(...c,l))}a(s,"next");function l(u,c){if(u)return t(u);if(u!==!1){if(!c)return t(null,...o);n(s)}}return a(l,"check"),l(null,!0)}a(G9,"doWhilst");var Ql=Et(G9,3);function vw(e,r,t){const n=kt(r);return Ql(e,(...i)=>{const o=i.pop();n(...i,(s,l)=>o(s,!l))},t)}a(vw,"doUntil");function Sw(e){return(r,t,n)=>e(r,n)}a(Sw,"_withoutIndex");function W9(e,r,t){return Mn(e,Sw(kt(r)),t)}a(W9,"eachLimit$2");var Pc=Et(W9,3);function j9(e,r,t,n){return oa(r)(e,Sw(kt(t)),n)}a(j9,"eachLimit");var eu=Et(j9,4);function $9(e,r,t){return eu(e,1,r,t)}a($9,"eachSeries");var tu=Et($9,3);function pm(e){return Zl(e)?e:function(...r){var t=r.pop(),n=!0;r.push((...i)=>{n?Qa(()=>t(...i)):t(...i)}),e.apply(this,r),n=!1}}a(pm,"ensureAsync");function z9(e,r,t){return Oa(n=>!n,n=>!n)(Mn,e,r,t)}a(z9,"every");var Mc=Et(z9,3);function q9(e,r,t,n){return Oa(i=>!i,i=>!i)(oa(r),e,t,n)}a(q9,"everyLimit");var Ic=Et(q9,4);function U9(e,r,t){return Oa(n=>!n,n=>!n)(sa,e,r,t)}a(U9,"everySeries");var Oc=Et(U9,3);function K9(e,r,t,n){var i=new Array(r.length);e(r,(o,s,l)=>{t(o,(u,c)=>{i[s]=!!c,l(u)})},o=>{if(o)return n(o);for(var s=[],l=0;l<r.length;l++)i[l]&&s.push(r[l]);n(null,s)})}a(K9,"filterArray");function V9(e,r,t,n){var i=[];e(r,(o,s,l)=>{t(o,(u,c)=>{if(u)return l(u);c&&i.push({index:s,value:o}),l(u)})},o=>{if(o)return n(o);n(null,i.sort((s,l)=>s.index-l.index).map(s=>s.value))})}a(V9,"filterGeneric");function Lc(e,r,t,n){var i=_c(r)?K9:V9;return i(e,r,kt(t),n)}a(Lc,"_filter");function J9(e,r,t){return Lc(Mn,e,r,t)}a(J9,"filter$1");var Nc=Et(J9,3);function Y9(e,r,t,n){return Lc(oa(r),e,t,n)}a(Y9,"filterLimit");var Hc=Et(Y9,4);function Z9(e,r,t){return Lc(sa,e,r,t)}a(Z9,"filterSeries");var Gc=Et(Z9,3);function X9(e,r){var t=ti(r),n=kt(pm(e));function i(o){if(o)return t(o);o!==!1&&n(i)}return a(i,"next"),i()}a(X9,"forever");var Cw=Et(X9,2);function Q9(e,r,t,n){var i=kt(t);return Xl(e,r,(o,s)=>{i(o,(l,u)=>l?s(l):s(l,{key:u,val:o}))},(o,s)=>{for(var l={},{hasOwnProperty:u}=Object.prototype,c=0;c<s.length;c++)if(s[c]){var{key:d}=s[c],{val:f}=s[c];u.call(l,d)?l[d].push(f):l[d]=[f]}return n(o,l)})}a(Q9,"groupByLimit");var Wc=Et(Q9,4);function ww(e,r,t){return Wc(e,1/0,r,t)}a(ww,"groupBy");function Ew(e,r,t){return Wc(e,1,r,t)}a(Ew,"groupBySeries");var _w=bw("log");function e5(e,r,t,n){n=ei(n);var i={},o=kt(t);return oa(r)(e,(s,l,u)=>{o(s,l,(c,d)=>{if(c)return u(c);i[l]=d,u(c)})},s=>n(s,i))}a(e5,"mapValuesLimit");var jc=Et(e5,4);function kw(e,r,t){return jc(e,1/0,r,t)}a(kw,"mapValues");function Aw(e,r,t){return jc(e,1,r,t)}a(Aw,"mapValuesSeries");function Tw(e,r=t=>t){var t=Object.create(null),n=Object.create(null),i=kt(e),o=Vl((s,l)=>{var u=r(...s);u in t?Qa(()=>l(null,...t[u])):u in n?n[u].push(l):(n[u]=[l],i(...s,(c,...d)=>{c||(t[u]=d);var f=n[u];delete n[u];for(var y=0,m=f.length;y<m;y++)f[y](c,...d)}))});return o.memo=t,o.unmemoized=e,o}a(Tw,"memoize$1");var $c;nw?$c=process.nextTick:rw?$c=setImmediate:$c=aw;var Dw=iw($c),ym=Et((e,r,t)=>{var n=_c(r)?[]:{};e(r,(i,o,s)=>{kt(i)((l,...u)=>{u.length<2&&([u]=u),n[o]=u,s(l)})},i=>t(i,n))},3);function Bw(e,r){return ym(Mn,e,r)}a(Bw,"parallel");function Rw(e,r,t){return ym(oa(r),e,t)}a(Rw,"parallelLimit");function gm(e,r){var t=kt(e);return fm((n,i)=>{t(n[0],i)},r,1)}a(gm,"queue$2");class t5{static{a(this,"Heap")}constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(r){let t;for(;r>0&&bm(this.heap[r],this.heap[t=xw(r)]);){let n=this.heap[r];this.heap[r]=this.heap[t],this.heap[t]=n,r=t}}percDown(r){let t;for(;(t=r5(r))<this.heap.length&&(t+1<this.heap.length&&bm(this.heap[t+1],this.heap[t])&&(t=t+1),!bm(this.heap[r],this.heap[t]));){let n=this.heap[r];this.heap[r]=this.heap[t],this.heap[t]=n,r=t}}push(r){r.pushCount=++this.pushCount,this.heap.push(r),this.percUp(this.heap.length-1)}unshift(r){return this.heap.push(r)}shift(){let[r]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),r}toArray(){return[...this]}*[Symbol.iterator](){for(let r=0;r<this.heap.length;r++)yield this.heap[r].data}remove(r){let t=0;for(let n=0;n<this.heap.length;n++)r(this.heap[n])||(this.heap[t]=this.heap[n],t++);this.heap.splice(t);for(let n=xw(this.heap.length-1);n>=0;n--)this.percDown(n);return this}}function r5(e){return(e<<1)+1}a(r5,"leftChi");function xw(e){return(e+1>>1)-1}a(xw,"parent");function bm(e,r){return e.priority!==r.priority?e.priority<r.priority:e.pushCount<r.pushCount}a(bm,"smaller");function Pw(e,r){var t=gm(e,r),{push:n,pushAsync:i}=t;t._tasks=new t5,t._createTaskItem=({data:s,priority:l},u)=>({data:s,priority:l,callback:u});function o(s,l){return Array.isArray(s)?s.map(u=>({data:u,priority:l})):{data:s,priority:l}}return a(o,"createDataItems"),t.push=function(s,l=0,u){return n(o(s,l),u)},t.pushAsync=function(s,l=0,u){return i(o(s,l),u)},delete t.unshift,delete t.unshiftAsync,t}a(Pw,"priorityQueue");function n5(e,r){if(r=ei(r),!Array.isArray(e))return r(new TypeError("First argument to race must be an array of functions"));if(!e.length)return r();for(var t=0,n=e.length;t<n;t++)kt(e[t])(r)}a(n5,"race$1");var Mw=Et(n5,2);function zc(e,r,t,n){var i=[...e].reverse();return ri(i,r,t,n)}a(zc,"reduceRight");function qc(e){var r=kt(e);return Vl(a(function(n,i){return n.push((o,...s)=>{let l={};if(o&&(l.error=o),s.length>0){var u=s;s.length<=1&&([u]=s),l.value=u}i(null,l)}),r.apply(this,n)},"reflectOn"))}a(qc,"reflect");function Iw(e){var r;return Array.isArray(e)?r=e.map(qc):(r={},Object.keys(e).forEach(t=>{r[t]=qc.call(this,e[t])})),r}a(Iw,"reflectAll");function Fm(e,r,t,n){const i=kt(t);return Lc(e,r,(o,s)=>{i(o,(l,u)=>{s(l,!u)})},n)}a(Fm,"reject$2");function a5(e,r,t){return Fm(Mn,e,r,t)}a(a5,"reject");var Ow=Et(a5,3);function i5(e,r,t,n){return Fm(oa(r),e,t,n)}a(i5,"rejectLimit");var Lw=Et(i5,4);function o5(e,r,t){return Fm(sa,e,r,t)}a(o5,"rejectSeries");var Nw=Et(o5,3);function Hw(e){return function(){return e}}a(Hw,"constant");const vm=5,Gw=0;function Uc(e,r,t){var n={times:vm,intervalFunc:Hw(Gw)};if(arguments.length<3&&typeof e=="function"?(t=r||ns(),r=e):(s5(n,e),t=t||ns()),typeof r!="function")throw new Error("Invalid arguments for async.retry");var i=kt(r),o=1;function s(){i((l,...u)=>{l!==!1&&(l&&o++<n.times&&(typeof n.errorFilter!="function"||n.errorFilter(l))?setTimeout(s,n.intervalFunc(o-1)):t(l,...u))})}return a(s,"retryAttempt"),s(),t[rs]}a(Uc,"retry");function s5(e,r){if(typeof r=="object")e.times=+r.times||vm,e.intervalFunc=typeof r.interval=="function"?r.interval:Hw(+r.interval||Gw),e.errorFilter=r.errorFilter;else if(typeof r=="number"||typeof r=="string")e.times=+r||vm;else throw new Error("Invalid arguments for async.retry")}a(s5,"parseTimes");function Ww(e,r){r||(r=e,e=null);let t=e&&e.arity||r.length;Zl(r)&&(t+=1);var n=kt(r);return Vl((i,o)=>{(i.length<t-1||o==null)&&(i.push(o),o=ns());function s(l){n(...i,l)}return a(s,"taskFn"),e?Uc(e,s,o):Uc(s,o),o[rs]})}a(Ww,"retryable");function jw(e,r){return ym(sa,e,r)}a(jw,"series");function l5(e,r,t){return Oa(Boolean,n=>n)(Mn,e,r,t)}a(l5,"some$1");var Kc=Et(l5,3);function u5(e,r,t,n){return Oa(Boolean,i=>i)(oa(r),e,t,n)}a(u5,"someLimit");var Vc=Et(u5,4);function c5(e,r,t){return Oa(Boolean,n=>n)(sa,e,r,t)}a(c5,"someSeries");var Jc=Et(c5,3);function d5(e,r,t){var n=kt(r);return Ac(e,(o,s)=>{n(o,(l,u)=>{if(l)return s(l);s(l,{value:o,criteria:u})})},(o,s)=>{if(o)return t(o);t(null,s.sort(i).map(l=>l.value))});function i(o,s){var l=o.criteria,u=s.criteria;return l<u?-1:l>u?1:0}}a(d5,"sortBy");var $w=Et(d5,3);function zw(e,r,t){var n=kt(e);return Vl((i,o)=>{var s=!1,l;function u(){var c=e.name||"anonymous",d=new Error('Callback function "'+c+'" timed out.');d.code="ETIMEDOUT",t&&(d.info=t),s=!0,o(d)}a(u,"timeoutCallback"),i.push((...c)=>{s||(o(...c),clearTimeout(l))}),l=setTimeout(u,r),n(...i)})}a(zw,"timeout");function h5(e){for(var r=Array(e);e--;)r[e]=e;return r}a(h5,"range");function Yc(e,r,t,n){var i=kt(t);return Xl(h5(e),r,i,n)}a(Yc,"timesLimit");function qw(e,r,t){return Yc(e,1/0,r,t)}a(qw,"times");function Uw(e,r,t){return Yc(e,1,r,t)}a(Uw,"timesSeries");function Kw(e,r,t,n){arguments.length<=3&&typeof r=="function"&&(n=t,t=r,r=Array.isArray(e)?[]:{}),n=ei(n||ns());var i=kt(t);return Mn(e,(o,s,l)=>{i(r,o,s,l)},o=>n(o,r)),n[rs]}a(Kw,"transform$1");function f5(e,r){var t=null,n;return tu(e,(i,o)=>{kt(i)((s,...l)=>{if(s===!1)return o(s);l.length<2?[n]=l:n=l,t=s,o(s?null:{})})},()=>r(t,n))}a(f5,"tryEach");var Vw=Et(f5);function Jw(e){return(...r)=>(e.unmemoized||e)(...r)}a(Jw,"unmemoize");function m5(e,r,t){t=ti(t);var n=kt(r),i=kt(e),o=[];function s(u,...c){if(u)return t(u);o=c,u!==!1&&i(l)}a(s,"next");function l(u,c){if(u)return t(u);if(u!==!1){if(!c)return t(null,...o);n(s)}}return a(l,"check"),i(l)}a(m5,"whilst");var ru=Et(m5,3);function Yw(e,r,t){const n=kt(e);return ru(i=>n((o,s)=>i(o,!s)),r,t)}a(Yw,"until");function p5(e,r){if(r=ei(r),!Array.isArray(e))return r(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return r();var t=0;function n(o){var s=kt(e[t++]);s(...o,ti(i))}a(n,"nextTask");function i(o,...s){if(o!==!1){if(o||t===e.length)return r(o,...s);n(s)}}a(i,"next"),n([])}a(p5,"waterfall");var Zw=Et(p5),y5={apply:tw,applyEach:cw,applyEachSeries:dw,asyncify:Yl,auto:hm,autoInject:hw,cargo:mw,cargoQueue:pw,compose:yw,concat:Tc,concatLimit:as,concatSeries:Dc,constant:gw,detect:Bc,detectLimit:Rc,detectSeries:xc,dir:Fw,doUntil:vw,doWhilst:Ql,each:Pc,eachLimit:eu,eachOf:Mn,eachOfLimit:ts,eachOfSeries:sa,eachSeries:tu,ensureAsync:pm,every:Mc,everyLimit:Ic,everySeries:Oc,filter:Nc,filterLimit:Hc,filterSeries:Gc,forever:Cw,groupBy:ww,groupByLimit:Wc,groupBySeries:Ew,log:_w,map:Ac,mapLimit:Xl,mapSeries:dm,mapValues:kw,mapValuesLimit:jc,mapValuesSeries:Aw,memoize:Tw,nextTick:Dw,parallel:Bw,parallelLimit:Rw,priorityQueue:Pw,queue:gm,race:Mw,reduce:ri,reduceRight:zc,reflect:qc,reflectAll:Iw