cdktn-cli 0.24.0-pre.60 → 0.24.0-pre.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -93,7 +93,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
93
93
|
${i.join(`
|
|
94
94
|
`)}`);let a={...n.context,...n.targetVersions?{[i$.TARGET_VERSIONS_CONTEXT_KEY]:n.targetVersions}:{}};return Object.keys(a).length>0&&(dSt.env[pSt]=JSON.stringify(a)),n};da.parseConfig=mSt;function gSt(t=xSe.join(process.cwd(),wSe)){let e;return SSe.existsSync(t)&&(e=SSe.readFileSync(t).toString()),(0,da.parseConfig)(e)}da.readConfigSync=gSt;function vSt(t){return xO(t.terraformModules)||xO(t.terraformProviders)}da.shouldCheckCodeMakerOutput=vSt;function ySt(t){ESe.logger.debug(`Start timer for ${t}...`);let e=Date.now();return function(){let i=Date.now()-e;ESe.logger.debug(`${t} took ${i}ms`)}}da.logTimespan=ySt});var TSe=w((xsr,RSe)=>{"use strict";RSe.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var Ny=w((wsr,BSe)=>{"use strict";var bSt=TSe();BSe.exports=t=>typeof t=="string"?t.replace(bSt(),""):t});var XI=w(ba=>{"use strict";var _St=ba&&ba.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),CSt=ba&&ba.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),NO=ba&&ba.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_St(e,t,r);return CSt(e,t),e},ISt=ba&&ba.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ba,"__esModule",{value:!0});ba.hasNoColorFlagOrEnv=ba.ensureAllSettledBeforeThrowing=ba.downloadFile=ba.HttpError=ba.downcaseFirst=ba.readCDKTFManifest=ba.readCDKTFVersion=ba.exec=ba.mkdtemp=ba.withTempDir=ba.shell=void 0;var SSt=Wz(),qm=NO(uy()),NSe=D_e(),DSe=NO(require("os")),lA=NO(require("path")),TO=R5(),ESt=require("cdktn"),xSt=NO(RO()),oA=ISt(Ny());function wSt(t,e,r){t.stderr=e,t.stdout=r;let n=[e,r].filter(Boolean).join(`
|
|
95
95
|
`);if(n){let i=t.message;t.toString=()=>`Error: ${i}
|
|
96
|
-
${n}`}}async function ASt(t,e=[],r={}){return(0,ba.exec)(t,e,r,n=>{let i=r.noColor?(0,oA.default)(n.toLocaleString()):n.toLocaleString();console.log(i)},()=>{})}ba.shell=ASt;async function RSt(t,e){let r=process.cwd(),n=await qm.mkdtemp(lA.join(DSe.tmpdir(),"cdktf.")),i=lA.join(n,t);await qm.mkdirp(i);try{process.chdir(i),await e()}finally{process.chdir(r),await qm.remove(n)}}ba.withTempDir=RSt;async function TSt(t){let e=await qm.mkdtemp(lA.join(DSe.tmpdir(),"cdktf."));try{await t(e)}finally{await qm.remove(e)}}ba.mkdtemp=TSt;var BSt=async(t,e,r,n,i,a=!0)=>(typeof r.noColor!="boolean"&&GSe()&&(r.noColor=!0),new Promise((s,o)=>{var l,u,f,h;let g=(0,SSt.spawn)(t,e,r),_=new Array,x=new Array;n!==void 0?(l=g.stdout)===null||l===void 0||l.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerDebug)(N),_.push(N),n(N)}):(u=g.stdout)===null||u===void 0||u.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerDebug)(N),_.push(N)}),i!==void 0?(f=g.stderr)===null||f===void 0||f.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerError)(N),a&&i(N),x.push(N)}):(h=g.stderr)===null||h===void 0||h.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerError)(N),a&&process.stderr.write(N),x.push(N)}),g.once("error",R=>o(R)),g.once("close",R=>{if(R!==0){let N=new Error(`${t} ${e.join(" ")} exited with code ${R}`);return wSt(N,x.join(""),_.join("")),o(N)}return s(_.join(""))})}));ba.exec=BSt;async function NSt(t){let e=lA.join(t,"cdk.tf.json");if(qm.existsSync(e)){let r=qm.readFileSync(e,"utf8");return JSON.parse(r)["//"].metadata.version}return""}ba.readCDKTFVersion=NSt;async function DSt(){let{output:t}=xSt.readConfigSync(),e=await qm.readFile(lA.join(t,ESt.Manifest.fileName));return JSON.parse(e.toString())}ba.readCDKTFManifest=DSt;function GSt(t){return t===""?t:`${t[0].toLocaleLowerCase()}${t.slice(1)}`}ba.downcaseFirst=GSt;var BO=class extends Error{constructor(e,r){super(e),this.statusCode=r,Object.setPrototypeOf(this,new.target.prototype)}};ba.HttpError=BO;async function FSt(t,e){let r=t.startsWith("http://")?NSe.http:NSe.https,n=qm.createWriteStream(e);return new Promise((i,a)=>{let s=r.get(t,o=>{if(o.statusCode!==200){a(new BO(`Failed to get '${t}' (${o.statusCode})`,o.statusCode));return}o.pipe(n)});n.on("finish",()=>i()),s.on("error",o=>{qm.unlink(e,()=>a(o))}),n.on("error",o=>{qm.unlink(e,()=>a(o))}),s.end()})}ba.downloadFile=FSt;async function OSt(t,e){try{await t}catch(r){throw await Promise.allSettled(e),r}}ba.ensureAllSettledBeforeThrowing=OSt;function GSe(){return ZSt("no-color")||process.env.FORCE_COLOR==="0"}ba.hasNoColorFlagOrEnv=GSe;function ZSt(t){let e=t.startsWith("-")?"":t.length===1?"-":"--",r=process.argv.indexOf(e+t),n=process.argv.indexOf("--");return r!==-1&&(n===-1||r<n)}});var R5=w(kd=>{"use strict";var kSt=kd&&kd.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),WSt=kd&&kd.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),s$=kd&&kd.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kSt(e,t,r);return WSt(e,t),e};Object.defineProperty(kd,"__esModule",{value:!0});kd.logFileName=kd.processLoggerError=kd.processLoggerDebug=kd.logger=void 0;var a$=H1e(),FSe=s$(uy()),VSt=s$(require("path")),zI=s$(zF()),LSt=XI(),Dy=(0,a$.getLogger)(),o$={trace(t,...e){Dy.trace(t,...e),zI.addBreadcrumb({message:t,level:"debug"})},debug(t,...e){Dy.debug(t,...e),zI.addBreadcrumb({message:t,level:"debug"})},info(t,...e){Dy.info(t,...e),zI.addBreadcrumb({message:t,level:"info"})},warn(t,...e){Dy.warn(t,...e),zI.addBreadcrumb({message:t,level:"warning"})},error(t,...e){Dy.error(t,...e),zI.addBreadcrumb({message:t,level:"error"})},fatal(t,...e){Dy.fatal(t,...e),zI.addBreadcrumb({message:t,level:"fatal"})},setLevel(t){Dy.level=t},useDefaultLevel(){Dy.level=process.env.CDKTF_LOG_LEVEL||"INFO"}};kd.logger=o$;Dy.level=process.env.CDKTF_LOG_LEVEL||"INFO";var OSe="cdktf.log";kd.logFileName=OSe;if(process.env.CDKTF_LOG_FILE_DIRECTORY&&FSe.existsSync(process.env.CDKTF_LOG_FILE_DIRECTORY)&&FSe.statSync(process.env.CDKTF_LOG_FILE_DIRECTORY).isDirectory())(0,a$.configure)({appenders:{cdktf:{type:"file",filename:VSt.join(process.env.CDKTF_LOG_FILE_DIRECTORY,OSe)}},categories:{default:{appenders:["cdktf"],level:"debug"}}});else{let t=(0,LSt.hasNoColorFlagOrEnv)()?"basic":"colored";(0,a$.configure)({appenders:{out:{type:"stdout",layout:{type:t}}},categories:{default:{appenders:["out"],level:"info"}}})}var PSt=t=>{o$.debug(t.toString())};kd.processLoggerDebug=PSt;var HSt=t=>{o$.error(t.toString())};kd.processLoggerError=HSt});var ZSe=w((Tsr,MSt)=>{MSt.exports={name:"@cdktn/commons",version:"0.24.0-pre.
|
|
96
|
+
${n}`}}async function ASt(t,e=[],r={}){return(0,ba.exec)(t,e,r,n=>{let i=r.noColor?(0,oA.default)(n.toLocaleString()):n.toLocaleString();console.log(i)},()=>{})}ba.shell=ASt;async function RSt(t,e){let r=process.cwd(),n=await qm.mkdtemp(lA.join(DSe.tmpdir(),"cdktf.")),i=lA.join(n,t);await qm.mkdirp(i);try{process.chdir(i),await e()}finally{process.chdir(r),await qm.remove(n)}}ba.withTempDir=RSt;async function TSt(t){let e=await qm.mkdtemp(lA.join(DSe.tmpdir(),"cdktf."));try{await t(e)}finally{await qm.remove(e)}}ba.mkdtemp=TSt;var BSt=async(t,e,r,n,i,a=!0)=>(typeof r.noColor!="boolean"&&GSe()&&(r.noColor=!0),new Promise((s,o)=>{var l,u,f,h;let g=(0,SSt.spawn)(t,e,r),_=new Array,x=new Array;n!==void 0?(l=g.stdout)===null||l===void 0||l.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerDebug)(N),_.push(N),n(N)}):(u=g.stdout)===null||u===void 0||u.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerDebug)(N),_.push(N)}),i!==void 0?(f=g.stderr)===null||f===void 0||f.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerError)(N),a&&i(N),x.push(N)}):(h=g.stderr)===null||h===void 0||h.on("data",R=>{let N=r.noColor?(0,oA.default)(R.toLocaleString()):R.toLocaleString();(0,TO.processLoggerError)(N),a&&process.stderr.write(N),x.push(N)}),g.once("error",R=>o(R)),g.once("close",R=>{if(R!==0){let N=new Error(`${t} ${e.join(" ")} exited with code ${R}`);return wSt(N,x.join(""),_.join("")),o(N)}return s(_.join(""))})}));ba.exec=BSt;async function NSt(t){let e=lA.join(t,"cdk.tf.json");if(qm.existsSync(e)){let r=qm.readFileSync(e,"utf8");return JSON.parse(r)["//"].metadata.version}return""}ba.readCDKTFVersion=NSt;async function DSt(){let{output:t}=xSt.readConfigSync(),e=await qm.readFile(lA.join(t,ESt.Manifest.fileName));return JSON.parse(e.toString())}ba.readCDKTFManifest=DSt;function GSt(t){return t===""?t:`${t[0].toLocaleLowerCase()}${t.slice(1)}`}ba.downcaseFirst=GSt;var BO=class extends Error{constructor(e,r){super(e),this.statusCode=r,Object.setPrototypeOf(this,new.target.prototype)}};ba.HttpError=BO;async function FSt(t,e){let r=t.startsWith("http://")?NSe.http:NSe.https,n=qm.createWriteStream(e);return new Promise((i,a)=>{let s=r.get(t,o=>{if(o.statusCode!==200){a(new BO(`Failed to get '${t}' (${o.statusCode})`,o.statusCode));return}o.pipe(n)});n.on("finish",()=>i()),s.on("error",o=>{qm.unlink(e,()=>a(o))}),n.on("error",o=>{qm.unlink(e,()=>a(o))}),s.end()})}ba.downloadFile=FSt;async function OSt(t,e){try{await t}catch(r){throw await Promise.allSettled(e),r}}ba.ensureAllSettledBeforeThrowing=OSt;function GSe(){return ZSt("no-color")||process.env.FORCE_COLOR==="0"}ba.hasNoColorFlagOrEnv=GSe;function ZSt(t){let e=t.startsWith("-")?"":t.length===1?"-":"--",r=process.argv.indexOf(e+t),n=process.argv.indexOf("--");return r!==-1&&(n===-1||r<n)}});var R5=w(kd=>{"use strict";var kSt=kd&&kd.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),WSt=kd&&kd.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),s$=kd&&kd.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kSt(e,t,r);return WSt(e,t),e};Object.defineProperty(kd,"__esModule",{value:!0});kd.logFileName=kd.processLoggerError=kd.processLoggerDebug=kd.logger=void 0;var a$=H1e(),FSe=s$(uy()),VSt=s$(require("path")),zI=s$(zF()),LSt=XI(),Dy=(0,a$.getLogger)(),o$={trace(t,...e){Dy.trace(t,...e),zI.addBreadcrumb({message:t,level:"debug"})},debug(t,...e){Dy.debug(t,...e),zI.addBreadcrumb({message:t,level:"debug"})},info(t,...e){Dy.info(t,...e),zI.addBreadcrumb({message:t,level:"info"})},warn(t,...e){Dy.warn(t,...e),zI.addBreadcrumb({message:t,level:"warning"})},error(t,...e){Dy.error(t,...e),zI.addBreadcrumb({message:t,level:"error"})},fatal(t,...e){Dy.fatal(t,...e),zI.addBreadcrumb({message:t,level:"fatal"})},setLevel(t){Dy.level=t},useDefaultLevel(){Dy.level=process.env.CDKTF_LOG_LEVEL||"INFO"}};kd.logger=o$;Dy.level=process.env.CDKTF_LOG_LEVEL||"INFO";var OSe="cdktf.log";kd.logFileName=OSe;if(process.env.CDKTF_LOG_FILE_DIRECTORY&&FSe.existsSync(process.env.CDKTF_LOG_FILE_DIRECTORY)&&FSe.statSync(process.env.CDKTF_LOG_FILE_DIRECTORY).isDirectory())(0,a$.configure)({appenders:{cdktf:{type:"file",filename:VSt.join(process.env.CDKTF_LOG_FILE_DIRECTORY,OSe)}},categories:{default:{appenders:["cdktf"],level:"debug"}}});else{let t=(0,LSt.hasNoColorFlagOrEnv)()?"basic":"colored";(0,a$.configure)({appenders:{out:{type:"stdout",layout:{type:t}}},categories:{default:{appenders:["out"],level:"info"}}})}var PSt=t=>{o$.debug(t.toString())};kd.processLoggerDebug=PSt;var HSt=t=>{o$.error(t.toString())};kd.processLoggerError=HSt});var ZSe=w((Tsr,MSt)=>{MSt.exports={name:"@cdktn/commons",version:"0.24.0-pre.62",publishConfig:{access:"public"},description:"CDK Terrain Common utilities",scripts:{build:"tsc",watch:"tsc -w","watch-preserve-output":"tsc -w --preserveWatchOutput","test:update":"jest -u",package:"./package.sh","dist-clean":"rm -rf dist","package:js":"./package.sh"},main:"build/index.js",types:"build/index.d.ts",nx:{tags:["unit-test"]},repository:{type:"git",url:"git://github.com/open-constructs/cdk-terrain.git",directory:"packages/@cdktn/commons"},author:{name:"OpenConstructs",url:"https://github.com/open-constructs"},keywords:["cdk","cdktf","cdktn","terraform"],license:"MPL-2.0",dependencies:{"@sentry/node":"7.120.4",cdktn:"workspace:*","ci-info":"3.9.0",codemaker:"1.128.0","cross-spawn":"7.0.6","follow-redirects":"1.15.11","fs-extra":"11.3.4",log4js:"6.9.1",semver:"7.7.4","strip-ansi":"6.0.1",uuid:"9.0.1",validator:"13.15.35"},devDependencies:{"@types/cross-spawn":"6.0.6","@types/follow-redirects":"1.14.4","@types/fs-extra":"11.0.4","@types/semver":"7.7.1","@types/uuid":"9.0.8","@types/validator":"13.15.10","tsc-files":"1.1.4",typescript:"^5.0.0"},"lint-staged":{"src/**/*.{ts,tsx}":"tsc-files ambient.d.ts --noEmit"}}});var uA=w(DO=>{"use strict";Object.defineProperty(DO,"__esModule",{value:!0});DO.DISPLAY_VERSION=void 0;DO.DISPLAY_VERSION=`${USt()}`;function USt(){return ZSe().version.replace(/\+[0-9a-f]+$/,"")}});var u$=w(Qu=>{"use strict";var YSt=Qu&&Qu.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),jSt=Qu&&Qu.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),OO=Qu&&Qu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YSt(e,t,r);return jSt(e,t),e},XSt=Qu&&Qu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.ReportRequest=Qu.getUserId=Qu.getProjectId=Qu.sendTelemetry=void 0;var zSt=OO(require("https")),qSt=require("url"),VSe=(R0e(),Ple(A0e)),FO=OO(require("os")),kSe=XSt(hM()),l$=R5(),cA=OO(require("path")),GO=OO(uy()),KSt=uA(),JSt="https://checkpoint-api.hashicorp.com/v1/",$St=[200,201],WSe=8192;function QSt(){var t;return process.env.CDKTF_HOME?cA.resolve(process.env.CDKTF_HOME):cA.join(((t=FO.userInfo().homedir)!==null&&t!==void 0?t:FO.homedir()).trim()||"/",".cdktf")}async function eEt(t,e){return new Promise((r,n)=>{let i=zSt.request((0,qSt.format)(t),{headers:{Accept:"application/json","Content-Length":e.length,"User-Agent":"OpenConstructs/cdktn-cli"},method:"POST"},a=>{if(a.statusCode){let o=a.statusCode;if(!$St.includes(o))return n(new Error(a.statusMessage))}let s=new Array;a.on("data",o=>s.push(o)),a.on("error",o=>n(o)),a.on("end",()=>r())});i.setTimeout(1e3,()=>n(new Error("request timeout"))),i.write(e),i.end(),i.on("error",a=>n(a))})}async function tEt(t,e){let r={command:t,product:"cdktn",version:`${KSt.DISPLAY_VERSION}`,dateTime:new Date,language:e.language,payload:e};try{await MSe(r)}catch(n){l$.logger.error(`Could not send telemetry data: ${n}`)}}Qu.sendTelemetry=tEt;function LSe(t,e,r=!1,n){let i=(0,VSe.v4)(),a;try{a=JSON.parse(GO.readFileSync(t,"utf-8"))}catch{if(r){let o={};n&&(o["//"]=n.replace(/\n/g," ")),o[e]=i,GO.ensureDirSync(cA.dirname(t)),GO.writeFileSync(t,JSON.stringify(o,null,2))}return i}return a[e]?a[e]:(GO.writeFileSync(t,JSON.stringify({...a,[e]:i},null,2)),i)}function PSe(t=process.cwd()){return LSe(cA.resolve(t,"cdktf.json"),"projectId")}Qu.getProjectId=PSe;function HSe(){return LSe(cA.resolve(QSt(),"config.json"),"userId",!0,`This signature is a randomly generated UUID used to anonymously differentiate users in telemetry data order to inform product direction.
|
|
97
97
|
This signature is random, it is not based on any personally identifiable information.
|
|
98
98
|
To create a new signature, you can simply delete this file at any time.
|
|
99
99
|
See https://cdktn.io/docs/telemetry for more
|
|
@@ -103,7 +103,7 @@ information on how to disable it.`)}Qu.getUserId=HSe;async function MSe(t){if(pr
|
|
|
103
103
|
`).forEach(a=>{t.line(`* ${a}`)})},end:()=>{e&&(t.line(" *"),t.line("* Note: The above comment contained a comment block ending sequence (* followed by /). We have introduced a space between to prevent syntax errors. Please ignore the space.")),t.line("*/")}}}QO.sanitizedComment=Dxt});var HEe=w(tZ=>{"use strict";Object.defineProperty(tZ,"__esModule",{value:!0});tZ.ResourceEmitter=void 0;var Gxt=$O(),O$=eZ(),Z$=class{constructor(e){this.code=e,this.attributesEmitter=new Gxt.AttributesEmitter(this.code)}emit(e){this.code.line();let r=(0,O$.sanitizedComment)(this.code);r.line(`Represents a {@link ${e.linkToDocs} ${e.terraformResourceType}}`),r.end(),this.code.openBlock(`export class ${e.className} extends cdktn.${e.parentClassName}`),this.emitHeader("STATIC PROPERTIES"),this.emitStaticProperties(e),this.emitHeader("STATIC Methods"),this.emitStaticMethods(e),this.emitHeader("INITIALIZER"),this.emitInitializer(e),this.emitHeader("ATTRIBUTES"),this.emitResourceAttributes(e),this.emitHeader("SYNTHESIS"),this.emitResourceSynthesis(e),this.emitHclResourceSynthesis(e),this.code.closeBlock()}emitHeader(e){this.code.line(),this.code.line("// "+"=".repeat(e.length)),this.code.line(`// ${e}`),this.code.line("// "+"=".repeat(e.length))}emitStaticProperties(e){this.code.line(`public static readonly tfResourceType = "${e.terraformResourceType}";`)}emitStaticMethods(e){let r=(0,O$.sanitizedComment)(this.code);r.line(`Generates CDKTN code for importing a ${e.className} resource upon running "cdktn plan <stack-name>"`),r.line("@param scope The scope in which to define this construct"),r.line(`@param importToId The construct id used in the generated config for the ${e.className} to import`),r.line(`@param importFromId The id of the existing ${e.className} that should be imported. Refer to the {@link ${e.linkToDocs}#import import section} in the documentation of this resource for the id to use`),r.line(`@param provider? Optional instance of the provider where the ${e.className} to import is found`),r.end(),this.code.line(`public static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktn.TerraformProvider) {
|
|
104
104
|
return new cdktn.ImportableResource(scope, importToId, { terraformResourceType: "${e.terraformResourceType}", importId: importFromId, provider });
|
|
105
105
|
}`)}emitHclResourceSynthesis(e){this.code.line(),this.code.openBlock("protected synthesizeHclAttributes(): { [name: string]: any }"),this.code.open("const attrs = {");for(let r of e.synthesizableAttributes)this.attributesEmitter.emitToHclTerraform(r,!1);this.code.close("};"),e.synthesizableAttributes.length>0?(this.code.line(),this.code.line("// remove undefined attributes"),this.code.line("return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined ))")):this.code.line("return attrs;"),this.code.closeBlock()}emitResourceSynthesis(e){this.code.line(),this.code.openBlock("protected synthesizeAttributes(): { [name: string]: any }"),this.code.open("return {");for(let r of e.synthesizableAttributes)this.attributesEmitter.emitToTerraform(r,!1);this.code.close("};"),this.code.closeBlock()}emitResourceAttributes(e){for(let r of e.attributes)this.attributesEmitter.emit(r,this.attributesEmitter.needsResetEscape(r,e.attributes),this.attributesEmitter.needsInputEscape(r,e.attributes))}emitInitializer(e){this.code.line();let r=(0,O$.sanitizedComment)(this.code);r.line(`Create a new {@link ${e.linkToDocs} ${e.terraformResourceType}} ${e.isDataSource?"Data Source":"Resource"}`),r.line(""),r.line("@param scope The scope in which to define this construct"),r.line("@param id The scoped construct ID. Must be unique amongst siblings in the same scope"),r.line(`@param options ${e.configStruct.attributeType}`),r.end(),this.code.openBlock(`public constructor(scope: Construct, id: string, config: ${e.configStruct.attributeType})`),e.isProvider?this.emitProviderSuper(e):this.emitResourceSuper(e);for(let n of e.configStruct.assignableAttributes)n.setterType._type==="stored_class"?this.code.line(`this.${n.storageName}.internalValue = config.${n.name};`):this.code.line(`this.${n.storageName} = config.${n.name};`);this.code.closeBlock()}emitResourceSuper(e){this.code.open("super(scope, id, {"),this.code.line(`terraformResourceType: '${e.terraformResourceType}',`),this.emitTerraformGeneratorMetadata(e),this.code.line("provider: config.provider,"),this.code.line("dependsOn: config.dependsOn,"),this.code.line("count: config.count,"),this.code.line("lifecycle: config.lifecycle,"),this.code.line("provisioners: config.provisioners,"),this.code.line("connection: config.connection,"),this.code.line("forEach: config.forEach"),this.code.close("});")}emitProviderSuper(e){this.code.open("super(scope, id, {"),this.code.line(`terraformResourceType: '${e.terraformResourceType}',`),this.emitTerraformGeneratorMetadata(e),this.code.line(`terraformProviderSource: '${e.terraformProviderSource}'`),this.code.close("});")}emitTerraformGeneratorMetadata(e){this.code.open("terraformGeneratorMetadata: {"),this.code.line(`providerName: '${e.provider}'${e.providerVersion||e.providerVersionConstraint?",":""}`),e.providerVersion&&this.code.line(`providerVersion: '${e.providerVersion}'${e.providerVersionConstraint?",":""}`),e.providerVersionConstraint&&this.code.line(`providerVersionConstraint: '${e.providerVersionConstraint}'`),this.code.close("},")}};tZ.ResourceEmitter=Z$});var UEe=w(k2=>{"use strict";var Fxt=k2&&k2.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Oxt=k2&&k2.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Zxt=k2&&k2.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fxt(e,t,r);return Oxt(e,t),e};Object.defineProperty(k2,"__esModule",{value:!0});k2.StructEmitter=void 0;var rZ=r3(),kxt=$O(),MEe=UO(),nZ=Zxt(require("path")),k$=A$(),_1=eZ(),W$=class{constructor(e,r){this.code=e,this.attributesEmitter=new kxt.AttributesEmitter(this.code),this.importExtension=r}emit(e){e.structsRequireSharding?this.emitNamespacedStructs(e):this.emitStructs(e)}warnAboutIdField(e){e.name==="id"&&(this.code.line("*"),this.code.line("* Please be aware that the id field is automatically added to all resources in Terraform providers using a Terraform provider SDK version below 2."),this.code.line("* If you experience problems setting this value it might not be settable. Please take a look at the provider documentation to ensure it should be settable."))}emitInterface(e,r,n=r.name){e.isProvider?this.code.openBlock(`export interface ${n}`):this.code.openBlock(`export interface ${n}${r.extends}`);for(let i of r.assignableAttributes){let a=(0,_1.sanitizedComment)(this.code);i.description?(a.line(i.description),a.line(""),a.line(`Docs at Terraform Registry: {@link ${e.linkToDocs}#${i.terraformName} ${e.className}#${i.terraformName}}`),this.warnAboutIdField(i),a.end()):(a.line(`Docs at Terraform Registry: {@link ${e.linkToDocs}#${i.terraformName} ${e.className}#${i.terraformName}}`),this.warnAboutIdField(i),a.end()),this.code.line(`readonly ${i.typeDefinition};`)}this.code.closeBlock(),r instanceof rZ.ConfigStruct||(this.emitToTerraformFunction(r),this.emitToHclTerraformFunction(r))}emitStructs(e){e.structs.forEach(r=>{r instanceof rZ.ConfigStruct?this.emitInterface(e,r):(this.emitInterface(e,r),r.isProvider||this.emitClass(r))})}emitNamespacedStructs(e){let r={},n=e.structs.slice(1),i=[[]],a=[0];n.forEach(l=>{a[a.length-1]+l.exportCount<=k$.STRUCT_SHARDING_THRESHOLD?(i[i.length-1].push(l),a[a.length-1]+=l.exportCount):(i.push([l]),a.push(l.exportCount))});for(let l=0;l<i.length;l++){let u=`structs${l*k$.STRUCT_SHARDING_THRESHOLD}.ts`;i[l].forEach(h=>r[h.name]=u)}let s=[];for(let l=0;l<i.length;l++){let u={},f=i[l],h=`structs${l*k$.STRUCT_SHARDING_THRESHOLD}.ts`;s.push(h),f.forEach(_=>{_.attributes.forEach(x=>{var R,N;let D=(R=x.type.struct)===null||R===void 0?void 0:R.name,Z=r[D??""];if(Z&&Z!==h){if(!x.type.struct)throw new Error(`${D} is not a struct`);(N=u[Z])!==null&&N!==void 0||(u[Z]=[]);let z=x.getReferencedTypes(_ instanceof rZ.ConfigStruct);z&&u[Z].push(...z)}})});let g=nZ.join(e.structsFolderPath,h);this.code.openFile(g),this.code.line("import * as cdktn from 'cdktn';"),Object.entries(u).forEach(([_,x])=>{let R=nZ.basename(_,".ts");this.code.line(`import { ${[...new Set(x)].join(`,
|
|
106
|
-
`)} } from './${R}${this.importExtension}';`)}),f.forEach(_=>{_ instanceof rZ.ConfigStruct?this.emitInterface(e,_):(this.emitInterface(e,_),_.isProvider||this.emitClass(_))}),this.code.closeFile(g)}let o=nZ.join(e.structsFolderPath,"index.ts");this.code.openFile(o),s.forEach(l=>{let u=nZ.basename(l,".ts");this.code.line(`export * from './${u}${this.importExtension}';`)}),this.code.closeFile(o)}emitClass(e){this.code.openBlock(`export class ${e.outputReferenceName} extends cdktn.ComplexObject`),this.code.line("private isEmptyObject = false;"),e.isClass||this.code.line("private resolvableValue?: cdktn.IResolvable;"),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),e.isSingleItem?(r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute, false, 0);"),this.code.closeBlock()):e.nestingMode==="single"||e.nestingMode==="object"?(r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute, false);"),this.code.closeBlock()):e.nestingMode.startsWith("map")?(this.code.line("* @param complexObjectKey the key of this item in the map"),r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, complexObjectKey: string)"),this.code.line("super(terraformResource, terraformAttribute, false, complexObjectKey);"),this.code.closeBlock()):(r.line("@param complexObjectIndex the index of this item in the list"),r.line("@param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, complexObjectIsFromSet, complexObjectIndex);"),this.code.closeBlock()),this.code.line(),this.emitInternalValueGetter(e),this.code.line(),this.emitInternalValueSetter(e);for(let n of e.attributes)this.attributesEmitter.emit(n,this.attributesEmitter.needsResetEscape(n,e.attributes),this.attributesEmitter.needsInputEscape(n,e.attributes));this.code.closeBlock(),!e.isSingleItem&&(e.nestingMode==="list"||e.nestingMode==="set")?this.emitComplexListClass(e):e.nestingMode==="map"?this.emitComplexMapClass(e):e.nestingMode==="maplist"?this.emitComplexMapListClasses(e):e.nestingMode==="mapset"?this.emitComplexMapListClasses(e):e.nestingMode==="listmap"?this.emitComplexListMapClasses(e,!1):e.nestingMode==="setmap"?this.emitComplexListMapClasses(e,!0):(e.nestingMode==="listlist"||e.nestingMode==="listset"||e.nestingMode==="setlist"||e.nestingMode==="setset")&&this.emitComplexListListClasses(e)}emitComplexListClass(e){this.code.line(),this.code.openBlock(`export class ${e.listName} extends cdktn.ComplexList`),e.assignable&&this.code.line(`public internalValue? : ${e.name}[] | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.line("@param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, wrapsSet);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param index the index of the item to return"),n.end(),this.code.openBlock(`public get(index: number): ${e.outputReferenceName}`),this.code.line(`return new ${e.outputReferenceName}(this.terraformResource, this.terraformAttribute, index, this.wrapsSet);`),this.code.closeBlock(),this.code.closeBlock()}emitComplexMapClass(e){this.code.line(),this.code.openBlock(`export class ${e.mapName} extends cdktn.ComplexMap`),e.assignable&&this.code.line(`public internalValue? : { [key: string]: ${e.name} } | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param key the key of the item to return"),n.end(),this.code.openBlock(`public get(key: string): ${e.outputReferenceName}`),this.code.line(`return new ${e.outputReferenceName}(this.terraformResource, this.terraformAttribute, key);`),this.code.closeBlock(),this.code.closeBlock()}emitComplexMapListClasses(e){this.emitComplexMapListClass(e),this.emitComplexMapClass(e)}emitComplexMapListClass(e){this.code.line(),this.code.openBlock(`export class ${e.mapListName} extends cdktn.MapList`),e.assignable&&this.code.line(`public internalValue? : ${e.mapName}[] | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.line("@param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, wrapsSet);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param index the index of the item to return"),n.end(),this.code.openBlock(`public get(index: number): ${e.mapName}`),this.code.line(`return new ${e.mapName}(this, \`[\${index}]\`);`),this.code.closeBlock(),this.code.closeBlock()}emitComplexListMapClasses(e,r){this.emitComplexListMapClass(e,r),this.emitComplexListClass(e)}emitComplexListMapClass(e,r){this.code.line(),this.code.openBlock(`export class ${e.listMapName} extends cdktn.ComplexMap`),e.assignable&&this.code.line(`public internalValue? : { [key: string]: ${e.name}[] } | cdktn.IResolvable`),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param terraformResource The parent resource"),n.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),n.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute);"),this.code.closeBlock(),this.code.line();let i=(0,_1.sanitizedComment)(this.code);i.line("@param key the key of the item to return"),i.end(),this.code.openBlock(`public get(key: string): ${e.listName}`),this.code.line(`return new ${e.listName}(this, \`[\${key}]\`, ${r});`),this.code.closeBlock(),this.code.closeBlock()}emitComplexListListClasses(e){this.emitComplexListListClass(e),this.emitComplexListClass(e)}emitComplexListListClass(e){this.code.line(),this.code.openBlock(`export class ${e.listListName} extends cdktn.MapList`),e.assignable&&this.code.line(`public internalValue? : ${e.name}[][] | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.line("@param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, wrapsSet);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param index the index of the item to return"),n.end(),this.code.openBlock(`public get(index: number): ${e.listName}`),this.code.line(`return new ${e.listName}(this, \`[\${index}]\`, ${e.nestingMode==="setlist"||e.nestingMode==="setset"});`),this.code.closeBlock(),this.code.closeBlock()}emitInternalValueGetter(e){this.code.openBlock(`public get internalValue(): ${e.name}${e.isClass?"":" | cdktn.IResolvable"} | undefined`),e.isClass||(this.code.openBlock("if (this.resolvableValue)"),this.code.line("return this.resolvableValue;"),this.code.closeBlock()),this.code.line("let hasAnyValues = this.isEmptyObject;"),this.code.line("const internalValueResult: any = {};");for(let r of e.attributes)r.isStored&&(r.getterType._type==="stored_class"?this.code.openBlock(`if (this.${r.storageName}?.internalValue !== undefined)`):this.code.openBlock(`if (this.${r.storageName} !== undefined)`),this.code.line("hasAnyValues = true;"),r.getterType._type==="stored_class"?this.code.line(`internalValueResult.${r.name} = this.${r.storageName}?.internalValue;`):this.code.line(`internalValueResult.${r.name} = this.${r.storageName};`),this.code.closeBlock());this.code.line("return hasAnyValues ? internalValueResult : undefined;"),this.code.closeBlock()}emitInternalValueSetter(e){this.code.openBlock(`public set internalValue(value: ${e.name}${e.isClass?"":" | cdktn.IResolvable"} | undefined)`),this.code.openBlock("if (value === undefined)"),this.code.line("this.isEmptyObject = false;"),e.isClass||this.code.line("this.resolvableValue = undefined;");for(let r of e.attributes)r.isStored&&(r.setterType._type==="stored_class"?this.code.line(`this.${r.storageName}.internalValue = undefined;`):r.setterType._type!=="none"&&this.code.line(`this.${r.storageName} = undefined;`));this.code.closeBlock(),e.isClass||(this.code.openBlock("else if (cdktn.Tokenization.isResolvable(value))"),this.code.line("this.isEmptyObject = false;"),this.code.line("this.resolvableValue = value;"),this.code.closeBlock()),this.code.openBlock("else"),this.code.line("this.isEmptyObject = Object.keys(value).length === 0;"),e.isClass||this.code.line("this.resolvableValue = undefined;");for(let r of e.attributes)r.isStored&&(r.setterType._type==="stored_class"?this.code.line(`this.${r.storageName}.internalValue = value.${r.name};`):r.setterType._type!=="none"&&this.code.line(`this.${r.storageName} = value.${r.name};`));this.code.closeBlock(),this.code.closeBlock()}emitToHclTerraformFunction(e){this.code.line(),this.code.openBlock(`export function ${(0,MEe.downcaseFirst)(e.name)}ToHclTerraform(struct?: ${e.isSingleItem&&!e.isProvider?`${e.name}OutputReference | `:""}${e.name}${e.isClass?"":" | cdktn.IResolvable"}): any`),this.code.line("if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }"),this.code.openBlock("if (cdktn.isComplexElement(struct))"),this.code.line('throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");'),this.code.closeBlock(),this.code.open("const attrs = {");for(let r of e.assignableAttributes)this.attributesEmitter.emitToHclTerraform(r,!0);this.code.close("};"),e.assignableAttributes.length>0?(this.code.line(),this.code.line("// remove undefined attributes"),this.code.line("return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));")):this.code.line("return attrs;"),this.code.closeBlock(),this.code.line()}emitToTerraformFunction(e){this.code.line(),this.code.openBlock(`export function ${(0,MEe.downcaseFirst)(e.name)}ToTerraform(struct?: ${e.isSingleItem&&!e.isProvider?`${e.name}OutputReference | `:""}${e.name}${e.isClass?"":" | cdktn.IResolvable"}): any`),this.code.line("if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }"),this.code.openBlock("if (cdktn.isComplexElement(struct))"),this.code.line('throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");'),this.code.closeBlock(),this.code.openBlock("return");for(let r of e.assignableAttributes)this.attributesEmitter.emitToTerraform(r,!0);this.code.closeBlock(";"),this.code.closeBlock(),this.code.line()}};k2.StructEmitter=W$});var YEe=w(Oy=>{"use strict";var Wxt=Oy&&Oy.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),V$=Oy&&Oy.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wxt(e,t,r)};Object.defineProperty(Oy,"__esModule",{value:!0});V$($O(),Oy);V$(HEe(),Oy);V$(UEe(),Oy)});var P$=w(aZ=>{"use strict";Object.defineProperty(aZ,"__esModule",{value:!0});aZ.TerraformProviderGenerator=void 0;var jEe=iy(),iZ=In(),Vxt=t4(),Lxt=G$(),XEe=YEe(),Pxt=(t,e)=>{if(t.isModule)return!1;let r=e.split("/");if(r.length===1)return t.source===e;{let[n,i,a]=r;if(!n||!i||!a)throw new Error(`can't handle ${e}`);if(t.source){let s={hostname:"registry.terraform.io",namespace:"hashicorp",name:""},o=t.source.split("/");switch(o.length){case 1:s.name=o[0].toLowerCase();break;case 2:s.namespace=o[0].toLowerCase(),s.name=o[1].toLowerCase();break;case 3:s.hostname=o[0].toLowerCase(),s.namespace=o[1].toLowerCase(),s.name=o[2].toLowerCase();break;default:throw new Error(`can't handle ${t.source}. Expected string with 1, 2 or 3 elements separated by '/'`)}return s.hostname===n&&s.namespace===i&&s.name===a}return t.name===a}},L$=class{constructor(e,r,n={}){var i;this.code=e,this.schema=r,this.resourceParser=new Lxt.ResourceParser,this.versions={},this.code.indentation=2,this.importExtension=(i=n.importExtension)!==null&&i!==void 0?i:"",this.resourceEmitter=new XEe.ResourceEmitter(this.code),this.structEmitter=new XEe.StructEmitter(this.code,this.importExtension)}getProviderByConstraint(e){return Object.keys(this.schema.provider_schemas||{}).find(r=>Pxt(e,r))}generate(e){var r;let n=this.getProviderByConstraint(e);if(!n)throw iZ.logger.debug(`Could not find provider constraint for ${e} in schema: ${JSON.stringify(this.schema,null,2)}`),new Error(`Could not find provider with constraint ${JSON.stringify(e)}`);let i=(r=this.schema.provider_versions)===null||r===void 0?void 0:r[n];this.emitProvider(n,i,e),this.versions[n]=i}generateAll(){for(let e of Object.keys(this.schema.provider_schemas||{}))this.generate(new iZ.ConstructsMakerProviderTarget(new iZ.TerraformProviderConstraint(e),iZ.LANGUAGES[0]))}async save(e){await this.code.save(e)}buildResourceModels(e,r){var n;let i=(n=this.schema.provider_schemas)===null||n===void 0?void 0:n[e];if(!i)throw new Error(`Can not find provider '${e}' in schema`);let a=Object.entries(i.resource_schemas||{}).map(([o,l])=>this.resourceParser.parse(e,o,l,"resource",r)),s=Object.entries(i.data_source_schemas||{}).map(([o,l])=>this.resourceParser.parse(e,`data_${o}`,l,"data_source",r));return[].concat(...a,...s)}getClassNameForResource(e){return this.resourceParser.getClassNameForResource(e)}getNamespaceNameForResource(e){return this.resourceParser.getNamespaceNameForResource(e)}emitProvider(e,r,n){var i;let a=n?.name?n.name:(0,Vxt.parseFQPN)(e).name,s=(i=this.schema.provider_schemas)===null||i===void 0?void 0:i[e];if(!s)throw new Error(`Can not find provider '${e}' in schema`);let o=[];if(this.buildResourceModels(e,n).forEach(l=>{n&&(l.providerVersionConstraint=n.version,l.terraformProviderSource=n.source),l.providerVersion=r,l.structsRequireSharding?o.push(this.emitResourceWithComplexStruct(l)):o.push(this.emitResource(l)),this.emitResourceReadme(l)}),s.provider){let l=this.resourceParser.parse(e,"provider",s.provider,"provider",n);n&&(l.providerVersionConstraint=n.version,l.terraformProviderSource=n.source,l.terraformProviderName=n.name),l.providerVersion=r,o.push(this.emitResource(l)),this.emitResourceReadme(l)}this.emitIndexFile(a,o),this.emitLazyIndexFile(a,o)}emitResourceReadme(e){let r=`${e.namespaceFolderPath}/README.md`;this.code.openFile(r),this.code.line(`# \`${e.terraformType}\``),this.code.line();let n=e.isProvider?e.provider:e.terraformType;this.code.line(`Refer to the Terraform Registry for docs: [\`${n}\`](${e.linkToDocs}).`),this.code.closeFile(r)}emitIndexFile(e,r){let n=`providers/${e}`,i=`${n}/index.ts`;this.code.openFile(i),this.code.line("// generated by cdktn get");for(let a of r){let s=a.replace(`${n}/`,"").replace("/index.ts","");this.code.line(`export * as ${(0,jEe.toCamelCase)(s)} from './${s}/index${this.importExtension}';`)}this.code.line(),this.code.closeFile(i)}emitLazyIndexFile(e,r){let n=`providers/${e}`,i=`${n}/lazy-index.ts`;this.code.openFile(i),this.code.line("// generated by cdktn get");for(let a of r){let s=a.replace(`${n}/`,"").replace("/index.ts","");this.code.line(`Object.defineProperty(exports, '${(0,jEe.toCamelCase)(s)}', { get: function () { return require('./${s}'); } });`)}this.code.line(),this.code.closeFile(i)}emitResource(e){return this.code.openFile(e.filePath),this.emitFileHeader(e),this.structEmitter.emit(e),this.resourceEmitter.emit(e),this.code.closeFile(e.filePath),e.filePath}emitResourceWithComplexStruct(e){let r=[],n=e.filePath;if(this.code.openFile(n),this.code.line("// generated from terraform resource schema"),this.code.line(),e.structsRequireSharding){let i=`./${e.structsFolderName}/index${this.importExtension}`;e.referencedTypes.length>0&&this.code.line(`import { ${e.referencedTypes.join(`,
|
|
106
|
+
`)} } from './${R}${this.importExtension}';`)}),f.forEach(_=>{_ instanceof rZ.ConfigStruct?this.emitInterface(e,_):(this.emitInterface(e,_),_.isProvider||this.emitClass(_))}),this.code.closeFile(g)}let o=nZ.join(e.structsFolderPath,"index.ts");this.code.openFile(o),s.forEach(l=>{let u=nZ.basename(l,".ts");this.code.line(`export * from './${u}${this.importExtension}';`)}),this.code.closeFile(o)}emitClass(e){this.code.openBlock(`export class ${e.outputReferenceName} extends cdktn.ComplexObject`),this.code.line("private isEmptyObject = false;"),e.isClass||this.code.line("private resolvableValue?: cdktn.IResolvable;"),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),e.isSingleItem?(r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute, false, 0);"),this.code.closeBlock()):e.nestingMode==="single"||e.nestingMode==="object"?(r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute, false);"),this.code.closeBlock()):e.nestingMode.startsWith("map")?(this.code.line("* @param complexObjectKey the key of this item in the map"),r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, complexObjectKey: string)"),this.code.line("super(terraformResource, terraformAttribute, false, complexObjectKey);"),this.code.closeBlock()):(r.line("@param complexObjectIndex the index of this item in the list"),r.line("@param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("public constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, complexObjectIsFromSet, complexObjectIndex);"),this.code.closeBlock()),this.code.line(),this.emitInternalValueGetter(e),this.code.line(),this.emitInternalValueSetter(e);for(let n of e.attributes)this.attributesEmitter.emit(n,this.attributesEmitter.needsResetEscape(n,e.attributes),this.attributesEmitter.needsInputEscape(n,e.attributes));this.code.closeBlock(),!e.isSingleItem&&(e.nestingMode==="list"||e.nestingMode==="set")?this.emitComplexListClass(e):e.nestingMode==="map"?this.emitComplexMapClass(e):e.nestingMode==="maplist"?this.emitComplexMapListClasses(e):e.nestingMode==="mapset"?this.emitComplexMapListClasses(e):e.nestingMode==="listmap"?this.emitComplexListMapClasses(e,!1):e.nestingMode==="setmap"?this.emitComplexListMapClasses(e,!0):(e.nestingMode==="listlist"||e.nestingMode==="listset"||e.nestingMode==="setlist"||e.nestingMode==="setset")&&this.emitComplexListListClasses(e)}emitComplexListClass(e){this.code.line(),this.code.openBlock(`export class ${e.listName} extends cdktn.ComplexList`),e.assignable&&this.code.line(`public internalValue? : ${e.name}[] | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.line("@param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, wrapsSet);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param index the index of the item to return"),n.end(),this.code.openBlock(`public get(index: number): ${e.outputReferenceName}`),this.code.line(`return new ${e.outputReferenceName}(this.terraformResource, this.terraformAttribute, index, this.wrapsSet);`),this.code.closeBlock(),this.code.closeBlock()}emitComplexMapClass(e){this.code.line(),this.code.openBlock(`export class ${e.mapName} extends cdktn.ComplexMap`),e.assignable&&this.code.line(`public internalValue? : { [key: string]: ${e.name} } | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param key the key of the item to return"),n.end(),this.code.openBlock(`public get(key: string): ${e.outputReferenceName}`),this.code.line(`return new ${e.outputReferenceName}(this.terraformResource, this.terraformAttribute, key);`),this.code.closeBlock(),this.code.closeBlock()}emitComplexMapListClasses(e){this.emitComplexMapListClass(e),this.emitComplexMapClass(e)}emitComplexMapListClass(e){this.code.line(),this.code.openBlock(`export class ${e.mapListName} extends cdktn.MapList`),e.assignable&&this.code.line(`public internalValue? : ${e.mapName}[] | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.line("@param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, wrapsSet);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param index the index of the item to return"),n.end(),this.code.openBlock(`public get(index: number): ${e.mapName}`),this.code.line(`return new ${e.mapName}(this, \`[\${index}]\`);`),this.code.closeBlock(),this.code.closeBlock()}emitComplexListMapClasses(e,r){this.emitComplexListMapClass(e,r),this.emitComplexListClass(e)}emitComplexListMapClass(e,r){this.code.line(),this.code.openBlock(`export class ${e.listMapName} extends cdktn.ComplexMap`),e.assignable&&this.code.line(`public internalValue? : { [key: string]: ${e.name}[] } | cdktn.IResolvable`),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param terraformResource The parent resource"),n.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),n.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string)"),this.code.line("super(terraformResource, terraformAttribute);"),this.code.closeBlock(),this.code.line();let i=(0,_1.sanitizedComment)(this.code);i.line("@param key the key of the item to return"),i.end(),this.code.openBlock(`public get(key: string): ${e.listName}`),this.code.line(`return new ${e.listName}(this, \`[\${key}]\`, ${r});`),this.code.closeBlock(),this.code.closeBlock()}emitComplexListListClasses(e){this.emitComplexListListClass(e),this.emitComplexListClass(e)}emitComplexListListClass(e){this.code.line(),this.code.openBlock(`export class ${e.listListName} extends cdktn.MapList`),e.assignable&&this.code.line(`public internalValue? : ${e.name}[][] | cdktn.IResolvable`),this.code.line();let r=(0,_1.sanitizedComment)(this.code);r.line("@param terraformResource The parent resource"),r.line("@param terraformAttribute The attribute on the parent resource this class is referencing"),r.line("@param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)"),r.end(),this.code.openBlock("constructor(terraformResource: cdktn.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean)"),this.code.line("super(terraformResource, terraformAttribute, wrapsSet);"),this.code.closeBlock(),this.code.line();let n=(0,_1.sanitizedComment)(this.code);n.line("@param index the index of the item to return"),n.end(),this.code.openBlock(`public get(index: number): ${e.listName}`),this.code.line(`return new ${e.listName}(this, \`[\${index}]\`, ${e.nestingMode==="setlist"||e.nestingMode==="setset"});`),this.code.closeBlock(),this.code.closeBlock()}emitInternalValueGetter(e){this.code.openBlock(`public get internalValue(): ${e.name}${e.isClass?"":" | cdktn.IResolvable"} | undefined`),e.isClass||(this.code.openBlock("if (this.resolvableValue)"),this.code.line("return this.resolvableValue;"),this.code.closeBlock()),this.code.line("let hasAnyValues = this.isEmptyObject;"),this.code.line("const internalValueResult: any = {};");for(let r of e.attributes)r.isStored&&(r.getterType._type==="stored_class"?this.code.openBlock(`if (this.${r.storageName}?.internalValue !== undefined)`):this.code.openBlock(`if (this.${r.storageName} !== undefined)`),this.code.line("hasAnyValues = true;"),r.getterType._type==="stored_class"?this.code.line(`internalValueResult.${r.name} = this.${r.storageName}?.internalValue;`):this.code.line(`internalValueResult.${r.name} = this.${r.storageName};`),this.code.closeBlock());this.code.line("return hasAnyValues ? internalValueResult : undefined;"),this.code.closeBlock()}emitInternalValueSetter(e){this.code.openBlock(`public set internalValue(value: ${e.name}${e.isClass?"":" | cdktn.IResolvable"} | undefined)`),this.code.openBlock("if (value === undefined)"),this.code.line("this.isEmptyObject = false;"),e.isClass||this.code.line("this.resolvableValue = undefined;");for(let r of e.attributes)r.isStored&&(r.setterType._type==="stored_class"?this.code.line(`this.${r.storageName}.internalValue = undefined;`):r.setterType._type!=="none"&&this.code.line(`this.${r.storageName} = undefined;`));this.code.closeBlock(),e.isClass||(this.code.openBlock("else if (cdktn.Tokenization.isResolvable(value))"),this.code.line("this.isEmptyObject = false;"),this.code.line("this.resolvableValue = value;"),this.code.closeBlock()),this.code.openBlock("else"),this.code.line("this.isEmptyObject = Object.keys(value).length === 0;"),e.isClass||this.code.line("this.resolvableValue = undefined;");for(let r of e.attributes)r.isStored&&(r.setterType._type==="stored_class"?this.code.line(`this.${r.storageName}.internalValue = value.${r.name};`):r.setterType._type!=="none"&&this.code.line(`this.${r.storageName} = value.${r.name};`));this.code.closeBlock(),this.code.closeBlock()}emitToHclTerraformFunction(e){this.code.line(),this.code.openBlock(`export function ${(0,MEe.downcaseFirst)(e.name)}ToHclTerraform(struct?: ${e.isSingleItem&&!e.isProvider?`${e.name}OutputReference | `:""}${e.name}${e.isClass?"":" | cdktn.IResolvable"}): any`),this.code.line("if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }"),this.code.openBlock("if (cdktn.isComplexElement(struct))"),this.code.line('throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");'),this.code.closeBlock(),this.code.open("const attrs = {");for(let r of e.assignableAttributes)this.attributesEmitter.emitToHclTerraform(r,!0);this.code.close("};"),e.assignableAttributes.length>0?(this.code.line(),this.code.line("// remove undefined attributes"),this.code.line("return Object.fromEntries(Object.entries(attrs).filter(([_, value]) => value !== undefined && value.value !== undefined));")):this.code.line("return attrs;"),this.code.closeBlock(),this.code.line()}emitToTerraformFunction(e){this.code.line(),this.code.openBlock(`export function ${(0,MEe.downcaseFirst)(e.name)}ToTerraform(struct?: ${e.isSingleItem&&!e.isProvider?`${e.name}OutputReference | `:""}${e.name}${e.isClass?"":" | cdktn.IResolvable"}): any`),this.code.line("if (!cdktn.canInspect(struct) || cdktn.Tokenization.isResolvable(struct)) { return struct; }"),this.code.openBlock("if (cdktn.isComplexElement(struct))"),this.code.line('throw new Error("A complex element was used as configuration, this is not supported: https://cdktn.io/docs/concepts/resources#references");'),this.code.closeBlock(),this.code.openBlock("return");for(let r of e.assignableAttributes)this.attributesEmitter.emitToTerraform(r,!0);this.code.closeBlock(";"),this.code.closeBlock(),this.code.line()}};k2.StructEmitter=W$});var YEe=w(Oy=>{"use strict";var Wxt=Oy&&Oy.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),V$=Oy&&Oy.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wxt(e,t,r)};Object.defineProperty(Oy,"__esModule",{value:!0});V$($O(),Oy);V$(HEe(),Oy);V$(UEe(),Oy)});var P$=w(aZ=>{"use strict";Object.defineProperty(aZ,"__esModule",{value:!0});aZ.TerraformProviderGenerator=void 0;var jEe=iy(),iZ=In(),Vxt=t4(),Lxt=G$(),XEe=YEe(),Pxt=(t,e)=>{if(t.isModule)return!1;let r=e.split("/");if(r.length===1)return t.source===e;{let[n,i,a]=r;if(!n||!i||!a)throw new Error(`can't handle ${e}`);if(t.source){let s={hostname:"registry.terraform.io",namespace:"hashicorp",name:""},o=t.source.split("/"),l=o.length===3;switch(o.length){case 1:s.name=o[0].toLowerCase();break;case 2:s.namespace=o[0].toLowerCase(),s.name=o[1].toLowerCase();break;case 3:s.hostname=o[0].toLowerCase(),s.namespace=o[1].toLowerCase(),s.name=o[2].toLowerCase();break;default:throw new Error(`can't handle ${t.source}. Expected string with 1, 2 or 3 elements separated by '/'`)}return(!l||s.hostname===n)&&s.namespace===i&&s.name===a}return t.name===a}},L$=class{constructor(e,r,n={}){var i;this.code=e,this.schema=r,this.resourceParser=new Lxt.ResourceParser,this.versions={},this.code.indentation=2,this.importExtension=(i=n.importExtension)!==null&&i!==void 0?i:"",this.resourceEmitter=new XEe.ResourceEmitter(this.code),this.structEmitter=new XEe.StructEmitter(this.code,this.importExtension)}getProviderByConstraint(e){return Object.keys(this.schema.provider_schemas||{}).find(r=>Pxt(e,r))}generate(e){var r;let n=this.getProviderByConstraint(e);if(!n)throw iZ.logger.debug(`Could not find provider constraint for ${e} in schema: ${JSON.stringify(this.schema,null,2)}`),new Error(`Could not find provider with constraint ${JSON.stringify(e)}`);let i=(r=this.schema.provider_versions)===null||r===void 0?void 0:r[n];this.emitProvider(n,i,e),this.versions[n]=i}generateAll(){for(let e of Object.keys(this.schema.provider_schemas||{}))this.generate(new iZ.ConstructsMakerProviderTarget(new iZ.TerraformProviderConstraint(e),iZ.LANGUAGES[0]))}async save(e){await this.code.save(e)}buildResourceModels(e,r){var n;let i=(n=this.schema.provider_schemas)===null||n===void 0?void 0:n[e];if(!i)throw new Error(`Can not find provider '${e}' in schema`);let a=Object.entries(i.resource_schemas||{}).map(([o,l])=>this.resourceParser.parse(e,o,l,"resource",r)),s=Object.entries(i.data_source_schemas||{}).map(([o,l])=>this.resourceParser.parse(e,`data_${o}`,l,"data_source",r));return[].concat(...a,...s)}getClassNameForResource(e){return this.resourceParser.getClassNameForResource(e)}getNamespaceNameForResource(e){return this.resourceParser.getNamespaceNameForResource(e)}emitProvider(e,r,n){var i;let a=n?.name?n.name:(0,Vxt.parseFQPN)(e).name,s=(i=this.schema.provider_schemas)===null||i===void 0?void 0:i[e];if(!s)throw new Error(`Can not find provider '${e}' in schema`);let o=[];if(this.buildResourceModels(e,n).forEach(l=>{n&&(l.providerVersionConstraint=n.version,l.terraformProviderSource=n.source),l.providerVersion=r,l.structsRequireSharding?o.push(this.emitResourceWithComplexStruct(l)):o.push(this.emitResource(l)),this.emitResourceReadme(l)}),s.provider){let l=this.resourceParser.parse(e,"provider",s.provider,"provider",n);n&&(l.providerVersionConstraint=n.version,l.terraformProviderSource=n.source,l.terraformProviderName=n.name),l.providerVersion=r,o.push(this.emitResource(l)),this.emitResourceReadme(l)}this.emitIndexFile(a,o),this.emitLazyIndexFile(a,o)}emitResourceReadme(e){let r=`${e.namespaceFolderPath}/README.md`;this.code.openFile(r),this.code.line(`# \`${e.terraformType}\``),this.code.line();let n=e.isProvider?e.provider:e.terraformType;this.code.line(`Refer to the Terraform Registry for docs: [\`${n}\`](${e.linkToDocs}).`),this.code.closeFile(r)}emitIndexFile(e,r){let n=`providers/${e}`,i=`${n}/index.ts`;this.code.openFile(i),this.code.line("// generated by cdktn get");for(let a of r){let s=a.replace(`${n}/`,"").replace("/index.ts","");this.code.line(`export * as ${(0,jEe.toCamelCase)(s)} from './${s}/index${this.importExtension}';`)}this.code.line(),this.code.closeFile(i)}emitLazyIndexFile(e,r){let n=`providers/${e}`,i=`${n}/lazy-index.ts`;this.code.openFile(i),this.code.line("// generated by cdktn get");for(let a of r){let s=a.replace(`${n}/`,"").replace("/index.ts","");this.code.line(`Object.defineProperty(exports, '${(0,jEe.toCamelCase)(s)}', { get: function () { return require('./${s}'); } });`)}this.code.line(),this.code.closeFile(i)}emitResource(e){return this.code.openFile(e.filePath),this.emitFileHeader(e),this.structEmitter.emit(e),this.resourceEmitter.emit(e),this.code.closeFile(e.filePath),e.filePath}emitResourceWithComplexStruct(e){let r=[],n=e.filePath;if(this.code.openFile(n),this.code.line("// generated from terraform resource schema"),this.code.line(),e.structsRequireSharding){let i=`./${e.structsFolderName}/index${this.importExtension}`;e.referencedTypes.length>0&&this.code.line(`import { ${e.referencedTypes.join(`,
|
|
107
107
|
`)}} from '${i}';`),this.code.line(`export * from '${i}';`),e.importStatements.forEach(a=>this.code.line(a)),this.structEmitter.emitInterface(e,e.configStruct),this.resourceEmitter.emit(e),this.code.closeFile(n),this.structEmitter.emit(e),r.push(e.fileName),r.push(e.structsFolderName)}else e.importStatements.forEach(i=>this.code.line(i)),this.structEmitter.emit(e),this.resourceEmitter.emit(e),this.code.closeFile(n),r.push(e.fileName);return n}emitFileHeader(e){this.code.line(`// ${e.linkToDocs}`),this.code.line("// generated from terraform resource schema"),this.code.line(),e.importStatements.forEach(r=>this.code.line(r)),this.code.line(),this.code.line("// Configuration"),this.code.line()}};aZ.TerraformProviderGenerator=L$});var qEe=w(lZ=>{"use strict";Object.defineProperty(lZ,"__esModule",{value:!0});lZ.ModuleGenerator=void 0;var sZ=iy(),H$=r3(),zEe=eZ(),M$=class{constructor(e,r){this.code=e,this.targets=r,this.code.indentation=2;for(let n of this.targets)this.emitSubmodule(n)}emitSubmodule(e){let r=e.spec;if(!r)throw new Error(`missing spec for ${e.fqn}`);this.code.openFile(e.fileName),this.code.line("// generated by cdktn get"),this.code.line(`// ${e.source}`),this.code.line("import { TerraformModule, type TerraformModuleUserConfig } from 'cdktn';"),this.code.line("import { Construct } from 'constructs';");let n=this.code.toPascalCase(e.name.replace(/[-/.]/g,"_")),i=`${n}Config`;this.code.openBlock(`export interface ${i} extends TerraformModuleUserConfig`);for(let u of r.inputs){let f=u.required&&u.default===void 0?"":"?",h=(0,zEe.sanitizedComment)(this.code);u.description&&h.line(u.description),u.default&&h.line(u.default),u.type.includes("map(")&&h.line("The property type contains a map, they have special handling, please see {@link cdk.tf/module-map-inputs the docs}"),h.end(),this.code.line(`readonly ${H$.AttributeModel.escapeName((0,sZ.toCamelCase)(u.name))}${f}: ${oZ(u.type)};`)}this.code.closeBlock();let a=e.source.includes("."),s;e.source.includes("//")?s=e.source.replace("//modules",`/${e.version||"latest"}/submodules`):s=`${e.source}/${e.version||"latest"}`;let o=(0,zEe.sanitizedComment)(this.code);o.line(`Defines an ${n} based on a Terraform module`),o.line(""),o.line(a?`Source at ${e.source}`:`Docs at Terraform Registry: {@link https://registry.terraform.io/modules/${s} ${e.source}}`),o.end(),this.code.openBlock(`export class ${n} extends TerraformModule`),this.code.line("private readonly inputs: { [name: string]: any } = { };");let l=r.inputs.find(u=>u.required)?"":" = {}";this.code.open(`public constructor(scope: Construct, id: string, config: ${i}${l}) {`),this.code.open("super(scope, id, {"),this.code.line("...config,"),this.code.line(`source: '${e.source}',`),e.version&&this.code.line(`version: '${e.version}',`),this.code.close("});");for(let u of r.inputs){let f=H$.AttributeModel.escapeName((0,sZ.toCamelCase)(u.name));this.code.line(`this.${f} = config.${f};`)}this.code.close("}");for(let u of r.inputs){let f=H$.AttributeModel.escapeName((0,sZ.toCamelCase)(u.name)),h=oZ(u.type)+(u.required&&u.default===void 0?"":" | undefined");this.code.openBlock(`public get ${f}(): ${h}`),this.code.line(`return this.inputs['${u.name}'] as ${h};`),this.code.closeBlock(),this.code.openBlock(`public set ${f}(value: ${h})`),this.code.line(`this.inputs['${u.name}'] = value;`),this.code.closeBlock()}for(let u of r.outputs){let f=(0,sZ.toCamelCase)(u.name);this.code.openBlock(`public get ${f}Output()`),this.code.line(`return this.getString('${u.name}');`),this.code.closeBlock()}this.code.openBlock("protected synthesizeAttributes()"),this.code.line("return this.inputs;"),this.code.closeBlock(),this.code.openBlock("protected synthesizeHclAttributes(): { [name: string]: any }"),this.code.line("return Object.fromEntries("),this.code.line(" Object.entries(this.inputs)"),this.code.line(" .filter(([, val]) => val !== undefined)"),this.code.line(" .map(([key, val]) => {"),this.code.line(" return ["),this.code.line(" key,"),this.code.line(" {"),this.code.line(" value: val,"),this.code.line(' type: "any",'),this.code.line(" },"),this.code.line(" ];"),this.code.line(" })"),this.code.line(");"),this.code.closeBlock(),this.code.closeBlock(),this.code.closeFile(e.fileName)}};lZ.ModuleGenerator=M$;function oZ(t){if(t==="string")return"string";if(t==="number")return"number";if(t==="bool")return"boolean";if(t==="list")return"string[]";if(t==="map")return"{ [key: string]: string }";if(t==="tuple")return"string[]";if(t==="any")return"any";let e=Hxt(t);if(e)return e;throw new Error(`unknown type ${t}`)}function Hxt(t){let r=/^(object|list|map|set|tuple)\(([\s\S]+)\)/.exec(t);if(!r)return;let[,n,i]=r;if(n==="object")return"any";if(n==="list"||n==="set")return`${oZ(i)}[]`;if(n==="tuple")return"any[]";if(n==="map")return`{ [key: string]: ${oZ(i)} }`;throw new Error(`unexpected kind ${n}`)}});var exe=w((cor,QEe)=>{"use strict";QEe.exports=JEe;function JEe(t,e,r){t instanceof RegExp&&(t=KEe(t,r)),e instanceof RegExp&&(e=KEe(e,r));var n=$Ee(t,e,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+t.length,n[1]),post:r.slice(n[1]+e.length)}}function KEe(t,e){var r=e.match(t);return r?r[0]:null}JEe.range=$Ee;function $Ee(t,e,r){var n,i,a,s,o,l=r.indexOf(t),u=r.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(t===e)return[l,u];for(n=[],a=r.length;f>=0&&!o;)f==l?(n.push(f),l=r.indexOf(t,f+1)):n.length==1?o=[n.pop(),u]:(i=n.pop(),i<a&&(a=i,s=u),u=r.indexOf(e,f+1)),f=l<u&&l>=0?l:u;n.length&&(o=[a,s])}return o}});var uZ=w((dor,oxe)=>{"use strict";var txe=exe();oxe.exports=Yxt;var rxe="\0SLASH"+Math.random()+"\0",nxe="\0OPEN"+Math.random()+"\0",Y$="\0CLOSE"+Math.random()+"\0",ixe="\0COMMA"+Math.random()+"\0",axe="\0PERIOD"+Math.random()+"\0";function U$(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function Mxt(t){return t.split("\\\\").join(rxe).split("\\{").join(nxe).split("\\}").join(Y$).split("\\,").join(ixe).split("\\.").join(axe)}function Uxt(t){return t.split(rxe).join("\\").split(nxe).join("{").split(Y$).join("}").split(ixe).join(",").split(axe).join(".")}function sxe(t){if(!t)return[""];var e=[],r=txe("{","}",t);if(!r)return t.split(",");var n=r.pre,i=r.body,a=r.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var o=sxe(a);return a.length&&(s[s.length-1]+=o.shift(),s.push.apply(s,o)),e.push.apply(e,s),e}function Yxt(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),gA(Mxt(t),!0).map(Uxt)):[]}function jxt(t){return"{"+t+"}"}function Xxt(t){return/^-?0\d/.test(t)}function zxt(t,e){return t<=e}function qxt(t,e){return t>=e}function gA(t,e){var r=[],n=txe("{","}",t);if(!n)return[t];var i=n.pre,a=n.post.length?gA(n.post,!1):[""];if(/\$$/.test(n.pre))for(var s=0;s<a.length;s++){var o=i+"{"+n.body+"}"+a[s];r.push(o)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),f=l||u,h=n.body.indexOf(",")>=0;if(!f&&!h)return n.post.match(/,(?!,).*\}/)?(t=n.pre+"{"+n.body+Y$+n.post,gA(t)):[t];var g;if(f)g=n.body.split(/\.\./);else if(g=sxe(n.body),g.length===1&&(g=gA(g[0],!1).map(jxt),g.length===1))return a.map(function(Ne){return n.pre+g[0]+Ne});var _;if(f){var x=U$(g[0]),R=U$(g[1]),N=Math.max(g[0].length,g[1].length),D=g.length==3?Math.max(Math.abs(U$(g[2])),1):1,Z=zxt,L=R<x;L&&(D*=-1,Z=qxt);var z=g.some(Xxt);_=[];for(var ue=x;Z(ue,R);ue+=D){var K;if(u)K=String.fromCharCode(ue),K==="\\"&&(K="");else if(K=String(ue),z){var ne=N-K.length;if(ne>0){var H=new Array(ne+1).join("0");ue<0?K="-"+H+K.slice(1):K=H+K}}_.push(K)}}else{_=[];for(var ae=0;ae<g.length;ae++)_.push.apply(_,gA(g[ae],!1))}for(var ae=0;ae<_.length;ae++)for(var s=0;s<a.length;s++){var o=i+_[ae]+a[s];(!e||f||o)&&r.push(o)}}return r}});var lxe=w(cZ=>{"use strict";Object.defineProperty(cZ,"__esModule",{value:!0});cZ.assertValidPattern=void 0;var Kxt=1024*64,Jxt=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>Kxt)throw new TypeError("pattern is too long")};cZ.assertValidPattern=Jxt});var cxe=w(dZ=>{"use strict";Object.defineProperty(dZ,"__esModule",{value:!0});dZ.parseClass=void 0;var $xt={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},vA=t=>t.replace(/[[\]\\-]/g,"\\$&"),Qxt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),uxe=t=>t.join(""),ewt=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],a=r+1,s=!1,o=!1,l=!1,u=!1,f=r,h="";e:for(;a<t.length;){let R=t.charAt(a);if((R==="!"||R==="^")&&a===r+1){u=!0,a++;continue}if(R==="]"&&s&&!l){f=a+1;break}if(s=!0,R==="\\"&&!l){l=!0,a++;continue}if(R==="["&&!l){for(let[N,[D,Z,L]]of Object.entries($xt))if(t.startsWith(N,a)){if(h)return["$.",!1,t.length-r,!0];a+=N.length,L?i.push(D):n.push(D),o=o||Z;continue e}}if(l=!1,h){R>h?n.push(vA(h)+"-"+vA(R)):R===h&&n.push(vA(R)),h="",a++;continue}if(t.startsWith("-]",a+1)){n.push(vA(R+"-")),a+=2;continue}if(t.startsWith("-",a+1)){h=R,a+=2;continue}n.push(vA(R)),a++}if(f<a)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let R=n[0].length===2?n[0].slice(-1):n[0];return[Qxt(R),!1,f-r,!1]}let g="["+(u?"^":"")+uxe(n)+"]",_="["+(u?"":"^")+uxe(i)+"]";return[n.length&&i.length?"("+g+"|"+_+")":n.length?g:_,o,f-r,!0]};dZ.parseClass=ewt});var pZ=w(fZ=>{"use strict";Object.defineProperty(fZ,"__esModule",{value:!0});fZ.unescape=void 0;var twt=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");fZ.unescape=twt});var z$=w(vZ=>{"use strict";var Yp;Object.defineProperty(vZ,"__esModule",{value:!0});vZ.AST=void 0;var rwt=cxe(),hZ=pZ(),nwt=new Set(["!","?","+","*","@"]),j$=t=>nwt.has(t),dxe=t=>j$(t.type),iwt=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),awt=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),swt=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),fxe=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),owt="(?!(?:^|/)\\.\\.?(?:$|/))",mZ="(?!\\.)",lwt=new Set(["[","."]),uwt=new Set(["..","."]),cwt=new Set("().*{}+?[]^$\\!"),dwt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),X$="[^/]",pxe=X$+"*?",hxe=X$+"+?",gZ=class{type;#e;#r;#n=!1;#t=[];#s;#v;#u;#d=!1;#l;#o;#a=!1;constructor(e,r,n={}){this.type=e,e&&(this.#r=!0),this.#s=r,this.#e=this.#s?this.#s.#e:this,this.#l=this.#e===this?n:this.#e.#l,this.#u=this.#e===this?[]:this.#e.#u,e==="!"&&!this.#e.#d&&this.#u.push(this),this.#v=this.#s?this.#s.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#o=this.#t.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let r=e,n=r.#s;for(;n;){for(let i=r.#v+1;!n.type&&i<n.#t.length;i++)for(let a of e.#t){if(typeof a=="string")throw new Error("string part in extglob AST??");a.copyIn(n.#t[i])}r=n,n=r.#s}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof Yp&&r.#s===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let e=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#s?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#s?.isStart())return!1;if(this.#v===0)return!0;let e=this.#s;for(let r=0;r<this.#v;r++){let n=e.#t[r];if(!(n instanceof Yp&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let e=this.#s?this.#s.#t.length:0;return this.#v===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new Yp(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#b(e,r,n,i,a){let s=i.maxExtglobRecursion??2,o=!1,l=!1,u=-1,f=!1;if(r.type===null){let R=n,N="";for(;R<e.length;){let D=e.charAt(R++);if(o||D==="\\"){o=!o,N+=D;continue}if(l){R===u+1?(D==="^"||D==="!")&&(f=!0):D==="]"&&!(R===u+2&&f)&&(l=!1),N+=D;continue}else if(D==="["){l=!0,u=R,f=!1,N+=D;continue}if(!i.noext&&j$(D)&&e.charAt(R)==="("&&a<=s){r.push(N),N="";let L=new Yp(D,r);R=Yp.#b(e,L,R,i,a+1),r.push(L);continue}N+=D}return r.push(N),R}let h=n+1,g=new Yp(null,r),_=[],x="";for(;h<e.length;){let R=e.charAt(h++);if(o||R==="\\"){o=!o,x+=R;continue}if(l){h===u+1?(R==="^"||R==="!")&&(f=!0):R==="]"&&!(h===u+2&&f)&&(l=!1),x+=R;continue}else if(R==="["){l=!0,u=h,f=!1,x+=R;continue}if(j$(R)&&e.charAt(h)==="("&&(a<=s||r&&r.#I(R))){let D=r&&r.#I(R)?0:1;g.push(x),x="";let Z=new Yp(R,g);g.push(Z),h=Yp.#b(e,Z,h,i,a+D);continue}if(R==="|"){g.push(x),x="",_.push(g),g=new Yp(null,r);continue}if(R===")")return x===""&&r.#t.length===0&&(r.#a=!0),g.push(x),x="",r.push(..._,g),h;x+=R}return r.type=null,r.#r=void 0,r.#t=[e.substring(n-1)],h}#m(e){return this.#p(e,awt)}#p(e,r=iwt){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#I(n.type,r)}#I(e,r=swt){return!!r.get(this.type)?.includes(e)}#h(e,r){let n=e.#t[0],i=new Yp(null,n,this.options);i.#t.push(""),n.push(i),this.#E(e,r)}#E(e,r){let n=e.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#s=this);this.#o=void 0}#x(e){return!!fxe.get(this.type)?.has(e)}#g(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#x(r.type)}#S(e){let r=fxe.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let a of this.#t)typeof a=="object"&&(a.#s=this);this.type=i,this.#o=void 0,this.#a=!1}#_(){if(dxe(this)){let e=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#_(),this.#p(i)?(r=!1,this.#E(i,n)):this.#m(i)?(r=!1,this.#h(i,n)):this.#g(i)&&(r=!1,this.#S(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#_();this.#o=void 0}static fromGlob(e,r={}){let n=new Yp(null,void 0,r);return Yp.#b(e,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,n,i,a]=this.toRegExpSource();if(!(i||this.#r||this.#l.nocase&&!this.#l.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let o=(this.#l.nocase?"i":"")+(a?"u":"");return Object.assign(new RegExp(`^${r}$`,o),{_src:r,_glob:e})}get options(){return this.#l}toRegExpSource(e){let r=e??!!this.#l.dot;if(this.#e===this&&(this.#_(),this.#y()),!dxe(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(_=>{let[x,R,N,D]=typeof _=="string"?Yp.#w(_,this.#r,l):_.toRegExpSource(e);return this.#r=this.#r||N,this.#n=this.#n||D,x}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&uwt.has(this.#t[0]))){let x=lwt,R=r&&x.has(u.charAt(0))||u.startsWith("\\.")&&x.has(u.charAt(2))||u.startsWith("\\.\\.")&&x.has(u.charAt(4)),N=!r&&!e&&x.has(u.charAt(0));f=R?owt:N?mZ:""}let h="";return this.isEnd()&&this.#e.#d&&this.#s?.type==="!"&&(h="(?:$|\\/)"),[f+u+h,(0,hZ.unescape)(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",a=this.#f(r);if(this.isStart()&&this.isEnd()&&!a&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#r=void 0,[l,(0,hZ.unescape)(this.toString()),!1,!1]}let s=!n||e||r||!mZ?"":this.#f(!0);s===a&&(s=""),s&&(a=`(?:${a})(?:${s})*?`);let o="";if(this.type==="!"&&this.#a)o=(this.isStart()&&!r?mZ:"")+hxe;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!e?mZ:"")+pxe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;o=i+a+l}return[o,(0,hZ.unescape)(a),this.#r=!!this.#r,this.#n]}#f(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,a,s]=r.toRegExpSource(e);return this.#n=this.#n||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#w(e,r,n=!1){let i=!1,a="",s=!1,o=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,a+=(cwt.has(u)?"\\":"")+u,o=!1;continue}if(u==="\\"){l===e.length-1?a+="\\\\":i=!0;continue}if(u==="["){let[f,h,g,_]=(0,rwt.parseClass)(e,l);if(g){a+=f,s=s||h,l+=g-1,r=r||_,o=!1;continue}}if(u==="*"){if(o)continue;o=!0,a+=n&&/^[*]+$/.test(e)?hxe:pxe,r=!0;continue}else o=!1;if(u==="?"){a+=X$,r=!0;continue}a+=dwt(u)}return[a,(0,hZ.unescape)(e),!!r,s]}};vZ.AST=gZ;Yp=gZ});var q$=w(yZ=>{"use strict";Object.defineProperty(yZ,"__esModule",{value:!0});yZ.escape=void 0;var fwt=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");yZ.escape=fwt});var r4=w(Or=>{"use strict";var pwt=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});Or.unescape=Or.escape=Or.AST=Or.Minimatch=Or.match=Or.makeRe=Or.braceExpand=Or.defaults=Or.filter=Or.GLOBSTAR=Or.sep=Or.minimatch=void 0;var hwt=pwt(uZ()),bZ=lxe(),vxe=z$(),mwt=q$(),gwt=pZ(),vwt=(t,e,r={})=>((0,bZ.assertValidPattern)(e),!r.nocomment&&e.charAt(0)==="#"?!1:new N5(e,r).match(t));Or.minimatch=vwt;var ywt=/^\*+([^+@!?\*\[\(]*)$/,bwt=t=>e=>!e.startsWith(".")&&e.endsWith(t),_wt=t=>e=>e.endsWith(t),Cwt=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Iwt=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Swt=/^\*+\.\*+$/,Ewt=t=>!t.startsWith(".")&&t.includes("."),xwt=t=>t!=="."&&t!==".."&&t.includes("."),wwt=/^\.\*+$/,Awt=t=>t!=="."&&t!==".."&&t.startsWith("."),Rwt=/^\*+$/,Twt=t=>t.length!==0&&!t.startsWith("."),Bwt=t=>t.length!==0&&t!=="."&&t!=="..",Nwt=/^\?+([^+@!?\*\[\(]*)?$/,Dwt=([t,e=""])=>{let r=yxe([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Gwt=([t,e=""])=>{let r=bxe([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Fwt=([t,e=""])=>{let r=bxe([t]);return e?n=>r(n)&&n.endsWith(e):r},Owt=([t,e=""])=>{let r=yxe([t]);return e?n=>r(n)&&n.endsWith(e):r},yxe=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},bxe=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},_xe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",mxe={win32:{sep:"\\"},posix:{sep:"/"}};Or.sep=_xe==="win32"?mxe.win32.sep:mxe.posix.sep;Or.minimatch.sep=Or.sep;Or.GLOBSTAR=Symbol("globstar **");Or.minimatch.GLOBSTAR=Or.GLOBSTAR;var Zwt="[^/]",kwt=Zwt+"*?",Wwt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vwt="(?:(?!(?:\\/|^)\\.).)*?",Lwt=(t,e={})=>r=>(0,Or.minimatch)(r,t,e);Or.filter=Lwt;Or.minimatch.filter=Or.filter;var C1=(t,e={})=>Object.assign({},t,e),Pwt=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Or.minimatch;let e=Or.minimatch;return Object.assign((n,i,a={})=>e(n,i,C1(t,a)),{Minimatch:class extends e.Minimatch{constructor(i,a={}){super(i,C1(t,a))}static defaults(i){return e.defaults(C1(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,a,s={}){super(i,a,C1(t,s))}static fromGlob(i,a={}){return e.AST.fromGlob(i,C1(t,a))}},unescape:(n,i={})=>e.unescape(n,C1(t,i)),escape:(n,i={})=>e.escape(n,C1(t,i)),filter:(n,i={})=>e.filter(n,C1(t,i)),defaults:n=>e.defaults(C1(t,n)),makeRe:(n,i={})=>e.makeRe(n,C1(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,C1(t,i)),match:(n,i,a={})=>e.match(n,i,C1(t,a)),sep:e.sep,GLOBSTAR:Or.GLOBSTAR})};Or.defaults=Pwt;Or.minimatch.defaults=Or.defaults;var Hwt=(t,e={})=>((0,bZ.assertValidPattern)(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,hwt.default)(t));Or.braceExpand=Hwt;Or.minimatch.braceExpand=Or.braceExpand;var Mwt=(t,e={})=>new N5(t,e).makeRe();Or.makeRe=Mwt;Or.minimatch.makeRe=Or.makeRe;var Uwt=(t,e,r={})=>{let n=new N5(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};Or.match=Uwt;Or.minimatch.match=Or.match;var gxe=/[?*]|[+@!]\(.*?\)|\[|\]/,Ywt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),N5=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){(0,bZ.assertValidPattern)(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||_xe,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...a)=>console.error(...a)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(a=>this.slashSplit(a));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((a,s,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=a[0]===""&&a[1]===""&&(a[2]==="?"||!gxe.test(a[2]))&&!gxe.test(a[3]),u=/^[a-z]:/i.test(a[0]);if(l)return[...a.slice(0,4),...a.slice(4).map(f=>this.parse(f))];if(u)return[a[0],...a.slice(1).map(f=>this.parse(f))]}return a.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(a=>a.indexOf(!1)===-1),this.isWindows)for(let a=0;a<this.set.length;a++){let s=this.set[a];s[0]===""&&s[1]===""&&this.globParts[a][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let a=n[n.length-1];return i==="**"&&a==="**"?n:i===".."&&a&&a!==".."&&a!=="."&&a!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let a=e[i];i===1&&a===""&&e[0]===""||(a==="."||a==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let s=i;for(;n[s+1]==="**";)s++;s>i&&n.splice(i+1,s-i);let o=n[i+1],l=n[i+2],u=n[i+3];if(o!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(i,1);let f=n.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let s=1;s<n.length-1;s++){let o=n[s];s===1&&o===""&&n[0]===""||(o==="."||o==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let a=0;for(;(a=n.indexOf("..",a+1))!==-1;){let s=n[a-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let l=a===1&&n[a+1]==="**"?["."]:[];n.splice(a-1,2,...l),n.length===0&&n.push(""),a-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,a=0,s=[],o="";for(;i<e.length&&a<r.length;)if(e[i]===r[a])s.push(o==="b"?r[a]:e[i]),i++,a++;else if(n&&e[i]==="**"&&r[a]===e[i+1])s.push(e[i]),i++;else if(n&&r[a]==="**"&&e[i]===r[a+1])s.push(r[a]),a++;else if(e[i]==="*"&&r[a]&&(this.options.dot||!r[a].startsWith("."))&&r[a]!=="**"){if(o==="b")return!1;o="a",s.push(e[i]),i++,a++}else if(r[a]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(o==="a")return!1;o="b",s.push(r[a]),i++,a++}else return!1;return e.length===r.length&&s}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=0,a=0;if(this.isWindows){let o=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!o&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),f=!u&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),h=l?3:o?0:void 0,g=f?3:u?0:void 0;if(typeof h=="number"&&typeof g=="number"){let[_,x]=[e[h],r[g]];_.toLowerCase()===x.toLowerCase()&&(r[g]=_,a=g,i=h)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(Or.GLOBSTAR)?this.#e(e,r,n,i,a):this.#n(e,r,n,i,a)}#e(e,r,n,i,a){let s=r.indexOf(Or.GLOBSTAR,a),o=r.lastIndexOf(Or.GLOBSTAR),[l,u,f]=n?[r.slice(a,s),r.slice(s+1),[]]:[r.slice(a,s),r.slice(s+1,o),r.slice(o+1)];if(l.length){let Z=e.slice(i,i+l.length);if(!this.#n(Z,l,n,0,0))return!1;i+=l.length}let h=0;if(f.length){if(f.length+i>e.length)return!1;let Z=e.length-f.length;if(this.#n(e,f,n,Z,0))h=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(Z--,!this.#n(e,f,n,Z,0)))return!1;h=f.length+1}}if(!u.length){let Z=!!h;for(let L=i;L<e.length-h;L++){let z=String(e[L]);if(Z=!0,z==="."||z===".."||!this.options.dot&&z.startsWith("."))return!1}return n||Z}let g=[[[],0]],_=g[0],x=0,R=[0];for(let Z of u)Z===Or.GLOBSTAR?(R.push(x),_=[[],0],g.push(_)):(_[0].push(Z),x++);let N=g.length-1,D=e.length-h;for(let Z of g)Z[1]=D-(R[N--]+Z[0].length);return!!this.#r(e,g,i,0,n,0,!!h)}#r(e,r,n,i,a,s,o){let l=r[i];if(!l){for(let h=n;h<e.length;h++){o=!0;let g=e[h];if(g==="."||g===".."||!this.options.dot&&g.startsWith("."))return!1}return o}let[u,f]=l;for(;n<=f;){if(this.#n(e.slice(0,n+u.length),u,a,n,0)&&s<this.maxGlobstarRecursion){let _=this.#r(e,r,n+u.length,i+1,a,s+1,o);if(_!==!1)return _}let g=e[n];if(g==="."||g===".."||!this.options.dot&&g.startsWith("."))return!1;n++}return a||null}#n(e,r,n,i,a){let s,o,l,u;for(s=i,o=a,u=e.length,l=r.length;s<u&&o<l;s++,o++){this.debug("matchOne loop");let f=r[o],h=e[s];if(this.debug(r,f,h),f===!1||f===Or.GLOBSTAR)return!1;let g;if(typeof f=="string"?(g=h===f,this.debug("string match",f,h,g)):(g=f.test(h),this.debug("pattern match",f,h,g)),!g)return!1}if(s===u&&o===l)return!0;if(s===u)return n;if(o===l)return s===u-1&&e[s]==="";throw new Error("wtf?")}braceExpand(){return(0,Or.braceExpand)(this.pattern,this.options)}parse(e){(0,bZ.assertValidPattern)(e);let r=this.options;if(e==="**")return Or.GLOBSTAR;if(e==="")return"";let n,i=null;(n=e.match(Rwt))?i=r.dot?Bwt:Twt:(n=e.match(ywt))?i=(r.nocase?r.dot?Iwt:Cwt:r.dot?_wt:bwt)(n[1]):(n=e.match(Nwt))?i=(r.nocase?r.dot?Gwt:Dwt:r.dot?Fwt:Owt)(n):(n=e.match(Swt))?i=r.dot?xwt:Ewt:(n=e.match(wwt))&&(i=Awt);let a=vxe.AST.fromGlob(e,this.options).toMMPattern();return i&&typeof a=="object"&&Reflect.defineProperty(a,"test",{value:i}),a}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?kwt:r.dot?Wwt:Vwt,i=new Set(r.nocase?["i"]:[]),a=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))i.add(h);return typeof f=="string"?Ywt(f):f===Or.GLOBSTAR?Or.GLOBSTAR:f._src});return u.forEach((f,h)=>{let g=u[h+1],_=u[h-1];f!==Or.GLOBSTAR||_===Or.GLOBSTAR||(_===void 0?g!==void 0&&g!==Or.GLOBSTAR?u[h+1]="(?:\\/|"+n+"\\/)?"+g:u[h]=n:g===void 0?u[h-1]=_+"(?:\\/|"+n+")?":g!==Or.GLOBSTAR&&(u[h-1]=_+"(?:\\/|\\/"+n+"\\/)"+g,u[h+1]=Or.GLOBSTAR))}),u.filter(f=>f!==Or.GLOBSTAR).join("/")}).join("|"),[s,o]=e.length>1?["(?:",")"]:["",""];a="^"+s+a+o+"$",this.negate&&(a="^(?!"+a+").+$");try{this.regexp=new RegExp(a,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let a=this.set;this.debug(this.pattern,"set",a);let s=i[i.length-1];if(!s)for(let o=i.length-2;!s&&o>=0;o--)s=i[o];for(let o=0;o<a.length;o++){let l=a[o],u=i;if(n.matchBase&&l.length===1&&(u=[s]),this.matchOne(u,l,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Or.minimatch.defaults(e).Minimatch}};Or.Minimatch=N5;var jwt=z$();Object.defineProperty(Or,"AST",{enumerable:!0,get:function(){return jwt.AST}});var Xwt=q$();Object.defineProperty(Or,"escape",{enumerable:!0,get:function(){return Xwt.escape}});var zwt=pZ();Object.defineProperty(Or,"unescape",{enumerable:!0,get:function(){return zwt.unescape}});Or.minimatch.AST=vxe.AST;Or.minimatch.Minimatch=N5;Or.minimatch.escape=mwt.escape;Or.minimatch.unescape=gwt.unescape});var xxe=w(CZ=>{"use strict";Object.defineProperty(CZ,"__esModule",{value:!0});CZ.LRUCache=void 0;var i3=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ixe=new Set,K$=typeof process=="object"&&process?process:{},Sxe=(t,e,r,n)=>{typeof K$.emitWarning=="function"?K$.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},_Z=globalThis.AbortController,Cxe=globalThis.AbortSignal;if(typeof _Z>"u"){Cxe=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},_Z=class{constructor(){e()}signal=new Cxe;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=K$.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,Sxe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var qwt=t=>!Ixe.has(t),n4=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Exe=t=>n4(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?a3:null:null,a3=class extends Array{constructor(e){super(e),this.fill(0)}},J$=class t{heap;length;static#e=!1;static create(e){let r=Exe(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},$$=class t{#e;#r;#n;#t;#s;#v;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#u;#d;#l;#o;#a;#y;#b;#m;#p;#I;#h;#E;#x;#g;#S;#_;#f;static unsafeExposeInternals(e){return{starts:e.#x,ttls:e.#g,sizes:e.#E,keyMap:e.#l,keyList:e.#o,valList:e.#a,next:e.#y,prev:e.#b,get head(){return e.#m},get tail(){return e.#p},free:e.#I,isBackgroundFetch:r=>e.#c(r),backgroundFetch:(r,n,i,a)=>e.#W(r,n,i,a),moveToTail:r=>e.#L(r),indexes:r=>e.#R(r),rindexes:r=>e.#T(r),isStale:r=>e.#C(r)}}get max(){return this.#e}get maxSize(){return this.#r}get calculatedSize(){return this.#d}get size(){return this.#u}get fetchMethod(){return this.#s}get memoMethod(){return this.#v}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:h,noUpdateTTL:g,maxSize:_=0,maxEntrySize:x=0,sizeCalculation:R,fetchMethod:N,memoMethod:D,noDeleteOnFetchRejection:Z,noDeleteOnStaleGet:L,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:ue,ignoreFetchAbort:K}=e;if(r!==0&&!n4(r))throw new TypeError("max option must be a nonnegative integer");let ne=r?Exe(r):Array;if(!ne)throw new Error("invalid max value: "+r);if(this.#e=r,this.#r=_,this.maxEntrySize=x||this.#r,this.sizeCalculation=R,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(D!==void 0&&typeof D!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#v=D,N!==void 0&&typeof N!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#s=N,this.#_=!!N,this.#l=new Map,this.#o=new Array(r).fill(void 0),this.#a=new Array(r).fill(void 0),this.#y=new ne(r),this.#b=new ne(r),this.#m=0,this.#p=0,this.#I=J$.create(r),this.#u=0,this.#d=0,typeof u=="function"&&(this.#n=u),typeof f=="function"?(this.#t=f,this.#h=[]):(this.#t=void 0,this.#h=void 0),this.#S=!!this.#n,this.#f=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!Z,this.allowStaleOnFetchRejection=!!z,this.allowStaleOnFetchAbort=!!ue,this.ignoreFetchAbort=!!K,this.maxEntrySize!==0){if(this.#r!==0&&!n4(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!n4(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!L,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=n4(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!n4(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#w()}if(this.#e===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#r){let H="LRU_CACHE_UNBOUNDED";qwt(H)&&(Ixe.add(H),Sxe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",H,t))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#w(){let e=new a3(this.#e),r=new a3(this.#e);this.#g=e,this.#x=r,this.#D=(a,s,o=i3.now())=>{if(r[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#C(a)&&this.#N(this.#o[a],"expire")},s+1);l.unref&&l.unref()}},this.#A=a=>{r[a]=e[a]!==0?i3.now():0},this.#i=(a,s)=>{if(e[s]){let o=e[s],l=r[s];if(!o||!l)return;a.ttl=o,a.start=l,a.now=n||i();let u=a.now-l;a.remainingTTL=o-u}};let n=0,i=()=>{let a=i3.now();if(this.ttlResolution>0){n=a;let s=setTimeout(()=>n=0,this.ttlResolution);s.unref&&s.unref()}return a};this.getRemainingTTL=a=>{let s=this.#l.get(a);if(s===void 0)return 0;let o=e[s],l=r[s];if(!o||!l)return 1/0;let u=(n||i())-l;return o-u},this.#C=a=>{let s=r[a],o=e[a];return!!o&&!!s&&(n||i())-s>o}}#A=()=>{};#i=()=>{};#D=()=>{};#C=()=>!1;#B(){let e=new a3(this.#e);this.#d=0,this.#E=e,this.#G=r=>{this.#d-=e[r],e[r]=0},this.#O=(r,n,i,a)=>{if(this.#c(n))return 0;if(!n4(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(n,r),!n4(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#F=(r,n,i)=>{if(e[r]=n,this.#r){let a=this.#r-e[r];for(;this.#d>a;)this.#k(!0)}this.#d+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#d)}}#G=e=>{};#F=(e,r,n)=>{};#O=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#R({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#p;!(!this.#Z(r)||((e||!this.#C(r))&&(yield r),r===this.#m));)r=this.#b[r]}*#T({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#m;!(!this.#Z(r)||((e||!this.#C(r))&&(yield r),r===this.#p));)r=this.#y[r]}#Z(e){return e!==void 0&&this.#l.get(this.#o[e])===e}*entries(){for(let e of this.#R())this.#a[e]!==void 0&&this.#o[e]!==void 0&&!this.#c(this.#a[e])&&(yield[this.#o[e],this.#a[e]])}*rentries(){for(let e of this.#T())this.#a[e]!==void 0&&this.#o[e]!==void 0&&!this.#c(this.#a[e])&&(yield[this.#o[e],this.#a[e]])}*keys(){for(let e of this.#R()){let r=this.#o[e];r!==void 0&&!this.#c(this.#a[e])&&(yield r)}}*rkeys(){for(let e of this.#T()){let r=this.#o[e];r!==void 0&&!this.#c(this.#a[e])&&(yield r)}}*values(){for(let e of this.#R())this.#a[e]!==void 0&&!this.#c(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#T())this.#a[e]!==void 0&&!this.#c(this.#a[e])&&(yield this.#a[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#R()){let i=this.#a[n],a=this.#c(i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,this.#o[n],this))return this.get(this.#o[n],r)}}forEach(e,r=this){for(let n of this.#R()){let i=this.#a[n],a=this.#c(i)?i.__staleWhileFetching:i;a!==void 0&&e.call(r,a,this.#o[n],this)}}rforEach(e,r=this){for(let n of this.#T()){let i=this.#a[n],a=this.#c(i)?i.__staleWhileFetching:i;a!==void 0&&e.call(r,a,this.#o[n],this)}}purgeStale(){let e=!1;for(let r of this.#T({allowStale:!0}))this.#C(r)&&(this.#N(this.#o[r],"expire"),e=!0);return e}info(e){let r=this.#l.get(e);if(r===void 0)return;let n=this.#a[r],i=this.#c(n)?n.__staleWhileFetching:n;if(i===void 0)return;let a={value:i};if(this.#g&&this.#x){let s=this.#g[r],o=this.#x[r];if(s&&o){let l=s-(i3.now()-o);a.ttl=l,a.start=Date.now()}}return this.#E&&(a.size=this.#E[r]),a}dump(){let e=[];for(let r of this.#R({allowStale:!0})){let n=this.#o[r],i=this.#a[r],a=this.#c(i)?i.__staleWhileFetching:i;if(a===void 0||n===void 0)continue;let s={value:a};if(this.#g&&this.#x){s.ttl=this.#g[r];let o=i3.now()-this.#x[r];s.start=Math.floor(Date.now()-o)}this.#E&&(s.size=this.#E[r]),e.unshift([n,s])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=i3.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:a,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=n,{noUpdateTTL:u=this.noUpdateTTL}=n,f=this.#O(e,r,n.size||0,o);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#N(e,"set"),this;let h=this.#u===0?void 0:this.#l.get(e);if(h===void 0)h=this.#u===0?this.#p:this.#I.length!==0?this.#I.pop():this.#u===this.#e?this.#k(!1):this.#u,this.#o[h]=e,this.#a[h]=r,this.#l.set(e,h),this.#y[this.#p]=h,this.#b[h]=this.#p,this.#p=h,this.#u++,this.#F(h,f,l),l&&(l.set="add"),u=!1;else{this.#L(h);let g=this.#a[h];if(r!==g){if(this.#_&&this.#c(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:_}=g;_!==void 0&&!s&&(this.#S&&this.#n?.(_,e,"set"),this.#f&&this.#h?.push([_,e,"set"]))}else s||(this.#S&&this.#n?.(g,e,"set"),this.#f&&this.#h?.push([g,e,"set"]));if(this.#G(h),this.#F(h,f,l),this.#a[h]=r,l){l.set="replace";let _=g&&this.#c(g)?g.__staleWhileFetching:g;_!==void 0&&(l.oldValue=_)}}else l&&(l.set="update")}if(i!==0&&!this.#g&&this.#w(),this.#g&&(u||this.#D(h,i,a),l&&this.#i(l,h)),!s&&this.#f&&this.#h){let g=this.#h,_;for(;_=g?.shift();)this.#t?.(..._)}return this}pop(){try{for(;this.#u;){let e=this.#a[this.#m];if(this.#k(!0),this.#c(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#h){let e=this.#h,r;for(;r=e?.shift();)this.#t?.(...r)}}}#k(e){let r=this.#m,n=this.#o[r],i=this.#a[r];return this.#_&&this.#c(i)?i.__abortController.abort(new Error("evicted")):(this.#S||this.#f)&&(this.#S&&this.#n?.(i,n,"evict"),this.#f&&this.#h?.push([i,n,"evict"])),this.#G(r),e&&(this.#o[r]=void 0,this.#a[r]=void 0,this.#I.push(r)),this.#u===1?(this.#m=this.#p=0,this.#I.length=0):this.#m=this.#y[r],this.#l.delete(n),this.#u--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,a=this.#l.get(e);if(a!==void 0){let s=this.#a[a];if(this.#c(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#C(a))i&&(i.has="stale",this.#i(i,a));else return n&&this.#A(a),i&&(i.has="hit",this.#i(i,a)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#l.get(e);if(i===void 0||!n&&this.#C(i))return;let a=this.#a[i];return this.#c(a)?a.__staleWhileFetching:a}#W(e,r,n,i){let a=r===void 0?void 0:this.#a[r];if(this.#c(a))return a;let s=new _Z,{signal:o}=n;o?.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});let l={signal:s.signal,options:n,context:i},u=(R,N=!1)=>{let{aborted:D}=s.signal,Z=n.ignoreFetchAbort&&R!==void 0;if(n.status&&(D&&!N?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,Z&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),D&&!Z&&!N)return h(s.signal.reason);let L=_;return this.#a[r]===_&&(R===void 0?L.__staleWhileFetching?this.#a[r]=L.__staleWhileFetching:this.#N(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,R,l.options))),R},f=R=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=R),h(R)),h=R=>{let{aborted:N}=s.signal,D=N&&n.allowStaleOnFetchAbort,Z=D||n.allowStaleOnFetchRejection,L=Z||n.noDeleteOnFetchRejection,z=_;if(this.#a[r]===_&&(!L||z.__staleWhileFetching===void 0?this.#N(e,"fetch"):D||(this.#a[r]=z.__staleWhileFetching)),Z)return n.status&&z.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),z.__staleWhileFetching;if(z.__returned===z)throw R},g=(R,N)=>{let D=this.#s?.(e,a,l);D&&D instanceof Promise&&D.then(Z=>R(Z===void 0?void 0:Z),N),s.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(R(void 0),n.allowStaleOnFetchAbort&&(R=Z=>u(Z,!0)))})};n.status&&(n.status.fetchDispatched=!0);let _=new Promise(g).then(u,f),x=Object.assign(_,{__abortController:s,__staleWhileFetching:a,__returned:void 0});return r===void 0?(this.set(e,x,{...l.options,status:void 0}),r=this.#l.get(e)):this.#a[r]=x,x}#c(e){if(!this.#_)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof _Z}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:R,forceRefresh:N=!1,status:D,signal:Z}=r;if(!this.#_)return D&&(D.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:D});let L={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:s,noDisposeOnSet:o,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:x,ignoreFetchAbort:_,status:D,signal:Z},z=this.#l.get(e);if(z===void 0){D&&(D.fetch="miss");let ue=this.#W(e,z,L,R);return ue.__returned=ue}else{let ue=this.#a[z];if(this.#c(ue)){let Ne=n&&ue.__staleWhileFetching!==void 0;return D&&(D.fetch="inflight",Ne&&(D.returnedStale=!0)),Ne?ue.__staleWhileFetching:ue.__returned=ue}let K=this.#C(z);if(!N&&!K)return D&&(D.fetch="hit"),this.#L(z),i&&this.#A(z),D&&this.#i(D,z),ue;let ne=this.#W(e,z,L,R),ae=ne.__staleWhileFetching!==void 0&&n;return D&&(D.fetch=K?"stale":"refresh",ae&&K&&(D.returnedStale=!0)),ae?ne.__staleWhileFetching:ne.__returned=ne}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#v;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:a,...s}=r,o=this.get(e,s);if(!a&&o!==void 0)return o;let l=n(e,o,{options:s,context:i});return this.set(e,l,s),l}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=r,o=this.#l.get(e);if(o!==void 0){let l=this.#a[o],u=this.#c(l);return s&&this.#i(s,o),this.#C(o)?(s&&(s.get="stale"),u?(s&&n&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),n?l.__staleWhileFetching:void 0):(a||this.#N(e,"expire"),s&&n&&(s.returnedStale=!0),n?l:void 0)):(s&&(s.get="hit"),u?l.__staleWhileFetching:(this.#L(o),i&&this.#A(o),l))}else s&&(s.get="miss")}#V(e,r){this.#b[r]=e,this.#y[e]=r}#L(e){e!==this.#p&&(e===this.#m?this.#m=this.#y[e]:this.#V(this.#b[e],this.#y[e]),this.#V(this.#p,e),this.#p=e)}delete(e){return this.#N(e,"delete")}#N(e,r){let n=!1;if(this.#u!==0){let i=this.#l.get(e);if(i!==void 0)if(n=!0,this.#u===1)this.#P(r);else{this.#G(i);let a=this.#a[i];if(this.#c(a)?a.__abortController.abort(new Error("deleted")):(this.#S||this.#f)&&(this.#S&&this.#n?.(a,e,r),this.#f&&this.#h?.push([a,e,r])),this.#l.delete(e),this.#o[i]=void 0,this.#a[i]=void 0,i===this.#p)this.#p=this.#b[i];else if(i===this.#m)this.#m=this.#y[i];else{let s=this.#b[i];this.#y[s]=this.#y[i];let o=this.#y[i];this.#b[o]=this.#b[i]}this.#u--,this.#I.push(i)}}if(this.#f&&this.#h?.length){let i=this.#h,a;for(;a=i?.shift();)this.#t?.(...a)}return n}clear(){return this.#P("delete")}#P(e){for(let r of this.#T({allowStale:!0})){let n=this.#a[r];if(this.#c(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#o[r];this.#S&&this.#n?.(n,i,e),this.#f&&this.#h?.push([n,i,e])}}if(this.#l.clear(),this.#a.fill(void 0),this.#o.fill(void 0),this.#g&&this.#x&&(this.#g.fill(0),this.#x.fill(0)),this.#E&&this.#E.fill(0),this.#m=0,this.#p=0,this.#I.length=0,this.#d=0,this.#u=0,this.#f&&this.#h){let r=this.#h,n;for(;n=r?.shift();)this.#t?.(...n)}}};CZ.LRUCache=$$});var sQ=w(Yf=>{"use strict";var Kwt=Yf&&Yf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Yf,"__esModule",{value:!0});Yf.Minipass=Yf.isWritable=Yf.isReadable=Yf.isStream=void 0;var wxe=typeof process=="object"&&process?process:{stdout:null,stderr:null},aQ=require("node:events"),Bxe=Kwt(require("node:stream")),Jwt=require("node:string_decoder"),$wt=t=>!!t&&typeof t=="object"&&(t instanceof RZ||t instanceof Bxe.default||(0,Yf.isReadable)(t)||(0,Yf.isWritable)(t));Yf.isStream=$wt;var Qwt=t=>!!t&&typeof t=="object"&&t instanceof aQ.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==Bxe.default.Writable.prototype.pipe;Yf.isReadable=Qwt;var e7t=t=>!!t&&typeof t=="object"&&t instanceof aQ.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function";Yf.isWritable=e7t;var Zy=Symbol("EOF"),ky=Symbol("maybeEmitEnd"),i4=Symbol("emittedEnd"),IZ=Symbol("emittingEnd"),yA=Symbol("emittedError"),SZ=Symbol("closed"),Axe=Symbol("read"),EZ=Symbol("flush"),Rxe=Symbol("flushChunk"),Jm=Symbol("encoding"),s3=Symbol("decoder"),tc=Symbol("flowing"),bA=Symbol("paused"),o3=Symbol("resume"),rc=Symbol("buffer"),Uf=Symbol("pipes"),nc=Symbol("bufferLength"),Q$=Symbol("bufferPush"),xZ=Symbol("bufferShift"),Wd=Symbol("objectMode"),gl=Symbol("destroyed"),eQ=Symbol("error"),tQ=Symbol("emitData"),Txe=Symbol("emitEnd"),rQ=Symbol("emitEnd2"),W2=Symbol("async"),nQ=Symbol("abort"),wZ=Symbol("aborted"),_A=Symbol("signal"),D5=Symbol("dataListeners"),Q0=Symbol("discarded"),CA=t=>Promise.resolve().then(t),t7t=t=>t(),r7t=t=>t==="end"||t==="finish"||t==="prefinish",n7t=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,i7t=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),AZ=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[o3](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},iQ=class extends AZ{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=i=>r.emit("error",i),e.on("error",this.proxyErrors)}},a7t=t=>!!t.objectMode,s7t=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",RZ=class extends aQ.EventEmitter{[tc]=!1;[bA]=!1;[Uf]=[];[rc]=[];[Wd];[Jm];[W2];[s3];[Zy]=!1;[i4]=!1;[IZ]=!1;[SZ]=!1;[yA]=null;[nc]=0;[gl]=!1;[_A];[wZ]=!1;[D5]=0;[Q0]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");a7t(r)?(this[Wd]=!0,this[Jm]=null):s7t(r)?(this[Jm]=r.encoding,this[Wd]=!1):(this[Wd]=!1,this[Jm]=null),this[W2]=!!r.async,this[s3]=this[Jm]?new Jwt.StringDecoder(this[Jm]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[rc]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Uf]});let{signal:n}=r;n&&(this[_A]=n,n.aborted?this[nQ]():n.addEventListener("abort",()=>this[nQ]()))}get bufferLength(){return this[nc]}get encoding(){return this[Jm]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Wd]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[W2]}set async(e){this[W2]=this[W2]||!!e}[nQ](){this[wZ]=!0,this.emit("abort",this[_A]?.reason),this.destroy(this[_A]?.reason)}get aborted(){return this[wZ]}set aborted(e){}write(e,r,n){if(this[wZ])return!1;if(this[Zy])throw new Error("write after end");if(this[gl])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let i=this[W2]?CA:t7t;if(!this[Wd]&&!Buffer.isBuffer(e)){if(i7t(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(n7t(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Wd]?(this[tc]&&this[nc]!==0&&this[EZ](!0),this[tc]?this.emit("data",e):this[Q$](e),this[nc]!==0&&this.emit("readable"),n&&i(n),this[tc]):e.length?(typeof e=="string"&&!(r===this[Jm]&&!this[s3]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Jm]&&(e=this[s3].write(e)),this[tc]&&this[nc]!==0&&this[EZ](!0),this[tc]?this.emit("data",e):this[Q$](e),this[nc]!==0&&this.emit("readable"),n&&i(n),this[tc]):(this[nc]!==0&&this.emit("readable"),n&&i(n),this[tc])}read(e){if(this[gl])return null;if(this[Q0]=!1,this[nc]===0||e===0||e&&e>this[nc])return this[ky](),null;this[Wd]&&(e=null),this[rc].length>1&&!this[Wd]&&(this[rc]=[this[Jm]?this[rc].join(""):Buffer.concat(this[rc],this[nc])]);let r=this[Axe](e||null,this[rc][0]);return this[ky](),r}[Axe](e,r){if(this[Wd])this[xZ]();else{let n=r;e===n.length||e===null?this[xZ]():typeof n=="string"?(this[rc][0]=n.slice(e),r=n.slice(0,e),this[nc]-=e):(this[rc][0]=n.subarray(e),r=n.subarray(0,e),this[nc]-=e)}return this.emit("data",r),!this[rc].length&&!this[Zy]&&this.emit("drain"),r}end(e,r,n){return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r="utf8"),e!==void 0&&this.write(e,r),n&&this.once("end",n),this[Zy]=!0,this.writable=!1,(this[tc]||!this[bA])&&this[ky](),this}[o3](){this[gl]||(!this[D5]&&!this[Uf].length&&(this[Q0]=!0),this[bA]=!1,this[tc]=!0,this.emit("resume"),this[rc].length?this[EZ]():this[Zy]?this[ky]():this.emit("drain"))}resume(){return this[o3]()}pause(){this[tc]=!1,this[bA]=!0,this[Q0]=!1}get destroyed(){return this[gl]}get flowing(){return this[tc]}get paused(){return this[bA]}[Q$](e){this[Wd]?this[nc]+=1:this[nc]+=e.length,this[rc].push(e)}[xZ](){return this[Wd]?this[nc]-=1:this[nc]-=this[rc][0].length,this[rc].shift()}[EZ](e=!1){do;while(this[Rxe](this[xZ]())&&this[rc].length);!e&&!this[rc].length&&!this[Zy]&&this.emit("drain")}[Rxe](e){return this.emit("data",e),this[tc]}pipe(e,r){if(this[gl])return e;this[Q0]=!1;let n=this[i4];return r=r||{},e===wxe.stdout||e===wxe.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Uf].push(r.proxyErrors?new iQ(this,e,r):new AZ(this,e,r)),this[W2]?CA(()=>this[o3]()):this[o3]()),e}unpipe(e){let r=this[Uf].find(n=>n.dest===e);r&&(this[Uf].length===1?(this[tc]&&this[D5]===0&&(this[tc]=!1),this[Uf]=[]):this[Uf].splice(this[Uf].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let n=super.on(e,r);if(e==="data")this[Q0]=!1,this[D5]++,!this[Uf].length&&!this[tc]&&this[o3]();else if(e==="readable"&&this[nc]!==0)super.emit("readable");else if(r7t(e)&&this[i4])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[yA]){let i=r;this[W2]?CA(()=>i.call(this,this[yA])):i.call(this,this[yA])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[D5]=this.listeners("data").length,this[D5]===0&&!this[Q0]&&!this[Uf].length&&(this[tc]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[D5]=0,!this[Q0]&&!this[Uf].length&&(this[tc]=!1)),r}get emittedEnd(){return this[i4]}[ky](){!this[IZ]&&!this[i4]&&!this[gl]&&this[rc].length===0&&this[Zy]&&(this[IZ]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[SZ]&&this.emit("close"),this[IZ]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==gl&&this[gl])return!1;if(e==="data")return!this[Wd]&&!n?!1:this[W2]?(CA(()=>this[tQ](n)),!0):this[tQ](n);if(e==="end")return this[Txe]();if(e==="close"){if(this[SZ]=!0,!this[i4]&&!this[gl])return!1;let a=super.emit("close");return this.removeAllListeners("close"),a}else if(e==="error"){this[yA]=n,super.emit(eQ,n);let a=!this[_A]||this.listeners("error").length?super.emit("error",n):!1;return this[ky](),a}else if(e==="resume"){let a=super.emit("resume");return this[ky](),a}else if(e==="finish"||e==="prefinish"){let a=super.emit(e);return this.removeAllListeners(e),a}let i=super.emit(e,...r);return this[ky](),i}[tQ](e){for(let n of this[Uf])n.dest.write(e)===!1&&this.pause();let r=this[Q0]?!1:super.emit("data",e);return this[ky](),r}[Txe](){return this[i4]?!1:(this[i4]=!0,this.readable=!1,this[W2]?(CA(()=>this[rQ]()),!0):this[rQ]())}[rQ](){if(this[s3]){let r=this[s3].end();if(r){for(let n of this[Uf])n.dest.write(r);this[Q0]||super.emit("data",r)}}for(let r of this[Uf])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Wd]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[Wd]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[Wd])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Jm]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(gl,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Q0]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Zy])return r();let a,s,o=h=>{this.off("data",l),this.off("end",u),this.off(gl,f),r(),s(h)},l=h=>{this.off("error",o),this.off("end",u),this.off(gl,f),this.pause(),a({value:h,done:!!this[Zy]})},u=()=>{this.off("error",o),this.off("data",l),this.off(gl,f),r(),a({done:!0,value:void 0})},f=()=>o(new Error("stream destroyed"));return new Promise((h,g)=>{s=g,a=h,this.once(gl,f),this.once("error",o),this.once("end",u),this.once("data",l)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Q0]=!1;let e=!1,r=()=>(this.pause(),this.off(eQ,r),this.off(gl,r),this.off("end",r),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return r();let i=this.read();return i===null?r():{done:!1,value:i}};return this.once("end",r),this.once(eQ,r),this.once(gl,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[gl])return e?this.emit("error",e):this.emit(gl),this;this[gl]=!0,this[Q0]=!0,this[rc].length=0,this[nc]=0;let r=this;return typeof r.close=="function"&&!this[SZ]&&r.close(),e?this.emit("error",e):this.emit(gl),this}static get isStream(){return Yf.isStream}};Yf.Minipass=RZ});var Yxe=w(za=>{"use strict";var o7t=za&&za.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),l7t=za&&za.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),u7t=za&&za.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o7t(e,t,r);return l7t(e,t),e};Object.defineProperty(za,"__esModule",{value:!0});za.PathScurry=za.Path=za.PathScurryDarwin=za.PathScurryPosix=za.PathScurryWin32=za.PathScurryBase=za.PathPosix=za.PathWin32=za.PathBase=za.ChildrenCache=za.ResolveCache=void 0;var Zxe=xxe(),GZ=require("node:path"),c7t=require("node:url"),SA=require("fs"),d7t=u7t(require("node:fs")),f7t=SA.realpathSync.native,TZ=require("node:fs/promises"),Nxe=sQ(),EA={lstatSync:SA.lstatSync,readdir:SA.readdir,readdirSync:SA.readdirSync,readlinkSync:SA.readlinkSync,realpathSync:f7t,promises:{lstat:TZ.lstat,readdir:TZ.readdir,readlink:TZ.readlink,realpath:TZ.realpath}},kxe=t=>!t||t===EA||t===d7t?EA:{...EA,...t,promises:{...EA.promises,...t.promises||{}}},Wxe=/^\\\\\?\\([a-z]:)\\?$/i,p7t=t=>t.replace(/\//g,"\\").replace(Wxe,"$1\\"),h7t=/[\\\/]/,S1=0,Vxe=1,Lxe=2,V2=4,Pxe=6,Hxe=8,G5=10,Mxe=12,I1=15,IA=~I1,oQ=16,Dxe=32,xA=64,$m=128,BZ=256,DZ=512,Gxe=xA|$m|DZ,m7t=1023,lQ=t=>t.isFile()?Hxe:t.isDirectory()?V2:t.isSymbolicLink()?G5:t.isCharacterDevice()?Lxe:t.isBlockDevice()?Pxe:t.isSocket()?Mxe:t.isFIFO()?Vxe:S1,Fxe=new Map,wA=t=>{let e=Fxe.get(t);if(e)return e;let r=t.normalize("NFKD");return Fxe.set(t,r),r},Oxe=new Map,NZ=t=>{let e=Oxe.get(t);if(e)return e;let r=wA(t.toLowerCase());return Oxe.set(t,r),r},AA=class extends Zxe.LRUCache{constructor(){super({max:256})}};za.ResolveCache=AA;var FZ=class extends Zxe.LRUCache{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}};za.ChildrenCache=FZ;var Uxe=Symbol("PathScurry setAsCwd"),zc=class{name;root;roots;parent;nocase;isCWD=!1;#e;#r;get dev(){return this.#r}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#s;get uid(){return this.#s}#v;get gid(){return this.#v}#u;get rdev(){return this.#u}#d;get blksize(){return this.#d}#l;get ino(){return this.#l}#o;get size(){return this.#o}#a;get blocks(){return this.#a}#y;get atimeMs(){return this.#y}#b;get mtimeMs(){return this.#b}#m;get ctimeMs(){return this.#m}#p;get birthtimeMs(){return this.#p}#I;get atime(){return this.#I}#h;get mtime(){return this.#h}#E;get ctime(){return this.#E}#x;get birthtime(){return this.#x}#g;#S;#_;#f;#w;#A;#i;#D;#C;#B;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=S1,n,i,a,s,o){this.name=e,this.#g=a?NZ(e):wA(e),this.#i=r&m7t,this.nocase=a,this.roots=i,this.root=n||this,this.#D=s,this.#_=o.fullpath,this.#w=o.relative,this.#A=o.relativePosix,this.parent=o.parent,this.parent?this.#e=this.parent.#e:this.#e=kxe(o.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#D}resolve(e){if(!e)return this;let r=this.getRootString(e),i=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#G(i):this.#G(i)}#G(e){let r=this;for(let n of e)r=r.child(n);return r}children(){let e=this.#D.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#D.set(this,r),this.#i&=~oQ,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?NZ(e):wA(e);for(let l of n)if(l.#g===i)return l;let a=this.parent?this.sep:"",s=this.#_?this.#_+a+e:void 0,o=this.newChild(e,S1,{...r,parent:this,fullpath:s});return this.canReaddir()||(o.#i|=$m),n.push(o),o}relative(){if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,r=this.parent;if(!r)return this.#w=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,r=this.parent;if(!r)return this.#A=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+e}fullpath(){if(this.#_!==void 0)return this.#_;let e=this.name,r=this.parent;if(!r)return this.#_=this.name;let i=r.fullpath()+(r.parent?this.sep:"")+e;return this.#_=i}fullpathPosix(){if(this.#f!==void 0)return this.#f;if(this.sep==="/")return this.#f=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#f=`//?/${i}`:this.#f=i}let e=this.parent,r=e.fullpathPosix(),n=r+(!r||!e.parent?"":"/")+this.name;return this.#f=n}isUnknown(){return(this.#i&I1)===S1}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&I1)===Hxe}isDirectory(){return(this.#i&I1)===V2}isCharacterDevice(){return(this.#i&I1)===Lxe}isBlockDevice(){return(this.#i&I1)===Pxe}isFIFO(){return(this.#i&I1)===Vxe}isSocket(){return(this.#i&I1)===Mxe}isSymbolicLink(){return(this.#i&G5)===G5}lstatCached(){return this.#i&Dxe?this:void 0}readlinkCached(){return this.#C}realpathCached(){return this.#B}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#C)return!0;if(!this.parent)return!1;let e=this.#i&I1;return!(e!==S1&&e!==G5||this.#i&BZ||this.#i&$m)}calledReaddir(){return!!(this.#i&oQ)}isENOENT(){return!!(this.#i&$m)}isNamed(e){return this.nocase?this.#g===NZ(e):this.#g===wA(e)}async readlink(){let e=this.#C;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#e.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#C=n}catch(r){this.#c(r.code);return}}readlinkSync(){let e=this.#C;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#e.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#C=n}catch(r){this.#c(r.code);return}}#F(e){this.#i|=oQ;for(let r=e.provisional;r<e.length;r++){let n=e[r];n&&n.#O()}}#O(){this.#i&$m||(this.#i=(this.#i|$m)&IA,this.#R())}#R(){let e=this.children();e.provisional=0;for(let r of e)r.#O()}#T(){this.#i|=DZ,this.#Z()}#Z(){if(this.#i&xA)return;let e=this.#i;(e&I1)===V2&&(e&=IA),this.#i=e|xA,this.#R()}#k(e=""){e==="ENOTDIR"||e==="EPERM"?this.#Z():e==="ENOENT"?this.#O():this.children().provisional=0}#W(e=""){e==="ENOTDIR"?this.parent.#Z():e==="ENOENT"&&this.#O()}#c(e=""){let r=this.#i;r|=BZ,e==="ENOENT"&&(r|=$m),(e==="EINVAL"||e==="UNKNOWN")&&(r&=IA),this.#i=r,e==="ENOTDIR"&&this.parent&&this.parent.#Z()}#V(e,r){return this.#N(e,r)||this.#L(e,r)}#L(e,r){let n=lQ(e),i=this.newChild(e.name,n,{parent:this}),a=i.#i&I1;return a!==V2&&a!==G5&&a!==S1&&(i.#i|=xA),r.unshift(i),r.provisional++,i}#N(e,r){for(let n=r.provisional;n<r.length;n++){let i=r[n];if((this.nocase?NZ(e.name):wA(e.name))===i.#g)return this.#P(e,i,n,r)}}#P(e,r,n,i){let a=r.name;return r.#i=r.#i&IA|lQ(e),a!==e.name&&(r.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(r)),i.provisional++,r}async lstat(){if((this.#i&$m)===0)try{return this.#Y(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#W(e.code)}}lstatSync(){if((this.#i&$m)===0)try{return this.#Y(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#W(e.code)}}#Y(e){let{atime:r,atimeMs:n,birthtime:i,birthtimeMs:a,blksize:s,blocks:o,ctime:l,ctimeMs:u,dev:f,gid:h,ino:g,mode:_,mtime:x,mtimeMs:R,nlink:N,rdev:D,size:Z,uid:L}=e;this.#I=r,this.#y=n,this.#x=i,this.#p=a,this.#d=s,this.#a=o,this.#E=l,this.#m=u,this.#r=f,this.#v=h,this.#l=g,this.#n=_,this.#h=x,this.#b=R,this.#t=N,this.#u=D,this.#o=Z,this.#s=L;let z=lQ(e);this.#i=this.#i&IA|z|Dxe,z!==S1&&z!==V2&&z!==G5&&(this.#i|=xA)}#M=[];#U=!1;#j(e){this.#U=!1;let r=this.#M.slice();this.#M.length=0,r.forEach(n=>n(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let a=n.slice(0,n.provisional);r?e(null,a):queueMicrotask(()=>e(null,a));return}if(this.#M.push(e),this.#U)return;this.#U=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(a,s)=>{if(a)this.#k(a.code),n.provisional=0;else{for(let o of s)this.#V(o,n);this.#F(n)}this.#j(n.slice(0,n.provisional))})}#H;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#H)await this.#H;else{let n=()=>{};this.#H=new Promise(i=>n=i);try{for(let i of await this.#e.promises.readdir(r,{withFileTypes:!0}))this.#V(i,e);this.#F(e)}catch(i){this.#k(i.code),e.provisional=0}this.#H=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();try{for(let n of this.#e.readdirSync(r,{withFileTypes:!0}))this.#V(n,e);this.#F(e)}catch(n){this.#k(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&Gxe)return!1;let e=I1&this.#i;return e===S1||e===V2||e===G5}shouldWalk(e,r){return(this.#i&V2)===V2&&!(this.#i&Gxe)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#B)return this.#B;if(!((DZ|BZ|$m)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#B=this.resolve(e)}catch{this.#T()}}realpathSync(){if(this.#B)return this.#B;if(!((DZ|BZ|$m)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#B=this.resolve(e)}catch{this.#T()}}[Uxe](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],i=this;for(;i&&i.parent;)r.add(i),i.#w=n.join(this.sep),i.#A=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!r.has(i);)i.#w=void 0,i.#A=void 0,i=i.parent}};za.PathBase=zc;var RA=class t extends zc{sep="\\";splitSep=h7t;constructor(e,r=S1,n,i,a,s,o){super(e,r,n,i,a,s,o)}newChild(e,r=S1,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return GZ.win32.parse(e).root}getRoot(e){if(e=p7t(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=n;return this.roots[e]=new NA(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Wxe,"$1\\"),e===r}};za.PathWin32=RA;var TA=class t extends zc{splitSep="/";sep="/";constructor(e,r=S1,n,i,a,s,o){super(e,r,n,i,a,s,o)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=S1,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}};za.PathPosix=TA;var BA=class{root;rootPath;roots;cwd;#e;#r;#n;nocase;#t;constructor(e=process.cwd(),r,n,{nocase:i,childrenCacheSize:a=16*1024,fs:s=EA}={}){this.#t=kxe(s),(e instanceof URL||e.startsWith("file://"))&&(e=(0,c7t.fileURLToPath)(e));let o=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#e=new AA,this.#r=new AA,this.#n=new FZ(a);let l=o.substring(this.rootPath.length).split(n);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,h=r.sep,g=this.rootPath,_=!1;for(let x of l){let R=f--;u=u.child(x,{relative:new Array(R).fill("..").join(h),relativePosix:new Array(R).fill("..").join("/"),fullpath:g+=(_?"":h)+x}),_=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let r="";for(let a=e.length-1;a>=0;a--){let s=e[a];if(!(!s||s===".")&&(r=r?`${s}/${r}`:s,this.isAbsolute(s)))break}let n=this.#e.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpath();return this.#e.set(r,i),i}resolvePosix(...e){let r="";for(let a=e.length-1;a>=0;a--){let s=e[a];if(!(!s||s===".")&&(r=r?`${s}/${r}`:s,this.isAbsolute(s)))break}let n=this.#r.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd);let{withFileTypes:n}=r;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(a=>a.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd);let{withFileTypes:n=!0}=r;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e.withFileTypes,e=this.cwd);let n=await e.readlink();return r?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return r?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e.withFileTypes,e=this.cwd);let n=await e.realpath();return r?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return r?n:n?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:a,walkFilter:s}=r,o=[];(!a||a(e))&&o.push(n?e:e.fullpath());let l=new Set,u=(h,g)=>{l.add(h),h.readdirCB((_,x)=>{if(_)return g(_);let R=x.length;if(!R)return g();let N=()=>{--R===0&&g()};for(let D of x)(!a||a(D))&&o.push(n?D:D.fullpath()),i&&D.isSymbolicLink()?D.realpath().then(Z=>Z?.isUnknown()?Z.lstat():Z).then(Z=>Z?.shouldWalk(l,s)?u(Z,N):N()):D.shouldWalk(l,s)?u(D,N):N()},!0)},f=e;return new Promise((h,g)=>{u(f,_=>{if(_)return g(_);h(o)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:a,walkFilter:s}=r,o=[];(!a||a(e))&&o.push(n?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let h of f){(!a||a(h))&&o.push(n?h:h.fullpath());let g=h;if(h.isSymbolicLink()){if(!(i&&(g=h.realpathSync())))continue;g.isUnknown()&&g.lstatSync()}g.shouldWalk(l,s)&&l.add(g)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:a,walkFilter:s}=r;(!a||a(e))&&(yield n?e:e.fullpath());let o=new Set([e]);for(let l of o){let u=l.readdirSync();for(let f of u){(!a||a(f))&&(yield n?f:f.fullpath());let h=f;if(f.isSymbolicLink()){if(!(i&&(h=f.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(o,s)&&o.add(h)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:a,walkFilter:s}=r,o=new Nxe.Minipass({objectMode:!0});(!a||a(e))&&o.write(n?e:e.fullpath());let l=new Set,u=[e],f=0,h=()=>{let g=!1;for(;!g;){let _=u.shift();if(!_){f===0&&o.end();return}f++,l.add(_);let x=(N,D,Z=!1)=>{if(N)return o.emit("error",N);if(i&&!Z){let L=[];for(let z of D)z.isSymbolicLink()&&L.push(z.realpath().then(ue=>ue?.isUnknown()?ue.lstat():ue));if(L.length){Promise.all(L).then(()=>x(null,D,!0));return}}for(let L of D)L&&(!a||a(L))&&(o.write(n?L:L.fullpath())||(g=!0));f--;for(let L of D){let z=L.realpathCached()||L;z.shouldWalk(l,s)&&u.push(z)}g&&!o.flowing?o.once("drain",h):R||h()},R=!0;_.readdirCB(x,!0),R=!1}};return h(),o}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof zc||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:a,walkFilter:s}=r,o=new Nxe.Minipass({objectMode:!0}),l=new Set;(!a||a(e))&&o.write(n?e:e.fullpath());let u=[e],f=0,h=()=>{let g=!1;for(;!g;){let _=u.shift();if(!_){f===0&&o.end();return}f++,l.add(_);let x=_.readdirSync();for(let R of x)(!a||a(R))&&(o.write(n?R:R.fullpath())||(g=!0));f--;for(let R of x){let N=R;if(R.isSymbolicLink()){if(!(i&&(N=R.realpathSync())))continue;N.isUnknown()&&N.lstatSync()}N.shouldWalk(l,s)&&u.push(N)}}g&&!o.flowing&&o.once("drain",h)};return h(),o}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Uxe](r)}};za.PathScurryBase=BA;var NA=class extends BA{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,GZ.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return GZ.win32.parse(e).root.toUpperCase()}newRoot(e){return new RA(this.rootPath,V2,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}};za.PathScurryWin32=NA;var DA=class extends BA{sep="/";constructor(e=process.cwd(),r={}){let{nocase:n=!1}=r;super(e,GZ.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new TA(this.rootPath,V2,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}};za.PathScurryPosix=DA;var OZ=class extends DA{constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,{...r,nocase:n})}};za.PathScurryDarwin=OZ;za.Path=process.platform==="win32"?RA:TA;za.PathScurry=process.platform==="win32"?NA:process.platform==="darwin"?OZ:DA});var cQ=w(ZZ=>{"use strict";Object.defineProperty(ZZ,"__esModule",{value:!0});ZZ.Pattern=void 0;var g7t=r4(),v7t=t=>t.length>=1,y7t=t=>t.length>=1,uQ=class t{#e;#r;#n;length;#t;#s;#v;#u;#d;#l;#o=!0;constructor(e,r,n,i){if(!v7t(e))throw new TypeError("empty pattern list");if(!y7t(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#r=r,this.#n=n,this.#t=i,this.#n===0){if(this.isUNC()){let[a,s,o,l,...u]=this.#e,[f,h,g,_,...x]=this.#r;u[0]===""&&(u.shift(),x.shift());let R=[a,s,o,l,""].join("/"),N=[f,h,g,_,""].join("/");this.#e=[R,...u],this.#r=[N,...x],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[a,...s]=this.#e,[o,...l]=this.#r;s[0]===""&&(s.shift(),l.shift());let u=a+"/",f=o+"/";this.#e=[u,...s],this.#r=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===g7t.GLOBSTAR}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#v=this.#v||(this.#n===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#s!==void 0?this.#s:this.hasMore()?(this.#s=new t(this.#e,this.#r,this.#n+1,this.#t),this.#s.#l=this.#l,this.#s.#d=this.#d,this.#s.#u=this.#u,this.#s):this.#s=null}isUNC(){let e=this.#e;return this.#d!==void 0?this.#d:this.#d=this.#t==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#l!==void 0?this.#l:this.#l=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#o)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#o?!1:(this.#o=!1,!0)}};ZZ.Pattern=uQ});var fQ=w(kZ=>{"use strict";Object.defineProperty(kZ,"__esModule",{value:!0});kZ.Ignore=void 0;var jxe=r4(),b7t=cQ(),_7t=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",dQ=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:n,noext:i,noglobstar:a,platform:s=_7t}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=s,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:i,noglobstar:a,optimizationLevel:2,platform:s,nocomment:!0,nonegate:!0};for(let o of e)this.add(o)}add(e){let r=new jxe.Minimatch(e,this.mmopts);for(let n=0;n<r.set.length;n++){let i=r.set[n],a=r.globParts[n];if(!i||!a)throw new Error("invalid pattern object");for(;i[0]==="."&&a[0]===".";)i.shift(),a.shift();let s=new b7t.Pattern(i,a,0,this.platform),o=new jxe.Minimatch(s.globString(),this.mmopts),l=a[a.length-1]==="**",u=s.isAbsolute();u?this.absolute.push(o):this.relative.push(o),l&&(u?this.absoluteChildren.push(o):this.relativeChildren.push(o))}}ignored(e){let r=e.fullpath(),n=`${r}/`,i=e.relative()||".",a=`${i}/`;for(let s of this.relative)if(s.match(i)||s.match(a))return!0;for(let s of this.absolute)if(s.match(r)||s.match(n))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(r))return!0;return!1}};kZ.Ignore=dQ});var zxe=w(L2=>{"use strict";Object.defineProperty(L2,"__esModule",{value:!0});L2.Processor=L2.SubWalks=L2.MatchRecord=L2.HasWalkedCache=void 0;var Xxe=r4(),WZ=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let n=e.fullpath(),i=this.store.get(n);i?i.add(r.globString()):this.store.set(n,new Set([r.globString()]))}};L2.HasWalkedCache=WZ;var VZ=class{store=new Map;add(e,r,n){let i=(r?2:0)|(n?1:0),a=this.store.get(e);this.store.set(e,a===void 0?i:i&a)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}};L2.MatchRecord=VZ;var LZ=class{store=new Map;add(e,r){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===r.globString())||n.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}};L2.SubWalks=LZ;var pQ=class t{hasWalkedCache;matches=new VZ;subwalks=new LZ;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new WZ}processPatterns(e,r){this.patterns=r;let n=r.map(i=>[e,i]);for(let[i,a]of n){this.hasWalkedCache.storeWalked(i,a);let s=a.root(),o=a.isAbsolute()&&this.opts.absolute!==!1;if(s){i=i.resolve(s==="/"&&this.opts.root!==void 0?this.opts.root:s);let h=a.rest();if(h)a=h;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=a.pattern())=="string"&&(u=a.rest());)i=i.resolve(l),a=u,f=!0;if(l=a.pattern(),u=a.rest(),f){if(this.hasWalkedCache.hasWalked(i,a))continue;this.hasWalkedCache.storeWalked(i,a)}if(typeof l=="string"){let h=l===".."||l===""||l===".";this.matches.add(i.resolve(l),o,h);continue}else if(l===Xxe.GLOBSTAR){(!i.isSymbolicLink()||this.follow||a.checkFollowGlobstar())&&this.subwalks.add(i,a);let h=u?.pattern(),g=u?.rest();if(!u||(h===""||h===".")&&!g)this.matches.add(i,o,h===""||h===".");else if(h===".."){let _=i.parent||i;g?this.hasWalkedCache.hasWalked(_,g)||this.subwalks.add(_,g):this.matches.add(_,o,!0)}}else l instanceof RegExp&&this.subwalks.add(i,a)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let n=this.subwalks.get(e),i=this.child();for(let a of r)for(let s of n){let o=s.isAbsolute(),l=s.pattern(),u=s.rest();l===Xxe.GLOBSTAR?i.testGlobstar(a,s,u,o):l instanceof RegExp?i.testRegExp(a,l,u,o):i.testString(a,l,u,o)}return i}testGlobstar(e,r,n,i){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(e,n):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),n){let a=n.pattern();if(typeof a=="string"&&a!==".."&&a!==""&&a!==".")this.testString(e,a,n.rest(),i);else if(a===".."){let s=e.parent||e;this.subwalks.add(s,n)}else a instanceof RegExp&&this.testRegExp(e,a,n.rest(),i)}}testRegExp(e,r,n,i){r.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,r,n,i){e.isNamed(r)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}};L2.Processor=pQ});var Jxe=w(a4=>{"use strict";Object.defineProperty(a4,"__esModule",{value:!0});a4.GlobStream=a4.GlobWalker=a4.GlobUtil=void 0;var C7t=sQ(),qxe=fQ(),Kxe=zxe(),I7t=(t,e)=>typeof t=="string"?new qxe.Ignore([t],e):Array.isArray(t)?new qxe.Ignore(t,e):t,GA=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#r;#n;signal;maxDepth;includeChildMatches;constructor(e,r,n){if(this.patterns=e,this.path=r,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=I7t(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#s(e){return!!this.#r?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let a=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&a?.isSymbolicLink()){let s=await a.realpath();s&&(s.isUnknown()||this.opts.stat)&&await s.lstat()}return this.matchCheckTest(a,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let a=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&a?.isSymbolicLink()){let s=a.realpathSync();s&&(s?.isUnknown()||this.opts.stat)&&s.lstatSync()}return this.matchCheckTest(a,r)}matchFinish(e,r){if(this.#t(e))return;if(!this.includeChildMatches&&this.#r?.add){let a=`${e.relativePosix()}/**`;this.#r.add(a)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let a=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(a+i)}else{let a=this.opts.posix?e.relativePosix():e.relative(),s=this.opts.dotRelative&&!a.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(a?s+a+i:"."+i)}}async match(e,r,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,r)}matchSync(e,r,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,r)}walkCB(e,r,n){this.signal?.aborted&&n(),this.walkCB2(e,r,new Kxe.Processor(this.opts),n)}walkCB2(e,r,n,i){if(this.#s(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,r,n,i));return}n.processPatterns(e,r);let a=1,s=()=>{--a===0&&i()};for(let[o,l,u]of n.matches.entries())this.#t(o)||(a++,this.match(o,l,u).then(()=>s()));for(let o of n.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;a++;let l=o.readdirCached();o.calledReaddir()?this.walkCB3(o,l,n,s):o.readdirCB((u,f)=>this.walkCB3(o,f,n,s),!0)}s()}walkCB3(e,r,n,i){n=n.filterEntries(e,r);let a=1,s=()=>{--a===0&&i()};for(let[o,l,u]of n.matches.entries())this.#t(o)||(a++,this.match(o,l,u).then(()=>s()));for(let[o,l]of n.subwalks.entries())a++,this.walkCB2(o,l,n.child(),s);s()}walkCBSync(e,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,r,new Kxe.Processor(this.opts),n)}walkCB2Sync(e,r,n,i){if(this.#s(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,n,i));return}n.processPatterns(e,r);let a=1,s=()=>{--a===0&&i()};for(let[o,l,u]of n.matches.entries())this.#t(o)||this.matchSync(o,l,u);for(let o of n.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;a++;let l=o.readdirSync();this.walkCB3Sync(o,l,n,s)}s()}walkCB3Sync(e,r,n,i){n=n.filterEntries(e,r);let a=1,s=()=>{--a===0&&i()};for(let[o,l,u]of n.matches.entries())this.#t(o)||this.matchSync(o,l,u);for(let[o,l]of n.subwalks.entries())a++,this.walkCB2Sync(o,l,n.child(),s);s()}};a4.GlobUtil=GA;var hQ=class extends GA{matches=new Set;constructor(e,r,n){super(e,r,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}};a4.GlobWalker=hQ;var mQ=class extends GA{results;constructor(e,r,n){super(e,r,n),this.results=new C7t.Minipass({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};a4.GlobStream=mQ});var vQ=w(MZ=>{"use strict";Object.defineProperty(MZ,"__esModule",{value:!0});MZ.Glob=void 0;var S7t=r4(),E7t=require("node:url"),PZ=Yxe(),x7t=cQ(),HZ=Jxe(),w7t=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",gQ=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,E7t.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=r.platform||w7t,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=r.platform==="win32"?PZ.PathScurryWin32:r.platform==="darwin"?PZ.PathScurryDarwin:r.platform?PZ.PathScurryPosix:PZ.PathScurry;this.scurry=new l(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},a=this.pattern.map(l=>new S7t.Minimatch(l,i)),[s,o]=a.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=s.map((l,u)=>{let f=o[u];if(!f)throw new Error("invalid pattern object");return new x7t.Pattern(l,f,0,this.platform)})}async walk(){return[...await new HZ.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new HZ.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new HZ.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new HZ.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};MZ.Glob=gQ});var yQ=w(UZ=>{"use strict";Object.defineProperty(UZ,"__esModule",{value:!0});UZ.hasMagic=void 0;var A7t=r4(),R7t=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new A7t.Minimatch(r,e).hasMagic())return!0;return!1};UZ.hasMagic=R7t});var twe=w(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.glob=Mi.sync=Mi.iterate=Mi.iterateSync=Mi.stream=Mi.streamSync=Mi.Ignore=Mi.hasMagic=Mi.Glob=Mi.unescape=Mi.escape=void 0;Mi.globStreamSync=FA;Mi.globStream=bQ;Mi.globSync=_Q;Mi.globIterateSync=OA;Mi.globIterate=CQ;var $xe=r4(),F5=vQ(),T7t=yQ(),ewe=r4();Object.defineProperty(Mi,"escape",{enumerable:!0,get:function(){return ewe.escape}});Object.defineProperty(Mi,"unescape",{enumerable:!0,get:function(){return ewe.unescape}});var B7t=vQ();Object.defineProperty(Mi,"Glob",{enumerable:!0,get:function(){return B7t.Glob}});var N7t=yQ();Object.defineProperty(Mi,"hasMagic",{enumerable:!0,get:function(){return N7t.hasMagic}});var D7t=fQ();Object.defineProperty(Mi,"Ignore",{enumerable:!0,get:function(){return D7t.Ignore}});function FA(t,e={}){return new F5.Glob(t,e).streamSync()}function bQ(t,e={}){return new F5.Glob(t,e).stream()}function _Q(t,e={}){return new F5.Glob(t,e).walkSync()}async function Qxe(t,e={}){return new F5.Glob(t,e).walk()}function OA(t,e={}){return new F5.Glob(t,e).iterateSync()}function CQ(t,e={}){return new F5.Glob(t,e).iterate()}Mi.streamSync=FA;Mi.stream=Object.assign(bQ,{sync:FA});Mi.iterateSync=OA;Mi.iterate=Object.assign(CQ,{sync:OA});Mi.sync=Object.assign(_Q,{stream:FA,iterate:OA});Mi.glob=Object.assign(Qxe,{glob:Qxe,globSync:_Q,sync:Mi.sync,globStream:bQ,stream:Mi.stream,globStreamSync:FA,streamSync:Mi.streamSync,globIterate:CQ,iterate:Mi.iterate,globIterateSync:OA,iterateSync:Mi.iterateSync,Glob:F5.Glob,hasMagic:T7t.hasMagic,escape:$xe.escape,unescape:$xe.unescape});Mi.glob.glob=Mi.glob});var EQ=w(jf=>{"use strict";var G7t=jf&&jf.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),F7t=jf&&jf.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),rwe=jf&&jf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G7t(e,t,r);return F7t(e,t),e};Object.defineProperty(jf,"__esModule",{value:!0});jf.determineGoModuleName=jf.ConstructsMaker=jf.generateJsiiLanguage=void 0;var xs=rwe(hu()),kn=rwe(require("path")),O7t=iy(),IQ=In(),ts=In(),eh=In(),Z7t=P$(),k7t=qEe(),nwe=twe(),W7t=t4(),V7t=require.resolve("jsii-pacmak/bin/jsii-pacmak"),L7t=require.resolve("jsii/bin/jsii");async function iwe(t,e,r,n=[]){await(0,IQ.mkdtemp)(async i=>{await t.save(i);let a=n.flatMap(N=>nwe.glob.sync(N,{cwd:i}));await Promise.all(a.map(N=>xs.remove(kn.join(i,N))));let s=["--silence-warnings","reserved-word"],o=e.entrypoint,l=kn.join(kn.dirname(o),kn.basename(o,".ts")),u=e.moduleKey.replace(/\./g,"").replace(/\//g,""),f=e.deps,h={},g={};for(let N of f){let D=await xs.readJson(kn.join(N,"package.json")),Z=D.name,L=D.version,z=kn.join(kn.join(i,"node_modules"),Z);await xs.mkdirp(kn.dirname(z)),await xs.copy(N,z,{dereference:!0}),Z.startsWith("@types/")||(g[Z]=L)}let _={name:u,version:"0.0.0",author:"generated@generated.com",main:`${l}.js`,types:`${l}.d.ts`,license:"UNLICENSED",repository:{url:"http://generated",type:"git"},jsii:{outdir:"dist",targets:h},dependencies:g,peerDependencies:g};e.exports&&(_.exports=e.exports),e.python&&(h.python={distName:"generated",module:e.python.moduleName}),e.java&&(h.java={package:e.java.package,maven:{groupId:"generated",artifactId:"generated"}}),e.csharp&&(h.dotnet={namespace:e.csharp.namespace,packageId:e.csharp.namespace}),e.golang&&(h.go={moduleName:e.golang.moduleName,packageName:e.golang.packageName}),await xs.writeFile(kn.join(i,"package.json"),JSON.stringify(_,void 0,2));let x=(0,ts.logTimespan)("jsii");await(0,IQ.exec)(L7t,s,{cwd:i}),x(),e.jsii&&await xs.copy(kn.join(i,".jsii"),e.jsii.path);let R=(0,ts.logTimespan)("jsii-pacmak");if(await(0,IQ.exec)(V7t,["--code-only"],{cwd:i}),R(),e.python){let N=e.python.moduleName.replace(/\./g,"/"),D=kn.resolve(kn.join(i,"dist/python/src",N)),Z=kn.join(e.python.outdir,N);await xs.move(D,Z,{overwrite:!0})}if(e.java){let N=kn.resolve(kn.join(i,"dist/java/src/")),D=kn.join(e.java.outdir,"src/"),Z=e.java.package.replace(/\./g,"/");await xs.mkdirp(kn.join(D,"main/java",Z)),await xs.mkdirp(kn.join(D,"main/resources",Z)),await xs.copy(N,D,{recursive:!0,overwrite:!1})}if(e.csharp){let N=e.csharp.namespace,D=kn.resolve(kn.join(i,"dist/dotnet/",N)),Z=kn.join(e.csharp.outdir,N);await xs.move(D,Z,{overwrite:!0})}if(e.golang){let N=e.golang.packageName,D=kn.resolve(kn.join(i,"dist/go/",N)),Z=kn.join(e.golang.outdir,N);await xs.move(D,Z,{overwrite:!0}),await xs.remove(kn.join(Z,"go.mod"))}["versions.json","constraints.json"].forEach(N=>{try{xs.copySync(kn.resolve(i,N),kn.resolve(r,N))}catch(D){ts.logger.debug(`Failed to copy ${N}: ${D}`)}})})}jf.generateJsiiLanguage=iwe;var SQ=class{constructor(e,r,n=async()=>{}){this.options=e,this.schemaCachePath=r,this.reportTelemetry=n,this.codeMakerOutdir=kn.resolve(this.options.codeMakerOutput),xs.mkdirpSync(this.codeMakerOutdir),this.code=new O7t.CodeMaker,this.versions={}}async generateTypescriptProvider(e,r){var n;let i=(0,ts.logTimespan)(`Generate Typescript for ${e.name}`),a=new Z7t.TerraformProviderGenerator(this.code,r,{importExtension:(n=this.options.languageOptions)===null||n===void 0?void 0:n.importExtension});a.generate(e),this.versions={...this.versions,...a.versions},i()}async filterAlreadyGenerated(e){let r="{}";try{r=await xs.readFile(kn.join(this.codeMakerOutdir,"constraints.json"),"utf8")}catch(a){return ts.logger.debug(`Could not find constraints.json file while filtering: ${a}. This means no providers were generated, so all constraints need to be generated.`),e}ts.logger.debug(`Found constraints.json file: ${r}`);let n={};try{n=JSON.parse(r)}catch(a){return ts.logger.info(`Could not parse constraints.json file while filtering: ${a}. Generating all constraints.`),e}if(ts.logger.debug(`Found previous constraints: ${JSON.stringify(n,null,2)}`),!n.providers||typeof n.providers!="object")return ts.logger.info(`Could not find providers in constraints.json file, generating all constraints. The constraints file was ${JSON.stringify(n,null,2)}`),e;if(n.cdktf!==eh.DISPLAY_VERSION)return ts.logger.info(`The CDKTN version has changed, generating all constraints. The previous version was ${n.cdktf}, the current version is ${eh.DISPLAY_VERSION}`),e;let i=e.filter(a=>{let s=n.providers[a.fqn]===a.version,o=!1;switch(this.options.targetLanguage){case eh.Language.TYPESCRIPT:o=xs.existsSync(kn.join(this.codeMakerOutdir,"providers",a.name));break;case eh.Language.PYTHON:case eh.Language.JAVA:case eh.Language.CSHARP:o=xs.existsSync(kn.join(this.codeMakerOutdir,a.name));break;case eh.Language.GO:o=xs.existsSync(kn.join(this.codeMakerOutdir,a.namespace||"hashicorp",a.name));break}return!(s&&o)});return ts.logger.debug(`Constraints to generate: ${JSON.stringify(i,null,2)}`),i}async generateTypescriptModule(e,r){let n=(0,ts.logTimespan)(`Generate Typescript for ${e.name}`);e.spec=r,new k7t.ModuleGenerator(this.code,[e]),n()}async generateTypescript(e,r){var n;if(e.isModule){let i=(n=r.moduleSchema)===null||n===void 0?void 0:n[e.moduleKey];if(!i)throw ts.Errors.Internal(`Could not generate schema for module ${e.moduleKey}`);await this.generateTypescriptModule(e,i)}else if(e.isProvider){if(!r.providerSchema)throw ts.Errors.Internal("Could not generate schema for providers");await this.generateTypescriptProvider(e,r.providerSchema)}else throw new Error(`Unknown target type used to generate bindings: ${e.name}`)}updateVersionsFile(e){ts.logger.debug(`Updating versions file with generated versions ${JSON.stringify(this.versions,null,2)} with allowed constraints ${JSON.stringify(e,null,2)}`);let r="versions.json",n={};try{n=JSON.parse(xs.readFileSync(kn.resolve(this.codeMakerOutdir,r),"utf8")),ts.logger.debug(`Read existing versions file: ${JSON.stringify(n,null,2)}`)}catch(a){ts.logger.debug(`Could not read versions file, this is expected if there are no pre-existing local providers: ${a}`)}let i=e.reduce((a,s)=>{let o=Object.entries(n).find(([l])=>l.endsWith(s.fqn));if(o){let[l,u]=o;return{...a,[l]:u}}return a},{});return ts.logger.debug(`Writing versions file (${r}): ${JSON.stringify(i,null,2)}`),this.code.openFile(r),this.code.line(JSON.stringify({...i,...this.versions},null,2)),this.code.closeFile(r),r}async removeFoldersThatShouldNotExist(e){if(ts.logger.debug(`Removing providers except for ${JSON.stringify(e,null,2)}`),!this.isJavascriptTarget)return;let r=[],n=kn.resolve(this.codeMakerOutdir,"providers");try{r=await xs.readdir(n)}catch(a){ts.logger.debug(`Error listing files in providers folder '${n}': ${a}`)}return r.filter(a=>xs.statSync(kn.resolve(this.codeMakerOutdir,"providers",a)).isDirectory()).forEach(a=>{e.some(o=>o.name===a)||(ts.logger.debug(`Removing folder ${a} from providers`),xs.removeSync(kn.resolve(this.codeMakerOutdir,"providers",a)))})}emitConstraintsFile(e){let r="constraints.json",n={cdktf:eh.DISPLAY_VERSION,providers:e.sort((i,a)=>i.fqn.localeCompare(a.fqn)).reduce((i,a)=>({...i,[a.fqn]:a.version}),{})};return this.code.openFile(r),this.code.line(JSON.stringify(n,null,2)),this.code.closeFile(r),r}async generateJsiiLanguage(e){var r;let n=[kn.dirname(require.resolve("@types/node/package.json")),kn.dirname(require.resolve("constructs/package.json")),kn.dirname(require.resolve("cdktn/package.json"))],i={entrypoint:e.fileName,deps:n,moduleKey:e.moduleKey,exports:e.isProvider?{".":{import:`./providers/${e.name}/index.js`,require:`./providers/${e.name}/lazy-index.js`}}:void 0};if(this.options.outputJsii&&(i.jsii={path:this.options.outputJsii}),this.isPythonTarget&&(i.python={outdir:this.codeMakerOutdir,moduleName:e.srcMakName}),this.isJavaTarget){if(this.options.codeMakerOutput.includes("/")||this.options.codeMakerOutput.includes("\\"))throw ts.Errors.Usage('When using Java the "codeMakerOutput" option in the cdktf.json must be the organization identifier for your project (e.g. com.my-company), not a path. The generated Java code will be placed in a subdirectory of the given directory. If you are migrating from a < 0.19 version of cdktf you want to change the codemakerOutput to "imports".');i.java={outdir:".",package:`${this.options.codeMakerOutput}.${e.srcMakName}`}}if(this.isCsharpTarget&&(i.csharp={outdir:this.codeMakerOutdir,namespace:e.srcMakName}),this.isGoTarget){let s=kn.join(this.codeMakerOutdir,(r=e.namespace)!==null&&r!==void 0?r:"");i.golang={outdir:s,moduleName:await(0,jf.determineGoModuleName)(s),packageName:e.srcMakName}}process.env.NODE_OPTIONS&&!process.env.NODE_OPTIONS.includes("--max-old-space-size")?ts.logger.warn(`found NODE_OPTIONS environment variable without a setting for --max-old-space-size.
|
|
108
108
|
The provider generation needs a substantial amount of memory (~13GB) for some providers and languages.
|
|
109
109
|
So cdktn-cli sets it to NODE_OPTIONS="--max-old-space-size=16384" by default. As your environment already contains
|