create-zuplo-api 7.0.1 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- (()=>{var t={7213:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.createFileSystemAdapter=u.FILE_SYSTEM_ADAPTER=void 0;const m=p(9896);u.FILE_SYSTEM_ADAPTER={lstat:m.lstat,stat:m.stat,lstatSync:m.lstatSync,statSync:m.statSync,readdir:m.readdir,readdirSync:m.readdirSync};function createFileSystemAdapter(t){if(t===undefined){return u.FILE_SYSTEM_ADAPTER}return Object.assign(Object.assign({},u.FILE_SYSTEM_ADAPTER),t)}u.createFileSystemAdapter=createFileSystemAdapter},7190:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const p=process.versions.node.split(".");if(p[0]===undefined||p[1]===undefined){throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`)}const m=Number.parseInt(p[0],10);const g=Number.parseInt(p[1],10);const v=10;const b=10;const w=m>v;const E=m===v&&g>=b;u.IS_SUPPORT_READDIR_WITH_FILE_TYPES=w||E},4227:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.Settings=u.scandirSync=u.scandir=void 0;const m=p(1250);const g=p(5959);const v=p(6);u.Settings=v.default;function scandir(t,u,p){if(typeof u==="function"){m.read(t,getSettings(),u);return}m.read(t,getSettings(u),p)}u.scandir=scandir;function scandirSync(t,u){const p=getSettings(u);return g.read(t,p)}u.scandirSync=scandirSync;function getSettings(t={}){if(t instanceof v.default){return t}return new v.default(t)}},1250:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.readdir=u.readdirWithFileTypes=u.read=void 0;const m=p(9321);const g=p(5876);const v=p(7190);const b=p(2829);const w=p(5521);function read(t,u,p){if(!u.stats&&v.IS_SUPPORT_READDIR_WITH_FILE_TYPES){readdirWithFileTypes(t,u,p);return}readdir(t,u,p)}u.read=read;function readdirWithFileTypes(t,u,p){u.fs.readdir(t,{withFileTypes:true},((m,v)=>{if(m!==null){callFailureCallback(p,m);return}const b=v.map((p=>({dirent:p,name:p.name,path:w.joinPathSegments(t,p.name,u.pathSegmentSeparator)})));if(!u.followSymbolicLinks){callSuccessCallback(p,b);return}const E=b.map((t=>makeRplTaskEntry(t,u)));g(E,((t,u)=>{if(t!==null){callFailureCallback(p,t);return}callSuccessCallback(p,u)}))}))}u.readdirWithFileTypes=readdirWithFileTypes;function makeRplTaskEntry(t,u){return p=>{if(!t.dirent.isSymbolicLink()){p(null,t);return}u.fs.stat(t.path,((m,g)=>{if(m!==null){if(u.throwErrorOnBrokenSymbolicLink){p(m);return}p(null,t);return}t.dirent=b.fs.createDirentFromStats(t.name,g);p(null,t)}))}}function readdir(t,u,p){u.fs.readdir(t,((v,E)=>{if(v!==null){callFailureCallback(p,v);return}const S=E.map((p=>{const g=w.joinPathSegments(t,p,u.pathSegmentSeparator);return t=>{m.stat(g,u.fsStatSettings,((m,v)=>{if(m!==null){t(m);return}const w={name:p,path:g,dirent:b.fs.createDirentFromStats(p,v)};if(u.stats){w.stats=v}t(null,w)}))}}));g(S,((t,u)=>{if(t!==null){callFailureCallback(p,t);return}callSuccessCallback(p,u)}))}))}u.readdir=readdir;function callFailureCallback(t,u){t(u)}function callSuccessCallback(t,u){t(null,u)}},5521:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.joinPathSegments=void 0;function joinPathSegments(t,u,p){if(t.endsWith(p)){return t+u}return t+p+u}u.joinPathSegments=joinPathSegments},5959:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.readdir=u.readdirWithFileTypes=u.read=void 0;const m=p(9321);const g=p(7190);const v=p(2829);const b=p(5521);function read(t,u){if(!u.stats&&g.IS_SUPPORT_READDIR_WITH_FILE_TYPES){return readdirWithFileTypes(t,u)}return readdir(t,u)}u.read=read;function readdirWithFileTypes(t,u){const p=u.fs.readdirSync(t,{withFileTypes:true});return p.map((p=>{const m={dirent:p,name:p.name,path:b.joinPathSegments(t,p.name,u.pathSegmentSeparator)};if(m.dirent.isSymbolicLink()&&u.followSymbolicLinks){try{const t=u.fs.statSync(m.path);m.dirent=v.fs.createDirentFromStats(m.name,t)}catch(t){if(u.throwErrorOnBrokenSymbolicLink){throw t}}}return m}))}u.readdirWithFileTypes=readdirWithFileTypes;function readdir(t,u){const p=u.fs.readdirSync(t);return p.map((p=>{const g=b.joinPathSegments(t,p,u.pathSegmentSeparator);const w=m.statSync(g,u.fsStatSettings);const E={name:p,path:g,dirent:v.fs.createDirentFromStats(p,w)};if(u.stats){E.stats=w}return E}))}u.readdir=readdir},6:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6928);const g=p(9321);const v=p(7213);class Settings{constructor(t={}){this._options=t;this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,false);this.fs=v.createFileSystemAdapter(this._options.fs);this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,m.sep);this.stats=this._getValue(this._options.stats,false);this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,true);this.fsStatSettings=new g.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,u){return t!==null&&t!==void 0?t:u}}u["default"]=Settings},426:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.createDirentFromStats=void 0;class DirentFromStats{constructor(t,u){this.name=t;this.isBlockDevice=u.isBlockDevice.bind(u);this.isCharacterDevice=u.isCharacterDevice.bind(u);this.isDirectory=u.isDirectory.bind(u);this.isFIFO=u.isFIFO.bind(u);this.isFile=u.isFile.bind(u);this.isSocket=u.isSocket.bind(u);this.isSymbolicLink=u.isSymbolicLink.bind(u)}}function createDirentFromStats(t,u){return new DirentFromStats(t,u)}u.createDirentFromStats=createDirentFromStats},2829:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.fs=void 0;const m=p(426);u.fs=m},7323:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.createFileSystemAdapter=u.FILE_SYSTEM_ADAPTER=void 0;const m=p(9896);u.FILE_SYSTEM_ADAPTER={lstat:m.lstat,stat:m.stat,lstatSync:m.lstatSync,statSync:m.statSync};function createFileSystemAdapter(t){if(t===undefined){return u.FILE_SYSTEM_ADAPTER}return Object.assign(Object.assign({},u.FILE_SYSTEM_ADAPTER),t)}u.createFileSystemAdapter=createFileSystemAdapter},9321:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.statSync=u.stat=u.Settings=void 0;const m=p(1968);const g=p(5249);const v=p(9172);u.Settings=v.default;function stat(t,u,p){if(typeof u==="function"){m.read(t,getSettings(),u);return}m.read(t,getSettings(u),p)}u.stat=stat;function statSync(t,u){const p=getSettings(u);return g.read(t,p)}u.statSync=statSync;function getSettings(t={}){if(t instanceof v.default){return t}return new v.default(t)}},1968:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.read=void 0;function read(t,u,p){u.fs.lstat(t,((m,g)=>{if(m!==null){callFailureCallback(p,m);return}if(!g.isSymbolicLink()||!u.followSymbolicLink){callSuccessCallback(p,g);return}u.fs.stat(t,((t,m)=>{if(t!==null){if(u.throwErrorOnBrokenSymbolicLink){callFailureCallback(p,t);return}callSuccessCallback(p,g);return}if(u.markSymbolicLink){m.isSymbolicLink=()=>true}callSuccessCallback(p,m)}))}))}u.read=read;function callFailureCallback(t,u){t(u)}function callSuccessCallback(t,u){t(null,u)}},5249:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.read=void 0;function read(t,u){const p=u.fs.lstatSync(t);if(!p.isSymbolicLink()||!u.followSymbolicLink){return p}try{const p=u.fs.statSync(t);if(u.markSymbolicLink){p.isSymbolicLink=()=>true}return p}catch(t){if(!u.throwErrorOnBrokenSymbolicLink){return p}throw t}}u.read=read},9172:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7323);class Settings{constructor(t={}){this._options=t;this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,true);this.fs=m.createFileSystemAdapter(this._options.fs);this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,false);this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,true)}_getValue(t,u){return t!==null&&t!==void 0?t:u}}u["default"]=Settings},3882:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.Settings=u.walkStream=u.walkSync=u.walk=void 0;const m=p(6279);const g=p(7291);const v=p(4844);const b=p(1305);u.Settings=b.default;function walk(t,u,p){if(typeof u==="function"){new m.default(t,getSettings()).read(u);return}new m.default(t,getSettings(u)).read(p)}u.walk=walk;function walkSync(t,u){const p=getSettings(u);const m=new v.default(t,p);return m.read()}u.walkSync=walkSync;function walkStream(t,u){const p=getSettings(u);const m=new g.default(t,p);return m.read()}u.walkStream=walkStream;function getSettings(t={}){if(t instanceof b.default){return t}return new b.default(t)}},6279:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(997);class AsyncProvider{constructor(t,u){this._root=t;this._settings=u;this._reader=new m.default(this._root,this._settings);this._storage=[]}read(t){this._reader.onError((u=>{callFailureCallback(t,u)}));this._reader.onEntry((t=>{this._storage.push(t)}));this._reader.onEnd((()=>{callSuccessCallback(t,this._storage)}));this._reader.read()}}u["default"]=AsyncProvider;function callFailureCallback(t,u){t(u)}function callSuccessCallback(t,u){t(null,u)}},7291:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(2203);const g=p(997);class StreamProvider{constructor(t,u){this._root=t;this._settings=u;this._reader=new g.default(this._root,this._settings);this._stream=new m.Readable({objectMode:true,read:()=>{},destroy:()=>{if(!this._reader.isDestroyed){this._reader.destroy()}}})}read(){this._reader.onError((t=>{this._stream.emit("error",t)}));this._reader.onEntry((t=>{this._stream.push(t)}));this._reader.onEnd((()=>{this._stream.push(null)}));this._reader.read();return this._stream}}u["default"]=StreamProvider},4844:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7942);class SyncProvider{constructor(t,u){this._root=t;this._settings=u;this._reader=new m.default(this._root,this._settings)}read(){return this._reader.read()}}u["default"]=SyncProvider},997:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4434);const g=p(4227);const v=p(3451);const b=p(6628);const w=p(6914);class AsyncReader extends w.default{constructor(t,u){super(t,u);this._settings=u;this._scandir=g.scandir;this._emitter=new m.EventEmitter;this._queue=v(this._worker.bind(this),this._settings.concurrency);this._isFatalError=false;this._isDestroyed=false;this._queue.drain=()=>{if(!this._isFatalError){this._emitter.emit("end")}}}read(){this._isFatalError=false;this._isDestroyed=false;setImmediate((()=>{this._pushToQueue(this._root,this._settings.basePath)}));return this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed){throw new Error("The reader is already destroyed")}this._isDestroyed=true;this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,u){const p={directory:t,base:u};this._queue.push(p,(t=>{if(t!==null){this._handleError(t)}}))}_worker(t,u){this._scandir(t.directory,this._settings.fsScandirSettings,((p,m)=>{if(p!==null){u(p,undefined);return}for(const u of m){this._handleEntry(u,t.base)}u(null,undefined)}))}_handleError(t){if(this._isDestroyed||!b.isFatalError(this._settings,t)){return}this._isFatalError=true;this._isDestroyed=true;this._emitter.emit("error",t)}_handleEntry(t,u){if(this._isDestroyed||this._isFatalError){return}const p=t.path;if(u!==undefined){t.path=b.joinPathSegments(u,t.name,this._settings.pathSegmentSeparator)}if(b.isAppliedFilter(this._settings.entryFilter,t)){this._emitEntry(t)}if(t.dirent.isDirectory()&&b.isAppliedFilter(this._settings.deepFilter,t)){this._pushToQueue(p,u===undefined?undefined:t.path)}}_emitEntry(t){this._emitter.emit("entry",t)}}u["default"]=AsyncReader},6628:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.joinPathSegments=u.replacePathSegmentSeparator=u.isAppliedFilter=u.isFatalError=void 0;function isFatalError(t,u){if(t.errorFilter===null){return true}return!t.errorFilter(u)}u.isFatalError=isFatalError;function isAppliedFilter(t,u){return t===null||t(u)}u.isAppliedFilter=isAppliedFilter;function replacePathSegmentSeparator(t,u){return t.split(/[/\\]/).join(u)}u.replacePathSegmentSeparator=replacePathSegmentSeparator;function joinPathSegments(t,u,p){if(t===""){return u}if(t.endsWith(p)){return t+u}return t+p+u}u.joinPathSegments=joinPathSegments},6914:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6628);class Reader{constructor(t,u){this._root=t;this._settings=u;this._root=m.replacePathSegmentSeparator(t,u.pathSegmentSeparator)}}u["default"]=Reader},7942:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4227);const g=p(6628);const v=p(6914);class SyncReader extends v.default{constructor(){super(...arguments);this._scandir=m.scandirSync;this._storage=[];this._queue=new Set}read(){this._pushToQueue(this._root,this._settings.basePath);this._handleQueue();return this._storage}_pushToQueue(t,u){this._queue.add({directory:t,base:u})}_handleQueue(){for(const t of this._queue.values()){this._handleDirectory(t.directory,t.base)}}_handleDirectory(t,u){try{const p=this._scandir(t,this._settings.fsScandirSettings);for(const t of p){this._handleEntry(t,u)}}catch(t){this._handleError(t)}}_handleError(t){if(!g.isFatalError(this._settings,t)){return}throw t}_handleEntry(t,u){const p=t.path;if(u!==undefined){t.path=g.joinPathSegments(u,t.name,this._settings.pathSegmentSeparator)}if(g.isAppliedFilter(this._settings.entryFilter,t)){this._pushToStorage(t)}if(t.dirent.isDirectory()&&g.isAppliedFilter(this._settings.deepFilter,t)){this._pushToQueue(p,u===undefined?undefined:t.path)}}_pushToStorage(t){this._storage.push(t)}}u["default"]=SyncReader},1305:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6928);const g=p(4227);class Settings{constructor(t={}){this._options=t;this.basePath=this._getValue(this._options.basePath,undefined);this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY);this.deepFilter=this._getValue(this._options.deepFilter,null);this.entryFilter=this._getValue(this._options.entryFilter,null);this.errorFilter=this._getValue(this._options.errorFilter,null);this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,m.sep);this.fsScandirSettings=new g.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,u){return t!==null&&t!==void 0?t:u}}u["default"]=Settings},939:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.MissingRefError=u.ValidationError=u.CodeGen=u.Name=u.nil=u.stringify=u.str=u._=u.KeywordCxt=u.Ajv2020=void 0;const m=p(6952);const g=p(4231);const v=p(9099);const b=p(4010);const w="https://json-schema.org/draft/2020-12/schema";class Ajv2020 extends m.default{constructor(t={}){super({...t,dynamicRef:true,next:true,unevaluated:true})}_addVocabularies(){super._addVocabularies();g.default.forEach((t=>this.addVocabulary(t)));if(this.opts.discriminator)this.addKeyword(v.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:t,meta:u}=this.opts;if(!u)return;b.default.call(this,t);this.refs["http://json-schema.org/schema"]=w}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(w)?w:undefined)}}u.Ajv2020=Ajv2020;t.exports=u=Ajv2020;t.exports.Ajv2020=Ajv2020;Object.defineProperty(u,"__esModule",{value:true});u["default"]=Ajv2020;var E=p(324);Object.defineProperty(u,"KeywordCxt",{enumerable:true,get:function(){return E.KeywordCxt}});var S=p(4671);Object.defineProperty(u,"_",{enumerable:true,get:function(){return S._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return S.str}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return S.stringify}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return S.nil}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return S.Name}});Object.defineProperty(u,"CodeGen",{enumerable:true,get:function(){return S.CodeGen}});var $=p(4068);Object.defineProperty(u,"ValidationError",{enumerable:true,get:function(){return $.default}});var P=p(909);Object.defineProperty(u,"MissingRefError",{enumerable:true,get:function(){return P.default}})},5984:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.MissingRefError=u.ValidationError=u.CodeGen=u.Name=u.nil=u.stringify=u.str=u._=u.KeywordCxt=u.Ajv=void 0;const m=p(6952);const g=p(1982);const v=p(9099);const b=p(3928);const w=["/properties"];const E="http://json-schema.org/draft-07/schema";class Ajv extends m.default{_addVocabularies(){super._addVocabularies();g.default.forEach((t=>this.addVocabulary(t)));if(this.opts.discriminator)this.addKeyword(v.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();if(!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(b,w):b;this.addMetaSchema(t,E,false);this.refs["http://json-schema.org/schema"]=E}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(E)?E:undefined)}}u.Ajv=Ajv;t.exports=u=Ajv;t.exports.Ajv=Ajv;Object.defineProperty(u,"__esModule",{value:true});u["default"]=Ajv;var S=p(324);Object.defineProperty(u,"KeywordCxt",{enumerable:true,get:function(){return S.KeywordCxt}});var $=p(4671);Object.defineProperty(u,"_",{enumerable:true,get:function(){return $._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return $.str}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return $.stringify}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return $.nil}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return $.Name}});Object.defineProperty(u,"CodeGen",{enumerable:true,get:function(){return $.CodeGen}});var P=p(4068);Object.defineProperty(u,"ValidationError",{enumerable:true,get:function(){return P.default}});var R=p(909);Object.defineProperty(u,"MissingRefError",{enumerable:true,get:function(){return R.default}})},5554:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.regexpCode=u.getEsmExportName=u.getProperty=u.safeStringify=u.stringify=u.strConcat=u.addCodeArg=u.str=u._=u.nil=u._Code=u.Name=u.IDENTIFIER=u._CodeOrName=void 0;class _CodeOrName{}u._CodeOrName=_CodeOrName;u.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(t){super();if(!u.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}u.Name=Name;class _Code extends _CodeOrName{constructor(t){super();this._items=typeof t==="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce(((t,u)=>`${t}${u}`),"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce(((t,u)=>{if(u instanceof Name)t[u.str]=(t[u.str]||0)+1;return t}),{})}}u._Code=_Code;u.nil=new _Code("");function _(t,...u){const p=[t[0]];let m=0;while(m<u.length){addCodeArg(p,u[m]);p.push(t[++m])}return new _Code(p)}u._=_;const p=new _Code("+");function str(t,...u){const m=[safeStringify(t[0])];let g=0;while(g<u.length){m.push(p);addCodeArg(m,u[g]);m.push(p,safeStringify(t[++g]))}optimize(m);return new _Code(m)}u.str=str;function addCodeArg(t,u){if(u instanceof _Code)t.push(...u._items);else if(u instanceof Name)t.push(u);else t.push(interpolate(u))}u.addCodeArg=addCodeArg;function optimize(t){let u=1;while(u<t.length-1){if(t[u]===p){const p=mergeExprItems(t[u-1],t[u+1]);if(p!==undefined){t.splice(u-1,3,p);continue}t[u++]="+"}u++}}function mergeExprItems(t,u){if(u==='""')return t;if(t==='""')return u;if(typeof t=="string"){if(u instanceof Name||t[t.length-1]!=='"')return;if(typeof u!="string")return`${t.slice(0,-1)}${u}"`;if(u[0]==='"')return t.slice(0,-1)+u.slice(1);return}if(typeof u=="string"&&u[0]==='"'&&!(t instanceof Name))return`"${t}${u.slice(1)}`;return}function strConcat(t,u){return u.emptyStr()?t:t.emptyStr()?u:str`${t}${u}`}u.strConcat=strConcat;function interpolate(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:safeStringify(Array.isArray(t)?t.join(","):t)}function stringify(t){return new _Code(safeStringify(t))}u.stringify=stringify;function safeStringify(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}u.safeStringify=safeStringify;function getProperty(t){return typeof t=="string"&&u.IDENTIFIER.test(t)?new _Code(`.${t}`):_`[${t}]`}u.getProperty=getProperty;function getEsmExportName(t){if(typeof t=="string"&&u.IDENTIFIER.test(t)){return new _Code(`${t}`)}throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}u.getEsmExportName=getEsmExportName;function regexpCode(t){return new _Code(t.toString())}u.regexpCode=regexpCode},4671:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.or=u.and=u.not=u.CodeGen=u.operators=u.varKinds=u.ValueScopeName=u.ValueScope=u.Scope=u.Name=u.regexpCode=u.stringify=u.getProperty=u.nil=u.strConcat=u.str=u._=void 0;const m=p(5554);const g=p(183);var v=p(5554);Object.defineProperty(u,"_",{enumerable:true,get:function(){return v._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return v.str}});Object.defineProperty(u,"strConcat",{enumerable:true,get:function(){return v.strConcat}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return v.nil}});Object.defineProperty(u,"getProperty",{enumerable:true,get:function(){return v.getProperty}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return v.stringify}});Object.defineProperty(u,"regexpCode",{enumerable:true,get:function(){return v.regexpCode}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return v.Name}});var b=p(183);Object.defineProperty(u,"Scope",{enumerable:true,get:function(){return b.Scope}});Object.defineProperty(u,"ValueScope",{enumerable:true,get:function(){return b.ValueScope}});Object.defineProperty(u,"ValueScopeName",{enumerable:true,get:function(){return b.ValueScopeName}});Object.defineProperty(u,"varKinds",{enumerable:true,get:function(){return b.varKinds}});u.operators={GT:new m._Code(">"),GTE:new m._Code(">="),LT:new m._Code("<"),LTE:new m._Code("<="),EQ:new m._Code("==="),NEQ:new m._Code("!=="),NOT:new m._Code("!"),OR:new m._Code("||"),AND:new m._Code("&&"),ADD:new m._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(t,u){return this}}class Def extends Node{constructor(t,u,p){super();this.varKind=t;this.name=u;this.rhs=p}render({es5:t,_n:u}){const p=t?g.varKinds.var:this.varKind;const m=this.rhs===undefined?"":` = ${this.rhs}`;return`${p} ${this.name}${m};`+u}optimizeNames(t,u){if(!t[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,t,u);return this}get names(){return this.rhs instanceof m._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(t,u,p){super();this.lhs=t;this.rhs=u;this.sideEffects=p}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,u){if(this.lhs instanceof m.Name&&!t[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,t,u);return this}get names(){const t=this.lhs instanceof m.Name?{}:{...this.lhs.names};return addExprNames(t,this.rhs)}}class AssignOp extends Assign{constructor(t,u,p,m){super(t,p,m);this.op=u}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class Label extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){return`${this.label}:`+t}}class Break extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){const u=this.label?` ${this.label}`:"";return`break${u};`+t}}class Throw extends Node{constructor(t){super();this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class AnyCode extends Node{constructor(t){super();this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(t,u){this.code=optimizeExpr(this.code,t,u);return this}get names(){return this.code instanceof m._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(t=[]){super();this.nodes=t}render(t){return this.nodes.reduce(((u,p)=>u+p.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let u=t.length;while(u--){const p=t[u].optimizeNodes();if(Array.isArray(p))t.splice(u,1,...p);else if(p)t[u]=p;else t.splice(u,1)}return t.length>0?this:undefined}optimizeNames(t,u){const{nodes:p}=this;let m=p.length;while(m--){const g=p[m];if(g.optimizeNames(t,u))continue;subtractNames(t,g.names);p.splice(m,1)}return p.length>0?this:undefined}get names(){return this.nodes.reduce(((t,u)=>addNames(t,u.names)),{})}}class BlockNode extends ParentNode{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(t,u){super(u);this.condition=t}render(t){let u=`if(${this.condition})`+super.render(t);if(this.else)u+="else "+this.else.render(t);return u}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(t===true)return this.nodes;let u=this.else;if(u){const t=u.optimizeNodes();u=this.else=Array.isArray(t)?new Else(t):t}if(u){if(t===false)return u instanceof If?u:u.nodes;if(this.nodes.length)return this;return new If(not(t),u instanceof If?[u]:u.nodes)}if(t===false||!this.nodes.length)return undefined;return this}optimizeNames(t,u){var p;this.else=(p=this.else)===null||p===void 0?void 0:p.optimizeNames(t,u);if(!(super.optimizeNames(t,u)||this.else))return;this.condition=optimizeExpr(this.condition,t,u);return this}get names(){const t=super.names;addExprNames(t,this.condition);if(this.else)addNames(t,this.else.names);return t}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(t){super();this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,u){if(!super.optimizeNames(t,u))return;this.iteration=optimizeExpr(this.iteration,t,u);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(t,u,p,m){super();this.varKind=t;this.name=u;this.from=p;this.to=m}render(t){const u=t.es5?g.varKinds.var:this.varKind;const{name:p,from:m,to:v}=this;return`for(${u} ${p}=${m}; ${p}<${v}; ${p}++)`+super.render(t)}get names(){const t=addExprNames(super.names,this.from);return addExprNames(t,this.to)}}class ForIter extends For{constructor(t,u,p,m){super();this.loop=t;this.varKind=u;this.name=p;this.iterable=m}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,u){if(!super.optimizeNames(t,u))return;this.iterable=optimizeExpr(this.iterable,t,u);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(t,u,p){super();this.name=t;this.args=u;this.async=p}render(t){const u=this.async?"async ":"";return`${u}function ${this.name}(${this.args})`+super.render(t)}}Func.kind="func";class Return extends ParentNode{render(t){return"return "+super.render(t)}}Return.kind="return";class Try extends BlockNode{render(t){let u="try"+super.render(t);if(this.catch)u+=this.catch.render(t);if(this.finally)u+=this.finally.render(t);return u}optimizeNodes(){var t,u;super.optimizeNodes();(t=this.catch)===null||t===void 0?void 0:t.optimizeNodes();(u=this.finally)===null||u===void 0?void 0:u.optimizeNodes();return this}optimizeNames(t,u){var p,m;super.optimizeNames(t,u);(p=this.catch)===null||p===void 0?void 0:p.optimizeNames(t,u);(m=this.finally)===null||m===void 0?void 0:m.optimizeNames(t,u);return this}get names(){const t=super.names;if(this.catch)addNames(t,this.catch.names);if(this.finally)addNames(t,this.finally.names);return t}}class Catch extends BlockNode{constructor(t){super();this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}Catch.kind="catch";class Finally extends BlockNode{render(t){return"finally"+super.render(t)}}Finally.kind="finally";class CodeGen{constructor(t,u={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...u,_n:u.lines?"\n":""};this._extScope=t;this._scope=new g.Scope({parent:t});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,u){const p=this._extScope.value(t,u);const m=this._values[p.prefix]||(this._values[p.prefix]=new Set);m.add(p);return p}getScopeValue(t,u){return this._extScope.getValue(t,u)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,u,p,m){const g=this._scope.toName(u);if(p!==undefined&&m)this._constants[g.str]=p;this._leafNode(new Def(t,g,p));return g}const(t,u,p){return this._def(g.varKinds.const,t,u,p)}let(t,u,p){return this._def(g.varKinds.let,t,u,p)}var(t,u,p){return this._def(g.varKinds.var,t,u,p)}assign(t,u,p){return this._leafNode(new Assign(t,u,p))}add(t,p){return this._leafNode(new AssignOp(t,u.operators.ADD,p))}code(t){if(typeof t=="function")t();else if(t!==m.nil)this._leafNode(new AnyCode(t));return this}object(...t){const u=["{"];for(const[p,g]of t){if(u.length>1)u.push(",");u.push(p);if(p!==g||this.opts.es5){u.push(":");(0,m.addCodeArg)(u,g)}}u.push("}");return new m._Code(u)}if(t,u,p){this._blockNode(new If(t));if(u&&p){this.code(u).else().code(p).endIf()}else if(u){this.code(u).endIf()}else if(p){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(t){return this._elseNode(new If(t))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(t,u){this._blockNode(t);if(u)this.code(u).endFor();return this}for(t,u){return this._for(new ForLoop(t),u)}forRange(t,u,p,m,v=(this.opts.es5?g.varKinds.var:g.varKinds.let)){const b=this._scope.toName(t);return this._for(new ForRange(v,b,u,p),(()=>m(b)))}forOf(t,u,p,v=g.varKinds.const){const b=this._scope.toName(t);if(this.opts.es5){const t=u instanceof m.Name?u:this.var("_arr",u);return this.forRange("_i",0,(0,m._)`${t}.length`,(u=>{this.var(b,(0,m._)`${t}[${u}]`);p(b)}))}return this._for(new ForIter("of",v,b,u),(()=>p(b)))}forIn(t,u,p,v=(this.opts.es5?g.varKinds.var:g.varKinds.const)){if(this.opts.ownProperties){return this.forOf(t,(0,m._)`Object.keys(${u})`,p)}const b=this._scope.toName(t);return this._for(new ForIter("in",v,b,u),(()=>p(b)))}endFor(){return this._endBlockNode(For)}label(t){return this._leafNode(new Label(t))}break(t){return this._leafNode(new Break(t))}return(t){const u=new Return;this._blockNode(u);this.code(t);if(u.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(t,u,p){if(!u&&!p)throw new Error('CodeGen: "try" without "catch" and "finally"');const m=new Try;this._blockNode(m);this.code(t);if(u){const t=this.name("e");this._currNode=m.catch=new Catch(t);u(t)}if(p){this._currNode=m.finally=new Finally;this.code(p)}return this._endBlockNode(Catch,Finally)}throw(t){return this._leafNode(new Throw(t))}block(t,u){this._blockStarts.push(this._nodes.length);if(t)this.code(t).endBlock(u);return this}endBlock(t){const u=this._blockStarts.pop();if(u===undefined)throw new Error("CodeGen: not in self-balancing block");const p=this._nodes.length-u;if(p<0||t!==undefined&&p!==t){throw new Error(`CodeGen: wrong number of nodes: ${p} vs ${t} expected`)}this._nodes.length=u;return this}func(t,u=m.nil,p,g){this._blockNode(new Func(t,u,p));if(g)this.code(g).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(t=1){while(t-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(t){this._currNode.nodes.push(t);return this}_blockNode(t){this._currNode.nodes.push(t);this._nodes.push(t)}_endBlockNode(t,u){const p=this._currNode;if(p instanceof t||u&&p instanceof u){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${u?`${t.kind}/${u.kind}`:t.kind}"`)}_elseNode(t){const u=this._currNode;if(!(u instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=u.else=t;return this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const u=this._nodes;u[u.length-1]=t}}u.CodeGen=CodeGen;function addNames(t,u){for(const p in u)t[p]=(t[p]||0)+(u[p]||0);return t}function addExprNames(t,u){return u instanceof m._CodeOrName?addNames(t,u.names):t}function optimizeExpr(t,u,p){if(t instanceof m.Name)return replaceName(t);if(!canOptimize(t))return t;return new m._Code(t._items.reduce(((t,u)=>{if(u instanceof m.Name)u=replaceName(u);if(u instanceof m._Code)t.push(...u._items);else t.push(u);return t}),[]));function replaceName(t){const m=p[t.str];if(m===undefined||u[t.str]!==1)return t;delete u[t.str];return m}function canOptimize(t){return t instanceof m._Code&&t._items.some((t=>t instanceof m.Name&&u[t.str]===1&&p[t.str]!==undefined))}}function subtractNames(t,u){for(const p in u)t[p]=(t[p]||0)-(u[p]||0)}function not(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,m._)`!${par(t)}`}u.not=not;const w=mappend(u.operators.AND);function and(...t){return t.reduce(w)}u.and=and;const E=mappend(u.operators.OR);function or(...t){return t.reduce(E)}u.or=or;function mappend(t){return(u,p)=>u===m.nil?p:p===m.nil?u:(0,m._)`${par(u)} ${t} ${par(p)}`}function par(t){return t instanceof m.Name?t:(0,m._)`(${t})`}},183:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.ValueScope=u.ValueScopeName=u.Scope=u.varKinds=u.UsedValueState=void 0;const m=p(5554);class ValueError extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`);this.value=t.value}}var g;(function(t){t[t["Started"]=0]="Started";t[t["Completed"]=1]="Completed"})(g||(u.UsedValueState=g={}));u.varKinds={const:new m.Name("const"),let:new m.Name("let"),var:new m.Name("var")};class Scope{constructor({prefixes:t,parent:u}={}){this._names={};this._prefixes=t;this._parent=u}toName(t){return t instanceof m.Name?t:this.name(t)}name(t){return new m.Name(this._newName(t))}_newName(t){const u=this._names[t]||this._nameGroup(t);return`${t}${u.index++}`}_nameGroup(t){var u,p;if(((p=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||p===void 0?void 0:p.has(t))||this._prefixes&&!this._prefixes.has(t)){throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`)}return this._names[t]={prefix:t,index:0}}}u.Scope=Scope;class ValueScopeName extends m.Name{constructor(t,u){super(u);this.prefix=t}setValue(t,{property:u,itemIndex:p}){this.value=t;this.scopePath=(0,m._)`.${new m.Name(u)}[${p}]`}}u.ValueScopeName=ValueScopeName;const v=(0,m._)`\n`;class ValueScope extends Scope{constructor(t){super(t);this._values={};this._scope=t.scope;this.opts={...t,_n:t.lines?v:m.nil}}get(){return this._scope}name(t){return new ValueScopeName(t,this._newName(t))}value(t,u){var p;if(u.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const m=this.toName(t);const{prefix:g}=m;const v=(p=u.key)!==null&&p!==void 0?p:u.ref;let b=this._values[g];if(b){const t=b.get(v);if(t)return t}else{b=this._values[g]=new Map}b.set(v,m);const w=this._scope[g]||(this._scope[g]=[]);const E=w.length;w[E]=u.ref;m.setValue(u,{property:g,itemIndex:E});return m}getValue(t,u){const p=this._values[t];if(!p)return;return p.get(u)}scopeRefs(t,u=this._values){return this._reduceValues(u,(u=>{if(u.scopePath===undefined)throw new Error(`CodeGen: name "${u}" has no value`);return(0,m._)`${t}${u.scopePath}`}))}scopeCode(t=this._values,u,p){return this._reduceValues(t,(t=>{if(t.value===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),u,p)}_reduceValues(t,p,v={},b){let w=m.nil;for(const E in t){const S=t[E];if(!S)continue;const $=v[E]=v[E]||new Map;S.forEach((t=>{if($.has(t))return;$.set(t,g.Started);let v=p(t);if(v){const p=this.opts.es5?u.varKinds.var:u.varKinds.const;w=(0,m._)`${w}${p} ${t} = ${v};${this.opts._n}`}else if(v=b===null||b===void 0?void 0:b(t)){w=(0,m._)`${w}${v}${this.opts._n}`}else{throw new ValueError(t)}$.set(t,g.Completed)}))}return w}}u.ValueScope=ValueScope},7446:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.extendErrors=u.resetErrorsCount=u.reportExtraError=u.reportError=u.keyword$DataError=u.keywordError=void 0;const m=p(4671);const g=p(5049);const v=p(1529);u.keywordError={message:({keyword:t})=>(0,m.str)`must pass "${t}" keyword validation`};u.keyword$DataError={message:({keyword:t,schemaType:u})=>u?(0,m.str)`"${t}" keyword must be ${u} ($data)`:(0,m.str)`"${t}" keyword is invalid ($data)`};function reportError(t,p=u.keywordError,g,v){const{it:b}=t;const{gen:w,compositeRule:E,allErrors:S}=b;const $=errorObjectCode(t,p,g);if(v!==null&&v!==void 0?v:E||S){addError(w,$)}else{returnErrors(b,(0,m._)`[${$}]`)}}u.reportError=reportError;function reportExtraError(t,p=u.keywordError,m){const{it:g}=t;const{gen:b,compositeRule:w,allErrors:E}=g;const S=errorObjectCode(t,p,m);addError(b,S);if(!(w||E)){returnErrors(g,v.default.vErrors)}}u.reportExtraError=reportExtraError;function resetErrorsCount(t,u){t.assign(v.default.errors,u);t.if((0,m._)`${v.default.vErrors} !== null`,(()=>t.if(u,(()=>t.assign((0,m._)`${v.default.vErrors}.length`,u)),(()=>t.assign(v.default.vErrors,null)))))}u.resetErrorsCount=resetErrorsCount;function extendErrors({gen:t,keyword:u,schemaValue:p,data:g,errsCount:b,it:w}){if(b===undefined)throw new Error("ajv implementation error");const E=t.name("err");t.forRange("i",b,v.default.errors,(b=>{t.const(E,(0,m._)`${v.default.vErrors}[${b}]`);t.if((0,m._)`${E}.instancePath === undefined`,(()=>t.assign((0,m._)`${E}.instancePath`,(0,m.strConcat)(v.default.instancePath,w.errorPath))));t.assign((0,m._)`${E}.schemaPath`,(0,m.str)`${w.errSchemaPath}/${u}`);if(w.opts.verbose){t.assign((0,m._)`${E}.schema`,p);t.assign((0,m._)`${E}.data`,g)}}))}u.extendErrors=extendErrors;function addError(t,u){const p=t.const("err",u);t.if((0,m._)`${v.default.vErrors} === null`,(()=>t.assign(v.default.vErrors,(0,m._)`[${p}]`)),(0,m._)`${v.default.vErrors}.push(${p})`);t.code((0,m._)`${v.default.errors}++`)}function returnErrors(t,u){const{gen:p,validateName:g,schemaEnv:v}=t;if(v.$async){p.throw((0,m._)`new ${t.ValidationError}(${u})`)}else{p.assign((0,m._)`${g}.errors`,u);p.return(false)}}const b={keyword:new m.Name("keyword"),schemaPath:new m.Name("schemaPath"),params:new m.Name("params"),propertyName:new m.Name("propertyName"),message:new m.Name("message"),schema:new m.Name("schema"),parentSchema:new m.Name("parentSchema")};function errorObjectCode(t,u,p){const{createErrors:g}=t.it;if(g===false)return(0,m._)`{}`;return errorObject(t,u,p)}function errorObject(t,u,p={}){const{gen:m,it:g}=t;const v=[errorInstancePath(g,p),errorSchemaPath(t,p)];extraErrorProps(t,u,v);return m.object(...v)}function errorInstancePath({errorPath:t},{instancePath:u}){const p=u?(0,m.str)`${t}${(0,g.getErrorPath)(u,g.Type.Str)}`:t;return[v.default.instancePath,(0,m.strConcat)(v.default.instancePath,p)]}function errorSchemaPath({keyword:t,it:{errSchemaPath:u}},{schemaPath:p,parentSchema:v}){let w=v?u:(0,m.str)`${u}/${t}`;if(p){w=(0,m.str)`${w}${(0,g.getErrorPath)(p,g.Type.Str)}`}return[b.schemaPath,w]}function extraErrorProps(t,{params:u,message:p},g){const{keyword:w,data:E,schemaValue:S,it:$}=t;const{opts:P,propertyName:R,topSchemaRef:x,schemaPath:O}=$;g.push([b.keyword,w],[b.params,typeof u=="function"?u(t):u||(0,m._)`{}`]);if(P.messages){g.push([b.message,typeof p=="function"?p(t):p])}if(P.verbose){g.push([b.schema,S],[b.parentSchema,(0,m._)`${x}${O}`],[v.default.data,E])}if(R)g.push([b.propertyName,R])}},4033:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.resolveSchema=u.getCompilingSchema=u.resolveRef=u.compileSchema=u.SchemaEnv=void 0;const m=p(4671);const g=p(4068);const v=p(1529);const b=p(9749);const w=p(5049);const E=p(324);class SchemaEnv{constructor(t){var u;this.refs={};this.dynamicAnchors={};let p;if(typeof t.schema=="object")p=t.schema;this.schema=t.schema;this.schemaId=t.schemaId;this.root=t.root||this;this.baseId=(u=t.baseId)!==null&&u!==void 0?u:(0,b.normalizeId)(p===null||p===void 0?void 0:p[t.schemaId||"$id"]);this.schemaPath=t.schemaPath;this.localRefs=t.localRefs;this.meta=t.meta;this.$async=p===null||p===void 0?void 0:p.$async;this.refs={}}}u.SchemaEnv=SchemaEnv;function compileSchema(t){const u=getCompilingSchema.call(this,t);if(u)return u;const p=(0,b.getFullPath)(this.opts.uriResolver,t.root.baseId);const{es5:w,lines:S}=this.opts.code;const{ownProperties:$}=this.opts;const P=new m.CodeGen(this.scope,{es5:w,lines:S,ownProperties:$});let R;if(t.$async){R=P.scopeValue("Error",{ref:g.default,code:(0,m._)`require("ajv/dist/runtime/validation_error").default`})}const x=P.scopeName("validate");t.validateName=x;const O={gen:P,allErrors:this.opts.allErrors,data:v.default.data,parentData:v.default.parentData,parentDataProperty:v.default.parentDataProperty,dataNames:[v.default.data],dataPathArr:[m.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:P.scopeValue("schema",this.opts.code.source===true?{ref:t.schema,code:(0,m.stringify)(t.schema)}:{ref:t.schema}),validateName:x,ValidationError:R,schema:t.schema,schemaEnv:t,rootId:p,baseId:t.baseId||p,schemaPath:m.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,m._)`""`,opts:this.opts,self:this};let A;try{this._compilations.add(t);(0,E.validateFunctionCode)(O);P.optimize(this.opts.code.optimize);const u=P.toString();A=`${P.scopeRefs(v.default.scope)}return ${u}`;if(this.opts.code.process)A=this.opts.code.process(A,t);const p=new Function(`${v.default.self}`,`${v.default.scope}`,A);const g=p(this,this.scope.get());this.scope.value(x,{ref:g});g.errors=null;g.schema=t.schema;g.schemaEnv=t;if(t.$async)g.$async=true;if(this.opts.code.source===true){g.source={validateName:x,validateCode:u,scopeValues:P._values}}if(this.opts.unevaluated){const{props:t,items:u}=O;g.evaluated={props:t instanceof m.Name?undefined:t,items:u instanceof m.Name?undefined:u,dynamicProps:t instanceof m.Name,dynamicItems:u instanceof m.Name};if(g.source)g.source.evaluated=(0,m.stringify)(g.evaluated)}t.validate=g;return t}catch(u){delete t.validate;delete t.validateName;if(A)this.logger.error("Error compiling schema, function code:",A);throw u}finally{this._compilations.delete(t)}}u.compileSchema=compileSchema;function resolveRef(t,u,p){var m;p=(0,b.resolveUrl)(this.opts.uriResolver,u,p);const g=t.refs[p];if(g)return g;let v=resolve.call(this,t,p);if(v===undefined){const g=(m=t.localRefs)===null||m===void 0?void 0:m[p];const{schemaId:b}=this.opts;if(g)v=new SchemaEnv({schema:g,schemaId:b,root:t,baseId:u})}if(v===undefined)return;return t.refs[p]=inlineOrCompile.call(this,v)}u.resolveRef=resolveRef;function inlineOrCompile(t){if((0,b.inlineRef)(t.schema,this.opts.inlineRefs))return t.schema;return t.validate?t:compileSchema.call(this,t)}function getCompilingSchema(t){for(const u of this._compilations){if(sameSchemaEnv(u,t))return u}}u.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(t,u){return t.schema===u.schema&&t.root===u.root&&t.baseId===u.baseId}function resolve(t,u){let p;while(typeof(p=this.refs[u])=="string")u=p;return p||this.schemas[u]||resolveSchema.call(this,t,u)}function resolveSchema(t,u){const p=this.opts.uriResolver.parse(u);const m=(0,b._getFullPath)(this.opts.uriResolver,p);let g=(0,b.getFullPath)(this.opts.uriResolver,t.baseId,undefined);if(Object.keys(t.schema).length>0&&m===g){return getJsonPointer.call(this,p,t)}const v=(0,b.normalizeId)(m);const w=this.refs[v]||this.schemas[v];if(typeof w=="string"){const u=resolveSchema.call(this,t,w);if(typeof(u===null||u===void 0?void 0:u.schema)!=="object")return;return getJsonPointer.call(this,p,u)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)compileSchema.call(this,w);if(v===(0,b.normalizeId)(u)){const{schema:u}=w;const{schemaId:p}=this.opts;const m=u[p];if(m)g=(0,b.resolveUrl)(this.opts.uriResolver,g,m);return new SchemaEnv({schema:u,schemaId:p,root:t,baseId:g})}return getJsonPointer.call(this,p,w)}u.resolveSchema=resolveSchema;const S=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(t,{baseId:u,schema:p,root:m}){var g;if(((g=t.fragment)===null||g===void 0?void 0:g[0])!=="/")return;for(const m of t.fragment.slice(1).split("/")){if(typeof p==="boolean")return;const t=p[(0,w.unescapeFragment)(m)];if(t===undefined)return;p=t;const g=typeof p==="object"&&p[this.opts.schemaId];if(!S.has(m)&&g){u=(0,b.resolveUrl)(this.opts.uriResolver,u,g)}}let v;if(typeof p!="boolean"&&p.$ref&&!(0,w.schemaHasRulesButRef)(p,this.RULES)){const t=(0,b.resolveUrl)(this.opts.uriResolver,u,p.$ref);v=resolveSchema.call(this,m,t)}const{schemaId:E}=this.opts;v=v||new SchemaEnv({schema:p,schemaId:E,root:m,baseId:u});if(v.schema!==v.root.schema)return v;return undefined}},1529:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g={data:new m.Name("data"),valCxt:new m.Name("valCxt"),instancePath:new m.Name("instancePath"),parentData:new m.Name("parentData"),parentDataProperty:new m.Name("parentDataProperty"),rootData:new m.Name("rootData"),dynamicAnchors:new m.Name("dynamicAnchors"),vErrors:new m.Name("vErrors"),errors:new m.Name("errors"),this:new m.Name("this"),self:new m.Name("self"),scope:new m.Name("scope"),json:new m.Name("json"),jsonPos:new m.Name("jsonPos"),jsonLen:new m.Name("jsonLen"),jsonPart:new m.Name("jsonPart")};u["default"]=g},909:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(9749);class MissingRefError extends Error{constructor(t,u,p,g){super(g||`can't resolve reference ${p} from id ${u}`);this.missingRef=(0,m.resolveUrl)(t,u,p);this.missingSchema=(0,m.normalizeId)((0,m.getFullPath)(t,this.missingRef))}}u["default"]=MissingRefError},9749:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.getSchemaRefs=u.resolveUrl=u.normalizeId=u._getFullPath=u.getFullPath=u.inlineRef=void 0;const m=p(5049);const g=p(7407);const v=p(7564);const b=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(t,u=true){if(typeof t=="boolean")return true;if(u===true)return!hasRef(t);if(!u)return false;return countKeys(t)<=u}u.inlineRef=inlineRef;const w=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(t){for(const u in t){if(w.has(u))return true;const p=t[u];if(Array.isArray(p)&&p.some(hasRef))return true;if(typeof p=="object"&&hasRef(p))return true}return false}function countKeys(t){let u=0;for(const p in t){if(p==="$ref")return Infinity;u++;if(b.has(p))continue;if(typeof t[p]=="object"){(0,m.eachItem)(t[p],(t=>u+=countKeys(t)))}if(u===Infinity)return Infinity}return u}function getFullPath(t,u="",p){if(p!==false)u=normalizeId(u);const m=t.parse(u);return _getFullPath(t,m)}u.getFullPath=getFullPath;function _getFullPath(t,u){const p=t.serialize(u);return p.split("#")[0]+"#"}u._getFullPath=_getFullPath;const E=/#\/?$/;function normalizeId(t){return t?t.replace(E,""):""}u.normalizeId=normalizeId;function resolveUrl(t,u,p){p=normalizeId(p);return t.resolve(u,p)}u.resolveUrl=resolveUrl;const S=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(t,u){if(typeof t=="boolean")return{};const{schemaId:p,uriResolver:m}=this.opts;const b=normalizeId(t[p]||u);const w={"":b};const E=getFullPath(m,b,false);const $={};const P=new Set;v(t,{allKeys:true},((t,u,m,g)=>{if(g===undefined)return;const v=E+u;let b=w[g];if(typeof t[p]=="string")b=addRef.call(this,t[p]);addAnchor.call(this,t.$anchor);addAnchor.call(this,t.$dynamicAnchor);w[u]=b;function addRef(u){const p=this.opts.uriResolver.resolve;u=normalizeId(b?p(b,u):u);if(P.has(u))throw ambiguos(u);P.add(u);let m=this.refs[u];if(typeof m=="string")m=this.refs[m];if(typeof m=="object"){checkAmbiguosRef(t,m.schema,u)}else if(u!==normalizeId(v)){if(u[0]==="#"){checkAmbiguosRef(t,$[u],u);$[u]=t}else{this.refs[u]=v}}return u}function addAnchor(t){if(typeof t=="string"){if(!S.test(t))throw new Error(`invalid anchor "${t}"`);addRef.call(this,`#${t}`)}}}));return $;function checkAmbiguosRef(t,u,p){if(u!==undefined&&!g(t,u))throw ambiguos(p)}function ambiguos(t){return new Error(`reference "${t}" resolves to more than one schema`)}}u.getSchemaRefs=getSchemaRefs},2166:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.getRules=u.isJSONType=void 0;const p=["string","number","integer","boolean","null","object","array"];const m=new Set(p);function isJSONType(t){return typeof t=="string"&&m.has(t)}u.isJSONType=isJSONType;function getRules(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:true,boolean:true,null:true},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}u.getRules=getRules},5049:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.checkStrictMode=u.getErrorPath=u.Type=u.useFunc=u.setEvaluated=u.evaluatedPropsToName=u.mergeEvaluated=u.eachItem=u.unescapeJsonPointer=u.escapeJsonPointer=u.escapeFragment=u.unescapeFragment=u.schemaRefOrVal=u.schemaHasRulesButRef=u.schemaHasRules=u.checkUnknownRules=u.alwaysValidSchema=u.toHash=void 0;const m=p(4671);const g=p(5554);function toHash(t){const u={};for(const p of t)u[p]=true;return u}u.toHash=toHash;function alwaysValidSchema(t,u){if(typeof u=="boolean")return u;if(Object.keys(u).length===0)return true;checkUnknownRules(t,u);return!schemaHasRules(u,t.self.RULES.all)}u.alwaysValidSchema=alwaysValidSchema;function checkUnknownRules(t,u=t.schema){const{opts:p,self:m}=t;if(!p.strictSchema)return;if(typeof u==="boolean")return;const g=m.RULES.keywords;for(const p in u){if(!g[p])checkStrictMode(t,`unknown keyword: "${p}"`)}}u.checkUnknownRules=checkUnknownRules;function schemaHasRules(t,u){if(typeof t=="boolean")return!t;for(const p in t)if(u[p])return true;return false}u.schemaHasRules=schemaHasRules;function schemaHasRulesButRef(t,u){if(typeof t=="boolean")return!t;for(const p in t)if(p!=="$ref"&&u.all[p])return true;return false}u.schemaHasRulesButRef=schemaHasRulesButRef;function schemaRefOrVal({topSchemaRef:t,schemaPath:u},p,g,v){if(!v){if(typeof p=="number"||typeof p=="boolean")return p;if(typeof p=="string")return(0,m._)`${p}`}return(0,m._)`${t}${u}${(0,m.getProperty)(g)}`}u.schemaRefOrVal=schemaRefOrVal;function unescapeFragment(t){return unescapeJsonPointer(decodeURIComponent(t))}u.unescapeFragment=unescapeFragment;function escapeFragment(t){return encodeURIComponent(escapeJsonPointer(t))}u.escapeFragment=escapeFragment;function escapeJsonPointer(t){if(typeof t=="number")return`${t}`;return t.replace(/~/g,"~0").replace(/\//g,"~1")}u.escapeJsonPointer=escapeJsonPointer;function unescapeJsonPointer(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}u.unescapeJsonPointer=unescapeJsonPointer;function eachItem(t,u){if(Array.isArray(t)){for(const p of t)u(p)}else{u(t)}}u.eachItem=eachItem;function makeMergeEvaluated({mergeNames:t,mergeToName:u,mergeValues:p,resultToName:g}){return(v,b,w,E)=>{const S=w===undefined?b:w instanceof m.Name?(b instanceof m.Name?t(v,b,w):u(v,b,w),w):b instanceof m.Name?(u(v,w,b),b):p(b,w);return E===m.Name&&!(S instanceof m.Name)?g(v,S):S}}u.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(t,u,p)=>t.if((0,m._)`${p} !== true && ${u} !== undefined`,(()=>{t.if((0,m._)`${u} === true`,(()=>t.assign(p,true)),(()=>t.assign(p,(0,m._)`${p} || {}`).code((0,m._)`Object.assign(${p}, ${u})`)))})),mergeToName:(t,u,p)=>t.if((0,m._)`${p} !== true`,(()=>{if(u===true){t.assign(p,true)}else{t.assign(p,(0,m._)`${p} || {}`);setEvaluated(t,p,u)}})),mergeValues:(t,u)=>t===true?true:{...t,...u},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(t,u,p)=>t.if((0,m._)`${p} !== true && ${u} !== undefined`,(()=>t.assign(p,(0,m._)`${u} === true ? true : ${p} > ${u} ? ${p} : ${u}`))),mergeToName:(t,u,p)=>t.if((0,m._)`${p} !== true`,(()=>t.assign(p,u===true?true:(0,m._)`${p} > ${u} ? ${p} : ${u}`))),mergeValues:(t,u)=>t===true?true:Math.max(t,u),resultToName:(t,u)=>t.var("items",u)})};function evaluatedPropsToName(t,u){if(u===true)return t.var("props",true);const p=t.var("props",(0,m._)`{}`);if(u!==undefined)setEvaluated(t,p,u);return p}u.evaluatedPropsToName=evaluatedPropsToName;function setEvaluated(t,u,p){Object.keys(p).forEach((p=>t.assign((0,m._)`${u}${(0,m.getProperty)(p)}`,true)))}u.setEvaluated=setEvaluated;const v={};function useFunc(t,u){return t.scopeValue("func",{ref:u,code:v[u.code]||(v[u.code]=new g._Code(u.code))})}u.useFunc=useFunc;var b;(function(t){t[t["Num"]=0]="Num";t[t["Str"]=1]="Str"})(b||(u.Type=b={}));function getErrorPath(t,u,p){if(t instanceof m.Name){const g=u===b.Num;return p?g?(0,m._)`"[" + ${t} + "]"`:(0,m._)`"['" + ${t} + "']"`:g?(0,m._)`"/" + ${t}`:(0,m._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return p?(0,m.getProperty)(t).toString():"/"+escapeJsonPointer(t)}u.getErrorPath=getErrorPath;function checkStrictMode(t,u,p=t.opts.strictSchema){if(!p)return;u=`strict mode: ${u}`;if(p===true)throw new Error(u);t.self.logger.warn(u)}u.checkStrictMode=checkStrictMode},7837:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.shouldUseRule=u.shouldUseGroup=u.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:t,self:u},p){const m=u.RULES.types[p];return m&&m!==true&&shouldUseGroup(t,m)}u.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(t,u){return u.rules.some((u=>shouldUseRule(t,u)))}u.shouldUseGroup=shouldUseGroup;function shouldUseRule(t,u){var p;return t[u.keyword]!==undefined||((p=u.definition.implements)===null||p===void 0?void 0:p.some((u=>t[u]!==undefined)))}u.shouldUseRule=shouldUseRule},5885:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.boolOrEmptySchema=u.topBoolOrEmptySchema=void 0;const m=p(7446);const g=p(4671);const v=p(1529);const b={message:"boolean schema is false"};function topBoolOrEmptySchema(t){const{gen:u,schema:p,validateName:m}=t;if(p===false){falseSchemaError(t,false)}else if(typeof p=="object"&&p.$async===true){u.return(v.default.data)}else{u.assign((0,g._)`${m}.errors`,null);u.return(true)}}u.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(t,u){const{gen:p,schema:m}=t;if(m===false){p.var(u,false);falseSchemaError(t)}else{p.var(u,true)}}u.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(t,u){const{gen:p,data:g}=t;const v={gen:p,keyword:"false schema",data:g,schema:false,schemaCode:false,schemaValue:false,params:{},it:t};(0,m.reportError)(v,b,undefined,u)}},3330:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.reportTypeError=u.checkDataTypes=u.checkDataType=u.coerceAndCheckDataType=u.getJSONTypes=u.getSchemaTypes=u.DataType=void 0;const m=p(2166);const g=p(7837);const v=p(7446);const b=p(4671);const w=p(5049);var E;(function(t){t[t["Correct"]=0]="Correct";t[t["Wrong"]=1]="Wrong"})(E||(u.DataType=E={}));function getSchemaTypes(t){const u=getJSONTypes(t.type);const p=u.includes("null");if(p){if(t.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!u.length&&t.nullable!==undefined){throw new Error('"nullable" cannot be used without "type"')}if(t.nullable===true)u.push("null")}return u}u.getSchemaTypes=getSchemaTypes;function getJSONTypes(t){const u=Array.isArray(t)?t:t?[t]:[];if(u.every(m.isJSONType))return u;throw new Error("type must be JSONType or JSONType[]: "+u.join(","))}u.getJSONTypes=getJSONTypes;function coerceAndCheckDataType(t,u){const{gen:p,data:m,opts:v}=t;const b=coerceToTypes(u,v.coerceTypes);const w=u.length>0&&!(b.length===0&&u.length===1&&(0,g.schemaHasRulesForType)(t,u[0]));if(w){const g=checkDataTypes(u,m,v.strictNumbers,E.Wrong);p.if(g,(()=>{if(b.length)coerceData(t,u,b);else reportTypeError(t)}))}return w}u.coerceAndCheckDataType=coerceAndCheckDataType;const S=new Set(["string","number","integer","boolean","null"]);function coerceToTypes(t,u){return u?t.filter((t=>S.has(t)||u==="array"&&t==="array")):[]}function coerceData(t,u,p){const{gen:m,data:g,opts:v}=t;const w=m.let("dataType",(0,b._)`typeof ${g}`);const E=m.let("coerced",(0,b._)`undefined`);if(v.coerceTypes==="array"){m.if((0,b._)`${w} == 'object' && Array.isArray(${g}) && ${g}.length == 1`,(()=>m.assign(g,(0,b._)`${g}[0]`).assign(w,(0,b._)`typeof ${g}`).if(checkDataTypes(u,g,v.strictNumbers),(()=>m.assign(E,g)))))}m.if((0,b._)`${E} !== undefined`);for(const t of p){if(S.has(t)||t==="array"&&v.coerceTypes==="array"){coerceSpecificType(t)}}m.else();reportTypeError(t);m.endIf();m.if((0,b._)`${E} !== undefined`,(()=>{m.assign(g,E);assignParentData(t,E)}));function coerceSpecificType(t){switch(t){case"string":m.elseIf((0,b._)`${w} == "number" || ${w} == "boolean"`).assign(E,(0,b._)`"" + ${g}`).elseIf((0,b._)`${g} === null`).assign(E,(0,b._)`""`);return;case"number":m.elseIf((0,b._)`${w} == "boolean" || ${g} === null
2
+ (()=>{var t={7213:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.createFileSystemAdapter=u.FILE_SYSTEM_ADAPTER=void 0;const m=p(9896);u.FILE_SYSTEM_ADAPTER={lstat:m.lstat,stat:m.stat,lstatSync:m.lstatSync,statSync:m.statSync,readdir:m.readdir,readdirSync:m.readdirSync};function createFileSystemAdapter(t){if(t===undefined){return u.FILE_SYSTEM_ADAPTER}return Object.assign(Object.assign({},u.FILE_SYSTEM_ADAPTER),t)}u.createFileSystemAdapter=createFileSystemAdapter},7190:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const p=process.versions.node.split(".");if(p[0]===undefined||p[1]===undefined){throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`)}const m=Number.parseInt(p[0],10);const g=Number.parseInt(p[1],10);const v=10;const b=10;const w=m>v;const E=m===v&&g>=b;u.IS_SUPPORT_READDIR_WITH_FILE_TYPES=w||E},4227:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.Settings=u.scandirSync=u.scandir=void 0;const m=p(1250);const g=p(5959);const v=p(6);u.Settings=v.default;function scandir(t,u,p){if(typeof u==="function"){m.read(t,getSettings(),u);return}m.read(t,getSettings(u),p)}u.scandir=scandir;function scandirSync(t,u){const p=getSettings(u);return g.read(t,p)}u.scandirSync=scandirSync;function getSettings(t={}){if(t instanceof v.default){return t}return new v.default(t)}},1250:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.readdir=u.readdirWithFileTypes=u.read=void 0;const m=p(9321);const g=p(5876);const v=p(7190);const b=p(2829);const w=p(5521);function read(t,u,p){if(!u.stats&&v.IS_SUPPORT_READDIR_WITH_FILE_TYPES){readdirWithFileTypes(t,u,p);return}readdir(t,u,p)}u.read=read;function readdirWithFileTypes(t,u,p){u.fs.readdir(t,{withFileTypes:true},((m,v)=>{if(m!==null){callFailureCallback(p,m);return}const b=v.map((p=>({dirent:p,name:p.name,path:w.joinPathSegments(t,p.name,u.pathSegmentSeparator)})));if(!u.followSymbolicLinks){callSuccessCallback(p,b);return}const E=b.map((t=>makeRplTaskEntry(t,u)));g(E,((t,u)=>{if(t!==null){callFailureCallback(p,t);return}callSuccessCallback(p,u)}))}))}u.readdirWithFileTypes=readdirWithFileTypes;function makeRplTaskEntry(t,u){return p=>{if(!t.dirent.isSymbolicLink()){p(null,t);return}u.fs.stat(t.path,((m,g)=>{if(m!==null){if(u.throwErrorOnBrokenSymbolicLink){p(m);return}p(null,t);return}t.dirent=b.fs.createDirentFromStats(t.name,g);p(null,t)}))}}function readdir(t,u,p){u.fs.readdir(t,((v,E)=>{if(v!==null){callFailureCallback(p,v);return}const S=E.map((p=>{const g=w.joinPathSegments(t,p,u.pathSegmentSeparator);return t=>{m.stat(g,u.fsStatSettings,((m,v)=>{if(m!==null){t(m);return}const w={name:p,path:g,dirent:b.fs.createDirentFromStats(p,v)};if(u.stats){w.stats=v}t(null,w)}))}}));g(S,((t,u)=>{if(t!==null){callFailureCallback(p,t);return}callSuccessCallback(p,u)}))}))}u.readdir=readdir;function callFailureCallback(t,u){t(u)}function callSuccessCallback(t,u){t(null,u)}},5521:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.joinPathSegments=void 0;function joinPathSegments(t,u,p){if(t.endsWith(p)){return t+u}return t+p+u}u.joinPathSegments=joinPathSegments},5959:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.readdir=u.readdirWithFileTypes=u.read=void 0;const m=p(9321);const g=p(7190);const v=p(2829);const b=p(5521);function read(t,u){if(!u.stats&&g.IS_SUPPORT_READDIR_WITH_FILE_TYPES){return readdirWithFileTypes(t,u)}return readdir(t,u)}u.read=read;function readdirWithFileTypes(t,u){const p=u.fs.readdirSync(t,{withFileTypes:true});return p.map((p=>{const m={dirent:p,name:p.name,path:b.joinPathSegments(t,p.name,u.pathSegmentSeparator)};if(m.dirent.isSymbolicLink()&&u.followSymbolicLinks){try{const t=u.fs.statSync(m.path);m.dirent=v.fs.createDirentFromStats(m.name,t)}catch(t){if(u.throwErrorOnBrokenSymbolicLink){throw t}}}return m}))}u.readdirWithFileTypes=readdirWithFileTypes;function readdir(t,u){const p=u.fs.readdirSync(t);return p.map((p=>{const g=b.joinPathSegments(t,p,u.pathSegmentSeparator);const w=m.statSync(g,u.fsStatSettings);const E={name:p,path:g,dirent:v.fs.createDirentFromStats(p,w)};if(u.stats){E.stats=w}return E}))}u.readdir=readdir},6:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6928);const g=p(9321);const v=p(7213);class Settings{constructor(t={}){this._options=t;this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,false);this.fs=v.createFileSystemAdapter(this._options.fs);this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,m.sep);this.stats=this._getValue(this._options.stats,false);this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,true);this.fsStatSettings=new g.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,u){return t!==null&&t!==void 0?t:u}}u["default"]=Settings},426:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.createDirentFromStats=void 0;class DirentFromStats{constructor(t,u){this.name=t;this.isBlockDevice=u.isBlockDevice.bind(u);this.isCharacterDevice=u.isCharacterDevice.bind(u);this.isDirectory=u.isDirectory.bind(u);this.isFIFO=u.isFIFO.bind(u);this.isFile=u.isFile.bind(u);this.isSocket=u.isSocket.bind(u);this.isSymbolicLink=u.isSymbolicLink.bind(u)}}function createDirentFromStats(t,u){return new DirentFromStats(t,u)}u.createDirentFromStats=createDirentFromStats},2829:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.fs=void 0;const m=p(426);u.fs=m},7323:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.createFileSystemAdapter=u.FILE_SYSTEM_ADAPTER=void 0;const m=p(9896);u.FILE_SYSTEM_ADAPTER={lstat:m.lstat,stat:m.stat,lstatSync:m.lstatSync,statSync:m.statSync};function createFileSystemAdapter(t){if(t===undefined){return u.FILE_SYSTEM_ADAPTER}return Object.assign(Object.assign({},u.FILE_SYSTEM_ADAPTER),t)}u.createFileSystemAdapter=createFileSystemAdapter},9321:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.statSync=u.stat=u.Settings=void 0;const m=p(1968);const g=p(5249);const v=p(9172);u.Settings=v.default;function stat(t,u,p){if(typeof u==="function"){m.read(t,getSettings(),u);return}m.read(t,getSettings(u),p)}u.stat=stat;function statSync(t,u){const p=getSettings(u);return g.read(t,p)}u.statSync=statSync;function getSettings(t={}){if(t instanceof v.default){return t}return new v.default(t)}},1968:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.read=void 0;function read(t,u,p){u.fs.lstat(t,((m,g)=>{if(m!==null){callFailureCallback(p,m);return}if(!g.isSymbolicLink()||!u.followSymbolicLink){callSuccessCallback(p,g);return}u.fs.stat(t,((t,m)=>{if(t!==null){if(u.throwErrorOnBrokenSymbolicLink){callFailureCallback(p,t);return}callSuccessCallback(p,g);return}if(u.markSymbolicLink){m.isSymbolicLink=()=>true}callSuccessCallback(p,m)}))}))}u.read=read;function callFailureCallback(t,u){t(u)}function callSuccessCallback(t,u){t(null,u)}},5249:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.read=void 0;function read(t,u){const p=u.fs.lstatSync(t);if(!p.isSymbolicLink()||!u.followSymbolicLink){return p}try{const p=u.fs.statSync(t);if(u.markSymbolicLink){p.isSymbolicLink=()=>true}return p}catch(t){if(!u.throwErrorOnBrokenSymbolicLink){return p}throw t}}u.read=read},9172:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7323);class Settings{constructor(t={}){this._options=t;this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,true);this.fs=m.createFileSystemAdapter(this._options.fs);this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,false);this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,true)}_getValue(t,u){return t!==null&&t!==void 0?t:u}}u["default"]=Settings},3882:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.Settings=u.walkStream=u.walkSync=u.walk=void 0;const m=p(6279);const g=p(7291);const v=p(4844);const b=p(1305);u.Settings=b.default;function walk(t,u,p){if(typeof u==="function"){new m.default(t,getSettings()).read(u);return}new m.default(t,getSettings(u)).read(p)}u.walk=walk;function walkSync(t,u){const p=getSettings(u);const m=new v.default(t,p);return m.read()}u.walkSync=walkSync;function walkStream(t,u){const p=getSettings(u);const m=new g.default(t,p);return m.read()}u.walkStream=walkStream;function getSettings(t={}){if(t instanceof b.default){return t}return new b.default(t)}},6279:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(997);class AsyncProvider{constructor(t,u){this._root=t;this._settings=u;this._reader=new m.default(this._root,this._settings);this._storage=[]}read(t){this._reader.onError((u=>{callFailureCallback(t,u)}));this._reader.onEntry((t=>{this._storage.push(t)}));this._reader.onEnd((()=>{callSuccessCallback(t,this._storage)}));this._reader.read()}}u["default"]=AsyncProvider;function callFailureCallback(t,u){t(u)}function callSuccessCallback(t,u){t(null,u)}},7291:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(2203);const g=p(997);class StreamProvider{constructor(t,u){this._root=t;this._settings=u;this._reader=new g.default(this._root,this._settings);this._stream=new m.Readable({objectMode:true,read:()=>{},destroy:()=>{if(!this._reader.isDestroyed){this._reader.destroy()}}})}read(){this._reader.onError((t=>{this._stream.emit("error",t)}));this._reader.onEntry((t=>{this._stream.push(t)}));this._reader.onEnd((()=>{this._stream.push(null)}));this._reader.read();return this._stream}}u["default"]=StreamProvider},4844:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7942);class SyncProvider{constructor(t,u){this._root=t;this._settings=u;this._reader=new m.default(this._root,this._settings)}read(){return this._reader.read()}}u["default"]=SyncProvider},997:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4434);const g=p(4227);const v=p(3451);const b=p(6628);const w=p(6914);class AsyncReader extends w.default{constructor(t,u){super(t,u);this._settings=u;this._scandir=g.scandir;this._emitter=new m.EventEmitter;this._queue=v(this._worker.bind(this),this._settings.concurrency);this._isFatalError=false;this._isDestroyed=false;this._queue.drain=()=>{if(!this._isFatalError){this._emitter.emit("end")}}}read(){this._isFatalError=false;this._isDestroyed=false;setImmediate((()=>{this._pushToQueue(this._root,this._settings.basePath)}));return this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed){throw new Error("The reader is already destroyed")}this._isDestroyed=true;this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,u){const p={directory:t,base:u};this._queue.push(p,(t=>{if(t!==null){this._handleError(t)}}))}_worker(t,u){this._scandir(t.directory,this._settings.fsScandirSettings,((p,m)=>{if(p!==null){u(p,undefined);return}for(const u of m){this._handleEntry(u,t.base)}u(null,undefined)}))}_handleError(t){if(this._isDestroyed||!b.isFatalError(this._settings,t)){return}this._isFatalError=true;this._isDestroyed=true;this._emitter.emit("error",t)}_handleEntry(t,u){if(this._isDestroyed||this._isFatalError){return}const p=t.path;if(u!==undefined){t.path=b.joinPathSegments(u,t.name,this._settings.pathSegmentSeparator)}if(b.isAppliedFilter(this._settings.entryFilter,t)){this._emitEntry(t)}if(t.dirent.isDirectory()&&b.isAppliedFilter(this._settings.deepFilter,t)){this._pushToQueue(p,u===undefined?undefined:t.path)}}_emitEntry(t){this._emitter.emit("entry",t)}}u["default"]=AsyncReader},6628:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.joinPathSegments=u.replacePathSegmentSeparator=u.isAppliedFilter=u.isFatalError=void 0;function isFatalError(t,u){if(t.errorFilter===null){return true}return!t.errorFilter(u)}u.isFatalError=isFatalError;function isAppliedFilter(t,u){return t===null||t(u)}u.isAppliedFilter=isAppliedFilter;function replacePathSegmentSeparator(t,u){return t.split(/[/\\]/).join(u)}u.replacePathSegmentSeparator=replacePathSegmentSeparator;function joinPathSegments(t,u,p){if(t===""){return u}if(t.endsWith(p)){return t+u}return t+p+u}u.joinPathSegments=joinPathSegments},6914:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6628);class Reader{constructor(t,u){this._root=t;this._settings=u;this._root=m.replacePathSegmentSeparator(t,u.pathSegmentSeparator)}}u["default"]=Reader},7942:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4227);const g=p(6628);const v=p(6914);class SyncReader extends v.default{constructor(){super(...arguments);this._scandir=m.scandirSync;this._storage=[];this._queue=new Set}read(){this._pushToQueue(this._root,this._settings.basePath);this._handleQueue();return this._storage}_pushToQueue(t,u){this._queue.add({directory:t,base:u})}_handleQueue(){for(const t of this._queue.values()){this._handleDirectory(t.directory,t.base)}}_handleDirectory(t,u){try{const p=this._scandir(t,this._settings.fsScandirSettings);for(const t of p){this._handleEntry(t,u)}}catch(t){this._handleError(t)}}_handleError(t){if(!g.isFatalError(this._settings,t)){return}throw t}_handleEntry(t,u){const p=t.path;if(u!==undefined){t.path=g.joinPathSegments(u,t.name,this._settings.pathSegmentSeparator)}if(g.isAppliedFilter(this._settings.entryFilter,t)){this._pushToStorage(t)}if(t.dirent.isDirectory()&&g.isAppliedFilter(this._settings.deepFilter,t)){this._pushToQueue(p,u===undefined?undefined:t.path)}}_pushToStorage(t){this._storage.push(t)}}u["default"]=SyncReader},1305:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6928);const g=p(4227);class Settings{constructor(t={}){this._options=t;this.basePath=this._getValue(this._options.basePath,undefined);this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY);this.deepFilter=this._getValue(this._options.deepFilter,null);this.entryFilter=this._getValue(this._options.entryFilter,null);this.errorFilter=this._getValue(this._options.errorFilter,null);this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,m.sep);this.fsScandirSettings=new g.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,u){return t!==null&&t!==void 0?t:u}}u["default"]=Settings},9888:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.formatNames=u.fastFormats=u.fullFormats=void 0;function fmtDef(t,u){return{validate:t,compare:u}}u.fullFormats={date:fmtDef(date,compareDate),time:fmtDef(getTime(true),compareTime),"date-time":fmtDef(getDateTime(true),compareDateTime),"iso-time":fmtDef(getTime(),compareIsoTime),"iso-date-time":fmtDef(getDateTime(),compareIsoDateTime),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uri,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:regex,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:byte,int32:{type:"number",validate:validateInt32},int64:{type:"number",validate:validateInt64},float:{type:"number",validate:validateNumber},double:{type:"number",validate:validateNumber},password:true,binary:true};u.fastFormats={...u.fullFormats,date:fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,compareDate),time:fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareTime),"date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareDateTime),"iso-time":fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoTime),"iso-date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoDateTime),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};u.formatNames=Object.keys(u.fullFormats);function isLeapYear(t){return t%4===0&&(t%100!==0||t%400===0)}const p=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;const m=[0,31,28,31,30,31,30,31,31,30,31,30,31];function date(t){const u=p.exec(t);if(!u)return false;const g=+u[1];const v=+u[2];const b=+u[3];return v>=1&&v<=12&&b>=1&&b<=(v===2&&isLeapYear(g)?29:m[v])}function compareDate(t,u){if(!(t&&u))return undefined;if(t>u)return 1;if(t<u)return-1;return 0}const g=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function getTime(t){return function time(u){const p=g.exec(u);if(!p)return false;const m=+p[1];const v=+p[2];const b=+p[3];const w=p[4];const E=p[5]==="-"?-1:1;const S=+(p[6]||0);const $=+(p[7]||0);if(S>23||$>59||t&&!w)return false;if(m<=23&&v<=59&&b<60)return true;const P=v-$*E;const R=m-S*E-(P<0?1:0);return(R===23||R===-1)&&(P===59||P===-1)&&b<61}}function compareTime(t,u){if(!(t&&u))return undefined;const p=new Date("2020-01-01T"+t).valueOf();const m=new Date("2020-01-01T"+u).valueOf();if(!(p&&m))return undefined;return p-m}function compareIsoTime(t,u){if(!(t&&u))return undefined;const p=g.exec(t);const m=g.exec(u);if(!(p&&m))return undefined;t=p[1]+p[2]+p[3];u=m[1]+m[2]+m[3];if(t>u)return 1;if(t<u)return-1;return 0}const v=/t|\s/i;function getDateTime(t){const u=getTime(t);return function date_time(t){const p=t.split(v);return p.length===2&&date(p[0])&&u(p[1])}}function compareDateTime(t,u){if(!(t&&u))return undefined;const p=new Date(t).valueOf();const m=new Date(u).valueOf();if(!(p&&m))return undefined;return p-m}function compareIsoDateTime(t,u){if(!(t&&u))return undefined;const[p,m]=t.split(v);const[g,b]=u.split(v);const w=compareDate(p,g);if(w===undefined)return undefined;return w||compareTime(m,b)}const b=/\/|:/;const w=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function uri(t){return b.test(t)&&w.test(t)}const E=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function byte(t){E.lastIndex=0;return E.test(t)}const S=-(2**31);const $=2**31-1;function validateInt32(t){return Number.isInteger(t)&&t<=$&&t>=S}function validateInt64(t){return Number.isInteger(t)}function validateNumber(){return true}const P=/[^\\]\\Z/;function regex(t){if(P.test(t))return false;try{new RegExp(t);return true}catch(t){return false}}},6848:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(9888);const g=p(5755);const v=p(4671);const b=new v.Name("fullFormats");const w=new v.Name("fastFormats");const formatsPlugin=(t,u={keywords:true})=>{if(Array.isArray(u)){addFormats(t,u,m.fullFormats,b);return t}const[p,v]=u.mode==="fast"?[m.fastFormats,w]:[m.fullFormats,b];const E=u.formats||m.formatNames;addFormats(t,E,p,v);if(u.keywords)(0,g.default)(t);return t};formatsPlugin.get=(t,u="full")=>{const p=u==="fast"?m.fastFormats:m.fullFormats;const g=p[t];if(!g)throw new Error(`Unknown format "${t}"`);return g};function addFormats(t,u,p,m){var g;var b;(g=(b=t.opts.code).formats)!==null&&g!==void 0?g:b.formats=(0,v._)`require("ajv-formats/dist/formats").${m}`;for(const m of u)t.addFormat(m,p[m])}t.exports=u=formatsPlugin;Object.defineProperty(u,"__esModule",{value:true});u["default"]=formatsPlugin},5755:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.formatLimitDefinition=void 0;const m=p(5984);const g=p(4671);const v=g.operators;const b={formatMaximum:{okStr:"<=",ok:v.LTE,fail:v.GT},formatMinimum:{okStr:">=",ok:v.GTE,fail:v.LT},formatExclusiveMaximum:{okStr:"<",ok:v.LT,fail:v.GTE},formatExclusiveMinimum:{okStr:">",ok:v.GT,fail:v.LTE}};const w={message:({keyword:t,schemaCode:u})=>(0,g.str)`should be ${b[t].okStr} ${u}`,params:({keyword:t,schemaCode:u})=>(0,g._)`{comparison: ${b[t].okStr}, limit: ${u}}`};u.formatLimitDefinition={keyword:Object.keys(b),type:"string",schemaType:"string",$data:true,error:w,code(t){const{gen:u,data:p,schemaCode:v,keyword:w,it:E}=t;const{opts:S,self:$}=E;if(!S.validateFormats)return;const P=new m.KeywordCxt(E,$.RULES.all.format.definition,"format");if(P.$data)validate$DataFormat();else validateFormat();function validate$DataFormat(){const p=u.scopeValue("formats",{ref:$.formats,code:S.code.formats});const m=u.const("fmt",(0,g._)`${p}[${P.schemaCode}]`);t.fail$data((0,g.or)((0,g._)`typeof ${m} != "object"`,(0,g._)`${m} instanceof RegExp`,(0,g._)`typeof ${m}.compare != "function"`,compareCode(m)))}function validateFormat(){const p=P.schema;const m=$.formats[p];if(!m||m===true)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function"){throw new Error(`"${w}": format "${p}" does not define "compare" function`)}const v=u.scopeValue("formats",{key:p,ref:m,code:S.code.formats?(0,g._)`${S.code.formats}${(0,g.getProperty)(p)}`:undefined});t.fail$data(compareCode(v))}function compareCode(t){return(0,g._)`${t}.compare(${p}, ${v}) ${b[w].fail} 0`}},dependencies:["format"]};const formatLimitPlugin=t=>{t.addKeyword(u.formatLimitDefinition);return t};u["default"]=formatLimitPlugin},939:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.MissingRefError=u.ValidationError=u.CodeGen=u.Name=u.nil=u.stringify=u.str=u._=u.KeywordCxt=u.Ajv2020=void 0;const m=p(6952);const g=p(4231);const v=p(9099);const b=p(4010);const w="https://json-schema.org/draft/2020-12/schema";class Ajv2020 extends m.default{constructor(t={}){super({...t,dynamicRef:true,next:true,unevaluated:true})}_addVocabularies(){super._addVocabularies();g.default.forEach((t=>this.addVocabulary(t)));if(this.opts.discriminator)this.addKeyword(v.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:t,meta:u}=this.opts;if(!u)return;b.default.call(this,t);this.refs["http://json-schema.org/schema"]=w}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(w)?w:undefined)}}u.Ajv2020=Ajv2020;t.exports=u=Ajv2020;t.exports.Ajv2020=Ajv2020;Object.defineProperty(u,"__esModule",{value:true});u["default"]=Ajv2020;var E=p(324);Object.defineProperty(u,"KeywordCxt",{enumerable:true,get:function(){return E.KeywordCxt}});var S=p(4671);Object.defineProperty(u,"_",{enumerable:true,get:function(){return S._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return S.str}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return S.stringify}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return S.nil}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return S.Name}});Object.defineProperty(u,"CodeGen",{enumerable:true,get:function(){return S.CodeGen}});var $=p(4068);Object.defineProperty(u,"ValidationError",{enumerable:true,get:function(){return $.default}});var P=p(909);Object.defineProperty(u,"MissingRefError",{enumerable:true,get:function(){return P.default}})},5984:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.MissingRefError=u.ValidationError=u.CodeGen=u.Name=u.nil=u.stringify=u.str=u._=u.KeywordCxt=u.Ajv=void 0;const m=p(6952);const g=p(1982);const v=p(9099);const b=p(3928);const w=["/properties"];const E="http://json-schema.org/draft-07/schema";class Ajv extends m.default{_addVocabularies(){super._addVocabularies();g.default.forEach((t=>this.addVocabulary(t)));if(this.opts.discriminator)this.addKeyword(v.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();if(!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(b,w):b;this.addMetaSchema(t,E,false);this.refs["http://json-schema.org/schema"]=E}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(E)?E:undefined)}}u.Ajv=Ajv;t.exports=u=Ajv;t.exports.Ajv=Ajv;Object.defineProperty(u,"__esModule",{value:true});u["default"]=Ajv;var S=p(324);Object.defineProperty(u,"KeywordCxt",{enumerable:true,get:function(){return S.KeywordCxt}});var $=p(4671);Object.defineProperty(u,"_",{enumerable:true,get:function(){return $._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return $.str}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return $.stringify}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return $.nil}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return $.Name}});Object.defineProperty(u,"CodeGen",{enumerable:true,get:function(){return $.CodeGen}});var P=p(4068);Object.defineProperty(u,"ValidationError",{enumerable:true,get:function(){return P.default}});var R=p(909);Object.defineProperty(u,"MissingRefError",{enumerable:true,get:function(){return R.default}})},5554:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.regexpCode=u.getEsmExportName=u.getProperty=u.safeStringify=u.stringify=u.strConcat=u.addCodeArg=u.str=u._=u.nil=u._Code=u.Name=u.IDENTIFIER=u._CodeOrName=void 0;class _CodeOrName{}u._CodeOrName=_CodeOrName;u.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(t){super();if(!u.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}u.Name=Name;class _Code extends _CodeOrName{constructor(t){super();this._items=typeof t==="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce(((t,u)=>`${t}${u}`),"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce(((t,u)=>{if(u instanceof Name)t[u.str]=(t[u.str]||0)+1;return t}),{})}}u._Code=_Code;u.nil=new _Code("");function _(t,...u){const p=[t[0]];let m=0;while(m<u.length){addCodeArg(p,u[m]);p.push(t[++m])}return new _Code(p)}u._=_;const p=new _Code("+");function str(t,...u){const m=[safeStringify(t[0])];let g=0;while(g<u.length){m.push(p);addCodeArg(m,u[g]);m.push(p,safeStringify(t[++g]))}optimize(m);return new _Code(m)}u.str=str;function addCodeArg(t,u){if(u instanceof _Code)t.push(...u._items);else if(u instanceof Name)t.push(u);else t.push(interpolate(u))}u.addCodeArg=addCodeArg;function optimize(t){let u=1;while(u<t.length-1){if(t[u]===p){const p=mergeExprItems(t[u-1],t[u+1]);if(p!==undefined){t.splice(u-1,3,p);continue}t[u++]="+"}u++}}function mergeExprItems(t,u){if(u==='""')return t;if(t==='""')return u;if(typeof t=="string"){if(u instanceof Name||t[t.length-1]!=='"')return;if(typeof u!="string")return`${t.slice(0,-1)}${u}"`;if(u[0]==='"')return t.slice(0,-1)+u.slice(1);return}if(typeof u=="string"&&u[0]==='"'&&!(t instanceof Name))return`"${t}${u.slice(1)}`;return}function strConcat(t,u){return u.emptyStr()?t:t.emptyStr()?u:str`${t}${u}`}u.strConcat=strConcat;function interpolate(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:safeStringify(Array.isArray(t)?t.join(","):t)}function stringify(t){return new _Code(safeStringify(t))}u.stringify=stringify;function safeStringify(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}u.safeStringify=safeStringify;function getProperty(t){return typeof t=="string"&&u.IDENTIFIER.test(t)?new _Code(`.${t}`):_`[${t}]`}u.getProperty=getProperty;function getEsmExportName(t){if(typeof t=="string"&&u.IDENTIFIER.test(t)){return new _Code(`${t}`)}throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}u.getEsmExportName=getEsmExportName;function regexpCode(t){return new _Code(t.toString())}u.regexpCode=regexpCode},4671:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.or=u.and=u.not=u.CodeGen=u.operators=u.varKinds=u.ValueScopeName=u.ValueScope=u.Scope=u.Name=u.regexpCode=u.stringify=u.getProperty=u.nil=u.strConcat=u.str=u._=void 0;const m=p(5554);const g=p(183);var v=p(5554);Object.defineProperty(u,"_",{enumerable:true,get:function(){return v._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return v.str}});Object.defineProperty(u,"strConcat",{enumerable:true,get:function(){return v.strConcat}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return v.nil}});Object.defineProperty(u,"getProperty",{enumerable:true,get:function(){return v.getProperty}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return v.stringify}});Object.defineProperty(u,"regexpCode",{enumerable:true,get:function(){return v.regexpCode}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return v.Name}});var b=p(183);Object.defineProperty(u,"Scope",{enumerable:true,get:function(){return b.Scope}});Object.defineProperty(u,"ValueScope",{enumerable:true,get:function(){return b.ValueScope}});Object.defineProperty(u,"ValueScopeName",{enumerable:true,get:function(){return b.ValueScopeName}});Object.defineProperty(u,"varKinds",{enumerable:true,get:function(){return b.varKinds}});u.operators={GT:new m._Code(">"),GTE:new m._Code(">="),LT:new m._Code("<"),LTE:new m._Code("<="),EQ:new m._Code("==="),NEQ:new m._Code("!=="),NOT:new m._Code("!"),OR:new m._Code("||"),AND:new m._Code("&&"),ADD:new m._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(t,u){return this}}class Def extends Node{constructor(t,u,p){super();this.varKind=t;this.name=u;this.rhs=p}render({es5:t,_n:u}){const p=t?g.varKinds.var:this.varKind;const m=this.rhs===undefined?"":` = ${this.rhs}`;return`${p} ${this.name}${m};`+u}optimizeNames(t,u){if(!t[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,t,u);return this}get names(){return this.rhs instanceof m._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(t,u,p){super();this.lhs=t;this.rhs=u;this.sideEffects=p}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,u){if(this.lhs instanceof m.Name&&!t[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,t,u);return this}get names(){const t=this.lhs instanceof m.Name?{}:{...this.lhs.names};return addExprNames(t,this.rhs)}}class AssignOp extends Assign{constructor(t,u,p,m){super(t,p,m);this.op=u}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class Label extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){return`${this.label}:`+t}}class Break extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){const u=this.label?` ${this.label}`:"";return`break${u};`+t}}class Throw extends Node{constructor(t){super();this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class AnyCode extends Node{constructor(t){super();this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(t,u){this.code=optimizeExpr(this.code,t,u);return this}get names(){return this.code instanceof m._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(t=[]){super();this.nodes=t}render(t){return this.nodes.reduce(((u,p)=>u+p.render(t)),"")}optimizeNodes(){const{nodes:t}=this;let u=t.length;while(u--){const p=t[u].optimizeNodes();if(Array.isArray(p))t.splice(u,1,...p);else if(p)t[u]=p;else t.splice(u,1)}return t.length>0?this:undefined}optimizeNames(t,u){const{nodes:p}=this;let m=p.length;while(m--){const g=p[m];if(g.optimizeNames(t,u))continue;subtractNames(t,g.names);p.splice(m,1)}return p.length>0?this:undefined}get names(){return this.nodes.reduce(((t,u)=>addNames(t,u.names)),{})}}class BlockNode extends ParentNode{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(t,u){super(u);this.condition=t}render(t){let u=`if(${this.condition})`+super.render(t);if(this.else)u+="else "+this.else.render(t);return u}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(t===true)return this.nodes;let u=this.else;if(u){const t=u.optimizeNodes();u=this.else=Array.isArray(t)?new Else(t):t}if(u){if(t===false)return u instanceof If?u:u.nodes;if(this.nodes.length)return this;return new If(not(t),u instanceof If?[u]:u.nodes)}if(t===false||!this.nodes.length)return undefined;return this}optimizeNames(t,u){var p;this.else=(p=this.else)===null||p===void 0?void 0:p.optimizeNames(t,u);if(!(super.optimizeNames(t,u)||this.else))return;this.condition=optimizeExpr(this.condition,t,u);return this}get names(){const t=super.names;addExprNames(t,this.condition);if(this.else)addNames(t,this.else.names);return t}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(t){super();this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,u){if(!super.optimizeNames(t,u))return;this.iteration=optimizeExpr(this.iteration,t,u);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(t,u,p,m){super();this.varKind=t;this.name=u;this.from=p;this.to=m}render(t){const u=t.es5?g.varKinds.var:this.varKind;const{name:p,from:m,to:v}=this;return`for(${u} ${p}=${m}; ${p}<${v}; ${p}++)`+super.render(t)}get names(){const t=addExprNames(super.names,this.from);return addExprNames(t,this.to)}}class ForIter extends For{constructor(t,u,p,m){super();this.loop=t;this.varKind=u;this.name=p;this.iterable=m}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,u){if(!super.optimizeNames(t,u))return;this.iterable=optimizeExpr(this.iterable,t,u);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(t,u,p){super();this.name=t;this.args=u;this.async=p}render(t){const u=this.async?"async ":"";return`${u}function ${this.name}(${this.args})`+super.render(t)}}Func.kind="func";class Return extends ParentNode{render(t){return"return "+super.render(t)}}Return.kind="return";class Try extends BlockNode{render(t){let u="try"+super.render(t);if(this.catch)u+=this.catch.render(t);if(this.finally)u+=this.finally.render(t);return u}optimizeNodes(){var t,u;super.optimizeNodes();(t=this.catch)===null||t===void 0?void 0:t.optimizeNodes();(u=this.finally)===null||u===void 0?void 0:u.optimizeNodes();return this}optimizeNames(t,u){var p,m;super.optimizeNames(t,u);(p=this.catch)===null||p===void 0?void 0:p.optimizeNames(t,u);(m=this.finally)===null||m===void 0?void 0:m.optimizeNames(t,u);return this}get names(){const t=super.names;if(this.catch)addNames(t,this.catch.names);if(this.finally)addNames(t,this.finally.names);return t}}class Catch extends BlockNode{constructor(t){super();this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}Catch.kind="catch";class Finally extends BlockNode{render(t){return"finally"+super.render(t)}}Finally.kind="finally";class CodeGen{constructor(t,u={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...u,_n:u.lines?"\n":""};this._extScope=t;this._scope=new g.Scope({parent:t});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,u){const p=this._extScope.value(t,u);const m=this._values[p.prefix]||(this._values[p.prefix]=new Set);m.add(p);return p}getScopeValue(t,u){return this._extScope.getValue(t,u)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,u,p,m){const g=this._scope.toName(u);if(p!==undefined&&m)this._constants[g.str]=p;this._leafNode(new Def(t,g,p));return g}const(t,u,p){return this._def(g.varKinds.const,t,u,p)}let(t,u,p){return this._def(g.varKinds.let,t,u,p)}var(t,u,p){return this._def(g.varKinds.var,t,u,p)}assign(t,u,p){return this._leafNode(new Assign(t,u,p))}add(t,p){return this._leafNode(new AssignOp(t,u.operators.ADD,p))}code(t){if(typeof t=="function")t();else if(t!==m.nil)this._leafNode(new AnyCode(t));return this}object(...t){const u=["{"];for(const[p,g]of t){if(u.length>1)u.push(",");u.push(p);if(p!==g||this.opts.es5){u.push(":");(0,m.addCodeArg)(u,g)}}u.push("}");return new m._Code(u)}if(t,u,p){this._blockNode(new If(t));if(u&&p){this.code(u).else().code(p).endIf()}else if(u){this.code(u).endIf()}else if(p){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(t){return this._elseNode(new If(t))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(t,u){this._blockNode(t);if(u)this.code(u).endFor();return this}for(t,u){return this._for(new ForLoop(t),u)}forRange(t,u,p,m,v=(this.opts.es5?g.varKinds.var:g.varKinds.let)){const b=this._scope.toName(t);return this._for(new ForRange(v,b,u,p),(()=>m(b)))}forOf(t,u,p,v=g.varKinds.const){const b=this._scope.toName(t);if(this.opts.es5){const t=u instanceof m.Name?u:this.var("_arr",u);return this.forRange("_i",0,(0,m._)`${t}.length`,(u=>{this.var(b,(0,m._)`${t}[${u}]`);p(b)}))}return this._for(new ForIter("of",v,b,u),(()=>p(b)))}forIn(t,u,p,v=(this.opts.es5?g.varKinds.var:g.varKinds.const)){if(this.opts.ownProperties){return this.forOf(t,(0,m._)`Object.keys(${u})`,p)}const b=this._scope.toName(t);return this._for(new ForIter("in",v,b,u),(()=>p(b)))}endFor(){return this._endBlockNode(For)}label(t){return this._leafNode(new Label(t))}break(t){return this._leafNode(new Break(t))}return(t){const u=new Return;this._blockNode(u);this.code(t);if(u.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(t,u,p){if(!u&&!p)throw new Error('CodeGen: "try" without "catch" and "finally"');const m=new Try;this._blockNode(m);this.code(t);if(u){const t=this.name("e");this._currNode=m.catch=new Catch(t);u(t)}if(p){this._currNode=m.finally=new Finally;this.code(p)}return this._endBlockNode(Catch,Finally)}throw(t){return this._leafNode(new Throw(t))}block(t,u){this._blockStarts.push(this._nodes.length);if(t)this.code(t).endBlock(u);return this}endBlock(t){const u=this._blockStarts.pop();if(u===undefined)throw new Error("CodeGen: not in self-balancing block");const p=this._nodes.length-u;if(p<0||t!==undefined&&p!==t){throw new Error(`CodeGen: wrong number of nodes: ${p} vs ${t} expected`)}this._nodes.length=u;return this}func(t,u=m.nil,p,g){this._blockNode(new Func(t,u,p));if(g)this.code(g).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(t=1){while(t-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(t){this._currNode.nodes.push(t);return this}_blockNode(t){this._currNode.nodes.push(t);this._nodes.push(t)}_endBlockNode(t,u){const p=this._currNode;if(p instanceof t||u&&p instanceof u){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${u?`${t.kind}/${u.kind}`:t.kind}"`)}_elseNode(t){const u=this._currNode;if(!(u instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=u.else=t;return this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const u=this._nodes;u[u.length-1]=t}}u.CodeGen=CodeGen;function addNames(t,u){for(const p in u)t[p]=(t[p]||0)+(u[p]||0);return t}function addExprNames(t,u){return u instanceof m._CodeOrName?addNames(t,u.names):t}function optimizeExpr(t,u,p){if(t instanceof m.Name)return replaceName(t);if(!canOptimize(t))return t;return new m._Code(t._items.reduce(((t,u)=>{if(u instanceof m.Name)u=replaceName(u);if(u instanceof m._Code)t.push(...u._items);else t.push(u);return t}),[]));function replaceName(t){const m=p[t.str];if(m===undefined||u[t.str]!==1)return t;delete u[t.str];return m}function canOptimize(t){return t instanceof m._Code&&t._items.some((t=>t instanceof m.Name&&u[t.str]===1&&p[t.str]!==undefined))}}function subtractNames(t,u){for(const p in u)t[p]=(t[p]||0)-(u[p]||0)}function not(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,m._)`!${par(t)}`}u.not=not;const w=mappend(u.operators.AND);function and(...t){return t.reduce(w)}u.and=and;const E=mappend(u.operators.OR);function or(...t){return t.reduce(E)}u.or=or;function mappend(t){return(u,p)=>u===m.nil?p:p===m.nil?u:(0,m._)`${par(u)} ${t} ${par(p)}`}function par(t){return t instanceof m.Name?t:(0,m._)`(${t})`}},183:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.ValueScope=u.ValueScopeName=u.Scope=u.varKinds=u.UsedValueState=void 0;const m=p(5554);class ValueError extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`);this.value=t.value}}var g;(function(t){t[t["Started"]=0]="Started";t[t["Completed"]=1]="Completed"})(g||(u.UsedValueState=g={}));u.varKinds={const:new m.Name("const"),let:new m.Name("let"),var:new m.Name("var")};class Scope{constructor({prefixes:t,parent:u}={}){this._names={};this._prefixes=t;this._parent=u}toName(t){return t instanceof m.Name?t:this.name(t)}name(t){return new m.Name(this._newName(t))}_newName(t){const u=this._names[t]||this._nameGroup(t);return`${t}${u.index++}`}_nameGroup(t){var u,p;if(((p=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||p===void 0?void 0:p.has(t))||this._prefixes&&!this._prefixes.has(t)){throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`)}return this._names[t]={prefix:t,index:0}}}u.Scope=Scope;class ValueScopeName extends m.Name{constructor(t,u){super(u);this.prefix=t}setValue(t,{property:u,itemIndex:p}){this.value=t;this.scopePath=(0,m._)`.${new m.Name(u)}[${p}]`}}u.ValueScopeName=ValueScopeName;const v=(0,m._)`\n`;class ValueScope extends Scope{constructor(t){super(t);this._values={};this._scope=t.scope;this.opts={...t,_n:t.lines?v:m.nil}}get(){return this._scope}name(t){return new ValueScopeName(t,this._newName(t))}value(t,u){var p;if(u.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const m=this.toName(t);const{prefix:g}=m;const v=(p=u.key)!==null&&p!==void 0?p:u.ref;let b=this._values[g];if(b){const t=b.get(v);if(t)return t}else{b=this._values[g]=new Map}b.set(v,m);const w=this._scope[g]||(this._scope[g]=[]);const E=w.length;w[E]=u.ref;m.setValue(u,{property:g,itemIndex:E});return m}getValue(t,u){const p=this._values[t];if(!p)return;return p.get(u)}scopeRefs(t,u=this._values){return this._reduceValues(u,(u=>{if(u.scopePath===undefined)throw new Error(`CodeGen: name "${u}" has no value`);return(0,m._)`${t}${u.scopePath}`}))}scopeCode(t=this._values,u,p){return this._reduceValues(t,(t=>{if(t.value===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code}),u,p)}_reduceValues(t,p,v={},b){let w=m.nil;for(const E in t){const S=t[E];if(!S)continue;const $=v[E]=v[E]||new Map;S.forEach((t=>{if($.has(t))return;$.set(t,g.Started);let v=p(t);if(v){const p=this.opts.es5?u.varKinds.var:u.varKinds.const;w=(0,m._)`${w}${p} ${t} = ${v};${this.opts._n}`}else if(v=b===null||b===void 0?void 0:b(t)){w=(0,m._)`${w}${v}${this.opts._n}`}else{throw new ValueError(t)}$.set(t,g.Completed)}))}return w}}u.ValueScope=ValueScope},7446:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.extendErrors=u.resetErrorsCount=u.reportExtraError=u.reportError=u.keyword$DataError=u.keywordError=void 0;const m=p(4671);const g=p(5049);const v=p(1529);u.keywordError={message:({keyword:t})=>(0,m.str)`must pass "${t}" keyword validation`};u.keyword$DataError={message:({keyword:t,schemaType:u})=>u?(0,m.str)`"${t}" keyword must be ${u} ($data)`:(0,m.str)`"${t}" keyword is invalid ($data)`};function reportError(t,p=u.keywordError,g,v){const{it:b}=t;const{gen:w,compositeRule:E,allErrors:S}=b;const $=errorObjectCode(t,p,g);if(v!==null&&v!==void 0?v:E||S){addError(w,$)}else{returnErrors(b,(0,m._)`[${$}]`)}}u.reportError=reportError;function reportExtraError(t,p=u.keywordError,m){const{it:g}=t;const{gen:b,compositeRule:w,allErrors:E}=g;const S=errorObjectCode(t,p,m);addError(b,S);if(!(w||E)){returnErrors(g,v.default.vErrors)}}u.reportExtraError=reportExtraError;function resetErrorsCount(t,u){t.assign(v.default.errors,u);t.if((0,m._)`${v.default.vErrors} !== null`,(()=>t.if(u,(()=>t.assign((0,m._)`${v.default.vErrors}.length`,u)),(()=>t.assign(v.default.vErrors,null)))))}u.resetErrorsCount=resetErrorsCount;function extendErrors({gen:t,keyword:u,schemaValue:p,data:g,errsCount:b,it:w}){if(b===undefined)throw new Error("ajv implementation error");const E=t.name("err");t.forRange("i",b,v.default.errors,(b=>{t.const(E,(0,m._)`${v.default.vErrors}[${b}]`);t.if((0,m._)`${E}.instancePath === undefined`,(()=>t.assign((0,m._)`${E}.instancePath`,(0,m.strConcat)(v.default.instancePath,w.errorPath))));t.assign((0,m._)`${E}.schemaPath`,(0,m.str)`${w.errSchemaPath}/${u}`);if(w.opts.verbose){t.assign((0,m._)`${E}.schema`,p);t.assign((0,m._)`${E}.data`,g)}}))}u.extendErrors=extendErrors;function addError(t,u){const p=t.const("err",u);t.if((0,m._)`${v.default.vErrors} === null`,(()=>t.assign(v.default.vErrors,(0,m._)`[${p}]`)),(0,m._)`${v.default.vErrors}.push(${p})`);t.code((0,m._)`${v.default.errors}++`)}function returnErrors(t,u){const{gen:p,validateName:g,schemaEnv:v}=t;if(v.$async){p.throw((0,m._)`new ${t.ValidationError}(${u})`)}else{p.assign((0,m._)`${g}.errors`,u);p.return(false)}}const b={keyword:new m.Name("keyword"),schemaPath:new m.Name("schemaPath"),params:new m.Name("params"),propertyName:new m.Name("propertyName"),message:new m.Name("message"),schema:new m.Name("schema"),parentSchema:new m.Name("parentSchema")};function errorObjectCode(t,u,p){const{createErrors:g}=t.it;if(g===false)return(0,m._)`{}`;return errorObject(t,u,p)}function errorObject(t,u,p={}){const{gen:m,it:g}=t;const v=[errorInstancePath(g,p),errorSchemaPath(t,p)];extraErrorProps(t,u,v);return m.object(...v)}function errorInstancePath({errorPath:t},{instancePath:u}){const p=u?(0,m.str)`${t}${(0,g.getErrorPath)(u,g.Type.Str)}`:t;return[v.default.instancePath,(0,m.strConcat)(v.default.instancePath,p)]}function errorSchemaPath({keyword:t,it:{errSchemaPath:u}},{schemaPath:p,parentSchema:v}){let w=v?u:(0,m.str)`${u}/${t}`;if(p){w=(0,m.str)`${w}${(0,g.getErrorPath)(p,g.Type.Str)}`}return[b.schemaPath,w]}function extraErrorProps(t,{params:u,message:p},g){const{keyword:w,data:E,schemaValue:S,it:$}=t;const{opts:P,propertyName:R,topSchemaRef:x,schemaPath:O}=$;g.push([b.keyword,w],[b.params,typeof u=="function"?u(t):u||(0,m._)`{}`]);if(P.messages){g.push([b.message,typeof p=="function"?p(t):p])}if(P.verbose){g.push([b.schema,S],[b.parentSchema,(0,m._)`${x}${O}`],[v.default.data,E])}if(R)g.push([b.propertyName,R])}},4033:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.resolveSchema=u.getCompilingSchema=u.resolveRef=u.compileSchema=u.SchemaEnv=void 0;const m=p(4671);const g=p(4068);const v=p(1529);const b=p(9749);const w=p(5049);const E=p(324);class SchemaEnv{constructor(t){var u;this.refs={};this.dynamicAnchors={};let p;if(typeof t.schema=="object")p=t.schema;this.schema=t.schema;this.schemaId=t.schemaId;this.root=t.root||this;this.baseId=(u=t.baseId)!==null&&u!==void 0?u:(0,b.normalizeId)(p===null||p===void 0?void 0:p[t.schemaId||"$id"]);this.schemaPath=t.schemaPath;this.localRefs=t.localRefs;this.meta=t.meta;this.$async=p===null||p===void 0?void 0:p.$async;this.refs={}}}u.SchemaEnv=SchemaEnv;function compileSchema(t){const u=getCompilingSchema.call(this,t);if(u)return u;const p=(0,b.getFullPath)(this.opts.uriResolver,t.root.baseId);const{es5:w,lines:S}=this.opts.code;const{ownProperties:$}=this.opts;const P=new m.CodeGen(this.scope,{es5:w,lines:S,ownProperties:$});let R;if(t.$async){R=P.scopeValue("Error",{ref:g.default,code:(0,m._)`require("ajv/dist/runtime/validation_error").default`})}const x=P.scopeName("validate");t.validateName=x;const O={gen:P,allErrors:this.opts.allErrors,data:v.default.data,parentData:v.default.parentData,parentDataProperty:v.default.parentDataProperty,dataNames:[v.default.data],dataPathArr:[m.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:P.scopeValue("schema",this.opts.code.source===true?{ref:t.schema,code:(0,m.stringify)(t.schema)}:{ref:t.schema}),validateName:x,ValidationError:R,schema:t.schema,schemaEnv:t,rootId:p,baseId:t.baseId||p,schemaPath:m.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,m._)`""`,opts:this.opts,self:this};let A;try{this._compilations.add(t);(0,E.validateFunctionCode)(O);P.optimize(this.opts.code.optimize);const u=P.toString();A=`${P.scopeRefs(v.default.scope)}return ${u}`;if(this.opts.code.process)A=this.opts.code.process(A,t);const p=new Function(`${v.default.self}`,`${v.default.scope}`,A);const g=p(this,this.scope.get());this.scope.value(x,{ref:g});g.errors=null;g.schema=t.schema;g.schemaEnv=t;if(t.$async)g.$async=true;if(this.opts.code.source===true){g.source={validateName:x,validateCode:u,scopeValues:P._values}}if(this.opts.unevaluated){const{props:t,items:u}=O;g.evaluated={props:t instanceof m.Name?undefined:t,items:u instanceof m.Name?undefined:u,dynamicProps:t instanceof m.Name,dynamicItems:u instanceof m.Name};if(g.source)g.source.evaluated=(0,m.stringify)(g.evaluated)}t.validate=g;return t}catch(u){delete t.validate;delete t.validateName;if(A)this.logger.error("Error compiling schema, function code:",A);throw u}finally{this._compilations.delete(t)}}u.compileSchema=compileSchema;function resolveRef(t,u,p){var m;p=(0,b.resolveUrl)(this.opts.uriResolver,u,p);const g=t.refs[p];if(g)return g;let v=resolve.call(this,t,p);if(v===undefined){const g=(m=t.localRefs)===null||m===void 0?void 0:m[p];const{schemaId:b}=this.opts;if(g)v=new SchemaEnv({schema:g,schemaId:b,root:t,baseId:u})}if(v===undefined)return;return t.refs[p]=inlineOrCompile.call(this,v)}u.resolveRef=resolveRef;function inlineOrCompile(t){if((0,b.inlineRef)(t.schema,this.opts.inlineRefs))return t.schema;return t.validate?t:compileSchema.call(this,t)}function getCompilingSchema(t){for(const u of this._compilations){if(sameSchemaEnv(u,t))return u}}u.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(t,u){return t.schema===u.schema&&t.root===u.root&&t.baseId===u.baseId}function resolve(t,u){let p;while(typeof(p=this.refs[u])=="string")u=p;return p||this.schemas[u]||resolveSchema.call(this,t,u)}function resolveSchema(t,u){const p=this.opts.uriResolver.parse(u);const m=(0,b._getFullPath)(this.opts.uriResolver,p);let g=(0,b.getFullPath)(this.opts.uriResolver,t.baseId,undefined);if(Object.keys(t.schema).length>0&&m===g){return getJsonPointer.call(this,p,t)}const v=(0,b.normalizeId)(m);const w=this.refs[v]||this.schemas[v];if(typeof w=="string"){const u=resolveSchema.call(this,t,w);if(typeof(u===null||u===void 0?void 0:u.schema)!=="object")return;return getJsonPointer.call(this,p,u)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)compileSchema.call(this,w);if(v===(0,b.normalizeId)(u)){const{schema:u}=w;const{schemaId:p}=this.opts;const m=u[p];if(m)g=(0,b.resolveUrl)(this.opts.uriResolver,g,m);return new SchemaEnv({schema:u,schemaId:p,root:t,baseId:g})}return getJsonPointer.call(this,p,w)}u.resolveSchema=resolveSchema;const S=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(t,{baseId:u,schema:p,root:m}){var g;if(((g=t.fragment)===null||g===void 0?void 0:g[0])!=="/")return;for(const m of t.fragment.slice(1).split("/")){if(typeof p==="boolean")return;const t=p[(0,w.unescapeFragment)(m)];if(t===undefined)return;p=t;const g=typeof p==="object"&&p[this.opts.schemaId];if(!S.has(m)&&g){u=(0,b.resolveUrl)(this.opts.uriResolver,u,g)}}let v;if(typeof p!="boolean"&&p.$ref&&!(0,w.schemaHasRulesButRef)(p,this.RULES)){const t=(0,b.resolveUrl)(this.opts.uriResolver,u,p.$ref);v=resolveSchema.call(this,m,t)}const{schemaId:E}=this.opts;v=v||new SchemaEnv({schema:p,schemaId:E,root:m,baseId:u});if(v.schema!==v.root.schema)return v;return undefined}},1529:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g={data:new m.Name("data"),valCxt:new m.Name("valCxt"),instancePath:new m.Name("instancePath"),parentData:new m.Name("parentData"),parentDataProperty:new m.Name("parentDataProperty"),rootData:new m.Name("rootData"),dynamicAnchors:new m.Name("dynamicAnchors"),vErrors:new m.Name("vErrors"),errors:new m.Name("errors"),this:new m.Name("this"),self:new m.Name("self"),scope:new m.Name("scope"),json:new m.Name("json"),jsonPos:new m.Name("jsonPos"),jsonLen:new m.Name("jsonLen"),jsonPart:new m.Name("jsonPart")};u["default"]=g},909:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(9749);class MissingRefError extends Error{constructor(t,u,p,g){super(g||`can't resolve reference ${p} from id ${u}`);this.missingRef=(0,m.resolveUrl)(t,u,p);this.missingSchema=(0,m.normalizeId)((0,m.getFullPath)(t,this.missingRef))}}u["default"]=MissingRefError},9749:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.getSchemaRefs=u.resolveUrl=u.normalizeId=u._getFullPath=u.getFullPath=u.inlineRef=void 0;const m=p(5049);const g=p(7407);const v=p(7564);const b=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(t,u=true){if(typeof t=="boolean")return true;if(u===true)return!hasRef(t);if(!u)return false;return countKeys(t)<=u}u.inlineRef=inlineRef;const w=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(t){for(const u in t){if(w.has(u))return true;const p=t[u];if(Array.isArray(p)&&p.some(hasRef))return true;if(typeof p=="object"&&hasRef(p))return true}return false}function countKeys(t){let u=0;for(const p in t){if(p==="$ref")return Infinity;u++;if(b.has(p))continue;if(typeof t[p]=="object"){(0,m.eachItem)(t[p],(t=>u+=countKeys(t)))}if(u===Infinity)return Infinity}return u}function getFullPath(t,u="",p){if(p!==false)u=normalizeId(u);const m=t.parse(u);return _getFullPath(t,m)}u.getFullPath=getFullPath;function _getFullPath(t,u){const p=t.serialize(u);return p.split("#")[0]+"#"}u._getFullPath=_getFullPath;const E=/#\/?$/;function normalizeId(t){return t?t.replace(E,""):""}u.normalizeId=normalizeId;function resolveUrl(t,u,p){p=normalizeId(p);return t.resolve(u,p)}u.resolveUrl=resolveUrl;const S=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(t,u){if(typeof t=="boolean")return{};const{schemaId:p,uriResolver:m}=this.opts;const b=normalizeId(t[p]||u);const w={"":b};const E=getFullPath(m,b,false);const $={};const P=new Set;v(t,{allKeys:true},((t,u,m,g)=>{if(g===undefined)return;const v=E+u;let b=w[g];if(typeof t[p]=="string")b=addRef.call(this,t[p]);addAnchor.call(this,t.$anchor);addAnchor.call(this,t.$dynamicAnchor);w[u]=b;function addRef(u){const p=this.opts.uriResolver.resolve;u=normalizeId(b?p(b,u):u);if(P.has(u))throw ambiguos(u);P.add(u);let m=this.refs[u];if(typeof m=="string")m=this.refs[m];if(typeof m=="object"){checkAmbiguosRef(t,m.schema,u)}else if(u!==normalizeId(v)){if(u[0]==="#"){checkAmbiguosRef(t,$[u],u);$[u]=t}else{this.refs[u]=v}}return u}function addAnchor(t){if(typeof t=="string"){if(!S.test(t))throw new Error(`invalid anchor "${t}"`);addRef.call(this,`#${t}`)}}}));return $;function checkAmbiguosRef(t,u,p){if(u!==undefined&&!g(t,u))throw ambiguos(p)}function ambiguos(t){return new Error(`reference "${t}" resolves to more than one schema`)}}u.getSchemaRefs=getSchemaRefs},2166:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.getRules=u.isJSONType=void 0;const p=["string","number","integer","boolean","null","object","array"];const m=new Set(p);function isJSONType(t){return typeof t=="string"&&m.has(t)}u.isJSONType=isJSONType;function getRules(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:true,boolean:true,null:true},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}u.getRules=getRules},5049:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.checkStrictMode=u.getErrorPath=u.Type=u.useFunc=u.setEvaluated=u.evaluatedPropsToName=u.mergeEvaluated=u.eachItem=u.unescapeJsonPointer=u.escapeJsonPointer=u.escapeFragment=u.unescapeFragment=u.schemaRefOrVal=u.schemaHasRulesButRef=u.schemaHasRules=u.checkUnknownRules=u.alwaysValidSchema=u.toHash=void 0;const m=p(4671);const g=p(5554);function toHash(t){const u={};for(const p of t)u[p]=true;return u}u.toHash=toHash;function alwaysValidSchema(t,u){if(typeof u=="boolean")return u;if(Object.keys(u).length===0)return true;checkUnknownRules(t,u);return!schemaHasRules(u,t.self.RULES.all)}u.alwaysValidSchema=alwaysValidSchema;function checkUnknownRules(t,u=t.schema){const{opts:p,self:m}=t;if(!p.strictSchema)return;if(typeof u==="boolean")return;const g=m.RULES.keywords;for(const p in u){if(!g[p])checkStrictMode(t,`unknown keyword: "${p}"`)}}u.checkUnknownRules=checkUnknownRules;function schemaHasRules(t,u){if(typeof t=="boolean")return!t;for(const p in t)if(u[p])return true;return false}u.schemaHasRules=schemaHasRules;function schemaHasRulesButRef(t,u){if(typeof t=="boolean")return!t;for(const p in t)if(p!=="$ref"&&u.all[p])return true;return false}u.schemaHasRulesButRef=schemaHasRulesButRef;function schemaRefOrVal({topSchemaRef:t,schemaPath:u},p,g,v){if(!v){if(typeof p=="number"||typeof p=="boolean")return p;if(typeof p=="string")return(0,m._)`${p}`}return(0,m._)`${t}${u}${(0,m.getProperty)(g)}`}u.schemaRefOrVal=schemaRefOrVal;function unescapeFragment(t){return unescapeJsonPointer(decodeURIComponent(t))}u.unescapeFragment=unescapeFragment;function escapeFragment(t){return encodeURIComponent(escapeJsonPointer(t))}u.escapeFragment=escapeFragment;function escapeJsonPointer(t){if(typeof t=="number")return`${t}`;return t.replace(/~/g,"~0").replace(/\//g,"~1")}u.escapeJsonPointer=escapeJsonPointer;function unescapeJsonPointer(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}u.unescapeJsonPointer=unescapeJsonPointer;function eachItem(t,u){if(Array.isArray(t)){for(const p of t)u(p)}else{u(t)}}u.eachItem=eachItem;function makeMergeEvaluated({mergeNames:t,mergeToName:u,mergeValues:p,resultToName:g}){return(v,b,w,E)=>{const S=w===undefined?b:w instanceof m.Name?(b instanceof m.Name?t(v,b,w):u(v,b,w),w):b instanceof m.Name?(u(v,w,b),b):p(b,w);return E===m.Name&&!(S instanceof m.Name)?g(v,S):S}}u.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(t,u,p)=>t.if((0,m._)`${p} !== true && ${u} !== undefined`,(()=>{t.if((0,m._)`${u} === true`,(()=>t.assign(p,true)),(()=>t.assign(p,(0,m._)`${p} || {}`).code((0,m._)`Object.assign(${p}, ${u})`)))})),mergeToName:(t,u,p)=>t.if((0,m._)`${p} !== true`,(()=>{if(u===true){t.assign(p,true)}else{t.assign(p,(0,m._)`${p} || {}`);setEvaluated(t,p,u)}})),mergeValues:(t,u)=>t===true?true:{...t,...u},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(t,u,p)=>t.if((0,m._)`${p} !== true && ${u} !== undefined`,(()=>t.assign(p,(0,m._)`${u} === true ? true : ${p} > ${u} ? ${p} : ${u}`))),mergeToName:(t,u,p)=>t.if((0,m._)`${p} !== true`,(()=>t.assign(p,u===true?true:(0,m._)`${p} > ${u} ? ${p} : ${u}`))),mergeValues:(t,u)=>t===true?true:Math.max(t,u),resultToName:(t,u)=>t.var("items",u)})};function evaluatedPropsToName(t,u){if(u===true)return t.var("props",true);const p=t.var("props",(0,m._)`{}`);if(u!==undefined)setEvaluated(t,p,u);return p}u.evaluatedPropsToName=evaluatedPropsToName;function setEvaluated(t,u,p){Object.keys(p).forEach((p=>t.assign((0,m._)`${u}${(0,m.getProperty)(p)}`,true)))}u.setEvaluated=setEvaluated;const v={};function useFunc(t,u){return t.scopeValue("func",{ref:u,code:v[u.code]||(v[u.code]=new g._Code(u.code))})}u.useFunc=useFunc;var b;(function(t){t[t["Num"]=0]="Num";t[t["Str"]=1]="Str"})(b||(u.Type=b={}));function getErrorPath(t,u,p){if(t instanceof m.Name){const g=u===b.Num;return p?g?(0,m._)`"[" + ${t} + "]"`:(0,m._)`"['" + ${t} + "']"`:g?(0,m._)`"/" + ${t}`:(0,m._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return p?(0,m.getProperty)(t).toString():"/"+escapeJsonPointer(t)}u.getErrorPath=getErrorPath;function checkStrictMode(t,u,p=t.opts.strictSchema){if(!p)return;u=`strict mode: ${u}`;if(p===true)throw new Error(u);t.self.logger.warn(u)}u.checkStrictMode=checkStrictMode},7837:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.shouldUseRule=u.shouldUseGroup=u.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:t,self:u},p){const m=u.RULES.types[p];return m&&m!==true&&shouldUseGroup(t,m)}u.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(t,u){return u.rules.some((u=>shouldUseRule(t,u)))}u.shouldUseGroup=shouldUseGroup;function shouldUseRule(t,u){var p;return t[u.keyword]!==undefined||((p=u.definition.implements)===null||p===void 0?void 0:p.some((u=>t[u]!==undefined)))}u.shouldUseRule=shouldUseRule},5885:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.boolOrEmptySchema=u.topBoolOrEmptySchema=void 0;const m=p(7446);const g=p(4671);const v=p(1529);const b={message:"boolean schema is false"};function topBoolOrEmptySchema(t){const{gen:u,schema:p,validateName:m}=t;if(p===false){falseSchemaError(t,false)}else if(typeof p=="object"&&p.$async===true){u.return(v.default.data)}else{u.assign((0,g._)`${m}.errors`,null);u.return(true)}}u.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(t,u){const{gen:p,schema:m}=t;if(m===false){p.var(u,false);falseSchemaError(t)}else{p.var(u,true)}}u.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(t,u){const{gen:p,data:g}=t;const v={gen:p,keyword:"false schema",data:g,schema:false,schemaCode:false,schemaValue:false,params:{},it:t};(0,m.reportError)(v,b,undefined,u)}},3330:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.reportTypeError=u.checkDataTypes=u.checkDataType=u.coerceAndCheckDataType=u.getJSONTypes=u.getSchemaTypes=u.DataType=void 0;const m=p(2166);const g=p(7837);const v=p(7446);const b=p(4671);const w=p(5049);var E;(function(t){t[t["Correct"]=0]="Correct";t[t["Wrong"]=1]="Wrong"})(E||(u.DataType=E={}));function getSchemaTypes(t){const u=getJSONTypes(t.type);const p=u.includes("null");if(p){if(t.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!u.length&&t.nullable!==undefined){throw new Error('"nullable" cannot be used without "type"')}if(t.nullable===true)u.push("null")}return u}u.getSchemaTypes=getSchemaTypes;function getJSONTypes(t){const u=Array.isArray(t)?t:t?[t]:[];if(u.every(m.isJSONType))return u;throw new Error("type must be JSONType or JSONType[]: "+u.join(","))}u.getJSONTypes=getJSONTypes;function coerceAndCheckDataType(t,u){const{gen:p,data:m,opts:v}=t;const b=coerceToTypes(u,v.coerceTypes);const w=u.length>0&&!(b.length===0&&u.length===1&&(0,g.schemaHasRulesForType)(t,u[0]));if(w){const g=checkDataTypes(u,m,v.strictNumbers,E.Wrong);p.if(g,(()=>{if(b.length)coerceData(t,u,b);else reportTypeError(t)}))}return w}u.coerceAndCheckDataType=coerceAndCheckDataType;const S=new Set(["string","number","integer","boolean","null"]);function coerceToTypes(t,u){return u?t.filter((t=>S.has(t)||u==="array"&&t==="array")):[]}function coerceData(t,u,p){const{gen:m,data:g,opts:v}=t;const w=m.let("dataType",(0,b._)`typeof ${g}`);const E=m.let("coerced",(0,b._)`undefined`);if(v.coerceTypes==="array"){m.if((0,b._)`${w} == 'object' && Array.isArray(${g}) && ${g}.length == 1`,(()=>m.assign(g,(0,b._)`${g}[0]`).assign(w,(0,b._)`typeof ${g}`).if(checkDataTypes(u,g,v.strictNumbers),(()=>m.assign(E,g)))))}m.if((0,b._)`${E} !== undefined`);for(const t of p){if(S.has(t)||t==="array"&&v.coerceTypes==="array"){coerceSpecificType(t)}}m.else();reportTypeError(t);m.endIf();m.if((0,b._)`${E} !== undefined`,(()=>{m.assign(g,E);assignParentData(t,E)}));function coerceSpecificType(t){switch(t){case"string":m.elseIf((0,b._)`${w} == "number" || ${w} == "boolean"`).assign(E,(0,b._)`"" + ${g}`).elseIf((0,b._)`${g} === null`).assign(E,(0,b._)`""`);return;case"number":m.elseIf((0,b._)`${w} == "boolean" || ${g} === null
3
3
  || (${w} == "string" && ${g} && ${g} == +${g})`).assign(E,(0,b._)`+${g}`);return;case"integer":m.elseIf((0,b._)`${w} === "boolean" || ${g} === null
4
4
  || (${w} === "string" && ${g} && ${g} == +${g} && !(${g} % 1))`).assign(E,(0,b._)`+${g}`);return;case"boolean":m.elseIf((0,b._)`${g} === "false" || ${g} === 0 || ${g} === null`).assign(E,false).elseIf((0,b._)`${g} === "true" || ${g} === 1`).assign(E,true);return;case"null":m.elseIf((0,b._)`${g} === "" || ${g} === 0 || ${g} === false`);m.assign(E,null);return;case"array":m.elseIf((0,b._)`${w} === "string" || ${w} === "number"
5
- || ${w} === "boolean" || ${g} === null`).assign(E,(0,b._)`[${g}]`)}}}function assignParentData({gen:t,parentData:u,parentDataProperty:p},m){t.if((0,b._)`${u} !== undefined`,(()=>t.assign((0,b._)`${u}[${p}]`,m)))}function checkDataType(t,u,p,m=E.Correct){const g=m===E.Correct?b.operators.EQ:b.operators.NEQ;let v;switch(t){case"null":return(0,b._)`${u} ${g} null`;case"array":v=(0,b._)`Array.isArray(${u})`;break;case"object":v=(0,b._)`${u} && typeof ${u} == "object" && !Array.isArray(${u})`;break;case"integer":v=numCond((0,b._)`!(${u} % 1) && !isNaN(${u})`);break;case"number":v=numCond();break;default:return(0,b._)`typeof ${u} ${g} ${t}`}return m===E.Correct?v:(0,b.not)(v);function numCond(t=b.nil){return(0,b.and)((0,b._)`typeof ${u} == "number"`,t,p?(0,b._)`isFinite(${u})`:b.nil)}}u.checkDataType=checkDataType;function checkDataTypes(t,u,p,m){if(t.length===1){return checkDataType(t[0],u,p,m)}let g;const v=(0,w.toHash)(t);if(v.array&&v.object){const t=(0,b._)`typeof ${u} != "object"`;g=v.null?t:(0,b._)`!${u} || ${t}`;delete v.null;delete v.array;delete v.object}else{g=b.nil}if(v.number)delete v.integer;for(const t in v)g=(0,b.and)(g,checkDataType(t,u,p,m));return g}u.checkDataTypes=checkDataTypes;const $={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:u})=>typeof t=="string"?(0,b._)`{type: ${t}}`:(0,b._)`{type: ${u}}`};function reportTypeError(t){const u=getTypeErrorContext(t);(0,v.reportError)(u,$)}u.reportTypeError=reportTypeError;function getTypeErrorContext(t){const{gen:u,data:p,schema:m}=t;const g=(0,w.schemaRefOrVal)(t,m,"type");return{gen:u,keyword:"type",data:p,schema:m.type,schemaCode:g,schemaValue:g,parentSchema:m,params:{},it:t}}},2168:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.assignDefaults=void 0;const m=p(4671);const g=p(5049);function assignDefaults(t,u){const{properties:p,items:m}=t.schema;if(u==="object"&&p){for(const u in p){assignDefault(t,u,p[u].default)}}else if(u==="array"&&Array.isArray(m)){m.forEach(((u,p)=>assignDefault(t,p,u.default)))}}u.assignDefaults=assignDefaults;function assignDefault(t,u,p){const{gen:v,compositeRule:b,data:w,opts:E}=t;if(p===undefined)return;const S=(0,m._)`${w}${(0,m.getProperty)(u)}`;if(b){(0,g.checkStrictMode)(t,`default is ignored for: ${S}`);return}let $=(0,m._)`${S} === undefined`;if(E.useDefaults==="empty"){$=(0,m._)`${$} || ${S} === null || ${S} === ""`}v.if($,(0,m._)`${S} = ${(0,m.stringify)(p)}`)}},324:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.getData=u.KeywordCxt=u.validateFunctionCode=void 0;const m=p(5885);const g=p(3330);const v=p(7837);const b=p(3330);const w=p(2168);const E=p(9007);const S=p(3893);const $=p(4671);const P=p(1529);const R=p(9749);const x=p(5049);const O=p(7446);function validateFunctionCode(t){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){topSchemaObjCode(t);return}}validateFunction(t,(()=>(0,m.topBoolOrEmptySchema)(t)))}u.validateFunctionCode=validateFunctionCode;function validateFunction({gen:t,validateName:u,schema:p,schemaEnv:m,opts:g},v){if(g.code.es5){t.func(u,(0,$._)`${P.default.data}, ${P.default.valCxt}`,m.$async,(()=>{t.code((0,$._)`"use strict"; ${funcSourceUrl(p,g)}`);destructureValCxtES5(t,g);t.code(v)}))}else{t.func(u,(0,$._)`${P.default.data}, ${destructureValCxt(g)}`,m.$async,(()=>t.code(funcSourceUrl(p,g)).code(v)))}}function destructureValCxt(t){return(0,$._)`{${P.default.instancePath}="", ${P.default.parentData}, ${P.default.parentDataProperty}, ${P.default.rootData}=${P.default.data}${t.dynamicRef?(0,$._)`, ${P.default.dynamicAnchors}={}`:$.nil}}={}`}function destructureValCxtES5(t,u){t.if(P.default.valCxt,(()=>{t.var(P.default.instancePath,(0,$._)`${P.default.valCxt}.${P.default.instancePath}`);t.var(P.default.parentData,(0,$._)`${P.default.valCxt}.${P.default.parentData}`);t.var(P.default.parentDataProperty,(0,$._)`${P.default.valCxt}.${P.default.parentDataProperty}`);t.var(P.default.rootData,(0,$._)`${P.default.valCxt}.${P.default.rootData}`);if(u.dynamicRef)t.var(P.default.dynamicAnchors,(0,$._)`${P.default.valCxt}.${P.default.dynamicAnchors}`)}),(()=>{t.var(P.default.instancePath,(0,$._)`""`);t.var(P.default.parentData,(0,$._)`undefined`);t.var(P.default.parentDataProperty,(0,$._)`undefined`);t.var(P.default.rootData,P.default.data);if(u.dynamicRef)t.var(P.default.dynamicAnchors,(0,$._)`{}`)}))}function topSchemaObjCode(t){const{schema:u,opts:p,gen:m}=t;validateFunction(t,(()=>{if(p.$comment&&u.$comment)commentKeyword(t);checkNoDefault(t);m.let(P.default.vErrors,null);m.let(P.default.errors,0);if(p.unevaluated)resetEvaluated(t);typeAndKeywords(t);returnResults(t)}));return}function resetEvaluated(t){const{gen:u,validateName:p}=t;t.evaluated=u.const("evaluated",(0,$._)`${p}.evaluated`);u.if((0,$._)`${t.evaluated}.dynamicProps`,(()=>u.assign((0,$._)`${t.evaluated}.props`,(0,$._)`undefined`)));u.if((0,$._)`${t.evaluated}.dynamicItems`,(()=>u.assign((0,$._)`${t.evaluated}.items`,(0,$._)`undefined`)))}function funcSourceUrl(t,u){const p=typeof t=="object"&&t[u.schemaId];return p&&(u.code.source||u.code.process)?(0,$._)`/*# sourceURL=${p} */`:$.nil}function subschemaCode(t,u){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){subSchemaObjCode(t,u);return}}(0,m.boolOrEmptySchema)(t,u)}function schemaCxtHasRules({schema:t,self:u}){if(typeof t=="boolean")return!t;for(const p in t)if(u.RULES.all[p])return true;return false}function isSchemaObj(t){return typeof t.schema!="boolean"}function subSchemaObjCode(t,u){const{schema:p,gen:m,opts:g}=t;if(g.$comment&&p.$comment)commentKeyword(t);updateContext(t);checkAsyncSchema(t);const v=m.const("_errs",P.default.errors);typeAndKeywords(t,v);m.var(u,(0,$._)`${v} === ${P.default.errors}`)}function checkKeywords(t){(0,x.checkUnknownRules)(t);checkRefsAndKeywords(t)}function typeAndKeywords(t,u){if(t.opts.jtd)return schemaKeywords(t,[],false,u);const p=(0,g.getSchemaTypes)(t.schema);const m=(0,g.coerceAndCheckDataType)(t,p);schemaKeywords(t,p,!m,u)}function checkRefsAndKeywords(t){const{schema:u,errSchemaPath:p,opts:m,self:g}=t;if(u.$ref&&m.ignoreKeywordsWithRef&&(0,x.schemaHasRulesButRef)(u,g.RULES)){g.logger.warn(`$ref: keywords ignored in schema at path "${p}"`)}}function checkNoDefault(t){const{schema:u,opts:p}=t;if(u.default!==undefined&&p.useDefaults&&p.strictSchema){(0,x.checkStrictMode)(t,"default is ignored in the schema root")}}function updateContext(t){const u=t.schema[t.opts.schemaId];if(u)t.baseId=(0,R.resolveUrl)(t.opts.uriResolver,t.baseId,u)}function checkAsyncSchema(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:t,schemaEnv:u,schema:p,errSchemaPath:m,opts:g}){const v=p.$comment;if(g.$comment===true){t.code((0,$._)`${P.default.self}.logger.log(${v})`)}else if(typeof g.$comment=="function"){const p=(0,$.str)`${m}/$comment`;const g=t.scopeValue("root",{ref:u.root});t.code((0,$._)`${P.default.self}.opts.$comment(${v}, ${p}, ${g}.schema)`)}}function returnResults(t){const{gen:u,schemaEnv:p,validateName:m,ValidationError:g,opts:v}=t;if(p.$async){u.if((0,$._)`${P.default.errors} === 0`,(()=>u.return(P.default.data)),(()=>u.throw((0,$._)`new ${g}(${P.default.vErrors})`)))}else{u.assign((0,$._)`${m}.errors`,P.default.vErrors);if(v.unevaluated)assignEvaluated(t);u.return((0,$._)`${P.default.errors} === 0`)}}function assignEvaluated({gen:t,evaluated:u,props:p,items:m}){if(p instanceof $.Name)t.assign((0,$._)`${u}.props`,p);if(m instanceof $.Name)t.assign((0,$._)`${u}.items`,m)}function schemaKeywords(t,u,p,m){const{gen:g,schema:w,data:E,allErrors:S,opts:R,self:O}=t;const{RULES:A}=O;if(w.$ref&&(R.ignoreKeywordsWithRef||!(0,x.schemaHasRulesButRef)(w,A))){g.block((()=>keywordCode(t,"$ref",A.all.$ref.definition)));return}if(!R.jtd)checkStrictTypes(t,u);g.block((()=>{for(const t of A.rules)groupKeywords(t);groupKeywords(A.post)}));function groupKeywords(x){if(!(0,v.shouldUseGroup)(w,x))return;if(x.type){g.if((0,b.checkDataType)(x.type,E,R.strictNumbers));iterateKeywords(t,x);if(u.length===1&&u[0]===x.type&&p){g.else();(0,b.reportTypeError)(t)}g.endIf()}else{iterateKeywords(t,x)}if(!S)g.if((0,$._)`${P.default.errors} === ${m||0}`)}}function iterateKeywords(t,u){const{gen:p,schema:m,opts:{useDefaults:g}}=t;if(g)(0,w.assignDefaults)(t,u.type);p.block((()=>{for(const p of u.rules){if((0,v.shouldUseRule)(m,p)){keywordCode(t,p.keyword,p.definition,u.type)}}}))}function checkStrictTypes(t,u){if(t.schemaEnv.meta||!t.opts.strictTypes)return;checkContextTypes(t,u);if(!t.opts.allowUnionTypes)checkMultipleTypes(t,u);checkKeywordTypes(t,t.dataTypes)}function checkContextTypes(t,u){if(!u.length)return;if(!t.dataTypes.length){t.dataTypes=u;return}u.forEach((u=>{if(!includesType(t.dataTypes,u)){strictTypesError(t,`type "${u}" not allowed by context "${t.dataTypes.join(",")}"`)}}));narrowSchemaTypes(t,u)}function checkMultipleTypes(t,u){if(u.length>1&&!(u.length===2&&u.includes("null"))){strictTypesError(t,"use allowUnionTypes to allow union type keyword")}}function checkKeywordTypes(t,u){const p=t.self.RULES.all;for(const m in p){const g=p[m];if(typeof g=="object"&&(0,v.shouldUseRule)(t.schema,g)){const{type:p}=g.definition;if(p.length&&!p.some((t=>hasApplicableType(u,t)))){strictTypesError(t,`missing type "${p.join(",")}" for keyword "${m}"`)}}}}function hasApplicableType(t,u){return t.includes(u)||u==="number"&&t.includes("integer")}function includesType(t,u){return t.includes(u)||u==="integer"&&t.includes("number")}function narrowSchemaTypes(t,u){const p=[];for(const m of t.dataTypes){if(includesType(u,m))p.push(m);else if(u.includes("integer")&&m==="number")p.push("integer")}t.dataTypes=p}function strictTypesError(t,u){const p=t.schemaEnv.baseId+t.errSchemaPath;u+=` at "${p}" (strictTypes)`;(0,x.checkStrictMode)(t,u,t.opts.strictTypes)}class KeywordCxt{constructor(t,u,p){(0,E.validateKeywordUsage)(t,u,p);this.gen=t.gen;this.allErrors=t.allErrors;this.keyword=p;this.data=t.data;this.schema=t.schema[p];this.$data=u.$data&&t.opts.$data&&this.schema&&this.schema.$data;this.schemaValue=(0,x.schemaRefOrVal)(t,this.schema,p,this.$data);this.schemaType=u.schemaType;this.parentSchema=t.schema;this.params={};this.it=t;this.def=u;if(this.$data){this.schemaCode=t.gen.const("vSchema",getData(this.$data,t))}else{this.schemaCode=this.schemaValue;if(!(0,E.validSchemaType)(this.schema,u.schemaType,u.allowUndefined)){throw new Error(`${p} value must be ${JSON.stringify(u.schemaType)}`)}}if("code"in u?u.trackErrors:u.errors!==false){this.errsCount=t.gen.const("_errs",P.default.errors)}}result(t,u,p){this.failResult((0,$.not)(t),u,p)}failResult(t,u,p){this.gen.if(t);if(p)p();else this.error();if(u){this.gen.else();u();if(this.allErrors)this.gen.endIf()}else{if(this.allErrors)this.gen.endIf();else this.gen.else()}}pass(t,u){this.failResult((0,$.not)(t),undefined,u)}fail(t){if(t===undefined){this.error();if(!this.allErrors)this.gen.if(false);return}this.gen.if(t);this.error();if(this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:u}=this;this.fail((0,$._)`${u} !== undefined && (${(0,$.or)(this.invalid$data(),t)})`)}error(t,u,p){if(u){this.setParams(u);this._error(t,p);this.setParams({});return}this._error(t,p)}_error(t,u){(t?O.reportExtraError:O.reportError)(this,this.def.error,u)}$dataError(){(0,O.reportError)(this,this.def.$dataError||O.keyword$DataError)}reset(){if(this.errsCount===undefined)throw new Error('add "trackErrors" to keyword definition');(0,O.resetErrorsCount)(this.gen,this.errsCount)}ok(t){if(!this.allErrors)this.gen.if(t)}setParams(t,u){if(u)Object.assign(this.params,t);else this.params=t}block$data(t,u,p=$.nil){this.gen.block((()=>{this.check$data(t,p);u()}))}check$data(t=$.nil,u=$.nil){if(!this.$data)return;const{gen:p,schemaCode:m,schemaType:g,def:v}=this;p.if((0,$.or)((0,$._)`${m} === undefined`,u));if(t!==$.nil)p.assign(t,true);if(g.length||v.validateSchema){p.elseIf(this.invalid$data());this.$dataError();if(t!==$.nil)p.assign(t,false)}p.else()}invalid$data(){const{gen:t,schemaCode:u,schemaType:p,def:m,it:g}=this;return(0,$.or)(wrong$DataType(),invalid$DataSchema());function wrong$DataType(){if(p.length){if(!(u instanceof $.Name))throw new Error("ajv implementation error");const t=Array.isArray(p)?p:[p];return(0,$._)`${(0,b.checkDataTypes)(t,u,g.opts.strictNumbers,b.DataType.Wrong)}`}return $.nil}function invalid$DataSchema(){if(m.validateSchema){const p=t.scopeValue("validate$data",{ref:m.validateSchema});return(0,$._)`!${p}(${u})`}return $.nil}}subschema(t,u){const p=(0,S.getSubschema)(this.it,t);(0,S.extendSubschemaData)(p,this.it,t);(0,S.extendSubschemaMode)(p,t);const m={...this.it,...p,items:undefined,props:undefined};subschemaCode(m,u);return m}mergeEvaluated(t,u){const{it:p,gen:m}=this;if(!p.opts.unevaluated)return;if(p.props!==true&&t.props!==undefined){p.props=x.mergeEvaluated.props(m,t.props,p.props,u)}if(p.items!==true&&t.items!==undefined){p.items=x.mergeEvaluated.items(m,t.items,p.items,u)}}mergeValidEvaluated(t,u){const{it:p,gen:m}=this;if(p.opts.unevaluated&&(p.props!==true||p.items!==true)){m.if(u,(()=>this.mergeEvaluated(t,$.Name)));return true}}}u.KeywordCxt=KeywordCxt;function keywordCode(t,u,p,m){const g=new KeywordCxt(t,p,u);if("code"in p){p.code(g,m)}else if(g.$data&&p.validate){(0,E.funcKeywordCode)(g,p)}else if("macro"in p){(0,E.macroKeywordCode)(g,p)}else if(p.compile||p.validate){(0,E.funcKeywordCode)(g,p)}}const A=/^\/(?:[^~]|~0|~1)*$/;const k=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(t,{dataLevel:u,dataNames:p,dataPathArr:m}){let g;let v;if(t==="")return P.default.rootData;if(t[0]==="/"){if(!A.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);g=t;v=P.default.rootData}else{const b=k.exec(t);if(!b)throw new Error(`Invalid JSON-pointer: ${t}`);const w=+b[1];g=b[2];if(g==="#"){if(w>=u)throw new Error(errorMsg("property/index",w));return m[u-w]}if(w>u)throw new Error(errorMsg("data",w));v=p[u-w];if(!g)return v}let b=v;const w=g.split("/");for(const t of w){if(t){v=(0,$._)`${v}${(0,$.getProperty)((0,x.unescapeJsonPointer)(t))}`;b=(0,$._)`${b} && ${v}`}}return b;function errorMsg(t,p){return`Cannot access ${t} ${p} levels up, current level is ${u}`}}u.getData=getData},9007:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateKeywordUsage=u.validSchemaType=u.funcKeywordCode=u.macroKeywordCode=void 0;const m=p(4671);const g=p(1529);const v=p(1919);const b=p(7446);function macroKeywordCode(t,u){const{gen:p,keyword:g,schema:v,parentSchema:b,it:w}=t;const E=u.macro.call(w.self,v,b,w);const S=useKeyword(p,g,E);if(w.opts.validateSchema!==false)w.self.validateSchema(E,true);const $=p.name("valid");t.subschema({schema:E,schemaPath:m.nil,errSchemaPath:`${w.errSchemaPath}/${g}`,topSchemaRef:S,compositeRule:true},$);t.pass($,(()=>t.error(true)))}u.macroKeywordCode=macroKeywordCode;function funcKeywordCode(t,u){var p;const{gen:b,keyword:w,schema:E,parentSchema:S,$data:$,it:P}=t;checkAsyncKeyword(P,u);const R=!$&&u.compile?u.compile.call(P.self,E,S,P):u.validate;const x=useKeyword(b,w,R);const O=b.let("valid");t.block$data(O,validateKeyword);t.ok((p=u.valid)!==null&&p!==void 0?p:O);function validateKeyword(){if(u.errors===false){assignValid();if(u.modifying)modifyData(t);reportErrs((()=>t.error()))}else{const p=u.async?validateAsync():validateSync();if(u.modifying)modifyData(t);reportErrs((()=>addErrs(t,p)))}}function validateAsync(){const t=b.let("ruleErrs",null);b.try((()=>assignValid((0,m._)`await `)),(u=>b.assign(O,false).if((0,m._)`${u} instanceof ${P.ValidationError}`,(()=>b.assign(t,(0,m._)`${u}.errors`)),(()=>b.throw(u)))));return t}function validateSync(){const t=(0,m._)`${x}.errors`;b.assign(t,null);assignValid(m.nil);return t}function assignValid(p=(u.async?(0,m._)`await `:m.nil)){const w=P.opts.passContext?g.default.this:g.default.self;const E=!("compile"in u&&!$||u.schema===false);b.assign(O,(0,m._)`${p}${(0,v.callValidateCode)(t,x,w,E)}`,u.modifying)}function reportErrs(t){var p;b.if((0,m.not)((p=u.valid)!==null&&p!==void 0?p:O),t)}}u.funcKeywordCode=funcKeywordCode;function modifyData(t){const{gen:u,data:p,it:g}=t;u.if(g.parentData,(()=>u.assign(p,(0,m._)`${g.parentData}[${g.parentDataProperty}]`)))}function addErrs(t,u){const{gen:p}=t;p.if((0,m._)`Array.isArray(${u})`,(()=>{p.assign(g.default.vErrors,(0,m._)`${g.default.vErrors} === null ? ${u} : ${g.default.vErrors}.concat(${u})`).assign(g.default.errors,(0,m._)`${g.default.vErrors}.length`);(0,b.extendErrors)(t)}),(()=>t.error()))}function checkAsyncKeyword({schemaEnv:t},u){if(u.async&&!t.$async)throw new Error("async keyword in sync schema")}function useKeyword(t,u,p){if(p===undefined)throw new Error(`keyword "${u}" failed to compile`);return t.scopeValue("keyword",typeof p=="function"?{ref:p}:{ref:p,code:(0,m.stringify)(p)})}function validSchemaType(t,u,p=false){return!u.length||u.some((u=>u==="array"?Array.isArray(t):u==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==u||p&&typeof t=="undefined"))}u.validSchemaType=validSchemaType;function validateKeywordUsage({schema:t,opts:u,self:p,errSchemaPath:m},g,v){if(Array.isArray(g.keyword)?!g.keyword.includes(v):g.keyword!==v){throw new Error("ajv implementation error")}const b=g.dependencies;if(b===null||b===void 0?void 0:b.some((u=>!Object.prototype.hasOwnProperty.call(t,u)))){throw new Error(`parent schema must have dependencies of ${v}: ${b.join(",")}`)}if(g.validateSchema){const b=g.validateSchema(t[v]);if(!b){const t=`keyword "${v}" value is invalid at path "${m}": `+p.errorsText(g.validateSchema.errors);if(u.validateSchema==="log")p.logger.error(t);else throw new Error(t)}}}u.validateKeywordUsage=validateKeywordUsage},3893:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.extendSubschemaMode=u.extendSubschemaData=u.getSubschema=void 0;const m=p(4671);const g=p(5049);function getSubschema(t,{keyword:u,schemaProp:p,schema:v,schemaPath:b,errSchemaPath:w,topSchemaRef:E}){if(u!==undefined&&v!==undefined){throw new Error('both "keyword" and "schema" passed, only one allowed')}if(u!==undefined){const v=t.schema[u];return p===undefined?{schema:v,schemaPath:(0,m._)`${t.schemaPath}${(0,m.getProperty)(u)}`,errSchemaPath:`${t.errSchemaPath}/${u}`}:{schema:v[p],schemaPath:(0,m._)`${t.schemaPath}${(0,m.getProperty)(u)}${(0,m.getProperty)(p)}`,errSchemaPath:`${t.errSchemaPath}/${u}/${(0,g.escapeFragment)(p)}`}}if(v!==undefined){if(b===undefined||w===undefined||E===undefined){throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')}return{schema:v,schemaPath:b,topSchemaRef:E,errSchemaPath:w}}throw new Error('either "keyword" or "schema" must be passed')}u.getSubschema=getSubschema;function extendSubschemaData(t,u,{dataProp:p,dataPropType:v,data:b,dataTypes:w,propertyName:E}){if(b!==undefined&&p!==undefined){throw new Error('both "data" and "dataProp" passed, only one allowed')}const{gen:S}=u;if(p!==undefined){const{errorPath:b,dataPathArr:w,opts:E}=u;const $=S.let("data",(0,m._)`${u.data}${(0,m.getProperty)(p)}`,true);dataContextProps($);t.errorPath=(0,m.str)`${b}${(0,g.getErrorPath)(p,v,E.jsPropertySyntax)}`;t.parentDataProperty=(0,m._)`${p}`;t.dataPathArr=[...w,t.parentDataProperty]}if(b!==undefined){const u=b instanceof m.Name?b:S.let("data",b,true);dataContextProps(u);if(E!==undefined)t.propertyName=E}if(w)t.dataTypes=w;function dataContextProps(p){t.data=p;t.dataLevel=u.dataLevel+1;t.dataTypes=[];u.definedProperties=new Set;t.parentData=u.data;t.dataNames=[...u.dataNames,p]}}u.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(t,{jtdDiscriminator:u,jtdMetadata:p,compositeRule:m,createErrors:g,allErrors:v}){if(m!==undefined)t.compositeRule=m;if(g!==undefined)t.createErrors=g;if(v!==undefined)t.allErrors=v;t.jtdDiscriminator=u;t.jtdMetadata=p}u.extendSubschemaMode=extendSubschemaMode},6952:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.CodeGen=u.Name=u.nil=u.stringify=u.str=u._=u.KeywordCxt=void 0;var m=p(324);Object.defineProperty(u,"KeywordCxt",{enumerable:true,get:function(){return m.KeywordCxt}});var g=p(4671);Object.defineProperty(u,"_",{enumerable:true,get:function(){return g._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return g.str}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return g.stringify}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return g.nil}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return g.Name}});Object.defineProperty(u,"CodeGen",{enumerable:true,get:function(){return g.CodeGen}});const v=p(4068);const b=p(909);const w=p(2166);const E=p(4033);const S=p(4671);const $=p(9749);const P=p(3330);const R=p(5049);const x=p(3770);const O=p(7438);const defaultRegExp=(t,u)=>new RegExp(t,u);defaultRegExp.code="new RegExp";const A=["removeAdditional","useDefaults","coerceTypes"];const k=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]);const T={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."};const C={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};const I=200;function requiredOptions(t){var u,p,m,g,v,b,w,E,S,$,P,R,x,A,k,T,C,N,D,j,L,M,U,B,H;const z=t.strict;const V=(u=t.code)===null||u===void 0?void 0:u.optimize;const G=V===true||V===undefined?1:V||0;const q=(m=(p=t.code)===null||p===void 0?void 0:p.regExp)!==null&&m!==void 0?m:defaultRegExp;const W=(g=t.uriResolver)!==null&&g!==void 0?g:O.default;return{strictSchema:(b=(v=t.strictSchema)!==null&&v!==void 0?v:z)!==null&&b!==void 0?b:true,strictNumbers:(E=(w=t.strictNumbers)!==null&&w!==void 0?w:z)!==null&&E!==void 0?E:true,strictTypes:($=(S=t.strictTypes)!==null&&S!==void 0?S:z)!==null&&$!==void 0?$:"log",strictTuples:(R=(P=t.strictTuples)!==null&&P!==void 0?P:z)!==null&&R!==void 0?R:"log",strictRequired:(A=(x=t.strictRequired)!==null&&x!==void 0?x:z)!==null&&A!==void 0?A:false,code:t.code?{...t.code,optimize:G,regExp:q}:{optimize:G,regExp:q},loopRequired:(k=t.loopRequired)!==null&&k!==void 0?k:I,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:I,meta:(C=t.meta)!==null&&C!==void 0?C:true,messages:(N=t.messages)!==null&&N!==void 0?N:true,inlineRefs:(D=t.inlineRefs)!==null&&D!==void 0?D:true,schemaId:(j=t.schemaId)!==null&&j!==void 0?j:"$id",addUsedSchema:(L=t.addUsedSchema)!==null&&L!==void 0?L:true,validateSchema:(M=t.validateSchema)!==null&&M!==void 0?M:true,validateFormats:(U=t.validateFormats)!==null&&U!==void 0?U:true,unicodeRegExp:(B=t.unicodeRegExp)!==null&&B!==void 0?B:true,int32range:(H=t.int32range)!==null&&H!==void 0?H:true,uriResolver:W}}class Ajv{constructor(t={}){this.schemas={};this.refs={};this.formats={};this._compilations=new Set;this._loading={};this._cache=new Map;t=this.opts={...t,...requiredOptions(t)};const{es5:u,lines:p}=this.opts.code;this.scope=new S.ValueScope({scope:{},prefixes:k,es5:u,lines:p});this.logger=getLogger(t.logger);const m=t.validateFormats;t.validateFormats=false;this.RULES=(0,w.getRules)();checkOptions.call(this,T,t,"NOT SUPPORTED");checkOptions.call(this,C,t,"DEPRECATED","warn");this._metaOpts=getMetaSchemaOptions.call(this);if(t.formats)addInitialFormats.call(this);this._addVocabularies();this._addDefaultMetaSchema();if(t.keywords)addInitialKeywords.call(this,t.keywords);if(typeof t.meta=="object")this.addMetaSchema(t.meta);addInitialSchemas.call(this);t.validateFormats=m}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:u,schemaId:p}=this.opts;let m=x;if(p==="id"){m={...x};m.id=m.$id;delete m.$id}if(u&&t)this.addMetaSchema(m,m[p],false)}defaultMeta(){const{meta:t,schemaId:u}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[u]||t:undefined}validate(t,u){let p;if(typeof t=="string"){p=this.getSchema(t);if(!p)throw new Error(`no schema with key or ref "${t}"`)}else{p=this.compile(t)}const m=p(u);if(!("$async"in p))this.errors=p.errors;return m}compile(t,u){const p=this._addSchema(t,u);return p.validate||this._compileSchemaEnv(p)}compileAsync(t,u){if(typeof this.opts.loadSchema!="function"){throw new Error("options.loadSchema should be a function")}const{loadSchema:p}=this.opts;return runCompileAsync.call(this,t,u);async function runCompileAsync(t,u){await loadMetaSchema.call(this,t.$schema);const p=this._addSchema(t,u);return p.validate||_compileAsync.call(this,p)}async function loadMetaSchema(t){if(t&&!this.getSchema(t)){await runCompileAsync.call(this,{$ref:t},true)}}async function _compileAsync(t){try{return this._compileSchemaEnv(t)}catch(u){if(!(u instanceof b.default))throw u;checkLoaded.call(this,u);await loadMissingSchema.call(this,u.missingSchema);return _compileAsync.call(this,t)}}function checkLoaded({missingSchema:t,missingRef:u}){if(this.refs[t]){throw new Error(`AnySchema ${t} is loaded but ${u} cannot be resolved`)}}async function loadMissingSchema(t){const p=await _loadSchema.call(this,t);if(!this.refs[t])await loadMetaSchema.call(this,p.$schema);if(!this.refs[t])this.addSchema(p,t,u)}async function _loadSchema(t){const u=this._loading[t];if(u)return u;try{return await(this._loading[t]=p(t))}finally{delete this._loading[t]}}}addSchema(t,u,p,m=this.opts.validateSchema){if(Array.isArray(t)){for(const u of t)this.addSchema(u,undefined,p,m);return this}let g;if(typeof t==="object"){const{schemaId:u}=this.opts;g=t[u];if(g!==undefined&&typeof g!="string"){throw new Error(`schema ${u} must be string`)}}u=(0,$.normalizeId)(u||g);this._checkUnique(u);this.schemas[u]=this._addSchema(t,p,u,m,true);return this}addMetaSchema(t,u,p=this.opts.validateSchema){this.addSchema(t,u,true,p);return this}validateSchema(t,u){if(typeof t=="boolean")return true;let p;p=t.$schema;if(p!==undefined&&typeof p!="string"){throw new Error("$schema must be a string")}p=p||this.opts.defaultMeta||this.defaultMeta();if(!p){this.logger.warn("meta-schema not available");this.errors=null;return true}const m=this.validate(p,t);if(!m&&u){const t="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(t);else throw new Error(t)}return m}getSchema(t){let u;while(typeof(u=getSchEnv.call(this,t))=="string")t=u;if(u===undefined){const{schemaId:p}=this.opts;const m=new E.SchemaEnv({schema:{},schemaId:p});u=E.resolveSchema.call(this,m,t);if(!u)return;this.refs[t]=u}return u.validate||this._compileSchemaEnv(u)}removeSchema(t){if(t instanceof RegExp){this._removeAllSchemas(this.schemas,t);this._removeAllSchemas(this.refs,t);return this}switch(typeof t){case"undefined":this._removeAllSchemas(this.schemas);this._removeAllSchemas(this.refs);this._cache.clear();return this;case"string":{const u=getSchEnv.call(this,t);if(typeof u=="object")this._cache.delete(u.schema);delete this.schemas[t];delete this.refs[t];return this}case"object":{const u=t;this._cache.delete(u);let p=t[this.opts.schemaId];if(p){p=(0,$.normalizeId)(p);delete this.schemas[p];delete this.refs[p]}return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const u of t)this.addKeyword(u);return this}addKeyword(t,u){let p;if(typeof t=="string"){p=t;if(typeof u=="object"){this.logger.warn("these parameters are deprecated, see docs for addKeyword");u.keyword=p}}else if(typeof t=="object"&&u===undefined){u=t;p=u.keyword;if(Array.isArray(p)&&!p.length){throw new Error("addKeywords: keyword must be string or non-empty array")}}else{throw new Error("invalid addKeywords parameters")}checkKeyword.call(this,p,u);if(!u){(0,R.eachItem)(p,(t=>addRule.call(this,t)));return this}keywordMetaschema.call(this,u);const m={...u,type:(0,P.getJSONTypes)(u.type),schemaType:(0,P.getJSONTypes)(u.schemaType)};(0,R.eachItem)(p,m.type.length===0?t=>addRule.call(this,t,m):t=>m.type.forEach((u=>addRule.call(this,t,m,u))));return this}getKeyword(t){const u=this.RULES.all[t];return typeof u=="object"?u.definition:!!u}removeKeyword(t){const{RULES:u}=this;delete u.keywords[t];delete u.all[t];for(const p of u.rules){const u=p.rules.findIndex((u=>u.keyword===t));if(u>=0)p.rules.splice(u,1)}return this}addFormat(t,u){if(typeof u=="string")u=new RegExp(u);this.formats[t]=u;return this}errorsText(t=this.errors,{separator:u=", ",dataVar:p="data"}={}){if(!t||t.length===0)return"No errors";return t.map((t=>`${p}${t.instancePath} ${t.message}`)).reduce(((t,p)=>t+u+p))}$dataMetaSchema(t,u){const p=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const m of u){const u=m.split("/").slice(1);let g=t;for(const t of u)g=g[t];for(const t in p){const u=p[t];if(typeof u!="object")continue;const{$data:m}=u.definition;const v=g[t];if(m&&v)g[t]=schemaOrData(v)}}return t}_removeAllSchemas(t,u){for(const p in t){const m=t[p];if(!u||u.test(p)){if(typeof m=="string"){delete t[p]}else if(m&&!m.meta){this._cache.delete(m.schema);delete t[p]}}}}_addSchema(t,u,p,m=this.opts.validateSchema,g=this.opts.addUsedSchema){let v;const{schemaId:b}=this.opts;if(typeof t=="object"){v=t[b]}else{if(this.opts.jtd)throw new Error("schema must be object");else if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let w=this._cache.get(t);if(w!==undefined)return w;p=(0,$.normalizeId)(v||p);const S=$.getSchemaRefs.call(this,t,p);w=new E.SchemaEnv({schema:t,schemaId:b,meta:u,baseId:p,localRefs:S});this._cache.set(w.schema,w);if(g&&!p.startsWith("#")){if(p)this._checkUnique(p);this.refs[p]=w}if(m)this.validateSchema(t,true);return w}_checkUnique(t){if(this.schemas[t]||this.refs[t]){throw new Error(`schema with key or id "${t}" already exists`)}}_compileSchemaEnv(t){if(t.meta)this._compileMetaSchema(t);else E.compileSchema.call(this,t);if(!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const u=this.opts;this.opts=this._metaOpts;try{E.compileSchema.call(this,t)}finally{this.opts=u}}}Ajv.ValidationError=v.default;Ajv.MissingRefError=b.default;u["default"]=Ajv;function checkOptions(t,u,p,m="error"){for(const g in t){const v=g;if(v in u)this.logger[m](`${p}: option ${g}. ${t[v]}`)}}function getSchEnv(t){t=(0,$.normalizeId)(t);return this.schemas[t]||this.refs[t]}function addInitialSchemas(){const t=this.opts.schemas;if(!t)return;if(Array.isArray(t))this.addSchema(t);else for(const u in t)this.addSchema(t[u],u)}function addInitialFormats(){for(const t in this.opts.formats){const u=this.opts.formats[t];if(u)this.addFormat(t,u)}}function addInitialKeywords(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const u in t){const p=t[u];if(!p.keyword)p.keyword=u;this.addKeyword(p)}}function getMetaSchemaOptions(){const t={...this.opts};for(const u of A)delete t[u];return t}const N={log(){},warn(){},error(){}};function getLogger(t){if(t===false)return N;if(t===undefined)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}const D=/^[a-z_$][a-z0-9_$:-]*$/i;function checkKeyword(t,u){const{RULES:p}=this;(0,R.eachItem)(t,(t=>{if(p.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!D.test(t))throw new Error(`Keyword ${t} has invalid name`)}));if(!u)return;if(u.$data&&!("code"in u||"validate"in u)){throw new Error('$data keyword must have "code" or "validate" function')}}function addRule(t,u,p){var m;const g=u===null||u===void 0?void 0:u.post;if(p&&g)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:v}=this;let b=g?v.post:v.rules.find((({type:t})=>t===p));if(!b){b={type:p,rules:[]};v.rules.push(b)}v.keywords[t]=true;if(!u)return;const w={keyword:t,definition:{...u,type:(0,P.getJSONTypes)(u.type),schemaType:(0,P.getJSONTypes)(u.schemaType)}};if(u.before)addBeforeRule.call(this,b,w,u.before);else b.rules.push(w);v.all[t]=w;(m=u.implements)===null||m===void 0?void 0:m.forEach((t=>this.addKeyword(t)))}function addBeforeRule(t,u,p){const m=t.rules.findIndex((t=>t.keyword===p));if(m>=0){t.rules.splice(m,0,u)}else{t.rules.push(u);this.logger.warn(`rule ${p} is not defined`)}}function keywordMetaschema(t){let{metaSchema:u}=t;if(u===undefined)return;if(t.$data&&this.opts.$data)u=schemaOrData(u);t.validateSchema=this.compile(u,true)}const j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function schemaOrData(t){return{anyOf:[t,j]}}},4010:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6261);const g=p(13);const v=p(7388);const b=p(2394);const w=p(4771);const E=p(9567);const S=p(8364);const $=p(2943);const P=["/properties"];function addMetaSchema2020(t){[m,g,v,b,w,with$data(this,E),S,with$data(this,$)].forEach((t=>this.addMetaSchema(t,undefined,false)));return this;function with$data(u,p){return t?u.$dataMetaSchema(p,P):p}}u["default"]=addMetaSchema2020},9804:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7407);m.code='require("ajv/dist/runtime/equal").default';u["default"]=m},4679:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});function ucs2length(t){const u=t.length;let p=0;let m=0;let g;while(m<u){p++;g=t.charCodeAt(m++);if(g>=55296&&g<=56319&&m<u){g=t.charCodeAt(m);if((g&64512)===56320)m++}}return p}u["default"]=ucs2length;ucs2length.code='require("ajv/dist/runtime/ucs2length").default'},7438:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(3996);m.code='require("ajv/dist/runtime/uri").default';u["default"]=m},4068:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});class ValidationError extends Error{constructor(t){super("validation failed");this.errors=t;this.ajv=this.validation=true}}u["default"]=ValidationError},2063:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateAdditionalItems=void 0;const m=p(4671);const g=p(5049);const v={message:({params:{len:t}})=>(0,m.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,m._)`{limit: ${t}}`};const b={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:v,code(t){const{parentSchema:u,it:p}=t;const{items:m}=u;if(!Array.isArray(m)){(0,g.checkStrictMode)(p,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(t,m)}};function validateAdditionalItems(t,u){const{gen:p,schema:v,data:b,keyword:w,it:E}=t;E.items=true;const S=p.const("len",(0,m._)`${b}.length`);if(v===false){t.setParams({len:u.length});t.pass((0,m._)`${S} <= ${u.length}`)}else if(typeof v=="object"&&!(0,g.alwaysValidSchema)(E,v)){const g=p.var("valid",(0,m._)`${S} <= ${u.length}`);p.if((0,m.not)(g),(()=>validateItems(g)));t.ok(g)}function validateItems(v){p.forRange("i",u.length,S,(u=>{t.subschema({keyword:w,dataProp:u,dataPropType:g.Type.Num},v);if(!E.allErrors)p.if((0,m.not)(v),(()=>p.break()))}))}}u.validateAdditionalItems=validateAdditionalItems;u["default"]=b},8410:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1919);const g=p(4671);const v=p(1529);const b=p(5049);const w={message:"must NOT have additional properties",params:({params:t})=>(0,g._)`{additionalProperty: ${t.additionalProperty}}`};const E={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:w,code(t){const{gen:u,schema:p,parentSchema:w,data:E,errsCount:S,it:$}=t;if(!S)throw new Error("ajv implementation error");const{allErrors:P,opts:R}=$;$.props=true;if(R.removeAdditional!=="all"&&(0,b.alwaysValidSchema)($,p))return;const x=(0,m.allSchemaProperties)(w.properties);const O=(0,m.allSchemaProperties)(w.patternProperties);checkAdditionalProperties();t.ok((0,g._)`${S} === ${v.default.errors}`);function checkAdditionalProperties(){u.forIn("key",E,(t=>{if(!x.length&&!O.length)additionalPropertyCode(t);else u.if(isAdditional(t),(()=>additionalPropertyCode(t)))}))}function isAdditional(p){let v;if(x.length>8){const t=(0,b.schemaRefOrVal)($,w.properties,"properties");v=(0,m.isOwnProperty)(u,t,p)}else if(x.length){v=(0,g.or)(...x.map((t=>(0,g._)`${p} === ${t}`)))}else{v=g.nil}if(O.length){v=(0,g.or)(v,...O.map((u=>(0,g._)`${(0,m.usePattern)(t,u)}.test(${p})`)))}return(0,g.not)(v)}function deleteAdditional(t){u.code((0,g._)`delete ${E}[${t}]`)}function additionalPropertyCode(m){if(R.removeAdditional==="all"||R.removeAdditional&&p===false){deleteAdditional(m);return}if(p===false){t.setParams({additionalProperty:m});t.error();if(!P)u.break();return}if(typeof p=="object"&&!(0,b.alwaysValidSchema)($,p)){const p=u.name("valid");if(R.removeAdditional==="failing"){applyAdditionalSchema(m,p,false);u.if((0,g.not)(p),(()=>{t.reset();deleteAdditional(m)}))}else{applyAdditionalSchema(m,p);if(!P)u.if((0,g.not)(p),(()=>u.break()))}}}function applyAdditionalSchema(u,p,m){const g={keyword:"additionalProperties",dataProp:u,dataPropType:b.Type.Str};if(m===false){Object.assign(g,{compositeRule:true,createErrors:false,allErrors:false})}t.subschema(g,p)}}};u["default"]=E},382:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(5049);const g={keyword:"allOf",schemaType:"array",code(t){const{gen:u,schema:p,it:g}=t;if(!Array.isArray(p))throw new Error("ajv implementation error");const v=u.name("valid");p.forEach(((u,p)=>{if((0,m.alwaysValidSchema)(g,u))return;const b=t.subschema({keyword:"allOf",schemaProp:p},v);t.ok(v);t.mergeEvaluated(b)}))}};u["default"]=g},1151:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1919);const g={keyword:"anyOf",schemaType:"array",trackErrors:true,code:m.validateUnion,error:{message:"must match a schema in anyOf"}};u["default"]=g},4503:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v={message:({params:{min:t,max:u}})=>u===undefined?(0,m.str)`must contain at least ${t} valid item(s)`:(0,m.str)`must contain at least ${t} and no more than ${u} valid item(s)`,params:({params:{min:t,max:u}})=>u===undefined?(0,m._)`{minContains: ${t}}`:(0,m._)`{minContains: ${t}, maxContains: ${u}}`};const b={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:v,code(t){const{gen:u,schema:p,parentSchema:v,data:b,it:w}=t;let E;let S;const{minContains:$,maxContains:P}=v;if(w.opts.next){E=$===undefined?1:$;S=P}else{E=1}const R=u.const("len",(0,m._)`${b}.length`);t.setParams({min:E,max:S});if(S===undefined&&E===0){(0,g.checkStrictMode)(w,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(S!==undefined&&E>S){(0,g.checkStrictMode)(w,`"minContains" > "maxContains" is always invalid`);t.fail();return}if((0,g.alwaysValidSchema)(w,p)){let u=(0,m._)`${R} >= ${E}`;if(S!==undefined)u=(0,m._)`${u} && ${R} <= ${S}`;t.pass(u);return}w.items=true;const x=u.name("valid");if(S===undefined&&E===1){validateItems(x,(()=>u.if(x,(()=>u.break()))))}else if(E===0){u.let(x,true);if(S!==undefined)u.if((0,m._)`${b}.length > 0`,validateItemsWithCount)}else{u.let(x,false);validateItemsWithCount()}t.result(x,(()=>t.reset()));function validateItemsWithCount(){const t=u.name("_valid");const p=u.let("count",0);validateItems(t,(()=>u.if(t,(()=>checkLimits(p)))))}function validateItems(p,m){u.forRange("i",0,R,(u=>{t.subschema({keyword:"contains",dataProp:u,dataPropType:g.Type.Num,compositeRule:true},p);m()}))}function checkLimits(t){u.code((0,m._)`${t}++`);if(S===undefined){u.if((0,m._)`${t} >= ${E}`,(()=>u.assign(x,true).break()))}else{u.if((0,m._)`${t} > ${S}`,(()=>u.assign(x,false).break()));if(E===1)u.assign(x,true);else u.if((0,m._)`${t} >= ${E}`,(()=>u.assign(x,true)))}}}};u["default"]=b},4239:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateSchemaDeps=u.validatePropertyDeps=u.error=void 0;const m=p(4671);const g=p(5049);const v=p(1919);u.error={message:({params:{property:t,depsCount:u,deps:p}})=>{const g=u===1?"property":"properties";return(0,m.str)`must have ${g} ${p} when property ${t} is present`},params:({params:{property:t,depsCount:u,deps:p,missingProperty:g}})=>(0,m._)`{property: ${t},
5
+ || ${w} === "boolean" || ${g} === null`).assign(E,(0,b._)`[${g}]`)}}}function assignParentData({gen:t,parentData:u,parentDataProperty:p},m){t.if((0,b._)`${u} !== undefined`,(()=>t.assign((0,b._)`${u}[${p}]`,m)))}function checkDataType(t,u,p,m=E.Correct){const g=m===E.Correct?b.operators.EQ:b.operators.NEQ;let v;switch(t){case"null":return(0,b._)`${u} ${g} null`;case"array":v=(0,b._)`Array.isArray(${u})`;break;case"object":v=(0,b._)`${u} && typeof ${u} == "object" && !Array.isArray(${u})`;break;case"integer":v=numCond((0,b._)`!(${u} % 1) && !isNaN(${u})`);break;case"number":v=numCond();break;default:return(0,b._)`typeof ${u} ${g} ${t}`}return m===E.Correct?v:(0,b.not)(v);function numCond(t=b.nil){return(0,b.and)((0,b._)`typeof ${u} == "number"`,t,p?(0,b._)`isFinite(${u})`:b.nil)}}u.checkDataType=checkDataType;function checkDataTypes(t,u,p,m){if(t.length===1){return checkDataType(t[0],u,p,m)}let g;const v=(0,w.toHash)(t);if(v.array&&v.object){const t=(0,b._)`typeof ${u} != "object"`;g=v.null?t:(0,b._)`!${u} || ${t}`;delete v.null;delete v.array;delete v.object}else{g=b.nil}if(v.number)delete v.integer;for(const t in v)g=(0,b.and)(g,checkDataType(t,u,p,m));return g}u.checkDataTypes=checkDataTypes;const $={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:u})=>typeof t=="string"?(0,b._)`{type: ${t}}`:(0,b._)`{type: ${u}}`};function reportTypeError(t){const u=getTypeErrorContext(t);(0,v.reportError)(u,$)}u.reportTypeError=reportTypeError;function getTypeErrorContext(t){const{gen:u,data:p,schema:m}=t;const g=(0,w.schemaRefOrVal)(t,m,"type");return{gen:u,keyword:"type",data:p,schema:m.type,schemaCode:g,schemaValue:g,parentSchema:m,params:{},it:t}}},2168:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.assignDefaults=void 0;const m=p(4671);const g=p(5049);function assignDefaults(t,u){const{properties:p,items:m}=t.schema;if(u==="object"&&p){for(const u in p){assignDefault(t,u,p[u].default)}}else if(u==="array"&&Array.isArray(m)){m.forEach(((u,p)=>assignDefault(t,p,u.default)))}}u.assignDefaults=assignDefaults;function assignDefault(t,u,p){const{gen:v,compositeRule:b,data:w,opts:E}=t;if(p===undefined)return;const S=(0,m._)`${w}${(0,m.getProperty)(u)}`;if(b){(0,g.checkStrictMode)(t,`default is ignored for: ${S}`);return}let $=(0,m._)`${S} === undefined`;if(E.useDefaults==="empty"){$=(0,m._)`${$} || ${S} === null || ${S} === ""`}v.if($,(0,m._)`${S} = ${(0,m.stringify)(p)}`)}},324:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.getData=u.KeywordCxt=u.validateFunctionCode=void 0;const m=p(5885);const g=p(3330);const v=p(7837);const b=p(3330);const w=p(2168);const E=p(9007);const S=p(3893);const $=p(4671);const P=p(1529);const R=p(9749);const x=p(5049);const O=p(7446);function validateFunctionCode(t){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){topSchemaObjCode(t);return}}validateFunction(t,(()=>(0,m.topBoolOrEmptySchema)(t)))}u.validateFunctionCode=validateFunctionCode;function validateFunction({gen:t,validateName:u,schema:p,schemaEnv:m,opts:g},v){if(g.code.es5){t.func(u,(0,$._)`${P.default.data}, ${P.default.valCxt}`,m.$async,(()=>{t.code((0,$._)`"use strict"; ${funcSourceUrl(p,g)}`);destructureValCxtES5(t,g);t.code(v)}))}else{t.func(u,(0,$._)`${P.default.data}, ${destructureValCxt(g)}`,m.$async,(()=>t.code(funcSourceUrl(p,g)).code(v)))}}function destructureValCxt(t){return(0,$._)`{${P.default.instancePath}="", ${P.default.parentData}, ${P.default.parentDataProperty}, ${P.default.rootData}=${P.default.data}${t.dynamicRef?(0,$._)`, ${P.default.dynamicAnchors}={}`:$.nil}}={}`}function destructureValCxtES5(t,u){t.if(P.default.valCxt,(()=>{t.var(P.default.instancePath,(0,$._)`${P.default.valCxt}.${P.default.instancePath}`);t.var(P.default.parentData,(0,$._)`${P.default.valCxt}.${P.default.parentData}`);t.var(P.default.parentDataProperty,(0,$._)`${P.default.valCxt}.${P.default.parentDataProperty}`);t.var(P.default.rootData,(0,$._)`${P.default.valCxt}.${P.default.rootData}`);if(u.dynamicRef)t.var(P.default.dynamicAnchors,(0,$._)`${P.default.valCxt}.${P.default.dynamicAnchors}`)}),(()=>{t.var(P.default.instancePath,(0,$._)`""`);t.var(P.default.parentData,(0,$._)`undefined`);t.var(P.default.parentDataProperty,(0,$._)`undefined`);t.var(P.default.rootData,P.default.data);if(u.dynamicRef)t.var(P.default.dynamicAnchors,(0,$._)`{}`)}))}function topSchemaObjCode(t){const{schema:u,opts:p,gen:m}=t;validateFunction(t,(()=>{if(p.$comment&&u.$comment)commentKeyword(t);checkNoDefault(t);m.let(P.default.vErrors,null);m.let(P.default.errors,0);if(p.unevaluated)resetEvaluated(t);typeAndKeywords(t);returnResults(t)}));return}function resetEvaluated(t){const{gen:u,validateName:p}=t;t.evaluated=u.const("evaluated",(0,$._)`${p}.evaluated`);u.if((0,$._)`${t.evaluated}.dynamicProps`,(()=>u.assign((0,$._)`${t.evaluated}.props`,(0,$._)`undefined`)));u.if((0,$._)`${t.evaluated}.dynamicItems`,(()=>u.assign((0,$._)`${t.evaluated}.items`,(0,$._)`undefined`)))}function funcSourceUrl(t,u){const p=typeof t=="object"&&t[u.schemaId];return p&&(u.code.source||u.code.process)?(0,$._)`/*# sourceURL=${p} */`:$.nil}function subschemaCode(t,u){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){subSchemaObjCode(t,u);return}}(0,m.boolOrEmptySchema)(t,u)}function schemaCxtHasRules({schema:t,self:u}){if(typeof t=="boolean")return!t;for(const p in t)if(u.RULES.all[p])return true;return false}function isSchemaObj(t){return typeof t.schema!="boolean"}function subSchemaObjCode(t,u){const{schema:p,gen:m,opts:g}=t;if(g.$comment&&p.$comment)commentKeyword(t);updateContext(t);checkAsyncSchema(t);const v=m.const("_errs",P.default.errors);typeAndKeywords(t,v);m.var(u,(0,$._)`${v} === ${P.default.errors}`)}function checkKeywords(t){(0,x.checkUnknownRules)(t);checkRefsAndKeywords(t)}function typeAndKeywords(t,u){if(t.opts.jtd)return schemaKeywords(t,[],false,u);const p=(0,g.getSchemaTypes)(t.schema);const m=(0,g.coerceAndCheckDataType)(t,p);schemaKeywords(t,p,!m,u)}function checkRefsAndKeywords(t){const{schema:u,errSchemaPath:p,opts:m,self:g}=t;if(u.$ref&&m.ignoreKeywordsWithRef&&(0,x.schemaHasRulesButRef)(u,g.RULES)){g.logger.warn(`$ref: keywords ignored in schema at path "${p}"`)}}function checkNoDefault(t){const{schema:u,opts:p}=t;if(u.default!==undefined&&p.useDefaults&&p.strictSchema){(0,x.checkStrictMode)(t,"default is ignored in the schema root")}}function updateContext(t){const u=t.schema[t.opts.schemaId];if(u)t.baseId=(0,R.resolveUrl)(t.opts.uriResolver,t.baseId,u)}function checkAsyncSchema(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:t,schemaEnv:u,schema:p,errSchemaPath:m,opts:g}){const v=p.$comment;if(g.$comment===true){t.code((0,$._)`${P.default.self}.logger.log(${v})`)}else if(typeof g.$comment=="function"){const p=(0,$.str)`${m}/$comment`;const g=t.scopeValue("root",{ref:u.root});t.code((0,$._)`${P.default.self}.opts.$comment(${v}, ${p}, ${g}.schema)`)}}function returnResults(t){const{gen:u,schemaEnv:p,validateName:m,ValidationError:g,opts:v}=t;if(p.$async){u.if((0,$._)`${P.default.errors} === 0`,(()=>u.return(P.default.data)),(()=>u.throw((0,$._)`new ${g}(${P.default.vErrors})`)))}else{u.assign((0,$._)`${m}.errors`,P.default.vErrors);if(v.unevaluated)assignEvaluated(t);u.return((0,$._)`${P.default.errors} === 0`)}}function assignEvaluated({gen:t,evaluated:u,props:p,items:m}){if(p instanceof $.Name)t.assign((0,$._)`${u}.props`,p);if(m instanceof $.Name)t.assign((0,$._)`${u}.items`,m)}function schemaKeywords(t,u,p,m){const{gen:g,schema:w,data:E,allErrors:S,opts:R,self:O}=t;const{RULES:A}=O;if(w.$ref&&(R.ignoreKeywordsWithRef||!(0,x.schemaHasRulesButRef)(w,A))){g.block((()=>keywordCode(t,"$ref",A.all.$ref.definition)));return}if(!R.jtd)checkStrictTypes(t,u);g.block((()=>{for(const t of A.rules)groupKeywords(t);groupKeywords(A.post)}));function groupKeywords(x){if(!(0,v.shouldUseGroup)(w,x))return;if(x.type){g.if((0,b.checkDataType)(x.type,E,R.strictNumbers));iterateKeywords(t,x);if(u.length===1&&u[0]===x.type&&p){g.else();(0,b.reportTypeError)(t)}g.endIf()}else{iterateKeywords(t,x)}if(!S)g.if((0,$._)`${P.default.errors} === ${m||0}`)}}function iterateKeywords(t,u){const{gen:p,schema:m,opts:{useDefaults:g}}=t;if(g)(0,w.assignDefaults)(t,u.type);p.block((()=>{for(const p of u.rules){if((0,v.shouldUseRule)(m,p)){keywordCode(t,p.keyword,p.definition,u.type)}}}))}function checkStrictTypes(t,u){if(t.schemaEnv.meta||!t.opts.strictTypes)return;checkContextTypes(t,u);if(!t.opts.allowUnionTypes)checkMultipleTypes(t,u);checkKeywordTypes(t,t.dataTypes)}function checkContextTypes(t,u){if(!u.length)return;if(!t.dataTypes.length){t.dataTypes=u;return}u.forEach((u=>{if(!includesType(t.dataTypes,u)){strictTypesError(t,`type "${u}" not allowed by context "${t.dataTypes.join(",")}"`)}}));narrowSchemaTypes(t,u)}function checkMultipleTypes(t,u){if(u.length>1&&!(u.length===2&&u.includes("null"))){strictTypesError(t,"use allowUnionTypes to allow union type keyword")}}function checkKeywordTypes(t,u){const p=t.self.RULES.all;for(const m in p){const g=p[m];if(typeof g=="object"&&(0,v.shouldUseRule)(t.schema,g)){const{type:p}=g.definition;if(p.length&&!p.some((t=>hasApplicableType(u,t)))){strictTypesError(t,`missing type "${p.join(",")}" for keyword "${m}"`)}}}}function hasApplicableType(t,u){return t.includes(u)||u==="number"&&t.includes("integer")}function includesType(t,u){return t.includes(u)||u==="integer"&&t.includes("number")}function narrowSchemaTypes(t,u){const p=[];for(const m of t.dataTypes){if(includesType(u,m))p.push(m);else if(u.includes("integer")&&m==="number")p.push("integer")}t.dataTypes=p}function strictTypesError(t,u){const p=t.schemaEnv.baseId+t.errSchemaPath;u+=` at "${p}" (strictTypes)`;(0,x.checkStrictMode)(t,u,t.opts.strictTypes)}class KeywordCxt{constructor(t,u,p){(0,E.validateKeywordUsage)(t,u,p);this.gen=t.gen;this.allErrors=t.allErrors;this.keyword=p;this.data=t.data;this.schema=t.schema[p];this.$data=u.$data&&t.opts.$data&&this.schema&&this.schema.$data;this.schemaValue=(0,x.schemaRefOrVal)(t,this.schema,p,this.$data);this.schemaType=u.schemaType;this.parentSchema=t.schema;this.params={};this.it=t;this.def=u;if(this.$data){this.schemaCode=t.gen.const("vSchema",getData(this.$data,t))}else{this.schemaCode=this.schemaValue;if(!(0,E.validSchemaType)(this.schema,u.schemaType,u.allowUndefined)){throw new Error(`${p} value must be ${JSON.stringify(u.schemaType)}`)}}if("code"in u?u.trackErrors:u.errors!==false){this.errsCount=t.gen.const("_errs",P.default.errors)}}result(t,u,p){this.failResult((0,$.not)(t),u,p)}failResult(t,u,p){this.gen.if(t);if(p)p();else this.error();if(u){this.gen.else();u();if(this.allErrors)this.gen.endIf()}else{if(this.allErrors)this.gen.endIf();else this.gen.else()}}pass(t,u){this.failResult((0,$.not)(t),undefined,u)}fail(t){if(t===undefined){this.error();if(!this.allErrors)this.gen.if(false);return}this.gen.if(t);this.error();if(this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:u}=this;this.fail((0,$._)`${u} !== undefined && (${(0,$.or)(this.invalid$data(),t)})`)}error(t,u,p){if(u){this.setParams(u);this._error(t,p);this.setParams({});return}this._error(t,p)}_error(t,u){(t?O.reportExtraError:O.reportError)(this,this.def.error,u)}$dataError(){(0,O.reportError)(this,this.def.$dataError||O.keyword$DataError)}reset(){if(this.errsCount===undefined)throw new Error('add "trackErrors" to keyword definition');(0,O.resetErrorsCount)(this.gen,this.errsCount)}ok(t){if(!this.allErrors)this.gen.if(t)}setParams(t,u){if(u)Object.assign(this.params,t);else this.params=t}block$data(t,u,p=$.nil){this.gen.block((()=>{this.check$data(t,p);u()}))}check$data(t=$.nil,u=$.nil){if(!this.$data)return;const{gen:p,schemaCode:m,schemaType:g,def:v}=this;p.if((0,$.or)((0,$._)`${m} === undefined`,u));if(t!==$.nil)p.assign(t,true);if(g.length||v.validateSchema){p.elseIf(this.invalid$data());this.$dataError();if(t!==$.nil)p.assign(t,false)}p.else()}invalid$data(){const{gen:t,schemaCode:u,schemaType:p,def:m,it:g}=this;return(0,$.or)(wrong$DataType(),invalid$DataSchema());function wrong$DataType(){if(p.length){if(!(u instanceof $.Name))throw new Error("ajv implementation error");const t=Array.isArray(p)?p:[p];return(0,$._)`${(0,b.checkDataTypes)(t,u,g.opts.strictNumbers,b.DataType.Wrong)}`}return $.nil}function invalid$DataSchema(){if(m.validateSchema){const p=t.scopeValue("validate$data",{ref:m.validateSchema});return(0,$._)`!${p}(${u})`}return $.nil}}subschema(t,u){const p=(0,S.getSubschema)(this.it,t);(0,S.extendSubschemaData)(p,this.it,t);(0,S.extendSubschemaMode)(p,t);const m={...this.it,...p,items:undefined,props:undefined};subschemaCode(m,u);return m}mergeEvaluated(t,u){const{it:p,gen:m}=this;if(!p.opts.unevaluated)return;if(p.props!==true&&t.props!==undefined){p.props=x.mergeEvaluated.props(m,t.props,p.props,u)}if(p.items!==true&&t.items!==undefined){p.items=x.mergeEvaluated.items(m,t.items,p.items,u)}}mergeValidEvaluated(t,u){const{it:p,gen:m}=this;if(p.opts.unevaluated&&(p.props!==true||p.items!==true)){m.if(u,(()=>this.mergeEvaluated(t,$.Name)));return true}}}u.KeywordCxt=KeywordCxt;function keywordCode(t,u,p,m){const g=new KeywordCxt(t,p,u);if("code"in p){p.code(g,m)}else if(g.$data&&p.validate){(0,E.funcKeywordCode)(g,p)}else if("macro"in p){(0,E.macroKeywordCode)(g,p)}else if(p.compile||p.validate){(0,E.funcKeywordCode)(g,p)}}const A=/^\/(?:[^~]|~0|~1)*$/;const k=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(t,{dataLevel:u,dataNames:p,dataPathArr:m}){let g;let v;if(t==="")return P.default.rootData;if(t[0]==="/"){if(!A.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);g=t;v=P.default.rootData}else{const b=k.exec(t);if(!b)throw new Error(`Invalid JSON-pointer: ${t}`);const w=+b[1];g=b[2];if(g==="#"){if(w>=u)throw new Error(errorMsg("property/index",w));return m[u-w]}if(w>u)throw new Error(errorMsg("data",w));v=p[u-w];if(!g)return v}let b=v;const w=g.split("/");for(const t of w){if(t){v=(0,$._)`${v}${(0,$.getProperty)((0,x.unescapeJsonPointer)(t))}`;b=(0,$._)`${b} && ${v}`}}return b;function errorMsg(t,p){return`Cannot access ${t} ${p} levels up, current level is ${u}`}}u.getData=getData},9007:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateKeywordUsage=u.validSchemaType=u.funcKeywordCode=u.macroKeywordCode=void 0;const m=p(4671);const g=p(1529);const v=p(1919);const b=p(7446);function macroKeywordCode(t,u){const{gen:p,keyword:g,schema:v,parentSchema:b,it:w}=t;const E=u.macro.call(w.self,v,b,w);const S=useKeyword(p,g,E);if(w.opts.validateSchema!==false)w.self.validateSchema(E,true);const $=p.name("valid");t.subschema({schema:E,schemaPath:m.nil,errSchemaPath:`${w.errSchemaPath}/${g}`,topSchemaRef:S,compositeRule:true},$);t.pass($,(()=>t.error(true)))}u.macroKeywordCode=macroKeywordCode;function funcKeywordCode(t,u){var p;const{gen:b,keyword:w,schema:E,parentSchema:S,$data:$,it:P}=t;checkAsyncKeyword(P,u);const R=!$&&u.compile?u.compile.call(P.self,E,S,P):u.validate;const x=useKeyword(b,w,R);const O=b.let("valid");t.block$data(O,validateKeyword);t.ok((p=u.valid)!==null&&p!==void 0?p:O);function validateKeyword(){if(u.errors===false){assignValid();if(u.modifying)modifyData(t);reportErrs((()=>t.error()))}else{const p=u.async?validateAsync():validateSync();if(u.modifying)modifyData(t);reportErrs((()=>addErrs(t,p)))}}function validateAsync(){const t=b.let("ruleErrs",null);b.try((()=>assignValid((0,m._)`await `)),(u=>b.assign(O,false).if((0,m._)`${u} instanceof ${P.ValidationError}`,(()=>b.assign(t,(0,m._)`${u}.errors`)),(()=>b.throw(u)))));return t}function validateSync(){const t=(0,m._)`${x}.errors`;b.assign(t,null);assignValid(m.nil);return t}function assignValid(p=(u.async?(0,m._)`await `:m.nil)){const w=P.opts.passContext?g.default.this:g.default.self;const E=!("compile"in u&&!$||u.schema===false);b.assign(O,(0,m._)`${p}${(0,v.callValidateCode)(t,x,w,E)}`,u.modifying)}function reportErrs(t){var p;b.if((0,m.not)((p=u.valid)!==null&&p!==void 0?p:O),t)}}u.funcKeywordCode=funcKeywordCode;function modifyData(t){const{gen:u,data:p,it:g}=t;u.if(g.parentData,(()=>u.assign(p,(0,m._)`${g.parentData}[${g.parentDataProperty}]`)))}function addErrs(t,u){const{gen:p}=t;p.if((0,m._)`Array.isArray(${u})`,(()=>{p.assign(g.default.vErrors,(0,m._)`${g.default.vErrors} === null ? ${u} : ${g.default.vErrors}.concat(${u})`).assign(g.default.errors,(0,m._)`${g.default.vErrors}.length`);(0,b.extendErrors)(t)}),(()=>t.error()))}function checkAsyncKeyword({schemaEnv:t},u){if(u.async&&!t.$async)throw new Error("async keyword in sync schema")}function useKeyword(t,u,p){if(p===undefined)throw new Error(`keyword "${u}" failed to compile`);return t.scopeValue("keyword",typeof p=="function"?{ref:p}:{ref:p,code:(0,m.stringify)(p)})}function validSchemaType(t,u,p=false){return!u.length||u.some((u=>u==="array"?Array.isArray(t):u==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==u||p&&typeof t=="undefined"))}u.validSchemaType=validSchemaType;function validateKeywordUsage({schema:t,opts:u,self:p,errSchemaPath:m},g,v){if(Array.isArray(g.keyword)?!g.keyword.includes(v):g.keyword!==v){throw new Error("ajv implementation error")}const b=g.dependencies;if(b===null||b===void 0?void 0:b.some((u=>!Object.prototype.hasOwnProperty.call(t,u)))){throw new Error(`parent schema must have dependencies of ${v}: ${b.join(",")}`)}if(g.validateSchema){const b=g.validateSchema(t[v]);if(!b){const t=`keyword "${v}" value is invalid at path "${m}": `+p.errorsText(g.validateSchema.errors);if(u.validateSchema==="log")p.logger.error(t);else throw new Error(t)}}}u.validateKeywordUsage=validateKeywordUsage},3893:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.extendSubschemaMode=u.extendSubschemaData=u.getSubschema=void 0;const m=p(4671);const g=p(5049);function getSubschema(t,{keyword:u,schemaProp:p,schema:v,schemaPath:b,errSchemaPath:w,topSchemaRef:E}){if(u!==undefined&&v!==undefined){throw new Error('both "keyword" and "schema" passed, only one allowed')}if(u!==undefined){const v=t.schema[u];return p===undefined?{schema:v,schemaPath:(0,m._)`${t.schemaPath}${(0,m.getProperty)(u)}`,errSchemaPath:`${t.errSchemaPath}/${u}`}:{schema:v[p],schemaPath:(0,m._)`${t.schemaPath}${(0,m.getProperty)(u)}${(0,m.getProperty)(p)}`,errSchemaPath:`${t.errSchemaPath}/${u}/${(0,g.escapeFragment)(p)}`}}if(v!==undefined){if(b===undefined||w===undefined||E===undefined){throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')}return{schema:v,schemaPath:b,topSchemaRef:E,errSchemaPath:w}}throw new Error('either "keyword" or "schema" must be passed')}u.getSubschema=getSubschema;function extendSubschemaData(t,u,{dataProp:p,dataPropType:v,data:b,dataTypes:w,propertyName:E}){if(b!==undefined&&p!==undefined){throw new Error('both "data" and "dataProp" passed, only one allowed')}const{gen:S}=u;if(p!==undefined){const{errorPath:b,dataPathArr:w,opts:E}=u;const $=S.let("data",(0,m._)`${u.data}${(0,m.getProperty)(p)}`,true);dataContextProps($);t.errorPath=(0,m.str)`${b}${(0,g.getErrorPath)(p,v,E.jsPropertySyntax)}`;t.parentDataProperty=(0,m._)`${p}`;t.dataPathArr=[...w,t.parentDataProperty]}if(b!==undefined){const u=b instanceof m.Name?b:S.let("data",b,true);dataContextProps(u);if(E!==undefined)t.propertyName=E}if(w)t.dataTypes=w;function dataContextProps(p){t.data=p;t.dataLevel=u.dataLevel+1;t.dataTypes=[];u.definedProperties=new Set;t.parentData=u.data;t.dataNames=[...u.dataNames,p]}}u.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(t,{jtdDiscriminator:u,jtdMetadata:p,compositeRule:m,createErrors:g,allErrors:v}){if(m!==undefined)t.compositeRule=m;if(g!==undefined)t.createErrors=g;if(v!==undefined)t.allErrors=v;t.jtdDiscriminator=u;t.jtdMetadata=p}u.extendSubschemaMode=extendSubschemaMode},6952:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.CodeGen=u.Name=u.nil=u.stringify=u.str=u._=u.KeywordCxt=void 0;var m=p(324);Object.defineProperty(u,"KeywordCxt",{enumerable:true,get:function(){return m.KeywordCxt}});var g=p(4671);Object.defineProperty(u,"_",{enumerable:true,get:function(){return g._}});Object.defineProperty(u,"str",{enumerable:true,get:function(){return g.str}});Object.defineProperty(u,"stringify",{enumerable:true,get:function(){return g.stringify}});Object.defineProperty(u,"nil",{enumerable:true,get:function(){return g.nil}});Object.defineProperty(u,"Name",{enumerable:true,get:function(){return g.Name}});Object.defineProperty(u,"CodeGen",{enumerable:true,get:function(){return g.CodeGen}});const v=p(4068);const b=p(909);const w=p(2166);const E=p(4033);const S=p(4671);const $=p(9749);const P=p(3330);const R=p(5049);const x=p(3770);const O=p(7438);const defaultRegExp=(t,u)=>new RegExp(t,u);defaultRegExp.code="new RegExp";const A=["removeAdditional","useDefaults","coerceTypes"];const k=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]);const T={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."};const C={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};const I=200;function requiredOptions(t){var u,p,m,g,v,b,w,E,S,$,P,R,x,A,k,T,C,N,D,j,L,M,U,B,H;const z=t.strict;const V=(u=t.code)===null||u===void 0?void 0:u.optimize;const G=V===true||V===undefined?1:V||0;const q=(m=(p=t.code)===null||p===void 0?void 0:p.regExp)!==null&&m!==void 0?m:defaultRegExp;const W=(g=t.uriResolver)!==null&&g!==void 0?g:O.default;return{strictSchema:(b=(v=t.strictSchema)!==null&&v!==void 0?v:z)!==null&&b!==void 0?b:true,strictNumbers:(E=(w=t.strictNumbers)!==null&&w!==void 0?w:z)!==null&&E!==void 0?E:true,strictTypes:($=(S=t.strictTypes)!==null&&S!==void 0?S:z)!==null&&$!==void 0?$:"log",strictTuples:(R=(P=t.strictTuples)!==null&&P!==void 0?P:z)!==null&&R!==void 0?R:"log",strictRequired:(A=(x=t.strictRequired)!==null&&x!==void 0?x:z)!==null&&A!==void 0?A:false,code:t.code?{...t.code,optimize:G,regExp:q}:{optimize:G,regExp:q},loopRequired:(k=t.loopRequired)!==null&&k!==void 0?k:I,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:I,meta:(C=t.meta)!==null&&C!==void 0?C:true,messages:(N=t.messages)!==null&&N!==void 0?N:true,inlineRefs:(D=t.inlineRefs)!==null&&D!==void 0?D:true,schemaId:(j=t.schemaId)!==null&&j!==void 0?j:"$id",addUsedSchema:(L=t.addUsedSchema)!==null&&L!==void 0?L:true,validateSchema:(M=t.validateSchema)!==null&&M!==void 0?M:true,validateFormats:(U=t.validateFormats)!==null&&U!==void 0?U:true,unicodeRegExp:(B=t.unicodeRegExp)!==null&&B!==void 0?B:true,int32range:(H=t.int32range)!==null&&H!==void 0?H:true,uriResolver:W}}class Ajv{constructor(t={}){this.schemas={};this.refs={};this.formats={};this._compilations=new Set;this._loading={};this._cache=new Map;t=this.opts={...t,...requiredOptions(t)};const{es5:u,lines:p}=this.opts.code;this.scope=new S.ValueScope({scope:{},prefixes:k,es5:u,lines:p});this.logger=getLogger(t.logger);const m=t.validateFormats;t.validateFormats=false;this.RULES=(0,w.getRules)();checkOptions.call(this,T,t,"NOT SUPPORTED");checkOptions.call(this,C,t,"DEPRECATED","warn");this._metaOpts=getMetaSchemaOptions.call(this);if(t.formats)addInitialFormats.call(this);this._addVocabularies();this._addDefaultMetaSchema();if(t.keywords)addInitialKeywords.call(this,t.keywords);if(typeof t.meta=="object")this.addMetaSchema(t.meta);addInitialSchemas.call(this);t.validateFormats=m}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:u,schemaId:p}=this.opts;let m=x;if(p==="id"){m={...x};m.id=m.$id;delete m.$id}if(u&&t)this.addMetaSchema(m,m[p],false)}defaultMeta(){const{meta:t,schemaId:u}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[u]||t:undefined}validate(t,u){let p;if(typeof t=="string"){p=this.getSchema(t);if(!p)throw new Error(`no schema with key or ref "${t}"`)}else{p=this.compile(t)}const m=p(u);if(!("$async"in p))this.errors=p.errors;return m}compile(t,u){const p=this._addSchema(t,u);return p.validate||this._compileSchemaEnv(p)}compileAsync(t,u){if(typeof this.opts.loadSchema!="function"){throw new Error("options.loadSchema should be a function")}const{loadSchema:p}=this.opts;return runCompileAsync.call(this,t,u);async function runCompileAsync(t,u){await loadMetaSchema.call(this,t.$schema);const p=this._addSchema(t,u);return p.validate||_compileAsync.call(this,p)}async function loadMetaSchema(t){if(t&&!this.getSchema(t)){await runCompileAsync.call(this,{$ref:t},true)}}async function _compileAsync(t){try{return this._compileSchemaEnv(t)}catch(u){if(!(u instanceof b.default))throw u;checkLoaded.call(this,u);await loadMissingSchema.call(this,u.missingSchema);return _compileAsync.call(this,t)}}function checkLoaded({missingSchema:t,missingRef:u}){if(this.refs[t]){throw new Error(`AnySchema ${t} is loaded but ${u} cannot be resolved`)}}async function loadMissingSchema(t){const p=await _loadSchema.call(this,t);if(!this.refs[t])await loadMetaSchema.call(this,p.$schema);if(!this.refs[t])this.addSchema(p,t,u)}async function _loadSchema(t){const u=this._loading[t];if(u)return u;try{return await(this._loading[t]=p(t))}finally{delete this._loading[t]}}}addSchema(t,u,p,m=this.opts.validateSchema){if(Array.isArray(t)){for(const u of t)this.addSchema(u,undefined,p,m);return this}let g;if(typeof t==="object"){const{schemaId:u}=this.opts;g=t[u];if(g!==undefined&&typeof g!="string"){throw new Error(`schema ${u} must be string`)}}u=(0,$.normalizeId)(u||g);this._checkUnique(u);this.schemas[u]=this._addSchema(t,p,u,m,true);return this}addMetaSchema(t,u,p=this.opts.validateSchema){this.addSchema(t,u,true,p);return this}validateSchema(t,u){if(typeof t=="boolean")return true;let p;p=t.$schema;if(p!==undefined&&typeof p!="string"){throw new Error("$schema must be a string")}p=p||this.opts.defaultMeta||this.defaultMeta();if(!p){this.logger.warn("meta-schema not available");this.errors=null;return true}const m=this.validate(p,t);if(!m&&u){const t="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(t);else throw new Error(t)}return m}getSchema(t){let u;while(typeof(u=getSchEnv.call(this,t))=="string")t=u;if(u===undefined){const{schemaId:p}=this.opts;const m=new E.SchemaEnv({schema:{},schemaId:p});u=E.resolveSchema.call(this,m,t);if(!u)return;this.refs[t]=u}return u.validate||this._compileSchemaEnv(u)}removeSchema(t){if(t instanceof RegExp){this._removeAllSchemas(this.schemas,t);this._removeAllSchemas(this.refs,t);return this}switch(typeof t){case"undefined":this._removeAllSchemas(this.schemas);this._removeAllSchemas(this.refs);this._cache.clear();return this;case"string":{const u=getSchEnv.call(this,t);if(typeof u=="object")this._cache.delete(u.schema);delete this.schemas[t];delete this.refs[t];return this}case"object":{const u=t;this._cache.delete(u);let p=t[this.opts.schemaId];if(p){p=(0,$.normalizeId)(p);delete this.schemas[p];delete this.refs[p]}return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const u of t)this.addKeyword(u);return this}addKeyword(t,u){let p;if(typeof t=="string"){p=t;if(typeof u=="object"){this.logger.warn("these parameters are deprecated, see docs for addKeyword");u.keyword=p}}else if(typeof t=="object"&&u===undefined){u=t;p=u.keyword;if(Array.isArray(p)&&!p.length){throw new Error("addKeywords: keyword must be string or non-empty array")}}else{throw new Error("invalid addKeywords parameters")}checkKeyword.call(this,p,u);if(!u){(0,R.eachItem)(p,(t=>addRule.call(this,t)));return this}keywordMetaschema.call(this,u);const m={...u,type:(0,P.getJSONTypes)(u.type),schemaType:(0,P.getJSONTypes)(u.schemaType)};(0,R.eachItem)(p,m.type.length===0?t=>addRule.call(this,t,m):t=>m.type.forEach((u=>addRule.call(this,t,m,u))));return this}getKeyword(t){const u=this.RULES.all[t];return typeof u=="object"?u.definition:!!u}removeKeyword(t){const{RULES:u}=this;delete u.keywords[t];delete u.all[t];for(const p of u.rules){const u=p.rules.findIndex((u=>u.keyword===t));if(u>=0)p.rules.splice(u,1)}return this}addFormat(t,u){if(typeof u=="string")u=new RegExp(u);this.formats[t]=u;return this}errorsText(t=this.errors,{separator:u=", ",dataVar:p="data"}={}){if(!t||t.length===0)return"No errors";return t.map((t=>`${p}${t.instancePath} ${t.message}`)).reduce(((t,p)=>t+u+p))}$dataMetaSchema(t,u){const p=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const m of u){const u=m.split("/").slice(1);let g=t;for(const t of u)g=g[t];for(const t in p){const u=p[t];if(typeof u!="object")continue;const{$data:m}=u.definition;const v=g[t];if(m&&v)g[t]=schemaOrData(v)}}return t}_removeAllSchemas(t,u){for(const p in t){const m=t[p];if(!u||u.test(p)){if(typeof m=="string"){delete t[p]}else if(m&&!m.meta){this._cache.delete(m.schema);delete t[p]}}}}_addSchema(t,u,p,m=this.opts.validateSchema,g=this.opts.addUsedSchema){let v;const{schemaId:b}=this.opts;if(typeof t=="object"){v=t[b]}else{if(this.opts.jtd)throw new Error("schema must be object");else if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let w=this._cache.get(t);if(w!==undefined)return w;p=(0,$.normalizeId)(v||p);const S=$.getSchemaRefs.call(this,t,p);w=new E.SchemaEnv({schema:t,schemaId:b,meta:u,baseId:p,localRefs:S});this._cache.set(w.schema,w);if(g&&!p.startsWith("#")){if(p)this._checkUnique(p);this.refs[p]=w}if(m)this.validateSchema(t,true);return w}_checkUnique(t){if(this.schemas[t]||this.refs[t]){throw new Error(`schema with key or id "${t}" already exists`)}}_compileSchemaEnv(t){if(t.meta)this._compileMetaSchema(t);else E.compileSchema.call(this,t);if(!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const u=this.opts;this.opts=this._metaOpts;try{E.compileSchema.call(this,t)}finally{this.opts=u}}}Ajv.ValidationError=v.default;Ajv.MissingRefError=b.default;u["default"]=Ajv;function checkOptions(t,u,p,m="error"){for(const g in t){const v=g;if(v in u)this.logger[m](`${p}: option ${g}. ${t[v]}`)}}function getSchEnv(t){t=(0,$.normalizeId)(t);return this.schemas[t]||this.refs[t]}function addInitialSchemas(){const t=this.opts.schemas;if(!t)return;if(Array.isArray(t))this.addSchema(t);else for(const u in t)this.addSchema(t[u],u)}function addInitialFormats(){for(const t in this.opts.formats){const u=this.opts.formats[t];if(u)this.addFormat(t,u)}}function addInitialKeywords(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const u in t){const p=t[u];if(!p.keyword)p.keyword=u;this.addKeyword(p)}}function getMetaSchemaOptions(){const t={...this.opts};for(const u of A)delete t[u];return t}const N={log(){},warn(){},error(){}};function getLogger(t){if(t===false)return N;if(t===undefined)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}const D=/^[a-z_$][a-z0-9_$:-]*$/i;function checkKeyword(t,u){const{RULES:p}=this;(0,R.eachItem)(t,(t=>{if(p.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!D.test(t))throw new Error(`Keyword ${t} has invalid name`)}));if(!u)return;if(u.$data&&!("code"in u||"validate"in u)){throw new Error('$data keyword must have "code" or "validate" function')}}function addRule(t,u,p){var m;const g=u===null||u===void 0?void 0:u.post;if(p&&g)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:v}=this;let b=g?v.post:v.rules.find((({type:t})=>t===p));if(!b){b={type:p,rules:[]};v.rules.push(b)}v.keywords[t]=true;if(!u)return;const w={keyword:t,definition:{...u,type:(0,P.getJSONTypes)(u.type),schemaType:(0,P.getJSONTypes)(u.schemaType)}};if(u.before)addBeforeRule.call(this,b,w,u.before);else b.rules.push(w);v.all[t]=w;(m=u.implements)===null||m===void 0?void 0:m.forEach((t=>this.addKeyword(t)))}function addBeforeRule(t,u,p){const m=t.rules.findIndex((t=>t.keyword===p));if(m>=0){t.rules.splice(m,0,u)}else{t.rules.push(u);this.logger.warn(`rule ${p} is not defined`)}}function keywordMetaschema(t){let{metaSchema:u}=t;if(u===undefined)return;if(t.$data&&this.opts.$data)u=schemaOrData(u);t.validateSchema=this.compile(u,true)}const j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function schemaOrData(t){return{anyOf:[t,j]}}},4010:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6261);const g=p(13);const v=p(7388);const b=p(2394);const w=p(4771);const E=p(9567);const S=p(8364);const $=p(2943);const P=["/properties"];function addMetaSchema2020(t){[m,g,v,b,w,with$data(this,E),S,with$data(this,$)].forEach((t=>this.addMetaSchema(t,undefined,false)));return this;function with$data(u,p){return t?u.$dataMetaSchema(p,P):p}}u["default"]=addMetaSchema2020},9804:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7407);m.code='require("ajv/dist/runtime/equal").default';u["default"]=m},4679:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});function ucs2length(t){const u=t.length;let p=0;let m=0;let g;while(m<u){p++;g=t.charCodeAt(m++);if(g>=55296&&g<=56319&&m<u){g=t.charCodeAt(m);if((g&64512)===56320)m++}}return p}u["default"]=ucs2length;ucs2length.code='require("ajv/dist/runtime/ucs2length").default'},7438:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1311);m.code='require("ajv/dist/runtime/uri").default';u["default"]=m},4068:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});class ValidationError extends Error{constructor(t){super("validation failed");this.errors=t;this.ajv=this.validation=true}}u["default"]=ValidationError},2063:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateAdditionalItems=void 0;const m=p(4671);const g=p(5049);const v={message:({params:{len:t}})=>(0,m.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,m._)`{limit: ${t}}`};const b={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:v,code(t){const{parentSchema:u,it:p}=t;const{items:m}=u;if(!Array.isArray(m)){(0,g.checkStrictMode)(p,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(t,m)}};function validateAdditionalItems(t,u){const{gen:p,schema:v,data:b,keyword:w,it:E}=t;E.items=true;const S=p.const("len",(0,m._)`${b}.length`);if(v===false){t.setParams({len:u.length});t.pass((0,m._)`${S} <= ${u.length}`)}else if(typeof v=="object"&&!(0,g.alwaysValidSchema)(E,v)){const g=p.var("valid",(0,m._)`${S} <= ${u.length}`);p.if((0,m.not)(g),(()=>validateItems(g)));t.ok(g)}function validateItems(v){p.forRange("i",u.length,S,(u=>{t.subschema({keyword:w,dataProp:u,dataPropType:g.Type.Num},v);if(!E.allErrors)p.if((0,m.not)(v),(()=>p.break()))}))}}u.validateAdditionalItems=validateAdditionalItems;u["default"]=b},8410:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1919);const g=p(4671);const v=p(1529);const b=p(5049);const w={message:"must NOT have additional properties",params:({params:t})=>(0,g._)`{additionalProperty: ${t.additionalProperty}}`};const E={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:w,code(t){const{gen:u,schema:p,parentSchema:w,data:E,errsCount:S,it:$}=t;if(!S)throw new Error("ajv implementation error");const{allErrors:P,opts:R}=$;$.props=true;if(R.removeAdditional!=="all"&&(0,b.alwaysValidSchema)($,p))return;const x=(0,m.allSchemaProperties)(w.properties);const O=(0,m.allSchemaProperties)(w.patternProperties);checkAdditionalProperties();t.ok((0,g._)`${S} === ${v.default.errors}`);function checkAdditionalProperties(){u.forIn("key",E,(t=>{if(!x.length&&!O.length)additionalPropertyCode(t);else u.if(isAdditional(t),(()=>additionalPropertyCode(t)))}))}function isAdditional(p){let v;if(x.length>8){const t=(0,b.schemaRefOrVal)($,w.properties,"properties");v=(0,m.isOwnProperty)(u,t,p)}else if(x.length){v=(0,g.or)(...x.map((t=>(0,g._)`${p} === ${t}`)))}else{v=g.nil}if(O.length){v=(0,g.or)(v,...O.map((u=>(0,g._)`${(0,m.usePattern)(t,u)}.test(${p})`)))}return(0,g.not)(v)}function deleteAdditional(t){u.code((0,g._)`delete ${E}[${t}]`)}function additionalPropertyCode(m){if(R.removeAdditional==="all"||R.removeAdditional&&p===false){deleteAdditional(m);return}if(p===false){t.setParams({additionalProperty:m});t.error();if(!P)u.break();return}if(typeof p=="object"&&!(0,b.alwaysValidSchema)($,p)){const p=u.name("valid");if(R.removeAdditional==="failing"){applyAdditionalSchema(m,p,false);u.if((0,g.not)(p),(()=>{t.reset();deleteAdditional(m)}))}else{applyAdditionalSchema(m,p);if(!P)u.if((0,g.not)(p),(()=>u.break()))}}}function applyAdditionalSchema(u,p,m){const g={keyword:"additionalProperties",dataProp:u,dataPropType:b.Type.Str};if(m===false){Object.assign(g,{compositeRule:true,createErrors:false,allErrors:false})}t.subschema(g,p)}}};u["default"]=E},382:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(5049);const g={keyword:"allOf",schemaType:"array",code(t){const{gen:u,schema:p,it:g}=t;if(!Array.isArray(p))throw new Error("ajv implementation error");const v=u.name("valid");p.forEach(((u,p)=>{if((0,m.alwaysValidSchema)(g,u))return;const b=t.subschema({keyword:"allOf",schemaProp:p},v);t.ok(v);t.mergeEvaluated(b)}))}};u["default"]=g},1151:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1919);const g={keyword:"anyOf",schemaType:"array",trackErrors:true,code:m.validateUnion,error:{message:"must match a schema in anyOf"}};u["default"]=g},4503:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v={message:({params:{min:t,max:u}})=>u===undefined?(0,m.str)`must contain at least ${t} valid item(s)`:(0,m.str)`must contain at least ${t} and no more than ${u} valid item(s)`,params:({params:{min:t,max:u}})=>u===undefined?(0,m._)`{minContains: ${t}}`:(0,m._)`{minContains: ${t}, maxContains: ${u}}`};const b={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:v,code(t){const{gen:u,schema:p,parentSchema:v,data:b,it:w}=t;let E;let S;const{minContains:$,maxContains:P}=v;if(w.opts.next){E=$===undefined?1:$;S=P}else{E=1}const R=u.const("len",(0,m._)`${b}.length`);t.setParams({min:E,max:S});if(S===undefined&&E===0){(0,g.checkStrictMode)(w,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(S!==undefined&&E>S){(0,g.checkStrictMode)(w,`"minContains" > "maxContains" is always invalid`);t.fail();return}if((0,g.alwaysValidSchema)(w,p)){let u=(0,m._)`${R} >= ${E}`;if(S!==undefined)u=(0,m._)`${u} && ${R} <= ${S}`;t.pass(u);return}w.items=true;const x=u.name("valid");if(S===undefined&&E===1){validateItems(x,(()=>u.if(x,(()=>u.break()))))}else if(E===0){u.let(x,true);if(S!==undefined)u.if((0,m._)`${b}.length > 0`,validateItemsWithCount)}else{u.let(x,false);validateItemsWithCount()}t.result(x,(()=>t.reset()));function validateItemsWithCount(){const t=u.name("_valid");const p=u.let("count",0);validateItems(t,(()=>u.if(t,(()=>checkLimits(p)))))}function validateItems(p,m){u.forRange("i",0,R,(u=>{t.subschema({keyword:"contains",dataProp:u,dataPropType:g.Type.Num,compositeRule:true},p);m()}))}function checkLimits(t){u.code((0,m._)`${t}++`);if(S===undefined){u.if((0,m._)`${t} >= ${E}`,(()=>u.assign(x,true).break()))}else{u.if((0,m._)`${t} > ${S}`,(()=>u.assign(x,false).break()));if(E===1)u.assign(x,true);else u.if((0,m._)`${t} >= ${E}`,(()=>u.assign(x,true)))}}}};u["default"]=b},4239:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateSchemaDeps=u.validatePropertyDeps=u.error=void 0;const m=p(4671);const g=p(5049);const v=p(1919);u.error={message:({params:{property:t,depsCount:u,deps:p}})=>{const g=u===1?"property":"properties";return(0,m.str)`must have ${g} ${p} when property ${t} is present`},params:({params:{property:t,depsCount:u,deps:p,missingProperty:g}})=>(0,m._)`{property: ${t},
6
6
  missingProperty: ${g},
7
7
  depsCount: ${u},
8
8
  deps: ${p}}`};const b={keyword:"dependencies",type:"object",schemaType:"object",error:u.error,code(t){const[u,p]=splitDependencies(t);validatePropertyDeps(t,u);validateSchemaDeps(t,p)}};function splitDependencies({schema:t}){const u={};const p={};for(const m in t){if(m==="__proto__")continue;const g=Array.isArray(t[m])?u:p;g[m]=t[m]}return[u,p]}function validatePropertyDeps(t,u=t.schema){const{gen:p,data:g,it:b}=t;if(Object.keys(u).length===0)return;const w=p.let("missing");for(const E in u){const S=u[E];if(S.length===0)continue;const $=(0,v.propertyInData)(p,g,E,b.opts.ownProperties);t.setParams({property:E,depsCount:S.length,deps:S.join(", ")});if(b.allErrors){p.if($,(()=>{for(const u of S){(0,v.checkReportMissingProp)(t,u)}}))}else{p.if((0,m._)`${$} && (${(0,v.checkMissingProp)(t,S,w)})`);(0,v.reportMissingProp)(t,w);p.else()}}}u.validatePropertyDeps=validatePropertyDeps;function validateSchemaDeps(t,u=t.schema){const{gen:p,data:m,keyword:b,it:w}=t;const E=p.name("valid");for(const S in u){if((0,g.alwaysValidSchema)(w,u[S]))continue;p.if((0,v.propertyInData)(p,m,S,w.opts.ownProperties),(()=>{const u=t.subschema({keyword:b,schemaProp:S},E);t.mergeValidEvaluated(u,E)}),(()=>p.var(E,true)));t.ok(E)}}u.validateSchemaDeps=validateSchemaDeps;u["default"]=b},2663:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4239);const g={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,m.validateSchemaDeps)(t)};u["default"]=g},6057:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v={message:({params:t})=>(0,m.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,m._)`{failingKeyword: ${t.ifClause}}`};const b={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:v,code(t){const{gen:u,parentSchema:p,it:v}=t;if(p.then===undefined&&p.else===undefined){(0,g.checkStrictMode)(v,'"if" without "then" and "else" is ignored')}const b=hasSchema(v,"then");const w=hasSchema(v,"else");if(!b&&!w)return;const E=u.let("valid",true);const S=u.name("_valid");validateIf();t.reset();if(b&&w){const p=u.let("ifClause");t.setParams({ifClause:p});u.if(S,validateClause("then",p),validateClause("else",p))}else if(b){u.if(S,validateClause("then"))}else{u.if((0,m.not)(S),validateClause("else"))}t.pass(E,(()=>t.error(true)));function validateIf(){const u=t.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},S);t.mergeEvaluated(u)}function validateClause(p,g){return()=>{const v=t.subschema({keyword:p},S);u.assign(E,S);t.mergeValidEvaluated(v,E);if(g)u.assign(g,(0,m._)`${p}`);else t.setParams({ifClause:p})}}}};function hasSchema(t,u){const p=t.schema[u];return p!==undefined&&!(0,g.alwaysValidSchema)(t,p)}u["default"]=b},8112:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(2063);const g=p(8120);const v=p(6604);const b=p(8844);const w=p(4503);const E=p(4239);const S=p(1023);const $=p(8410);const P=p(8563);const R=p(9527);const x=p(8573);const O=p(1151);const A=p(8037);const k=p(382);const T=p(6057);const C=p(8472);function getApplicator(t=false){const u=[x.default,O.default,A.default,k.default,T.default,C.default,S.default,$.default,E.default,P.default,R.default];if(t)u.push(g.default,b.default);else u.push(m.default,v.default);u.push(w.default);return u}u["default"]=getApplicator},6604:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateTuple=void 0;const m=p(4671);const g=p(5049);const v=p(1919);const b={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:u,it:p}=t;if(Array.isArray(u))return validateTuple(t,"additionalItems",u);p.items=true;if((0,g.alwaysValidSchema)(p,u))return;t.ok((0,v.validateArray)(t))}};function validateTuple(t,u,p=t.schema){const{gen:v,parentSchema:b,data:w,keyword:E,it:S}=t;checkStrictTuple(b);if(S.opts.unevaluated&&p.length&&S.items!==true){S.items=g.mergeEvaluated.items(v,p.length,S.items)}const $=v.name("valid");const P=v.const("len",(0,m._)`${w}.length`);p.forEach(((u,p)=>{if((0,g.alwaysValidSchema)(S,u))return;v.if((0,m._)`${P} > ${p}`,(()=>t.subschema({keyword:E,schemaProp:p,dataProp:p},$)));t.ok($)}));function checkStrictTuple(t){const{opts:m,errSchemaPath:v}=S;const b=p.length;const w=b===t.minItems&&(b===t.maxItems||t[u]===false);if(m.strictTuples&&!w){const t=`"${E}" is ${b}-tuple, but minItems or maxItems/${u} are not specified or different at path "${v}"`;(0,g.checkStrictMode)(S,t,m.strictTuples)}}}u.validateTuple=validateTuple;u["default"]=b},8844:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v=p(1919);const b=p(2063);const w={message:({params:{len:t}})=>(0,m.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,m._)`{limit: ${t}}`};const E={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:w,code(t){const{schema:u,parentSchema:p,it:m}=t;const{prefixItems:w}=p;m.items=true;if((0,g.alwaysValidSchema)(m,u))return;if(w)(0,b.validateAdditionalItems)(t,w);else t.ok((0,v.validateArray)(t))}};u["default"]=E},8573:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(5049);const g={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(t){const{gen:u,schema:p,it:g}=t;if((0,m.alwaysValidSchema)(g,p)){t.fail();return}const v=u.name("valid");t.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},v);t.failResult(v,(()=>t.reset()),(()=>t.error()))},error:{message:"must NOT be valid"}};u["default"]=g},8037:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,m._)`{passingSchemas: ${t.passing}}`};const b={keyword:"oneOf",schemaType:"array",trackErrors:true,error:v,code(t){const{gen:u,schema:p,parentSchema:v,it:b}=t;if(!Array.isArray(p))throw new Error("ajv implementation error");if(b.opts.discriminator&&v.discriminator)return;const w=p;const E=u.let("valid",false);const S=u.let("passing",null);const $=u.name("_valid");t.setParams({passing:S});u.block(validateOneOf);t.result(E,(()=>t.reset()),(()=>t.error(true)));function validateOneOf(){w.forEach(((p,v)=>{let w;if((0,g.alwaysValidSchema)(b,p)){u.var($,true)}else{w=t.subschema({keyword:"oneOf",schemaProp:v,compositeRule:true},$)}if(v>0){u.if((0,m._)`${$} && ${E}`).assign(E,false).assign(S,(0,m._)`[${S}, ${v}]`).else()}u.if($,(()=>{u.assign(E,true);u.assign(S,v);if(w)t.mergeEvaluated(w,m.Name)}))}))}}};u["default"]=b},9527:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1919);const g=p(4671);const v=p(5049);const b=p(5049);const w={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:u,schema:p,data:w,parentSchema:E,it:S}=t;const{opts:$}=S;const P=(0,m.allSchemaProperties)(p);const R=P.filter((t=>(0,v.alwaysValidSchema)(S,p[t])));if(P.length===0||R.length===P.length&&(!S.opts.unevaluated||S.props===true)){return}const x=$.strictSchema&&!$.allowMatchingProperties&&E.properties;const O=u.name("valid");if(S.props!==true&&!(S.props instanceof g.Name)){S.props=(0,b.evaluatedPropsToName)(u,S.props)}const{props:A}=S;validatePatternProperties();function validatePatternProperties(){for(const t of P){if(x)checkMatchingProperties(t);if(S.allErrors){validateProperties(t)}else{u.var(O,true);validateProperties(t);u.if(O)}}}function checkMatchingProperties(t){for(const u in x){if(new RegExp(t).test(u)){(0,v.checkStrictMode)(S,`property ${u} matches pattern ${t} (use allowMatchingProperties)`)}}}function validateProperties(p){u.forIn("key",w,(v=>{u.if((0,g._)`${(0,m.usePattern)(t,p)}.test(${v})`,(()=>{const m=R.includes(p);if(!m){t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:v,dataPropType:b.Type.Str},O)}if(S.opts.unevaluated&&A!==true){u.assign((0,g._)`${A}[${v}]`,true)}else if(!m&&!S.allErrors){u.if((0,g.not)(O),(()=>u.break()))}}))}))}}};u["default"]=w},8120:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6604);const g={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,m.validateTuple)(t,"items")};u["default"]=g},8563:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(324);const g=p(1919);const v=p(5049);const b=p(8410);const w={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:u,schema:p,parentSchema:w,data:E,it:S}=t;if(S.opts.removeAdditional==="all"&&w.additionalProperties===undefined){b.default.code(new m.KeywordCxt(S,b.default,"additionalProperties"))}const $=(0,g.allSchemaProperties)(p);for(const t of $){S.definedProperties.add(t)}if(S.opts.unevaluated&&$.length&&S.props!==true){S.props=v.mergeEvaluated.props(u,(0,v.toHash)($),S.props)}const P=$.filter((t=>!(0,v.alwaysValidSchema)(S,p[t])));if(P.length===0)return;const R=u.name("valid");for(const p of P){if(hasDefault(p)){applyPropertySchema(p)}else{u.if((0,g.propertyInData)(u,E,p,S.opts.ownProperties));applyPropertySchema(p);if(!S.allErrors)u.else().var(R,true);u.endIf()}t.it.definedProperties.add(p);t.ok(R)}function hasDefault(t){return S.opts.useDefaults&&!S.compositeRule&&p[t].default!==undefined}function applyPropertySchema(u){t.subschema({keyword:"properties",schemaProp:u,dataProp:u},R)}}};u["default"]=w},1023:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v={message:"property name must be valid",params:({params:t})=>(0,m._)`{propertyName: ${t.propertyName}}`};const b={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:v,code(t){const{gen:u,schema:p,data:v,it:b}=t;if((0,g.alwaysValidSchema)(b,p))return;const w=u.name("valid");u.forIn("key",v,(p=>{t.setParams({propertyName:p});t.subschema({keyword:"propertyNames",data:p,dataTypes:["string"],propertyName:p,compositeRule:true},w);u.if((0,m.not)(w),(()=>{t.error(true);if(!b.allErrors)u.break()}))}));t.ok(w)}};u["default"]=b},8472:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(5049);const g={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:u,it:p}){if(u.if===undefined)(0,m.checkStrictMode)(p,`"${t}" without "if" is ignored`)}};u["default"]=g},1919:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.validateUnion=u.validateArray=u.usePattern=u.callValidateCode=u.schemaProperties=u.allSchemaProperties=u.noPropertyInData=u.propertyInData=u.isOwnProperty=u.hasPropFunc=u.reportMissingProp=u.checkMissingProp=u.checkReportMissingProp=void 0;const m=p(4671);const g=p(5049);const v=p(1529);const b=p(5049);function checkReportMissingProp(t,u){const{gen:p,data:g,it:v}=t;p.if(noPropertyInData(p,g,u,v.opts.ownProperties),(()=>{t.setParams({missingProperty:(0,m._)`${u}`},true);t.error()}))}u.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:t,data:u,it:{opts:p}},g,v){return(0,m.or)(...g.map((g=>(0,m.and)(noPropertyInData(t,u,g,p.ownProperties),(0,m._)`${v} = ${g}`))))}u.checkMissingProp=checkMissingProp;function reportMissingProp(t,u){t.setParams({missingProperty:u},true);t.error()}u.reportMissingProp=reportMissingProp;function hasPropFunc(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,m._)`Object.prototype.hasOwnProperty`})}u.hasPropFunc=hasPropFunc;function isOwnProperty(t,u,p){return(0,m._)`${hasPropFunc(t)}.call(${u}, ${p})`}u.isOwnProperty=isOwnProperty;function propertyInData(t,u,p,g){const v=(0,m._)`${u}${(0,m.getProperty)(p)} !== undefined`;return g?(0,m._)`${v} && ${isOwnProperty(t,u,p)}`:v}u.propertyInData=propertyInData;function noPropertyInData(t,u,p,g){const v=(0,m._)`${u}${(0,m.getProperty)(p)} === undefined`;return g?(0,m.or)(v,(0,m.not)(isOwnProperty(t,u,p))):v}u.noPropertyInData=noPropertyInData;function allSchemaProperties(t){return t?Object.keys(t).filter((t=>t!=="__proto__")):[]}u.allSchemaProperties=allSchemaProperties;function schemaProperties(t,u){return allSchemaProperties(u).filter((p=>!(0,g.alwaysValidSchema)(t,u[p])))}u.schemaProperties=schemaProperties;function callValidateCode({schemaCode:t,data:u,it:{gen:p,topSchemaRef:g,schemaPath:b,errorPath:w},it:E},S,$,P){const R=P?(0,m._)`${t}, ${u}, ${g}${b}`:u;const x=[[v.default.instancePath,(0,m.strConcat)(v.default.instancePath,w)],[v.default.parentData,E.parentData],[v.default.parentDataProperty,E.parentDataProperty],[v.default.rootData,v.default.rootData]];if(E.opts.dynamicRef)x.push([v.default.dynamicAnchors,v.default.dynamicAnchors]);const O=(0,m._)`${R}, ${p.object(...x)}`;return $!==m.nil?(0,m._)`${S}.call(${$}, ${O})`:(0,m._)`${S}(${O})`}u.callValidateCode=callValidateCode;const w=(0,m._)`new RegExp`;function usePattern({gen:t,it:{opts:u}},p){const g=u.unicodeRegExp?"u":"";const{regExp:v}=u.code;const E=v(p,g);return t.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,m._)`${v.code==="new RegExp"?w:(0,b.useFunc)(t,v)}(${p}, ${g})`})}u.usePattern=usePattern;function validateArray(t){const{gen:u,data:p,keyword:v,it:b}=t;const w=u.name("valid");if(b.allErrors){const t=u.let("valid",true);validateItems((()=>u.assign(t,false)));return t}u.var(w,true);validateItems((()=>u.break()));return w;function validateItems(b){const E=u.const("len",(0,m._)`${p}.length`);u.forRange("i",0,E,(p=>{t.subschema({keyword:v,dataProp:p,dataPropType:g.Type.Num},w);u.if((0,m.not)(w),b)}))}}u.validateArray=validateArray;function validateUnion(t){const{gen:u,schema:p,keyword:v,it:b}=t;if(!Array.isArray(p))throw new Error("ajv implementation error");const w=p.some((t=>(0,g.alwaysValidSchema)(b,t)));if(w&&!b.opts.unevaluated)return;const E=u.let("valid",false);const S=u.name("_valid");u.block((()=>p.forEach(((p,g)=>{const b=t.subschema({keyword:v,schemaProp:g,compositeRule:true},S);u.assign(E,(0,m._)`${E} || ${S}`);const w=t.mergeValidEvaluated(b,S);if(!w)u.if((0,m.not)(E))}))));t.result(E,(()=>t.reset()),(()=>t.error(true)))}u.validateUnion=validateUnion},9069:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const p={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};u["default"]=p},6550:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(9069);const g=p(4247);const v=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",m.default,g.default];u["default"]=v},4247:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.callRef=u.getValidate=void 0;const m=p(909);const g=p(1919);const v=p(4671);const b=p(1529);const w=p(4033);const E=p(5049);const S={keyword:"$ref",schemaType:"string",code(t){const{gen:u,schema:p,it:g}=t;const{baseId:b,schemaEnv:E,validateName:S,opts:$,self:P}=g;const{root:R}=E;if((p==="#"||p==="#/")&&b===R.baseId)return callRootRef();const x=w.resolveRef.call(P,R,b,p);if(x===undefined)throw new m.default(g.opts.uriResolver,b,p);if(x instanceof w.SchemaEnv)return callValidate(x);return inlineRefSchema(x);function callRootRef(){if(E===R)return callRef(t,S,E,E.$async);const p=u.scopeValue("root",{ref:R});return callRef(t,(0,v._)`${p}.validate`,R,R.$async)}function callValidate(u){const p=getValidate(t,u);callRef(t,p,u,u.$async)}function inlineRefSchema(m){const g=u.scopeValue("schema",$.code.source===true?{ref:m,code:(0,v.stringify)(m)}:{ref:m});const b=u.name("valid");const w=t.subschema({schema:m,dataTypes:[],schemaPath:v.nil,topSchemaRef:g,errSchemaPath:p},b);t.mergeEvaluated(w);t.ok(b)}}};function getValidate(t,u){const{gen:p}=t;return u.validate?p.scopeValue("validate",{ref:u.validate}):(0,v._)`${p.scopeValue("wrapper",{ref:u})}.validate`}u.getValidate=getValidate;function callRef(t,u,p,m){const{gen:w,it:S}=t;const{allErrors:$,schemaEnv:P,opts:R}=S;const x=R.passContext?b.default.this:v.nil;if(m)callAsyncRef();else callSyncRef();function callAsyncRef(){if(!P.$async)throw new Error("async schema referenced by sync schema");const p=w.let("valid");w.try((()=>{w.code((0,v._)`await ${(0,g.callValidateCode)(t,u,x)}`);addEvaluatedFrom(u);if(!$)w.assign(p,true)}),(t=>{w.if((0,v._)`!(${t} instanceof ${S.ValidationError})`,(()=>w.throw(t)));addErrorsFrom(t);if(!$)w.assign(p,false)}));t.ok(p)}function callSyncRef(){t.result((0,g.callValidateCode)(t,u,x),(()=>addEvaluatedFrom(u)),(()=>addErrorsFrom(u)))}function addErrorsFrom(t){const u=(0,v._)`${t}.errors`;w.assign(b.default.vErrors,(0,v._)`${b.default.vErrors} === null ? ${u} : ${b.default.vErrors}.concat(${u})`);w.assign(b.default.errors,(0,v._)`${b.default.vErrors}.length`)}function addEvaluatedFrom(t){var u;if(!S.opts.unevaluated)return;const m=(u=p===null||p===void 0?void 0:p.validate)===null||u===void 0?void 0:u.evaluated;if(S.props!==true){if(m&&!m.dynamicProps){if(m.props!==undefined){S.props=E.mergeEvaluated.props(w,m.props,S.props)}}else{const u=w.var("props",(0,v._)`${t}.evaluated.props`);S.props=E.mergeEvaluated.props(w,u,S.props,v.Name)}}if(S.items!==true){if(m&&!m.dynamicItems){if(m.items!==undefined){S.items=E.mergeEvaluated.items(w,m.items,S.items)}}else{const u=w.var("items",(0,v._)`${t}.evaluated.items`);S.items=E.mergeEvaluated.items(w,u,S.items,v.Name)}}}}u.callRef=callRef;u["default"]=S},9099:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(2330);const v=p(4033);const b=p(909);const w=p(5049);const E={message:({params:{discrError:t,tagName:u}})=>t===g.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:t,tag:u,tagName:p}})=>(0,m._)`{error: ${t}, tag: ${p}, tagValue: ${u}}`};const S={keyword:"discriminator",type:"object",schemaType:"object",error:E,code(t){const{gen:u,data:p,schema:E,parentSchema:S,it:$}=t;const{oneOf:P}=S;if(!$.opts.discriminator){throw new Error("discriminator: requires discriminator option")}const R=E.propertyName;if(typeof R!="string")throw new Error("discriminator: requires propertyName");if(E.mapping)throw new Error("discriminator: mapping is not supported");if(!P)throw new Error("discriminator: requires oneOf keyword");const x=u.let("valid",false);const O=u.const("tag",(0,m._)`${p}${(0,m.getProperty)(R)}`);u.if((0,m._)`typeof ${O} == "string"`,(()=>validateMapping()),(()=>t.error(false,{discrError:g.DiscrError.Tag,tag:O,tagName:R})));t.ok(x);function validateMapping(){const p=getMapping();u.if(false);for(const t in p){u.elseIf((0,m._)`${O} === ${t}`);u.assign(x,applyTagSchema(p[t]))}u.else();t.error(false,{discrError:g.DiscrError.Mapping,tag:O,tagName:R});u.endIf()}function applyTagSchema(p){const g=u.name("valid");const v=t.subschema({keyword:"oneOf",schemaProp:p},g);t.mergeEvaluated(v,m.Name);return g}function getMapping(){var t;const u={};const p=hasRequired(S);let m=true;for(let u=0;u<P.length;u++){let g=P[u];if((g===null||g===void 0?void 0:g.$ref)&&!(0,w.schemaHasRulesButRef)(g,$.self.RULES)){const t=g.$ref;g=v.resolveRef.call($.self,$.schemaEnv.root,$.baseId,t);if(g instanceof v.SchemaEnv)g=g.schema;if(g===undefined)throw new b.default($.opts.uriResolver,$.baseId,t)}const E=(t=g===null||g===void 0?void 0:g.properties)===null||t===void 0?void 0:t[R];if(typeof E!="object"){throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${R}"`)}m=m&&(p||hasRequired(g));addMappings(E,u)}if(!m)throw new Error(`discriminator: "${R}" must be required`);return u;function hasRequired({required:t}){return Array.isArray(t)&&t.includes(R)}function addMappings(t,u){if(t.const){addMapping(t.const,u)}else if(t.enum){for(const p of t.enum){addMapping(p,u)}}else{throw new Error(`discriminator: "properties/${R}" must have "const" or "enum"`)}}function addMapping(t,p){if(typeof t!="string"||t in u){throw new Error(`discriminator: "${R}" values must be unique strings`)}u[t]=p}}}};u["default"]=S},2330:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.DiscrError=void 0;var p;(function(t){t["Tag"]="tag";t["Mapping"]="mapping"})(p||(u.DiscrError=p={}))},4231:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6550);const g=p(9706);const v=p(8112);const b=p(6774);const w=p(2043);const E=p(5119);const S=p(6242);const $=p(7123);const P=[b.default,m.default,g.default,(0,v.default)(true),S.default,$.metadataVocabulary,$.contentVocabulary,w.default,E.default];u["default"]=P},1982:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6550);const g=p(9706);const v=p(8112);const b=p(6242);const w=p(7123);const E=[m.default,g.default,(0,v.default)(),b.default,w.metadataVocabulary,w.contentVocabulary];u["default"]=E},6758:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.dynamicAnchor=void 0;const m=p(4671);const g=p(1529);const v=p(4033);const b=p(4247);const w={keyword:"$dynamicAnchor",schemaType:"string",code:t=>dynamicAnchor(t,t.schema)};function dynamicAnchor(t,u){const{gen:p,it:v}=t;v.schemaEnv.root.dynamicAnchors[u]=true;const b=(0,m._)`${g.default.dynamicAnchors}${(0,m.getProperty)(u)}`;const w=v.errSchemaPath==="#"?v.validateName:_getValidate(t);p.if((0,m._)`!${b}`,(()=>p.assign(b,w)))}u.dynamicAnchor=dynamicAnchor;function _getValidate(t){const{schemaEnv:u,schema:p,self:m}=t.it;const{root:g,baseId:w,localRefs:E,meta:S}=u.root;const{schemaId:$}=m.opts;const P=new v.SchemaEnv({schema:p,schemaId:$,root:g,baseId:w,localRefs:E,meta:S});v.compileSchema.call(m,P);return(0,b.getValidate)(t,P)}u["default"]=w},1178:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.dynamicRef=void 0;const m=p(4671);const g=p(1529);const v=p(4247);const b={keyword:"$dynamicRef",schemaType:"string",code:t=>dynamicRef(t,t.schema)};function dynamicRef(t,u){const{gen:p,keyword:b,it:w}=t;if(u[0]!=="#")throw new Error(`"${b}" only supports hash fragment reference`);const E=u.slice(1);if(w.allErrors){_dynamicRef()}else{const u=p.let("valid",false);_dynamicRef(u);t.ok(u)}function _dynamicRef(t){if(w.schemaEnv.root.dynamicAnchors[E]){const u=p.let("_v",(0,m._)`${g.default.dynamicAnchors}${(0,m.getProperty)(E)}`);p.if(u,_callRef(u,t),_callRef(w.validateName,t))}else{_callRef(w.validateName,t)()}}function _callRef(u,m){return m?()=>p.block((()=>{(0,v.callRef)(t,u);p.let(m,true)})):()=>(0,v.callRef)(t,u)}}u.dynamicRef=dynamicRef;u["default"]=b},6774:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6758);const g=p(1178);const v=p(2719);const b=p(8249);const w=[m.default,g.default,v.default,b.default];u["default"]=w},2719:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(6758);const g=p(5049);const v={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){if(t.schema)(0,m.dynamicAnchor)(t,"");else(0,g.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};u["default"]=v},8249:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1178);const g={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,m.dynamicRef)(t,t.schema)};u["default"]=g},3779:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g={message:({schemaCode:t})=>(0,m.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,m._)`{format: ${t}}`};const v={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:g,code(t,u){const{gen:p,data:g,$data:v,schema:b,schemaCode:w,it:E}=t;const{opts:S,errSchemaPath:$,schemaEnv:P,self:R}=E;if(!S.validateFormats)return;if(v)validate$DataFormat();else validateFormat();function validate$DataFormat(){const v=p.scopeValue("formats",{ref:R.formats,code:S.code.formats});const b=p.const("fDef",(0,m._)`${v}[${w}]`);const E=p.let("fType");const $=p.let("format");p.if((0,m._)`typeof ${b} == "object" && !(${b} instanceof RegExp)`,(()=>p.assign(E,(0,m._)`${b}.type || "string"`).assign($,(0,m._)`${b}.validate`)),(()=>p.assign(E,(0,m._)`"string"`).assign($,b)));t.fail$data((0,m.or)(unknownFmt(),invalidFmt()));function unknownFmt(){if(S.strictSchema===false)return m.nil;return(0,m._)`${w} && !${$}`}function invalidFmt(){const t=P.$async?(0,m._)`(${b}.async ? await ${$}(${g}) : ${$}(${g}))`:(0,m._)`${$}(${g})`;const p=(0,m._)`(typeof ${$} == "function" ? ${t} : ${$}.test(${g}))`;return(0,m._)`${$} && ${$} !== true && ${E} === ${u} && !${p}`}}function validateFormat(){const v=R.formats[b];if(!v){unknownFormat();return}if(v===true)return;const[w,E,x]=getFormat(v);if(w===u)t.pass(validCondition());function unknownFormat(){if(S.strictSchema===false){R.logger.warn(unknownMsg());return}throw new Error(unknownMsg());function unknownMsg(){return`unknown format "${b}" ignored in schema at path "${$}"`}}function getFormat(t){const u=t instanceof RegExp?(0,m.regexpCode)(t):S.code.formats?(0,m._)`${S.code.formats}${(0,m.getProperty)(b)}`:undefined;const g=p.scopeValue("formats",{key:b,ref:t,code:u});if(typeof t=="object"&&!(t instanceof RegExp)){return[t.type||"string",t.validate,(0,m._)`${g}.validate`]}return["string",t,g]}function validCondition(){if(typeof v=="object"&&!(v instanceof RegExp)&&v.async){if(!P.$async)throw new Error("async format in sync schema");return(0,m._)`await ${x}(${g})`}return typeof E=="function"?(0,m._)`${x}(${g})`:(0,m._)`${x}.test(${g})`}}}};u["default"]=v},6242:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(3779);const g=[m.default];u["default"]=g},7123:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.contentVocabulary=u.metadataVocabulary=void 0;u.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];u.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},2043:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7800);const g=p(2663);const v=p(7928);const b=[m.default,g.default,v.default];u["default"]=b},5119:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(9250);const g=p(3703);const v=[m.default,g.default];u["default"]=v},3703:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v={message:({params:{len:t}})=>(0,m.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,m._)`{limit: ${t}}`};const b={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:v,code(t){const{gen:u,schema:p,data:v,it:b}=t;const w=b.items||0;if(w===true)return;const E=u.const("len",(0,m._)`${v}.length`);if(p===false){t.setParams({len:w});t.fail((0,m._)`${E} > ${w}`)}else if(typeof p=="object"&&!(0,g.alwaysValidSchema)(b,p)){const p=u.var("valid",(0,m._)`${E} <= ${w}`);u.if((0,m.not)(p),(()=>validateItems(p,w)));t.ok(p)}b.items=true;function validateItems(p,v){u.forRange("i",v,E,(v=>{t.subschema({keyword:"unevaluatedItems",dataProp:v,dataPropType:g.Type.Num},p);if(!b.allErrors)u.if((0,m.not)(p),(()=>u.break()))}))}}};u["default"]=b},9250:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v=p(1529);const b={message:"must NOT have unevaluated properties",params:({params:t})=>(0,m._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`};const w={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:true,error:b,code(t){const{gen:u,schema:p,data:b,errsCount:w,it:E}=t;if(!w)throw new Error("ajv implementation error");const{allErrors:S,props:$}=E;if($ instanceof m.Name){u.if((0,m._)`${$} !== true`,(()=>u.forIn("key",b,(t=>u.if(unevaluatedDynamic($,t),(()=>unevaluatedPropCode(t)))))))}else if($!==true){u.forIn("key",b,(t=>$===undefined?unevaluatedPropCode(t):u.if(unevaluatedStatic($,t),(()=>unevaluatedPropCode(t)))))}E.props=true;t.ok((0,m._)`${w} === ${v.default.errors}`);function unevaluatedPropCode(v){if(p===false){t.setParams({unevaluatedProperty:v});t.error();if(!S)u.break();return}if(!(0,g.alwaysValidSchema)(E,p)){const p=u.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:v,dataPropType:g.Type.Str},p);if(!S)u.if((0,m.not)(p),(()=>u.break()))}}function unevaluatedDynamic(t,u){return(0,m._)`!${t} || !${t}[${u}]`}function unevaluatedStatic(t,u){const p=[];for(const g in t){if(t[g]===true)p.push((0,m._)`${u} !== ${g}`)}return(0,m.and)(...p)}}};u["default"]=w},1793:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v=p(9804);const b={message:"must be equal to constant",params:({schemaCode:t})=>(0,m._)`{allowedValue: ${t}}`};const w={keyword:"const",$data:true,error:b,code(t){const{gen:u,data:p,$data:b,schemaCode:w,schema:E}=t;if(b||E&&typeof E=="object"){t.fail$data((0,m._)`!${(0,g.useFunc)(u,v.default)}(${p}, ${w})`)}else{t.fail((0,m._)`${E} !== ${p}`)}}};u["default"]=w},7800:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4239);const g={keyword:"dependentRequired",type:"object",schemaType:"object",error:m.error,code:t=>(0,m.validatePropertyDeps)(t)};u["default"]=g},3429:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v=p(9804);const b={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,m._)`{allowedValues: ${t}}`};const w={keyword:"enum",schemaType:"array",$data:true,error:b,code(t){const{gen:u,data:p,$data:b,schema:w,schemaCode:E,it:S}=t;if(!b&&w.length===0)throw new Error("enum must have non-empty array");const $=w.length>=S.opts.loopEnum;let P;const getEql=()=>P!==null&&P!==void 0?P:P=(0,g.useFunc)(u,v.default);let R;if($||b){R=u.let("valid");t.block$data(R,loopEnum)}else{if(!Array.isArray(w))throw new Error("ajv implementation error");const t=u.const("vSchema",E);R=(0,m.or)(...w.map(((u,p)=>equalCode(t,p))))}t.pass(R);function loopEnum(){u.assign(R,false);u.forOf("v",E,(t=>u.if((0,m._)`${getEql()}(${p}, ${t})`,(()=>u.assign(R,true).break()))))}function equalCode(t,u){const g=w[u];return typeof g==="object"&&g!==null?(0,m._)`${getEql()}(${p}, ${t}[${u}])`:(0,m._)`${p} === ${g}`}}};u["default"]=w},9706:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(7560);const g=p(7677);const v=p(7453);const b=p(3744);const w=p(6088);const E=p(9185);const S=p(2085);const $=p(8835);const P=p(1793);const R=p(3429);const x=[m.default,g.default,v.default,b.default,w.default,E.default,S.default,$.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},P.default,R.default];u["default"]=x},7928:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(5049);const g={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:u,it:p}){if(u.contains===undefined){(0,m.checkStrictMode)(p,`"${t}" without "contains" is ignored`)}}};u["default"]=g},2085:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g={message({keyword:t,schemaCode:u}){const p=t==="maxItems"?"more":"fewer";return(0,m.str)`must NOT have ${p} than ${u} items`},params:({schemaCode:t})=>(0,m._)`{limit: ${t}}`};const v={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:g,code(t){const{keyword:u,data:p,schemaCode:g}=t;const v=u==="maxItems"?m.operators.GT:m.operators.LT;t.fail$data((0,m._)`${p}.length ${v} ${g}`)}};u["default"]=v},7453:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=p(5049);const v=p(4679);const b={message({keyword:t,schemaCode:u}){const p=t==="maxLength"?"more":"fewer";return(0,m.str)`must NOT have ${p} than ${u} characters`},params:({schemaCode:t})=>(0,m._)`{limit: ${t}}`};const w={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:b,code(t){const{keyword:u,data:p,schemaCode:b,it:w}=t;const E=u==="maxLength"?m.operators.GT:m.operators.LT;const S=w.opts.unicode===false?(0,m._)`${p}.length`:(0,m._)`${(0,g.useFunc)(t.gen,v.default)}(${p})`;t.fail$data((0,m._)`${S} ${E} ${b}`)}};u["default"]=w},7560:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g=m.operators;const v={maximum:{okStr:"<=",ok:g.LTE,fail:g.GT},minimum:{okStr:">=",ok:g.GTE,fail:g.LT},exclusiveMaximum:{okStr:"<",ok:g.LT,fail:g.GTE},exclusiveMinimum:{okStr:">",ok:g.GT,fail:g.LTE}};const b={message:({keyword:t,schemaCode:u})=>(0,m.str)`must be ${v[t].okStr} ${u}`,params:({keyword:t,schemaCode:u})=>(0,m._)`{comparison: ${v[t].okStr}, limit: ${u}}`};const w={keyword:Object.keys(v),type:"number",schemaType:"number",$data:true,error:b,code(t){const{keyword:u,data:p,schemaCode:g}=t;t.fail$data((0,m._)`${p} ${v[u].fail} ${g} || isNaN(${p})`)}};u["default"]=w},6088:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g={message({keyword:t,schemaCode:u}){const p=t==="maxProperties"?"more":"fewer";return(0,m.str)`must NOT have ${p} than ${u} properties`},params:({schemaCode:t})=>(0,m._)`{limit: ${t}}`};const v={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:g,code(t){const{keyword:u,data:p,schemaCode:g}=t;const v=u==="maxProperties"?m.operators.GT:m.operators.LT;t.fail$data((0,m._)`Object.keys(${p}).length ${v} ${g}`)}};u["default"]=v},7677:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(4671);const g={message:({schemaCode:t})=>(0,m.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,m._)`{multipleOf: ${t}}`};const v={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:g,code(t){const{gen:u,data:p,schemaCode:g,it:v}=t;const b=v.opts.multipleOfPrecision;const w=u.let("res");const E=b?(0,m._)`Math.abs(Math.round(${w}) - ${w}) > 1e-${b}`:(0,m._)`${w} !== parseInt(${w})`;t.fail$data((0,m._)`(${g} === 0 || (${w} = ${p}/${g}, ${E}))`)}};u["default"]=v},3744:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1919);const g=p(4671);const v={message:({schemaCode:t})=>(0,g.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,g._)`{pattern: ${t}}`};const b={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:v,code(t){const{data:u,$data:p,schema:v,schemaCode:b,it:w}=t;const E=w.opts.unicodeRegExp?"u":"";const S=p?(0,g._)`(new RegExp(${b}, ${E}))`:(0,m.usePattern)(t,v);t.fail$data((0,g._)`!${S}.test(${u})`)}};u["default"]=b},9185:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(1919);const g=p(4671);const v=p(5049);const b={message:({params:{missingProperty:t}})=>(0,g.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,g._)`{missingProperty: ${t}}`};const w={keyword:"required",type:"object",schemaType:"array",$data:true,error:b,code(t){const{gen:u,schema:p,schemaCode:b,data:w,$data:E,it:S}=t;const{opts:$}=S;if(!E&&p.length===0)return;const P=p.length>=$.loopRequired;if(S.allErrors)allErrorsMode();else exitOnErrorMode();if($.strictRequired){const u=t.parentSchema.properties;const{definedProperties:m}=t.it;for(const t of p){if((u===null||u===void 0?void 0:u[t])===undefined&&!m.has(t)){const u=S.schemaEnv.baseId+S.errSchemaPath;const p=`required property "${t}" is not defined at "${u}" (strictRequired)`;(0,v.checkStrictMode)(S,p,S.opts.strictRequired)}}}function allErrorsMode(){if(P||E){t.block$data(g.nil,loopAllRequired)}else{for(const u of p){(0,m.checkReportMissingProp)(t,u)}}}function exitOnErrorMode(){const g=u.let("missing");if(P||E){const p=u.let("valid",true);t.block$data(p,(()=>loopUntilMissing(g,p)));t.ok(p)}else{u.if((0,m.checkMissingProp)(t,p,g));(0,m.reportMissingProp)(t,g);u.else()}}function loopAllRequired(){u.forOf("prop",b,(p=>{t.setParams({missingProperty:p});u.if((0,m.noPropertyInData)(u,w,p,$.ownProperties),(()=>t.error()))}))}function loopUntilMissing(p,v){t.setParams({missingProperty:p});u.forOf(p,b,(()=>{u.assign(v,(0,m.propertyInData)(u,w,p,$.ownProperties));u.if((0,g.not)(v),(()=>{t.error();u.break()}))}),g.nil)}}};u["default"]=w},8835:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(3330);const g=p(4671);const v=p(5049);const b=p(9804);const w={message:({params:{i:t,j:u}})=>(0,g.str)`must NOT have duplicate items (items ## ${u} and ${t} are identical)`,params:({params:{i:t,j:u}})=>(0,g._)`{i: ${t}, j: ${u}}`};const E={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:w,code(t){const{gen:u,data:p,$data:w,schema:E,parentSchema:S,schemaCode:$,it:P}=t;if(!w&&!E)return;const R=u.let("valid");const x=S.items?(0,m.getSchemaTypes)(S.items):[];t.block$data(R,validateUniqueItems,(0,g._)`${$} === false`);t.ok(R);function validateUniqueItems(){const m=u.let("i",(0,g._)`${p}.length`);const v=u.let("j");t.setParams({i:m,j:v});u.assign(R,true);u.if((0,g._)`${m} > 1`,(()=>(canOptimize()?loopN:loopN2)(m,v)))}function canOptimize(){return x.length>0&&!x.some((t=>t==="object"||t==="array"))}function loopN(v,b){const w=u.name("item");const E=(0,m.checkDataTypes)(x,w,P.opts.strictNumbers,m.DataType.Wrong);const S=u.const("indices",(0,g._)`{}`);u.for((0,g._)`;${v}--;`,(()=>{u.let(w,(0,g._)`${p}[${v}]`);u.if(E,(0,g._)`continue`);if(x.length>1)u.if((0,g._)`typeof ${w} == "string"`,(0,g._)`${w} += "_"`);u.if((0,g._)`typeof ${S}[${w}] == "number"`,(()=>{u.assign(b,(0,g._)`${S}[${w}]`);t.error();u.assign(R,false).break()})).code((0,g._)`${S}[${w}] = ${v}`)}))}function loopN2(m,w){const E=(0,v.useFunc)(u,b.default);const S=u.name("outer");u.label(S).for((0,g._)`;${m}--;`,(()=>u.for((0,g._)`${w} = ${m}; ${w}--;`,(()=>u.if((0,g._)`${E}(${p}[${m}], ${p}[${w}])`,(()=>{t.error();u.assign(R,false).break(S)}))))))}}};u["default"]=E},9850:(t,u,p)=>{var m=p(6647);function retry(t,u){function run(p,g){var v=u||{};var b;if(!("randomize"in v)){v.randomize=true}b=m.operation(v);function bail(t){g(t||new Error("Aborted"))}function onError(t,u){if(t.bail){bail(t);return}if(!b.retry(t)){g(b.mainError())}else if(v.onRetry){v.onRetry(t,u)}}function runAttempt(u){var m;try{m=t(bail,u)}catch(t){onError(t,u);return}Promise.resolve(m).then(p).catch((function catchIt(t){onError(t,u)}))}b.attempt(runAttempt)}return new Promise(run)}t.exports=retry},1483:(t,u,p)=>{"use strict";const m=p(7386);const g=p(3638);const v=p(6135);const b=p(6148);const braces=(t,u={})=>{let p=[];if(Array.isArray(t)){for(const m of t){const t=braces.create(m,u);if(Array.isArray(t)){p.push(...t)}else{p.push(t)}}}else{p=[].concat(braces.create(t,u))}if(u&&u.expand===true&&u.nodupes===true){p=[...new Set(p)]}return p};braces.parse=(t,u={})=>b(t,u);braces.stringify=(t,u={})=>{if(typeof t==="string"){return m(braces.parse(t,u),u)}return m(t,u)};braces.compile=(t,u={})=>{if(typeof t==="string"){t=braces.parse(t,u)}return g(t,u)};braces.expand=(t,u={})=>{if(typeof t==="string"){t=braces.parse(t,u)}let p=v(t,u);if(u.noempty===true){p=p.filter(Boolean)}if(u.nodupes===true){p=[...new Set(p)]}return p};braces.create=(t,u={})=>{if(t===""||t.length<3){return[t]}return u.expand!==true?braces.compile(t,u):braces.expand(t,u)};t.exports=braces},3638:(t,u,p)=>{"use strict";const m=p(1430);const g=p(8886);const compile=(t,u={})=>{const walk=(t,p={})=>{const v=g.isInvalidBrace(p);const b=t.invalid===true&&u.escapeInvalid===true;const w=v===true||b===true;const E=u.escapeInvalid===true?"\\":"";let S="";if(t.isOpen===true){return E+t.value}if(t.isClose===true){console.log("node.isClose",E,t.value);return E+t.value}if(t.type==="open"){return w?E+t.value:"("}if(t.type==="close"){return w?E+t.value:")"}if(t.type==="comma"){return t.prev.type==="comma"?"":w?t.value:"|"}if(t.value){return t.value}if(t.nodes&&t.ranges>0){const p=g.reduce(t.nodes);const v=m(...p,{...u,wrap:false,toRegex:true,strictZeros:true});if(v.length!==0){return p.length>1&&v.length>1?`(${v})`:v}}if(t.nodes){for(const u of t.nodes){S+=walk(u,t)}}return S};return walk(t)};t.exports=compile},1134:t=>{"use strict";t.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"}},6135:(t,u,p)=>{"use strict";const m=p(1430);const g=p(7386);const v=p(8886);const append=(t="",u="",p=false)=>{const m=[];t=[].concat(t);u=[].concat(u);if(!u.length)return t;if(!t.length){return p?v.flatten(u).map((t=>`{${t}}`)):u}for(const g of t){if(Array.isArray(g)){for(const t of g){m.push(append(t,u,p))}}else{for(let t of u){if(p===true&&typeof t==="string")t=`{${t}}`;m.push(Array.isArray(t)?append(g,t,p):g+t)}}}return v.flatten(m)};const expand=(t,u={})=>{const p=u.rangeLimit===undefined?1e3:u.rangeLimit;const walk=(t,b={})=>{t.queue=[];let w=b;let E=b.queue;while(w.type!=="brace"&&w.type!=="root"&&w.parent){w=w.parent;E=w.queue}if(t.invalid||t.dollar){E.push(append(E.pop(),g(t,u)));return}if(t.type==="brace"&&t.invalid!==true&&t.nodes.length===2){E.push(append(E.pop(),["{}"]));return}if(t.nodes&&t.ranges>0){const b=v.reduce(t.nodes);if(v.exceedsLimit(...b,u.step,p)){throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.")}let w=m(...b,u);if(w.length===0){w=g(t,u)}E.push(append(E.pop(),w));t.nodes=[];return}const S=v.encloseBrace(t);let $=t.queue;let P=t;while(P.type!=="brace"&&P.type!=="root"&&P.parent){P=P.parent;$=P.queue}for(let u=0;u<t.nodes.length;u++){const p=t.nodes[u];if(p.type==="comma"&&t.type==="brace"){if(u===1)$.push("");$.push("");continue}if(p.type==="close"){E.push(append(E.pop(),$,S));continue}if(p.value&&p.type!=="open"){$.push(append($.pop(),p.value));continue}if(p.nodes){walk(p,t)}}return $};return v.flatten(walk(t))};t.exports=expand},6148:(t,u,p)=>{"use strict";const m=p(7386);const{MAX_LENGTH:g,CHAR_BACKSLASH:v,CHAR_BACKTICK:b,CHAR_COMMA:w,CHAR_DOT:E,CHAR_LEFT_PARENTHESES:S,CHAR_RIGHT_PARENTHESES:$,CHAR_LEFT_CURLY_BRACE:P,CHAR_RIGHT_CURLY_BRACE:R,CHAR_LEFT_SQUARE_BRACKET:x,CHAR_RIGHT_SQUARE_BRACKET:O,CHAR_DOUBLE_QUOTE:A,CHAR_SINGLE_QUOTE:k,CHAR_NO_BREAK_SPACE:T,CHAR_ZERO_WIDTH_NOBREAK_SPACE:C}=p(1134);const parse=(t,u={})=>{if(typeof t!=="string"){throw new TypeError("Expected a string")}const p=u||{};const I=typeof p.maxLength==="number"?Math.min(g,p.maxLength):g;if(t.length>I){throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${I})`)}const N={type:"root",input:t,nodes:[]};const D=[N];let j=N;let L=N;let M=0;const U=t.length;let B=0;let H=0;let z;const advance=()=>t[B++];const push=t=>{if(t.type==="text"&&L.type==="dot"){L.type="text"}if(L&&L.type==="text"&&t.type==="text"){L.value+=t.value;return}j.nodes.push(t);t.parent=j;t.prev=L;L=t;return t};push({type:"bos"});while(B<U){j=D[D.length-1];z=advance();if(z===C||z===T){continue}if(z===v){push({type:"text",value:(u.keepEscaping?z:"")+advance()});continue}if(z===O){push({type:"text",value:"\\"+z});continue}if(z===x){M++;let t;while(B<U&&(t=advance())){z+=t;if(t===x){M++;continue}if(t===v){z+=advance();continue}if(t===O){M--;if(M===0){break}}}push({type:"text",value:z});continue}if(z===S){j=push({type:"paren",nodes:[]});D.push(j);push({type:"text",value:z});continue}if(z===$){if(j.type!=="paren"){push({type:"text",value:z});continue}j=D.pop();push({type:"text",value:z});j=D[D.length-1];continue}if(z===A||z===k||z===b){const t=z;let p;if(u.keepQuotes!==true){z=""}while(B<U&&(p=advance())){if(p===v){z+=p+advance();continue}if(p===t){if(u.keepQuotes===true)z+=p;break}z+=p}push({type:"text",value:z});continue}if(z===P){H++;const t=L.value&&L.value.slice(-1)==="$"||j.dollar===true;const u={type:"brace",open:true,close:false,dollar:t,depth:H,commas:0,ranges:0,nodes:[]};j=push(u);D.push(j);push({type:"open",value:z});continue}if(z===R){if(j.type!=="brace"){push({type:"text",value:z});continue}const t="close";j=D.pop();j.close=true;push({type:t,value:z});H--;j=D[D.length-1];continue}if(z===w&&H>0){if(j.ranges>0){j.ranges=0;const t=j.nodes.shift();j.nodes=[t,{type:"text",value:m(j)}]}push({type:"comma",value:z});j.commas++;continue}if(z===E&&H>0&&j.commas===0){const t=j.nodes;if(H===0||t.length===0){push({type:"text",value:z});continue}if(L.type==="dot"){j.range=[];L.value+=z;L.type="range";if(j.nodes.length!==3&&j.nodes.length!==5){j.invalid=true;j.ranges=0;L.type="text";continue}j.ranges++;j.args=[];continue}if(L.type==="range"){t.pop();const u=t[t.length-1];u.value+=L.value+z;L=u;j.ranges--;continue}push({type:"dot",value:z});continue}push({type:"text",value:z})}do{j=D.pop();if(j.type!=="root"){j.nodes.forEach((t=>{if(!t.nodes){if(t.type==="open")t.isOpen=true;if(t.type==="close")t.isClose=true;if(!t.nodes)t.type="text";t.invalid=true}}));const t=D[D.length-1];const u=t.nodes.indexOf(j);t.nodes.splice(u,1,...j.nodes)}}while(D.length>0);push({type:"eos"});return N};t.exports=parse},7386:(t,u,p)=>{"use strict";const m=p(8886);t.exports=(t,u={})=>{const stringify=(t,p={})=>{const g=u.escapeInvalid&&m.isInvalidBrace(p);const v=t.invalid===true&&u.escapeInvalid===true;let b="";if(t.value){if((g||v)&&m.isOpenOrClose(t)){return"\\"+t.value}return t.value}if(t.value){return t.value}if(t.nodes){for(const u of t.nodes){b+=stringify(u)}}return b};return stringify(t)}},8886:(t,u)=>{"use strict";u.isInteger=t=>{if(typeof t==="number"){return Number.isInteger(t)}if(typeof t==="string"&&t.trim()!==""){return Number.isInteger(Number(t))}return false};u.find=(t,u)=>t.nodes.find((t=>t.type===u));u.exceedsLimit=(t,p,m=1,g)=>{if(g===false)return false;if(!u.isInteger(t)||!u.isInteger(p))return false;return(Number(p)-Number(t))/Number(m)>=g};u.escapeNode=(t,u=0,p)=>{const m=t.nodes[u];if(!m)return;if(p&&m.type===p||m.type==="open"||m.type==="close"){if(m.escaped!==true){m.value="\\"+m.value;m.escaped=true}}};u.encloseBrace=t=>{if(t.type!=="brace")return false;if(t.commas>>0+t.ranges>>0===0){t.invalid=true;return true}return false};u.isInvalidBrace=t=>{if(t.type!=="brace")return false;if(t.invalid===true||t.dollar)return true;if(t.commas>>0+t.ranges>>0===0){t.invalid=true;return true}if(t.open!==true||t.close!==true){t.invalid=true;return true}return false};u.isOpenOrClose=t=>{if(t.type==="open"||t.type==="close"){return true}return t.open===true||t.close===true};u.reduce=t=>t.reduce(((t,u)=>{if(u.type==="text")t.push(u.value);if(u.type==="range")u.type="text";return t}),[]);u.flatten=(...t)=>{const u=[];const flat=t=>{for(let p=0;p<t.length;p++){const m=t[p];if(Array.isArray(m)){flat(m);continue}if(m!==undefined){u.push(m)}}return u};flat(t);return u}},4791:(t,u,p)=>{"use strict";const m=p(5317);const g=p(4160);const v=p(7894);function spawn(t,u,p){const b=g(t,u,p);const w=m.spawn(b.command,b.args,b.options);v.hookChildProcess(w,b);return w}function spawnSync(t,u,p){const b=g(t,u,p);const w=m.spawnSync(b.command,b.args,b.options);w.error=w.error||v.verifyENOENTSync(w.status,b);return w}t.exports=spawn;t.exports.spawn=spawn;t.exports.sync=spawnSync;t.exports._parse=g;t.exports._enoent=v},7894:t=>{"use strict";const u=process.platform==="win32";function notFoundError(t,u){return Object.assign(new Error(`${u} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${u} ${t.command}`,path:t.command,spawnargs:t.args})}function hookChildProcess(t,p){if(!u){return}const m=t.emit;t.emit=function(u,g){if(u==="exit"){const u=verifyENOENT(g,p);if(u){return m.call(t,"error",u)}}return m.apply(t,arguments)}}function verifyENOENT(t,p){if(u&&t===1&&!p.file){return notFoundError(p.original,"spawn")}return null}function verifyENOENTSync(t,p){if(u&&t===1&&!p.file){return notFoundError(p.original,"spawnSync")}return null}t.exports={hookChildProcess:hookChildProcess,verifyENOENT:verifyENOENT,verifyENOENTSync:verifyENOENTSync,notFoundError:notFoundError}},4160:(t,u,p)=>{"use strict";const m=p(6928);const g=p(2015);const v=p(1);const b=p(748);const w=process.platform==="win32";const E=/\.(?:com|exe)$/i;const S=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function detectShebang(t){t.file=g(t);const u=t.file&&b(t.file);if(u){t.args.unshift(t.file);t.command=u;return g(t)}return t.file}function parseNonShell(t){if(!w){return t}const u=detectShebang(t);const p=!E.test(u);if(t.options.forceShell||p){const p=S.test(u);t.command=m.normalize(t.command);t.command=v.command(t.command);t.args=t.args.map((t=>v.argument(t,p)));const g=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${g}"`];t.command=process.env.comspec||"cmd.exe";t.options.windowsVerbatimArguments=true}return t}function parse(t,u,p){if(u&&!Array.isArray(u)){p=u;u=null}u=u?u.slice(0):[];p=Object.assign({},p);const m={command:t,args:u,options:p,file:undefined,original:{command:t,args:u}};return p.shell?m:parseNonShell(m)}t.exports=parse},1:t=>{"use strict";const u=/([()\][%!^"`<>&|;, *?])/g;function escapeCommand(t){t=t.replace(u,"^$1");return t}function escapeArgument(t,p){t=`${t}`;t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"');t=t.replace(/(?=(\\+?)?)\1$/,"$1$1");t=`"${t}"`;t=t.replace(u,"^$1");if(p){t=t.replace(u,"^$1")}return t}t.exports.command=escapeCommand;t.exports.argument=escapeArgument},748:(t,u,p)=>{"use strict";const m=p(9896);const g=p(8309);function readShebang(t){const u=150;const p=Buffer.alloc(u);let v;try{v=m.openSync(t,"r");m.readSync(v,p,0,u,0);m.closeSync(v)}catch(t){}return g(p.toString())}t.exports=readShebang},2015:(t,u,p)=>{"use strict";const m=p(6928);const g=p(3969);const v=p(6334);function resolveCommandAttempt(t,u){const p=t.options.env||process.env;const b=process.cwd();const w=t.options.cwd!=null;const E=w&&process.chdir!==undefined&&!process.chdir.disabled;if(E){try{process.chdir(t.options.cwd)}catch(t){}}let S;try{S=g.sync(t.command,{path:p[v({env:p})],pathExt:u?m.delimiter:undefined})}catch(t){}finally{if(E){process.chdir(b)}}if(S){S=m.resolve(w?t.options.cwd:"",S)}return S}function resolveCommand(t){return resolveCommandAttempt(t)||resolveCommandAttempt(t,true)}t.exports=resolveCommand},6345:t=>{"use strict";
@@ -69,4 +69,4 @@ var m=p(181);var g=m.Buffer;function copyProps(t,u){for(var p in t){u[p]=t[p]}}i
69
69
  *
70
70
  * Copyright (c) 2015-present, Jon Schlinkert.
71
71
  * Released under the MIT License.
72
- */const m=p(7311);const toRegexRange=(t,u,p)=>{if(m(t)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(u===void 0||t===u){return String(t)}if(m(u)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let g={relaxZeros:true,...p};if(typeof g.strictZeros==="boolean"){g.relaxZeros=g.strictZeros===false}let v=String(g.relaxZeros);let b=String(g.shorthand);let w=String(g.capture);let E=String(g.wrap);let S=t+":"+u+"="+v+b+w+E;if(toRegexRange.cache.hasOwnProperty(S)){return toRegexRange.cache[S].result}let $=Math.min(t,u);let P=Math.max(t,u);if(Math.abs($-P)===1){let p=t+"|"+u;if(g.capture){return`(${p})`}if(g.wrap===false){return p}return`(?:${p})`}let R=hasPadding(t)||hasPadding(u);let x={min:t,max:u,a:$,b:P};let O=[];let A=[];if(R){x.isPadded=R;x.maxLen=String(x.max).length}if($<0){let t=P<0?Math.abs(P):1;A=splitToPatterns(t,Math.abs($),x,g);$=x.a=0}if(P>=0){O=splitToPatterns($,P,x,g)}x.negatives=A;x.positives=O;x.result=collatePatterns(A,O,g);if(g.capture===true){x.result=`(${x.result})`}else if(g.wrap!==false&&O.length+A.length>1){x.result=`(?:${x.result})`}toRegexRange.cache[S]=x;return x.result};function collatePatterns(t,u,p){let m=filterPatterns(t,u,"-",false,p)||[];let g=filterPatterns(u,t,"",false,p)||[];let v=filterPatterns(t,u,"-?",true,p)||[];let b=m.concat(v).concat(g);return b.join("|")}function splitToRanges(t,u){let p=1;let m=1;let g=countNines(t,p);let v=new Set([u]);while(t<=g&&g<=u){v.add(g);p+=1;g=countNines(t,p)}g=countZeros(u+1,m)-1;while(t<g&&g<=u){v.add(g);m+=1;g=countZeros(u+1,m)-1}v=[...v];v.sort(compare);return v}function rangeToPattern(t,u,p){if(t===u){return{pattern:t,count:[],digits:0}}let m=zip(t,u);let g=m.length;let v="";let b=0;for(let t=0;t<g;t++){let[u,g]=m[t];if(u===g){v+=u}else if(u!=="0"||g!=="9"){v+=toCharacterClass(u,g,p)}else{b++}}if(b){v+=p.shorthand===true?"\\d":"[0-9]"}return{pattern:v,count:[b],digits:g}}function splitToPatterns(t,u,p,m){let g=splitToRanges(t,u);let v=[];let b=t;let w;for(let t=0;t<g.length;t++){let u=g[t];let E=rangeToPattern(String(b),String(u),m);let S="";if(!p.isPadded&&w&&w.pattern===E.pattern){if(w.count.length>1){w.count.pop()}w.count.push(E.count[0]);w.string=w.pattern+toQuantifier(w.count);b=u+1;continue}if(p.isPadded){S=padZeros(u,p,m)}E.string=S+E.pattern+toQuantifier(E.count);v.push(E);b=u+1;w=E}return v}function filterPatterns(t,u,p,m,g){let v=[];for(let g of t){let{string:t}=g;if(!m&&!contains(u,"string",t)){v.push(p+t)}if(m&&contains(u,"string",t)){v.push(p+t)}}return v}function zip(t,u){let p=[];for(let m=0;m<t.length;m++)p.push([t[m],u[m]]);return p}function compare(t,u){return t>u?1:u>t?-1:0}function contains(t,u,p){return t.some((t=>t[u]===p))}function countNines(t,u){return Number(String(t).slice(0,-u)+"9".repeat(u))}function countZeros(t,u){return t-t%Math.pow(10,u)}function toQuantifier(t){let[u=0,p=""]=t;if(p||u>1){return`{${u+(p?","+p:"")}}`}return""}function toCharacterClass(t,u,p){return`[${t}${u-t===1?"":"-"}${u}]`}function hasPadding(t){return/^-?(0+)\d/.test(t)}function padZeros(t,u,p){if(!u.isPadded){return t}let m=Math.abs(u.maxLen-String(t).length);let g=p.relaxZeros!==false;switch(m){case 0:return"";case 1:return g?"0?":"0";case 2:return g?"0{0,2}":"00";default:{return g?`0{0,${m}}`:`0{${m}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};t.exports=toRegexRange},1083:(t,u,p)=>{const{URL:m}=p(7016);const{join:g}=p(6928);const v=p(9896);const{promisify:b}=p(9023);const{tmpdir:w}=p(857);const E=p(2804);const S=b(v.writeFile);const $=b(v.mkdir);const P=b(v.readFile);const compareVersions=(t,u)=>t.localeCompare(u,"en-US",{numeric:true});const encode=t=>encodeURIComponent(t).replace(/^%40/,"@");const getFile=async(t,u)=>{const p=w();const m=g(p,"update-check");if(!v.existsSync(m)){await $(m)}let b=`${t.name}-${u}.json`;if(t.scope){b=`${t.scope}-${b}`}return g(m,b)};const evaluateCache=async(t,u,p)=>{if(v.existsSync(t)){const m=await P(t,"utf8");const{lastUpdate:g,latest:v}=JSON.parse(m);const b=g+p;if(b>u){return{shouldCheck:false,latest:v}}}return{shouldCheck:true,latest:null}};const updateCache=async(t,u,p)=>{const m=JSON.stringify({latest:u,lastUpdate:p});await S(t,m,"utf8")};const loadPackage=(t,u)=>new Promise(((m,g)=>{const v={host:t.hostname,path:t.pathname,port:t.port,headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},timeout:2e3};if(u){v.headers.authorization=`${u.type} ${u.token}`}const{get:b}=p(t.protocol==="https:"?5692:8611);b(v,(t=>{const{statusCode:u}=t;if(u!==200){const p=new Error(`Request failed with code ${u}`);p.code=u;g(p);t.resume();return}let p="";t.setEncoding("utf8");t.on("data",(t=>{p+=t}));t.on("end",(()=>{try{const t=JSON.parse(p);m(t)}catch(t){g(t)}}))})).on("error",g).on("timeout",g)}));const getMostRecent=async({full:t,scope:u},g)=>{const v=E(u);const b=new m(t,v);let w=null;try{w=await loadPackage(b)}catch(t){if(t.code&&String(t.code).startsWith(4)){const t=p(373);const u=t(v,{recursive:true});w=await loadPackage(b,u)}else{throw t}}const S=w["dist-tags"][g];if(!S){throw new Error(`Distribution tag ${g} is not available`)}return S};const R={interval:36e5,distTag:"latest"};const getDetails=t=>{const u={full:encode(t)};if(t.includes("/")){const p=t.split("/");u.scope=p[0];u.name=p[1]}else{u.scope=null;u.name=t}return u};t.exports=async(t,u)=>{if(typeof t!=="object"){throw new Error("The first parameter should be your package.json file content")}const p=getDetails(t.name);const m=Date.now();const{distTag:g,interval:v}=Object.assign({},R,u);const b=await getFile(p,g);let w=null;let E=true;({shouldCheck:E,latest:w}=await evaluateCache(b,m,v));if(E){w=await getMostRecent(p,g);await updateCache(b,w,m)}const S=compareVersions(t.version,w);if(S===-1){return{latest:w,fromCache:!E}}return null}},3969:(t,u,p)=>{const m=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys";const g=p(6928);const v=m?";":":";const b=p(6173);const getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"});const getPathInfo=(t,u)=>{const p=u.colon||v;const g=t.match(/\//)||m&&t.match(/\\/)?[""]:[...m?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(p)];const b=m?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"";const w=m?b.split(p):[""];if(m){if(t.indexOf(".")!==-1&&w[0]!=="")w.unshift("")}return{pathEnv:g,pathExt:w,pathExtExe:b}};const which=(t,u,p)=>{if(typeof u==="function"){p=u;u={}}if(!u)u={};const{pathEnv:m,pathExt:v,pathExtExe:w}=getPathInfo(t,u);const E=[];const step=p=>new Promise(((v,b)=>{if(p===m.length)return u.all&&E.length?v(E):b(getNotFoundError(t));const w=m[p];const S=/^".*"$/.test(w)?w.slice(1,-1):w;const $=g.join(S,t);const P=!S&&/^\.[\\\/]/.test(t)?t.slice(0,2)+$:$;v(subStep(P,p,0))}));const subStep=(t,p,m)=>new Promise(((g,S)=>{if(m===v.length)return g(step(p+1));const $=v[m];b(t+$,{pathExt:w},((v,b)=>{if(!v&&b){if(u.all)E.push(t+$);else return g(t+$)}return g(subStep(t,p,m+1))}))}));return p?step(0).then((t=>p(null,t)),p):step(0)};const whichSync=(t,u)=>{u=u||{};const{pathEnv:p,pathExt:m,pathExtExe:v}=getPathInfo(t,u);const w=[];for(let E=0;E<p.length;E++){const S=p[E];const $=/^".*"$/.test(S)?S.slice(1,-1):S;const P=g.join($,t);const R=!$&&/^\.[\\\/]/.test(t)?t.slice(0,2)+P:P;for(let t=0;t<m.length;t++){const p=R+m[t];try{const t=b.sync(p,{pathExt:v});if(t){if(u.all)w.push(p);else return p}}catch(t){}}}if(u.all&&w.length)return w;if(u.nothrow)return null;throw getNotFoundError(t)};t.exports=which;which.sync=whichSync},779:(t,u)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.formatNames=u.fastFormats=u.fullFormats=void 0;function fmtDef(t,u){return{validate:t,compare:u}}u.fullFormats={date:fmtDef(date,compareDate),time:fmtDef(getTime(true),compareTime),"date-time":fmtDef(getDateTime(true),compareDateTime),"iso-time":fmtDef(getTime(),compareIsoTime),"iso-date-time":fmtDef(getDateTime(),compareIsoDateTime),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uri,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:regex,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:byte,int32:{type:"number",validate:validateInt32},int64:{type:"number",validate:validateInt64},float:{type:"number",validate:validateNumber},double:{type:"number",validate:validateNumber},password:true,binary:true};u.fastFormats={...u.fullFormats,date:fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,compareDate),time:fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareTime),"date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareDateTime),"iso-time":fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoTime),"iso-date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoDateTime),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};u.formatNames=Object.keys(u.fullFormats);function isLeapYear(t){return t%4===0&&(t%100!==0||t%400===0)}const p=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;const m=[0,31,28,31,30,31,30,31,31,30,31,30,31];function date(t){const u=p.exec(t);if(!u)return false;const g=+u[1];const v=+u[2];const b=+u[3];return v>=1&&v<=12&&b>=1&&b<=(v===2&&isLeapYear(g)?29:m[v])}function compareDate(t,u){if(!(t&&u))return undefined;if(t>u)return 1;if(t<u)return-1;return 0}const g=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function getTime(t){return function time(u){const p=g.exec(u);if(!p)return false;const m=+p[1];const v=+p[2];const b=+p[3];const w=p[4];const E=p[5]==="-"?-1:1;const S=+(p[6]||0);const $=+(p[7]||0);if(S>23||$>59||t&&!w)return false;if(m<=23&&v<=59&&b<60)return true;const P=v-$*E;const R=m-S*E-(P<0?1:0);return(R===23||R===-1)&&(P===59||P===-1)&&b<61}}function compareTime(t,u){if(!(t&&u))return undefined;const p=new Date("2020-01-01T"+t).valueOf();const m=new Date("2020-01-01T"+u).valueOf();if(!(p&&m))return undefined;return p-m}function compareIsoTime(t,u){if(!(t&&u))return undefined;const p=g.exec(t);const m=g.exec(u);if(!(p&&m))return undefined;t=p[1]+p[2]+p[3];u=m[1]+m[2]+m[3];if(t>u)return 1;if(t<u)return-1;return 0}const v=/t|\s/i;function getDateTime(t){const u=getTime(t);return function date_time(t){const p=t.split(v);return p.length===2&&date(p[0])&&u(p[1])}}function compareDateTime(t,u){if(!(t&&u))return undefined;const p=new Date(t).valueOf();const m=new Date(u).valueOf();if(!(p&&m))return undefined;return p-m}function compareIsoDateTime(t,u){if(!(t&&u))return undefined;const[p,m]=t.split(v);const[g,b]=u.split(v);const w=compareDate(p,g);if(w===undefined)return undefined;return w||compareTime(m,b)}const b=/\/|:/;const w=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function uri(t){return b.test(t)&&w.test(t)}const E=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function byte(t){E.lastIndex=0;return E.test(t)}const S=-(2**31);const $=2**31-1;function validateInt32(t){return Number.isInteger(t)&&t<=$&&t>=S}function validateInt64(t){return Number.isInteger(t)}function validateNumber(){return true}const P=/[^\\]\\Z/;function regex(t){if(P.test(t))return false;try{new RegExp(t);return true}catch(t){return false}}},2815:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});const m=p(779);const g=p(1284);const v=p(4671);const b=new v.Name("fullFormats");const w=new v.Name("fastFormats");const formatsPlugin=(t,u={keywords:true})=>{if(Array.isArray(u)){addFormats(t,u,m.fullFormats,b);return t}const[p,v]=u.mode==="fast"?[m.fastFormats,w]:[m.fullFormats,b];const E=u.formats||m.formatNames;addFormats(t,E,p,v);if(u.keywords)(0,g.default)(t);return t};formatsPlugin.get=(t,u="full")=>{const p=u==="fast"?m.fastFormats:m.fullFormats;const g=p[t];if(!g)throw new Error(`Unknown format "${t}"`);return g};function addFormats(t,u,p,m){var g;var b;(g=(b=t.opts.code).formats)!==null&&g!==void 0?g:b.formats=(0,v._)`require("ajv-formats/dist/formats").${m}`;for(const m of u)t.addFormat(m,p[m])}t.exports=u=formatsPlugin;Object.defineProperty(u,"__esModule",{value:true});u["default"]=formatsPlugin},1284:(t,u,p)=>{"use strict";Object.defineProperty(u,"__esModule",{value:true});u.formatLimitDefinition=void 0;const m=p(5984);const g=p(4671);const v=g.operators;const b={formatMaximum:{okStr:"<=",ok:v.LTE,fail:v.GT},formatMinimum:{okStr:">=",ok:v.GTE,fail:v.LT},formatExclusiveMaximum:{okStr:"<",ok:v.LT,fail:v.GTE},formatExclusiveMinimum:{okStr:">",ok:v.GT,fail:v.LTE}};const w={message:({keyword:t,schemaCode:u})=>(0,g.str)`should be ${b[t].okStr} ${u}`,params:({keyword:t,schemaCode:u})=>(0,g._)`{comparison: ${b[t].okStr}, limit: ${u}}`};u.formatLimitDefinition={keyword:Object.keys(b),type:"string",schemaType:"string",$data:true,error:w,code(t){const{gen:u,data:p,schemaCode:v,keyword:w,it:E}=t;const{opts:S,self:$}=E;if(!S.validateFormats)return;const P=new m.KeywordCxt(E,$.RULES.all.format.definition,"format");if(P.$data)validate$DataFormat();else validateFormat();function validate$DataFormat(){const p=u.scopeValue("formats",{ref:$.formats,code:S.code.formats});const m=u.const("fmt",(0,g._)`${p}[${P.schemaCode}]`);t.fail$data((0,g.or)((0,g._)`typeof ${m} != "object"`,(0,g._)`${m} instanceof RegExp`,(0,g._)`typeof ${m}.compare != "function"`,compareCode(m)))}function validateFormat(){const p=P.schema;const m=$.formats[p];if(!m||m===true)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function"){throw new Error(`"${w}": format "${p}" does not define "compare" function`)}const v=u.scopeValue("formats",{key:p,ref:m,code:S.code.formats?(0,g._)`${S.code.formats}${(0,g.getProperty)(p)}`:undefined});t.fail$data(compareCode(v))}function compareCode(t){return(0,g._)`${t}.compare(${p}, ${v}) ${b[w].fail} 0`}},dependencies:["format"]};const formatLimitPlugin=t=>{t.addKeyword(u.formatLimitDefinition);return t};u["default"]=formatLimitPlugin},6395:(t,u,p)=>{"use strict";const m=p(2040);const g=process.env;Object.defineProperty(u,"_vendors",{value:m.map((function(t){return t.constant}))});u.name=null;u.isPR=null;m.forEach((function(t){const p=Array.isArray(t.env)?t.env:[t.env];const m=p.every((function(t){return checkEnv(t)}));u[t.constant]=m;if(!m){return}u.name=t.name;switch(typeof t.pr){case"string":u.isPR=!!g[t.pr];break;case"object":if("env"in t.pr){u.isPR=t.pr.env in g&&g[t.pr.env]!==t.pr.ne}else if("any"in t.pr){u.isPR=t.pr.any.some((function(t){return!!g[t]}))}else{u.isPR=checkEnv(t.pr)}break;default:u.isPR=null}}));u.isCI=!!(g.CI!=="false"&&(g.BUILD_ID||g.BUILD_NUMBER||g.CI||g.CI_APP_ID||g.CI_BUILD_ID||g.CI_BUILD_NUMBER||g.CI_NAME||g.CONTINUOUS_INTEGRATION||g.RUN_ID||u.name||false));function checkEnv(t){if(typeof t==="string")return!!g[t];if("env"in t){return g[t.env]&&g[t.env].includes(t.includes)}if("any"in t){return t.any.some((function(t){return!!g[t]}))}return Object.keys(t).every((function(u){return g[u]===t[u]}))}},7825:(t,u,p)=>{"use strict";const{builtinModules:m}=p(3339);var g=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var v=["node_modules","favicon.ico"];function validate(t){var u=[];var p=[];if(t===null){p.push("name cannot be null");return done(u,p)}if(t===undefined){p.push("name cannot be undefined");return done(u,p)}if(typeof t!=="string"){p.push("name must be a string");return done(u,p)}if(!t.length){p.push("name length must be greater than zero")}if(t.match(/^\./)){p.push("name cannot start with a period")}if(t.match(/^_/)){p.push("name cannot start with an underscore")}if(t.trim()!==t){p.push("name cannot contain leading or trailing spaces")}v.forEach((function(u){if(t.toLowerCase()===u){p.push(u+" is a blacklisted name")}}));if(m.includes(t.toLowerCase())){u.push(t+" is a core module name")}if(t.length>214){u.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){u.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){u.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var b=t.match(g);if(b){var w=b[1];var E=b[2];if(encodeURIComponent(w)===w&&encodeURIComponent(E)===E){return done(u,p)}}p.push("name can only contain URL-friendly characters")}return done(u,p)}var done=function(t,u){var p={validForNewPackages:u.length===0&&t.length===0,validForOldPackages:u.length===0,warnings:t,errors:u};if(!p.warnings.length){delete p.warnings}if(!p.errors.length){delete p.errors}return p};t.exports=validate},181:t=>{"use strict";t.exports=require("buffer")},5317:t=>{"use strict";t.exports=require("child_process")},4434:t=>{"use strict";t.exports=require("events")},9896:t=>{"use strict";t.exports=require("fs")},8611:t=>{"use strict";t.exports=require("http")},5692:t=>{"use strict";t.exports=require("https")},3339:t=>{"use strict";t.exports=require("module")},1421:t=>{"use strict";t.exports=require("node:child_process")},8474:t=>{"use strict";t.exports=require("node:events")},3024:t=>{"use strict";t.exports=require("node:fs")},6760:t=>{"use strict";t.exports=require("node:path")},1708:t=>{"use strict";t.exports=require("node:process")},857:t=>{"use strict";t.exports=require("os")},6928:t=>{"use strict";t.exports=require("path")},3785:t=>{"use strict";t.exports=require("readline")},2203:t=>{"use strict";t.exports=require("stream")},2018:t=>{"use strict";t.exports=require("tty")},7016:t=>{"use strict";t.exports=require("url")},9023:t=>{"use strict";t.exports=require("util")},3996:(t,u,p)=>{"use strict";const{normalizeIPv6:m,removeDotSegments:g,recomposeAuthority:v,normalizePercentEncoding:b,normalizePathEncoding:w,escapePreservingEscapes:E,reescapeHostDelimiters:S,isIPv4:$,nonSimpleDomain:P}=p(9073);const{SCHEMES:R,getSchemeHandler:x}=p(2e3);function normalize(t,u){if(typeof t==="string"){t=normalizeString(t,u)}else if(typeof t==="object"){t=parse(serialize(t,u),u)}return t}function resolve(t,u,p){const m=p?Object.assign({scheme:"null"},p):{scheme:"null"};const{parsed:g,malformedAuthorityOrPort:v}=parseWithStatus(t,m);const{parsed:b,malformedAuthorityOrPort:w}=parseWithStatus(u,m);if(v||w){throw new Error(g.error||b.error||"URI is malformed.")}const E=resolveComponent(g,b,m,true);m.skipEscape=true;return serialize(E,m)}function resolveComponent(t,u,p,m){const v={};if(!m){t=parse(serialize(t,p),p);u=parse(serialize(u,p),p)}p=p||{};if(!p.tolerant&&u.scheme){v.scheme=u.scheme;v.userinfo=u.userinfo;v.host=u.host;v.port=u.port;v.path=g(u.path||"");v.query=u.query}else{if(u.userinfo!==undefined||u.host!==undefined||u.port!==undefined){v.userinfo=u.userinfo;v.host=u.host;v.port=u.port;v.path=g(u.path||"");v.query=u.query}else{if(!u.path){v.path=t.path;if(u.query!==undefined){v.query=u.query}else{v.query=t.query}}else{if(u.path[0]==="/"){v.path=g(u.path)}else{if((t.userinfo!==undefined||t.host!==undefined||t.port!==undefined)&&!t.path){v.path="/"+u.path}else if(!t.path){v.path=u.path}else{v.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+u.path}v.path=g(v.path)}v.query=u.query}v.userinfo=t.userinfo;v.host=t.host;v.port=t.port}v.scheme=t.scheme}v.fragment=u.fragment;return v}function equal(t,u,p){const m=normalizeComparableURI(t,p);const g=normalizeComparableURI(u,p);return m!==undefined&&g!==undefined&&m.toLowerCase()===g.toLowerCase()}function serialize(t,u){const p={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""};const m=Object.assign({},u);const w=[];const S=x(m.scheme||p.scheme);if(S&&S.serialize)S.serialize(p,m);if(p.path!==undefined){if(!m.skipEscape){p.path=E(p.path);if(p.scheme!==undefined){p.path=p.path.split("%3A").join(":")}}else{p.path=b(p.path)}}if(m.reference!=="suffix"&&p.scheme){w.push(p.scheme,":")}const $=v(p);if($!==undefined){if(m.reference!=="suffix"){w.push("//")}w.push($);if(p.path&&p.path[0]!=="/"){w.push("/")}}if(p.path!==undefined){let t=p.path;if(!m.absolutePath&&(!S||!S.absolutePath)){t=g(t)}if($===undefined&&t[0]==="/"&&t[1]==="/"){t="/%2F"+t.slice(2)}w.push(t)}if(p.query!==undefined){w.push("?",p.query)}if(p.fragment!==undefined){w.push("#",p.fragment)}return w.join("")}const O=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;const A=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/;const k=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function getParseError(t,u){if(u[2]!==undefined&&t.path&&t.path[0]!=="/"){return'URI path must start with "/" when authority is present.'}if(typeof t.port==="number"&&(t.port<0||t.port>65535)){return"URI port is malformed."}return undefined}function parseWithStatus(t,u){const p=Object.assign({},u);const g={scheme:undefined,userinfo:undefined,host:"",port:undefined,path:"",query:undefined,fragment:undefined};let v=false;let b=false;if(p.reference==="suffix"){if(p.scheme){t=p.scheme+":"+t}else{t="//"+t}}const E=t.match(A);if(E!==null&&E[1].indexOf("\\")!==-1){g.error="URI authority must not contain a literal backslash.";v=true}const R=t.match(k);if(R!==null){const t=R[1];const u=t.replace(/[\t\n\r]/g,"");if(u.length>=2){if(u.slice(0,2)!=="//"){g.error=g.error||"URI authority must not contain a literal backslash.";v=true}else if(t.length!==u.length){g.error=g.error||"URI authority introducer must not contain whitespace.";v=true}}}const T=t.match(O);if(T){g.scheme=T[1];g.userinfo=T[3];g.host=T[4];g.port=parseInt(T[5],10);g.path=T[6]||"";g.query=T[7];g.fragment=T[8];if(isNaN(g.port)){g.port=T[5]}const u=getParseError(g,T);if(u!==undefined){g.error=g.error||u;v=true}if(g.host){const t=$(g.host);if(t===false){const t=m(g.host);g.host=t.host.toLowerCase();b=t.isIPV6}else{b=true}}if(g.scheme===undefined&&g.userinfo===undefined&&g.host===undefined&&g.port===undefined&&g.query===undefined&&!g.path){g.reference="same-document"}else if(g.scheme===undefined){g.reference="relative"}else if(g.fragment===undefined){g.reference="absolute"}else{g.reference="uri"}if(p.reference&&p.reference!=="suffix"&&p.reference!==g.reference){g.error=g.error||"URI is not a "+p.reference+" reference."}const E=x(p.scheme||g.scheme);if(!p.unicodeSupport&&(!E||!E.unicodeSupport)){if(g.host&&(p.domainHost||E&&E.domainHost)&&b===false&&P(g.host)){try{g.host=new URL("http://"+g.host).hostname}catch(t){g.error=g.error||"Host's domain name can not be converted to ASCII: "+t}}}if(!E||E&&!E.skipNormalize){if(t.indexOf("%")!==-1){if(g.scheme!==undefined){g.scheme=unescape(g.scheme)}if(g.host!==undefined){g.host=S(unescape(g.host),b)}}if(g.path){g.path=w(g.path)}if(g.fragment){try{g.fragment=encodeURI(decodeURIComponent(g.fragment))}catch{g.error=g.error||"URI malformed"}}}if(E&&E.parse){E.parse(g,p)}}else{g.error=g.error||"URI can not be parsed."}return{parsed:g,malformedAuthorityOrPort:v}}function parse(t,u){return parseWithStatus(t,u).parsed}function normalizeString(t,u){return normalizeStringWithStatus(t,u).normalized}function normalizeStringWithStatus(t,u){const{parsed:p,malformedAuthorityOrPort:m}=parseWithStatus(t,u);return{normalized:m?t:serialize(p,u),malformedAuthorityOrPort:m}}function normalizeComparableURI(t,u){if(typeof t==="string"){const{normalized:p,malformedAuthorityOrPort:m}=normalizeStringWithStatus(t,u);return m?undefined:p}if(typeof t==="object"){return serialize(t,u)}}const T={SCHEMES:R,normalize:normalize,resolve:resolve,resolveComponent:resolveComponent,equal:equal,serialize:serialize,parse:parse};t.exports=T;t.exports["default"]=T;t.exports.fastUri=T},2e3:(t,u,p)=>{"use strict";const{isUUID:m}=p(9073);const g=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;const v=["http","https","ws","wss","urn","urn:uuid"];function isValidSchemeName(t){return v.indexOf(t)!==-1}function wsIsSecure(t){if(t.secure===true){return true}else if(t.secure===false){return false}else if(t.scheme){return t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S")}else{return false}}function httpParse(t){if(!t.host){t.error=t.error||"HTTP URIs must have a host."}return t}function httpSerialize(t){const u=String(t.scheme).toLowerCase()==="https";if(t.port===(u?443:80)||t.port===""){t.port=undefined}if(!t.path){t.path="/"}return t}function wsParse(t){t.secure=wsIsSecure(t);t.resourceName=(t.path||"/")+(t.query?"?"+t.query:"");t.path=undefined;t.query=undefined;return t}function wsSerialize(t){if(t.port===(wsIsSecure(t)?443:80)||t.port===""){t.port=undefined}if(typeof t.secure==="boolean"){t.scheme=t.secure?"wss":"ws";t.secure=undefined}if(t.resourceName){const[u,p]=t.resourceName.split("?");t.path=u&&u!=="/"?u:undefined;t.query=p;t.resourceName=undefined}t.fragment=undefined;return t}function urnParse(t,u){if(!t.path){t.error="URN can not be parsed";return t}const p=t.path.match(g);if(p){const m=u.scheme||t.scheme||"urn";t.nid=p[1].toLowerCase();t.nss=p[2];const g=`${m}:${u.nid||t.nid}`;const v=getSchemeHandler(g);t.path=undefined;if(v){t=v.parse(t,u)}}else{t.error=t.error||"URN can not be parsed."}return t}function urnSerialize(t,u){if(t.nid===undefined){throw new Error("URN without nid cannot be serialized")}const p=u.scheme||t.scheme||"urn";const m=t.nid.toLowerCase();const g=`${p}:${u.nid||m}`;const v=getSchemeHandler(g);if(v){t=v.serialize(t,u)}const b=t;const w=t.nss;b.path=`${m||u.nid}:${w}`;u.skipEscape=true;return b}function urnuuidParse(t,u){const p=t;p.uuid=p.nss;p.nss=undefined;if(!u.tolerant&&(!p.uuid||!m(p.uuid))){p.error=p.error||"UUID is not valid."}return p}function urnuuidSerialize(t){const u=t;u.nss=(t.uuid||"").toLowerCase();return u}const b={scheme:"http",domainHost:true,parse:httpParse,serialize:httpSerialize};const w={scheme:"https",domainHost:b.domainHost,parse:httpParse,serialize:httpSerialize};const E={scheme:"ws",domainHost:true,parse:wsParse,serialize:wsSerialize};const S={scheme:"wss",domainHost:E.domainHost,parse:E.parse,serialize:E.serialize};const $={scheme:"urn",parse:urnParse,serialize:urnSerialize,skipNormalize:true};const P={scheme:"urn:uuid",parse:urnuuidParse,serialize:urnuuidSerialize,skipNormalize:true};const R={http:b,https:w,ws:E,wss:S,urn:$,"urn:uuid":P};Object.setPrototypeOf(R,null);function getSchemeHandler(t){return t&&(R[t]||R[t.toLowerCase()])||undefined}t.exports={wsIsSecure:wsIsSecure,SCHEMES:R,isValidSchemeName:isValidSchemeName,getSchemeHandler:getSchemeHandler}},9073:t=>{"use strict";const u=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);const p=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);const m=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);const g=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);const v=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function stringArrayToHexStripped(t){let u="";let p=0;let m=0;for(m=0;m<t.length;m++){p=t[m].charCodeAt(0);if(p===48){continue}if(!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102)){return""}u+=t[m];break}for(m+=1;m<t.length;m++){p=t[m].charCodeAt(0);if(!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102)){return""}u+=t[m]}return u}const b=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function consumeIsZone(t){t.length=0;return true}function consumeHextets(t,u,p){if(t.length){const m=stringArrayToHexStripped(t);if(m!==""){u.push(m)}else{p.error=true;return false}t.length=0}return true}function getIPV6(t){let u=0;const p={error:false,address:"",zone:""};const m=[];const g=[];let v=false;let b=false;let w=consumeHextets;for(let E=0;E<t.length;E++){const S=t[E];if(S==="["||S==="]"){continue}if(S===":"){if(v===true){b=true}if(!w(g,m,p)){break}if(++u>7){p.error=true;break}if(E>0&&t[E-1]===":"){v=true}m.push(":");continue}else if(S==="%"){if(!w(g,m,p)){break}w=consumeIsZone}else{g.push(S);continue}}if(g.length){if(w===consumeIsZone){p.zone=g.join("")}else if(b){m.push(g.join(""))}else{m.push(stringArrayToHexStripped(g))}}p.address=m.join("");return p}function normalizeIPv6(t){if(findToken(t,":")<2){return{host:t,isIPV6:false}}const u=getIPV6(t);if(!u.error){let t=u.address;let p=u.address;if(u.zone){t+="%"+u.zone;p+="%25"+u.zone}return{host:t,isIPV6:true,escapedHost:p}}else{return{host:t,isIPV6:false}}}function findToken(t,u){let p=0;for(let m=0;m<t.length;m++){if(t[m]===u)p++}return p}function removeDotSegments(t){let u=t;const p=[];let m=-1;let g=0;while(g=u.length){if(g===1){if(u==="."){break}else if(u==="/"){p.push("/");break}else{p.push(u);break}}else if(g===2){if(u[0]==="."){if(u[1]==="."){break}else if(u[1]==="/"){u=u.slice(2);continue}}else if(u[0]==="/"){if(u[1]==="."||u[1]==="/"){p.push("/");break}}}else if(g===3){if(u==="/.."){if(p.length!==0){p.pop()}p.push("/");break}}if(u[0]==="."){if(u[1]==="."){if(u[2]==="/"){u=u.slice(3);continue}}else if(u[1]==="/"){u=u.slice(2);continue}}else if(u[0]==="/"){if(u[1]==="."){if(u[2]==="/"){u=u.slice(2);continue}else if(u[2]==="."){if(u[3]==="/"){u=u.slice(3);if(p.length!==0){p.pop()}continue}}}}if((m=u.indexOf("/",1))===-1){p.push(u);break}else{p.push(u.slice(0,m));u=u.slice(m)}}return p.join("")}const w={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"};const E=/[@/?#:]/g;const S=/[@/?#]/g;function reescapeHostDelimiters(t,u){const p=u?S:E;p.lastIndex=0;return t.replace(p,(t=>w[t]))}function normalizePercentEncoding(t,u=false){if(t.indexOf("%")===-1){return t}let p="";for(let v=0;v<t.length;v++){if(t[v]==="%"&&v+2<t.length){const b=t.slice(v+1,v+3);if(m(b)){const t=b.toUpperCase();const m=String.fromCharCode(parseInt(t,16));if(u&&g(m)){p+=m}else{p+="%"+t}v+=2;continue}}p+=t[v]}return p}function normalizePathEncoding(t){let u="";for(let p=0;p<t.length;p++){if(t[p]==="%"&&p+2<t.length){const v=t.slice(p+1,p+3);if(m(v)){const t=v.toUpperCase();const m=String.fromCharCode(parseInt(t,16));if(m!=="."&&g(m)){u+=m}else{u+="%"+t}p+=2;continue}}if(v(t[p])){u+=t[p]}else{u+=escape(t[p])}}return u}function escapePreservingEscapes(t){let u="";for(let p=0;p<t.length;p++){if(t[p]==="%"&&p+2<t.length){const g=t.slice(p+1,p+3);if(m(g)){u+="%"+g.toUpperCase();p+=2;continue}}u+=escape(t[p])}return u}function recomposeAuthority(t){const u=[];if(t.userinfo!==undefined){u.push(t.userinfo);u.push("@")}if(t.host!==undefined){let m=unescape(t.host);if(!p(m)){const t=normalizeIPv6(m);if(t.isIPV6===true){m=`[${t.escapedHost}]`}else{m=reescapeHostDelimiters(m,false)}}u.push(m)}if(typeof t.port==="number"||typeof t.port==="string"){u.push(":");u.push(String(t.port))}return u.length?u.join(""):undefined}t.exports={nonSimpleDomain:b,recomposeAuthority:recomposeAuthority,reescapeHostDelimiters:reescapeHostDelimiters,normalizePercentEncoding:normalizePercentEncoding,normalizePathEncoding:normalizePathEncoding,escapePreservingEscapes:escapePreservingEscapes,removeDotSegments:removeDotSegments,isIPv4:p,isUUID:u,normalizeIPv6:normalizeIPv6,stringArrayToHexStripped:stringArrayToHexStripped}},8909:(t,u,p)=>{const{Argument:m}=p(9154);const{Command:g}=p(4348);const{CommanderError:v,InvalidArgumentError:b}=p(1135);const{Help:w}=p(9754);const{Option:E}=p(5240);u.DM=new g;u.gu=t=>new g(t);u.Ww=(t,u)=>new E(t,u);u.er=(t,u)=>new m(t,u);u.uB=g;u.c$=E;u.ef=m;u._V=w;u.b7=v;u.Di=b;u.a2=b},9154:(t,u,p)=>{const{InvalidArgumentError:m}=p(1135);class Argument{constructor(t,u){this.description=u||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(t[0]){case"<":this.required=true;this._name=t.slice(1,-1);break;case"[":this.required=false;this._name=t.slice(1,-1);break;default:this.required=true;this._name=t;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(t,u){if(u===this.defaultValue||!Array.isArray(u)){return[t]}return u.concat(t)}default(t,u){this.defaultValue=t;this.defaultValueDescription=u;return this}argParser(t){this.parseArg=t;return this}choices(t){this.argChoices=t.slice();this.parseArg=(t,u)=>{if(!this.argChoices.includes(t)){throw new m(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,u)}return t};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(t){const u=t.name()+(t.variadic===true?"...":"");return t.required?"<"+u+">":"["+u+"]"}u.Argument=Argument;u.humanReadableArgName=humanReadableArgName},4348:(t,u,p)=>{const m=p(8474).EventEmitter;const g=p(1421);const v=p(6760);const b=p(3024);const w=p(1708);const{Argument:E,humanReadableArgName:S}=p(9154);const{CommanderError:$}=p(1135);const{Help:P}=p(9754);const{Option:R,DualOptions:x}=p(5240);const{suggestSimilar:O}=p(5030);class Command extends m{constructor(t){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this.registeredArguments=[];this._args=this.registeredArguments;this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=t||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:t=>w.stdout.write(t),writeErr:t=>w.stderr.write(t),getOutHelpWidth:()=>w.stdout.isTTY?w.stdout.columns:undefined,getErrHelpWidth:()=>w.stderr.isTTY?w.stderr.columns:undefined,outputError:(t,u)=>u(t)};this._hidden=false;this._helpOption=undefined;this._addImplicitHelpCommand=undefined;this._helpCommand=undefined;this._helpConfiguration={}}copyInheritedSettings(t){this._outputConfiguration=t._outputConfiguration;this._helpOption=t._helpOption;this._helpCommand=t._helpCommand;this._helpConfiguration=t._helpConfiguration;this._exitCallback=t._exitCallback;this._storeOptionsAsProperties=t._storeOptionsAsProperties;this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue;this._allowExcessArguments=t._allowExcessArguments;this._enablePositionalOptions=t._enablePositionalOptions;this._showHelpAfterError=t._showHelpAfterError;this._showSuggestionAfterError=t._showSuggestionAfterError;return this}_getCommandAndAncestors(){const t=[];for(let u=this;u;u=u.parent){t.push(u)}return t}command(t,u,p){let m=u;let g=p;if(typeof m==="object"&&m!==null){g=m;m=null}g=g||{};const[,v,b]=t.match(/([^ ]+) *(.*)/);const w=this.createCommand(v);if(m){w.description(m);w._executableHandler=true}if(g.isDefault)this._defaultCommandName=w._name;w._hidden=!!(g.noHelp||g.hidden);w._executableFile=g.executableFile||null;if(b)w.arguments(b);this._registerCommand(w);w.parent=this;w.copyInheritedSettings(this);if(m)return this;return w}createCommand(t){return new Command(t)}createHelp(){return Object.assign(new P,this.configureHelp())}configureHelp(t){if(t===undefined)return this._helpConfiguration;this._helpConfiguration=t;return this}configureOutput(t){if(t===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,t);return this}showHelpAfterError(t=true){if(typeof t!=="string")t=!!t;this._showHelpAfterError=t;return this}showSuggestionAfterError(t=true){this._showSuggestionAfterError=!!t;return this}addCommand(t,u){if(!t._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}u=u||{};if(u.isDefault)this._defaultCommandName=t._name;if(u.noHelp||u.hidden)t._hidden=true;this._registerCommand(t);t.parent=this;t._checkForBrokenPassThrough();return this}createArgument(t,u){return new E(t,u)}argument(t,u,p,m){const g=this.createArgument(t,u);if(typeof p==="function"){g.default(m).argParser(p)}else{g.default(p)}this.addArgument(g);return this}arguments(t){t.trim().split(/ +/).forEach((t=>{this.argument(t)}));return this}addArgument(t){const u=this.registeredArguments.slice(-1)[0];if(u&&u.variadic){throw new Error(`only the last argument can be variadic '${u.name()}'`)}if(t.required&&t.defaultValue!==undefined&&t.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${t.name()}'`)}this.registeredArguments.push(t);return this}helpCommand(t,u){if(typeof t==="boolean"){this._addImplicitHelpCommand=t;return this}t=t??"help [command]";const[,p,m]=t.match(/([^ ]+) *(.*)/);const g=u??"display help for command";const v=this.createCommand(p);v.helpOption(false);if(m)v.arguments(m);if(g)v.description(g);this._addImplicitHelpCommand=true;this._helpCommand=v;return this}addHelpCommand(t,u){if(typeof t!=="object"){this.helpCommand(t,u);return this}this._addImplicitHelpCommand=true;this._helpCommand=t;return this}_getHelpCommand(){const t=this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"));if(t){if(this._helpCommand===undefined){this.helpCommand(undefined,undefined)}return this._helpCommand}return null}hook(t,u){const p=["preSubcommand","preAction","postAction"];if(!p.includes(t)){throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${p.join("', '")}'`)}if(this._lifeCycleHooks[t]){this._lifeCycleHooks[t].push(u)}else{this._lifeCycleHooks[t]=[u]}return this}exitOverride(t){if(t){this._exitCallback=t}else{this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync"){throw t}else{}}}return this}_exit(t,u,p){if(this._exitCallback){this._exitCallback(new $(t,u,p))}w.exit(t)}action(t){const listener=u=>{const p=this.registeredArguments.length;const m=u.slice(0,p);if(this._storeOptionsAsProperties){m[p]=this}else{m[p]=this.opts()}m.push(this);return t.apply(this,m)};this._actionHandler=listener;return this}createOption(t,u){return new R(t,u)}_callParseArg(t,u,p,m){try{return t.parseArg(u,p)}catch(t){if(t.code==="commander.invalidArgument"){const u=`${m} ${t.message}`;this.error(u,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){const u=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(u){const p=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${p}'\n- already used by option '${u.flags}'`)}this.options.push(t)}_registerCommand(t){const knownBy=t=>[t.name()].concat(t.aliases());const u=knownBy(t).find((t=>this._findCommand(t)));if(u){const p=knownBy(this._findCommand(u)).join("|");const m=knownBy(t).join("|");throw new Error(`cannot add command '${m}' as already have command '${p}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);const u=t.name();const p=t.attributeName();if(t.negate){const u=t.long.replace(/^--no-/,"--");if(!this._findOption(u)){this.setOptionValueWithSource(p,t.defaultValue===undefined?true:t.defaultValue,"default")}}else if(t.defaultValue!==undefined){this.setOptionValueWithSource(p,t.defaultValue,"default")}const handleOptionValue=(u,m,g)=>{if(u==null&&t.presetArg!==undefined){u=t.presetArg}const v=this.getOptionValue(p);if(u!==null&&t.parseArg){u=this._callParseArg(t,u,v,m)}else if(u!==null&&t.variadic){u=t._concatValue(u,v)}if(u==null){if(t.negate){u=false}else if(t.isBoolean()||t.optional){u=true}else{u=""}}this.setOptionValueWithSource(p,u,g)};this.on("option:"+u,(u=>{const p=`error: option '${t.flags}' argument '${u}' is invalid.`;handleOptionValue(u,p,"cli")}));if(t.envVar){this.on("optionEnv:"+u,(u=>{const p=`error: option '${t.flags}' value '${u}' from env '${t.envVar}' is invalid.`;handleOptionValue(u,p,"env")}))}return this}_optionEx(t,u,p,m,g){if(typeof u==="object"&&u instanceof R){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const v=this.createOption(u,p);v.makeOptionMandatory(!!t.mandatory);if(typeof m==="function"){v.default(g).argParser(m)}else if(m instanceof RegExp){const t=m;m=(u,p)=>{const m=t.exec(u);return m?m[0]:p};v.default(g).argParser(m)}else{v.default(m)}return this.addOption(v)}option(t,u,p,m){return this._optionEx({},t,u,p,m)}requiredOption(t,u,p,m){return this._optionEx({mandatory:true},t,u,p,m)}combineFlagAndOptionalValue(t=true){this._combineFlagAndOptionalValue=!!t;return this}allowUnknownOption(t=true){this._allowUnknownOption=!!t;return this}allowExcessArguments(t=true){this._allowExcessArguments=!!t;return this}enablePositionalOptions(t=true){this._enablePositionalOptions=!!t;return this}passThroughOptions(t=true){this._passThroughOptions=!!t;this._checkForBrokenPassThrough();return this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions){throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}}storeOptionsAsProperties(t=true){if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}if(Object.keys(this._optionValues).length){throw new Error("call .storeOptionsAsProperties() before setting option values")}this._storeOptionsAsProperties=!!t;return this}getOptionValue(t){if(this._storeOptionsAsProperties){return this[t]}return this._optionValues[t]}setOptionValue(t,u){return this.setOptionValueWithSource(t,u,undefined)}setOptionValueWithSource(t,u,p){if(this._storeOptionsAsProperties){this[t]=u}else{this._optionValues[t]=u}this._optionValueSources[t]=p;return this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let u;this._getCommandAndAncestors().forEach((p=>{if(p.getOptionValueSource(t)!==undefined){u=p.getOptionValueSource(t)}}));return u}_prepareUserArgs(t,u){if(t!==undefined&&!Array.isArray(t)){throw new Error("first parameter to parse must be array or undefined")}u=u||{};if(t===undefined&&u.from===undefined){if(w.versions?.electron){u.from="electron"}const t=w.execArgv??[];if(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print")){u.from="eval"}}if(t===undefined){t=w.argv}this.rawArgs=t.slice();let p;switch(u.from){case undefined:case"node":this._scriptPath=t[1];p=t.slice(2);break;case"electron":if(w.defaultApp){this._scriptPath=t[1];p=t.slice(2)}else{p=t.slice(1)}break;case"user":p=t.slice(0);break;case"eval":p=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return p}parse(t,u){const p=this._prepareUserArgs(t,u);this._parseCommand([],p);return this}async parseAsync(t,u){const p=this._prepareUserArgs(t,u);await this._parseCommand([],p);return this}_executeSubCommand(t,u){u=u.slice();let p=false;const m=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(t,u){const p=v.resolve(t,u);if(b.existsSync(p))return p;if(m.includes(v.extname(u)))return undefined;const g=m.find((t=>b.existsSync(`${p}${t}`)));if(g)return`${p}${g}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let E=t._executableFile||`${this._name}-${t._name}`;let S=this._executableDir||"";if(this._scriptPath){let t;try{t=b.realpathSync(this._scriptPath)}catch(u){t=this._scriptPath}S=v.resolve(v.dirname(t),S)}if(S){let u=findFile(S,E);if(!u&&!t._executableFile&&this._scriptPath){const p=v.basename(this._scriptPath,v.extname(this._scriptPath));if(p!==this._name){u=findFile(S,`${p}-${t._name}`)}}E=u||E}p=m.includes(v.extname(E));let P;if(w.platform!=="win32"){if(p){u.unshift(E);u=incrementNodeInspectorPort(w.execArgv).concat(u);P=g.spawn(w.argv[0],u,{stdio:"inherit"})}else{P=g.spawn(E,u,{stdio:"inherit"})}}else{u.unshift(E);u=incrementNodeInspectorPort(w.execArgv).concat(u);P=g.spawn(w.execPath,u,{stdio:"inherit"})}if(!P.killed){const t=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];t.forEach((t=>{w.on(t,(()=>{if(P.killed===false&&P.exitCode===null){P.kill(t)}}))}))}const R=this._exitCallback;P.on("close",(t=>{t=t??1;if(!R){w.exit(t)}else{R(new $(t,"commander.executeSubCommandAsync","(close)"))}}));P.on("error",(u=>{if(u.code==="ENOENT"){const u=S?`searched for local subcommand relative to directory '${S}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const p=`'${E}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${u}`;throw new Error(p)}else if(u.code==="EACCES"){throw new Error(`'${E}' not executable`)}if(!R){w.exit(1)}else{const t=new $(1,"commander.executeSubCommandAsync","(error)");t.nestedError=u;R(t)}}));this.runningCommand=P}_dispatchSubcommand(t,u,p){const m=this._findCommand(t);if(!m)this.help({error:true});let g;g=this._chainOrCallSubCommandHook(g,m,"preSubcommand");g=this._chainOrCall(g,(()=>{if(m._executableHandler){this._executeSubCommand(m,u.concat(p))}else{return m._parseCommand(u,p)}}));return g}_dispatchHelpCommand(t){if(!t){this.help()}const u=this._findCommand(t);if(u&&!u._executableHandler){u.help()}return this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,u)=>{if(t.required&&this.args[u]==null){this.missingArgument(t.name())}}));if(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic){return}if(this.args.length>this.registeredArguments.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(t,u,p)=>{let m=u;if(u!==null&&t.parseArg){const g=`error: command-argument value '${u}' is invalid for argument '${t.name()}'.`;m=this._callParseArg(t,u,p,g)}return m};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach(((u,p)=>{let m=u.defaultValue;if(u.variadic){if(p<this.args.length){m=this.args.slice(p);if(u.parseArg){m=m.reduce(((t,p)=>myParseArg(u,p,t)),u.defaultValue)}}else if(m===undefined){m=[]}}else if(p<this.args.length){m=this.args[p];if(u.parseArg){m=myParseArg(u,m,u.defaultValue)}}t[p]=m}));this.processedArgs=t}_chainOrCall(t,u){if(t&&t.then&&typeof t.then==="function"){return t.then((()=>u()))}return u()}_chainOrCallHooks(t,u){let p=t;const m=[];this._getCommandAndAncestors().reverse().filter((t=>t._lifeCycleHooks[u]!==undefined)).forEach((t=>{t._lifeCycleHooks[u].forEach((u=>{m.push({hookedCommand:t,callback:u})}))}));if(u==="postAction"){m.reverse()}m.forEach((t=>{p=this._chainOrCall(p,(()=>t.callback(t.hookedCommand,this)))}));return p}_chainOrCallSubCommandHook(t,u,p){let m=t;if(this._lifeCycleHooks[p]!==undefined){this._lifeCycleHooks[p].forEach((t=>{m=this._chainOrCall(m,(()=>t(this,u)))}))}return m}_parseCommand(t,u){const p=this.parseOptions(u);this._parseOptionsEnv();this._parseOptionsImplied();t=t.concat(p.operands);u=p.unknown;this.args=t.concat(u);if(t&&this._findCommand(t[0])){return this._dispatchSubcommand(t[0],t.slice(1),u)}if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name()){return this._dispatchHelpCommand(t[1])}if(this._defaultCommandName){this._outputHelpIfRequested(u);return this._dispatchSubcommand(this._defaultCommandName,t,u)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}this._outputHelpIfRequested(p.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(p.unknown.length>0){this.unknownOption(p.unknown[0])}};const m=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let p;p=this._chainOrCallHooks(p,"preAction");p=this._chainOrCall(p,(()=>this._actionHandler(this.processedArgs)));if(this.parent){p=this._chainOrCall(p,(()=>{this.parent.emit(m,t,u)}))}p=this._chainOrCallHooks(p,"postAction");return p}if(this.parent&&this.parent.listenerCount(m)){checkForUnknownOptions();this._processArguments();this.parent.emit(m,t,u)}else if(t.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",t,u)}if(this.listenerCount("command:*")){this.emit("command:*",t,u)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(t){if(!t)return undefined;return this.commands.find((u=>u._name===t||u._aliases.includes(t)))}_findOption(t){return this.options.find((u=>u.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((u=>{if(u.mandatory&&t.getOptionValue(u.attributeName())===undefined){t.missingMandatoryOptionValue(u)}}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const u=t.attributeName();if(this.getOptionValue(u)===undefined){return false}return this.getOptionValueSource(u)!=="default"}));const u=t.filter((t=>t.conflictsWith.length>0));u.forEach((u=>{const p=t.find((t=>u.conflictsWith.includes(t.attributeName())));if(p){this._conflictingOption(u,p)}}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const u=[];const p=[];let m=u;const g=t.slice();function maybeOption(t){return t.length>1&&t[0]==="-"}let v=null;while(g.length){const t=g.shift();if(t==="--"){if(m===p)m.push(t);m.push(...g);break}if(v&&!maybeOption(t)){this.emit(`option:${v.name()}`,t);continue}v=null;if(maybeOption(t)){const u=this._findOption(t);if(u){if(u.required){const t=g.shift();if(t===undefined)this.optionMissingArgument(u);this.emit(`option:${u.name()}`,t)}else if(u.optional){let t=null;if(g.length>0&&!maybeOption(g[0])){t=g.shift()}this.emit(`option:${u.name()}`,t)}else{this.emit(`option:${u.name()}`)}v=u.variadic?u:null;continue}}if(t.length>2&&t[0]==="-"&&t[1]!=="-"){const u=this._findOption(`-${t[1]}`);if(u){if(u.required||u.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${u.name()}`,t.slice(2))}else{this.emit(`option:${u.name()}`);g.unshift(`-${t.slice(2)}`)}continue}}if(/^--[^=]+=/.test(t)){const u=t.indexOf("=");const p=this._findOption(t.slice(0,u));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,t.slice(u+1));continue}}if(maybeOption(t)){m=p}if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&p.length===0){if(this._findCommand(t)){u.push(t);if(g.length>0)p.push(...g);break}else if(this._getHelpCommand()&&t===this._getHelpCommand().name()){u.push(t);if(g.length>0)u.push(...g);break}else if(this._defaultCommandName){p.push(t);if(g.length>0)p.push(...g);break}}if(this._passThroughOptions){m.push(t);if(g.length>0)m.push(...g);break}m.push(t)}return{operands:u,unknown:p}}opts(){if(this._storeOptionsAsProperties){const t={};const u=this.options.length;for(let p=0;p<u;p++){const u=this.options[p].attributeName();t[u]=u===this._versionOptionName?this._version:this[u]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,u)=>Object.assign(t,u.opts())),{})}error(t,u){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const p=u||{};const m=p.exitCode||1;const g=p.code||"commander.error";this._exit(m,g,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in w.env){const u=t.attributeName();if(this.getOptionValue(u)===undefined||["default","config","env"].includes(this.getOptionValueSource(u))){if(t.required||t.optional){this.emit(`optionEnv:${t.name()}`,w.env[t.envVar])}else{this.emit(`optionEnv:${t.name()}`)}}}}))}_parseOptionsImplied(){const t=new x(this.options);const hasCustomOptionValue=t=>this.getOptionValue(t)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((u=>u.implied!==undefined&&hasCustomOptionValue(u.attributeName())&&t.valueFromOption(this.getOptionValue(u.attributeName()),u))).forEach((t=>{Object.keys(t.implied).filter((t=>!hasCustomOptionValue(t))).forEach((u=>{this.setOptionValueWithSource(u,t.implied[u],"implied")}))}))}missingArgument(t){const u=`error: missing required argument '${t}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(t){const u=`error: option '${t.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const u=`error: required option '${t.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,u){const findBestOptionFromValue=t=>{const u=t.attributeName();const p=this.getOptionValue(u);const m=this.options.find((t=>t.negate&&u===t.attributeName()));const g=this.options.find((t=>!t.negate&&u===t.attributeName()));if(m&&(m.presetArg===undefined&&p===false||m.presetArg!==undefined&&p===m.presetArg)){return m}return g||t};const getErrorMessage=t=>{const u=findBestOptionFromValue(t);const p=u.attributeName();const m=this.getOptionValueSource(p);if(m==="env"){return`environment variable '${u.envVar}'`}return`option '${u.flags}'`};const p=`error: ${getErrorMessage(t)} cannot be used with ${getErrorMessage(u)}`;this.error(p,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let u="";if(t.startsWith("--")&&this._showSuggestionAfterError){let p=[];let m=this;do{const t=m.createHelp().visibleOptions(m).filter((t=>t.long)).map((t=>t.long));p=p.concat(t);m=m.parent}while(m&&!m._enablePositionalOptions);u=O(t,p)}const p=`error: unknown option '${t}'${u}`;this.error(p,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const u=this.registeredArguments.length;const p=u===1?"":"s";const m=this.parent?` for '${this.name()}'`:"";const g=`error: too many arguments${m}. Expected ${u} argument${p} but got ${t.length}.`;this.error(g,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let u="";if(this._showSuggestionAfterError){const p=[];this.createHelp().visibleCommands(this).forEach((t=>{p.push(t.name());if(t.alias())p.push(t.alias())}));u=O(t,p)}const p=`error: unknown command '${t}'${u}`;this.error(p,{code:"commander.unknownCommand"})}version(t,u,p){if(t===undefined)return this._version;this._version=t;u=u||"-V, --version";p=p||"output the version number";const m=this.createOption(u,p);this._versionOptionName=m.attributeName();this._registerOption(m);this.on("option:"+m.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`);this._exit(0,"commander.version",t)}));return this}description(t,u){if(t===undefined&&u===undefined)return this._description;this._description=t;if(u){this._argsDescription=u}return this}summary(t){if(t===undefined)return this._summary;this._summary=t;return this}alias(t){if(t===undefined)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){u=this.commands[this.commands.length-1]}if(t===u._name)throw new Error("Command alias can't be the same as its name");const p=this.parent?._findCommand(t);if(p){const u=[p.name()].concat(p.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${u}'`)}u._aliases.push(t);return this}aliases(t){if(t===undefined)return this._aliases;t.forEach((t=>this.alias(t)));return this}usage(t){if(t===undefined){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>S(t)));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}this._usage=t;return this}name(t){if(t===undefined)return this._name;this._name=t;return this}nameFromFilename(t){this._name=v.basename(t,v.extname(t));return this}executableDir(t){if(t===undefined)return this._executableDir;this._executableDir=t;return this}helpInformation(t){const u=this.createHelp();if(u.helpWidth===undefined){u.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return u.formatHelp(this,u)}_getHelpContext(t){t=t||{};const u={error:!!t.error};let p;if(u.error){p=t=>this._outputConfiguration.writeErr(t)}else{p=t=>this._outputConfiguration.writeOut(t)}u.write=t.write||p;u.command=this;return u}outputHelp(t){let u;if(typeof t==="function"){u=t;t=undefined}const p=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",p)));this.emit("beforeHelp",p);let m=this.helpInformation(p);if(u){m=u(m);if(typeof m!=="string"&&!Buffer.isBuffer(m)){throw new Error("outputHelp callback must return a string or a Buffer")}}p.write(m);if(this._getHelpOption()?.long){this.emit(this._getHelpOption().long)}this.emit("afterHelp",p);this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",p)))}helpOption(t,u){if(typeof t==="boolean"){if(t){this._helpOption=this._helpOption??undefined}else{this._helpOption=null}return this}t=t??"-h, --help";u=u??"display help for command";this._helpOption=this.createOption(t,u);return this}_getHelpOption(){if(this._helpOption===undefined){this.helpOption(undefined,undefined)}return this._helpOption}addHelpOption(t){this._helpOption=t;return this}help(t){this.outputHelp(t);let u=w.exitCode||0;if(u===0&&t&&typeof t!=="function"&&t.error){u=1}this._exit(u,"commander.help","(outputHelp)")}addHelpText(t,u){const p=["beforeAll","before","after","afterAll"];if(!p.includes(t)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${p.join("', '")}'`)}const m=`${t}Help`;this.on(m,(t=>{let p;if(typeof u==="function"){p=u({error:t.error,command:t.command})}else{p=u}if(p){t.write(`${p}\n`)}}));return this}_outputHelpIfRequested(t){const u=this._getHelpOption();const p=u&&t.find((t=>u.is(t)));if(p){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(t){return t.map((t=>{if(!t.startsWith("--inspect")){return t}let u;let p="127.0.0.1";let m="9229";let g;if((g=t.match(/^(--inspect(-brk)?)$/))!==null){u=g[1]}else if((g=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){u=g[1];if(/^\d+$/.test(g[3])){m=g[3]}else{p=g[3]}}else if((g=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){u=g[1];p=g[3];m=g[4]}if(u&&m!=="0"){return`${u}=${p}:${parseInt(m)+1}`}return t}))}u.Command=Command},1135:(t,u)=>{class CommanderError extends Error{constructor(t,u,p){super(p);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=u;this.exitCode=t;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(t){super(1,"commander.invalidArgument",t);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}u.CommanderError=CommanderError;u.InvalidArgumentError=InvalidArgumentError},9754:(t,u,p)=>{const{humanReadableArgName:m}=p(9154);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(t){const u=t.commands.filter((t=>!t._hidden));const p=t._getHelpCommand();if(p&&!p._hidden){u.push(p)}if(this.sortSubcommands){u.sort(((t,u)=>t.name().localeCompare(u.name())))}return u}compareOptions(t,u){const getSortKey=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return getSortKey(t).localeCompare(getSortKey(u))}visibleOptions(t){const u=t.options.filter((t=>!t.hidden));const p=t._getHelpOption();if(p&&!p.hidden){const m=p.short&&t._findOption(p.short);const g=p.long&&t._findOption(p.long);if(!m&&!g){u.push(p)}else if(p.long&&!g){u.push(t.createOption(p.long,p.description))}else if(p.short&&!m){u.push(t.createOption(p.short,p.description))}}if(this.sortOptions){u.sort(this.compareOptions)}return u}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const u=[];for(let p=t.parent;p;p=p.parent){const t=p.options.filter((t=>!t.hidden));u.push(...t)}if(this.sortOptions){u.sort(this.compareOptions)}return u}visibleArguments(t){if(t._argsDescription){t.registeredArguments.forEach((u=>{u.description=u.description||t._argsDescription[u.name()]||""}))}if(t.registeredArguments.find((t=>t.description))){return t.registeredArguments}return[]}subcommandTerm(t){const u=t.registeredArguments.map((t=>m(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,u){return u.visibleCommands(t).reduce(((t,p)=>Math.max(t,u.subcommandTerm(p).length)),0)}longestOptionTermLength(t,u){return u.visibleOptions(t).reduce(((t,p)=>Math.max(t,u.optionTerm(p).length)),0)}longestGlobalOptionTermLength(t,u){return u.visibleGlobalOptions(t).reduce(((t,p)=>Math.max(t,u.optionTerm(p).length)),0)}longestArgumentTermLength(t,u){return u.visibleArguments(t).reduce(((t,p)=>Math.max(t,u.argumentTerm(p).length)),0)}commandUsage(t){let u=t._name;if(t._aliases[0]){u=u+"|"+t._aliases[0]}let p="";for(let u=t.parent;u;u=u.parent){p=u.name()+" "+p}return p+u+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const u=[];if(t.argChoices){u.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){const p=t.required||t.optional||t.isBoolean()&&typeof t.defaultValue==="boolean";if(p){u.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}}if(t.presetArg!==undefined&&t.optional){u.push(`preset: ${JSON.stringify(t.presetArg)}`)}if(t.envVar!==undefined){u.push(`env: ${t.envVar}`)}if(u.length>0){return`${t.description} (${u.join(", ")})`}return t.description}argumentDescription(t){const u=[];if(t.argChoices){u.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){u.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}if(u.length>0){const p=`(${u.join(", ")})`;if(t.description){return`${t.description} ${p}`}return p}return t.description}formatHelp(t,u){const p=u.padWidth(t,u);const m=u.helpWidth||80;const g=2;const v=2;function formatItem(t,b){if(b){const w=`${t.padEnd(p+v)}${b}`;return u.wrap(w,m-g,p+v)}return t}function formatList(t){return t.join("\n").replace(/^/gm," ".repeat(g))}let b=[`Usage: ${u.commandUsage(t)}`,""];const w=u.commandDescription(t);if(w.length>0){b=b.concat([u.wrap(w,m,0),""])}const E=u.visibleArguments(t).map((t=>formatItem(u.argumentTerm(t),u.argumentDescription(t))));if(E.length>0){b=b.concat(["Arguments:",formatList(E),""])}const S=u.visibleOptions(t).map((t=>formatItem(u.optionTerm(t),u.optionDescription(t))));if(S.length>0){b=b.concat(["Options:",formatList(S),""])}if(this.showGlobalOptions){const p=u.visibleGlobalOptions(t).map((t=>formatItem(u.optionTerm(t),u.optionDescription(t))));if(p.length>0){b=b.concat(["Global Options:",formatList(p),""])}}const $=u.visibleCommands(t).map((t=>formatItem(u.subcommandTerm(t),u.subcommandDescription(t))));if($.length>0){b=b.concat(["Commands:",formatList($),""])}return b.join("\n")}padWidth(t,u){return Math.max(u.longestOptionTermLength(t,u),u.longestGlobalOptionTermLength(t,u),u.longestSubcommandTermLength(t,u),u.longestArgumentTermLength(t,u))}wrap(t,u,p,m=40){const g=" \\f\\t\\v   -    \ufeff";const v=new RegExp(`[\\n][${g}]+`);if(t.match(v))return t;const b=u-p;if(b<m)return t;const w=t.slice(0,p);const E=t.slice(p).replace("\r\n","\n");const S=" ".repeat(p);const $="​";const P=`\\s${$}`;const R=new RegExp(`\n|.{1,${b-1}}([${P}]|$)|[^${P}]+?([${P}]|$)`,"g");const x=E.match(R)||[];return w+x.map(((t,u)=>{if(t==="\n")return"";return(u>0?S:"")+t.trimEnd()})).join("\n")}}u.Help=Help},5240:(t,u,p)=>{const{InvalidArgumentError:m}=p(1135);class Option{constructor(t,u){this.flags=t;this.description=u||"";this.required=t.includes("<");this.optional=t.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(t);this.mandatory=false;const p=splitOptionFlags(t);this.short=p.shortFlag;this.long=p.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(t,u){this.defaultValue=t;this.defaultValueDescription=u;return this}preset(t){this.presetArg=t;return this}conflicts(t){this.conflictsWith=this.conflictsWith.concat(t);return this}implies(t){let u=t;if(typeof t==="string"){u={[t]:true}}this.implied=Object.assign(this.implied||{},u);return this}env(t){this.envVar=t;return this}argParser(t){this.parseArg=t;return this}makeOptionMandatory(t=true){this.mandatory=!!t;return this}hideHelp(t=true){this.hidden=!!t;return this}_concatValue(t,u){if(u===this.defaultValue||!Array.isArray(u)){return[t]}return u.concat(t)}choices(t){this.argChoices=t.slice();this.parseArg=(t,u)=>{if(!this.argChoices.includes(t)){throw new m(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,u)}return t};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(t){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;t.forEach((t=>{if(t.negate){this.negativeOptions.set(t.attributeName(),t)}else{this.positiveOptions.set(t.attributeName(),t)}}));this.negativeOptions.forEach(((t,u)=>{if(this.positiveOptions.has(u)){this.dualOptions.add(u)}}))}valueFromOption(t,u){const p=u.attributeName();if(!this.dualOptions.has(p))return true;const m=this.negativeOptions.get(p).presetArg;const g=m!==undefined?m:false;return u.negate===(g===t)}}function camelcase(t){return t.split("-").reduce(((t,u)=>t+u[0].toUpperCase()+u.slice(1)))}function splitOptionFlags(t){let u;let p;const m=t.split(/[ |,]+/);if(m.length>1&&!/^[[<]/.test(m[1]))u=m.shift();p=m.shift();if(!u&&/^-[^-]$/.test(p)){u=p;p=undefined}return{shortFlag:u,longFlag:p}}u.Option=Option;u.DualOptions=DualOptions},5030:(t,u)=>{const p=3;function editDistance(t,u){if(Math.abs(t.length-u.length)>p)return Math.max(t.length,u.length);const m=[];for(let u=0;u<=t.length;u++){m[u]=[u]}for(let t=0;t<=u.length;t++){m[0][t]=t}for(let p=1;p<=u.length;p++){for(let g=1;g<=t.length;g++){let v=1;if(t[g-1]===u[p-1]){v=0}else{v=1}m[g][p]=Math.min(m[g-1][p]+1,m[g][p-1]+1,m[g-1][p-1]+v);if(g>1&&p>1&&t[g-1]===u[p-2]&&t[g-2]===u[p-1]){m[g][p]=Math.min(m[g][p],m[g-2][p-2]+1)}}}return m[t.length][u.length]}function suggestSimilar(t,u){if(!u||u.length===0)return"";u=Array.from(new Set(u));const m=t.startsWith("--");if(m){t=t.slice(2);u=u.map((t=>t.slice(2)))}let g=[];let v=p;const b=.4;u.forEach((u=>{if(u.length<=1)return;const p=editDistance(t,u);const m=Math.max(t.length,u.length);const w=(m-p)/m;if(w>b){if(p<v){v=p;g=[u]}else if(p===v){g.push(u)}}}));g.sort(((t,u)=>t.localeCompare(u)));if(m){g=g.map((t=>`--${t}`))}if(g.length>1){return`\n(Did you mean one of ${g.join(", ")}?)`}if(g.length===1){return`\n(Did you mean ${g[0]}?)`}return""}u.suggestSimilar=suggestSimilar},3770:t=>{"use strict";t.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},13:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},2394:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},4771:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},9567:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},8364:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},7388:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},2943:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},6261:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},3928:t=>{"use strict";t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},2040:t=>{"use strict";t.exports=JSON.parse('[{"name":"Agola CI","constant":"AGOLA","env":"AGOLA_GIT_REF","pr":"AGOLA_PULL_REQUEST_ID"},{"name":"Appcircle","constant":"APPCIRCLE","env":"AC_APPCIRCLE"},{"name":"AppVeyor","constant":"APPVEYOR","env":"APPVEYOR","pr":"APPVEYOR_PULL_REQUEST_NUMBER"},{"name":"AWS CodeBuild","constant":"CODEBUILD","env":"CODEBUILD_BUILD_ARN"},{"name":"Azure Pipelines","constant":"AZURE_PIPELINES","env":"TF_BUILD","pr":{"BUILD_REASON":"PullRequest"}},{"name":"Bamboo","constant":"BAMBOO","env":"bamboo_planKey"},{"name":"Bitbucket Pipelines","constant":"BITBUCKET","env":"BITBUCKET_COMMIT","pr":"BITBUCKET_PR_ID"},{"name":"Bitrise","constant":"BITRISE","env":"BITRISE_IO","pr":"BITRISE_PULL_REQUEST"},{"name":"Buddy","constant":"BUDDY","env":"BUDDY_WORKSPACE_ID","pr":"BUDDY_EXECUTION_PULL_REQUEST_ID"},{"name":"Buildkite","constant":"BUILDKITE","env":"BUILDKITE","pr":{"env":"BUILDKITE_PULL_REQUEST","ne":"false"}},{"name":"CircleCI","constant":"CIRCLE","env":"CIRCLECI","pr":"CIRCLE_PULL_REQUEST"},{"name":"Cirrus CI","constant":"CIRRUS","env":"CIRRUS_CI","pr":"CIRRUS_PR"},{"name":"Codefresh","constant":"CODEFRESH","env":"CF_BUILD_ID","pr":{"any":["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{"name":"Codemagic","constant":"CODEMAGIC","env":"CM_BUILD_ID","pr":"CM_PULL_REQUEST"},{"name":"Codeship","constant":"CODESHIP","env":{"CI_NAME":"codeship"}},{"name":"Drone","constant":"DRONE","env":"DRONE","pr":{"DRONE_BUILD_EVENT":"pull_request"}},{"name":"dsari","constant":"DSARI","env":"DSARI"},{"name":"Earthly","constant":"EARTHLY","env":"EARTHLY_CI"},{"name":"Expo Application Services","constant":"EAS","env":"EAS_BUILD"},{"name":"Gerrit","constant":"GERRIT","env":"GERRIT_PROJECT"},{"name":"Gitea Actions","constant":"GITEA_ACTIONS","env":"GITEA_ACTIONS"},{"name":"GitHub Actions","constant":"GITHUB_ACTIONS","env":"GITHUB_ACTIONS","pr":{"GITHUB_EVENT_NAME":"pull_request"}},{"name":"GitLab CI","constant":"GITLAB","env":"GITLAB_CI","pr":"CI_MERGE_REQUEST_ID"},{"name":"GoCD","constant":"GOCD","env":"GO_PIPELINE_LABEL"},{"name":"Google Cloud Build","constant":"GOOGLE_CLOUD_BUILD","env":"BUILDER_OUTPUT"},{"name":"Harness CI","constant":"HARNESS","env":"HARNESS_BUILD_ID"},{"name":"Heroku","constant":"HEROKU","env":{"env":"NODE","includes":"/app/.heroku/node/bin/node"}},{"name":"Hudson","constant":"HUDSON","env":"HUDSON_URL"},{"name":"Jenkins","constant":"JENKINS","env":["JENKINS_URL","BUILD_ID"],"pr":{"any":["ghprbPullId","CHANGE_ID"]}},{"name":"LayerCI","constant":"LAYERCI","env":"LAYERCI","pr":"LAYERCI_PULL_REQUEST"},{"name":"Magnum CI","constant":"MAGNUM","env":"MAGNUM"},{"name":"Netlify CI","constant":"NETLIFY","env":"NETLIFY","pr":{"env":"PULL_REQUEST","ne":"false"}},{"name":"Nevercode","constant":"NEVERCODE","env":"NEVERCODE","pr":{"env":"NEVERCODE_PULL_REQUEST","ne":"false"}},{"name":"Prow","constant":"PROW","env":"PROW_JOB_ID"},{"name":"ReleaseHub","constant":"RELEASEHUB","env":"RELEASE_BUILD_ID"},{"name":"Render","constant":"RENDER","env":"RENDER","pr":{"IS_PULL_REQUEST":"true"}},{"name":"Sail CI","constant":"SAIL","env":"SAILCI","pr":"SAIL_PULL_REQUEST_NUMBER"},{"name":"Screwdriver","constant":"SCREWDRIVER","env":"SCREWDRIVER","pr":{"env":"SD_PULL_REQUEST","ne":"false"}},{"name":"Semaphore","constant":"SEMAPHORE","env":"SEMAPHORE","pr":"PULL_REQUEST_NUMBER"},{"name":"Sourcehut","constant":"SOURCEHUT","env":{"CI_NAME":"sourcehut"}},{"name":"Strider CD","constant":"STRIDER","env":"STRIDER"},{"name":"TaskCluster","constant":"TASKCLUSTER","env":["TASK_ID","RUN_ID"]},{"name":"TeamCity","constant":"TEAMCITY","env":"TEAMCITY_VERSION"},{"name":"Travis CI","constant":"TRAVIS","env":"TRAVIS","pr":{"env":"TRAVIS_PULL_REQUEST","ne":"false"}},{"name":"Vela","constant":"VELA","env":"VELA","pr":{"VELA_PULL_REQUEST":"1"}},{"name":"Vercel","constant":"VERCEL","env":{"any":["NOW_BUILDER","VERCEL"]},"pr":"VERCEL_GIT_PULL_REQUEST_ID"},{"name":"Visual Studio App Center","constant":"APPCENTER","env":"APPCENTER_BUILD_ID"},{"name":"Woodpecker","constant":"WOODPECKER","env":{"CI":"woodpecker"},"pr":{"CI_BUILD_EVENT":"pull_request"}},{"name":"Xcode Cloud","constant":"XCODE_CLOUD","env":"CI_XCODE_PROJECT","pr":"CI_PULL_REQUEST_NUMBER"},{"name":"Xcode Server","constant":"XCODE_SERVER","env":"XCS"}]')}};var u={};function __nccwpck_require__(p){var m=u[p];if(m!==undefined){return m.exports}var g=u[p]={exports:{}};var v=true;try{t[p](g,g.exports,__nccwpck_require__);v=false}finally{if(v)delete u[p]}return g.exports}(()=>{__nccwpck_require__.n=t=>{var u=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(u,{a:u});return u}})();(()=>{var t=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;var u;__nccwpck_require__.t=function(p,m){if(m&1)p=this(p);if(m&8)return p;if(typeof p==="object"&&p){if(m&4&&p.__esModule)return p;if(m&16&&typeof p.then==="function")return p}var g=Object.create(null);__nccwpck_require__.r(g);var v={};u=u||[null,t({}),t([]),t(t)];for(var b=m&2&&p;typeof b=="object"&&!~u.indexOf(b);b=t(b)){Object.getOwnPropertyNames(b).forEach((t=>v[t]=()=>p[t]))}v["default"]=()=>p;__nccwpck_require__.d(g,v);return g}})();(()=>{__nccwpck_require__.d=(t,u)=>{for(var p in u){if(__nccwpck_require__.o(u,p)&&!__nccwpck_require__.o(t,p)){Object.defineProperty(t,p,{enumerable:true,get:u[p]})}}}})();(()=>{__nccwpck_require__.o=(t,u)=>Object.prototype.hasOwnProperty.call(t,u)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var p={};(()=>{"use strict";var t=__nccwpck_require__(6395);var u=__nccwpck_require__.n(t);var p=__nccwpck_require__(8909);const{DM:m,gu:g,er:v,Ww:b,b7:w,Di:E,a2:S,uB:$,ef:P,c$:R,_V:x}=p;const O=require("node:util");var A=__nccwpck_require__(1708);var k=__nccwpck_require__(3024);var T=__nccwpck_require__(6760);var C=__nccwpck_require__.n(T);const I=require("node:crypto");const N=require("node:assert");const isObject=t=>{const u=typeof t;return t!==null&&(u==="object"||u==="function")};const isEmptyObject=t=>isObject(t)&&Object.keys(t).length===0;const D=new Set(["__proto__","prototype","constructor"]);const j=new Set("0123456789");function getPathSegments(t){const u=[];let p="";let m="start";let g=false;for(const v of t){switch(v){case"\\":{if(m==="index"){throw new Error("Invalid character in an index")}if(m==="indexEnd"){throw new Error("Invalid character after an index")}if(g){p+=v}m="property";g=!g;break}case".":{if(m==="index"){throw new Error("Invalid character in an index")}if(m==="indexEnd"){m="property";break}if(g){g=false;p+=v;break}if(D.has(p)){return[]}u.push(p);p="";m="property";break}case"[":{if(m==="index"){throw new Error("Invalid character in an index")}if(m==="indexEnd"){m="index";break}if(g){g=false;p+=v;break}if(m==="property"){if(D.has(p)){return[]}u.push(p);p=""}m="index";break}case"]":{if(m==="index"){u.push(Number.parseInt(p,10));p="";m="indexEnd";break}if(m==="indexEnd"){throw new Error("Invalid character after an index")}}default:{if(m==="index"&&!j.has(v)){throw new Error("Invalid character in an index")}if(m==="indexEnd"){throw new Error("Invalid character after an index")}if(m==="start"){m="property"}if(g){g=false;p+="\\"}p+=v}}}if(g){p+="\\"}switch(m){case"property":{if(D.has(p)){return[]}u.push(p);break}case"index":{throw new Error("Index was not closed")}case"start":{u.push("");break}}return u}function isStringIndex(t,u){if(typeof u!=="number"&&Array.isArray(t)){const p=Number.parseInt(u,10);return Number.isInteger(p)&&t[p]===t[u]}return false}function assertNotStringIndex(t,u){if(isStringIndex(t,u)){throw new Error("Cannot use string index")}}function getProperty(t,u,p){if(!isObject(t)||typeof u!=="string"){return p===undefined?t:p}const m=getPathSegments(u);if(m.length===0){return p}for(let u=0;u<m.length;u++){const g=m[u];if(isStringIndex(t,g)){t=u===m.length-1?undefined:null}else{t=t[g]}if(t===undefined||t===null){if(u!==m.length-1){return p}break}}return t===undefined?p:t}function setProperty(t,u,p){if(!isObject(t)||typeof u!=="string"){return t}const m=t;const g=getPathSegments(u);for(let u=0;u<g.length;u++){const m=g[u];assertNotStringIndex(t,m);if(u===g.length-1){t[m]=p}else if(!isObject(t[m])){t[m]=typeof g[u+1]==="number"?[]:{}}t=t[m]}return m}function deleteProperty(t,u){if(!isObject(t)||typeof u!=="string"){return false}const p=getPathSegments(u);for(let u=0;u<p.length;u++){const m=p[u];assertNotStringIndex(t,m);if(u===p.length-1){delete t[m];return true}t=t[m];if(!isObject(t)){return false}}}function hasProperty(t,u){if(!isObject(t)||typeof u!=="string"){return false}const p=getPathSegments(u);if(p.length===0){return false}for(const u of p){if(!isObject(t)||!(u in t)||isStringIndex(t,u)){return false}t=t[u]}return true}function escapePath(t){if(typeof t!=="string"){throw new TypeError("Expected a string")}return t.replaceAll(/[\\.[]/g,"\\$&")}function entries(t){const u=Object.entries(t);if(Array.isArray(t)){return u.map((([t,u])=>[Number(t),u]))}return u}function stringifyPath(t){let u="";for(let[p,m]of entries(t)){if(typeof m==="number"){u+=`[${m}]`}else{m=escapePath(m);u+=p===0?m:`.${m}`}}return u}function*deepKeysIterator(t,u=[]){if(!isObject(t)||isEmptyObject(t)){if(u.length>0){yield stringifyPath(u)}return}for(const[p,m]of entries(t)){yield*deepKeysIterator(m,[...u,p])}}function deepKeys(t){return[...deepKeysIterator(t)]}const L=require("node:os");const M=L.homedir();const U=L.tmpdir();const{env:B}=A;const macos=t=>{const u=T.join(M,"Library");return{data:T.join(u,"Application Support",t),config:T.join(u,"Preferences",t),cache:T.join(u,"Caches",t),log:T.join(u,"Logs",t),temp:T.join(U,t)}};const windows=t=>{const u=B.APPDATA||T.join(M,"AppData","Roaming");const p=B.LOCALAPPDATA||T.join(M,"AppData","Local");return{data:T.join(p,t,"Data"),config:T.join(u,t,"Config"),cache:T.join(p,t,"Cache"),log:T.join(p,t,"Log"),temp:T.join(U,t)}};const linux=t=>{const u=T.basename(M);return{data:T.join(B.XDG_DATA_HOME||T.join(M,".local","share"),t),config:T.join(B.XDG_CONFIG_HOME||T.join(M,".config"),t),cache:T.join(B.XDG_CACHE_HOME||T.join(M,".cache"),t),log:T.join(B.XDG_STATE_HOME||T.join(M,".local","state"),t),temp:T.join(U,u,t)}};function envPaths(t,{suffix:u="nodejs"}={}){if(typeof t!=="string"){throw new TypeError(`Expected a string, got ${typeof t}`)}if(u){t+=`-${u}`}if(A.platform==="darwin"){return macos(t)}if(A.platform==="win32"){return windows(t)}return linux(t)}const attemptifyAsync=(t,u)=>function attemptified(...p){return t.apply(undefined,p).catch(u)};const attemptifySync=(t,u)=>function attemptified(...p){try{return t.apply(undefined,p)}catch(t){return u(t)}};const H=A.getuid?!A.getuid():false;const z=1e4;const NOOP=()=>undefined;const V={isChangeErrorOk:t=>{if(!V.isNodeError(t))return false;const{code:u}=t;if(u==="ENOSYS")return true;if(!H&&(u==="EINVAL"||u==="EPERM"))return true;return false},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!V.isNodeError(t))return false;const{code:u}=t;if(u==="EMFILE"||u==="ENFILE"||u==="EAGAIN"||u==="EBUSY"||u==="EACCESS"||u==="EACCES"||u==="EACCS"||u==="EPERM")return true;return false},onChangeError:t=>{if(!V.isNodeError(t))throw t;if(V.isChangeErrorOk(t))return;throw t}};const G=V;class RetryfyQueue{constructor(){this.interval=25;this.intervalId=undefined;this.limit=z;this.queueActive=new Set;this.queueWaiting=new Set;this.init=()=>{if(this.intervalId)return;this.intervalId=setInterval(this.tick,this.interval)};this.reset=()=>{if(!this.intervalId)return;clearInterval(this.intervalId);delete this.intervalId};this.add=t=>{this.queueWaiting.add(t);if(this.queueActive.size<this.limit/2){this.tick()}else{this.init()}};this.remove=t=>{this.queueWaiting.delete(t);this.queueActive.delete(t)};this.schedule=()=>new Promise((t=>{const cleanup=()=>this.remove(resolver);const resolver=()=>t(cleanup);this.add(resolver)}));this.tick=()=>{if(this.queueActive.size>=this.limit)return;if(!this.queueWaiting.size)return this.reset();for(const t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t);this.queueActive.add(t);t()}}}}const q=new RetryfyQueue;const retryifyAsync=(t,u)=>function retrified(p){return function attempt(...m){return q.schedule().then((g=>{const onResolve=t=>{g();return t};const onReject=t=>{g();if(Date.now()>=p)throw t;if(u(t)){const t=Math.round(100*Math.random());const u=new Promise((u=>setTimeout(u,t)));return u.then((()=>attempt.apply(undefined,m)))}throw t};return t.apply(undefined,m).then(onResolve,onReject)}))}};const retryifySync=(t,u)=>function retrified(p){return function attempt(...m){try{return t.apply(undefined,m)}catch(t){if(Date.now()>p)throw t;if(u(t))return attempt.apply(undefined,m);throw t}}};const W={attempt:{chmod:attemptifyAsync((0,O.promisify)(k.chmod),G.onChangeError),chown:attemptifyAsync((0,O.promisify)(k.chown),G.onChangeError),close:attemptifyAsync((0,O.promisify)(k.close),NOOP),fsync:attemptifyAsync((0,O.promisify)(k.fsync),NOOP),mkdir:attemptifyAsync((0,O.promisify)(k.mkdir),NOOP),realpath:attemptifyAsync((0,O.promisify)(k.realpath),NOOP),stat:attemptifyAsync((0,O.promisify)(k.stat),NOOP),unlink:attemptifyAsync((0,O.promisify)(k.unlink),NOOP),chmodSync:attemptifySync(k.chmodSync,G.onChangeError),chownSync:attemptifySync(k.chownSync,G.onChangeError),closeSync:attemptifySync(k.closeSync,NOOP),existsSync:attemptifySync(k.existsSync,NOOP),fsyncSync:attemptifySync(k.fsync,NOOP),mkdirSync:attemptifySync(k.mkdirSync,NOOP),realpathSync:attemptifySync(k.realpathSync,NOOP),statSync:attemptifySync(k.statSync,NOOP),unlinkSync:attemptifySync(k.unlinkSync,NOOP)},retry:{close:retryifyAsync((0,O.promisify)(k.close),G.isRetriableError),fsync:retryifyAsync((0,O.promisify)(k.fsync),G.isRetriableError),open:retryifyAsync((0,O.promisify)(k.open),G.isRetriableError),readFile:retryifyAsync((0,O.promisify)(k.readFile),G.isRetriableError),rename:retryifyAsync((0,O.promisify)(k.rename),G.isRetriableError),stat:retryifyAsync((0,O.promisify)(k.stat),G.isRetriableError),write:retryifyAsync((0,O.promisify)(k.write),G.isRetriableError),writeFile:retryifyAsync((0,O.promisify)(k.writeFile),G.isRetriableError),closeSync:retryifySync(k.closeSync,G.isRetriableError),fsyncSync:retryifySync(k.fsyncSync,G.isRetriableError),openSync:retryifySync(k.openSync,G.isRetriableError),readFileSync:retryifySync(k.readFileSync,G.isRetriableError),renameSync:retryifySync(k.renameSync,G.isRetriableError),statSync:retryifySync(k.statSync,G.isRetriableError),writeSync:retryifySync(k.writeSync,G.isRetriableError),writeFileSync:retryifySync(k.writeFileSync,G.isRetriableError)}};const Y=W;const Z="utf8";const J=438;const X=511;const Q={};const ee={};const te=L.userInfo().uid;const re=L.userInfo().gid;const ie=7500;const oe=1e3;const ae=!!A.getuid;const le=A.getuid?!A.getuid():false;const ue=128;const he=1e4;const constants_NOOP=()=>{};const lang_isException=t=>t instanceof Error&&"code"in t;const lang_isFunction=t=>typeof t==="function";const lang_isString=t=>typeof t==="string";const lang_isUndefined=t=>t===undefined;const de={};const fe={next:t=>{const u=de[t];if(!u)return;u.shift();const p=u[0];if(p){p((()=>fe.next(t)))}else{delete de[t]}},schedule:t=>new Promise((u=>{let p=de[t];if(!p)p=de[t]=[];p.push(u);if(p.length>1)return;u((()=>fe.next(t)))}))};const pe=null&&fe;const me=A.platform==="linux";const ge=A.platform==="win32";const ve=["SIGHUP","SIGINT","SIGTERM"];if(!ge){ve.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(me){ve.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")}const _e=ve;class Interceptor{constructor(){this.callbacks=new Set;this.exited=false;this.exit=t=>{if(this.exited)return;this.exited=true;for(const t of this.callbacks){t()}if(t){if(ge&&(t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL")){A.kill(A.pid,"SIGTERM")}else{A.kill(A.pid,t)}}};this.hook=()=>{A.once("exit",(()=>this.exit()));for(const t of _e){try{A.once(t,(()=>this.exit(t)))}catch{}}};this.register=t=>{this.callbacks.add(t);return()=>{this.callbacks.delete(t)}};this.hook()}}const be=new Interceptor;const we=be.register;const Ee=we;const Se={store:{},create:t=>{const u=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6);const p=Date.now().toString().slice(-10);const m="tmp-";const g=`.${m}${p}${u}`;const v=`${t}${g}`;return v},get:(t,u,p=true)=>{const m=Se.truncate(u(t));if(m in Se.store)return Se.get(t,u,p);Se.store[m]=p;const disposer=()=>delete Se.store[m];return[m,disposer]},purge:t=>{if(!Se.store[t])return;delete Se.store[t];Y.attempt.unlink(t)},purgeSync:t=>{if(!Se.store[t])return;delete Se.store[t];Y.attempt.unlinkSync(t)},purgeSyncAll:()=>{for(const t in Se.store){Se.purgeSync(t)}},truncate:t=>{const u=T.basename(t);if(u.length<=ue)return t;const p=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(u);if(!p)return t;const m=u.length-ue;return`${t.slice(0,-u.length)}${p[1]}${p[2].slice(0,-m)}${p[3]}`}};Ee(Se.purgeSyncAll);const $e=Se;function readFile(t,u=DEFAULT_READ_OPTIONS){if(isString(u))return readFile(t,{encoding:u});const p=Date.now()+((u.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);return fs.retry.readFile(p)(t,u)}function readFileSync(t,u=DEFAULT_READ_OPTIONS){if(isString(u))return readFileSync(t,{encoding:u});const p=Date.now()+((u.timeout??DEFAULT_TIMEOUT_SYNC)||-1);return fs.retry.readFileSync(p)(t,u)}function writeFile(t,u,p,m){if(isFunction(p))return writeFile(t,u,DEFAULT_WRITE_OPTIONS,p);const g=writeFileAsync(t,u,p);if(m)g.then(m,m);return g}async function writeFileAsync(t,u,p=DEFAULT_WRITE_OPTIONS){if(isString(p))return writeFileAsync(t,u,{encoding:p});const m=Date.now()+((p.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);let g=null;let v=null;let b=null;let w=null;let E=null;try{if(p.schedule)g=await p.schedule(t);v=await Scheduler.schedule(t);const S=await fs.attempt.realpath(t);const $=!!S;t=S||t;[w,b]=Temp.get(t,p.tmpCreate||Temp.create,!(p.tmpPurge===false));const P=IS_POSIX&&isUndefined(p.chown);const R=isUndefined(p.mode);if($&&(P||R)){const u=await fs.attempt.stat(t);if(u){p={...p};if(P){p.chown={uid:u.uid,gid:u.gid}}if(R){p.mode=u.mode}}}if(!$){const u=path.dirname(t);await fs.attempt.mkdir(u,{mode:DEFAULT_FOLDER_MODE,recursive:true})}E=await fs.retry.open(m)(w,"w",p.mode||DEFAULT_FILE_MODE);if(p.tmpCreated){p.tmpCreated(w)}if(isString(u)){await fs.retry.write(m)(E,u,0,p.encoding||DEFAULT_ENCODING)}else if(!isUndefined(u)){await fs.retry.write(m)(E,u,0,u.length,0)}if(p.fsync!==false){if(p.fsyncWait!==false){await fs.retry.fsync(m)(E)}else{fs.attempt.fsync(E)}}await fs.retry.close(m)(E);E=null;if(p.chown&&(p.chown.uid!==DEFAULT_USER_UID||p.chown.gid!==DEFAULT_USER_GID)){await fs.attempt.chown(w,p.chown.uid,p.chown.gid)}if(p.mode&&p.mode!==DEFAULT_FILE_MODE){await fs.attempt.chmod(w,p.mode)}try{await fs.retry.rename(m)(w,t)}catch(u){if(!isException(u))throw u;if(u.code!=="ENAMETOOLONG")throw u;await fs.retry.rename(m)(w,Temp.truncate(t))}b();w=null}finally{if(E)await fs.attempt.close(E);if(w)Temp.purge(w);if(g)g();if(v)v()}}function writeFileSync(t,u,p=ee){if(lang_isString(p))return writeFileSync(t,u,{encoding:p});const m=Date.now()+((p.timeout??oe)||-1);let g=null;let v=null;let b=null;try{const w=Y.attempt.realpathSync(t);const E=!!w;t=w||t;[v,g]=$e.get(t,p.tmpCreate||$e.create,!(p.tmpPurge===false));const S=ae&&lang_isUndefined(p.chown);const $=lang_isUndefined(p.mode);if(E&&(S||$)){const u=Y.attempt.statSync(t);if(u){p={...p};if(S){p.chown={uid:u.uid,gid:u.gid}}if($){p.mode=u.mode}}}if(!E){const u=T.dirname(t);Y.attempt.mkdirSync(u,{mode:X,recursive:true})}b=Y.retry.openSync(m)(v,"w",p.mode||J);if(p.tmpCreated){p.tmpCreated(v)}if(lang_isString(u)){Y.retry.writeSync(m)(b,u,0,p.encoding||Z)}else if(!lang_isUndefined(u)){Y.retry.writeSync(m)(b,u,0,u.length,0)}if(p.fsync!==false){if(p.fsyncWait!==false){Y.retry.fsyncSync(m)(b)}else{Y.attempt.fsync(b)}}Y.retry.closeSync(m)(b);b=null;if(p.chown&&(p.chown.uid!==te||p.chown.gid!==re)){Y.attempt.chownSync(v,p.chown.uid,p.chown.gid)}if(p.mode&&p.mode!==J){Y.attempt.chmodSync(v,p.mode)}try{Y.retry.renameSync(m)(v,t)}catch(u){if(!lang_isException(u))throw u;if(u.code!=="ENAMETOOLONG")throw u;Y.retry.renameSync(m)(v,$e.truncate(t))}g();v=null}finally{if(b)Y.attempt.closeSync(b);if(v)$e.purge(v)}}var Pe=__nccwpck_require__(939);var Re=__nccwpck_require__(2815);const copyProperty=(t,u,p,m)=>{if(p==="length"||p==="prototype"){return}if(p==="arguments"||p==="caller"){return}const g=Object.getOwnPropertyDescriptor(t,p);const v=Object.getOwnPropertyDescriptor(u,p);if(!canCopyProperty(g,v)&&m){return}Object.defineProperty(t,p,v)};const canCopyProperty=function(t,u){return t===undefined||t.configurable||t.writable===u.writable&&t.enumerable===u.enumerable&&t.configurable===u.configurable&&(t.writable||t.value===u.value)};const changePrototype=(t,u)=>{const p=Object.getPrototypeOf(u);if(p===Object.getPrototypeOf(t)){return}Object.setPrototypeOf(t,p)};const wrappedToString=(t,u)=>`/* Wrapped ${t}*/\n${u}`;const xe=Object.getOwnPropertyDescriptor(Function.prototype,"toString");const Oe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");const changeToString=(t,u,p)=>{const m=p===""?"":`with ${p.trim()}() `;const g=wrappedToString.bind(null,m,u.toString());Object.defineProperty(g,"name",Oe);const{writable:v,enumerable:b,configurable:w}=xe;Object.defineProperty(t,"toString",{value:g,writable:v,enumerable:b,configurable:w})};function mimicFunction(t,u,{ignoreNonConfigurable:p=false}={}){const{name:m}=t;for(const m of Reflect.ownKeys(u)){copyProperty(t,u,m,p)}changePrototype(t,u);changeToString(t,u,m);return t}const debounceFunction=(t,u={})=>{if(typeof t!=="function"){throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``)}const{wait:p=0,maxWait:m=Number.POSITIVE_INFINITY,before:g=false,after:v=true}=u;if(p<0||m<0){throw new RangeError("`wait` and `maxWait` must not be negative.")}if(!g&&!v){throw new Error("Both `before` and `after` are false, function wouldn't be called.")}let b;let w;let E;const debouncedFunction=function(...u){const S=this;const later=()=>{b=undefined;if(w){clearTimeout(w);w=undefined}if(v){E=t.apply(S,u)}};const maxLater=()=>{w=undefined;if(b){clearTimeout(b);b=undefined}if(v){E=t.apply(S,u)}};const $=g&&!b;clearTimeout(b);b=setTimeout(later,p);if(m>0&&m!==Number.POSITIVE_INFINITY&&!w){w=setTimeout(maxLater,m)}if($){E=t.apply(S,u)}return E};mimicFunction(debouncedFunction,t);debouncedFunction.cancel=()=>{if(b){clearTimeout(b);b=undefined}if(w){clearTimeout(w);w=undefined}};return debouncedFunction};const Ae=debounceFunction;var ke=__nccwpck_require__(6723);const Te=Object.prototype.toString;const Ce="[object Uint8Array]";const Ie="[object ArrayBuffer]";function isType(t,u,p){if(!t){return false}if(t.constructor===u){return true}return Te.call(t)===p}function isUint8Array(t){return isType(t,Uint8Array,Ce)}function isArrayBuffer(t){return isType(t,ArrayBuffer,Ie)}function isUint8ArrayOrArrayBuffer(t){return isUint8Array(t)||isArrayBuffer(t)}function assertUint8Array(t){if(!isUint8Array(t)){throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}}function assertUint8ArrayOrArrayBuffer(t){if(!isUint8ArrayOrArrayBuffer(t)){throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``)}}function toUint8Array(t){if(t instanceof ArrayBuffer){return new Uint8Array(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}throw new TypeError(`Unsupported value, got \`${typeof t}\`.`)}function concatUint8Arrays(t,u){if(t.length===0){return new Uint8Array(0)}u??=t.reduce(((t,u)=>t+u.length),0);const p=new Uint8Array(u);let m=0;for(const u of t){assertUint8Array(u);p.set(u,m);m+=u.length}return p}function areUint8ArraysEqual(t,u){assertUint8Array(t);assertUint8Array(u);if(t===u){return true}if(t.length!==u.length){return false}for(let p=0;p<t.length;p++){if(t[p]!==u[p]){return false}}return true}function compareUint8Arrays(t,u){assertUint8Array(t);assertUint8Array(u);const p=Math.min(t.length,u.length);for(let m=0;m<p;m++){const p=t[m]-u[m];if(p!==0){return Math.sign(p)}}return Math.sign(t.length-u.length)}const Ne={utf8:new globalThis.TextDecoder("utf8")};function uint8ArrayToString(t,u="utf8"){assertUint8ArrayOrArrayBuffer(t);Ne[u]??=new globalThis.TextDecoder(u);return Ne[u].decode(t)}function assertString(t){if(typeof t!=="string"){throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}}const De=new globalThis.TextEncoder;function stringToUint8Array(t){assertString(t);return De.encode(t)}function base64ToBase64Url(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function base64UrlToBase64(t){const u=t.replaceAll("-","+").replaceAll("_","/");const p=(4-u.length%4)%4;return u+"=".repeat(p)}const je=65535;function uint8ArrayToBase64(t,{urlSafe:u=false}={}){assertUint8Array(t);let p="";for(let u=0;u<t.length;u+=je){const m=t.subarray(u,u+je);p+=globalThis.btoa(String.fromCodePoint.apply(undefined,m))}return u?base64ToBase64Url(p):p}function base64ToUint8Array(t){assertString(t);return Uint8Array.from(globalThis.atob(base64UrlToBase64(t)),(t=>t.codePointAt(0)))}function stringToBase64(t,{urlSafe:u=false}={}){assertString(t);return uint8ArrayToBase64(stringToUint8Array(t),{urlSafe:u})}function base64ToString(t){assertString(t);return uint8ArrayToString(base64ToUint8Array(t))}const Le=Array.from({length:256},((t,u)=>u.toString(16).padStart(2,"0")));function uint8ArrayToHex(t){assertUint8Array(t);let u="";for(let p=0;p<t.length;p++){u+=Le[t[p]]}return u}const Me={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function hexToUint8Array(t){assertString(t);if(t.length%2!==0){throw new Error("Invalid Hex string length.")}const u=t.length/2;const p=new Uint8Array(u);for(let m=0;m<u;m++){const u=Me[t[m*2]];const g=Me[t[m*2+1]];if(u===undefined||g===undefined){throw new Error(`Invalid Hex character encountered at position ${m*2}`)}p[m]=u<<4|g}return p}function getUintBE(t){const{byteLength:u}=t;if(u===6){return t.getUint16(0)*2**32+t.getUint32(2)}if(u===5){return t.getUint8(0)*2**32+t.getUint32(1)}if(u===4){return t.getUint32(0)}if(u===3){return t.getUint8(0)*2**16+t.getUint16(1)}if(u===2){return t.getUint16(0)}if(u===1){return t.getUint8(0)}}function indexOf(t,u){const p=t.length;const m=u.length;if(m===0){return-1}if(m>p){return-1}const g=p-m;for(let p=0;p<=g;p++){let g=true;for(let v=0;v<m;v++){if(t[p+v]!==u[v]){g=false;break}}if(g){return p}}return-1}function includes(t,u){return indexOf(t,u)!==-1}const Fe=Re["default"];const Ue="aes-256-cbc";const createPlainObject=()=>Object.create(null);const isExist=t=>t!==undefined&&t!==null;const checkValueType=(t,u)=>{const p=new Set(["undefined","symbol","function"]);const m=typeof u;if(p.has(m)){throw new TypeError(`Setting a value of type \`${m}\` for key \`${t}\` is not allowed as it's not supported by JSON`)}};const Be="__internal__";const He=`${Be}.migrations.version`;class Conf{path;events;#e;#t;#r;#s={};constructor(t={}){const u={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:false,accessPropertiesByDotNotation:true,configFileMode:438,...t};if(!u.cwd){if(!u.projectName){throw new Error("Please specify the `projectName` option.")}u.cwd=envPaths(u.projectName,{suffix:u.projectSuffix}).config}this.#r=u;if(u.schema){if(typeof u.schema!=="object"){throw new TypeError("The `schema` option must be an object.")}const t=new Pe.Ajv2020({allErrors:true,useDefaults:true});Fe(t);const p={type:"object",properties:u.schema};this.#e=t.compile(p);for(const[t,p]of Object.entries(u.schema)){if(p?.default){this.#s[t]=p.default}}}if(u.defaults){this.#s={...this.#s,...u.defaults}}if(u.serialize){this._serialize=u.serialize}if(u.deserialize){this._deserialize=u.deserialize}this.events=new EventTarget;this.#t=u.encryptionKey;const p=u.fileExtension?`.${u.fileExtension}`:"";this.path=T.resolve(u.cwd,`${u.configName??"config"}${p}`);const m=this.store;const g=Object.assign(createPlainObject(),u.defaults,m);if(u.migrations){if(!u.projectVersion){throw new Error("Please specify the `projectVersion` option.")}this._migrate(u.migrations,u.projectVersion,u.beforeEachMigration)}this._validate(g);try{N.deepEqual(m,g)}catch{this.store=g}if(u.watch){this._watch()}}get(t,u){if(this.#r.accessPropertiesByDotNotation){return this._get(t,u)}const{store:p}=this;return t in p?p[t]:u}set(t,u){if(typeof t!=="string"&&typeof t!=="object"){throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`)}if(typeof t!=="object"&&u===undefined){throw new TypeError("Use `delete()` to clear values")}if(this._containsReservedKey(t)){throw new TypeError(`Please don't use the ${Be} key, as it's used to manage this module internal operations.`)}const{store:p}=this;const set=(t,u)=>{checkValueType(t,u);if(this.#r.accessPropertiesByDotNotation){setProperty(p,t,u)}else{p[t]=u}};if(typeof t==="object"){const u=t;for(const[t,p]of Object.entries(u)){set(t,p)}}else{set(t,u)}this.store=p}has(t){if(this.#r.accessPropertiesByDotNotation){return hasProperty(this.store,t)}return t in this.store}reset(...t){for(const u of t){if(isExist(this.#s[u])){this.set(u,this.#s[u])}}}delete(t){const{store:u}=this;if(this.#r.accessPropertiesByDotNotation){deleteProperty(u,t)}else{delete u[t]}this.store=u}clear(){this.store=createPlainObject();for(const t of Object.keys(this.#s)){this.reset(t)}}onDidChange(t,u){if(typeof t!=="string"){throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`)}if(typeof u!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof u}`)}return this._handleChange((()=>this.get(t)),u)}onDidAnyChange(t){if(typeof t!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`)}return this._handleChange((()=>this.store),t)}get size(){return Object.keys(this.store).length}get store(){try{const t=k.readFileSync(this.path,this.#t?null:"utf8");const u=this._encryptData(t);const p=this._deserialize(u);this._validate(p);return Object.assign(createPlainObject(),p)}catch(t){if(t?.code==="ENOENT"){this._ensureDirectory();return createPlainObject()}if(this.#r.clearInvalidConfig&&t.name==="SyntaxError"){return createPlainObject()}throw t}}set store(t){this._ensureDirectory();this._validate(t);this._write(t);this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,u]of Object.entries(this.store)){yield[t,u]}}_encryptData(t){if(!this.#t){return typeof t==="string"?t:uint8ArrayToString(t)}try{const u=t.slice(0,16);const p=I.pbkdf2Sync(this.#t,u.toString(),1e4,32,"sha512");const m=I.createDecipheriv(Ue,p,u);const g=t.slice(17);const v=typeof g==="string"?stringToUint8Array(g):g;return uint8ArrayToString(concatUint8Arrays([m.update(v),m.final()]))}catch{}return t.toString()}_handleChange(t,u){let p=t();const onChange=()=>{const m=p;const g=t();if((0,O.isDeepStrictEqual)(g,m)){return}p=g;u.call(this,g,m)};this.events.addEventListener("change",onChange);return()=>{this.events.removeEventListener("change",onChange)}}_deserialize=t=>JSON.parse(t);_serialize=t=>JSON.stringify(t,undefined,"\t");_validate(t){if(!this.#e){return}const u=this.#e(t);if(u||!this.#e.errors){return}const p=this.#e.errors.map((({instancePath:t,message:u=""})=>`\`${t.slice(1)}\` ${u}`));throw new Error("Config schema violation: "+p.join("; "))}_ensureDirectory(){k.mkdirSync(T.dirname(this.path),{recursive:true})}_write(t){let u=this._serialize(t);if(this.#t){const t=I.randomBytes(16);const p=I.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512");const m=I.createCipheriv(Ue,p,t);u=concatUint8Arrays([t,stringToUint8Array(":"),m.update(stringToUint8Array(u)),m.final()])}if(A.env.SNAP){k.writeFileSync(this.path,u,{mode:this.#r.configFileMode})}else{try{writeFileSync(this.path,u,{mode:this.#r.configFileMode})}catch(t){if(t?.code==="EXDEV"){k.writeFileSync(this.path,u,{mode:this.#r.configFileMode});return}throw t}}}_watch(){this._ensureDirectory();if(!k.existsSync(this.path)){this._write(createPlainObject())}if(A.platform==="win32"){k.watch(this.path,{persistent:false},Ae((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:100}))}else{k.watchFile(this.path,{persistent:false},Ae((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:5e3}))}}_migrate(t,u,p){let m=this._get(He,"0.0.0");const g=Object.keys(t).filter((t=>this._shouldPerformMigration(t,m,u)));let v={...this.store};for(const b of g){try{if(p){p(this,{fromVersion:m,toVersion:b,finalVersion:u,versions:g})}const w=t[b];w?.(this);this._set(He,b);m=b;v={...this.store}}catch(t){this.store=v;throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${t}`)}}if(this._isVersionInRangeFormat(m)||!ke.eq(m,u)){this._set(He,u)}}_containsReservedKey(t){if(typeof t==="object"){const u=Object.keys(t)[0];if(u===Be){return true}}if(typeof t!=="string"){return false}if(this.#r.accessPropertiesByDotNotation){if(t.startsWith(`${Be}.`)){return true}return false}return false}_isVersionInRangeFormat(t){return ke.clean(t)===null}_shouldPerformMigration(t,u,p){if(this._isVersionInRangeFormat(t)){if(u!=="0.0.0"&&ke.satisfies(u,t)){return false}return ke.satisfies(p,t)}if(ke.lte(t,u)){return false}if(ke.gt(t,p)){return false}return true}_get(t,u){return getProperty(this.store,t,u)}_set(t,u){const{store:p}=this;setProperty(p,t,u);this.store=p}}var ze=__nccwpck_require__(9896);var Ve=__nccwpck_require__(6928);var Ge=__nccwpck_require__.n(Ve);var qe=__nccwpck_require__(9033);var We=__nccwpck_require__(7298);var Ke=__nccwpck_require__.n(We);var Ye=__nccwpck_require__(1083);var Ze=__nccwpck_require__.n(Ye);var Je=__nccwpck_require__(9850);var Xe=__nccwpck_require__.n(Je);const Qe=require("fs/promises");var et=__nccwpck_require__.n(Qe);var tt=__nccwpck_require__(857);var rt=__nccwpck_require__.n(tt);var st=__nccwpck_require__(2203);const it=require("stream/promises");var nt=__nccwpck_require__(4434);var ot=__nccwpck_require__(8474);const at=require("node:stream");const ut=require("node:string_decoder");const ht=require("assert");var dt=__nccwpck_require__(181);const ft=require("zlib");var pt=__nccwpck_require__.t(ft,2);const yt=require("node:fs/promises");var vt=Object.defineProperty;var Ur=(t,u)=>{for(var p in u)vt(t,p,{get:u[p],enumerable:!0})};var _t=typeof process=="object"&&process?process:{stdout:null,stderr:null},Wr=t=>!!t&&typeof t=="object"&&(t instanceof ir||t instanceof at||Gr(t)||Zr(t)),Gr=t=>!!t&&typeof t=="object"&&t instanceof ot.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==at.Writable.prototype.pipe,Zr=t=>!!t&&typeof t=="object"&&t instanceof ot.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",bt=Symbol("EOF"),wt=Symbol("maybeEmitEnd"),Et=Symbol("emittedEnd"),St=Symbol("emittingEnd"),$t=Symbol("emittedError"),Pt=Symbol("closed"),Rt=Symbol("read"),Ot=Symbol("flush"),At=Symbol("flushChunk"),kt=Symbol("encoding"),Tt=Symbol("decoder"),Ct=Symbol("flowing"),It=Symbol("paused"),Nt=Symbol("resume"),Mt=Symbol("buffer"),Ft=Symbol("pipes"),Ut=Symbol("bufferLength"),Bt=Symbol("bufferPush"),Ht=Symbol("bufferShift"),zt=Symbol("objectMode"),Vt=Symbol("destroyed"),Gt=Symbol("error"),qt=Symbol("emitData"),Wt=Symbol("emitEnd"),Kt=Symbol("emitEnd2"),Yt=Symbol("async"),Zt=Symbol("abort"),Jt=Symbol("aborted"),Xt=Symbol("signal"),Qt=Symbol("dataListeners"),er=Symbol("discarded"),jt=t=>Promise.resolve().then(t),Yr=t=>t(),Kr=t=>t==="end"||t==="finish"||t==="prefinish",Vr=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,$r=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),tr=class{src;dest;opts;ondrain;constructor(t,u,p){this.src=t,this.dest=u,this.opts=p,this.ondrain=()=>t[Nt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},sr=class extends tr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,u,p){super(t,u,p),this.proxyErrors=t=>this.dest.emit("error",t),t.on("error",this.proxyErrors)}},Xr=t=>!!t.objectMode,qr=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",ir=class extends ot.EventEmitter{[Ct]=!1;[It]=!1;[Ft]=[];[Mt]=[];[zt];[kt];[Yt];[Tt];[bt]=!1;[Et]=!1;[St]=!1;[Pt]=!1;[$t]=null;[Ut]=0;[Vt]=!1;[Xt];[Jt]=!1;[Qt]=0;[er]=!1;writable=!0;readable=!0;constructor(...t){let u=t[0]||{};if(super(),u.objectMode&&typeof u.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Xr(u)?(this[zt]=!0,this[kt]=null):qr(u)?(this[kt]=u.encoding,this[zt]=!1):(this[zt]=!1,this[kt]=null),this[Yt]=!!u.async,this[Tt]=this[kt]?new ut.StringDecoder(this[kt]):null,u&&u.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Mt]}),u&&u.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Ft]});let{signal:p}=u;p&&(this[Xt]=p,p.aborted?this[Zt]():p.addEventListener("abort",(()=>this[Zt]())))}get bufferLength(){return this[Ut]}get encoding(){return this[kt]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[zt]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Yt]}set async(t){this[Yt]=this[Yt]||!!t}[Zt](){this[Jt]=!0,this.emit("abort",this[Xt]?.reason),this.destroy(this[Xt]?.reason)}get aborted(){return this[Jt]}set aborted(t){}write(t,u,p){if(this[Jt])return!1;if(this[bt])throw new Error("write after end");if(this[Vt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof u=="function"&&(p=u,u="utf8"),u||(u="utf8");let m=this[Yt]?jt:Yr;if(!this[zt]&&!Buffer.isBuffer(t)){if($r(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Vr(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[zt]?(this[Ct]&&this[Ut]!==0&&this[Ot](!0),this[Ct]?this.emit("data",t):this[Bt](t),this[Ut]!==0&&this.emit("readable"),p&&m(p),this[Ct]):t.length?(typeof t=="string"&&!(u===this[kt]&&!this[Tt]?.lastNeed)&&(t=Buffer.from(t,u)),Buffer.isBuffer(t)&&this[kt]&&(t=this[Tt].write(t)),this[Ct]&&this[Ut]!==0&&this[Ot](!0),this[Ct]?this.emit("data",t):this[Bt](t),this[Ut]!==0&&this.emit("readable"),p&&m(p),this[Ct]):(this[Ut]!==0&&this.emit("readable"),p&&m(p),this[Ct])}read(t){if(this[Vt])return null;if(this[er]=!1,this[Ut]===0||t===0||t&&t>this[Ut])return this[wt](),null;this[zt]&&(t=null),this[Mt].length>1&&!this[zt]&&(this[Mt]=[this[kt]?this[Mt].join(""):Buffer.concat(this[Mt],this[Ut])]);let u=this[Rt](t||null,this[Mt][0]);return this[wt](),u}[Rt](t,u){if(this[zt])this[Ht]();else{let p=u;t===p.length||t===null?this[Ht]():typeof p=="string"?(this[Mt][0]=p.slice(t),u=p.slice(0,t),this[Ut]-=t):(this[Mt][0]=p.subarray(t),u=p.subarray(0,t),this[Ut]-=t)}return this.emit("data",u),!this[Mt].length&&!this[bt]&&this.emit("drain"),u}end(t,u,p){return typeof t=="function"&&(p=t,t=void 0),typeof u=="function"&&(p=u,u="utf8"),t!==void 0&&this.write(t,u),p&&this.once("end",p),this[bt]=!0,this.writable=!1,(this[Ct]||!this[It])&&this[wt](),this}[Nt](){this[Vt]||(!this[Qt]&&!this[Ft].length&&(this[er]=!0),this[It]=!1,this[Ct]=!0,this.emit("resume"),this[Mt].length?this[Ot]():this[bt]?this[wt]():this.emit("drain"))}resume(){return this[Nt]()}pause(){this[Ct]=!1,this[It]=!0,this[er]=!1}get destroyed(){return this[Vt]}get flowing(){return this[Ct]}get paused(){return this[It]}[Bt](t){this[zt]?this[Ut]+=1:this[Ut]+=t.length,this[Mt].push(t)}[Ht](){return this[zt]?this[Ut]-=1:this[Ut]-=this[Mt][0].length,this[Mt].shift()}[Ot](t=!1){do{}while(this[At](this[Ht]())&&this[Mt].length);!t&&!this[Mt].length&&!this[bt]&&this.emit("drain")}[At](t){return this.emit("data",t),this[Ct]}pipe(t,u){if(this[Vt])return t;this[er]=!1;let p=this[Et];return u=u||{},t===_t.stdout||t===_t.stderr?u.end=!1:u.end=u.end!==!1,u.proxyErrors=!!u.proxyErrors,p?u.end&&t.end():(this[Ft].push(u.proxyErrors?new sr(this,t,u):new tr(this,t,u)),this[Yt]?jt((()=>this[Nt]())):this[Nt]()),t}unpipe(t){let u=this[Ft].find((u=>u.dest===t));u&&(this[Ft].length===1?(this[Ct]&&this[Qt]===0&&(this[Ct]=!1),this[Ft]=[]):this[Ft].splice(this[Ft].indexOf(u),1),u.unpipe())}addListener(t,u){return this.on(t,u)}on(t,u){let p=super.on(t,u);if(t==="data")this[er]=!1,this[Qt]++,!this[Ft].length&&!this[Ct]&&this[Nt]();else if(t==="readable"&&this[Ut]!==0)super.emit("readable");else if(Kr(t)&&this[Et])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[$t]){let t=u;this[Yt]?jt((()=>t.call(this,this[$t]))):t.call(this,this[$t])}return p}removeListener(t,u){return this.off(t,u)}off(t,u){let p=super.off(t,u);return t==="data"&&(this[Qt]=this.listeners("data").length,this[Qt]===0&&!this[er]&&!this[Ft].length&&(this[Ct]=!1)),p}removeAllListeners(t){let u=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[Qt]=0,!this[er]&&!this[Ft].length&&(this[Ct]=!1)),u}get emittedEnd(){return this[Et]}[wt](){!this[St]&&!this[Et]&&!this[Vt]&&this[Mt].length===0&&this[bt]&&(this[St]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Pt]&&this.emit("close"),this[St]=!1)}emit(t,...u){let p=u[0];if(t!=="error"&&t!=="close"&&t!==Vt&&this[Vt])return!1;if(t==="data")return!this[zt]&&!p?!1:this[Yt]?(jt((()=>this[qt](p))),!0):this[qt](p);if(t==="end")return this[Wt]();if(t==="close"){if(this[Pt]=!0,!this[Et]&&!this[Vt])return!1;let t=super.emit("close");return this.removeAllListeners("close"),t}else if(t==="error"){this[$t]=p,super.emit(Gt,p);let t=!this[Xt]||this.listeners("error").length?super.emit("error",p):!1;return this[wt](),t}else if(t==="resume"){let t=super.emit("resume");return this[wt](),t}else if(t==="finish"||t==="prefinish"){let u=super.emit(t);return this.removeAllListeners(t),u}let m=super.emit(t,...u);return this[wt](),m}[qt](t){for(let u of this[Ft])u.dest.write(t)===!1&&this.pause();let u=this[er]?!1:super.emit("data",t);return this[wt](),u}[Wt](){return this[Et]?!1:(this[Et]=!0,this.readable=!1,this[Yt]?(jt((()=>this[Kt]())),!0):this[Kt]())}[Kt](){if(this[Tt]){let t=this[Tt].end();if(t){for(let u of this[Ft])u.dest.write(t);this[er]||super.emit("data",t)}}for(let t of this[Ft])t.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[zt]||(t.dataLength=0);let u=this.promise();return this.on("data",(u=>{t.push(u),this[zt]||(t.dataLength+=u.length)})),await u,t}async concat(){if(this[zt])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[kt]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,u)=>{this.on(Vt,(()=>u(new Error("stream destroyed")))),this.on("error",(t=>u(t))),this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[er]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let u=this.read();if(u!==null)return Promise.resolve({done:!1,value:u});if(this[bt])return e();let p,m,h=t=>{this.off("data",a),this.off("end",l),this.off(Vt,c),e(),m(t)},a=t=>{this.off("error",h),this.off("end",l),this.off(Vt,c),this.pause(),p({value:t,done:!!this[bt]})},l=()=>{this.off("error",h),this.off("data",a),this.off(Vt,c),e(),p({done:!0,value:void 0})},c=()=>h(new Error("stream destroyed"));return new Promise(((t,u)=>{m=u,p=t,this.once(Vt,c),this.once("error",h),this.once("end",l),this.once("data",a)}))},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[er]=!1;let t=!1,e=()=>(this.pause(),this.off(Gt,e),this.off(Vt,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let u=this.read();return u===null?e():{done:!1,value:u}};return this.once("end",e),this.once(Gt,e),this.once(Vt,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[Vt])return t?this.emit("error",t):this.emit(Vt),this;this[Vt]=!0,this[er]=!0,this[Mt].length=0,this[Ut]=0;let u=this;return typeof u.close=="function"&&!this[Pt]&&u.close(),t?this.emit("error",t):this.emit(Vt),this}static get isStream(){return Wr}};var nr=ze.writev,ar=Symbol("_autoClose"),cr=Symbol("_close"),lr=Symbol("_ended"),ur=Symbol("_fd"),hr=Symbol("_finished"),pr=Symbol("_flags"),mr=Symbol("_flush"),yr=Symbol("_handleChunk"),wr=Symbol("_makeBuf"),Er=Symbol("_mode"),Sr=Symbol("_needDrain"),Pr=Symbol("_onerror"),Rr=Symbol("_onopen"),xr=Symbol("_onread"),Or=Symbol("_onwrite"),Ar=Symbol("_open"),kr=Symbol("_path"),Cr=Symbol("_pos"),Ir=Symbol("_queue"),Nr=Symbol("_read"),Dr=Symbol("_readSize"),jr=Symbol("_reading"),Mr=Symbol("_remain"),Fr=Symbol("_size"),Br=Symbol("_write"),Hr=Symbol("_writing"),zr=Symbol("_defaultFlag"),Jr=Symbol("_errored"),Qr=class extends ir{[Jr]=!1;[ur];[kr];[Dr];[jr]=!1;[Fr];[Mr];[ar];constructor(t,u){if(u=u||{},super(u),this.readable=!0,this.writable=!1,typeof t!="string")throw new TypeError("path must be a string");this[Jr]=!1,this[ur]=typeof u.fd=="number"?u.fd:void 0,this[kr]=t,this[Dr]=u.readSize||16*1024*1024,this[jr]=!1,this[Fr]=typeof u.size=="number"?u.size:1/0,this[Mr]=this[Fr],this[ar]=typeof u.autoClose=="boolean"?u.autoClose:!0,typeof this[ur]=="number"?this[Nr]():this[Ar]()}get fd(){return this[ur]}get path(){return this[kr]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ar](){ze.open(this[kr],"r",((t,u)=>this[Rr](t,u)))}[Rr](t,u){t?this[Pr](t):(this[ur]=u,this.emit("open",u),this[Nr]())}[wr](){return Buffer.allocUnsafe(Math.min(this[Dr],this[Mr]))}[Nr](){if(!this[jr]){this[jr]=!0;let t=this[wr]();if(t.length===0)return process.nextTick((()=>this[xr](null,0,t)));ze.read(this[ur],t,0,t.length,null,((t,u,p)=>this[xr](t,u,p)))}}[xr](t,u,p){this[jr]=!1,t?this[Pr](t):this[yr](u,p)&&this[Nr]()}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[Pr](t){this[jr]=!0,this[cr](),this.emit("error",t)}[yr](t,u){let p=!1;return this[Mr]-=t,t>0&&(p=super.write(t<u.length?u.subarray(0,t):u)),(t===0||this[Mr]<=0)&&(p=!1,this[cr](),super.end()),p}emit(t,...u){switch(t){case"prefinish":case"finish":return!1;case"drain":return typeof this[ur]=="number"&&this[Nr](),!1;case"error":return this[Jr]?!1:(this[Jr]=!0,super.emit(t,...u));default:return super.emit(t,...u)}}},es=class extends Qr{[Ar](){let t=!0;try{this[Rr](null,ze.openSync(this[kr],"r")),t=!1}finally{t&&this[cr]()}}[Nr](){let t=!0;try{if(!this[jr]){this[jr]=!0;do{let t=this[wr](),u=t.length===0?0:ze.readSync(this[ur],t,0,t.length,null);if(!this[yr](u,t))break}while(!0);this[jr]=!1}t=!1}finally{t&&this[cr]()}}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.closeSync(t),this.emit("close")}}},rs=class extends nt{readable=!1;writable=!0;[Jr]=!1;[Hr]=!1;[lr]=!1;[Ir]=[];[Sr]=!1;[kr];[Er];[ar];[ur];[zr];[pr];[hr]=!1;[Cr];constructor(t,u){u=u||{},super(u),this[kr]=t,this[ur]=typeof u.fd=="number"?u.fd:void 0,this[Er]=u.mode===void 0?438:u.mode,this[Cr]=typeof u.start=="number"?u.start:void 0,this[ar]=typeof u.autoClose=="boolean"?u.autoClose:!0;let p=this[Cr]!==void 0?"r+":"w";this[zr]=u.flags===void 0,this[pr]=u.flags===void 0?p:u.flags,this[ur]===void 0&&this[Ar]()}emit(t,...u){if(t==="error"){if(this[Jr])return!1;this[Jr]=!0}return super.emit(t,...u)}get fd(){return this[ur]}get path(){return this[kr]}[Pr](t){this[cr](),this[Hr]=!0,this.emit("error",t)}[Ar](){ze.open(this[kr],this[pr],this[Er],((t,u)=>this[Rr](t,u)))}[Rr](t,u){this[zr]&&this[pr]==="r+"&&t&&t.code==="ENOENT"?(this[pr]="w",this[Ar]()):t?this[Pr](t):(this[ur]=u,this.emit("open",u),this[Hr]||this[mr]())}end(t,u){return t&&this.write(t,u),this[lr]=!0,!this[Hr]&&!this[Ir].length&&typeof this[ur]=="number"&&this[Or](null,0),this}write(t,u){return typeof t=="string"&&(t=Buffer.from(t,u)),this[lr]?(this.emit("error",new Error("write() after end()")),!1):this[ur]===void 0||this[Hr]||this[Ir].length?(this[Ir].push(t),this[Sr]=!0,!1):(this[Hr]=!0,this[Br](t),!0)}[Br](t){ze.write(this[ur],t,0,t.length,this[Cr],((t,u)=>this[Or](t,u)))}[Or](t,u){t?this[Pr](t):(this[Cr]!==void 0&&typeof u=="number"&&(this[Cr]+=u),this[Ir].length?this[mr]():(this[Hr]=!1,this[lr]&&!this[hr]?(this[hr]=!0,this[cr](),this.emit("finish")):this[Sr]&&(this[Sr]=!1,this.emit("drain"))))}[mr](){if(this[Ir].length===0)this[lr]&&this[Or](null,0);else if(this[Ir].length===1)this[Br](this[Ir].pop());else{let t=this[Ir];this[Ir]=[],nr(this[ur],t,this[Cr],((t,u)=>this[Or](t,u)))}}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}},ss=class extends rs{[Ar](){let t;if(this[zr]&&this[pr]==="r+")try{t=ze.openSync(this[kr],this[pr],this[Er])}catch(t){if(t?.code==="ENOENT")return this[pr]="w",this[Ar]();throw t}else t=ze.openSync(this[kr],this[pr],this[Er]);this[Rr](null,t)}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.closeSync(t),this.emit("close")}}[Br](t){let u=!0;try{this[Or](null,ze.writeSync(this[ur],t,0,t.length,this[Cr])),u=!1}finally{if(u)try{this[cr]()}catch{}}}};var is=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Fs=t=>!!t.sync&&!!t.file,ks=t=>!t.sync&&!!t.file,vs=t=>!!t.sync&&!t.file,Ms=t=>!t.sync&&!t.file;var Bs=t=>!!t.file;var tn=t=>{let u=is.get(t);return u||t},se=(t={})=>{if(!t)return{};let u={};for(let[p,m]of Object.entries(t)){let t=tn(p);u[t]=m}return u.chmod===void 0&&u.noChmod===!1&&(u.chmod=!0),delete u.noChmod,u};var K=(t,u,p,m,g)=>Object.assign(((v=[],b,w)=>{Array.isArray(v)&&(b=v,v={}),typeof b=="function"&&(w=b,b=void 0),b=b?Array.from(b):[];let E=se(v);if(g?.(E,b),Fs(E)){if(typeof w=="function")throw new TypeError("callback not supported for sync tar functions");return t(E,b)}else if(ks(E)){let t=u(E,b);return w?t.then((()=>w()),w):t}else if(vs(E)){if(typeof w=="function")throw new TypeError("callback not supported for sync tar functions");return p(E,b)}else if(Ms(E)){if(typeof w=="function")throw new TypeError("callback only supported with file option");return m(E,b)}throw new Error("impossible options??")}),{syncFile:t,asyncFile:u,syncNoFile:p,asyncNoFile:m,validate:g});var ns=ft.constants||{ZLIB_VERNUM:4736},os=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},ns));var as=dt.Buffer.concat,cs=Object.getOwnPropertyDescriptor(dt.Buffer,"concat"),nn=t=>t,ls=cs?.writable===!0||cs?.set!==void 0?t=>{dt.Buffer.concat=t?nn:as}:t=>{},us=Symbol("_superWrite"),hs=class extends Error{code;errno;constructor(t,u){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,u??this.constructor)}get name(){return"ZlibError"}},ds=Symbol("flushFlag"),ms=class extends ir{#i=!1;#n=!1;#o;#a;#c;#l;#u;get sawError(){return this.#i}get handle(){return this.#l}get flushFlag(){return this.#o}constructor(t,u){if(!t||typeof t!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(t),this.#o=t.flush??0,this.#a=t.finishFlush??0,this.#c=t.fullFlushFlag??0,typeof pt[u]!="function")throw new TypeError("Compression method not supported: "+u);try{this.#l=new pt[u](t)}catch(t){throw new hs(t,this.constructor)}this.#u=t=>{this.#i||(this.#i=!0,this.close(),this.emit("error",t))},this.#l?.on("error",(t=>this.#u(new hs(t)))),this.once("end",(()=>this.close))}close(){this.#l&&(this.#l.close(),this.#l=void 0,this.emit("close"))}reset(){if(!this.#i)return ht(this.#l,"zlib binding closed"),this.#l.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#c),this.write(Object.assign(dt.Buffer.alloc(0),{[ds]:t})))}end(t,u,p){return typeof t=="function"&&(p=t,u=void 0,t=void 0),typeof u=="function"&&(p=u,u=void 0),t&&(u?this.write(t,u):this.write(t)),this.flush(this.#a),this.#n=!0,super.end(p)}get ended(){return this.#n}[us](t){return super.write(t)}write(t,u,p){if(typeof u=="function"&&(p=u,u="utf8"),typeof t=="string"&&(t=dt.Buffer.from(t,u)),this.#i)return;ht(this.#l,"zlib binding closed");let m=this.#l._handle,g=m.close;m.close=()=>{};let v=this.#l.close;this.#l.close=()=>{},ls(!0);let b;try{let u=typeof t[ds]=="number"?t[ds]:this.#o;b=this.#l._processChunk(t,u),ls(!1)}catch(t){ls(!1),this.#u(new hs(t,this.write))}finally{this.#l&&(this.#l._handle=m,m.close=g,this.#l.close=v,this.#l.removeAllListeners("error"))}this.#l&&this.#l.on("error",(t=>this.#u(new hs(t,this.write))));let w;if(b)if(Array.isArray(b)&&b.length>0){let t=b[0];w=this[us](dt.Buffer.from(t));for(let t=1;t<b.length;t++)w=this[us](b[t])}else w=this[us](dt.Buffer.from(b));return p&&p(),w}},gs=class extends ms{#i;#n;constructor(t,u){t=t||{},t.flush=t.flush||os.Z_NO_FLUSH,t.finishFlush=t.finishFlush||os.Z_FINISH,t.fullFlushFlag=os.Z_FULL_FLUSH,super(t,u),this.#i=t.level,this.#n=t.strategy}params(t,u){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#i!==t||this.#n!==u){this.flush(os.Z_SYNC_FLUSH),ht(this.handle,"zlib binding closed");let p=this.handle.flush;this.handle.flush=(t,u)=>{typeof t=="function"&&(u=t,t=this.flushFlag),this.flush(t),u?.()};try{this.handle.params(t,u)}finally{this.handle.flush=p}this.handle&&(this.#i=t,this.#n=u)}}}};var ys=class extends gs{#i;constructor(t){super(t,"Gzip"),this.#i=t&&!!t.portable}[us](t){return this.#i?(this.#i=!1,t[9]=255,super[us](t)):super[us](t)}};var _s=class extends gs{constructor(t){super(t,"Unzip")}},bs=class extends ms{constructor(t,u){t=t||{},t.flush=t.flush||os.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||os.BROTLI_OPERATION_FINISH,t.fullFlushFlag=os.BROTLI_OPERATION_FLUSH,super(t,u)}},$s=class extends bs{constructor(t){super(t,"BrotliCompress")}},Ps=class extends bs{constructor(t){super(t,"BrotliDecompress")}},Rs=class extends ms{constructor(t,u){t=t||{},t.flush=t.flush||os.ZSTD_e_continue,t.finishFlush=t.finishFlush||os.ZSTD_e_end,t.fullFlushFlag=os.ZSTD_e_flush,super(t,u)}},xs=class extends Rs{constructor(t){super(t,"ZstdCompress")}},Os=class extends Rs{constructor(t){super(t,"ZstdDecompress")}};var Us=(t,u)=>{if(Number.isSafeInteger(t))t<0?an(t,u):hn(t,u);else throw Error("cannot encode number outside of javascript safe integer range");return u},hn=(t,u)=>{u[0]=128;for(var p=u.length;p>1;p--)u[p-1]=t&255,t=Math.floor(t/256)},an=(t,u)=>{u[0]=255;var p=!1;t=t*-1;for(var m=u.length;m>1;m--){var g=t&255;t=Math.floor(t/256),p?u[m-1]=Ws(g):g===0?u[m-1]=0:(p=!0,u[m-1]=Gs(g))}},Hs=t=>{let u=t[0],p=u===128?cn(t.subarray(1,t.length)):u===255?ln(t):null;if(p===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(p))throw Error("parsed number outside of javascript safe integer range");return p},ln=t=>{for(var u=t.length,p=0,m=!1,g=u-1;g>-1;g--){var v=Number(t[g]),b;m?b=Ws(v):v===0?b=v:(m=!0,b=Gs(v)),b!==0&&(p-=b*Math.pow(256,u-g-1))}return p},cn=t=>{for(var u=t.length,p=0,m=u-1;m>-1;m--){var g=Number(t[m]);g!==0&&(p+=g*Math.pow(256,u-m-1))}return p},Ws=t=>(255^t)&255,Gs=t=>(255^t)+1&255;var As={};Ur(As,{code:()=>Is,isCode:()=>ne,isName:()=>dn,name:()=>Cs,normalFsTypes:()=>Ts});var ne=t=>Cs.has(t),dn=t=>Is.has(t),Ts=new Set(["0","","1","2","3","4","5","6","7","D"]),Cs=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Is=new Map(Array.from(Cs).map((t=>[t[1],t[0]])));var un=t=>t===void 0||t<0?void 0:t,Ns=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#i="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,u=0,p,m){Buffer.isBuffer(t)?this.decode(t,u||0,p,m):t&&this.#n(t)}decode(t,u,p,m){if(u||(u=0),!t||!(t.length>=u+512))throw new Error("need 512 bytes for header");let g=xt(t,u+156,1),v=Ts.has(g),b=v?p:void 0,w=v?m:void 0;if(this.path=b?.path??xt(t,u,100),this.mode=b?.mode??w?.mode??lt(t,u+100,8),this.uid=b?.uid??w?.uid??lt(t,u+108,8),this.gid=b?.gid??w?.gid??lt(t,u+116,8),this.size=un(b?.size??w?.size??lt(t,u+124,12)),this.mtime=b?.mtime??w?.mtime??Wi(t,u+136,12),this.cksum=lt(t,u+148,12),w&&this.#n(w,!0),b&&this.#n(b),ne(g)&&(this.#i=g||"0"),this.#i==="0"&&this.path.slice(-1)==="/"&&(this.#i="5"),this.#i==="5"&&(this.size=0),this.linkpath=xt(t,u+157,100),t.subarray(u+257,u+265).toString()==="ustar\x0000")if(this.uname=b?.uname??w?.uname??xt(t,u+265,32),this.gname=b?.gname??w?.gname??xt(t,u+297,32),this.devmaj=b?.devmaj??w?.devmaj??lt(t,u+329,8)??0,this.devmin=b?.devmin??w?.devmin??lt(t,u+337,8)??0,t[u+475]!==0){let p=xt(t,u+345,155);this.path=p+"/"+this.path}else{let g=xt(t,u+345,130);g&&(this.path=g+"/"+this.path),this.atime=p?.atime??m?.atime??Wi(t,u+476,12),this.ctime=p?.ctime??m?.ctime??Wi(t,u+488,12)}let E=256;for(let p=u;p<u+148;p++)E+=t[p];for(let p=u+156;p<u+512;p++)E+=t[p];this.cksumValid=E===this.cksum,this.cksum===void 0&&E===256&&(this.nullBlock=!0)}#n(t,u=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,p])=>!(p==null||t==="size"&&Number(p)<0||t==="path"&&u||t==="linkpath"&&u||t==="global")))))}encode(t,u=0){if(t||(t=this.block=Buffer.alloc(512)),this.#i==="Unsupported"&&(this.#i="0"),!(t.length>=u+512))throw new Error("need 512 bytes for header");let p=this.ctime||this.atime?130:155,m=mn(this.path||"",p),g=m[0],v=m[1];this.needPax=!!m[2],this.needPax=Lt(t,u,100,g)||this.needPax,this.needPax=ct(t,u+100,8,this.mode)||this.needPax,this.needPax=ct(t,u+108,8,this.uid)||this.needPax,this.needPax=ct(t,u+116,8,this.gid)||this.needPax,this.needPax=ct(t,u+124,12,this.size)||this.needPax,this.needPax=Gi(t,u+136,12,this.mtime)||this.needPax,t[u+156]=Number(this.#i.codePointAt(0)),this.needPax=Lt(t,u+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",u+257,8),this.needPax=Lt(t,u+265,32,this.uname)||this.needPax,this.needPax=Lt(t,u+297,32,this.gname)||this.needPax,this.needPax=ct(t,u+329,8,this.devmaj)||this.needPax,this.needPax=ct(t,u+337,8,this.devmin)||this.needPax,this.needPax=Lt(t,u+345,p,v)||this.needPax,t[u+475]!==0?this.needPax=Lt(t,u+345,155,v)||this.needPax:(this.needPax=Lt(t,u+345,130,v)||this.needPax,this.needPax=Gi(t,u+476,12,this.atime)||this.needPax,this.needPax=Gi(t,u+488,12,this.ctime)||this.needPax);let b=256;for(let p=u;p<u+148;p++)b+=t[p];for(let p=u+156;p<u+512;p++)b+=t[p];return this.cksum=b,ct(t,u+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#i==="Unsupported"?this.#i:Cs.get(this.#i)}get typeKey(){return this.#i}set type(t){let u=String(Is.get(t));if(ne(u)||u==="Unsupported")this.#i=u;else if(ne(t))this.#i=t;else throw new TypeError("invalid entry type: "+t)}},mn=(t,u)=>{let p=t,m="",g,v=T.posix.parse(t).root||".";if(Buffer.byteLength(p)<100)g=[p,m,!1];else{m=T.posix.dirname(p),p=T.posix.basename(p);do{Buffer.byteLength(p)<=100&&Buffer.byteLength(m)<=u?g=[p,m,!1]:Buffer.byteLength(p)>100&&Buffer.byteLength(m)<=u?g=[p.slice(0,99),m,!0]:(p=T.posix.join(T.posix.basename(m),p),m=T.posix.dirname(m))}while(m!==v&&g===void 0);g||(g=[t.slice(0,99),"",!0])}return g},xt=(t,u,p)=>t.subarray(u,u+p).toString("utf8").replace(/\0.*/,""),Wi=(t,u,p)=>pn(lt(t,u,p)),pn=t=>t===void 0?void 0:new Date(t*1e3),lt=(t,u,p)=>Number(t[u])&128?Hs(t.subarray(u,u+p)):wn(t,u,p),En=t=>isNaN(t)?void 0:t,wn=(t,u,p)=>En(parseInt(t.subarray(u,u+p).toString("utf8").replace(/\0.*$/,"").trim(),8)),Ds={12:8589934591,8:2097151},ct=(t,u,p,m)=>m===void 0?!1:m>Ds[p]||m<0?(Us(m,t.subarray(u,u+p)),!0):(yn(t,u,p,m),!1),yn=(t,u,p,m)=>t.write(Rn(m,p),u,p,"ascii"),Rn=(t,u)=>gn(Math.floor(t).toString(8),u),gn=(t,u)=>(t.length===u-1?t:new Array(u-t.length-1).join("0")+t+" ")+"\0",Gi=(t,u,p,m)=>m===void 0?!1:ct(t,u,p,m.getTime()/1e3),js=new Array(156).join("\0"),Lt=(t,u,p,m)=>m===void 0?!1:(t.write(m+js,u,p,"utf8"),m.length!==Buffer.byteLength(m)||m.length>p);var Ls=class s{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,u=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=u,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let u=Buffer.byteLength(t),p=512*Math.ceil(1+u/512),m=Buffer.allocUnsafe(p);for(let t=0;t<512;t++)m[t]=0;new Ns({path:("PaxHeader/"+(0,T.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:u,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(m),m.write(t,512,u,"utf8");for(let t=u+512;t<m.length;t++)m[t]=0;return m}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let u=this[t],p=u instanceof Date?u.getTime()/1e3:u,m=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+p+`\n`,g=Buffer.byteLength(m),v=Math.floor(Math.log(g)/Math.log(10))+1;return g+v>=Math.pow(10,v)&&(v+=1),v+g+m}static parse(t,u,p=!1){return new s(On(Tn(t),u),p)}},On=(t,u)=>u?Object.assign({},u,t):t,Tn=t=>t.replace(/\n$/,"").split(`\n`).reduce(xn,Object.create(null)),xn=(t,u)=>{let p=parseInt(u,10);if(p!==Buffer.byteLength(u)+1)return t;u=u.slice((p+" ").length);let m=u.split("="),g=m.shift();if(!g)return t;let v=g.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),b=m.join("=").replace(/\0.*/,"");switch(v){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":t[v]=b;break;case"ctime":case"atime":case"mtime":t[v]=new Date(Number(b)*1e3);break;case"size":let u=+b;u>=0&&(t[v]=u);break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":t[v]=+b;break}return t};var zs=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Vs=zs!=="win32"?t=>String(t):t=>String(t).replaceAll(/\\/g,"/");var qs=class extends ir{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,u,p){switch(super({}),this.pause(),this.extended=u,this.globalExtended=p,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=Vs(t.path),this.mode=t.mode,this.mode&&(this.mode=this.mode&4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?Vs(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,u&&this.#i(u),p&&this.#i(p,!0)}write(t){let u=t.length;if(u>this.blockRemain)throw new Error("writing more to entry than is appropriate");let p=this.remain,m=this.blockRemain;return this.remain=Math.max(0,p-u),this.blockRemain=Math.max(0,m-u),this.ignore?!0:p>=u?super.write(t):super.write(t.subarray(0,p))}#i(t,u=!1){t.path&&(t.path=Vs(t.path)),t.linkpath&&(t.linkpath=Vs(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,p])=>!(p==null||t==="path"&&u)))))}};var Dt=(t,u,p,m={})=>{t.file&&(m.file=t.file),t.cwd&&(m.cwd=t.cwd),m.code=p instanceof Error&&p.code||u,m.tarCode=u,!t.strict&&m.recoverable!==!1?(p instanceof Error&&(m=Object.assign(p,m),p=p.message),t.emit("warn",u,p,m)):p instanceof Error?t.emit("error",Object.assign(p,m)):t.emit("error",Object.assign(new Error(`${u}: ${p}`),m))};var Ks=1024*1024,Ys=Buffer.from([31,139]),Zs=Buffer.from([40,181,47,253]),Js=Math.max(Ys.length,Zs.length),Xs=Symbol("state"),ei=Symbol("writeEntry"),ti=Symbol("readEntry"),ri=Symbol("nextEntry"),si=Symbol("processEntry"),ii=Symbol("extendedHeader"),ni=Symbol("globalExtendedHeader"),oi=Symbol("meta"),ai=Symbol("emitMeta"),ci=Symbol("buffer"),li=Symbol("queue"),ui=Symbol("ended"),hi=Symbol("emittedEnd"),di=Symbol("emit"),fi=Symbol("unzip"),pi=Symbol("consumeChunk"),mi=Symbol("consumeChunkSub"),gi=Symbol("consumeBody"),yi=Symbol("consumeMeta"),vi=Symbol("consumeHeader"),_i=Symbol("consuming"),bi=Symbol("bufferConcat"),wi=Symbol("maybeEnd"),Si=Symbol("writing"),$i=Symbol("aborted"),Pi=Symbol("onDone"),Ri=Symbol("sawValidEntry"),xi=Symbol("sawNullBlock"),Oi=Symbol("sawEOF"),Ai=Symbol("closeStream"),ki=1e3,Ti=Symbol("compressedBytesRead"),Ci=Symbol("decompressedBytesRead"),Ii=Symbol("checkDecompressionRatio"),Cn=()=>!0,Ni=class extends nt.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=!0;readable=!1;[li]=[];[ci];[ti];[ei];[Xs]="begin";[oi]="";[ii];[ni];[ui]=!1;[fi];[$i]=!1;[Ri];[xi]=!1;[Oi]=!1;[Si]=!1;[_i]=!1;[hi]=!1;[Ti]=0;[Ci]=0;constructor(t={}){super(),this.file=t.file||"",this.on(Pi,(()=>{(this[Xs]==="begin"||this[Ri]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")})),t.ondone?this.on(Pi,t.ondone):this.on(Pi,(()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")})),this.strict=!!t.strict,this.maxDecompressionRatio=typeof t.maxDecompressionRatio=="number"?t.maxDecompressionRatio:ki,this.maxMetaEntrySize=t.maxMetaEntrySize||Ks,this.filter=typeof t.filter=="function"?t.filter:Cn;let u=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:u?void 0:!1;let p=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:p?!0:void 0,this.on("end",(()=>this[Ai]())),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,u,p={}){Dt(this,t,u,p)}[vi](t,u){this[Ri]===void 0&&(this[Ri]=!1);let p;try{p=new Ns(t,u,this[ii],this[ni])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(p.nullBlock)this[xi]?(this[Oi]=!0,this[Xs]==="begin"&&(this[Xs]="header"),this[di]("eof")):(this[xi]=!0,this[di]("nullBlock"));else if(this[xi]=!1,!p.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:p});else if(!p.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:p});else{let t=p.type;if(/^(Symbolic)?Link$/.test(t)&&!p.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:p});else if(!/^(Symbolic)?Link$/.test(t)&&!/^(Global)?ExtendedHeader$/.test(t)&&p.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:p});else{let t=this[ei]=new qs(p,this[ii],this[ni]);if(!this[Ri])if(t.remain){let o=()=>{t.invalid||(this[Ri]=!0)};t.on("end",o)}else this[Ri]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[di]("ignoredEntry",t),this[Xs]="ignore",t.resume()):t.size>0&&(this[oi]="",t.on("data",(t=>this[oi]+=t)),this[Xs]="meta"):(this[ii]=void 0,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[di]("ignoredEntry",t),this[Xs]=t.remain?"ignore":"header",t.resume()):(t.remain?this[Xs]="body":(this[Xs]="header",t.end()),this[ti]?this[li].push(t):(this[li].push(t),this[ri]())))}}}[Ai](){queueMicrotask((()=>this.emit("close")))}[si](t){let u=!0;if(!t)this[ti]=void 0,u=!1;else if(Array.isArray(t)){let[u,...p]=t;this.emit(u,...p)}else this[ti]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",(()=>this[ri]())),u=!1);return u}[ri](){do{}while(this[si](this[li].shift()));if(this[li].length===0){let t=this[ti];!t||t.flowing||t.size===t.remain?this[Si]||this.emit("drain"):t.once("drain",(()=>this.emit("drain")))}}[gi](t,u){let p=this[ei];if(!p)throw new Error("attempt to consume body without entry??");let m=p.blockRemain??0,g=m>=t.length&&u===0?t:t.subarray(u,u+m);return p.write(g),p.blockRemain||(this[Xs]="header",this[ei]=void 0,p.end()),g.length}[yi](t,u){let p=this[ei],m=this[gi](t,u);return!this[ei]&&p&&this[ai](p),m}[di](t,u,p){this[li].length===0&&!this[ti]?this.emit(t,u,p):this[li].push([t,u,p])}[ai](t){switch(this[di]("meta",this[oi]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[ii]=Ls.parse(this[oi],this[ii],!1);break;case"GlobalExtendedHeader":this[ni]=Ls.parse(this[oi],this[ni],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[ii]??Object.create(null);this[ii]=t,t.path=this[oi].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[ii]||Object.create(null);this[ii]=t,t.linkpath=this[oi].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){if(!this[$i]){if(this[fi]){let t=this[fi];t.write=()=>!0,t.end=()=>t,t.emit=()=>!1,t.destroy?.()}this[$i]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}}[Ii](t){this[Ci]+=t.length;let u=this[Ci]/this[Ti];return u>this.maxDecompressionRatio?(this.abort(new Error(`max decompression ratio exceeded: ${u.toFixed(2)} > ${this.maxDecompressionRatio}`)),!1):!0}write(t,u,p){if(typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof u=="string"?u:"utf8")),this[$i])return p?.(),!1;if((this[fi]===void 0||this.brotli===void 0&&this[fi]===!1)&&t){if(this[ci]&&(t=Buffer.concat([this[ci],t]),this[ci]=void 0),t.length<Js)return this[ci]=t,p?.(),!0;for(let u=0;this[fi]===void 0&&u<Ys.length;u++)t[u]!==Ys[u]&&(this[fi]=!1);let u=!1;if(this[fi]===!1&&this.zstd!==!1){u=!0;for(let p=0;p<Zs.length;p++)if(t[p]!==Zs[p]){u=!1;break}}let m=this.brotli===void 0&&!u;if(this[fi]===!1&&m)if(t.length<512)if(this[ui])this.brotli=!0;else return this[ci]=t,p?.(),!0;else try{new Ns(t.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[fi]===void 0||this[fi]===!1&&(this.brotli||u)){let m=this[ui];this[ui]=!1,this[fi]=this[fi]===void 0?new _s({}):u?new Os({}):new Ps({}),this[fi].on("data",(t=>{this[Ii](t)&&this[pi](t)})),this[fi].on("error",(t=>{this[$i]||this.abort(t)})),this[fi].on("end",(()=>{this[ui]=!0,this[pi]()})),this[Si]=!0,this[Ti]+=t.length;let g=!!this[fi][m?"end":"write"](t);return this[Si]=!1,p?.(),g}}this[Si]=!0,this[fi]?(this[Ti]+=t.length,this[fi].write(t)):this[pi](t),this[Si]=!1;let m=this[li].length>0?!1:this[ti]?this[ti].flowing:!0;return!m&&this[li].length===0&&this[ti]?.once("drain",(()=>this.emit("drain"))),p?.(),m}[bi](t){t&&!this[$i]&&(this[ci]=this[ci]?Buffer.concat([this[ci],t]):t)}[wi](){if(this[ui]&&!this[hi]&&!this[$i]&&!this[_i]){this[hi]=!0;let t=this[ei];if(t?.blockRemain){let u=this[ci]?this[ci].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${u} available)`,{entry:t}),this[ci]&&t.write(this[ci]),t.end()}this[di](Pi)}}[pi](t){if(this[_i]&&t)this[bi](t);else if(!t&&!this[ci])this[wi]();else if(t){if(this[_i]=!0,this[ci]){this[bi](t);let u=this[ci];this[ci]=void 0,this[mi](u)}else this[mi](t);for(;this[ci]&&this[ci]?.length>=512&&!this[$i]&&!this[Oi];){let t=this[ci];this[ci]=void 0,this[mi](t)}this[_i]=!1}(!this[ci]||this[ui])&&this[wi]()}[mi](t){let u=0,p=t.length;for(;u+512<=p&&!this[$i]&&!this[Oi];)switch(this[Xs]){case"begin":case"header":this[vi](t,u),u+=512;break;case"ignore":case"body":u+=this[gi](t,u);break;case"meta":u+=this[yi](t,u);break;default:throw new Error("invalid state: "+this[Xs])}u<p&&(this[ci]=this[ci]?Buffer.concat([t.subarray(u),this[ci]]):t.subarray(u))}end(t,u,p){return typeof t=="function"&&(p=t,u=void 0,t=void 0),typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,u)),p&&this.once("finish",p),this[$i]||(this[fi]?(t&&(this[Ti]+=t.length,this[fi].write(t)),this[fi].end()):(this[ui]=!0,(this.brotli===void 0||this.zstd===void 0)&&(t=t||Buffer.alloc(0)),t&&this.write(t),this[wi]())),this}};var mt=t=>{let u=t.length-1,p=-1;for(;u>-1&&t.charAt(u)==="/";)p=u,u--;return p===-1?t:t.slice(0,p)};var vn=t=>{let u=t.onReadEntry;t.onReadEntry=u?t=>{u(t),t.resume()}:t=>t.resume()},Qi=(t,u)=>{let p=new Map(u.map((t=>[mt(t),!0]))),m=t.filter,g=100,n=(t,u="",m=0)=>{if(m>=g)return p.set(t,!1),!1;let v=u||(0,Ve.parse)(t).root||".",b;if(t===v)b=!1;else{let u=p.get(t);b=u!==void 0?u:n((0,Ve.dirname)(t),v,m+1)}return p.set(t,b),b};t.filter=m?(t,u)=>m(t,u)&&n(mt(t)):t=>n(mt(t))},Mn=t=>{let u=new Ni(t),p=t.file,m;try{m=k.openSync(p,"r");let g=k.fstatSync(m),v=t.maxReadSize||16*1024*1024;if(g.size<v){let t=Buffer.allocUnsafe(g.size),p=k.readSync(m,t,0,g.size,0);u.end(p===t.byteLength?t:t.subarray(0,p))}else{let t=0,p=Buffer.allocUnsafe(v);for(;t<g.size;){let g=k.readSync(m,p,0,v,t);if(g===0)break;t+=g,u.write(p.subarray(0,g))}u.end()}}finally{if(typeof m=="number")try{k.closeSync(m)}catch{}}},Bn=(t,u)=>{let p=new Ni(t),m=t.maxReadSize||16*1024*1024,g=t.file;return new Promise(((t,u)=>{p.on("error",u),p.on("end",t),k.stat(g,((t,v)=>{if(t)u(t);else{let t=new Qr(g,{readSize:m,size:v.size});t.on("error",u),t.pipe(p)}}))}))},Di=K(Mn,Bn,(t=>new Ni(t)),(t=>new Ni(t)),((t,u)=>{u?.length&&Qi(t,u),t.noResume||vn(t)}));var Ji=(t,u,p)=>(t&=4095,p&&(t=(t|384)&-19),u&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);var{isAbsolute:ji,parse:Li}=T.win32,ce=t=>{let u="",p=Li(t);for(;ji(t)||p.root;){let m=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":p.root;t=t.slice(m.length),u+=m,p=Li(t)}return[u,t]};var Mi=["|","<",">","?",":"],Fi=Mi.map((t=>String.fromCodePoint(61440+Number(t.codePointAt(0))))),Ui=new Map(Mi.map(((t,u)=>[t,Fi[u]]))),Bi=new Map(Fi.map(((t,u)=>[t,Mi[u]]))),ts=t=>Mi.reduce(((t,u)=>t.split(u).join(Ui.get(u))),t),Qs=t=>Fi.reduce(((t,u)=>t.split(u).join(Bi.get(u))),t);var rr=(t,u)=>u?(t=Vs(t).replace(/^\.(\/|$)/,""),mt(u)+"/"+t):Vs(t),Hi=16*1024*1024,zi=Symbol("process"),Vi=Symbol("file"),qi=Symbol("directory"),Ki=Symbol("symlink"),Yi=Symbol("hardlink"),Zi=Symbol("header"),Xi=Symbol("read"),en=Symbol("lstat"),rn=Symbol("onlstat"),sn=Symbol("onread"),on=Symbol("onreadlink"),fn=Symbol("openfile"),_n=Symbol("onopenfile"),bn=Symbol("close"),Sn=Symbol("mode"),Pn=Symbol("awaitDrain"),An=Symbol("ondrain"),kn=Symbol("prefix"),In=class extends ir{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#i=!1;constructor(t,u={}){let p=se(u);super(),this.path=Vs(t),this.portable=!!p.portable,this.maxReadSize=p.maxReadSize||Hi,this.linkCache=p.linkCache||new Map,this.statCache=p.statCache||new Map,this.preservePaths=!!p.preservePaths,this.cwd=Vs(p.cwd||process.cwd()),this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.mtime=p.mtime,this.prefix=p.prefix?Vs(p.prefix):void 0,this.onWriteEntry=p.onWriteEntry,typeof p.onwarn=="function"&&this.on("warn",p.onwarn);let m=!1;if(!this.preservePaths){let[t,u]=ce(this.path);t&&typeof u=="string"&&(this.path=u,m=t)}this.win32=!!p.win32||process.platform==="win32",this.win32&&(this.path=Qs(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=Vs(p.absolute||Ve.resolve(this.cwd,t)),this.path===""&&(this.path="./"),m&&this.warn("TAR_ENTRY_INFO",`stripping ${m} from absolute path`,{entry:this,path:m+this.path});let g=this.statCache.get(this.absolute);g?this[rn](g):this[en]()}warn(t,u,p={}){return Dt(this,t,u,p)}emit(t,...u){return t==="error"&&(this.#i=!0),super.emit(t,...u)}[en](){ze.lstat(this.absolute,((t,u)=>{if(t)return this.emit("error",t);this[rn](u)}))}[rn](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=Gn(t),this.emit("stat",t),this[zi]()}[zi](){switch(this.type){case"File":return this[Vi]();case"Directory":return this[qi]();case"SymbolicLink":return this[Ki]();default:return this.end()}}[Sn](t){return Ji(t,this.type==="Directory",this.portable)}[kn](t){return rr(t,this.prefix)}[Zi](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new Ns({path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,mode:this[Sn](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Ls({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[qi](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Zi](),this.end()}[Ki](){ze.readlink(this.absolute,((t,u)=>{if(t)return this.emit("error",t);this[on](u)}))}[on](t){this.linkpath=Vs(t),this[Zi](),this.end()}[Yi](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=Vs(Ve.relative(this.cwd,t)),this.stat.size=0,this[Zi](),this.end()}[Vi](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,u=this.linkCache.get(t);if(u?.indexOf(this.cwd)===0)return this[Yi](u);this.linkCache.set(t,this.absolute)}if(this[Zi](),this.stat.size===0)return this.end();this[fn]()}[fn](){ze.open(this.absolute,"r",((t,u)=>{if(t)return this.emit("error",t);this[_n](u)}))}[_n](t){if(this.fd=t,this.#i)return this[bn]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let u=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(u),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Xi]()}[Xi](){let{fd:t,buf:u,offset:p,length:m,pos:g}=this;if(t===void 0||u===void 0)throw new Error("cannot read file without first opening");ze.read(t,u,p,m,g,((t,u)=>{if(t)return this[bn]((()=>this.emit("error",t)));this[sn](u)}))}[bn](t=()=>{}){this.fd!==void 0&&ze.close(this.fd,t)}[sn](t){if(t<=0&&this.remain>0){let t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[bn]((()=>this.emit("error",t)))}if(t>this.remain){let t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[bn]((()=>this.emit("error",t)))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let u=t;u<this.length&&t<this.blockRemain;u++)this.buf[u+this.offset]=0,t++,this.remain++;let u=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(u)?this[An]():this[Pn]((()=>this[An]()))}[Pn](t){this.once("drain",t)}write(t,u,p){if(typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof u=="string"?u:"utf8")),this.blockRemain<t.length){let t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,p)}[An](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[bn]((t=>t?this.emit("error",t):this.end()));if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Xi]()}},Nn=class extends In{sync=!0;[en](){this[rn](ze.lstatSync(this.absolute))}[Ki](){this[on](ze.readlinkSync(this.absolute))}[fn](){this[_n](ze.openSync(this.absolute,"r"))}[Xi](){let t=!0;try{let{fd:u,buf:p,offset:m,length:g,pos:v}=this;if(u===void 0||p===void 0)throw new Error("fd and buf must be set in READ method");let b=ze.readSync(u,p,m,g,v);this[sn](b),t=!1}finally{if(t)try{this[bn]((()=>{}))}catch{}}}[Pn](t){t()}[bn](t=()=>{}){this.fd!==void 0&&ze.closeSync(this.fd),t()}},Dn=class extends ir{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,u,p={}){return Dt(this,t,u,p)}constructor(t,u={}){let p=se(u);super(),this.preservePaths=!!p.preservePaths,this.portable=!!p.portable,this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.onWriteEntry=p.onWriteEntry,this.readEntry=t;let{type:m}=t;if(m==="Unsupported")throw new Error("writing entry that should be ignored");this.type=m,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=p.prefix,this.path=Vs(t.path),this.mode=t.mode!==void 0?this[Sn](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:p.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=t.linkpath!==void 0?Vs(t.linkpath):void 0,typeof p.onwarn=="function"&&this.on("warn",p.onwarn);let g=!1;if(!this.preservePaths){let[t,u]=ce(this.path);t&&typeof u=="string"&&(this.path=u,g=t)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new Ns({path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),g&&this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute path`,{entry:this,path:g+this.path}),this.header.encode()&&!this.noPax&&super.write(new Ls({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let v=this.header?.block;if(!v)throw new Error("failed to encode header");super.write(v),t.pipe(this)}[kn](t){return rr(t,this.prefix)}[Sn](t){return Ji(t,this.type==="Directory",this.portable)}write(t,u,p){typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof u=="string"?u:"utf8"));let m=t.length;if(m>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=m,super.write(t,p)}end(t,u,p){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof t=="function"&&(p=t,u=void 0,t=void 0),typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,u??"utf8")),p&&this.once("finish",p),t?super.end(t,p):super.end(p),this}},Gn=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var jn=class s{tail;head;length=0;static create(t=[]){return new s(t)}constructor(t=[]){for(let u of t)this.push(u)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let u=t.next,p=t.prev;return u&&(u.prev=p),p&&(p.next=u),t===this.head&&(this.head=u),t===this.tail&&(this.tail=p),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,u}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let u=this.head;t.list=this,t.next=u,u&&(u.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let u=this.tail;t.list=this,t.prev=u,u&&(u.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let u=0,p=t.length;u<p;u++)Yn(this,t[u]);return this.length}unshift(...t){for(var u=0,p=t.length;u<p;u++)Kn(this,t[u]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,u=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,u.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,u=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,u.list=void 0,this.length--,t}forEach(t,u){u=u||this;for(let p=this.head,m=0;p;m++)t.call(u,p.value,m,this),p=p.next}forEachReverse(t,u){u=u||this;for(let p=this.tail,m=this.length-1;p;m--)t.call(u,p.value,m,this),p=p.prev}get(t){let u=0,p=this.head;for(;p&&u<t;u++)p=p.next;if(u===t&&p)return p.value}getReverse(t){let u=0,p=this.tail;for(;p&&u<t;u++)p=p.prev;if(u===t&&p)return p.value}map(t,u){u=u||this;let p=new s;for(let m=this.head;m;)p.push(t.call(u,m.value,this)),m=m.next;return p}mapReverse(t,u){u=u||this;var p=new s;for(let m=this.tail;m;)p.push(t.call(u,m.value,this)),m=m.prev;return p}reduce(t,u){let p,m=this.head;if(arguments.length>1)p=u;else if(this.head)m=this.head.next,p=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var g=0;m;g++)p=t(p,m.value,g),m=m.next;return p}reduceReverse(t,u){let p,m=this.tail;if(arguments.length>1)p=u;else if(this.tail)m=this.tail.prev,p=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let u=this.length-1;m;u--)p=t(p,m.value,u),m=m.prev;return p}toArray(){let t=new Array(this.length);for(let u=0,p=this.head;p;u++)t[u]=p.value,p=p.next;return t}toArrayReverse(){let t=new Array(this.length);for(let u=0,p=this.tail;p;u++)t[u]=p.value,p=p.prev;return t}slice(t=0,u=this.length){u<0&&(u+=this.length),t<0&&(t+=this.length);let p=new s;if(u<t||u<0)return p;t<0&&(t=0),u>this.length&&(u=this.length);let m=this.head,g=0;for(g=0;m&&g<t;g++)m=m.next;for(;m&&g<u;g++,m=m.next)p.push(m.value);return p}sliceReverse(t=0,u=this.length){u<0&&(u+=this.length),t<0&&(t+=this.length);let p=new s;if(u<t||u<0)return p;t<0&&(t=0),u>this.length&&(u=this.length);let m=this.length,g=this.tail;for(;g&&m>u;m--)g=g.prev;for(;g&&m>t;m--,g=g.prev)p.push(g.value);return p}splice(t,u=0,...p){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let m=this.head;for(let u=0;m&&u<t;u++)m=m.next;let g=[];for(let t=0;m&&t<u;t++)g.push(m.value),m=this.removeNode(m);m?m!==this.tail&&(m=m.prev):m=this.tail;for(let t of p)m=Zn(this,m,t);return g}reverse(){let t=this.head,u=this.tail;for(let u=t;u;u=u.prev){let t=u.prev;u.prev=u.next,u.next=t}return this.head=u,this.tail=t,this}};function Zn(t,u,p){let m=u,g=u?u.next:t.head,v=new Ln(p,m,g,t);return v.next===void 0&&(t.tail=v),v.prev===void 0&&(t.head=v),t.length++,v}function Yn(t,u){t.tail=new Ln(u,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function Kn(t,u){t.head=new Ln(u,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var Ln=class{list;next;prev;value;constructor(t,u,p,m){this.list=m,this.value=t,u?(u.next=this,this.prev=u):this.prev=void 0,p?(p.prev=this,this.next=p):this.next=void 0}};var Fn=class{path;absolute;entry;stat;readdir;pending=!1;pendingLink=!1;ignore=!1;piped=!1;constructor(t,u){this.path=t||"./",this.absolute=u}},Un=Buffer.alloc(1024),Hn=Symbol("onStat"),zn=Symbol("ended"),Wn=Symbol("queue"),Jn=Symbol("pendingLinks"),Qn=Symbol("current"),eo=Symbol("process"),to=Symbol("processing"),ro=Symbol("processJob"),ao=Symbol("jobs"),co=Symbol("jobDone"),uo=Symbol("addFSEntry"),ho=Symbol("addTarEntry"),fo=Symbol("stat"),vo=Symbol("readdir"),So=Symbol("onreaddir"),$o=Symbol("pipe"),Po=Symbol("entry"),xo=Symbol("entryOpt"),Oo=Symbol("writeEntryClass"),Ao=Symbol("write"),ko=Symbol("ondrain"),Co=class extends ir{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Oo];onWriteEntry;[Wn];[Jn]=new Map;[ao]=0;[to]=!1;[zn]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=Vs(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[Oo]=In,typeof t.onwarn=="function"&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli||t.zstd){if((t.gzip?1:0)+(t.brotli?1:0)+(t.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&(typeof t.gzip!="object"&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new ys(t.gzip)),t.brotli&&(typeof t.brotli!="object"&&(t.brotli={}),this.zip=new $s(t.brotli)),t.zstd&&(typeof t.zstd!="object"&&(t.zstd={}),this.zip=new xs(t.zstd)),!this.zip)throw new Error("impossible");let u=this.zip;u.on("data",(t=>super.write(t))),u.on("end",(()=>super.end())),u.on("drain",(()=>this[ko]())),this.on("resume",(()=>u.resume()))}else this.on("drain",this[ko]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter=typeof t.filter=="function"?t.filter:()=>!0,this[Wn]=new jn,this[ao]=0,this.jobs=Number(t.jobs)||4,this[to]=!1,this[zn]=!1}[Ao](t){return super.write(t)}add(t){return this.write(t),this}end(t,u,p){return typeof t=="function"&&(p=t,t=void 0),typeof u=="function"&&(p=u,u=void 0),t&&this.add(t),this[zn]=!0,this[eo](),p&&p(),this}write(t){if(this[zn])throw new Error("write after end");return typeof t=="string"?this[uo](t):this[ho](t),this.flowing}[ho](t){let u=Vs(Ve.resolve(this.cwd,t.path));if(!this.filter(t.path,t))t.resume();else{let p=new Fn(t.path,u);p.entry=new Dn(t,this[xo](p)),p.entry.on("end",(()=>this[co](p))),this[ao]+=1,this[Wn].push(p)}this[eo]()}[uo](t){let u=Vs(Ve.resolve(this.cwd,t));this[Wn].push(new Fn(t,u)),this[eo]()}[fo](t){t.pending=!0,this[ao]+=1;let u=this.follow?"stat":"lstat";ze[u](t.absolute,((u,p)=>{t.pending=!1,this[ao]-=1,u?this.emit("error",u):this[Hn](t,p)}))}[Hn](t,u){if(this.statCache.set(t.absolute,u),t.stat=u,!this.filter(t.path,u))t.ignore=!0;else if(u.isFile()&&u.nlink>1&&!this.linkCache.get(`${u.dev}:${u.ino}`)&&!this.sync)if(t===this[Qn])this[ro](t);else{let p=`${u.dev}:${u.ino}`,m=this[Jn].get(p);m?m.push(t):this[Jn].set(p,[t]),t.pendingLink=!0,t.pending=!0}this[eo]()}[vo](t){t.pending=!0,this[ao]+=1,ze.readdir(t.absolute,((u,p)=>{if(t.pending=!1,this[ao]-=1,u)return this.emit("error",u);this[So](t,p)}))}[So](t,u){this.readdirCache.set(t.absolute,u),t.readdir=u,this[eo]()}[eo](){if(!this[to]){this[to]=!0;for(let t=this[Wn].head;t&&this[ao]<this.jobs;t=t.next)if(this[ro](t.value),t.value.ignore){let u=t.next;this[Wn].removeNode(t),t.next=u}this[to]=!1,this[zn]&&this[Wn].length===0&&this[ao]===0&&(this.zip?this.zip.end(Un):(super.write(Un),super.end()))}}get[Qn](){return this[Wn]&&this[Wn].head&&this[Wn].head.value}[co](t){this[Wn].shift(),this[ao]-=1;let{stat:u}=t;if(u&&u.isFile()&&u.nlink>1){let t=`${u.dev}:${u.ino}`,p=this[Jn].get(t);if(p){this[Jn].delete(t);for(let t of p)t.pending=!1,this[ro](t)}}this[eo]()}[ro](t){if(t.pending&&t.pendingLink&&t===this[Qn]&&(t.pending=!1,t.pendingLink=!1),!t.pending){if(t.entry){t===this[Qn]&&!t.piped&&this[$o](t);return}if(!t.stat){let u=this.statCache.get(t.absolute);u?this[Hn](t,u):this[fo](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let u=this.readdirCache.get(t.absolute);if(u?this[So](t,u):this[vo](t),!t.readdir)return}if(t.entry=this[Po](t),!t.entry){t.ignore=!0;return}t===this[Qn]&&!t.piped&&this[$o](t)}}}[xo](t){return{onwarn:(t,u,p)=>this.warn(t,u,p),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Po](t){this[ao]+=1;try{return new this[Oo](t.path,this[xo](t)).on("end",(()=>this[co](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[ko](){this[Qn]&&this[Qn].entry&&this[Qn].entry.resume()}[$o](t){t.piped=!0,t.readdir&&t.readdir.forEach((u=>{let p=t.path,m=p==="./"?"":p.replace(/\/*$/,"/");this[uo](m+u)}));let u=t.entry,p=this.zip;if(!u)throw new Error("cannot pipe without source");p?u.on("data",(t=>{p.write(t)||u.pause()})):u.on("data",(t=>{super.write(t)||u.pause()}))}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,u,p={}){Dt(this,t,u,p)}},Io=class extends Co{sync=!0;constructor(t){super(t),this[Oo]=Nn}pause(){}resume(){}[fo](t){let u=this.follow?"statSync":"lstatSync";this[Hn](t,ze[u](t.absolute))}[vo](t){this[So](t,ze.readdirSync(t.absolute))}[$o](t){let u=t.entry,p=this.zip;if(t.readdir&&t.readdir.forEach((u=>{let p=t.path,m=p==="./"?"":p.replace(/\/*$/,"/");this[uo](m+u)})),!u)throw new Error("Cannot pipe without source");p?u.on("data",(t=>{p.write(t)})):u.on("data",(t=>{super[Ao](t)}))}};var Vn=(t,u)=>{let p=new Io(t),m=new ss(t.file,{mode:t.mode||438});p.pipe(m),fr(p,u)},$n=(t,u)=>{let p=new Co(t),m=new rs(t.file,{mode:t.mode||438});p.pipe(m);let g=new Promise(((t,u)=>{m.on("error",u),m.on("close",t),p.on("error",u)}));return dr(p,u).catch((t=>p.emit("error",t))),g},fr=(t,u)=>{u.forEach((u=>{u.charAt(0)==="@"?Di({file:T.resolve(t.cwd,u.slice(1)),sync:!0,noResume:!0,onReadEntry:u=>t.add(u)}):t.add(u)})),t.end()},dr=async(t,u)=>{for(let p of u)p.charAt(0)==="@"?await Di({file:T.resolve(String(t.cwd),p.slice(1)),noResume:!0,onReadEntry:u=>{t.add(u)}}):t.add(p);t.end()},Xn=(t,u)=>{let p=new Io(t);return fr(p,u),p},qn=(t,u)=>{let p=new Co(t);return dr(p,u).catch((t=>p.emit("error",t))),p},No=K(Vn,$n,Xn,qn,((t,u)=>{if(!u?.length)throw new TypeError("no paths specified to add to archive")}));var Do=process.env.__FAKE_PLATFORM__||process.platform,jo=Do==="win32",{O_CREAT:Lo,O_NOFOLLOW:Mo,O_TRUNC:Fo,O_WRONLY:Uo}=ze.constants,Bo=Number(process.env.__FAKE_FS_O_FILENAME__)||ze.constants.UV_FS_O_FILEMAP||0,Ho=jo&&!!Bo,zo=512*1024,Vo=Bo|Fo|Lo|Uo,Go=!jo&&typeof Mo=="number"?Mo|Fo|Lo|Uo:null,qo=Go!==null?()=>Go:Ho?t=>t<zo?Vo:"w":()=>"w";var ps=(t,u,p)=>{try{return k.lchownSync(t,u,p)}catch(t){if(t?.code!=="ENOENT")throw t}},Ei=(t,u,p,m)=>{k.lchown(t,u,p,(t=>{m(t&&t?.code!=="ENOENT"?t:null)}))},io=(t,u,p,m,g)=>{if(u.isDirectory())Es(T.resolve(t,u.name),p,m,(v=>{if(v)return g(v);let b=T.resolve(t,u.name);Ei(b,p,m,g)}));else{let v=T.resolve(t,u.name);Ei(v,p,m,g)}},Es=(t,u,p,m)=>{k.readdir(t,{withFileTypes:!0},((g,v)=>{if(g){if(g.code==="ENOENT")return m();if(g.code!=="ENOTDIR"&&g.code!=="ENOTSUP")return m(g)}if(g||!v.length)return Ei(t,u,p,m);let b=v.length,w=null,a=g=>{if(!w){if(g)return m(w=g);if(--b===0)return Ei(t,u,p,m)}};for(let m of v)io(t,m,u,p,a)}))},so=(t,u,p,m)=>{u.isDirectory()&&ws(T.resolve(t,u.name),p,m),ps(T.resolve(t,u.name),p,m)},ws=(t,u,p)=>{let m;try{m=k.readdirSync(t,{withFileTypes:!0})}catch(m){let g=m;if(g?.code==="ENOENT")return;if(g?.code==="ENOTDIR"||g?.code==="ENOTSUP")return ps(t,u,p);throw g}for(let g of m)so(t,g,u,p);return ps(t,u,p)};var Wo=class extends Error{path;code;syscall="chdir";constructor(t,u){super(`${u}: Cannot cd into '${t}'`),this.path=t,this.code=u}get name(){return"CwdError"}};var Ko=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,u){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=u}get name(){return"SymlinkError"}};var no=(t,u)=>{k.stat(t,((p,m)=>{(p||!m.isDirectory())&&(p=new Wo(t,p?.code||"ENOTDIR")),u(p)}))},gr=(t,u,p)=>{t=Vs(t);let m=u.umask??18,g=u.mode|448,v=(g&m)!==0,b=u.uid,w=u.gid,E=typeof b=="number"&&typeof w=="number"&&(b!==u.processUid||w!==u.processGid),S=u.preserve,$=u.unlink,P=Vs(u.cwd),y=(u,m)=>{u?p(u):m&&E?Es(m,b,w,(t=>y(t))):v?k.chmod(t,g,p):p()};if(t===P)return no(t,y);if(S)return yt.mkdir(t,{mode:g,recursive:!0}).then((t=>y(null,t??void 0)),y);let R=Vs(T.relative(P,t)).split("/");Ss(P,R,g,$,P,void 0,y)},Ss=(t,u,p,m,g,v,b)=>{if(u.length===0)return b(null,v);let w=u.shift(),E=Vs(T.resolve(t+"/"+w));k.mkdir(E,p,br(E,u,p,m,g,v,b))},br=(t,u,p,m,g,v,b)=>w=>{w?k.lstat(t,((E,S)=>{if(E)E.path=E.path&&Vs(E.path),b(E);else if(S.isDirectory())Ss(t,u,p,m,g,v,b);else if(m)k.unlink(t,(w=>{if(w)return b(w);k.mkdir(t,p,br(t,u,p,m,g,v,b))}));else{if(S.isSymbolicLink())return b(new Ko(t,t+"/"+u.join("/")));b(w)}})):(v=v||t,Ss(t,u,p,m,g,v,b))},oo=t=>{let u=!1,p;try{u=k.statSync(t).isDirectory()}catch(t){p=t?.code}finally{if(!u)throw new Wo(t,p??"ENOTDIR")}},_r=(t,u)=>{t=Vs(t);let p=u.umask??18,m=u.mode|448,g=(m&p)!==0,v=u.uid,b=u.gid,w=typeof v=="number"&&typeof b=="number"&&(v!==u.processUid||b!==u.processGid),E=u.preserve,S=u.unlink,$=Vs(u.cwd),d=u=>{u&&w&&ws(u,v,b),g&&k.chmodSync(t,m)};if(t===$)return oo($),d();if(E)return d(k.mkdirSync(t,{mode:m,recursive:!0})??void 0);let P=Vs(T.relative($,t)).split("/"),R;for(let t=P.shift(),u=$;t&&(u+="/"+t);t=P.shift()){u=Vs(T.resolve(u));try{k.mkdirSync(u,m),R=R||u}catch{let t=k.lstatSync(u);if(t.isDirectory())continue;if(S){k.unlinkSync(u),k.mkdirSync(u,m),R=R||u;continue}else if(t.isSymbolicLink())return new Ko(u,u+"/"+P.join("/"))}}return d(R)};var Yo=Object.create(null),Zo=1e4,Jo=new Set,Tr=t=>{Jo.has(t)?Jo.delete(t):Yo[t]=t.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Jo.add(t);let u=Yo[t],p=Jo.size-Zo;if(p>Zo/10){for(let t of Jo)if(Jo.delete(t),delete Yo[t],--p<=0)break}return u};var Xo=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Qo=Xo==="win32",lo=t=>t.split("/").slice(0,-1).reduce(((t,u)=>{let p=t.at(-1);return p!==void 0&&(u=(0,T.join)(p,u)),t.push(u||"/"),t}),[]),ea=class{#i=new Map;#n=new Map;#o=new Set;reserve(t,u){t=Qo?["win32 parallelization disabled"]:t.map((t=>mt((0,T.join)(Tr(t)))));let p=new Set(t.map((t=>lo(t))).reduce(((t,u)=>t.concat(u))));this.#n.set(u,{dirs:p,paths:t});for(let p of t){let t=this.#i.get(p);t?t.push(u):this.#i.set(p,[u])}for(let t of p){let p=this.#i.get(t);if(!p)this.#i.set(t,[new Set([u])]);else{let t=p.at(-1);t instanceof Set?t.add(u):p.push(new Set([u]))}}return this.#c(u)}#a(t){let u=this.#n.get(t);if(!u)throw new Error("function does not have any path reservations");return{paths:u.paths.map((t=>this.#i.get(t))),dirs:[...u.dirs].map((t=>this.#i.get(t)))}}check(t){let{paths:u,dirs:p}=this.#a(t);return u.every((u=>u&&u[0]===t))&&p.every((u=>u&&u[0]instanceof Set&&u[0].has(t)))}#c(t){return this.#o.has(t)||!this.check(t)?!1:(this.#o.add(t),t((()=>this.#l(t))),!0)}#l(t){if(!this.#o.has(t))return!1;let u=this.#n.get(t);if(!u)throw new Error("invalid reservation");let{paths:p,dirs:m}=u,g=new Set;for(let u of p){let p=this.#i.get(u);if(!p||p?.[0]!==t)continue;let m=p[1];if(!m){this.#i.delete(u);continue}if(p.shift(),typeof m=="function")g.add(m);else for(let t of m)g.add(t)}for(let u of m){let p=this.#i.get(u),m=p?.[0];if(!(!p||!(m instanceof Set)))if(m.size===1&&p.length===1){this.#i.delete(u);continue}else if(m.size===1){p.shift();let t=p[0];typeof t=="function"&&g.add(t)}else m.delete(t)}return this.#o.delete(t),g.forEach((t=>this.#c(t))),!0}};var Lr=()=>process.umask();var ta=Symbol("onEntry"),ra=Symbol("checkFs"),sa=Symbol("checkFs2"),ia=Symbol("isReusable"),na=Symbol("makeFs"),oa=Symbol("file"),aa=Symbol("directory"),ca=Symbol("link"),la=Symbol("symlink"),ua=Symbol("hardlink"),ha=Symbol("ensureNoSymlink"),da=Symbol("unsupported"),fa=Symbol("checkPath"),pa=Symbol("stripAbsolutePath"),ma=Symbol("mkdir"),ga=Symbol("onError"),ya=Symbol("pending"),va=Symbol("pend"),_a=Symbol("unpend"),ba=Symbol("ended"),wa=Symbol("maybeClose"),Ea=Symbol("skip"),Sa=Symbol("doChown"),$a=Symbol("uid"),Pa=Symbol("gid"),Ra=Symbol("checkedCwd"),xa=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Oa=xa==="win32",Aa=1024,mo=(t,u)=>{if(!Oa)return k.unlink(t,u);let p=t+".DELETE."+(0,I.randomBytes)(16).toString("hex");k.rename(t,p,(t=>{if(t)return u(t);k.unlink(p,u)}))},po=t=>{if(!Oa)return k.unlinkSync(t);let u=t+".DELETE."+(0,I.randomBytes)(16).toString("hex");k.renameSync(t,u),k.unlinkSync(u)},vr=(t,u,p)=>t!==void 0&&t===t>>>0?t:u!==void 0&&u===u>>>0?u:p,ka=class extends Ni{[ba]=!1;[Ra]=!1;[ya]=0;reservations=new ea;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[ba]=!0,this[wa]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?process.getuid?.()===0:!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:Aa,this.forceChown=t.forceChown===!0,this.win32=!!t.win32||Oa,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=Vs(T.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:Lr():0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",(t=>this[ta](t)))}warn(t,u,p={}){return(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT")&&(p.recoverable=!1),super.warn(t,u,p)}[wa](){this[ba]&&this[ya]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[pa](t,u){let p=t[u],{type:m}=t;if(!p||this.preservePaths)return!0;let[g,v]=ce(p),b=v.replaceAll(/\\/g,"/").split("/");if(b.includes("..")||Oa&&/^[a-z]:\.\.$/i.test(b[0]??"")){if(u==="path"||m==="Link")return this.warn("TAR_ENTRY_ERROR",`${u} contains '..'`,{entry:t,[u]:p}),!1;let g=T.posix.dirname(t.path),v=T.posix.normalize(T.posix.join(g,b.join("/")));if(v.startsWith("../")||v==="..")return this.warn("TAR_ENTRY_ERROR",`${u} escapes extraction directory`,{entry:t,[u]:p}),!1}return g&&(t[u]=String(v),this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute ${u}`,{entry:t,[u]:p})),!0}[fa](t){let u=Vs(t.path),p=u.split("/");if(this.strip){if(p.length<this.strip)return!1;if(t.type==="Link"){let u=Vs(String(t.linkpath)).split("/");if(u.length>=this.strip)t.linkpath=u.slice(this.strip).join("/");else return!1}p.splice(0,this.strip),t.path=p.join("/")}if(isFinite(this.maxDepth)&&p.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:u,depth:p.length,maxDepth:this.maxDepth}),!1;if(!this[pa](t,"path")||!this[pa](t,"linkpath"))return!1;if(t.absolute=T.isAbsolute(t.path)?Vs(T.resolve(t.path)):Vs(T.resolve(this.cwd,t.path)),!this.preservePaths&&typeof t.absolute=="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:Vs(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir")return!1;if(this.win32){let{root:u}=T.win32.parse(String(t.absolute));t.absolute=u+ts(String(t.absolute).slice(u.length));let{root:p}=T.win32.parse(t.path);t.path=p+ts(t.path.slice(p.length))}return!0}[ta](t){if(!this[fa](t))return t.resume();switch(N.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=t.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[ra](t);default:return this[da](t)}}[ga](t,u){t.name==="CwdError"?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:u}),this[_a](),u.resume())}[ma](t,u,p){gr(Vs(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:u},p)}[Sa](t){return this.forceChown||this.preserveOwner&&(typeof t.uid=="number"&&t.uid!==this.processUid||typeof t.gid=="number"&&t.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[$a](t){return vr(this.uid,t.uid,this.processUid)}[Pa](t){return vr(this.gid,t.gid,this.processGid)}[oa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.fmode,m=new rs(String(t.absolute),{flags:qo(t.size),mode:p,autoClose:!1});m.on("error",(p=>{m.fd&&k.close(m.fd,(()=>{})),m.write=()=>!0,this[ga](p,t),u()}));let g=1,o=p=>{if(p){m.fd&&k.close(m.fd,(()=>{})),this[ga](p,t),u();return}--g===0&&m.fd!==void 0&&k.close(m.fd,(p=>{p?this[ga](p,t):this[_a](),u()}))};m.on("finish",(()=>{let u=String(t.absolute),p=m.fd;if(typeof p=="number"&&t.mtime&&!this.noMtime){g++;let m=t.atime||new Date,v=t.mtime;k.futimes(p,m,v,(t=>t?k.utimes(u,m,v,(u=>o(u&&t))):o()))}if(typeof p=="number"&&this[Sa](t)){g++;let m=this[$a](t),v=this[Pa](t);typeof m=="number"&&typeof v=="number"&&k.fchown(p,m,v,(t=>t?k.chown(u,m,v,(u=>o(u&&t))):o()))}o()}));let v=this.transform&&this.transform(t)||t;v!==t&&(v.on("error",(p=>{this[ga](p,t),u()})),t.pipe(v)),v.pipe(m)}[aa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.dmode;this[ma](String(t.absolute),p,(p=>{if(p){this[ga](p,t),u();return}let m=1,o=()=>{--m===0&&(u(),this[_a](),t.resume())};t.mtime&&!this.noMtime&&(m++,k.utimes(String(t.absolute),t.atime||new Date,t.mtime,o)),this[Sa](t)&&(m++,k.chown(String(t.absolute),Number(this[$a](t)),Number(this[Pa](t)),o)),o()}))}[da](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[la](t,u){let p=Vs(T.relative(this.cwd,T.resolve(T.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[ha](t,this.cwd,p,(()=>this[ca](t,String(t.linkpath),"symlink",u)),(p=>{this[ga](p,t),u()}))}[ua](t,u){let p=Vs(T.resolve(this.cwd,String(t.linkpath))),m=Vs(String(t.linkpath)).split("/");this[ha](t,this.cwd,m,(()=>this[ca](t,p,"link",u)),(p=>{this[ga](p,t),u()}))}[ha](t,u,p,m,g){let v=p.shift();if(this.preservePaths||v===void 0)return m();let b=T.resolve(u,v);k.lstat(b,((u,v)=>{if(u)return m();if(v?.isSymbolicLink())return g(new Ko(b,T.resolve(b,p.join("/"))));this[ha](t,b,p,m,g)}))}[va](){this[ya]++}[_a](){this[ya]--,this[wa]()}[Ea](t){this[_a](),t.resume()}[ia](t,u){return t.type==="File"&&!this.unlink&&u.isFile()&&u.nlink<=1&&!Oa}[ra](t){this[va]();let u=[t.path];t.linkpath&&u.push(t.linkpath),this.reservations.reserve(u,(u=>this[sa](t,u)))}[sa](t,u){let i=t=>{u(t)},r=()=>{this[ma](this.cwd,this.dmode,(u=>{if(u){this[ga](u,t),i();return}this[Ra]=!0,n()}))},n=()=>{if(t.absolute!==this.cwd){let u=Vs(T.dirname(String(t.absolute)));if(u!==this.cwd)return this[ma](u,this.dmode,(u=>{if(u){this[ga](u,t),i();return}o()}))}o()},o=()=>{k.lstat(String(t.absolute),((u,p)=>{if(p&&(this.keep||this.newer&&p.mtime>(t.mtime??p.mtime))){this[Ea](t),i();return}if(u||this[ia](t,p))return this[na](null,t,i);if(p.isDirectory()){if(t.type==="Directory"){let u=this.chmod&&t.mode&&(p.mode&4095)!==t.mode,c=u=>this[na](u??null,t,i);return u?k.chmod(String(t.absolute),Number(t.mode),c):c()}if(t.absolute!==this.cwd)return k.rmdir(String(t.absolute),(u=>this[na](u??null,t,i)))}if(t.absolute===this.cwd)return this[na](null,t,i);mo(String(t.absolute),(u=>this[na](u??null,t,i)))}))};this[Ra]?n():r()}[na](t,u,p){if(t){this[ga](t,u),p();return}switch(u.type){case"File":case"OldFile":case"ContiguousFile":return this[oa](u,p);case"Link":return this[ua](u,p);case"SymbolicLink":return this[la](u,p);case"Directory":case"GNUDumpDir":return this[aa](u,p)}}[ca](t,u,p,m){k[p](u,String(t.absolute),(u=>{u?this[ga](u,t):(this[_a](),t.resume()),m()}))}},ye=t=>{try{return[null,t()]}catch(t){return[t,null]}},Ta=class extends ka{sync=!0;[na](t,u){return super[na](t,u,(()=>{}))}[ra](t){if(!this[Ra]){let u=this[ma](this.cwd,this.dmode);if(u)return this[ga](u,t);this[Ra]=!0}if(t.absolute!==this.cwd){let u=Vs(T.dirname(String(t.absolute)));if(u!==this.cwd){let p=this[ma](u,this.dmode);if(p)return this[ga](p,t)}}let[u,p]=ye((()=>k.lstatSync(String(t.absolute))));if(p&&(this.keep||this.newer&&p.mtime>(t.mtime??p.mtime)))return this[Ea](t);if(u||this[ia](t,p))return this[na](null,t);if(p.isDirectory()){if(t.type==="Directory"){let u=this.chmod&&t.mode&&(p.mode&4095)!==t.mode,[m]=u?ye((()=>{k.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[na](m,t)}let[u]=ye((()=>k.rmdirSync(String(t.absolute))));this[na](u,t)}let[m]=t.absolute===this.cwd?[]:ye((()=>po(String(t.absolute))));this[na](m,t)}[oa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.fmode,r=p=>{let g;try{k.closeSync(m)}catch(t){g=t}(p||g)&&this[ga](p||g,t),u()},m;try{m=k.openSync(String(t.absolute),qo(t.size),p)}catch(t){return r(t)}let g=this.transform&&this.transform(t)||t;g!==t&&(g.on("error",(u=>this[ga](u,t))),t.pipe(g)),g.on("data",(t=>{try{k.writeSync(m,t,0,t.length)}catch(t){r(t)}})),g.on("end",(()=>{let u=null;if(t.mtime&&!this.noMtime){let p=t.atime||new Date,g=t.mtime;try{k.futimesSync(m,p,g)}catch(m){try{k.utimesSync(String(t.absolute),p,g)}catch{u=m}}}if(this[Sa](t)){let p=this[$a](t),g=this[Pa](t);try{k.fchownSync(m,Number(p),Number(g))}catch(m){try{k.chownSync(String(t.absolute),Number(p),Number(g))}catch{u=u||m}}}r(u)}))}[aa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.dmode,m=this[ma](String(t.absolute),p);if(m){this[ga](m,t),u();return}if(t.mtime&&!this.noMtime)try{k.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[Sa](t))try{k.chownSync(String(t.absolute),Number(this[$a](t)),Number(this[Pa](t)))}catch{}u(),t.resume()}[ma](t,u){try{return _r(Vs(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:u})}catch(t){return t}}[ha](t,u,p,m,g){if(this.preservePaths||p.length===0)return m();let v=u;for(let t of p){v=T.resolve(v,t);let[b,w]=ye((()=>k.lstatSync(v)));if(b)return m();if(w.isSymbolicLink())return g(new Ko(v,T.resolve(u,p.join("/"))))}m()}[ca](t,u,p,m){let g=`${p}Sync`;try{k[g](u,String(t.absolute)),m(),t.resume()}catch(u){return this[ga](u,t)}}};var Eo=t=>{let u=new Ta(t),p=t.file,m=k.statSync(p),g=t.maxReadSize||16*1024*1024;new es(p,{readSize:g,size:m.size}).pipe(u)},wo=(t,u)=>{let p=new ka(t),m=t.maxReadSize||16*1024*1024,g=t.file;return new Promise(((t,u)=>{p.on("error",u),p.on("close",t),k.stat(g,((t,v)=>{if(t)u(t);else{let t=new Qr(g,{readSize:m,size:v.size});t.on("error",u),t.pipe(p)}}))}))},Ca=K(Eo,wo,(t=>new Ta(t)),(t=>new ka(t)),((t,u)=>{u?.length&&Qi(t,u)}));var yo=(t,u)=>{let p=new Io(t),m=!0,g,v;try{try{g=k.openSync(t.file,"r+")}catch(u){if(u?.code==="ENOENT")g=k.openSync(t.file,"w+");else throw u}let b=k.fstatSync(g),w=Buffer.alloc(512);e:for(v=0;v<b.size;v+=512){for(let t=0,u=0;t<512;t+=u){if(u=k.readSync(g,w,t,w.length-t,v+t),v===0&&w[0]===31&&w[1]===139)throw new Error("cannot append to compressed archives");if(!u)break e}let u=new Ns(w);if(!u.cksumValid)break;let p=512*Math.ceil((u.size||0)/512);if(v+p+512>b.size)break;v+=p,t.mtimeCache&&u.mtime&&t.mtimeCache.set(String(u.path),u.mtime)}m=!1,Ro(t,p,v,g,u)}finally{if(m)try{k.closeSync(g)}catch{}}},Ro=(t,u,p,m,g)=>{let v=new ss(t.file,{fd:m,start:p});u.pipe(v),bo(u,g)},go=(t,u)=>{u=Array.from(u);let p=new Co(t),i=(u,p,m)=>{let a=(t,p)=>{t?k.close(u,(u=>m(t))):m(null,p)},g=0;if(p===0)return a(null,0);let v=0,b=Buffer.alloc(512),y=(m,w)=>{if(m||w===void 0)return a(m);if(v+=w,v<512&&w)return k.read(u,b,v,b.length-v,g+v,y);if(g===0&&b[0]===31&&b[1]===139)return a(new Error("cannot append to compressed archives"));if(v<512)return a(null,g);let E=new Ns(b);if(!E.cksumValid)return a(null,g);let S=512*Math.ceil((E.size??0)/512);if(g+S+512>p||(g+=S+512,g>=p))return a(null,g);t.mtimeCache&&E.mtime&&t.mtimeCache.set(String(E.path),E.mtime),v=0,k.read(u,b,0,512,g,y)};k.read(u,b,0,512,g,y)};return new Promise(((m,g)=>{p.on("error",g);let v="r+",a=(b,w)=>{if(b&&b.code==="ENOENT"&&v==="r+")return v="w+",k.open(t.file,v,a);if(b||!w)return g(b);k.fstat(w,((v,b)=>{if(v)return k.close(w,(()=>g(v)));i(w,b.size,((v,b)=>{if(v)return g(v);let E=new rs(t.file,{fd:w,start:b});p.pipe(E),E.on("error",g),E.on("close",m),_o(p,u)}))}))};k.open(t.file,v,a)}))},bo=(t,u)=>{u.forEach((u=>{u.charAt(0)==="@"?Di({file:T.resolve(t.cwd,u.slice(1)),sync:!0,noResume:!0,onReadEntry:u=>t.add(u)}):t.add(u)})),t.end()},_o=async(t,u)=>{for(let p of u)p.charAt(0)==="@"?await Di({file:T.resolve(String(t.cwd),p.slice(1)),noResume:!0,onReadEntry:u=>t.add(u)}):t.add(p);t.end()},Ia=K(yo,go,(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,u)=>{if(!Bs(t))throw new TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!u?.length)throw new TypeError("no paths specified to add/replace")}));var Na=K(Ia.syncFile,Ia.asyncFile,Ia.syncNoFile,Ia.asyncNoFile,((t,u=[])=>{Ia.validate?.(t,u),To(t)})),To=t=>{let u=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=u?(p,m)=>u(p,m)&&!((t.mtimeCache?.get(p)??m.mtime??0)>(m.mtime??0)):(u,p)=>!((t.mtimeCache?.get(u)??p.mtime??0)>(p.mtime??0))};const Da="none";const ja=[{title:"Claude Code",value:"claude",description:"CLAUDE.md, .claude/, .mcp.json"},{title:"GitHub Copilot",value:"copilot",description:".github/copilot-instructions.md, .mcp.json"},{title:"Cursor",value:"cursor",description:".cursorrules, .mcp.json"},{title:"Windsurf",value:"windsurf",description:".windsurfrules, .mcp.json"},{title:"OpenAI Codex",value:"codex",description:"AGENTS.md, .mcp.json"},{title:"None",value:Da,description:"Skip AI agent setup"}];function resolveAgentSelection(t){if(t.includes(Da)){return[]}return t}const La="https://codeload.github.com/zuplo/tools/tar.gz/main";const Ma={claude:".claude/skills",copilot:".agents/skills",cursor:".cursor/skills",windsurf:".windsurf/skills",codex:".agents/skills"};const Fa={claude:"CLAUDE.md",copilot:".github/copilot-instructions.md",cursor:".cursorrules",windsurf:".windsurfrules",codex:"AGENTS.md"};function getSharedInstructions(){return`## Project Overview\n\nThis is a Zuplo API gateway project with an accompanying Zudoku-based developer portal.\n\n## Commands\n\n- **Dev server:** \`npm run dev\` (runs on http://localhost:9000)\n- **Run tests:** \`npm run test\`\n- **Typecheck:** \`npm run typecheck\`\n- **Dev portal:** \`npm run docs\`\n\n## Architecture\n\n- **\`config/routes.oas.json\`** — OpenAPI 3.1 route definitions. Each operation uses \`x-zuplo-route\` to configure handlers (e.g., \`urlForwardHandler\`) and policies. This is the primary file for defining API routes.\n- **\`config/policies.json\`** — Policy configurations applied to routes (e.g., \`MockApiInboundPolicy\`).\n- **\`modules/\`** — Custom TypeScript request handlers. Handlers receive \`(ZuploRequest, ZuploContext)\` and return a \`Response\` or serializable value.\n- **\`docs/\`** — Zudoku developer portal (separate workspace). Config is in \`docs/zudoku.config.tsx\`. Reads the OpenAPI spec from \`../config/routes.oas.json\`.\n- **\`zuplo.jsonc\`** — Zuplo project configuration (version, compatibility date).\n\n## Key Patterns\n\n- Routes are configured declaratively in \`config/routes.oas.json\`, not in code. Custom logic goes in \`modules/\` and is referenced via \`x-zuplo-route.handler\`.\n- The project uses ESM (\`"type": "module"\`) with TypeScript targeting ES2022.\n- Environment variables are defined in \`.env\` (gitignored). See \`.env.example\` for available vars.`}function getLocalDocsSection(){return`## Local Documentation (node_modules)\n\nFull markdown documentation is bundled in node_modules and can be read directly:\n\n- **Zuplo docs:** \`node_modules/zuplo/docs/\` — includes docs on policies (\`policies/\`), handlers (\`handlers/\`), CLI (\`cli/\`), dev portal (\`dev-portal/\`), guides, and articles.\n- **Zuplo policy configs:** \`node_modules/zuplo/docs/policies/\` — each policy has its own folder with full configuration docs. Reference these when adding or configuring policies in \`config/policies.json\`.\n- **Zudoku docs:** \`docs/node_modules/zudoku/docs/\` — configuration, components, customization, plugins, and deployment docs for the developer portal.`}function getGenericInstructions(){return`${getSharedInstructions()}\n\n${getLocalDocsSection()}\n`}function getClaudeMd(){return`# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n${getSharedInstructions()}\n\n## Available Tools and Documentation\n\n### MCP Tools\n\n- **Zuplo Docs MCP** (configured in \`.mcp.json\`) — search Zuplo documentation via \`mcp__zuplo_docs__ask-question-about-zuplo\` and \`mcp__zuplo_docs__search-zuplo-docs\`.\n- **Zuplo Skills** — installed skills for working with Zuplo projects: \`zuplo-guide\`, \`zuplo-project-setup\`, \`zuplo-policies\`, \`zuplo-handlers\`, \`zuplo-monetization\`, \`zuplo-cli\`, and \`zudoku-guide\`.\n\n${getLocalDocsSection()}\n`}function getClaudeSettings(){return JSON.stringify({enabledPlugins:{"zudoku-skills@zuplo-tools":true,"zuplo-skills@zuplo-tools":true},extraKnownMarketplaces:{"zuplo-tools":{source:{source:"github",repo:"zuplo/tools"}}},enableAllProjectMcpServers:true},null,2)}function getMcpJson(){return JSON.stringify({mcpServers:{zuplo_docs:{type:"http",url:"https://dev.zuplo.com/mcp/docs"}}},null,2)}async function agents_writeFile(t,u){await et().mkdir(Ge().dirname(t),{recursive:true});await et().writeFile(t,u+rt().EOL,"utf-8")}async function downloadSkillsToTmp(){const t=await et().mkdtemp(Ge().join(rt().tmpdir(),"zuplo-skills-"));const u=await fetch(La);if(!u.body){throw new Error("Failed to download zuplo/tools tarball")}const p=u.body;const m=st.Readable.fromWeb(p);let g=0;const v=new st.Transform({transform(t,u,p){g+=t.length;if(g>10*1024*1024){return p(new Error("Download too large"))}p(null,t)}});await(0,it.pipeline)(m.pipe(v),Ca({cwd:t,strip:1,filter:t=>/\/skills\/[^/]+\/SKILL\.md$/.test(t)}));return t}async function installSkills(t,u){const p=await downloadSkillsToTmp();try{const m=Ge().join(p,"skills");let g;try{g=await et().readdir(m)}catch{throw new Error("No skills found in zuplo/tools tarball")}for(const p of u){const u=Ma[p];for(const p of g){const g=Ge().join(m,p,"SKILL.md");try{const m=await et().readFile(g,"utf-8");await agents_writeFile(Ge().join(t,u,p,"SKILL.md"),m)}catch{}}}}finally{await et().rm(p,{recursive:true,force:true})}}async function installAgentConfigs(t,u){if(u.length>0){await agents_writeFile(Ge().join(t,".mcp.json"),getMcpJson())}for(const p of u){if(p==="claude"){await agents_writeFile(Ge().join(t,".claude","settings.json"),getClaudeSettings());await agents_writeFile(Ge().join(t,"CLAUDE.md"),getClaudeMd())}else{await agents_writeFile(Ge().join(t,Fa[p]),getGenericInstructions())}}const p=u.filter((t=>t!=="claude"));if(p.length>0){try{console.log("Installing Zuplo agent skills...");await installSkills(t,p)}catch{console.log("Failed to download agent skills. You can install them later with:");console.log(" npx skills add zuplo/tools")}}}async function isUrlOk(t){try{const u=await fetch(t,{method:"HEAD"});return u.status===200}catch{return false}}async function getRepoInfo(t,u){const[,p,m,g,v,...b]=t.pathname.split("/");const w=u?u.replace(/^\//,""):b.join("/");if(g===undefined||g===""&&v===undefined){try{const t=await fetch(`https://api.github.com/repos/${p}/${m}`);if(t.status!==200){return}const u=await t.json();return{username:p,name:m,branch:u["default_branch"],filePath:w}}catch{return}}const E=u?`${v}/${b.join("/")}`.replace(new RegExp(`/${w}|/$`),""):v;if(p&&m&&E&&g==="tree"){return{username:p,name:m,branch:E,filePath:w}}}function hasRepo({username:t,name:u,branch:p,filePath:m}){const g=`https://api.github.com/repos/${t}/${u}/contents`;const v=`${m?`/${m}`:""}/package.json`;return isUrlOk(`${g+v}?ref=${p}`)}function existsInRepo(t){try{const u=new URL(t);return isUrlOk(u.href)}catch{return isUrlOk(`https://api.github.com/repos/zuplo/zuplo/contents/examples/${encodeURIComponent(t)}`)}}async function downloadTarStream(t,u=50*1024*1024){const p=await fetch(t);if(!p.body){throw new Error(`Failed to download: ${t}`)}const m=p.headers.get("content-length");if(m&&parseInt(m,10)>u){throw new Error(`File too large! ${m} bytes exceeds limit of ${u} bytes`)}const g=p.body;const v=st.Readable.fromWeb(g);let b=0;const w=new st.Transform({transform(t,p,m){b+=t.length;if(b>u){return m(new Error(`Download aborted! File size exceeded ${u} bytes`))}m(null,t)}});return v.pipe(w)}async function downloadAndExtractRepo(t,{username:u,name:p,branch:m,filePath:g},v){const b=`https://codeload.github.com/${u}/${p}/tar.gz/${m}`;if(v){console.log(`Downloading repo from ${b}`)}let w=null;await(0,it.pipeline)(await downloadTarStream(b),Ca({cwd:t,strip:g?g.split("/").length+1:1,filter:t=>{if(w===null){const u=t.split(Ve.sep);w=u.length?u[0]:null}return t.startsWith(`${w}${g?`/${g}/`:"/"}`)}}))}async function downloadAndExtractExample(t,u,p){if(u==="__internal-testing-retry"){throw new Error("This is an internal example for testing the CLI.")}const m="https://codeload.github.com/zuplo/zuplo/tar.gz/main";if(p){console.log(`Downloading example from ${m}`)}await(0,it.pipeline)(await downloadTarStream(m),Ca({cwd:t,strip:2+u.split("/").length,filter:t=>t.includes(`zuplo-main/examples/${u}/`)}))}var Ua=__nccwpck_require__(5317);function isInGitRepository(){try{(0,Ua.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch{}return false}function isInMercurialRepository(){try{(0,Ua.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch{}return false}function isDefaultBranchSet(){try{(0,Ua.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch{}return false}function tryGitInit(t,u){let p=false;const m=u?"inherit":"ignore";try{(0,Ua.execSync)("git --version",{stdio:m});if(isInGitRepository()||isInMercurialRepository()){return false}(0,Ua.execSync)("git init",{stdio:m});p=true;if(!isDefaultBranchSet()){(0,Ua.execSync)("git checkout -b main",{stdio:m})}(0,Ua.execSync)("git add -A",{stdio:m});(0,Ua.execSync)('git commit -m "Initial commit from create-zuplo-api"',{stdio:m});return true}catch(m){if(u){console.error("Git init failed:",m)}if(p){try{(0,ze.rmSync)((0,Ve.join)(t,".git"),{recursive:true,force:true})}catch{}}return false}}var Ba=__nccwpck_require__(4791);var Ha=__nccwpck_require__.n(Ba);async function install(t,u,p){const m=["install"];if(!u){console.log((0,qe.yellow)("You appear to be offline.\nFalling back to the local cache."));m.push("--offline")}else if(t==="npm"){m.push("--no-audit");m.push("--no-fund")}if(p){m.push("--verbose")}return new Promise(((u,p)=>{const g=Ha()(t,m,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});g.on("close",(g=>{if(g!==0){p({command:`${t} ${m.join(" ")}`});return}u()}))}))}function isFolderEmpty(t,u){const p=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const m=(0,ze.readdirSync)(t).filter((t=>!p.includes(t)&&!/\.iml$/.test(t)));if(m.length>0){console.log(`The directory ${(0,qe.green)(u)} contains files that could conflict:`);console.log();for(const u of m){try{const p=(0,ze.lstatSync)((0,Ve.join)(t,u));if(p.isDirectory()){console.log(` ${(0,qe.blue)(u)}/`)}else{console.log(` ${u}`)}}catch{console.log(` ${u}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}const za=require("dns/promises");var Va=__nccwpck_require__(7016);var Ga=__nccwpck_require__.n(Va);function getProxy(){if(process.env.https_proxy){return process.env.https_proxy}try{const t=(0,Ua.execSync)("npm config get https-proxy").toString().trim();return t!=="null"?t:undefined}catch{return}}async function getOnline(){try{await(0,za.lookup)("registry.yarnpkg.com");return true}catch{const t=getProxy();if(!t){return false}const{hostname:u}=Ga().parse(t);if(!u){return false}try{await(0,za.lookup)(u);return true}catch{return false}}}const qa=require("constants");async function isWriteable(t){try{await(0,Qe.access)(t,qa.W_OK);return true}catch{return false}}function unquote(t){if(t.length<2){return t}const u=t[0];const p=t[t.length-1];if(u==='"'&&p==='"'||u==="'"&&p==="'"){return t.slice(1,-1)}return t}function extractEnvValue(t,u){const p=new RegExp(`^${u}=(.*)$`,"m").exec(t);if(!p){return undefined}const m=unquote(p[1].trim());return m.length>0?m:undefined}function readLinkedConfig(t){try{const u=(0,ze.readFileSync)((0,Ve.join)(t,".env.zuplo"),"utf-8");const p=extractEnvValue(u,"ZUPLO_ACCOUNT_NAME");const m=extractEnvValue(u,"ZUPLO_PROJECT_NAME");if(!p||!m){return undefined}return{account:p,project:m}}catch{return undefined}}function getZuploAuthFilePath(){var t;const u=(t=process.env.XDG_DATA_HOME)!==null&&t!==void 0?t:(0,Ve.join)((0,tt.homedir)(),".local","state");return(0,Ve.join)(u,"zuplo","auth.json")}function getZuploDeveloperApiEndpoint(){var t;return(t=process.env.ZUPLO_DEVELOPER_API_ENDPOINT)!==null&&t!==void 0?t:"https://dev.zuplo.com"}function readZuploAccessToken(){try{const t=getZuploAuthFilePath();if(!(0,ze.existsSync)(t)){return undefined}const u=(0,ze.readFileSync)(t,"utf-8");const p=JSON.parse(u);return typeof p.access_token==="string"?p.access_token:undefined}catch{return undefined}}async function fetchZuploAccountNames(t){try{const u=await fetch(`${getZuploDeveloperApiEndpoint()}/v1/accounts`,{method:"GET",headers:{Authorization:`Bearer ${t}`}});if(!u.ok){return undefined}const p=await u.json();if(!Array.isArray(p.data)){return undefined}return p.data.map((t=>typeof(t===null||t===void 0?void 0:t.name)==="string"?t.name:undefined)).filter((t=>typeof t==="string")).sort(((t,u)=>t.localeCompare(u)))}catch{return undefined}}async function probeProjectDeployments(t,u,p){try{const m=`${getZuploDeveloperApiEndpoint()}/v1/accounts/${encodeURIComponent(u)}/projects/${encodeURIComponent(p)}/deployments`;const g=await fetch(m,{method:"GET",headers:{Authorization:`Bearer ${t}`}});if(!g.ok){return{exists:false,soleWorkingCopy:undefined}}const v=await g.json();if(!Array.isArray(v.data)){return{exists:true,soleWorkingCopy:undefined}}const b=v.data.filter((t=>(t===null||t===void 0?void 0:t.environmentType)==="WORKING_COPY")).map((t=>typeof(t===null||t===void 0?void 0:t.name)==="string"?t.name:undefined)).filter((t=>typeof t==="string"));return{exists:true,soleWorkingCopy:b.length===1?b[0]:undefined}}catch{return{exists:false,soleWorkingCopy:undefined}}}async function fetchSoleWorkingCopyName(t,u,p){const m=await probeProjectDeployments(t,u,p);return m.soleWorkingCopy}async function findAccountWithProject(t,u,p){for(const m of u){const u=await probeProjectDeployments(t,m,p);if(u.exists){return{account:m,soleWorkingCopy:u.soleWorkingCopy}}}return undefined}const defaultRunZuplo=t=>new Promise(((u,p)=>{const m=process.platform==="win32"?"npx.cmd":"npx";const g=(0,Ua.spawn)(m,["zuplo",...t],{stdio:"inherit"});g.on("close",((m,g)=>{if(m===0){u();return}let v;if(m!==null&&m!==undefined){v=`exited with code ${m}`}else if(g){v=`was terminated by signal ${g}`}else{v="exited unsuccessfully"}p(new Error(`"zuplo ${t.join(" ")}" ${v}.`))}));g.on("error",p)}));const defaultPromptForAccount=async t=>{const u=await Ke()({type:"select",name:"account",message:"Which Zuplo account should host this project?",choices:t.map((t=>({title:t,value:t}))),onState:t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}}});return typeof u.account==="string"?u.account:undefined};const Wa={readToken:readZuploAccessToken,fetchAccounts:fetchZuploAccountNames,fetchWorkingCopy:fetchSoleWorkingCopyName,findAccountWithProject:findAccountWithProject,readLinked:readLinkedConfig,runZuplo:defaultRunZuplo,promptForAccount:defaultPromptForAccount};async function createAndLinkServerProject(t,u=Wa){const{appPath:p,appName:m,account:g,skipPrompts:v}=t;let b=(g===null||g===void 0?void 0:g.trim())||undefined;if(!b){const t=u.readToken();const p=t?await u.fetchAccounts(t):undefined;if(p&&p.length===1){b=p[0];console.log();console.log(`Using Zuplo account ${(0,qe.cyan)(`'${b}'`)}.`)}else if(v){console.log();console.log(`${(0,qe.yellow)("Note:")} Skipping server-project setup in non-interactive mode.`);console.log(`Pass ${(0,qe.cyan)("--account <name>")} to create a server project, or ${(0,qe.cyan)("--no-server-project")} to silence this note.`);return undefined}else if(p&&p.length>1){b=await u.promptForAccount(p)}}console.log();console.log("Creating your project on portal.zuplo.com...");console.log();const w=["project","create","--name",m];if(b){w.push("--account",b)}try{await u.runZuplo(w)}catch{console.log();console.log(`${(0,qe.yellow)("Note:")} Failed to create the server project. Your local files are ready.`);console.log(`You can finish setup later by running ${(0,qe.cyan)(`zuplo project create --name ${m}`)} and ${(0,qe.cyan)(`zuplo link`)} from inside your project directory.`);return undefined}console.log();console.log("Linking your working copy to the server project...");console.log();const E=["link","--dir",p,"--project",m];let S;if(!b){const t=u.readToken();if(t){const p=await u.fetchAccounts(t);if(p&&p.length===1){b=p[0]}else if(p&&p.length>1){const g=await u.findAccountWithProject(t,p,m);if(g){b=g.account;S=g.soleWorkingCopy}}}}if(b){E.push("--account",b)}if(b){if(S){E.push("--environment",S)}else{const t=u.readToken();if(t){const p=await u.fetchWorkingCopy(t,b,m);if(p){E.push("--environment",p)}}}}try{await u.runZuplo(E)}catch{console.log();console.log(`${(0,qe.yellow)("Note:")} The server project was created but linking failed.`);console.log(`You can finish setup later by running ${(0,qe.cyan)(`zuplo link`)} from inside your project directory.`);return undefined}return u.readLinked(p)}var Ka=__nccwpck_require__(4761);const identity=t=>t;const copy=async(t,u,{cwd:p,rename:m=identity,parents:g=true,verbose:v=false}={})=>{const b=typeof t==="string"?[t]:t;if(b.length===0||!u){throw new TypeError("`src` and `dest` are required")}const w=await(0,Ka.async)(b,{cwd:p,dot:true,absolute:false,stats:false});const E=p?(0,Ve.resolve)(p,u):u;return Promise.all(w.map((async t=>{const u=(0,Ve.dirname)(t);const b=m((0,Ve.basename)(t),t);const w=p?(0,Ve.resolve)(p,t):t;const S=g?(0,Ve.join)(E,u,b):(0,Ve.join)(E,b);await(0,Qe.mkdir)((0,Ve.dirname)(S),{recursive:true});if(v){console.log(`Copying ${w} to ${S}`)}return(0,Qe.copyFile)(w,S)})))};const Ya=["eslint","biome","oxlint","none"];const Za=["prettier","biome","oxfmt","none"];function isLinter(t){return Ya.includes(t)}function isFormatter(t){return Za.includes(t)}const Ja=[{title:"ESLint",value:"eslint",description:"The most widely used JavaScript/TypeScript linter"},{title:"Biome",value:"biome",description:"Fast Rust-based linter (can also format)"},{title:"Oxlint",value:"oxlint",description:"Fast Rust-based linter from the Oxc project"},{title:"None",value:"none",description:"Skip linter setup"}];const Xa=[{title:"Prettier",value:"prettier",description:"The most widely used code formatter"},{title:"Biome",value:"biome",description:"Fast Rust-based formatter (can also lint)"},{title:"Oxfmt",value:"oxfmt",description:"Fast Rust-based, Prettier-compatible formatter (beta)"},{title:"None",value:"none",description:"Skip formatter setup"}];function resolveLinterFromLegacyFlags({eslint:t,noEslint:u}){if(t)return"eslint";if(u)return"none";return undefined}function resolveFormatterFromLegacyFlags({prettier:t,noPrettier:u}){if(t)return"prettier";if(u)return"none";return undefined}function migrateLegacyLintPreferences(t){if(t.linter===undefined&&typeof t.eslint==="boolean"){t.linter=t.eslint?"eslint":"none"}if(t.formatter===undefined&&typeof t.prettier==="boolean"){t.formatter=t.prettier?"prettier":"none"}delete t.eslint;delete t.prettier}function eslintConfig(t){const u=[`import js from "@eslint/js";`,`import { defineConfig } from "eslint/config";`,...t?[`import prettier from "eslint-config-prettier/flat";`]:[],`import tseslint from "typescript-eslint";`,``,`export default defineConfig(`,` js.configs.recommended,`,` tseslint.configs.recommended,`,...t?[` prettier,`]:[],`);`,``];return u.join(rt().EOL)}function biomeConfig({lint:t,format:u}){return JSON.stringify({$schema:"https://biomejs.dev/schemas/2.5.3/schema.json",vcs:{enabled:true,clientKind:"git",useIgnoreFile:true},files:{ignoreUnknown:true},linter:{enabled:t,rules:{preset:"recommended"}},formatter:u?{enabled:true,indentStyle:"space"}:{enabled:false},assist:{enabled:true,actions:{source:{organizeImports:"on"}}}},null,2)+rt().EOL}function oxlintConfig(){return JSON.stringify({$schema:"./node_modules/oxlint/configuration_schema.json",categories:{correctness:"error"}},null,2)+rt().EOL}function prettierConfig(){return JSON.stringify({overrides:[{files:"*.jsonc",options:{trailingComma:"none"}}]},null,2)+rt().EOL}function oxfmtConfig(){return[`{`,` "$schema": "./node_modules/oxfmt/configuration_schema.json",`,` "printWidth": 80,`,` "overrides": [`,` {`,` "files": ["*.jsonc"],`,` "options": {`,` "trailingComma": "none"`,` }`,` }`,` ]`,`}`,``].join(rt().EOL)}function buildLintFormatSetup(t,u){const p={};const m={};const g={};const v=[];switch(t){case"eslint":{p.lint="eslint";p["lint:fix"]="eslint --fix";m["@eslint/js"]="^10";m.eslint="^10";m["typescript-eslint"]="^8";g["eslint.config.js"]=eslintConfig(u==="prettier");if(u==="prettier"){m["eslint-config-prettier"]="^10"}v.push("dbaeumer.vscode-eslint");break}case"oxlint":{p.lint="oxlint";p["lint:fix"]="oxlint --fix";m.oxlint="^1";g[".oxlintrc.json"]=oxlintConfig();v.push("oxc.oxc-vscode");break}case"biome":{p.lint="biome lint .";p["lint:fix"]="biome lint --write .";break}case"none":break}switch(u){case"prettier":{p.format="prettier --write .";p["format:check"]="prettier --check .";m.prettier="^3";g[".prettierrc.json"]=prettierConfig();v.push("esbenp.prettier-vscode");break}case"oxfmt":{p.format="oxfmt";p["format:check"]="oxfmt --check";m.oxfmt="^0.58.0";g[".oxfmtrc.json"]=oxfmtConfig();if(!v.includes("oxc.oxc-vscode")){v.push("oxc.oxc-vscode")}break}case"biome":{p.format="biome format --write .";p["format:check"]="biome format .";break}case"none":break}if(t==="biome"||u==="biome"){m["@biomejs/biome"]="^2";g["biome.json"]=biomeConfig({lint:t==="biome",format:u==="biome"});v.push("biomejs.biome")}return{scripts:p,docsScripts:p.lint?{lint:p.lint}:{},devDependencies:m,files:g,vscodeExtensions:v}}function buildProjectDependencies(t,u){const p={zuplo:`^${u}`};if(t==="default"||t==="default-empty"){p["@zuplo/otel"]=`^${u}`}return p}const getTemplateFile=({template:t,file:u})=>__nccwpck_require__.ab+"templates/"+t+"/"+u;const installTemplate=async({appName:t,root:u,packageManager:p,isOnline:m,template:g,linter:v,formatter:b,installPackages:w,verbose:E,zuploVersion:S,agents:$})=>{var P;console.log((0,qe.bold)(`Using ${p}.`));console.log("\nInitializing project with template:",g,"\n");const R=__nccwpck_require__.ab+"templates/"+g;const x=(0,ze.existsSync)(Ge().join(R,"docs"));const O=["**","!vscode/**"];await copy(O,u,{parents:true,cwd:R,verbose:E,rename(t){switch(t){case"gitignore":case"env.example":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});const A=buildLintFormatSetup(v,b);for(const[t,p]of Object.entries(A.files)){await et().writeFile(Ge().join(u,t),p,"utf-8")}const k=["settings.json","launch.json"];for(const t of k){const p=Ge().join(R,"vscode",t);const m=Ge().join(u,".vscode",t);if((0,ze.existsSync)(p)){await et().mkdir(Ge().join(u,".vscode"),{recursive:true});await et().copyFile(p,m)}}if(A.vscodeExtensions.length>0){await et().mkdir(Ge().join(u,".vscode"),{recursive:true});const t=A.vscodeExtensions.map((t=>`"${t}"`)).join(", ");await et().writeFile(Ge().join(u,".vscode","extensions.json"),`{${rt().EOL} "recommendations": [${t}]${rt().EOL}}${rt().EOL}`,"utf-8")}const T=(P=process.env.ZUPLO_PRIVATE_TEST_VERSION)!==null&&P!==void 0?P:S;const C=new ke.SemVer(T);const I={name:t,version:"0.1.0",private:true,type:"module",scripts:{dev:`zuplo dev`,test:"zuplo test",typecheck:"tsc --noEmit",...x?{docs:"zuplo docs"}:{},...A.scripts},dependencies:buildProjectDependencies(g,C.major),devDependencies:{typescript:"^5","@types/node":"^22",...A.devDependencies}};if(x){if(p==="pnpm"){await et().writeFile(Ge().join(u,"pnpm-workspace.yaml"),["packages:",' - "docs"',"onlyBuiltDependencies:",' - "@swc/core"'," - deno"," - esbuild"," - protobufjs"," - workerd",""].join(rt().EOL),"utf-8")}else{I.workspaces=["docs"]}}const sortObjectKeys=t=>Object.keys(t).sort().reduce(((u,p)=>{u[p]=t[p];return u}),{});if(I.dependencies){I.dependencies=sortObjectKeys(I.dependencies)}if(I.devDependencies){I.devDependencies=sortObjectKeys(I.devDependencies)}const N=Object.keys(I.devDependencies).length;if(!N)delete I.devDependencies;await et().writeFile(Ge().join(u,"package.json"),JSON.stringify(I,null,2)+rt().EOL);let D="^0.82";if(x&&m){try{const t=await fetch("https://api.github.com/repos/zuplo/zudoku/releases/latest");const u=await t.json();const p=u.tag_name.replace("v","");const m=new ke.SemVer(p);D=`^${m.major}.${m.minor}`}catch{console.warn("\nFailed to determine the latest dev portal version. Using the default version.")}}const j=[{name:"@zudoku/plugin-graphql",label:"GraphQL plugin"},{name:"@zuplo/zudoku-plugin-monetization",label:"monetization plugin"}];const L={};for(const{name:t,label:u}of j){let p="latest";if(x&&m){try{const u=await fetch(`https://registry.npmjs.org/${t}/latest`);const m=await u.json();const g=new ke.SemVer(m.version);p=`^${g.major}.${g.minor}`}catch{console.warn(`\nFailed to determine the latest ${u} version. Using the default version.`)}}L[t]=p}const M={name:"docs",version:"0.1.0",private:true,type:"module",scripts:{dev:"zudoku dev --zuplo",build:"zudoku build --zuplo",...A.docsScripts},dependencies:sortObjectKeys({react:"^19","react-dom":"^19","@mdx-js/react":"3.0.1",...L,zudoku:D}),devDependencies:{"@types/node":"^22","@types/react":"^19","@types/react-dom":"^19",typescript:"^5"}};if(x){await et().writeFile(Ge().join(u,"docs","package.json"),JSON.stringify(M,null,2)+rt().EOL)}if($.length>0){await installAgentConfigs(u,$);const t=Ge().join(u,"README.md");const p=await et().readFile(t,"utf-8");const m=["","## AI Coding Agents","","This project is configured for AI coding agents. Skills from","[zuplo/tools](https://github.com/zuplo/tools) provide agents with Zuplo and","Zudoku-specific knowledge.","","To update skills to the latest version:","","```bash","npx skills add zuplo/tools","```","","Learn more about using AI agents with Zuplo at","[zuplo.com/docs/articles/ai-agents](https://zuplo.com/docs/articles/ai-agents).",""].join("\n");await et().writeFile(t,p+m,"utf-8")}if(!w)return;console.log("\nInstalling dependencies:");for(const t in I.dependencies)console.log(`- ${(0,qe.cyan)(t)}`);if(N){console.log("\nInstalling devDependencies:");for(const t in I.devDependencies)console.log(`- ${(0,qe.cyan)(t)}`)}console.log();await install(p,m,E)};class DownloadError extends Error{}async function createApp({appPath:t,packageManager:u,example:p,examplePath:m,template:g,linter:v,formatter:b,installPackages:w,empty:E,initGit:S,verbose:$,zuploVersion:P,serverProject:R,account:x,skipPrompts:O,agents:A}){let k;const T=g!==null&&g!==void 0?g:`default${E?"-empty":""}`;if(p){let H;try{H=new URL(p)}catch(z){const V=z;if(V.code!=="ERR_INVALID_URL"){console.error(z);process.exit(1)}}if(H){if(H.origin!=="https://github.com"){console.error(`Invalid URL: ${(0,qe.red)(`"${p}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);process.exit(1)}k=await getRepoInfo(H,m);if(!k){console.error(`Found invalid GitHub URL: ${(0,qe.red)(`"${p}"`)}. Please fix the URL and try again.`);process.exit(1)}const G=await hasRepo(k);if(!G){console.error(`Could not locate the repository for ${(0,qe.red)(`"${p}"`)}. Please check that the repository exists and try again.`);process.exit(1)}}else if(p!=="__internal-testing-retry"){const q=await existsInRepo(p);if(!q){console.error(`Could not locate an example named ${(0,qe.red)(`"${p}"`)}. It could be due to the following:\n`,`1. Your spelling of example ${(0,qe.red)(`"${p}"`)} might be incorrect.\n`,`2. You might not be connected to the internet or you are behind a proxy.`);process.exit(1)}}}const C=(0,Ve.resolve)(t);if(!await isWriteable((0,Ve.dirname)(C))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const I=(0,Ve.basename)(C);(0,ze.mkdirSync)(C,{recursive:true});if(!isFolderEmpty(C,I)){process.exit(1)}const N=u==="yarn";const D=!N||await getOnline();const j=process.cwd();console.log(`Creating a new Zuplo API in ${(0,qe.green)(C)}.`);console.log();process.chdir(C);const L=(0,Ve.join)(C,"package.json");let M=false;if(p){try{if(k){const Y=k;console.log(`Downloading files from repo ${(0,qe.cyan)(p)}. This might take a moment.`);console.log();await Xe()((()=>downloadAndExtractRepo(C,Y,$)),{retries:3})}else{console.log(`Downloading files for example ${(0,qe.cyan)(p)}. This might take a moment.`);console.log();await Xe()((()=>downloadAndExtractExample(C,p,$)),{retries:3})}}catch(Z){function isErrorLike(t){return typeof t==="object"&&t!==null&&typeof t.message==="string"}throw new DownloadError(isErrorLike(Z)?Z.message:`${Z}`)}const W=(0,Ve.join)(C,".gitignore");if(!(0,ze.existsSync)(W)){(0,ze.copyFileSync)(getTemplateFile({template:T,file:"gitignore"}),W)}if(A.length>0){await installAgentConfigs(C,A)}M=(0,ze.existsSync)(L);if(w&&M){console.log("Installing packages. This might take a couple of minutes.");console.log();await install(u,D,$);console.log()}}else{await installTemplate({appName:I,root:C,template:T,packageManager:u,isOnline:D,linter:v,formatter:b,installPackages:w,verbose:$,zuploVersion:P,agents:A})}if(S){if(tryGitInit(C,$)){console.log("Initialized a git repository.");console.log()}}let U;if((0,Ve.join)(j,I)===t){U=I}else{U=t}console.log(`${(0,qe.green)("Success!")} Created ${I} at ${t}`);let B;if(R){B=await createAndLinkServerProject({appPath:C,appName:I,account:x,skipPrompts:O})}if(B){const J=`https://portal.zuplo.com/${B.account}/${B.project}`;console.log();console.log(`${(0,qe.green)("Success!")} Your project ${(0,qe.cyan)(`'${B.project}'`)} has been created in account ${(0,qe.cyan)(`'${B.account}'`)}.`);console.log();console.log("You can access this project online at:");console.log(` ${(0,qe.cyan)(J)}`);console.log();console.log("To connect your project to source control for easy, automated deployments:");console.log(` ${(0,qe.cyan)(`${J}/settings/source-control-settings`)}`);console.log()}if(M){console.log("Inside that directory, you can run several commands:");console.log();console.log((0,qe.cyan)(` ${u} ${N?"":"run "}dev`));console.log(" Starts the development server.");console.log();console.log((0,qe.cyan)(` ${u} ${N?"":"run "}build`));console.log(" Builds the app for production.");console.log();console.log((0,qe.cyan)(` ${u} start`));console.log(" Runs the built app in production mode.");console.log();console.log("We suggest that you begin by typing:");console.log();console.log((0,qe.cyan)(" cd"),U);console.log(` ${(0,qe.cyan)(`${u} ${N?"":"run "}dev`)}`)}console.log()}const Qa=require("crypto");function basename(t){if(!t){return undefined}return C().basename(t).toLowerCase()}function parseUserAgent(t){var u;const p=t===null||t===void 0?void 0:t.match(/^([^/\s]+)\/([^\s]+)/);const m=(u=p===null||p===void 0?void 0:p[1])===null||u===void 0?void 0:u.toLowerCase();switch(m){case"npm":case"pnpm":case"yarn":case"bun":return{family:m,version:p===null||p===void 0?void 0:p[2]};default:return{family:"unknown"}}}function inferFamilyFromExecutable(t){if(t==="npm"||t==="npm-cli.js"||t==="npx"||t==="npx-cli.js"){return"npm"}if(t==="pnpm"||t==="pnpm.cjs"||t==="pnpx"){return"pnpm"}if(t==="yarn"||t==="yarn.js"){return"yarn"}if(t==="bun"||t==="bunx"){return"bun"}return undefined}function inferRunner({family:t,command:u,execPathBasename:p,runnerBasename:m}){if(t==="npm"){if(p==="npx-cli.js"||m==="npx"){return"npx"}if(u==="init"||u==="create"){return"npm-create"}if(u==="exec"){return"npm-exec"}return"npm"}if(t==="pnpm"){if(m==="pnpx"||p==="pnpx"){return"pnpx"}if(u==="create"||u==="init"){return"pnpm-create"}if(u==="dlx"){return"pnpm-dlx"}if(u==="exec"){return"pnpm-exec"}return"pnpm"}if(t==="yarn"){if(u==="create"){return"yarn-create"}if(u==="dlx"){return"yarn-dlx"}return"yarn"}if(t==="bun"){if(m==="bunx"){return"bunx"}if(u==="create"){return"bun-create"}return"bun"}return"unknown"}function inferInstallSource(t){if(!t){return"unknown"}const u=t.toLowerCase().replace(/\\/g,"/");if(u.includes("/node_modules/.bin/")){return"project-local"}if(u.includes("/corepack/")){return"corepack"}if(u.includes("/.volta/")||u.includes("/volta/")){return"volta"}if(u.includes("/.nvm/")){return"nvm"}if(u.includes("/.asdf/")){return"asdf"}if(u.includes("/.fnm/")||u.includes("/fnm_multishells/")){return"fnm"}if(u.includes("/homebrew/")||u.includes("/cellar/")||u.startsWith("/opt/homebrew/")){return"homebrew"}if(u.startsWith("/usr/bin/")||u.startsWith("/usr/local/bin/")||u.startsWith("/usr/local/lib/")||u.startsWith("/bin/")||u.startsWith("c:/program files/")||u.startsWith("c:/programdata/")){return"system"}return"unknown"}function getPackageManagerUsageProperties(t=process.env){var u,p,m;const g=t["npm_config_user_agent"]||undefined;const v=(u=t["npm_command"])===null||u===void 0?void 0:u.toLowerCase();const b=t["npm_execpath"];const w=basename(b);const E=basename(t["_"]);const S=parseUserAgent(g);const $=S.family!=="unknown"?S.family:(m=(p=inferFamilyFromExecutable(E))!==null&&p!==void 0?p:inferFamilyFromExecutable(w))!==null&&m!==void 0?m:"unknown";return{packageManager:$,packageManagerVersion:S.version,runner:inferRunner({family:$,command:v,execPathBasename:w,runnerBasename:E}),installSource:inferInstallSource(b),nodeVersion:process.versions.node,platform:process.platform,arch:process.arch}}function getPkgManager(){const{packageManager:t}=getPackageManagerUsageProperties();if(t!=="unknown"){return t}return"npm"}const ec="phc_xB1aydh7a41MW9TwUtLJjKme4izQiWf9zKbKhpysAiW";const tc="https://app.posthog.com";const rc=1e3;function isAnalyticsEnabled(){return!process.env.ZUPLO_DO_NOT_TRACK}function getOrCreateAnalyticsDistinctId(t){try{const u=t.get("analyticsDistinctId");if(typeof u==="string"&&u.length>0){return u}const p=(0,Qa.randomUUID)();try{t.set("analyticsDistinctId",p)}catch{}return p}catch{return(0,Qa.randomUUID)()}}async function captureCreateZuploApiEvent({distinctId:t,event:u,properties:p}){if(!isAnalyticsEnabled()){return}const m=new AbortController;const g=setTimeout((()=>m.abort()),rc);g.unref();try{await fetch(`${tc}/capture/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({["api_key"]:ec,event:u,["distinct_id"]:t,properties:{...getPackageManagerUsageProperties(),...p!==null&&p!==void 0?p:{}},timestamp:(new Date).toISOString()}),signal:m.signal})}catch{}finally{clearTimeout(g)}}function resolvePackageManager(t,u){if(t.useNpm)return"npm";if(t.usePnpm)return"pnpm";if(t.useYarn)return"yarn";if(t.useBun)return"bun";return u()}function resolveNegatableFlag(t,u,p){return t!==null&&t!==void 0?t:!u.includes(p)}function parseAgentsFlag(t){const u=t.split(",").map((t=>t.trim())).filter(Boolean);const p=new Set(ja.map((t=>t.value)));const m=u.filter((t=>!p.has(t)));if(m.length>0){return{ok:false,error:`Invalid agent value(s): ${m.join(", ")}\nValid agents are: ${Array.from(p).join(", ")}`}}if(u.includes(Da)){if(u.some((t=>t!==Da))){return{ok:false,error:`'none' cannot be combined with other agents. Use --agents none to skip agent setup, or list specific agents.`}}return{ok:true,agents:[]}}return{ok:true,agents:u}}const sc=["default","default-empty","ai-gateway"];function resolveTemplate(t){const{template:u,empty:p,example:m}=t;if(u===undefined){return{template:p?"default-empty":"default"}}if(m){return{error:"The --template option cannot be combined with --example. Remove one of the two options."}}if(p){return{error:"The --template option cannot be combined with --empty. Use --template default-empty instead."}}const g=sc.find((t=>t===u));if(!g){return{error:`Unknown template "${u}". Valid templates are: ${sc.join(", ")}.`}}return{template:g}}function resolveServerProjectFromFlags(t){if(t.noServerProject){return false}if(t.serverProject){return true}if(typeof t.account==="string"&&t.account.trim().length>0){return true}return undefined}var ic=__nccwpck_require__(7825);var nc=__nccwpck_require__.n(ic);function validateNpmName(t){const u=nc()(t);if(u.validForNewPackages){return{valid:true}}return{valid:false,problems:[...u.errors||[],...u.warnings||[]]}}let oc="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const ac=JSON.parse((0,ze.readFileSync)(Ge().resolve(__dirname,Ge().join("..","package.json")),"utf-8"));const cc=new $(ac.name).version(ac.version,"-v, --version","Output the current version of create-zuplo-api.").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","Display this help message.").option("--linter <linter>",`The linter to configure: ${Ya.join(", ")}.`).option("--formatter <formatter>",`The formatter to configure: ${Za.join(", ")}.`).option("--eslint","Initialize with ESLint config. (deprecated: use --linter eslint)").option("--prettier","Initialize with Prettier config. (deprecated: use --formatter prettier)").option("--empty","Initialize an empty project.").option("--use-npm","Explicitly tell the CLI to bootstrap the application using npm.").option("--use-pnpm","Explicitly tell the CLI to bootstrap the application using pnpm.").option("--use-yarn","Explicitly tell the CLI to bootstrap the application using Yarn.").option("--use-bun","Explicitly tell the CLI to bootstrap the application using Bun.").option("--reset, --reset-preferences","Reset the preferences saved for create-zuplo-api.").option("--git","Whether or not to initialize the project as a git repo.").option("--version-check","Whether or not to check for an outdated version.").option("--install","Whether or not to install packages.").option("--verbose","Enable verbose logging.",false).option("--yes","Use saved preferences or defaults for unprovided options.").option("--server-project","Create a matching project on portal.zuplo.com and link this working copy to it (skips the interactive prompt).").option("--account <account-name>","The Zuplo account that will host the server project. Implies --server-project.").option("--agents <agents>","Comma-separated list of AI coding agents to configure (claude,copilot,cursor,windsurf,codex), or 'none' to skip agent setup.").option("--template <template-name>",`\n\n A built-in template to bootstrap the api with (default, default-empty,\n ai-gateway). Cannot be combined with --example or --empty.\n`).option("-e, --example <example-name|github-url>",`\n\n An example to bootstrap the api with. You can use an example name\n from the official Zuplo repo or a public GitHub URL. The URL can use\n any branch and/or subdirectory.\n`).option("--example-path <path-to-example>",`\n\n In a rare case, your GitHub URL might contain a branch name with\n a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).\n In this case, you must specify the path to the example separately:\n --example-path foo/bar\n`).action((t=>{if(t&&!t.startsWith("-")){oc=t}})).allowUnknownOption().parse(process.argv);const lc=cc.opts();const{args:uc}=cc;const hc=resolvePackageManager(lc,getPkgManager);async function run(){var t,p,m,g,v,b,w,E,S;const $=new Conf({projectName:"create-zuplo-api"});if(typeof lc.linter==="string"&&!isLinter(lc.linter)){console.error((0,qe.red)(`Invalid linter: "${lc.linter}"\nValid linters are: ${Ya.join(", ")}`));process.exit(1)}if(typeof lc.formatter==="string"&&!isFormatter(lc.formatter)){console.error((0,qe.red)(`Invalid formatter: "${lc.formatter}"\nValid formatters are: ${Za.join(", ")}`));process.exit(1)}if(lc.resetPreferences){const{resetPreferences:t}=await Ke()({onState:onPromptState,type:"toggle",name:"resetPreferences",message:"Would you like to reset the saved preferences?",initial:false,active:"Yes",inactive:"No"});if(t){$.clear();console.log("The preferences have been reset successfully!")}process.exit(0)}if(typeof oc==="string"){oc=oc.trim()}if(!oc){const t=await Ke()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-api",validate:t=>{const u=validateNpmName((0,Ve.basename)((0,Ve.resolve)(t)));if(u.valid){return true}return`Invalid project name: ${u.problems[0]}`}});if(typeof t.path==="string"){oc=t.path.trim()}}if(!oc){console.log("\nPlease specify the project directory:\n"+` ${(0,qe.cyan)(lc.name())} ${(0,qe.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,qe.cyan)(lc.name())} ${(0,qe.green)("my-zuplo-api")}\n\n`+`Run ${(0,qe.cyan)(`${lc.name()} --help`)} to see all options.`);process.exit(1)}const P=(0,Ve.resolve)(oc);const R=(0,Ve.basename)(P);const x=validateNpmName(R);if(!x.valid){console.error(`Could not create a project called ${(0,qe.red)(`"${R}"`)} because of npm naming restrictions:`);x.problems.forEach((t=>console.error(` ${(0,qe.red)((0,qe.bold)("*"))} ${t}`)));process.exit(1)}if(lc.example===true){console.error("Please provide an example name or url, otherwise remove the example option.");process.exit(1)}if((0,ze.existsSync)(P)&&!isFolderEmpty(P,R)){process.exit(1)}const O=typeof lc.example==="string"&&lc.example.trim();const A=resolveTemplate({template:typeof lc.template==="string"?lc.template:undefined,empty:Boolean(lc.empty),example:Boolean(O)});if("error"in A){console.error((0,qe.red)(A.error));process.exit(1)}const k=$.get("preferences")||{};const T=u().isCI||lc.yes;let C=resolveServerProjectFromFlags({noServerProject:uc.includes("--no-server-project"),serverProject:lc.serverProject===true,account:typeof lc.account==="string"?lc.account:undefined});if(C===undefined&&!T){const{serverProject:t}=await Ke()({onState:onPromptState,type:"toggle",name:"serverProject",message:"Create a matching project on portal.zuplo.com?",hint:"Connect this working copy to your Zuplo account so you can deploy and manage it from portal.zuplo.com.",initial:true,active:"Yes",inactive:"No"});C=Boolean(t)}if(!O){const u={linter:"eslint",formatter:"prettier",git:true,install:true,versionCheck:true,empty:false,zudoku:false};migrateLegacyLintPreferences(k);const getPrefOrDefault=t=>{var p;return(p=k[t])!==null&&p!==void 0?p:u[t]};if(!lc.linter){const t=resolveLinterFromLegacyFlags({eslint:lc.eslint===true,noEslint:uc.includes("--no-eslint")});if(t){lc.linter=t}else if(T){lc.linter=getPrefOrDefault("linter")}else{const t=getPrefOrDefault("linter");const{linter:u}=await Ke()({onState:onPromptState,type:"select",name:"linter",message:`Which ${(0,qe.blue)("linter")} would you like to use?`,choices:Ja,initial:Math.max(0,Ja.findIndex((u=>u.value===t)))});lc.linter=u;k.linter=lc.linter}}if(!lc.formatter){const p=resolveFormatterFromLegacyFlags({prettier:lc.prettier===true,noPrettier:uc.includes("--no-prettier")});if(p){lc.formatter=p}else if(T){lc.formatter=getPrefOrDefault("formatter")}else{const p=(t=k.formatter)!==null&&t!==void 0?t:lc.linter==="biome"?"biome":u.formatter;const{formatter:m}=await Ke()({onState:onPromptState,type:"select",name:"formatter",message:`Which ${(0,qe.blue)("formatter")} would you like to use?`,choices:Xa,initial:Math.max(0,Xa.findIndex((t=>t.value===p)))});lc.formatter=m;k.formatter=lc.formatter}}if(!lc.agents){if(T){lc.agents=[]}else{const{agents:t}=await Ke()({onState:onPromptState,type:"multiselect",name:"agents",message:"Which AI coding agents would you like to configure?",choices:ja,hint:"- Space to select. Return to submit"});lc.agents=resolveAgentSelection((p=t)!==null&&p!==void 0?p:[])}}}lc.git=resolveNegatableFlag(lc.git,uc,"--no-git");lc.install=resolveNegatableFlag(lc.install,uc,"--no-install");lc.versionCheck=resolveNegatableFlag(lc.versionCheck,uc,"--no-version-check");lc.serverProject=C!==null&&C!==void 0?C:false;if(typeof lc.agents==="string"){const t=parseAgentsFlag(lc.agents);if(!t.ok){console.error((0,qe.red)(t.error));process.exit(1)}lc.agents=t.agents}lc.agents=(m=lc.agents)!==null&&m!==void 0?m:[];if(isAnalyticsEnabled()){void captureCreateZuploApiEvent({distinctId:getOrCreateAnalyticsDistinctId($),event:"create-zuplo-api invoked",properties:{version:ac.version,selectedPackageManager:hc,hasExample:Boolean(O),emptyTemplate:Boolean(lc.empty),installPackages:Boolean(lc.install),initGit:Boolean(lc.git),serverProject:Boolean(lc.serverProject),skipPrompts:T,agentsCount:lc.agents.length,linter:(g=lc.linter)!==null&&g!==void 0?g:null,formatter:(v=lc.formatter)!==null&&v!==void 0?v:null}})}try{await createApp({appPath:P,packageManager:hc,example:O&&O!=="default"?O:undefined,examplePath:lc.examplePath,template:A.template,linter:(b=lc.linter)!==null&&b!==void 0?b:"none",formatter:(w=lc.formatter)!==null&&w!==void 0?w:"none",installPackages:lc.install,empty:lc.empty,initGit:lc.git,verbose:lc.verbose,zuploVersion:ac.version,serverProject:lc.serverProject,account:lc.account,skipPrompts:T,agents:lc.agents})}catch(t){if(!(t instanceof DownloadError)){throw t}const u=await Ke()({onState:onPromptState,type:"confirm",name:"builtin",message:`Could not download "${O}" because of a connectivity issue between your machine and GitHub.\n`+`Do you want to use the default template instead?`,initial:true});if(!u.builtin){throw t}await createApp({appPath:P,packageManager:hc,template:A.template,linter:(E=lc.linter)!==null&&E!==void 0?E:"none",formatter:(S=lc.formatter)!==null&&S!==void 0?S:"none",installPackages:lc.install,empty:lc.empty,initGit:lc.git,verbose:lc.verbose,zuploVersion:ac.version,serverProject:lc.serverProject,account:lc.account,skipPrompts:T,agents:lc.agents})}$.set("preferences",k);if(lc.versionCheck){console.log();await notifyUpdate()}}const dc=Ze()(ac).catch((()=>null));async function notifyUpdate(){var t;try{if((t=await dc)===null||t===void 0?void 0:t.latest){const t={npm:"npm i -g",yarn:"yarn global add",pnpm:"pnpm add -g",bun:"bun add -g"};const u=`${t[hc]} create-zuplo-api`;console.log((0,qe.yellow)((0,qe.bold)("A new version of `create-zuplo-api` is available!"))+"\n"+"You can update by running: "+(0,qe.cyan)(u)+"\n")}process.exit(0)}catch{}}async function exit(t){console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,qe.cyan)(t.command)} has failed.`)}else{console.log(`${(0,qe.red)("Unexpected error. Please report it as a bug:")}\n`,t)}process.exit(1)}run().catch(exit)})();module.exports=p})();
72
+ */const m=p(7311);const toRegexRange=(t,u,p)=>{if(m(t)===false){throw new TypeError("toRegexRange: expected the first argument to be a number")}if(u===void 0||t===u){return String(t)}if(m(u)===false){throw new TypeError("toRegexRange: expected the second argument to be a number.")}let g={relaxZeros:true,...p};if(typeof g.strictZeros==="boolean"){g.relaxZeros=g.strictZeros===false}let v=String(g.relaxZeros);let b=String(g.shorthand);let w=String(g.capture);let E=String(g.wrap);let S=t+":"+u+"="+v+b+w+E;if(toRegexRange.cache.hasOwnProperty(S)){return toRegexRange.cache[S].result}let $=Math.min(t,u);let P=Math.max(t,u);if(Math.abs($-P)===1){let p=t+"|"+u;if(g.capture){return`(${p})`}if(g.wrap===false){return p}return`(?:${p})`}let R=hasPadding(t)||hasPadding(u);let x={min:t,max:u,a:$,b:P};let O=[];let A=[];if(R){x.isPadded=R;x.maxLen=String(x.max).length}if($<0){let t=P<0?Math.abs(P):1;A=splitToPatterns(t,Math.abs($),x,g);$=x.a=0}if(P>=0){O=splitToPatterns($,P,x,g)}x.negatives=A;x.positives=O;x.result=collatePatterns(A,O,g);if(g.capture===true){x.result=`(${x.result})`}else if(g.wrap!==false&&O.length+A.length>1){x.result=`(?:${x.result})`}toRegexRange.cache[S]=x;return x.result};function collatePatterns(t,u,p){let m=filterPatterns(t,u,"-",false,p)||[];let g=filterPatterns(u,t,"",false,p)||[];let v=filterPatterns(t,u,"-?",true,p)||[];let b=m.concat(v).concat(g);return b.join("|")}function splitToRanges(t,u){let p=1;let m=1;let g=countNines(t,p);let v=new Set([u]);while(t<=g&&g<=u){v.add(g);p+=1;g=countNines(t,p)}g=countZeros(u+1,m)-1;while(t<g&&g<=u){v.add(g);m+=1;g=countZeros(u+1,m)-1}v=[...v];v.sort(compare);return v}function rangeToPattern(t,u,p){if(t===u){return{pattern:t,count:[],digits:0}}let m=zip(t,u);let g=m.length;let v="";let b=0;for(let t=0;t<g;t++){let[u,g]=m[t];if(u===g){v+=u}else if(u!=="0"||g!=="9"){v+=toCharacterClass(u,g,p)}else{b++}}if(b){v+=p.shorthand===true?"\\d":"[0-9]"}return{pattern:v,count:[b],digits:g}}function splitToPatterns(t,u,p,m){let g=splitToRanges(t,u);let v=[];let b=t;let w;for(let t=0;t<g.length;t++){let u=g[t];let E=rangeToPattern(String(b),String(u),m);let S="";if(!p.isPadded&&w&&w.pattern===E.pattern){if(w.count.length>1){w.count.pop()}w.count.push(E.count[0]);w.string=w.pattern+toQuantifier(w.count);b=u+1;continue}if(p.isPadded){S=padZeros(u,p,m)}E.string=S+E.pattern+toQuantifier(E.count);v.push(E);b=u+1;w=E}return v}function filterPatterns(t,u,p,m,g){let v=[];for(let g of t){let{string:t}=g;if(!m&&!contains(u,"string",t)){v.push(p+t)}if(m&&contains(u,"string",t)){v.push(p+t)}}return v}function zip(t,u){let p=[];for(let m=0;m<t.length;m++)p.push([t[m],u[m]]);return p}function compare(t,u){return t>u?1:u>t?-1:0}function contains(t,u,p){return t.some((t=>t[u]===p))}function countNines(t,u){return Number(String(t).slice(0,-u)+"9".repeat(u))}function countZeros(t,u){return t-t%Math.pow(10,u)}function toQuantifier(t){let[u=0,p=""]=t;if(p||u>1){return`{${u+(p?","+p:"")}}`}return""}function toCharacterClass(t,u,p){return`[${t}${u-t===1?"":"-"}${u}]`}function hasPadding(t){return/^-?(0+)\d/.test(t)}function padZeros(t,u,p){if(!u.isPadded){return t}let m=Math.abs(u.maxLen-String(t).length);let g=p.relaxZeros!==false;switch(m){case 0:return"";case 1:return g?"0?":"0";case 2:return g?"0{0,2}":"00";default:{return g?`0{0,${m}}`:`0{${m}}`}}}toRegexRange.cache={};toRegexRange.clearCache=()=>toRegexRange.cache={};t.exports=toRegexRange},1083:(t,u,p)=>{const{URL:m}=p(7016);const{join:g}=p(6928);const v=p(9896);const{promisify:b}=p(9023);const{tmpdir:w}=p(857);const E=p(2804);const S=b(v.writeFile);const $=b(v.mkdir);const P=b(v.readFile);const compareVersions=(t,u)=>t.localeCompare(u,"en-US",{numeric:true});const encode=t=>encodeURIComponent(t).replace(/^%40/,"@");const getFile=async(t,u)=>{const p=w();const m=g(p,"update-check");if(!v.existsSync(m)){await $(m)}let b=`${t.name}-${u}.json`;if(t.scope){b=`${t.scope}-${b}`}return g(m,b)};const evaluateCache=async(t,u,p)=>{if(v.existsSync(t)){const m=await P(t,"utf8");const{lastUpdate:g,latest:v}=JSON.parse(m);const b=g+p;if(b>u){return{shouldCheck:false,latest:v}}}return{shouldCheck:true,latest:null}};const updateCache=async(t,u,p)=>{const m=JSON.stringify({latest:u,lastUpdate:p});await S(t,m,"utf8")};const loadPackage=(t,u)=>new Promise(((m,g)=>{const v={host:t.hostname,path:t.pathname,port:t.port,headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},timeout:2e3};if(u){v.headers.authorization=`${u.type} ${u.token}`}const{get:b}=p(t.protocol==="https:"?5692:8611);b(v,(t=>{const{statusCode:u}=t;if(u!==200){const p=new Error(`Request failed with code ${u}`);p.code=u;g(p);t.resume();return}let p="";t.setEncoding("utf8");t.on("data",(t=>{p+=t}));t.on("end",(()=>{try{const t=JSON.parse(p);m(t)}catch(t){g(t)}}))})).on("error",g).on("timeout",g)}));const getMostRecent=async({full:t,scope:u},g)=>{const v=E(u);const b=new m(t,v);let w=null;try{w=await loadPackage(b)}catch(t){if(t.code&&String(t.code).startsWith(4)){const t=p(373);const u=t(v,{recursive:true});w=await loadPackage(b,u)}else{throw t}}const S=w["dist-tags"][g];if(!S){throw new Error(`Distribution tag ${g} is not available`)}return S};const R={interval:36e5,distTag:"latest"};const getDetails=t=>{const u={full:encode(t)};if(t.includes("/")){const p=t.split("/");u.scope=p[0];u.name=p[1]}else{u.scope=null;u.name=t}return u};t.exports=async(t,u)=>{if(typeof t!=="object"){throw new Error("The first parameter should be your package.json file content")}const p=getDetails(t.name);const m=Date.now();const{distTag:g,interval:v}=Object.assign({},R,u);const b=await getFile(p,g);let w=null;let E=true;({shouldCheck:E,latest:w}=await evaluateCache(b,m,v));if(E){w=await getMostRecent(p,g);await updateCache(b,w,m)}const S=compareVersions(t.version,w);if(S===-1){return{latest:w,fromCache:!E}}return null}},3969:(t,u,p)=>{const m=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys";const g=p(6928);const v=m?";":":";const b=p(6173);const getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"});const getPathInfo=(t,u)=>{const p=u.colon||v;const g=t.match(/\//)||m&&t.match(/\\/)?[""]:[...m?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(p)];const b=m?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"";const w=m?b.split(p):[""];if(m){if(t.indexOf(".")!==-1&&w[0]!=="")w.unshift("")}return{pathEnv:g,pathExt:w,pathExtExe:b}};const which=(t,u,p)=>{if(typeof u==="function"){p=u;u={}}if(!u)u={};const{pathEnv:m,pathExt:v,pathExtExe:w}=getPathInfo(t,u);const E=[];const step=p=>new Promise(((v,b)=>{if(p===m.length)return u.all&&E.length?v(E):b(getNotFoundError(t));const w=m[p];const S=/^".*"$/.test(w)?w.slice(1,-1):w;const $=g.join(S,t);const P=!S&&/^\.[\\\/]/.test(t)?t.slice(0,2)+$:$;v(subStep(P,p,0))}));const subStep=(t,p,m)=>new Promise(((g,S)=>{if(m===v.length)return g(step(p+1));const $=v[m];b(t+$,{pathExt:w},((v,b)=>{if(!v&&b){if(u.all)E.push(t+$);else return g(t+$)}return g(subStep(t,p,m+1))}))}));return p?step(0).then((t=>p(null,t)),p):step(0)};const whichSync=(t,u)=>{u=u||{};const{pathEnv:p,pathExt:m,pathExtExe:v}=getPathInfo(t,u);const w=[];for(let E=0;E<p.length;E++){const S=p[E];const $=/^".*"$/.test(S)?S.slice(1,-1):S;const P=g.join($,t);const R=!$&&/^\.[\\\/]/.test(t)?t.slice(0,2)+P:P;for(let t=0;t<m.length;t++){const p=R+m[t];try{const t=b.sync(p,{pathExt:v});if(t){if(u.all)w.push(p);else return p}}catch(t){}}}if(u.all&&w.length)return w;if(u.nothrow)return null;throw getNotFoundError(t)};t.exports=which;which.sync=whichSync},6395:(t,u,p)=>{"use strict";const m=p(2040);const g=process.env;Object.defineProperty(u,"_vendors",{value:m.map((function(t){return t.constant}))});u.name=null;u.isPR=null;m.forEach((function(t){const p=Array.isArray(t.env)?t.env:[t.env];const m=p.every((function(t){return checkEnv(t)}));u[t.constant]=m;if(!m){return}u.name=t.name;switch(typeof t.pr){case"string":u.isPR=!!g[t.pr];break;case"object":if("env"in t.pr){u.isPR=t.pr.env in g&&g[t.pr.env]!==t.pr.ne}else if("any"in t.pr){u.isPR=t.pr.any.some((function(t){return!!g[t]}))}else{u.isPR=checkEnv(t.pr)}break;default:u.isPR=null}}));u.isCI=!!(g.CI!=="false"&&(g.BUILD_ID||g.BUILD_NUMBER||g.CI||g.CI_APP_ID||g.CI_BUILD_ID||g.CI_BUILD_NUMBER||g.CI_NAME||g.CONTINUOUS_INTEGRATION||g.RUN_ID||u.name||false));function checkEnv(t){if(typeof t==="string")return!!g[t];if("env"in t){return g[t.env]&&g[t.env].includes(t.includes)}if("any"in t){return t.any.some((function(t){return!!g[t]}))}return Object.keys(t).every((function(u){return g[u]===t[u]}))}},7825:(t,u,p)=>{"use strict";const{builtinModules:m}=p(3339);var g=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var v=["node_modules","favicon.ico"];function validate(t){var u=[];var p=[];if(t===null){p.push("name cannot be null");return done(u,p)}if(t===undefined){p.push("name cannot be undefined");return done(u,p)}if(typeof t!=="string"){p.push("name must be a string");return done(u,p)}if(!t.length){p.push("name length must be greater than zero")}if(t.match(/^\./)){p.push("name cannot start with a period")}if(t.match(/^_/)){p.push("name cannot start with an underscore")}if(t.trim()!==t){p.push("name cannot contain leading or trailing spaces")}v.forEach((function(u){if(t.toLowerCase()===u){p.push(u+" is a blacklisted name")}}));if(m.includes(t.toLowerCase())){u.push(t+" is a core module name")}if(t.length>214){u.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){u.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){u.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var b=t.match(g);if(b){var w=b[1];var E=b[2];if(encodeURIComponent(w)===w&&encodeURIComponent(E)===E){return done(u,p)}}p.push("name can only contain URL-friendly characters")}return done(u,p)}var done=function(t,u){var p={validForNewPackages:u.length===0&&t.length===0,validForOldPackages:u.length===0,warnings:t,errors:u};if(!p.warnings.length){delete p.warnings}if(!p.errors.length){delete p.errors}return p};t.exports=validate},181:t=>{"use strict";t.exports=require("buffer")},5317:t=>{"use strict";t.exports=require("child_process")},4434:t=>{"use strict";t.exports=require("events")},9896:t=>{"use strict";t.exports=require("fs")},8611:t=>{"use strict";t.exports=require("http")},5692:t=>{"use strict";t.exports=require("https")},3339:t=>{"use strict";t.exports=require("module")},1421:t=>{"use strict";t.exports=require("node:child_process")},8474:t=>{"use strict";t.exports=require("node:events")},3024:t=>{"use strict";t.exports=require("node:fs")},6760:t=>{"use strict";t.exports=require("node:path")},1708:t=>{"use strict";t.exports=require("node:process")},857:t=>{"use strict";t.exports=require("os")},6928:t=>{"use strict";t.exports=require("path")},3785:t=>{"use strict";t.exports=require("readline")},2203:t=>{"use strict";t.exports=require("stream")},2018:t=>{"use strict";t.exports=require("tty")},7016:t=>{"use strict";t.exports=require("url")},9023:t=>{"use strict";t.exports=require("util")},1311:(t,u,p)=>{"use strict";const{normalizeIPv6:m,removeDotSegments:g,recomposeAuthority:v,normalizePercentEncoding:b,normalizePathEncoding:w,escapePreservingEscapes:E,reescapeHostDelimiters:S,isIPv4:$,nonSimpleDomain:P}=p(6138);const{SCHEMES:R,getSchemeHandler:x}=p(8415);function normalize(t,u){if(typeof t==="string"){t=normalizeString(t,u)}else if(typeof t==="object"){t=parse(serialize(t,u),u)}return t}function resolve(t,u,p){const m=p?Object.assign({scheme:"null"},p):{scheme:"null"};const{parsed:g,malformedAuthorityOrPort:v}=parseWithStatus(t,m);const{parsed:b,malformedAuthorityOrPort:w}=parseWithStatus(u,m);if(v||w){throw new Error(g.error||b.error||"URI is malformed.")}const E=resolveComponent(g,b,m,true);m.skipEscape=true;return serialize(E,m)}function resolveComponent(t,u,p,m){const v={};if(!m){t=parse(serialize(t,p),p);u=parse(serialize(u,p),p)}p=p||{};if(!p.tolerant&&u.scheme){v.scheme=u.scheme;v.userinfo=u.userinfo;v.host=u.host;v.port=u.port;v.path=g(u.path||"");v.query=u.query}else{if(u.userinfo!==undefined||u.host!==undefined||u.port!==undefined){v.userinfo=u.userinfo;v.host=u.host;v.port=u.port;v.path=g(u.path||"");v.query=u.query}else{if(!u.path){v.path=t.path;if(u.query!==undefined){v.query=u.query}else{v.query=t.query}}else{if(u.path[0]==="/"){v.path=g(u.path)}else{if((t.userinfo!==undefined||t.host!==undefined||t.port!==undefined)&&!t.path){v.path="/"+u.path}else if(!t.path){v.path=u.path}else{v.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+u.path}v.path=g(v.path)}v.query=u.query}v.userinfo=t.userinfo;v.host=t.host;v.port=t.port}v.scheme=t.scheme}v.fragment=u.fragment;return v}function equal(t,u,p){const m=normalizeComparableURI(t,p);const g=normalizeComparableURI(u,p);return m!==undefined&&g!==undefined&&m.toLowerCase()===g.toLowerCase()}function serialize(t,u){const p={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""};const m=Object.assign({},u);const w=[];const S=x(m.scheme||p.scheme);if(S&&S.serialize)S.serialize(p,m);if(p.path!==undefined){if(!m.skipEscape){p.path=E(p.path);if(p.scheme!==undefined){p.path=p.path.split("%3A").join(":")}}else{p.path=b(p.path)}}if(m.reference!=="suffix"&&p.scheme){w.push(p.scheme,":")}const $=v(p);if($!==undefined){if(m.reference!=="suffix"){w.push("//")}w.push($);if(p.path&&p.path[0]!=="/"){w.push("/")}}if(p.path!==undefined){let t=p.path;if(!m.absolutePath&&(!S||!S.absolutePath)){t=g(t)}if($===undefined&&t[0]==="/"&&t[1]==="/"){t="/%2F"+t.slice(2)}w.push(t)}if(p.query!==undefined){w.push("?",p.query)}if(p.fragment!==undefined){w.push("#",p.fragment)}return w.join("")}const O=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;const A=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/;const k=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function getParseError(t,u){if(u[2]!==undefined&&t.path&&t.path[0]!=="/"){return'URI path must start with "/" when authority is present.'}if(typeof t.port==="number"&&(t.port<0||t.port>65535)){return"URI port is malformed."}return undefined}function parseWithStatus(t,u){const p=Object.assign({},u);const g={scheme:undefined,userinfo:undefined,host:"",port:undefined,path:"",query:undefined,fragment:undefined};let v=false;let b=false;if(p.reference==="suffix"){if(p.scheme){t=p.scheme+":"+t}else{t="//"+t}}const E=t.match(A);if(E!==null&&E[1].indexOf("\\")!==-1){g.error="URI authority must not contain a literal backslash.";v=true}const R=t.match(k);if(R!==null){const t=R[1];const u=t.replace(/[\t\n\r]/g,"");if(u.length>=2){if(u.slice(0,2)!=="//"){g.error=g.error||"URI authority must not contain a literal backslash.";v=true}else if(t.length!==u.length){g.error=g.error||"URI authority introducer must not contain whitespace.";v=true}}}const T=t.match(O);if(T){g.scheme=T[1];g.userinfo=T[3];g.host=T[4];g.port=parseInt(T[5],10);g.path=T[6]||"";g.query=T[7];g.fragment=T[8];if(isNaN(g.port)){g.port=T[5]}const u=getParseError(g,T);if(u!==undefined){g.error=g.error||u;v=true}if(g.host){const t=$(g.host);if(t===false){const t=m(g.host);g.host=t.host.toLowerCase();b=t.isIPV6}else{b=true}}if(g.scheme===undefined&&g.userinfo===undefined&&g.host===undefined&&g.port===undefined&&g.query===undefined&&!g.path){g.reference="same-document"}else if(g.scheme===undefined){g.reference="relative"}else if(g.fragment===undefined){g.reference="absolute"}else{g.reference="uri"}if(p.reference&&p.reference!=="suffix"&&p.reference!==g.reference){g.error=g.error||"URI is not a "+p.reference+" reference."}const E=x(p.scheme||g.scheme);if(!p.unicodeSupport&&(!E||!E.unicodeSupport)){if(g.host&&(p.domainHost||E&&E.domainHost)&&b===false&&P(g.host)){try{g.host=new URL("http://"+g.host).hostname}catch(t){g.error=g.error||"Host's domain name can not be converted to ASCII: "+t}}}if(!E||E&&!E.skipNormalize){if(t.indexOf("%")!==-1){if(g.scheme!==undefined){g.scheme=unescape(g.scheme)}if(g.host!==undefined){g.host=S(unescape(g.host),b)}}if(g.path){g.path=w(g.path)}if(g.fragment){try{g.fragment=encodeURI(decodeURIComponent(g.fragment))}catch{g.error=g.error||"URI malformed"}}}if(E&&E.parse){E.parse(g,p)}}else{g.error=g.error||"URI can not be parsed."}return{parsed:g,malformedAuthorityOrPort:v}}function parse(t,u){return parseWithStatus(t,u).parsed}function normalizeString(t,u){return normalizeStringWithStatus(t,u).normalized}function normalizeStringWithStatus(t,u){const{parsed:p,malformedAuthorityOrPort:m}=parseWithStatus(t,u);return{normalized:m?t:serialize(p,u),malformedAuthorityOrPort:m}}function normalizeComparableURI(t,u){if(typeof t==="string"){const{normalized:p,malformedAuthorityOrPort:m}=normalizeStringWithStatus(t,u);return m?undefined:p}if(typeof t==="object"){return serialize(t,u)}}const T={SCHEMES:R,normalize:normalize,resolve:resolve,resolveComponent:resolveComponent,equal:equal,serialize:serialize,parse:parse};t.exports=T;t.exports["default"]=T;t.exports.fastUri=T},8415:(t,u,p)=>{"use strict";const{isUUID:m}=p(6138);const g=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;const v=["http","https","ws","wss","urn","urn:uuid"];function isValidSchemeName(t){return v.indexOf(t)!==-1}function wsIsSecure(t){if(t.secure===true){return true}else if(t.secure===false){return false}else if(t.scheme){return t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S")}else{return false}}function httpParse(t){if(!t.host){t.error=t.error||"HTTP URIs must have a host."}return t}function httpSerialize(t){const u=String(t.scheme).toLowerCase()==="https";if(t.port===(u?443:80)||t.port===""){t.port=undefined}if(!t.path){t.path="/"}return t}function wsParse(t){t.secure=wsIsSecure(t);t.resourceName=(t.path||"/")+(t.query?"?"+t.query:"");t.path=undefined;t.query=undefined;return t}function wsSerialize(t){if(t.port===(wsIsSecure(t)?443:80)||t.port===""){t.port=undefined}if(typeof t.secure==="boolean"){t.scheme=t.secure?"wss":"ws";t.secure=undefined}if(t.resourceName){const[u,p]=t.resourceName.split("?");t.path=u&&u!=="/"?u:undefined;t.query=p;t.resourceName=undefined}t.fragment=undefined;return t}function urnParse(t,u){if(!t.path){t.error="URN can not be parsed";return t}const p=t.path.match(g);if(p){const m=u.scheme||t.scheme||"urn";t.nid=p[1].toLowerCase();t.nss=p[2];const g=`${m}:${u.nid||t.nid}`;const v=getSchemeHandler(g);t.path=undefined;if(v){t=v.parse(t,u)}}else{t.error=t.error||"URN can not be parsed."}return t}function urnSerialize(t,u){if(t.nid===undefined){throw new Error("URN without nid cannot be serialized")}const p=u.scheme||t.scheme||"urn";const m=t.nid.toLowerCase();const g=`${p}:${u.nid||m}`;const v=getSchemeHandler(g);if(v){t=v.serialize(t,u)}const b=t;const w=t.nss;b.path=`${m||u.nid}:${w}`;u.skipEscape=true;return b}function urnuuidParse(t,u){const p=t;p.uuid=p.nss;p.nss=undefined;if(!u.tolerant&&(!p.uuid||!m(p.uuid))){p.error=p.error||"UUID is not valid."}return p}function urnuuidSerialize(t){const u=t;u.nss=(t.uuid||"").toLowerCase();return u}const b={scheme:"http",domainHost:true,parse:httpParse,serialize:httpSerialize};const w={scheme:"https",domainHost:b.domainHost,parse:httpParse,serialize:httpSerialize};const E={scheme:"ws",domainHost:true,parse:wsParse,serialize:wsSerialize};const S={scheme:"wss",domainHost:E.domainHost,parse:E.parse,serialize:E.serialize};const $={scheme:"urn",parse:urnParse,serialize:urnSerialize,skipNormalize:true};const P={scheme:"urn:uuid",parse:urnuuidParse,serialize:urnuuidSerialize,skipNormalize:true};const R={http:b,https:w,ws:E,wss:S,urn:$,"urn:uuid":P};Object.setPrototypeOf(R,null);function getSchemeHandler(t){return t&&(R[t]||R[t.toLowerCase()])||undefined}t.exports={wsIsSecure:wsIsSecure,SCHEMES:R,isValidSchemeName:isValidSchemeName,getSchemeHandler:getSchemeHandler}},6138:t=>{"use strict";const u=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);const p=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);const m=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);const g=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);const v=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function stringArrayToHexStripped(t){let u="";let p=0;let m=0;for(m=0;m<t.length;m++){p=t[m].charCodeAt(0);if(p===48){continue}if(!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102)){return""}u+=t[m];break}for(m+=1;m<t.length;m++){p=t[m].charCodeAt(0);if(!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102)){return""}u+=t[m]}return u}const b=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function consumeIsZone(t){t.length=0;return true}function consumeHextets(t,u,p){if(t.length){const m=stringArrayToHexStripped(t);if(m!==""){u.push(m)}else{p.error=true;return false}t.length=0}return true}function getIPV6(t){let u=0;const p={error:false,address:"",zone:""};const m=[];const g=[];let v=false;let b=false;let w=consumeHextets;for(let E=0;E<t.length;E++){const S=t[E];if(S==="["||S==="]"){continue}if(S===":"){if(v===true){b=true}if(!w(g,m,p)){break}if(++u>7){p.error=true;break}if(E>0&&t[E-1]===":"){v=true}m.push(":");continue}else if(S==="%"){if(!w(g,m,p)){break}w=consumeIsZone}else{g.push(S);continue}}if(g.length){if(w===consumeIsZone){p.zone=g.join("")}else if(b){m.push(g.join(""))}else{m.push(stringArrayToHexStripped(g))}}p.address=m.join("");return p}function normalizeIPv6(t){if(findToken(t,":")<2){return{host:t,isIPV6:false}}const u=getIPV6(t);if(!u.error){let t=u.address;let p=u.address;if(u.zone){t+="%"+u.zone;p+="%25"+u.zone}return{host:t,isIPV6:true,escapedHost:p}}else{return{host:t,isIPV6:false}}}function findToken(t,u){let p=0;for(let m=0;m<t.length;m++){if(t[m]===u)p++}return p}function removeDotSegments(t){let u=t;const p=[];let m=-1;let g=0;while(g=u.length){if(g===1){if(u==="."){break}else if(u==="/"){p.push("/");break}else{p.push(u);break}}else if(g===2){if(u[0]==="."){if(u[1]==="."){break}else if(u[1]==="/"){u=u.slice(2);continue}}else if(u[0]==="/"){if(u[1]==="."||u[1]==="/"){p.push("/");break}}}else if(g===3){if(u==="/.."){if(p.length!==0){p.pop()}p.push("/");break}}if(u[0]==="."){if(u[1]==="."){if(u[2]==="/"){u=u.slice(3);continue}}else if(u[1]==="/"){u=u.slice(2);continue}}else if(u[0]==="/"){if(u[1]==="."){if(u[2]==="/"){u=u.slice(2);continue}else if(u[2]==="."){if(u[3]==="/"){u=u.slice(3);if(p.length!==0){p.pop()}continue}}}}if((m=u.indexOf("/",1))===-1){p.push(u);break}else{p.push(u.slice(0,m));u=u.slice(m)}}return p.join("")}const w={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"};const E=/[@/?#:]/g;const S=/[@/?#]/g;function reescapeHostDelimiters(t,u){const p=u?S:E;p.lastIndex=0;return t.replace(p,(t=>w[t]))}function normalizePercentEncoding(t,u=false){if(t.indexOf("%")===-1){return t}let p="";for(let v=0;v<t.length;v++){if(t[v]==="%"&&v+2<t.length){const b=t.slice(v+1,v+3);if(m(b)){const t=b.toUpperCase();const m=String.fromCharCode(parseInt(t,16));if(u&&g(m)){p+=m}else{p+="%"+t}v+=2;continue}}p+=t[v]}return p}function normalizePathEncoding(t){let u="";for(let p=0;p<t.length;p++){if(t[p]==="%"&&p+2<t.length){const v=t.slice(p+1,p+3);if(m(v)){const t=v.toUpperCase();const m=String.fromCharCode(parseInt(t,16));if(m!=="."&&g(m)){u+=m}else{u+="%"+t}p+=2;continue}}if(v(t[p])){u+=t[p]}else{u+=escape(t[p])}}return u}function escapePreservingEscapes(t){let u="";for(let p=0;p<t.length;p++){if(t[p]==="%"&&p+2<t.length){const g=t.slice(p+1,p+3);if(m(g)){u+="%"+g.toUpperCase();p+=2;continue}}u+=escape(t[p])}return u}function recomposeAuthority(t){const u=[];if(t.userinfo!==undefined){u.push(t.userinfo);u.push("@")}if(t.host!==undefined){let m=unescape(t.host);if(!p(m)){const t=normalizeIPv6(m);if(t.isIPV6===true){m=`[${t.escapedHost}]`}else{m=reescapeHostDelimiters(m,false)}}u.push(m)}if(typeof t.port==="number"||typeof t.port==="string"){u.push(":");u.push(String(t.port))}return u.length?u.join(""):undefined}t.exports={nonSimpleDomain:b,recomposeAuthority:recomposeAuthority,reescapeHostDelimiters:reescapeHostDelimiters,normalizePercentEncoding:normalizePercentEncoding,normalizePathEncoding:normalizePathEncoding,escapePreservingEscapes:escapePreservingEscapes,removeDotSegments:removeDotSegments,isIPv4:p,isUUID:u,normalizeIPv6:normalizeIPv6,stringArrayToHexStripped:stringArrayToHexStripped}},8909:(t,u,p)=>{const{Argument:m}=p(9154);const{Command:g}=p(4348);const{CommanderError:v,InvalidArgumentError:b}=p(1135);const{Help:w}=p(9754);const{Option:E}=p(5240);u.DM=new g;u.gu=t=>new g(t);u.Ww=(t,u)=>new E(t,u);u.er=(t,u)=>new m(t,u);u.uB=g;u.c$=E;u.ef=m;u._V=w;u.b7=v;u.Di=b;u.a2=b},9154:(t,u,p)=>{const{InvalidArgumentError:m}=p(1135);class Argument{constructor(t,u){this.description=u||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(t[0]){case"<":this.required=true;this._name=t.slice(1,-1);break;case"[":this.required=false;this._name=t.slice(1,-1);break;default:this.required=true;this._name=t;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(t,u){if(u===this.defaultValue||!Array.isArray(u)){return[t]}return u.concat(t)}default(t,u){this.defaultValue=t;this.defaultValueDescription=u;return this}argParser(t){this.parseArg=t;return this}choices(t){this.argChoices=t.slice();this.parseArg=(t,u)=>{if(!this.argChoices.includes(t)){throw new m(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,u)}return t};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(t){const u=t.name()+(t.variadic===true?"...":"");return t.required?"<"+u+">":"["+u+"]"}u.Argument=Argument;u.humanReadableArgName=humanReadableArgName},4348:(t,u,p)=>{const m=p(8474).EventEmitter;const g=p(1421);const v=p(6760);const b=p(3024);const w=p(1708);const{Argument:E,humanReadableArgName:S}=p(9154);const{CommanderError:$}=p(1135);const{Help:P}=p(9754);const{Option:R,DualOptions:x}=p(5240);const{suggestSimilar:O}=p(5030);class Command extends m{constructor(t){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this.registeredArguments=[];this._args=this.registeredArguments;this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=t||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:t=>w.stdout.write(t),writeErr:t=>w.stderr.write(t),getOutHelpWidth:()=>w.stdout.isTTY?w.stdout.columns:undefined,getErrHelpWidth:()=>w.stderr.isTTY?w.stderr.columns:undefined,outputError:(t,u)=>u(t)};this._hidden=false;this._helpOption=undefined;this._addImplicitHelpCommand=undefined;this._helpCommand=undefined;this._helpConfiguration={}}copyInheritedSettings(t){this._outputConfiguration=t._outputConfiguration;this._helpOption=t._helpOption;this._helpCommand=t._helpCommand;this._helpConfiguration=t._helpConfiguration;this._exitCallback=t._exitCallback;this._storeOptionsAsProperties=t._storeOptionsAsProperties;this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue;this._allowExcessArguments=t._allowExcessArguments;this._enablePositionalOptions=t._enablePositionalOptions;this._showHelpAfterError=t._showHelpAfterError;this._showSuggestionAfterError=t._showSuggestionAfterError;return this}_getCommandAndAncestors(){const t=[];for(let u=this;u;u=u.parent){t.push(u)}return t}command(t,u,p){let m=u;let g=p;if(typeof m==="object"&&m!==null){g=m;m=null}g=g||{};const[,v,b]=t.match(/([^ ]+) *(.*)/);const w=this.createCommand(v);if(m){w.description(m);w._executableHandler=true}if(g.isDefault)this._defaultCommandName=w._name;w._hidden=!!(g.noHelp||g.hidden);w._executableFile=g.executableFile||null;if(b)w.arguments(b);this._registerCommand(w);w.parent=this;w.copyInheritedSettings(this);if(m)return this;return w}createCommand(t){return new Command(t)}createHelp(){return Object.assign(new P,this.configureHelp())}configureHelp(t){if(t===undefined)return this._helpConfiguration;this._helpConfiguration=t;return this}configureOutput(t){if(t===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,t);return this}showHelpAfterError(t=true){if(typeof t!=="string")t=!!t;this._showHelpAfterError=t;return this}showSuggestionAfterError(t=true){this._showSuggestionAfterError=!!t;return this}addCommand(t,u){if(!t._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}u=u||{};if(u.isDefault)this._defaultCommandName=t._name;if(u.noHelp||u.hidden)t._hidden=true;this._registerCommand(t);t.parent=this;t._checkForBrokenPassThrough();return this}createArgument(t,u){return new E(t,u)}argument(t,u,p,m){const g=this.createArgument(t,u);if(typeof p==="function"){g.default(m).argParser(p)}else{g.default(p)}this.addArgument(g);return this}arguments(t){t.trim().split(/ +/).forEach((t=>{this.argument(t)}));return this}addArgument(t){const u=this.registeredArguments.slice(-1)[0];if(u&&u.variadic){throw new Error(`only the last argument can be variadic '${u.name()}'`)}if(t.required&&t.defaultValue!==undefined&&t.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${t.name()}'`)}this.registeredArguments.push(t);return this}helpCommand(t,u){if(typeof t==="boolean"){this._addImplicitHelpCommand=t;return this}t=t??"help [command]";const[,p,m]=t.match(/([^ ]+) *(.*)/);const g=u??"display help for command";const v=this.createCommand(p);v.helpOption(false);if(m)v.arguments(m);if(g)v.description(g);this._addImplicitHelpCommand=true;this._helpCommand=v;return this}addHelpCommand(t,u){if(typeof t!=="object"){this.helpCommand(t,u);return this}this._addImplicitHelpCommand=true;this._helpCommand=t;return this}_getHelpCommand(){const t=this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"));if(t){if(this._helpCommand===undefined){this.helpCommand(undefined,undefined)}return this._helpCommand}return null}hook(t,u){const p=["preSubcommand","preAction","postAction"];if(!p.includes(t)){throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${p.join("', '")}'`)}if(this._lifeCycleHooks[t]){this._lifeCycleHooks[t].push(u)}else{this._lifeCycleHooks[t]=[u]}return this}exitOverride(t){if(t){this._exitCallback=t}else{this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync"){throw t}else{}}}return this}_exit(t,u,p){if(this._exitCallback){this._exitCallback(new $(t,u,p))}w.exit(t)}action(t){const listener=u=>{const p=this.registeredArguments.length;const m=u.slice(0,p);if(this._storeOptionsAsProperties){m[p]=this}else{m[p]=this.opts()}m.push(this);return t.apply(this,m)};this._actionHandler=listener;return this}createOption(t,u){return new R(t,u)}_callParseArg(t,u,p,m){try{return t.parseArg(u,p)}catch(t){if(t.code==="commander.invalidArgument"){const u=`${m} ${t.message}`;this.error(u,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){const u=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(u){const p=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${p}'\n- already used by option '${u.flags}'`)}this.options.push(t)}_registerCommand(t){const knownBy=t=>[t.name()].concat(t.aliases());const u=knownBy(t).find((t=>this._findCommand(t)));if(u){const p=knownBy(this._findCommand(u)).join("|");const m=knownBy(t).join("|");throw new Error(`cannot add command '${m}' as already have command '${p}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);const u=t.name();const p=t.attributeName();if(t.negate){const u=t.long.replace(/^--no-/,"--");if(!this._findOption(u)){this.setOptionValueWithSource(p,t.defaultValue===undefined?true:t.defaultValue,"default")}}else if(t.defaultValue!==undefined){this.setOptionValueWithSource(p,t.defaultValue,"default")}const handleOptionValue=(u,m,g)=>{if(u==null&&t.presetArg!==undefined){u=t.presetArg}const v=this.getOptionValue(p);if(u!==null&&t.parseArg){u=this._callParseArg(t,u,v,m)}else if(u!==null&&t.variadic){u=t._concatValue(u,v)}if(u==null){if(t.negate){u=false}else if(t.isBoolean()||t.optional){u=true}else{u=""}}this.setOptionValueWithSource(p,u,g)};this.on("option:"+u,(u=>{const p=`error: option '${t.flags}' argument '${u}' is invalid.`;handleOptionValue(u,p,"cli")}));if(t.envVar){this.on("optionEnv:"+u,(u=>{const p=`error: option '${t.flags}' value '${u}' from env '${t.envVar}' is invalid.`;handleOptionValue(u,p,"env")}))}return this}_optionEx(t,u,p,m,g){if(typeof u==="object"&&u instanceof R){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const v=this.createOption(u,p);v.makeOptionMandatory(!!t.mandatory);if(typeof m==="function"){v.default(g).argParser(m)}else if(m instanceof RegExp){const t=m;m=(u,p)=>{const m=t.exec(u);return m?m[0]:p};v.default(g).argParser(m)}else{v.default(m)}return this.addOption(v)}option(t,u,p,m){return this._optionEx({},t,u,p,m)}requiredOption(t,u,p,m){return this._optionEx({mandatory:true},t,u,p,m)}combineFlagAndOptionalValue(t=true){this._combineFlagAndOptionalValue=!!t;return this}allowUnknownOption(t=true){this._allowUnknownOption=!!t;return this}allowExcessArguments(t=true){this._allowExcessArguments=!!t;return this}enablePositionalOptions(t=true){this._enablePositionalOptions=!!t;return this}passThroughOptions(t=true){this._passThroughOptions=!!t;this._checkForBrokenPassThrough();return this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions){throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}}storeOptionsAsProperties(t=true){if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}if(Object.keys(this._optionValues).length){throw new Error("call .storeOptionsAsProperties() before setting option values")}this._storeOptionsAsProperties=!!t;return this}getOptionValue(t){if(this._storeOptionsAsProperties){return this[t]}return this._optionValues[t]}setOptionValue(t,u){return this.setOptionValueWithSource(t,u,undefined)}setOptionValueWithSource(t,u,p){if(this._storeOptionsAsProperties){this[t]=u}else{this._optionValues[t]=u}this._optionValueSources[t]=p;return this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let u;this._getCommandAndAncestors().forEach((p=>{if(p.getOptionValueSource(t)!==undefined){u=p.getOptionValueSource(t)}}));return u}_prepareUserArgs(t,u){if(t!==undefined&&!Array.isArray(t)){throw new Error("first parameter to parse must be array or undefined")}u=u||{};if(t===undefined&&u.from===undefined){if(w.versions?.electron){u.from="electron"}const t=w.execArgv??[];if(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print")){u.from="eval"}}if(t===undefined){t=w.argv}this.rawArgs=t.slice();let p;switch(u.from){case undefined:case"node":this._scriptPath=t[1];p=t.slice(2);break;case"electron":if(w.defaultApp){this._scriptPath=t[1];p=t.slice(2)}else{p=t.slice(1)}break;case"user":p=t.slice(0);break;case"eval":p=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return p}parse(t,u){const p=this._prepareUserArgs(t,u);this._parseCommand([],p);return this}async parseAsync(t,u){const p=this._prepareUserArgs(t,u);await this._parseCommand([],p);return this}_executeSubCommand(t,u){u=u.slice();let p=false;const m=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(t,u){const p=v.resolve(t,u);if(b.existsSync(p))return p;if(m.includes(v.extname(u)))return undefined;const g=m.find((t=>b.existsSync(`${p}${t}`)));if(g)return`${p}${g}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let E=t._executableFile||`${this._name}-${t._name}`;let S=this._executableDir||"";if(this._scriptPath){let t;try{t=b.realpathSync(this._scriptPath)}catch(u){t=this._scriptPath}S=v.resolve(v.dirname(t),S)}if(S){let u=findFile(S,E);if(!u&&!t._executableFile&&this._scriptPath){const p=v.basename(this._scriptPath,v.extname(this._scriptPath));if(p!==this._name){u=findFile(S,`${p}-${t._name}`)}}E=u||E}p=m.includes(v.extname(E));let P;if(w.platform!=="win32"){if(p){u.unshift(E);u=incrementNodeInspectorPort(w.execArgv).concat(u);P=g.spawn(w.argv[0],u,{stdio:"inherit"})}else{P=g.spawn(E,u,{stdio:"inherit"})}}else{u.unshift(E);u=incrementNodeInspectorPort(w.execArgv).concat(u);P=g.spawn(w.execPath,u,{stdio:"inherit"})}if(!P.killed){const t=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];t.forEach((t=>{w.on(t,(()=>{if(P.killed===false&&P.exitCode===null){P.kill(t)}}))}))}const R=this._exitCallback;P.on("close",(t=>{t=t??1;if(!R){w.exit(t)}else{R(new $(t,"commander.executeSubCommandAsync","(close)"))}}));P.on("error",(u=>{if(u.code==="ENOENT"){const u=S?`searched for local subcommand relative to directory '${S}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const p=`'${E}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${u}`;throw new Error(p)}else if(u.code==="EACCES"){throw new Error(`'${E}' not executable`)}if(!R){w.exit(1)}else{const t=new $(1,"commander.executeSubCommandAsync","(error)");t.nestedError=u;R(t)}}));this.runningCommand=P}_dispatchSubcommand(t,u,p){const m=this._findCommand(t);if(!m)this.help({error:true});let g;g=this._chainOrCallSubCommandHook(g,m,"preSubcommand");g=this._chainOrCall(g,(()=>{if(m._executableHandler){this._executeSubCommand(m,u.concat(p))}else{return m._parseCommand(u,p)}}));return g}_dispatchHelpCommand(t){if(!t){this.help()}const u=this._findCommand(t);if(u&&!u._executableHandler){u.help()}return this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,u)=>{if(t.required&&this.args[u]==null){this.missingArgument(t.name())}}));if(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic){return}if(this.args.length>this.registeredArguments.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(t,u,p)=>{let m=u;if(u!==null&&t.parseArg){const g=`error: command-argument value '${u}' is invalid for argument '${t.name()}'.`;m=this._callParseArg(t,u,p,g)}return m};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach(((u,p)=>{let m=u.defaultValue;if(u.variadic){if(p<this.args.length){m=this.args.slice(p);if(u.parseArg){m=m.reduce(((t,p)=>myParseArg(u,p,t)),u.defaultValue)}}else if(m===undefined){m=[]}}else if(p<this.args.length){m=this.args[p];if(u.parseArg){m=myParseArg(u,m,u.defaultValue)}}t[p]=m}));this.processedArgs=t}_chainOrCall(t,u){if(t&&t.then&&typeof t.then==="function"){return t.then((()=>u()))}return u()}_chainOrCallHooks(t,u){let p=t;const m=[];this._getCommandAndAncestors().reverse().filter((t=>t._lifeCycleHooks[u]!==undefined)).forEach((t=>{t._lifeCycleHooks[u].forEach((u=>{m.push({hookedCommand:t,callback:u})}))}));if(u==="postAction"){m.reverse()}m.forEach((t=>{p=this._chainOrCall(p,(()=>t.callback(t.hookedCommand,this)))}));return p}_chainOrCallSubCommandHook(t,u,p){let m=t;if(this._lifeCycleHooks[p]!==undefined){this._lifeCycleHooks[p].forEach((t=>{m=this._chainOrCall(m,(()=>t(this,u)))}))}return m}_parseCommand(t,u){const p=this.parseOptions(u);this._parseOptionsEnv();this._parseOptionsImplied();t=t.concat(p.operands);u=p.unknown;this.args=t.concat(u);if(t&&this._findCommand(t[0])){return this._dispatchSubcommand(t[0],t.slice(1),u)}if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name()){return this._dispatchHelpCommand(t[1])}if(this._defaultCommandName){this._outputHelpIfRequested(u);return this._dispatchSubcommand(this._defaultCommandName,t,u)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}this._outputHelpIfRequested(p.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(p.unknown.length>0){this.unknownOption(p.unknown[0])}};const m=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let p;p=this._chainOrCallHooks(p,"preAction");p=this._chainOrCall(p,(()=>this._actionHandler(this.processedArgs)));if(this.parent){p=this._chainOrCall(p,(()=>{this.parent.emit(m,t,u)}))}p=this._chainOrCallHooks(p,"postAction");return p}if(this.parent&&this.parent.listenerCount(m)){checkForUnknownOptions();this._processArguments();this.parent.emit(m,t,u)}else if(t.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",t,u)}if(this.listenerCount("command:*")){this.emit("command:*",t,u)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(t){if(!t)return undefined;return this.commands.find((u=>u._name===t||u._aliases.includes(t)))}_findOption(t){return this.options.find((u=>u.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((u=>{if(u.mandatory&&t.getOptionValue(u.attributeName())===undefined){t.missingMandatoryOptionValue(u)}}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const u=t.attributeName();if(this.getOptionValue(u)===undefined){return false}return this.getOptionValueSource(u)!=="default"}));const u=t.filter((t=>t.conflictsWith.length>0));u.forEach((u=>{const p=t.find((t=>u.conflictsWith.includes(t.attributeName())));if(p){this._conflictingOption(u,p)}}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const u=[];const p=[];let m=u;const g=t.slice();function maybeOption(t){return t.length>1&&t[0]==="-"}let v=null;while(g.length){const t=g.shift();if(t==="--"){if(m===p)m.push(t);m.push(...g);break}if(v&&!maybeOption(t)){this.emit(`option:${v.name()}`,t);continue}v=null;if(maybeOption(t)){const u=this._findOption(t);if(u){if(u.required){const t=g.shift();if(t===undefined)this.optionMissingArgument(u);this.emit(`option:${u.name()}`,t)}else if(u.optional){let t=null;if(g.length>0&&!maybeOption(g[0])){t=g.shift()}this.emit(`option:${u.name()}`,t)}else{this.emit(`option:${u.name()}`)}v=u.variadic?u:null;continue}}if(t.length>2&&t[0]==="-"&&t[1]!=="-"){const u=this._findOption(`-${t[1]}`);if(u){if(u.required||u.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${u.name()}`,t.slice(2))}else{this.emit(`option:${u.name()}`);g.unshift(`-${t.slice(2)}`)}continue}}if(/^--[^=]+=/.test(t)){const u=t.indexOf("=");const p=this._findOption(t.slice(0,u));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,t.slice(u+1));continue}}if(maybeOption(t)){m=p}if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&p.length===0){if(this._findCommand(t)){u.push(t);if(g.length>0)p.push(...g);break}else if(this._getHelpCommand()&&t===this._getHelpCommand().name()){u.push(t);if(g.length>0)u.push(...g);break}else if(this._defaultCommandName){p.push(t);if(g.length>0)p.push(...g);break}}if(this._passThroughOptions){m.push(t);if(g.length>0)m.push(...g);break}m.push(t)}return{operands:u,unknown:p}}opts(){if(this._storeOptionsAsProperties){const t={};const u=this.options.length;for(let p=0;p<u;p++){const u=this.options[p].attributeName();t[u]=u===this._versionOptionName?this._version:this[u]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,u)=>Object.assign(t,u.opts())),{})}error(t,u){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const p=u||{};const m=p.exitCode||1;const g=p.code||"commander.error";this._exit(m,g,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in w.env){const u=t.attributeName();if(this.getOptionValue(u)===undefined||["default","config","env"].includes(this.getOptionValueSource(u))){if(t.required||t.optional){this.emit(`optionEnv:${t.name()}`,w.env[t.envVar])}else{this.emit(`optionEnv:${t.name()}`)}}}}))}_parseOptionsImplied(){const t=new x(this.options);const hasCustomOptionValue=t=>this.getOptionValue(t)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((u=>u.implied!==undefined&&hasCustomOptionValue(u.attributeName())&&t.valueFromOption(this.getOptionValue(u.attributeName()),u))).forEach((t=>{Object.keys(t.implied).filter((t=>!hasCustomOptionValue(t))).forEach((u=>{this.setOptionValueWithSource(u,t.implied[u],"implied")}))}))}missingArgument(t){const u=`error: missing required argument '${t}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(t){const u=`error: option '${t.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const u=`error: required option '${t.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,u){const findBestOptionFromValue=t=>{const u=t.attributeName();const p=this.getOptionValue(u);const m=this.options.find((t=>t.negate&&u===t.attributeName()));const g=this.options.find((t=>!t.negate&&u===t.attributeName()));if(m&&(m.presetArg===undefined&&p===false||m.presetArg!==undefined&&p===m.presetArg)){return m}return g||t};const getErrorMessage=t=>{const u=findBestOptionFromValue(t);const p=u.attributeName();const m=this.getOptionValueSource(p);if(m==="env"){return`environment variable '${u.envVar}'`}return`option '${u.flags}'`};const p=`error: ${getErrorMessage(t)} cannot be used with ${getErrorMessage(u)}`;this.error(p,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let u="";if(t.startsWith("--")&&this._showSuggestionAfterError){let p=[];let m=this;do{const t=m.createHelp().visibleOptions(m).filter((t=>t.long)).map((t=>t.long));p=p.concat(t);m=m.parent}while(m&&!m._enablePositionalOptions);u=O(t,p)}const p=`error: unknown option '${t}'${u}`;this.error(p,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const u=this.registeredArguments.length;const p=u===1?"":"s";const m=this.parent?` for '${this.name()}'`:"";const g=`error: too many arguments${m}. Expected ${u} argument${p} but got ${t.length}.`;this.error(g,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let u="";if(this._showSuggestionAfterError){const p=[];this.createHelp().visibleCommands(this).forEach((t=>{p.push(t.name());if(t.alias())p.push(t.alias())}));u=O(t,p)}const p=`error: unknown command '${t}'${u}`;this.error(p,{code:"commander.unknownCommand"})}version(t,u,p){if(t===undefined)return this._version;this._version=t;u=u||"-V, --version";p=p||"output the version number";const m=this.createOption(u,p);this._versionOptionName=m.attributeName();this._registerOption(m);this.on("option:"+m.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`);this._exit(0,"commander.version",t)}));return this}description(t,u){if(t===undefined&&u===undefined)return this._description;this._description=t;if(u){this._argsDescription=u}return this}summary(t){if(t===undefined)return this._summary;this._summary=t;return this}alias(t){if(t===undefined)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){u=this.commands[this.commands.length-1]}if(t===u._name)throw new Error("Command alias can't be the same as its name");const p=this.parent?._findCommand(t);if(p){const u=[p.name()].concat(p.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${u}'`)}u._aliases.push(t);return this}aliases(t){if(t===undefined)return this._aliases;t.forEach((t=>this.alias(t)));return this}usage(t){if(t===undefined){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>S(t)));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}this._usage=t;return this}name(t){if(t===undefined)return this._name;this._name=t;return this}nameFromFilename(t){this._name=v.basename(t,v.extname(t));return this}executableDir(t){if(t===undefined)return this._executableDir;this._executableDir=t;return this}helpInformation(t){const u=this.createHelp();if(u.helpWidth===undefined){u.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return u.formatHelp(this,u)}_getHelpContext(t){t=t||{};const u={error:!!t.error};let p;if(u.error){p=t=>this._outputConfiguration.writeErr(t)}else{p=t=>this._outputConfiguration.writeOut(t)}u.write=t.write||p;u.command=this;return u}outputHelp(t){let u;if(typeof t==="function"){u=t;t=undefined}const p=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",p)));this.emit("beforeHelp",p);let m=this.helpInformation(p);if(u){m=u(m);if(typeof m!=="string"&&!Buffer.isBuffer(m)){throw new Error("outputHelp callback must return a string or a Buffer")}}p.write(m);if(this._getHelpOption()?.long){this.emit(this._getHelpOption().long)}this.emit("afterHelp",p);this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",p)))}helpOption(t,u){if(typeof t==="boolean"){if(t){this._helpOption=this._helpOption??undefined}else{this._helpOption=null}return this}t=t??"-h, --help";u=u??"display help for command";this._helpOption=this.createOption(t,u);return this}_getHelpOption(){if(this._helpOption===undefined){this.helpOption(undefined,undefined)}return this._helpOption}addHelpOption(t){this._helpOption=t;return this}help(t){this.outputHelp(t);let u=w.exitCode||0;if(u===0&&t&&typeof t!=="function"&&t.error){u=1}this._exit(u,"commander.help","(outputHelp)")}addHelpText(t,u){const p=["beforeAll","before","after","afterAll"];if(!p.includes(t)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${p.join("', '")}'`)}const m=`${t}Help`;this.on(m,(t=>{let p;if(typeof u==="function"){p=u({error:t.error,command:t.command})}else{p=u}if(p){t.write(`${p}\n`)}}));return this}_outputHelpIfRequested(t){const u=this._getHelpOption();const p=u&&t.find((t=>u.is(t)));if(p){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(t){return t.map((t=>{if(!t.startsWith("--inspect")){return t}let u;let p="127.0.0.1";let m="9229";let g;if((g=t.match(/^(--inspect(-brk)?)$/))!==null){u=g[1]}else if((g=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){u=g[1];if(/^\d+$/.test(g[3])){m=g[3]}else{p=g[3]}}else if((g=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){u=g[1];p=g[3];m=g[4]}if(u&&m!=="0"){return`${u}=${p}:${parseInt(m)+1}`}return t}))}u.Command=Command},1135:(t,u)=>{class CommanderError extends Error{constructor(t,u,p){super(p);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=u;this.exitCode=t;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(t){super(1,"commander.invalidArgument",t);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}u.CommanderError=CommanderError;u.InvalidArgumentError=InvalidArgumentError},9754:(t,u,p)=>{const{humanReadableArgName:m}=p(9154);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(t){const u=t.commands.filter((t=>!t._hidden));const p=t._getHelpCommand();if(p&&!p._hidden){u.push(p)}if(this.sortSubcommands){u.sort(((t,u)=>t.name().localeCompare(u.name())))}return u}compareOptions(t,u){const getSortKey=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return getSortKey(t).localeCompare(getSortKey(u))}visibleOptions(t){const u=t.options.filter((t=>!t.hidden));const p=t._getHelpOption();if(p&&!p.hidden){const m=p.short&&t._findOption(p.short);const g=p.long&&t._findOption(p.long);if(!m&&!g){u.push(p)}else if(p.long&&!g){u.push(t.createOption(p.long,p.description))}else if(p.short&&!m){u.push(t.createOption(p.short,p.description))}}if(this.sortOptions){u.sort(this.compareOptions)}return u}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const u=[];for(let p=t.parent;p;p=p.parent){const t=p.options.filter((t=>!t.hidden));u.push(...t)}if(this.sortOptions){u.sort(this.compareOptions)}return u}visibleArguments(t){if(t._argsDescription){t.registeredArguments.forEach((u=>{u.description=u.description||t._argsDescription[u.name()]||""}))}if(t.registeredArguments.find((t=>t.description))){return t.registeredArguments}return[]}subcommandTerm(t){const u=t.registeredArguments.map((t=>m(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,u){return u.visibleCommands(t).reduce(((t,p)=>Math.max(t,u.subcommandTerm(p).length)),0)}longestOptionTermLength(t,u){return u.visibleOptions(t).reduce(((t,p)=>Math.max(t,u.optionTerm(p).length)),0)}longestGlobalOptionTermLength(t,u){return u.visibleGlobalOptions(t).reduce(((t,p)=>Math.max(t,u.optionTerm(p).length)),0)}longestArgumentTermLength(t,u){return u.visibleArguments(t).reduce(((t,p)=>Math.max(t,u.argumentTerm(p).length)),0)}commandUsage(t){let u=t._name;if(t._aliases[0]){u=u+"|"+t._aliases[0]}let p="";for(let u=t.parent;u;u=u.parent){p=u.name()+" "+p}return p+u+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const u=[];if(t.argChoices){u.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){const p=t.required||t.optional||t.isBoolean()&&typeof t.defaultValue==="boolean";if(p){u.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}}if(t.presetArg!==undefined&&t.optional){u.push(`preset: ${JSON.stringify(t.presetArg)}`)}if(t.envVar!==undefined){u.push(`env: ${t.envVar}`)}if(u.length>0){return`${t.description} (${u.join(", ")})`}return t.description}argumentDescription(t){const u=[];if(t.argChoices){u.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){u.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}if(u.length>0){const p=`(${u.join(", ")})`;if(t.description){return`${t.description} ${p}`}return p}return t.description}formatHelp(t,u){const p=u.padWidth(t,u);const m=u.helpWidth||80;const g=2;const v=2;function formatItem(t,b){if(b){const w=`${t.padEnd(p+v)}${b}`;return u.wrap(w,m-g,p+v)}return t}function formatList(t){return t.join("\n").replace(/^/gm," ".repeat(g))}let b=[`Usage: ${u.commandUsage(t)}`,""];const w=u.commandDescription(t);if(w.length>0){b=b.concat([u.wrap(w,m,0),""])}const E=u.visibleArguments(t).map((t=>formatItem(u.argumentTerm(t),u.argumentDescription(t))));if(E.length>0){b=b.concat(["Arguments:",formatList(E),""])}const S=u.visibleOptions(t).map((t=>formatItem(u.optionTerm(t),u.optionDescription(t))));if(S.length>0){b=b.concat(["Options:",formatList(S),""])}if(this.showGlobalOptions){const p=u.visibleGlobalOptions(t).map((t=>formatItem(u.optionTerm(t),u.optionDescription(t))));if(p.length>0){b=b.concat(["Global Options:",formatList(p),""])}}const $=u.visibleCommands(t).map((t=>formatItem(u.subcommandTerm(t),u.subcommandDescription(t))));if($.length>0){b=b.concat(["Commands:",formatList($),""])}return b.join("\n")}padWidth(t,u){return Math.max(u.longestOptionTermLength(t,u),u.longestGlobalOptionTermLength(t,u),u.longestSubcommandTermLength(t,u),u.longestArgumentTermLength(t,u))}wrap(t,u,p,m=40){const g=" \\f\\t\\v   -    \ufeff";const v=new RegExp(`[\\n][${g}]+`);if(t.match(v))return t;const b=u-p;if(b<m)return t;const w=t.slice(0,p);const E=t.slice(p).replace("\r\n","\n");const S=" ".repeat(p);const $="​";const P=`\\s${$}`;const R=new RegExp(`\n|.{1,${b-1}}([${P}]|$)|[^${P}]+?([${P}]|$)`,"g");const x=E.match(R)||[];return w+x.map(((t,u)=>{if(t==="\n")return"";return(u>0?S:"")+t.trimEnd()})).join("\n")}}u.Help=Help},5240:(t,u,p)=>{const{InvalidArgumentError:m}=p(1135);class Option{constructor(t,u){this.flags=t;this.description=u||"";this.required=t.includes("<");this.optional=t.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(t);this.mandatory=false;const p=splitOptionFlags(t);this.short=p.shortFlag;this.long=p.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(t,u){this.defaultValue=t;this.defaultValueDescription=u;return this}preset(t){this.presetArg=t;return this}conflicts(t){this.conflictsWith=this.conflictsWith.concat(t);return this}implies(t){let u=t;if(typeof t==="string"){u={[t]:true}}this.implied=Object.assign(this.implied||{},u);return this}env(t){this.envVar=t;return this}argParser(t){this.parseArg=t;return this}makeOptionMandatory(t=true){this.mandatory=!!t;return this}hideHelp(t=true){this.hidden=!!t;return this}_concatValue(t,u){if(u===this.defaultValue||!Array.isArray(u)){return[t]}return u.concat(t)}choices(t){this.argChoices=t.slice();this.parseArg=(t,u)=>{if(!this.argChoices.includes(t)){throw new m(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,u)}return t};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(t){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;t.forEach((t=>{if(t.negate){this.negativeOptions.set(t.attributeName(),t)}else{this.positiveOptions.set(t.attributeName(),t)}}));this.negativeOptions.forEach(((t,u)=>{if(this.positiveOptions.has(u)){this.dualOptions.add(u)}}))}valueFromOption(t,u){const p=u.attributeName();if(!this.dualOptions.has(p))return true;const m=this.negativeOptions.get(p).presetArg;const g=m!==undefined?m:false;return u.negate===(g===t)}}function camelcase(t){return t.split("-").reduce(((t,u)=>t+u[0].toUpperCase()+u.slice(1)))}function splitOptionFlags(t){let u;let p;const m=t.split(/[ |,]+/);if(m.length>1&&!/^[[<]/.test(m[1]))u=m.shift();p=m.shift();if(!u&&/^-[^-]$/.test(p)){u=p;p=undefined}return{shortFlag:u,longFlag:p}}u.Option=Option;u.DualOptions=DualOptions},5030:(t,u)=>{const p=3;function editDistance(t,u){if(Math.abs(t.length-u.length)>p)return Math.max(t.length,u.length);const m=[];for(let u=0;u<=t.length;u++){m[u]=[u]}for(let t=0;t<=u.length;t++){m[0][t]=t}for(let p=1;p<=u.length;p++){for(let g=1;g<=t.length;g++){let v=1;if(t[g-1]===u[p-1]){v=0}else{v=1}m[g][p]=Math.min(m[g-1][p]+1,m[g][p-1]+1,m[g-1][p-1]+v);if(g>1&&p>1&&t[g-1]===u[p-2]&&t[g-2]===u[p-1]){m[g][p]=Math.min(m[g][p],m[g-2][p-2]+1)}}}return m[t.length][u.length]}function suggestSimilar(t,u){if(!u||u.length===0)return"";u=Array.from(new Set(u));const m=t.startsWith("--");if(m){t=t.slice(2);u=u.map((t=>t.slice(2)))}let g=[];let v=p;const b=.4;u.forEach((u=>{if(u.length<=1)return;const p=editDistance(t,u);const m=Math.max(t.length,u.length);const w=(m-p)/m;if(w>b){if(p<v){v=p;g=[u]}else if(p===v){g.push(u)}}}));g.sort(((t,u)=>t.localeCompare(u)));if(m){g=g.map((t=>`--${t}`))}if(g.length>1){return`\n(Did you mean one of ${g.join(", ")}?)`}if(g.length===1){return`\n(Did you mean ${g[0]}?)`}return""}u.suggestSimilar=suggestSimilar},3770:t=>{"use strict";t.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},13:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},2394:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},4771:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},9567:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},8364:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},7388:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},2943:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},6261:t=>{"use strict";t.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},3928:t=>{"use strict";t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},2040:t=>{"use strict";t.exports=JSON.parse('[{"name":"Agola CI","constant":"AGOLA","env":"AGOLA_GIT_REF","pr":"AGOLA_PULL_REQUEST_ID"},{"name":"Appcircle","constant":"APPCIRCLE","env":"AC_APPCIRCLE"},{"name":"AppVeyor","constant":"APPVEYOR","env":"APPVEYOR","pr":"APPVEYOR_PULL_REQUEST_NUMBER"},{"name":"AWS CodeBuild","constant":"CODEBUILD","env":"CODEBUILD_BUILD_ARN"},{"name":"Azure Pipelines","constant":"AZURE_PIPELINES","env":"TF_BUILD","pr":{"BUILD_REASON":"PullRequest"}},{"name":"Bamboo","constant":"BAMBOO","env":"bamboo_planKey"},{"name":"Bitbucket Pipelines","constant":"BITBUCKET","env":"BITBUCKET_COMMIT","pr":"BITBUCKET_PR_ID"},{"name":"Bitrise","constant":"BITRISE","env":"BITRISE_IO","pr":"BITRISE_PULL_REQUEST"},{"name":"Buddy","constant":"BUDDY","env":"BUDDY_WORKSPACE_ID","pr":"BUDDY_EXECUTION_PULL_REQUEST_ID"},{"name":"Buildkite","constant":"BUILDKITE","env":"BUILDKITE","pr":{"env":"BUILDKITE_PULL_REQUEST","ne":"false"}},{"name":"CircleCI","constant":"CIRCLE","env":"CIRCLECI","pr":"CIRCLE_PULL_REQUEST"},{"name":"Cirrus CI","constant":"CIRRUS","env":"CIRRUS_CI","pr":"CIRRUS_PR"},{"name":"Codefresh","constant":"CODEFRESH","env":"CF_BUILD_ID","pr":{"any":["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{"name":"Codemagic","constant":"CODEMAGIC","env":"CM_BUILD_ID","pr":"CM_PULL_REQUEST"},{"name":"Codeship","constant":"CODESHIP","env":{"CI_NAME":"codeship"}},{"name":"Drone","constant":"DRONE","env":"DRONE","pr":{"DRONE_BUILD_EVENT":"pull_request"}},{"name":"dsari","constant":"DSARI","env":"DSARI"},{"name":"Earthly","constant":"EARTHLY","env":"EARTHLY_CI"},{"name":"Expo Application Services","constant":"EAS","env":"EAS_BUILD"},{"name":"Gerrit","constant":"GERRIT","env":"GERRIT_PROJECT"},{"name":"Gitea Actions","constant":"GITEA_ACTIONS","env":"GITEA_ACTIONS"},{"name":"GitHub Actions","constant":"GITHUB_ACTIONS","env":"GITHUB_ACTIONS","pr":{"GITHUB_EVENT_NAME":"pull_request"}},{"name":"GitLab CI","constant":"GITLAB","env":"GITLAB_CI","pr":"CI_MERGE_REQUEST_ID"},{"name":"GoCD","constant":"GOCD","env":"GO_PIPELINE_LABEL"},{"name":"Google Cloud Build","constant":"GOOGLE_CLOUD_BUILD","env":"BUILDER_OUTPUT"},{"name":"Harness CI","constant":"HARNESS","env":"HARNESS_BUILD_ID"},{"name":"Heroku","constant":"HEROKU","env":{"env":"NODE","includes":"/app/.heroku/node/bin/node"}},{"name":"Hudson","constant":"HUDSON","env":"HUDSON_URL"},{"name":"Jenkins","constant":"JENKINS","env":["JENKINS_URL","BUILD_ID"],"pr":{"any":["ghprbPullId","CHANGE_ID"]}},{"name":"LayerCI","constant":"LAYERCI","env":"LAYERCI","pr":"LAYERCI_PULL_REQUEST"},{"name":"Magnum CI","constant":"MAGNUM","env":"MAGNUM"},{"name":"Netlify CI","constant":"NETLIFY","env":"NETLIFY","pr":{"env":"PULL_REQUEST","ne":"false"}},{"name":"Nevercode","constant":"NEVERCODE","env":"NEVERCODE","pr":{"env":"NEVERCODE_PULL_REQUEST","ne":"false"}},{"name":"Prow","constant":"PROW","env":"PROW_JOB_ID"},{"name":"ReleaseHub","constant":"RELEASEHUB","env":"RELEASE_BUILD_ID"},{"name":"Render","constant":"RENDER","env":"RENDER","pr":{"IS_PULL_REQUEST":"true"}},{"name":"Sail CI","constant":"SAIL","env":"SAILCI","pr":"SAIL_PULL_REQUEST_NUMBER"},{"name":"Screwdriver","constant":"SCREWDRIVER","env":"SCREWDRIVER","pr":{"env":"SD_PULL_REQUEST","ne":"false"}},{"name":"Semaphore","constant":"SEMAPHORE","env":"SEMAPHORE","pr":"PULL_REQUEST_NUMBER"},{"name":"Sourcehut","constant":"SOURCEHUT","env":{"CI_NAME":"sourcehut"}},{"name":"Strider CD","constant":"STRIDER","env":"STRIDER"},{"name":"TaskCluster","constant":"TASKCLUSTER","env":["TASK_ID","RUN_ID"]},{"name":"TeamCity","constant":"TEAMCITY","env":"TEAMCITY_VERSION"},{"name":"Travis CI","constant":"TRAVIS","env":"TRAVIS","pr":{"env":"TRAVIS_PULL_REQUEST","ne":"false"}},{"name":"Vela","constant":"VELA","env":"VELA","pr":{"VELA_PULL_REQUEST":"1"}},{"name":"Vercel","constant":"VERCEL","env":{"any":["NOW_BUILDER","VERCEL"]},"pr":"VERCEL_GIT_PULL_REQUEST_ID"},{"name":"Visual Studio App Center","constant":"APPCENTER","env":"APPCENTER_BUILD_ID"},{"name":"Woodpecker","constant":"WOODPECKER","env":{"CI":"woodpecker"},"pr":{"CI_BUILD_EVENT":"pull_request"}},{"name":"Xcode Cloud","constant":"XCODE_CLOUD","env":"CI_XCODE_PROJECT","pr":"CI_PULL_REQUEST_NUMBER"},{"name":"Xcode Server","constant":"XCODE_SERVER","env":"XCS"}]')}};var u={};function __nccwpck_require__(p){var m=u[p];if(m!==undefined){return m.exports}var g=u[p]={exports:{}};var v=true;try{t[p](g,g.exports,__nccwpck_require__);v=false}finally{if(v)delete u[p]}return g.exports}(()=>{__nccwpck_require__.n=t=>{var u=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(u,{a:u});return u}})();(()=>{var t=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;var u;__nccwpck_require__.t=function(p,m){if(m&1)p=this(p);if(m&8)return p;if(typeof p==="object"&&p){if(m&4&&p.__esModule)return p;if(m&16&&typeof p.then==="function")return p}var g=Object.create(null);__nccwpck_require__.r(g);var v={};u=u||[null,t({}),t([]),t(t)];for(var b=m&2&&p;typeof b=="object"&&!~u.indexOf(b);b=t(b)){Object.getOwnPropertyNames(b).forEach((t=>v[t]=()=>p[t]))}v["default"]=()=>p;__nccwpck_require__.d(g,v);return g}})();(()=>{__nccwpck_require__.d=(t,u)=>{for(var p in u){if(__nccwpck_require__.o(u,p)&&!__nccwpck_require__.o(t,p)){Object.defineProperty(t,p,{enumerable:true,get:u[p]})}}}})();(()=>{__nccwpck_require__.o=(t,u)=>Object.prototype.hasOwnProperty.call(t,u)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var p={};(()=>{"use strict";var t=__nccwpck_require__(6395);var u=__nccwpck_require__.n(t);var p=__nccwpck_require__(8909);const{DM:m,gu:g,er:v,Ww:b,b7:w,Di:E,a2:S,uB:$,ef:P,c$:R,_V:x}=p;const O=require("node:util");var A=__nccwpck_require__(1708);var k=__nccwpck_require__(3024);var T=__nccwpck_require__(6760);var C=__nccwpck_require__.n(T);const I=require("node:crypto");const N=require("node:assert");const isObject=t=>{const u=typeof t;return t!==null&&(u==="object"||u==="function")};const isEmptyObject=t=>isObject(t)&&Object.keys(t).length===0;const D=new Set(["__proto__","prototype","constructor"]);const j=new Set("0123456789");function getPathSegments(t){const u=[];let p="";let m="start";let g=false;for(const v of t){switch(v){case"\\":{if(m==="index"){throw new Error("Invalid character in an index")}if(m==="indexEnd"){throw new Error("Invalid character after an index")}if(g){p+=v}m="property";g=!g;break}case".":{if(m==="index"){throw new Error("Invalid character in an index")}if(m==="indexEnd"){m="property";break}if(g){g=false;p+=v;break}if(D.has(p)){return[]}u.push(p);p="";m="property";break}case"[":{if(m==="index"){throw new Error("Invalid character in an index")}if(m==="indexEnd"){m="index";break}if(g){g=false;p+=v;break}if(m==="property"){if(D.has(p)){return[]}u.push(p);p=""}m="index";break}case"]":{if(m==="index"){u.push(Number.parseInt(p,10));p="";m="indexEnd";break}if(m==="indexEnd"){throw new Error("Invalid character after an index")}}default:{if(m==="index"&&!j.has(v)){throw new Error("Invalid character in an index")}if(m==="indexEnd"){throw new Error("Invalid character after an index")}if(m==="start"){m="property"}if(g){g=false;p+="\\"}p+=v}}}if(g){p+="\\"}switch(m){case"property":{if(D.has(p)){return[]}u.push(p);break}case"index":{throw new Error("Index was not closed")}case"start":{u.push("");break}}return u}function isStringIndex(t,u){if(typeof u!=="number"&&Array.isArray(t)){const p=Number.parseInt(u,10);return Number.isInteger(p)&&t[p]===t[u]}return false}function assertNotStringIndex(t,u){if(isStringIndex(t,u)){throw new Error("Cannot use string index")}}function getProperty(t,u,p){if(!isObject(t)||typeof u!=="string"){return p===undefined?t:p}const m=getPathSegments(u);if(m.length===0){return p}for(let u=0;u<m.length;u++){const g=m[u];if(isStringIndex(t,g)){t=u===m.length-1?undefined:null}else{t=t[g]}if(t===undefined||t===null){if(u!==m.length-1){return p}break}}return t===undefined?p:t}function setProperty(t,u,p){if(!isObject(t)||typeof u!=="string"){return t}const m=t;const g=getPathSegments(u);for(let u=0;u<g.length;u++){const m=g[u];assertNotStringIndex(t,m);if(u===g.length-1){t[m]=p}else if(!isObject(t[m])){t[m]=typeof g[u+1]==="number"?[]:{}}t=t[m]}return m}function deleteProperty(t,u){if(!isObject(t)||typeof u!=="string"){return false}const p=getPathSegments(u);for(let u=0;u<p.length;u++){const m=p[u];assertNotStringIndex(t,m);if(u===p.length-1){delete t[m];return true}t=t[m];if(!isObject(t)){return false}}}function hasProperty(t,u){if(!isObject(t)||typeof u!=="string"){return false}const p=getPathSegments(u);if(p.length===0){return false}for(const u of p){if(!isObject(t)||!(u in t)||isStringIndex(t,u)){return false}t=t[u]}return true}function escapePath(t){if(typeof t!=="string"){throw new TypeError("Expected a string")}return t.replaceAll(/[\\.[]/g,"\\$&")}function entries(t){const u=Object.entries(t);if(Array.isArray(t)){return u.map((([t,u])=>[Number(t),u]))}return u}function stringifyPath(t){let u="";for(let[p,m]of entries(t)){if(typeof m==="number"){u+=`[${m}]`}else{m=escapePath(m);u+=p===0?m:`.${m}`}}return u}function*deepKeysIterator(t,u=[]){if(!isObject(t)||isEmptyObject(t)){if(u.length>0){yield stringifyPath(u)}return}for(const[p,m]of entries(t)){yield*deepKeysIterator(m,[...u,p])}}function deepKeys(t){return[...deepKeysIterator(t)]}const L=require("node:os");const M=L.homedir();const U=L.tmpdir();const{env:B}=A;const macos=t=>{const u=T.join(M,"Library");return{data:T.join(u,"Application Support",t),config:T.join(u,"Preferences",t),cache:T.join(u,"Caches",t),log:T.join(u,"Logs",t),temp:T.join(U,t)}};const windows=t=>{const u=B.APPDATA||T.join(M,"AppData","Roaming");const p=B.LOCALAPPDATA||T.join(M,"AppData","Local");return{data:T.join(p,t,"Data"),config:T.join(u,t,"Config"),cache:T.join(p,t,"Cache"),log:T.join(p,t,"Log"),temp:T.join(U,t)}};const linux=t=>{const u=T.basename(M);return{data:T.join(B.XDG_DATA_HOME||T.join(M,".local","share"),t),config:T.join(B.XDG_CONFIG_HOME||T.join(M,".config"),t),cache:T.join(B.XDG_CACHE_HOME||T.join(M,".cache"),t),log:T.join(B.XDG_STATE_HOME||T.join(M,".local","state"),t),temp:T.join(U,u,t)}};function envPaths(t,{suffix:u="nodejs"}={}){if(typeof t!=="string"){throw new TypeError(`Expected a string, got ${typeof t}`)}if(u){t+=`-${u}`}if(A.platform==="darwin"){return macos(t)}if(A.platform==="win32"){return windows(t)}return linux(t)}const attemptifyAsync=(t,u)=>function attemptified(...p){return t.apply(undefined,p).catch(u)};const attemptifySync=(t,u)=>function attemptified(...p){try{return t.apply(undefined,p)}catch(t){return u(t)}};const H=A.getuid?!A.getuid():false;const z=1e4;const NOOP=()=>undefined;const V={isChangeErrorOk:t=>{if(!V.isNodeError(t))return false;const{code:u}=t;if(u==="ENOSYS")return true;if(!H&&(u==="EINVAL"||u==="EPERM"))return true;return false},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!V.isNodeError(t))return false;const{code:u}=t;if(u==="EMFILE"||u==="ENFILE"||u==="EAGAIN"||u==="EBUSY"||u==="EACCESS"||u==="EACCES"||u==="EACCS"||u==="EPERM")return true;return false},onChangeError:t=>{if(!V.isNodeError(t))throw t;if(V.isChangeErrorOk(t))return;throw t}};const G=V;class RetryfyQueue{constructor(){this.interval=25;this.intervalId=undefined;this.limit=z;this.queueActive=new Set;this.queueWaiting=new Set;this.init=()=>{if(this.intervalId)return;this.intervalId=setInterval(this.tick,this.interval)};this.reset=()=>{if(!this.intervalId)return;clearInterval(this.intervalId);delete this.intervalId};this.add=t=>{this.queueWaiting.add(t);if(this.queueActive.size<this.limit/2){this.tick()}else{this.init()}};this.remove=t=>{this.queueWaiting.delete(t);this.queueActive.delete(t)};this.schedule=()=>new Promise((t=>{const cleanup=()=>this.remove(resolver);const resolver=()=>t(cleanup);this.add(resolver)}));this.tick=()=>{if(this.queueActive.size>=this.limit)return;if(!this.queueWaiting.size)return this.reset();for(const t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t);this.queueActive.add(t);t()}}}}const q=new RetryfyQueue;const retryifyAsync=(t,u)=>function retrified(p){return function attempt(...m){return q.schedule().then((g=>{const onResolve=t=>{g();return t};const onReject=t=>{g();if(Date.now()>=p)throw t;if(u(t)){const t=Math.round(100*Math.random());const u=new Promise((u=>setTimeout(u,t)));return u.then((()=>attempt.apply(undefined,m)))}throw t};return t.apply(undefined,m).then(onResolve,onReject)}))}};const retryifySync=(t,u)=>function retrified(p){return function attempt(...m){try{return t.apply(undefined,m)}catch(t){if(Date.now()>p)throw t;if(u(t))return attempt.apply(undefined,m);throw t}}};const W={attempt:{chmod:attemptifyAsync((0,O.promisify)(k.chmod),G.onChangeError),chown:attemptifyAsync((0,O.promisify)(k.chown),G.onChangeError),close:attemptifyAsync((0,O.promisify)(k.close),NOOP),fsync:attemptifyAsync((0,O.promisify)(k.fsync),NOOP),mkdir:attemptifyAsync((0,O.promisify)(k.mkdir),NOOP),realpath:attemptifyAsync((0,O.promisify)(k.realpath),NOOP),stat:attemptifyAsync((0,O.promisify)(k.stat),NOOP),unlink:attemptifyAsync((0,O.promisify)(k.unlink),NOOP),chmodSync:attemptifySync(k.chmodSync,G.onChangeError),chownSync:attemptifySync(k.chownSync,G.onChangeError),closeSync:attemptifySync(k.closeSync,NOOP),existsSync:attemptifySync(k.existsSync,NOOP),fsyncSync:attemptifySync(k.fsync,NOOP),mkdirSync:attemptifySync(k.mkdirSync,NOOP),realpathSync:attemptifySync(k.realpathSync,NOOP),statSync:attemptifySync(k.statSync,NOOP),unlinkSync:attemptifySync(k.unlinkSync,NOOP)},retry:{close:retryifyAsync((0,O.promisify)(k.close),G.isRetriableError),fsync:retryifyAsync((0,O.promisify)(k.fsync),G.isRetriableError),open:retryifyAsync((0,O.promisify)(k.open),G.isRetriableError),readFile:retryifyAsync((0,O.promisify)(k.readFile),G.isRetriableError),rename:retryifyAsync((0,O.promisify)(k.rename),G.isRetriableError),stat:retryifyAsync((0,O.promisify)(k.stat),G.isRetriableError),write:retryifyAsync((0,O.promisify)(k.write),G.isRetriableError),writeFile:retryifyAsync((0,O.promisify)(k.writeFile),G.isRetriableError),closeSync:retryifySync(k.closeSync,G.isRetriableError),fsyncSync:retryifySync(k.fsyncSync,G.isRetriableError),openSync:retryifySync(k.openSync,G.isRetriableError),readFileSync:retryifySync(k.readFileSync,G.isRetriableError),renameSync:retryifySync(k.renameSync,G.isRetriableError),statSync:retryifySync(k.statSync,G.isRetriableError),writeSync:retryifySync(k.writeSync,G.isRetriableError),writeFileSync:retryifySync(k.writeFileSync,G.isRetriableError)}};const Y=W;const Z="utf8";const J=438;const X=511;const Q={};const ee={};const te=L.userInfo().uid;const re=L.userInfo().gid;const ie=7500;const oe=1e3;const ae=!!A.getuid;const le=A.getuid?!A.getuid():false;const ue=128;const he=1e4;const constants_NOOP=()=>{};const lang_isException=t=>t instanceof Error&&"code"in t;const lang_isFunction=t=>typeof t==="function";const lang_isString=t=>typeof t==="string";const lang_isUndefined=t=>t===undefined;const de={};const fe={next:t=>{const u=de[t];if(!u)return;u.shift();const p=u[0];if(p){p((()=>fe.next(t)))}else{delete de[t]}},schedule:t=>new Promise((u=>{let p=de[t];if(!p)p=de[t]=[];p.push(u);if(p.length>1)return;u((()=>fe.next(t)))}))};const pe=null&&fe;const me=A.platform==="linux";const ge=A.platform==="win32";const ve=["SIGHUP","SIGINT","SIGTERM"];if(!ge){ve.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(me){ve.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")}const _e=ve;class Interceptor{constructor(){this.callbacks=new Set;this.exited=false;this.exit=t=>{if(this.exited)return;this.exited=true;for(const t of this.callbacks){t()}if(t){if(ge&&(t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL")){A.kill(A.pid,"SIGTERM")}else{A.kill(A.pid,t)}}};this.hook=()=>{A.once("exit",(()=>this.exit()));for(const t of _e){try{A.once(t,(()=>this.exit(t)))}catch{}}};this.register=t=>{this.callbacks.add(t);return()=>{this.callbacks.delete(t)}};this.hook()}}const be=new Interceptor;const we=be.register;const Ee=we;const Se={store:{},create:t=>{const u=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6);const p=Date.now().toString().slice(-10);const m="tmp-";const g=`.${m}${p}${u}`;const v=`${t}${g}`;return v},get:(t,u,p=true)=>{const m=Se.truncate(u(t));if(m in Se.store)return Se.get(t,u,p);Se.store[m]=p;const disposer=()=>delete Se.store[m];return[m,disposer]},purge:t=>{if(!Se.store[t])return;delete Se.store[t];Y.attempt.unlink(t)},purgeSync:t=>{if(!Se.store[t])return;delete Se.store[t];Y.attempt.unlinkSync(t)},purgeSyncAll:()=>{for(const t in Se.store){Se.purgeSync(t)}},truncate:t=>{const u=T.basename(t);if(u.length<=ue)return t;const p=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(u);if(!p)return t;const m=u.length-ue;return`${t.slice(0,-u.length)}${p[1]}${p[2].slice(0,-m)}${p[3]}`}};Ee(Se.purgeSyncAll);const $e=Se;function readFile(t,u=DEFAULT_READ_OPTIONS){if(isString(u))return readFile(t,{encoding:u});const p=Date.now()+((u.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);return fs.retry.readFile(p)(t,u)}function readFileSync(t,u=DEFAULT_READ_OPTIONS){if(isString(u))return readFileSync(t,{encoding:u});const p=Date.now()+((u.timeout??DEFAULT_TIMEOUT_SYNC)||-1);return fs.retry.readFileSync(p)(t,u)}function writeFile(t,u,p,m){if(isFunction(p))return writeFile(t,u,DEFAULT_WRITE_OPTIONS,p);const g=writeFileAsync(t,u,p);if(m)g.then(m,m);return g}async function writeFileAsync(t,u,p=DEFAULT_WRITE_OPTIONS){if(isString(p))return writeFileAsync(t,u,{encoding:p});const m=Date.now()+((p.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);let g=null;let v=null;let b=null;let w=null;let E=null;try{if(p.schedule)g=await p.schedule(t);v=await Scheduler.schedule(t);const S=await fs.attempt.realpath(t);const $=!!S;t=S||t;[w,b]=Temp.get(t,p.tmpCreate||Temp.create,!(p.tmpPurge===false));const P=IS_POSIX&&isUndefined(p.chown);const R=isUndefined(p.mode);if($&&(P||R)){const u=await fs.attempt.stat(t);if(u){p={...p};if(P){p.chown={uid:u.uid,gid:u.gid}}if(R){p.mode=u.mode}}}if(!$){const u=path.dirname(t);await fs.attempt.mkdir(u,{mode:DEFAULT_FOLDER_MODE,recursive:true})}E=await fs.retry.open(m)(w,"w",p.mode||DEFAULT_FILE_MODE);if(p.tmpCreated){p.tmpCreated(w)}if(isString(u)){await fs.retry.write(m)(E,u,0,p.encoding||DEFAULT_ENCODING)}else if(!isUndefined(u)){await fs.retry.write(m)(E,u,0,u.length,0)}if(p.fsync!==false){if(p.fsyncWait!==false){await fs.retry.fsync(m)(E)}else{fs.attempt.fsync(E)}}await fs.retry.close(m)(E);E=null;if(p.chown&&(p.chown.uid!==DEFAULT_USER_UID||p.chown.gid!==DEFAULT_USER_GID)){await fs.attempt.chown(w,p.chown.uid,p.chown.gid)}if(p.mode&&p.mode!==DEFAULT_FILE_MODE){await fs.attempt.chmod(w,p.mode)}try{await fs.retry.rename(m)(w,t)}catch(u){if(!isException(u))throw u;if(u.code!=="ENAMETOOLONG")throw u;await fs.retry.rename(m)(w,Temp.truncate(t))}b();w=null}finally{if(E)await fs.attempt.close(E);if(w)Temp.purge(w);if(g)g();if(v)v()}}function writeFileSync(t,u,p=ee){if(lang_isString(p))return writeFileSync(t,u,{encoding:p});const m=Date.now()+((p.timeout??oe)||-1);let g=null;let v=null;let b=null;try{const w=Y.attempt.realpathSync(t);const E=!!w;t=w||t;[v,g]=$e.get(t,p.tmpCreate||$e.create,!(p.tmpPurge===false));const S=ae&&lang_isUndefined(p.chown);const $=lang_isUndefined(p.mode);if(E&&(S||$)){const u=Y.attempt.statSync(t);if(u){p={...p};if(S){p.chown={uid:u.uid,gid:u.gid}}if($){p.mode=u.mode}}}if(!E){const u=T.dirname(t);Y.attempt.mkdirSync(u,{mode:X,recursive:true})}b=Y.retry.openSync(m)(v,"w",p.mode||J);if(p.tmpCreated){p.tmpCreated(v)}if(lang_isString(u)){Y.retry.writeSync(m)(b,u,0,p.encoding||Z)}else if(!lang_isUndefined(u)){Y.retry.writeSync(m)(b,u,0,u.length,0)}if(p.fsync!==false){if(p.fsyncWait!==false){Y.retry.fsyncSync(m)(b)}else{Y.attempt.fsync(b)}}Y.retry.closeSync(m)(b);b=null;if(p.chown&&(p.chown.uid!==te||p.chown.gid!==re)){Y.attempt.chownSync(v,p.chown.uid,p.chown.gid)}if(p.mode&&p.mode!==J){Y.attempt.chmodSync(v,p.mode)}try{Y.retry.renameSync(m)(v,t)}catch(u){if(!lang_isException(u))throw u;if(u.code!=="ENAMETOOLONG")throw u;Y.retry.renameSync(m)(v,$e.truncate(t))}g();v=null}finally{if(b)Y.attempt.closeSync(b);if(v)$e.purge(v)}}var Pe=__nccwpck_require__(939);var Re=__nccwpck_require__(6848);const copyProperty=(t,u,p,m)=>{if(p==="length"||p==="prototype"){return}if(p==="arguments"||p==="caller"){return}const g=Object.getOwnPropertyDescriptor(t,p);const v=Object.getOwnPropertyDescriptor(u,p);if(!canCopyProperty(g,v)&&m){return}Object.defineProperty(t,p,v)};const canCopyProperty=function(t,u){return t===undefined||t.configurable||t.writable===u.writable&&t.enumerable===u.enumerable&&t.configurable===u.configurable&&(t.writable||t.value===u.value)};const changePrototype=(t,u)=>{const p=Object.getPrototypeOf(u);if(p===Object.getPrototypeOf(t)){return}Object.setPrototypeOf(t,p)};const wrappedToString=(t,u)=>`/* Wrapped ${t}*/\n${u}`;const xe=Object.getOwnPropertyDescriptor(Function.prototype,"toString");const Oe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");const changeToString=(t,u,p)=>{const m=p===""?"":`with ${p.trim()}() `;const g=wrappedToString.bind(null,m,u.toString());Object.defineProperty(g,"name",Oe);const{writable:v,enumerable:b,configurable:w}=xe;Object.defineProperty(t,"toString",{value:g,writable:v,enumerable:b,configurable:w})};function mimicFunction(t,u,{ignoreNonConfigurable:p=false}={}){const{name:m}=t;for(const m of Reflect.ownKeys(u)){copyProperty(t,u,m,p)}changePrototype(t,u);changeToString(t,u,m);return t}const debounceFunction=(t,u={})=>{if(typeof t!=="function"){throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``)}const{wait:p=0,maxWait:m=Number.POSITIVE_INFINITY,before:g=false,after:v=true}=u;if(p<0||m<0){throw new RangeError("`wait` and `maxWait` must not be negative.")}if(!g&&!v){throw new Error("Both `before` and `after` are false, function wouldn't be called.")}let b;let w;let E;const debouncedFunction=function(...u){const S=this;const later=()=>{b=undefined;if(w){clearTimeout(w);w=undefined}if(v){E=t.apply(S,u)}};const maxLater=()=>{w=undefined;if(b){clearTimeout(b);b=undefined}if(v){E=t.apply(S,u)}};const $=g&&!b;clearTimeout(b);b=setTimeout(later,p);if(m>0&&m!==Number.POSITIVE_INFINITY&&!w){w=setTimeout(maxLater,m)}if($){E=t.apply(S,u)}return E};mimicFunction(debouncedFunction,t);debouncedFunction.cancel=()=>{if(b){clearTimeout(b);b=undefined}if(w){clearTimeout(w);w=undefined}};return debouncedFunction};const Ae=debounceFunction;var ke=__nccwpck_require__(6723);const Te=Object.prototype.toString;const Ce="[object Uint8Array]";const Ie="[object ArrayBuffer]";function isType(t,u,p){if(!t){return false}if(t.constructor===u){return true}return Te.call(t)===p}function isUint8Array(t){return isType(t,Uint8Array,Ce)}function isArrayBuffer(t){return isType(t,ArrayBuffer,Ie)}function isUint8ArrayOrArrayBuffer(t){return isUint8Array(t)||isArrayBuffer(t)}function assertUint8Array(t){if(!isUint8Array(t)){throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}}function assertUint8ArrayOrArrayBuffer(t){if(!isUint8ArrayOrArrayBuffer(t)){throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``)}}function toUint8Array(t){if(t instanceof ArrayBuffer){return new Uint8Array(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}throw new TypeError(`Unsupported value, got \`${typeof t}\`.`)}function concatUint8Arrays(t,u){if(t.length===0){return new Uint8Array(0)}u??=t.reduce(((t,u)=>t+u.length),0);const p=new Uint8Array(u);let m=0;for(const u of t){assertUint8Array(u);p.set(u,m);m+=u.length}return p}function areUint8ArraysEqual(t,u){assertUint8Array(t);assertUint8Array(u);if(t===u){return true}if(t.length!==u.length){return false}for(let p=0;p<t.length;p++){if(t[p]!==u[p]){return false}}return true}function compareUint8Arrays(t,u){assertUint8Array(t);assertUint8Array(u);const p=Math.min(t.length,u.length);for(let m=0;m<p;m++){const p=t[m]-u[m];if(p!==0){return Math.sign(p)}}return Math.sign(t.length-u.length)}const Ne={utf8:new globalThis.TextDecoder("utf8")};function uint8ArrayToString(t,u="utf8"){assertUint8ArrayOrArrayBuffer(t);Ne[u]??=new globalThis.TextDecoder(u);return Ne[u].decode(t)}function assertString(t){if(typeof t!=="string"){throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}}const De=new globalThis.TextEncoder;function stringToUint8Array(t){assertString(t);return De.encode(t)}function base64ToBase64Url(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function base64UrlToBase64(t){const u=t.replaceAll("-","+").replaceAll("_","/");const p=(4-u.length%4)%4;return u+"=".repeat(p)}const je=65535;function uint8ArrayToBase64(t,{urlSafe:u=false}={}){assertUint8Array(t);let p="";for(let u=0;u<t.length;u+=je){const m=t.subarray(u,u+je);p+=globalThis.btoa(String.fromCodePoint.apply(undefined,m))}return u?base64ToBase64Url(p):p}function base64ToUint8Array(t){assertString(t);return Uint8Array.from(globalThis.atob(base64UrlToBase64(t)),(t=>t.codePointAt(0)))}function stringToBase64(t,{urlSafe:u=false}={}){assertString(t);return uint8ArrayToBase64(stringToUint8Array(t),{urlSafe:u})}function base64ToString(t){assertString(t);return uint8ArrayToString(base64ToUint8Array(t))}const Le=Array.from({length:256},((t,u)=>u.toString(16).padStart(2,"0")));function uint8ArrayToHex(t){assertUint8Array(t);let u="";for(let p=0;p<t.length;p++){u+=Le[t[p]]}return u}const Me={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function hexToUint8Array(t){assertString(t);if(t.length%2!==0){throw new Error("Invalid Hex string length.")}const u=t.length/2;const p=new Uint8Array(u);for(let m=0;m<u;m++){const u=Me[t[m*2]];const g=Me[t[m*2+1]];if(u===undefined||g===undefined){throw new Error(`Invalid Hex character encountered at position ${m*2}`)}p[m]=u<<4|g}return p}function getUintBE(t){const{byteLength:u}=t;if(u===6){return t.getUint16(0)*2**32+t.getUint32(2)}if(u===5){return t.getUint8(0)*2**32+t.getUint32(1)}if(u===4){return t.getUint32(0)}if(u===3){return t.getUint8(0)*2**16+t.getUint16(1)}if(u===2){return t.getUint16(0)}if(u===1){return t.getUint8(0)}}function indexOf(t,u){const p=t.length;const m=u.length;if(m===0){return-1}if(m>p){return-1}const g=p-m;for(let p=0;p<=g;p++){let g=true;for(let v=0;v<m;v++){if(t[p+v]!==u[v]){g=false;break}}if(g){return p}}return-1}function includes(t,u){return indexOf(t,u)!==-1}const Fe=Re["default"];const Ue="aes-256-cbc";const createPlainObject=()=>Object.create(null);const isExist=t=>t!==undefined&&t!==null;const checkValueType=(t,u)=>{const p=new Set(["undefined","symbol","function"]);const m=typeof u;if(p.has(m)){throw new TypeError(`Setting a value of type \`${m}\` for key \`${t}\` is not allowed as it's not supported by JSON`)}};const Be="__internal__";const He=`${Be}.migrations.version`;class Conf{path;events;#e;#t;#r;#s={};constructor(t={}){const u={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:false,accessPropertiesByDotNotation:true,configFileMode:438,...t};if(!u.cwd){if(!u.projectName){throw new Error("Please specify the `projectName` option.")}u.cwd=envPaths(u.projectName,{suffix:u.projectSuffix}).config}this.#r=u;if(u.schema){if(typeof u.schema!=="object"){throw new TypeError("The `schema` option must be an object.")}const t=new Pe.Ajv2020({allErrors:true,useDefaults:true});Fe(t);const p={type:"object",properties:u.schema};this.#e=t.compile(p);for(const[t,p]of Object.entries(u.schema)){if(p?.default){this.#s[t]=p.default}}}if(u.defaults){this.#s={...this.#s,...u.defaults}}if(u.serialize){this._serialize=u.serialize}if(u.deserialize){this._deserialize=u.deserialize}this.events=new EventTarget;this.#t=u.encryptionKey;const p=u.fileExtension?`.${u.fileExtension}`:"";this.path=T.resolve(u.cwd,`${u.configName??"config"}${p}`);const m=this.store;const g=Object.assign(createPlainObject(),u.defaults,m);if(u.migrations){if(!u.projectVersion){throw new Error("Please specify the `projectVersion` option.")}this._migrate(u.migrations,u.projectVersion,u.beforeEachMigration)}this._validate(g);try{N.deepEqual(m,g)}catch{this.store=g}if(u.watch){this._watch()}}get(t,u){if(this.#r.accessPropertiesByDotNotation){return this._get(t,u)}const{store:p}=this;return t in p?p[t]:u}set(t,u){if(typeof t!=="string"&&typeof t!=="object"){throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`)}if(typeof t!=="object"&&u===undefined){throw new TypeError("Use `delete()` to clear values")}if(this._containsReservedKey(t)){throw new TypeError(`Please don't use the ${Be} key, as it's used to manage this module internal operations.`)}const{store:p}=this;const set=(t,u)=>{checkValueType(t,u);if(this.#r.accessPropertiesByDotNotation){setProperty(p,t,u)}else{p[t]=u}};if(typeof t==="object"){const u=t;for(const[t,p]of Object.entries(u)){set(t,p)}}else{set(t,u)}this.store=p}has(t){if(this.#r.accessPropertiesByDotNotation){return hasProperty(this.store,t)}return t in this.store}reset(...t){for(const u of t){if(isExist(this.#s[u])){this.set(u,this.#s[u])}}}delete(t){const{store:u}=this;if(this.#r.accessPropertiesByDotNotation){deleteProperty(u,t)}else{delete u[t]}this.store=u}clear(){this.store=createPlainObject();for(const t of Object.keys(this.#s)){this.reset(t)}}onDidChange(t,u){if(typeof t!=="string"){throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`)}if(typeof u!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof u}`)}return this._handleChange((()=>this.get(t)),u)}onDidAnyChange(t){if(typeof t!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`)}return this._handleChange((()=>this.store),t)}get size(){return Object.keys(this.store).length}get store(){try{const t=k.readFileSync(this.path,this.#t?null:"utf8");const u=this._encryptData(t);const p=this._deserialize(u);this._validate(p);return Object.assign(createPlainObject(),p)}catch(t){if(t?.code==="ENOENT"){this._ensureDirectory();return createPlainObject()}if(this.#r.clearInvalidConfig&&t.name==="SyntaxError"){return createPlainObject()}throw t}}set store(t){this._ensureDirectory();this._validate(t);this._write(t);this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,u]of Object.entries(this.store)){yield[t,u]}}_encryptData(t){if(!this.#t){return typeof t==="string"?t:uint8ArrayToString(t)}try{const u=t.slice(0,16);const p=I.pbkdf2Sync(this.#t,u.toString(),1e4,32,"sha512");const m=I.createDecipheriv(Ue,p,u);const g=t.slice(17);const v=typeof g==="string"?stringToUint8Array(g):g;return uint8ArrayToString(concatUint8Arrays([m.update(v),m.final()]))}catch{}return t.toString()}_handleChange(t,u){let p=t();const onChange=()=>{const m=p;const g=t();if((0,O.isDeepStrictEqual)(g,m)){return}p=g;u.call(this,g,m)};this.events.addEventListener("change",onChange);return()=>{this.events.removeEventListener("change",onChange)}}_deserialize=t=>JSON.parse(t);_serialize=t=>JSON.stringify(t,undefined,"\t");_validate(t){if(!this.#e){return}const u=this.#e(t);if(u||!this.#e.errors){return}const p=this.#e.errors.map((({instancePath:t,message:u=""})=>`\`${t.slice(1)}\` ${u}`));throw new Error("Config schema violation: "+p.join("; "))}_ensureDirectory(){k.mkdirSync(T.dirname(this.path),{recursive:true})}_write(t){let u=this._serialize(t);if(this.#t){const t=I.randomBytes(16);const p=I.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512");const m=I.createCipheriv(Ue,p,t);u=concatUint8Arrays([t,stringToUint8Array(":"),m.update(stringToUint8Array(u)),m.final()])}if(A.env.SNAP){k.writeFileSync(this.path,u,{mode:this.#r.configFileMode})}else{try{writeFileSync(this.path,u,{mode:this.#r.configFileMode})}catch(t){if(t?.code==="EXDEV"){k.writeFileSync(this.path,u,{mode:this.#r.configFileMode});return}throw t}}}_watch(){this._ensureDirectory();if(!k.existsSync(this.path)){this._write(createPlainObject())}if(A.platform==="win32"){k.watch(this.path,{persistent:false},Ae((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:100}))}else{k.watchFile(this.path,{persistent:false},Ae((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:5e3}))}}_migrate(t,u,p){let m=this._get(He,"0.0.0");const g=Object.keys(t).filter((t=>this._shouldPerformMigration(t,m,u)));let v={...this.store};for(const b of g){try{if(p){p(this,{fromVersion:m,toVersion:b,finalVersion:u,versions:g})}const w=t[b];w?.(this);this._set(He,b);m=b;v={...this.store}}catch(t){this.store=v;throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${t}`)}}if(this._isVersionInRangeFormat(m)||!ke.eq(m,u)){this._set(He,u)}}_containsReservedKey(t){if(typeof t==="object"){const u=Object.keys(t)[0];if(u===Be){return true}}if(typeof t!=="string"){return false}if(this.#r.accessPropertiesByDotNotation){if(t.startsWith(`${Be}.`)){return true}return false}return false}_isVersionInRangeFormat(t){return ke.clean(t)===null}_shouldPerformMigration(t,u,p){if(this._isVersionInRangeFormat(t)){if(u!=="0.0.0"&&ke.satisfies(u,t)){return false}return ke.satisfies(p,t)}if(ke.lte(t,u)){return false}if(ke.gt(t,p)){return false}return true}_get(t,u){return getProperty(this.store,t,u)}_set(t,u){const{store:p}=this;setProperty(p,t,u);this.store=p}}var ze=__nccwpck_require__(9896);var Ve=__nccwpck_require__(6928);var Ge=__nccwpck_require__.n(Ve);var qe=__nccwpck_require__(9033);var We=__nccwpck_require__(7298);var Ke=__nccwpck_require__.n(We);var Ye=__nccwpck_require__(1083);var Ze=__nccwpck_require__.n(Ye);var Je=__nccwpck_require__(9850);var Xe=__nccwpck_require__.n(Je);const Qe=require("fs/promises");var et=__nccwpck_require__.n(Qe);var tt=__nccwpck_require__(857);var rt=__nccwpck_require__.n(tt);var st=__nccwpck_require__(2203);const it=require("stream/promises");var nt=__nccwpck_require__(4434);var ot=__nccwpck_require__(8474);const at=require("node:stream");const ut=require("node:string_decoder");const ht=require("assert");var dt=__nccwpck_require__(181);const ft=require("zlib");var pt=__nccwpck_require__.t(ft,2);const yt=require("node:fs/promises");var vt=Object.defineProperty;var Ur=(t,u)=>{for(var p in u)vt(t,p,{get:u[p],enumerable:!0})};var _t=typeof process=="object"&&process?process:{stdout:null,stderr:null},Wr=t=>!!t&&typeof t=="object"&&(t instanceof ir||t instanceof at||Gr(t)||Zr(t)),Gr=t=>!!t&&typeof t=="object"&&t instanceof ot.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==at.Writable.prototype.pipe,Zr=t=>!!t&&typeof t=="object"&&t instanceof ot.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",bt=Symbol("EOF"),wt=Symbol("maybeEmitEnd"),Et=Symbol("emittedEnd"),St=Symbol("emittingEnd"),$t=Symbol("emittedError"),Pt=Symbol("closed"),Rt=Symbol("read"),Ot=Symbol("flush"),At=Symbol("flushChunk"),kt=Symbol("encoding"),Tt=Symbol("decoder"),Ct=Symbol("flowing"),It=Symbol("paused"),Nt=Symbol("resume"),Mt=Symbol("buffer"),Ft=Symbol("pipes"),Ut=Symbol("bufferLength"),Bt=Symbol("bufferPush"),Ht=Symbol("bufferShift"),zt=Symbol("objectMode"),Vt=Symbol("destroyed"),Gt=Symbol("error"),qt=Symbol("emitData"),Wt=Symbol("emitEnd"),Kt=Symbol("emitEnd2"),Yt=Symbol("async"),Zt=Symbol("abort"),Jt=Symbol("aborted"),Xt=Symbol("signal"),Qt=Symbol("dataListeners"),er=Symbol("discarded"),jt=t=>Promise.resolve().then(t),Yr=t=>t(),Kr=t=>t==="end"||t==="finish"||t==="prefinish",Vr=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,$r=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),tr=class{src;dest;opts;ondrain;constructor(t,u,p){this.src=t,this.dest=u,this.opts=p,this.ondrain=()=>t[Nt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},sr=class extends tr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,u,p){super(t,u,p),this.proxyErrors=t=>this.dest.emit("error",t),t.on("error",this.proxyErrors)}},Xr=t=>!!t.objectMode,qr=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",ir=class extends ot.EventEmitter{[Ct]=!1;[It]=!1;[Ft]=[];[Mt]=[];[zt];[kt];[Yt];[Tt];[bt]=!1;[Et]=!1;[St]=!1;[Pt]=!1;[$t]=null;[Ut]=0;[Vt]=!1;[Xt];[Jt]=!1;[Qt]=0;[er]=!1;writable=!0;readable=!0;constructor(...t){let u=t[0]||{};if(super(),u.objectMode&&typeof u.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Xr(u)?(this[zt]=!0,this[kt]=null):qr(u)?(this[kt]=u.encoding,this[zt]=!1):(this[zt]=!1,this[kt]=null),this[Yt]=!!u.async,this[Tt]=this[kt]?new ut.StringDecoder(this[kt]):null,u&&u.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Mt]}),u&&u.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Ft]});let{signal:p}=u;p&&(this[Xt]=p,p.aborted?this[Zt]():p.addEventListener("abort",(()=>this[Zt]())))}get bufferLength(){return this[Ut]}get encoding(){return this[kt]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[zt]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Yt]}set async(t){this[Yt]=this[Yt]||!!t}[Zt](){this[Jt]=!0,this.emit("abort",this[Xt]?.reason),this.destroy(this[Xt]?.reason)}get aborted(){return this[Jt]}set aborted(t){}write(t,u,p){if(this[Jt])return!1;if(this[bt])throw new Error("write after end");if(this[Vt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof u=="function"&&(p=u,u="utf8"),u||(u="utf8");let m=this[Yt]?jt:Yr;if(!this[zt]&&!Buffer.isBuffer(t)){if($r(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Vr(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[zt]?(this[Ct]&&this[Ut]!==0&&this[Ot](!0),this[Ct]?this.emit("data",t):this[Bt](t),this[Ut]!==0&&this.emit("readable"),p&&m(p),this[Ct]):t.length?(typeof t=="string"&&!(u===this[kt]&&!this[Tt]?.lastNeed)&&(t=Buffer.from(t,u)),Buffer.isBuffer(t)&&this[kt]&&(t=this[Tt].write(t)),this[Ct]&&this[Ut]!==0&&this[Ot](!0),this[Ct]?this.emit("data",t):this[Bt](t),this[Ut]!==0&&this.emit("readable"),p&&m(p),this[Ct]):(this[Ut]!==0&&this.emit("readable"),p&&m(p),this[Ct])}read(t){if(this[Vt])return null;if(this[er]=!1,this[Ut]===0||t===0||t&&t>this[Ut])return this[wt](),null;this[zt]&&(t=null),this[Mt].length>1&&!this[zt]&&(this[Mt]=[this[kt]?this[Mt].join(""):Buffer.concat(this[Mt],this[Ut])]);let u=this[Rt](t||null,this[Mt][0]);return this[wt](),u}[Rt](t,u){if(this[zt])this[Ht]();else{let p=u;t===p.length||t===null?this[Ht]():typeof p=="string"?(this[Mt][0]=p.slice(t),u=p.slice(0,t),this[Ut]-=t):(this[Mt][0]=p.subarray(t),u=p.subarray(0,t),this[Ut]-=t)}return this.emit("data",u),!this[Mt].length&&!this[bt]&&this.emit("drain"),u}end(t,u,p){return typeof t=="function"&&(p=t,t=void 0),typeof u=="function"&&(p=u,u="utf8"),t!==void 0&&this.write(t,u),p&&this.once("end",p),this[bt]=!0,this.writable=!1,(this[Ct]||!this[It])&&this[wt](),this}[Nt](){this[Vt]||(!this[Qt]&&!this[Ft].length&&(this[er]=!0),this[It]=!1,this[Ct]=!0,this.emit("resume"),this[Mt].length?this[Ot]():this[bt]?this[wt]():this.emit("drain"))}resume(){return this[Nt]()}pause(){this[Ct]=!1,this[It]=!0,this[er]=!1}get destroyed(){return this[Vt]}get flowing(){return this[Ct]}get paused(){return this[It]}[Bt](t){this[zt]?this[Ut]+=1:this[Ut]+=t.length,this[Mt].push(t)}[Ht](){return this[zt]?this[Ut]-=1:this[Ut]-=this[Mt][0].length,this[Mt].shift()}[Ot](t=!1){do{}while(this[At](this[Ht]())&&this[Mt].length);!t&&!this[Mt].length&&!this[bt]&&this.emit("drain")}[At](t){return this.emit("data",t),this[Ct]}pipe(t,u){if(this[Vt])return t;this[er]=!1;let p=this[Et];return u=u||{},t===_t.stdout||t===_t.stderr?u.end=!1:u.end=u.end!==!1,u.proxyErrors=!!u.proxyErrors,p?u.end&&t.end():(this[Ft].push(u.proxyErrors?new sr(this,t,u):new tr(this,t,u)),this[Yt]?jt((()=>this[Nt]())):this[Nt]()),t}unpipe(t){let u=this[Ft].find((u=>u.dest===t));u&&(this[Ft].length===1?(this[Ct]&&this[Qt]===0&&(this[Ct]=!1),this[Ft]=[]):this[Ft].splice(this[Ft].indexOf(u),1),u.unpipe())}addListener(t,u){return this.on(t,u)}on(t,u){let p=super.on(t,u);if(t==="data")this[er]=!1,this[Qt]++,!this[Ft].length&&!this[Ct]&&this[Nt]();else if(t==="readable"&&this[Ut]!==0)super.emit("readable");else if(Kr(t)&&this[Et])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[$t]){let t=u;this[Yt]?jt((()=>t.call(this,this[$t]))):t.call(this,this[$t])}return p}removeListener(t,u){return this.off(t,u)}off(t,u){let p=super.off(t,u);return t==="data"&&(this[Qt]=this.listeners("data").length,this[Qt]===0&&!this[er]&&!this[Ft].length&&(this[Ct]=!1)),p}removeAllListeners(t){let u=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[Qt]=0,!this[er]&&!this[Ft].length&&(this[Ct]=!1)),u}get emittedEnd(){return this[Et]}[wt](){!this[St]&&!this[Et]&&!this[Vt]&&this[Mt].length===0&&this[bt]&&(this[St]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Pt]&&this.emit("close"),this[St]=!1)}emit(t,...u){let p=u[0];if(t!=="error"&&t!=="close"&&t!==Vt&&this[Vt])return!1;if(t==="data")return!this[zt]&&!p?!1:this[Yt]?(jt((()=>this[qt](p))),!0):this[qt](p);if(t==="end")return this[Wt]();if(t==="close"){if(this[Pt]=!0,!this[Et]&&!this[Vt])return!1;let t=super.emit("close");return this.removeAllListeners("close"),t}else if(t==="error"){this[$t]=p,super.emit(Gt,p);let t=!this[Xt]||this.listeners("error").length?super.emit("error",p):!1;return this[wt](),t}else if(t==="resume"){let t=super.emit("resume");return this[wt](),t}else if(t==="finish"||t==="prefinish"){let u=super.emit(t);return this.removeAllListeners(t),u}let m=super.emit(t,...u);return this[wt](),m}[qt](t){for(let u of this[Ft])u.dest.write(t)===!1&&this.pause();let u=this[er]?!1:super.emit("data",t);return this[wt](),u}[Wt](){return this[Et]?!1:(this[Et]=!0,this.readable=!1,this[Yt]?(jt((()=>this[Kt]())),!0):this[Kt]())}[Kt](){if(this[Tt]){let t=this[Tt].end();if(t){for(let u of this[Ft])u.dest.write(t);this[er]||super.emit("data",t)}}for(let t of this[Ft])t.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[zt]||(t.dataLength=0);let u=this.promise();return this.on("data",(u=>{t.push(u),this[zt]||(t.dataLength+=u.length)})),await u,t}async concat(){if(this[zt])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[kt]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,u)=>{this.on(Vt,(()=>u(new Error("stream destroyed")))),this.on("error",(t=>u(t))),this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[er]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let u=this.read();if(u!==null)return Promise.resolve({done:!1,value:u});if(this[bt])return e();let p,m,h=t=>{this.off("data",a),this.off("end",l),this.off(Vt,c),e(),m(t)},a=t=>{this.off("error",h),this.off("end",l),this.off(Vt,c),this.pause(),p({value:t,done:!!this[bt]})},l=()=>{this.off("error",h),this.off("data",a),this.off(Vt,c),e(),p({done:!0,value:void 0})},c=()=>h(new Error("stream destroyed"));return new Promise(((t,u)=>{m=u,p=t,this.once(Vt,c),this.once("error",h),this.once("end",l),this.once("data",a)}))},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[er]=!1;let t=!1,e=()=>(this.pause(),this.off(Gt,e),this.off(Vt,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let u=this.read();return u===null?e():{done:!1,value:u}};return this.once("end",e),this.once(Gt,e),this.once(Vt,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[Vt])return t?this.emit("error",t):this.emit(Vt),this;this[Vt]=!0,this[er]=!0,this[Mt].length=0,this[Ut]=0;let u=this;return typeof u.close=="function"&&!this[Pt]&&u.close(),t?this.emit("error",t):this.emit(Vt),this}static get isStream(){return Wr}};var nr=ze.writev,ar=Symbol("_autoClose"),cr=Symbol("_close"),lr=Symbol("_ended"),ur=Symbol("_fd"),hr=Symbol("_finished"),pr=Symbol("_flags"),mr=Symbol("_flush"),yr=Symbol("_handleChunk"),wr=Symbol("_makeBuf"),Er=Symbol("_mode"),Sr=Symbol("_needDrain"),Pr=Symbol("_onerror"),Rr=Symbol("_onopen"),xr=Symbol("_onread"),Or=Symbol("_onwrite"),Ar=Symbol("_open"),kr=Symbol("_path"),Cr=Symbol("_pos"),Ir=Symbol("_queue"),Nr=Symbol("_read"),Dr=Symbol("_readSize"),jr=Symbol("_reading"),Mr=Symbol("_remain"),Fr=Symbol("_size"),Br=Symbol("_write"),Hr=Symbol("_writing"),zr=Symbol("_defaultFlag"),Jr=Symbol("_errored"),Qr=class extends ir{[Jr]=!1;[ur];[kr];[Dr];[jr]=!1;[Fr];[Mr];[ar];constructor(t,u){if(u=u||{},super(u),this.readable=!0,this.writable=!1,typeof t!="string")throw new TypeError("path must be a string");this[Jr]=!1,this[ur]=typeof u.fd=="number"?u.fd:void 0,this[kr]=t,this[Dr]=u.readSize||16*1024*1024,this[jr]=!1,this[Fr]=typeof u.size=="number"?u.size:1/0,this[Mr]=this[Fr],this[ar]=typeof u.autoClose=="boolean"?u.autoClose:!0,typeof this[ur]=="number"?this[Nr]():this[Ar]()}get fd(){return this[ur]}get path(){return this[kr]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ar](){ze.open(this[kr],"r",((t,u)=>this[Rr](t,u)))}[Rr](t,u){t?this[Pr](t):(this[ur]=u,this.emit("open",u),this[Nr]())}[wr](){return Buffer.allocUnsafe(Math.min(this[Dr],this[Mr]))}[Nr](){if(!this[jr]){this[jr]=!0;let t=this[wr]();if(t.length===0)return process.nextTick((()=>this[xr](null,0,t)));ze.read(this[ur],t,0,t.length,null,((t,u,p)=>this[xr](t,u,p)))}}[xr](t,u,p){this[jr]=!1,t?this[Pr](t):this[yr](u,p)&&this[Nr]()}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[Pr](t){this[jr]=!0,this[cr](),this.emit("error",t)}[yr](t,u){let p=!1;return this[Mr]-=t,t>0&&(p=super.write(t<u.length?u.subarray(0,t):u)),(t===0||this[Mr]<=0)&&(p=!1,this[cr](),super.end()),p}emit(t,...u){switch(t){case"prefinish":case"finish":return!1;case"drain":return typeof this[ur]=="number"&&this[Nr](),!1;case"error":return this[Jr]?!1:(this[Jr]=!0,super.emit(t,...u));default:return super.emit(t,...u)}}},es=class extends Qr{[Ar](){let t=!0;try{this[Rr](null,ze.openSync(this[kr],"r")),t=!1}finally{t&&this[cr]()}}[Nr](){let t=!0;try{if(!this[jr]){this[jr]=!0;do{let t=this[wr](),u=t.length===0?0:ze.readSync(this[ur],t,0,t.length,null);if(!this[yr](u,t))break}while(!0);this[jr]=!1}t=!1}finally{t&&this[cr]()}}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.closeSync(t),this.emit("close")}}},rs=class extends nt{readable=!1;writable=!0;[Jr]=!1;[Hr]=!1;[lr]=!1;[Ir]=[];[Sr]=!1;[kr];[Er];[ar];[ur];[zr];[pr];[hr]=!1;[Cr];constructor(t,u){u=u||{},super(u),this[kr]=t,this[ur]=typeof u.fd=="number"?u.fd:void 0,this[Er]=u.mode===void 0?438:u.mode,this[Cr]=typeof u.start=="number"?u.start:void 0,this[ar]=typeof u.autoClose=="boolean"?u.autoClose:!0;let p=this[Cr]!==void 0?"r+":"w";this[zr]=u.flags===void 0,this[pr]=u.flags===void 0?p:u.flags,this[ur]===void 0&&this[Ar]()}emit(t,...u){if(t==="error"){if(this[Jr])return!1;this[Jr]=!0}return super.emit(t,...u)}get fd(){return this[ur]}get path(){return this[kr]}[Pr](t){this[cr](),this[Hr]=!0,this.emit("error",t)}[Ar](){ze.open(this[kr],this[pr],this[Er],((t,u)=>this[Rr](t,u)))}[Rr](t,u){this[zr]&&this[pr]==="r+"&&t&&t.code==="ENOENT"?(this[pr]="w",this[Ar]()):t?this[Pr](t):(this[ur]=u,this.emit("open",u),this[Hr]||this[mr]())}end(t,u){return t&&this.write(t,u),this[lr]=!0,!this[Hr]&&!this[Ir].length&&typeof this[ur]=="number"&&this[Or](null,0),this}write(t,u){return typeof t=="string"&&(t=Buffer.from(t,u)),this[lr]?(this.emit("error",new Error("write() after end()")),!1):this[ur]===void 0||this[Hr]||this[Ir].length?(this[Ir].push(t),this[Sr]=!0,!1):(this[Hr]=!0,this[Br](t),!0)}[Br](t){ze.write(this[ur],t,0,t.length,this[Cr],((t,u)=>this[Or](t,u)))}[Or](t,u){t?this[Pr](t):(this[Cr]!==void 0&&typeof u=="number"&&(this[Cr]+=u),this[Ir].length?this[mr]():(this[Hr]=!1,this[lr]&&!this[hr]?(this[hr]=!0,this[cr](),this.emit("finish")):this[Sr]&&(this[Sr]=!1,this.emit("drain"))))}[mr](){if(this[Ir].length===0)this[lr]&&this[Or](null,0);else if(this[Ir].length===1)this[Br](this[Ir].pop());else{let t=this[Ir];this[Ir]=[],nr(this[ur],t,this[Cr],((t,u)=>this[Or](t,u)))}}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}},ss=class extends rs{[Ar](){let t;if(this[zr]&&this[pr]==="r+")try{t=ze.openSync(this[kr],this[pr],this[Er])}catch(t){if(t?.code==="ENOENT")return this[pr]="w",this[Ar]();throw t}else t=ze.openSync(this[kr],this[pr],this[Er]);this[Rr](null,t)}[cr](){if(this[ar]&&typeof this[ur]=="number"){let t=this[ur];this[ur]=void 0,ze.closeSync(t),this.emit("close")}}[Br](t){let u=!0;try{this[Or](null,ze.writeSync(this[ur],t,0,t.length,this[Cr])),u=!1}finally{if(u)try{this[cr]()}catch{}}}};var is=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Fs=t=>!!t.sync&&!!t.file,ks=t=>!t.sync&&!!t.file,vs=t=>!!t.sync&&!t.file,Ms=t=>!t.sync&&!t.file;var Bs=t=>!!t.file;var tn=t=>{let u=is.get(t);return u||t},se=(t={})=>{if(!t)return{};let u={};for(let[p,m]of Object.entries(t)){let t=tn(p);u[t]=m}return u.chmod===void 0&&u.noChmod===!1&&(u.chmod=!0),delete u.noChmod,u};var K=(t,u,p,m,g)=>Object.assign(((v=[],b,w)=>{Array.isArray(v)&&(b=v,v={}),typeof b=="function"&&(w=b,b=void 0),b=b?Array.from(b):[];let E=se(v);if(g?.(E,b),Fs(E)){if(typeof w=="function")throw new TypeError("callback not supported for sync tar functions");return t(E,b)}else if(ks(E)){let t=u(E,b);return w?t.then((()=>w()),w):t}else if(vs(E)){if(typeof w=="function")throw new TypeError("callback not supported for sync tar functions");return p(E,b)}else if(Ms(E)){if(typeof w=="function")throw new TypeError("callback only supported with file option");return m(E,b)}throw new Error("impossible options??")}),{syncFile:t,asyncFile:u,syncNoFile:p,asyncNoFile:m,validate:g});var ns=ft.constants||{ZLIB_VERNUM:4736},os=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},ns));var as=dt.Buffer.concat,cs=Object.getOwnPropertyDescriptor(dt.Buffer,"concat"),nn=t=>t,ls=cs?.writable===!0||cs?.set!==void 0?t=>{dt.Buffer.concat=t?nn:as}:t=>{},us=Symbol("_superWrite"),hs=class extends Error{code;errno;constructor(t,u){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,u??this.constructor)}get name(){return"ZlibError"}},ds=Symbol("flushFlag"),ms=class extends ir{#i=!1;#n=!1;#o;#a;#c;#l;#u;get sawError(){return this.#i}get handle(){return this.#l}get flushFlag(){return this.#o}constructor(t,u){if(!t||typeof t!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(t),this.#o=t.flush??0,this.#a=t.finishFlush??0,this.#c=t.fullFlushFlag??0,typeof pt[u]!="function")throw new TypeError("Compression method not supported: "+u);try{this.#l=new pt[u](t)}catch(t){throw new hs(t,this.constructor)}this.#u=t=>{this.#i||(this.#i=!0,this.close(),this.emit("error",t))},this.#l?.on("error",(t=>this.#u(new hs(t)))),this.once("end",(()=>this.close))}close(){this.#l&&(this.#l.close(),this.#l=void 0,this.emit("close"))}reset(){if(!this.#i)return ht(this.#l,"zlib binding closed"),this.#l.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#c),this.write(Object.assign(dt.Buffer.alloc(0),{[ds]:t})))}end(t,u,p){return typeof t=="function"&&(p=t,u=void 0,t=void 0),typeof u=="function"&&(p=u,u=void 0),t&&(u?this.write(t,u):this.write(t)),this.flush(this.#a),this.#n=!0,super.end(p)}get ended(){return this.#n}[us](t){return super.write(t)}write(t,u,p){if(typeof u=="function"&&(p=u,u="utf8"),typeof t=="string"&&(t=dt.Buffer.from(t,u)),this.#i)return;ht(this.#l,"zlib binding closed");let m=this.#l._handle,g=m.close;m.close=()=>{};let v=this.#l.close;this.#l.close=()=>{},ls(!0);let b;try{let u=typeof t[ds]=="number"?t[ds]:this.#o;b=this.#l._processChunk(t,u),ls(!1)}catch(t){ls(!1),this.#u(new hs(t,this.write))}finally{this.#l&&(this.#l._handle=m,m.close=g,this.#l.close=v,this.#l.removeAllListeners("error"))}this.#l&&this.#l.on("error",(t=>this.#u(new hs(t,this.write))));let w;if(b)if(Array.isArray(b)&&b.length>0){let t=b[0];w=this[us](dt.Buffer.from(t));for(let t=1;t<b.length;t++)w=this[us](b[t])}else w=this[us](dt.Buffer.from(b));return p&&p(),w}},gs=class extends ms{#i;#n;constructor(t,u){t=t||{},t.flush=t.flush||os.Z_NO_FLUSH,t.finishFlush=t.finishFlush||os.Z_FINISH,t.fullFlushFlag=os.Z_FULL_FLUSH,super(t,u),this.#i=t.level,this.#n=t.strategy}params(t,u){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#i!==t||this.#n!==u){this.flush(os.Z_SYNC_FLUSH),ht(this.handle,"zlib binding closed");let p=this.handle.flush;this.handle.flush=(t,u)=>{typeof t=="function"&&(u=t,t=this.flushFlag),this.flush(t),u?.()};try{this.handle.params(t,u)}finally{this.handle.flush=p}this.handle&&(this.#i=t,this.#n=u)}}}};var ys=class extends gs{#i;constructor(t){super(t,"Gzip"),this.#i=t&&!!t.portable}[us](t){return this.#i?(this.#i=!1,t[9]=255,super[us](t)):super[us](t)}};var _s=class extends gs{constructor(t){super(t,"Unzip")}},bs=class extends ms{constructor(t,u){t=t||{},t.flush=t.flush||os.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||os.BROTLI_OPERATION_FINISH,t.fullFlushFlag=os.BROTLI_OPERATION_FLUSH,super(t,u)}},$s=class extends bs{constructor(t){super(t,"BrotliCompress")}},Ps=class extends bs{constructor(t){super(t,"BrotliDecompress")}},Rs=class extends ms{constructor(t,u){t=t||{},t.flush=t.flush||os.ZSTD_e_continue,t.finishFlush=t.finishFlush||os.ZSTD_e_end,t.fullFlushFlag=os.ZSTD_e_flush,super(t,u)}},xs=class extends Rs{constructor(t){super(t,"ZstdCompress")}},Os=class extends Rs{constructor(t){super(t,"ZstdDecompress")}};var Us=(t,u)=>{if(Number.isSafeInteger(t))t<0?an(t,u):hn(t,u);else throw Error("cannot encode number outside of javascript safe integer range");return u},hn=(t,u)=>{u[0]=128;for(var p=u.length;p>1;p--)u[p-1]=t&255,t=Math.floor(t/256)},an=(t,u)=>{u[0]=255;var p=!1;t=t*-1;for(var m=u.length;m>1;m--){var g=t&255;t=Math.floor(t/256),p?u[m-1]=Ws(g):g===0?u[m-1]=0:(p=!0,u[m-1]=Gs(g))}},Hs=t=>{let u=t[0],p=u===128?cn(t.subarray(1,t.length)):u===255?ln(t):null;if(p===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(p))throw Error("parsed number outside of javascript safe integer range");return p},ln=t=>{for(var u=t.length,p=0,m=!1,g=u-1;g>-1;g--){var v=Number(t[g]),b;m?b=Ws(v):v===0?b=v:(m=!0,b=Gs(v)),b!==0&&(p-=b*Math.pow(256,u-g-1))}return p},cn=t=>{for(var u=t.length,p=0,m=u-1;m>-1;m--){var g=Number(t[m]);g!==0&&(p+=g*Math.pow(256,u-m-1))}return p},Ws=t=>(255^t)&255,Gs=t=>(255^t)+1&255;var As={};Ur(As,{code:()=>Is,isCode:()=>ne,isName:()=>dn,name:()=>Cs,normalFsTypes:()=>Ts});var ne=t=>Cs.has(t),dn=t=>Is.has(t),Ts=new Set(["0","","1","2","3","4","5","6","7","D"]),Cs=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Is=new Map(Array.from(Cs).map((t=>[t[1],t[0]])));var un=t=>t===void 0||t<0?void 0:t,Ns=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#i="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,u=0,p,m){Buffer.isBuffer(t)?this.decode(t,u||0,p,m):t&&this.#n(t)}decode(t,u,p,m){if(u||(u=0),!t||!(t.length>=u+512))throw new Error("need 512 bytes for header");let g=xt(t,u+156,1),v=Ts.has(g),b=v?p:void 0,w=v?m:void 0;if(this.path=b?.path??xt(t,u,100),this.mode=b?.mode??w?.mode??lt(t,u+100,8),this.uid=b?.uid??w?.uid??lt(t,u+108,8),this.gid=b?.gid??w?.gid??lt(t,u+116,8),this.size=un(b?.size??w?.size??lt(t,u+124,12)),this.mtime=b?.mtime??w?.mtime??Wi(t,u+136,12),this.cksum=lt(t,u+148,12),w&&this.#n(w,!0),b&&this.#n(b),ne(g)&&(this.#i=g||"0"),this.#i==="0"&&this.path.slice(-1)==="/"&&(this.#i="5"),this.#i==="5"&&(this.size=0),this.linkpath=xt(t,u+157,100),t.subarray(u+257,u+265).toString()==="ustar\x0000")if(this.uname=b?.uname??w?.uname??xt(t,u+265,32),this.gname=b?.gname??w?.gname??xt(t,u+297,32),this.devmaj=b?.devmaj??w?.devmaj??lt(t,u+329,8)??0,this.devmin=b?.devmin??w?.devmin??lt(t,u+337,8)??0,t[u+475]!==0){let p=xt(t,u+345,155);this.path=p+"/"+this.path}else{let g=xt(t,u+345,130);g&&(this.path=g+"/"+this.path),this.atime=p?.atime??m?.atime??Wi(t,u+476,12),this.ctime=p?.ctime??m?.ctime??Wi(t,u+488,12)}let E=256;for(let p=u;p<u+148;p++)E+=t[p];for(let p=u+156;p<u+512;p++)E+=t[p];this.cksumValid=E===this.cksum,this.cksum===void 0&&E===256&&(this.nullBlock=!0)}#n(t,u=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,p])=>!(p==null||t==="size"&&Number(p)<0||t==="path"&&u||t==="linkpath"&&u||t==="global")))))}encode(t,u=0){if(t||(t=this.block=Buffer.alloc(512)),this.#i==="Unsupported"&&(this.#i="0"),!(t.length>=u+512))throw new Error("need 512 bytes for header");let p=this.ctime||this.atime?130:155,m=mn(this.path||"",p),g=m[0],v=m[1];this.needPax=!!m[2],this.needPax=Lt(t,u,100,g)||this.needPax,this.needPax=ct(t,u+100,8,this.mode)||this.needPax,this.needPax=ct(t,u+108,8,this.uid)||this.needPax,this.needPax=ct(t,u+116,8,this.gid)||this.needPax,this.needPax=ct(t,u+124,12,this.size)||this.needPax,this.needPax=Gi(t,u+136,12,this.mtime)||this.needPax,t[u+156]=Number(this.#i.codePointAt(0)),this.needPax=Lt(t,u+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",u+257,8),this.needPax=Lt(t,u+265,32,this.uname)||this.needPax,this.needPax=Lt(t,u+297,32,this.gname)||this.needPax,this.needPax=ct(t,u+329,8,this.devmaj)||this.needPax,this.needPax=ct(t,u+337,8,this.devmin)||this.needPax,this.needPax=Lt(t,u+345,p,v)||this.needPax,t[u+475]!==0?this.needPax=Lt(t,u+345,155,v)||this.needPax:(this.needPax=Lt(t,u+345,130,v)||this.needPax,this.needPax=Gi(t,u+476,12,this.atime)||this.needPax,this.needPax=Gi(t,u+488,12,this.ctime)||this.needPax);let b=256;for(let p=u;p<u+148;p++)b+=t[p];for(let p=u+156;p<u+512;p++)b+=t[p];return this.cksum=b,ct(t,u+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#i==="Unsupported"?this.#i:Cs.get(this.#i)}get typeKey(){return this.#i}set type(t){let u=String(Is.get(t));if(ne(u)||u==="Unsupported")this.#i=u;else if(ne(t))this.#i=t;else throw new TypeError("invalid entry type: "+t)}},mn=(t,u)=>{let p=t,m="",g,v=T.posix.parse(t).root||".";if(Buffer.byteLength(p)<100)g=[p,m,!1];else{m=T.posix.dirname(p),p=T.posix.basename(p);do{Buffer.byteLength(p)<=100&&Buffer.byteLength(m)<=u?g=[p,m,!1]:Buffer.byteLength(p)>100&&Buffer.byteLength(m)<=u?g=[p.slice(0,99),m,!0]:(p=T.posix.join(T.posix.basename(m),p),m=T.posix.dirname(m))}while(m!==v&&g===void 0);g||(g=[t.slice(0,99),"",!0])}return g},xt=(t,u,p)=>t.subarray(u,u+p).toString("utf8").replace(/\0.*/,""),Wi=(t,u,p)=>pn(lt(t,u,p)),pn=t=>t===void 0?void 0:new Date(t*1e3),lt=(t,u,p)=>Number(t[u])&128?Hs(t.subarray(u,u+p)):wn(t,u,p),En=t=>isNaN(t)?void 0:t,wn=(t,u,p)=>En(parseInt(t.subarray(u,u+p).toString("utf8").replace(/\0.*$/,"").trim(),8)),Ds={12:8589934591,8:2097151},ct=(t,u,p,m)=>m===void 0?!1:m>Ds[p]||m<0?(Us(m,t.subarray(u,u+p)),!0):(yn(t,u,p,m),!1),yn=(t,u,p,m)=>t.write(Rn(m,p),u,p,"ascii"),Rn=(t,u)=>gn(Math.floor(t).toString(8),u),gn=(t,u)=>(t.length===u-1?t:new Array(u-t.length-1).join("0")+t+" ")+"\0",Gi=(t,u,p,m)=>m===void 0?!1:ct(t,u,p,m.getTime()/1e3),js=new Array(156).join("\0"),Lt=(t,u,p,m)=>m===void 0?!1:(t.write(m+js,u,p,"utf8"),m.length!==Buffer.byteLength(m)||m.length>p);var Ls=class s{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,u=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=u,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let u=Buffer.byteLength(t),p=512*Math.ceil(1+u/512),m=Buffer.allocUnsafe(p);for(let t=0;t<512;t++)m[t]=0;new Ns({path:("PaxHeader/"+(0,T.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:u,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(m),m.write(t,512,u,"utf8");for(let t=u+512;t<m.length;t++)m[t]=0;return m}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let u=this[t],p=u instanceof Date?u.getTime()/1e3:u,m=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+p+`\n`,g=Buffer.byteLength(m),v=Math.floor(Math.log(g)/Math.log(10))+1;return g+v>=Math.pow(10,v)&&(v+=1),v+g+m}static parse(t,u,p=!1){return new s(On(Tn(t),u),p)}},On=(t,u)=>u?Object.assign({},u,t):t,Tn=t=>t.replace(/\n$/,"").split(`\n`).reduce(xn,Object.create(null)),xn=(t,u)=>{let p=parseInt(u,10);if(p!==Buffer.byteLength(u)+1)return t;u=u.slice((p+" ").length);let m=u.split("="),g=m.shift();if(!g)return t;let v=g.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),b=m.join("=").replace(/\0.*/,"");switch(v){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":t[v]=b;break;case"ctime":case"atime":case"mtime":t[v]=new Date(Number(b)*1e3);break;case"size":let u=+b;u>=0&&(t[v]=u);break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":t[v]=+b;break}return t};var zs=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Vs=zs!=="win32"?t=>String(t):t=>String(t).replaceAll(/\\/g,"/");var qs=class extends ir{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,u,p){switch(super({}),this.pause(),this.extended=u,this.globalExtended=p,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=Vs(t.path),this.mode=t.mode,this.mode&&(this.mode=this.mode&4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?Vs(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,u&&this.#i(u),p&&this.#i(p,!0)}write(t){let u=t.length;if(u>this.blockRemain)throw new Error("writing more to entry than is appropriate");let p=this.remain,m=this.blockRemain;return this.remain=Math.max(0,p-u),this.blockRemain=Math.max(0,m-u),this.ignore?!0:p>=u?super.write(t):super.write(t.subarray(0,p))}#i(t,u=!1){t.path&&(t.path=Vs(t.path)),t.linkpath&&(t.linkpath=Vs(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,p])=>!(p==null||t==="path"&&u)))))}};var Dt=(t,u,p,m={})=>{t.file&&(m.file=t.file),t.cwd&&(m.cwd=t.cwd),m.code=p instanceof Error&&p.code||u,m.tarCode=u,!t.strict&&m.recoverable!==!1?(p instanceof Error&&(m=Object.assign(p,m),p=p.message),t.emit("warn",u,p,m)):p instanceof Error?t.emit("error",Object.assign(p,m)):t.emit("error",Object.assign(new Error(`${u}: ${p}`),m))};var Ks=1024*1024,Ys=Buffer.from([31,139]),Zs=Buffer.from([40,181,47,253]),Js=Math.max(Ys.length,Zs.length),Xs=Symbol("state"),ei=Symbol("writeEntry"),ti=Symbol("readEntry"),ri=Symbol("nextEntry"),si=Symbol("processEntry"),ii=Symbol("extendedHeader"),ni=Symbol("globalExtendedHeader"),oi=Symbol("meta"),ai=Symbol("emitMeta"),ci=Symbol("buffer"),li=Symbol("queue"),ui=Symbol("ended"),hi=Symbol("emittedEnd"),di=Symbol("emit"),fi=Symbol("unzip"),pi=Symbol("consumeChunk"),mi=Symbol("consumeChunkSub"),gi=Symbol("consumeBody"),yi=Symbol("consumeMeta"),vi=Symbol("consumeHeader"),_i=Symbol("consuming"),bi=Symbol("bufferConcat"),wi=Symbol("maybeEnd"),Si=Symbol("writing"),$i=Symbol("aborted"),Pi=Symbol("onDone"),Ri=Symbol("sawValidEntry"),xi=Symbol("sawNullBlock"),Oi=Symbol("sawEOF"),Ai=Symbol("closeStream"),ki=1e3,Ti=Symbol("compressedBytesRead"),Ci=Symbol("decompressedBytesRead"),Ii=Symbol("checkDecompressionRatio"),Cn=()=>!0,Ni=class extends nt.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=!0;readable=!1;[li]=[];[ci];[ti];[ei];[Xs]="begin";[oi]="";[ii];[ni];[ui]=!1;[fi];[$i]=!1;[Ri];[xi]=!1;[Oi]=!1;[Si]=!1;[_i]=!1;[hi]=!1;[Ti]=0;[Ci]=0;constructor(t={}){super(),this.file=t.file||"",this.on(Pi,(()=>{(this[Xs]==="begin"||this[Ri]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")})),t.ondone?this.on(Pi,t.ondone):this.on(Pi,(()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")})),this.strict=!!t.strict,this.maxDecompressionRatio=typeof t.maxDecompressionRatio=="number"?t.maxDecompressionRatio:ki,this.maxMetaEntrySize=t.maxMetaEntrySize||Ks,this.filter=typeof t.filter=="function"?t.filter:Cn;let u=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:u?void 0:!1;let p=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:p?!0:void 0,this.on("end",(()=>this[Ai]())),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,u,p={}){Dt(this,t,u,p)}[vi](t,u){this[Ri]===void 0&&(this[Ri]=!1);let p;try{p=new Ns(t,u,this[ii],this[ni])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(p.nullBlock)this[xi]?(this[Oi]=!0,this[Xs]==="begin"&&(this[Xs]="header"),this[di]("eof")):(this[xi]=!0,this[di]("nullBlock"));else if(this[xi]=!1,!p.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:p});else if(!p.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:p});else{let t=p.type;if(/^(Symbolic)?Link$/.test(t)&&!p.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:p});else if(!/^(Symbolic)?Link$/.test(t)&&!/^(Global)?ExtendedHeader$/.test(t)&&p.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:p});else{let t=this[ei]=new qs(p,this[ii],this[ni]);if(!this[Ri])if(t.remain){let o=()=>{t.invalid||(this[Ri]=!0)};t.on("end",o)}else this[Ri]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[di]("ignoredEntry",t),this[Xs]="ignore",t.resume()):t.size>0&&(this[oi]="",t.on("data",(t=>this[oi]+=t)),this[Xs]="meta"):(this[ii]=void 0,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[di]("ignoredEntry",t),this[Xs]=t.remain?"ignore":"header",t.resume()):(t.remain?this[Xs]="body":(this[Xs]="header",t.end()),this[ti]?this[li].push(t):(this[li].push(t),this[ri]())))}}}[Ai](){queueMicrotask((()=>this.emit("close")))}[si](t){let u=!0;if(!t)this[ti]=void 0,u=!1;else if(Array.isArray(t)){let[u,...p]=t;this.emit(u,...p)}else this[ti]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",(()=>this[ri]())),u=!1);return u}[ri](){do{}while(this[si](this[li].shift()));if(this[li].length===0){let t=this[ti];!t||t.flowing||t.size===t.remain?this[Si]||this.emit("drain"):t.once("drain",(()=>this.emit("drain")))}}[gi](t,u){let p=this[ei];if(!p)throw new Error("attempt to consume body without entry??");let m=p.blockRemain??0,g=m>=t.length&&u===0?t:t.subarray(u,u+m);return p.write(g),p.blockRemain||(this[Xs]="header",this[ei]=void 0,p.end()),g.length}[yi](t,u){let p=this[ei],m=this[gi](t,u);return!this[ei]&&p&&this[ai](p),m}[di](t,u,p){this[li].length===0&&!this[ti]?this.emit(t,u,p):this[li].push([t,u,p])}[ai](t){switch(this[di]("meta",this[oi]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[ii]=Ls.parse(this[oi],this[ii],!1);break;case"GlobalExtendedHeader":this[ni]=Ls.parse(this[oi],this[ni],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[ii]??Object.create(null);this[ii]=t,t.path=this[oi].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[ii]||Object.create(null);this[ii]=t,t.linkpath=this[oi].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){if(!this[$i]){if(this[fi]){let t=this[fi];t.write=()=>!0,t.end=()=>t,t.emit=()=>!1,t.destroy?.()}this[$i]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}}[Ii](t){this[Ci]+=t.length;let u=this[Ci]/this[Ti];return u>this.maxDecompressionRatio?(this.abort(new Error(`max decompression ratio exceeded: ${u.toFixed(2)} > ${this.maxDecompressionRatio}`)),!1):!0}write(t,u,p){if(typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof u=="string"?u:"utf8")),this[$i])return p?.(),!1;if((this[fi]===void 0||this.brotli===void 0&&this[fi]===!1)&&t){if(this[ci]&&(t=Buffer.concat([this[ci],t]),this[ci]=void 0),t.length<Js)return this[ci]=t,p?.(),!0;for(let u=0;this[fi]===void 0&&u<Ys.length;u++)t[u]!==Ys[u]&&(this[fi]=!1);let u=!1;if(this[fi]===!1&&this.zstd!==!1){u=!0;for(let p=0;p<Zs.length;p++)if(t[p]!==Zs[p]){u=!1;break}}let m=this.brotli===void 0&&!u;if(this[fi]===!1&&m)if(t.length<512)if(this[ui])this.brotli=!0;else return this[ci]=t,p?.(),!0;else try{new Ns(t.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[fi]===void 0||this[fi]===!1&&(this.brotli||u)){let m=this[ui];this[ui]=!1,this[fi]=this[fi]===void 0?new _s({}):u?new Os({}):new Ps({}),this[fi].on("data",(t=>{this[Ii](t)&&this[pi](t)})),this[fi].on("error",(t=>{this[$i]||this.abort(t)})),this[fi].on("end",(()=>{this[ui]=!0,this[pi]()})),this[Si]=!0,this[Ti]+=t.length;let g=!!this[fi][m?"end":"write"](t);return this[Si]=!1,p?.(),g}}this[Si]=!0,this[fi]?(this[Ti]+=t.length,this[fi].write(t)):this[pi](t),this[Si]=!1;let m=this[li].length>0?!1:this[ti]?this[ti].flowing:!0;return!m&&this[li].length===0&&this[ti]?.once("drain",(()=>this.emit("drain"))),p?.(),m}[bi](t){t&&!this[$i]&&(this[ci]=this[ci]?Buffer.concat([this[ci],t]):t)}[wi](){if(this[ui]&&!this[hi]&&!this[$i]&&!this[_i]){this[hi]=!0;let t=this[ei];if(t?.blockRemain){let u=this[ci]?this[ci].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${u} available)`,{entry:t}),this[ci]&&t.write(this[ci]),t.end()}this[di](Pi)}}[pi](t){if(this[_i]&&t)this[bi](t);else if(!t&&!this[ci])this[wi]();else if(t){if(this[_i]=!0,this[ci]){this[bi](t);let u=this[ci];this[ci]=void 0,this[mi](u)}else this[mi](t);for(;this[ci]&&this[ci]?.length>=512&&!this[$i]&&!this[Oi];){let t=this[ci];this[ci]=void 0,this[mi](t)}this[_i]=!1}(!this[ci]||this[ui])&&this[wi]()}[mi](t){let u=0,p=t.length;for(;u+512<=p&&!this[$i]&&!this[Oi];)switch(this[Xs]){case"begin":case"header":this[vi](t,u),u+=512;break;case"ignore":case"body":u+=this[gi](t,u);break;case"meta":u+=this[yi](t,u);break;default:throw new Error("invalid state: "+this[Xs])}u<p&&(this[ci]=this[ci]?Buffer.concat([t.subarray(u),this[ci]]):t.subarray(u))}end(t,u,p){return typeof t=="function"&&(p=t,u=void 0,t=void 0),typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,u)),p&&this.once("finish",p),this[$i]||(this[fi]?(t&&(this[Ti]+=t.length,this[fi].write(t)),this[fi].end()):(this[ui]=!0,(this.brotli===void 0||this.zstd===void 0)&&(t=t||Buffer.alloc(0)),t&&this.write(t),this[wi]())),this}};var mt=t=>{let u=t.length-1,p=-1;for(;u>-1&&t.charAt(u)==="/";)p=u,u--;return p===-1?t:t.slice(0,p)};var vn=t=>{let u=t.onReadEntry;t.onReadEntry=u?t=>{u(t),t.resume()}:t=>t.resume()},Qi=(t,u)=>{let p=new Map(u.map((t=>[mt(t),!0]))),m=t.filter,g=100,n=(t,u="",m=0)=>{if(m>=g)return p.set(t,!1),!1;let v=u||(0,Ve.parse)(t).root||".",b;if(t===v)b=!1;else{let u=p.get(t);b=u!==void 0?u:n((0,Ve.dirname)(t),v,m+1)}return p.set(t,b),b};t.filter=m?(t,u)=>m(t,u)&&n(mt(t)):t=>n(mt(t))},Mn=t=>{let u=new Ni(t),p=t.file,m;try{m=k.openSync(p,"r");let g=k.fstatSync(m),v=t.maxReadSize||16*1024*1024;if(g.size<v){let t=Buffer.allocUnsafe(g.size),p=k.readSync(m,t,0,g.size,0);u.end(p===t.byteLength?t:t.subarray(0,p))}else{let t=0,p=Buffer.allocUnsafe(v);for(;t<g.size;){let g=k.readSync(m,p,0,v,t);if(g===0)break;t+=g,u.write(p.subarray(0,g))}u.end()}}finally{if(typeof m=="number")try{k.closeSync(m)}catch{}}},Bn=(t,u)=>{let p=new Ni(t),m=t.maxReadSize||16*1024*1024,g=t.file;return new Promise(((t,u)=>{p.on("error",u),p.on("end",t),k.stat(g,((t,v)=>{if(t)u(t);else{let t=new Qr(g,{readSize:m,size:v.size});t.on("error",u),t.pipe(p)}}))}))},Di=K(Mn,Bn,(t=>new Ni(t)),(t=>new Ni(t)),((t,u)=>{u?.length&&Qi(t,u),t.noResume||vn(t)}));var Ji=(t,u,p)=>(t&=4095,p&&(t=(t|384)&-19),u&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);var{isAbsolute:ji,parse:Li}=T.win32,ce=t=>{let u="",p=Li(t);for(;ji(t)||p.root;){let m=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":p.root;t=t.slice(m.length),u+=m,p=Li(t)}return[u,t]};var Mi=["|","<",">","?",":"],Fi=Mi.map((t=>String.fromCodePoint(61440+Number(t.codePointAt(0))))),Ui=new Map(Mi.map(((t,u)=>[t,Fi[u]]))),Bi=new Map(Fi.map(((t,u)=>[t,Mi[u]]))),ts=t=>Mi.reduce(((t,u)=>t.split(u).join(Ui.get(u))),t),Qs=t=>Fi.reduce(((t,u)=>t.split(u).join(Bi.get(u))),t);var rr=(t,u)=>u?(t=Vs(t).replace(/^\.(\/|$)/,""),mt(u)+"/"+t):Vs(t),Hi=16*1024*1024,zi=Symbol("process"),Vi=Symbol("file"),qi=Symbol("directory"),Ki=Symbol("symlink"),Yi=Symbol("hardlink"),Zi=Symbol("header"),Xi=Symbol("read"),en=Symbol("lstat"),rn=Symbol("onlstat"),sn=Symbol("onread"),on=Symbol("onreadlink"),fn=Symbol("openfile"),_n=Symbol("onopenfile"),bn=Symbol("close"),Sn=Symbol("mode"),Pn=Symbol("awaitDrain"),An=Symbol("ondrain"),kn=Symbol("prefix"),In=class extends ir{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#i=!1;constructor(t,u={}){let p=se(u);super(),this.path=Vs(t),this.portable=!!p.portable,this.maxReadSize=p.maxReadSize||Hi,this.linkCache=p.linkCache||new Map,this.statCache=p.statCache||new Map,this.preservePaths=!!p.preservePaths,this.cwd=Vs(p.cwd||process.cwd()),this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.mtime=p.mtime,this.prefix=p.prefix?Vs(p.prefix):void 0,this.onWriteEntry=p.onWriteEntry,typeof p.onwarn=="function"&&this.on("warn",p.onwarn);let m=!1;if(!this.preservePaths){let[t,u]=ce(this.path);t&&typeof u=="string"&&(this.path=u,m=t)}this.win32=!!p.win32||process.platform==="win32",this.win32&&(this.path=Qs(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=Vs(p.absolute||Ve.resolve(this.cwd,t)),this.path===""&&(this.path="./"),m&&this.warn("TAR_ENTRY_INFO",`stripping ${m} from absolute path`,{entry:this,path:m+this.path});let g=this.statCache.get(this.absolute);g?this[rn](g):this[en]()}warn(t,u,p={}){return Dt(this,t,u,p)}emit(t,...u){return t==="error"&&(this.#i=!0),super.emit(t,...u)}[en](){ze.lstat(this.absolute,((t,u)=>{if(t)return this.emit("error",t);this[rn](u)}))}[rn](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=Gn(t),this.emit("stat",t),this[zi]()}[zi](){switch(this.type){case"File":return this[Vi]();case"Directory":return this[qi]();case"SymbolicLink":return this[Ki]();default:return this.end()}}[Sn](t){return Ji(t,this.type==="Directory",this.portable)}[kn](t){return rr(t,this.prefix)}[Zi](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new Ns({path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,mode:this[Sn](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Ls({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[qi](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Zi](),this.end()}[Ki](){ze.readlink(this.absolute,((t,u)=>{if(t)return this.emit("error",t);this[on](u)}))}[on](t){this.linkpath=Vs(t),this[Zi](),this.end()}[Yi](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=Vs(Ve.relative(this.cwd,t)),this.stat.size=0,this[Zi](),this.end()}[Vi](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,u=this.linkCache.get(t);if(u?.indexOf(this.cwd)===0)return this[Yi](u);this.linkCache.set(t,this.absolute)}if(this[Zi](),this.stat.size===0)return this.end();this[fn]()}[fn](){ze.open(this.absolute,"r",((t,u)=>{if(t)return this.emit("error",t);this[_n](u)}))}[_n](t){if(this.fd=t,this.#i)return this[bn]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let u=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(u),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Xi]()}[Xi](){let{fd:t,buf:u,offset:p,length:m,pos:g}=this;if(t===void 0||u===void 0)throw new Error("cannot read file without first opening");ze.read(t,u,p,m,g,((t,u)=>{if(t)return this[bn]((()=>this.emit("error",t)));this[sn](u)}))}[bn](t=()=>{}){this.fd!==void 0&&ze.close(this.fd,t)}[sn](t){if(t<=0&&this.remain>0){let t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[bn]((()=>this.emit("error",t)))}if(t>this.remain){let t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[bn]((()=>this.emit("error",t)))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let u=t;u<this.length&&t<this.blockRemain;u++)this.buf[u+this.offset]=0,t++,this.remain++;let u=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(u)?this[An]():this[Pn]((()=>this[An]()))}[Pn](t){this.once("drain",t)}write(t,u,p){if(typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof u=="string"?u:"utf8")),this.blockRemain<t.length){let t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,p)}[An](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[bn]((t=>t?this.emit("error",t):this.end()));if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Xi]()}},Nn=class extends In{sync=!0;[en](){this[rn](ze.lstatSync(this.absolute))}[Ki](){this[on](ze.readlinkSync(this.absolute))}[fn](){this[_n](ze.openSync(this.absolute,"r"))}[Xi](){let t=!0;try{let{fd:u,buf:p,offset:m,length:g,pos:v}=this;if(u===void 0||p===void 0)throw new Error("fd and buf must be set in READ method");let b=ze.readSync(u,p,m,g,v);this[sn](b),t=!1}finally{if(t)try{this[bn]((()=>{}))}catch{}}}[Pn](t){t()}[bn](t=()=>{}){this.fd!==void 0&&ze.closeSync(this.fd),t()}},Dn=class extends ir{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,u,p={}){return Dt(this,t,u,p)}constructor(t,u={}){let p=se(u);super(),this.preservePaths=!!p.preservePaths,this.portable=!!p.portable,this.strict=!!p.strict,this.noPax=!!p.noPax,this.noMtime=!!p.noMtime,this.onWriteEntry=p.onWriteEntry,this.readEntry=t;let{type:m}=t;if(m==="Unsupported")throw new Error("writing entry that should be ignored");this.type=m,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=p.prefix,this.path=Vs(t.path),this.mode=t.mode!==void 0?this[Sn](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:p.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=t.linkpath!==void 0?Vs(t.linkpath):void 0,typeof p.onwarn=="function"&&this.on("warn",p.onwarn);let g=!1;if(!this.preservePaths){let[t,u]=ce(this.path);t&&typeof u=="string"&&(this.path=u,g=t)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new Ns({path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),g&&this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute path`,{entry:this,path:g+this.path}),this.header.encode()&&!this.noPax&&super.write(new Ls({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[kn](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[kn](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let v=this.header?.block;if(!v)throw new Error("failed to encode header");super.write(v),t.pipe(this)}[kn](t){return rr(t,this.prefix)}[Sn](t){return Ji(t,this.type==="Directory",this.portable)}write(t,u,p){typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof u=="string"?u:"utf8"));let m=t.length;if(m>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=m,super.write(t,p)}end(t,u,p){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof t=="function"&&(p=t,u=void 0,t=void 0),typeof u=="function"&&(p=u,u=void 0),typeof t=="string"&&(t=Buffer.from(t,u??"utf8")),p&&this.once("finish",p),t?super.end(t,p):super.end(p),this}},Gn=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var jn=class s{tail;head;length=0;static create(t=[]){return new s(t)}constructor(t=[]){for(let u of t)this.push(u)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");let u=t.next,p=t.prev;return u&&(u.prev=p),p&&(p.next=u),t===this.head&&(this.head=u),t===this.tail&&(this.tail=p),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,u}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let u=this.head;t.list=this,t.next=u,u&&(u.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let u=this.tail;t.list=this,t.prev=u,u&&(u.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let u=0,p=t.length;u<p;u++)Yn(this,t[u]);return this.length}unshift(...t){for(var u=0,p=t.length;u<p;u++)Kn(this,t[u]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,u=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,u.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,u=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,u.list=void 0,this.length--,t}forEach(t,u){u=u||this;for(let p=this.head,m=0;p;m++)t.call(u,p.value,m,this),p=p.next}forEachReverse(t,u){u=u||this;for(let p=this.tail,m=this.length-1;p;m--)t.call(u,p.value,m,this),p=p.prev}get(t){let u=0,p=this.head;for(;p&&u<t;u++)p=p.next;if(u===t&&p)return p.value}getReverse(t){let u=0,p=this.tail;for(;p&&u<t;u++)p=p.prev;if(u===t&&p)return p.value}map(t,u){u=u||this;let p=new s;for(let m=this.head;m;)p.push(t.call(u,m.value,this)),m=m.next;return p}mapReverse(t,u){u=u||this;var p=new s;for(let m=this.tail;m;)p.push(t.call(u,m.value,this)),m=m.prev;return p}reduce(t,u){let p,m=this.head;if(arguments.length>1)p=u;else if(this.head)m=this.head.next,p=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var g=0;m;g++)p=t(p,m.value,g),m=m.next;return p}reduceReverse(t,u){let p,m=this.tail;if(arguments.length>1)p=u;else if(this.tail)m=this.tail.prev,p=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let u=this.length-1;m;u--)p=t(p,m.value,u),m=m.prev;return p}toArray(){let t=new Array(this.length);for(let u=0,p=this.head;p;u++)t[u]=p.value,p=p.next;return t}toArrayReverse(){let t=new Array(this.length);for(let u=0,p=this.tail;p;u++)t[u]=p.value,p=p.prev;return t}slice(t=0,u=this.length){u<0&&(u+=this.length),t<0&&(t+=this.length);let p=new s;if(u<t||u<0)return p;t<0&&(t=0),u>this.length&&(u=this.length);let m=this.head,g=0;for(g=0;m&&g<t;g++)m=m.next;for(;m&&g<u;g++,m=m.next)p.push(m.value);return p}sliceReverse(t=0,u=this.length){u<0&&(u+=this.length),t<0&&(t+=this.length);let p=new s;if(u<t||u<0)return p;t<0&&(t=0),u>this.length&&(u=this.length);let m=this.length,g=this.tail;for(;g&&m>u;m--)g=g.prev;for(;g&&m>t;m--,g=g.prev)p.push(g.value);return p}splice(t,u=0,...p){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let m=this.head;for(let u=0;m&&u<t;u++)m=m.next;let g=[];for(let t=0;m&&t<u;t++)g.push(m.value),m=this.removeNode(m);m?m!==this.tail&&(m=m.prev):m=this.tail;for(let t of p)m=Zn(this,m,t);return g}reverse(){let t=this.head,u=this.tail;for(let u=t;u;u=u.prev){let t=u.prev;u.prev=u.next,u.next=t}return this.head=u,this.tail=t,this}};function Zn(t,u,p){let m=u,g=u?u.next:t.head,v=new Ln(p,m,g,t);return v.next===void 0&&(t.tail=v),v.prev===void 0&&(t.head=v),t.length++,v}function Yn(t,u){t.tail=new Ln(u,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function Kn(t,u){t.head=new Ln(u,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var Ln=class{list;next;prev;value;constructor(t,u,p,m){this.list=m,this.value=t,u?(u.next=this,this.prev=u):this.prev=void 0,p?(p.prev=this,this.next=p):this.next=void 0}};var Fn=class{path;absolute;entry;stat;readdir;pending=!1;pendingLink=!1;ignore=!1;piped=!1;constructor(t,u){this.path=t||"./",this.absolute=u}},Un=Buffer.alloc(1024),Hn=Symbol("onStat"),zn=Symbol("ended"),Wn=Symbol("queue"),Jn=Symbol("pendingLinks"),Qn=Symbol("current"),eo=Symbol("process"),to=Symbol("processing"),ro=Symbol("processJob"),ao=Symbol("jobs"),co=Symbol("jobDone"),uo=Symbol("addFSEntry"),ho=Symbol("addTarEntry"),fo=Symbol("stat"),vo=Symbol("readdir"),So=Symbol("onreaddir"),$o=Symbol("pipe"),Po=Symbol("entry"),xo=Symbol("entryOpt"),Oo=Symbol("writeEntryClass"),Ao=Symbol("write"),ko=Symbol("ondrain"),Co=class extends ir{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Oo];onWriteEntry;[Wn];[Jn]=new Map;[ao]=0;[to]=!1;[zn]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=Vs(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[Oo]=In,typeof t.onwarn=="function"&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli||t.zstd){if((t.gzip?1:0)+(t.brotli?1:0)+(t.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&(typeof t.gzip!="object"&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new ys(t.gzip)),t.brotli&&(typeof t.brotli!="object"&&(t.brotli={}),this.zip=new $s(t.brotli)),t.zstd&&(typeof t.zstd!="object"&&(t.zstd={}),this.zip=new xs(t.zstd)),!this.zip)throw new Error("impossible");let u=this.zip;u.on("data",(t=>super.write(t))),u.on("end",(()=>super.end())),u.on("drain",(()=>this[ko]())),this.on("resume",(()=>u.resume()))}else this.on("drain",this[ko]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter=typeof t.filter=="function"?t.filter:()=>!0,this[Wn]=new jn,this[ao]=0,this.jobs=Number(t.jobs)||4,this[to]=!1,this[zn]=!1}[Ao](t){return super.write(t)}add(t){return this.write(t),this}end(t,u,p){return typeof t=="function"&&(p=t,t=void 0),typeof u=="function"&&(p=u,u=void 0),t&&this.add(t),this[zn]=!0,this[eo](),p&&p(),this}write(t){if(this[zn])throw new Error("write after end");return typeof t=="string"?this[uo](t):this[ho](t),this.flowing}[ho](t){let u=Vs(Ve.resolve(this.cwd,t.path));if(!this.filter(t.path,t))t.resume();else{let p=new Fn(t.path,u);p.entry=new Dn(t,this[xo](p)),p.entry.on("end",(()=>this[co](p))),this[ao]+=1,this[Wn].push(p)}this[eo]()}[uo](t){let u=Vs(Ve.resolve(this.cwd,t));this[Wn].push(new Fn(t,u)),this[eo]()}[fo](t){t.pending=!0,this[ao]+=1;let u=this.follow?"stat":"lstat";ze[u](t.absolute,((u,p)=>{t.pending=!1,this[ao]-=1,u?this.emit("error",u):this[Hn](t,p)}))}[Hn](t,u){if(this.statCache.set(t.absolute,u),t.stat=u,!this.filter(t.path,u))t.ignore=!0;else if(u.isFile()&&u.nlink>1&&!this.linkCache.get(`${u.dev}:${u.ino}`)&&!this.sync)if(t===this[Qn])this[ro](t);else{let p=`${u.dev}:${u.ino}`,m=this[Jn].get(p);m?m.push(t):this[Jn].set(p,[t]),t.pendingLink=!0,t.pending=!0}this[eo]()}[vo](t){t.pending=!0,this[ao]+=1,ze.readdir(t.absolute,((u,p)=>{if(t.pending=!1,this[ao]-=1,u)return this.emit("error",u);this[So](t,p)}))}[So](t,u){this.readdirCache.set(t.absolute,u),t.readdir=u,this[eo]()}[eo](){if(!this[to]){this[to]=!0;for(let t=this[Wn].head;t&&this[ao]<this.jobs;t=t.next)if(this[ro](t.value),t.value.ignore){let u=t.next;this[Wn].removeNode(t),t.next=u}this[to]=!1,this[zn]&&this[Wn].length===0&&this[ao]===0&&(this.zip?this.zip.end(Un):(super.write(Un),super.end()))}}get[Qn](){return this[Wn]&&this[Wn].head&&this[Wn].head.value}[co](t){this[Wn].shift(),this[ao]-=1;let{stat:u}=t;if(u&&u.isFile()&&u.nlink>1){let t=`${u.dev}:${u.ino}`,p=this[Jn].get(t);if(p){this[Jn].delete(t);for(let t of p)t.pending=!1,this[ro](t)}}this[eo]()}[ro](t){if(t.pending&&t.pendingLink&&t===this[Qn]&&(t.pending=!1,t.pendingLink=!1),!t.pending){if(t.entry){t===this[Qn]&&!t.piped&&this[$o](t);return}if(!t.stat){let u=this.statCache.get(t.absolute);u?this[Hn](t,u):this[fo](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let u=this.readdirCache.get(t.absolute);if(u?this[So](t,u):this[vo](t),!t.readdir)return}if(t.entry=this[Po](t),!t.entry){t.ignore=!0;return}t===this[Qn]&&!t.piped&&this[$o](t)}}}[xo](t){return{onwarn:(t,u,p)=>this.warn(t,u,p),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Po](t){this[ao]+=1;try{return new this[Oo](t.path,this[xo](t)).on("end",(()=>this[co](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[ko](){this[Qn]&&this[Qn].entry&&this[Qn].entry.resume()}[$o](t){t.piped=!0,t.readdir&&t.readdir.forEach((u=>{let p=t.path,m=p==="./"?"":p.replace(/\/*$/,"/");this[uo](m+u)}));let u=t.entry,p=this.zip;if(!u)throw new Error("cannot pipe without source");p?u.on("data",(t=>{p.write(t)||u.pause()})):u.on("data",(t=>{super.write(t)||u.pause()}))}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,u,p={}){Dt(this,t,u,p)}},Io=class extends Co{sync=!0;constructor(t){super(t),this[Oo]=Nn}pause(){}resume(){}[fo](t){let u=this.follow?"statSync":"lstatSync";this[Hn](t,ze[u](t.absolute))}[vo](t){this[So](t,ze.readdirSync(t.absolute))}[$o](t){let u=t.entry,p=this.zip;if(t.readdir&&t.readdir.forEach((u=>{let p=t.path,m=p==="./"?"":p.replace(/\/*$/,"/");this[uo](m+u)})),!u)throw new Error("Cannot pipe without source");p?u.on("data",(t=>{p.write(t)})):u.on("data",(t=>{super[Ao](t)}))}};var Vn=(t,u)=>{let p=new Io(t),m=new ss(t.file,{mode:t.mode||438});p.pipe(m),fr(p,u)},$n=(t,u)=>{let p=new Co(t),m=new rs(t.file,{mode:t.mode||438});p.pipe(m);let g=new Promise(((t,u)=>{m.on("error",u),m.on("close",t),p.on("error",u)}));return dr(p,u).catch((t=>p.emit("error",t))),g},fr=(t,u)=>{u.forEach((u=>{u.charAt(0)==="@"?Di({file:T.resolve(t.cwd,u.slice(1)),sync:!0,noResume:!0,onReadEntry:u=>t.add(u)}):t.add(u)})),t.end()},dr=async(t,u)=>{for(let p of u)p.charAt(0)==="@"?await Di({file:T.resolve(String(t.cwd),p.slice(1)),noResume:!0,onReadEntry:u=>{t.add(u)}}):t.add(p);t.end()},Xn=(t,u)=>{let p=new Io(t);return fr(p,u),p},qn=(t,u)=>{let p=new Co(t);return dr(p,u).catch((t=>p.emit("error",t))),p},No=K(Vn,$n,Xn,qn,((t,u)=>{if(!u?.length)throw new TypeError("no paths specified to add to archive")}));var Do=process.env.__FAKE_PLATFORM__||process.platform,jo=Do==="win32",{O_CREAT:Lo,O_NOFOLLOW:Mo,O_TRUNC:Fo,O_WRONLY:Uo}=ze.constants,Bo=Number(process.env.__FAKE_FS_O_FILENAME__)||ze.constants.UV_FS_O_FILEMAP||0,Ho=jo&&!!Bo,zo=512*1024,Vo=Bo|Fo|Lo|Uo,Go=!jo&&typeof Mo=="number"?Mo|Fo|Lo|Uo:null,qo=Go!==null?()=>Go:Ho?t=>t<zo?Vo:"w":()=>"w";var ps=(t,u,p)=>{try{return k.lchownSync(t,u,p)}catch(t){if(t?.code!=="ENOENT")throw t}},Ei=(t,u,p,m)=>{k.lchown(t,u,p,(t=>{m(t&&t?.code!=="ENOENT"?t:null)}))},io=(t,u,p,m,g)=>{if(u.isDirectory())Es(T.resolve(t,u.name),p,m,(v=>{if(v)return g(v);let b=T.resolve(t,u.name);Ei(b,p,m,g)}));else{let v=T.resolve(t,u.name);Ei(v,p,m,g)}},Es=(t,u,p,m)=>{k.readdir(t,{withFileTypes:!0},((g,v)=>{if(g){if(g.code==="ENOENT")return m();if(g.code!=="ENOTDIR"&&g.code!=="ENOTSUP")return m(g)}if(g||!v.length)return Ei(t,u,p,m);let b=v.length,w=null,a=g=>{if(!w){if(g)return m(w=g);if(--b===0)return Ei(t,u,p,m)}};for(let m of v)io(t,m,u,p,a)}))},so=(t,u,p,m)=>{u.isDirectory()&&ws(T.resolve(t,u.name),p,m),ps(T.resolve(t,u.name),p,m)},ws=(t,u,p)=>{let m;try{m=k.readdirSync(t,{withFileTypes:!0})}catch(m){let g=m;if(g?.code==="ENOENT")return;if(g?.code==="ENOTDIR"||g?.code==="ENOTSUP")return ps(t,u,p);throw g}for(let g of m)so(t,g,u,p);return ps(t,u,p)};var Wo=class extends Error{path;code;syscall="chdir";constructor(t,u){super(`${u}: Cannot cd into '${t}'`),this.path=t,this.code=u}get name(){return"CwdError"}};var Ko=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,u){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=u}get name(){return"SymlinkError"}};var no=(t,u)=>{k.stat(t,((p,m)=>{(p||!m.isDirectory())&&(p=new Wo(t,p?.code||"ENOTDIR")),u(p)}))},gr=(t,u,p)=>{t=Vs(t);let m=u.umask??18,g=u.mode|448,v=(g&m)!==0,b=u.uid,w=u.gid,E=typeof b=="number"&&typeof w=="number"&&(b!==u.processUid||w!==u.processGid),S=u.preserve,$=u.unlink,P=Vs(u.cwd),y=(u,m)=>{u?p(u):m&&E?Es(m,b,w,(t=>y(t))):v?k.chmod(t,g,p):p()};if(t===P)return no(t,y);if(S)return yt.mkdir(t,{mode:g,recursive:!0}).then((t=>y(null,t??void 0)),y);let R=Vs(T.relative(P,t)).split("/");Ss(P,R,g,$,P,void 0,y)},Ss=(t,u,p,m,g,v,b)=>{if(u.length===0)return b(null,v);let w=u.shift(),E=Vs(T.resolve(t+"/"+w));k.mkdir(E,p,br(E,u,p,m,g,v,b))},br=(t,u,p,m,g,v,b)=>w=>{w?k.lstat(t,((E,S)=>{if(E)E.path=E.path&&Vs(E.path),b(E);else if(S.isDirectory())Ss(t,u,p,m,g,v,b);else if(m)k.unlink(t,(w=>{if(w)return b(w);k.mkdir(t,p,br(t,u,p,m,g,v,b))}));else{if(S.isSymbolicLink())return b(new Ko(t,t+"/"+u.join("/")));b(w)}})):(v=v||t,Ss(t,u,p,m,g,v,b))},oo=t=>{let u=!1,p;try{u=k.statSync(t).isDirectory()}catch(t){p=t?.code}finally{if(!u)throw new Wo(t,p??"ENOTDIR")}},_r=(t,u)=>{t=Vs(t);let p=u.umask??18,m=u.mode|448,g=(m&p)!==0,v=u.uid,b=u.gid,w=typeof v=="number"&&typeof b=="number"&&(v!==u.processUid||b!==u.processGid),E=u.preserve,S=u.unlink,$=Vs(u.cwd),d=u=>{u&&w&&ws(u,v,b),g&&k.chmodSync(t,m)};if(t===$)return oo($),d();if(E)return d(k.mkdirSync(t,{mode:m,recursive:!0})??void 0);let P=Vs(T.relative($,t)).split("/"),R;for(let t=P.shift(),u=$;t&&(u+="/"+t);t=P.shift()){u=Vs(T.resolve(u));try{k.mkdirSync(u,m),R=R||u}catch{let t=k.lstatSync(u);if(t.isDirectory())continue;if(S){k.unlinkSync(u),k.mkdirSync(u,m),R=R||u;continue}else if(t.isSymbolicLink())return new Ko(u,u+"/"+P.join("/"))}}return d(R)};var Yo=Object.create(null),Zo=1e4,Jo=new Set,Tr=t=>{Jo.has(t)?Jo.delete(t):Yo[t]=t.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Jo.add(t);let u=Yo[t],p=Jo.size-Zo;if(p>Zo/10){for(let t of Jo)if(Jo.delete(t),delete Yo[t],--p<=0)break}return u};var Xo=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Qo=Xo==="win32",lo=t=>t.split("/").slice(0,-1).reduce(((t,u)=>{let p=t.at(-1);return p!==void 0&&(u=(0,T.join)(p,u)),t.push(u||"/"),t}),[]),ea=class{#i=new Map;#n=new Map;#o=new Set;reserve(t,u){t=Qo?["win32 parallelization disabled"]:t.map((t=>mt((0,T.join)(Tr(t)))));let p=new Set(t.map((t=>lo(t))).reduce(((t,u)=>t.concat(u))));this.#n.set(u,{dirs:p,paths:t});for(let p of t){let t=this.#i.get(p);t?t.push(u):this.#i.set(p,[u])}for(let t of p){let p=this.#i.get(t);if(!p)this.#i.set(t,[new Set([u])]);else{let t=p.at(-1);t instanceof Set?t.add(u):p.push(new Set([u]))}}return this.#c(u)}#a(t){let u=this.#n.get(t);if(!u)throw new Error("function does not have any path reservations");return{paths:u.paths.map((t=>this.#i.get(t))),dirs:[...u.dirs].map((t=>this.#i.get(t)))}}check(t){let{paths:u,dirs:p}=this.#a(t);return u.every((u=>u&&u[0]===t))&&p.every((u=>u&&u[0]instanceof Set&&u[0].has(t)))}#c(t){return this.#o.has(t)||!this.check(t)?!1:(this.#o.add(t),t((()=>this.#l(t))),!0)}#l(t){if(!this.#o.has(t))return!1;let u=this.#n.get(t);if(!u)throw new Error("invalid reservation");let{paths:p,dirs:m}=u,g=new Set;for(let u of p){let p=this.#i.get(u);if(!p||p?.[0]!==t)continue;let m=p[1];if(!m){this.#i.delete(u);continue}if(p.shift(),typeof m=="function")g.add(m);else for(let t of m)g.add(t)}for(let u of m){let p=this.#i.get(u),m=p?.[0];if(!(!p||!(m instanceof Set)))if(m.size===1&&p.length===1){this.#i.delete(u);continue}else if(m.size===1){p.shift();let t=p[0];typeof t=="function"&&g.add(t)}else m.delete(t)}return this.#o.delete(t),g.forEach((t=>this.#c(t))),!0}};var Lr=()=>process.umask();var ta=Symbol("onEntry"),ra=Symbol("checkFs"),sa=Symbol("checkFs2"),ia=Symbol("isReusable"),na=Symbol("makeFs"),oa=Symbol("file"),aa=Symbol("directory"),ca=Symbol("link"),la=Symbol("symlink"),ua=Symbol("hardlink"),ha=Symbol("ensureNoSymlink"),da=Symbol("unsupported"),fa=Symbol("checkPath"),pa=Symbol("stripAbsolutePath"),ma=Symbol("mkdir"),ga=Symbol("onError"),ya=Symbol("pending"),va=Symbol("pend"),_a=Symbol("unpend"),ba=Symbol("ended"),wa=Symbol("maybeClose"),Ea=Symbol("skip"),Sa=Symbol("doChown"),$a=Symbol("uid"),Pa=Symbol("gid"),Ra=Symbol("checkedCwd"),xa=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Oa=xa==="win32",Aa=1024,mo=(t,u)=>{if(!Oa)return k.unlink(t,u);let p=t+".DELETE."+(0,I.randomBytes)(16).toString("hex");k.rename(t,p,(t=>{if(t)return u(t);k.unlink(p,u)}))},po=t=>{if(!Oa)return k.unlinkSync(t);let u=t+".DELETE."+(0,I.randomBytes)(16).toString("hex");k.renameSync(t,u),k.unlinkSync(u)},vr=(t,u,p)=>t!==void 0&&t===t>>>0?t:u!==void 0&&u===u>>>0?u:p,ka=class extends Ni{[ba]=!1;[Ra]=!1;[ya]=0;reservations=new ea;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[ba]=!0,this[wa]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?process.getuid?.()===0:!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:Aa,this.forceChown=t.forceChown===!0,this.win32=!!t.win32||Oa,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=Vs(T.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:Lr():0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",(t=>this[ta](t)))}warn(t,u,p={}){return(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT")&&(p.recoverable=!1),super.warn(t,u,p)}[wa](){this[ba]&&this[ya]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[pa](t,u){let p=t[u],{type:m}=t;if(!p||this.preservePaths)return!0;let[g,v]=ce(p),b=v.replaceAll(/\\/g,"/").split("/");if(b.includes("..")||Oa&&/^[a-z]:\.\.$/i.test(b[0]??"")){if(u==="path"||m==="Link")return this.warn("TAR_ENTRY_ERROR",`${u} contains '..'`,{entry:t,[u]:p}),!1;let g=T.posix.dirname(t.path),v=T.posix.normalize(T.posix.join(g,b.join("/")));if(v.startsWith("../")||v==="..")return this.warn("TAR_ENTRY_ERROR",`${u} escapes extraction directory`,{entry:t,[u]:p}),!1}return g&&(t[u]=String(v),this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute ${u}`,{entry:t,[u]:p})),!0}[fa](t){let u=Vs(t.path),p=u.split("/");if(this.strip){if(p.length<this.strip)return!1;if(t.type==="Link"){let u=Vs(String(t.linkpath)).split("/");if(u.length>=this.strip)t.linkpath=u.slice(this.strip).join("/");else return!1}p.splice(0,this.strip),t.path=p.join("/")}if(isFinite(this.maxDepth)&&p.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:u,depth:p.length,maxDepth:this.maxDepth}),!1;if(!this[pa](t,"path")||!this[pa](t,"linkpath"))return!1;if(t.absolute=T.isAbsolute(t.path)?Vs(T.resolve(t.path)):Vs(T.resolve(this.cwd,t.path)),!this.preservePaths&&typeof t.absolute=="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:Vs(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir")return!1;if(this.win32){let{root:u}=T.win32.parse(String(t.absolute));t.absolute=u+ts(String(t.absolute).slice(u.length));let{root:p}=T.win32.parse(t.path);t.path=p+ts(t.path.slice(p.length))}return!0}[ta](t){if(!this[fa](t))return t.resume();switch(N.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=t.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[ra](t);default:return this[da](t)}}[ga](t,u){t.name==="CwdError"?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:u}),this[_a](),u.resume())}[ma](t,u,p){gr(Vs(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:u},p)}[Sa](t){return this.forceChown||this.preserveOwner&&(typeof t.uid=="number"&&t.uid!==this.processUid||typeof t.gid=="number"&&t.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[$a](t){return vr(this.uid,t.uid,this.processUid)}[Pa](t){return vr(this.gid,t.gid,this.processGid)}[oa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.fmode,m=new rs(String(t.absolute),{flags:qo(t.size),mode:p,autoClose:!1});m.on("error",(p=>{m.fd&&k.close(m.fd,(()=>{})),m.write=()=>!0,this[ga](p,t),u()}));let g=1,o=p=>{if(p){m.fd&&k.close(m.fd,(()=>{})),this[ga](p,t),u();return}--g===0&&m.fd!==void 0&&k.close(m.fd,(p=>{p?this[ga](p,t):this[_a](),u()}))};m.on("finish",(()=>{let u=String(t.absolute),p=m.fd;if(typeof p=="number"&&t.mtime&&!this.noMtime){g++;let m=t.atime||new Date,v=t.mtime;k.futimes(p,m,v,(t=>t?k.utimes(u,m,v,(u=>o(u&&t))):o()))}if(typeof p=="number"&&this[Sa](t)){g++;let m=this[$a](t),v=this[Pa](t);typeof m=="number"&&typeof v=="number"&&k.fchown(p,m,v,(t=>t?k.chown(u,m,v,(u=>o(u&&t))):o()))}o()}));let v=this.transform&&this.transform(t)||t;v!==t&&(v.on("error",(p=>{this[ga](p,t),u()})),t.pipe(v)),v.pipe(m)}[aa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.dmode;this[ma](String(t.absolute),p,(p=>{if(p){this[ga](p,t),u();return}let m=1,o=()=>{--m===0&&(u(),this[_a](),t.resume())};t.mtime&&!this.noMtime&&(m++,k.utimes(String(t.absolute),t.atime||new Date,t.mtime,o)),this[Sa](t)&&(m++,k.chown(String(t.absolute),Number(this[$a](t)),Number(this[Pa](t)),o)),o()}))}[da](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[la](t,u){let p=Vs(T.relative(this.cwd,T.resolve(T.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[ha](t,this.cwd,p,(()=>this[ca](t,String(t.linkpath),"symlink",u)),(p=>{this[ga](p,t),u()}))}[ua](t,u){let p=Vs(T.resolve(this.cwd,String(t.linkpath))),m=Vs(String(t.linkpath)).split("/");this[ha](t,this.cwd,m,(()=>this[ca](t,p,"link",u)),(p=>{this[ga](p,t),u()}))}[ha](t,u,p,m,g){let v=p.shift();if(this.preservePaths||v===void 0)return m();let b=T.resolve(u,v);k.lstat(b,((u,v)=>{if(u)return m();if(v?.isSymbolicLink())return g(new Ko(b,T.resolve(b,p.join("/"))));this[ha](t,b,p,m,g)}))}[va](){this[ya]++}[_a](){this[ya]--,this[wa]()}[Ea](t){this[_a](),t.resume()}[ia](t,u){return t.type==="File"&&!this.unlink&&u.isFile()&&u.nlink<=1&&!Oa}[ra](t){this[va]();let u=[t.path];t.linkpath&&u.push(t.linkpath),this.reservations.reserve(u,(u=>this[sa](t,u)))}[sa](t,u){let i=t=>{u(t)},r=()=>{this[ma](this.cwd,this.dmode,(u=>{if(u){this[ga](u,t),i();return}this[Ra]=!0,n()}))},n=()=>{if(t.absolute!==this.cwd){let u=Vs(T.dirname(String(t.absolute)));if(u!==this.cwd)return this[ma](u,this.dmode,(u=>{if(u){this[ga](u,t),i();return}o()}))}o()},o=()=>{k.lstat(String(t.absolute),((u,p)=>{if(p&&(this.keep||this.newer&&p.mtime>(t.mtime??p.mtime))){this[Ea](t),i();return}if(u||this[ia](t,p))return this[na](null,t,i);if(p.isDirectory()){if(t.type==="Directory"){let u=this.chmod&&t.mode&&(p.mode&4095)!==t.mode,c=u=>this[na](u??null,t,i);return u?k.chmod(String(t.absolute),Number(t.mode),c):c()}if(t.absolute!==this.cwd)return k.rmdir(String(t.absolute),(u=>this[na](u??null,t,i)))}if(t.absolute===this.cwd)return this[na](null,t,i);mo(String(t.absolute),(u=>this[na](u??null,t,i)))}))};this[Ra]?n():r()}[na](t,u,p){if(t){this[ga](t,u),p();return}switch(u.type){case"File":case"OldFile":case"ContiguousFile":return this[oa](u,p);case"Link":return this[ua](u,p);case"SymbolicLink":return this[la](u,p);case"Directory":case"GNUDumpDir":return this[aa](u,p)}}[ca](t,u,p,m){k[p](u,String(t.absolute),(u=>{u?this[ga](u,t):(this[_a](),t.resume()),m()}))}},ye=t=>{try{return[null,t()]}catch(t){return[t,null]}},Ta=class extends ka{sync=!0;[na](t,u){return super[na](t,u,(()=>{}))}[ra](t){if(!this[Ra]){let u=this[ma](this.cwd,this.dmode);if(u)return this[ga](u,t);this[Ra]=!0}if(t.absolute!==this.cwd){let u=Vs(T.dirname(String(t.absolute)));if(u!==this.cwd){let p=this[ma](u,this.dmode);if(p)return this[ga](p,t)}}let[u,p]=ye((()=>k.lstatSync(String(t.absolute))));if(p&&(this.keep||this.newer&&p.mtime>(t.mtime??p.mtime)))return this[Ea](t);if(u||this[ia](t,p))return this[na](null,t);if(p.isDirectory()){if(t.type==="Directory"){let u=this.chmod&&t.mode&&(p.mode&4095)!==t.mode,[m]=u?ye((()=>{k.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[na](m,t)}let[u]=ye((()=>k.rmdirSync(String(t.absolute))));this[na](u,t)}let[m]=t.absolute===this.cwd?[]:ye((()=>po(String(t.absolute))));this[na](m,t)}[oa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.fmode,r=p=>{let g;try{k.closeSync(m)}catch(t){g=t}(p||g)&&this[ga](p||g,t),u()},m;try{m=k.openSync(String(t.absolute),qo(t.size),p)}catch(t){return r(t)}let g=this.transform&&this.transform(t)||t;g!==t&&(g.on("error",(u=>this[ga](u,t))),t.pipe(g)),g.on("data",(t=>{try{k.writeSync(m,t,0,t.length)}catch(t){r(t)}})),g.on("end",(()=>{let u=null;if(t.mtime&&!this.noMtime){let p=t.atime||new Date,g=t.mtime;try{k.futimesSync(m,p,g)}catch(m){try{k.utimesSync(String(t.absolute),p,g)}catch{u=m}}}if(this[Sa](t)){let p=this[$a](t),g=this[Pa](t);try{k.fchownSync(m,Number(p),Number(g))}catch(m){try{k.chownSync(String(t.absolute),Number(p),Number(g))}catch{u=u||m}}}r(u)}))}[aa](t,u){let p=typeof t.mode=="number"?t.mode&4095:this.dmode,m=this[ma](String(t.absolute),p);if(m){this[ga](m,t),u();return}if(t.mtime&&!this.noMtime)try{k.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[Sa](t))try{k.chownSync(String(t.absolute),Number(this[$a](t)),Number(this[Pa](t)))}catch{}u(),t.resume()}[ma](t,u){try{return _r(Vs(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:u})}catch(t){return t}}[ha](t,u,p,m,g){if(this.preservePaths||p.length===0)return m();let v=u;for(let t of p){v=T.resolve(v,t);let[b,w]=ye((()=>k.lstatSync(v)));if(b)return m();if(w.isSymbolicLink())return g(new Ko(v,T.resolve(u,p.join("/"))))}m()}[ca](t,u,p,m){let g=`${p}Sync`;try{k[g](u,String(t.absolute)),m(),t.resume()}catch(u){return this[ga](u,t)}}};var Eo=t=>{let u=new Ta(t),p=t.file,m=k.statSync(p),g=t.maxReadSize||16*1024*1024;new es(p,{readSize:g,size:m.size}).pipe(u)},wo=(t,u)=>{let p=new ka(t),m=t.maxReadSize||16*1024*1024,g=t.file;return new Promise(((t,u)=>{p.on("error",u),p.on("close",t),k.stat(g,((t,v)=>{if(t)u(t);else{let t=new Qr(g,{readSize:m,size:v.size});t.on("error",u),t.pipe(p)}}))}))},Ca=K(Eo,wo,(t=>new Ta(t)),(t=>new ka(t)),((t,u)=>{u?.length&&Qi(t,u)}));var yo=(t,u)=>{let p=new Io(t),m=!0,g,v;try{try{g=k.openSync(t.file,"r+")}catch(u){if(u?.code==="ENOENT")g=k.openSync(t.file,"w+");else throw u}let b=k.fstatSync(g),w=Buffer.alloc(512);e:for(v=0;v<b.size;v+=512){for(let t=0,u=0;t<512;t+=u){if(u=k.readSync(g,w,t,w.length-t,v+t),v===0&&w[0]===31&&w[1]===139)throw new Error("cannot append to compressed archives");if(!u)break e}let u=new Ns(w);if(!u.cksumValid)break;let p=512*Math.ceil((u.size||0)/512);if(v+p+512>b.size)break;v+=p,t.mtimeCache&&u.mtime&&t.mtimeCache.set(String(u.path),u.mtime)}m=!1,Ro(t,p,v,g,u)}finally{if(m)try{k.closeSync(g)}catch{}}},Ro=(t,u,p,m,g)=>{let v=new ss(t.file,{fd:m,start:p});u.pipe(v),bo(u,g)},go=(t,u)=>{u=Array.from(u);let p=new Co(t),i=(u,p,m)=>{let a=(t,p)=>{t?k.close(u,(u=>m(t))):m(null,p)},g=0;if(p===0)return a(null,0);let v=0,b=Buffer.alloc(512),y=(m,w)=>{if(m||w===void 0)return a(m);if(v+=w,v<512&&w)return k.read(u,b,v,b.length-v,g+v,y);if(g===0&&b[0]===31&&b[1]===139)return a(new Error("cannot append to compressed archives"));if(v<512)return a(null,g);let E=new Ns(b);if(!E.cksumValid)return a(null,g);let S=512*Math.ceil((E.size??0)/512);if(g+S+512>p||(g+=S+512,g>=p))return a(null,g);t.mtimeCache&&E.mtime&&t.mtimeCache.set(String(E.path),E.mtime),v=0,k.read(u,b,0,512,g,y)};k.read(u,b,0,512,g,y)};return new Promise(((m,g)=>{p.on("error",g);let v="r+",a=(b,w)=>{if(b&&b.code==="ENOENT"&&v==="r+")return v="w+",k.open(t.file,v,a);if(b||!w)return g(b);k.fstat(w,((v,b)=>{if(v)return k.close(w,(()=>g(v)));i(w,b.size,((v,b)=>{if(v)return g(v);let E=new rs(t.file,{fd:w,start:b});p.pipe(E),E.on("error",g),E.on("close",m),_o(p,u)}))}))};k.open(t.file,v,a)}))},bo=(t,u)=>{u.forEach((u=>{u.charAt(0)==="@"?Di({file:T.resolve(t.cwd,u.slice(1)),sync:!0,noResume:!0,onReadEntry:u=>t.add(u)}):t.add(u)})),t.end()},_o=async(t,u)=>{for(let p of u)p.charAt(0)==="@"?await Di({file:T.resolve(String(t.cwd),p.slice(1)),noResume:!0,onReadEntry:u=>t.add(u)}):t.add(p);t.end()},Ia=K(yo,go,(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,u)=>{if(!Bs(t))throw new TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!u?.length)throw new TypeError("no paths specified to add/replace")}));var Na=K(Ia.syncFile,Ia.asyncFile,Ia.syncNoFile,Ia.asyncNoFile,((t,u=[])=>{Ia.validate?.(t,u),To(t)})),To=t=>{let u=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=u?(p,m)=>u(p,m)&&!((t.mtimeCache?.get(p)??m.mtime??0)>(m.mtime??0)):(u,p)=>!((t.mtimeCache?.get(u)??p.mtime??0)>(p.mtime??0))};const Da="none";const ja=[{title:"Claude Code",value:"claude",description:"CLAUDE.md, .claude/, .mcp.json"},{title:"GitHub Copilot",value:"copilot",description:".github/copilot-instructions.md, .mcp.json"},{title:"Cursor",value:"cursor",description:".cursorrules, .mcp.json"},{title:"Windsurf",value:"windsurf",description:".windsurfrules, .mcp.json"},{title:"OpenAI Codex",value:"codex",description:"AGENTS.md, .mcp.json"},{title:"None",value:Da,description:"Skip AI agent setup"}];function resolveAgentSelection(t){if(t.includes(Da)){return[]}return t}const La="https://codeload.github.com/zuplo/tools/tar.gz/main";const Ma={claude:".claude/skills",copilot:".agents/skills",cursor:".cursor/skills",windsurf:".windsurf/skills",codex:".agents/skills"};const Fa={claude:"CLAUDE.md",copilot:".github/copilot-instructions.md",cursor:".cursorrules",windsurf:".windsurfrules",codex:"AGENTS.md"};function getSharedInstructions(){return`## Project Overview\n\nThis is a Zuplo API gateway project with an accompanying Zudoku-based developer portal.\n\n## Commands\n\n- **Dev server:** \`npm run dev\` (runs on http://localhost:9000)\n- **Run tests:** \`npm run test\`\n- **Typecheck:** \`npm run typecheck\`\n- **Dev portal:** \`npm run docs\`\n\n## Architecture\n\n- **\`config/routes.oas.json\`** — OpenAPI 3.1 route definitions. Each operation uses \`x-zuplo-route\` to configure handlers (e.g., \`urlForwardHandler\`) and policies. This is the primary file for defining API routes.\n- **\`config/policies.json\`** — Policy configurations applied to routes (e.g., \`MockApiInboundPolicy\`).\n- **\`modules/\`** — Custom TypeScript request handlers. Handlers receive \`(ZuploRequest, ZuploContext)\` and return a \`Response\` or serializable value.\n- **\`docs/\`** — Zudoku developer portal (separate workspace). Config is in \`docs/zudoku.config.tsx\`. Reads the OpenAPI spec from \`../config/routes.oas.json\`.\n- **\`zuplo.jsonc\`** — Zuplo project configuration (version, compatibility date).\n\n## Key Patterns\n\n- Routes are configured declaratively in \`config/routes.oas.json\`, not in code. Custom logic goes in \`modules/\` and is referenced via \`x-zuplo-route.handler\`.\n- The project uses ESM (\`"type": "module"\`) with TypeScript targeting ES2022.\n- Environment variables are defined in \`.env\` (gitignored). See \`.env.example\` for available vars.`}function getLocalDocsSection(){return`## Local Documentation (node_modules)\n\nFull markdown documentation is bundled in node_modules and can be read directly:\n\n- **Zuplo docs:** \`node_modules/zuplo/docs/\` — includes docs on policies (\`policies/\`), handlers (\`handlers/\`), CLI (\`cli/\`), dev portal (\`dev-portal/\`), guides, and articles.\n- **Zuplo policy configs:** \`node_modules/zuplo/docs/policies/\` — each policy has its own folder with full configuration docs. Reference these when adding or configuring policies in \`config/policies.json\`.\n- **Zudoku docs:** \`docs/node_modules/zudoku/docs/\` — configuration, components, customization, plugins, and deployment docs for the developer portal.`}function getGenericInstructions(){return`${getSharedInstructions()}\n\n${getLocalDocsSection()}\n`}function getClaudeMd(){return`# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n${getSharedInstructions()}\n\n## Available Tools and Documentation\n\n### MCP Tools\n\n- **Zuplo Docs MCP** (configured in \`.mcp.json\`) — search Zuplo documentation via \`mcp__zuplo_docs__ask-question-about-zuplo\` and \`mcp__zuplo_docs__search-zuplo-docs\`.\n- **Zuplo Skills** — installed skills for working with Zuplo projects: \`zuplo-guide\`, \`zuplo-project-setup\`, \`zuplo-policies\`, \`zuplo-handlers\`, \`zuplo-monetization\`, \`zuplo-cli\`, and \`zudoku-guide\`.\n\n${getLocalDocsSection()}\n`}function getClaudeSettings(){return JSON.stringify({enabledPlugins:{"zudoku-skills@zuplo-tools":true,"zuplo-skills@zuplo-tools":true},extraKnownMarketplaces:{"zuplo-tools":{source:{source:"github",repo:"zuplo/tools"}}},enableAllProjectMcpServers:true},null,2)}function getMcpJson(){return JSON.stringify({mcpServers:{zuplo_docs:{type:"http",url:"https://dev.zuplo.com/mcp/docs"}}},null,2)}async function agents_writeFile(t,u){await et().mkdir(Ge().dirname(t),{recursive:true});await et().writeFile(t,u+rt().EOL,"utf-8")}async function downloadSkillsToTmp(){const t=await et().mkdtemp(Ge().join(rt().tmpdir(),"zuplo-skills-"));const u=await fetch(La);if(!u.body){throw new Error("Failed to download zuplo/tools tarball")}const p=u.body;const m=st.Readable.fromWeb(p);let g=0;const v=new st.Transform({transform(t,u,p){g+=t.length;if(g>10*1024*1024){return p(new Error("Download too large"))}p(null,t)}});await(0,it.pipeline)(m.pipe(v),Ca({cwd:t,strip:1,filter:t=>/\/skills\/[^/]+\/SKILL\.md$/.test(t)}));return t}async function installSkills(t,u){const p=await downloadSkillsToTmp();try{const m=Ge().join(p,"skills");let g;try{g=await et().readdir(m)}catch{throw new Error("No skills found in zuplo/tools tarball")}for(const p of u){const u=Ma[p];for(const p of g){const g=Ge().join(m,p,"SKILL.md");try{const m=await et().readFile(g,"utf-8");await agents_writeFile(Ge().join(t,u,p,"SKILL.md"),m)}catch{}}}}finally{await et().rm(p,{recursive:true,force:true})}}async function installAgentConfigs(t,u){if(u.length>0){await agents_writeFile(Ge().join(t,".mcp.json"),getMcpJson())}for(const p of u){if(p==="claude"){await agents_writeFile(Ge().join(t,".claude","settings.json"),getClaudeSettings());await agents_writeFile(Ge().join(t,"CLAUDE.md"),getClaudeMd())}else{await agents_writeFile(Ge().join(t,Fa[p]),getGenericInstructions())}}const p=u.filter((t=>t!=="claude"));if(p.length>0){try{console.log("Installing Zuplo agent skills...");await installSkills(t,p)}catch{console.log("Failed to download agent skills. You can install them later with:");console.log(" npx skills add zuplo/tools")}}}async function isUrlOk(t){try{const u=await fetch(t,{method:"HEAD"});return u.status===200}catch{return false}}async function getRepoInfo(t,u){const[,p,m,g,v,...b]=t.pathname.split("/");const w=u?u.replace(/^\//,""):b.join("/");if(g===undefined||g===""&&v===undefined){try{const t=await fetch(`https://api.github.com/repos/${p}/${m}`);if(t.status!==200){return}const u=await t.json();return{username:p,name:m,branch:u["default_branch"],filePath:w}}catch{return}}const E=u?`${v}/${b.join("/")}`.replace(new RegExp(`/${w}|/$`),""):v;if(p&&m&&E&&g==="tree"){return{username:p,name:m,branch:E,filePath:w}}}function hasRepo({username:t,name:u,branch:p,filePath:m}){const g=`https://api.github.com/repos/${t}/${u}/contents`;const v=`${m?`/${m}`:""}/package.json`;return isUrlOk(`${g+v}?ref=${p}`)}function existsInRepo(t){try{const u=new URL(t);return isUrlOk(u.href)}catch{return isUrlOk(`https://api.github.com/repos/zuplo/zuplo/contents/examples/${encodeURIComponent(t)}`)}}async function downloadTarStream(t,u=50*1024*1024){const p=await fetch(t);if(!p.body){throw new Error(`Failed to download: ${t}`)}const m=p.headers.get("content-length");if(m&&parseInt(m,10)>u){throw new Error(`File too large! ${m} bytes exceeds limit of ${u} bytes`)}const g=p.body;const v=st.Readable.fromWeb(g);let b=0;const w=new st.Transform({transform(t,p,m){b+=t.length;if(b>u){return m(new Error(`Download aborted! File size exceeded ${u} bytes`))}m(null,t)}});return v.pipe(w)}async function downloadAndExtractRepo(t,{username:u,name:p,branch:m,filePath:g},v){const b=`https://codeload.github.com/${u}/${p}/tar.gz/${m}`;if(v){console.log(`Downloading repo from ${b}`)}let w=null;await(0,it.pipeline)(await downloadTarStream(b),Ca({cwd:t,strip:g?g.split("/").length+1:1,filter:t=>{if(w===null){const u=t.split(Ve.sep);w=u.length?u[0]:null}return t.startsWith(`${w}${g?`/${g}/`:"/"}`)}}))}async function downloadAndExtractExample(t,u,p){if(u==="__internal-testing-retry"){throw new Error("This is an internal example for testing the CLI.")}const m="https://codeload.github.com/zuplo/zuplo/tar.gz/main";if(p){console.log(`Downloading example from ${m}`)}await(0,it.pipeline)(await downloadTarStream(m),Ca({cwd:t,strip:2+u.split("/").length,filter:t=>t.includes(`zuplo-main/examples/${u}/`)}))}var Ua=__nccwpck_require__(5317);function isInGitRepository(){try{(0,Ua.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch{}return false}function isInMercurialRepository(){try{(0,Ua.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch{}return false}function isDefaultBranchSet(){try{(0,Ua.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch{}return false}function tryGitInit(t,u){let p=false;const m=u?"inherit":"ignore";try{(0,Ua.execSync)("git --version",{stdio:m});if(isInGitRepository()||isInMercurialRepository()){return false}(0,Ua.execSync)("git init",{stdio:m});p=true;if(!isDefaultBranchSet()){(0,Ua.execSync)("git checkout -b main",{stdio:m})}(0,Ua.execSync)("git add -A",{stdio:m});(0,Ua.execSync)('git commit -m "Initial commit from create-zuplo-api"',{stdio:m});return true}catch(m){if(u){console.error("Git init failed:",m)}if(p){try{(0,ze.rmSync)((0,Ve.join)(t,".git"),{recursive:true,force:true})}catch{}}return false}}var Ba=__nccwpck_require__(4791);var Ha=__nccwpck_require__.n(Ba);async function install(t,u,p){const m=["install"];if(!u){console.log((0,qe.yellow)("You appear to be offline.\nFalling back to the local cache."));m.push("--offline")}else if(t==="npm"){m.push("--no-audit");m.push("--no-fund")}if(p){m.push("--verbose")}return new Promise(((u,p)=>{const g=Ha()(t,m,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});g.on("close",(g=>{if(g!==0){p({command:`${t} ${m.join(" ")}`});return}u()}))}))}function isFolderEmpty(t,u){const p=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const m=(0,ze.readdirSync)(t).filter((t=>!p.includes(t)&&!/\.iml$/.test(t)));if(m.length>0){console.log(`The directory ${(0,qe.green)(u)} contains files that could conflict:`);console.log();for(const u of m){try{const p=(0,ze.lstatSync)((0,Ve.join)(t,u));if(p.isDirectory()){console.log(` ${(0,qe.blue)(u)}/`)}else{console.log(` ${u}`)}}catch{console.log(` ${u}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}const za=require("dns/promises");var Va=__nccwpck_require__(7016);var Ga=__nccwpck_require__.n(Va);function getProxy(){if(process.env.https_proxy){return process.env.https_proxy}try{const t=(0,Ua.execSync)("npm config get https-proxy").toString().trim();return t!=="null"?t:undefined}catch{return}}async function getOnline(){try{await(0,za.lookup)("registry.yarnpkg.com");return true}catch{const t=getProxy();if(!t){return false}const{hostname:u}=Ga().parse(t);if(!u){return false}try{await(0,za.lookup)(u);return true}catch{return false}}}const qa=require("constants");async function isWriteable(t){try{await(0,Qe.access)(t,qa.W_OK);return true}catch{return false}}function unquote(t){if(t.length<2){return t}const u=t[0];const p=t[t.length-1];if(u==='"'&&p==='"'||u==="'"&&p==="'"){return t.slice(1,-1)}return t}function extractEnvValue(t,u){const p=new RegExp(`^${u}=(.*)$`,"m").exec(t);if(!p){return undefined}const m=unquote(p[1].trim());return m.length>0?m:undefined}function readLinkedConfig(t){try{const u=(0,ze.readFileSync)((0,Ve.join)(t,".env.zuplo"),"utf-8");const p=extractEnvValue(u,"ZUPLO_ACCOUNT_NAME");const m=extractEnvValue(u,"ZUPLO_PROJECT_NAME");if(!p||!m){return undefined}return{account:p,project:m}}catch{return undefined}}function getZuploAuthFilePath(){var t;const u=(t=process.env.XDG_DATA_HOME)!==null&&t!==void 0?t:(0,Ve.join)((0,tt.homedir)(),".local","state");return(0,Ve.join)(u,"zuplo","auth.json")}function getZuploDeveloperApiEndpoint(){var t;return(t=process.env.ZUPLO_DEVELOPER_API_ENDPOINT)!==null&&t!==void 0?t:"https://dev.zuplo.com"}function readZuploAccessToken(){try{const t=getZuploAuthFilePath();if(!(0,ze.existsSync)(t)){return undefined}const u=(0,ze.readFileSync)(t,"utf-8");const p=JSON.parse(u);return typeof p.access_token==="string"?p.access_token:undefined}catch{return undefined}}async function fetchZuploAccountNames(t){try{const u=await fetch(`${getZuploDeveloperApiEndpoint()}/v1/accounts`,{method:"GET",headers:{Authorization:`Bearer ${t}`}});if(!u.ok){return undefined}const p=await u.json();if(!Array.isArray(p.data)){return undefined}return p.data.map((t=>typeof(t===null||t===void 0?void 0:t.name)==="string"?t.name:undefined)).filter((t=>typeof t==="string")).sort(((t,u)=>t.localeCompare(u)))}catch{return undefined}}async function probeProjectDeployments(t,u,p){try{const m=`${getZuploDeveloperApiEndpoint()}/v1/accounts/${encodeURIComponent(u)}/projects/${encodeURIComponent(p)}/deployments`;const g=await fetch(m,{method:"GET",headers:{Authorization:`Bearer ${t}`}});if(!g.ok){return{exists:false,soleWorkingCopy:undefined}}const v=await g.json();if(!Array.isArray(v.data)){return{exists:true,soleWorkingCopy:undefined}}const b=v.data.filter((t=>(t===null||t===void 0?void 0:t.environmentType)==="WORKING_COPY")).map((t=>typeof(t===null||t===void 0?void 0:t.name)==="string"?t.name:undefined)).filter((t=>typeof t==="string"));return{exists:true,soleWorkingCopy:b.length===1?b[0]:undefined}}catch{return{exists:false,soleWorkingCopy:undefined}}}async function fetchSoleWorkingCopyName(t,u,p){const m=await probeProjectDeployments(t,u,p);return m.soleWorkingCopy}async function findAccountWithProject(t,u,p){for(const m of u){const u=await probeProjectDeployments(t,m,p);if(u.exists){return{account:m,soleWorkingCopy:u.soleWorkingCopy}}}return undefined}const defaultRunZuplo=t=>new Promise(((u,p)=>{const m=process.platform==="win32"?"npx.cmd":"npx";const g=(0,Ua.spawn)(m,["zuplo",...t],{stdio:"inherit"});g.on("close",((m,g)=>{if(m===0){u();return}let v;if(m!==null&&m!==undefined){v=`exited with code ${m}`}else if(g){v=`was terminated by signal ${g}`}else{v="exited unsuccessfully"}p(new Error(`"zuplo ${t.join(" ")}" ${v}.`))}));g.on("error",p)}));const defaultPromptForAccount=async t=>{const u=await Ke()({type:"select",name:"account",message:"Which Zuplo account should host this project?",choices:t.map((t=>({title:t,value:t}))),onState:t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}}});return typeof u.account==="string"?u.account:undefined};const Wa={readToken:readZuploAccessToken,fetchAccounts:fetchZuploAccountNames,fetchWorkingCopy:fetchSoleWorkingCopyName,findAccountWithProject:findAccountWithProject,readLinked:readLinkedConfig,runZuplo:defaultRunZuplo,promptForAccount:defaultPromptForAccount};async function createAndLinkServerProject(t,u=Wa){const{appPath:p,appName:m,account:g,skipPrompts:v}=t;let b=(g===null||g===void 0?void 0:g.trim())||undefined;if(!b){const t=u.readToken();const p=t?await u.fetchAccounts(t):undefined;if(p&&p.length===1){b=p[0];console.log();console.log(`Using Zuplo account ${(0,qe.cyan)(`'${b}'`)}.`)}else if(v){console.log();console.log(`${(0,qe.yellow)("Note:")} Skipping server-project setup in non-interactive mode.`);console.log(`Pass ${(0,qe.cyan)("--account <name>")} to create a server project, or ${(0,qe.cyan)("--no-server-project")} to silence this note.`);return undefined}else if(p&&p.length>1){b=await u.promptForAccount(p)}}console.log();console.log("Creating your project on portal.zuplo.com...");console.log();const w=["project","create","--name",m];if(b){w.push("--account",b)}try{await u.runZuplo(w)}catch{console.log();console.log(`${(0,qe.yellow)("Note:")} Failed to create the server project. Your local files are ready.`);console.log(`You can finish setup later by running ${(0,qe.cyan)(`zuplo project create --name ${m}`)} and ${(0,qe.cyan)(`zuplo link`)} from inside your project directory.`);return undefined}console.log();console.log("Linking your working copy to the server project...");console.log();const E=["link","--dir",p,"--project",m];let S;if(!b){const t=u.readToken();if(t){const p=await u.fetchAccounts(t);if(p&&p.length===1){b=p[0]}else if(p&&p.length>1){const g=await u.findAccountWithProject(t,p,m);if(g){b=g.account;S=g.soleWorkingCopy}}}}if(b){E.push("--account",b)}if(b){if(S){E.push("--environment",S)}else{const t=u.readToken();if(t){const p=await u.fetchWorkingCopy(t,b,m);if(p){E.push("--environment",p)}}}}try{await u.runZuplo(E)}catch{console.log();console.log(`${(0,qe.yellow)("Note:")} The server project was created but linking failed.`);console.log(`You can finish setup later by running ${(0,qe.cyan)(`zuplo link`)} from inside your project directory.`);return undefined}return u.readLinked(p)}var Ka=__nccwpck_require__(4761);const identity=t=>t;const copy=async(t,u,{cwd:p,rename:m=identity,parents:g=true,verbose:v=false}={})=>{const b=typeof t==="string"?[t]:t;if(b.length===0||!u){throw new TypeError("`src` and `dest` are required")}const w=await(0,Ka.async)(b,{cwd:p,dot:true,absolute:false,stats:false});const E=p?(0,Ve.resolve)(p,u):u;return Promise.all(w.map((async t=>{const u=(0,Ve.dirname)(t);const b=m((0,Ve.basename)(t),t);const w=p?(0,Ve.resolve)(p,t):t;const S=g?(0,Ve.join)(E,u,b):(0,Ve.join)(E,b);await(0,Qe.mkdir)((0,Ve.dirname)(S),{recursive:true});if(v){console.log(`Copying ${w} to ${S}`)}return(0,Qe.copyFile)(w,S)})))};const Ya=["eslint","biome","oxlint","none"];const Za=["prettier","biome","oxfmt","none"];function isLinter(t){return Ya.includes(t)}function isFormatter(t){return Za.includes(t)}const Ja=[{title:"ESLint",value:"eslint",description:"The most widely used JavaScript/TypeScript linter"},{title:"Biome",value:"biome",description:"Fast Rust-based linter (can also format)"},{title:"Oxlint",value:"oxlint",description:"Fast Rust-based linter from the Oxc project"},{title:"None",value:"none",description:"Skip linter setup"}];const Xa=[{title:"Prettier",value:"prettier",description:"The most widely used code formatter"},{title:"Biome",value:"biome",description:"Fast Rust-based formatter (can also lint)"},{title:"Oxfmt",value:"oxfmt",description:"Fast Rust-based, Prettier-compatible formatter (beta)"},{title:"None",value:"none",description:"Skip formatter setup"}];function resolveLinterFromLegacyFlags({eslint:t,noEslint:u}){if(t)return"eslint";if(u)return"none";return undefined}function resolveFormatterFromLegacyFlags({prettier:t,noPrettier:u}){if(t)return"prettier";if(u)return"none";return undefined}function migrateLegacyLintPreferences(t){if(t.linter===undefined&&typeof t.eslint==="boolean"){t.linter=t.eslint?"eslint":"none"}if(t.formatter===undefined&&typeof t.prettier==="boolean"){t.formatter=t.prettier?"prettier":"none"}delete t.eslint;delete t.prettier}function eslintConfig(t){const u=[`import js from "@eslint/js";`,`import { defineConfig } from "eslint/config";`,...t?[`import prettier from "eslint-config-prettier/flat";`]:[],`import tseslint from "typescript-eslint";`,``,`export default defineConfig(`,` js.configs.recommended,`,` tseslint.configs.recommended,`,...t?[` prettier,`]:[],`);`,``];return u.join(rt().EOL)}function biomeConfig({lint:t,format:u}){return JSON.stringify({$schema:"https://biomejs.dev/schemas/2.5.3/schema.json",vcs:{enabled:true,clientKind:"git",useIgnoreFile:true},files:{ignoreUnknown:true},linter:{enabled:t,rules:{preset:"recommended"}},formatter:u?{enabled:true,indentStyle:"space"}:{enabled:false},assist:{enabled:true,actions:{source:{organizeImports:"on"}}}},null,2)+rt().EOL}function oxlintConfig(){return JSON.stringify({$schema:"./node_modules/oxlint/configuration_schema.json",categories:{correctness:"error"}},null,2)+rt().EOL}function prettierConfig(){return JSON.stringify({overrides:[{files:"*.jsonc",options:{trailingComma:"none"}}]},null,2)+rt().EOL}function oxfmtConfig(){return[`{`,` "$schema": "./node_modules/oxfmt/configuration_schema.json",`,` "printWidth": 80,`,` "overrides": [`,` {`,` "files": ["*.jsonc"],`,` "options": {`,` "trailingComma": "none"`,` }`,` }`,` ]`,`}`,``].join(rt().EOL)}function buildLintFormatSetup(t,u){const p={};const m={};const g={};const v=[];switch(t){case"eslint":{p.lint="eslint";p["lint:fix"]="eslint --fix";m["@eslint/js"]="^10";m.eslint="^10";m["typescript-eslint"]="^8";g["eslint.config.js"]=eslintConfig(u==="prettier");if(u==="prettier"){m["eslint-config-prettier"]="^10"}v.push("dbaeumer.vscode-eslint");break}case"oxlint":{p.lint="oxlint";p["lint:fix"]="oxlint --fix";m.oxlint="^1";g[".oxlintrc.json"]=oxlintConfig();v.push("oxc.oxc-vscode");break}case"biome":{p.lint="biome lint .";p["lint:fix"]="biome lint --write .";break}case"none":break}switch(u){case"prettier":{p.format="prettier --write .";p["format:check"]="prettier --check .";m.prettier="^3";g[".prettierrc.json"]=prettierConfig();v.push("esbenp.prettier-vscode");break}case"oxfmt":{p.format="oxfmt";p["format:check"]="oxfmt --check";m.oxfmt="^0.58.0";g[".oxfmtrc.json"]=oxfmtConfig();if(!v.includes("oxc.oxc-vscode")){v.push("oxc.oxc-vscode")}break}case"biome":{p.format="biome format --write .";p["format:check"]="biome format .";break}case"none":break}if(t==="biome"||u==="biome"){m["@biomejs/biome"]="^2";g["biome.json"]=biomeConfig({lint:t==="biome",format:u==="biome"});v.push("biomejs.biome")}return{scripts:p,docsScripts:p.lint?{lint:p.lint}:{},devDependencies:m,files:g,vscodeExtensions:v}}function buildProjectDependencies(t,u){const p={zuplo:`^${u}`};if(t==="default"||t==="default-empty"){p["@zuplo/otel"]=`^${u}`}return p}const getTemplateFile=({template:t,file:u})=>__nccwpck_require__.ab+"templates/"+t+"/"+u;const installTemplate=async({appName:t,root:u,packageManager:p,isOnline:m,template:g,linter:v,formatter:b,installPackages:w,verbose:E,zuploVersion:S,agents:$})=>{var P;console.log((0,qe.bold)(`Using ${p}.`));console.log("\nInitializing project with template:",g,"\n");const R=__nccwpck_require__.ab+"templates/"+g;const x=(0,ze.existsSync)(Ge().join(R,"docs"));const O=["**","!vscode/**"];await copy(O,u,{parents:true,cwd:R,verbose:E,rename(t){switch(t){case"gitignore":case"env.example":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});const A=buildLintFormatSetup(v,b);for(const[t,p]of Object.entries(A.files)){await et().writeFile(Ge().join(u,t),p,"utf-8")}const k=["settings.json","launch.json"];for(const t of k){const p=Ge().join(R,"vscode",t);const m=Ge().join(u,".vscode",t);if((0,ze.existsSync)(p)){await et().mkdir(Ge().join(u,".vscode"),{recursive:true});await et().copyFile(p,m)}}if(A.vscodeExtensions.length>0){await et().mkdir(Ge().join(u,".vscode"),{recursive:true});const t=A.vscodeExtensions.map((t=>`"${t}"`)).join(", ");await et().writeFile(Ge().join(u,".vscode","extensions.json"),`{${rt().EOL} "recommendations": [${t}]${rt().EOL}}${rt().EOL}`,"utf-8")}const T=(P=process.env.ZUPLO_PRIVATE_TEST_VERSION)!==null&&P!==void 0?P:S;const C=new ke.SemVer(T);const I={name:t,version:"0.1.0",private:true,type:"module",scripts:{dev:`zuplo dev`,test:"zuplo test",typecheck:"tsc --noEmit",...x?{docs:"zuplo docs"}:{},...A.scripts},dependencies:buildProjectDependencies(g,C.major),devDependencies:{typescript:"^5","@types/node":"^22",...A.devDependencies}};if(x){if(p==="pnpm"){await et().writeFile(Ge().join(u,"pnpm-workspace.yaml"),["packages:",' - "docs"',"onlyBuiltDependencies:",' - "@swc/core"'," - deno"," - esbuild"," - protobufjs"," - workerd",""].join(rt().EOL),"utf-8")}else{I.workspaces=["docs"]}}const sortObjectKeys=t=>Object.keys(t).sort().reduce(((u,p)=>{u[p]=t[p];return u}),{});if(I.dependencies){I.dependencies=sortObjectKeys(I.dependencies)}if(I.devDependencies){I.devDependencies=sortObjectKeys(I.devDependencies)}const N=Object.keys(I.devDependencies).length;if(!N)delete I.devDependencies;await et().writeFile(Ge().join(u,"package.json"),JSON.stringify(I,null,2)+rt().EOL);let D="^0.82";if(x&&m){try{const t=await fetch("https://api.github.com/repos/zuplo/zudoku/releases/latest");const u=await t.json();const p=u.tag_name.replace("v","");const m=new ke.SemVer(p);D=`^${m.major}.${m.minor}`}catch{console.warn("\nFailed to determine the latest dev portal version. Using the default version.")}}const j=[{name:"@zudoku/plugin-graphql",label:"GraphQL plugin"},{name:"@zuplo/zudoku-plugin-monetization",label:"monetization plugin"}];const L={};for(const{name:t,label:u}of j){let p="latest";if(x&&m){try{const u=await fetch(`https://registry.npmjs.org/${t}/latest`);const m=await u.json();const g=new ke.SemVer(m.version);p=`^${g.major}.${g.minor}`}catch{console.warn(`\nFailed to determine the latest ${u} version. Using the default version.`)}}L[t]=p}const M={name:"docs",version:"0.1.0",private:true,type:"module",scripts:{dev:"zudoku dev --zuplo",build:"zudoku build --zuplo",...A.docsScripts},dependencies:sortObjectKeys({react:"^19","react-dom":"^19","@mdx-js/react":"3.0.1",...L,zudoku:D}),devDependencies:{"@types/node":"^22","@types/react":"^19","@types/react-dom":"^19",typescript:"^5"}};if(x){await et().writeFile(Ge().join(u,"docs","package.json"),JSON.stringify(M,null,2)+rt().EOL)}if($.length>0){await installAgentConfigs(u,$);const t=Ge().join(u,"README.md");const p=await et().readFile(t,"utf-8");const m=["","## AI Coding Agents","","This project is configured for AI coding agents. Skills from","[zuplo/tools](https://github.com/zuplo/tools) provide agents with Zuplo and","Zudoku-specific knowledge.","","To update skills to the latest version:","","```bash","npx skills add zuplo/tools","```","","Learn more about using AI agents with Zuplo at","[zuplo.com/docs/articles/ai-agents](https://zuplo.com/docs/articles/ai-agents).",""].join("\n");await et().writeFile(t,p+m,"utf-8")}if(!w)return;console.log("\nInstalling dependencies:");for(const t in I.dependencies)console.log(`- ${(0,qe.cyan)(t)}`);if(N){console.log("\nInstalling devDependencies:");for(const t in I.devDependencies)console.log(`- ${(0,qe.cyan)(t)}`)}console.log();await install(p,m,E)};class DownloadError extends Error{}async function createApp({appPath:t,packageManager:u,example:p,examplePath:m,template:g,linter:v,formatter:b,installPackages:w,empty:E,initGit:S,verbose:$,zuploVersion:P,serverProject:R,account:x,skipPrompts:O,agents:A}){let k;const T=g!==null&&g!==void 0?g:`default${E?"-empty":""}`;if(p){let H;try{H=new URL(p)}catch(z){const V=z;if(V.code!=="ERR_INVALID_URL"){console.error(z);process.exit(1)}}if(H){if(H.origin!=="https://github.com"){console.error(`Invalid URL: ${(0,qe.red)(`"${p}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);process.exit(1)}k=await getRepoInfo(H,m);if(!k){console.error(`Found invalid GitHub URL: ${(0,qe.red)(`"${p}"`)}. Please fix the URL and try again.`);process.exit(1)}const G=await hasRepo(k);if(!G){console.error(`Could not locate the repository for ${(0,qe.red)(`"${p}"`)}. Please check that the repository exists and try again.`);process.exit(1)}}else if(p!=="__internal-testing-retry"){const q=await existsInRepo(p);if(!q){console.error(`Could not locate an example named ${(0,qe.red)(`"${p}"`)}. It could be due to the following:\n`,`1. Your spelling of example ${(0,qe.red)(`"${p}"`)} might be incorrect.\n`,`2. You might not be connected to the internet or you are behind a proxy.`);process.exit(1)}}}const C=(0,Ve.resolve)(t);if(!await isWriteable((0,Ve.dirname)(C))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const I=(0,Ve.basename)(C);(0,ze.mkdirSync)(C,{recursive:true});if(!isFolderEmpty(C,I)){process.exit(1)}const N=u==="yarn";const D=!N||await getOnline();const j=process.cwd();console.log(`Creating a new Zuplo API in ${(0,qe.green)(C)}.`);console.log();process.chdir(C);const L=(0,Ve.join)(C,"package.json");let M=false;if(p){try{if(k){const Y=k;console.log(`Downloading files from repo ${(0,qe.cyan)(p)}. This might take a moment.`);console.log();await Xe()((()=>downloadAndExtractRepo(C,Y,$)),{retries:3})}else{console.log(`Downloading files for example ${(0,qe.cyan)(p)}. This might take a moment.`);console.log();await Xe()((()=>downloadAndExtractExample(C,p,$)),{retries:3})}}catch(Z){function isErrorLike(t){return typeof t==="object"&&t!==null&&typeof t.message==="string"}throw new DownloadError(isErrorLike(Z)?Z.message:`${Z}`)}const W=(0,Ve.join)(C,".gitignore");if(!(0,ze.existsSync)(W)){(0,ze.copyFileSync)(getTemplateFile({template:T,file:"gitignore"}),W)}if(A.length>0){await installAgentConfigs(C,A)}M=(0,ze.existsSync)(L);if(w&&M){console.log("Installing packages. This might take a couple of minutes.");console.log();await install(u,D,$);console.log()}}else{await installTemplate({appName:I,root:C,template:T,packageManager:u,isOnline:D,linter:v,formatter:b,installPackages:w,verbose:$,zuploVersion:P,agents:A})}if(S){if(tryGitInit(C,$)){console.log("Initialized a git repository.");console.log()}}let U;if((0,Ve.join)(j,I)===t){U=I}else{U=t}console.log(`${(0,qe.green)("Success!")} Created ${I} at ${t}`);let B;if(R){B=await createAndLinkServerProject({appPath:C,appName:I,account:x,skipPrompts:O})}if(B){const J=`https://portal.zuplo.com/${B.account}/${B.project}`;console.log();console.log(`${(0,qe.green)("Success!")} Your project ${(0,qe.cyan)(`'${B.project}'`)} has been created in account ${(0,qe.cyan)(`'${B.account}'`)}.`);console.log();console.log("You can access this project online at:");console.log(` ${(0,qe.cyan)(J)}`);console.log();console.log("To connect your project to source control for easy, automated deployments:");console.log(` ${(0,qe.cyan)(`${J}/settings/source-control-settings`)}`);console.log()}if(M){console.log("Inside that directory, you can run several commands:");console.log();console.log((0,qe.cyan)(` ${u} ${N?"":"run "}dev`));console.log(" Starts the development server.");console.log();console.log((0,qe.cyan)(` ${u} ${N?"":"run "}build`));console.log(" Builds the app for production.");console.log();console.log((0,qe.cyan)(` ${u} start`));console.log(" Runs the built app in production mode.");console.log();console.log("We suggest that you begin by typing:");console.log();console.log((0,qe.cyan)(" cd"),U);console.log(` ${(0,qe.cyan)(`${u} ${N?"":"run "}dev`)}`)}console.log()}const Qa=require("crypto");function basename(t){if(!t){return undefined}return C().basename(t).toLowerCase()}function parseUserAgent(t){var u;const p=t===null||t===void 0?void 0:t.match(/^([^/\s]+)\/([^\s]+)/);const m=(u=p===null||p===void 0?void 0:p[1])===null||u===void 0?void 0:u.toLowerCase();switch(m){case"npm":case"pnpm":case"yarn":case"bun":return{family:m,version:p===null||p===void 0?void 0:p[2]};default:return{family:"unknown"}}}function inferFamilyFromExecutable(t){if(t==="npm"||t==="npm-cli.js"||t==="npx"||t==="npx-cli.js"){return"npm"}if(t==="pnpm"||t==="pnpm.cjs"||t==="pnpx"){return"pnpm"}if(t==="yarn"||t==="yarn.js"){return"yarn"}if(t==="bun"||t==="bunx"){return"bun"}return undefined}function inferRunner({family:t,command:u,execPathBasename:p,runnerBasename:m}){if(t==="npm"){if(p==="npx-cli.js"||m==="npx"){return"npx"}if(u==="init"||u==="create"){return"npm-create"}if(u==="exec"){return"npm-exec"}return"npm"}if(t==="pnpm"){if(m==="pnpx"||p==="pnpx"){return"pnpx"}if(u==="create"||u==="init"){return"pnpm-create"}if(u==="dlx"){return"pnpm-dlx"}if(u==="exec"){return"pnpm-exec"}return"pnpm"}if(t==="yarn"){if(u==="create"){return"yarn-create"}if(u==="dlx"){return"yarn-dlx"}return"yarn"}if(t==="bun"){if(m==="bunx"){return"bunx"}if(u==="create"){return"bun-create"}return"bun"}return"unknown"}function inferInstallSource(t){if(!t){return"unknown"}const u=t.toLowerCase().replace(/\\/g,"/");if(u.includes("/node_modules/.bin/")){return"project-local"}if(u.includes("/corepack/")){return"corepack"}if(u.includes("/.volta/")||u.includes("/volta/")){return"volta"}if(u.includes("/.nvm/")){return"nvm"}if(u.includes("/.asdf/")){return"asdf"}if(u.includes("/.fnm/")||u.includes("/fnm_multishells/")){return"fnm"}if(u.includes("/homebrew/")||u.includes("/cellar/")||u.startsWith("/opt/homebrew/")){return"homebrew"}if(u.startsWith("/usr/bin/")||u.startsWith("/usr/local/bin/")||u.startsWith("/usr/local/lib/")||u.startsWith("/bin/")||u.startsWith("c:/program files/")||u.startsWith("c:/programdata/")){return"system"}return"unknown"}function getPackageManagerUsageProperties(t=process.env){var u,p,m;const g=t["npm_config_user_agent"]||undefined;const v=(u=t["npm_command"])===null||u===void 0?void 0:u.toLowerCase();const b=t["npm_execpath"];const w=basename(b);const E=basename(t["_"]);const S=parseUserAgent(g);const $=S.family!=="unknown"?S.family:(m=(p=inferFamilyFromExecutable(E))!==null&&p!==void 0?p:inferFamilyFromExecutable(w))!==null&&m!==void 0?m:"unknown";return{packageManager:$,packageManagerVersion:S.version,runner:inferRunner({family:$,command:v,execPathBasename:w,runnerBasename:E}),installSource:inferInstallSource(b),nodeVersion:process.versions.node,platform:process.platform,arch:process.arch}}function getPkgManager(){const{packageManager:t}=getPackageManagerUsageProperties();if(t!=="unknown"){return t}return"npm"}const ec="phc_xB1aydh7a41MW9TwUtLJjKme4izQiWf9zKbKhpysAiW";const tc="https://app.posthog.com";const rc=1e3;function isAnalyticsEnabled(){return!process.env.ZUPLO_DO_NOT_TRACK}function getOrCreateAnalyticsDistinctId(t){try{const u=t.get("analyticsDistinctId");if(typeof u==="string"&&u.length>0){return u}const p=(0,Qa.randomUUID)();try{t.set("analyticsDistinctId",p)}catch{}return p}catch{return(0,Qa.randomUUID)()}}async function captureCreateZuploApiEvent({distinctId:t,event:u,properties:p}){if(!isAnalyticsEnabled()){return}const m=new AbortController;const g=setTimeout((()=>m.abort()),rc);g.unref();try{await fetch(`${tc}/capture/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({["api_key"]:ec,event:u,["distinct_id"]:t,properties:{...getPackageManagerUsageProperties(),...p!==null&&p!==void 0?p:{}},timestamp:(new Date).toISOString()}),signal:m.signal})}catch{}finally{clearTimeout(g)}}function resolvePackageManager(t,u){if(t.useNpm)return"npm";if(t.usePnpm)return"pnpm";if(t.useYarn)return"yarn";if(t.useBun)return"bun";return u()}function resolveNegatableFlag(t,u,p){return t!==null&&t!==void 0?t:!u.includes(p)}function parseAgentsFlag(t){const u=t.split(",").map((t=>t.trim())).filter(Boolean);const p=new Set(ja.map((t=>t.value)));const m=u.filter((t=>!p.has(t)));if(m.length>0){return{ok:false,error:`Invalid agent value(s): ${m.join(", ")}\nValid agents are: ${Array.from(p).join(", ")}`}}if(u.includes(Da)){if(u.some((t=>t!==Da))){return{ok:false,error:`'none' cannot be combined with other agents. Use --agents none to skip agent setup, or list specific agents.`}}return{ok:true,agents:[]}}return{ok:true,agents:u}}const sc=["default","default-empty","ai-gateway"];function resolveTemplate(t){const{template:u,empty:p,example:m}=t;if(u===undefined){return{template:p?"default-empty":"default"}}if(m){return{error:"The --template option cannot be combined with --example. Remove one of the two options."}}if(p){return{error:"The --template option cannot be combined with --empty. Use --template default-empty instead."}}const g=sc.find((t=>t===u));if(!g){return{error:`Unknown template "${u}". Valid templates are: ${sc.join(", ")}.`}}return{template:g}}function resolveServerProjectFromFlags(t){if(t.noServerProject){return false}if(t.serverProject){return true}if(typeof t.account==="string"&&t.account.trim().length>0){return true}return undefined}var ic=__nccwpck_require__(7825);var nc=__nccwpck_require__.n(ic);function validateNpmName(t){const u=nc()(t);if(u.validForNewPackages){return{valid:true}}return{valid:false,problems:[...u.errors||[],...u.warnings||[]]}}let oc="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const ac=JSON.parse((0,ze.readFileSync)(Ge().resolve(__dirname,Ge().join("..","package.json")),"utf-8"));const cc=new $(ac.name).version(ac.version,"-v, --version","Output the current version of create-zuplo-api.").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","Display this help message.").option("--linter <linter>",`The linter to configure: ${Ya.join(", ")}.`).option("--formatter <formatter>",`The formatter to configure: ${Za.join(", ")}.`).option("--eslint","Initialize with ESLint config. (deprecated: use --linter eslint)").option("--prettier","Initialize with Prettier config. (deprecated: use --formatter prettier)").option("--empty","Initialize an empty project.").option("--use-npm","Explicitly tell the CLI to bootstrap the application using npm.").option("--use-pnpm","Explicitly tell the CLI to bootstrap the application using pnpm.").option("--use-yarn","Explicitly tell the CLI to bootstrap the application using Yarn.").option("--use-bun","Explicitly tell the CLI to bootstrap the application using Bun.").option("--reset, --reset-preferences","Reset the preferences saved for create-zuplo-api.").option("--git","Whether or not to initialize the project as a git repo.").option("--version-check","Whether or not to check for an outdated version.").option("--install","Whether or not to install packages.").option("--verbose","Enable verbose logging.",false).option("--yes","Use saved preferences or defaults for unprovided options.").option("--server-project","Create a matching project on portal.zuplo.com and link this working copy to it (skips the interactive prompt).").option("--account <account-name>","The Zuplo account that will host the server project. Implies --server-project.").option("--agents <agents>","Comma-separated list of AI coding agents to configure (claude,copilot,cursor,windsurf,codex), or 'none' to skip agent setup.").option("--template <template-name>",`\n\n A built-in template to bootstrap the api with (default, default-empty,\n ai-gateway). Cannot be combined with --example or --empty.\n`).option("-e, --example <example-name|github-url>",`\n\n An example to bootstrap the api with. You can use an example name\n from the official Zuplo repo or a public GitHub URL. The URL can use\n any branch and/or subdirectory.\n`).option("--example-path <path-to-example>",`\n\n In a rare case, your GitHub URL might contain a branch name with\n a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).\n In this case, you must specify the path to the example separately:\n --example-path foo/bar\n`).action((t=>{if(t&&!t.startsWith("-")){oc=t}})).allowUnknownOption().parse(process.argv);const lc=cc.opts();const{args:uc}=cc;const hc=resolvePackageManager(lc,getPkgManager);async function run(){var t,p,m,g,v,b,w,E,S;const $=new Conf({projectName:"create-zuplo-api"});if(typeof lc.linter==="string"&&!isLinter(lc.linter)){console.error((0,qe.red)(`Invalid linter: "${lc.linter}"\nValid linters are: ${Ya.join(", ")}`));process.exit(1)}if(typeof lc.formatter==="string"&&!isFormatter(lc.formatter)){console.error((0,qe.red)(`Invalid formatter: "${lc.formatter}"\nValid formatters are: ${Za.join(", ")}`));process.exit(1)}if(lc.resetPreferences){const{resetPreferences:t}=await Ke()({onState:onPromptState,type:"toggle",name:"resetPreferences",message:"Would you like to reset the saved preferences?",initial:false,active:"Yes",inactive:"No"});if(t){$.clear();console.log("The preferences have been reset successfully!")}process.exit(0)}if(typeof oc==="string"){oc=oc.trim()}if(!oc){const t=await Ke()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-api",validate:t=>{const u=validateNpmName((0,Ve.basename)((0,Ve.resolve)(t)));if(u.valid){return true}return`Invalid project name: ${u.problems[0]}`}});if(typeof t.path==="string"){oc=t.path.trim()}}if(!oc){console.log("\nPlease specify the project directory:\n"+` ${(0,qe.cyan)(lc.name())} ${(0,qe.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,qe.cyan)(lc.name())} ${(0,qe.green)("my-zuplo-api")}\n\n`+`Run ${(0,qe.cyan)(`${lc.name()} --help`)} to see all options.`);process.exit(1)}const P=(0,Ve.resolve)(oc);const R=(0,Ve.basename)(P);const x=validateNpmName(R);if(!x.valid){console.error(`Could not create a project called ${(0,qe.red)(`"${R}"`)} because of npm naming restrictions:`);x.problems.forEach((t=>console.error(` ${(0,qe.red)((0,qe.bold)("*"))} ${t}`)));process.exit(1)}if(lc.example===true){console.error("Please provide an example name or url, otherwise remove the example option.");process.exit(1)}if((0,ze.existsSync)(P)&&!isFolderEmpty(P,R)){process.exit(1)}const O=typeof lc.example==="string"&&lc.example.trim();const A=resolveTemplate({template:typeof lc.template==="string"?lc.template:undefined,empty:Boolean(lc.empty),example:Boolean(O)});if("error"in A){console.error((0,qe.red)(A.error));process.exit(1)}const k=$.get("preferences")||{};const T=u().isCI||lc.yes;let C=resolveServerProjectFromFlags({noServerProject:uc.includes("--no-server-project"),serverProject:lc.serverProject===true,account:typeof lc.account==="string"?lc.account:undefined});if(C===undefined&&!T){const{serverProject:t}=await Ke()({onState:onPromptState,type:"toggle",name:"serverProject",message:"Create a matching project on portal.zuplo.com?",hint:"Connect this working copy to your Zuplo account so you can deploy and manage it from portal.zuplo.com.",initial:true,active:"Yes",inactive:"No"});C=Boolean(t)}if(!O){const u={linter:"eslint",formatter:"prettier",git:true,install:true,versionCheck:true,empty:false,zudoku:false};migrateLegacyLintPreferences(k);const getPrefOrDefault=t=>{var p;return(p=k[t])!==null&&p!==void 0?p:u[t]};if(!lc.linter){const t=resolveLinterFromLegacyFlags({eslint:lc.eslint===true,noEslint:uc.includes("--no-eslint")});if(t){lc.linter=t}else if(T){lc.linter=getPrefOrDefault("linter")}else{const t=getPrefOrDefault("linter");const{linter:u}=await Ke()({onState:onPromptState,type:"select",name:"linter",message:`Which ${(0,qe.blue)("linter")} would you like to use?`,choices:Ja,initial:Math.max(0,Ja.findIndex((u=>u.value===t)))});lc.linter=u;k.linter=lc.linter}}if(!lc.formatter){const p=resolveFormatterFromLegacyFlags({prettier:lc.prettier===true,noPrettier:uc.includes("--no-prettier")});if(p){lc.formatter=p}else if(T){lc.formatter=getPrefOrDefault("formatter")}else{const p=(t=k.formatter)!==null&&t!==void 0?t:lc.linter==="biome"?"biome":u.formatter;const{formatter:m}=await Ke()({onState:onPromptState,type:"select",name:"formatter",message:`Which ${(0,qe.blue)("formatter")} would you like to use?`,choices:Xa,initial:Math.max(0,Xa.findIndex((t=>t.value===p)))});lc.formatter=m;k.formatter=lc.formatter}}if(!lc.agents){if(T){lc.agents=[]}else{const{agents:t}=await Ke()({onState:onPromptState,type:"multiselect",name:"agents",message:"Which AI coding agents would you like to configure?",choices:ja,hint:"- Space to select. Return to submit"});lc.agents=resolveAgentSelection((p=t)!==null&&p!==void 0?p:[])}}}lc.git=resolveNegatableFlag(lc.git,uc,"--no-git");lc.install=resolveNegatableFlag(lc.install,uc,"--no-install");lc.versionCheck=resolveNegatableFlag(lc.versionCheck,uc,"--no-version-check");lc.serverProject=C!==null&&C!==void 0?C:false;if(typeof lc.agents==="string"){const t=parseAgentsFlag(lc.agents);if(!t.ok){console.error((0,qe.red)(t.error));process.exit(1)}lc.agents=t.agents}lc.agents=(m=lc.agents)!==null&&m!==void 0?m:[];if(isAnalyticsEnabled()){void captureCreateZuploApiEvent({distinctId:getOrCreateAnalyticsDistinctId($),event:"create-zuplo-api invoked",properties:{version:ac.version,selectedPackageManager:hc,hasExample:Boolean(O),emptyTemplate:Boolean(lc.empty),installPackages:Boolean(lc.install),initGit:Boolean(lc.git),serverProject:Boolean(lc.serverProject),skipPrompts:T,agentsCount:lc.agents.length,linter:(g=lc.linter)!==null&&g!==void 0?g:null,formatter:(v=lc.formatter)!==null&&v!==void 0?v:null}})}try{await createApp({appPath:P,packageManager:hc,example:O&&O!=="default"?O:undefined,examplePath:lc.examplePath,template:A.template,linter:(b=lc.linter)!==null&&b!==void 0?b:"none",formatter:(w=lc.formatter)!==null&&w!==void 0?w:"none",installPackages:lc.install,empty:lc.empty,initGit:lc.git,verbose:lc.verbose,zuploVersion:ac.version,serverProject:lc.serverProject,account:lc.account,skipPrompts:T,agents:lc.agents})}catch(t){if(!(t instanceof DownloadError)){throw t}const u=await Ke()({onState:onPromptState,type:"confirm",name:"builtin",message:`Could not download "${O}" because of a connectivity issue between your machine and GitHub.\n`+`Do you want to use the default template instead?`,initial:true});if(!u.builtin){throw t}await createApp({appPath:P,packageManager:hc,template:A.template,linter:(E=lc.linter)!==null&&E!==void 0?E:"none",formatter:(S=lc.formatter)!==null&&S!==void 0?S:"none",installPackages:lc.install,empty:lc.empty,initGit:lc.git,verbose:lc.verbose,zuploVersion:ac.version,serverProject:lc.serverProject,account:lc.account,skipPrompts:T,agents:lc.agents})}$.set("preferences",k);if(lc.versionCheck){console.log();await notifyUpdate()}}const dc=Ze()(ac).catch((()=>null));async function notifyUpdate(){var t;try{if((t=await dc)===null||t===void 0?void 0:t.latest){const t={npm:"npm i -g",yarn:"yarn global add",pnpm:"pnpm add -g",bun:"bun add -g"};const u=`${t[hc]} create-zuplo-api`;console.log((0,qe.yellow)((0,qe.bold)("A new version of `create-zuplo-api` is available!"))+"\n"+"You can update by running: "+(0,qe.cyan)(u)+"\n")}process.exit(0)}catch{}}async function exit(t){console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,qe.cyan)(t.command)} has failed.`)}else{console.log(`${(0,qe.red)("Unexpected error. Please report it as a bug:")}\n`,t)}process.exit(1)}run().catch(exit)})();module.exports=p})();