UNPKG

azureauth

Version:

node-azure auth wrapps the AzureAuth CLI wrapper for performing AAD Authentication

2 lines 179 kB
"use strict";var pu=Object.create;var kt=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var yu=Object.getOwnPropertyNames;var vu=Object.getPrototypeOf,_u=Object.prototype.hasOwnProperty;var d=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},gu=(e,t)=>{for(var r in t)kt(e,r,{get:t[r],enumerable:!0})},_n=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of yu(t))!_u.call(e,n)&&n!==r&&kt(e,n,{get:()=>t[n],enumerable:!(i=mu(t,n))||i.enumerable});return e};var jt=(e,t,r)=>(r=e!=null?pu(vu(e)):{},_n(t||!e||!e.__esModule?kt(r,"default",{value:e,enumerable:!0}):r,e)),wu=e=>_n(kt({},"__esModule",{value:!0}),e);var Sn=d(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.DownloaderHelper=Ie.DH_STATES=void 0;var Wr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bu=(function(){function e(t,r){for(var i,n=0;n<r.length;n++)i=r[n],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}})(),Eu=require("fs"),V=Nt(Eu),De=require("url"),Su=require("path"),Fe=Nt(Su),Au=require("http"),gn=Nt(Au),Fu=require("https"),wn=Nt(Fu),Ou=require("events");function Nt(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function Ru(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Pu(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var En=Ie.DH_STATES={IDLE:"IDLE",SKIPPED:"SKIPPED",STARTED:"STARTED",DOWNLOADING:"DOWNLOADING",RETRY:"RETRY",PAUSED:"PAUSED",RESUMED:"RESUMED",STOPPED:"STOPPED",FINISHED:"FINISHED",FAILED:"FAILED"},Gh=Ie.DownloaderHelper=(function(e){function t(r,i){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};Ru(this,t);var o=bn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{captureRejections:!0}));return o.__validate(r,i)?(o.url=o.requestURL=r.trim(),o.state=En.IDLE,o.__defaultOpts={body:null,retry:!1,method:"GET",headers:{},fileName:"",timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1e3,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},o.__opts=Object.assign({},o.__defaultOpts),o.__pipes=[],o.__total=0,o.__downloaded=0,o.__progress=0,o.__retryCount=0,o.__retryTimeout=null,o.__resumeRetryCount=0,o.__states=En,o.__promise=null,o.__request=null,o.__response=null,o.__isAborted=!1,o.__isResumed=!1,o.__isResumable=!1,o.__isRedirected=!1,o.__destFolder=i,o.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},o.__fileName="",o.__filePath="",o.updateOptions(n),o):bn(o)}return Pu(t,e),bu(t,[{key:"start",value:function(){var i=this,n=function(){return new Promise(function(o,a){i.__promise={resolve:o,reject:a},i.__start()})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(o){var a=o.name,s=o.total,f=i.__opts.override;if(i.__opts.override=!0,i.__filePath=i.__getFilePath(a),i.__opts.override=f,i.__filePath&&V.existsSync(i.__filePath)){var c=i.__getFilesizeInBytes(i.__filePath);return c===s?n():i.resumeFromFile(i.__filePath,{total:s,fileName:a})}return n()}):n()}},{key:"pause",value:function(){var i=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(n){return n.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return i.__setState(i.__states.PAUSED),i.emit("pause"),!0}))}},{key:"resume",value:function(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range="bytes="+this.__downloaded+"-"),this.emit("resume",this.__isResumed),this.__start()):this.start()}},{key:"stop",value:function(){var i=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var n=function(){return new Promise(function(o,a){V.access(i.__filePath,function(s){return s?(i.__emitStop(),o(!0)):void V.unlink(i.__filePath,function(f){return f?(i.__setState(i.__states.FAILED),i.emit("error",f),a(f)):(i.__emitStop(),void o(!0))})})})};return this.__requestAbort(),this.__closeFileStream().then(function(){return i.__opts.removeOnStop?n():(i.__emitStop(),Promise.resolve(!0))})}},{key:"pipe",value:function(i){var n=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;return this.__pipes.push({stream:i,options:n}),i}},{key:"unpipe",value:function(){var i=this,n=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null,o=function(s){return i.__response?i.__response.unpipe(s):s.unpipe()};if(n){var a=this.__pipes.find(function(s){return s.stream===n});return void(a&&(o(n),this.__pipes=this.__pipes.filter(function(s){return s.stream!==n})))}this.__pipes.forEach(function(s){return o(s.stream)}),this.__pipes=[]}},{key:"getDownloadPath",value:function(){return this.__filePath}},{key:"isResumable",value:function(){return this.__isResumable}},{key:"updateOptions",value:function(i){var n=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"";this.__opts=Object.assign({},this.__opts,i),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),(typeof this.__opts.progressThrottle!="number"||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=n||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url)}},{key:"getOptions",value:function(){return this.__opts}},{key:"getMetadata",value:function(){return this.__opts.metadata}},{key:"getStats",value:function(){return{total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:"getTotalSize",value:function(){var i=this;return new Promise(function(n,o){var a=function(f){i.__initProtocol(f);var c=Object.assign({},i.__headers);c.hasOwnProperty("range")&&delete c.range;var l=i.__getReqOptions("HEAD",f,c);return Object.assign({},i.__reqOptions,l)},s=function(f,c){var l=i.__protocol.request(c,function(x){if(i.__isRequireRedirect(x)){var u=/^https?:\/\//.test(x.headers.location)?x.headers.location:new De.URL(x.headers.location,f).href;return i.emit("redirected",u,f),s(u,a(u))}return x.statusCode===200?void n({name:i.__getFileNameFromHeaders(x.headers,x),total:parseInt(x.headers["content-length"])||null}):o(new Error("Response status was "+x.statusCode))});l.on("error",function(x){return o(x)}),l.on("timeout",function(){return o(new Error("timeout"))}),l.on("uncaughtException",function(x){return o(x)}),l.end()};s(i.url,a(i.url))})}},{key:"getResumeState",value:function(){return{downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:"resumeFromFile",value:function(i){var n=this,o=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return this.__opts.override=!0,this.__filePath=i,(o.total&&o.fileName?Promise.resolve({name:o.fileName,total:o.total}):this.getTotalSize()).then(function(a){var s=a.name,f=a.total;return n.__total=o.total||f,n.__fileName=o.fileName||s,n.__downloaded=o.downloaded||n.__getFilesizeInBytes(n.__filePath),n.__reqOptions.headers.range="bytes="+n.__downloaded+"-",n.__isResumed=!0,n.__isResumable=!0,n.__setState(n.__states.RESUMED),n.emit("resume",n.__isResumed),new Promise(function(c,l){n.__promise={resolve:c,reject:l},n.__start()})})}},{key:"__start",value:function(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit("start"),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on("error",this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on("timeout",this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on("uncaughtException",this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end()}},{key:"__resolvePending",value:function(){if(this.__promise){var i=this.__promise.resolve;return this.__promise=null,i(!0)}}},{key:"__downloadRequest",value:function(i,n){var o=this;return this.__protocol.request(this.__reqOptions,function(a){if(o.__response=a,o.__isResumed||(o.__total=parseInt(a.headers["content-length"])||null,o.__resetStats()),o.__isRequireRedirect(a)){var s=/^https?:\/\//.test(a.headers.location)?a.headers.location:new De.URL(a.headers.location,o.url).href;return o.__isRedirected=!0,o.__initProtocol(s),o.emit("redirected",s,o.url),o.__start()}if(a.statusCode!==200&&a.statusCode!==206){var f=new Error("Response status was "+a.statusCode);return f.status=a.statusCode||0,f.body=a.body||"",o.__setState(o.__states.FAILED),o.emit("error",f),n(f)}(o.__opts.forceResume||a.headers.hasOwnProperty("accept-ranges")&&a.headers["accept-ranges"]!=="none")&&(o.__isResumable=!0),o.__startDownload(a,i,n)})}},{key:"__startDownload",value:function(i,n,o){var a=this,s=i;if(this.__isResumed)this.__fileStream=V.createWriteStream(this.__filePath,{flags:"a"});else{var f=this.__getFileNameFromHeaders(i.headers);if(this.__filePath=this.__getFilePath(f),this.__fileName=this.__filePath.split(Fe.sep).pop(),V.existsSync(this.__filePath)){var c=this.__getFilesizeInBytes(this.__filePath),l=this.__total?this.__total:0;if(Wr(this.__opts.override)==="object"&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||c>=l))return this.emit("skip",{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:c}),this.__setState(this.__states.SKIPPED),n(!0)}this.__fileStream=V.createWriteStream(this.__filePath,{})}this.emit("download",{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,s.on("data",function(x){return a.__calculateStats(x.length)}),this.__pipes.forEach(function(x){s.pipe(x.stream,x.options),s=x.stream}),s.pipe(this.__fileStream),s.on("error",this.__onError(n,o)),this.__fileStream.on("finish",this.__onFinished(n,o)),this.__fileStream.on("error",this.__onError(n,o))}},{key:"__hasFinished",value:function(){return!this.__isAborted&&[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)===-1}},{key:"__isRequireRedirect",value:function(i){return 300<i.statusCode&&400>i.statusCode&&i.headers.hasOwnProperty("location")&&i.headers.location}},{key:"__onFinished",value:function(i,n){var o=this;return function(){o.__fileStream.close(function(a){if(a)return n(a);if(o.__hasFinished()){var s=!!o.__total&&o.__downloaded!==o.__total;if(s&&o.__isResumable&&o.__opts.resumeOnIncomplete&&o.__resumeRetryCount<=o.__opts.resumeOnIncompleteMaxRetry)return o.__resumeRetryCount++,o.emit("warning",new Error("uncomplete download, retrying")),o.resume();o.__setState(o.__states.FINISHED),o.__pipes=[],o.emit("end",{fileName:o.__fileName,filePath:o.__filePath,totalSize:o.__total,incomplete:s,onDiskSize:o.__getFilesizeInBytes(o.__filePath),downloadedSize:o.__downloaded})}return i(o.__downloaded===o.__total)})}}},{key:"__closeFileStream",value:function(){var i=this;return this.__fileStream?new Promise(function(n,o){i.__fileStream.close(function(a){return a?o(a):n(!0)})}):Promise.resolve(!0)}},{key:"__onError",value:function(i,n){var o=this,a=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return function(s){return o.__pipes=[],a&&o.__requestAbort(),o.state===o.__states.STOPPED||o.state===o.__states.FAILED?void 0:o.__opts.retry?o.__retry(s).catch(function(f){o.__removeFile().finally(function(){o.__setState(o.__states.FAILED),o.emit("error",f||s),n(f||s)})}):o.__removeFile().finally(function(){o.__setState(o.__states.FAILED),o.emit("error",s),n(s)})}}},{key:"__retry",value:function(){var i=this,n=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null;if(!this.__opts.retry||Wr(this.__opts.retry)!=="object")return Promise.reject(n||new Error("wrong retry options"));var o=this.__opts.retry,a=o.delay,s=a===void 0?0:a,f=o.maxRetries,c=f===void 0?999:f;return this.__retryCount>=c?Promise.reject(n||new Error("reached the maximum retries")):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit("retry",this.__retryCount,this.__opts.retry,n),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(l){return l.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(l){return i.__retryTimeout=setTimeout(function(){return l(0<i.__downloaded?i.resume():i.__start())},s)})}))}},{key:"__onTimeout",value:function(i,n){var o=this;return function(){return o.__requestAbort(),o.__opts.retry?o.__retry(new Error("timeout")).catch(function(a){o.__removeFile().finally(function(){o.__setState(o.__states.FAILED),a?n(a):(o.emit("timeout"),n(new Error("timeout")))})}):o.__removeFile().finally(function(){o.__setState(o.__states.FAILED),o.emit("timeout"),n(new Error("timeout"))})}}},{key:"__resetStats",value:function(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0}}},{key:"__getFileNameFromHeaders",value:function(i,n){var o="",a=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,s=/.*filename="(.*?)";?/i,f=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,c=i.hasOwnProperty("content-disposition"),l=c?i["content-disposition"].match(a):null,x=!c||l?null:i["content-disposition"].match(s),u=!c||l||x?null:i["content-disposition"].match(f);return c&&(l||x||u)?(o=i["content-disposition"],o=o.trim(),l?o=l[1]:x?o=x[1]:u&&(o=u[1]),o=o.replace(/[/\\]/g,"")):0<Fe.basename(new De.URL(this.requestURL).pathname).length?o=Fe.basename(new De.URL(this.requestURL).pathname):o=new De.URL(this.requestURL).hostname+".html",this.__opts.fileName?this.__getFileNameFromOpts(o,n):o.replace(/\.*$/,"")}},{key:"__getFilePath",value:function(i){var n=Fe.join(this.__destFolder,i),o=n;return this.__opts.override||this.state===this.__states.RESUMED||(o=this.__uniqFileNameSync(o),n!==o&&this.emit("renamed",{path:o,fileName:o.split(Fe.sep).pop(),prevPath:n,prevFileName:n.split(Fe.sep).pop()})),o}},{key:"__getFileNameFromOpts",value:function(i,n){if(!this.__opts.fileName)return i;if(typeof this.__opts.fileName=="string")return this.__opts.fileName;if(typeof this.__opts.fileName=="function"){var o=Fe.join(this.__destFolder,i);return n&&n.headers||this.__response&&this.__response.headers?this.__opts.fileName(i,o,(n||this.__response).headers["content-type"]):this.__opts.fileName(i,o)}if(Wr(this.__opts.fileName)==="object"){var a=this.__opts.fileName,s=a.name,f=!!a.hasOwnProperty("ext")&&a.ext;if(typeof f=="string")return s+"."+f;if(typeof f=="boolean"){if(f)return s;var c=i.includes(".")?i.split(".").pop():"";return c===""?s:s+"."+c}}return i}},{key:"__calculateStats",value:function(i){var n=new Date,o=n-this.__statsEstimate.time,a=n-this.__statsEstimate.throttleTime,s=this.__total||0;i&&(this.__downloaded+=i,this.__progress=s===0?0:100*(this.__downloaded/s),(this.__downloaded===s||1e3<o)&&(this.__statsEstimate.time=n,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===s||a>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=n,this.emit("progress.throttled",this.getStats())),this.emit("progress",this.getStats()))}},{key:"__setState",value:function(i){this.state=i,this.emit("stateChanged",this.state)}},{key:"__getReqOptions",value:function(i,n){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},a=new De.URL(n),s={protocol:a.protocol,host:a.hostname,port:a.port,path:a.pathname+a.search,method:i};return o&&(s.headers=o),s}},{key:"__getFilesizeInBytes",value:function(i){try{var n=V.statSync(i,{throwIfNoEntry:!1}),o=n.size||0;return o}catch(a){this.emit("warning",a)}return 0}},{key:"__validate",value:function(i,n){if(typeof i!="string")throw new Error("URL should be an string");if(i.trim()==="")throw new Error("URL couldn't be empty");if(typeof n!="string")throw new Error("Destination Folder should be an string");if(n.trim()==="")throw new Error("Destination Folder couldn't be empty");if(!V.existsSync(n))throw new Error("Destination Folder must exist");var o=V.statSync(n);if(!o.isDirectory())throw new Error("Destination Folder must be a directory");try{V.accessSync(n,V.constants.W_OK)}catch{throw new Error("Destination Folder must be writable")}return!0}},{key:"__initProtocol",value:function(i){var n=this.__getReqOptions(this.__opts.method,i,this.__headers);this.requestURL=i,-1<i.indexOf("https://")?(this.__protocol=wn,n.agent=new wn.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},n,this.__opts.httpsRequestOptions)):(this.__protocol=gn,n.agent=new gn.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},n,this.__opts.httpRequestOptions))}},{key:"__uniqFileNameSync",value:function(i){if(typeof i!="string"||i==="")return i;try{V.accessSync(i,V.F_OK);var n=i.match(/(.*)(\([0-9]+\))(\..*)$/),o=n?n[1].trim():i,a=n?parseInt(n[2].replace(/\(|\)/,"")):0,s=i.split(".").pop();return s!==i&&0<s.length?(s="."+s,o=o.replace(s,"")):s="",this.__uniqFileNameSync(o+" ("+ ++a+")"+s)}catch{return i}}},{key:"__removeFile",value:function(){var i=this;return new Promise(function(n){return i.__fileStream?void i.__fileStream.close(function(o){return o&&i.emit("warning",o),i.__opts.removeOnFail?V.access(i.__filePath,function(a){return a?n():void V.unlink(i.__filePath,function(s){s&&i.emit("warning",o),n()})}):void n()}):n()})}},{key:"__requestAbort",value:function(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort())}},{key:"__emitStop",value:function(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit("stop")}}]),t})(Ou.EventEmitter)});var Fn=d((Zh,An)=>{var ye=require("constants"),Tu=process.cwd,Ut=null,Bu=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Ut||(Ut=Tu.call(process)),Ut};try{process.cwd()}catch{}typeof process.chdir=="function"&&($r=process.chdir,process.chdir=function(e){Ut=null,$r.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,$r));var $r;An.exports=Cu;function Cu(e){ye.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=s(e.stat),e.fstat=s(e.fstat),e.lstat=s(e.lstat),e.statSync=f(e.statSync),e.fstatSync=f(e.fstatSync),e.lstatSync=f(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(l,x,u){u&&process.nextTick(u)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(l,x,u,h){h&&process.nextTick(h)},e.lchownSync=function(){}),Bu==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(l){function x(u,h,m){var y=Date.now(),p=0;l(u,h,function _(g){if(g&&(g.code==="EACCES"||g.code==="EPERM"||g.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){e.stat(h,function(E,N){E&&E.code==="ENOENT"?l(u,h,_):m(g)})},p),p<100&&(p+=10);return}m&&m(g)})}return Object.setPrototypeOf&&Object.setPrototypeOf(x,l),x})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(l){function x(u,h,m,y,p,_){var g;if(_&&typeof _=="function"){var E=0;g=function(N,R,J){if(N&&N.code==="EAGAIN"&&E<10)return E++,l.call(e,u,h,m,y,p,g);_.apply(this,arguments)}}return l.call(e,u,h,m,y,p,g)}return Object.setPrototypeOf&&Object.setPrototypeOf(x,l),x})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(l){return function(x,u,h,m,y){for(var p=0;;)try{return l.call(e,x,u,h,m,y)}catch(_){if(_.code==="EAGAIN"&&p<10){p++;continue}throw _}}})(e.readSync);function t(l){l.lchmod=function(x,u,h){l.open(x,ye.O_WRONLY|ye.O_SYMLINK,u,function(m,y){if(m){h&&h(m);return}l.fchmod(y,u,function(p){l.close(y,function(_){h&&h(p||_)})})})},l.lchmodSync=function(x,u){var h=l.openSync(x,ye.O_WRONLY|ye.O_SYMLINK,u),m=!0,y;try{y=l.fchmodSync(h,u),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return y}}function r(l){ye.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(x,u,h,m){l.open(x,ye.O_SYMLINK,function(y,p){if(y){m&&m(y);return}l.futimes(p,u,h,function(_){l.close(p,function(g){m&&m(_||g)})})})},l.lutimesSync=function(x,u,h){var m=l.openSync(x,ye.O_SYMLINK),y,p=!0;try{y=l.futimesSync(m,u,h),p=!1}finally{if(p)try{l.closeSync(m)}catch{}else l.closeSync(m)}return y}):l.futimes&&(l.lutimes=function(x,u,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function i(l){return l&&function(x,u,h){return l.call(e,x,u,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function n(l){return l&&function(x,u){try{return l.call(e,x,u)}catch(h){if(!c(h))throw h}}}function o(l){return l&&function(x,u,h,m){return l.call(e,x,u,h,function(y){c(y)&&(y=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(x,u,h){try{return l.call(e,x,u,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(x,u,h){typeof u=="function"&&(h=u,u=null);function m(y,p){p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),h&&h.apply(this,arguments)}return u?l.call(e,x,u,m):l.call(e,x,m)}}function f(l){return l&&function(x,u){var h=u?l.call(e,x,u):l.call(e,x);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(l){if(!l||l.code==="ENOSYS")return!0;var x=!process.getuid||process.getuid()!==0;return!!(x&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Pn=d((Kh,Rn)=>{var On=require("stream").Stream;Rn.exports=qu;function qu(e){return{ReadStream:t,WriteStream:r};function t(i,n){if(!(this instanceof t))return new t(i,n);On.call(this);var o=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,n=n||{};for(var a=Object.keys(n),s=0,f=a.length;s<f;s++){var c=a[s];this[c]=n[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}e.open(this.path,this.flags,this.mode,function(l,x){if(l){o.emit("error",l),o.readable=!1;return}o.fd=x,o.emit("open",x),o._read()})}function r(i,n){if(!(this instanceof r))return new r(i,n);On.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,n=n||{};for(var o=Object.keys(n),a=0,s=o.length;a<s;a++){var f=o[a];this[f]=n[f]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Bn=d((Vh,Tn)=>{"use strict";Tn.exports=Iu;var Du=Object.getPrototypeOf||function(e){return e.__proto__};function Iu(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:Du(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var In=d((Xh,Yr)=>{var U=require("fs"),ku=Fn(),ju=Pn(),Nu=Bn(),Lt=require("util"),H,Mt;typeof Symbol=="function"&&typeof Symbol.for=="function"?(H=Symbol.for("graceful-fs.queue"),Mt=Symbol.for("graceful-fs.previous")):(H="___graceful-fs.queue",Mt="___graceful-fs.previous");function Uu(){}function Dn(e,t){Object.defineProperty(e,H,{get:function(){return t}})}var Oe=Uu;Lt.debuglog?Oe=Lt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Oe=function(){var e=Lt.format.apply(Lt,arguments);e="GFS4: "+e.split(/\n/).join(` GFS4: `),console.error(e)});U[H]||(Cn=global[H]||[],Dn(U,Cn),U.close=(function(e){function t(r,i){return e.call(U,r,function(n){n||qn(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,Mt,{value:e}),t})(U.close),U.closeSync=(function(e){function t(r){e.apply(U,arguments),qn()}return Object.defineProperty(t,Mt,{value:e}),t})(U.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Oe(U[H]),require("assert").equal(U[H].length,0)}));var Cn;global[H]||Dn(global,U[H]);Yr.exports=Hr(Nu(U));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!U.__patched&&(Yr.exports=Hr(U),U.__patched=!0);function Hr(e){ku(e),e.gracefulify=Hr,e.createReadStream=R,e.createWriteStream=J;var t=e.readFile;e.readFile=r;function r(v,w,b){return typeof w=="function"&&(b=w,w=null),C(v,w,b);function C(q,B,A,F){return t(q,B,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?ke([C,[q,B,A],O,F||Date.now(),Date.now()]):typeof A=="function"&&A.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=n;function n(v,w,b,C){return typeof b=="function"&&(C=b,b=null),q(v,w,b,C);function q(B,A,F,O,M){return i(B,A,F,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ke([q,[B,A,F,O],T,M||Date.now(),Date.now()]):typeof O=="function"&&O.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=a);function a(v,w,b,C){return typeof b=="function"&&(C=b,b=null),q(v,w,b,C);function q(B,A,F,O,M){return o(B,A,F,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ke([q,[B,A,F,O],T,M||Date.now(),Date.now()]):typeof O=="function"&&O.apply(this,arguments)})}}var s=e.copyFile;s&&(e.copyFile=f);function f(v,w,b,C){return typeof b=="function"&&(C=b,b=0),q(v,w,b,C);function q(B,A,F,O,M){return s(B,A,F,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ke([q,[B,A,F,O],T,M||Date.now(),Date.now()]):typeof O=="function"&&O.apply(this,arguments)})}}var c=e.readdir;e.readdir=x;var l=/^v[0-5]\./;function x(v,w,b){typeof w=="function"&&(b=w,w=null);var C=l.test(process.version)?function(A,F,O,M){return c(A,q(A,F,O,M))}:function(A,F,O,M){return c(A,F,q(A,F,O,M))};return C(v,w,b);function q(B,A,F,O){return function(M,T){M&&(M.code==="EMFILE"||M.code==="ENFILE")?ke([C,[B,A,F],M,O||Date.now(),Date.now()]):(T&&T.sort&&T.sort(),typeof F=="function"&&F.call(this,M,T))}}}if(process.version.substr(0,4)==="v0.8"){var u=ju(e);_=u.ReadStream,E=u.WriteStream}var h=e.ReadStream;h&&(_.prototype=Object.create(h.prototype),_.prototype.open=g);var m=e.WriteStream;m&&(E.prototype=Object.create(m.prototype),E.prototype.open=N),Object.defineProperty(e,"ReadStream",{get:function(){return _},set:function(v){_=v},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return E},set:function(v){E=v},enumerable:!0,configurable:!0});var y=_;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(v){y=v},enumerable:!0,configurable:!0});var p=E;Object.defineProperty(e,"FileWriteStream",{get:function(){return p},set:function(v){p=v},enumerable:!0,configurable:!0});function _(v,w){return this instanceof _?(h.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}function g(){var v=this;z(v.path,v.flags,v.mode,function(w,b){w?(v.autoClose&&v.destroy(),v.emit("error",w)):(v.fd=b,v.emit("open",b),v.read())})}function E(v,w){return this instanceof E?(m.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function N(){var v=this;z(v.path,v.flags,v.mode,function(w,b){w?(v.destroy(),v.emit("error",w)):(v.fd=b,v.emit("open",b))})}function R(v,w){return new e.ReadStream(v,w)}function J(v,w){return new e.WriteStream(v,w)}var j=e.open;e.open=z;function z(v,w,b,C){return typeof b=="function"&&(C=b,b=null),q(v,w,b,C);function q(B,A,F,O,M){return j(B,A,F,function(T,D){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ke([q,[B,A,F,O],T,M||Date.now(),Date.now()]):typeof O=="function"&&O.apply(this,arguments)})}}return e}function ke(e){Oe("ENQUEUE",e[0].name,e[1]),U[H].push(e),Gr()}var zt;function qn(){for(var e=Date.now(),t=0;t<U[H].length;++t)U[H][t].length>2&&(U[H][t][3]=e,U[H][t][4]=e);Gr()}function Gr(){if(clearTimeout(zt),zt=void 0,U[H].length!==0){var e=U[H].shift(),t=e[0],r=e[1],i=e[2],n=e[3],o=e[4];if(n===void 0)Oe("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-n>=6e4){Oe("TIMEOUT",t.name,r);var a=r.pop();typeof a=="function"&&a.call(null,i)}else{var s=Date.now()-o,f=Math.max(o-n,1),c=Math.min(f*1.2,100);s>=c?(Oe("RETRY",t.name,r),t.apply(null,r.concat([n]))):U[H].push(e)}zt===void 0&&(zt=setTimeout(Gr,0))}}});var Zr=d((Jh,kn)=>{"use strict";kn.exports=e=>{let t=new Uint8Array(e);if(!(t&&t.length>1))return null;let r=(i,n)=>{n=Object.assign({offset:0},n);for(let o=0;o<i.length;o++)if(i[o]!==t[o+n.offset])return!1;return!0};if(r([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(r([137,80,78,71,13,10,26,10]))return{ext:"png",mime:"image/png"};if(r([71,73,70]))return{ext:"gif",mime:"image/gif"};if(r([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(r([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((r([73,73,42,0])||r([77,77,0,42]))&&r([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r([73,73,42,0])||r([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(r([66,77]))return{ext:"bmp",mime:"image/bmp"};if(r([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(r([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(r([80,75,3,4])&&r([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(r([80,75,3,4])&&r([77,69,84,65,45,73,78,70,47,109,111,122,105,108,108,97,46,114,115,97],{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(r([80,75])&&(t[2]===3||t[2]===5||t[2]===7)&&(t[3]===4||t[3]===6||t[3]===8))return{ext:"zip",mime:"application/zip"};if(r([117,115,116,97,114],{offset:257}))return{ext:"tar",mime:"application/x-tar"};if(r([82,97,114,33,26,7])&&(t[6]===0||t[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(r([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(r([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(r([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(r([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(r([0,0,0])&&(t[3]===24||t[3]===32)&&r([102,116,121,112],{offset:4})||r([51,103,112,53])||r([0,0,0,28,102,116,121,112,109,112,52,50])&&r([109,112,52,49,109,112,52,50,105,115,111,109],{offset:16})||r([0,0,0,28,102,116,121,112,105,115,111,109])||r([0,0,0,28,102,116,121,112,109,112,52,50,0,0,0,0]))return{ext:"mp4",mime:"video/mp4"};if(r([0,0,0,28,102,116,121,112,77,52,86]))return{ext:"m4v",mime:"video/x-m4v"};if(r([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(r([26,69,223,163])){let i=t.subarray(4,4100),n=i.findIndex((o,a,s)=>s[a]===66&&s[a+1]===130);if(n>=0){let o=n+3,a=s=>Array.from(s).every((f,c)=>i[o+c]===f.charCodeAt(0));if(a("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(a("webm"))return{ext:"webm",mime:"video/webm"}}}return r([0,0,0,20,102,116,121,112,113,116,32,32])||r([102,114,101,101],{offset:4})||r([102,116,121,112,113,116,32,32],{offset:4})||r([109,100,97,116],{offset:4})||r([119,105,100,101],{offset:4})?{ext:"mov",mime:"video/quicktime"}:r([82,73,70,70])&&r([65,86,73],{offset:8})?{ext:"avi",mime:"video/x-msvideo"}:r([48,38,178,117,142,102,207,17,166,217])?{ext:"wmv",mime:"video/x-ms-wmv"}:r([0,0,1,186])?{ext:"mpg",mime:"video/mpeg"}:r([73,68,51])||r([255,251])?{ext:"mp3",mime:"audio/mpeg"}:r([102,116,121,112,77,52,65],{offset:4})||r([77,52,65,32])?{ext:"m4a",mime:"audio/m4a"}:r([79,112,117,115,72,101,97,100],{offset:28})?{ext:"opus",mime:"audio/opus"}:r([79,103,103,83])?{ext:"ogg",mime:"audio/ogg"}:r([102,76,97,67])?{ext:"flac",mime:"audio/x-flac"}:r([82,73,70,70])&&r([87,65,86,69],{offset:8})?{ext:"wav",mime:"audio/x-wav"}:r([35,33,65,77,82,10])?{ext:"amr",mime:"audio/amr"}:r([37,80,68,70])?{ext:"pdf",mime:"application/pdf"}:r([77,90])?{ext:"exe",mime:"application/x-msdownload"}:(t[0]===67||t[0]===70)&&r([87,83],{offset:1})?{ext:"swf",mime:"application/x-shockwave-flash"}:r([123,92,114,116,102])?{ext:"rtf",mime:"application/rtf"}:r([0,97,115,109])?{ext:"wasm",mime:"application/wasm"}:r([119,79,70,70])&&(r([0,1,0,0],{offset:4})||r([79,84,84,79],{offset:4}))?{ext:"woff",mime:"font/woff"}:r([119,79,70,50])&&(r([0,1,0,0],{offset:4})||r([79,84,84,79],{offset:4}))?{ext:"woff2",mime:"font/woff2"}:r([76,80],{offset:34})&&(r([0,0,1],{offset:8})||r([1,0,2],{offset:8})||r([2,0,2],{offset:8}))?{ext:"eot",mime:"application/octet-stream"}:r([0,1,0,0,0])?{ext:"ttf",mime:"font/ttf"}:r([79,84,84,79,0])?{ext:"otf",mime:"font/otf"}:r([0,0,1,0])?{ext:"ico",mime:"image/x-icon"}:r([70,76,86,1])?{ext:"flv",mime:"video/x-flv"}:r([37,33])?{ext:"ps",mime:"application/postscript"}:r([253,55,122,88,90,0])?{ext:"xz",mime:"application/x-xz"}:r([83,81,76,105])?{ext:"sqlite",mime:"application/x-sqlite3"}:r([78,69,83,26])?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:r([67,114,50,52])?{ext:"crx",mime:"application/x-google-chrome-extension"}:r([77,83,67,70])||r([73,83,99,40])?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:r([33,60,97,114,99,104,62,10,100,101,98,105,97,110,45,98,105,110,97,114,121])?{ext:"deb",mime:"application/x-deb"}:r([33,60,97,114,99,104,62])?{ext:"ar",mime:"application/x-unix-archive"}:r([237,171,238,219])?{ext:"rpm",mime:"application/x-rpm"}:r([31,160])||r([31,157])?{ext:"Z",mime:"application/x-compress"}:r([76,90,73,80])?{ext:"lz",mime:"application/x-lzip"}:r([208,207,17,224,161,177,26,225])?{ext:"msi",mime:"application/x-msi"}:r([6,14,43,52,2,5,1,1,13,1,2,1,1,2])?{ext:"mxf",mime:"application/mxf"}:r([71],{offset:4})&&(r([71],{offset:192})||r([71],{offset:196}))?{ext:"mts",mime:"video/mp2t"}:r([66,76,69,78,68,69,82])?{ext:"blend",mime:"application/x-blender"}:r([66,80,71,251])?{ext:"bpg",mime:"image/bpg"}:null}});var Wt=d((Qh,jn)=>{"use strict";var ue=jn.exports=function(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"};ue.writable=function(e){return ue(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"};ue.readable=function(e){return ue(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object"};ue.duplex=function(e){return ue.writable(e)&&ue.readable(e)};ue.transform=function(e){return ue.duplex(e)&&typeof e._transform=="function"&&typeof e._transformState=="object"}});var ft=d((ep,Kr)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Kr.exports={nextTick:Lu}:Kr.exports=process;function Lu(e,t,r,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,o,a;switch(n){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,i)});default:for(o=new Array(n-1),a=0;a<o.length;)o[a++]=arguments[a];return process.nextTick(function(){e.apply(null,o)})}}});var Un=d((tp,Nn)=>{var zu={}.toString;Nn.exports=Array.isArray||function(e){return zu.call(e)=="[object Array]"}});var Vr=d((rp,Ln)=>{Ln.exports=require("stream")});var ut=d((Xr,Mn)=>{var $t=require("buffer"),le=$t.Buffer;function zn(e,t){for(var r in e)t[r]=e[r]}le.from&&le.alloc&&le.allocUnsafe&&le.allocUnsafeSlow?Mn.exports=$t:(zn($t,Xr),Xr.Buffer=je);function je(e,t,r){return le(e,t,r)}zn(le,je);je.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return le(e,t,r)};je.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=le(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};je.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return le(e)};je.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return $t.SlowBuffer(e)}});var Ne=d(K=>{function Mu(e){return Array.isArray?Array.isArray(e):Ht(e)==="[object Array]"}K.isArray=Mu;function Wu(e){return typeof e=="boolean"}K.isBoolean=Wu;function $u(e){return e===null}K.isNull=$u;function Hu(e){return e==null}K.isNullOrUndefined=Hu;function Gu(e){return typeof e=="number"}K.isNumber=Gu;function Yu(e){return typeof e=="string"}K.isString=Yu;function Zu(e){return typeof e=="symbol"}K.isSymbol=Zu;function Ku(e){return e===void 0}K.isUndefined=Ku;function Vu(e){return Ht(e)==="[object RegExp]"}K.isRegExp=Vu;function Xu(e){return typeof e=="object"&&e!==null}K.isObject=Xu;function Ju(e){return Ht(e)==="[object Date]"}K.isDate=Ju;function Qu(e){return Ht(e)==="[object Error]"||e instanceof Error}K.isError=Qu;function el(e){return typeof e=="function"}K.isFunction=el;function tl(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}K.isPrimitive=tl;K.isBuffer=require("buffer").Buffer.isBuffer;function Ht(e){return Object.prototype.toString.call(e)}});var Wn=d((np,Jr)=>{typeof Object.create=="function"?Jr.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Jr.exports=function(t,r){if(r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}}});var Ue=d((op,ei)=>{try{if(Qr=require("util"),typeof Qr.inherits!="function")throw"";ei.exports=Qr.inherits}catch{ei.exports=Wn()}var Qr});var Hn=d((ap,ti)=>{"use strict";function rl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var $n=ut().Buffer,lt=require("util");function il(e,t,r){e.copy(t,r)}ti.exports=(function(){function e(){rl(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},e.prototype.unshift=function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},e.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n},e.prototype.concat=function(r){if(this.length===0)return $n.alloc(0);for(var i=$n.allocUnsafe(r>>>0),n=this.head,o=0;n;)il(n.data,i,o),o+=n.data.length,n=n.next;return i},e})();lt&&lt.inspect&&lt.inspect.custom&&(ti.exports.prototype[lt.inspect.custom]=function(){var e=lt.inspect({length:this.length});return this.constructor.name+" "+e})});var ri=d((sp,Gn)=>{"use strict";var Gt=ft();function nl(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Gt.nextTick(Yt,this,e)):Gt.nextTick(Yt,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(o){!t&&o?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,Gt.nextTick(Yt,r,o)):Gt.nextTick(Yt,r,o):t&&t(o)}),this)}function ol(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Yt(e,t){e.emit("error",t)}Gn.exports={destroy:nl,undestroy:ol}});var Zn=d((fp,Yn)=>{Yn.exports=require("util").deprecate});var ni=d((up,ro)=>{"use strict";var Re=ft();ro.exports=W;function Vn(e){var t=this;this.next=null,this.entry=null,this.finish=function(){El(t,e)}}var al=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Re.nextTick,Le;W.WritableState=xt;var Xn=Object.create(Ne());Xn.inherits=Ue();var sl={deprecate:Zn()},Jn=Vr(),Kt=ut().Buffer,fl=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ul(e){return Kt.from(e)}function ll(e){return Kt.isBuffer(e)||e instanceof fl}var Qn=ri();Xn.inherits(W,Jn);function cl(){}function xt(e,t){Le=Le||Pe(),e=e||{};var r=t instanceof Le;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,n=e.writableHighWaterMark,o=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:r&&(n||n===0)?this.highWaterMark=n:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=e.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(s){vl(t,s)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Vn(this)}xt.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(xt.prototype,"buffer",{get:sl.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Zt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Zt=Function.prototype[Symbol.hasInstance],Object.defineProperty(W,Symbol.hasInstance,{value:function(e){return Zt.call(this,e)?!0:this!==W?!1:e&&e._writableState instanceof xt}})):Zt=function(e){return e instanceof this};function W(e){if(Le=Le||Pe(),!Zt.call(W,this)&&!(this instanceof Le))return new W(e);this._writableState=new xt(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),Jn.call(this)}W.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function xl(e,t){var r=new Error("write after end");e.emit("error",r),Re.nextTick(t,r)}function dl(e,t,r,i){var n=!0,o=!1;return r===null?o=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),Re.nextTick(i,o),n=!1),n}W.prototype.write=function(e,t,r){var i=this._writableState,n=!1,o=!i.objectMode&&ll(e);return o&&!Kt.isBuffer(e)&&(e=ul(e)),typeof t=="function"&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),typeof r!="function"&&(r=cl),i.ended?xl(this,r):(o||dl(this,i,e,r))&&(i.pendingcb++,n=pl(this,i,o,e,t,r)),n};W.prototype.cork=function(){var e=this._writableState;e.corked++};W.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&eo(this,e))};W.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function hl(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Kt.from(t,r)),t}Object.defineProperty(W.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function pl(e,t,r,i,n,o){if(!r){var a=hl(t,i,n);i!==a&&(r=!0,n="buffer",i=a)}var s=t.objectMode?1:i.length;t.length+=s;var f=t.length<t.highWaterMark;if(f||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else ii(e,t,!1,s,i,n,o);return f}function ii(e,t,r,i,n,o,a){t.writelen=i,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function ml(e,t,r,i,n){--t.pendingcb,r?(Re.nextTick(n,i),Re.nextTick(ct,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),ct(e,t))}function yl(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function vl(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(yl(r),t)ml(e,r,i,t,n);else{var o=to(r);!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&eo(e,r),i?al(Kn,e,r,o,n):Kn(e,r,o,n)}}function Kn(e,t,r,i){r||_l(e,t),t.pendingcb--,i(),ct(e,t)}function _l(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function eo(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)n[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;n.allBuffers=s,ii(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Vn(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,l=r.callback,x=t.objectMode?1:f.length;if(ii(e,t,!1,x,f,c,l),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}W.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};W.prototype._writev=null;W.prototype.end=function(e,t,r){var i=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||bl(this,i,r)};function to(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function gl(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),ct(e,t)})}function wl(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Re.nextTick(gl,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function ct(e,t){var r=to(t);return r&&(wl(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function bl(e,t,r){t.ending=!0,ct(e,t),r&&(t.finished?Re.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function El(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(W.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});W.prototype.destroy=Qn.destroy;W.prototype._undestroy=Qn.undestroy;W.prototype._destroy=function(e,t){this.end(),t(e)}});var Pe=d((lp,ao)=>{"use strict";var io=ft(),Sl=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};ao.exports=ce;var no=Object.create(Ne());no.inherits=Ue();var oo=si(),ai=ni();no.inherits(ce,oo);for(oi=Sl(ai.prototype),Vt=0;Vt<oi.length;Vt++)Xt=oi[Vt],ce.prototype[Xt]||(ce.prototype[Xt]=ai.prototype[Xt]);var oi,Xt,Vt;function ce(e){if(!(this instanceof ce))return new ce(e);oo.call(this,e),ai.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",Al)}Object.defineProperty(ce.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Al(){this.allowHalfOpen||this._writableState.ended||io.nextTick(Fl,this)}function Fl(e){e.end()}Object.defineProperty(ce.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this