@wallabyjs/cli 1.0.16 → 1.0.18
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.
- package/dist/index.mjs +28 -15
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import t,{basename as n,dirname as r,join as i,parse as a,posix as o,resolve as s}from"node:path";import c,{homedir as l,tmpdir as u}from"node:os";import d,{createWriteStream as f,existsSync as p,mkdirSync as m,readFileSync as h,readdirSync as g}from"node:fs";import{fileURLToPath as _}from"node:url";import v,{constants as y,mkdir as b,readdir as x,rename as S,rm as C,stat as w,unlink as T,writeFile as E}from"node:fs/promises";import{Writable as D}from"node:stream";import
|
|
1
|
+
import{createRequire as e}from"node:module";import t,{basename as n,dirname as r,join as i,parse as a,posix as o,resolve as s}from"node:path";import c,{homedir as l,tmpdir as u}from"node:os";import d,{createWriteStream as f,existsSync as p,mkdirSync as m,readFileSync as h,readdirSync as g}from"node:fs";import{fileURLToPath as _}from"node:url";import v,{constants as y,mkdir as b,readdir as x,rename as S,rm as C,stat as w,unlink as T,writeFile as E}from"node:fs/promises";import{Writable as D}from"node:stream";import{Buffer as O}from"node:buffer";import k,{randomUUID as A}from"node:crypto";import j,{cwd as M}from"node:process";import{format as N,promisify as P}from"node:util";import{Agent as ee}from"node:https";import F,{exec as te,execFile as ne,spawn as I}from"node:child_process";var re=Object.create,ie=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,oe=Object.getOwnPropertyNames,se=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty,L=(e,t)=>()=>(e&&(t=e(e=0)),t),R=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),le=(e,t)=>{let n={};for(var r in e)ie(n,r,{get:e[r],enumerable:!0});return t||ie(n,Symbol.toStringTag,{value:`Module`}),n},ue=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=oe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ce.call(e,s)&&s!==n&&ie(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ae(t,s))||r.enumerable});return e},z=(e,t,n)=>(n=e==null?{}:re(se(e)),ue(t||!e||!e.__esModule?ie(n,`default`,{value:e,enumerable:!0}):n,e)),B=e(import.meta.url),V=R((e=>{e.fromCallback=function(e){return Object.defineProperty(function(...t){if(typeof t[t.length-1]==`function`)e.apply(this,t);else return new Promise((n,r)=>{t.push((e,t)=>e==null?n(t):r(e)),e.apply(this,t)})},`name`,{value:e.name})},e.fromPromise=function(e){return Object.defineProperty(function(...t){let n=t[t.length-1];if(typeof n!=`function`)return e.apply(this,t);t.pop(),e.apply(this,t).then(e=>n(null,e),n)},`name`,{value:e.name})}})),de=R(((e,t)=>{var n=B(`constants`),r=process.cwd,i=null,a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return i||=r.call(process),i};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var o=process.chdir;process.chdir=function(e){i=null,o.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,o)}t.exports=s;function s(e){n.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=o(e.chmodSync),e.fchmodSync=o(e.fchmodSync),e.lchmodSync=o(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),a===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,r,i){e.open(t,n.O_WRONLY|n.O_SYMLINK,r,function(t,n){if(t){i&&i(t);return}e.fchmod(n,r,function(t){e.close(n,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,r){var i=e.openSync(t,n.O_WRONLY|n.O_SYMLINK,r),a=!0,o;try{o=e.fchmodSync(i,r),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function r(e){n.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,r,i,a){e.open(t,n.O_SYMLINK,function(t,n){if(t){a&&a(t);return}e.futimes(n,r,i,function(t){e.close(n,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,r,i){var a=e.openSync(t,n.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,r,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function o(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),fe=R(((e,t)=>{var n=B(`stream`).Stream;t.exports=r;function r(e){return{ReadStream:t,WriteStream:r};function t(r,i){if(!(this instanceof t))return new t(r,i);n.call(this);var a=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=64*1024,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}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 Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function r(t,i){if(!(this instanceof r))return new r(t,i);n.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw 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())}}})),pe=R(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),H=R(((e,t)=>{var n=B(`fs`),r=de(),i=fe(),a=pe(),o=B(`util`),s,c;typeof Symbol==`function`&&typeof Symbol.for==`function`?(s=Symbol.for(`graceful-fs.queue`),c=Symbol.for(`graceful-fs.previous`)):(s=`___graceful-fs.queue`,c=`___graceful-fs.previous`);function l(){}function u(e,t){Object.defineProperty(e,s,{get:function(){return t}})}var d=l;o.debuglog?d=o.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(d=function(){var e=o.format.apply(o,arguments);e=`GFS4: `+e.split(/\n/).join(`
|
|
2
2
|
GFS4: `),console.error(e)}),n[s]||(u(n,global[s]||[]),n.close=(function(e){function t(t,r){return e.call(n,t,function(e){e||h(),typeof r==`function`&&r.apply(this,arguments)})}return Object.defineProperty(t,c,{value:e}),t})(n.close),n.closeSync=(function(e){function t(t){e.apply(n,arguments),h()}return Object.defineProperty(t,c,{value:e}),t})(n.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&process.on(`exit`,function(){d(n[s]),B(`assert`).equal(n[s].length,0)})),global[s]||u(global,n[s]),t.exports=f(a(n)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!n.__patched&&(t.exports=f(n),n.__patched=!0);function f(e){r(e),e.gracefulify=f,e.createReadStream=T,e.createWriteStream=E;var t=e.readFile;e.readFile=n;function n(e,n,r){return typeof n==`function`&&(r=n,n=null),i(e,n,r);function i(e,n,r,a){return t(e,n,function(t){t&&(t.code===`EMFILE`||t.code===`ENFILE`)?p([i,[e,n,r],t,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var a=e.writeFile;e.writeFile=o;function o(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,o){return a(e,t,n,function(a){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?p([i,[e,t,n,r],a,o||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=c);function c(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return s(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?p([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(e,t,n,r){return typeof n==`function`&&(r=n,n=0),i(e,t,n,r);function i(e,t,n,r,a){return l(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?p([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var m=/^v[0-5]\./;function h(e,t,n){typeof t==`function`&&(n=t,t=null);var r=m.test(process.version)?function(e,t,n,r){return d(e,i(e,t,n,r))}:function(e,t,n,r){return d(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(a,o){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?p([r,[e,t,n],a,i||Date.now(),Date.now()]):(o&&o.sort&&o.sort(),typeof n==`function`&&n.call(this,a,o))}}}if(process.version.substr(0,4)===`v0.8`){var g=i(e);x=g.ReadStream,C=g.WriteStream}var _=e.ReadStream;_&&(x.prototype=Object.create(_.prototype),x.prototype.open=S);var v=e.WriteStream;v&&(C.prototype=Object.create(v.prototype),C.prototype.open=w),Object.defineProperty(e,`ReadStream`,{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,`WriteStream`,{get:function(){return C},set:function(e){C=e},enumerable:!0,configurable:!0});var y=x;Object.defineProperty(e,`FileReadStream`,{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(e,`FileWriteStream`,{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0});function x(e,t){return this instanceof x?(_.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n),e.read())})}function C(e,t){return this instanceof C?(v.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function w(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function T(t,n){return new e.ReadStream(t,n)}function E(t,n){return new e.WriteStream(t,n)}var D=e.open;e.open=O;function O(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return D(e,t,n,function(o,s){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?p([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}return e}function p(e){d(`ENQUEUE`,e[0].name,e[1]),n[s].push(e),g()}var m;function h(){for(var e=Date.now(),t=0;t<n[s].length;++t)n[s][t].length>2&&(n[s][t][3]=e,n[s][t][4]=e);g()}function g(){if(clearTimeout(m),m=void 0,n[s].length!==0){var e=n[s].shift(),t=e[0],r=e[1],i=e[2],a=e[3],o=e[4];if(a===void 0)d(`RETRY`,t.name,r),t.apply(null,r);else if(Date.now()-a>=6e4){d(`TIMEOUT`,t.name,r);var c=r.pop();typeof c==`function`&&c.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-a,1);l>=Math.min(u*1.2,100)?(d(`RETRY`,t.name,r),t.apply(null,r.concat([a]))):n[s].push(e)}m===void 0&&(m=setTimeout(g,0))}}})),U=R((e=>{let t=V().fromCallback,n=H(),r=`access.appendFile.chmod.chown.close.copyFile.cp.fchmod.fchown.fdatasync.fstat.fsync.ftruncate.futimes.glob.lchmod.lchown.lutimes.link.lstat.mkdir.mkdtemp.open.opendir.readdir.readFile.readlink.realpath.rename.rm.rmdir.stat.statfs.symlink.truncate.unlink.utimes.writeFile`.split(`.`).filter(e=>typeof n[e]==`function`);Object.assign(e,n),r.forEach(r=>{e[r]=t(n[r])}),e.exists=function(e,t){return typeof t==`function`?n.exists(e,t):new Promise(t=>n.exists(e,t))},e.read=function(e,t,r,i,a,o){return typeof o==`function`?n.read(e,t,r,i,a,o):new Promise((o,s)=>{n.read(e,t,r,i,a,(e,t,n)=>{if(e)return s(e);o({bytesRead:t,buffer:n})})})},e.write=function(e,t,...r){return typeof r[r.length-1]==`function`?n.write(e,t,...r):new Promise((i,a)=>{n.write(e,t,...r,(e,t,n)=>{if(e)return a(e);i({bytesWritten:t,buffer:n})})})},e.readv=function(e,t,...r){return typeof r[r.length-1]==`function`?n.readv(e,t,...r):new Promise((i,a)=>{n.readv(e,t,...r,(e,t,n)=>{if(e)return a(e);i({bytesRead:t,buffers:n})})})},e.writev=function(e,t,...r){return typeof r[r.length-1]==`function`?n.writev(e,t,...r):new Promise((i,a)=>{n.writev(e,t,...r,(e,t,n)=>{if(e)return a(e);i({bytesWritten:t,buffers:n})})})},typeof n.realpath.native==`function`?e.realpath.native=t(n.realpath.native):process.emitWarning(`fs.realpath.native is not a function. Is fs being monkey-patched?`,`Warning`,`fs-extra-WARN0003`)})),me=R(((e,t)=>{let n=B(`path`);t.exports.checkPath=function(e){if(process.platform===`win32`&&/[<>:"|?*]/.test(e.replace(n.parse(e).root,``))){let t=Error(`Path contains invalid characters: ${e}`);throw t.code=`EINVAL`,t}}})),he=R(((e,t)=>{let n=U(),{checkPath:r}=me(),i=e=>typeof e==`number`?e:{mode:511,...e}.mode;t.exports.makeDir=async(e,t)=>(r(e),n.mkdir(e,{mode:i(t),recursive:!0})),t.exports.makeDirSync=(e,t)=>(r(e),n.mkdirSync(e,{mode:i(t),recursive:!0}))})),W=R(((e,t)=>{let n=V().fromPromise,{makeDir:r,makeDirSync:i}=he(),a=n(r);t.exports={mkdirs:a,mkdirsSync:i,mkdirp:a,mkdirpSync:i,ensureDir:a,ensureDirSync:i}})),ge=R(((e,t)=>{let n=V().fromPromise,r=U();function i(e){return r.access(e).then(()=>!0).catch(()=>!1)}t.exports={pathExists:n(i),pathExistsSync:r.existsSync}})),_e=R(((e,t)=>{let n=U(),r=V().fromPromise;async function i(e,t,r){let i=await n.open(e,`r+`),a=null;try{await n.futimes(i,t,r)}finally{try{await n.close(i)}catch(e){a=e}}if(a)throw a}function a(e,t,r){let i=n.openSync(e,`r+`);return n.futimesSync(i,t,r),n.closeSync(i)}t.exports={utimesMillis:r(i),utimesMillisSync:a}})),ve=R(((e,t)=>{let n=U(),r=B(`path`),i=V().fromPromise;function a(e,t,r){let i=r.dereference?e=>n.stat(e,{bigint:!0}):e=>n.lstat(e,{bigint:!0});return Promise.all([i(e),i(t).catch(e=>{if(e.code===`ENOENT`)return null;throw e})]).then(([e,t])=>({srcStat:e,destStat:t}))}function o(e,t,r){let i,a=r.dereference?e=>n.statSync(e,{bigint:!0}):e=>n.lstatSync(e,{bigint:!0}),o=a(e);try{i=a(t)}catch(e){if(e.code===`ENOENT`)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:i}}async function s(e,t,n,i){let{srcStat:o,destStat:s}=await a(e,t,i);if(s){if(d(o,s)){let i=r.basename(e),a=r.basename(t);if(n===`move`&&i!==a&&i.toLowerCase()===a.toLowerCase())return{srcStat:o,destStat:s,isChangingCase:!0};throw Error(`Source and destination must not be the same.`)}if(o.isDirectory()&&!s.isDirectory())throw Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!o.isDirectory()&&s.isDirectory())throw Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(o.isDirectory()&&f(e,t))throw Error(p(e,t,n));return{srcStat:o,destStat:s}}function c(e,t,n,i){let{srcStat:a,destStat:s}=o(e,t,i);if(s){if(d(a,s)){let i=r.basename(e),o=r.basename(t);if(n===`move`&&i!==o&&i.toLowerCase()===o.toLowerCase())return{srcStat:a,destStat:s,isChangingCase:!0};throw Error(`Source and destination must not be the same.`)}if(a.isDirectory()&&!s.isDirectory())throw Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!a.isDirectory()&&s.isDirectory())throw Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(a.isDirectory()&&f(e,t))throw Error(p(e,t,n));return{srcStat:a,destStat:s}}async function l(e,t,i,a){let o=r.resolve(r.dirname(e)),s=r.resolve(r.dirname(i));if(s===o||s===r.parse(s).root)return;let c;try{c=await n.stat(s,{bigint:!0})}catch(e){if(e.code===`ENOENT`)return;throw e}if(d(t,c))throw Error(p(e,i,a));return l(e,t,s,a)}function u(e,t,i,a){let o=r.resolve(r.dirname(e)),s=r.resolve(r.dirname(i));if(s===o||s===r.parse(s).root)return;let c;try{c=n.statSync(s,{bigint:!0})}catch(e){if(e.code===`ENOENT`)return;throw e}if(d(t,c))throw Error(p(e,i,a));return u(e,t,s,a)}function d(e,t){return t.ino!==void 0&&t.dev!==void 0&&t.ino===e.ino&&t.dev===e.dev}function f(e,t){let n=r.resolve(e).split(r.sep).filter(e=>e),i=r.resolve(t).split(r.sep).filter(e=>e);return n.every((e,t)=>i[t]===e)}function p(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}t.exports={checkPaths:i(s),checkPathsSync:c,checkParentPaths:i(l),checkParentPathsSync:u,isSrcSubdir:f,areIdentical:d}})),ye=R(((e,t)=>{async function n(e,t){let n=[];for await(let r of e)n.push(t(r).then(()=>null,e=>e??Error(`unknown error`)));await Promise.all(n.map(e=>e.then(e=>{if(e!==null)throw e})))}t.exports={asyncIteratorConcurrentProcess:n}})),be=R(((e,t)=>{let n=U(),r=B(`path`),{mkdirs:i}=W(),{pathExists:a}=ge(),{utimesMillis:o}=_e(),s=ve(),{asyncIteratorConcurrentProcess:c}=ye();async function l(e,t,n={}){typeof n==`function`&&(n={filter:n}),n.clobber=`clobber`in n?!!n.clobber:!0,n.overwrite=`overwrite`in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&process.arch===`ia32`&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
3
3
|
|
|
4
4
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,`Warning`,`fs-extra-WARN0001`);let{srcStat:o,destStat:c}=await s.checkPaths(e,t,`copy`,n);if(await s.checkParentPaths(e,o,t,`copy`),!await u(e,t,n))return;let l=r.dirname(t);await a(l)||await i(l),await d(c,e,t,n)}async function u(e,t,n){return n.filter?n.filter(e,t):!0}async function d(e,t,r,i){let a=await(i.dereference?n.stat:n.lstat)(t);if(a.isDirectory())return g(a,e,t,r,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return f(a,e,t,r,i);if(a.isSymbolicLink())return _(e,t,r,i);throw a.isSocket()?Error(`Cannot copy a socket file: ${t}`):a.isFIFO()?Error(`Cannot copy a FIFO pipe: ${t}`):Error(`Unknown file: ${t}`)}async function f(e,t,r,i,a){if(!t)return p(e,r,i,a);if(a.overwrite)return await n.unlink(i),p(e,r,i,a);if(a.errorOnExist)throw Error(`'${i}' already exists`)}async function p(e,t,r,i){if(await n.copyFile(t,r),i.preserveTimestamps){m(e.mode)&&await h(r,e.mode);let i=await n.stat(t);await o(r,i.atime,i.mtime)}return n.chmod(r,e.mode)}function m(e){return(e&128)==0}function h(e,t){return n.chmod(e,t|128)}async function g(e,t,i,a,o){t||await n.mkdir(a),await c(await n.opendir(i),async e=>{let t=r.join(i,e.name),n=r.join(a,e.name);if(await u(t,n,o)){let{destStat:e}=await s.checkPaths(t,n,`copy`,o);await d(e,t,n,o)}}),t||await n.chmod(a,e.mode)}async function _(e,t,i,a){let o=await n.readlink(t);if(a.dereference&&(o=r.resolve(process.cwd(),o)),!e)return n.symlink(o,i);let c=null;try{c=await n.readlink(i)}catch(e){if(e.code===`EINVAL`||e.code===`UNKNOWN`)return n.symlink(o,i);throw e}if(a.dereference&&(c=r.resolve(process.cwd(),c)),o!==c){if(s.isSrcSubdir(o,c))throw Error(`Cannot copy '${o}' to a subdirectory of itself, '${c}'.`);if(s.isSrcSubdir(c,o))throw Error(`Cannot overwrite '${c}' with '${o}'.`)}return await n.unlink(i),n.symlink(o,i)}t.exports=l})),xe=R(((e,t)=>{let n=H(),r=B(`path`),i=W().mkdirsSync,a=_e().utimesMillisSync,o=ve();function s(e,t,a){typeof a==`function`&&(a={filter:a}),a||={},a.clobber=`clobber`in a?!!a.clobber:!0,a.overwrite=`overwrite`in a?!!a.overwrite:a.clobber,a.preserveTimestamps&&process.arch===`ia32`&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
@@ -10,11 +10,29 @@ GFS4: `),console.error(e)}),n[s]||(u(n,global[s]||[]),n.close=(function(e){funct
|
|
|
10
10
|
`)})}this.examples.length>0&&a.push({title:`Examples`,body:this.examples.map(t=>typeof t==`function`?t(e):t).join(`
|
|
11
11
|
`)}),i&&(a=i(a)||a),console.info(a.map(e=>e.title?`${e.title}:\n${e.body}`:e.body).join(`
|
|
12
12
|
|
|
13
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.info(`${e}/${t} ${at}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new nt(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new nt(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new nt(`option \`${t.rawName}\` value is missing`)}}}checkUnusedArgs(){let e=this.args.some(e=>e.variadic)?1/0:this.args.length;if(e<this.cli.args.length)throw new nt(`Unused args: ${this.cli.args.slice(e).map(e=>`\`${e}\``).join(`, `)}`)}},st=class extends ot{constructor(e){super(`@@global@@`,``,{},e)}},ct=class extends EventTarget{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new st(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new ot(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e,{run:t=!0}={}){if(!e){if(!it)throw Error(`No argv provided and runtime process argv is not available.`);e=it}this.rawArgs=e,this.name||=e[1]?et(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e={...r,args:r.args.slice(1)};this.setParsedInfo(e,t,i),this.dispatchEvent(new CustomEvent(`command:${i}`,{detail:t}))}}if(n){for(let t of this.commands)if(t.isDefaultCommand){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.dispatchEvent(new CustomEvent(`command:!`,{detail:t}))}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.dispatchEvent(new CustomEvent(`command:*`,{detail:this.args[0]})),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=Je(n),i=[],a=e.indexOf(`--`);a!==-1&&(i=e.slice(a+1),e=e.slice(0,a));let o=Ge(e,r);o=Object.keys(o).reduce((e,t)=>({...e,[tt(t)]:o[t]}),{_:[]});let s=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let e of n){if(!l&&e.config.default!==void 0)for(let t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&u[e.name]===void 0&&(u[e.name]=Object.create(null),u[e.name].shouldTransform=!0,u[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(o))e!==`_`&&(Qe(c,e.split(`.`),o[e]),$e(c,u));return{args:s,options:c}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs(),n.checkUnusedArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const lt=(e=``)=>new ct(e);function ut(e){switch(e){case`strict`:return`strict`;case`relaxed`:return`relaxed`;case`off`:return`off`;default:throw Error(`Invalid value for --ssl: ${e}. Expected one of: strict, relaxed, off.`)}}function q(e){return Array.isArray(e)?e[e.length-1]:e}function dt(e){if(e===`true`)return`latest`;if(e!==`undefined`)return e}function ft(e,t){let n=
|
|
13
|
+
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.info(`${e}/${t} ${at}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new nt(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new nt(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new nt(`option \`${t.rawName}\` value is missing`)}}}checkUnusedArgs(){let e=this.args.some(e=>e.variadic)?1/0:this.args.length;if(e<this.cli.args.length)throw new nt(`Unused args: ${this.cli.args.slice(e).map(e=>`\`${e}\``).join(`, `)}`)}},st=class extends ot{constructor(e){super(`@@global@@`,``,{},e)}},ct=class extends EventTarget{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new st(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new ot(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e,{run:t=!0}={}){if(!e){if(!it)throw Error(`No argv provided and runtime process argv is not available.`);e=it}this.rawArgs=e,this.name||=e[1]?et(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e={...r,args:r.args.slice(1)};this.setParsedInfo(e,t,i),this.dispatchEvent(new CustomEvent(`command:${i}`,{detail:t}))}}if(n){for(let t of this.commands)if(t.isDefaultCommand){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.dispatchEvent(new CustomEvent(`command:!`,{detail:t}))}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.dispatchEvent(new CustomEvent(`command:*`,{detail:this.args[0]})),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=Je(n),i=[],a=e.indexOf(`--`);a!==-1&&(i=e.slice(a+1),e=e.slice(0,a));let o=Ge(e,r);o=Object.keys(o).reduce((e,t)=>({...e,[tt(t)]:o[t]}),{_:[]});let s=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let e of n){if(!l&&e.config.default!==void 0)for(let t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&u[e.name]===void 0&&(u[e.name]=Object.create(null),u[e.name].shouldTransform=!0,u[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(o))e!==`_`&&(Qe(c,e.split(`.`),o[e]),$e(c,u));return{args:s,options:c}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs(),n.checkUnusedArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const lt=(e=``)=>new ct(e);function ut(e){switch(e){case`strict`:return`strict`;case`relaxed`:return`relaxed`;case`off`:return`off`;default:throw Error(`Invalid value for --ssl: ${e}. Expected one of: strict, relaxed, off.`)}}function q(e){return Array.isArray(e)?e[e.length-1]:e}function dt(e){if(e===`true`)return`latest`;if(e!==`undefined`)return e}function ft(e){return e===`undefined`?void 0:e}function pt(e,t){let n=_t(t);return{config:q(e.config),force:q(e.force)??!1,ui:q(e.ui),smart:n.length>0?!0:q(e.smart),update:dt(q(e.update)),ssl:ut(q(e.ssl)),notifications:q(e.notifications),paths:n}}function mt(e,t){let n=_t(t);return{config:q(e.config),force:q(e.force)??!1,rerun:q(e.rerun)??!1,skill:q(e.skill)??!1,snapshots:q(e.snapshots)??!1,smart:q(e.smart),test:ft(q(e.test)),update:dt(q(e.update)),ssl:ut(q(e.ssl)),paths:n}}function ht(e,t){return{config:q(e.config),inspections:vt(t),test:ft(q(e.test))}}function gt(e){return{all:q(e?.all)??!1,config:q(e?.config)}}function _t(e){return(Array.isArray(e)?e:[]).filter(e=>e!==``&&!e.startsWith(`--`))}function vt(e){return(Array.isArray(e)?e:[]).filter(e=>e!==``)}function yt(e,t){let n=lt(`wallaby`),r,i=n.command(`[start] [...paths]`,`Start Wallaby`).usage(`[start] [...paths]`).alias(`start`).option(`--config <path>`,`Use config file: https://wallabyjs.com/docs/config/overview.html`).option(`--ui`,`Open browser on startup`,{default:!0}).option(`--smart`,`Use smart (lazy) start to run tests of modified test files only: https://wallabyjs.com/docs/intro/smart-start.html`).option(`--force`,`Start a new Wallaby instance even if one is already running`,{default:!1}).option(`--update [version]`,`Update Wallaby to the latest version before starting, or install and pin the specified version`,{type:[String]}).option(`--ssl <mode>`,`Set SSL mode for downloads: strict, relaxed, or off`,{default:`strict`,type:[String]}).option(`--notifications`,`Notify about license expiration`,{default:!0}).action((e,t,n)=>{r={action:`start`,options:pt(n,e?[e,...t??[]]:t)}});return i.rawName=`[start] [...paths]`,n.command(`run [...paths]`,`Run Wallaby for coding agents`).option(`--config <path>`,`Use config file: https://wallabyjs.com/docs/config/overview.html`).option(`--force`,`Force a new Wallaby instance launch`,{default:!1}).option(`--rerun`,`Trigger a fresh test run`,{default:!1}).option(`--skill`,`Launch Wallaby in skill mode and keep it running after the run finishes`,{default:!1}).option(`--snapshots`,`Update test snapshots during the run`,{default:!1}).option(`--test <name>`,`Run a specific test by its full name`,{type:[String]}).option(`--smart`,`Use smart (lazy) start to run tests of modified test files only: https://wallabyjs.com/docs/intro/smart-start.html`).option(`--update [version]`,`Update Wallaby to the latest version before starting, or install and pin the specified version`,{type:[String]}).option(`--ssl <mode>`,`Set SSL mode for downloads: strict, relaxed, or off`,{default:`strict`,type:[String]}).action((e,t)=>{r={action:`run`,options:mt(t,e)}}),n.command(`inspect [...inspections]`,`Inspect runtime values`).option(`--config <path>`,`Use config file: https://wallabyjs.com/docs/config/overview.html`).option(`--test <name>`,`Prioritize runtime values produced by the specified test`,{type:[String]}).action((e,t)=>{r={action:`inspect`,options:ht(t,e)}}),n.command(`stop`,`Stop Wallaby`).option(`--config <path>`,`Stop Wallaby instances using config file`).option(`--all`,`Stop all Wallaby instances`,{default:!1}).action(e=>{r={action:`stop`,options:gt(e)}}),n.help(),n.version(t),n.parse(e),r}var bt=R(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}else return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
|
|
14
14
|
causes have become circular...`;let o=r(e);return o?(t.add(e),a+`
|
|
15
|
-
caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}else return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),vt=R(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),yt=R(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=_t(),{pinoErrProto:a,pinoErrorSymbols:o}=vt(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),bt=R(((e,t)=>{t.exports=s;let{isErrorLike:n}=_t(),{pinoErrProto:r,pinoErrorSymbols:i}=vt(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),xt=R(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),St=R(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),Ct=R(((e,t)=>{let n=yt(),r=bt(),i=xt(),a=St();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),wt=R(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),Tt=R(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a))if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}else if(typeof a==`object`&&a)if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else d.includes(`*`)?u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s):s?a(e,d):i(e,d,typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n)}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t.has(r)||t.has(`*`)?i[r]=n(e[r],t.get(r)||t.get(`*`)):i[r]=e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),Et=R(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),k=Symbol.for(`pino.serializers`),A=Symbol.for(`pino.formatters`),j=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:k,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:A,hooksSym:j,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),Dt=R(((e,t)=>{let n=Tt(),{redactFmtSym:r,wildcardFirstSym:i}=Et(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),Ot=R(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=s+(process.hrtime.bigint()-c),t=e/o,n=e%o,r=Number(t*1000n+n/1000000n),i=new Date(r);return`,"time":"${i.getUTCFullYear()}-${(i.getUTCMonth()+1).toString().padStart(2,`0`)}-${i.getUTCDate().toString().padStart(2,`0`)}T${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}:${i.getUTCSeconds().toString().padStart(2,`0`)}.${n.toString().padStart(9,`0`)}Z"`}}})),kt=R(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--;break}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),At=R(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),jt=R(((e,t)=>{let n=B(`fs`),r=B(`events`),i=B(`util`).inherits,a=B(`path`),o=At(),s=B(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:k,contentMode:A,mode:j}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=k||!1,this.append=p||!1,this.mode=j,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let M,N;if(A===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,M=()=>n.writeSync(this.fd,this._writingBuf),N=()=>n.write(this.fd,this._writingBuf,this.release);else if(A===void 0||A===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=E,M=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),N=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${A}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(N,100);else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){N();return}try{do{let e=M(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,O(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():O(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||O(this)};function E(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function O(e){if(e.fd===-1){e.once(`ready`,O.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}h.SonicBoom=h,h.default=h,t.exports=h})),Mt=R(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),Nt=R(((e,t)=>{t.exports={name:`thread-stream`,version:`4.0.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^0.2.0`},devDependencies:{"@types/node":`^22.0.0`,"@yao-pkg/pkg":`^6.0.0`,borp:`^0.21.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,husky:`^9.0.6`,neostandard:`^0.12.2`,"pino-elasticsearch":`^8.0.0`,"sonic-boom":`^4.0.1`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'`,"test:ci":`npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'`,"test:yarn":`npm run transpile && borp --pattern 'test/*.test.js'`,transpile:`sh ./test/ts/transpile.sh`,prepare:`husky install`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),Pt=R(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(s):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),Ft=R(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8}})),It=R(((e,t)=>{let{version:n}=Nt(),{EventEmitter:r}=B(`events`),{Worker:i}=B(`worker_threads`),{join:a}=B(`path`),{pathToFileURL:o}=B(`url`),{wait:s}=Pt(),{WRITE_INDEX:c,READ_INDEX:l}=Ft(),u=B(`buffer`),d=B(`assert`),f=Symbol(`kImpl`),p=u.constants.MAX_STRING_LENGTH;var m=class{constructor(e){this._value=e}deref(){return this._value}},h=class{register(){}unregister(){}};let g=process.env.NODE_V8_COVERAGE?h:global.FinalizationRegistry||h,_=process.env.NODE_V8_COVERAGE?m:global.WeakRef||m,v=new g(e=>{e.exited||e.terminate()});function y(e,t){let{filename:r,workerData:s}=t,c=new i((`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||a(__dirname,`lib`,`worker.js`),{...t.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf(`file://`)===0?r:o(r).href,dataBuf:e[f].dataBuf,stateBuf:e[f].stateBuf,workerData:{$context:{threadStreamVersion:n},...s}}});return c.stream=new m(e),c.on(`message`,S),c.on(`exit`,C),v.register(e,c),c}function b(e){d(!e[f].sync),e[f].needDrain&&(e[f].needDrain=!1,e.emit(`drain`))}function x(e){let t=Atomics.load(e[f].state,c),n=e[f].data.length-t;if(n>0){if(e[f].buf.length===0){e[f].flushing=!1,e[f].ending?O(e):e[f].needDrain&&process.nextTick(b,e);return}let t=e[f].buf.slice(0,n),r=Buffer.byteLength(t);r<=n?(e[f].buf=e[f].buf.slice(n),D(e,t,x.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);r>e[f].data.length;)n/=2,t=e[f].buf.slice(0,n),r=Buffer.byteLength(t);e[f].buf=e[f].buf.slice(n),D(e,t,x.bind(null,e))}})}else if(n===0){if(t===0&&e[f].buf.length===0)return;e.flush(()=>{Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l),x(e)})}else E(e,Error(`overwritten`))}function S(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}switch(e.code){case`READY`:this.stream=new _(t),t.flush(()=>{t[f].ready=!0,t.emit(`ready`)});break;case`ERROR`:E(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`WARNING`:process.emitWarning(e.err);break;default:E(t,Error(`this should not happen: `+e.code))}}function C(e){let t=this.stream.deref();t!==void 0&&(v.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,C),E(t,e===0?null:Error(`the worker thread exited`)))}var w=class extends r{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[f]={},this[f].stateBuf=new SharedArrayBuffer(128),this[f].state=new Int32Array(this[f].stateBuf),this[f].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[f].data=Buffer.from(this[f].dataBuf),this[f].sync=e.sync||!1,this[f].ending=!1,this[f].ended=!1,this[f].needDrain=!1,this[f].destroyed=!1,this[f].flushing=!1,this[f].ready=!1,this[f].finished=!1,this[f].errored=null,this[f].closed=!1,this[f].buf=``,this.worker=y(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){if(this[f].destroyed)return T(this,Error(`the worker has exited`)),!1;if(this[f].ending)return T(this,Error(`the worker is ending`)),!1;if(this[f].flushing&&this[f].buf.length+e.length>=p)try{k(this),this[f].flushing=!0}catch(e){return E(this,e),!1}if(this[f].buf+=e,this[f].sync)try{return k(this),!0}catch(e){return E(this,e),!1}return this[f].flushing||(this[f].flushing=!0,setImmediate(x,this)),this[f].needDrain=this[f].data.length-this[f].buf.length-Atomics.load(this[f].state,c)<=0,!this[f].needDrain}end(){this[f].destroyed||(this[f].ending=!0,O(this))}flush(e){if(this[f].destroyed){typeof e==`function`&&process.nextTick(e,Error(`the worker has exited`));return}let t=Atomics.load(this[f].state,c);s(this[f].state,l,t,1/0,(t,n)=>{if(t){E(this,t),process.nextTick(e,t);return}if(n===`not-equal`){this.flush(e);return}process.nextTick(e)})}flushSync(){this[f].destroyed||(k(this),A(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[f].ready}get destroyed(){return this[f].destroyed}get closed(){return this[f].closed}get writable(){return!this[f].destroyed&&!this[f].ending}get writableEnded(){return this[f].ending}get writableFinished(){return this[f].finished}get writableNeedDrain(){return this[f].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[f].errored}};function T(e,t){setImmediate(()=>{e.emit(`error`,t)})}function E(e,t){e[f].destroyed||(e[f].destroyed=!0,t&&(e[f].errored=t,T(e,t)),e.worker.exited?setImmediate(()=>{e[f].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[f].closed=!0,e.emit(`close`)}))}function D(e,t,n){let r=Atomics.load(e[f].state,c),i=Buffer.byteLength(t);return e[f].data.write(t,r),Atomics.store(e[f].state,c,r+i),Atomics.notify(e[f].state,c),n(),!0}function O(e){if(!(e[f].ended||!e[f].ending||e[f].flushing)){e[f].ended=!0;try{e.flushSync();let t=Atomics.load(e[f].state,l);Atomics.store(e[f].state,c,-1),Atomics.notify(e[f].state,c);let n=0;for(;t!==-1;){if(Atomics.wait(e[f].state,l,t,1e3),t=Atomics.load(e[f].state,l),t===-2){E(e,Error(`end() failed`));return}if(++n===10){E(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[f].finished=!0,e.emit(`finish`)})}catch(t){E(e,t)}}}function k(e){let t=()=>{e[f].ending?O(e):e[f].needDrain&&process.nextTick(b,e)};for(e[f].flushing=!1;e[f].buf.length!==0;){let n=Atomics.load(e[f].state,c),r=e[f].data.length-n;if(r===0){A(e),Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);continue}else if(r<0)throw Error(`overwritten`);let i=e[f].buf.slice(0,r),a=Buffer.byteLength(i);if(a<=r)e[f].buf=e[f].buf.slice(r),D(e,i,t);else{for(A(e),Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);a>e[f].buf.length;)r/=2,i=e[f].buf.slice(0,r),a=Buffer.byteLength(i);e[f].buf=e[f].buf.slice(r),D(e,i,t)}}}function A(e){if(e[f].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[f].state,c),n=0;for(;;){let r=Atomics.load(e[f].state,l);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[f].state,l,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}t.exports=w})),Lt=R(((e,t)=>{let{createRequire:n}=B(`module`),{existsSync:r}=B(`node:fs`),i=wt(),{join:a,isAbsolute:o,sep:s}=B(`node:path`),{fileURLToPath:c}=B(`node:url`),l=At(),u=Mt(),d=It();function f(e){u.register(e,v),u.registerBeforeExit(e,y),e.on(`close`,function(){u.unregister(e)})}function p(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function m(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&h(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&h(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function h(e){let t=g(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=c(n)}catch{return!1}return o(n)&&!r(n)}function g(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function _(e,t,n,r,i){if(!n.execArgv&&p()&&B.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let e=m(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:e}})}n={...n,name:i};let a=new d({filename:e,workerData:t,workerOpts:n,sync:r});a.on(`ready`,o),a.on(`close`,function(){process.removeListener(`exit`,s)}),process.on(`exit`,s);function o(){process.removeListener(`exit`,s),a.unref(),n.autoEnd!==!1&&f(a)}function s(){a.closed||(a.flushSync(),l(100),a.end())}return a}function v(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function y(e){e.flushSync()}function b(e){let{pipeline:t,targets:r,levels:c,dedupe:l,worker:u={},caller:d=i(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw Error(`only one of target or targets can be specified`);r?(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.targets=r.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=r.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),c&&(p.levels=c),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let v=r||t?`pino.transport`:g;return _(y(g),p,u,f,v);function y(e){if(e=h[e]||e,o(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return a(__dirname,`..`,`file.js`);let t;for(let r of m)try{t=n(r===`node:repl`?process.cwd()+s:r).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}t.exports=b})),Rt=R(((e,t)=>{let n=B(`node:diagnostics_channel`),r=kt(),{mapHttpRequest:i,mapHttpResponse:a}=Ct(),o=jt(),s=Mt(),{lsCacheSym:c,chindingsSym:l,writeSym:u,serializersSym:d,formatOptsSym:f,endSym:p,stringifiersSym:m,stringifySym:h,stringifySafeSym:g,wildcardFirstSym:_,nestedKeySym:v,formattersSym:y,messageKeySym:b,errorKeySym:x,nestedKeyStrSym:S,msgPrefixSym:C}=Et(),{isMainThread:w}=B(`worker_threads`),T=Lt(),[E]=process.versions.node.split(`.`).map(e=>Number(e)),D=n.tracingChannel(`pino_asJson`),O=E>=25?e=>JSON.stringify(e):j;function k(){}function A(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let o=t;t!==null&&(t.method&&t.headers&&t.socket?t=i(t):typeof t.setHeader==`function`&&(t=a(t)));let s;o===null&&n.length===0?s=[null]:(o=n.shift(),s=n),typeof this[C]==`string`&&o!=null&&(o=this[C]+o),this[u](t,r(o,s,this[f]),e)}else{let i=t===void 0?n.shift():t;typeof this[C]==`string`&&i!=null&&(i=this[C]+i),this[u](null,r(i,n,this[f]),e)}}}function j(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function M(e,t,n,r){if(D.hasSubscribers===!1)return N.call(this,e,t,n,r);let i={instance:this,arguments};return D.traceSync(N,i,this,e,t,n,r)}function N(e,t,n,r){let i=this[h],a=this[g],o=this[m],s=this[p],u=this[l],f=this[d],C=this[y],w=this[b],T=this[x],E=this[c][n]+r;E+=u;let D;C.log&&(e=C.log(e));let k=o[_],A=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){f[t]?D=f[t](D):t===T&&f.err&&(D=f.err(D));let e=o[t]||k;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||O)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=O(t);A+=`,`+n+`:`+D}let j=``;if(t!==void 0){D=f[w]?f[w](t):t;let e=o[w]||k;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),j=`,"`+w+`":`+D;break;case`string`:D=(e||O)(D),j=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),j=`,"`+w+`":`+D}}return this[v]&&A?E+this[S]+A.slice(1)+`}`+j+s:E+A+j+s}function P(e,t){let n,r=e[l],i=e[h],a=e[g],o=e[m],s=o[_],c=e[d],u=e[y].bindings;t=u(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function ee(e){return e.write!==e.constructor.prototype.write}function F(e){let t=new o(e);return t.on(`error`,n),!e.sync&&w&&(s.register(t,te),t.on(`close`,function(){s.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=k,t.end=k,t.flushSync=k,t.destroy=k;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function te(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function ne(e){return function(t,n,r={},i){if(typeof r==`string`)i=F({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=F({dest:i})}else if(r instanceof o||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof o||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=T({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:s}=r;return a===!1&&(r.level=`silent`),s||(r.onChild=k),i||=ee(process.stdout)?process.stdout:F({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function I(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[g])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function re(e,t,n){return{level:e,bindings:t,log:n}}function ie(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}t.exports={noop:k,buildSafeSonicBoom:F,asChindings:P,asJson:M,genLog:A,createArgsNormalizer:ne,stringify:I,buildFormatters:re,normalizeDestFileDescriptor:ie}})),zt=R(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),Bt=R(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=Et(),{noop:l,genLog:u}=Rt(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=zt(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),Vt=R(((e,t)=>{t.exports={version:`10.3.1`}})),Ht=R(((e,t)=>{let{EventEmitter:n}=B(`node:events`),{lsCacheSym:r,levelValSym:i,setLevelSym:a,getLevelSym:o,chindingsSym:s,mixinSym:c,asJsonSym:l,writeSym:u,mixinMergeStrategySym:d,timeSym:f,timeSliceIndexSym:p,streamSym:m,serializersSym:h,formattersSym:g,errorKeySym:_,messageKeySym:v,useOnlyCustomLevelsSym:y,needsMetadataGsym:b,redactFmtSym:x,stringifySym:S,formatOptsSym:C,stringifiersSym:w,msgPrefixSym:T,hooksSym:E}=Et(),{getLevel:D,setLevel:O,isLevelEnabled:k,mappings:A,initialLsCache:j,genLsCache:M,assertNoLevelCollisions:N}=Bt(),{asChindings:P,asJson:ee,buildFormatters:F,stringify:te,noop:ne}=Rt(),{version:I}=Vt(),re=Dt(),ie={constructor:class{},child:oe,bindings:se,setBindings:ce,flush:le,isLevelEnabled:k,version:I,get level(){return this[o]()},set level(e){this[a](e)},get levelVal(){return this[i]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[T]},get[Symbol.toStringTag](){return`Pino`},[r]:j,[u]:R,[l]:ee,[o]:D,[a]:O};Object.setPrototypeOf(ie,n.prototype),t.exports=function(){return Object.create(ie)};let ae=e=>e;function oe(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[h],r=this[g],i=Object.create(this);if(t==null)return i[g].bindings!==ae&&(i[g]=F(r.level,ae,r.log)),i[s]=P(i,e),this.onChild!==ne&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[h]=Object.create(null);for(let e in n)i[h][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var o=0;o<e.length;o++){let t=e[o];i[h][t]=n[t]}for(let e in t.serializers)i[h][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var c=0;c<r.length;c++){let e=r[c];i[h][e]=t.serializers[e]}}else i[h]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[g]=F(e||r.level,n||ae,a||r.log)}else i[g]=F(r.level,ae,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(N(this.levels,t.customLevels),i.levels=A(t.customLevels,i[y]),M(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=re(i.redact,te),n={stringify:e[x]};i[S]=te,i[w]=e,i[C]=n}if(typeof t.msgPrefix==`string`&&(i[T]=(this[T]||``)+t.msgPrefix),i[s]=P(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[a](e)}return this.onChild(i),i}function se(){let e=`{${this[s].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function ce(e){let t=P(this,e);this[s]=t}function L(e,t){return Object.assign(t,e)}function R(e,t,n){let r=this[f](),i=this[c],a=this[_],o=this[v],s=this[d]||L,u,h=this[E].streamWrite;e==null?u={}:e instanceof Error?(u={[a]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(u=s(u,i(u,n,this)));let g=this[l](u,t,n,r),y=this[m];y[b]===!0&&(y.lastLevel=n,y.lastObj=u,y.lastMsg=t,y.lastTime=r.slice(this[p]),y.lastLogger=this),y.write(h?h(g):g)}function le(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[m];typeof t.flush==`function`?t.flush(e||ne):e&&e()}})),Ut=R(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0?!0:t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),Wt=R(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=zt(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),Gt=z(R(((e,t)=>{let n=B(`node:os`),r=Ct(),i=wt(),a=Dt(),o=Ot(),s=Ht(),c=Et(),{configure:l}=Ut(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=Bt(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=zt(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=Rt(),{version:w}=Vt(),{chindingsSym:T,redactFmtSym:E,serializersSym:D,timeSym:O,timeSliceIndexSym:k,streamSym:A,stringifySym:j,stringifySafeSym:M,stringifiersSym:N,setLevelSym:P,endSym:ee,formatOptsSym:F,messageKeySym:te,errorKeySym:ne,nestedKeySym:I,mixinSym:re,levelCompSym:ie,useOnlyCustomLevelsSym:ae,formattersSym:oe,hooksSym:se,nestedKeyStrSym:ce,mixinMergeStrategySym:L,msgPrefixSym:R}=c,{epochTime:le,nullTime:ue}=o,{pid:z}=process,V=n.hostname(),de=r.err,fe=_({level:`info`,levelComparison:g.ASC,levels:h,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:z,hostname:V},serializers:Object.assign(Object.create(null),{err:de}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:le,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),pe=Object.assign(Object.create(null),r);function H(...e){let t={},{opts:n,stream:r}=fe(t,i(),...e);n.level&&typeof n.level==`string`&&h[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:o,crlf:c,serializers:g,timestamp:_,messageKey:y,errorKey:S,nestedKey:w,base:z,name:B,level:V,customLevels:de,levelComparison:pe,mixin:H,mixinMergeStrategy:U,useOnlyCustomLevels:me,formatters:he,hooks:W,depthLimit:ge,edgeLimit:_e,onChild:ve,msgPrefix:ye}=n,be=l({maximumDepth:ge,maximumBreadth:_e}),xe=b(he.level,he.bindings,he.log),Se=x.bind({[M]:be}),Ce=o?a(o,Se):{},we=o?{stringify:Ce[E]}:{stringify:Se},Te=`}`+(c?`\r
|
|
15
|
+
caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}else return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),xt=R(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),St=R(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=bt(),{pinoErrProto:a,pinoErrorSymbols:o}=xt(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),Ct=R(((e,t)=>{t.exports=s;let{isErrorLike:n}=bt(),{pinoErrProto:r,pinoErrorSymbols:i}=xt(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),wt=R(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),Tt=R(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),Et=R(((e,t)=>{let n=St(),r=Ct(),i=wt(),a=Tt();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),Dt=R(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),Ot=R(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a))if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}else if(typeof a==`object`&&a)if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else d.includes(`*`)?u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s):s?a(e,d):i(e,d,typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n)}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t.has(r)||t.has(`*`)?i[r]=n(e[r],t.get(r)||t.get(`*`)):i[r]=e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),kt=R(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),k=Symbol.for(`pino.serializers`),A=Symbol.for(`pino.formatters`),j=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:k,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:A,hooksSym:j,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),At=R(((e,t)=>{let n=Ot(),{redactFmtSym:r,wildcardFirstSym:i}=kt(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),jt=R(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=s+(process.hrtime.bigint()-c),t=e/o,n=e%o,r=Number(t*1000n+n/1000000n),i=new Date(r);return`,"time":"${i.getUTCFullYear()}-${(i.getUTCMonth()+1).toString().padStart(2,`0`)}-${i.getUTCDate().toString().padStart(2,`0`)}T${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}:${i.getUTCSeconds().toString().padStart(2,`0`)}.${n.toString().padStart(9,`0`)}Z"`}}})),Mt=R(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--;break}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),Nt=R(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),Pt=R(((e,t)=>{let n=B(`fs`),r=B(`events`),i=B(`util`).inherits,a=B(`path`),o=Nt(),s=B(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:k,contentMode:A,mode:j}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=k||!1,this.append=p||!1,this.mode=j,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let M,N;if(A===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,M=()=>n.writeSync(this.fd,this._writingBuf),N=()=>n.write(this.fd,this._writingBuf,this.release);else if(A===void 0||A===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=E,M=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),N=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${A}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(N,100);else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){N();return}try{do{let e=M(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,O(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():O(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||O(this)};function E(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function O(e){if(e.fd===-1){e.once(`ready`,O.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}h.SonicBoom=h,h.default=h,t.exports=h})),Ft=R(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),It=R(((e,t)=>{t.exports={name:`thread-stream`,version:`4.0.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^0.2.0`},devDependencies:{"@types/node":`^22.0.0`,"@yao-pkg/pkg":`^6.0.0`,borp:`^0.21.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,husky:`^9.0.6`,neostandard:`^0.12.2`,"pino-elasticsearch":`^8.0.0`,"sonic-boom":`^4.0.1`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'`,"test:ci":`npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'`,"test:yarn":`npm run transpile && borp --pattern 'test/*.test.js'`,transpile:`sh ./test/ts/transpile.sh`,prepare:`husky install`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),Lt=R(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(s):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),Rt=R(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8}})),zt=R(((e,t)=>{let{version:n}=It(),{EventEmitter:r}=B(`events`),{Worker:i}=B(`worker_threads`),{join:a}=B(`path`),{pathToFileURL:o}=B(`url`),{wait:s}=Lt(),{WRITE_INDEX:c,READ_INDEX:l}=Rt(),u=B(`buffer`),d=B(`assert`),f=Symbol(`kImpl`),p=u.constants.MAX_STRING_LENGTH;var m=class{constructor(e){this._value=e}deref(){return this._value}},h=class{register(){}unregister(){}};let g=process.env.NODE_V8_COVERAGE?h:global.FinalizationRegistry||h,_=process.env.NODE_V8_COVERAGE?m:global.WeakRef||m,v=new g(e=>{e.exited||e.terminate()});function y(e,t){let{filename:r,workerData:s}=t,c=new i((`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||a(__dirname,`lib`,`worker.js`),{...t.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf(`file://`)===0?r:o(r).href,dataBuf:e[f].dataBuf,stateBuf:e[f].stateBuf,workerData:{$context:{threadStreamVersion:n},...s}}});return c.stream=new m(e),c.on(`message`,S),c.on(`exit`,C),v.register(e,c),c}function b(e){d(!e[f].sync),e[f].needDrain&&(e[f].needDrain=!1,e.emit(`drain`))}function x(e){let t=Atomics.load(e[f].state,c),n=e[f].data.length-t;if(n>0){if(e[f].buf.length===0){e[f].flushing=!1,e[f].ending?O(e):e[f].needDrain&&process.nextTick(b,e);return}let t=e[f].buf.slice(0,n),r=Buffer.byteLength(t);r<=n?(e[f].buf=e[f].buf.slice(n),D(e,t,x.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);r>e[f].data.length;)n/=2,t=e[f].buf.slice(0,n),r=Buffer.byteLength(t);e[f].buf=e[f].buf.slice(n),D(e,t,x.bind(null,e))}})}else if(n===0){if(t===0&&e[f].buf.length===0)return;e.flush(()=>{Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l),x(e)})}else E(e,Error(`overwritten`))}function S(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}switch(e.code){case`READY`:this.stream=new _(t),t.flush(()=>{t[f].ready=!0,t.emit(`ready`)});break;case`ERROR`:E(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`WARNING`:process.emitWarning(e.err);break;default:E(t,Error(`this should not happen: `+e.code))}}function C(e){let t=this.stream.deref();t!==void 0&&(v.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,C),E(t,e===0?null:Error(`the worker thread exited`)))}var w=class extends r{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[f]={},this[f].stateBuf=new SharedArrayBuffer(128),this[f].state=new Int32Array(this[f].stateBuf),this[f].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[f].data=Buffer.from(this[f].dataBuf),this[f].sync=e.sync||!1,this[f].ending=!1,this[f].ended=!1,this[f].needDrain=!1,this[f].destroyed=!1,this[f].flushing=!1,this[f].ready=!1,this[f].finished=!1,this[f].errored=null,this[f].closed=!1,this[f].buf=``,this.worker=y(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){if(this[f].destroyed)return T(this,Error(`the worker has exited`)),!1;if(this[f].ending)return T(this,Error(`the worker is ending`)),!1;if(this[f].flushing&&this[f].buf.length+e.length>=p)try{k(this),this[f].flushing=!0}catch(e){return E(this,e),!1}if(this[f].buf+=e,this[f].sync)try{return k(this),!0}catch(e){return E(this,e),!1}return this[f].flushing||(this[f].flushing=!0,setImmediate(x,this)),this[f].needDrain=this[f].data.length-this[f].buf.length-Atomics.load(this[f].state,c)<=0,!this[f].needDrain}end(){this[f].destroyed||(this[f].ending=!0,O(this))}flush(e){if(this[f].destroyed){typeof e==`function`&&process.nextTick(e,Error(`the worker has exited`));return}let t=Atomics.load(this[f].state,c);s(this[f].state,l,t,1/0,(t,n)=>{if(t){E(this,t),process.nextTick(e,t);return}if(n===`not-equal`){this.flush(e);return}process.nextTick(e)})}flushSync(){this[f].destroyed||(k(this),A(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[f].ready}get destroyed(){return this[f].destroyed}get closed(){return this[f].closed}get writable(){return!this[f].destroyed&&!this[f].ending}get writableEnded(){return this[f].ending}get writableFinished(){return this[f].finished}get writableNeedDrain(){return this[f].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[f].errored}};function T(e,t){setImmediate(()=>{e.emit(`error`,t)})}function E(e,t){e[f].destroyed||(e[f].destroyed=!0,t&&(e[f].errored=t,T(e,t)),e.worker.exited?setImmediate(()=>{e[f].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[f].closed=!0,e.emit(`close`)}))}function D(e,t,n){let r=Atomics.load(e[f].state,c),i=Buffer.byteLength(t);return e[f].data.write(t,r),Atomics.store(e[f].state,c,r+i),Atomics.notify(e[f].state,c),n(),!0}function O(e){if(!(e[f].ended||!e[f].ending||e[f].flushing)){e[f].ended=!0;try{e.flushSync();let t=Atomics.load(e[f].state,l);Atomics.store(e[f].state,c,-1),Atomics.notify(e[f].state,c);let n=0;for(;t!==-1;){if(Atomics.wait(e[f].state,l,t,1e3),t=Atomics.load(e[f].state,l),t===-2){E(e,Error(`end() failed`));return}if(++n===10){E(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[f].finished=!0,e.emit(`finish`)})}catch(t){E(e,t)}}}function k(e){let t=()=>{e[f].ending?O(e):e[f].needDrain&&process.nextTick(b,e)};for(e[f].flushing=!1;e[f].buf.length!==0;){let n=Atomics.load(e[f].state,c),r=e[f].data.length-n;if(r===0){A(e),Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);continue}else if(r<0)throw Error(`overwritten`);let i=e[f].buf.slice(0,r),a=Buffer.byteLength(i);if(a<=r)e[f].buf=e[f].buf.slice(r),D(e,i,t);else{for(A(e),Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);a>e[f].buf.length;)r/=2,i=e[f].buf.slice(0,r),a=Buffer.byteLength(i);e[f].buf=e[f].buf.slice(r),D(e,i,t)}}}function A(e){if(e[f].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[f].state,c),n=0;for(;;){let r=Atomics.load(e[f].state,l);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[f].state,l,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}t.exports=w})),Bt=R(((e,t)=>{let{createRequire:n}=B(`module`),{existsSync:r}=B(`node:fs`),i=Dt(),{join:a,isAbsolute:o,sep:s}=B(`node:path`),{fileURLToPath:c}=B(`node:url`),l=Nt(),u=Ft(),d=zt();function f(e){u.register(e,v),u.registerBeforeExit(e,y),e.on(`close`,function(){u.unregister(e)})}function p(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function m(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&h(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&h(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function h(e){let t=g(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=c(n)}catch{return!1}return o(n)&&!r(n)}function g(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function _(e,t,n,r,i){if(!n.execArgv&&p()&&B.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let e=m(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:e}})}n={...n,name:i};let a=new d({filename:e,workerData:t,workerOpts:n,sync:r});a.on(`ready`,o),a.on(`close`,function(){process.removeListener(`exit`,s)}),process.on(`exit`,s);function o(){process.removeListener(`exit`,s),a.unref(),n.autoEnd!==!1&&f(a)}function s(){a.closed||(a.flushSync(),l(100),a.end())}return a}function v(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function y(e){e.flushSync()}function b(e){let{pipeline:t,targets:r,levels:c,dedupe:l,worker:u={},caller:d=i(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw Error(`only one of target or targets can be specified`);r?(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.targets=r.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=r.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),c&&(p.levels=c),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let v=r||t?`pino.transport`:g;return _(y(g),p,u,f,v);function y(e){if(e=h[e]||e,o(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return a(__dirname,`..`,`file.js`);let t;for(let r of m)try{t=n(r===`node:repl`?process.cwd()+s:r).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}t.exports=b})),Vt=R(((e,t)=>{let n=B(`node:diagnostics_channel`),r=Mt(),{mapHttpRequest:i,mapHttpResponse:a}=Et(),o=Pt(),s=Ft(),{lsCacheSym:c,chindingsSym:l,writeSym:u,serializersSym:d,formatOptsSym:f,endSym:p,stringifiersSym:m,stringifySym:h,stringifySafeSym:g,wildcardFirstSym:_,nestedKeySym:v,formattersSym:y,messageKeySym:b,errorKeySym:x,nestedKeyStrSym:S,msgPrefixSym:C}=kt(),{isMainThread:w}=B(`worker_threads`),T=Bt(),[E]=process.versions.node.split(`.`).map(e=>Number(e)),D=n.tracingChannel(`pino_asJson`),O=E>=25?e=>JSON.stringify(e):j;function k(){}function A(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let o=t;t!==null&&(t.method&&t.headers&&t.socket?t=i(t):typeof t.setHeader==`function`&&(t=a(t)));let s;o===null&&n.length===0?s=[null]:(o=n.shift(),s=n),typeof this[C]==`string`&&o!=null&&(o=this[C]+o),this[u](t,r(o,s,this[f]),e)}else{let i=t===void 0?n.shift():t;typeof this[C]==`string`&&i!=null&&(i=this[C]+i),this[u](null,r(i,n,this[f]),e)}}}function j(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function M(e,t,n,r){if(D.hasSubscribers===!1)return N.call(this,e,t,n,r);let i={instance:this,arguments};return D.traceSync(N,i,this,e,t,n,r)}function N(e,t,n,r){let i=this[h],a=this[g],o=this[m],s=this[p],u=this[l],f=this[d],C=this[y],w=this[b],T=this[x],E=this[c][n]+r;E+=u;let D;C.log&&(e=C.log(e));let k=o[_],A=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){f[t]?D=f[t](D):t===T&&f.err&&(D=f.err(D));let e=o[t]||k;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||O)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=O(t);A+=`,`+n+`:`+D}let j=``;if(t!==void 0){D=f[w]?f[w](t):t;let e=o[w]||k;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),j=`,"`+w+`":`+D;break;case`string`:D=(e||O)(D),j=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),j=`,"`+w+`":`+D}}return this[v]&&A?E+this[S]+A.slice(1)+`}`+j+s:E+A+j+s}function P(e,t){let n,r=e[l],i=e[h],a=e[g],o=e[m],s=o[_],c=e[d],u=e[y].bindings;t=u(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function ee(e){return e.write!==e.constructor.prototype.write}function F(e){let t=new o(e);return t.on(`error`,n),!e.sync&&w&&(s.register(t,te),t.on(`close`,function(){s.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=k,t.end=k,t.flushSync=k,t.destroy=k;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function te(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function ne(e){return function(t,n,r={},i){if(typeof r==`string`)i=F({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=F({dest:i})}else if(r instanceof o||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof o||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=T({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:s}=r;return a===!1&&(r.level=`silent`),s||(r.onChild=k),i||=ee(process.stdout)?process.stdout:F({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function I(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[g])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function re(e,t,n){return{level:e,bindings:t,log:n}}function ie(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}t.exports={noop:k,buildSafeSonicBoom:F,asChindings:P,asJson:M,genLog:A,createArgsNormalizer:ne,stringify:I,buildFormatters:re,normalizeDestFileDescriptor:ie}})),Ht=R(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),Ut=R(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=kt(),{noop:l,genLog:u}=Vt(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=Ht(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),Wt=R(((e,t)=>{t.exports={version:`10.3.1`}})),Gt=R(((e,t)=>{let{EventEmitter:n}=B(`node:events`),{lsCacheSym:r,levelValSym:i,setLevelSym:a,getLevelSym:o,chindingsSym:s,mixinSym:c,asJsonSym:l,writeSym:u,mixinMergeStrategySym:d,timeSym:f,timeSliceIndexSym:p,streamSym:m,serializersSym:h,formattersSym:g,errorKeySym:_,messageKeySym:v,useOnlyCustomLevelsSym:y,needsMetadataGsym:b,redactFmtSym:x,stringifySym:S,formatOptsSym:C,stringifiersSym:w,msgPrefixSym:T,hooksSym:E}=kt(),{getLevel:D,setLevel:O,isLevelEnabled:k,mappings:A,initialLsCache:j,genLsCache:M,assertNoLevelCollisions:N}=Ut(),{asChindings:P,asJson:ee,buildFormatters:F,stringify:te,noop:ne}=Vt(),{version:I}=Wt(),re=At(),ie={constructor:class{},child:oe,bindings:se,setBindings:ce,flush:le,isLevelEnabled:k,version:I,get level(){return this[o]()},set level(e){this[a](e)},get levelVal(){return this[i]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[T]},get[Symbol.toStringTag](){return`Pino`},[r]:j,[u]:R,[l]:ee,[o]:D,[a]:O};Object.setPrototypeOf(ie,n.prototype),t.exports=function(){return Object.create(ie)};let ae=e=>e;function oe(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[h],r=this[g],i=Object.create(this);if(t==null)return i[g].bindings!==ae&&(i[g]=F(r.level,ae,r.log)),i[s]=P(i,e),this.onChild!==ne&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[h]=Object.create(null);for(let e in n)i[h][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var o=0;o<e.length;o++){let t=e[o];i[h][t]=n[t]}for(let e in t.serializers)i[h][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var c=0;c<r.length;c++){let e=r[c];i[h][e]=t.serializers[e]}}else i[h]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[g]=F(e||r.level,n||ae,a||r.log)}else i[g]=F(r.level,ae,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(N(this.levels,t.customLevels),i.levels=A(t.customLevels,i[y]),M(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=re(i.redact,te),n={stringify:e[x]};i[S]=te,i[w]=e,i[C]=n}if(typeof t.msgPrefix==`string`&&(i[T]=(this[T]||``)+t.msgPrefix),i[s]=P(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[a](e)}return this.onChild(i),i}function se(){let e=`{${this[s].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function ce(e){let t=P(this,e);this[s]=t}function L(e,t){return Object.assign(t,e)}function R(e,t,n){let r=this[f](),i=this[c],a=this[_],o=this[v],s=this[d]||L,u,h=this[E].streamWrite;e==null?u={}:e instanceof Error?(u={[a]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(u=s(u,i(u,n,this)));let g=this[l](u,t,n,r),y=this[m];y[b]===!0&&(y.lastLevel=n,y.lastObj=u,y.lastMsg=t,y.lastTime=r.slice(this[p]),y.lastLogger=this),y.write(h?h(g):g)}function le(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[m];typeof t.flush==`function`?t.flush(e||ne):e&&e()}})),Kt=R(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0?!0:t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),qt=R(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=Ht(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),Jt=z(R(((e,t)=>{let n=B(`node:os`),r=Et(),i=Dt(),a=At(),o=jt(),s=Gt(),c=kt(),{configure:l}=Kt(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=Ut(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=Ht(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=Vt(),{version:w}=Wt(),{chindingsSym:T,redactFmtSym:E,serializersSym:D,timeSym:O,timeSliceIndexSym:k,streamSym:A,stringifySym:j,stringifySafeSym:M,stringifiersSym:N,setLevelSym:P,endSym:ee,formatOptsSym:F,messageKeySym:te,errorKeySym:ne,nestedKeySym:I,mixinSym:re,levelCompSym:ie,useOnlyCustomLevelsSym:ae,formattersSym:oe,hooksSym:se,nestedKeyStrSym:ce,mixinMergeStrategySym:L,msgPrefixSym:R}=c,{epochTime:le,nullTime:ue}=o,{pid:z}=process,V=n.hostname(),de=r.err,fe=_({level:`info`,levelComparison:g.ASC,levels:h,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:z,hostname:V},serializers:Object.assign(Object.create(null),{err:de}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:le,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),pe=Object.assign(Object.create(null),r);function H(...e){let t={},{opts:n,stream:r}=fe(t,i(),...e);n.level&&typeof n.level==`string`&&h[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:o,crlf:c,serializers:g,timestamp:_,messageKey:y,errorKey:S,nestedKey:w,base:z,name:B,level:V,customLevels:de,levelComparison:pe,mixin:H,mixinMergeStrategy:U,useOnlyCustomLevels:me,formatters:he,hooks:W,depthLimit:ge,edgeLimit:_e,onChild:ve,msgPrefix:ye}=n,be=l({maximumDepth:ge,maximumBreadth:_e}),xe=b(he.level,he.bindings,he.log),Se=x.bind({[M]:be}),Ce=o?a(o,Se):{},we=o?{stringify:Ce[E]}:{stringify:Se},Te=`}`+(c?`\r
|
|
16
16
|
`:`
|
|
17
|
-
`),Ee=v.bind(null,{[T]:``,[D]:g,[N]:Ce,[j]:x,[M]:be,[oe]:xe}),De=``;z!==null&&(De=Ee(B===void 0?z:Object.assign({},z,{name:B})));let Oe=_ instanceof Function?_:_?le:ue,ke=Oe().indexOf(`:`)+1;if(me&&!de)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(H&&typeof H!=`function`)throw Error(`Unknown mixin type "${typeof H}" - expected "function"`);if(ye&&typeof ye!=`string`)throw Error(`Unknown msgPrefix type "${typeof ye}" - expected "string"`);u(V,de,me);let Ae=d(de,me);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:Ae,messageKey:y,errorKey:S}}),m(pe);let je=p(pe);return Object.assign(t,{levels:Ae,[ie]:je,[ae]:me,[A]:r,[O]:Oe,[k]:ke,[j]:x,[M]:be,[N]:Ce,[ee]:Te,[F]:we,[te]:y,[ne]:S,[I]:w,[ce]:w?`,${JSON.stringify(w)}:{`:``,[D]:g,[re]:H,[L]:U,[T]:De,[oe]:xe,[se]:W,silent:C,onChild:ve,[R]:ye}),Object.setPrototypeOf(t,s()),f(t),t[P](V),t}t.exports=H,t.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=S(e.dest||process.stdout.fd),y(e)):y({dest:S(e),minLength:0}),t.exports.transport=Lt(),t.exports.multistream=Wt(),t.exports.levels=d(),t.exports.stdSerializers=pe,t.exports.stdTimeFunctions=Object.assign({},o),t.exports.symbols=c,t.exports.version=w,t.exports.default=H,t.exports.pino=H}))(),1),Kt=class extends D{_filePath;_fileDir;_fileExt;_fileStem;_fileBaseName;_options;_label;_size=0;_stream;_init;constructor(e,t={}){if(super(),!e)throw Error(`A log filename is required`);let r=a(e);this._filePath=e,this._fileDir=r.dir,this._fileExt=r.ext,this._fileStem=r.name,this._fileBaseName=n(e),this._options={size:t.size??0,backups:t.backups??1,flags:t.flags??`a`,mode:t.mode??384,encoding:t.encoding??`utf8`},this._label=this._format(new Date),this._init=this._initialize()}_write(e,t,n){this._writeChunk(e,t).then(()=>n(),n)}_final(e){this._close().then(()=>e(),e)}async _initialize(){await b(this._fileDir,{recursive:!0});let e=await Yt(this._filePath);if(e){let t=this._format(e.mtime),n=t!==this._label,r=this._options.size>0&&e.size>=this._options.size;n||r?await this._rotateHotFile(t):this._size=e.size}this._stream=this._open()}async _writeChunk(e,t){await this._init;let n=Buffer.isBuffer(e)?e.byteLength:Buffer.byteLength(e,t);await this._rotateIfNeeded(),await new Promise((n,r)=>{this._stream.write(e,t,e=>{e?r(e):n()})}),this._size+=n}_open(){let e=f(this._filePath,{flags:this._options.flags,mode:this._options.mode,encoding:this._options.encoding});return e.on(`error`,e=>{this.destroy(e)}),e}async _close(){if(await this._init.catch(()=>void 0),!this._stream)return;let e=this._stream;this._stream=void 0,await new Promise((t,n)=>{let r=()=>{e.off(`error`,i),t()},i=t=>{e.off(`close`,r),n(t)};e.once(`close`,r),e.once(`error`,i),e.end()})}async _rotateIfNeeded(){let e=this._format(new Date),t=e!==this._label,n=this._options.size>0&&this._size>=this._options.size;if(!t&&!n)return;await this._close();let r=await Yt(this._filePath);r&&r.size>0&&await this._rotateHotFile(this._label),this._label=e,this._size=0,this._stream=this._open()}async _rotateHotFile(e){if(!await Yt(this._filePath))return;let t=await this._getNextRotatedPath(e);await S(this._filePath,t),await this._pruneBackups()}async _getNextRotatedPath(e){let t=(await this._listRotatedFiles()).filter(t=>t.label===e).reduce((e,t)=>Math.max(e,t.index),0)+1;return i(this._fileDir,this._buildRotatedFileName(e,t))}_buildRotatedFileName(e,t){return this._fileExt?`${this._fileStem}.${e}.${t}${this._fileExt}`:`${this._fileBaseName}.${e}.${t}`}async _pruneBackups(){let e=(await this._listRotatedFiles()).sort((e,t)=>e.label===t.label?t.index-e.index:t.label.localeCompare(e.label)).slice(this._options.backups);await Promise.all(e.map(e=>C(e.path,{force:!0})))}async _listRotatedFiles(){let e=await x(this._fileDir),t=[],n=this._getRotatedFilePattern();for(let r of e){let e=n.exec(r);e?.groups&&t.push({label:e.groups.label,index:Number.parseInt(e.groups.index,10),path:i(this._fileDir,r)})}return t}_getRotatedFilePattern(){return this._fileExt?RegExp(`^${Jt(this._fileStem)}\\.(?<label>.+)\\.(?<index>\\d+)${Jt(this._fileExt)}$`,`u`):RegExp(`^${Jt(this._fileBaseName)}\\.(?<label>.+)\\.(?<index>\\d+)$`,`u`)}_format(e){return`${qt(e.getFullYear(),4)}-${qt(e.getMonth()+1)}-${qt(e.getDate())}`}};function qt(e,t=2){return e.toString().padStart(t,`0`)}function Jt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}async function Yt(e){try{return await w(e)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}let Xt;var Zt=class{_category;_factory;_logger;constructor(e){this._category=e}trace(...e){this._log?.trace(...e)}debug(...e){this._log?.debug(...e)}info(...e){this._log?.info(...e)}warn(...e){this._log?.warn(...e)}error(...e){this._log?.error(...e)}fatal(...e){this._log?.fatal(...e)}get _log(){if(!Xt){this._factory=void 0,this._logger=void 0;return}return(this._factory!==Xt||!this._logger)&&(this._factory=Xt,this._logger=Xt.create(this._category)),this._logger}};function Qt(e){switch(e=e?.toLowerCase(),e){case`trace`:case`debug`:case`info`:case`warn`:case`error`:case`fatal`:case`silent`:return e;default:return`info`}}function $t(e){let t=process.env.WALLABY_CLI_LOG_PATH;function n(){let e=process.env.WALLABY_CLI_LOG_LEVEL;return e?Qt(e):`info`}function r(e,t){let n=Number.parseInt(e??``,10);return Number.isInteger(n)&&n>0?n:t}return{path:e?.path??t??i(u(),`wallaby-cli.log`),level:e?.level??n(),size:e?.size??r(process.env.WALLABY_CLI_LOG_MAX_SIZE,10*1024*1024),backups:e?.backups??r(process.env.WALLABY_CLI_LOG_MAX_BACKUPS,7)}}function en(e){if(Xt)throw Error(`Logger is already initialized`);e=$t(e),G.default.ensureDirSync(r(e.path));let t=new Kt(e.path,{size:e.size,backups:e.backups,flags:`a`,mode:384,encoding:`utf8`});function n(e){process.stderr.write(`[logger] ${e.stack||e.message}\n`)}t.on(`error`,n);function i(e){let t=(t,n)=>{e.fatal({err:t,origin:n},`Uncaught exception`)},n=t=>{e.error({reason:t},`Unhandled promise rejection`)};return process.on(`uncaughtExceptionMonitor`,t),process.on(`unhandledRejection`,n),()=>{process.off(`uncaughtExceptionMonitor`,t),process.off(`unhandledRejection`,n)}}let a=(0,Gt.default)({level:e.level,timestamp:Gt.default.stdTimeFunctions.isoTime,base:{pid:process.pid},errorKey:`error`,formatters:{level(e){return{level:e}}}},t),o=i(a);Xt={create(e){return a.child({category:e})},async close(){o(),t.off(`error`,n),await new Promise((e,n)=>{t.end(t=>{t?n(t):e()})})}},a.debug(`Initialized CLI logger`)}function tn(e){return new Zt(e)}async function nn(){let e=Xt;e&&(Xt=void 0,await e.close())}var J={initialize:en,create:tn,shutdown:nn};const rn=_(import.meta.url),an=process.platform===`win32`,on=un(),sn=an?e=>e.replace(/\\/g,o.sep):e=>e,cn=on?e=>e:e=>e.toLowerCase(),ln=e=>o.normalize(cn(sn(e)));function un(){return an?!1:!p(dn(rn))}function dn(e){return e.replace(/\w/g,e=>{let t=e.toUpperCase();return e===t?e.toLowerCase():t})}const fn=_(new URL(`..`,import.meta.url));var Y={version:JSON.parse(h(i(fn,`package.json`),`utf-8`)).version,paths:{dirs:{package:{bin:i(fn,`bin`)},home:i(l(),`.wallaby`),current:i(l(),`.wallaby`,`cli`)}}},pn=R(((e,t)=>{t.exports=[`|/-\\`,`⠂-–—–-`,`◐◓◑◒`,`◴◷◶◵`,`◰◳◲◱`,`▖▘▝▗`,`■□▪▫`,`▌▀▐▄`,`▉▊▋▌▍▎▏▎▍▌▋▊▉`,`▁▃▄▅▆▇█▇▆▅▄▃`,`←↖↑↗→↘↓↙`,`┤┘┴└├┌┬┐`,`◢◣◤◥`,`.oO°Oo.`,`.oO@*`,[`🌍`,`🌎`,`🌏`],`◡◡ ⊙⊙ ◠◠`,`☱☲☴`,`⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏`,`⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓`,`⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆`,`⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋`,`⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁`,`⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈`,`⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈`,`⢄⢂⢁⡁⡈⡐⡠`,`⢹⢺⢼⣸⣇⡧⡗⡏`,`⣾⣽⣻⢿⡿⣟⣯⣷`,`⠁⠂⠄⡀⢀⠠⠐⠈`,[`🌑`,`🌒`,`🌓`,`🌔`,`🌕`,`🌝`,`🌖`,`🌗`,`🌘`,`🌚`],[`🕛`,`🕐`,`🕑`,`🕒`,`🕓`,`🕔`,`🕕`,`🕖`,`🕗`,`🕘`,`🕙`,`🕚`]]})),mn=R((e=>{var t=B(`readline`),n=0,r=60;function i(e){this.clearLine(this.stream),this.stream.write(e)}var a=function(e){if(!(this instanceof a))return new a(e);typeof e==`string`?e={text:e}:e||={},this.text=e.text||``,this.setSpinnerString(n),this.setSpinnerDelay(r),this.onTick=e.onTick||i,this.stream=e.stream||process.stdout};a.spinners=pn(),a.setDefaultSpinnerString=function(e){return n=e,this},a.setDefaultSpinnerDelay=function(e){return r=e,this},a.prototype.start=function(){if(this.stream===process.stdout&&this.stream.isTTY!==!0)return this;var e=0,t=this,n=function(){var n=t.text.indexOf(`%s`)>-1?t.text.replace(`%s`,t.chars[e]):t.chars[e]+` `+t.text;t.onTick(n),e=++e%t.chars.length};return n(),this.id=setInterval(n,this.delay),this},a.prototype.isSpinning=function(){return this.id!==void 0},a.prototype.setSpinnerDelay=function(e){return this.delay=e,this},a.prototype.setSpinnerString=function(e){let t=s(e,this.spinners);return this.chars=Array.isArray(t)?t:t.split(``),this},a.prototype.setSpinnerTitle=function(e){return this.text=e,this},a.prototype.stop=function(e){return this.isSpinning===!1?this:(clearInterval(this.id),this.id=void 0,e&&this.clearLine(this.stream),this)},a.prototype.clearLine=function(e){return t.clearLine(e,0),t.cursorTo(e,0),this};function o(e){return typeof e==`number`&&e%1==0}function s(e,t){if(!o(e))return e+``;var n=a.spinners.length;return e=e>=n?0:e,e=e<0?n+e:e,a.spinners[e]}e.Spinner=a})),hn=R(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),gn=R(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),_n=R(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=hn(),a=gn();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),vn=R(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),yn=R(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),X=R(((e,t)=>{let n=gn(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=hn(),{safeRe:a,t:o}=_n(),s=vn(),{compareIdentifiers:c}=yn();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),bn=R(((e,t)=>{let n=X();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),xn=R(((e,t)=>{let n=bn();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Sn=R(((e,t)=>{let n=bn();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Cn=R(((e,t)=>{let n=X();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),wn=R(((e,t)=>{let n=bn();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Tn=R(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).major})),En=R(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).minor})),Dn=R(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).patch})),On=R(((e,t)=>{let n=bn();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Z=R(((e,t)=>{let n=X();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),kn=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(t,e,r)})),An=R(((e,t)=>{let n=Z();t.exports=(e,t)=>n(e,t,!0)})),jn=R(((e,t)=>{let n=X();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Mn=R(((e,t)=>{let n=jn();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Nn=R(((e,t)=>{let n=jn();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Pn=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>0})),Fn=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<0})),In=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)===0})),Ln=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)!==0})),Rn=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>=0})),zn=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<=0})),Bn=R(((e,t)=>{let n=In(),r=Ln(),i=Pn(),a=Rn(),o=Fn(),s=zn();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Vn=R(((e,t)=>{let n=X(),r=bn(),{safeRe:i,t:a}=_n();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Hn=R(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Un=R(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,O(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>D(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}};let r=new(Hn()),i=vn(),a=Wn(),o=gn(),s=X(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=_n(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=hn(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=E(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>T(e,t)).join(` `)),T=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},E=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),D=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),O=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),k=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),Wn=R(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=vn(),{safeRe:i,t:a}=_n(),o=Bn(),s=gn(),c=X(),l=Un()})),Gn=R(((e,t)=>{let n=Un();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Kn=R(((e,t)=>{let n=Un();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),qn=R(((e,t)=>{let n=X(),r=Un();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),Jn=R(((e,t)=>{let n=X(),r=Un();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Yn=R(((e,t)=>{let n=X(),r=Un(),i=Pn();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Xn=R(((e,t)=>{let n=Un();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),Zn=R(((e,t)=>{let n=X(),r=Wn(),{ANY:i}=r,a=Un(),o=Gn(),s=Pn(),c=Fn(),l=zn(),u=Rn();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Qn=R(((e,t)=>{let n=Zn();t.exports=(e,t,r)=>n(e,t,`>`,r)})),$n=R(((e,t)=>{let n=Zn();t.exports=(e,t,r)=>n(e,t,`<`,r)})),er=R(((e,t)=>{let n=Un();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),tr=R(((e,t)=>{let n=Gn(),r=Z();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),nr=R(((e,t)=>{let n=Un(),r=Wn(),{ANY:i}=r,a=Gn(),o=Z(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),rr=R(((e,t)=>{let n=_n(),r=hn(),i=X(),a=yn();t.exports={parse:bn(),valid:xn(),clean:Sn(),inc:Cn(),diff:wn(),major:Tn(),minor:En(),patch:Dn(),prerelease:On(),compare:Z(),rcompare:kn(),compareLoose:An(),compareBuild:jn(),sort:Mn(),rsort:Nn(),gt:Pn(),lt:Fn(),eq:In(),neq:Ln(),gte:Rn(),lte:zn(),cmp:Bn(),coerce:Vn(),Comparator:Wn(),Range:Un(),satisfies:Gn(),toComparators:Kn(),maxSatisfying:qn(),minSatisfying:Jn(),minVersion:Yn(),validRange:Xn(),outside:Zn(),gtr:Qn(),ltr:$n(),intersects:er(),simplifyRange:tr(),subset:nr(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}})),ir=mn(),ar=rr();const or=J.create(`downloader`);async function sr(e,t,n,r,i){let a=`This may occur when you are behind proxy.`,o={headers:{"User-Agent":`node `+process.version}};or.debug({name:e,from:t,to:n,size:r,strict:i},`Downloading file`),t.startsWith(`https:`)&&i===!1&&(o.agent=new M({rejectUnauthorized:!1}));let s=await fetch(t,o);if(or.debug({name:e,from:t,to:n,size:r,strict:i,status:s.status},`Received download response`),!s.ok||s.status!==200)throw or.debug({from:t,name:e,status:s.status},`Download failed`),Error(`Error while downloading ${e}, status code: ${s.status}. ${a}`);let c=s.headers.get(`content-length`);if(r&&c&&Number.parseInt(c,10)<r)throw or.debug({name:e,from:t,to:n,size:r,strict:i,length:c},`Download failed size validation`),Error(`Error while downloading ${e}, file is corrupt. ${a}`);let l=await s.arrayBuffer();return await E(n,new Uint8Array(l)),or.debug({name:e,from:t,to:n,size:r,strict:i,bytes:l.byteLength},`Downloaded file`),n}var cr=R((e=>{e.require=function(){var e=B(`fs`);if(process.versions.electron)try{e=B(`original-fs`)}catch{}return e}})),lr=R(((e,t)=>{t.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,FLG_ENC:0,FLG_COMP1:1,FLG_COMP2:2,FLG_DESC:4,FLG_ENH:8,FLG_STR:16,FLG_LNG:1024,FLG_MSK:4096,FILE:0,BUFFER:1,NONE:2,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}})),ur=R(((e,t)=>{t.exports={INVALID_LOC:`Invalid LOC header (bad signature)`,INVALID_CEN:`Invalid CEN header (bad signature)`,INVALID_END:`Invalid END header (bad signature)`,NO_DATA:`Nothing to decompress`,BAD_CRC:`CRC32 checksum failed`,FILE_IN_THE_WAY:`There is a file in the way: %s`,UNKNOWN_METHOD:`Invalid/unsupported compression method`,AVAIL_DATA:`inflate::Available inflate data did not terminate`,INVALID_DISTANCE:`inflate::Invalid literal/length or distance code in fixed or dynamic block`,TO_MANY_CODES:`inflate::Dynamic block code description: too many length or distance codes`,INVALID_REPEAT_LEN:`inflate::Dynamic block code description: repeat more than specified lengths`,INVALID_REPEAT_FIRST:`inflate::Dynamic block code description: repeat lengths with no first length`,INCOMPLETE_CODES:`inflate::Dynamic block code description: code lengths codes incomplete`,INVALID_DYN_DISTANCE:`inflate::Dynamic block code description: invalid distance code lengths`,INVALID_CODES_LEN:`inflate::Dynamic block code description: invalid literal/length code lengths`,INVALID_STORE_BLOCK:`inflate::Stored block length did not match one's complement`,INVALID_BLOCK_TYPE:`inflate::Invalid block type (type == 3)`,CANT_EXTRACT_FILE:`Could not extract the file`,CANT_OVERRIDE:`Target file already exists`,NO_ZIP:`No zip file was loaded`,NO_ENTRY:`Entry doesn't exist`,DIRECTORY_CONTENT_ERROR:`A directory cannot have content`,FILE_NOT_FOUND:`File not found: %s`,NOT_IMPLEMENTED:`Not implemented`,INVALID_FILENAME:`Invalid filename`,INVALID_FORMAT:`Invalid or unsupported zip format. No END header found`}})),dr=R(((e,t)=>{var n=cr().require(),r=B(`path`);n.existsSync=n.existsSync||r.existsSync,t.exports=(function(){var e=[],t=lr(),i=ur(),a=r.sep;function o(e){var t=e.split(a)[0];e.split(a).forEach(function(e){if(!(!e||e.substr(-1,1)===`:`)){t+=a+e;var r;try{r=n.statSync(t)}catch{n.mkdirSync(t)}if(r&&r.isFile())throw i.FILE_IN_THE_WAY.replace(`%s`,t)}})}function s(e,t,i){typeof t==`boolean`&&(i=t,t=void 0);var o=[];return n.readdirSync(e).forEach(function(c){var l=r.join(e,c);n.statSync(l).isDirectory()&&i&&(o=o.concat(s(l,t,i))),(!t||t.test(l))&&o.push(r.normalize(l)+(n.statSync(l).isDirectory()?a:``))}),o}return{makeDir:function(e){o(e)},crc32:function(t){typeof t==`string`&&(t=Buffer.alloc(t.length,t));var n=Buffer.alloc(4);if(!e.length)for(var r=0;r<256;r++){for(var i=r,a=8;--a>=0;)i&1?i=3988292384^i>>>1:i>>>=1;i<0&&(n.writeInt32LE(i,0),i=n.readUInt32LE(0)),e[r]=i}for(var o=0,s=0,c=t.length,l=~o;--c>=0;)l=e[(l^t[s++])&255]^l>>>8;return o=~l,n.writeInt32LE(o&4294967295,0),n.readUInt32LE(0)},methodToString:function(e){switch(e){case t.STORED:return`STORED (`+e+`)`;case t.DEFLATED:return`DEFLATED (`+e+`)`;default:return`UNSUPPORTED (`+e+`)`}},writeFileTo:function(e,t,i,a){if(n.existsSync(e)&&(!i||n.statSync(e).isDirectory()))return!1;var s=r.dirname(e);n.existsSync(s)||o(s);var c;try{c=n.openSync(e,`w`,438)}catch{n.chmodSync(e,438),c=n.openSync(e,`w`,438)}if(c)try{n.writeSync(c,t,0,t.length,0)}catch(e){throw e}finally{n.closeSync(c)}return n.chmodSync(e,a||438),!0},writeFileToAsync:function(e,t,i,a,s){typeof a==`function`&&(s=a,a=void 0),n.exists(e,function(c){if(c&&!i)return s(!1);n.stat(e,function(i,l){if(c&&l.isDirectory())return s(!1);var u=r.dirname(e);n.exists(u,function(r){r||o(u),n.open(e,`w`,438,function(r,i){r?n.chmod(e,438,function(){n.open(e,`w`,438,function(r,i){n.write(i,t,0,t.length,0,function(){n.close(i,function(){n.chmod(e,a||438,function(){s(!0)})})})})}):i?n.write(i,t,0,t.length,0,function(){n.close(i,function(){n.chmod(e,a||438,function(){s(!0)})})}):n.chmod(e,a||438,function(){s(!0)})})})})})},findFiles:function(e){return s(e,!0)},getAttributes:function(e){},setAttributes:function(e){},toBuffer:function(e){return Buffer.isBuffer(e)?e:e.length===0?Buffer.alloc(0):Buffer.alloc(e.length,e,`utf8`)},Constants:t,Errors:i}})()})),fr=R(((e,t)=>{var n=cr().require(),r=B(`path`);n.existsSync=n.existsSync||r.existsSync,t.exports=function(e){var t=e||``,i=o(),a=null;function o(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return t&&n.existsSync(t)?(a=n.statSync(t),i.directory=a.isDirectory(),i.mtime=a.mtime,i.atime=a.atime,i.executable=!!(1&parseInt((a.mode&511).toString(8)[0])),i.readonly=!!(2&parseInt((a.mode&511).toString(8)[0])),i.hidden=r.basename(t)[0]===`.`):console.warn(`Invalid path: `+t),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(e){},encodeAttributes:function(e){},toString:function(){return`{
|
|
17
|
+
`),Ee=v.bind(null,{[T]:``,[D]:g,[N]:Ce,[j]:x,[M]:be,[oe]:xe}),De=``;z!==null&&(De=Ee(B===void 0?z:Object.assign({},z,{name:B})));let Oe=_ instanceof Function?_:_?le:ue,ke=Oe().indexOf(`:`)+1;if(me&&!de)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(H&&typeof H!=`function`)throw Error(`Unknown mixin type "${typeof H}" - expected "function"`);if(ye&&typeof ye!=`string`)throw Error(`Unknown msgPrefix type "${typeof ye}" - expected "string"`);u(V,de,me);let Ae=d(de,me);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:Ae,messageKey:y,errorKey:S}}),m(pe);let je=p(pe);return Object.assign(t,{levels:Ae,[ie]:je,[ae]:me,[A]:r,[O]:Oe,[k]:ke,[j]:x,[M]:be,[N]:Ce,[ee]:Te,[F]:we,[te]:y,[ne]:S,[I]:w,[ce]:w?`,${JSON.stringify(w)}:{`:``,[D]:g,[re]:H,[L]:U,[T]:De,[oe]:xe,[se]:W,silent:C,onChild:ve,[R]:ye}),Object.setPrototypeOf(t,s()),f(t),t[P](V),t}t.exports=H,t.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=S(e.dest||process.stdout.fd),y(e)):y({dest:S(e),minLength:0}),t.exports.transport=Bt(),t.exports.multistream=qt(),t.exports.levels=d(),t.exports.stdSerializers=pe,t.exports.stdTimeFunctions=Object.assign({},o),t.exports.symbols=c,t.exports.version=w,t.exports.default=H,t.exports.pino=H}))(),1),Yt=class extends D{_filePath;_fileDir;_fileExt;_fileStem;_fileBaseName;_options;_label;_size=0;_stream;_init;constructor(e,t={}){if(super(),!e)throw Error(`A log filename is required`);let r=a(e);this._filePath=e,this._fileDir=r.dir,this._fileExt=r.ext,this._fileStem=r.name,this._fileBaseName=n(e),this._options={size:t.size??0,backups:t.backups??1,flags:t.flags??`a`,mode:t.mode??384,encoding:t.encoding??`utf8`},this._label=this._format(new Date),this._init=this._initialize()}_write(e,t,n){this._writeChunk(e,t).then(()=>n(),n)}_final(e){this._close().then(()=>e(),e)}async _initialize(){await b(this._fileDir,{recursive:!0});let e=await Qt(this._filePath);if(e){let t=this._format(e.mtime),n=t!==this._label,r=this._options.size>0&&e.size>=this._options.size;n||r?await this._rotateHotFile(t):this._size=e.size}this._stream=this._open()}async _writeChunk(e,t){await this._init;let n=Buffer.isBuffer(e)?e.byteLength:Buffer.byteLength(e,t);await this._rotateIfNeeded(),await new Promise((n,r)=>{this._stream.write(e,t,e=>{e?r(e):n()})}),this._size+=n}_open(){let e=f(this._filePath,{flags:this._options.flags,mode:this._options.mode,encoding:this._options.encoding});return e.on(`error`,e=>{this.destroy(e)}),e}async _close(){if(await this._init.catch(()=>void 0),!this._stream)return;let e=this._stream;this._stream=void 0,await new Promise((t,n)=>{let r=()=>{e.off(`error`,i),t()},i=t=>{e.off(`close`,r),n(t)};e.once(`close`,r),e.once(`error`,i),e.end()})}async _rotateIfNeeded(){let e=this._format(new Date),t=e!==this._label,n=this._options.size>0&&this._size>=this._options.size;if(!t&&!n)return;await this._close();let r=await Qt(this._filePath);r&&r.size>0&&await this._rotateHotFile(this._label),this._label=e,this._size=0,this._stream=this._open()}async _rotateHotFile(e){if(!await Qt(this._filePath))return;let t=await this._getNextRotatedPath(e);await S(this._filePath,t),await this._pruneBackups()}async _getNextRotatedPath(e){let t=(await this._listRotatedFiles()).filter(t=>t.label===e).reduce((e,t)=>Math.max(e,t.index),0)+1;return i(this._fileDir,this._buildRotatedFileName(e,t))}_buildRotatedFileName(e,t){return this._fileExt?`${this._fileStem}.${e}.${t}${this._fileExt}`:`${this._fileBaseName}.${e}.${t}`}async _pruneBackups(){let e=(await this._listRotatedFiles()).sort((e,t)=>e.label===t.label?t.index-e.index:t.label.localeCompare(e.label)).slice(this._options.backups);await Promise.all(e.map(e=>C(e.path,{force:!0})))}async _listRotatedFiles(){let e=await x(this._fileDir),t=[],n=this._getRotatedFilePattern();for(let r of e){let e=n.exec(r);e?.groups&&t.push({label:e.groups.label,index:Number.parseInt(e.groups.index,10),path:i(this._fileDir,r)})}return t}_getRotatedFilePattern(){return this._fileExt?RegExp(`^${Zt(this._fileStem)}\\.(?<label>.+)\\.(?<index>\\d+)${Zt(this._fileExt)}$`,`u`):RegExp(`^${Zt(this._fileBaseName)}\\.(?<label>.+)\\.(?<index>\\d+)$`,`u`)}_format(e){return`${Xt(e.getFullYear(),4)}-${Xt(e.getMonth()+1)}-${Xt(e.getDate())}`}};function Xt(e,t=2){return e.toString().padStart(t,`0`)}function Zt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}async function Qt(e){try{return await w(e)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}let $t;var en=class{_category;_factory;_logger;constructor(e){this._category=e}trace(...e){this._log?.trace(...e)}debug(...e){this._log?.debug(...e)}info(...e){this._log?.info(...e)}warn(...e){this._log?.warn(...e)}error(...e){this._log?.error(...e)}fatal(...e){this._log?.fatal(...e)}get _log(){if(!$t){this._factory=void 0,this._logger=void 0;return}return(this._factory!==$t||!this._logger)&&(this._factory=$t,this._logger=$t.create(this._category)),this._logger}};function tn(e){switch(e=e?.toLowerCase(),e){case`trace`:case`debug`:case`info`:case`warn`:case`error`:case`fatal`:case`silent`:return e;default:return`info`}}function nn(e){let t=process.env.WALLABY_CLI_LOG_PATH;function n(){let e=process.env.WALLABY_CLI_LOG_LEVEL;return e?tn(e):`info`}function r(e,t){let n=Number.parseInt(e??``,10);return Number.isInteger(n)&&n>0?n:t}return{path:e?.path??t??i(u(),`wallaby-cli.log`),level:e?.level??n(),size:e?.size??r(process.env.WALLABY_CLI_LOG_MAX_SIZE,10*1024*1024),backups:e?.backups??r(process.env.WALLABY_CLI_LOG_MAX_BACKUPS,7)}}function rn(e){if($t)throw Error(`Logger is already initialized`);e=nn(e),G.default.ensureDirSync(r(e.path));let t=new Yt(e.path,{size:e.size,backups:e.backups,flags:`a`,mode:384,encoding:`utf8`});function n(e){process.stderr.write(`[logger] ${e.stack||e.message}\n`)}t.on(`error`,n);function i(e){let t=(t,n)=>{e.fatal({err:t,origin:n},`Uncaught exception`)},n=t=>{e.error({reason:t},`Unhandled promise rejection`)};return process.on(`uncaughtExceptionMonitor`,t),process.on(`unhandledRejection`,n),()=>{process.off(`uncaughtExceptionMonitor`,t),process.off(`unhandledRejection`,n)}}let a=(0,Jt.default)({level:e.level,timestamp:Jt.default.stdTimeFunctions.isoTime,base:{pid:process.pid},errorKey:`error`,formatters:{level(e){return{level:e}}}},t),o=i(a);$t={create(e){return a.child({category:e})},async close(){o(),t.off(`error`,n),await new Promise((e,n)=>{t.end(t=>{t?n(t):e()})})}},a.debug(`Initialized CLI logger`)}function an(e){return new en(e)}async function on(){let e=$t;e&&($t=void 0,await e.close())}var J={initialize:rn,create:an,shutdown:on},sn=R(((e,t)=>{t.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,t.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,t.exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/})),cn=R(((e,t)=>{let n=sn();t.exports={isSpaceSeparator(e){return typeof e==`string`&&n.Space_Separator.test(e)},isIdStartChar(e){return typeof e==`string`&&(e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`$`||e===`_`||n.ID_Start.test(e))},isIdContinueChar(e){return typeof e==`string`&&(e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`$`||e===`_`||e===``||e===``||n.ID_Continue.test(e))},isDigit(e){return typeof e==`string`&&/[0-9]/.test(e)},isHexDigit(e){return typeof e==`string`&&/[0-9A-Fa-f]/.test(e)}}})),ln=R(((e,t)=>{let n=cn(),r,i,a,o,s,c,l,u,d;t.exports=function(e,t){r=String(e),i=`start`,a=[],o=0,s=1,c=0,l=void 0,u=void 0,d=void 0;do l=v(),D[i]();while(l.type!==`eof`);return typeof t==`function`?f({"":d},``,t):d};function f(e,t,n){let r=e[t];if(typeof r==`object`&&r)if(Array.isArray(r))for(let e=0;e<r.length;e++){let t=String(e),i=f(r,t,n);i===void 0?delete r[t]:Object.defineProperty(r,t,{value:i,writable:!0,enumerable:!0,configurable:!0})}else for(let e in r){let t=f(r,e,n);t===void 0?delete r[e]:Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}return n.call(e,t,r)}let p,m,h,g,_;function v(){for(p=`default`,m=``,h=!1,g=1;;){_=y();let e=x[p]();if(e)return e}}function y(){if(r[o])return String.fromCodePoint(r.codePointAt(o))}function b(){let e=y();return e===`
|
|
18
|
+
`?(s++,c=0):e?c+=e.length:c++,e&&(o+=e.length),e}let x={default(){switch(_){case` `:case`\v`:case`\f`:case` `:case`\xA0`:case``:case`
|
|
19
|
+
`:case`\r`:case`\u2028`:case`\u2029`:b();return;case`/`:b(),p=`comment`;return;case void 0:return b(),S(`eof`)}if(n.isSpaceSeparator(_)){b();return}return x[i]()},comment(){switch(_){case`*`:b(),p=`multiLineComment`;return;case`/`:b(),p=`singleLineComment`;return}throw A(b())},multiLineComment(){switch(_){case`*`:b(),p=`multiLineCommentAsterisk`;return;case void 0:throw A(b())}b()},multiLineCommentAsterisk(){switch(_){case`*`:b();return;case`/`:b(),p=`default`;return;case void 0:throw A(b())}b(),p=`multiLineComment`},singleLineComment(){switch(_){case`
|
|
20
|
+
`:case`\r`:case`\u2028`:case`\u2029`:b(),p=`default`;return;case void 0:return b(),S(`eof`)}b()},value(){switch(_){case`{`:case`[`:return S(`punctuator`,b());case`n`:return b(),C(`ull`),S(`null`,null);case`t`:return b(),C(`rue`),S(`boolean`,!0);case`f`:return b(),C(`alse`),S(`boolean`,!1);case`-`:case`+`:b()===`-`&&(g=-1),p=`sign`;return;case`.`:m=b(),p=`decimalPointLeading`;return;case`0`:m=b(),p=`zero`;return;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:m=b(),p=`decimalInteger`;return;case`I`:return b(),C(`nfinity`),S(`numeric`,1/0);case`N`:return b(),C(`aN`),S(`numeric`,NaN);case`"`:case`'`:h=b()===`"`,m=``,p=`string`;return}throw A(b())},identifierNameStartEscape(){if(_!==`u`)throw A(b());b();let e=E();switch(e){case`$`:case`_`:break;default:if(!n.isIdStartChar(e))throw M();break}m+=e,p=`identifierName`},identifierName(){switch(_){case`$`:case`_`:case``:case``:m+=b();return;case`\\`:b(),p=`identifierNameEscape`;return}if(n.isIdContinueChar(_)){m+=b();return}return S(`identifier`,m)},identifierNameEscape(){if(_!==`u`)throw A(b());b();let e=E();switch(e){case`$`:case`_`:case``:case``:break;default:if(!n.isIdContinueChar(e))throw M();break}m+=e,p=`identifierName`},sign(){switch(_){case`.`:m=b(),p=`decimalPointLeading`;return;case`0`:m=b(),p=`zero`;return;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:m=b(),p=`decimalInteger`;return;case`I`:return b(),C(`nfinity`),S(`numeric`,g*(1/0));case`N`:return b(),C(`aN`),S(`numeric`,NaN)}throw A(b())},zero(){switch(_){case`.`:m+=b(),p=`decimalPoint`;return;case`e`:case`E`:m+=b(),p=`decimalExponent`;return;case`x`:case`X`:m+=b(),p=`hexadecimal`;return}return S(`numeric`,g*0)},decimalInteger(){switch(_){case`.`:m+=b(),p=`decimalPoint`;return;case`e`:case`E`:m+=b(),p=`decimalExponent`;return}if(n.isDigit(_)){m+=b();return}return S(`numeric`,g*Number(m))},decimalPointLeading(){if(n.isDigit(_)){m+=b(),p=`decimalFraction`;return}throw A(b())},decimalPoint(){switch(_){case`e`:case`E`:m+=b(),p=`decimalExponent`;return}if(n.isDigit(_)){m+=b(),p=`decimalFraction`;return}return S(`numeric`,g*Number(m))},decimalFraction(){switch(_){case`e`:case`E`:m+=b(),p=`decimalExponent`;return}if(n.isDigit(_)){m+=b();return}return S(`numeric`,g*Number(m))},decimalExponent(){switch(_){case`+`:case`-`:m+=b(),p=`decimalExponentSign`;return}if(n.isDigit(_)){m+=b(),p=`decimalExponentInteger`;return}throw A(b())},decimalExponentSign(){if(n.isDigit(_)){m+=b(),p=`decimalExponentInteger`;return}throw A(b())},decimalExponentInteger(){if(n.isDigit(_)){m+=b();return}return S(`numeric`,g*Number(m))},hexadecimal(){if(n.isHexDigit(_)){m+=b(),p=`hexadecimalInteger`;return}throw A(b())},hexadecimalInteger(){if(n.isHexDigit(_)){m+=b();return}return S(`numeric`,g*Number(m))},string(){switch(_){case`\\`:b(),m+=w();return;case`"`:if(h)return b(),S(`string`,m);m+=b();return;case`'`:if(!h)return b(),S(`string`,m);m+=b();return;case`
|
|
21
|
+
`:case`\r`:throw A(b());case`\u2028`:case`\u2029`:N(_);break;case void 0:throw A(b())}m+=b()},start(){switch(_){case`{`:case`[`:return S(`punctuator`,b())}p=`value`},beforePropertyName(){switch(_){case`$`:case`_`:m=b(),p=`identifierName`;return;case`\\`:b(),p=`identifierNameStartEscape`;return;case`}`:return S(`punctuator`,b());case`"`:case`'`:h=b()===`"`,p=`string`;return}if(n.isIdStartChar(_)){m+=b(),p=`identifierName`;return}throw A(b())},afterPropertyName(){if(_===`:`)return S(`punctuator`,b());throw A(b())},beforePropertyValue(){p=`value`},afterPropertyValue(){switch(_){case`,`:case`}`:return S(`punctuator`,b())}throw A(b())},beforeArrayValue(){if(_===`]`)return S(`punctuator`,b());p=`value`},afterArrayValue(){switch(_){case`,`:case`]`:return S(`punctuator`,b())}throw A(b())},end(){throw A(b())}};function S(e,t){return{type:e,value:t,line:s,column:c}}function C(e){for(let t of e){if(y()!==t)throw A(b());b()}}function w(){switch(y()){case`b`:return b(),`\b`;case`f`:return b(),`\f`;case`n`:return b(),`
|
|
22
|
+
`;case`r`:return b(),`\r`;case`t`:return b(),` `;case`v`:return b(),`\v`;case`0`:if(b(),n.isDigit(y()))throw A(b());return`\0`;case`x`:return b(),T();case`u`:return b(),E();case`
|
|
23
|
+
`:case`\u2028`:case`\u2029`:return b(),``;case`\r`:return b(),y()===`
|
|
24
|
+
`&&b(),``;case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:throw A(b());case void 0:throw A(b())}return b()}function T(){let e=``,t=y();if(!n.isHexDigit(t)||(e+=b(),t=y(),!n.isHexDigit(t)))throw A(b());return e+=b(),String.fromCodePoint(parseInt(e,16))}function E(){let e=``,t=4;for(;t-- >0;){let t=y();if(!n.isHexDigit(t))throw A(b());e+=b()}return String.fromCodePoint(parseInt(e,16))}let D={start(){if(l.type===`eof`)throw j();O()},beforePropertyName(){switch(l.type){case`identifier`:case`string`:u=l.value,i=`afterPropertyName`;return;case`punctuator`:k();return;case`eof`:throw j()}},afterPropertyName(){if(l.type===`eof`)throw j();i=`beforePropertyValue`},beforePropertyValue(){if(l.type===`eof`)throw j();O()},beforeArrayValue(){if(l.type===`eof`)throw j();if(l.type===`punctuator`&&l.value===`]`){k();return}O()},afterPropertyValue(){if(l.type===`eof`)throw j();switch(l.value){case`,`:i=`beforePropertyName`;return;case`}`:k()}},afterArrayValue(){if(l.type===`eof`)throw j();switch(l.value){case`,`:i=`beforeArrayValue`;return;case`]`:k()}},end(){}};function O(){let e;switch(l.type){case`punctuator`:switch(l.value){case`{`:e={};break;case`[`:e=[];break}break;case`null`:case`boolean`:case`numeric`:case`string`:e=l.value;break}if(d===void 0)d=e;else{let t=a[a.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,u,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(typeof e==`object`&&e)a.push(e),i=Array.isArray(e)?`beforeArrayValue`:`beforePropertyName`;else{let e=a[a.length-1];i=e==null?`end`:Array.isArray(e)?`afterArrayValue`:`afterPropertyValue`}}function k(){a.pop();let e=a[a.length-1];i=e==null?`end`:Array.isArray(e)?`afterArrayValue`:`afterPropertyValue`}function A(e){return ee(e===void 0?`JSON5: invalid end of input at ${s}:${c}`:`JSON5: invalid character '${P(e)}' at ${s}:${c}`)}function j(){return ee(`JSON5: invalid end of input at ${s}:${c}`)}function M(){return c-=5,ee(`JSON5: invalid identifier character at ${s}:${c}`)}function N(e){console.warn(`JSON5: '${P(e)}' in strings is not valid ECMAScript; consider escaping`)}function P(e){let t={"'":`\\'`,'"':`\\"`,"\\":`\\\\`,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`,"\v":`\\v`,"\0":`\\0`,"\u2028":`\\u2028`,"\u2029":`\\u2029`};if(t[e])return t[e];if(e<` `){let t=e.charCodeAt(0).toString(16);return`\\x`+(`00`+t).substring(t.length)}return e}function ee(e){let t=SyntaxError(e);return t.lineNumber=s,t.columnNumber=c,t}})),un=R(((e,t)=>{let n=cn();t.exports=function(e,t,r){let i=[],a=``,o,s,c=``,l;if(typeof t==`object`&&t&&!Array.isArray(t)&&(r=t.space,l=t.quote,t=t.replacer),typeof t==`function`)s=t;else if(Array.isArray(t)){o=[];for(let e of t){let t;typeof e==`string`?t=e:(typeof e==`number`||e instanceof String||e instanceof Number)&&(t=String(e)),t!==void 0&&o.indexOf(t)<0&&o.push(t)}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r==`number`?r>0&&(r=Math.min(10,Math.floor(r)),c=` `.substr(0,r)):typeof r==`string`&&(c=r.substr(0,10)),u(``,{"":e});function u(e,t){let n=t[e];switch(n!=null&&(typeof n.toJSON5==`function`?n=n.toJSON5(e):typeof n.toJSON==`function`&&(n=n.toJSON(e))),s&&(n=s.call(t,e,n)),n instanceof Number?n=Number(n):n instanceof String?n=String(n):n instanceof Boolean&&(n=n.valueOf()),n){case null:return`null`;case!0:return`true`;case!1:return`false`}if(typeof n==`string`)return d(n,!1);if(typeof n==`number`)return String(n);if(typeof n==`object`)return Array.isArray(n)?m(n):f(n)}function d(e){let t={"'":.1,'"':.2},r={"'":`\\'`,'"':`\\"`,"\\":`\\\\`,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`,"\v":`\\v`,"\0":`\\0`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},i=``;for(let a=0;a<e.length;a++){let o=e[a];switch(o){case`'`:case`"`:t[o]++,i+=o;continue;case`\0`:if(n.isDigit(e[a+1])){i+=`\\x00`;continue}}if(r[o]){i+=r[o];continue}if(o<` `){let e=o.charCodeAt(0).toString(16);i+=`\\x`+(`00`+e).substring(e.length);continue}i+=o}let a=l||Object.keys(t).reduce((e,n)=>t[e]<t[n]?e:n);return i=i.replace(new RegExp(a,`g`),r[a]),a+i+a}function f(e){if(i.indexOf(e)>=0)throw TypeError(`Converting circular structure to JSON5`);i.push(e);let t=a;a+=c;let n=o||Object.keys(e),r=[];for(let t of n){let n=u(t,e);if(n!==void 0){let e=p(t)+`:`;c!==``&&(e+=` `),e+=n,r.push(e)}}let s;if(r.length===0)s=`{}`;else{let e;if(c===``)e=r.join(`,`),s=`{`+e+`}`;else{let n=`,
|
|
25
|
+
`+a;e=r.join(n),s=`{
|
|
26
|
+
`+a+e+`,
|
|
27
|
+
`+t+`}`}}return i.pop(),a=t,s}function p(e){if(e.length===0)return d(e,!0);let t=String.fromCodePoint(e.codePointAt(0));if(!n.isIdStartChar(t))return d(e,!0);for(let r=t.length;r<e.length;r++)if(!n.isIdContinueChar(String.fromCodePoint(e.codePointAt(r))))return d(e,!0);return e}function m(e){if(i.indexOf(e)>=0)throw TypeError(`Converting circular structure to JSON5`);i.push(e);let t=a;a+=c;let n=[];for(let t=0;t<e.length;t++){let r=u(String(t),e);n.push(r===void 0?`null`:r)}let r;if(n.length===0)r=`[]`;else if(c===``)r=`[`+n.join(`,`)+`]`;else{let e=`,
|
|
28
|
+
`+a,i=n.join(e);r=`[
|
|
29
|
+
`+a+i+`,
|
|
30
|
+
`+t+`]`}return i.pop(),a=t,r}}})),dn=z(R(((e,t)=>{t.exports={parse:ln(),stringify:un()}}))(),1);const fn=_(import.meta.url),pn=process.platform===`win32`,mn=vn(),hn=pn?e=>e.replace(/\\/g,o.sep):e=>e,gn=mn?e=>e:e=>e.toLowerCase(),_n=e=>o.normalize(gn(hn(e)));function vn(){return pn?!1:!p(yn(fn))}function yn(e){return e.replace(/\w/g,e=>{let t=e.toUpperCase();return e===t?e.toLowerCase():t})}const bn=_(new URL(`..`,import.meta.url));var Y={version:JSON.parse(h(i(bn,`package.json`),`utf-8`)).version,paths:{dirs:{package:{bin:i(bn,`bin`)},home:i(l(),`.wallaby`),current:i(l(),`.wallaby`,`cli`)}}};const xn=J.create(`core/registry`);var Sn=class{_storeDirPath;constructor(e=i(Y.paths.dirs.home,`registry`)){this._storeDirPath=e,p(this._storeDirPath)||m(this._storeDirPath,{recursive:!0})}get manifests(){let e=[];try{for(let t of g(this._storeDirPath))if(t.endsWith(`.json`))try{let n=JSON.parse(h(i(this._storeDirPath,t),`utf8`));e.push(n)}catch(e){xn.trace({error:e},`Failed to read manifest`)}}catch(e){xn.error({error:e},`Failed to read registry directory`)}return e}},Cn=R(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),wn=R(((e,t)=>{let{EMPTY_BUFFER:n}=Cn(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=B(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),Tn=R(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),En=R(((e,t)=>{let n=B(`zlib`),r=wn(),i=Tn(),{kStatusCode:a}=Cn(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),Dn=R(((e,t)=>{let{isUtf8:n}=B(`buffer`),{hasBlob:r}=Cn(),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=B(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),On=R(((e,t)=>{let{Writable:n}=B(`stream`),r=En(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=Cn(),{concat:c,toArrayBuffer:l,unmask:u}=wn(),{isValidStatusCode:d,isValidUTF8:f}=Dn(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),kn=R(((e,t)=>{let{Duplex:n}=B(`stream`),{randomFillSync:r}=B(`crypto`),i=En(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=Cn(),{isBlob:c,isValidStatusCode:l}=Dn(),{mask:u,toBuffer:d}=wn(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8*1024,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);_(this,e,a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),An=R(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=Cn(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,`error`,{enumerable:!0}),Object.defineProperty(m.prototype,`message`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),jn=R(((e,t)=>{let{tokenChars:n}=Dn();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),Mn=R(((e,t)=>{let n=B(`events`),r=B(`https`),i=B(`http`),a=B(`net`),o=B(`tls`),{randomBytes:s,createHash:c}=B(`crypto`),{Duplex:l,Readable:u}=B(`stream`),{URL:d}=B(`url`),f=En(),p=On(),m=kn(),{isBlob:h}=Dn(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=Cn(),{EventTarget:{addEventListener:T,removeEventListener:E}}=An(),{format:D,parse:O}=jn(),{toBuffer:k}=wn(),A=Symbol(`kAborted`),j=[8,13],M=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],N=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var P=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),ee(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,ie),i.on(`drain`,ae),i.on(`error`,oe),i.on(`message`,ce),i.on(`ping`,L),i.on(`pong`,R),a.onerror=ue,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,V),t.on(`data`,de),t.on(`end`,fe),t.on(`error`,pe),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){I(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),z(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){re(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){re(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){re(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){I(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(P,`CONNECTING`,{enumerable:!0,value:M.indexOf(`CONNECTING`)}),Object.defineProperty(P.prototype,`CONNECTING`,{enumerable:!0,value:M.indexOf(`CONNECTING`)}),Object.defineProperty(P,`OPEN`,{enumerable:!0,value:M.indexOf(`OPEN`)}),Object.defineProperty(P.prototype,`OPEN`,{enumerable:!0,value:M.indexOf(`OPEN`)}),Object.defineProperty(P,`CLOSING`,{enumerable:!0,value:M.indexOf(`CLOSING`)}),Object.defineProperty(P.prototype,`CLOSING`,{enumerable:!0,value:M.indexOf(`CLOSING`)}),Object.defineProperty(P,`CLOSED`,{enumerable:!0,value:M.indexOf(`CLOSED`)}),Object.defineProperty(P.prototype,`CLOSED`,{enumerable:!0,value:M.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(P.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(P.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),P.prototype.addEventListener=T,P.prototype.removeEventListener=E,t.exports=P;function ee(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:j[1],maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!j.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${j.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;F(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?ne:te),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!N.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{I(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[A]||(S=e._req=null,F(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){I(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{F(e,SyntaxError(`Invalid URL: ${i}`));return}ee(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||I(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==P.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){I(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){I(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){I(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){I(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=O(u)}catch{I(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){I(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{I(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function F(e,t){e._readyState=P.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function te(e){return e.path=e.socketPath,a.connect(e)}function ne(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function I(e,t,n){e._readyState=P.CLOSING;let r=Error(n);Error.captureStackTrace(r,I),t.setHeader?(t[A]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(F,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function re(e,t,n){if(t){let n=h(t)?t.size:k(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${M[e.readyState]})`);process.nextTick(n,t)}}function ie(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,de),process.nextTick(le,n._socket),e===1005?n.close():n.close(e,t))}function ae(){let e=this[C];e.isPaused||e._socket.resume()}function oe(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,de),process.nextTick(le,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function se(){this[C].emitClose()}function ce(e,t){this[C].emit(`message`,e,t)}function L(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function R(e){this[C].emit(`pong`,e)}function le(e){e.resume()}function ue(e){let t=this[C];t.readyState!==P.CLOSED&&(t.readyState===P.OPEN&&(t._readyState=P.CLOSING,z(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function z(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function V(){let e=this[C];if(this.removeListener(`close`,V),this.removeListener(`data`,de),this.removeListener(`end`,fe),e._readyState=P.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,se),e._receiver.on(`finish`,se))}function de(e){this[C]._receiver.write(e)||this.pause()}function fe(){let e=this[C];e._readyState=P.CLOSING,e._receiver.end(),this.end()}function pe(){let e=this[C];this.removeListener(`error`,pe),this.on(`error`,w),e&&(e._readyState=P.CLOSING,this.destroy())}})),Nn=R(((e,t)=>{Mn();let{Duplex:n}=B(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),Pn=R(((e,t)=>{let{tokenChars:n}=Dn();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),Fn=R(((e,t)=>{let n=B(`events`),r=B(`http`),{Duplex:i}=B(`stream`),{createHash:a}=B(`crypto`),o=jn(),s=En(),c=Pn(),l=Mn(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=Cn(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
31
|
+
`).join(`\r
|
|
32
|
+
`)),i.removeListener(`error`,g),p.setSocket(i,c,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on(`close`,()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(h,this)})),l(p,r)}};function m(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function h(e){e._state=2,e.emit(`close`)}function g(){this.destroy()}function _(e,t,n,i){n||=r.STATUS_CODES[t],i={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...i},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join(`\r
|
|
33
|
+
`)+`\r
|
|
34
|
+
\r
|
|
35
|
+
`+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));Nn(),jn(),En(),On(),kn(),Pn();var In=z(Mn(),1);Fn();function Ln(e){if(!(e instanceof Error))return e;let t=e;return{...Object.keys(e).reduce((e,n)=>(e[n]=t[n],e),{}),name:e.name,message:e.message,stack:e.stack}}function Rn(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){let t=e,n=Error(typeof t.message==`string`?t.message:String(e));return typeof t.name==`string`&&t.name&&(n.name=t.name),typeof t.stack==`string`&&t.stack&&(n.stack=t.stack),Object.assign(n,e),n}return Error(String(e))}var zn=class e{properties;static nextId=0;id;sequenceNumber=1;awaitingPromises={};sendAcknowledgement=!0;remoteApiAcknowledgement=!0;inboundApi;_api;_originalProcessMessageReceived;constructor(t,n){this.properties=n;let r=this;this.id=e.nextId++,this._api=new Proxy({},{get:function(e,t){return async(...e)=>await r.sendInternal({method:t,args:e})}}),this.inboundApi=t(this)}get api(){return this._api}async processMethod(e,t,n){n?this.sendAcknowledgement&&e.sequenceNumber&&this.sendMessage({sequenceNumber:e.sequenceNumber,error:Ln(n)}):this.sendAcknowledgement&&e.sequenceNumber&&this.sendMessage({sequenceNumber:e.sequenceNumber,result:{value:t}})}async processResult(e,t,n,r){t(r)}async processError(e,t,n,r){n(Rn(r))}async processMessageReceived(e){if(e.method)try{let t=await this.inboundApi[e.method].apply(this.inboundApi,e.args);await this.processMethod(e,t,void 0)}catch(t){t||=Error(`An unknown error occurred`),await this.processMethod(e,void 0,t)}else if(e.result){let{sequenceNumber:t,result:n}=e;if(this.awaitingPromises[t]){let{resolve:r,reject:i}=this.awaitingPromises[t];delete this.awaitingPromises[t],r&&n&&await this.processResult(e,r,i,n.value)}}else if(e.error){let{sequenceNumber:t,error:n}=e;if(this.awaitingPromises[t]){let{resolve:r,reject:i}=this.awaitingPromises[t];delete this.awaitingPromises[t],r&&i&&await this.processError(e,r,i,n)}}}rejectAwaitingPromises(e){Object.values(this.awaitingPromises).forEach(({reject:t})=>t(e))}async onMessageReceived(e){this.processMessageReceived(e)}async sendInternal(e){if(this.remoteApiAcknowledgement&&(this.remoteApiAcknowledgement===!0||this.remoteApiAcknowledgement(e)))return e.sequenceNumber=this.sequenceNumber++,await new Promise(async(t,n)=>{this.awaitingPromises[e.sequenceNumber]={resolve:t,reject:n};try{await this.sendMessage(e)}catch(t){delete this.awaitingPromises[e.sequenceNumber],n(t)}});try{await this.sendMessage(e)}catch{}}dispose(){this.onDisposeListeners.map(e=>e()),this.onDisposeListeners=[],this.onConnectedListeners=[],this.onVersionMismatchListeners=[],this.rejectAwaitingPromises(Error(`Channel disposed`))}onConnectedListeners=[];subscribeOnConnected(e){this.onConnectedListeners.push(e)}unsubscribeOnConnected(e){this.onConnectedListeners=this.onConnectedListeners.filter(t=>t!==e)}connected(){this.onConnectedListeners.map(e=>e()),this.onConnectedListeners=[]}onVersionMismatchListeners=[];subscribeOnVersionMismatch(e){this.onVersionMismatchListeners.push(e)}unsubscribeOnVersionMismatch(e){this.onVersionMismatchListeners=this.onVersionMismatchListeners.filter(t=>t!==e)}versionMismatch(e,t){this.onVersionMismatchListeners.map(n=>n(e,t))}onDisposeListeners=[];subscribeOnDispose(e){this.onDisposeListeners.push(e)}unsubscribeOnDispose(e){this.onDisposeListeners=this.onDisposeListeners.filter(t=>t!==e)}replaceReceiver(e){this._originalProcessMessageReceived||=this.processMessageReceived;let t=e.allowedCalls;this.processMessageReceived=n=>{if(e.filter(n)){if(t<=0)return e.replacement(n);t--}return this._originalProcessMessageReceived.bind(this)(n)}}restoreReceiver(){this.processMessageReceived=(this._originalProcessMessageReceived||this.processMessageReceived).bind(this),delete this._originalProcessMessageReceived}},Bn=class{inboundApiFactory;channelBaseConstructor;_channels=[];get channels(){return[...this._channels]}constructor(e,t){this.inboundApiFactory=e,this.channelBaseConstructor=t}createChannel(e){let t=new this.channelBaseConstructor(this.inboundApiFactory,e);return this._channels.push(t),t.connected(),t}destroyChannel(e){let t=this._channels.indexOf(e);t!==-1&&this._channels.splice(t,1)[0].dispose()}dispose(){this.channels.map(e=>this.destroyChannel(e))}};function Vn(e){return e instanceof Error?e.message:String(e)}function Hn(e){return e instanceof Error?e.toString():String(e)}function Un(e){return e instanceof Error?e:Error(String(e))}var Wn=class extends zn{_disposed=!1;_version=``;_onChannelError=()=>{};setOptions(e,t){this._onChannelError=e,this._version=t}async sendMessage(e){if(this._disposed){this._onChannelError(Error(`Channel has been disposed`));return}try{this._version&&typeof e==`object`&&e&&(e.version=this._version);let t=JSON.stringify(e);if(t===void 0)throw TypeError(`Failed to serialize RPC message`);this.properties.socket.send(t,e=>{e&&this.properties.logger.trace(`send callback error:%s`,Vn(e))})}catch(e){throw this.properties.logger.trace(`failed to send message: %s`,Vn(e)),e}}async processError(e,t,n,r){r&&this.properties.logger.trace(`error processing message: %s, %s`,e,Hn(r)),await super.processError(e,t,n,r)}async processMessageReceived(e){e.method&&this.properties.logger.trace(`received method call: %s`,e.method),await super.processMessageReceived(e)}rejectAwaitingPromises(e){this._disposed||super.rejectAwaitingPromises(e)}dispose(){if(this._disposed=!0,super.dispose(),!this.properties.socket.CLOSED)try{this.properties.socket.close()}catch{}}};function Gn(e,t,n){e.on(`message`,e=>{try{t(JSON.parse(e.toString()))}catch(e){n(Un(e))}})}function Kn(e,t,n,r){let{secure:i,host:a,port:o,secret:s,onError:c,onClose:l}=e,u={};e.from&&(u.headers={from:e.from});let d=i?`wss://`:`ws://`,f=o?`:${o}`:``,p=s?`?secret=${s}`:``,m=new In.default(d+(a||`localhost`)+f+p,u);return n&&Gn(m,n,e=>{r.trace(`incoming message processing error: %s`,e?.message)}),m.onclose=({code:e,reason:t})=>{r.trace(`client disconnected: %s %s`,e,t);try{l&&l(m,e,t?.toString())}catch(e){r.trace(`error when closing connection: %s`,Vn(e))}},m.onerror=e=>{try{r.trace(`connection error: %s`,e.error),c&&c(e.error)}catch(e){r.trace(`error when processing connection error: %s`,Vn(e))}},m.onopen=()=>{t()},m}var qn=class extends Bn{_socket;constructor(e,t){super(t,Wn),e.onChannelError||=e=>{this.channels.forEach(t=>{t.rejectAwaitingPromises(e),this.destroyChannel(t)})},e.onError||=e=>{this.channels.forEach(t=>{t.rejectAwaitingPromises(e),this.destroyChannel(t)})},e.onClose||=(e,t,n)=>{this.channels.forEach(e=>{e.rejectAwaitingPromises(Error(`WebSocket closed with code ${t} and reason ${n}`)),this.destroyChannel(e)})},this._socket=Kn(e,()=>{this.createChannel({socket:this._socket,logger:e.logger}).setOptions(e.onChannelError,e.version)},e=>{this.channels.forEach(t=>{t.onMessageReceived(e)})},e.logger)}dispose(){this._socket?.close(),super.dispose()}};const Jn=J.create(`core/session`);var Yn=class{_channels;constructor(e){this._channels=e}get _channel(){let[e]=this._channels();if(!e)throw Error(`Core RPC channel is not available`);return e}handshake(e){return this._channel.api.handshake(e)}signal(e){this._channel.api.signal(e)}run(e){return this._channel.api.run(e)}inspect(e){return this._channel.api.inspect(e)}export(e){return this._channel.api.export(e)}stop(){this._channel.api.stop()}},Xn=class{ping(){}notify(e){}restart(){}launched(e){}relicensed(){}stopped(e){}},Zn=class{_client;_alive=$n();_api;_disposed=!1;_deactivated=!1;_interrupted=!1;constructor(e,t){this._client=e,this._api=t(()=>this._client.channels)}get alive(){return this._alive.promise}get api(){return this._api}deactivate(){this._deactivated=!0}interrupt(e){if(!this._interrupted){if(this._interrupted=!0,this._deactivated||this._disposed){this._alive.resolve();return}this._alive.reject(e)}}dispose(){this._disposed||(this._disposed=!0,this._interrupted||(this._interrupted=!0,this._alive.resolve()),this._client.dispose())}};async function Qn(e,t,n){let r=!1,i=!1,a,o=$n(),s=e=>{if(!r){r=!0,o.reject(e);return}i&&a.interrupt(e)};a=new Zn(new qn({port:e,from:`cli`,logger:{trace:(...e)=>{let[t,n,...r]=e;if(typeof t==`string`){Jn.trace(N(t,n,...r));return}if(typeof n==`string`||n===void 0){Jn.trace(t,n,...r);return}Jn.trace({args:e},`Websocket`)}},version:`1.0.0`,onError:e=>{Jn.debug({error:e},`Socket error`),s(e)},onChannelError:e=>{Jn.debug({error:e},`Channel error`),s(e)},onClose:(e,t,n)=>{Jn.debug({code:t,reason:n},`Socket closed`),s(Error(`Socket closed with code ${t} and reason: ${n}`))}},n=>(n.subscribeOnConnected(async()=>{r||(i=!0,r=!0,Jn.debug({port:e},`Connected`),o.resolve())}),t)),n);try{return await o.promise,a}catch(e){throw a.dispose(),e}}function $n(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var er=class extends Xn{_restart;constructor(e){super(),this._restart=e}restart(){this._restart()}},tr=class{_logger=J.create(`commands/inspect`);async execute(e){this._logger.info({cwd:M(),options:e},`Executing inspect command`);let t=await this._execute(e);return this._logger.info({result:t},`Executed inspect command`),t}async _execute(e){let t=await this._cycle(e);return t?`restarted`in t?(this._logger.info(`Restarting process`),await this._execute(e)):(console.info(t.message),t.success):!1}async _cycle(e){let t=!1,n=!1,r,i,a,o=()=>{t=!0},{manifest:s,session:c}=await this._attach(e,()=>new er(()=>{n||r!==void 0||(n=!0,o())}),e=>new Yn(e));this._logger.info({id:s.id,pid:s.pids.primary,port:s.ports.primary},`Connected to active process from registry`),o=()=>{t||(t=!0,c.deactivate())};let l=A(),u=this._handshake(c).then(async()=>(await this._inspect(l,c,e),await c.api.export({id:l}))).then(e=>{n||r!==void 0||(r=e,o())}).catch(e=>{n||t||(i=e,o())}),d=c.alive.catch(e=>{t||(a=e,o())});try{await u}finally{o(),c.dispose(),await d}if(n)return{restarted:!0};if(a)throw a;if(i)throw i;return r}async _attach(e,t,n){let r=this._find(e);if(r.length===0)throw Error(`Wallaby is not running for the specified project.`);let i=await this._connect(r,t,n);if(i)return i;throw Error(`Failed to connect to an active Wallaby Core instance for the specified config.`)}async _connect([e,...t],n,r){if(e){this._logger.info({id:e.id,pid:e.pids.primary,port:e.ports.primary},`Trying to connect to active process from registry`);try{return{manifest:e,session:await Qn(e.ports.primary,n(e),r)}}catch(i){return this._logger.warn({error:i,id:e.id,pid:e.pids.primary,port:e.ports.primary},`Failed to connect to active process from registry`),await this._connect(t,n,r)}}}async _inspect(e,t,n){await t.api.inspect({id:e,inspections:nr(n.inspections??[])??[],test:n.test})}async _handshake(e){let t=await e.api.handshake(Y.version);if(!t.compatible)throw Error(t.message||`Wallaby CLI v${Y.version} is not compatible with the running Wallaby Core.`)}_find(e){let t=_n(s(e.config?e.config:i(M(),`auto.detect`)));return new Sn().manifests.filter(e=>e.paths.config===t).sort((e,t)=>t.timestamps.refreshed-e.timestamps.refreshed).filter(e=>{try{return process.kill(e.pids.primary,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}})}};function nr(e){if(e.length!==0)return e.map(rr)}function rr(e){let t;try{t=dn.default.parse(e)}catch(t){pr(e,t instanceof Error?t.message:`could not parse JSON5`)}fr(t)||pr(e,`expected an object`);let n=t.path;return typeof n!=`string`&&pr(e,`expected a string path property`),{path:n,expression:sr(e,t,`expression`),location:ir(e,t)}}function ir(e,t){return`location`in t||pr(e,`expected a location property`),ar(e,t.location)}function ar(e,t){if(fr(t)||pr(e,`expected location to be an object`),`line`in t)return or(e,t);if(`fragment`in t)return{fragment:ur(sr(e,t,`fragment`))};pr(e,`expected location with line, or location with fragment`)}function or(e,t){let n=cr(e,t,`line`),r=lr(e,t,`column`);return r===void 0?{line:n}:{line:n,column:r}}function sr(e,t,n){let r=t[n];if(typeof r==`string`)return r;pr(e,`expected a string ${n} property`)}function cr(e,t,n){let r=t[n];if(typeof r==`number`&&Number.isFinite(r))return r;pr(e,`expected a number ${n} property`)}function lr(e,t,n){if(n in t)return cr(e,t,n)}function ur(e){let t=dr(e);if(!t)return e;let n=O.from(t,`base64`);if(n.length===0)return e;let r=n.toString(`utf8`);return O.from(r,`utf8`).equals(n)&&n.toString(`base64`).replace(/=+$/,``)===t.replace(/=+$/,``)?r:e}function dr(e){if(e.length<8||e.length%4==1||/[\s]/.test(e)||!/^[A-Za-z0-9+/_-]+={0,2}$/.test(e))return;let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t.padEnd(Math.ceil(t.length/4)*4,`=`)}function fr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pr(e,t){throw Error(`Invalid inspection ${JSON.stringify(e)}: ${t}.`)}var mr=R(((e,t)=>{t.exports=[`|/-\\`,`⠂-–—–-`,`◐◓◑◒`,`◴◷◶◵`,`◰◳◲◱`,`▖▘▝▗`,`■□▪▫`,`▌▀▐▄`,`▉▊▋▌▍▎▏▎▍▌▋▊▉`,`▁▃▄▅▆▇█▇▆▅▄▃`,`←↖↑↗→↘↓↙`,`┤┘┴└├┌┬┐`,`◢◣◤◥`,`.oO°Oo.`,`.oO@*`,[`🌍`,`🌎`,`🌏`],`◡◡ ⊙⊙ ◠◠`,`☱☲☴`,`⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏`,`⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓`,`⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆`,`⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋`,`⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁`,`⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈`,`⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈`,`⢄⢂⢁⡁⡈⡐⡠`,`⢹⢺⢼⣸⣇⡧⡗⡏`,`⣾⣽⣻⢿⡿⣟⣯⣷`,`⠁⠂⠄⡀⢀⠠⠐⠈`,[`🌑`,`🌒`,`🌓`,`🌔`,`🌕`,`🌝`,`🌖`,`🌗`,`🌘`,`🌚`],[`🕛`,`🕐`,`🕑`,`🕒`,`🕓`,`🕔`,`🕕`,`🕖`,`🕗`,`🕘`,`🕙`,`🕚`]]})),hr=R((e=>{var t=B(`readline`),n=0,r=60;function i(e){this.clearLine(this.stream),this.stream.write(e)}var a=function(e){if(!(this instanceof a))return new a(e);typeof e==`string`?e={text:e}:e||={},this.text=e.text||``,this.setSpinnerString(n),this.setSpinnerDelay(r),this.onTick=e.onTick||i,this.stream=e.stream||process.stdout};a.spinners=mr(),a.setDefaultSpinnerString=function(e){return n=e,this},a.setDefaultSpinnerDelay=function(e){return r=e,this},a.prototype.start=function(){if(this.stream===process.stdout&&this.stream.isTTY!==!0)return this;var e=0,t=this,n=function(){var n=t.text.indexOf(`%s`)>-1?t.text.replace(`%s`,t.chars[e]):t.chars[e]+` `+t.text;t.onTick(n),e=++e%t.chars.length};return n(),this.id=setInterval(n,this.delay),this},a.prototype.isSpinning=function(){return this.id!==void 0},a.prototype.setSpinnerDelay=function(e){return this.delay=e,this},a.prototype.setSpinnerString=function(e){let t=s(e,this.spinners);return this.chars=Array.isArray(t)?t:t.split(``),this},a.prototype.setSpinnerTitle=function(e){return this.text=e,this},a.prototype.stop=function(e){return this.isSpinning===!1?this:(clearInterval(this.id),this.id=void 0,e&&this.clearLine(this.stream),this)},a.prototype.clearLine=function(e){return t.clearLine(e,0),t.cursorTo(e,0),this};function o(e){return typeof e==`number`&&e%1==0}function s(e,t){if(!o(e))return e+``;var n=a.spinners.length;return e=e>=n?0:e,e=e<0?n+e:e,a.spinners[e]}e.Spinner=a})),gr=R(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),_r=R(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),vr=R(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=gr(),a=_r();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),yr=R(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),br=R(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),X=R(((e,t)=>{let n=_r(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=gr(),{safeRe:a,t:o}=vr(),s=yr(),{compareIdentifiers:c}=br();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),xr=R(((e,t)=>{let n=X();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Sr=R(((e,t)=>{let n=xr();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Cr=R(((e,t)=>{let n=xr();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),wr=R(((e,t)=>{let n=X();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Tr=R(((e,t)=>{let n=xr();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Er=R(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).major})),Dr=R(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).minor})),Or=R(((e,t)=>{let n=X();t.exports=(e,t)=>new n(e,t).patch})),kr=R(((e,t)=>{let n=xr();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Z=R(((e,t)=>{let n=X();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Ar=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(t,e,r)})),jr=R(((e,t)=>{let n=Z();t.exports=(e,t)=>n(e,t,!0)})),Mr=R(((e,t)=>{let n=X();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Nr=R(((e,t)=>{let n=Mr();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Pr=R(((e,t)=>{let n=Mr();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Fr=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>0})),Ir=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<0})),Lr=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)===0})),Rr=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)!==0})),zr=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)>=0})),Br=R(((e,t)=>{let n=Z();t.exports=(e,t,r)=>n(e,t,r)<=0})),Vr=R(((e,t)=>{let n=Lr(),r=Rr(),i=Fr(),a=zr(),o=Ir(),s=Br();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Hr=R(((e,t)=>{let n=X(),r=xr(),{safeRe:i,t:a}=vr();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Ur=R(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Wr=R(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,O(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>D(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}};let r=new(Ur()),i=yr(),a=Gr(),o=_r(),s=X(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=vr(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=gr(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=E(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>T(e,t)).join(` `)),T=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},E=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),D=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),O=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),k=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),Gr=R(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=yr(),{safeRe:i,t:a}=vr(),o=Vr(),s=_r(),c=X(),l=Wr()})),Kr=R(((e,t)=>{let n=Wr();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),qr=R(((e,t)=>{let n=Wr();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),Jr=R(((e,t)=>{let n=X(),r=Wr();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),Yr=R(((e,t)=>{let n=X(),r=Wr();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Xr=R(((e,t)=>{let n=X(),r=Wr(),i=Fr();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Zr=R(((e,t)=>{let n=Wr();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),Qr=R(((e,t)=>{let n=X(),r=Gr(),{ANY:i}=r,a=Wr(),o=Kr(),s=Fr(),c=Ir(),l=Br(),u=zr();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),$r=R(((e,t)=>{let n=Qr();t.exports=(e,t,r)=>n(e,t,`>`,r)})),ei=R(((e,t)=>{let n=Qr();t.exports=(e,t,r)=>n(e,t,`<`,r)})),ti=R(((e,t)=>{let n=Wr();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),ni=R(((e,t)=>{let n=Kr(),r=Z();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),ri=R(((e,t)=>{let n=Wr(),r=Gr(),{ANY:i}=r,a=Kr(),o=Z(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),ii=R(((e,t)=>{let n=vr(),r=gr(),i=X(),a=br();t.exports={parse:xr(),valid:Sr(),clean:Cr(),inc:wr(),diff:Tr(),major:Er(),minor:Dr(),patch:Or(),prerelease:kr(),compare:Z(),rcompare:Ar(),compareLoose:jr(),compareBuild:Mr(),sort:Nr(),rsort:Pr(),gt:Fr(),lt:Ir(),eq:Lr(),neq:Rr(),gte:zr(),lte:Br(),cmp:Vr(),coerce:Hr(),Comparator:Gr(),Range:Wr(),satisfies:Kr(),toComparators:qr(),maxSatisfying:Jr(),minSatisfying:Yr(),minVersion:Xr(),validRange:Zr(),outside:Qr(),gtr:$r(),ltr:ei(),intersects:ti(),simplifyRange:ni(),subset:ri(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}})),ai=hr(),oi=ii();const si=J.create(`downloader`);async function ci(e,t,n,r,i){let a=`This may occur when you are behind proxy.`,o={headers:{"User-Agent":`node `+process.version}};si.debug({name:e,from:t,to:n,size:r,strict:i},`Downloading file`),t.startsWith(`https:`)&&i===!1&&(o.agent=new ee({rejectUnauthorized:!1}));let s=await fetch(t,o);if(si.debug({name:e,from:t,to:n,size:r,strict:i,status:s.status},`Received download response`),!s.ok||s.status!==200)throw si.debug({from:t,name:e,status:s.status},`Download failed`),Error(`Error while downloading ${e}, status code: ${s.status}. ${a}`);let c=s.headers.get(`content-length`);if(r&&c&&Number.parseInt(c,10)<r)throw si.debug({name:e,from:t,to:n,size:r,strict:i,length:c},`Download failed size validation`),Error(`Error while downloading ${e}, file is corrupt. ${a}`);let l=await s.arrayBuffer();return await E(n,new Uint8Array(l)),si.debug({name:e,from:t,to:n,size:r,strict:i,bytes:l.byteLength},`Downloaded file`),n}var li=R((e=>{e.require=function(){var e=B(`fs`);if(process.versions.electron)try{e=B(`original-fs`)}catch{}return e}})),ui=R(((e,t)=>{t.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,FLG_ENC:0,FLG_COMP1:1,FLG_COMP2:2,FLG_DESC:4,FLG_ENH:8,FLG_STR:16,FLG_LNG:1024,FLG_MSK:4096,FILE:0,BUFFER:1,NONE:2,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}})),di=R(((e,t)=>{t.exports={INVALID_LOC:`Invalid LOC header (bad signature)`,INVALID_CEN:`Invalid CEN header (bad signature)`,INVALID_END:`Invalid END header (bad signature)`,NO_DATA:`Nothing to decompress`,BAD_CRC:`CRC32 checksum failed`,FILE_IN_THE_WAY:`There is a file in the way: %s`,UNKNOWN_METHOD:`Invalid/unsupported compression method`,AVAIL_DATA:`inflate::Available inflate data did not terminate`,INVALID_DISTANCE:`inflate::Invalid literal/length or distance code in fixed or dynamic block`,TO_MANY_CODES:`inflate::Dynamic block code description: too many length or distance codes`,INVALID_REPEAT_LEN:`inflate::Dynamic block code description: repeat more than specified lengths`,INVALID_REPEAT_FIRST:`inflate::Dynamic block code description: repeat lengths with no first length`,INCOMPLETE_CODES:`inflate::Dynamic block code description: code lengths codes incomplete`,INVALID_DYN_DISTANCE:`inflate::Dynamic block code description: invalid distance code lengths`,INVALID_CODES_LEN:`inflate::Dynamic block code description: invalid literal/length code lengths`,INVALID_STORE_BLOCK:`inflate::Stored block length did not match one's complement`,INVALID_BLOCK_TYPE:`inflate::Invalid block type (type == 3)`,CANT_EXTRACT_FILE:`Could not extract the file`,CANT_OVERRIDE:`Target file already exists`,NO_ZIP:`No zip file was loaded`,NO_ENTRY:`Entry doesn't exist`,DIRECTORY_CONTENT_ERROR:`A directory cannot have content`,FILE_NOT_FOUND:`File not found: %s`,NOT_IMPLEMENTED:`Not implemented`,INVALID_FILENAME:`Invalid filename`,INVALID_FORMAT:`Invalid or unsupported zip format. No END header found`}})),fi=R(((e,t)=>{var n=li().require(),r=B(`path`);n.existsSync=n.existsSync||r.existsSync,t.exports=(function(){var e=[],t=ui(),i=di(),a=r.sep;function o(e){var t=e.split(a)[0];e.split(a).forEach(function(e){if(!(!e||e.substr(-1,1)===`:`)){t+=a+e;var r;try{r=n.statSync(t)}catch{n.mkdirSync(t)}if(r&&r.isFile())throw i.FILE_IN_THE_WAY.replace(`%s`,t)}})}function s(e,t,i){typeof t==`boolean`&&(i=t,t=void 0);var o=[];return n.readdirSync(e).forEach(function(c){var l=r.join(e,c);n.statSync(l).isDirectory()&&i&&(o=o.concat(s(l,t,i))),(!t||t.test(l))&&o.push(r.normalize(l)+(n.statSync(l).isDirectory()?a:``))}),o}return{makeDir:function(e){o(e)},crc32:function(t){typeof t==`string`&&(t=Buffer.alloc(t.length,t));var n=Buffer.alloc(4);if(!e.length)for(var r=0;r<256;r++){for(var i=r,a=8;--a>=0;)i&1?i=3988292384^i>>>1:i>>>=1;i<0&&(n.writeInt32LE(i,0),i=n.readUInt32LE(0)),e[r]=i}for(var o=0,s=0,c=t.length,l=~o;--c>=0;)l=e[(l^t[s++])&255]^l>>>8;return o=~l,n.writeInt32LE(o&4294967295,0),n.readUInt32LE(0)},methodToString:function(e){switch(e){case t.STORED:return`STORED (`+e+`)`;case t.DEFLATED:return`DEFLATED (`+e+`)`;default:return`UNSUPPORTED (`+e+`)`}},writeFileTo:function(e,t,i,a){if(n.existsSync(e)&&(!i||n.statSync(e).isDirectory()))return!1;var s=r.dirname(e);n.existsSync(s)||o(s);var c;try{c=n.openSync(e,`w`,438)}catch{n.chmodSync(e,438),c=n.openSync(e,`w`,438)}if(c)try{n.writeSync(c,t,0,t.length,0)}catch(e){throw e}finally{n.closeSync(c)}return n.chmodSync(e,a||438),!0},writeFileToAsync:function(e,t,i,a,s){typeof a==`function`&&(s=a,a=void 0),n.exists(e,function(c){if(c&&!i)return s(!1);n.stat(e,function(i,l){if(c&&l.isDirectory())return s(!1);var u=r.dirname(e);n.exists(u,function(r){r||o(u),n.open(e,`w`,438,function(r,i){r?n.chmod(e,438,function(){n.open(e,`w`,438,function(r,i){n.write(i,t,0,t.length,0,function(){n.close(i,function(){n.chmod(e,a||438,function(){s(!0)})})})})}):i?n.write(i,t,0,t.length,0,function(){n.close(i,function(){n.chmod(e,a||438,function(){s(!0)})})}):n.chmod(e,a||438,function(){s(!0)})})})})})},findFiles:function(e){return s(e,!0)},getAttributes:function(e){},setAttributes:function(e){},toBuffer:function(e){return Buffer.isBuffer(e)?e:e.length===0?Buffer.alloc(0):Buffer.alloc(e.length,e,`utf8`)},Constants:t,Errors:i}})()})),pi=R(((e,t)=>{var n=li().require(),r=B(`path`);n.existsSync=n.existsSync||r.existsSync,t.exports=function(e){var t=e||``,i=o(),a=null;function o(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return t&&n.existsSync(t)?(a=n.statSync(t),i.directory=a.isDirectory(),i.mtime=a.mtime,i.atime=a.atime,i.executable=!!(1&parseInt((a.mode&511).toString(8)[0])),i.readonly=!!(2&parseInt((a.mode&511).toString(8)[0])),i.hidden=r.basename(t)[0]===`.`):console.warn(`Invalid path: `+t),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(e){},encodeAttributes:function(e){},toString:function(){return`{
|
|
18
36
|
"path" : "`+t+`,
|
|
19
37
|
"isDirectory" : `+i.directory+`,
|
|
20
38
|
"isReadOnly" : `+i.readonly+`,
|
|
@@ -22,7 +40,7 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
22
40
|
"isExecutable" : `+i.executable+`,
|
|
23
41
|
"mTime" : `+i.mtime+`
|
|
24
42
|
"aTime" : `+i.atime+`
|
|
25
|
-
}`}}}})),
|
|
43
|
+
}`}}}})),mi=R(((e,t)=>{t.exports=fi(),t.exports.FileSystem=li(),t.exports.Constants=ui(),t.exports.Errors=di(),t.exports.FileAttr=pi()})),hi=R(((e,t)=>{var n=mi(),r=n.Constants;t.exports=function(){var e=10,t=10,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_={};function v(e){e=new Date(e),o=(e.getFullYear()-1980&127)<<25|e.getMonth()+1<<21|e.getDate()<<16|e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1}return v(+new Date),{get made(){return e},set made(t){e=t},get version(){return t},set version(e){t=e},get flags(){return i},set flags(e){i=e},get method(){return a},set method(e){a=e},get time(){return new Date((o>>25&127)+1980,(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(o&31)<<1)},set time(e){v(e)},get crc(){return s},set crc(e){s=e},get compressedSize(){return c},set compressedSize(e){c=e},get size(){return l},set size(e){l=e},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return d},set extraLength(e){d=e},get commentLength(){return f},set commentLength(e){f=e},get diskNumStart(){return p},set diskNumStart(e){p=e},get inAttr(){return m},set inAttr(e){m=e},get attr(){return h},set attr(e){h=e},get offset(){return g},set offset(e){g=e},get encripted(){return(i&1)==1},get entryHeaderSize(){return r.CENHDR+u+d+f},get realDataOffset(){return g+r.LOCHDR+_.fnameLen+_.extraLen},get dataHeader(){return _},loadDataHeaderFromBinary:function(e){var t=e.slice(g,g+r.LOCHDR);if(t.readUInt32LE(0)!==r.LOCSIG)throw n.Errors.INVALID_LOC;_={version:t.readUInt16LE(r.LOCVER),flags:t.readUInt16LE(r.LOCFLG),method:t.readUInt16LE(r.LOCHOW),time:t.readUInt32LE(r.LOCTIM),crc:t.readUInt32LE(r.LOCCRC),compressedSize:t.readUInt32LE(r.LOCSIZ),size:t.readUInt32LE(r.LOCLEN),fnameLen:t.readUInt16LE(r.LOCNAM),extraLen:t.readUInt16LE(r.LOCEXT)}},loadFromBinary:function(_){if(_.length!==r.CENHDR||_.readUInt32LE(0)!==r.CENSIG)throw n.Errors.INVALID_CEN;e=_.readUInt16LE(r.CENVEM),t=_.readUInt16LE(r.CENVER),i=_.readUInt16LE(r.CENFLG),a=_.readUInt16LE(r.CENHOW),o=_.readUInt32LE(r.CENTIM),s=_.readUInt32LE(r.CENCRC),c=_.readUInt32LE(r.CENSIZ),l=_.readUInt32LE(r.CENLEN),u=_.readUInt16LE(r.CENNAM),d=_.readUInt16LE(r.CENEXT),f=_.readUInt16LE(r.CENCOM),p=_.readUInt16LE(r.CENDSK),m=_.readUInt16LE(r.CENATT),h=_.readUInt32LE(r.CENATX),g=_.readUInt32LE(r.CENOFF)},dataHeaderToBinary:function(){var e=Buffer.alloc(r.LOCHDR);return e.writeUInt32LE(r.LOCSIG,0),e.writeUInt16LE(t,r.LOCVER),e.writeUInt16LE(i,r.LOCFLG),e.writeUInt16LE(a,r.LOCHOW),e.writeUInt32LE(o,r.LOCTIM),e.writeUInt32LE(s,r.LOCCRC),e.writeUInt32LE(c,r.LOCSIZ),e.writeUInt32LE(l,r.LOCLEN),e.writeUInt16LE(u,r.LOCNAM),e.writeUInt16LE(d,r.LOCEXT),e},entryHeaderToBinary:function(){var n=Buffer.alloc(r.CENHDR+u+d+f);return n.writeUInt32LE(r.CENSIG,0),n.writeUInt16LE(e,r.CENVEM),n.writeUInt16LE(t,r.CENVER),n.writeUInt16LE(i,r.CENFLG),n.writeUInt16LE(a,r.CENHOW),n.writeUInt32LE(o,r.CENTIM),n.writeUInt32LE(s,r.CENCRC),n.writeUInt32LE(c,r.CENSIZ),n.writeUInt32LE(l,r.CENLEN),n.writeUInt16LE(u,r.CENNAM),n.writeUInt16LE(d,r.CENEXT),n.writeUInt16LE(f,r.CENCOM),n.writeUInt16LE(p,r.CENDSK),n.writeUInt16LE(m,r.CENATT),n.writeUInt32LE(h,r.CENATX),n.writeUInt32LE(g,r.CENOFF),n.fill(0,r.CENHDR),n},toString:function(){return`{
|
|
26
44
|
"made" : `+e+`,
|
|
27
45
|
"version" : `+t+`,
|
|
28
46
|
"flags" : `+i+`,
|
|
@@ -39,13 +57,13 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
39
57
|
"attr" : `+h+`,
|
|
40
58
|
"offset" : `+g+`,
|
|
41
59
|
"entryHeaderSize" : `+(r.CENHDR+u+d+f)+` bytes
|
|
42
|
-
}`}}}})),
|
|
60
|
+
}`}}}})),gi=R(((e,t)=>{var n=mi(),r=n.Constants;t.exports=function(){var e=0,t=0,i=0,a=0,o=0;return{get diskEntries(){return e},set diskEntries(n){e=t=n},get totalEntries(){return t},set totalEntries(n){t=e=n},get size(){return i},set size(e){i=e},get offset(){return a},set offset(e){a=e},get commentLength(){return o},set commentLength(e){o=e},get mainHeaderSize(){return r.ENDHDR+o},loadFromBinary:function(s){if(s.length!==r.ENDHDR||s.readUInt32LE(0)!==r.ENDSIG)throw n.Errors.INVALID_END;e=s.readUInt16LE(r.ENDSUB),t=s.readUInt16LE(r.ENDTOT),i=s.readUInt32LE(r.ENDSIZ),a=s.readUInt32LE(r.ENDOFF),o=s.readUInt16LE(r.ENDCOM)},toBinary:function(){var n=Buffer.alloc(r.ENDHDR+o);return n.writeUInt32LE(r.ENDSIG,0),n.writeUInt32LE(0,4),n.writeUInt16LE(e,r.ENDSUB),n.writeUInt16LE(t,r.ENDTOT),n.writeUInt32LE(i,r.ENDSIZ),n.writeUInt32LE(a,r.ENDOFF),n.writeUInt16LE(o,r.ENDCOM),n.fill(` `,r.ENDHDR),n},toString:function(){return`{
|
|
43
61
|
"diskEntries" : `+e+`,
|
|
44
62
|
"totalEntries" : `+t+`,
|
|
45
63
|
"size" : `+i+` bytes,
|
|
46
64
|
"offset" : 0x`+a.toString(16).toUpperCase()+`,
|
|
47
65
|
"commentLength" : 0x`+o+`
|
|
48
|
-
}`}}}})),
|
|
66
|
+
}`}}}})),_i=R((e=>{e.EntryHeader=hi(),e.MainHeader=gi()})),vi=R((()=>{})),yi=R(((e,t)=>{var n=B(`buffer`).Buffer;function r(e){var t=32768,r=n.alloc(65536),i=0,a=null,o,s,c=0,l=0,u=-1,d=!1,f=0,p=0,m,h,g,_,v=0,y=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],b=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],S=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],C=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function T(e,t,n,r,i,a){this.status=0,this.r=null,this.maxbit=0;var o,s,c,l=[],u=[],d=[],f=[],p={extra:0,bitcnt:0,lbase:0,next:null};c=this.r=null;for(var m=0;m<17;m++)u[m]=0,d[m]=0,l[m]=0;for(m=0;m<288;m++)f[m]=0;o=t>256?e[256]:16;for(var h=-1;++h<t;)u[e[h]]++;if(u[0]!==t){for(var g=1;g<=16&&u[g]===0;g++);var _=g;for(m=16;m!==0&&u[m]===0;m--);var v=m;a<g&&(a=g);for(var y=1<<g;g<m;g++,y<<=1)if((y-=u[g])<0){this.status=2,this.maxbit=a;return}if((y-=u[m])<0){this.status=2,this.maxbit=a;return}u[m]+=y,l[1]=g=0,h=1;for(var b=2;--m>0;)l[b++]=g+=u[h++];h=0,m=0;do(g=e[h++])&&(f[l[g]++]=m);while(++m<t);t=l[v],l[0]=m=0,h=0;for(var x=-1,S=d[0]=0,C=null,w=0,T=[];_<=v;_++)for(var E=u[_];E-- >0;){for(;_>S+d[1+x];){if(S+=d[1+x],x++,w=(w=v-S)>a?a:w,(s=1<<(g=_-S))>E+1)for(s-=E+1,b=_;++g<w&&!((s<<=1)<=u[++b]);)s-=u[b];for(S+g>o&&S<o&&(g=o-S),w=1<<g,d[1+x]=g,C=[];C.length<w;)C.push({extra:0,bitcnt:0,lbase:0,next:null});c=c==null?this.r={next:null,list:null}:c.next={next:null,list:null},c.next=null,c.list=C,T[x]=C,x>0&&(l[x]=m,p.bitcnt=d[x],p.extra=16+g,p.next=C,g=(m&(1<<S)-1)>>S-d[x],T[x-1][g].extra=p.extra,T[x-1][g].bitcnt=p.bitcnt,T[x-1][g].lbase=p.lbase,T[x-1][g].next=p.next)}for(p.bitcnt=_-S,h>=t?p.extra=99:f[h]<n?(p.extra=f[h]<256?16:15,p.lbase=f[h++]):(p.extra=i[f[h]-n],p.lbase=r[f[h++]-n]),s=1<<_-S,g=m>>S;g<w;g+=s)C[g].extra=p.extra,C[g].bitcnt=p.bitcnt,C[g].lbase=p.lbase,C[g].next=p.next;for(g=1<<_-1;(m&g)!==0;g>>=1)m^=g;for(m^=g;(m&(1<<S)-1)!==l[x];)S-=d[x],x--}this.maxbit=d[1],this.status=+(y!==0&&v!==1)}}function E(t){for(;l<t;)c|=e[v++]<<l,l+=8;return c}function D(e){return l-=e,c>>=e}function O(t){for(;l<t;)c|=e[v++]<<l,l+=8;var n=c&y[t];return c>>=t,l-=t,n}function k(e,n,a){var o,s;if(a===0)return 0;for(var c=0;;){for(s=m.list[E(g)&y[g]],o=s.extra;o>16;){if(o===99)return-1;D(s.bitcnt),o-=16,s=s.next[E(o)&y[o]],o=s.extra}if(D(s.bitcnt),o===16){if(i&=t-1,e[n+ c++]=r[i++]=s.lbase,c===a)return a;continue}if(o===15)break;for(f=s.lbase+O(o),s=h.list[E(_)&y[_]],o=s.extra;o>16;){if(o===99)return-1;D(s.bitcnt),o-=16,s=s.next[E(o)&y[o]],o=s.extra}for(D(s.bitcnt),p=i-s.lbase-O(o);f>0&&c<a;)f--,p&=t-1,i&=t-1,e[n+ c++]=r[i++]=r[p++];if(c===a)return a}return u=-1,c}function A(e,n,a){D(l&7);var o=O(16);if(o!==(~O(16)&65535))return-1;for(f=o,o=0;f>0&&o<a;)f--,i&=t-1,e[n+ o++]=r[i++]=O(8);return f===0&&(u=-1),o}function j(e,t,n){var r=0;if(a==null){for(var i=[],c=0;c<144;c++)i[c]=8;for(;c<256;c++)i[c]=9;for(;c<280;c++)i[c]=7;for(;c<288;c++)i[c]=8;s=7;var l=new T(i,288,257,b,x,s);if(l.status!==0)return-1;for(a=l.r,s=l.maxbit,c=0;c<30;c++)i[c]=5;if(r=5,l=new T(i,30,0,S,C,r),l.status>1)return a=null,-1;o=l.r,r=l.maxbit}return m=a,h=o,g=s,_=r,k(e,t,n)}function M(e,t,n){for(var r=Array(572),i=0;i<572;i++)r[i]=0;var a=257+O(5),o=1+O(5),s=4+O(4);if(a>286||o>30)return-1;for(var c=0;c<s;c++)r[w[c]]=O(3);for(;c<19;c++)r[w[c]]=0;g=7;var l=new T(r,19,19,null,null,g);if(l.status!==0)return-1;m=l.r,g=l.maxbit;for(var u=a+o,d=0,f=0;d<u;){var p=m.list[E(g)&y[g]];if(c=p.bitcnt,D(c),c=p.lbase,c<16)r[d++]=f=c;else if(c===16){if(c=3+O(2),d+c>u)return-1;for(;c-- >0;)r[d++]=f}else if(c===17){if(c=3+O(3),d+c>u)return-1;for(;c-- >0;)r[d++]=0;f=0}else{if(c=11+O(7),d+c>u)return-1;for(;c-- >0;)r[d++]=0;f=0}}if(g=9,l=new T(r,a,257,b,x,g),g===0&&(l.status=1),l.status!==0)return-1;for(m=l.r,g=l.maxbit,d=0;d<o;d++)r[d]=r[d+a];return _=6,l=new T(r,o,0,S,C,_),h=l.r,_=l.maxbit,_===0&&a>257||l.status!==0?-1:k(e,t,n)}return{inflate:function(e){m=null;for(var n=e.length,a=0,o;a<n;){if(d&&u===-1)return;if(f>0){if(u!==0)for(;f>0&&a<n;)f--,p&=t-1,i&=t-1,e[a++]=r[i++]=r[p++];else{for(;f>0&&a<n;)f--,i&=t-1,e[a++]=r[i++]=O(8);f===0&&(u=-1)}if(a===n)return}if(u===-1){if(d)break;d=O(1)!==0,u=O(2),m=null,f=0}switch(u){case 0:o=A(e,a,n-a);break;case 1:o=m==null?j(e,a,n-a):k(e,a,n-a);break;case 2:o=m==null?M(e,a,n-a):k(e,a,n-a);break;default:o=-1;break}if(o===-1)return;a+=o}}}}t.exports=function(e){var t=B(`zlib`);return{inflateAsync:function(r){var i=t.createInflateRaw(),a=[],o=0;i.on(`data`,function(e){a.push(e),o+=e.length}),i.on(`end`,function(){var e=n.alloc(o),t=0;e.fill(0);for(var i=0;i<a.length;i++){var s=a[i];s.copy(e,t),t+=s.length}r&&r(e)}),i.end(e)},inflate:function(t){var n={x:new r(e)};n.x.inflate(t),delete n.x}}}})),bi=R((e=>{e.Deflater=vi(),e.Inflater=yi()})),xi=R(((e,t)=>{var n=mi(),r=_i(),i=n.Constants,a=bi();t.exports=function(e){var t=new r.EntryHeader,o=Buffer.alloc(0),s=Buffer.alloc(0),c=!1,l=null,u=Buffer.alloc(0);function d(){return!e||!Buffer.isBuffer(e)?Buffer.alloc(0):(t.loadDataHeaderFromBinary(e),e.slice(t.realDataOffset,t.realDataOffset+t.compressedSize))}function f(e){return!((t.flags&8)!=8&&n.crc32(e)!==t.crc)}function p(e,r,i){if(r===void 0&&typeof e==`string`&&(i=e,e=void 0),c)return e&&r&&r(Buffer.alloc(0),n.Errors.DIRECTORY_CONTENT_ERROR),Buffer.alloc(0);var s=d();if(s.length===0)return e&&r&&r(s,n.Errors.NO_DATA),s;var l=Buffer.alloc(t.size);switch(t.method){case n.Constants.STORED:return s.copy(l),f(l)?(e&&r&&r(l),l):(e&&r&&r(l,n.Errors.BAD_CRC),n.Errors.BAD_CRC);case n.Constants.DEFLATED:var u=new a.Inflater(s);if(e)u.inflateAsync(function(e){e.copy(l,0),f(l)?r&&r(l):r&&r(l,n.Errors.BAD_CRC)});else return u.inflate(l),f(l)||console.warn(n.Errors.BAD_CRC+` `+o.toString()),l;break;default:return e&&r&&r(Buffer.alloc(0),n.Errors.UNKNOWN_METHOD),n.Errors.UNKNOWN_METHOD}}function m(r,i){if((!l||!l.length)&&Buffer.isBuffer(e))return r&&i&&i(d()),d();if(l.length&&!c){var o;switch(t.method){case n.Constants.STORED:return t.compressedSize=t.size,o=Buffer.alloc(l.length),l.copy(o),r&&i&&i(o),o;default:case n.Constants.DEFLATED:var s=new a.Deflater(l);if(r)s.deflateAsync(function(e){o=Buffer.alloc(e.length),t.compressedSize=e.length,e.copy(o),i&&i(o)});else{var u=s.deflate();return t.compressedSize=u.length,u}s=null;break}}else if(r&&i)i(Buffer.alloc(0));else return Buffer.alloc(0)}function h(e,t){return(e.readUInt32LE(t+4)<<4)+e.readUInt32LE(t)}function g(e){for(var t=0,n,r,a;t<e.length;)n=e.readUInt16LE(t),t+=2,r=e.readUInt16LE(t),t+=2,a=e.slice(t,t+r),t+=r,i.ID_ZIP64===n&&_(a)}function _(e){var n,r,a,o;e.length>=i.EF_ZIP64_SCOMP&&(n=h(e,i.EF_ZIP64_SUNCOMP),t.size===i.EF_ZIP64_OR_32&&(t.size=n)),e.length>=i.EF_ZIP64_RHO&&(r=h(e,i.EF_ZIP64_SCOMP),t.compressedSize===i.EF_ZIP64_OR_32&&(t.compressedSize=r)),e.length>=i.EF_ZIP64_DSN&&(a=h(e,i.EF_ZIP64_RHO),t.offset===i.EF_ZIP64_OR_32&&(t.offset=a)),e.length>=i.EF_ZIP64_DSN+4&&(o=e.readUInt32LE(i.EF_ZIP64_DSN),t.diskNumStart===i.EF_ZIP64_OR_16&&(t.diskNumStart=o))}return{get entryName(){return o.toString()},get rawEntryName(){return o},set entryName(e){o=n.toBuffer(e);var r=o[o.length-1];c=r===47||r===92,t.fileNameLength=o.length},get extra(){return u},set extra(e){u=e,t.extraLength=e.length,g(e)},get comment(){return s.toString()},set comment(e){s=n.toBuffer(e),t.commentLength=s.length},get name(){var e=o.toString();return c?e.substr(e.length-1).split(`/`).pop():e.split(`/`).pop()},get isDirectory(){return c},getCompressedData:function(){return m(!1,null)},getCompressedDataAsync:function(e){m(!0,e)},setData:function(e){l=n.toBuffer(e),!c&&l.length?(t.size=l.length,t.method=n.Constants.STORED,t.crc=n.crc32(e),t.changed=!0):t.method=n.Constants.STORED},getData:function(e){return t.changed?l:p(!1,null,e)},getDataAsync:function(e,n){t.changed?e(l):p(!0,e,n)},set attr(e){t.attr=e},get attr(){return t.attr},set header(e){t.loadFromBinary(e)},get header(){return t},packHeader:function(){var e=t.entryHeaderToBinary();return o.copy(e,n.Constants.CENHDR),t.extraLength&&u.copy(e,n.Constants.CENHDR+o.length),t.commentLength&&s.copy(e,n.Constants.CENHDR+o.length+t.extraLength,s.length),e},toString:function(){return`{
|
|
49
67
|
"entryName" : "`+o.toString()+`",
|
|
50
68
|
"name" : "`+(c?o.toString().replace(/\/$/,``).split(`/`).pop():o.toString().split(`/`).pop())+`",
|
|
51
69
|
"comment" : "`+s.toString()+`",
|
|
@@ -53,17 +71,12 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
53
71
|
"header" : `+t.toString().replace(/\t/gm,` `).replace(/}/gm,` }`)+`,
|
|
54
72
|
"compressedData" : <`+(e&&e.length+` bytes buffer`||`null`)+`>
|
|
55
73
|
"data" : <`+(l&&l.length+` bytes buffer`||`null`)+`>
|
|
56
|
-
}`}}}})),
|
|
57
|
-
`)[2]}catch{}}var
|
|
74
|
+
}`}}}})),Si=R(((e,t)=>{var n=xi(),r=_i(),i=mi();t.exports=function(e,t){var a=[],o={},s=Buffer.alloc(0),c=``,l=i.FileSystem.require(),u=null,d=new r.MainHeader;t===i.Constants.FILE?(c=e,u=l.readFileSync(c),p()):t===i.Constants.BUFFER&&(u=e,p());function f(){o={},a=Array(d.diskEntries);for(var e=d.offset,t=0;t<a.length;t++){var r=e,s=new n(u);s.header=u.slice(r,r+=i.Constants.CENHDR),s.entryName=u.slice(r,r+=s.header.fileNameLength),s.header.extraLength&&(s.extra=u.slice(r,r+=s.header.extraLength)),s.header.commentLength&&(s.comment=u.slice(r,r+s.header.commentLength)),e+=s.header.entryHeaderSize,a[t]=s,o[s.entryName]=s}}function p(){for(var e=u.length-i.Constants.ENDHDR,t=Math.max(0,e-65535),n=-1;e>=t;e--)if(u[e]===80&&u.readUInt32LE(e)===i.Constants.ENDSIG){n=e;break}if(!~n)throw i.Errors.INVALID_FORMAT;d.loadFromBinary(u.slice(n,n+i.Constants.ENDHDR)),d.commentLength&&(s=u.slice(n+i.Constants.ENDHDR)),f()}return{get entries(){return a},get comment(){return s.toString()},set comment(e){d.commentLength=e.length,s=e},getEntry:function(e){return o[e]||null},setEntry:function(e){a.push(e),o[e.entryName]=e,d.totalEntries=a.length},deleteEntry:function(e){var t=o[e];if(t&&t.isDirectory){var n=this;this.getEntryChildren(t).forEach(function(t){t.entryName!==e&&n.deleteEntry(t.entryName)})}a.splice(a.indexOf(t),1),delete o[e],d.totalEntries=a.length},getEntryChildren:function(e){if(e.isDirectory){var t=[],n=e.entryName,r=n.length;return a.forEach(function(e){e.entryName.substr(0,r)===n&&t.push(e)}),t}return[]},compressToBuffer:function(){a.length>1&&a.sort(function(e,t){var n=e.entryName.toLowerCase(),r=t.entryName.toLowerCase();return n<r?-1:+(n>r)});var e=0,t=[],n=[],r=0;d.size=0,d.offset=0,a.forEach(function(i){var a=i.getCompressedData();i.header.offset=r;var o=i.header.dataHeaderToBinary(),s=i.entryName+i.extra.toString(),c=Buffer.alloc(s.length,s),l=o.length+c.length+a.length;r+=l,t.push(o),t.push(c),t.push(a);var u=i.packHeader();n.push(u),d.size+=u.length,e+=l+u.length}),e+=d.mainHeaderSize,d.offset=r,r=0;var o=Buffer.alloc(e);t.forEach(function(e){e.copy(o,r),r+=e.length}),n.forEach(function(e){e.copy(o,r),r+=e.length});var c=d.toBinary();return s&&s.copy(c,i.Constants.ENDHDR),c.copy(o,r),o},toAsyncBuffer:function(e,t,n,r){a.length>1&&a.sort(function(e,t){var n=e.entryName.toLowerCase(),r=t.entryName.toLowerCase();return n>r?-1:+(n<r)});var o=0,c=[],l=[],u=0;d.size=0,d.offset=0,function(t){var a=arguments.callee;if(t.length){var f=t.pop(),p=f.entryName+f.extra.toString();n&&n(p),f.getCompressedDataAsync(function(n){r&&r(p),f.header.offset=u;var m=f.header.dataHeaderToBinary(),h=Buffer.alloc(p),g=m.length+h.length+n.length;u+=g,c.push(m),c.push(h),c.push(n);var _=f.packHeader();if(l.push(_),d.size+=_.length,o+=g+_.length,t.length)a(t);else{o+=d.mainHeaderSize,d.offset=u,u=0;var v=Buffer.alloc(o);c.forEach(function(e){e.copy(v,u),u+=e.length}),l.forEach(function(e){e.copy(v,u),u+=e.length});var y=d.toBinary();s&&s.copy(y,i.Constants.ENDHDR),y.copy(v,u),e(v)}})}}(a)}}}})),Ci=z(R(((e,t)=>{var n=mi(),r=n.FileSystem.require(),i=B(`path`);r.existsSync=r.existsSync||i.existsSync;var a=xi(),o=Si();/^win/.test(process.platform),t.exports=function(e){var t=void 0,s=``;if(e&&typeof e==`string`)if(r.existsSync(e))s=e,t=new o(e,n.Constants.FILE);else throw n.Errors.INVALID_FILENAME;else t=e&&Buffer.isBuffer(e)?new o(e,n.Constants.BUFFER):new o(null,n.Constants.NONE);function c(e,t){e=i.resolve(i.normalize(e));for(var n=t.split(`/`),r=0,a=n.length;r<a;r++){var o=i.normalize(i.join(e,n.slice(r,a).join(i.sep)));if(o.indexOf(e)===0)return o}return i.normalize(i.join(e,i.basename(t)))}function l(e){if(e&&t){var n;if(typeof e==`string`&&(n=t.getEntry(e)),typeof e==`object`&&e.entryName!==void 0&&e.header!==void 0&&(n=t.getEntry(e.entryName)),n)return n}return null}return{readFile:function(e){var t=l(e);return t&&t.getData()||null},readFileAsync:function(e,t){var n=l(e);n?n.getDataAsync(t):t(null,`getEntry failed for:`+e)},readAsText:function(e,t){var n=l(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||`utf8`)}return``},readAsTextAsync:function(e,t,n){var r=l(e);r?r.getDataAsync(function(e){e&&e.length?t(e.toString(n||`utf8`)):t(``)}):t(``)},deleteFile:function(e){var n=l(e);n&&t.deleteEntry(n.entryName)},addZipComment:function(e){t.comment=e},getZipComment:function(){return t.comment||``},addZipEntryComment:function(e,t){var n=l(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=l(e);return t&&t.comment||``},updateFile:function(e,t){var n=l(e);n&&n.setData(t)},addLocalFile:function(e,t,i){if(r.existsSync(e)){t?(t=t.split(`\\`).join(`/`),t.charAt(t.length-1)!==`/`&&(t+=`/`)):t=``;var a=e.split(`\\`).join(`/`).split(`/`).pop();i?this.addFile(t+i,r.readFileSync(e),``,0):this.addFile(t+a,r.readFileSync(e),``,0)}else throw n.Errors.FILE_NOT_FOUND.replace(`%s`,e)},addLocalFolder:function(e,t,a){if(a===void 0?a=function(){return!0}:a instanceof RegExp&&(a=function(e){return function(t){return e.test(t)}}(a)),t?(t=t.split(`\\`).join(`/`),t.charAt(t.length-1)!==`/`&&(t+=`/`)):t=``,e=i.normalize(e),e=e.split(`\\`).join(`/`),e.charAt(e.length-1)!==`/`&&(e+=`/`),r.existsSync(e)){var o=n.findFiles(e),s=this;o.length&&o.forEach(function(n){var i=n.split(`\\`).join(`/`).replace(new RegExp(e.replace(/(\(|\))/g,`\\$1`),`i`),``);a(i)&&(i.charAt(i.length-1)===`/`?s.addFile(t+i,Buffer.alloc(0),``,0):s.addFile(t+i,r.readFileSync(n),``,0))})}else throw n.Errors.FILE_NOT_FOUND.replace(`%s`,e)},addFile:function(e,n,r,i){var o=new a;o.entryName=e,o.comment=r||``,i||=o.isDirectory?1106051088:420<<16,o.attr=i,o.setData(n),t.setEntry(o)},getEntries:function(){return t?t.entries:[]},getEntry:function(e){return l(e)},extractEntryTo:function(e,a,o,s){s||=!1,o=o===void 0?!0:o;var u=l(e);if(!u)throw n.Errors.NO_ENTRY;var d=u.entryName,f=c(a,o?d:i.basename(d));if(u.isDirectory)return f=i.resolve(f,`..`),t.getEntryChildren(u).forEach(function(e){if(!e.isDirectory){var t=e.getData();if(!t)throw n.Errors.CANT_EXTRACT_FILE;var r=c(a,o?e.entryName:i.basename(e.entryName));n.writeFileTo(r,t,s)}}),!0;var p=u.getData();if(!p)throw n.Errors.CANT_EXTRACT_FILE;if(r.existsSync(f)&&!s)throw n.Errors.CANT_OVERRIDE;return n.writeFileTo(f,p,s),!0},test:function(){if(!t)return!1;for(var e in t.entries)try{if(e.isDirectory)continue;if(!t.entries[e].getData())return!1}catch{return!1}return!0},extractAllTo:function(e,i){if(i||=!1,!t)throw n.Errors.NO_ZIP;t.entries.forEach(function(t){var a=c(e,t.entryName.toString());if(t.isDirectory){n.makeDir(a);return}var o=t.getData();if(!o)throw n.Errors.CANT_EXTRACT_FILE;n.writeFileTo(a,o,i),r.utimesSync(a,t.header.time,t.header.time)})},extractAllToAsync:function(e,a,o){if(o||=function(){},a||=!1,!t){o(Error(n.Errors.NO_ZIP));return}var s=t.entries,l=s.length;s.forEach(function(t){if(!(l<=0)){var s=i.normalize(t.entryName.toString());if(t.isDirectory){n.makeDir(c(e,s)),--l===0&&o(void 0);return}t.getDataAsync(function(u){if(!(l<=0)){if(!u){l=0,o(Error(n.Errors.CANT_EXTRACT_FILE));return}n.writeFileToAsync(c(e,s),u,a,function(n){if(r.utimesSync(i.resolve(e,s),t.header.time,t.header.time),!(l<=0)){if(!n){l=0,o(Error(`Unable to write`));return}--l===0&&o(void 0)}})}})}})},writeZip:function(e,r){if(arguments.length===1&&typeof e==`function`&&(r=e,e=``),!e&&s&&(e=s),e){var i=t.compressToBuffer();if(i){var a=n.writeFileTo(e,i,!0);typeof r==`function`&&r(a?null:Error(`failed`),``)}}},toBuffer:function(e,n,r,i){return this.valueOf=2,typeof e==`function`?(t.toAsyncBuffer(e,n,r,i),null):t.compressToBuffer()}}}}))(),1);const wi=J.create(`zip`);var Ti=class{},Ei=class extends Ti{signature;constructor(e){super(),this.signature=e}verify(e){let t=this.signature.path,n=e.getEntries();n.sort((e,t)=>e.entryName.localeCompare(t.entryName));let r=e.readAsText(t),i=k.createVerify(`RSA-SHA512`);return n.forEach(e=>{e.entryName!==t&&i.update(new Uint8Array(e.getData()))}),i.verify(this.signature.key,r,`base64`)}};async function Di(e){let t=new Ci.default(e.from);if(wi.debug({from:e.from,to:e.to},`Extracting zip archive`),await Oi(e.to),e.verifier&&!await e.verifier.verify(t))throw wi.error({from:e.from},`Archive signature verification failed`),Error(`Could not verify archive signature`);return e.verifier&&wi.debug({from:e.from},`Verified archive signature`),await new Promise((n,r)=>{t.extractAllToAsync(e.to,!0,e=>{e?r(e):n()})}),wi.debug({from:e.from,to:e.to},`Extracted zip archive`),{extractTo:e.to}}async function Oi(e){try{if(!(await w(e)).isDirectory())throw Error(`Extraction target must be a directory: ${e}`)}catch(e){if(!(e instanceof Error)||!(`code`in e)||e.code!==`ENOENT`)throw e}}const ki=i(Y.paths.dirs.home,`key.lic`),Q=J.create(`core/installer`),Ai={downloads:i(Y.paths.dirs.current,`downloads`),versions:i(Y.paths.dirs.current,`wallaby.json`),manifest:i(Y.paths.dirs.current,`core.json`),pinned:i(Y.paths.dirs.current,`pinned.version`)};function ji(){try{let e=e=>e&&e.replace(/^\s+|\s+$/gm,``),t=G.default.readFileSync(ki).toString();if(t){let n=t.split(`:`);n.length===2&&(t=e(n[1]))}return Buffer.from(t,`base64`).toString().split(`
|
|
75
|
+
`)[2]}catch{}}var Mi=class extends Ei{version=``;date=new Date(NaN);constructor(){super({path:`signature.txt`,key:`-----BEGIN RSA PUBLIC KEY-----
|
|
58
76
|
MIIBCgKCAQEAngwMnSkF1zlHJggr7kXXO02ytYIlzMdvQxHu6hli+TFIeO72HNfK
|
|
59
77
|
P27g+f8EtlPRB0UwnpAHtkJHNCdwpo04eU8hS8g9vbmNf00luUJGuUHnf62Pp0EI
|
|
60
78
|
KbGKJvzkdPgfs62MItfi4uf+XiHa8rN0Bk7hRbddI1zA4Wupf/E0wZ7UorgCE9XB
|
|
61
79
|
EM6VULphGdHorpmHBW5deeCHIledtMOpOfDSM5lvjiqgVqmjNYT+WXCwjN8yCcyU
|
|
62
80
|
oedY3afSHTyqiuInKcpXd+VJQb2+d7y583Pb3+kDGraBMGFJaWGewm7+IYIlgk5C
|
|
63
81
|
uk54FsjCvwvaa0SKr2rkIBKuyFX3ZGymyQIDAQAB
|
|
64
|
-
-----END RSA PUBLIC KEY-----`})}verify(e){this.version=JSON.parse(e.readAsText(`package.json`)).version,this.date=new Date(e.getEntry(`package.json`).header.time),this.date.setMinutes(this.date.getMinutes()-this.date.getTimezoneOffset());let[t,n,r]=this.version.split(`.`).map(e=>Number.parseInt(e,10));return t>1||n>0||r>1091?super.verify(e):!0}};async function Mr(e,t,n,r){let a=!1;Q.debug({path:t,latest:n,reuse:r,ssl:e},`Resolving distribution with update policy`);let o=new Fr,s=Ar(),c=e===`off`?`http`:`https`,l=`${c}://update.wallabyjs.com/`,u=l,d=t=>sr(`version`,`${t}wallaby.json?${s?`expiry=`+s.replace(/\//g,`-`):``}`,kr.versions,void 0,e!==`relaxed`),f=o.pinned,p=n?!1:!!t&&G.default.existsSync(t),m=i(kr.downloads,`wallaby.zip`);if(!p&&!n&&G.default.existsSync(m))try{t=await Pr(m),p=!!t&&G.default.existsSync(t),a=!0,Q.debug({path:t},`Recovered from cached archive`)}catch(e){Q.info({error:e,distFilePath:m},`Failed to recover from cached archive`)}let h;if(r&&p)h=o.read(t),Q.debug({path:t,latestVersion:h},`Using installed version`);else{let e=Lr(`Downloading version file`);try{try{await d(l)}catch{u=`${c}://s3.amazonaws.com/wallaby-downloads/`,Q.debug({downloadUrl:u},`Falling back to S3 metadata endpoint`),await d(`http://update.wallabyjs.com/`)}}finally{e()}h=o.latest,Q.debug({latestVersion:h},`Fetched latest version`)}if(f&&(h&&(0,ar.gt)(f,h)?await o.unpin():h=f,Q.debug({pinnedVersion:f,latestVersion:h},`Applied pinned version policy`)),!(p&&o.read(t)===h))try{t=await Nr(`core`,`${u}wallaby-v${h}.zip`,e),a=!0}catch{Q.info({latestVersion:h},`Primary download failed, falling back to S3 archive`),t=await Nr(`core`,`${c}://s3.amazonaws.com/wallaby-downloads/wallaby-v${h}.zip`,e),a=!0}return Q.debug({path:t,updated:a,latestVersion:h},`Resolved dist`),{path:t,updated:a,type:`dist`}}async function Nr(e,t,n){Q.debug({name:e,from:t,ssl:n},`Downloading and extracting dist`);let r=Lr(`Downloading core`),a=i(kr.downloads,`wallaby.zip`);try{G.default.ensureDirSync(kr.downloads),await sr(e,t,a,2e6,n!==`relaxed`)}finally{r()}let o=Lr(`Extracting core`);try{return await Pr(a)}catch(t){throw Q.error({error:t,downloadedArchiveFilePath:a},`Failed to extract archive`),Error(`Error while unzipping wallaby.js ${e} file: ${t instanceof Error?t.message:String(t)}`,{cause:t})}finally{o()}}async function Pr(e){let t=O.randomBytes(3).toString(`hex`),n=i(Y.paths.dirs.current,`wallaby`+t);for(;G.default.existsSync(n);)t=O.randomBytes(3).toString(`hex`),n=i(Y.paths.dirs.current,`wallaby`+t);let r=new jr;await Er({from:e,to:n,verifier:r});let a=new Fr().register(t,r.date.getTime());return Q.debug({from:e,to:{extracted:n,registered:a}},`Extracted dist`),a}var Fr=class{_logger=J.create(`core/installer/vm`);_paths;constructor(e){this._paths={pinned:e?.pinned??kr.pinned,manifest:e?.manifest??kr.manifest,versions:e?.versions??kr.versions}}get pinned(){if(G.default.existsSync(this._paths.pinned)){let e=G.default.readFileSync(this._paths.pinned,`utf-8`);return this._logger.debug({version:e},`Read pinned version`),e}}get latest(){let e=JSON.parse(G.default.readFileSync(this._paths.versions).toString()),t;return e.latestServer.forEach(e=>{e.substring(0,e.lastIndexOf(`.`))===Y.version.substring(0,e.lastIndexOf(`.`))&&(t=e)}),this._logger.debug({latest:t},`Resolved latest known version`),t}async pin(e){this._logger.info({version:e},`Pinning version`),await E(this._paths.pinned,e)}async unpin(){if(G.default.existsSync(this._paths.pinned))return this._logger.debug(`Removing pinned version`),await T(this._paths.pinned)}refresh(e,t=!1){let n;if(!e)try{e=JSON.parse(G.default.readFileSync(this._paths.manifest).toString())}catch{}e||={},this._logger.debug({manifestEntries:Object.keys(e).length},`Resolving installed core from manifest`);let a;try{let[e,t,n]=Ar().split(`/`);a=new Date(Date.UTC(Number.parseInt(n,10),Number.parseInt(t,10)-1,Number.parseInt(e,10))).getTime()}catch{}let o=this.pinned,s=Object.keys(e).map(t=>{let n=i(i(Y.paths.dirs.current,`wallaby`+t),`package.json`),r=o&&G.default.existsSync(n)?JSON.parse(G.default.readFileSync(n,`utf-8`)).version:void 0;return{id:t,pinned:o?r===o:!1,package:n,...e[t]}}).sort((e,t)=>t.releaseDate-e.releaseDate),c=new Date().getTime()-1e3*60*60*24*5;s.forEach(n=>{G.default.existsSync(n.package)?!n.pinned&&n.invalidated&&Object.keys(n.expiry).length===0&&n.invalidated<c&&(t=!0,delete e[n.id],G.default.remove(r(n.package)).catch(e=>{this._logger.warn({error:e,path:n.package},`Failed to remove invalidated core directory`)})):(t=!0,delete e[n.id])});let l=s.filter(t=>(!a||t.releaseDate<a)&&e[t.id]);if(l.length){if(a&&a<new Date().getTime()&&!e[l[0].id].expiry[a]){e[l[0].id].expiry[a]=!0;for(let t=1;t<l.length;t++)delete e[l[t].id].expiry[a];t=!0}let r=o?(l.find(e=>e.pinned)||l.find(e=>!e.invalidated)||l[0]).id:(l.find(e=>!e.invalidated)||l[0]).id;n=i(Y.paths.dirs.current,`wallaby`+r),this._logger.debug({coreFolder:n,pinnedVersion:o},`Selected installed core folder`)}return t&&(G.default.writeFileSync(this._paths.manifest,JSON.stringify(e)),this._logger.debug({coreVersionManifest:this._paths.manifest},`Saved updated core manifest`)),n}register(e,t){let n;try{n=JSON.parse(G.default.readFileSync(this._paths.manifest).toString());let e=new Date().getTime();Object.keys(n).forEach(r=>{!n[r].invalidated&&n[r].releaseDate<=t&&(n[r].invalidated=e)})}catch{n={}}return n[e]={releaseDate:t,invalidated:!1,expiry:{}},this._logger.debug({id:e,releaseDate:t},`Added new core version to manifest`),this.refresh(n,!0)}read(e){let t=JSON.parse(G.default.readFileSync(i(e,`package.json`)).toString()).version;return this._logger.debug({path:e,version:t},`Read version`),t}async handle(e){return e=e?.trim(),e?e===`0`?{update:!1,fresh:!0}:e===`latest`?(await this.unpin(),{update:!0,fresh:!0}):(await this.pin(e.startsWith(`v`)?e.slice(1):e),{update:!1,fresh:!0}):{update:!1,fresh:!1}}},Ir=class{_timeout;_retry=0;_dist;_restarter;get dist(){return this._dist}clear(){this._dist=void 0}set restarter(e){this._restarter=e}stop(){clearTimeout(this._timeout),this._timeout=void 0}async check(e,t){try{Q.debug({path:e},`Performing update check`);let n=await Mr(t,e);if(n.updated){this._dist=n;let e=new Fr().read(n.path);Q.debug({path:n.path,version:e},`Core update downloaded`),this._restarter?.restart(e),this._retry=0}}catch(t){this._retry++,Q.info({error:t,path:e,retry:this._retry},`Scheduled update check failed`)}finally{this._retry<=3?this.schedule(this._dist?.path||e,t):Q.warn({path:e,retry:this._retry},`Stopped scheduling update checks after repeated failures`)}}schedule(e,t){this.stop(),Q.debug({path:e},`Scheduled update check`),this._timeout=setTimeout(async()=>await this.check(e,t),600*1e3),this._timeout.unref()}};function Lr(e){let t=new ir.Spinner;return t.setSpinnerString(4),t.setSpinnerDelay(250),t.setSpinnerTitle(` ${K.default.green(`%s`)} ${e}`),t.start(),()=>t.stop(!0)}const Rr=J.create(`core/locator`),zr=e(import.meta.url);r(_(import.meta.url));async function Br(e){try{let e=zr.resolve(`@wallabyjs/core`);if(await G.default.pathExists(e))return Rr.info({path:e},`Using installed @wallabyjs/core package`),{path:e,type:`npm`}}catch(e){Rr.debug({error:e},`No installed @wallabyjs/core package found`)}let t=await e();if(!t)throw Error(`Could not locate installed Wallaby Core`);return t}const Vr=J.create(`core/launcher`);var Hr=class e{location;version;_process;_ready=e._createDeferred();_exited=e._createDeferred();_stopping=e._createDeferred();_interrupted=!1;_cleaned=!1;_tail=``;constructor(e,t,n){this._process=e,this.location=t,this.version=n,this._attach(),e.pid||this._fail(Error(`Failed to start Wallaby process: no PID`))}async exited(e){let t=this._exited.promise,{promise:n,cleanup:r}=this._waitShutdown(e);try{await Promise.race([this.ready,n,t]),await t}finally{r()}}get ready(){return this._ready.promise}get stopping(){return this._stopping.promise}release(){Vr.debug({pid:this._process.pid},`Releasing process handle`),this._cleanup(),this._process.stdout.destroy(),this._process.stderr.destroy(),this._process.unref()}async stop(e){if(!this._interrupted&&(this._interrupted=!0,this._stopping.resolve(),Vr.debug({pid:this._process.pid},`Stopping process`),!(this._process.exitCode!==null||this._process.signalCode!==null))){if(process.platform===`win32`&&e)Vr.debug(`Stopping process through RPC`),e();else if(!this._process.kill(`SIGTERM`))throw Error(`Failed to terminate Wallaby process`)}}_attach(){this._process.stdout.on(`data`,this._onStdOut),this._process.stderr.on(`data`,this._onStdError),this._process.on(`error`,this._onError),this._process.on(`exit`,this._onExit)}_waitShutdown(e){let t=new Map,n=!1,r=[`SIGINT`,`SIGTERM`];return{promise:new Promise((i,a)=>{for(let o of r){let r=()=>{n||(n=!0,this._handleShutdown(o,e).then(i,a))};t.set(o,r),process.on(o,r)}}),cleanup:()=>{for(let[e,n]of t)process.off(e,n)}}}async _handleShutdown(e,t){Vr.debug({signal:e},`Received shutdown signal`),await this.stop(t)}_onStdOut=e=>{if(this._tail===void 0)return;let t=this._tail+e.toString(`utf8`),n=t.match(/wallaby\.js started, port=(\d+)/);if(n){delete this._tail,this._process.stdout.off(`data`,this._onStdOut),this._ready.resolve(Number.parseInt(n[1],10));return}this._tail=t};_onStdError=e=>{let t=e.toString(`utf8`);Vr.warn({stderr:t}),this._tail!==void 0&&process.stdout.write(t)};_onError=e=>{Vr.error({error:e},`Process emitted an error`),this._fail(e,this._tail===void 0?`Wallaby process crashed`:`Wallaby process failed to start`),this._cleanup()};_onExit=(t,n)=>{Vr.info({code:t,signal:n},`Process exited`),this._tail!==void 0&&this._ready.reject(e._createExitError(`Wallaby exited unexpectedly before startup completed`,t,n)),this._interrupted?this._exited.resolve():this._exited.reject(e._createExitError(`Wallaby exited unexpectedly`,t,n)),this._cleanup()};_cleanup(){this._cleaned||(this._cleaned=!0,this._process.stdout.off(`data`,this._onStdOut),this._process.stderr.off(`data`,this._onStdError),this._process.off(`error`,this._onError),this._process.off(`exit`,this._onExit))}_fail(e,t){let n=t?Error(`${t}: ${e.message}`):e;this._ready.reject(n),this._interrupted?this._exited.resolve():this._exited.reject(n)}static _createDeferred(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}static _createExitError(e,t,n){let r=``;return n&&(r=` (signal: ${n})`),t!==null&&(r=` (code: ${t})`),Error(`${e}${r}.`)}};async function Ur(e,t,n){n?.stop();let r=await t.handle(e.update);r.fresh&&n?.clear();let a=async()=>await Mr(e.ssl,t.refresh(),r.update,!0),o=r.fresh?await Br(a):n?.dist||await Br(a);Vr.debug({...o},`Located target to launch`);let s=Wr(e,t.pinned),c=t.read(o.path),[,,l]=c.split(`.`);if(Number.parseInt(l,10)<2035)throw Vr.debug({revision:l},`Refusing to start unsupported version`),Error(`Wallaby Core v${c} is not supported by Wallaby CLI v ${Y.version}.\nRun with --update flag to get the latest version of Wallaby Core.`);Vr.info({args:s,revision:l},`Launching process`);let u=F(process.execPath,[i(o.path,`server.js`),`extended-core-ws`,...s],{detached:e.skill||process.platform===`win32`,stdio:[`ignore`,`pipe`,`pipe`]});return Vr.info({pid:u.pid},`Launched process`),new Hr(u,o,c)}function Wr(e,t){let n=[`--port=0`,`--lkp=${Or}`,`--cli=${Y.version}`];return e.config&&n.push(`--configPath=${s(e.config)}`),e.smart&&n.push(`--smartStart=true`),t&&n.push(`--pinned=`+t),e.cache===!1&&n.push(`--cache=no-run-result`),e.skill&&n.push(`--skill`),n}const Gr=J.create(`core/registry`);var Kr=class{_storeDirPath;constructor(e=i(Y.paths.dirs.home,`registry`)){this._storeDirPath=e,p(this._storeDirPath)||m(this._storeDirPath,{recursive:!0})}get manifests(){let e=[];try{for(let t of g(this._storeDirPath))if(t.endsWith(`.json`))try{let n=JSON.parse(h(i(this._storeDirPath,t),`utf8`));e.push(n)}catch(e){Gr.trace({error:e},`Failed to read manifest`)}}catch(e){Gr.error({error:e},`Failed to read registry directory`)}return e}},qr=R(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),Jr=R(((e,t)=>{let{EMPTY_BUFFER:n}=qr(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=B(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),Yr=R(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),Xr=R(((e,t)=>{let n=B(`zlib`),r=Jr(),i=Yr(),{kStatusCode:a}=qr(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),Zr=R(((e,t)=>{let{isUtf8:n}=B(`buffer`),{hasBlob:r}=qr(),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=B(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),Qr=R(((e,t)=>{let{Writable:n}=B(`stream`),r=Xr(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=qr(),{concat:c,toArrayBuffer:l,unmask:u}=Jr(),{isValidStatusCode:d,isValidUTF8:f}=Zr(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),$r=R(((e,t)=>{let{Duplex:n}=B(`stream`),{randomFillSync:r}=B(`crypto`),i=Xr(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=qr(),{isBlob:c,isValidStatusCode:l}=Zr(),{mask:u,toBuffer:d}=Jr(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8*1024,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);_(this,e,a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),ei=R(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=qr(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,`error`,{enumerable:!0}),Object.defineProperty(m.prototype,`message`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),ti=R(((e,t)=>{let{tokenChars:n}=Zr();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),ni=R(((e,t)=>{let n=B(`events`),r=B(`https`),i=B(`http`),a=B(`net`),o=B(`tls`),{randomBytes:s,createHash:c}=B(`crypto`),{Duplex:l,Readable:u}=B(`stream`),{URL:d}=B(`url`),f=Xr(),p=Qr(),m=$r(),{isBlob:h}=Zr(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=qr(),{EventTarget:{addEventListener:T,removeEventListener:E}}=ei(),{format:D,parse:O}=ti(),{toBuffer:k}=Jr(),A=Symbol(`kAborted`),j=[8,13],M=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],N=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var P=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),ee(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,ie),i.on(`drain`,ae),i.on(`error`,oe),i.on(`message`,ce),i.on(`ping`,L),i.on(`pong`,R),a.onerror=ue,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,V),t.on(`data`,de),t.on(`end`,fe),t.on(`error`,pe),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){I(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),z(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){re(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){re(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){re(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){I(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(P,`CONNECTING`,{enumerable:!0,value:M.indexOf(`CONNECTING`)}),Object.defineProperty(P.prototype,`CONNECTING`,{enumerable:!0,value:M.indexOf(`CONNECTING`)}),Object.defineProperty(P,`OPEN`,{enumerable:!0,value:M.indexOf(`OPEN`)}),Object.defineProperty(P.prototype,`OPEN`,{enumerable:!0,value:M.indexOf(`OPEN`)}),Object.defineProperty(P,`CLOSING`,{enumerable:!0,value:M.indexOf(`CLOSING`)}),Object.defineProperty(P.prototype,`CLOSING`,{enumerable:!0,value:M.indexOf(`CLOSING`)}),Object.defineProperty(P,`CLOSED`,{enumerable:!0,value:M.indexOf(`CLOSED`)}),Object.defineProperty(P.prototype,`CLOSED`,{enumerable:!0,value:M.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(P.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(P.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),P.prototype.addEventListener=T,P.prototype.removeEventListener=E,t.exports=P;function ee(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:j[1],maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!j.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${j.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;F(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?ne:te),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!N.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{I(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[A]||(S=e._req=null,F(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){I(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{F(e,SyntaxError(`Invalid URL: ${i}`));return}ee(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||I(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==P.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){I(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){I(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){I(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){I(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=O(u)}catch{I(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){I(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{I(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function F(e,t){e._readyState=P.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function te(e){return e.path=e.socketPath,a.connect(e)}function ne(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function I(e,t,n){e._readyState=P.CLOSING;let r=Error(n);Error.captureStackTrace(r,I),t.setHeader?(t[A]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(F,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function re(e,t,n){if(t){let n=h(t)?t.size:k(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${M[e.readyState]})`);process.nextTick(n,t)}}function ie(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,de),process.nextTick(le,n._socket),e===1005?n.close():n.close(e,t))}function ae(){let e=this[C];e.isPaused||e._socket.resume()}function oe(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,de),process.nextTick(le,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function se(){this[C].emitClose()}function ce(e,t){this[C].emit(`message`,e,t)}function L(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function R(e){this[C].emit(`pong`,e)}function le(e){e.resume()}function ue(e){let t=this[C];t.readyState!==P.CLOSED&&(t.readyState===P.OPEN&&(t._readyState=P.CLOSING,z(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function z(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function V(){let e=this[C];if(this.removeListener(`close`,V),this.removeListener(`data`,de),this.removeListener(`end`,fe),e._readyState=P.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,se),e._receiver.on(`finish`,se))}function de(e){this[C]._receiver.write(e)||this.pause()}function fe(){let e=this[C];e._readyState=P.CLOSING,e._receiver.end(),this.end()}function pe(){let e=this[C];this.removeListener(`error`,pe),this.on(`error`,w),e&&(e._readyState=P.CLOSING,this.destroy())}})),ri=R(((e,t)=>{ni();let{Duplex:n}=B(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),ii=R(((e,t)=>{let{tokenChars:n}=Zr();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),ai=R(((e,t)=>{let n=B(`events`),r=B(`http`),{Duplex:i}=B(`stream`),{createHash:a}=B(`crypto`),o=ti(),s=Xr(),c=ii(),l=ni(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=qr(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
65
|
-
`).join(`\r
|
|
66
|
-
`)),i.removeListener(`error`,g),p.setSocket(i,c,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on(`close`,()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(h,this)})),l(p,r)}};function m(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function h(e){e._state=2,e.emit(`close`)}function g(){this.destroy()}function _(e,t,n,i){n||=r.STATUS_CODES[t],i={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...i},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join(`\r
|
|
67
|
-
`)+`\r
|
|
68
|
-
\r
|
|
69
|
-
`+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));ri(),ti(),Xr(),Qr(),$r(),ii();var oi=z(ni(),1);ai();function si(e){if(!(e instanceof Error))return e;let t=e;return{...Object.keys(e).reduce((e,n)=>(e[n]=t[n],e),{}),name:e.name,message:e.message,stack:e.stack}}function ci(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){let t=e,n=Error(typeof t.message==`string`?t.message:String(e));return typeof t.name==`string`&&t.name&&(n.name=t.name),typeof t.stack==`string`&&t.stack&&(n.stack=t.stack),Object.assign(n,e),n}return Error(String(e))}var li=class e{properties;static nextId=0;id;sequenceNumber=1;awaitingPromises={};sendAcknowledgement=!0;remoteApiAcknowledgement=!0;inboundApi;_api;_originalProcessMessageReceived;constructor(t,n){this.properties=n;let r=this;this.id=e.nextId++,this._api=new Proxy({},{get:function(e,t){return async(...e)=>await r.sendInternal({method:t,args:e})}}),this.inboundApi=t(this)}get api(){return this._api}async processMethod(e,t,n){n?this.sendAcknowledgement&&e.sequenceNumber&&this.sendMessage({sequenceNumber:e.sequenceNumber,error:si(n)}):this.sendAcknowledgement&&e.sequenceNumber&&this.sendMessage({sequenceNumber:e.sequenceNumber,result:{value:t}})}async processResult(e,t,n,r){t(r)}async processError(e,t,n,r){n(ci(r))}async processMessageReceived(e){if(e.method)try{let t=await this.inboundApi[e.method].apply(this.inboundApi,e.args);await this.processMethod(e,t,void 0)}catch(t){t||=Error(`An unknown error occurred`),await this.processMethod(e,void 0,t)}else if(e.result){let{sequenceNumber:t,result:n}=e;if(this.awaitingPromises[t]){let{resolve:r,reject:i}=this.awaitingPromises[t];delete this.awaitingPromises[t],r&&n&&await this.processResult(e,r,i,n.value)}}else if(e.error){let{sequenceNumber:t,error:n}=e;if(this.awaitingPromises[t]){let{resolve:r,reject:i}=this.awaitingPromises[t];delete this.awaitingPromises[t],r&&i&&await this.processError(e,r,i,n)}}}rejectAwaitingPromises(e){Object.values(this.awaitingPromises).forEach(({reject:t})=>t(e))}async onMessageReceived(e){this.processMessageReceived(e)}async sendInternal(e){if(this.remoteApiAcknowledgement&&(this.remoteApiAcknowledgement===!0||this.remoteApiAcknowledgement(e)))return e.sequenceNumber=this.sequenceNumber++,await new Promise(async(t,n)=>{this.awaitingPromises[e.sequenceNumber]={resolve:t,reject:n};try{await this.sendMessage(e)}catch(t){delete this.awaitingPromises[e.sequenceNumber],n(t)}});try{await this.sendMessage(e)}catch{}}dispose(){this.onDisposeListeners.map(e=>e()),this.onDisposeListeners=[],this.onConnectedListeners=[],this.onVersionMismatchListeners=[],this.rejectAwaitingPromises(Error(`Channel disposed`))}onConnectedListeners=[];subscribeOnConnected(e){this.onConnectedListeners.push(e)}unsubscribeOnConnected(e){this.onConnectedListeners=this.onConnectedListeners.filter(t=>t!==e)}connected(){this.onConnectedListeners.map(e=>e()),this.onConnectedListeners=[]}onVersionMismatchListeners=[];subscribeOnVersionMismatch(e){this.onVersionMismatchListeners.push(e)}unsubscribeOnVersionMismatch(e){this.onVersionMismatchListeners=this.onVersionMismatchListeners.filter(t=>t!==e)}versionMismatch(e,t){this.onVersionMismatchListeners.map(n=>n(e,t))}onDisposeListeners=[];subscribeOnDispose(e){this.onDisposeListeners.push(e)}unsubscribeOnDispose(e){this.onDisposeListeners=this.onDisposeListeners.filter(t=>t!==e)}replaceReceiver(e){this._originalProcessMessageReceived||=this.processMessageReceived;let t=e.allowedCalls;this.processMessageReceived=n=>{if(e.filter(n)){if(t<=0)return e.replacement(n);t--}return this._originalProcessMessageReceived.bind(this)(n)}}restoreReceiver(){this.processMessageReceived=(this._originalProcessMessageReceived||this.processMessageReceived).bind(this),delete this._originalProcessMessageReceived}},ui=class{inboundApiFactory;channelBaseConstructor;_channels=[];get channels(){return[...this._channels]}constructor(e,t){this.inboundApiFactory=e,this.channelBaseConstructor=t}createChannel(e){let t=new this.channelBaseConstructor(this.inboundApiFactory,e);return this._channels.push(t),t.connected(),t}destroyChannel(e){let t=this._channels.indexOf(e);t!==-1&&this._channels.splice(t,1)[0].dispose()}dispose(){this.channels.map(e=>this.destroyChannel(e))}};function di(e){return e instanceof Error?e.message:String(e)}function fi(e){return e instanceof Error?e.toString():String(e)}function pi(e){return e instanceof Error?e:Error(String(e))}var mi=class extends li{_disposed=!1;_version=``;_onChannelError=()=>{};setOptions(e,t){this._onChannelError=e,this._version=t}async sendMessage(e){if(this._disposed){this._onChannelError(Error(`Channel has been disposed`));return}try{this._version&&typeof e==`object`&&e&&(e.version=this._version);let t=JSON.stringify(e);if(t===void 0)throw TypeError(`Failed to serialize RPC message`);this.properties.socket.send(t,e=>{e&&this.properties.logger.trace(`send callback error:%s`,di(e))})}catch(e){throw this.properties.logger.trace(`failed to send message: %s`,di(e)),e}}async processError(e,t,n,r){r&&this.properties.logger.trace(`error processing message: %s, %s`,e,fi(r)),await super.processError(e,t,n,r)}async processMessageReceived(e){e.method&&this.properties.logger.trace(`received method call: %s`,e.method),await super.processMessageReceived(e)}rejectAwaitingPromises(e){this._disposed||super.rejectAwaitingPromises(e)}dispose(){if(this._disposed=!0,super.dispose(),!this.properties.socket.CLOSED)try{this.properties.socket.close()}catch{}}};function hi(e,t,n){e.on(`message`,e=>{try{t(JSON.parse(e.toString()))}catch(e){n(pi(e))}})}function gi(e,t,n,r){let{secure:i,host:a,port:o,secret:s,onError:c,onClose:l}=e,u={};e.from&&(u.headers={from:e.from});let d=i?`wss://`:`ws://`,f=o?`:${o}`:``,p=s?`?secret=${s}`:``,m=new oi.default(d+(a||`localhost`)+f+p,u);return n&&hi(m,n,e=>{r.trace(`incoming message processing error: %s`,e?.message)}),m.onclose=({code:e,reason:t})=>{r.trace(`client disconnected: %s %s`,e,t);try{l&&l(m,e,t?.toString())}catch(e){r.trace(`error when closing connection: %s`,di(e))}},m.onerror=e=>{try{r.trace(`connection error: %s`,e.error),c&&c(e.error)}catch(e){r.trace(`error when processing connection error: %s`,di(e))}},m.onopen=()=>{t()},m}var _i=class extends ui{_socket;constructor(e,t){super(t,mi),e.onChannelError||=e=>{this.channels.forEach(t=>{t.rejectAwaitingPromises(e),this.destroyChannel(t)})},e.onError||=e=>{this.channels.forEach(t=>{t.rejectAwaitingPromises(e),this.destroyChannel(t)})},e.onClose||=(e,t,n)=>{this.channels.forEach(e=>{e.rejectAwaitingPromises(Error(`WebSocket closed with code ${t} and reason ${n}`)),this.destroyChannel(e)})},this._socket=gi(e,()=>{this.createChannel({socket:this._socket,logger:e.logger}).setOptions(e.onChannelError,e.version)},e=>{this.channels.forEach(t=>{t.onMessageReceived(e)})},e.logger)}dispose(){this._socket?.close(),super.dispose()}};const vi=J.create(`core/session`);var yi=class{_channels;constructor(e){this._channels=e}get _channel(){let[e]=this._channels();if(!e)throw Error(`Core RPC channel is not available`);return e}handshake(e){return this._channel.api.handshake(e)}signal(e){this._channel.api.signal(e)}run(e){return this._channel.api.run(e)}export(e){return this._channel.api.export(e)}stop(){this._channel.api.stop()}},bi=class{ping(){}notify(e){}restart(){}launched(e){}relicensed(){}stopped(e){}},xi=class{_client;_alive=Ci();_api;_disposed=!1;_deactivated=!1;_interrupted=!1;constructor(e,t){this._client=e,this._api=t(()=>this._client.channels)}get alive(){return this._alive.promise}get api(){return this._api}deactivate(){this._deactivated=!0}interrupt(e){if(!this._interrupted){if(this._interrupted=!0,this._deactivated||this._disposed){this._alive.resolve();return}this._alive.reject(e)}}dispose(){this._disposed||(this._disposed=!0,this._interrupted||(this._interrupted=!0,this._alive.resolve()),this._client.dispose())}};async function Si(e,t,n){let r=!1,i=!1,a,o=Ci(),s=e=>{if(!r){r=!0,o.reject(e);return}i&&a.interrupt(e)};a=new xi(new _i({port:e,from:`cli`,logger:{trace:(...e)=>{let[t,n,...r]=e;if(typeof t==`string`){vi.trace(te(t,n,...r));return}if(typeof n==`string`||n===void 0){vi.trace(t,n,...r);return}vi.trace({args:e},`Websocket`)}},version:`1.0.0`,onError:e=>{vi.debug({error:e},`Socket error`),s(e)},onChannelError:e=>{vi.debug({error:e},`Channel error`),s(e)},onClose:(e,t,n)=>{vi.debug({code:t,reason:n},`Socket closed`),s(Error(`Socket closed with code ${t} and reason: ${n}`))}},n=>(n.subscribeOnConnected(async()=>{r||(i=!0,r=!0,vi.debug({port:e},`Connected`),o.resolve())}),t)),n);try{return await o.promise,a}catch(e){throw a.dispose(),e}}function Ci(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const wi=new Ir;var Ti=class extends bi{_options;_path;_restart;constructor(e,t,n){super(),this._options=e,this._path=t,this._restart=n}ping(){}notify(e){}restart(){this._restart()}launched(e){}relicensed(){this._path&&(wi.stop(),wi.check(this._path,this._options.ssl))}stopped(e){}},Ei=class{_logger=J.create(`commands/run`);async execute(e){this._logger.info({cwd:j(),options:e},`Executing run command`);let t=await this._execute(e);return this._logger.info({result:t},`Executed run command`),t}async _execute(e){let t=await this._cycle(e);return t?`restarted`in t?(this._logger.info(`Restarting process`),await this._execute(e)):(console.info(t.message),t.success):!1}async _cycle(e){let t=!1,n=!1,r,i,a,o=()=>{t=!0},s=await this._attach(e,()=>new Ti(e,void 0,()=>{n||r!==void 0||(n=!0,o())}),e=>new yi(e));if(!s)return await this._launch(e);let{manifest:c,session:l}=s;this._logger.info({id:c.id,pid:c.pids.primary,port:c.ports.primary},`Connected to active process from registry`),o=()=>{t||(t=!0,l.deactivate())};let u=k(),d=this._handshake(l).then(async()=>(await this._run(u,l,e),await l.api.export({id:u}))).then(e=>{n||r!==void 0||(r=e,o())}).catch(e=>{n||t||(i=e,o())}),f=l.alive.catch(e=>{t||(a=e,o())});try{await d}finally{o(),l.dispose(),await f}if(n)return{restarted:!0};if(a)throw a;if(i)throw i;return r}async _launch(e){let t=await Ur({...e,cache:!1,skill:e.skill,smart:e.smart||e.paths.length>0},new Fr,wi),n,r=()=>n?(n(),!0):!1,i=t.exited(r),a=await Promise.race([t.ready,i.then(()=>void 0)]);if(a===void 0)return;let o,s,c,l,u,d=!1,f=!1,p=!1,m,h,g,_,v=()=>(_?.(),h||(h=t.stop(r),h.catch(()=>{})),h);try{g=await Si(a,new Ti(e,t.location.path,()=>{p||u!==void 0||(p=!0,v())}),e=>new yi(e)),n=()=>g.api.stop(),wi.restarter={restart(e){g.api.signal({type:`update`,version:e})}},_=()=>{f||(f=!0,g.deactivate())}}catch(e){try{await t.stop(),await i}catch(e){this._logger.warn({error:e},`Failed to stop process after connection failure`)}throw e}t.stopping.then(()=>{_?.()}),m=this._handshake(g).then(async()=>{t.location.type===`dist`&&wi.schedule(t.location.path,e.ssl);let n=k();return await this._run(n,g,e),await g.api.export({id:n})}).then(t=>{if(!(p||u!==void 0)){if(u=t,e.skill){d=!0,_?.();return}return v()}}).catch(async e=>{if(!(p||f)){c=e;try{await v()}catch(e){this._logger.warn({error:e},`Failed to stop process after run/export failure`)}}});let y=g.alive.catch(async e=>{if(!f){s=e;try{await v()}catch(e){this._logger.warn({error:e},`Failed to stop process after connection loss`)}}});try{if(m&&await m,d&&t.release(),!d)try{await i}catch(e){o=e}}finally{if(wi.stop(),wi.restarter=void 0,g.dispose(),await y,h)try{await h}catch(e){l=e}}if(l)throw l;if(p)return{restarted:!0};if(o)throw o;if(s)throw s;if(c)throw c;if(u)return u}async _attach(e,t,n){if(e.force)return;let r=this._find(e);if(r.length===0)return;let i=await this._connect(r,t,n);if(i)return i;throw Error(`Failed to attach to active Wallaby instance for the specified config.`)}async _connect([e,...t],n,r){if(e){this._logger.info({id:e.id,pid:e.pids.primary,port:e.ports.primary},`Trying to connect to active process from registry`);try{return{manifest:e,session:await Si(e.ports.primary,n(e),r)}}catch(i){return this._logger.warn({error:i,id:e.id,pid:e.pids.primary,port:e.ports.primary},`Failed to connect to active process from registry`),await this._connect(t,n,r)}}}async _run(e,t,n){await t.api.run({id:e,paths:n.paths})}async _handshake(e){let t=await e.api.handshake(Y.version);if(!t.compatible)throw Error(t.message||`Wallaby CLI v${Y.version} is not compatible with the running Wallaby Core.`)}_find(e){let t=ln(s(e.config?e.config:i(j(),`auto.detect`)));return new Kr().manifests.filter(e=>e.paths.config===t).sort((e,t)=>t.timestamps.refreshed-e.timestamps.refreshed).filter(e=>{try{return process.kill(e.pids.primary,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}})}},Di=R(((e,t)=>{t.exports=a,a.sync=o;var n=B(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}})),Oi=R(((e,t)=>{t.exports=r,r.sync=i;var n=B(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),ki=R(((e,t)=>{B(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Di():Oi();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),Ai=R(((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=B(`path`),i=n?`;`:`:`,a=ki(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}})),ji=R(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),Mi=R(((e,t)=>{let n=B(`path`),r=Ai(),i=ji();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o})),Ni=R(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),Pi=R(((e,t)=>{t.exports=/^#!(.*)/})),Fi=R(((e,t)=>{let n=Pi();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),Ii=R(((e,t)=>{let n=B(`fs`),r=Fi();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i})),Li=R(((e,t)=>{let n=B(`path`),r=Mi(),i=Ni(),a=Ii(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d})),Ri=R(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),zi=R(((e,t)=>{let n=B(`child_process`),r=Li(),i=Ri();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i}));function Bi(){try{return d.statSync(`/.dockerenv`),!0}catch{return!1}}function Vi(){try{return d.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function Hi(){return Ui===void 0&&(Ui=Bi()||Vi()),Ui}var Ui,Wi=L((()=>{}));function Gi(){return Ki===void 0&&(Ki=qi()||Hi()),Ki}var Ki,qi,Ji=L((()=>{Wi(),qi=()=>{try{return d.statSync(`/run/.containerenv`),!0}catch{return!1}}})),Yi,Xi,Zi=L((()=>{Ji(),Yi=()=>{if(A.platform!==`linux`)return!1;if(c.release().toLowerCase().includes(`microsoft`))return!Gi();try{if(d.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`))return!Gi()}catch{}return d.existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)||d.existsSync(`/run/WSL`)?!Gi():!1},Xi=A.env.__IS_WSL_TEST__?Yi:Yi()})),Qi,$i,ea,ta=L((()=>{Zi(),Qi=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await v.access(n,y.F_OK),r=!0}catch{}if(!r)return e;let i=await v.readFile(n,{encoding:`utf8`}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return a?(t=a.groups.mountPoint.trim(),t=t.endsWith(`/`)?t:`${t}/`,t):e}})(),$i=async()=>`${await Qi()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,ea=async()=>Xi?$i():`${A.env.SYSTEMROOT||A.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`}));function na(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}var ra=L((()=>{}));async function ia(){if(A.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await aa(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}var aa,oa=L((()=>{aa=ne(ee)}));async function sa(e,{humanReadableOutput:t=!0,signal:n}={}){if(A.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await ca(`osascript`,[`-e`,e,r],i);return a.trim()}var ca,la=L((()=>{ca=ne(ee)}));async function ua(e){return sa(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var da=L((()=>{la()}));async function fa(e=pa){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new ha(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return ma[r]??ma[o]??ma[s]??{name:r,id:r}}var pa,ma,ha,ga=L((()=>{pa=ne(ee),ma={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},new Map(Object.entries(ma)),ha=class extends Error{}}));async function _a(){if(A.platform===`darwin`){let e=await ia();return{name:await ua(e),id:e}}if(A.platform===`linux`){let{stdout:e}=await va(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:ya(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(A.platform===`win32`)return fa();throw Error(`Only macOS, Linux, and Windows are supported`)}var va,ya,ba=L((()=>{oa(),da(),ga(),va=ne(ee),ya=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())})),xa=le({apps:()=>Pa,default:()=>Ma,openApp:()=>Na});async function Sa(){let e=await ea(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:n}=await Ta(e,[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`,I.from(t,`utf16le`).toString(`base64`)],{encoding:`utf8`}),r=n.trim(),i={ChromeHTML:`com.google.chrome`,BraveHTML:`com.brave.Browser`,MSEdgeHTM:`com.microsoft.edge`,FirefoxURL:`org.mozilla.firefox`};return i[r]?{id:i[r]}:{}}function Ca(e){if(typeof e==`string`||Array.isArray(e))return e;let{[ka]:t}=e;if(!t)throw Error(`${ka} is not supported`);return t}function wa({[Oa]:e},{wsl:t}){if(t&&Xi)return Ca(t);if(!e)throw Error(`${Oa} is not supported`);return Ca(e)}var Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa=L((()=>{ta(),ra(),ba(),Ji(),Ta=ne(N.execFile),Ea=t.dirname(_(import.meta.url)),Da=t.join(Ea,`xdg-open`),{platform:Oa,arch:ka}=A,Aa=async(e,t)=>{let n;for(let r of e)try{return await t(r)}catch(e){n=e}throw n},ja=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return Aa(e.app,t=>ja({...e,app:t}));let{name:t,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(t))return Aa(t,t=>ja({...e,app:{name:t,arguments:n}}));if(t===`browser`||t===`browserPrivate`){let r={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.Browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a=Xi?await Sa():await _a();if(a.id in r){let o=r[a.id];return t===`browserPrivate`&&n.push(i[o]),ja({...e,app:{name:Pa[o],arguments:n}})}throw Error(`${a.name} is not supported as a default browser`)}let r,i=[],a={};if(Oa===`darwin`)r=`open`,e.wait&&i.push(`--wait-apps`),e.background&&i.push(`--background`),e.newInstance&&i.push(`--new`),t&&i.push(`-a`,t);else if(Oa===`win32`||Xi&&!Gi()&&!t){r=await ea(),i.push(`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`),Xi||(a.windowsVerbatimArguments=!0);let o=[`Start`];e.wait&&o.push(`-Wait`),t?(o.push(`"\`"${t}\`""`),e.target&&n.push(e.target)):e.target&&o.push(`"${e.target}"`),n.length>0&&(n=n.map(e=>`"\`"${e}\`""`),o.push(`-ArgumentList`,n.join(`,`))),e.target=I.from(o.join(` `),`utf16le`).toString(`base64`)}else{if(t)r=t;else{let e=!Ea||Ea===`/`,t=!1;try{await v.access(Da,y.X_OK),t=!0}catch{}r=A.versions.electron??(Oa===`android`||e||!t)?`xdg-open`:Da}n.length>0&&i.push(...n),e.wait||(a.stdio=`ignore`,a.detached=!0)}Oa===`darwin`&&n.length>0&&i.push(`--args`,...n),e.target&&i.push(e.target);let o=N.spawn(r,i,a);return e.wait?new Promise((t,n)=>{o.once(`error`,n),o.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r>0){n(Error(`Exited with code ${r}`));return}t(o)})}):(o.unref(),o)},Ma=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return ja({...t,target:e})},Na=(e,t)=>{if(typeof e!=`string`&&!Array.isArray(e))throw TypeError("Expected a valid `name`");let{arguments:n=[]}=t??{};if(n!=null&&!Array.isArray(n))throw TypeError("Expected `appArguments` as Array type");return ja({...t,app:{name:e,arguments:n}})},Pa={},na(Pa,`chrome`,()=>wa({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),na(Pa,`brave`,()=>wa({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),na(Pa,`firefox`,()=>wa({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),na(Pa,`edge`,()=>wa({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),na(Pa,`browser`,()=>`browser`),na(Pa,`browserPrivate`,()=>`browserPrivate`)})),Ia=z(zi(),1);const $=J.create(`browser`);function La(e){let t=process.env.BROWSER||``;$.info({url:e,browser:t||`default`},`Opening browser`),t.toLowerCase().endsWith(`.js`)?za(t,e):t.toLowerCase()===`none`?$.debug({url:e},`Browser auto-open disabled by environment`):Va(t,process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(` `):[],e)}function Ra(e,t){return new Promise((n,r)=>{$.debug({command:e,cwd:t?.cwd},`Executing shell command`),P(e,t,(i,a)=>{i?($.error({err:i,command:e,cwd:t?.cwd},`Shell command failed`),r(i)):($.debug({command:e,cwd:t?.cwd},`Shell command completed`),n(a.toString()))})})}function za(e,t){let n=process.argv.slice(2);$.debug({scriptPath:e,url:t,extraArgs:n},`Launching browser script`);let r=(0,Ia.default)(process.execPath,[e,...n,t],{stdio:`inherit`});r.on(`error`,n=>{$.error({err:n,scriptPath:e,url:t},`Browser script process failed to start`)}),r.on(`close`,n=>{n===0?$.debug({scriptPath:e,url:t},`Browser script completed successfully`):($.warn({code:n,scriptPath:e,url:t},`Browser script exited with a non-zero status`),process.stdout.write(K.default.red(`\nThe script specified as BROWSER environment variable failed.\n\n${K.default.cyan(e)} exited with code ${n}.`)))})}const Ba=[`Google Chrome Canary`,`Google Chrome Dev`,`Google Chrome Beta`,`Google Chrome`,`Microsoft Edge`,`Brave Browser`,`Vivaldi`,`Chromium`];async function Va(e,t,n){let r=e===`google chrome`?`Google Chrome`:e,i=process.platform===`darwin`&&(!r||Ba.includes(r));if($.debug({browser:r,browserArgs:t,url:n},`Starting browser process`),i)try{let e=await Ra(`ps cax`),t=r&&e.includes(r)?r:Ba.find(t=>e.includes(t));if(t)return await Ra(`osascript openChrome.applescript "${encodeURI(n)}" "${t}"`,{cwd:Y.paths.dirs.package.bin}),$.debug({openedBrowser:t,url:n},`Opened browser via AppleScript`),!0}catch(e){$.debug({err:e,url:n},`AppleScript browser reuse attempt failed`)}process.platform===`darwin`&&e===`open`&&(e=void 0);try{let r=e?{app:{name:e,arguments:t}}:{},i;try{i=(await Promise.resolve().then(()=>(Fa(),xa))).default}catch(e){$.error({err:e},`Failed to import browser opener`)}if(i)try{let t=await i(n,r);$.debug({url:n,browser:e||`default`},`Opened browser with open package`),t.on(`error`,e=>{$.error({err:e,url:n},`Browser subprocess reported an error`),process.stderr.write(e.stack||e.message)})}catch(e){$.error({err:e,url:n},`Failed to open browser`),process.stderr.write(e instanceof Error?e.stack||e.message:String(e))}else $.warn({url:n},`Browser opener module was unavailable`);return!0}catch(t){return $.warn({err:t,url:n,browser:e||`default`},`Browser launch failed`),!1}}const Ha=J.create(`core/notifications`);function Ua(e,t){if(!t.text){Ha.trace({type:t.type},`Skipping empty notification`);return}Ha.debug({type:t.type,button:!!t.button},`Received notification from core`);let n=[];if(~t.text.indexOf(`expire`)&&t.type===`warning`&&e.notifications===!1){Ha.trace({type:t.type},`Suppressed expiration notification`);return}let r=`http://localhost:${e.port}`;~t.text.indexOf(`activate-link`)&&e.port&&n.push({title:`Enter License`,url:r}),~t.text.indexOf(`continue-trial-link`)&&e.port&&n.push({title:`Continue Trial`,url:r}),t.button&&n.push({title:t.button.label,url:t.button.link}),t.text=t.text.replace(/<br\/><br\/>/g,` `).replace(/<br\/>/g,` `).replace(/<a\s+(?:[^>]*?\s+)?href=['"]([^'"]*)['"]/g,(e,t)=>(t.startsWith(`http`)&&n.push({url:t}),e)).replace(/<[^>]*>/g,``);let i=t.type===`error`?K.default.red:t.type===`warning`?K.default.yellow:K.default.green;if(process.stdout.write(i(`\n ⚑ ${t.text}\n\n`)),n.length)for(let e of n)process.stdout.write(`${K.default.green(` ➜ `)}${K.default.bold(K.default.yellow(e.title?e.title+`: `:``))}${K.default.cyan(e.url)}\n`);Ha.trace({links:n},`Rendered notification links`)}const Wa=new Ir;var Ga=class extends bi{_options;_path;_version;_restart;_port;constructor(e,t,n,r){super(),this._options=e,this._path=t,this._version=n,this._restart=r}ping(){}notify(e){Ua({notifications:this._options.notifications,port:this._port,ui:this._options.ui},e)}restart(){this._restart()}launched(e){this._port=e;let t=`http://localhost:${e}`;process.stdout.write(K.default.green(` ${K.default.bold(`WALLABY CORE`)}${this._version?` v${this._version}`:``}\n`)),process.stdout.write(`${K.default.green(` ➜ `)}${K.default.bold(K.default.yellow(`UI:`))} ${K.default.cyan(t)}\n`),process.stdout.write(`${K.default.green(` ➜ `)}${K.default.bold(K.default.dim(`Docs:`))} ${K.default.cyan(`https://wallabyjs.com/docs`)}\n`),this._options.ui!==!1&&La(t)}relicensed(){this._path&&(Wa.stop(),Wa.check(this._path,this._options.ssl))}stopped(e){}},Ka=class{_logger=J.create(`commands/start`);async execute(e){this._logger.info({cwd:j(),options:e},`Executing start command`);let t=await this._execute(e);return this._logger.info({result:t},`Executed start command`),t}async _execute(e){return await this._cycle(e)?(this._logger.info(`Restarting process`),await this._execute(e)):!0}async _cycle(e){if(!e.force){let t=this._find(e)[0];if(t)return this._logger.info({id:t.id,pid:t.pids.primary,port:t.ports.primary},`Active process is already running for the specified config`),console.warn(`Wallaby Core is already started.`),!1}let t=await Ur({...e,smart:e.smart||e.paths.length>0},new Fr,Wa),n,r=()=>n?(n(),!0):!1,i=t.exited(r),a=await Promise.race([t.ready,i.then(()=>void 0)]);if(a===void 0)return!1;let o,s,c,l,u=!1,d,f,p=()=>(d||(d=t.stop(r),d.catch(()=>{})),d);try{f=await Si(a,new Ga(e,t.location.path,t.version,()=>{u||(u=!0,p())}),e=>new yi(e)),n=()=>f.api.stop(),Wa.restarter={restart(e){f.api.signal({type:`update`,version:e})}}}catch(e){try{await t.stop(),await i}catch(e){this._logger.warn({error:e},`Failed to stop process after connection failure`)}throw e}t.stopping.then(()=>f.deactivate());let m=f.alive.catch(async e=>{s=e;try{await p()}catch(e){this._logger.warn({error:e},`Failed to stop process after connection loss`)}});try{await this._handshake(f),t.location.type===`dist`&&Wa.schedule(t.location.path,e.ssl),await this._run(f,e).catch(async e=>{if(!u){c=e;try{await p()}catch(e){this._logger.warn({error:e},`Failed to stop process after run failure`)}}}),await i}catch(e){if(o=e,!u)try{await p(),await i.catch(()=>{})}catch(e){this._logger.warn({error:e},`Failed to stop process after startup failure`)}}finally{if(Wa.stop(),Wa.restarter=void 0,f.dispose(),await m,d)try{await d}catch(e){l=e}}if(l)throw l;if(o)throw o;if(c)throw c;if(s&&!(s instanceof Error&&s.message.startsWith(`Socket closed with code 1006 and reason:`)))throw s;return u}async _run(e,t){t.paths.length!==0&&await e.api.run({id:k(),paths:t.paths})}async _handshake(e){let t=await e.api.handshake(Y.version);if(!t.compatible)throw Error(t.message||`Wallaby CLI v${Y.version} is not compatible with the running Wallaby Core.`)}_find(e){let t=ln(s(e.config?e.config:i(j(),`auto.detect`)));return new Kr().manifests.filter(e=>e.paths.config===t).sort((e,t)=>t.timestamps.refreshed-e.timestamps.refreshed).filter(e=>{try{return process.kill(e.pids.primary,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}})}},qa=class{_logger=J.create(`commands/stop`);async execute(e){this._logger.info({cwd:j(),options:e},`Executing stop command`);let t=ln(s(e.config?e.config:i(j(),`auto.detect`)));this._logger.info({config:t},`Determined config path and config directory`);let n=new Kr().manifests.filter(n=>e.all?!0:e.config?n.paths.config===t:r(n.paths.config)===r(t));if(n.length!==0)for(let e of n)this._stop(e);else this._logger.info(`No running processes matched stop criteria`);this._logger.info({count:n.length},`Executed stop command`)}_stop(e){this._logger.info({id:e.id,pid:e.pids.primary,config:e.paths.config},`Stopping process from registry`);try{process.kill(e.pids.primary,`SIGTERM`)}catch(e){this._logger.info({error:e},`Failed to send SIGTERM to process, it may have already stopped`)}this._logger.info({id:e.id,pid:e.pids.primary},`Stopped process from registry`)}};J.initialize({path:i(Y.paths.dirs.current,`logs`,`trace.log`)});const Ja=J.create(`cli`);async function Ya(){Ja.trace({argv:process.argv.slice(2),version:Y.version},`Parsing CLI arguments`);let e=gt(process.argv,Y.version);if(e){if(await G.default.ensureDir(Y.paths.dirs.current),e.action===`stop`){await new qa().execute(e.options);return}if(e.action===`run`){let t=await new Ei().execute(e.options);process.exitCode=+!t;return}await new Ka().execute(e.options)}}async function Xa(){try{await Ya()}catch(e){Ja.error({error:e},`Wallaby CLI failed`),console.error(K.default.red(e instanceof Error?e.message:String(e))),process.exitCode=1}finally{try{await J.shutdown()}catch(e){process.stderr.write(`[logger] ${e instanceof Error?e.stack||e.message:String(e)}\n`),process.exitCode=1}}}Xa();export{};
|
|
82
|
+
-----END RSA PUBLIC KEY-----`})}verify(e){this.version=JSON.parse(e.readAsText(`package.json`)).version,this.date=new Date(e.getEntry(`package.json`).header.time),this.date.setMinutes(this.date.getMinutes()-this.date.getTimezoneOffset());let[t,n,r]=this.version.split(`.`).map(e=>Number.parseInt(e,10));return t>1||n>0||r>1091?super.verify(e):!0}};async function Ni(e,t,n,r){let a=!1;Q.debug({path:t,latest:n,reuse:r,ssl:e},`Resolving distribution with update policy`);let o=new Ii,s=ji(),c=e===`off`?`http`:`https`,l=`${c}://update.wallabyjs.com/`,u=l,d=t=>ci(`version`,`${t}wallaby.json?${s?`expiry=`+s.replace(/\//g,`-`):``}`,Ai.versions,void 0,e!==`relaxed`),f=o.pinned,p=n?!1:!!t&&G.default.existsSync(t),m=i(Ai.downloads,`wallaby.zip`);if(!p&&!n&&G.default.existsSync(m))try{t=await Fi(m),p=!!t&&G.default.existsSync(t),a=!0,Q.debug({path:t},`Recovered from cached archive`)}catch(e){Q.info({error:e,distFilePath:m},`Failed to recover from cached archive`)}let h;if(r&&p)h=o.read(t),Q.debug({path:t,latestVersion:h},`Using installed version`);else{let e=Ri(`Downloading version file`);try{try{await d(l)}catch{u=`${c}://s3.amazonaws.com/wallaby-downloads/`,Q.debug({downloadUrl:u},`Falling back to S3 metadata endpoint`),await d(`http://update.wallabyjs.com/`)}}finally{e()}h=o.latest,Q.debug({latestVersion:h},`Fetched latest version`)}if(f&&(h&&(0,oi.gt)(f,h)?await o.unpin():h=f,Q.debug({pinnedVersion:f,latestVersion:h},`Applied pinned version policy`)),!(p&&o.read(t)===h))try{t=await Pi(`core`,`${u}wallaby-v${h}.zip`,e),a=!0}catch{Q.info({latestVersion:h},`Primary download failed, falling back to S3 archive`),t=await Pi(`core`,`${c}://s3.amazonaws.com/wallaby-downloads/wallaby-v${h}.zip`,e),a=!0}return Q.debug({path:t,updated:a,latestVersion:h},`Resolved dist`),{path:t,updated:a,type:`dist`}}async function Pi(e,t,n){Q.debug({name:e,from:t,ssl:n},`Downloading and extracting dist`);let r=Ri(`Downloading core`),a=i(Ai.downloads,`wallaby.zip`);try{G.default.ensureDirSync(Ai.downloads),await ci(e,t,a,2e6,n!==`relaxed`)}finally{r()}let o=Ri(`Extracting core`);try{return await Fi(a)}catch(t){throw Q.error({error:t,downloadedArchiveFilePath:a},`Failed to extract archive`),Error(`Error while unzipping wallaby.js ${e} file: ${t instanceof Error?t.message:String(t)}`,{cause:t})}finally{o()}}async function Fi(e){let t=k.randomBytes(3).toString(`hex`),n=i(Y.paths.dirs.current,`wallaby`+t);for(;G.default.existsSync(n);)t=k.randomBytes(3).toString(`hex`),n=i(Y.paths.dirs.current,`wallaby`+t);let r=new Mi;await Di({from:e,to:n,verifier:r});let a=new Ii().register(t,r.date.getTime());return Q.debug({from:e,to:{extracted:n,registered:a}},`Extracted dist`),a}var Ii=class{_logger=J.create(`core/installer/vm`);_paths;constructor(e){this._paths={pinned:e?.pinned??Ai.pinned,manifest:e?.manifest??Ai.manifest,versions:e?.versions??Ai.versions}}get pinned(){if(G.default.existsSync(this._paths.pinned)){let e=G.default.readFileSync(this._paths.pinned,`utf-8`);return this._logger.debug({version:e},`Read pinned version`),e}}get latest(){let e=JSON.parse(G.default.readFileSync(this._paths.versions).toString()),t;return e.latestServer.forEach(e=>{e.substring(0,e.lastIndexOf(`.`))===Y.version.substring(0,e.lastIndexOf(`.`))&&(t=e)}),this._logger.debug({latest:t},`Resolved latest known version`),t}async pin(e){this._logger.info({version:e},`Pinning version`),await E(this._paths.pinned,e)}async unpin(){if(G.default.existsSync(this._paths.pinned))return this._logger.debug(`Removing pinned version`),await T(this._paths.pinned)}refresh(e,t=!1){let n;if(!e)try{e=JSON.parse(G.default.readFileSync(this._paths.manifest).toString())}catch{}e||={},this._logger.debug({manifestEntries:Object.keys(e).length},`Resolving installed core from manifest`);let a;try{let[e,t,n]=ji().split(`/`);a=new Date(Date.UTC(Number.parseInt(n,10),Number.parseInt(t,10)-1,Number.parseInt(e,10))).getTime()}catch{}let o=this.pinned,s=Object.keys(e).map(t=>{let n=i(i(Y.paths.dirs.current,`wallaby`+t),`package.json`),r=o&&G.default.existsSync(n)?JSON.parse(G.default.readFileSync(n,`utf-8`)).version:void 0;return{id:t,pinned:o?r===o:!1,package:n,...e[t]}}).sort((e,t)=>t.releaseDate-e.releaseDate),c=new Date().getTime()-1e3*60*60*24*5;s.forEach(n=>{G.default.existsSync(n.package)?!n.pinned&&n.invalidated&&Object.keys(n.expiry).length===0&&n.invalidated<c&&(t=!0,delete e[n.id],G.default.remove(r(n.package)).catch(e=>{this._logger.warn({error:e,path:n.package},`Failed to remove invalidated core directory`)})):(t=!0,delete e[n.id])});let l=s.filter(t=>(!a||t.releaseDate<a)&&e[t.id]);if(l.length){if(a&&a<new Date().getTime()&&!e[l[0].id].expiry[a]){e[l[0].id].expiry[a]=!0;for(let t=1;t<l.length;t++)delete e[l[t].id].expiry[a];t=!0}let r=o?(l.find(e=>e.pinned)||l.find(e=>!e.invalidated)||l[0]).id:(l.find(e=>!e.invalidated)||l[0]).id;n=i(Y.paths.dirs.current,`wallaby`+r),this._logger.debug({coreFolder:n,pinnedVersion:o},`Selected installed core folder`)}return t&&(G.default.writeFileSync(this._paths.manifest,JSON.stringify(e)),this._logger.debug({coreVersionManifest:this._paths.manifest},`Saved updated core manifest`)),n}register(e,t){let n;try{n=JSON.parse(G.default.readFileSync(this._paths.manifest).toString());let e=new Date().getTime();Object.keys(n).forEach(r=>{!n[r].invalidated&&n[r].releaseDate<=t&&(n[r].invalidated=e)})}catch{n={}}return n[e]={releaseDate:t,invalidated:!1,expiry:{}},this._logger.debug({id:e,releaseDate:t},`Added new core version to manifest`),this.refresh(n,!0)}read(e){let t=JSON.parse(G.default.readFileSync(i(e,`package.json`)).toString()).version;return this._logger.debug({path:e,version:t},`Read version`),t}async handle(e){return e=e?.trim(),e?e===`0`?{update:!1,fresh:!0}:e===`latest`?(await this.unpin(),{update:!0,fresh:!0}):(await this.pin(e.startsWith(`v`)?e.slice(1):e),{update:!1,fresh:!0}):{update:!1,fresh:!1}}},Li=class{_timeout;_retry=0;_dist;_restarter;get dist(){return this._dist}clear(){this._dist=void 0}set restarter(e){this._restarter=e}stop(){clearTimeout(this._timeout),this._timeout=void 0}async check(e,t){try{Q.debug({path:e},`Performing update check`);let n=await Ni(t,e);if(n.updated){this._dist=n;let e=new Ii().read(n.path);Q.debug({path:n.path,version:e},`Core update downloaded`),this._restarter?.restart(e),this._retry=0}}catch(t){this._retry++,Q.info({error:t,path:e,retry:this._retry},`Scheduled update check failed`)}finally{this._retry<=3?this.schedule(this._dist?.path||e,t):Q.warn({path:e,retry:this._retry},`Stopped scheduling update checks after repeated failures`)}}schedule(e,t){this.stop(),Q.debug({path:e},`Scheduled update check`),this._timeout=setTimeout(async()=>await this.check(e,t),600*1e3),this._timeout.unref()}};function Ri(e){let t=new ai.Spinner;return t.setSpinnerString(4),t.setSpinnerDelay(250),t.setSpinnerTitle(` ${K.default.green(`%s`)} ${e}`),t.start(),()=>t.stop(!0)}const zi=J.create(`core/locator`),Bi=e(import.meta.url);r(_(import.meta.url));async function Vi(e){try{let e=Bi.resolve(`@wallabyjs/core`);if(await G.default.pathExists(e))return zi.info({path:e},`Using installed @wallabyjs/core package`),{path:e,type:`npm`}}catch(e){zi.debug({error:e},`No installed @wallabyjs/core package found`)}let t=await e();if(!t)throw Error(`Could not locate installed Wallaby Core`);return t}const Hi=J.create(`core/launcher`);var Ui=class e{location;version;_process;_ready=e._createDeferred();_exited=e._createDeferred();_stopping=e._createDeferred();_interrupted=!1;_cleaned=!1;_tail=``;constructor(e,t,n){this._process=e,this.location=t,this.version=n,this._attach(),e.pid||this._fail(Error(`Failed to start Wallaby process: no PID`))}async exited(e){let t=this._exited.promise,{promise:n,cleanup:r}=this._waitShutdown(e);try{await Promise.race([this.ready,n,t]),await t}finally{r()}}get ready(){return this._ready.promise}get stopping(){return this._stopping.promise}release(){Hi.debug({pid:this._process.pid},`Releasing process handle`),this._cleanup(),this._process.stdout.destroy(),this._process.stderr.destroy(),this._process.unref()}async stop(e){if(!this._interrupted&&(this._interrupted=!0,this._stopping.resolve(),Hi.debug({pid:this._process.pid},`Stopping process`),!(this._process.exitCode!==null||this._process.signalCode!==null))){if(process.platform===`win32`&&e)Hi.debug(`Stopping process through RPC`),e();else if(!this._process.kill(`SIGTERM`))throw Error(`Failed to terminate Wallaby process`)}}_attach(){this._process.stdout.on(`data`,this._onStdOut),this._process.stderr.on(`data`,this._onStdError),this._process.on(`error`,this._onError),this._process.on(`exit`,this._onExit)}_waitShutdown(e){let t=new Map,n=!1,r=[`SIGINT`,`SIGTERM`];return{promise:new Promise((i,a)=>{for(let o of r){let r=()=>{n||(n=!0,this._handleShutdown(o,e).then(i,a))};t.set(o,r),process.on(o,r)}}),cleanup:()=>{for(let[e,n]of t)process.off(e,n)}}}async _handleShutdown(e,t){Hi.debug({signal:e},`Received shutdown signal`),await this.stop(t)}_onStdOut=e=>{if(this._tail===void 0)return;let t=this._tail+e.toString(`utf8`),n=t.match(/wallaby\.js started, port=(\d+)/);if(n){delete this._tail,this._process.stdout.off(`data`,this._onStdOut),this._ready.resolve(Number.parseInt(n[1],10));return}this._tail=t};_onStdError=e=>{let t=e.toString(`utf8`);Hi.warn({stderr:t}),this._tail!==void 0&&process.stdout.write(t)};_onError=e=>{Hi.error({error:e},`Process emitted an error`),this._fail(e,this._tail===void 0?`Wallaby process crashed`:`Wallaby process failed to start`),this._cleanup()};_onExit=(t,n)=>{Hi.info({code:t,signal:n},`Process exited`),this._tail!==void 0&&this._ready.reject(e._createExitError(`Wallaby exited unexpectedly before startup completed`,t,n)),this._interrupted?this._exited.resolve():this._exited.reject(e._createExitError(`Wallaby exited unexpectedly`,t,n)),this._cleanup()};_cleanup(){this._cleaned||(this._cleaned=!0,this._process.stdout.off(`data`,this._onStdOut),this._process.stderr.off(`data`,this._onStdError),this._process.off(`error`,this._onError),this._process.off(`exit`,this._onExit))}_fail(e,t){let n=t?Error(`${t}: ${e.message}`):e;this._ready.reject(n),this._interrupted?this._exited.resolve():this._exited.reject(n)}static _createDeferred(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}static _createExitError(e,t,n){let r=``;return n&&(r=` (signal: ${n})`),t!==null&&(r=` (code: ${t})`),Error(`${e}${r}.`)}};async function Wi(e,t,n){n?.stop();let r=await t.handle(e.update);r.fresh&&n?.clear();let a=async()=>await Ni(e.ssl,t.refresh(),r.update,!0),o=r.fresh?await Vi(a):n?.dist||await Vi(a);Hi.debug({...o},`Located target to launch`);let s=Gi(e,t.pinned),c=t.read(o.path),[,,l]=c.split(`.`);if(Number.parseInt(l,10)<2041)throw Hi.debug({revision:l},`Refusing to start unsupported version`),Error(`Wallaby Core v${c} is not supported by Wallaby CLI v ${Y.version}.\nRun with --update flag to get the latest version of Wallaby Core.`);Hi.info({args:s,revision:l},`Launching process`);let u=I(process.execPath,[i(o.path,`server.js`),`extended-core-ws`,...s],{detached:e.skill||process.platform===`win32`,stdio:[`ignore`,`pipe`,`pipe`]});return Hi.info({pid:u.pid},`Launched process`),new Ui(u,o,c)}function Gi(e,t){let n=[`--port=0`,`--lkp=${ki}`,`--cli=${Y.version}`];return e.config&&n.push(`--configPath=${s(e.config)}`),e.smart&&n.push(`--smartStart=true`),t&&n.push(`--pinned=`+t),e.cache===!1&&n.push(`--cache=no-run-result`),e.skill&&n.push(`--skill`),n}const Ki=new Li;var qi=class extends Xn{_options;_path;_restart;constructor(e,t,n){super(),this._options=e,this._path=t,this._restart=n}ping(){}notify(e){}restart(){this._restart()}launched(e){}relicensed(){this._path&&(Ki.stop(),Ki.check(this._path,this._options.ssl))}stopped(e){}},Ji=class{_logger=J.create(`commands/run`);async execute(e){this._logger.info({cwd:M(),options:e},`Executing run command`);let t=await this._execute(e);return this._logger.info({result:t},`Executed run command`),t}async _execute(e){let t=await this._cycle(e);return t?`restarted`in t?(this._logger.info(`Restarting process`),await this._execute(e)):(console.info(t.message),t.success):!1}async _cycle(e){let t=!1,n=!1,r,i,a,o=()=>{t=!0},s=await this._attach(e,()=>new qi(e,void 0,()=>{n||r!==void 0||(n=!0,o())}),e=>new Yn(e));if(!s)return await this._launch(e);let{manifest:c,session:l}=s;this._logger.info({id:c.id,pid:c.pids.primary,port:c.ports.primary},`Connected to active process from registry`),o=()=>{t||(t=!0,l.deactivate())};let u=A(),d=this._handshake(l).then(async()=>(await this._run(u,l,e),await l.api.export({id:u}))).then(e=>{n||r!==void 0||(r=e,o())}).catch(e=>{n||t||(i=e,o())}),f=l.alive.catch(e=>{t||(a=e,o())});try{await d}finally{o(),l.dispose(),await f}if(n)return{restarted:!0};if(a)throw a;if(i)throw i;return r}async _launch(e){let t=await Wi({...e,cache:!1,skill:e.skill,smart:e.smart||e.paths.length>0},new Ii,Ki),n,r=()=>n?(n(),!0):!1,i=t.exited(r),a=await Promise.race([t.ready,i.then(()=>void 0)]);if(a===void 0)return;let o,s,c,l,u,d=!1,f=!1,p=!1,m,h,g,_,v=()=>(_?.(),h||(h=t.stop(r),h.catch(()=>{})),h);try{g=await Qn(a,new qi(e,t.location.path,()=>{p||u!==void 0||(p=!0,v())}),e=>new Yn(e)),n=()=>g.api.stop(),Ki.restarter={restart(e){g.api.signal({type:`update`,version:e})}},_=()=>{f||(f=!0,g.deactivate())}}catch(e){try{await t.stop(),await i}catch(e){this._logger.warn({error:e},`Failed to stop process after connection failure`)}throw e}t.stopping.then(()=>{_?.()}),m=this._handshake(g).then(async()=>{t.location.type===`dist`&&Ki.schedule(t.location.path,e.ssl);let n=A();return await this._run(n,g,e),await g.api.export({id:n})}).then(t=>{if(!(p||u!==void 0)){if(u=t,e.skill){d=!0,_?.();return}return v()}}).catch(async e=>{if(!(p||f)){c=e;try{await v()}catch(e){this._logger.warn({error:e},`Failed to stop process after run/export failure`)}}});let y=g.alive.catch(async e=>{if(!f){s=e;try{await v()}catch(e){this._logger.warn({error:e},`Failed to stop process after connection loss`)}}});try{if(m&&await m,d&&t.release(),!d)try{await i}catch(e){o=e}}finally{if(Ki.stop(),Ki.restarter=void 0,g.dispose(),await y,h)try{await h}catch(e){l=e}}if(l)throw l;if(p)return{restarted:!0};if(o)throw o;if(s)throw s;if(c)throw c;if(u)return u}async _attach(e,t,n){if(e.force)return;let r=this._find(e);if(r.length===0)return;let i=await this._connect(r,t,n);if(i)return i;throw Error(`Failed to attach to active Wallaby instance for the specified config.`)}async _connect([e,...t],n,r){if(e){this._logger.info({id:e.id,pid:e.pids.primary,port:e.ports.primary},`Trying to connect to active process from registry`);try{return{manifest:e,session:await Qn(e.ports.primary,n(e),r)}}catch(i){return this._logger.warn({error:i,id:e.id,pid:e.pids.primary,port:e.ports.primary},`Failed to connect to active process from registry`),await this._connect(t,n,r)}}}async _run(e,t,n){await t.api.run({id:e,paths:n.paths,rerun:n.rerun,snapshots:n.snapshots,test:n.test})}async _handshake(e){let t=await e.api.handshake(Y.version);if(!t.compatible)throw Error(t.message||`Wallaby CLI v${Y.version} is not compatible with the running Wallaby Core.`)}_find(e){let t=_n(s(e.config?e.config:i(M(),`auto.detect`)));return new Sn().manifests.filter(e=>e.paths.config===t).sort((e,t)=>t.timestamps.refreshed-e.timestamps.refreshed).filter(e=>{try{return process.kill(e.pids.primary,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}})}},Yi=R(((e,t)=>{t.exports=a,a.sync=o;var n=B(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}})),Xi=R(((e,t)=>{t.exports=r,r.sync=i;var n=B(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),Zi=R(((e,t)=>{B(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Yi():Xi();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),Qi=R(((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=B(`path`),i=n?`;`:`:`,a=Zi(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}})),$i=R(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),ea=R(((e,t)=>{let n=B(`path`),r=Qi(),i=$i();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o})),ta=R(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),na=R(((e,t)=>{t.exports=/^#!(.*)/})),ra=R(((e,t)=>{let n=na();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),ia=R(((e,t)=>{let n=B(`fs`),r=ra();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i})),aa=R(((e,t)=>{let n=B(`path`),r=ea(),i=ta(),a=ia(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d})),oa=R(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),sa=R(((e,t)=>{let n=B(`child_process`),r=aa(),i=oa();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i}));function ca(){try{return d.statSync(`/.dockerenv`),!0}catch{return!1}}function la(){try{return d.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function ua(){return da===void 0&&(da=ca()||la()),da}var da,fa=L((()=>{}));function pa(){return ma===void 0&&(ma=ha()||ua()),ma}var ma,ha,ga=L((()=>{fa(),ha=()=>{try{return d.statSync(`/run/.containerenv`),!0}catch{return!1}}})),_a,va,ya=L((()=>{ga(),_a=()=>{if(j.platform!==`linux`)return!1;if(c.release().toLowerCase().includes(`microsoft`))return!pa();try{if(d.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`))return!pa()}catch{}return d.existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)||d.existsSync(`/run/WSL`)?!pa():!1},va=j.env.__IS_WSL_TEST__?_a:_a()})),ba,xa,Sa,Ca=L((()=>{ya(),ba=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await v.access(n,y.F_OK),r=!0}catch{}if(!r)return e;let i=await v.readFile(n,{encoding:`utf8`}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return a?(t=a.groups.mountPoint.trim(),t=t.endsWith(`/`)?t:`${t}/`,t):e}})(),xa=async()=>`${await ba()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Sa=async()=>va?xa():`${j.env.SYSTEMROOT||j.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`}));function wa(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}var Ta=L((()=>{}));async function Ea(){if(j.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await Da(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}var Da,Oa=L((()=>{Da=P(ne)}));async function ka(e,{humanReadableOutput:t=!0,signal:n}={}){if(j.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await Aa(`osascript`,[`-e`,e,r],i);return a.trim()}var Aa,ja=L((()=>{Aa=P(ne)}));async function Ma(e){return ka(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var Na=L((()=>{ja()}));async function Pa(e=Fa){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new La(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return Ia[r]??Ia[o]??Ia[s]??{name:r,id:r}}var Fa,Ia,La,Ra=L((()=>{Fa=P(ne),Ia={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},new Map(Object.entries(Ia)),La=class extends Error{}}));async function za(){if(j.platform===`darwin`){let e=await Ea();return{name:await Ma(e),id:e}}if(j.platform===`linux`){let{stdout:e}=await Ba(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:Va(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(j.platform===`win32`)return Pa();throw Error(`Only macOS, Linux, and Windows are supported`)}var Ba,Va,Ha=L((()=>{Oa(),Na(),Ra(),Ba=P(ne),Va=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())})),Ua=le({apps:()=>no,default:()=>eo,openApp:()=>to});async function Wa(){let e=await Sa(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:n}=await qa(e,[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`,O.from(t,`utf16le`).toString(`base64`)],{encoding:`utf8`}),r=n.trim(),i={ChromeHTML:`com.google.chrome`,BraveHTML:`com.brave.Browser`,MSEdgeHTM:`com.microsoft.edge`,FirefoxURL:`org.mozilla.firefox`};return i[r]?{id:i[r]}:{}}function Ga(e){if(typeof e==`string`||Array.isArray(e))return e;let{[Za]:t}=e;if(!t)throw Error(`${Za} is not supported`);return t}function Ka({[Xa]:e},{wsl:t}){if(t&&va)return Ga(t);if(!e)throw Error(`${Xa} is not supported`);return Ga(e)}var qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro=L((()=>{Ca(),Ta(),Ha(),ga(),qa=P(F.execFile),Ja=t.dirname(_(import.meta.url)),Ya=t.join(Ja,`xdg-open`),{platform:Xa,arch:Za}=j,Qa=async(e,t)=>{let n;for(let r of e)try{return await t(r)}catch(e){n=e}throw n},$a=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return Qa(e.app,t=>$a({...e,app:t}));let{name:t,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(t))return Qa(t,t=>$a({...e,app:{name:t,arguments:n}}));if(t===`browser`||t===`browserPrivate`){let r={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.Browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a=va?await Wa():await za();if(a.id in r){let o=r[a.id];return t===`browserPrivate`&&n.push(i[o]),$a({...e,app:{name:no[o],arguments:n}})}throw Error(`${a.name} is not supported as a default browser`)}let r,i=[],a={};if(Xa===`darwin`)r=`open`,e.wait&&i.push(`--wait-apps`),e.background&&i.push(`--background`),e.newInstance&&i.push(`--new`),t&&i.push(`-a`,t);else if(Xa===`win32`||va&&!pa()&&!t){r=await Sa(),i.push(`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`),va||(a.windowsVerbatimArguments=!0);let o=[`Start`];e.wait&&o.push(`-Wait`),t?(o.push(`"\`"${t}\`""`),e.target&&n.push(e.target)):e.target&&o.push(`"${e.target}"`),n.length>0&&(n=n.map(e=>`"\`"${e}\`""`),o.push(`-ArgumentList`,n.join(`,`))),e.target=O.from(o.join(` `),`utf16le`).toString(`base64`)}else{if(t)r=t;else{let e=!Ja||Ja===`/`,t=!1;try{await v.access(Ya,y.X_OK),t=!0}catch{}r=j.versions.electron??(Xa===`android`||e||!t)?`xdg-open`:Ya}n.length>0&&i.push(...n),e.wait||(a.stdio=`ignore`,a.detached=!0)}Xa===`darwin`&&n.length>0&&i.push(`--args`,...n),e.target&&i.push(e.target);let o=F.spawn(r,i,a);return e.wait?new Promise((t,n)=>{o.once(`error`,n),o.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r>0){n(Error(`Exited with code ${r}`));return}t(o)})}):(o.unref(),o)},eo=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return $a({...t,target:e})},to=(e,t)=>{if(typeof e!=`string`&&!Array.isArray(e))throw TypeError("Expected a valid `name`");let{arguments:n=[]}=t??{};if(n!=null&&!Array.isArray(n))throw TypeError("Expected `appArguments` as Array type");return $a({...t,app:{name:e,arguments:n}})},no={},wa(no,`chrome`,()=>Ka({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),wa(no,`brave`,()=>Ka({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),wa(no,`firefox`,()=>Ka({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),wa(no,`edge`,()=>Ka({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),wa(no,`browser`,()=>`browser`),wa(no,`browserPrivate`,()=>`browserPrivate`)})),io=z(sa(),1);const $=J.create(`browser`);function ao(e){let t=process.env.BROWSER||``;$.info({url:e,browser:t||`default`},`Opening browser`),t.toLowerCase().endsWith(`.js`)?so(t,e):t.toLowerCase()===`none`?$.debug({url:e},`Browser auto-open disabled by environment`):lo(t,process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(` `):[],e)}function oo(e,t){return new Promise((n,r)=>{$.debug({command:e,cwd:t?.cwd},`Executing shell command`),te(e,t,(i,a)=>{i?($.error({err:i,command:e,cwd:t?.cwd},`Shell command failed`),r(i)):($.debug({command:e,cwd:t?.cwd},`Shell command completed`),n(a.toString()))})})}function so(e,t){let n=process.argv.slice(2);$.debug({scriptPath:e,url:t,extraArgs:n},`Launching browser script`);let r=(0,io.default)(process.execPath,[e,...n,t],{stdio:`inherit`});r.on(`error`,n=>{$.error({err:n,scriptPath:e,url:t},`Browser script process failed to start`)}),r.on(`close`,n=>{n===0?$.debug({scriptPath:e,url:t},`Browser script completed successfully`):($.warn({code:n,scriptPath:e,url:t},`Browser script exited with a non-zero status`),process.stdout.write(K.default.red(`\nThe script specified as BROWSER environment variable failed.\n\n${K.default.cyan(e)} exited with code ${n}.`)))})}const co=[`Google Chrome Canary`,`Google Chrome Dev`,`Google Chrome Beta`,`Google Chrome`,`Microsoft Edge`,`Brave Browser`,`Vivaldi`,`Chromium`];async function lo(e,t,n){let r=e===`google chrome`?`Google Chrome`:e,i=process.platform===`darwin`&&(!r||co.includes(r));if($.debug({browser:r,browserArgs:t,url:n},`Starting browser process`),i)try{let e=await oo(`ps cax`),t=r&&e.includes(r)?r:co.find(t=>e.includes(t));if(t)return await oo(`osascript openChrome.applescript "${encodeURI(n)}" "${t}"`,{cwd:Y.paths.dirs.package.bin}),$.debug({openedBrowser:t,url:n},`Opened browser via AppleScript`),!0}catch(e){$.debug({err:e,url:n},`AppleScript browser reuse attempt failed`)}process.platform===`darwin`&&e===`open`&&(e=void 0);try{let r=e?{app:{name:e,arguments:t}}:{},i;try{i=(await Promise.resolve().then(()=>(ro(),Ua))).default}catch(e){$.error({err:e},`Failed to import browser opener`)}if(i)try{let t=await i(n,r);$.debug({url:n,browser:e||`default`},`Opened browser with open package`),t.on(`error`,e=>{$.error({err:e,url:n},`Browser subprocess reported an error`),process.stderr.write(e.stack||e.message)})}catch(e){$.error({err:e,url:n},`Failed to open browser`),process.stderr.write(e instanceof Error?e.stack||e.message:String(e))}else $.warn({url:n},`Browser opener module was unavailable`);return!0}catch(t){return $.warn({err:t,url:n,browser:e||`default`},`Browser launch failed`),!1}}const uo=J.create(`core/notifications`);function fo(e,t){if(!t.text){uo.trace({type:t.type},`Skipping empty notification`);return}uo.debug({type:t.type,button:!!t.button},`Received notification from core`);let n=[];if(~t.text.indexOf(`expire`)&&t.type===`warning`&&e.notifications===!1){uo.trace({type:t.type},`Suppressed expiration notification`);return}let r=`http://localhost:${e.port}`;~t.text.indexOf(`activate-link`)&&e.port&&n.push({title:`Enter License`,url:r}),~t.text.indexOf(`continue-trial-link`)&&e.port&&n.push({title:`Continue Trial`,url:r}),t.button&&n.push({title:t.button.label,url:t.button.link}),t.text=t.text.replace(/<br\/><br\/>/g,` `).replace(/<br\/>/g,` `).replace(/<a\s+(?:[^>]*?\s+)?href=['"]([^'"]*)['"]/g,(e,t)=>(t.startsWith(`http`)&&n.push({url:t}),e)).replace(/<[^>]*>/g,``);let i=t.type===`error`?K.default.red:t.type===`warning`?K.default.yellow:K.default.green;if(process.stdout.write(i(`\n ⚑ ${t.text}\n\n`)),n.length)for(let e of n)process.stdout.write(`${K.default.green(` ➜ `)}${K.default.bold(K.default.yellow(e.title?e.title+`: `:``))}${K.default.cyan(e.url)}\n`);uo.trace({links:n},`Rendered notification links`)}const po=new Li;var mo=class extends Xn{_options;_path;_version;_restart;_port;constructor(e,t,n,r){super(),this._options=e,this._path=t,this._version=n,this._restart=r}ping(){}notify(e){fo({notifications:this._options.notifications,port:this._port,ui:this._options.ui},e)}restart(){this._restart()}launched(e){this._port=e;let t=`http://localhost:${e}`;process.stdout.write(K.default.green(` ${K.default.bold(`WALLABY CORE`)}${this._version?` v${this._version}`:``}\n`)),process.stdout.write(`${K.default.green(` ➜ `)}${K.default.bold(K.default.yellow(`UI:`))} ${K.default.cyan(t)}\n`),process.stdout.write(`${K.default.green(` ➜ `)}${K.default.bold(K.default.dim(`Docs:`))} ${K.default.cyan(`https://wallabyjs.com/docs`)}\n`),this._options.ui!==!1&&ao(t)}relicensed(){this._path&&(po.stop(),po.check(this._path,this._options.ssl))}stopped(e){}},ho=class{_logger=J.create(`commands/start`);async execute(e){this._logger.info({cwd:M(),options:e},`Executing start command`);let t=await this._execute(e);return this._logger.info({result:t},`Executed start command`),t}async _execute(e){return await this._cycle(e)?(this._logger.info(`Restarting process`),await this._execute(e)):!0}async _cycle(e){if(!e.force){let t=this._find(e)[0];if(t)return this._logger.info({id:t.id,pid:t.pids.primary,port:t.ports.primary},`Active process is already running for the specified config`),console.warn(`Wallaby Core is already started.`),!1}let t=await Wi({...e,smart:e.smart||e.paths.length>0},new Ii,po),n,r=()=>n?(n(),!0):!1,i=t.exited(r),a=await Promise.race([t.ready,i.then(()=>void 0)]);if(a===void 0)return!1;let o,s,c,l,u=!1,d,f,p=()=>(d||(d=t.stop(r),d.catch(()=>{})),d);try{f=await Qn(a,new mo(e,t.location.path,t.version,()=>{u||(u=!0,p())}),e=>new Yn(e)),n=()=>f.api.stop(),po.restarter={restart(e){f.api.signal({type:`update`,version:e})}}}catch(e){try{await t.stop(),await i}catch(e){this._logger.warn({error:e},`Failed to stop process after connection failure`)}throw e}t.stopping.then(()=>f.deactivate());let m=f.alive.catch(async e=>{s=e;try{await p()}catch(e){this._logger.warn({error:e},`Failed to stop process after connection loss`)}});try{await this._handshake(f),t.location.type===`dist`&&po.schedule(t.location.path,e.ssl),await this._run(f,e).catch(async e=>{if(!u){c=e;try{await p()}catch(e){this._logger.warn({error:e},`Failed to stop process after run failure`)}}}),await i}catch(e){if(o=e,!u)try{await p(),await i.catch(()=>{})}catch(e){this._logger.warn({error:e},`Failed to stop process after startup failure`)}}finally{if(po.stop(),po.restarter=void 0,f.dispose(),await m,d)try{await d}catch(e){l=e}}if(l)throw l;if(o)throw o;if(c)throw c;if(s&&!(s instanceof Error&&s.message.startsWith(`Socket closed with code 1006 and reason:`)))throw s;return u}async _run(e,t){t.paths.length!==0&&await e.api.run({id:A(),paths:t.paths})}async _handshake(e){let t=await e.api.handshake(Y.version);if(!t.compatible)throw Error(t.message||`Wallaby CLI v${Y.version} is not compatible with the running Wallaby Core.`)}_find(e){let t=_n(s(e.config?e.config:i(M(),`auto.detect`)));return new Sn().manifests.filter(e=>e.paths.config===t).sort((e,t)=>t.timestamps.refreshed-e.timestamps.refreshed).filter(e=>{try{return process.kill(e.pids.primary,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}})}},go=class{_logger=J.create(`commands/stop`);async execute(e){this._logger.info({cwd:M(),options:e},`Executing stop command`);let t=_n(s(e.config?e.config:i(M(),`auto.detect`)));this._logger.info({config:t},`Determined config path and config directory`);let n=new Sn().manifests.filter(n=>e.all?!0:e.config?n.paths.config===t:r(n.paths.config)===r(t));if(n.length!==0)for(let e of n)this._stop(e);else this._logger.info(`No running processes matched stop criteria`);this._logger.info({count:n.length},`Executed stop command`)}_stop(e){this._logger.info({id:e.id,pid:e.pids.primary,config:e.paths.config},`Stopping process from registry`);try{process.kill(e.pids.primary,`SIGTERM`)}catch(e){this._logger.info({error:e},`Failed to send SIGTERM to process, it may have already stopped`)}this._logger.info({id:e.id,pid:e.pids.primary},`Stopped process from registry`)}};J.initialize({path:i(Y.paths.dirs.current,`logs`,`trace.log`)});const _o=J.create(`cli`);async function vo(){_o.trace({argv:process.argv.slice(2),version:Y.version},`Parsing CLI arguments`);let e=yt(process.argv,Y.version);if(e){if(await G.default.ensureDir(Y.paths.dirs.current),e.action===`stop`){await new go().execute(e.options);return}if(e.action===`run`){let t=await new Ji().execute(e.options);process.exitCode=+!t;return}if(e.action===`inspect`){let t=await new tr().execute(e.options);process.exitCode=+!t;return}await new ho().execute(e.options)}}async function yo(){try{await vo()}catch(e){_o.error({error:e},`Wallaby CLI failed`),console.error(K.default.red(e instanceof Error?e.message:String(e))),process.exitCode=1}finally{try{await J.shutdown()}catch(e){process.stderr.write(`[logger] ${e instanceof Error?e.stack||e.message:String(e)}\n`),process.exitCode=1}}}yo();export{};
|