@gjsify/example-node-express-webserver 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.gjs.js +1 -1
- package/package.json +16 -6
package/dist/index.gjs.js
CHANGED
|
@@ -33,7 +33,7 @@ t.exports=us()})),fs=__commonJSMin(((e,t)=>{var n={"prs.":100,"x-":200,"x.":300,
|
|
|
33
33
|
</body>
|
|
34
34
|
</html>
|
|
35
35
|
`}t.exports=finalhandler;function finalhandler(e,t,i){var a=i||{},o=a.env||process.env.NODE_ENV||`development`,s=a.onerror;return function(i){var a,c,l;if(!i&&t.headersSent){n(`cannot 404 after headers sent`);return}if(i?(l=getErrorStatusCode(i),l===void 0?l=getResponseStatusCode(t):a=getErrorHeaders(i),c=getErrorMessage(i,l,o)):(l=404,c=`Cannot `+e.method+` `+r(getResourceName(e))),n(`default %s`,l),i&&s&&setImmediate(s,i,e,t),t.headersSent){n(`cannot %d after headers sent`,l),e.socket&&e.socket.destroy();return}send(e,t,l,a,c)}}function getErrorHeaders(e){if(!(!e.headers||typeof e.headers!=`object`))return{...e.headers}}function getErrorMessage(e,t,n){var r;return n!==`production`&&(r=e.stack,!r&&typeof e.toString==`function`&&(r=e.toString())),r||s.message[t]}function getErrorStatusCode(e){if(typeof e.status==`number`&&e.status>=400&&e.status<600)return e.status;if(typeof e.statusCode==`number`&&e.statusCode>=400&&e.statusCode<600)return e.statusCode}function getResourceName(e){try{return o.original(e).pathname}catch{return`resource`}}function getResponseStatusCode(e){var t=e.statusCode;return(typeof t!=`number`||t<400||t>599)&&(t=500),t}function send(e,t,n,r,i){function write(){var a=createHtmlDocument(i);t.statusCode=n,e.httpVersionMajor<2&&(t.statusMessage=s.message[n]),t.removeHeader(`Content-Encoding`),t.removeHeader(`Content-Language`),t.removeHeader(`Content-Range`);for(let[e,n]of Object.entries(r??{}))t.setHeader(e,n);if(t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Content-Type`,`text/html; charset=utf-8`),t.setHeader(`Content-Length`,Buffer.byteLength(a,`utf8`)),e.method===`HEAD`){t.end();return}t.end(a,`utf8`)}if(c(e)){write();return}e.unpipe(),a(e,write),e.resume()}})),bl,__exportAll,xl=__esmMin(()=>{bl=Object.defineProperty,__exportAll=(e,t)=>{let n={};for(var r in e)bl(n,r,{get:e[r],enumerable:!0});return t||bl(n,Symbol.toStringTag,{value:`Module`}),n}});function getEncodingFromOptions(e={encoding:null,flag:`r`},t=`utf8`){return e===null?t:typeof e==`string`?e:typeof e==`object`&&typeof e.encoding==`string`?e.encoding:t}function encodeUint8Array(e,t){return e===`buffer`?K.from(t):new TextDecoder(e).decode(t)}function decode(e,t){if(t){let n=new TextDecoder(t),r=new TextEncoder;return n.decode(r.encode(e))}else return e}var Sl=__esmMin(()=>{q()}),Dirent,Cl=__esmMin(()=>{N(),_o(),Dirent=class{name;parentPath;_isFile=!1;_isDirectory=!1;_isBlockDevice=!1;_isCharacterDevice=!1;_isSymbolicLink=!1;_isFIFO=!1;_isSocket=!1;_file;constructor(e,t,n){switch(t||=lo(e),this.name=t,this.parentPath=co(e),this._file=M.File.new_for_path(e),n??this._file.query_file_type(M.FileQueryInfoFlags.NONE,null)){case M.FileType.DIRECTORY:this._isDirectory=!0;break;case M.FileType.MOUNTABLE:break;case M.FileType.REGULAR:this._isFile=!0;break;case M.FileType.SYMBOLIC_LINK:case M.FileType.SHORTCUT:this._isSymbolicLink=!0;break;case M.FileType.SPECIAL:this._classifySpecialFile(e);break}}_classifySpecialFile(e){try{let t=M.File.new_for_path(e).query_info(`unix::mode`,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_attribute_uint32(`unix::mode`);if(t===0)return;switch(t&61440){case 24576:this._isBlockDevice=!0;break;case 8192:this._isCharacterDevice=!0;break;case 49152:this._isSocket=!0;break;case 4096:this._isFIFO=!0;break}}catch{}}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isBlockDevice(){return this._isBlockDevice}isCharacterDevice(){return this._isCharacterDevice}isSymbolicLink(){return this._isSymbolicLink}isFIFO(){return this._isFIFO}isSocket(){return this._isSocket}}});function populateFromInfo(e){let t=e.get_attribute_uint64(`time::access`),n=e.get_attribute_uint32(`time::access-usec`)||0,r=e.get_attribute_uint64(`time::modified`),i=e.get_attribute_uint32(`time::modified-usec`)||0,a=e.get_attribute_uint64(`time::changed`),o=e.get_attribute_uint32(`time::changed-usec`)||0,s=e.get_attribute_uint64(`time::created`),c=e.get_attribute_uint32(`time::created-usec`)||0,l=t*1e3+n/1e3,u=r*1e3+i/1e3,d=a?a*1e3+o/1e3:u,p=s?s*1e3+c/1e3:d;return{dev:e.get_attribute_uint32(`unix::device`)||0,ino:Number(e.get_attribute_uint64(`unix::inode`)||0),mode:e.get_attribute_uint32(`unix::mode`)||0,nlink:e.get_attribute_uint32(`unix::nlink`)||0,uid:e.get_attribute_uint32(`unix::uid`)||0,gid:e.get_attribute_uint32(`unix::gid`)||0,rdev:e.get_attribute_uint32(`unix::rdev`)||0,size:Number(e.get_size()||0),blksize:e.get_attribute_uint32(`unix::block-size`)||4096,blocks:Number(e.get_attribute_uint64(`unix::blocks`)||0),atimeMs:l,mtimeMs:u,ctimeMs:d,birthtimeMs:p,atime:new Date(l),mtime:new Date(u),ctime:new Date(d),birthtime:new Date(p)}}var wl,Stats,BigIntStats,Tl=__esmMin(()=>{Cl(),N(),_o(),wl=`standard::*,time::*,unix::*`,Stats=class extends Dirent{dev;ino;mode;nlink;uid;gid;rdev;size;blksize;blocks;atimeMs;mtimeMs;ctimeMs;birthtimeMs;atime;mtime;ctime;birthtime;_info;constructor(e,t,n){let r,i;e instanceof M.FileInfo?(r=e,i=t.toString(),n||=lo(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=lo(i),r=M.File.new_for_path(i).query_info(wl,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)),super(i,n,r.get_file_type()),this._info=r;let a=populateFromInfo(r);this.dev=a.dev,this.ino=a.ino,this.mode=a.mode,this.nlink=a.nlink,this.uid=a.uid,this.gid=a.gid,this.rdev=a.rdev,this.size=a.size,this.blksize=a.blksize,this.blocks=a.blocks,this.atimeMs=a.atimeMs,this.mtimeMs=a.mtimeMs,this.ctimeMs=a.ctimeMs,this.birthtimeMs=a.birthtimeMs,this.atime=a.atime,this.mtime=a.mtime,this.ctime=a.ctime,this.birthtime=a.birthtime}},BigIntStats=class extends Dirent{dev;ino;mode;nlink;uid;gid;rdev;size;blksize;blocks;atimeMs;mtimeMs;ctimeMs;birthtimeMs;atimeNs;mtimeNs;ctimeNs;birthtimeNs;atime;mtime;ctime;birthtime;_info;constructor(e,t,n){let r,i;e instanceof M.FileInfo?(r=e,i=t.toString(),n||=lo(i)):(i=e.toString(),typeof t==`string`&&(n=t),n||=lo(i),r=M.File.new_for_path(i).query_info(wl,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)),super(i,n,r.get_file_type()),this._info=r;let a=populateFromInfo(r);this.dev=BigInt(a.dev),this.ino=BigInt(a.ino),this.mode=BigInt(a.mode),this.nlink=BigInt(a.nlink),this.uid=BigInt(a.uid),this.gid=BigInt(a.gid),this.rdev=BigInt(a.rdev),this.size=BigInt(a.size),this.blksize=BigInt(a.blksize),this.blocks=BigInt(a.blocks),this.atimeMs=BigInt(Math.trunc(a.atimeMs)),this.mtimeMs=BigInt(Math.trunc(a.mtimeMs)),this.ctimeMs=BigInt(Math.trunc(a.ctimeMs)),this.birthtimeMs=BigInt(Math.trunc(a.birthtimeMs)),this.atimeNs=this.atimeMs*1000000n,this.mtimeNs=this.mtimeMs*1000000n,this.ctimeNs=this.ctimeMs*1000000n,this.birthtimeNs=this.birthtimeMs*1000000n,this.atime=a.atime,this.mtime=a.mtime,this.ctime=a.ctime,this.birthtime=a.birthtime}}});function createReadStream(e,t){return new ReadStream(e,t)}var ReadStream,El=__esmMin(()=>{eu(),A(),N(),q(),Zr(),ReadStream=class extends Gr{bytesRead=0;path;pending=!0;fd=null;_gioFile;_inputStream=null;_cancellable=new M.Cancellable;_start;_end;_pos;close(e){this._cancellable.cancel(),this._inputStream&&=(this._inputStream.close_async(k.PRIORITY_DEFAULT,null,()=>{}),null),this.destroy(),e&&e(null)}constructor(e,t){let n=normalizePath(e);super({highWaterMark:t?.highWaterMark??64*1024,encoding:t?.encoding,objectMode:!1}),this.path=n,this._gioFile=M.File.new_for_path(n),this._start=t?.start??0,this._end=t?.end??1/0,this._pos=this._start}_construct(e){this._gioFile.read_async(k.PRIORITY_DEFAULT,this._cancellable,(t,n)=>{if(this.destroyed){e();return}try{this._inputStream=this._gioFile.read_finish(n),this.pending=!1,this.emit(`open`,0),this.emit(`ready`),this._start>0&&this._inputStream.can_seek()&&this._inputStream.seek(this._start,k.SeekType.SET,null),e()}catch(t){this._cancellable.is_cancelled()||e(t)}})}_read(e){this._doRead(e)}_doRead(e){let t=e;if(this._end!==1/0){let n=this._end-this._pos+1;if(n<=0){this.push(null);return}t=Math.min(e,n)}let n=this._inputStream;n.read_bytes_async(t,k.PRIORITY_DEFAULT,this._cancellable,(e,t)=>{try{let e=n.read_bytes_finish(t).get_data();if(!e||e.length===0){this.push(null);return}this.bytesRead+=e.length,this._pos+=e.length,this.push(K.from(e))}catch(e){this._cancellable.is_cancelled()||this.destroy(e)}})}_destroy(e,t){this._cancellable.cancel(),this._inputStream&&=(this._inputStream.close_async(k.PRIORITY_DEFAULT,null,()=>{}),null),t(e)}}});function createNodeError(e,t,n,r){return createNodeError$1(e,t,{path:n.toString(),dest:r?.toString()})}var Dl=__esmMin(()=>{L()});function makeEEXIST(e){let t=Error(`ERR_FS_CP_EEXIST: file already exists, copyfile '${e}'`);return t.code=`ERR_FS_CP_EEXIST`,t.syscall=`copyfile`,t.path=e,t}function makeEISDIR(e){let t=Error(`ERR_FS_EISDIR: illegal operation on a directory, copyfile '${e}'`);return t.code=`ERR_FS_EISDIR`,t.syscall=`copyfile`,t.path=e,t}function makeENOTDIR(e,t){let n=Error(`ENOTDIR: not a directory, copyfile '${e}' -> '${t}'`);return n.code=`ENOTDIR`,n.syscall=`copyfile`,n.path=e,n.dest=t,n}function makeSYMLINKLOOP(e,t){let n=Error(`ELOOP: too many levels of symbolic links, copyfile '${e}' -> '${t}'`);return n.code=`ELOOP`,n.syscall=`copyfile`,n.path=e,n.dest=t,n}function queryCopyFlags(e){let t=e.force??!0,n=M.FileCopyFlags.NONE;return t&&(n|=M.FileCopyFlags.OVERWRITE),e.preserveTimestamps&&(n|=M.FileCopyFlags.TARGET_DEFAULT_MODIFIED_TIME),e.dereference||(n|=M.FileCopyFlags.NOFOLLOW_SYMLINKS),n}function copyOneSyncFile(e,t,n,r,i){let a=i.force??!0;try{if(t.query_info(`standard::type`,M.FileQueryInfoFlags.NONE,null).get_file_type()===M.FileType.DIRECTORY)throw makeENOTDIR(n,r);if(!a){if(i.errorOnExist)throw makeEEXIST(r);return}}catch(e){if(typeof e.code==`string`)throw e}let o=queryCopyFlags(i);try{e.copy(t,o,null,null)}catch(e){throw createNodeError(e,`copyfile`,n,r)}}function cpOneDirSync(e,t,n,r,i){let a=n.endsWith(`/`)?``:`/`;if(r.startsWith(n+a)&&r!==n)throw makeSYMLINKLOOP(n,r);if(t.query_exists(null))try{if(t.query_info(`standard::type`,M.FileQueryInfoFlags.NONE,null).get_file_type()!==M.FileType.DIRECTORY)throw makeENOTDIR(r,n)}catch(e){if(typeof e.code==`string`)throw e}else try{t.make_directory_with_parents(null)}catch(e){throw createNodeError(e,`mkdir`,r)}let o;try{o=e.enumerate_children(`standard::name,standard::type,standard::is-symlink`,i.dereference?M.FileQueryInfoFlags.NONE:M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){throw createNodeError(e,`scandir`,n)}let s=o.next_file(null);for(;s!==null;){let e=s.get_name(),t=ao(n,e),a=ao(r,e),c=i.filter;if(c&&!c(t,a)){s=o.next_file(null);continue}cpSyncInternal(t,a,i),s=o.next_file(null)}}function cpSyncInternal(e,t,n){let r=M.File.new_for_path(e),i=M.File.new_for_path(t),a;try{a=r.query_info(`standard::type,standard::is-symlink`,n.dereference?M.FileQueryInfoFlags.NONE:M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`stat`,e)}if(a.get_file_type()===M.FileType.DIRECTORY){if(!n.recursive)throw makeEISDIR(e);cpOneDirSync(r,i,e,t,n)}else copyOneSyncFile(r,i,e,t,n)}function cpSync(e,t,n){let r=normalizePath(e),i=normalizePath(t),a=n??{},o=M.File.new_for_path(r),s=a.filter;if(!(s&&!s(r,i))){try{if(o.query_info(`standard::type`,a.dereference?M.FileQueryInfoFlags.NONE:M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_file_type()===M.FileType.DIRECTORY&&!a.recursive)throw makeEISDIR(r)}catch(e){throw typeof e.code==`string`?e:createNodeError(e,`stat`,r)}cpSyncInternal(r,i,a)}}function cp(e,t,n,r){let i,a;typeof n==`function`?(a=n,i={}):(a=r,i=n);let o=i.filter;if(o){Promise.resolve(o(normalizePath(e),normalizePath(t))).then(n=>{if(!n){a(null);return}try{cpPromises(e,t,i).then(()=>a(null)).catch(a)}catch(e){a(e)}}).catch(a);return}Promise.resolve().then(()=>{try{cpSync(e,t,i),a(null)}catch(e){a(e)}})}async function cpPromisesDir(e,t,n){let r=e.endsWith(`/`)?``:`/`;if(t.startsWith(e+r)&&t!==e)throw makeSYMLINKLOOP(e,t);let i=M.File.new_for_path(t);if(!i.query_exists(null))try{i.make_directory_with_parents(null)}catch(e){throw createNodeError(e,`mkdir`,t)}let a=M.File.new_for_path(e),o;try{o=a.enumerate_children(`standard::name,standard::type`,n.dereference?M.FileQueryInfoFlags.NONE:M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`scandir`,e)}let s=o.next_file(null);for(;s!==null;){let r=s.get_name(),i=ao(e,r),a=ao(t,r),c=n.filter;if(c&&!await Promise.resolve(c(i,a))){s=o.next_file(null);continue}await cpPromises(i,a,n),s=o.next_file(null)}}async function cpPromises(e,t,n={}){let r=normalizePath(e),i=normalizePath(t),a=M.File.new_for_path(r),o;try{o=a.query_info(`standard::type`,n.dereference?M.FileQueryInfoFlags.NONE:M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(e){throw createNodeError(e,`stat`,r)}if(o.get_file_type()===M.FileType.DIRECTORY){if(!n.recursive)throw makeEISDIR(r);await cpPromisesDir(r,i,n)}else copyOneSyncFile(a,M.File.new_for_path(i),r,i,n)}var Ol=__esmMin(()=>{eu(),Dl(),N(),_o()});function _openDir(e){let t=M.File.new_for_path(e),n;try{n=t.enumerate_children(kl,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){throw createNodeError(t,`opendir`,e)}return new Dir(e,n)}function opendirSync(e){return _openDir(normalizePath(e))}function opendir(e,t,n){let r;if(r=typeof t==`function`?t:n,typeof r!=`function`)throw TypeError(`The "callback" argument must be of type function`);Promise.resolve().then(()=>{try{let t=opendirSync(e);r(null,t)}catch(e){r(e,null)}})}async function opendirAsync(e,t){return new Promise((t,n)=>{let r=normalizePath(e),i=M.File.new_for_path(r);i.enumerate_children_async(kl,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,k.PRIORITY_DEFAULT,null,(e,a)=>{try{t(new Dir(r,i.enumerate_children_finish(a)))}catch(e){n(createNodeError(e,`opendir`,r))}})})}var kl,Dir,Al=__esmMin(()=>{eu(),Cl(),Dl(),A(),N(),kl=`standard::name,standard::type,standard::is-symlink,standard::size,standard::symlink-target,unix::uid,unix::gid,unix::mode,time::modified,time::access,time::created`,Dir=class{path;_enumerator;_closed=!1;constructor(e,t){this.path=e,this._enumerator=t}_assertOpen(){if(this._closed){let e=Error(`Directory handle was closed`);throw e.code=`ERR_DIR_CLOSED`,e}}readSync(){this._assertOpen();try{let e=this._enumerator.next_file(null);if(e===null)return null;let t=e.get_name(),n=e.get_file_type();return new Dirent(this.path.endsWith(`/`)?this.path+t:this.path+`/`+t,t,n)}catch(e){throw createNodeError(e,`readdir`,this.path)}}read(e){if(e!==void 0){if(typeof e!=`function`)throw TypeError(`The "callback" argument must be of type function`);try{this._assertOpen();let t=this.readSync();Promise.resolve().then(()=>e(null,t))}catch(t){Promise.resolve().then(()=>e(t,null))}return}return new Promise((e,t)=>{try{this._assertOpen(),e(this.readSync())}catch(e){t(e)}})}closeSync(){this._assertOpen(),this._closed=!0;try{this._enumerator.close(null)}catch{}this._enumerator=null}close(e){if(e!==void 0){if(typeof e!=`function`)throw TypeError(`The "callback" argument must be of type function`);try{this.closeSync(),Promise.resolve().then(()=>e(null))}catch(t){Promise.resolve().then(()=>e(t))}return}return new Promise((e,t)=>{try{this.closeSync(),e()}catch(e){t(e)}})}async*[Symbol.asyncIterator](){try{for(;;){let e=await this.read();if(e===null)break;yield e}}finally{this._closed||await this.close()}}}});function segmentToRegexSrc(e){let t=/^([!*+?@])\((.+)\)$/.exec(e);if(t){let[,e,n]=t,r=n.split(`|`).map(e=>segmentToRegexSrc(e)),i=`(?:`+r.join(`|`)+`)`;switch(e){case`!`:return`(?!(?:`+r.join(`|`)+`))[^/]*`;case`*`:return i+`*`;case`+`:return i+`+`;case`?`:return i+`?`;case`@`:return i}}let n=``,r=0;for(;r<e.length;){let t=e[r];if(t===`*`){n+=`[^/]*`,r++;continue}if(t===`?`){n+=`[^/]`,r++;continue}if(t===`[`){let t=e.indexOf(`]`,r+1);if(t===-1){n+=`\\[`,r++;continue}n+=e.slice(r,t+1),r=t+1;continue}if(t===`{`){let t=e.indexOf(`}`,r+1);if(t===-1){n+=`\\{`,r++;continue}let i=e.slice(r+1,t).split(`,`).map(e=>segmentToRegexSrc(e.trim()));n+=`(?:`+i.join(`|`)+`)`,r=t+1;continue}`.+^$|()[]{}`.includes(t)?n+=`\\`+t:n+=t,r++}return n}function globToRegex(e){e=e.replace(/\/+/g,`/`).replace(/^\.\//,``);let t=e.split(`/`),n=[];for(let e=0;e<t.length;e++){let r=t[e],i=e===t.length-1;r===`**`?i?n.length>0&&n[n.length-1]===`/`?(n.pop(),n.push(`(?:/.+)?`)):n.push(`(?:.+)?`):n.push(`(?:[^/]+/)*`):(n.push(segmentToRegexSrc(r)),i||n.push(`/`))}return RegExp(`^(?:`+n.join(``)+`)$`)}function buildExcludePredicate(e){if(!e)return null;if(typeof e==`function`)return e;let t=(Array.isArray(e)?e:[e]).map(e=>globToRegex(e));return e=>t.some(t=>t.test(e))}function matchAll(e,t,n){let r=globToRegex(e),i=buildExcludePredicate(n),a;try{a=readdirSync(t,{recursive:!0})}catch{return[]}let o=[`.`,...a],s=[];for(let e of o){let t=e.replace(/\\/g,`/`);r.test(t)&&(i&&i(t)||s.push(e))}return s}function globSync(e,t){let n=Array.isArray(e)?e:[e],r=t?.cwd?normalizePath(t.cwd):globalThis.process?.cwd?.()??`/`,i=t?.exclude,a=new Set,o=[];for(let e of n)for(let t of matchAll(e,r,i))a.has(t)||(a.add(t),o.push(t));return o}function glob(e,t,n){let r,i;typeof t==`function`?(i=t,r={}):(i=n,r=t||{}),Promise.resolve().then(()=>{try{let t=globSync(e,r);i(null,t)}catch(e){i(e,[])}})}async function*globAsync(e,t){let n=globSync(e,t);for(let e of n)yield e}var jl=__esmMin(()=>{eu(),$l()});function buildStatFs(e){let t=Number(e.get_attribute_uint64(`filesystem::size`)??0),n=Number(e.get_attribute_uint64(`filesystem::free`)??0),r=Math.floor(t/Nl),i=Math.floor(n/Nl);return{type:0,bsize:Nl,blocks:r,bfree:i,bavail:i,files:0,ffree:0}}function buildBigIntStatFs(e){let t=BigInt(e.get_attribute_uint64(`filesystem::size`)??0),n=BigInt(e.get_attribute_uint64(`filesystem::free`)??0),r=BigInt(Nl),i=t/r,a=n/r;return{type:0n,bsize:r,blocks:i,bfree:a,bavail:a,files:0n,ffree:0n}}function statfsSync(e,t){let n=M.File.new_for_path(normalizePath(e)).query_filesystem_info(Ml,null);return t?.bigint===!0?buildBigIntStatFs(n):buildStatFs(n)}function queryFsInfoAsync(e,t){return new Promise((n,r)=>{let i=M.File.new_for_path(normalizePath(e));i.query_filesystem_info_async(Ml,k.PRIORITY_DEFAULT,null,(e,a)=>{try{let e=i.query_filesystem_info_finish(a);n(t?buildBigIntStatFs(e):buildStatFs(e))}catch(e){r(e)}})})}function statfs(e,t,n){let r=typeof t==`function`?t:n;queryFsInfoAsync(e,(typeof t==`function`?{}:t)?.bigint===!0).then(e=>r(null,e),e=>r(e,null))}async function statfsAsync(e,t){return queryFsInfoAsync(e,t?.bigint===!0)}var Ml,Nl,Pl=__esmMin(()=>{eu(),A(),N(),Ml=[`filesystem::size`,`filesystem::free`].join(`,`),Nl=4096}),Fl=__exportAll$4({lchmod:()=>lchmod,lchmodAsync:()=>lchmodAsync,lchmodSync:()=>lchmodSync,lchown:()=>lchown,lchownAsync:()=>lchownAsync,lchownSync:()=>lchownSync,lutimes:()=>lutimes,lutimesAsync:()=>lutimesAsync,lutimesSync:()=>lutimesSync,utimes:()=>utimes,utimesAsync:()=>utimesAsync,utimesSync:()=>utimesSync});function toGLibDateTime(e){let t=e instanceof Date?e.getTime():typeof e==`bigint`?Number(e):typeof e==`string`?Date.parse(e):e*1e3;return k.DateTime.new_from_unix_utc(Math.floor(t/1e3))}function setTimestamps(e,t,n,r){let i=M.File.new_for_path(e),a=new M.FileInfo;a.set_modification_date_time(toGLibDateTime(n)),a.set_access_date_time(toGLibDateTime(t)),i.set_attributes_from_info(a,r,null)}function utimesSync(e,t,n){setTimestamps(normalizePath(e),t,n,M.FileQueryInfoFlags.NONE)}function utimes(e,t,n,r){Promise.resolve().then(()=>utimesSync(e,t,n)).then(()=>r(null),r)}async function utimesAsync(e,t,n){utimesSync(e,t,n)}function lutimesSync(e,t,n){setTimestamps(normalizePath(e),t,n,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS)}function lutimes(e,t,n,r){Promise.resolve().then(()=>lutimesSync(e,t,n)).then(()=>r(null),r)}async function lutimesAsync(e,t,n){lutimesSync(e,t,n)}function lchownSync(e,t,n){k.spawn_command_line_sync(`chown -h ${t}:${n} ${normalizePath(e)}`)}function lchown(e,t,n,r){Promise.resolve().then(()=>lchownSync(e,t,n)).then(()=>r(null),r)}async function lchownAsync(e,t,n){lchownSync(e,t,n)}function lchmodSync(e,t){}function lchmod(e,t,n){n(null)}async function lchmodAsync(e,t){}var Il=__esmMin(()=>{eu(),A(),N()});function getFH(e){return e instanceof Zl?Zl.getInstance(e.fd):Zl.getInstance(e)}function fstatSync(e,t){return statSync(normalizePath(getFH(e).options.path),t)}function fstat(e,t,n){let r=typeof t==`function`?t:n;fstatAsync(e,typeof t==`function`?{}:t).then(e=>r(null,e),e=>r(e,void 0))}async function fstatAsync(e,t){return t?.bigint,fstatSync(e,t)}function ftruncateSync(e,t=0){truncateSync(normalizePath(getFH(e).options.path),t)}function ftruncate(e,t,n){let r=typeof t==`function`?t:n;ftruncateAsync(e,typeof t==`function`?0:t).then(()=>r(null),r)}async function ftruncateAsync(e,t=0){ftruncateSync(e,t)}function fdatasyncSync(e){getFH(e)._flushSync()}function fdatasync(e,t){Promise.resolve().then(()=>fdatasyncSync(e)).then(()=>t(null),t)}async function fdatasyncAsync(e){fdatasyncSync(e)}function fsyncSync(e){getFH(e)._flushSync()}function fsync(e,t){Promise.resolve().then(()=>fsyncSync(e)).then(()=>t(null),t)}async function fsyncAsync(e){fsyncSync(e)}function fchmodSync(e,t){chmodSync(normalizePath(getFH(e).options.path),t)}function fchmod(e,t,n){Promise.resolve().then(()=>fchmodSync(e,t)).then(()=>n(null),n)}async function fchmodAsync(e,t){fchmodSync(e,t)}function fchownSync(e,t,n){chownSync(normalizePath(getFH(e).options.path),t,n)}function fchown(e,t,n,r){Promise.resolve().then(()=>fchownSync(e,t,n)).then(()=>r(null),r)}async function fchownAsync(e,t,n){fchownSync(e,t,n)}function futimesSync(e,t,n){utimesSync(normalizePath(getFH(e).options.path),t,n)}function futimes(e,t,n,r){Promise.resolve().then(()=>futimesSync(e,t,n)).then(()=>r(null),r)}async function futimesAsync(e,t,n){futimesSync(e,t,n)}function closeSync(e){getFH(e)._closeSync()}function readSync(e,t,n,r,i){let a=0;return typeof n==`object`&&n?(a=n.offset??0,r=n.length??t.byteLength,i=n.position??null):(a=n??0,r??=t.byteLength-a),getFH(e)._readSync(t,a,r,i??null)}function writeSync(e,t,n,r,i){let a;if(typeof t==`string`)a=new TextEncoder().encode(t),typeof n==`number`&&(i=n);else{let e=typeof n==`number`?n:0,i=typeof r==`number`?r:t.byteLength-e;a=new Uint8Array(t.buffer,t.byteOffset+e,i)}return getFH(e)._writeSync(a,i??null)}function readvSync(e,t,n){let r=0;for(let i of t){let t=readSync(e,i,0,i.byteLength,n==null?null:n+r);if(r+=t,t<i.byteLength)break}return r}function readv(e,t,n,r){let i=typeof n==`function`?n:r;readvAsync(e,t,typeof n==`function`?null:n).then(e=>i(null,e.bytesRead,e.buffers),e=>i(e,0,t))}async function readvAsync(e,t,n){return{bytesRead:readvSync(e,t,n),buffers:t}}function writevSync(e,t,n){let r=0;for(let i of t){let t=writeSync(e,i,0,i.byteLength,n==null?null:n+r);r+=t}return r}function writev(e,t,n,r){let i=typeof n==`function`?n:r;writevAsync(e,t,typeof n==`function`?null:n).then(e=>i(null,e.bytesWritten,e.buffers),e=>i(e,0,t))}async function writevAsync(e,t,n){return{bytesWritten:writevSync(e,t,n),buffers:t}}function exists(e,t){try{statSync(normalizePath(e)),t(!0)}catch{t(!1)}}async function openAsBlob(e,t){let n=readFileSync(normalizePath(e));return new Blob([n],{type:t?.type??``})}var Ll=__esmMin(()=>{eu(),Ql(),$l(),Il()});async function mkdir$1(e,t){let n;typeof t==`object`&&(t.recursive&&(n=t.recursive),t.mode&&t.mode);let r=normalizePath(e);if(n)return mkdirRecursiveAsync(r);let i=M.File.new_for_path(r);return new Promise((e,t)=>{i.make_directory_async(k.PRIORITY_DEFAULT,null,(n,a)=>{try{i.make_directory_finish(a),e(void 0)}catch(e){t(createNodeError(e,`mkdir`,r))}})})}async function mkdirRecursiveAsync(e){let t=M.File.new_for_path(e);try{return await new Promise((e,n)=>{t.make_directory_async(k.PRIORITY_DEFAULT,null,(r,i)=>{try{t.make_directory_finish(i),e()}catch(e){n(e)}})}),e}catch(t){let n=t;if(n.code===M.IOErrorEnum.EXISTS)return;if(n.code===M.IOErrorEnum.NOT_FOUND){let n=co(e);if(n===e)throw createNodeError(t,`mkdir`,e);let r=await mkdirRecursiveAsync(n),i=M.File.new_for_path(e);return await new Promise((t,n)=>{i.make_directory_async(k.PRIORITY_DEFAULT,null,(r,a)=>{try{i.make_directory_finish(a),t()}catch(t){n(createNodeError(t,`mkdir`,e))}})}),r??e}throw createNodeError(t,`mkdir`,e)}}async function readFile$1(e,t={encoding:null,flag:`r`}){let n=normalizePath(e),r=M.File.new_for_path(n),i,a;try{[i,a]=await new Promise((e,t)=>{r.load_contents_async(null,(n,i)=>{try{e(r.load_contents_finish(i))}catch(e){t(e)}})})}catch(e){throw createNodeError(e,`open`,n)}if(!i)throw createNodeError(Error(`failed to read file`),`open`,n);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),a)}async function mkdtemp(e,t){let n=getEncodingFromOptions(t),r=tempDirPath(e);return await mkdir$1(r,{recursive:!1,mode:448}),decode(r,n)}async function writeFile$1(e,t){let n=normalizePath(e),r=M.File.new_for_path(n),i;i=typeof t==`string`?new TextEncoder().encode(t):t instanceof Uint8Array?t:new TextEncoder().encode(String(t));let a=await new Promise((e,t)=>{r.replace_async(null,!1,M.FileCreateFlags.REPLACE_DESTINATION,k.PRIORITY_DEFAULT,null,(i,a)=>{try{e(r.replace_finish(a))}catch(e){t(createNodeError(e,`open`,n))}})});if(i.length>0){let e=new k.Bytes(i);await new Promise((t,r)=>{a.write_bytes_async(e,k.PRIORITY_DEFAULT,null,(e,i)=>{try{a.write_bytes_finish(i),t()}catch(e){r(createNodeError(e,`write`,n))}})})}await new Promise((e,t)=>{a.close_async(k.PRIORITY_DEFAULT,null,(r,i)=>{try{a.close_finish(i),e()}catch(e){t(createNodeError(e,`close`,n))}})})}async function rmdir$1(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);if((await new Promise((e,t)=>{r.query_info_async(`standard::type`,M.FileQueryInfoFlags.NONE,k.PRIORITY_DEFAULT,null,(i,a)=>{try{e(r.query_info_finish(a))}catch(e){t(createNodeError(e,`rmdir`,n))}})})).get_file_type()!==M.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if((await new Promise((e,t)=>{r.enumerate_children_async(`standard::name`,M.FileQueryInfoFlags.NONE,k.PRIORITY_DEFAULT,null,(i,a)=>{try{e(r.enumerate_children_finish(a))}catch(e){t(createNodeError(e,`rmdir`,n))}})})).next_file(null)!==null)throw createNodeError(Object.assign(Error(),{code:5}),`rmdir`,n);await new Promise((e,t)=>{r.delete_async(k.PRIORITY_DEFAULT,null,(i,a)=>{try{r.delete_finish(a),e()}catch(e){t(createNodeError(e,`rmdir`,n))}})})}async function unlink$1(e){let t=normalizePath(e),n=M.File.new_for_path(t);await new Promise((e,r)=>{n.delete_async(k.PRIORITY_DEFAULT,null,(i,a)=>{try{n.delete_finish(a),e()}catch(e){r(createNodeError(e,`unlink`,t))}})})}async function open$1(e,t,n){return new Zl({path:e,flags:t,mode:n})}async function write$1(e,t,n,r,i){return typeof t==`string`?_writeStr(e,t,n,r):_writeBuf(e,t,n,r,i)}async function _writeBuf(e,t,n,r,i){return{bytesWritten:(await Zl.getInstance(e).write(t,n,r,i)).bytesWritten,buffer:t}}async function _writeStr(e,t,n,r){return{bytesWritten:(await Zl.getInstance(e).write(t,n,r)).bytesWritten,buffer:t}}function queryInfoAsync(e,t,n,r){let i=normalizePath(e);return new Promise((e,a)=>{let o=M.File.new_for_path(i);o.query_info_async(wl,t,k.PRIORITY_DEFAULT,null,(t,s)=>{try{let t=o.query_info_finish(s);e(r?.bigint?new BigIntStats(t,i):new Stats(t,i))}catch(e){a(createNodeError(e,n,i))}})})}async function stat$1(e,t){return queryInfoAsync(e,M.FileQueryInfoFlags.NONE,`stat`,t)}async function lstat$1(e,t){return queryInfoAsync(e,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,t)}async function readdir$1(e,t){try{return readdirSync(e,t)}catch(t){throw createNodeError(t,`scandir`,e)}}async function realpath$1(e){return realpathSync(e)}async function symlink$1(e,t,n){let r=normalizePath(t),i=normalizePath(e);return new Promise((e,t)=>{let n=M.File.new_for_path(r);n.make_symbolic_link_async(i,k.PRIORITY_DEFAULT,null,(a,o)=>{try{n.make_symbolic_link_finish(o),e()}catch(e){t(createNodeError(e,`symlink`,i,r))}})})}async function rm$1(e,t){let n=normalizePath(e),r=M.File.new_for_path(n),i=t?.recursive||!1,a=t?.force||!1,o;try{o=r.query_file_type(M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){if(a)return;throw createNodeError(t,`rm`,e)}if(o===M.FileType.SYMBOLIC_LINK){await new Promise((t,n)=>{r.delete_async(k.PRIORITY_DEFAULT,null,(i,o)=>{try{r.delete_finish(o),t()}catch(r){if(a){t();return}n(createNodeError(r,`rm`,e))}})});return}if(o===M.FileType.DIRECTORY){let r=await readdir$1(e,{withFileTypes:!0});if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)typeof e!=`string`&&await rm$1(ao(n,e.name),t)}await new Promise((t,n)=>{r.delete_async(k.PRIORITY_DEFAULT,null,(i,o)=>{try{r.delete_finish(o),t()}catch(r){if(a){t();return}n(createNodeError(r,`rm`,e))}})})}async function rename$1(e,t){renameSync(e,t)}async function copyFile$1(e,t,n){copyFileSync(e,t,n)}async function access$1(e,t){accessSync(e,t)}async function appendFile$1(e,t,n){appendFileSync(e,t,n)}async function readlink$1(e,t){return readlinkSync(e,t)}async function truncate$1(e,t){truncateSync(e,t)}async function chmod$1(e,t){chmodSync(e,t)}async function chown$1(e,t,n){chownSync(e,t,n)}async function link$1(e,t){linkSync(e,t)}var Rl,zl,Bl=__esmMin(()=>{xl(),Sl(),eu(),nu(),Tl(),Ql(),Dl(),$l(),Ol(),Al(),jl(),Pl(),Il(),Ll(),A(),N(),_o(),Rl=__exportAll({access:()=>access$1,appendFile:()=>appendFile$1,chmod:()=>chmod$1,chown:()=>chown$1,copyFile:()=>copyFile$1,cp:()=>cpPromises,default:()=>zl,fchmod:()=>fchmodAsync,fchown:()=>fchownAsync,fdatasync:()=>fdatasyncAsync,fstat:()=>fstatAsync,fsync:()=>fsyncAsync,ftruncate:()=>ftruncateAsync,futimes:()=>futimesAsync,glob:()=>globAsync,lchmod:()=>lchmodAsync,lchown:()=>lchownAsync,link:()=>link$1,lstat:()=>lstat$1,lutimes:()=>lutimesAsync,mkdir:()=>mkdir$1,mkdtemp:()=>mkdtemp,open:()=>open$1,openAsBlob:()=>openAsBlob,opendir:()=>opendirAsync,readFile:()=>readFile$1,readdir:()=>readdir$1,readlink:()=>readlink$1,readv:()=>readvAsync,realpath:()=>realpath$1,rename:()=>rename$1,rm:()=>rm$1,rmdir:()=>rmdir$1,stat:()=>stat$1,statfs:()=>statfsAsync,symlink:()=>symlink$1,truncate:()=>truncate$1,unlink:()=>unlink$1,utimes:()=>utimesAsync,watch:()=>watchAsync,write:()=>write$1,writeFile:()=>writeFile$1,writev:()=>writevAsync}),__name(mkdir$1,`mkdir`),__name(readFile$1,`readFile`),__name(writeFile$1,`writeFile`),__name(rmdir$1,`rmdir`),__name(unlink$1,`unlink`),__name(open$1,`open`),__name(write$1,`write`),__name(stat$1,`stat`),__name(lstat$1,`lstat`),__name(readdir$1,`readdir`),__name(realpath$1,`realpath`),__name(symlink$1,`symlink`),__name(rm$1,`rm`),__name(rename$1,`rename`),__name(copyFile$1,`copyFile`),__name(access$1,`access`),__name(appendFile$1,`appendFile`),__name(readlink$1,`readlink`),__name(truncate$1,`truncate`),__name(chmod$1,`chmod`),__name(chown$1,`chown`),__name(link$1,`link`),zl={readFile:readFile$1,mkdir:mkdir$1,mkdtemp,realpath:realpath$1,readdir:readdir$1,writeFile:writeFile$1,rmdir:rmdir$1,unlink:unlink$1,open:open$1,write:write$1,rm:rm$1,lstat:lstat$1,symlink:symlink$1,stat:stat$1,rename:rename$1,copyFile:copyFile$1,access:access$1,appendFile:appendFile$1,readlink:readlink$1,truncate:truncate$1,chmod:chmod$1,chown:chown$1,link:link$1,cp:cpPromises,opendir:opendirAsync,glob:globAsync,watch:watchAsync,statfs:statfsAsync,utimes:utimesAsync,lutimes:lutimesAsync,lchown:lchownAsync,lchmod:lchmodAsync,fstat:fstatAsync,ftruncate:ftruncateAsync,fdatasync:fdatasyncAsync,fsync:fsyncAsync,fchmod:fchmodAsync,fchown:fchownAsync,futimes:futimesAsync,readv:readvAsync,writev:writevAsync,openAsBlob}});function parseOptsCb(e,t){return typeof e==`function`?{options:{},callback:e}:{options:e??{},callback:t}}function statImpl(e,t,n,r,i){let a=normalizePath(e),o=M.File.new_for_path(a);o.query_info_async(wl,t,k.PRIORITY_DEFAULT,null,(e,t)=>{try{let e=o.query_info_finish(t);i(null,r?.bigint?new BigIntStats(e,a):new Stats(e,a))}catch(e){i(createNodeError(e,n,a))}})}function stat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,M.FileQueryInfoFlags.NONE,`stat`,r,i)}function lstat(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);statImpl(e,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,`lstat`,r,i)}function readdir(e,t,n){let{options:r,callback:i}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{i(null,readdirSync(e,r))}catch(t){i(createNodeError(t,`readdir`,e))}})}function realpath(e,t,n){let{callback:r}=parseOptsCb(t,n);Promise.resolve().then(()=>{try{r(null,realpathSync(e))}catch(e){r(e)}})}function symlink(e,t,n,r){let i=typeof n==`function`?n:r;if(typeof i!=`function`)throw TypeError(`Callback must be a function. Received `+typeof i);let a=normalizePath(t),o=normalizePath(e),s=M.File.new_for_path(a);s.make_symbolic_link_async(o,k.PRIORITY_DEFAULT,null,(e,t)=>{try{s.make_symbolic_link_finish(t),i(null)}catch(e){i(createNodeError(e,`symlink`,o,a))}})}function open(e,...t){let n,r,i;switch(t.length){case 1:i=t[0];break;case 2:n=t[0],i=t[1];break;case 3:n=t[0],r=t[1],i=t[2];break;default:break}open$1(e,n,r).then(e=>{i(null,e.fd)}).catch(e=>{i(e,-1)})}function write(e,t,...n){let r=Zl.getInstance(e);if(typeof t==`string`){let e=n.pop(),i=n[0],a=n[1];r.write(t,i,a).then(t=>{e(null,t.bytesWritten,t.buffer)}).catch(t=>{e(t,0,``)});return}let i=n[n.length-1],a=n[0],o=n[1],s=n[2];r.write(t,a,o,s).then(e=>{i(null,e.bytesWritten,e.buffer)}).catch(e=>{i(e,0,K.from([]))})}function read(e,...t){let n=Zl.getInstance(e),r=t[t.length-1],i,a,o,s;if(!(t.length<=1))if(typeof t[0]==`object`&&!ArrayBuffer.isView(t[0])){let e=t[0];i=e.buffer,a=e.offset,o=e.length,s=e.position}else i=t[0],a=t[1],o=t[2],s=t[3];n.read(i,a,o,s).then(e=>{r(null,e.bytesRead,e.buffer)}).catch(e=>{r(e,0,K.from([]))})}function close(e,t){Zl.getInstance(e).close().then(()=>{t(null)}).catch(e=>t(e))}function rm(e,...t){let n={},r=t[t.length-1];t.length>=2&&(n=t[0]),rm$1(e,n).then(()=>{r(null)}).catch(e=>{r(e)})}function rename(e,t,n){Promise.resolve().then(()=>{try{renameSync(e,t),n(null)}catch(e){n(e)}})}function copyFile(e,t,n,r){let i=typeof n==`function`?0:n,a=typeof n==`function`?n:r;Promise.resolve().then(()=>{try{copyFileSync(e,t,i),a(null)}catch(e){a(e)}})}function access(e,t,n){let r=typeof t==`function`?void 0:t,i=typeof t==`function`?t:n;Promise.resolve().then(()=>{try{accessSync(e,r),i(null)}catch(e){i(e)}})}function appendFile(e,t,n,r){let i=typeof n==`function`?n:r,a=typeof n==`function`?void 0:n;Promise.resolve().then(()=>{try{appendFileSync(e,t,a),i(null)}catch(e){i(e)}})}function readlink(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{r(null,readlinkSync(e,i))}catch(e){r(e,``)}})}function truncate(e,t,n){let r=typeof t==`function`?0:t,i=typeof t==`function`?t:n;Promise.resolve().then(()=>{try{truncateSync(e,r),i(null)}catch(e){i(e)}})}function chmod(e,t,n){Promise.resolve().then(()=>{try{chmodSync(e,t),n(null)}catch(e){n(e)}})}function chown(e,t,n,r){Promise.resolve().then(()=>{try{chownSync(e,t,n),r(null)}catch(e){r(e)}})}function mkdir(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{mkdirSync(e,i),r(null)}catch(e){r(e)}})}function rmdir(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t;Promise.resolve().then(()=>{try{rmdirSync(e,i),r(null)}catch(e){r(e)}})}function readFile(e,t,n){let r=typeof t==`function`?t:n,i=typeof t==`function`?void 0:t,a=normalizePath(e);Promise.resolve().then(()=>{try{r(null,readFileSync(a,typeof i==`string`?{encoding:i,flag:`r`}:{encoding:i?.encoding??null,flag:i?.flag??`r`}))}catch(e){r(e,null)}})}function writeFile(e,t,n,r){let i=typeof n==`function`?n:r,a=normalizePath(e);Promise.resolve().then(()=>{try{writeFileSync(a,t),i(null)}catch(e){i(e)}})}function link(e,t,n){let r=normalizePath(e),i=normalizePath(t);Promise.resolve().then(()=>{try{if(!k.spawn_command_line_sync(`ln ${r} ${i}`)[0])throw Object.assign(Error(`EPERM: operation not permitted, link '${r}' -> '${i}'`),{code:`EPERM`,errno:-1,syscall:`link`,path:r,dest:i});n(null)}catch(e){n(e)}})}function unlink(e,t){let n=normalizePath(e);Promise.resolve().then(()=>{try{k.unlink(n),t(null)}catch(e){t(e)}})}var Vl=__esmMin(()=>{eu(),Tl(),Ql(),Dl(),$l(),Bl(),A(),N(),q()});function toPathIfFileURL(e){return normalizePath(e)}function createWriteStream(e,t){return new WriteStream(e,t)}var Hl,Ul,WriteStream,Wl=__esmMin(()=>{eu(),Vl(),Zr(),Hl=Symbol(`kIsPerformingIO`),Ul=Symbol(`kIoDone`),WriteStream=class extends Kr{close(e,t=null){this.fd?(close(this.fd,n=>{e(n||t)}),this.fd=null):e(t)}bytesWritten=0;path;pending;fd=null;flags=`w`;mode=438;pos=0;[Hl]=!1;constructor(e,t={}){super(t),this.path=toPathIfFileURL(e),t.encoding&&this.setDefaultEncoding(t.encoding)}_construct(e){open(this.path.toString(),this.flags,this.mode,(t,n)=>{if(t){e(t);return}this.fd=n,e(),this.emit(`open`,this.fd),this.emit(`ready`)})}_write(e,t,n){this[Hl]=!0,write(this.fd,e,0,e.length,this.pos,(e,t)=>{if(this[Hl]=!1,this.destroyed)return n(e),this.emit(Ul,e);if(e)return n(e);this.bytesWritten+=t,n()}),this.pos!==void 0&&(this.pos+=e.length)}_destroy(e,t){this[Hl]?this.once(Ul,n=>this.close(t,e||n)):this.close(t,e)}}});function resolveIOMode(e){if(e==null)return`r`;if(typeof e==`number`){let t=(e&2)!=0,n=(e&1)!=0,r=(e&1024)!=0,i=(e&512)!=0;return t?i?`w+`:`r+`:n?r?`a`:`w`:`r`}switch(e){case`ax`:case`wx`:return`w`;case`ax+`:case`wx+`:return`w+`;case`as`:case`rs+`:return`r+`;case`as+`:return`a+`;default:return e}}function shouldCreate(e){return typeof e==`number`?(e&64)!=0:typeof e==`string`?e===`w`||e===`w+`||e===`wx`||e===`wx+`||e===`a`||e===`a+`||e===`ax`||e===`ax+`||e===`as`||e===`as+`:!1}function openIOChannel(e,t,n){try{return k.IOChannel.new_file(e,t)}catch(r){if(n&&t===`r+`&&r?.code===k.FileError.NOENT)return k.file_set_contents(e,new Uint8Array),k.IOChannel.new_file(e,t);throw r}}function mapOpenError(e,t){return createGLibFileError(e,`open`,{path:t})}var Gl=__esmMin(()=>{A(),L()});function createInterface(e,t,n,r){return typeof e==`object`&&e&&!(`read`in e&&typeof e.read==`function`)?new Interface(e):new Interface({input:e,output:t,completer:n,terminal:r})}function*emitKeys(e){for(;;){let t=yield,n=t,r=!1,i={sequence:``,name:void 0,ctrl:!1,meta:!1,shift:!1};if(t===`\x1B`&&(r=!0,n+=t=yield,t===`\x1B`&&(n+=t=yield)),r&&(t===`O`||t===`[`)){let e=t,r=0;if(t===`O`)n+=t=yield,t>=`0`&&t<=`9`&&(r=t.charCodeAt(0)-1,n+=t=yield),e+=t;else if(t===`[`){n+=t=yield,t===`[`&&(e+=t,n+=t=yield);let i=n.length-1;t>=`0`&&t<=`9`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=t=yield))),t===`;`&&(n+=t=yield,t>=`0`&&t<=`9`&&(n+=yield));let a=n.slice(i),o;(o=/^(?:(\d\d?)(?:;(\d))?([~^$])|(\d{3}~))$/.exec(a))?o[4]?e+=o[4]:(e+=o[1]+o[3],r=(parseInt(o[2]??`1`,10)||1)-1):(o=/^((\d;)?(\d))?([A-Za-z])$/.exec(a))?(e+=o[4],r=(parseInt(o[3]??`1`,10)||1)-1):e+=a}switch(i.ctrl=!!(r&4),i.meta=!!(r&10),i.shift=!!(r&1),i.code=e,e){case`[P`:case`OP`:case`[11~`:case`[[A`:i.name=`f1`;break;case`[Q`:case`OQ`:case`[12~`:case`[[B`:i.name=`f2`;break;case`[R`:case`OR`:case`[13~`:case`[[C`:i.name=`f3`;break;case`[S`:case`OS`:case`[14~`:case`[[D`:i.name=`f4`;break;case`[15~`:case`[[E`:i.name=`f5`;break;case`[17~`:i.name=`f6`;break;case`[18~`:i.name=`f7`;break;case`[19~`:i.name=`f8`;break;case`[20~`:i.name=`f9`;break;case`[21~`:i.name=`f10`;break;case`[23~`:i.name=`f11`;break;case`[24~`:i.name=`f12`;break;case`[200~`:i.name=`paste-start`;break;case`[201~`:i.name=`paste-end`;break;case`[A`:case`OA`:i.name=`up`;break;case`[B`:case`OB`:i.name=`down`;break;case`[C`:case`OC`:i.name=`right`;break;case`[D`:case`OD`:i.name=`left`;break;case`[E`:case`OE`:i.name=`clear`;break;case`[F`:case`OF`:i.name=`end`;break;case`[H`:case`OH`:i.name=`home`;break;case`[1~`:i.name=`home`;break;case`[2~`:i.name=`insert`;break;case`[3~`:i.name=`delete`;break;case`[4~`:i.name=`end`;break;case`[5~`:case`[[5~`:i.name=`pageup`;break;case`[6~`:case`[[6~`:i.name=`pagedown`;break;case`[7~`:i.name=`home`;break;case`[8~`:i.name=`end`;break;case`[a`:i.name=`up`,i.shift=!0;break;case`[b`:i.name=`down`,i.shift=!0;break;case`[c`:i.name=`right`,i.shift=!0;break;case`[d`:i.name=`left`,i.shift=!0;break;case`[2$`:i.name=`insert`,i.shift=!0;break;case`[3$`:i.name=`delete`,i.shift=!0;break;case`[5$`:i.name=`pageup`,i.shift=!0;break;case`[6$`:i.name=`pagedown`,i.shift=!0;break;case`[7$`:i.name=`home`,i.shift=!0;break;case`[8$`:i.name=`end`,i.shift=!0;break;case`Oa`:i.name=`up`,i.ctrl=!0;break;case`Ob`:i.name=`down`,i.ctrl=!0;break;case`Oc`:i.name=`right`,i.ctrl=!0;break;case`Od`:i.name=`left`,i.ctrl=!0;break;case`[2^`:i.name=`insert`,i.ctrl=!0;break;case`[3^`:i.name=`delete`,i.ctrl=!0;break;case`[5^`:i.name=`pageup`,i.ctrl=!0;break;case`[6^`:i.name=`pagedown`,i.ctrl=!0;break;case`[7^`:i.name=`home`,i.ctrl=!0;break;case`[8^`:i.name=`end`,i.ctrl=!0;break;case`[Z`:i.name=`tab`,i.shift=!0;break;default:i.name=`undefined`;break}}else t===`\r`?(i.name=`return`,i.meta=r):t===`
|
|
36
|
-
`?(i.name=`enter`,i.meta=r):t===` `?(i.name=`tab`,i.meta=r):t===`\b`||t===``?(i.name=`backspace`,i.meta=r):t===`\x1B`?(i.name=`escape`,i.meta=r):t===` `?(i.name=`space`,i.meta=r):!r&&t<=``?(i.name=String.fromCharCode(t.charCodeAt(0)+97-1),i.ctrl=!0):/^[0-9A-Za-z]$/.test(t)?(i.name=t.toLowerCase(),i.shift=/^[A-Z]$/.test(t),i.meta=r):r&&(i.name=t.length?void 0:`escape`,i.meta=!0);i.sequence=n,n.length!==0&&(i.name!==void 0||r)?e.emit(`keypress`,r?void 0:n,i):n.length===1&&e.emit(`keypress`,n,i)}}function emitKeypressEvents(e,t={}){let n=e;if(n[Jl])return;n[Jl]=new Sn(`utf8`),n[Yl]=emitKeys(e),n[Yl].next();let r=t.escapeCodeTimeout??500,i,triggerEscape=()=>n[Yl].next(``);function onData(t){if(e.listenerCount(`keypress`)>0){let a=n[Jl].write(typeof t==`string`?Buffer.from(t):t);if(a){clearTimeout(i);for(let t of a)try{n[Yl].next(t),t===`\x1B`&&(i=setTimeout(triggerEscape,r))}catch{n[Yl]=emitKeys(e),n[Yl].next()}}}else e.removeListener(`data`,onData),delete n[Jl],delete n[Yl]}e.on(`data`,onData)}var Kl,Interface,ql,Jl,Yl,Xl=__esmMin(()=>{bn(),wn(),Kl=/\r\n|\r|\n/,Interface=class extends J{terminal;line=``;cursor=0;escapeCodeTimeout;_input;_output;get input(){return this._input}get output(){return this._output}_prompt;_closed=!1;_paused=!1;history;_historySize;_crlfDelay;_lineBuffer=``;_questionCallback=null;_boundOnData=null;_boundOnEnd=null;_boundOnError=null;_boundOnKeypress=null;constructor(e,t){super();let n;if(n=e&&typeof e==`object`&&!(`read`in e&&typeof e.read==`function`)?e:{input:e,output:t},this._input=n.input||null,this._output=n.output||null,this._prompt=n.prompt||`> `,this.terminal=n.terminal??this._output!==null,this._historySize=n.historySize??30,this.history=[],this._crlfDelay=n.crlfDelay??100,this.escapeCodeTimeout=n.escapeCodeTimeout,this._input&&(this._boundOnData=e=>this._onData(e),this._boundOnEnd=()=>this._onEnd(),this._boundOnError=e=>this.emit(`error`,e),this._input.on(`data`,this._boundOnData),this._input.on(`end`,this._boundOnEnd),this._input.on(`error`,this._boundOnError),`setEncoding`in this._input&&typeof this._input.setEncoding==`function`&&this._input.setEncoding(`utf8`),this.terminal)){emitKeypressEvents(this._input,this);let e=this._input;typeof e.setRawMode==`function`&&(e.isRaw||e.setRawMode(!0)),typeof this._input.resume==`function`&&this._input.resume(),this._boundOnKeypress=(e,t)=>{t&&(t.name===`backspace`||t.name===`delete`?this.cursor>0&&(this.line=this.line.slice(0,this.cursor-1)+this.line.slice(this.cursor),this.cursor--):e&&e.length===1&&!t.ctrl&&!t.meta&&t.name!==`return`&&t.name!==`enter`&&t.name!==`escape`&&(this.line=this.line.slice(0,this.cursor)+e+this.line.slice(this.cursor),this.cursor++))},this._input.on(`keypress`,this._boundOnKeypress)}}_onData(e){if(this._closed||this._paused)return;let t=typeof e==`string`?e:e.toString(`utf8`);this._lineBuffer+=t;let n;for(;(n=Kl.exec(this._lineBuffer))!==null;){let e=this._lineBuffer.substring(0,n.index);this._lineBuffer=this._lineBuffer.substring(n.index+n[0].length),this._onLine(e)}}_onLine(e){if(e.length>0&&this._historySize>0&&(this.history.length===0||this.history[0]!==e)&&(this.history.unshift(e),this.history.length>this._historySize&&this.history.pop()),this._questionCallback){let t=this._questionCallback;this._questionCallback=null,t(e)}this.emit(`line`,e)}_onEnd(){this._lineBuffer.length>0&&(this._onLine(this._lineBuffer),this._lineBuffer=``),this.close()}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(this._closed)throw Error(`readline was closed`);this._output?.write(this._prompt)}question(e,t,n){if(this._closed)throw Error(`readline was closed`);let r=typeof t==`function`?t:n;this._questionCallback=r,this._output?.write(e)}clearLine(e,t){return this.line=``,this.cursor=0,t&&t(),!0}write(e,t){if(!this._closed){if(t){this._input&&this._input.emit(`keypress`,e??``,t);return}if(e!=null){let t=typeof e==`string`?e:e.toString(`utf8`);t&&(this.line=this.line.slice(0,this.cursor)+t+this.line.slice(this.cursor),this.cursor+=t.length),this._output?.write(e)}}}close(){if(!this._closed){if(this._closed=!0,this._input){this._boundOnData&&this._input.removeListener(`data`,this._boundOnData),this._boundOnEnd&&this._input.removeListener(`end`,this._boundOnEnd),this._boundOnError&&this._input.removeListener(`error`,this._boundOnError),this._boundOnKeypress&&this._input.removeListener(`keypress`,this._boundOnKeypress),this._boundOnData=null,this._boundOnEnd=null,this._boundOnError=null,this._boundOnKeypress=null;let e=this._input;this.terminal&&e.isRaw&&typeof e.setRawMode==`function`&&e.setRawMode(!1),typeof this._input.pause==`function`&&this._input.pause()}this.emit(`close`)}}pause(){return this._closed?this:(this._paused=!0,this._input&&`pause`in this._input&&typeof this._input.pause==`function`&&this._input.pause(),this.emit(`pause`),this)}resume(){return this._closed?this:(this._paused=!1,this._input&&`resume`in this._input&&typeof this._input.resume==`function`&&this._input.resume(),this.emit(`resume`),this)}getCursorPos(){let e=this._output?.columns??80,t=this._prompt.length+this.cursor;return{rows:Math.floor(t/e),cols:t%e}}[Symbol.asyncIterator](){let e=[],t=null,n=!1,onLine=n=>{if(t){let e=t;t=null,e({value:n,done:!1})}else e.push(n)},onClose=()=>{if(n=!0,t){let e=t;t=null,e({value:void 0,done:!0})}};return this.on(`line`,onLine),this.on(`close`,onClose),{next:()=>e.length>0?Promise.resolve({value:e.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise(e=>{t=e}),return:()=>(n=!0,this.removeListener(`line`,onLine),this.removeListener(`close`,onClose),Promise.resolve({value:void 0,done:!0})),[Symbol.asyncIterator](){return this}}}},ql=Symbol.dispose??Symbol.for(`Symbol.dispose`),Interface.prototype[ql]=function(){this.close()},Jl=Symbol(`keypress-decoder`),Yl=Symbol(`escape-decoder`)}),Zl,Ql=__esmMin(()=>{Sl(),eu(),El(),Wl(),Tl(),Gl(),$l(),A(),N(),q(),Xl(),Zl=class FileHandle{_file;_ioStream=null;_readStream=null;_gFile;_ioMode;_ioLock=Promise.resolve();static instances={};constructor(e){this.options=e,this.options.flags||=`r`,this.options.mode||=438;let t=normalizePath(e.path),n=shouldCreate(e.flags),r=resolveIOMode(e.flags);try{this._file=openIOChannel(t,r,n)}catch(e){throw mapOpenError(e,t)}return this._file.set_encoding(null),this.fd=this._file.unix_get_fd(),this._gFile=M.File.new_for_path(t),this._ioMode=r,FileHandle.instances[this.fd]=this,FileHandle.getInstance(this.fd)}_getReadStream(){return this._ioStream?{input:this._ioStream.get_input_stream(),seekable:this._ioStream}:this._ioMode===`r`?(this._readStream||=this._gFile.read(null),{input:this._readStream,seekable:this._readStream}):(this._ioStream=this._gFile.open_readwrite(null),{input:this._ioStream.get_input_stream(),seekable:this._ioStream})}_getWriteStream(){if(this._ioStream)return this._ioStream;if(this._ioMode===`r`)throw Error(`FileHandle opened read-only; cannot write`);return this._ioStream=this._gFile.open_readwrite(null),this._ioStream}_serialize(e){let t=this._ioLock.catch(()=>{}).then(e);return this._ioLock=t,t}fd;static getInstance(e){if(!FileHandle.instances[e])throw Error(`No instance found for fd!`);return FileHandle.instances[e]}async appendFile(e,t){let n=getEncodingFromOptions(t);typeof e==`string`&&(e=K.from(e)),n&&this._file.set_encoding(n);let[r,i]=this._file.write_chars(e,e.length);if(r===k.IOStatus.ERROR)throw Error(`Error on append to file!`)}async chown(e,t){chownSync(normalizePath(this.options.path),e,t)}async chmod(e){chmodSync(normalizePath(this.options.path),e)}createReadStream(e){return new ReadStream(this.options.path,e)}createWriteStream(e){return new WriteStream(this.options.path,e)}async datasync(){this._file.flush()}async sync(){this._file.flush()}async read(...e){let t,n,r,i;if(typeof e[0]==`object`&&!(e[0]instanceof Uint8Array)&&!(e[0]instanceof K)){let a=e[0];t=a.buffer,n=a.offset,r=a.length,i=a.position}else t=e[0],n=e[1],r=e[2],i=e[3];let a=t,o=n??0,s=r??a?.byteLength??65536,c=i??0;return this._serialize(async()=>{let{input:e,seekable:n}=this._getReadStream();n.seek(BigInt(c),k.SeekType.SET,null);let r=e.read_bytes(s,null).get_data(),i=r?.length??0;return a&&r&&i>0&&a.set(r,o),{bytesRead:i,buffer:t}})}readableWebStream(){let e=globalThis.ReadableStream;if(typeof e!=`function`)throw Error(`readableWebStream() requires a global ReadableStream. Import "node:stream/web" or "@gjsify/streams" before calling this method.`);return new e}async readFile(e){let t=getEncodingFromOptions(e,`buffer`);t&&this._file.set_encoding(t);let[n,r]=this._file.read_to_end();if(n===k.IOStatus.ERROR)throw Error(`Error on read from file!`);return encodeUint8Array(t,r)}readLines(e){return createInterface({input:this.createReadStream(e),crlfDelay:1/0})}async stat(e){let t=await new Promise((e,t)=>{this._gFile.query_info_async(wl,M.FileQueryInfoFlags.NONE,k.PRIORITY_DEFAULT,null,(n,r)=>{try{e(this._gFile.query_info_finish(r))}catch(e){t(e)}})}),n=normalizePath(this.options.path);return e?.bigint?new BigIntStats(t,n):new Stats(t,n)}async truncate(e=0){let t=Math.max(0,e);this._file.flush(),this._getWriteStream().get_output_stream().truncate(t,null)}async utimes(e,t){let{utimesSync:n}=await Promise.resolve().then(()=>(Il(),Fl));n(normalizePath(this.options.path),e,t)}async writeFile(e,t){let n=getEncodingFromOptions(t),r;r=typeof e==`string`?K.from(e,n||`utf8`):e,this._file.seek_position(0,k.SeekType.SET);let[i]=this._file.write_chars(r,r.length);if(i===k.IOStatus.ERROR)throw Error(`Error writing to file!`);this._file.flush()}async write(e,...t){let n=null,r=null,i=null,a=null;typeof e==`string`?(n=t[0],r=t[1]):(i=t[0],a=t[1],n=t[2]),r=getEncodingFromOptions(r,typeof e==`string`?`utf8`:null);let o;o=typeof e==`string`?new TextEncoder().encode(e):e;let s=i??0,c=a??o.byteLength-s,l=o.slice(s,s+c),u=n??0;return{bytesWritten:await this._serialize(async()=>{let e=this._getWriteStream();e.seek(BigInt(u),k.SeekType.SET,null);let t=e.get_output_stream(),n=await new Promise((e,n)=>{t.write_bytes_async(new k.Bytes(l),k.PRIORITY_DEFAULT,null,(r,i)=>{try{e(t.write_bytes_finish(i))}catch(e){n(e)}})});return await new Promise((e,n)=>{t.flush_async(k.PRIORITY_DEFAULT,null,(r,i)=>{try{t.flush_finish(i),e()}catch(e){n(e)}})}),n}),buffer:e}}async writev(e,t){let n=0;for(let r of e){let e=K.from(r.buffer,r.byteOffset,r.byteLength),i=await this.write(e,0,e.byteLength,t==null?null:t+n);n+=i.bytesWritten}return{bytesWritten:n,buffers:e}}async readv(e,t){let n=0;for(let r of e){let e=await this.read({buffer:K.from(r.buffer,r.byteOffset,r.byteLength),position:t==null?null:t+n});if(n+=e.bytesRead,e.bytesRead<r.byteLength)break}return{bytesRead:n,buffers:e}}_flushSync(){this._file.flush()}_closeSync(){try{this._ioStream?.close(null)}catch{}try{this._readStream?.close(null)}catch{}this._ioStream=null,this._readStream=null;try{this._file.shutdown(!0)}catch{}let e=FileHandle;delete e.instances[this.fd]}_readSync(e,t,n,r){let i=this._gFile.read(null);try{r!==null&&r>=0&&i.seek(r,k.SeekType.SET,null);let a=i.read_bytes(n,null).get_data();return new Uint8Array(e.buffer,e.byteOffset+t).set(a.subarray(0,a.length)),a.length}finally{i.close(null)}}_writeSync(e,t){let n=this._gFile.open_readwrite(null);try{return t!==null&&t>=0&&n.seek(t,k.SeekType.SET,null),n.get_output_stream().write_bytes(k.Bytes.new(e),null)}finally{n.close(null)}}async close(){try{this._ioStream?.close(null)}catch{}try{this._readStream?.close(null)}catch{}this._ioStream=null,this._readStream=null;try{this._file.shutdown(!0)}catch{}}async[Symbol.asyncDispose](){await this.close()}pull(...e){throw Error('FileHandle.pull() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}writer(e){throw Error('FileHandle.writer() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}}});function statSync(e,t){let n=normalizePath(e);try{let e=M.File.new_for_path(n).query_info(wl,M.FileQueryInfoFlags.NONE,null);return t?.bigint?new BigIntStats(e,n):new Stats(e,n)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`stat`,n)}}function lstatSync(e,t){let n=normalizePath(e);try{let e=M.File.new_for_path(n).query_info(wl,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);return t?.bigint?new BigIntStats(e,n):new Stats(e,n)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`lstat`,n)}}function readdirSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n).enumerate_children(`standard::name,standard::type`,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null),i=[];try{let e=r.next_file(null);for(;e!==null;)i.push({name:e.get_name(),type:e.get_file_type()}),e=r.next_file(null)}finally{try{r.close(null)}catch{}}let a=[];for(let e of i){let r=ao(n,e.name);if(t?.withFileTypes?a.push(new Dirent(r,e.name,e.type)):a.push(e.name),t?.recursive&&e.type===M.FileType.DIRECTORY){let n=readdirSync(r,t);for(let t of n)typeof t==`string`?a.push(ao(e.name,t)):a.push(t)}}return a}function realpathSync(e){let t=normalizePath(e),n=M.File.new_for_path(t),r=0;for(;;){let e=n.query_info(`standard::is-symlink,standard::symlink-target`,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(!e.get_is_symlink())return n.get_path();let i=e.get_symlink_target(),a=n.get_parent();if(n=a?a.resolve_relative_path(i):M.File.new_for_path(i),++r>40)throw Error(`ELOOP: too many levels of symbolic links, realpath '${t}'`)}}function symlinkSync(e,t,n){let r=normalizePath(t),i=normalizePath(e);M.File.new_for_path(r).make_symbolic_link(i,null)}function readFileSync(e,t={encoding:null,flag:`r`}){let n=normalizePath(e),r=M.File.new_for_path(n);try{let[e,i]=r.load_contents(null);if(!e)throw createNodeError(Error(`failed to read file`),`read`,n);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),i)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`read`,n)}}function mkdirSync(e,t){let n=!1,r=511;if(typeof t==`object`?(t?.recursive&&(n=t.recursive),t?.mode&&(r=t.mode)):r=t||511,e=normalizePath(e),typeof r==`string`)throw TypeError(`mode as string is currently not supported!`);if(n)return mkdirSyncRecursive(e);let i=M.File.new_for_path(e);try{i.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}}function mkdirSyncRecursive(e){let t=M.File.new_for_path(e);try{return t.make_directory(null),e}catch(t){let n=t;if(n.code===M.IOErrorEnum.EXISTS)return;if(n.code===M.IOErrorEnum.NOT_FOUND){let n=ao(e,`..`),r=M.File.new_for_path(n).get_path();if(r===e)throw createNodeError(t,`mkdir`,e);let i=mkdirSyncRecursive(r),a=M.File.new_for_path(e);try{a.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}return i??e}throw createNodeError(t,`mkdir`,e)}}function rmdirSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{if(r.query_info(`standard::type`,M.FileQueryInfoFlags.NONE,null).get_file_type()!==M.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if(r.enumerate_children(`standard::name`,M.FileQueryInfoFlags.NONE,null).next_file(null)!==null)throw createNodeError(Object.assign(Error(),{code:5}),`rmdir`,n);r.delete(null)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`rmdir`,n)}}function unlinkSync(e){let t=normalizePath(e),n=M.File.new_for_path(t);try{n.delete(null)}catch(e){throw createNodeError(e,`unlink`,t)}}function writeFileSync(e,t){k.file_set_contents(normalizePath(e),t)}function renameSync(e,t){let n=normalizePath(e),r=normalizePath(t),i=M.File.new_for_path(n),a=M.File.new_for_path(r);try{i.move(a,M.FileCopyFlags.OVERWRITE,null,null)}catch(e){throw createNodeError(e,`rename`,n,r)}}function copyFileSync(e,t,n){let r=normalizePath(e),i=normalizePath(t),a=M.File.new_for_path(r),o=M.File.new_for_path(i),s=M.FileCopyFlags.NONE;n&&!(n&1)?s=M.FileCopyFlags.OVERWRITE:n||(s=M.FileCopyFlags.OVERWRITE);try{a.copy(o,s,null,null)}catch(e){throw createNodeError(e,`copyfile`,r,i)}}function accessSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{let e=r.query_info(`access::*`,M.FileQueryInfoFlags.NONE,null);if(t!==void 0&&t!==0){let r={code:14,message:`permission denied, access '${n}'`};if(t&4&&!e.get_attribute_boolean(`access::can-read`)||t&2&&!e.get_attribute_boolean(`access::can-write`)||t&1&&!e.get_attribute_boolean(`access::can-execute`))throw createNodeError(r,`access`,n)}}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`access`,n)}}function appendFileSync(e,t,n){let r=normalizePath(e),i=M.File.new_for_path(r),a;a=typeof t==`string`?new TextEncoder().encode(t):t;try{let e=i.append_to(M.FileCreateFlags.NONE,null);a.length>0&&e.write_bytes(new k.Bytes(a),null),e.close(null)}catch(e){throw createNodeError(e,`appendfile`,r)}}function readlinkSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{let e=r.query_info(`standard::symlink-target`,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_symlink_target();if(!e)throw Object.assign(Error(`EINVAL: invalid argument, readlink '${n}'`),{code:`EINVAL`,errno:-22,syscall:`readlink`,path:n});return(typeof t==`string`?t:t?.encoding)===`buffer`?K.from(e):e}catch(e){throw typeof e.code==`string`?e:createNodeError(e,`readlink`,n)}}function linkSync(e,t){let n=normalizePath(e),r=normalizePath(t);if(!k.spawn_command_line_sync(`ln ${n} ${r}`)[0])throw Object.assign(Error(`EPERM: operation not permitted, link '${n}' -> '${r}'`),{code:`EPERM`,errno:-1,syscall:`link`,path:n,dest:r})}function truncateSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{let e=r.replace(null,!1,M.FileCreateFlags.NONE,null);if(t&&t>0){let[,n]=r.load_contents(null),i=n.slice(0,t);i.length>0&&e.write_bytes(new k.Bytes(i),null)}e.close(null)}catch(e){throw createNodeError(e,`truncate`,n)}}function chmodSync(e,t){let n=normalizePath(e),r=typeof t==`string`?parseInt(t,8):t;if(!k.spawn_command_line_sync(`chmod ${r.toString(8)} ${n}`)[0])throw Object.assign(Error(`EPERM: operation not permitted, chmod '${n}'`),{code:`EPERM`,errno:-1,syscall:`chmod`,path:n})}function chownSync(e,t,n){let r=normalizePath(e);if(!k.spawn_command_line_sync(`chown ${t}:${n} ${r}`)[0])throw Object.assign(Error(`EPERM: operation not permitted, chown '${r}'`),{code:`EPERM`,errno:-1,syscall:`chown`,path:r})}function watch(e,t,n){return new FSWatcher(normalizePath(e),t,n)}function openSync(e,t,n){return new Zl({path:e,flags:t,mode:n})}function mkdtempSync(e,t){let n=getEncodingFromOptions(t),r=tempDirPath(e);return mkdirSync(r,{recursive:!1,mode:511}),decode(r,n)}function rmSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n),i=t?.recursive||!1,a=t?.force||!1,o;try{o=r.query_file_type(M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}if(o===M.FileType.SYMBOLIC_LINK){try{r.delete(null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}return}if(o===M.FileType.DIRECTORY){let r=readdirSync(e);if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)rmSync(ao(n,e),t)}try{r.delete(null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}}var $l=__esmMin(()=>{Sl(),eu(),nu(),Cl(),Tl(),Ql(),Dl(),A(),N(),_o(),q(),L(),realpathSync.native=realpathSync});function normalizePath(e){return e instanceof URL||e instanceof X?fileURLToPath(e):typeof e==`string`?e:e.toString()}function randomName(){return[...[,,,,,,]].map(()=>`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.floor(Math.random()*62)]).join(``)}function tempDirPath(e){let t;do t=e+randomName();while(existsSync(t));return t}var eu=__esmMin(()=>{$l(),Mn()});function changed(e,t,n,r){switch(r){case M.FileMonitorEvent.CHANGES_DONE_HINT:this.emit(`change`,`change`,t.get_basename());break;case M.FileMonitorEvent.DELETED:case M.FileMonitorEvent.CREATED:case M.FileMonitorEvent.RENAMED:case M.FileMonitorEvent.MOVED_IN:case M.FileMonitorEvent.MOVED_OUT:this.emit(`change`,`rename`,t.get_basename());break}}function gioEventToNodeType(e){switch(e){case M.FileMonitorEvent.CHANGES_DONE_HINT:return`change`;case M.FileMonitorEvent.DELETED:case M.FileMonitorEvent.CREATED:case M.FileMonitorEvent.RENAMED:case M.FileMonitorEvent.MOVED_IN:case M.FileMonitorEvent.MOVED_OUT:return`rename`;default:return null}}async function*watchAsync(e,t){let n=t?.signal;if(n?.aborted)return;let r=normalizePath(e),i=M.File.new_for_path(r),a=M.Cancellable.new(),o;try{o=i.monitor(M.FileMonitorFlags.NONE,a)}catch{return}let s=[],c=[],l=!1;function enqueue(e){l||(c.length>0?c.shift().resolve({value:e,done:!1}):s.push(e))}function terminate(){if(!l)for(l=!0,a.is_cancelled()||a.cancel();c.length>0;)c.shift().resolve({value:void 0,done:!0})}let u=o.connect(`changed`,(e,t,n,r)=>{let i=gioEventToNodeType(r);i!==null&&enqueue({eventType:i,filename:t?.get_basename()??null})}),abortHandler=()=>terminate();n?.addEventListener(`abort`,abortHandler);try{for(;!l;){if(s.length>0){yield s.shift();continue}let e=await new Promise(e=>{c.push({resolve:e})});if(e.done)break;yield e.value}}finally{n?.removeEventListener(`abort`,abortHandler);try{o.disconnect(u)}catch{}a.is_cancelled()||a.cancel()}}var tu,FSWatcher,nu=__esmMin(()=>{eu(),A(),N(),bn(),tu=new WeakMap,FSWatcher=class extends J{constructor(e,t,n){super(),(!t||typeof t!=`object`)&&(t={persistent:!0});let r=t.persistent!==!1,i=M.Cancellable.new(),a=normalizePath(e),o=M.File.new_for_path(a).monitor(M.FileMonitorFlags.NONE,i);o.connect(`changed`,changed.bind(this));let s=null;r&&(s=k.timeout_add(k.PRIORITY_LOW,2147483647,()=>k.SOURCE_CONTINUE)),tu.set(this,{persistent:r,cancellable:i,sourceId:s,watcher:o}),n&&this.on(`change`,n)}close(){let e=tu.get(this);e.cancellable.is_cancelled()||(e.cancellable.cancel(),e.sourceId!==null&&(k.source_remove(e.sourceId),e.sourceId=null))}ref(){let e=tu.get(this);return!e.persistent&&!e.cancellable.is_cancelled()&&(e.persistent=!0,e.sourceId=k.timeout_add(k.PRIORITY_LOW,2147483647,()=>k.SOURCE_CONTINUE)),this}unref(){let e=tu.get(this);return e.persistent&&(e.persistent=!1,e.sourceId!==null&&(k.source_remove(e.sourceId),e.sourceId=null)),this}}});function zeroedStat(){return{dev:0,ino:0,mode:0,nlink:0,uid:0,gid:0,rdev:0,size:0,blksize:0,blocks:0,atimeMs:0,mtimeMs:0,ctimeMs:0,birthtimeMs:0,atime:new Date(0),mtime:new Date(0),ctime:new Date(0),birthtime:new Date(0),isFile:()=>!1,isDirectory:()=>!1,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isSymbolicLink:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}}function watchFile(e,t,n){typeof t==`function`&&(n=t,t={});let r=t.interval??5007,i=e.toString(),a=ru.get(i);return a||(a=new StatWatcher(i,r),a.start(),ru.set(i,a)),n&&a.addChangeListener(n),a}function unwatchFile(e,t){let n=e.toString(),r=ru.get(n);r&&(t?r.removeChangeListener(t):r.removeAllChangeListeners(),r.changeListenerCount===0&&(r.stop(),ru.delete(n)))}var StatWatcher,ru,iu=__esmMin(()=>{$l(),bn(),StatWatcher=class extends J{_path;_interval;_timerId=null;_prev;_changeCount=0;constructor(e,t){super(),this._path=e,this._interval=t,this._prev=zeroedStat()}start(){try{this._prev=statSync(this._path)}catch{}this._timerId=setInterval(()=>{let e;try{e=statSync(this._path)}catch{e=zeroedStat()}let t=this._prev;(e.mtimeMs!==t.mtimeMs||e.size!==t.size||e.ino!==t.ino)&&(this._prev=e,this.emit(`change`,e,t))},this._interval)}stop(){this._timerId!==null&&(clearInterval(this._timerId),this._timerId=null),this.emit(`stop`)}addChangeListener(e){this._changeCount++,this.on(`change`,e)}removeChangeListener(e){this._changeCount--,this.removeListener(`change`,e)}removeAllChangeListeners(){this._changeCount=0,this.removeAllListeners(`change`)}get changeListenerCount(){return this._changeCount}},ru=new Map}),au=__exportAll$4({BigIntStats:()=>BigIntStats,Dir:()=>Dir,Dirent:()=>Dirent,FSWatcher:()=>FSWatcher,ReadStream:()=>ReadStream,StatWatcher:()=>StatWatcher,Stats:()=>Stats,WriteStream:()=>WriteStream,access:()=>access,accessSync:()=>accessSync,appendFile:()=>appendFile,appendFileSync:()=>appendFileSync,chmod:()=>chmod,chmodSync:()=>chmodSync,chown:()=>chown,chownSync:()=>chownSync,close:()=>close,closeSync:()=>closeSync,constants:()=>ou,copyFile:()=>copyFile,copyFileSync:()=>copyFileSync,cp:()=>cp,cpSync:()=>cpSync,createReadStream:()=>createReadStream,createWriteStream:()=>createWriteStream,default:()=>su,exists:()=>exists,existsSync:()=>existsSync,fchmod:()=>fchmod,fchmodSync:()=>fchmodSync,fchown:()=>fchown,fchownSync:()=>fchownSync,fdatasync:()=>fdatasync,fdatasyncSync:()=>fdatasyncSync,fstat:()=>fstat,fstatSync:()=>fstatSync,fsync:()=>fsync,fsyncSync:()=>fsyncSync,ftruncate:()=>ftruncate,ftruncateSync:()=>ftruncateSync,futimes:()=>futimes,futimesSync:()=>futimesSync,glob:()=>glob,globSync:()=>globSync,lchmod:()=>lchmod,lchmodSync:()=>lchmodSync,lchown:()=>lchown,lchownSync:()=>lchownSync,link:()=>link,linkSync:()=>linkSync,lstat:()=>lstat,lstatSync:()=>lstatSync,lutimes:()=>lutimes,lutimesSync:()=>lutimesSync,mkdir:()=>mkdir,mkdirSync:()=>mkdirSync,mkdtempSync:()=>mkdtempSync,open:()=>open,openAsBlob:()=>openAsBlob,openSync:()=>openSync,opendir:()=>opendir,opendirSync:()=>opendirSync,promises:()=>Rl,read:()=>read,readFile:()=>readFile,readFileSync:()=>readFileSync,readSync:()=>readSync,readdir:()=>readdir,readdirSync:()=>readdirSync,readlink:()=>readlink,readlinkSync:()=>readlinkSync,readv:()=>readv,readvSync:()=>readvSync,realpath:()=>realpath,realpathSync:()=>realpathSync,rename:()=>rename,renameSync:()=>renameSync,rm:()=>rm,rmSync:()=>rmSync,rmdir:()=>rmdir,rmdirSync:()=>rmdirSync,stat:()=>stat,statSync:()=>statSync,statfs:()=>statfs,statfsSync:()=>statfsSync,symlink:()=>symlink,symlinkSync:()=>symlinkSync,truncate:()=>truncate,truncateSync:()=>truncateSync,unlink:()=>unlink,unlinkSync:()=>unlinkSync,unwatchFile:()=>unwatchFile,utimes:()=>utimes,utimesSync:()=>utimesSync,watch:()=>watch,watchFile:()=>watchFile,write:()=>write,writeFile:()=>writeFile,writeFileSync:()=>writeFileSync,writeSync:()=>writeSync,writev:()=>writev,writevSync:()=>writevSync}),ou,su,cu=__esmMin(()=>{nu(),El(),Wl(),Cl(),Tl(),$l(),Ol(),Al(),jl(),Pl(),Il(),Ll(),Bl(),Vl(),iu(),ou={F_OK:0,R_OK:4,W_OK:2,X_OK:1,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_TRUNC:512,O_APPEND:1024,O_SYNC:1052672,O_NONBLOCK:2048,O_DIRECTORY:65536,O_NOFOLLOW:131072,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1},su={FSWatcher,StatWatcher,Stats,BigIntStats,Dirent,Dir,constants:ou,existsSync,readdirSync,readFileSync,writeFileSync,mkdirSync,rmdirSync,unlinkSync,mkdtempSync,rmSync,statSync,openSync,realpathSync,symlinkSync,lstatSync,renameSync,copyFileSync,accessSync,appendFileSync,readlinkSync,linkSync,truncateSync,chmodSync,chownSync,cpSync,opendirSync,globSync,glob,watch,watchFile,unwatchFile,statfsSync,statfs,utimesSync,utimes,lutimesSync,lutimes,lchownSync,lchown,lchmodSync,lchmod,fstatSync,fstat,ftruncateSync,ftruncate,fdatasyncSync,fdatasync,fsyncSync,fsync,fchmodSync,fchmod,fchownSync,fchown,futimesSync,futimes,closeSync,readSync,writeSync,readvSync,readv,writevSync,writev,exists,openAsBlob,createReadStream,ReadStream,createWriteStream,WriteStream,promises:Rl,open,close,read,write,rm,realpath,readdir,symlink,lstat,stat,rename,copyFile,cp,access,appendFile,readlink,truncate,chmod,chown,mkdir,rmdir,readFile,writeFile,unlink,link,opendir}}),lu=__commonJSMin(((e,t)=>{var n=bo()(`express:view`),r=(_o(),__toCommonJS(to)),i=(cu(),__toCommonJS(au)),a=r.dirname,o=r.basename,s=r.extname,c=r.join,l=r.resolve;t.exports=View;function View(e,t){var r=t||{};if(this.defaultEngine=r.defaultEngine,this.ext=s(e),this.name=e,this.root=r.root,!this.ext&&!this.defaultEngine)throw Error(`No default engine was specified and no extension was provided.`);var i=e;if(this.ext||(this.ext=this.defaultEngine[0]===`.`?this.defaultEngine:`.`+this.defaultEngine,i+=this.ext),!r.engines[this.ext]){var a=this.ext.slice(1);n(`require "%s"`,a);var o=v(a).__express;if(typeof o!=`function`)throw Error(`Module "`+a+`" does not provide a view engine.`);r.engines[this.ext]=o}this.engine=r.engines[this.ext],this.path=this.lookup(i)}View.prototype.lookup=function lookup(e){var t,r=[].concat(this.root);n(`lookup "%s"`,e);for(var i=0;i<r.length&&!t;i++){var s=r[i],c=l(s,e),u=a(c),d=o(c);t=this.resolve(u,d)}return t},View.prototype.render=function render(e,t){var r=!0;n(`render "%s"`,this.path),this.engine(this.path,e,function onRender(){if(!r)return t.apply(this,arguments);for(var e=Array(arguments.length),n=this,i=0;i<arguments.length;i++)e[i]=arguments[i];return process.nextTick(function renderTick(){return t.apply(n,e)})}),r=!1},View.prototype.resolve=function resolve(e,t){var n=this.ext,r=c(e,t),i=tryStat(r);if(i&&i.isFile()||(r=c(e,o(t,n),`index`+n),i=tryStat(r),i&&i.isFile()))return r};function tryStat(e){n(`stat "%s"`,e);try{return i.statSync(e)}catch{return}}})),uu,du,fu=__esmMin(()=>{uu={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,510:`Not Extended`,511:`Network Authentication Required`},du=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PRI.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`)}),IncomingMessage,pu=__esmMin(()=>{q(),Zr(),IncomingMessage=class extends Gr{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];method;url;statusCode;statusMessage;complete=!1;socket=null;aborted=!1;get connection(){return this.socket}_timeoutTimer=null;constructor(){super()}_read(e){}_autoClose(){}_pushBody(e){e&&e.length>0&&this.push(K.from(e)),this.push(null),this.complete=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null)}setTimeout(e,t){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}destroy(e){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this.aborted=!0,super.destroy(e)}}}),ServerRequestSocket,mu=__esmMin(()=>{Zr(),ServerRequestSocket=class extends qr{remoteAddress;remotePort;localAddress;localPort;remoteFamily=`IPv4`;encrypted;connecting=!1;pending=!1;bytesRead=0;bytesWritten=0;_bridgeRes;_bridgePaused=!1;constructor(e,t,n,r,i,a=!1){super({allowHalfOpen:!0}),this.remoteAddress=e,this.remotePort=t,this.localAddress=n,this.localPort=r,this.encrypted=a,this._bridgeRes=i}pause(){return this._bridgePaused?this:(this._bridgePaused=!0,super.pause())}resume(){return this._bridgePaused&&=!1,super.resume()}_read(e){}_write(e,t,n){n()}destroySoon(){this.writableEnded||this.end(),this.writableFinished?this.destroy():this.once(`finish`,()=>this.destroy())}setTimeout(e,t){return t&&this.once(`timeout`,t),this}setNoDelay(e){return this}setKeepAlive(e,t){return this}ref(){return this}unref(){return this}address(){return{address:this.localAddress,family:`IPv4`,port:this.localPort}}}}),Socket,hu=__esmMin(()=>{N(),A(),Zr(),q(),L(),Socket=class extends qr{remoteAddress;remotePort;remoteFamily;localAddress;localPort;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!0;readyState=`closed`;_connection=null;_ioStream=null;_inputStream=null;_outputStream=null;_cancellable=new M.Cancellable;_reading=!1;_timeout=0;_timeoutId=null;constructor(e){super(e),this.allowHalfOpen=e?.allowHalfOpen??!1}_setConnection(e){this._connection=e}_setupFromIOStream(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===M.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),this._startReading()}_attachOutputOnly(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===M.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`)}_releaseIOStream(){let e=this._ioStream;return this._ioStream=null,this._inputStream=null,this._outputStream=null,this._connection=null,e}connect(e,t,n){let r;typeof e==`number`?(r={port:e,host:typeof t==`string`?t:`localhost`},typeof t==`function`&&(n=t)):(r=e,typeof t==`function`&&(n=t)),n&&this.once(`connect`,n),this.connecting=!0,this.readyState=`opening`,this.pending=!0;let i=r.host||`localhost`,a=r.port,o=new M.SocketClient;return r.timeout&&o.set_timeout(Math.ceil(r.timeout/1e3)),o.connect_to_host_async(i,a,this._cancellable,(e,t)=>{try{this._connection=o.connect_to_host_finish(t),this._setupConnection(r)}catch(e){this.connecting=!1,this.readyState=`closed`;let t=createNodeError$1(e,`connect`,{address:i,port:a});this.destroy(t)}}),this}_setupConnection(e){if(!this._connection)return;let t=this._connection.get_socket();if(this._inputStream=this._connection.get_input_stream(),this._outputStream=this._connection.get_output_stream(),`keepAlive`in e&&e.keepAlive&&t.set_keepalive(!0),!(`noDelay`in e)||e.noDelay!==!1)try{t.set_option(6,1,1)}catch{}try{let e=this._connection.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===M.SocketFamily.IPV6?`IPv6`:`IPv4`}catch{}try{let e=this._connection.get_local_address();this.localAddress=e.get_address().to_string(),this.localPort=e.get_port()}catch{}this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),this._startReading()}_startReading(){this._reading||!this._inputStream||(this._reading=!0,this._readLoop())}async _readLoop(){let e=this._inputStream;if(e)try{for(;this._reading&&e;){let t=await new Promise((t,n)=>{e.read_bytes_async(16384,k.PRIORITY_DEFAULT,this._cancellable,(r,i)=>{try{t(e.read_bytes_finish(i))}catch(e){n(e)}})});if(!t||t.get_size()===0){this._reading=!1,this.allowHalfOpen?this.readyState=this.writable?`writeOnly`:`closed`:this.once(`end`,()=>{this.end(),this.readyState=`closed`}),this.push(null);break}let n=gbytesToUint8Array(t);if(this.bytesRead+=n.length,this._resetTimeout(),!this.push(K.from(n))){this._reading=!1;break}}}catch(e){this._cancellable.is_cancelled()||this.destroy(createNodeError$1(e,`read`,{address:this.remoteAddress}))}}_read(e){!this._reading&&this._inputStream&&this._startReading()}_write(e,t,n){if(!this._outputStream){n(Error(`Socket is not connected`));return}let r=K.isBuffer(e)?e:typeof e==`string`?K.from(e,t):K.from(e);this._outputStream.write_bytes_async(new k.Bytes(r),k.PRIORITY_DEFAULT,this._cancellable,(e,t)=>{try{let e=this._outputStream.write_bytes_finish(t);this.bytesWritten+=e,this._resetTimeout(),n(null)}catch(e){n(createNodeError$1(e,`write`,{address:this.remoteAddress}))}})}_final(e){if(this._connection)try{this._connection.get_socket().shutdown(!1,!0),this.readyState=this.readable?`readOnly`:`closed`}catch{}else if(this._ioStream){try{this._ioStream.close(null),this.readyState=`closed`}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null}e()}_destroy(e,t){if(this._reading=!1,this._clearTimeout(),this._cancellable.cancel(),this._connection){try{this._connection.close(null)}catch{}this._connection=null}else if(this._ioStream)try{this._ioStream.close(null)}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null,this.readyState=`closed`,this.destroyed=!0,t(e)}setTimeout(e,t){return this._timeout=e,this._clearTimeout(),t&&this.once(`timeout`,t),e>0&&this._resetTimeout(),this}_resetTimeout(){this._clearTimeout(),this._timeout>0&&(this._timeoutId=setTimeout(()=>{this.emit(`timeout`)},this._timeout))}_clearTimeout(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}setKeepAlive(e,t){if(this._connection)try{this._connection.get_socket().set_keepalive(e??!1)}catch{}return this}setNoDelay(e){if(this._connection)try{this._connection.get_socket().set_option(6,1,e===!1?0:1)}catch{}return this}destroySoon(){this.writable&&this.end(),this.writableFinished?this.destroy():this.once(`finish`,this.destroy.bind(this))}address(){return this.localAddress&&this.localPort?{port:this.localPort,family:this.remoteFamily||`IPv4`,address:this.localAddress}:{}}ref(){return this}unref(){return this}}}),gu,_u=__esmMin(()=>{gu=l.Server,l.Request,l.Response}),OutgoingMessage,ServerResponse,vu,Server$1,yu=__esmMin(()=>{I(),mu(),fu(),pu(),q(),L(),bn(),Zr(),hu(),_u(),OutgoingMessage=class extends Kr{headersSent=!1;sendDate=!0;finished=!1;socket=null;_headers=new Map;setHeader(e,t){return this._headers.set(e.toLowerCase(),typeof t==`number`?String(t):t),this}getHeader(e){return this._headers.get(e.toLowerCase())}removeHeader(e){this._headers.delete(e.toLowerCase())}hasHeader(e){return this._headers.has(e.toLowerCase())}getHeaderNames(){return Array.from(this._headers.keys())}getHeaders(){let e={};for(let[t,n]of this._headers)e[t]=n;return e}appendHeader(e,t){let n=e.toLowerCase(),r=this._headers.get(n);return r===void 0?this._headers.set(n,t):Array.isArray(r)?Array.isArray(t)?r.push(...t):r.push(t):Array.isArray(t)?this._headers.set(n,[r,...t]):this._headers.set(n,[r,t]),this}flushHeaders(){this.headersSent=!0}_write(e,t,n){n()}},ServerResponse=class extends OutgoingMessage{statusCode=200;statusMessage=``;_streaming=!1;_bridge;_timeoutTimer=null;constructor(e){super(),this._bridge=e,e.connect(`close`,()=>{this.emit(`close`)})}setTimeout(e,t){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}writeHead(e,t,n){if(this.statusCode=e,typeof t==`object`&&(n=t,t=void 0),this.statusMessage=t||uu[e]||``,n)for(let[e,t]of Object.entries(n))this.setHeader(e,t);return this}writeContinue(e){e&&Promise.resolve().then(e)}writeProcessing(e){e&&Promise.resolve().then(e)}flushHeaders(){this.headersSent||=!0}addTrailers(e){for(let[t,n]of Object.entries(e))this._headers.set(`trailer-`+t.toLowerCase(),n)}_startStreaming(){if(!this._streaming){this._streaming=!0,this.headersSent=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null);for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}}_write(e,t,n){let r=K.isBuffer(e)?e:typeof e==`string`?K.from(e,t):K.from(e);this._startStreaming(),this._bridge.write_chunk(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),n()}_final(e){if(!this._streaming){for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}this._bridge.end(),this.finished=!0,e()}end(e,t,n){return typeof e==`function`?(n=e,e=void 0):typeof t==`function`&&(n=t,t=void 0),e!=null&&this.write(e,t),super.end(n),this}},vu=new Set,Server$1=class extends J{static{__name(this,`Server`)}listening=!1;maxHeadersCount=2e3;timeout=0;keepAliveTimeout=5e3;headersTimeout=6e4;requestTimeout=3e5;_bridge=null;_address=null;get soupServer(){return this._bridge?.soup_server??null}constructor(e,t){super();let n=typeof e==`function`?e:t;n&&this.on(`request`,n)}listen(...e){let t=0,n=`0.0.0.0`,r;for(let i of e)typeof i==`number`?t=i:typeof i==`string`?n=i:typeof i==`function`&&(r=i);r&&this.once(`listening`,r);try{this._bridge=new gu,this._bridge.connect(`request-received`,(e,t,n)=>{this._handleRequest(t,n)}),this._bridge.connect(`upgrade`,(e,t,n,r)=>{this._handleUpgrade(t,n)}),this._bridge.connect(`error-occurred`,(e,t)=>{this.emit(`error`,Error(t))}),this._bridge.listen(t,n),ensureMainLoop(),this.listening=!0,this._address={port:this._bridge.port,family:`IPv4`,address:this._bridge.address||n},vu.add(this),deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleRequest(e,t){let n=new IncomingMessage,r=new ServerResponse(t);n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let i=e.header_pairs??[];for(let e=0;e+1<i.length;e+=2){let t=i[e],r=i[e+1],a=t.toLowerCase();if(n.rawHeaders.push(t,r),a in n.headers){let e=n.headers[a];Array.isArray(e)?e.push(r):n.headers[a]=[e,r]}else n.headers[a]=r}n.socket=new ServerRequestSocket(e.remote_address??`127.0.0.1`,e.remote_port??0,this._address?.address??`127.0.0.1`,this._address?.port??0,t);let a=e.get_body();a.length>0?n._pushBody(a):n._pushBody(null),e.connect(`aborted_signal`,()=>{n.aborted||(n.aborted=!0,n.emit(`aborted`))}),e.connect(`close`,()=>{n.emit(`close`)});try{let e=this.emit(`request`,n,r);(e instanceof Promise||typeof e==`object`&&e&&typeof e.then==`function`)&&e.catch(e=>{if(F.error(`[HTTP] Unhandled error in async request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}})}catch(e){if(F.error(`[HTTP] Unhandled error in request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}}}_handleUpgrade(e,t){let n=new IncomingMessage;n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let r=e.header_pairs??[];for(let e=0;e+1<r.length;e+=2){let t=r[e],i=r[e+1],a=t.toLowerCase();n.rawHeaders.push(t,i),n.headers[a]=i}if(this.listenerCount(`upgrade`)>0){let e=new Socket;e._attachOutputOnly(t),this.emit(`upgrade`,n,e,K.alloc(0))}}address(){return this._address}addWebSocketHandler(e,t){if(!this._bridge)throw Error(`Server must be listening before adding WebSocket handlers. Call listen() first.`);this._bridge.soup_server.add_websocket_handler(e,null,null,(e,n,r,i)=>{t(i)})}close(e){return e&&this.once(`close`,e),this._bridge&&=(this._bridge.close(),null),this.listening=!1,vu.delete(this),deferEmit(this,`close`),this}setTimeout(e,t){return this.timeout=e,t&&this.on(`timeout`,t),this}}}),bu,xu=__esmMin(()=>{bu=u}),Su,Cu=__esmMin(()=>{xu(),Su=bu}),ClientRequest,wu=__esmMin(()=>{pu(),yu(),A(),Cu(),N(),q(),Mn(),L(),ClientRequest=class extends OutgoingMessage{method;path;protocol;host;hostname;port;aborted=!1;reusedSocket=!1;maxHeadersCount=2e3;_chunks=[];_session;_message;_cancellable;_timeout=0;_timeoutTimer=null;_responseCallback;constructor(e,t,n){super();let r;if(typeof e==`string`||e instanceof X){let i=typeof e==`string`?new X(e):e;r={protocol:i.protocol,hostname:i.hostname,port:i.port?Number(i.port):void 0,path:i.pathname+i.search,...typeof t==`object`?t:{}},typeof t==`function`&&(n=t)}else r=e,typeof t==`function`&&(n=t);if(this.method=(r.method||`GET`).toUpperCase(),this.protocol=r.protocol||`http:`,this.hostname=r.hostname||r.host?.split(`:`)[0]||`localhost`,this.port=Number(r.port)||(this.protocol===`https:`?443:80),this.path=r.path||`/`,this.host=r.host||`${this.hostname}:${this.port}`,this._timeout=r.timeout||0,n&&(this._responseCallback=n,this.once(`response`,n)),r.headers)for(let[e,t]of Object.entries(r.headers))this.setHeader(e,t);if(r.setHost!==!1&&!this._headers.has(`host`)){let e=this.protocol===`https:`?443:80,t=this.port===e?this.hostname:`${this.hostname}:${this.port}`;this.setHeader(`Host`,t)}r.auth&&!this._headers.has(`authorization`)&&this.setHeader(`Authorization`,`Basic `+K.from(r.auth).toString(`base64`)),r.signal&&(r.signal.aborted?this.abort():r.signal.addEventListener(`abort`,()=>this.abort(),{once:!0}));let i=k.Uri.parse(this._buildUrl(),k.UriFlags.NONE);this._session=new Su.Session,this._message=new Su.Message({method:this.method,uri:i}),this._cancellable=new M.Cancellable,this._timeout>0&&(this._session.timeout=Math.ceil(this._timeout/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},this._timeout))}_buildUrl(){let e=this.protocol.endsWith(`:`)?this.protocol:this.protocol+`:`,t=e===`https:`?443:80,n=this.port===t?``:`:${this.port}`;return`${e}//${this.hostname}${n}${this.path}`}getRawHeaderNames(){return Array.from(this._headers.keys())}flushHeaders(){this.headersSent||this._applyHeaders()}setTimeout(e,t){return this._timeout=e,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._session.timeout=Math.ceil(e/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}abort(){this.aborted||(this.aborted=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this._cancellable.cancel(),this.emit(`abort`),this.destroy())}_write(e,t,n){let r=K.isBuffer(e)?e:typeof e==`string`?K.from(e,t):K.from(e);this._chunks.push(r),n()}_final(e){this._sendRequest().then(()=>e()).catch(t=>e(t))}_applyHeaders(){if(this.headersSent)return;this.headersSent=!0;let e=this._message.get_request_headers();for(let[t,n]of this._headers)if(Array.isArray(n))for(let r of n)e.append(t,r);else e.replace(t,n)}async _sendRequest(){this._applyHeaders();let e=K.concat(this._chunks);if(e.length>0){let t=this._headers.get(`content-type`)||`application/octet-stream`;this._message.set_request_body_from_bytes(t,new k.Bytes(e))}try{let e=await new Promise((e,t)=>{this._session.send_async(this._message,k.PRIORITY_DEFAULT,this._cancellable,(n,r)=>{try{e(this._session.send_finish(r))}catch(e){t(e)}})}),t=[];try{let n;for(;(n=await readBytesAsync(e,4096,k.PRIORITY_DEFAULT,this._cancellable))!==null;)t.push(K.from(n))}catch{}let n=new IncomingMessage;n.statusCode=this._message.status_code,n.statusMessage=this._message.get_reason_phrase(),n.httpVersion=`1.1`,this._message.get_response_headers().foreach((e,t)=>{let r=e.toLowerCase();if(n.rawHeaders.push(e,t),r in n.headers){let e=n.headers[r];Array.isArray(e)?e.push(t):n.headers[r]=[e,t]}else n.headers[r]=t}),this.finished=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this.emit(`response`,n),setTimeout(()=>{for(let e of t)n.push(e);n.push(null),n.complete=!0},0)}catch(e){this.aborted?this.emit(`abort`):this.emit(`error`,e instanceof Error?e:Error(String(e)))}}}});function validateHeaderName(e){if(typeof e!=`string`||!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_HTTP_TOKEN`}),t}}function validateHeaderValue(e,t){if(t===void 0){let t=TypeError(`Header "${e}" value must not be undefined`);throw Object.defineProperty(t,`code`,{value:`ERR_HTTP_INVALID_HEADER_VALUE`}),t}if(typeof t==`string`&&/[^\t -~-ÿ]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_CHAR`}),t}}var Tu=__esmMin(()=>{}),Eu=__exportAll$4({Agent:()=>Agent,ClientRequest:()=>ClientRequest,IncomingMessage:()=>IncomingMessage,METHODS:()=>du,OutgoingMessage:()=>OutgoingMessage,STATUS_CODES:()=>uu,Server:()=>Server$1,ServerResponse:()=>ServerResponse,createServer:()=>createServer$1,default:()=>ku,get:()=>get,globalAgent:()=>Du,maxHeaderSize:()=>Ou,request:()=>request,setMaxIdleHTTPParsers:()=>setMaxIdleHTTPParsers,validateHeaderName:()=>validateHeaderName,validateHeaderValue:()=>validateHeaderValue});function createServer$1(e,t){return typeof e==`function`?new Server$1(e):new Server$1(t)}function request(e,t,n){return new ClientRequest(e,t,n)}function get(e,t,n){let r,i=n;typeof e==`string`||e instanceof X?(r=typeof t==`object`?{...t,method:`GET`}:{method:`GET`},typeof t==`function`&&(i=t)):(r={...e,method:`GET`},typeof t==`function`&&(i=t),e=r);let a=typeof e==`string`||e instanceof X?new ClientRequest(e,{...r,method:`GET`},i):new ClientRequest({...r,method:`GET`},i);return a.end(),a}function setMaxIdleHTTPParsers(e){}var Agent,Du,Ou,ku,Au=__esmMin(()=>{fu(),pu(),yu(),wu(),Tu(),Mn(),Agent=class{defaultPort=80;protocol=`http:`;maxSockets;maxTotalSockets;maxFreeSockets;keepAliveMsecs;keepAlive;scheduling;requests={};sockets={};freeSockets={};constructor(e){this.keepAlive=e?.keepAlive??!1,this.keepAliveMsecs=e?.keepAliveMsecs??1e3,this.maxSockets=e?.maxSockets??1/0,this.maxTotalSockets=e?.maxTotalSockets??1/0,this.maxFreeSockets=e?.maxFreeSockets??256,this.scheduling=e?.scheduling??`lifo`}destroy(){}getName(e){let t=e.host||`localhost`;return e.port&&(t+=`:`+e.port),e.localAddress&&(t+=`:`+e.localAddress),(e.family===4||e.family===6)&&(t+=`:`+e.family),t}},Du=new Agent,__name(createServer$1,`createServer`),Ou=16384,ku={STATUS_CODES:uu,METHODS:du,Server:Server$1,IncomingMessage,OutgoingMessage,ServerResponse,ClientRequest,Agent,globalAgent:Du,createServer:createServer$1,request,get,validateHeaderName,validateHeaderValue,maxHeaderSize:Ou,setMaxIdleHTTPParsers}}),ju=__commonJSMin(((e,t)=>{t.exports=etag;var n=(xa(),__toCommonJS(ya)),r=(cu(),__toCommonJS(au)).Stats,i=Object.prototype.toString;function entitytag(e){if(e.length===0)return`"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"`;var t=n.createHash(`sha1`).update(e,`utf8`).digest(`base64`).substring(0,27);return`"`+(typeof e==`string`?Buffer.byteLength(e,`utf8`):e.length).toString(16)+`-`+t+`"`}function etag(e,t){if(e==null)throw TypeError(`argument entity is required`);var n=isstats(e),r=t&&typeof t.weak==`boolean`?t.weak:n;if(!n&&typeof e!=`string`&&!Buffer.isBuffer(e))throw TypeError(`argument entity must be string, Buffer, or fs.Stats`);var i=n?stattag(e):entitytag(e);return r?`W/`+i:i}function isstats(e){return typeof r==`function`&&e instanceof r?!0:e&&typeof e==`object`&&`ctime`in e&&i.call(e.ctime)===`[object Date]`&&`mtime`in e&&i.call(e.mtime)===`[object Date]`&&`ino`in e&&typeof e.ino==`number`&&`size`in e&&typeof e.size==`number`}function stattag(e){var t=e.mtime.getTime().toString(16);return`"`+e.size.toString(16)+`-`+t+`"`}})),Mu=__commonJSMin(((e,t)=>{t.exports=forwarded;function forwarded(e){if(!e)throw TypeError(`argument req is required`);var t=parse(e.headers[`x-forwarded-for`]||``);return[getSocketAddr(e)].concat(t)}function getSocketAddr(e){return e.socket?e.socket.remoteAddress:e.connection.remoteAddress}function parse(e){for(var t=e.length,n=[],r=e.length,i=e.length-1;i>=0;i--)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i;break;default:r=i;break}return r!==t&&n.push(e.substring(r,t)),n}})),Nu=__commonJSMin(((e,t)=>{(function(){var expandIPv6,e={},n,r,i,a,matchCIDR,o=this,s;t!=null&&t.exports?t.exports=e:o.ipaddr=e,matchCIDR=function(e,t,n,r){var i,a;if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);for(i=0;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0},e.subnetMatch=function(e,t,n){var r,i,a,o,s;for(a in n??=`unicast`,t)for(o=t[a],o[0]&&!(o[0]instanceof Array)&&(o=[o]),r=0,i=o.length;r<i;r++)if(s=o[r],e.kind()===s[0].kind()&&e.match.apply(e,s))return a;return n},e.IPv4=(function(){function IPv4(e){var t,n,r;if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);for(t=0,n=e.length;t<n;t++)if(r=e[t],!(0<=r&&r<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return IPv4.prototype.kind=function(){return`ipv4`},IPv4.prototype.toString=function(){return this.octets.join(`.`)},IPv4.prototype.toNormalizedString=function(){return this.toString()},IPv4.prototype.toByteArray=function(){return this.octets.slice(0)},IPv4.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return matchCIDR(this.octets,e.octets,8,t)},IPv4.prototype.SpecialRanges={unspecified:[[new IPv4([0,0,0,0]),8]],broadcast:[[new IPv4([255,255,255,255]),32]],multicast:[[new IPv4([224,0,0,0]),4]],linkLocal:[[new IPv4([169,254,0,0]),16]],loopback:[[new IPv4([127,0,0,0]),8]],carrierGradeNat:[[new IPv4([100,64,0,0]),10]],private:[[new IPv4([10,0,0,0]),8],[new IPv4([172,16,0,0]),12],[new IPv4([192,168,0,0]),16]],reserved:[[new IPv4([192,0,0,0]),24],[new IPv4([192,0,2,0]),24],[new IPv4([192,88,99,0]),24],[new IPv4([198,51,100,0]),24],[new IPv4([203,0,113,0]),24],[new IPv4([240,0,0,0]),4]]},IPv4.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv4.prototype.toIPv4MappedAddress=function(){return e.IPv6.parse(`::ffff:`+this.toString())},IPv4.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,a,o={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};for(e=0,i=!1,t=n=3;n>=0;t=n+=-1)if(r=this.octets[t],r in o){if(a=o[r],i&&a!==0)return null;a!==8&&(i=!0),e+=a}else return null;return 32-e},IPv4})(),n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^`+n+`\\.`+n+`\\.`+n+`\\.`+n+`$`,`i`),longValue:RegExp(`^`+n+`$`,`i`)},e.IPv4.parser=function(e){var t,parseIntAuto=function(e){return e[0]===`0`&&e[1]!==`x`?parseInt(e,8):parseInt(e)},n,i,a;if(t=e.match(r.fourOctet))return(function(){var e,r,i=t.slice(1,6),a=[];for(e=0,r=i.length;e<r;e++)n=i[e],a.push(parseIntAuto(n));return a})();if(t=e.match(r.longValue)){if(a=parseIntAuto(t[1]),a>4294967295||a<0)throw Error(`ipaddr: address outside defined range`);return(function(){var e,t=[];for(i=e=0;e<=24;i=e+=8)t.push(a>>i&255);return t})().reverse()}else return null},e.IPv6=(function(){function IPv6(e,t){var n,r,i,a,o,s;if(e.length===16)for(this.parts=[],n=r=0;r<=14;n=r+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(s=this.parts,i=0,a=s.length;i<a;i++)if(o=s[i],!(0<=o&&o<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return IPv6.prototype.kind=function(){return`ipv6`},IPv6.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,`::`)},IPv6.prototype.toRFC5952String=function(){var e,t,n,r=/((^|:)(0(:|$)){2,})/g,i=this.toNormalizedString();for(e=0,t=-1;n=r.exec(i);)n[0].length>t&&(e=n.index,t=n[0].length);return t<0?i:i.substring(0,e)+`::`+i.substring(e+t)},IPv6.prototype.toByteArray=function(){var e=[],t,n,r,i=this.parts;for(t=0,n=i.length;t<n;t++)r=i[t],e.push(r>>8),e.push(r&255);return e},IPv6.prototype.toNormalizedString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.toFixedLengthString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16).padStart(4,`0`));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return matchCIDR(this.parts,e.parts,16,t)},IPv6.prototype.SpecialRanges={unspecified:[new IPv6([0,0,0,0,0,0,0,0]),128],linkLocal:[new IPv6([65152,0,0,0,0,0,0,0]),10],multicast:[new IPv6([65280,0,0,0,0,0,0,0]),8],loopback:[new IPv6([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new IPv6([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new IPv6([0,0,0,0,0,65535,0,0]),96],rfc6145:[new IPv6([0,0,0,0,65535,0,0,0]),96],rfc6052:[new IPv6([100,65435,0,0,0,0,0,0]),96],"6to4":[new IPv6([8194,0,0,0,0,0,0,0]),16],teredo:[new IPv6([8193,0,0,0,0,0,0,0]),32],reserved:[[new IPv6([8193,3512,0,0,0,0,0,0]),32]]},IPv6.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv6.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},IPv6.prototype.toIPv4Address=function(){var t,n,r;if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);return r=this.parts.slice(-2),t=r[0],n=r[1],new e.IPv4([t>>8,t&255,n>>8,n&255])},IPv6.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,a,o={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};for(e=0,i=!1,t=n=7;n>=0;t=n+=-1)if(r=this.parts[t],r in o){if(a=o[r],i&&a!==0)return null;a!==16&&(i=!0),e+=a}else return null;return 128-e},IPv6})(),i=`(?:[0-9a-f]+::?)+`,s=`%[0-9a-z]{1,}`,a={zoneIndex:new RegExp(s,`i`),native:RegExp(`^(::)?(`+i+`)?([0-9a-f]+)?(::)?(`+s+`)?$`,`i`),transitional:RegExp(`^((?:`+i+`)|(?:::)(?:`+i+`)?)`+(n+`\\.`+n+`\\.`+n+`\\.`+n)+(`(`+s+`)?$`),`i`)},expandIPv6=function(e,t){var n,r,i,o,s,c;if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;for(c=(e.match(a.zoneIndex)||[])[0],c&&(c=c.substring(1),e=e.replace(/%.+$/,``)),n=0,r=-1;(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(s=t-n,o=`:`;s--;)o+=`0:`;return e=e.replace(`::`,o),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){var t,n,r=e.split(`:`),a=[];for(t=0,n=r.length;t<n;t++)i=r[t],a.push(parseInt(i,16));return a})(),{parts:t,zoneId:c}},e.IPv6.parser=function(e){var t,n,r,i,o,s,c;if(a.native.test(e))return expandIPv6(e,8);if((i=e.match(a.transitional))&&(c=i[6]||``,t=expandIPv6(i[1].slice(0,-1)+c,6),t.parts)){for(s=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],n=0,r=s.length;n<r;n++)if(o=s[n],!(0<=o&&o<=255))return null;return t.parts.push(s[0]<<8|s[1]),t.parts.push(s[2]<<8|s[3]),{parts:t.parts,zoneId:t.zoneId}}return null},e.IPv4.isIPv4=e.IPv6.isIPv6=function(e){return this.parser(e)!==null},e.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},e.IPv4.isValidFourPartDecimal=function(t){return!!(e.IPv4.isValid(t)&&t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},e.IPv6.isValid=function(e){var t;if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return t=this.parser(e),new this(t.parts,t.zoneId),!0}catch{return!1}},e.IPv4.parse=function(e){var t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t)},e.IPv6.parse=function(e){var t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t.parts,t.zoneId)},e.IPv4.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=32))return r=[this.parse(n[1]),t],Object.defineProperty(r,`toString`,{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},e.IPv4.subnetMaskFromPrefixLength=function(e){var t,n,r;if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);for(r=[0,0,0,0],n=0,t=Math.floor(e/8);n<t;)r[n]=255,n++;return t<4&&(r[t]=2**(e%8)-1<<8-e%8),new this(r)},e.IPv4.broadcastAddressFromCIDR=function(e){var t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)|parseInt(a[n],10)^255),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv4.networkAddressFromCIDR=function(e){var t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv6.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,`toString`,{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},e.isValid=function(t){return e.IPv6.isValid(t)||e.IPv4.isValid(t)},e.parse=function(t){if(e.IPv6.isValid(t))return e.IPv6.parse(t);if(e.IPv4.isValid(t))return e.IPv4.parse(t);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},e.parseCIDR=function(t){try{return e.IPv6.parseCIDR(t)}catch{try{return e.IPv4.parseCIDR(t)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},e.fromByteArray=function(t){var n=t.length;if(n===4)return new e.IPv4(t);if(n===16)return new e.IPv6(t);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},e.process=function(e){var t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t}}).call(e)})),Pu=__commonJSMin(((e,t)=>{t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=Mu(),r=Nu(),i=/^[0-9]+$/,a=r.isValid,o=r.parse,s={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(s,e)&&(e=s[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!a(n))throw TypeError(`invalid IP address: `+n);var r=o(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var s=r.kind()===`ipv6`?128:32,c=t===-1?null:e.substring(t+1,e.length);if(c=c===null?s:i.test(c)?parseInt(c,10):r.kind()===`ipv4`&&a(c)?parseNetmask(c):null,c<=0||c>s)throw TypeError(`invalid range on address: `+e);return[r,c]}function parseNetmask(e){var t=o(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!a(t))return!1;for(var n=o(t),r,i=n.kind(),s=0;s<e.length;s++){var c=e[s],l=c[0],u=l.kind(),d=c[1],p=n;if(i!==u){if(u===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=u===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),p=r}if(p.match(l,d))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!a(e))return!1;var s=o(e);if(s.kind()!==n){if(r&&!s.isIPv4MappedAddress())return!1;s=r?s.toIPv4Address():s.toIPv4MappedAddress()}return s.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,Fu=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),Iu,Lu,Ru,zu,Bu=__esmMin(()=>{Iu=Array.from({length:256});for(let e=0;e<256;++e)Iu[e]=`%`+((e<16?`0`:``)+e.toString(16)).toUpperCase();Lu=new Int8Array([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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,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,1,1,1,1,1,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Ru=new Int8Array([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,0,0,0,0,1,1,1,1,0,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,0,1,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,0]),zu=new Int8Array([-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-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,10,11,12,13,14,15,-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,-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,-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,-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,-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,-1,-1,-1,-1,-1,-1,-1,-1])});function encodeStr(e,t,n){let r=e.length;if(r===0)return``;let i=``,a=0;for(let o=0;o<r;o++){let s=e.charCodeAt(o);if(s<128){if(t[s]===1)continue;a<o&&(i+=e.slice(a,o)),a=o+1,i+=n[s];continue}if(a<o&&(i+=e.slice(a,o)),s<2048){a=o+1,i+=n[192|s>>6]+n[128|s&63];continue}if(s<55296||s>=57344){a=o+1,i+=n[224|s>>12]+n[128|s>>6&63]+n[128|s&63];continue}if(++o,o>=r)throw new ERR_INVALID_URI;let c=e.charCodeAt(o)&1023;a=o+1,s=65536+((s&1023)<<10|c),i+=n[240|s>>18]+n[128|s>>12&63]+n[128|s>>6&63]+n[128|s&63]}return a===0?e:a<r?i+e.slice(a):i}function qsEscape(e){return typeof e!=`string`&&(typeof e==`object`?e=String(e):e+=``),encodeStr(e,Ru,Iu)}var ERR_INVALID_URI,Vu=__esmMin(()=>{Fu(),Bu(),ERR_INVALID_URI=class extends NodeURIError{constructor(){super(`ERR_INVALID_URI`,`URI malformed`)}}});function unescapeBuffer(e,t=!1){let n=new K(e.length),r=0,i=0,a,o,s,c,l=e.length-2,u=!1;for(;r<e.length;){if(a=e.charCodeAt(r),a===43&&t){n[i++]=32,r++;continue}if(a===37&&r<l)if(a=e.charCodeAt(++r),s=zu[a],s>=0)o=e.charCodeAt(++r),c=zu[o],c>=0?(u=!0,a=s*16+c):(n[i++]=37,r--);else{n[i++]=37;continue}n[i++]=a,r++}return u?n.slice(0,i):n}function qsUnescape(e){try{return decodeURIComponent(e)}catch{return unescapeBuffer(e).toString()}}var Hu=__esmMin(()=>{Bu(),q()});function charCodes(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function addKeyVal(e,t,n,r,i,a){if(t.length>0&&r)try{t=a(t)}catch{}if(n.length>0&&i)try{n=a(n)}catch{}if(e[t]===void 0)e[t]=n;else{let r=e[t];r.pop?r[r.length]=n:e[t]=[r,n]}}function parse(e,t=`&`,n=`=`,{decodeURIComponent:r=qsUnescape,maxKeys:i=1e3}={}){let a=Object.create(null);if(typeof e!=`string`||e.length===0)return a;let o=t?charCodes(String(t)):[38],s=n?charCodes(String(n)):[61],c=o.length,l=s.length,u=1e3;typeof i==`number`&&(u=i>0?i:-1);let d=qsUnescape;r&&(d=r);let p=d!==qsUnescape,m=0,h=0,g=0,_=``,v=``,y=p,b=p,x=p?`%20`:` `,S=0;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n===o[h]){if(++h===c){let n=t-h+1;if(g<l){if(m<n)_+=e.slice(m,n);else if(_.length===0){if(--u===0)return a;m=t+1,h=g=0;continue}}else m<n&&(v+=e.slice(m,n));if(addKeyVal(a,_,v,y,b,d),--u===0)return a;_=v=``,S=0,m=t+1,h=g=0}}else{if(h=0,g<l){if(n===s[g]){if(++g===l){let n=t-g+1;m<n&&(_+=e.slice(m,n)),S=0,m=t+1}continue}else if(g=0,!y){if(n===37){S=1;continue}else if(S>0)if(Lu[n]===1){++S===3&&(y=!0);continue}else S=0}if(n===43){m<t&&(_+=e.slice(m,t)),_+=x,m=t+1;continue}}n===43?(m<t&&(v+=e.slice(m,t)),v+=x,m=t+1):b||(n===37?S=1:S>0&&(Lu[n]===1?++S===3&&(b=!0):S=0))}}if(m<e.length)g<l?_+=e.slice(m):h<c&&(v+=e.slice(m));else if(g===0&&_.length===0)return a;return addKeyVal(a,_,v,y,b,d),a}var Uu=__esmMin(()=>{Bu(),Hu()});function stringifyPrimitive(e){return typeof e==`string`?e:typeof e==`number`&&isFinite(e)||typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function encodeStringifiedCustom(e,t){return t(stringifyPrimitive(e))}function encodeStringified(e,t){return typeof e==`string`?e.length?t(e):``:typeof e==`number`&&isFinite(e)?Math.abs(e)<1e21?``+e:t(``+e):typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function stringify(e,t,n,r){t||=`&`,n||=`=`;let i=r?r.encodeURIComponent:qsEscape,a=r?encodeStringifiedCustom:encodeStringified;if(typeof e==`object`&&e){let r=Object.keys(e),o=r.length,s=``;for(let c=0;c<o;++c){let o=r[c],l=e[o],u=a(o,i);if(u+=n,Array.isArray(l)){let e=l.length;if(e===0)continue;s&&(s+=t);for(let n=0;n<e;++n)n&&(s+=t),s+=u,s+=a(l[n],i)}else s&&(s+=t),s+=u,s+=a(l,i)}return s}return``}var Wu=__esmMin(()=>{Vu()}),Gu=__exportAll$4({ERR_INVALID_URI:()=>ERR_INVALID_URI,decode:()=>Ku,default:()=>Xu,encode:()=>qu,escape:()=>Ju,parse:()=>parse,stringify:()=>stringify,unescape:()=>Yu,unescapeBuffer:()=>unescapeBuffer}),Ku,qu,Ju,Yu,Xu,Zu=__esmMin(()=>{Vu(),Hu(),Uu(),Wu(),Ku=parse,qu=stringify,Ju=qsEscape,Yu=qsUnescape,Xu={parse,stringify,decode:Ku,encode:qu,unescape:Yu,escape:Ju,unescapeBuffer}}),Qu=__commonJSMin((e=>{var{METHODS:t}=(Au(),__toCommonJS(Eu)),n=gs(),r=ju(),i=ps(),a=Pu(),o=fl(),s=(Zu(),__toCommonJS(Gu));let{Buffer:c}=(q(),__toCommonJS(Xt));e.methods=t.map(e=>e.toLowerCase()),e.etag=createETagGenerator({weak:!1}),e.wetag=createETagGenerator({weak:!0}),e.normalizeType=function(e){return~e.indexOf(`/`)?acceptParams(e):{value:i.lookup(e)||`application/octet-stream`,params:{}}},e.normalizeTypes=function(t){return t.map(e.normalizeType)};function acceptParams(e){for(var t=e.length,n=e.indexOf(`;`),r=n===-1?t:n,i={value:e.slice(0,r).trim(),quality:1,params:{}};r<t;){var a=e.indexOf(`=`,r);if(a===-1)break;var n=e.indexOf(`;`,r),o=n===-1?t:n;if(a>o){r=e.lastIndexOf(`;`,a-1)+1;continue}var s=e.slice(r,a).trim(),c=e.slice(a+1,o).trim();s===`q`?i.quality=parseFloat(c):i.params[s]=c,r=o+1}return i}e.compileETag=function(t){var n;if(typeof t==`function`)return t;switch(t){case!0:case`weak`:n=e.wetag;break;case!1:break;case`strong`:n=e.etag;break;default:throw TypeError(`unknown value for etag function: `+t)}return n},e.compileQueryParser=function compileQueryParser(e){var t;if(typeof e==`function`)return e;switch(e){case!0:case`simple`:t=s.parse;break;case!1:break;case`extended`:t=parseExtendedQueryString;break;default:throw TypeError(`unknown value for query parser function: `+e)}return t},e.compileTrust=function(e){return typeof e==`function`?e:e===!0?function(){return!0}:typeof e==`number`?function(t,n){return n<e}:(typeof e==`string`&&(e=e.split(`,`).map(function(e){return e.trim()})),a.compile(e||[]))},e.setCharset=function setCharset(e,t){if(!e||!t)return e;var r=n.parse(e);return r.parameters.charset=t,n.format(r)};function createETagGenerator(e){return function generateETag(t,n){return r(c.isBuffer(t)?t:c.from(t,n),e)}}function parseExtendedQueryString(e){return o.parse(e,{allowPrototypes:!0})}})),$u=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),ed=__commonJSMin(((e,t)=>{var n=$u();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,`once`,{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,`onceStrict`,{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),td=__exportAll$4({default:()=>isPromise});function isPromise(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var nd=__esmMin(()=>{}),rd=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PathError=e.TokenData=void 0,e.parse=parse,e.compile=compile,e.match=match,e.pathToRegexp=pathToRegexp,e.stringify=stringify;let NOOP_VALUE=e=>e,t=/^[$_\p{ID_Start}]$/u,n=/^[$\u200c\u200d\p{ID_Continue}]$/u,r=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;function escapeText(e){return e.replace(/[{}()\[\]+?!:*\\]/g,`\\$&`)}function escape(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,`\\$&`)}var TokenData=class{constructor(e,t){this.tokens=e,this.originalPath=t}};e.TokenData=TokenData;var PathError=class extends TypeError{constructor(e,t){let n=e;t&&(n+=`: ${t}`),n+=`; visit https://git.new/pathToRegexpError for info`,super(n),this.originalPath=t}};e.PathError=PathError;function parse(e,r={}){let{encodePath:i=NOOP_VALUE}=r,a=[...e],o=0;function consumeUntil(r){let s=[],c=``;function writePath(){c&&=(s.push({type:`text`,value:i(c)}),``)}for(;o<a.length;){let i=a[o++];if(i===r)return writePath(),s;if(i===`\\`){if(o===a.length)throw new PathError(`Unexpected end after \\ at index ${o}`,e);c+=a[o++];continue}if(i===`:`||i===`*`){let r=i===`:`?`param`:`wildcard`,c=``;if(t.test(a[o]))do c+=a[o++];while(n.test(a[o]));else if(a[o]===`"`){let t=o;for(;o<a.length;){if(a[++o]===`"`){o++,t=0;break}a[o]===`\\`&&o++,c+=a[o]}if(t)throw new PathError(`Unterminated quote at index ${t}`,e)}if(!c)throw new PathError(`Missing parameter name at index ${o}`,e);writePath(),s.push({type:r,name:c});continue}if(i===`{`){writePath(),s.push({type:`group`,tokens:consumeUntil(`}`)});continue}if(i===`}`||i===`(`||i===`)`||i===`[`||i===`]`||i===`+`||i===`?`||i===`!`)throw new PathError(`Unexpected ${i} at index ${o-1}`,e);c+=i}if(r)throw new PathError(`Unexpected end at index ${o}, expected ${r}`,e);return writePath(),s}return new TokenData(consumeUntil(``),e)}function compile(e,t={}){let{encode:n=encodeURIComponent,delimiter:r=`/`}=t,i=tokensToFunction((typeof e==`object`?e:parse(e,t)).tokens,r,n);return function path(e={}){let t=[],n=i(e,t);if(t.length)throw TypeError(`Missing parameters: ${t.join(`, `)}`);return n}}function tokensToFunction(e,t,n){let r=e.map(e=>tokenToFunction(e,t,n));return(e,t)=>{let n=``;for(let i of r)n+=i(e,t);return n}}function tokenToFunction(e,t,n){if(e.type===`text`)return()=>e.value;if(e.type===`group`){let r=tokensToFunction(e.tokens,t,n);return(e,t)=>{let n=t.length,i=r(e,t);return t.length===n?i:(t.length=n,``)}}let r=n||NOOP_VALUE;return e.type===`wildcard`&&n!==!1?(n,i)=>{let a=n[e.name];if(a==null)return i.push(e.name),``;if(!Array.isArray(a)||a.length===0)throw TypeError(`Expected "${e.name}" to be a non-empty array`);let o=``;for(let n=0;n<a.length;n++){if(typeof a[n]!=`string`)throw TypeError(`Expected "${e.name}/${n}" to be a string`);n>0&&(o+=t),o+=r(a[n])}return o}:(t,n)=>{let i=t[e.name];if(i==null)return n.push(e.name),``;if(typeof i!=`string`)throw TypeError(`Expected "${e.name}" to be a string`);return r(i)}}function match(e,t={}){let{decode:n=decodeURIComponent,delimiter:r=`/`}=t,{regexp:i,keys:a}=pathToRegexp(e,t),o=a.map(e=>n===!1?NOOP_VALUE:e.type===`param`?n:e=>e.split(r).map(n));return function match(e){let t=i.exec(e);if(!t)return!1;let n=t[0],r=Object.create(null);for(let e=1;e<t.length;e++){if(t[e]===void 0)continue;let n=a[e-1],i=o[e-1];r[n.name]=i(t[e])}return{path:n,params:r}}}function pathToRegexp(e,t={}){let{delimiter:n=`/`,end:r=!0,sensitive:i=!1,trailing:a=!0}=t,o=[],s=``,c=0;function process(e){if(Array.isArray(e)){for(let t of e)process(t);return}let r=typeof e==`object`?e:parse(e,t);flatten(r.tokens,0,[],e=>{if(c>=256)throw new PathError(`Too many path combinations`,r.originalPath);c>0&&(s+=`|`),s+=toRegExpSource(e,n,o,r.originalPath),c++})}process(e);let l=`^(?:${s})`;return a&&(l+=`(?:`+escape(n)+`$)?`),l+=r?`$`:`(?=`+escape(n)+`|$)`,{regexp:new RegExp(l,i?``:`i`),keys:o}}function flatten(e,t,n,r){for(;t<e.length;){let i=e[t++];if(i.type===`group`){let a=n.length;flatten(i.tokens,0,n,n=>flatten(e,t,n,r)),n.length=a;continue}n.push(i)}r(n)}function toRegExpSource(e,t,n,r){let i=``,a=``,o=``,s=0,c=0,l=0;function hasInSegment(n,r){for(;n<e.length;){let i=e[n++];if(i.type===r)return!0;if(i.type===`text`&&i.value.includes(t))break}return!1}function peekText(t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type!==`text`)break;n+=r.value}return n}for(;l<e.length;){let u=e[l++];if(u.type===`text`){i+=escape(u.value),a+=u.value,s===2&&(o+=u.value),u.value.includes(t)&&(c=0);continue}if(u.type===`param`||u.type===`wildcard`){if(s&&!a)throw new PathError(`Missing text before "${u.name}" ${u.type}`,r);u.type===`param`?(i+=c&2?`(${negate(t,a)}+)`:hasInSegment(l,`wildcard`)?`(${negate(t,peekText(l))}+)`:c&1?`(${negate(t,a)}+|${escape(a)})`:`(${negate(t,``)}+)`,c|=s=1):(i+=c&2?`(${negate(a,``)}+)`:o?`(${negate(o,``)}+|${negate(t,``)}+)`:`([^]+)`,o=``,c|=s=2),n.push(u),a=``;continue}throw TypeError(`Unknown token type: ${u.type}`)}return i}function negate(e,t){return t.length>e.length?negate(t,e):(e===t&&(t=``),t.length>1?`(?:(?!${escape(e)}|${escape(t)})[^])`:e.length>1?`(?:(?!${escape(e)})[^${escape(t)}])`:`[^${escape(e+t)}]`)}function stringifyTokens(e,t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type===`text`){n+=escapeText(r.value);continue}if(r.type===`group`){n+=`{`+stringifyTokens(r.tokens,0)+`}`;continue}if(r.type===`param`){n+=`:`+stringifyName(r.name,e[t]);continue}if(r.type===`wildcard`){n+=`*`+stringifyName(r.name,e[t]);continue}throw TypeError(`Unknown token type: ${r.type}`)}return n}function stringify(e){return stringifyTokens(e.tokens,0)}function stringifyName(e,t){return!r.test(e)||t?.type===`text`&&n.test(t.value[0])?JSON.stringify(e):e}})),id=__commonJSMin(((e,t)=>{let n=(nd(),__toCommonJS(td)),r=rd(),i=bo()(`router:layer`),a=xo()(`router`),o=/\/+$/,s=/\((?:\?<(.*?)>)?(?!\?)/g;t.exports=Layer;function Layer(e,t,n){if(!(this instanceof Layer))return new Layer(e,t,n);i(`new %o`,e);let a=t||{};this.handle=n,this.keys=[],this.name=n.name||`<anonymous>`,this.params=void 0,this.path=void 0,this.slash=e===`/`&&a.end===!1;function matcher(e){if(e instanceof RegExp){let t=[],n=0,r;for(;r=s.exec(e.source);)t.push({name:r[1]||n++,offset:r.index});return function regexpMatcher(n){let r=e.exec(n);if(!r)return!1;let i={};for(let e=1;e<r.length;e++){let n=t[e-1].name,a=decodeParam(r[e]);a!==void 0&&(i[n]=a)}return{params:i,path:r[0]}}}return r.match(a.strict?e:loosen(e),{sensitive:a.sensitive,end:a.end,trailing:!a.strict,decode:decodeParam})}this.matchers=Array.isArray(e)?e.map(matcher):[matcher(e)]}Layer.prototype.handleError=function handleError(e,t,r,i){let o=this.handle;if(o.length!==4)return i(e);try{let s=o(e,t,r,i);n(s)&&(s instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),s.then(null,function(e){i(e||Error(`Rejected promise`))}))}catch(e){i(e)}},Layer.prototype.handleRequest=function handleRequest(e,t,r){let i=this.handle;if(i.length>3)return r();try{let o=i(e,t,r);n(o)&&(o instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),o.then(null,function(e){r(e||Error(`Rejected promise`))}))}catch(e){r(e)}},Layer.prototype.match=function match(e){let t;if(e!=null){if(this.slash)return this.params={},this.path=``,!0;let n=0;for(;!t&&n<this.matchers.length;)t=this.matchers[n](e),n++}return t?(this.params=t.params,this.path=t.path,this.keys=Object.keys(t.params),!0):(this.params=void 0,this.path=void 0,!1)};function decodeParam(e){if(typeof e!=`string`||e.length===0)return e;try{return decodeURIComponent(e)}catch(t){throw t instanceof URIError&&(t.message=`Failed to decode param '`+e+`'`,t.status=400),t}}function loosen(e){return e instanceof RegExp||e===`/`?e:Array.isArray(e)?e.map(function(e){return loosen(e)}):String(e).replace(o,``)}})),ad=__commonJSMin(((e,t)=>{let n=bo()(`router:route`),r=id(),{METHODS:i}=(Au(),__toCommonJS(Eu)),a=Array.prototype.slice,o=Array.prototype.flat,s=i.map(e=>e.toLowerCase());t.exports=Route;function Route(e){n(`new %o`,e),this.path=e,this.stack=[],this.methods=Object.create(null)}Route.prototype._handlesMethod=function _handlesMethod(e){if(this.methods._all)return!0;let t=typeof e==`string`?e.toLowerCase():e;return t===`head`&&!this.methods.head&&(t=`get`),!!this.methods[t]},Route.prototype._methods=function _methods(){let e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push(`head`);for(let t=0;t<e.length;t++)e[t]=e[t].toUpperCase();return e},Route.prototype.dispatch=function dispatch(e,t,n){let r=0,i=this.stack,a=0;if(i.length===0)return n();let o=typeof e.method==`string`?e.method.toLowerCase():e.method;o===`head`&&!this.methods.head&&(o=`get`),e.route=this,next();function next(s){if(s&&s===`route`)return n();if(s&&s===`router`||r>=i.length)return n(s);if(++a>100)return setImmediate(next,s);let c,l;for(;l!==!0&&r<i.length;)c=i[r++],l=!c.method||c.method===o;if(l!==!0)return n(s);s?c.handleError(s,e,t,next):c.handleRequest(e,t,next),a=0}},Route.prototype.all=function all(e){let t=o.call(a.call(arguments),1/0);if(t.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=`function`)throw TypeError(`argument handler must be a function`);let i=r(`/`,{},n);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},s.forEach(function(e){Route.prototype[e]=function(t){let i=o.call(a.call(arguments),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let t=0;t<i.length;t++){let a=i[t];if(typeof a!=`function`)throw TypeError(`argument handler must be a function`);n(`%s %s`,e,this.path);let o=r(`/`,{},a);o.method=e,this.methods[e]=!0,this.stack.push(o)}return this}})})),od=__commonJSMin(((e,t)=>{let n=(nd(),__toCommonJS(td)),r=id(),{METHODS:i}=(Au(),__toCommonJS(Eu)),a=vl(),o=ad(),s=bo()(`router`),c=xo()(`router`),l=Array.prototype.slice,u=Array.prototype.flat,d=i.map(e=>e.toLowerCase());t.exports=Router,t.exports.Route=o;function Router(e){if(!(this instanceof Router))return new Router(e);let t=e||{};function router(e,t,n){router.handle(e,t,n)}return Object.setPrototypeOf(router,this),router.caseSensitive=t.caseSensitive,router.mergeParams=t.mergeParams,router.params={},router.strict=t.strict,router.stack=[],router}Router.prototype=function(){},Router.prototype.param=function param(e,t){if(!e)throw TypeError(`argument name is required`);if(typeof e!=`string`)throw TypeError(`argument name must be a string`);if(!t)throw TypeError(`argument fn is required`);if(typeof t!=`function`)throw TypeError(`argument fn must be a function`);let n=this.params[e];return n||=this.params[e]=[],n.push(t),this},Router.prototype.handle=function handle(e,t,n){if(!n)throw TypeError(`argument callback is required`);s(`dispatching %s %s`,e.method,e.url);let r=0,i,a=getProtohost(e.url)||``,o=``,c=this,l=!1,u=0,d={},p=this.stack,m=e.params,h=e.baseUrl||``,g=restore(n,e,`baseUrl`,`next`,`params`);e.next=next,e.method===`OPTIONS`&&(i=[],g=wrap(g,generateOptionsResponder(t,i))),e.baseUrl=h,e.originalUrl=e.originalUrl||e.url,next();function next(n){let s=n===`route`?null:n;if(l&&=(e.url=e.url.slice(1),!1),o.length!==0&&(e.baseUrl=h,e.url=a+o+e.url.slice(a.length),o=``),s===`router`){setImmediate(g,null);return}if(r>=p.length){setImmediate(g,s);return}if(++u>100)return setImmediate(next,n);let _=getPathname(e);if(_==null)return g(s);let v,y,b;for(;y!==!0&&r<p.length;){if(v=p[r++],y=matchLayer(v,_),b=v.route,typeof y!=`boolean`&&(s||=y),y!==!0||!b)continue;if(s){y=!1;continue}let t=e.method,n=b._handlesMethod(t);!n&&t===`OPTIONS`&&i&&i.push.apply(i,b._methods()),!n&&t!==`HEAD`&&(y=!1)}if(y!==!0)return g(s);b&&(e.route=b),e.params=c.mergeParams?mergeParams(v.params,m):v.params;let x=v.path;processParams(c.params,v,d,e,t,function(n){n?next(s||n):b?v.handleRequest(e,t,next):trimPrefix(v,s,x,_),u=0})}function trimPrefix(n,r,i,c){if(i.length!==0){if(i!==c.substring(0,i.length)){next(r);return}let t=c[i.length];if(t&&t!==`/`){next(r);return}s(`trim prefix (%s) from url %s`,i,e.url),o=i,e.url=a+e.url.slice(a.length+o.length),!a&&e.url[0]!==`/`&&(e.url=`/`+e.url,l=!0),e.baseUrl=h+(o[o.length-1]===`/`?o.substring(0,o.length-1):o)}s(`%s %s : %s`,n.name,i,e.originalUrl),r?n.handleError(r,e,t,next):n.handleRequest(e,t,next)}},Router.prototype.use=function use(e){let t=0,n=`/`;if(typeof e!=`function`){let r=e;for(;Array.isArray(r)&&r.length!==0;)r=r[0];typeof r!=`function`&&(t=1,n=e)}let i=u.call(l.call(arguments,t),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<i.length;e++){let t=i[e];if(typeof t!=`function`)throw TypeError(`argument handler must be a function`);s(`use %o %s`,n,t.name||`<anonymous>`);let a=new r(n,{sensitive:this.caseSensitive,strict:!1,end:!1},t);a.route=void 0,this.stack.push(a)}return this},Router.prototype.route=function route(e){let t=new o(e),n=new r(e,{sensitive:this.caseSensitive,strict:this.strict,end:!0},handle);function handle(e,n,r){t.dispatch(e,n,r)}return n.route=t,this.stack.push(n),t},d.concat(`all`).forEach(function(e){Router.prototype[e]=function(t){let n=this.route(t);return n[e].apply(n,l.call(arguments,1)),this}});function generateOptionsResponder(e,t){return function onDone(n,r){if(r||t.length===0)return n(r);trySendOptionsResponse(e,t,n)}}function getPathname(e){try{return a(e).pathname}catch{return}}function getProtohost(e){if(typeof e!=`string`||e.length===0||e[0]===`/`)return;let t=e.indexOf(`?`),n=t===-1?e.length:t,r=e.substring(0,n).indexOf(`://`);return r===-1?void 0:e.substring(0,e.indexOf(`/`,3+r))}function matchLayer(e,t){try{return e.match(t)}catch(e){return e}}function mergeParams(e,t){if(typeof t!=`object`||!t)return e;let n=Object.assign({},t);if(!(0 in e)||!(0 in t))return Object.assign(n,e);let r=0,i=0;for(;r in e;)r++;for(;i in t;)i++;for(r--;r>=0;r--)e[r+i]=e[r],r<i&&delete e[r];return Object.assign(n,e)}function processParams(e,t,r,i,a,o){let s=t.keys;if(!s||s.length===0)return o();let l=0,u=0,d,p,m,h;function param(t){if(t)return o(t);if(l>=s.length)return o();if(u=0,d=s[l++],p=i.params[d],m=e[d],h=r[d],p===void 0||!m)return param();if(h&&(h.match===p||h.error&&h.error!==`route`))return i.params[d]=h.value,param(h.error);r[d]=h={error:null,match:p,value:p},paramCallback()}function paramCallback(e){let t=m[u++];if(h.value=i.params[d],e){h.error=e,param(e);return}if(!t)return param();try{let e=t(i,a,paramCallback,p,d);n(e)&&(e instanceof Promise||c(`parameters that are Promise-like are deprecated, use a native Promise instead`),e.then(null,function(e){paramCallback(e||Error(`Rejected promise`))}))}catch(e){paramCallback(e)}}param()}function restore(e,t){let n=Array(arguments.length-2),r=Array(arguments.length-2);for(let e=0;e<n.length;e++)n[e]=arguments[e+2],r[e]=t[n[e]];return function(){for(let e=0;e<n.length;e++)t[n[e]]=r[e];return e.apply(this,arguments)}}function sendOptionsResponse(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++)n[t[e]]=!0;let r=Object.keys(n).sort().join(`, `);e.setHeader(`Allow`,r),e.setHeader(`Content-Length`,Buffer.byteLength(r)),e.setHeader(`Content-Type`,`text/plain`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.end(r)}function trySendOptionsResponse(e,t,n){try{sendOptionsResponse(e,t)}catch(e){n(e)}}function wrap(e,t){return function proxy(){let n=Array(arguments.length+1);n[0]=e;for(let e=0,t=arguments.length;e<t;e++)n[e+1]=arguments[e];t.apply(this,n)}}})),sd=__commonJSMin(((e,t)=>{I();var n=yl(),r=bo()(`express:application`),i=lu(),a=(Au(),__toCommonJS(Eu)),o=Qu().methods,s=Qu().compileETag,c=Qu().compileQueryParser,l=Qu().compileTrust,u=(_o(),__toCommonJS(to)).resolve,d=ed(),p=od(),m=Array.prototype.slice,h=Array.prototype.flat,g=e=t.exports={},_=`@@symbol:trust_proxy_default`;g.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,`router`,{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new p({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},g.defaultConfiguration=function defaultConfiguration(){var e=process.env.NODE_ENV||`development`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,_,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[_]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,u(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},g.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},g.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var a=h.call(m.call(arguments,t),1/0);if(a.length===0)throw TypeError(`app.use() requires a middleware function`);var o=this.router;return a.forEach(function(e){if(!e||!e.handle||!e.set)return o.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,o.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},g.route=function route(e){return this.router.route(e)},g.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},g.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},g.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,s(t));break;case`query parser`:this.set(`query parser fn`,c(t));break;case`trust proxy`:this.set(`trust proxy fn`,l(t)),Object.defineProperty(this.settings,_,{configurable:!0,value:!1});break}return this},g.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},g.enabled=function enabled(e){return!!this.set(e)},g.disabled=function disabled(e){return!this.set(e)},g.enable=function enable(e){return this.set(e,!0)},g.disable=function disable(e){return this.set(e,!1)},o.forEach(function(e){g[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,m.call(arguments,1)),this}}),g.all=function all(e){for(var t=this.route(e),n=m.call(arguments,1),r=0;r<o.length;r++)t[o[r]].apply(t,n);return this},g.render=function render(e,t,n){var r=this.cache,i=n,a=this.engines,o=t,s;typeof t==`function`&&(i=t,o={});var c={...this.locals,...o._locals,...o};if(c.cache??=this.enabled(`view cache`),c.cache&&(s=r[e]),!s){if(s=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:a}),!s.path){var l=Array.isArray(s.root)&&s.root.length>1?`directories "`+s.root.slice(0,-1).join(`", "`)+`" or "`+s.root[s.root.length-1]+`"`:`directory "`+s.root+`"`,u=Error(`Failed to lookup view "`+e+`" in views `+l);return u.view=s,i(u)}c.cache&&(r[e]=s)}tryRender(s,c,i)},g.listen=function listen(){var e=a.createServer(this),t=m.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=d(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&F.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),cd=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{charset:i,q:a,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),ld=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,a=0;i<t.length;i++){var o=parseEncoding(t[i].trim(),i);o&&(t[a++]=o,n||=specify(`identity`,o),r=Math.min(r,o.q||1))}return n||(t[a++]={encoding:`identity`,q:r,i}),t.length=a,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{encoding:i,q:a,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var a=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return a.filter(isQuality).sort(i).map(function getEncoding(e){return t[a.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),ud=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=r[2],o=i;a&&(o+=`-`+a);var s=1;if(r[3])for(var c=r[3].split(`;`),l=0;l<c.length;l++){var u=c[l].split(`=`);u[0]===`q`&&(s=parseFloat(u[1]))}return{prefix:i,suffix:a,q:s,i:t,full:o}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),dd=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),a=1,o=r[2],s=r[1];if(r[3])for(var c=splitParameters(r[3]).map(splitKeyValuePair),l=0;l<c.length;l++){var u=c[l],d=u[0].toLowerCase(),p=u[1],m=p&&p[0]===`"`&&p[p.length-1]===`"`?p.slice(1,-1):p;if(d===`q`){a=parseFloat(m);break}i[d]=m}return{type:s,subtype:o,params:i,q:a,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var a=Object.keys(t.params);if(a.length>0)if(a.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),fd=__commonJSMin(((e,t)=>{var n=cd(),r=ld(),i=ud(),a=dd();t.exports=Negotiator,t.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator))return new Negotiator(e);this.request=e}Negotiator.prototype.charset=function charset(e){var t=this.charsets(e);return t&&t[0]},Negotiator.prototype.charsets=function charsets(e){return n(this.request.headers[`accept-charset`],e)},Negotiator.prototype.encoding=function encoding(e,t){var n=this.encodings(e,t);return n&&n[0]},Negotiator.prototype.encodings=function encodings(e,t){var n=t||{};return r(this.request.headers[`accept-encoding`],e,n.preferred)},Negotiator.prototype.language=function language(e){var t=this.languages(e);return t&&t[0]},Negotiator.prototype.languages=function languages(e){return i(this.request.headers[`accept-language`],e)},Negotiator.prototype.mediaType=function mediaType(e){var t=this.mediaTypes(e);return t&&t[0]},Negotiator.prototype.mediaTypes=function mediaTypes(e){return a(this.request.headers.accept,e)},Negotiator.prototype.preferredCharset=Negotiator.prototype.charset,Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets,Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding,Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings,Negotiator.prototype.preferredLanguage=Negotiator.prototype.language,Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages,Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType,Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes})),pd=__commonJSMin(((e,t)=>{var n=fd(),r=ps();t.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts))return new Accepts(e);this.headers=e.headers,this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||t.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var r=t.map(extToMime),i=this.negotiator.mediaTypes(r.filter(validMime))[0];return i?t[r.indexOf(i)]:!1},Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.encodings():this.negotiator.encodings(t)[0]||!1},Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.charsets():this.negotiator.charsets(t)[0]||!1},Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.languages():this.negotiator.languages(t)[0]||!1};function extToMime(e){return e.indexOf(`/`)===-1?r.lookup(e):e}function validMime(e){return typeof e==`string`}})),md,Server,hd=__esmMin(()=>{hu(),N(),L(),bn(),md=new Set,Server=class extends J{listening=!1;maxConnections;allowHalfOpen;_service=null;_connections=new Set;_address=null;constructor(e,t){super(),typeof e==`function`?(t=e,this.allowHalfOpen=!1):this.allowHalfOpen=e?.allowHalfOpen??!1,t&&this.on(`connection`,t)}listen(...e){let t=0,n=`0.0.0.0`,r=511,i;if(typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0])){let a=e[0];t=a.port??0,n=a.host??`0.0.0.0`,r=a.backlog??511,i=e[1]}else{typeof e[0]==`number`&&(t=e[0]);for(let t=1;t<e.length;t++)typeof e[t]==`string`?n=e[t]:typeof e[t]==`number`?r=e[t]:typeof e[t]==`function`&&(i=e[t])}i&&this.once(`listening`,i);try{this._service=new M.SocketService,this._service.set_backlog(r);let e;t===0?e=this._service.add_any_inet_port(null):(this._service.add_inet_port(t,null),e=t),this._service.connect(`incoming`,(e,t)=>(this._handleConnection(t),!0)),this._service.start(),ensureMainLoop(),this.listening=!0,md.add(this);let i=n.includes(`:`)?`IPv6`:`IPv4`;this._address={port:e,family:i,address:n},deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleConnection(e){if(this.maxConnections&&this._connections.size>=this.maxConnections){try{e.close(null)}catch{}return}let t=new Socket({allowHalfOpen:this.allowHalfOpen});t._setConnection(e),t._setupConnection({}),this._connections.add(t),t.on(`close`,()=>{this._connections.delete(t)}),this.emit(`connection`,t)}address(){return this._address}close(e){if(e&&this.once(`close`,e),!this._service||!this.listening)return setTimeout(()=>{let e=Error(`Server is not running`);e.code=`ERR_SERVER_NOT_RUNNING`,this.emit(`error`,e)},0),this;this._service.stop(),this._service.close(),this._service=null,this.listening=!1,md.delete(this);for(let e of this._connections)e.destroy();return this._connections.clear(),deferEmit(this,`close`),this}getConnections(e){e(null,this._connections.size)}ref(){return this}unref(){return this}}}),gd=__exportAll$4({Server:()=>Server,Socket:()=>Socket,connect:()=>_d,createConnection:()=>createConnection,createServer:()=>createServer,default:()=>vd,isIP:()=>isIP,isIPv4:()=>isIPv4,isIPv6:()=>isIPv6});function isIP(e){if(typeof e!=`string`)return 0;let t=e.includes(`%`)?e.split(`%`)[0]:e,n=M.InetAddress.new_from_string(t);if(!n)return 0;switch(n.get_family()){case M.SocketFamily.INVALID:return 0;case M.SocketFamily.IPV4:return 4;case M.SocketFamily.IPV6:return 6}}function isIPv4(e){return isIP(e)===4}function isIPv6(e){return isIP(e)===6}function createConnection(e,t,n){return new Socket().connect(e,t,n)}function createServer(e,t){return typeof e==`function`?new Server(e):new Server(e,t)}var _d,vd,yd=__esmMin(()=>{hu(),hd(),N(),_d=createConnection,vd={Socket,Server,isIP,isIPv4,isIPv6,createConnection,connect:_d,createServer}}),bd=__commonJSMin(((e,t)=>{var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var a=e[`cache-control`];if(a&&n.test(a))return!1;if(i){if(i===`*`)return!0;var o=t.etag;if(!o)return!1;for(var s=parseTokenList(i),c=0;c<s.length;c++){var l=s[c];if(l===o||l===`W/`+o||`W/`+l===o)return!0}return!1}if(r){var u=t[`last-modified`];if(!u||!(parseHttpDate(u)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),xd=__commonJSMin(((e,t)=>{t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),a=[];a.type=t.slice(0,r);for(var o=0;o<i.length;o++){var s=i[o].split(`-`),c=parseInt(s[0],10),l=parseInt(s[1],10);isNaN(c)?(c=e-l,l=e-1):isNaN(l)&&(l=e-1),l>e-1&&(l=e-1),!(isNaN(c)||isNaN(l)||c>l||c<0)&&a.push({start:c,end:l})}return a.length<1?-1:n&&n.combine?combineRanges(a):a}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],a=t[n];i.start>a.end+1?t[++n]=i:i.end>a.end&&(a.end=i.end,a.index=Math.min(a.index,i.index))}t.length=n+1;var o=t.sort(sortByRangeIndex).map(mapWithoutIndex);return o.type=e.type,o}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),Sd=__commonJSMin(((e,t)=>{var n=pd(),r=(yd(),__toCommonJS(gd)).isIP,i=hs(),a=(Au(),__toCommonJS(Eu)),o=bd(),s=xd(),c=vl(),l=Pu(),u=Object.create(a.IncomingMessage.prototype);t.exports=u,u.get=u.header=function header(e){if(!e)throw TypeError(`name argument is required to req.get`);if(typeof e!=`string`)throw TypeError(`name must be a string to req.get`);var t=e.toLowerCase();switch(t){case`referer`:case`referrer`:return this.headers.referrer||this.headers.referer;default:return this.headers[t]}},u.accepts=function(){var e=n(this);return e.types.apply(e,arguments)},u.acceptsEncodings=function(){var e=n(this);return e.encodings.apply(e,arguments)},u.acceptsCharsets=function(){var e=n(this);return e.charsets.apply(e,arguments)},u.acceptsLanguages=function(...e){return n(this).languages(...e)},u.range=function range(e,t){var n=this.get(`Range`);if(n)return s(e,n,t)},defineGetter(u,`query`,function query(){var e=this.app.get(`query parser fn`);if(!e)return Object.create(null);var t=c(this).query;return e(t)}),u.is=function is(e){var t=e;if(!Array.isArray(e)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return i(this,t)},defineGetter(u,`protocol`,function protocol(){var e=this.socket.encrypted?`https`:`http`;if(!this.app.get(`trust proxy fn`)(this.socket.remoteAddress,0))return e;var t=this.get(`X-Forwarded-Proto`)||e,n=t.indexOf(`,`);return n===-1?t.trim():t.substring(0,n).trim()}),defineGetter(u,`secure`,function secure(){return this.protocol===`https`}),defineGetter(u,`ip`,function ip(){var e=this.app.get(`trust proxy fn`);return l(this,e)}),defineGetter(u,`ips`,function ips(){var e=this.app.get(`trust proxy fn`),t=l.all(this,e);return t.reverse().pop(),t}),defineGetter(u,`subdomains`,function subdomains(){var e=this.hostname;if(!e)return[];var t=this.app.get(`subdomain offset`);return(r(e)?[e]:e.split(`.`).reverse()).slice(t)}),defineGetter(u,`path`,function path(){return c(this).pathname}),defineGetter(u,`host`,function host(){var e=this.app.get(`trust proxy fn`),t=this.get(`X-Forwarded-Host`);return!t||!e(this.socket.remoteAddress,0)?t=this.get(`Host`):t.indexOf(`,`)!==-1&&(t=t.substring(0,t.indexOf(`,`)).trimRight()),t||void 0}),defineGetter(u,`hostname`,function hostname(){var e=this.host;if(e){var t=e[0]===`[`?e.indexOf(`]`)+1:0,n=e.indexOf(`:`,t);return n===-1?e:e.substring(0,n)}}),defineGetter(u,`fresh`,function(){var e=this.method,t=this.res,n=t.statusCode;return e!==`GET`&&e!==`HEAD`?!1:n>=200&&n<300||n===304?o(this.headers,{etag:t.get(`ETag`),"last-modified":t.get(`Last-Modified`)}):!1}),defineGetter(u,`stale`,function stale(){return!this.fresh}),defineGetter(u,`xhr`,function xhr(){return(this.get(`X-Requested-With`)||``).toLowerCase()===`xmlhttprequest`});function defineGetter(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}})),Cd=__commonJSMin(((e,t)=>{t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,a=/\\([\u0000-\u007f])/g,o=/([\\"])/g,s=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,c=/^[\x20-\x7e\x80-\xff]+$/,l=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,u=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,d=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),a=c.test(r),o=typeof t==`string`?basename(t):t&&getlatin1(r),s=typeof o==`string`&&o!==r;return(s||!a||hasHexEscape(r))&&(n[`filename*`]=r),(a||s)&&(n.filename=s?o:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!l.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,a=Object.keys(t).sort(),o=0;o<a.length;o++){i=a[o];var s=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+s}return r}function decodefield(e){let t=u.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=d.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,o=[],c={},l;for(n=s.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=s.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),l=t[2],o.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(o.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),l=decodefield(l),c[i]=l;continue}typeof c[i]!=`string`&&(l[0]===`"`&&(l=l.slice(1,-1).replace(a,`$1`)),c[i]=l)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,c)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(o,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),wd=__commonJSMin((e=>{var t=(xa(),__toCommonJS(ya));e.sign=function(e,n){if(typeof e!=`string`)throw TypeError(`Cookie value must be provided as a string.`);if(n==null)throw TypeError(`Secret key must be provided.`);return e+`.`+t.createHmac(`sha256`,n).update(e).digest(`base64`).replace(/\=+$/,``)},e.unsign=function(n,r){if(typeof n!=`string`)throw TypeError(`Signed cookie string must be provided.`);if(r==null)throw TypeError(`Secret key must be provided.`);var i=n.slice(0,n.lastIndexOf(`.`)),a=e.sign(i,r),o=Buffer.from(a),s=Buffer.from(n);return o.length===s.length&&t.timingSafeEqual(o,s)?i:!1}})),Td=__commonJSMin((e=>{e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var a=t&&t.decode||decode,o=0,s=0,c=0;do{if(s=e.indexOf(`=`,o),s===-1)break;if(c=e.indexOf(`;`,o),c===-1)c=i;else if(s>c){o=e.lastIndexOf(`;`,s-1)+1;continue}var l=startIndex(e,o,s),u=endIndex(e,s,l),d=e.slice(l,u);if(!n.call(r,d)){var p=startIndex(e,s+1,c),m=endIndex(e,c,p);e.charCodeAt(p)===34&&e.charCodeAt(m-1)===34&&(p++,m--),r[d]=tryDecode(e.slice(p,m),a)}o=c+1}while(o<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var s=n&&n.encode||encodeURIComponent;if(typeof s!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var c=s(t);if(!i.test(c))throw TypeError(`argument val is invalid`);var l=e+`=`+c;if(!n)return l;if(n.maxAge!=null){var u=Math.floor(n.maxAge);if(!isFinite(u))throw TypeError(`option maxAge is invalid`);l+=`; Max-Age=`+u}if(n.domain){if(!a.test(n.domain))throw TypeError(`option domain is invalid`);l+=`; Domain=`+n.domain}if(n.path){if(!o.test(n.path))throw TypeError(`option path is invalid`);l+=`; Path=`+n.path}if(n.expires){var d=n.expires;if(!isDate(d)||isNaN(d.valueOf()))throw TypeError(`option expires is invalid`);l+=`; Expires=`+d.toUTCString()}if(n.httpOnly&&(l+=`; HttpOnly`),n.secure&&(l+=`; Secure`),n.partitioned&&(l+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`strict`:l+=`; SameSite=Strict`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return l}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),Ed=__commonJSMin(((e,t)=>{var n=Do(),r=bo()(`send`),i=gl(),a=_l(),o=ju(),s=bd(),c=(cu(),__toCommonJS(au)),l=ps(),u=vo(),d=cs(),p=xd(),m=(_o(),__toCommonJS(to)),h=wo(),g=(Zr(),__toCommonJS(Ur)),_=(oc(),__toCommonJS(nc)),v=m.extname,y=m.join,b=m.normalize,x=m.resolve,S=m.sep,w=/^ *bytes=/,T=3600*24*365*1e3,E=/(?:^|[\\/])\.\.(?:[\\/]|$)/;t.exports=send;function send(e,t,n){return new SendStream(e,t,n)}function SendStream(e,t,n){g.call(this);var r=n||{};if(this.options=r,this.path=t,this.req=e,this._acceptRanges=r.acceptRanges===void 0?!0:!!r.acceptRanges,this._cacheControl=r.cacheControl===void 0?!0:!!r.cacheControl,this._etag=r.etag===void 0?!0:!!r.etag,this._dotfiles=r.dotfiles===void 0?`ignore`:r.dotfiles,this._dotfiles!==`ignore`&&this._dotfiles!==`allow`&&this._dotfiles!==`deny`)throw TypeError(`dotfiles option must be "allow", "deny", or "ignore"`);this._extensions=r.extensions===void 0?[]:normalizeList(r.extensions,`extensions option`),this._immutable=r.immutable===void 0?!1:!!r.immutable,this._index=r.index===void 0?[`index.html`]:normalizeList(r.index,`index option`),this._lastModified=r.lastModified===void 0?!0:!!r.lastModified,this._maxage=r.maxAge||r.maxage,this._maxage=typeof this._maxage==`string`?u(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),T),this._root=r.root?x(r.root):null}_.inherits(SendStream,g),SendStream.prototype.error=function error(e,t){if(hasListeners(this,`error`))return this.emit(`error`,createHttpError(e,t));var n=this.res,r=createHtmlDocument(`Error`,a(h.message[e]||String(e)));clearHeaders(n),t&&t.headers&&setHeaders(n,t.headers),n.statusCode=e,n.setHeader(`Content-Type`,`text/html; charset=UTF-8`),n.setHeader(`Content-Length`,Buffer.byteLength(r)),n.setHeader(`Content-Security-Policy`,`default-src 'none'`),n.setHeader(`X-Content-Type-Options`,`nosniff`),n.end(r)},SendStream.prototype.hasTrailingSlash=function hasTrailingSlash(){return this.path[this.path.length-1]===`/`},SendStream.prototype.isConditionalGET=function isConditionalGET(){return this.req.headers[`if-match`]||this.req.headers[`if-unmodified-since`]||this.req.headers[`if-none-match`]||this.req.headers[`if-modified-since`]},SendStream.prototype.isPreconditionFailure=function isPreconditionFailure(){var e=this.req,t=this.res,n=e.headers[`if-match`];if(n){var r=t.getHeader(`ETag`);return!r||n!==`*`&&parseTokenList(n).every(function(e){return e!==r&&e!==`W/`+r&&`W/`+e!==r})}var i=parseHttpDate(e.headers[`if-unmodified-since`]);if(!isNaN(i)){var a=parseHttpDate(t.getHeader(`Last-Modified`));return isNaN(a)||a>i}return!1},SendStream.prototype.removeContentHeaderFields=function removeContentHeaderFields(){var e=this.res;e.removeHeader(`Content-Encoding`),e.removeHeader(`Content-Language`),e.removeHeader(`Content-Length`),e.removeHeader(`Content-Range`),e.removeHeader(`Content-Type`)},SendStream.prototype.notModified=function notModified(){var e=this.res;r(`not modified`),this.removeContentHeaderFields(),e.statusCode=304,e.end()},SendStream.prototype.headersAlreadySent=function headersAlreadySent(){var e=Error(`Can't set headers after they are sent.`);r(`headers already sent`),this.error(500,e)},SendStream.prototype.isCachable=function isCachable(){var e=this.res.statusCode;return e>=200&&e<300||e===304},SendStream.prototype.onStatError=function onStatError(e){switch(e.code){case`ENAMETOOLONG`:case`ENOENT`:case`ENOTDIR`:this.error(404,e);break;default:this.error(500,e);break}},SendStream.prototype.isFresh=function isFresh(){return s(this.req.headers,{etag:this.res.getHeader(`ETag`),"last-modified":this.res.getHeader(`Last-Modified`)})},SendStream.prototype.isRangeFresh=function isRangeFresh(){var e=this.req.headers[`if-range`];if(!e)return!0;if(e.indexOf(`"`)!==-1){var t=this.res.getHeader(`ETag`);return!!(t&&e.indexOf(t)!==-1)}return parseHttpDate(this.res.getHeader(`Last-Modified`))<=parseHttpDate(e)},SendStream.prototype.redirect=function redirect(e){var t=this.res;if(hasListeners(this,`directory`)){this.emit(`directory`,t,e);return}if(this.hasTrailingSlash()){this.error(403);return}var n=i(collapseLeadingSlashes(this.path+`/`)),r=createHtmlDocument(`Redirecting`,`Redirecting to `+a(n));t.statusCode=301,t.setHeader(`Content-Type`,`text/html; charset=UTF-8`),t.setHeader(`Content-Length`,Buffer.byteLength(r)),t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Location`,n),t.end(r)},SendStream.prototype.pipe=function pipe(e){var t=this._root;this.res=e;var n=decode(this.path);if(n===-1||~n.indexOf(`\0`))return this.error(400),e;var i;if(t!==null){if(n&&=b(`.`+S+n),E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=n.split(S),n=b(y(t,n))}else{if(E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=b(n).split(S),n=x(n)}if(containsDotFile(i))switch(r(`%s dotfile "%s"`,this._dotfiles,n),this._dotfiles){case`allow`:break;case`deny`:return this.error(403),e;default:return this.error(404),e}return this._index.length&&this.hasTrailingSlash()?(this.sendIndex(n),e):(this.sendFile(n),e)},SendStream.prototype.send=function send(e,t){var n=t.size,i=this.options,a={},o=this.res,s=this.req,c=s.headers.range,l=i.start||0;if(o.headersSent){this.headersAlreadySent();return}if(r(`pipe "%s"`,e),this.setHeader(e,t),this.type(e),this.isConditionalGET()){if(this.isPreconditionFailure()){this.error(412);return}if(this.isCachable()&&this.isFresh()){this.notModified();return}}if(n=Math.max(0,n-l),i.end!==void 0){var u=i.end-l+1;n>u&&(n=u)}if(this._acceptRanges&&w.test(c)){if(c=p(n,c,{combine:!0}),this.isRangeFresh()||(r(`range stale`),c=-2),c===-1)return r(`range unsatisfiable`),o.setHeader(`Content-Range`,contentRange(`bytes`,n)),this.error(416,{headers:{"Content-Range":o.getHeader(`Content-Range`)}});c!==-2&&c.length===1&&(r(`range %j`,c),o.statusCode=206,o.setHeader(`Content-Range`,contentRange(`bytes`,n,c[0])),l+=c[0].start,n=c[0].end-c[0].start+1)}for(var d in i)a[d]=i[d];if(a.start=l,a.end=Math.max(l,l+n-1),o.setHeader(`Content-Length`,n),s.method===`HEAD`){o.end();return}this.stream(e,a)},SendStream.prototype.sendFile=function sendFile(e){var t=0,n=this;r(`stat "%s"`,e),c.stat(e,function onstat(t,r){var i=e[e.length-1]===S;if(t&&t.code===`ENOENT`&&!v(e)&&!i)return next(t);if(t)return n.onStatError(t);if(r.isDirectory())return n.redirect(e);if(i)return n.error(404);n.emit(`file`,e,r),n.send(e,r)});function next(i){if(n._extensions.length<=t)return i?n.onStatError(i):n.error(404);var a=e+`.`+n._extensions[t++];r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}},SendStream.prototype.sendIndex=function sendIndex(e){var t=-1,n=this;function next(i){if(++t>=n._index.length)return i?n.onStatError(i):n.error(404);var a=y(e,n._index[t]);r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}next()},SendStream.prototype.stream=function stream(e,t){var n=this,r=this.res,i=c.createReadStream(e,t);this.emit(`stream`,i),i.pipe(r);function cleanup(){i.destroy()}d(r,cleanup),i.on(`error`,function onerror(e){cleanup(),n.onStatError(e)}),i.on(`end`,function onend(){n.emit(`end`)})},SendStream.prototype.type=function type(e){var t=this.res;if(!t.getHeader(`Content-Type`)){var n=v(e),i=l.contentType(n)||`application/octet-stream`;r(`content-type %s`,i),t.setHeader(`Content-Type`,i)}},SendStream.prototype.setHeader=function setHeader(e,t){var n=this.res;if(this.emit(`headers`,n,e,t),this._acceptRanges&&!n.getHeader(`Accept-Ranges`)&&(r(`accept ranges`),n.setHeader(`Accept-Ranges`,`bytes`)),this._cacheControl&&!n.getHeader(`Cache-Control`)){var i=`public, max-age=`+Math.floor(this._maxage/1e3);this._immutable&&(i+=`, immutable`),r(`cache-control %s`,i),n.setHeader(`Cache-Control`,i)}if(this._lastModified&&!n.getHeader(`Last-Modified`)){var a=t.mtime.toUTCString();r(`modified %s`,a),n.setHeader(`Last-Modified`,a)}if(this._etag&&!n.getHeader(`ETag`)){var s=o(t);r(`etag %s`,s),n.setHeader(`ETag`,s)}};function clearHeaders(e){for(let t of e.getHeaderNames())e.removeHeader(t)}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e[t]===`/`;t++);return t>1?`/`+e.substr(t):e}function containsDotFile(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.length>1&&n[0]===`.`)return!0}return!1}function contentRange(e,t,n){return e+` `+(n?n.start+`-`+n.end:`*`)+`/`+t}function createHtmlDocument(e,t){return`<!DOCTYPE html>
|
|
36
|
+
`?(i.name=`enter`,i.meta=r):t===` `?(i.name=`tab`,i.meta=r):t===`\b`||t===``?(i.name=`backspace`,i.meta=r):t===`\x1B`?(i.name=`escape`,i.meta=r):t===` `?(i.name=`space`,i.meta=r):!r&&t<=``?(i.name=String.fromCharCode(t.charCodeAt(0)+97-1),i.ctrl=!0):/^[0-9A-Za-z]$/.test(t)?(i.name=t.toLowerCase(),i.shift=/^[A-Z]$/.test(t),i.meta=r):r&&(i.name=t.length?void 0:`escape`,i.meta=!0);i.sequence=n,n.length!==0&&(i.name!==void 0||r)?e.emit(`keypress`,r?void 0:n,i):n.length===1&&e.emit(`keypress`,n,i)}}function emitKeypressEvents(e,t={}){let n=e;if(n[Jl])return;n[Jl]=new Sn(`utf8`),n[Yl]=emitKeys(e),n[Yl].next();let r=t.escapeCodeTimeout??500,i,triggerEscape=()=>n[Yl].next(``);function onData(t){if(e.listenerCount(`keypress`)>0){let a=n[Jl].write(typeof t==`string`?Buffer.from(t):t);if(a){clearTimeout(i);for(let t of a)try{n[Yl].next(t),t===`\x1B`&&(i=setTimeout(triggerEscape,r))}catch{n[Yl]=emitKeys(e),n[Yl].next()}}}else e.removeListener(`data`,onData),delete n[Jl],delete n[Yl]}e.on(`data`,onData)}var Kl,Interface,ql,Jl,Yl,Xl=__esmMin(()=>{bn(),wn(),Kl=/\r\n|\r|\n/,Interface=class extends J{terminal;line=``;cursor=0;escapeCodeTimeout;_input;_output;get input(){return this._input}get output(){return this._output}_prompt;_closed=!1;_paused=!1;history;_historySize;_crlfDelay;_lineBuffer=``;_questionCallback=null;_boundOnData=null;_boundOnEnd=null;_boundOnError=null;_boundOnKeypress=null;constructor(e,t){super();let n;if(n=e&&typeof e==`object`&&!(`read`in e&&typeof e.read==`function`)?e:{input:e,output:t},this._input=n.input||null,this._output=n.output||null,this._prompt=n.prompt||`> `,this.terminal=n.terminal??this._output!==null,this._historySize=n.historySize??30,this.history=[],this._crlfDelay=n.crlfDelay??100,this.escapeCodeTimeout=n.escapeCodeTimeout,this._input&&(this._boundOnData=e=>this._onData(e),this._boundOnEnd=()=>this._onEnd(),this._boundOnError=e=>this.emit(`error`,e),this._input.on(`data`,this._boundOnData),this._input.on(`end`,this._boundOnEnd),this._input.on(`error`,this._boundOnError),`setEncoding`in this._input&&typeof this._input.setEncoding==`function`&&this._input.setEncoding(`utf8`),this.terminal)){emitKeypressEvents(this._input,this);let e=this._input;typeof e.setRawMode==`function`&&(e.isRaw||e.setRawMode(!0)),typeof this._input.resume==`function`&&this._input.resume(),this._boundOnKeypress=(e,t)=>{t&&(t.name===`backspace`||t.name===`delete`?this.cursor>0&&(this.line=this.line.slice(0,this.cursor-1)+this.line.slice(this.cursor),this.cursor--):e&&e.length===1&&!t.ctrl&&!t.meta&&t.name!==`return`&&t.name!==`enter`&&t.name!==`escape`&&(this.line=this.line.slice(0,this.cursor)+e+this.line.slice(this.cursor),this.cursor++))},this._input.on(`keypress`,this._boundOnKeypress)}}_onData(e){if(this._closed||this._paused)return;let t=typeof e==`string`?e:e.toString(`utf8`);this._lineBuffer+=t;let n;for(;(n=Kl.exec(this._lineBuffer))!==null;){let e=this._lineBuffer.substring(0,n.index);this._lineBuffer=this._lineBuffer.substring(n.index+n[0].length),this._onLine(e)}}_onLine(e){if(e.length>0&&this._historySize>0&&(this.history.length===0||this.history[0]!==e)&&(this.history.unshift(e),this.history.length>this._historySize&&this.history.pop()),this._questionCallback){let t=this._questionCallback;this._questionCallback=null,t(e)}this.emit(`line`,e)}_onEnd(){this._lineBuffer.length>0&&(this._onLine(this._lineBuffer),this._lineBuffer=``),this.close()}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(this._closed)throw Error(`readline was closed`);this._output?.write(this._prompt)}question(e,t,n){if(this._closed)throw Error(`readline was closed`);let r=typeof t==`function`?t:n;this._questionCallback=r,this._output?.write(e)}clearLine(e,t){return this.line=``,this.cursor=0,t&&t(),!0}write(e,t){if(!this._closed){if(t){this._input&&this._input.emit(`keypress`,e??``,t);return}if(e!=null){let t=typeof e==`string`?e:e.toString(`utf8`);t&&(this.line=this.line.slice(0,this.cursor)+t+this.line.slice(this.cursor),this.cursor+=t.length),this._output?.write(e)}}}close(){if(!this._closed){if(this._closed=!0,this._input){this._boundOnData&&this._input.removeListener(`data`,this._boundOnData),this._boundOnEnd&&this._input.removeListener(`end`,this._boundOnEnd),this._boundOnError&&this._input.removeListener(`error`,this._boundOnError),this._boundOnKeypress&&this._input.removeListener(`keypress`,this._boundOnKeypress),this._boundOnData=null,this._boundOnEnd=null,this._boundOnError=null,this._boundOnKeypress=null;let e=this._input;this.terminal&&e.isRaw&&typeof e.setRawMode==`function`&&e.setRawMode(!1),typeof this._input.pause==`function`&&this._input.pause()}this.emit(`close`)}}pause(){return this._closed?this:(this._paused=!0,this._input&&`pause`in this._input&&typeof this._input.pause==`function`&&this._input.pause(),this.emit(`pause`),this)}resume(){return this._closed?this:(this._paused=!1,this._input&&`resume`in this._input&&typeof this._input.resume==`function`&&this._input.resume(),this.emit(`resume`),this)}getCursorPos(){let e=this._output?.columns??80,t=this._prompt.length+this.cursor;return{rows:Math.floor(t/e),cols:t%e}}[Symbol.asyncIterator](){let e=[],t=null,n=!1,onLine=n=>{if(t){let e=t;t=null,e({value:n,done:!1})}else e.push(n)},onClose=()=>{if(n=!0,t){let e=t;t=null,e({value:void 0,done:!0})}};return this.on(`line`,onLine),this.on(`close`,onClose),{next:()=>e.length>0?Promise.resolve({value:e.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise(e=>{t=e}),return:()=>(n=!0,this.removeListener(`line`,onLine),this.removeListener(`close`,onClose),Promise.resolve({value:void 0,done:!0})),[Symbol.asyncIterator](){return this}}}},ql=Symbol.dispose??Symbol.for(`Symbol.dispose`),Interface.prototype[ql]=function(){this.close()},Jl=Symbol(`keypress-decoder`),Yl=Symbol(`escape-decoder`)}),Zl,Ql=__esmMin(()=>{Sl(),eu(),El(),Wl(),Tl(),Gl(),$l(),A(),N(),q(),Xl(),Zl=class FileHandle{_file;_ioStream=null;_readStream=null;_gFile;_ioMode;_readPos=0;_ioLock=Promise.resolve();static instances={};constructor(e){this.options=e,this.options.flags||=`r`,this.options.mode||=438;let t=normalizePath(e.path),n=shouldCreate(e.flags),r=resolveIOMode(e.flags);try{this._file=openIOChannel(t,r,n)}catch(e){throw mapOpenError(e,t)}return this._file.set_encoding(null),this.fd=this._file.unix_get_fd(),this._gFile=M.File.new_for_path(t),this._ioMode=r,FileHandle.instances[this.fd]=this,FileHandle.getInstance(this.fd)}_getReadStream(){return this._ioStream?{input:this._ioStream.get_input_stream(),seekable:this._ioStream}:this._ioMode===`r`?(this._readStream||=this._gFile.read(null),{input:this._readStream,seekable:this._readStream}):(this._ioStream=this._gFile.open_readwrite(null),{input:this._ioStream.get_input_stream(),seekable:this._ioStream})}_getWriteStream(){if(this._ioStream)return this._ioStream;if(this._ioMode===`r`)throw Error(`FileHandle opened read-only; cannot write`);return this._ioStream=this._gFile.open_readwrite(null),this._ioStream}_serialize(e){let t=this._ioLock.catch(()=>{}).then(e);return this._ioLock=t,t}fd;static getInstance(e){if(!FileHandle.instances[e])throw Error(`No instance found for fd!`);return FileHandle.instances[e]}async appendFile(e,t){let n=getEncodingFromOptions(t);typeof e==`string`&&(e=K.from(e)),n&&this._file.set_encoding(n);let[r,i]=this._file.write_chars(e,e.length);if(r===k.IOStatus.ERROR)throw Error(`Error on append to file!`)}async chown(e,t){chownSync(normalizePath(this.options.path),e,t)}async chmod(e){chmodSync(normalizePath(this.options.path),e)}createReadStream(e){return new ReadStream(this.options.path,e)}createWriteStream(e){return new WriteStream(this.options.path,e)}async datasync(){this._file.flush()}async sync(){this._file.flush()}async read(...e){let t,n,r,i;if(typeof e[0]==`object`&&!(e[0]instanceof Uint8Array)&&!(e[0]instanceof K)){let a=e[0];t=a.buffer,n=a.offset,r=a.length,i=a.position}else t=e[0],n=e[1],r=e[2],i=e[3];let a=t,o=n??0,s=r??a?.byteLength??65536,c=i??0;return this._serialize(async()=>{let{input:e,seekable:n}=this._getReadStream();n.seek(BigInt(c),k.SeekType.SET,null);let r=e.read_bytes(s,null).get_data(),i=r?.length??0;return a&&r&&i>0&&a.set(r,o),{bytesRead:i,buffer:t}})}readableWebStream(){let e=globalThis.ReadableStream;if(typeof e!=`function`)throw Error(`readableWebStream() requires a global ReadableStream. Import "node:stream/web" or "@gjsify/streams" before calling this method.`);return new e}async readFile(e){let t=getEncodingFromOptions(e,`buffer`);t&&this._file.set_encoding(t);let[n,r]=this._file.read_to_end();if(n===k.IOStatus.ERROR)throw Error(`Error on read from file!`);return encodeUint8Array(t,r)}readLines(e){return createInterface({input:this.createReadStream(e),crlfDelay:1/0})}async stat(e){let t=await new Promise((e,t)=>{this._gFile.query_info_async(wl,M.FileQueryInfoFlags.NONE,k.PRIORITY_DEFAULT,null,(n,r)=>{try{e(this._gFile.query_info_finish(r))}catch(e){t(e)}})}),n=normalizePath(this.options.path);return e?.bigint?new BigIntStats(t,n):new Stats(t,n)}async truncate(e=0){let t=Math.max(0,e);this._file.flush(),this._getWriteStream().get_output_stream().truncate(t,null)}async utimes(e,t){let{utimesSync:n}=await Promise.resolve().then(()=>(Il(),Fl));n(normalizePath(this.options.path),e,t)}async writeFile(e,t){let n=getEncodingFromOptions(t),r;r=typeof e==`string`?K.from(e,n||`utf8`):e,this._file.seek_position(0,k.SeekType.SET);let[i]=this._file.write_chars(r,r.length);if(i===k.IOStatus.ERROR)throw Error(`Error writing to file!`);this._file.flush()}async write(e,...t){let n=null,r=null,i=null,a=null;typeof e==`string`?(n=t[0],r=t[1]):(i=t[0],a=t[1],n=t[2]),r=getEncodingFromOptions(r,typeof e==`string`?`utf8`:null);let o;o=typeof e==`string`?new TextEncoder().encode(e):e;let s=i??0,c=a??o.byteLength-s,l=o.slice(s,s+c),u=n??0;return{bytesWritten:await this._serialize(async()=>{let e=this._getWriteStream();e.seek(BigInt(u),k.SeekType.SET,null);let t=e.get_output_stream(),n=await new Promise((e,n)=>{t.write_bytes_async(new k.Bytes(l),k.PRIORITY_DEFAULT,null,(r,i)=>{try{e(t.write_bytes_finish(i))}catch(e){n(e)}})});return await new Promise((e,n)=>{t.flush_async(k.PRIORITY_DEFAULT,null,(r,i)=>{try{t.flush_finish(i),e()}catch(e){n(e)}})}),n}),buffer:e}}async writev(e,t){let n=0;for(let r of e){let e=K.from(r.buffer,r.byteOffset,r.byteLength),i=await this.write(e,0,e.byteLength,t==null?null:t+n);n+=i.bytesWritten}return{bytesWritten:n,buffers:e}}async readv(e,t){let n=0;for(let r of e){let e=await this.read({buffer:K.from(r.buffer,r.byteOffset,r.byteLength),position:t==null?null:t+n});if(n+=e.bytesRead,e.bytesRead<r.byteLength)break}return{bytesRead:n,buffers:e}}_flushSync(){this._file.flush()}_closeSync(){try{this._ioStream?.close(null)}catch{}try{this._readStream?.close(null)}catch{}this._ioStream=null,this._readStream=null;try{this._file.shutdown(!0)}catch{}let e=FileHandle;delete e.instances[this.fd]}_readSync(e,t,n,r){let i=this._gFile.read(null);try{let a=r!==null&&r>=0,o=a?r:this._readPos;o>0&&i.seek(o,k.SeekType.SET,null);let s=i.read_bytes(n,null).get_data()??new Uint8Array;return new Uint8Array(e.buffer,e.byteOffset+t).set(s.subarray(0,s.length)),a||(this._readPos+=s.length),s.length}finally{i.close(null)}}_writeSync(e,t){let n=this._gFile.open_readwrite(null);try{return t!==null&&t>=0&&n.seek(t,k.SeekType.SET,null),n.get_output_stream().write_bytes(k.Bytes.new(e),null)}finally{n.close(null)}}async close(){try{this._ioStream?.close(null)}catch{}try{this._readStream?.close(null)}catch{}this._ioStream=null,this._readStream=null;try{this._file.shutdown(!0)}catch{}}async[Symbol.asyncDispose](){await this.close()}pull(...e){throw Error('FileHandle.pull() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}writer(e){throw Error('FileHandle.writer() is not implemented in @gjsify/fs yet — requires `node:stream/iter` (Node 25.9+) which @gjsify/stream has not ported. Track gjsify Open TODO "Node 25 stream/iter integration".')}}});function statSync(e,t){let n=normalizePath(e);try{let e=M.File.new_for_path(n).query_info(wl,M.FileQueryInfoFlags.NONE,null);return t?.bigint?new BigIntStats(e,n):new Stats(e,n)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`stat`,n)}}function lstatSync(e,t){let n=normalizePath(e);try{let e=M.File.new_for_path(n).query_info(wl,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);return t?.bigint?new BigIntStats(e,n):new Stats(e,n)}catch(e){if(t?.throwIfNoEntry===!1&&isNotFoundError(e))return;throw createNodeError(e,`lstat`,n)}}function readdirSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n).enumerate_children(`standard::name,standard::type`,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null),i=[];try{let e=r.next_file(null);for(;e!==null;)i.push({name:e.get_name(),type:e.get_file_type()}),e=r.next_file(null)}finally{try{r.close(null)}catch{}}let a=[];for(let e of i){let r=ao(n,e.name);if(t?.withFileTypes?a.push(new Dirent(r,e.name,e.type)):a.push(e.name),t?.recursive&&e.type===M.FileType.DIRECTORY){let n=readdirSync(r,t);for(let t of n)typeof t==`string`?a.push(ao(e.name,t)):a.push(t)}}return a}function realpathSync(e){let t=normalizePath(e),n=M.File.new_for_path(t),r=0;for(;;){let e=n.query_info(`standard::is-symlink,standard::symlink-target`,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(!e.get_is_symlink())return n.get_path();let i=e.get_symlink_target(),a=n.get_parent();if(n=a?a.resolve_relative_path(i):M.File.new_for_path(i),++r>40)throw Error(`ELOOP: too many levels of symbolic links, realpath '${t}'`)}}function symlinkSync(e,t,n){let r=normalizePath(t),i=normalizePath(e);M.File.new_for_path(r).make_symbolic_link(i,null)}function readFileSync(e,t={encoding:null,flag:`r`}){let n=normalizePath(e),r=M.File.new_for_path(n);try{let[e,i]=r.load_contents(null);if(!e)throw createNodeError(Error(`failed to read file`),`read`,n);return encodeUint8Array(getEncodingFromOptions(t,`buffer`),i)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`read`,n)}}function mkdirSync(e,t){let n=!1,r=511;if(typeof t==`object`?(t?.recursive&&(n=t.recursive),t?.mode&&(r=t.mode)):r=t||511,e=normalizePath(e),typeof r==`string`)throw TypeError(`mode as string is currently not supported!`);if(n)return mkdirSyncRecursive(e);let i=M.File.new_for_path(e);try{i.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}}function mkdirSyncRecursive(e){let t=M.File.new_for_path(e);try{return t.make_directory(null),e}catch(t){let n=t;if(n.code===M.IOErrorEnum.EXISTS)return;if(n.code===M.IOErrorEnum.NOT_FOUND){let n=ao(e,`..`),r=M.File.new_for_path(n).get_path();if(r===e)throw createNodeError(t,`mkdir`,e);let i=mkdirSyncRecursive(r),a=M.File.new_for_path(e);try{a.make_directory(null)}catch(t){throw createNodeError(t,`mkdir`,e)}return i??e}throw createNodeError(t,`mkdir`,e)}}function rmdirSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{if(r.query_info(`standard::type`,M.FileQueryInfoFlags.NONE,null).get_file_type()!==M.FileType.DIRECTORY)throw createNodeError(Object.assign(Error(),{code:4}),`rmdir`,n);if(r.enumerate_children(`standard::name`,M.FileQueryInfoFlags.NONE,null).next_file(null)!==null)throw createNodeError(Object.assign(Error(),{code:5}),`rmdir`,n);r.delete(null)}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`rmdir`,n)}}function unlinkSync(e){let t=normalizePath(e),n=M.File.new_for_path(t);try{n.delete(null)}catch(e){throw createNodeError(e,`unlink`,t)}}function writeFileSync(e,t){k.file_set_contents(normalizePath(e),t)}function renameSync(e,t){let n=normalizePath(e),r=normalizePath(t),i=M.File.new_for_path(n),a=M.File.new_for_path(r);try{i.move(a,M.FileCopyFlags.OVERWRITE,null,null)}catch(e){throw createNodeError(e,`rename`,n,r)}}function copyFileSync(e,t,n){let r=normalizePath(e),i=normalizePath(t),a=M.File.new_for_path(r),o=M.File.new_for_path(i),s=M.FileCopyFlags.NONE;n&&!(n&1)?s=M.FileCopyFlags.OVERWRITE:n||(s=M.FileCopyFlags.OVERWRITE);try{a.copy(o,s,null,null)}catch(e){throw createNodeError(e,`copyfile`,r,i)}}function accessSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{let e=r.query_info(`access::*`,M.FileQueryInfoFlags.NONE,null);if(t!==void 0&&t!==0){let r={code:14,message:`permission denied, access '${n}'`};if(t&4&&!e.get_attribute_boolean(`access::can-read`)||t&2&&!e.get_attribute_boolean(`access::can-write`)||t&1&&!e.get_attribute_boolean(`access::can-execute`))throw createNodeError(r,`access`,n)}}catch(e){throw e.code&&typeof e.code==`string`?e:createNodeError(e,`access`,n)}}function appendFileSync(e,t,n){let r=normalizePath(e),i=M.File.new_for_path(r),a;a=typeof t==`string`?new TextEncoder().encode(t):t;try{let e=i.append_to(M.FileCreateFlags.NONE,null);a.length>0&&e.write_bytes(new k.Bytes(a),null),e.close(null)}catch(e){throw createNodeError(e,`appendfile`,r)}}function readlinkSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{let e=r.query_info(`standard::symlink-target`,M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null).get_symlink_target();if(!e)throw Object.assign(Error(`EINVAL: invalid argument, readlink '${n}'`),{code:`EINVAL`,errno:-22,syscall:`readlink`,path:n});return(typeof t==`string`?t:t?.encoding)===`buffer`?K.from(e):e}catch(e){throw typeof e.code==`string`?e:createNodeError(e,`readlink`,n)}}function linkSync(e,t){let n=normalizePath(e),r=normalizePath(t);if(!k.spawn_command_line_sync(`ln ${n} ${r}`)[0])throw Object.assign(Error(`EPERM: operation not permitted, link '${n}' -> '${r}'`),{code:`EPERM`,errno:-1,syscall:`link`,path:n,dest:r})}function truncateSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n);try{let e=r.replace(null,!1,M.FileCreateFlags.NONE,null);if(t&&t>0){let[,n]=r.load_contents(null),i=n.slice(0,t);i.length>0&&e.write_bytes(new k.Bytes(i),null)}e.close(null)}catch(e){throw createNodeError(e,`truncate`,n)}}function chmodSync(e,t){let n=normalizePath(e),r=typeof t==`string`?parseInt(t,8):t;if(!k.spawn_command_line_sync(`chmod ${r.toString(8)} ${n}`)[0])throw Object.assign(Error(`EPERM: operation not permitted, chmod '${n}'`),{code:`EPERM`,errno:-1,syscall:`chmod`,path:n})}function chownSync(e,t,n){let r=normalizePath(e);if(!k.spawn_command_line_sync(`chown ${t}:${n} ${r}`)[0])throw Object.assign(Error(`EPERM: operation not permitted, chown '${r}'`),{code:`EPERM`,errno:-1,syscall:`chown`,path:r})}function watch(e,t,n){return new FSWatcher(normalizePath(e),t,n)}function openSync(e,t,n){return new Zl({path:e,flags:t,mode:n})}function mkdtempSync(e,t){let n=getEncodingFromOptions(t),r=tempDirPath(e);return mkdirSync(r,{recursive:!1,mode:511}),decode(r,n)}function rmSync(e,t){let n=normalizePath(e),r=M.File.new_for_path(n),i=t?.recursive||!1,a=t?.force||!1,o;try{o=r.query_file_type(M.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}if(o===M.FileType.SYMBOLIC_LINK){try{r.delete(null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}return}if(o===M.FileType.DIRECTORY){let r=readdirSync(e);if(!i&&r.length)throw createNodeError(Object.assign(Error(),{code:5}),`rm`,e);for(let e of r)rmSync(ao(n,e),t)}try{r.delete(null)}catch(t){if(a&&isNotFoundError(t))return;throw createNodeError(t,`rm`,e)}}var $l=__esmMin(()=>{Sl(),eu(),nu(),Cl(),Tl(),Ql(),Dl(),A(),N(),_o(),q(),L(),realpathSync.native=realpathSync});function normalizePath(e){return e instanceof URL||e instanceof X?fileURLToPath(e):typeof e==`string`?e:e.toString()}function randomName(){return[...[,,,,,,]].map(()=>`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.floor(Math.random()*62)]).join(``)}function tempDirPath(e){let t;do t=e+randomName();while(existsSync(t));return t}var eu=__esmMin(()=>{$l(),Mn()});function changed(e,t,n,r){switch(r){case M.FileMonitorEvent.CHANGES_DONE_HINT:this.emit(`change`,`change`,t.get_basename());break;case M.FileMonitorEvent.DELETED:case M.FileMonitorEvent.CREATED:case M.FileMonitorEvent.RENAMED:case M.FileMonitorEvent.MOVED_IN:case M.FileMonitorEvent.MOVED_OUT:this.emit(`change`,`rename`,t.get_basename());break}}function gioEventToNodeType(e){switch(e){case M.FileMonitorEvent.CHANGES_DONE_HINT:return`change`;case M.FileMonitorEvent.DELETED:case M.FileMonitorEvent.CREATED:case M.FileMonitorEvent.RENAMED:case M.FileMonitorEvent.MOVED_IN:case M.FileMonitorEvent.MOVED_OUT:return`rename`;default:return null}}async function*watchAsync(e,t){let n=t?.signal;if(n?.aborted)return;let r=normalizePath(e),i=M.File.new_for_path(r),a=M.Cancellable.new(),o;try{o=i.monitor(M.FileMonitorFlags.NONE,a)}catch{return}let s=[],c=[],l=!1;function enqueue(e){l||(c.length>0?c.shift().resolve({value:e,done:!1}):s.push(e))}function terminate(){if(!l)for(l=!0,a.is_cancelled()||a.cancel();c.length>0;)c.shift().resolve({value:void 0,done:!0})}let u=o.connect(`changed`,(e,t,n,r)=>{let i=gioEventToNodeType(r);i!==null&&enqueue({eventType:i,filename:t?.get_basename()??null})}),abortHandler=()=>terminate();n?.addEventListener(`abort`,abortHandler);try{for(;!l;){if(s.length>0){yield s.shift();continue}let e=await new Promise(e=>{c.push({resolve:e})});if(e.done)break;yield e.value}}finally{n?.removeEventListener(`abort`,abortHandler);try{o.disconnect(u)}catch{}a.is_cancelled()||a.cancel()}}var tu,FSWatcher,nu=__esmMin(()=>{eu(),A(),N(),bn(),tu=new WeakMap,FSWatcher=class extends J{constructor(e,t,n){super(),(!t||typeof t!=`object`)&&(t={persistent:!0});let r=t.persistent!==!1,i=M.Cancellable.new(),a=normalizePath(e),o=M.File.new_for_path(a).monitor(M.FileMonitorFlags.NONE,i);o.connect(`changed`,changed.bind(this));let s=null;r&&(s=k.timeout_add(k.PRIORITY_LOW,2147483647,()=>k.SOURCE_CONTINUE)),tu.set(this,{persistent:r,cancellable:i,sourceId:s,watcher:o}),n&&this.on(`change`,n)}close(){let e=tu.get(this);e.cancellable.is_cancelled()||(e.cancellable.cancel(),e.sourceId!==null&&(k.source_remove(e.sourceId),e.sourceId=null))}ref(){let e=tu.get(this);return!e.persistent&&!e.cancellable.is_cancelled()&&(e.persistent=!0,e.sourceId=k.timeout_add(k.PRIORITY_LOW,2147483647,()=>k.SOURCE_CONTINUE)),this}unref(){let e=tu.get(this);return e.persistent&&(e.persistent=!1,e.sourceId!==null&&(k.source_remove(e.sourceId),e.sourceId=null)),this}}});function zeroedStat(){return{dev:0,ino:0,mode:0,nlink:0,uid:0,gid:0,rdev:0,size:0,blksize:0,blocks:0,atimeMs:0,mtimeMs:0,ctimeMs:0,birthtimeMs:0,atime:new Date(0),mtime:new Date(0),ctime:new Date(0),birthtime:new Date(0),isFile:()=>!1,isDirectory:()=>!1,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isSymbolicLink:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}}function watchFile(e,t,n){typeof t==`function`&&(n=t,t={});let r=t.interval??5007,i=e.toString(),a=ru.get(i);return a||(a=new StatWatcher(i,r),a.start(),ru.set(i,a)),n&&a.addChangeListener(n),a}function unwatchFile(e,t){let n=e.toString(),r=ru.get(n);r&&(t?r.removeChangeListener(t):r.removeAllChangeListeners(),r.changeListenerCount===0&&(r.stop(),ru.delete(n)))}var StatWatcher,ru,iu=__esmMin(()=>{$l(),bn(),StatWatcher=class extends J{_path;_interval;_timerId=null;_prev;_changeCount=0;constructor(e,t){super(),this._path=e,this._interval=t,this._prev=zeroedStat()}start(){try{this._prev=statSync(this._path)}catch{}this._timerId=setInterval(()=>{let e;try{e=statSync(this._path)}catch{e=zeroedStat()}let t=this._prev;(e.mtimeMs!==t.mtimeMs||e.size!==t.size||e.ino!==t.ino)&&(this._prev=e,this.emit(`change`,e,t))},this._interval)}stop(){this._timerId!==null&&(clearInterval(this._timerId),this._timerId=null),this.emit(`stop`)}addChangeListener(e){this._changeCount++,this.on(`change`,e)}removeChangeListener(e){this._changeCount--,this.removeListener(`change`,e)}removeAllChangeListeners(){this._changeCount=0,this.removeAllListeners(`change`)}get changeListenerCount(){return this._changeCount}},ru=new Map}),au=__exportAll$4({BigIntStats:()=>BigIntStats,Dir:()=>Dir,Dirent:()=>Dirent,FSWatcher:()=>FSWatcher,ReadStream:()=>ReadStream,StatWatcher:()=>StatWatcher,Stats:()=>Stats,WriteStream:()=>WriteStream,access:()=>access,accessSync:()=>accessSync,appendFile:()=>appendFile,appendFileSync:()=>appendFileSync,chmod:()=>chmod,chmodSync:()=>chmodSync,chown:()=>chown,chownSync:()=>chownSync,close:()=>close,closeSync:()=>closeSync,constants:()=>ou,copyFile:()=>copyFile,copyFileSync:()=>copyFileSync,cp:()=>cp,cpSync:()=>cpSync,createReadStream:()=>createReadStream,createWriteStream:()=>createWriteStream,default:()=>su,exists:()=>exists,existsSync:()=>existsSync,fchmod:()=>fchmod,fchmodSync:()=>fchmodSync,fchown:()=>fchown,fchownSync:()=>fchownSync,fdatasync:()=>fdatasync,fdatasyncSync:()=>fdatasyncSync,fstat:()=>fstat,fstatSync:()=>fstatSync,fsync:()=>fsync,fsyncSync:()=>fsyncSync,ftruncate:()=>ftruncate,ftruncateSync:()=>ftruncateSync,futimes:()=>futimes,futimesSync:()=>futimesSync,glob:()=>glob,globSync:()=>globSync,lchmod:()=>lchmod,lchmodSync:()=>lchmodSync,lchown:()=>lchown,lchownSync:()=>lchownSync,link:()=>link,linkSync:()=>linkSync,lstat:()=>lstat,lstatSync:()=>lstatSync,lutimes:()=>lutimes,lutimesSync:()=>lutimesSync,mkdir:()=>mkdir,mkdirSync:()=>mkdirSync,mkdtempSync:()=>mkdtempSync,open:()=>open,openAsBlob:()=>openAsBlob,openSync:()=>openSync,opendir:()=>opendir,opendirSync:()=>opendirSync,promises:()=>Rl,read:()=>read,readFile:()=>readFile,readFileSync:()=>readFileSync,readSync:()=>readSync,readdir:()=>readdir,readdirSync:()=>readdirSync,readlink:()=>readlink,readlinkSync:()=>readlinkSync,readv:()=>readv,readvSync:()=>readvSync,realpath:()=>realpath,realpathSync:()=>realpathSync,rename:()=>rename,renameSync:()=>renameSync,rm:()=>rm,rmSync:()=>rmSync,rmdir:()=>rmdir,rmdirSync:()=>rmdirSync,stat:()=>stat,statSync:()=>statSync,statfs:()=>statfs,statfsSync:()=>statfsSync,symlink:()=>symlink,symlinkSync:()=>symlinkSync,truncate:()=>truncate,truncateSync:()=>truncateSync,unlink:()=>unlink,unlinkSync:()=>unlinkSync,unwatchFile:()=>unwatchFile,utimes:()=>utimes,utimesSync:()=>utimesSync,watch:()=>watch,watchFile:()=>watchFile,write:()=>write,writeFile:()=>writeFile,writeFileSync:()=>writeFileSync,writeSync:()=>writeSync,writev:()=>writev,writevSync:()=>writevSync}),ou,su,cu=__esmMin(()=>{nu(),El(),Wl(),Cl(),Tl(),$l(),Ol(),Al(),jl(),Pl(),Il(),Ll(),Bl(),Vl(),iu(),ou={F_OK:0,R_OK:4,W_OK:2,X_OK:1,COPYFILE_EXCL:1,COPYFILE_FICLONE:2,COPYFILE_FICLONE_FORCE:4,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,O_CREAT:64,O_EXCL:128,O_TRUNC:512,O_APPEND:1024,O_SYNC:1052672,O_NONBLOCK:2048,O_DIRECTORY:65536,O_NOFOLLOW:131072,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1},su={FSWatcher,StatWatcher,Stats,BigIntStats,Dirent,Dir,constants:ou,existsSync,readdirSync,readFileSync,writeFileSync,mkdirSync,rmdirSync,unlinkSync,mkdtempSync,rmSync,statSync,openSync,realpathSync,symlinkSync,lstatSync,renameSync,copyFileSync,accessSync,appendFileSync,readlinkSync,linkSync,truncateSync,chmodSync,chownSync,cpSync,opendirSync,globSync,glob,watch,watchFile,unwatchFile,statfsSync,statfs,utimesSync,utimes,lutimesSync,lutimes,lchownSync,lchown,lchmodSync,lchmod,fstatSync,fstat,ftruncateSync,ftruncate,fdatasyncSync,fdatasync,fsyncSync,fsync,fchmodSync,fchmod,fchownSync,fchown,futimesSync,futimes,closeSync,readSync,writeSync,readvSync,readv,writevSync,writev,exists,openAsBlob,createReadStream,ReadStream,createWriteStream,WriteStream,promises:Rl,open,close,read,write,rm,realpath,readdir,symlink,lstat,stat,rename,copyFile,cp,access,appendFile,readlink,truncate,chmod,chown,mkdir,rmdir,readFile,writeFile,unlink,link,opendir}}),lu=__commonJSMin(((e,t)=>{var n=bo()(`express:view`),r=(_o(),__toCommonJS(to)),i=(cu(),__toCommonJS(au)),a=r.dirname,o=r.basename,s=r.extname,c=r.join,l=r.resolve;t.exports=View;function View(e,t){var r=t||{};if(this.defaultEngine=r.defaultEngine,this.ext=s(e),this.name=e,this.root=r.root,!this.ext&&!this.defaultEngine)throw Error(`No default engine was specified and no extension was provided.`);var i=e;if(this.ext||(this.ext=this.defaultEngine[0]===`.`?this.defaultEngine:`.`+this.defaultEngine,i+=this.ext),!r.engines[this.ext]){var a=this.ext.slice(1);n(`require "%s"`,a);var o=v(a).__express;if(typeof o!=`function`)throw Error(`Module "`+a+`" does not provide a view engine.`);r.engines[this.ext]=o}this.engine=r.engines[this.ext],this.path=this.lookup(i)}View.prototype.lookup=function lookup(e){var t,r=[].concat(this.root);n(`lookup "%s"`,e);for(var i=0;i<r.length&&!t;i++){var s=r[i],c=l(s,e),u=a(c),d=o(c);t=this.resolve(u,d)}return t},View.prototype.render=function render(e,t){var r=!0;n(`render "%s"`,this.path),this.engine(this.path,e,function onRender(){if(!r)return t.apply(this,arguments);for(var e=Array(arguments.length),n=this,i=0;i<arguments.length;i++)e[i]=arguments[i];return process.nextTick(function renderTick(){return t.apply(n,e)})}),r=!1},View.prototype.resolve=function resolve(e,t){var n=this.ext,r=c(e,t),i=tryStat(r);if(i&&i.isFile()||(r=c(e,o(t,n),`index`+n),i=tryStat(r),i&&i.isFile()))return r};function tryStat(e){n(`stat "%s"`,e);try{return i.statSync(e)}catch{return}}})),uu,du,fu=__esmMin(()=>{uu={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,510:`Not Extended`,511:`Network Authentication Required`},du=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PRI.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`)}),IncomingMessage,pu=__esmMin(()=>{q(),Zr(),IncomingMessage=class extends Gr{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];method;url;statusCode;statusMessage;complete=!1;socket=null;aborted=!1;get connection(){return this.socket}_timeoutTimer=null;constructor(){super()}_read(e){}_autoClose(){}_pushBody(e){e&&e.length>0&&this.push(K.from(e)),this.push(null),this.complete=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null)}setTimeout(e,t){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}destroy(e){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this.aborted=!0,super.destroy(e)}}}),ServerRequestSocket,mu=__esmMin(()=>{Zr(),ServerRequestSocket=class extends qr{remoteAddress;remotePort;localAddress;localPort;remoteFamily=`IPv4`;encrypted;connecting=!1;pending=!1;bytesRead=0;bytesWritten=0;_bridgeRes;_bridgePaused=!1;constructor(e,t,n,r,i,a=!1){super({allowHalfOpen:!0}),this.remoteAddress=e,this.remotePort=t,this.localAddress=n,this.localPort=r,this.encrypted=a,this._bridgeRes=i}pause(){return this._bridgePaused?this:(this._bridgePaused=!0,super.pause())}resume(){return this._bridgePaused&&=!1,super.resume()}_read(e){}_write(e,t,n){n()}destroySoon(){this.writableEnded||this.end(),this.writableFinished?this.destroy():this.once(`finish`,()=>this.destroy())}setTimeout(e,t){return t&&this.once(`timeout`,t),this}setNoDelay(e){return this}setKeepAlive(e,t){return this}ref(){return this}unref(){return this}address(){return{address:this.localAddress,family:`IPv4`,port:this.localPort}}}}),Socket,hu=__esmMin(()=>{N(),A(),Zr(),q(),L(),Socket=class extends qr{remoteAddress;remotePort;remoteFamily;localAddress;localPort;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!0;readyState=`closed`;_connection=null;_ioStream=null;_inputStream=null;_outputStream=null;_cancellable=new M.Cancellable;_reading=!1;_timeout=0;_timeoutId=null;constructor(e){super(e),this.allowHalfOpen=e?.allowHalfOpen??!1}_setConnection(e){this._connection=e}_setupFromIOStream(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===M.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),this._startReading()}_attachOutputOnly(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===M.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`)}_releaseIOStream(){let e=this._ioStream;return this._ioStream=null,this._inputStream=null,this._outputStream=null,this._connection=null,e}connect(e,t,n){let r;typeof e==`number`?(r={port:e,host:typeof t==`string`?t:`localhost`},typeof t==`function`&&(n=t)):(r=e,typeof t==`function`&&(n=t)),n&&this.once(`connect`,n),this.connecting=!0,this.readyState=`opening`,this.pending=!0;let i=r.host||`localhost`,a=r.port,o=new M.SocketClient;return r.timeout&&o.set_timeout(Math.ceil(r.timeout/1e3)),o.connect_to_host_async(i,a,this._cancellable,(e,t)=>{try{this._connection=o.connect_to_host_finish(t),this._setupConnection(r)}catch(e){this.connecting=!1,this.readyState=`closed`;let t=createNodeError$1(e,`connect`,{address:i,port:a});this.destroy(t)}}),this}_setupConnection(e){if(!this._connection)return;let t=this._connection.get_socket();if(this._inputStream=this._connection.get_input_stream(),this._outputStream=this._connection.get_output_stream(),`keepAlive`in e&&e.keepAlive&&t.set_keepalive(!0),!(`noDelay`in e)||e.noDelay!==!1)try{t.set_option(6,1,1)}catch{}try{let e=this._connection.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===M.SocketFamily.IPV6?`IPv6`:`IPv4`}catch{}try{let e=this._connection.get_local_address();this.localAddress=e.get_address().to_string(),this.localPort=e.get_port()}catch{}this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),this._startReading()}_startReading(){this._reading||!this._inputStream||(this._reading=!0,this._readLoop())}async _readLoop(){let e=this._inputStream;if(e)try{for(;this._reading&&e;){let t=await new Promise((t,n)=>{e.read_bytes_async(16384,k.PRIORITY_DEFAULT,this._cancellable,(r,i)=>{try{t(e.read_bytes_finish(i))}catch(e){n(e)}})});if(!t||t.get_size()===0){this._reading=!1,this.allowHalfOpen?this.readyState=this.writable?`writeOnly`:`closed`:this.once(`end`,()=>{this.end(),this.readyState=`closed`}),this.push(null);break}let n=gbytesToUint8Array(t);if(this.bytesRead+=n.length,this._resetTimeout(),!this.push(K.from(n))){this._reading=!1;break}}}catch(e){this._cancellable.is_cancelled()||this.destroy(createNodeError$1(e,`read`,{address:this.remoteAddress}))}}_read(e){!this._reading&&this._inputStream&&this._startReading()}_write(e,t,n){if(!this._outputStream){n(Error(`Socket is not connected`));return}let r=K.isBuffer(e)?e:typeof e==`string`?K.from(e,t):K.from(e);this._outputStream.write_bytes_async(new k.Bytes(r),k.PRIORITY_DEFAULT,this._cancellable,(e,t)=>{try{let e=this._outputStream.write_bytes_finish(t);this.bytesWritten+=e,this._resetTimeout(),n(null)}catch(e){n(createNodeError$1(e,`write`,{address:this.remoteAddress}))}})}_final(e){if(this._connection)try{this._connection.get_socket().shutdown(!1,!0),this.readyState=this.readable?`readOnly`:`closed`}catch{}else if(this._ioStream){try{this._ioStream.close(null),this.readyState=`closed`}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null}e()}_destroy(e,t){if(this._reading=!1,this._clearTimeout(),this._cancellable.cancel(),this._connection){try{this._connection.close(null)}catch{}this._connection=null}else if(this._ioStream)try{this._ioStream.close(null)}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null,this.readyState=`closed`,this.destroyed=!0,t(e)}setTimeout(e,t){return this._timeout=e,this._clearTimeout(),t&&this.once(`timeout`,t),e>0&&this._resetTimeout(),this}_resetTimeout(){this._clearTimeout(),this._timeout>0&&(this._timeoutId=setTimeout(()=>{this.emit(`timeout`)},this._timeout))}_clearTimeout(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}setKeepAlive(e,t){if(this._connection)try{this._connection.get_socket().set_keepalive(e??!1)}catch{}return this}setNoDelay(e){if(this._connection)try{this._connection.get_socket().set_option(6,1,e===!1?0:1)}catch{}return this}destroySoon(){this.writable&&this.end(),this.writableFinished?this.destroy():this.once(`finish`,this.destroy.bind(this))}address(){return this.localAddress&&this.localPort?{port:this.localPort,family:this.remoteFamily||`IPv4`,address:this.localAddress}:{}}ref(){return this}unref(){return this}}}),gu,_u=__esmMin(()=>{gu=l.Server,l.Request,l.Response}),OutgoingMessage,ServerResponse,vu,Server$1,yu=__esmMin(()=>{I(),mu(),fu(),pu(),q(),L(),bn(),Zr(),hu(),_u(),OutgoingMessage=class extends Kr{headersSent=!1;sendDate=!0;finished=!1;socket=null;_headers=new Map;setHeader(e,t){return this._headers.set(e.toLowerCase(),typeof t==`number`?String(t):t),this}getHeader(e){return this._headers.get(e.toLowerCase())}removeHeader(e){this._headers.delete(e.toLowerCase())}hasHeader(e){return this._headers.has(e.toLowerCase())}getHeaderNames(){return Array.from(this._headers.keys())}getHeaders(){let e={};for(let[t,n]of this._headers)e[t]=n;return e}appendHeader(e,t){let n=e.toLowerCase(),r=this._headers.get(n);return r===void 0?this._headers.set(n,t):Array.isArray(r)?Array.isArray(t)?r.push(...t):r.push(t):Array.isArray(t)?this._headers.set(n,[r,...t]):this._headers.set(n,[r,t]),this}flushHeaders(){this.headersSent=!0}_write(e,t,n){n()}},ServerResponse=class extends OutgoingMessage{statusCode=200;statusMessage=``;_streaming=!1;_bridge;_timeoutTimer=null;constructor(e){super(),this._bridge=e,e.connect(`close`,()=>{this.emit(`close`)})}setTimeout(e,t){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}writeHead(e,t,n){if(this.statusCode=e,typeof t==`object`&&(n=t,t=void 0),this.statusMessage=t||uu[e]||``,n)for(let[e,t]of Object.entries(n))this.setHeader(e,t);return this}writeContinue(e){e&&Promise.resolve().then(e)}writeProcessing(e){e&&Promise.resolve().then(e)}flushHeaders(){this.headersSent||=!0}addTrailers(e){for(let[t,n]of Object.entries(e))this._headers.set(`trailer-`+t.toLowerCase(),n)}_startStreaming(){if(!this._streaming){this._streaming=!0,this.headersSent=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null);for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}}_write(e,t,n){let r=K.isBuffer(e)?e:typeof e==`string`?K.from(e,t):K.from(e);this._startStreaming(),this._bridge.write_chunk(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),n()}_final(e){if(!this._streaming){for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}this._bridge.end(),this.finished=!0,e()}end(e,t,n){return typeof e==`function`?(n=e,e=void 0):typeof t==`function`&&(n=t,t=void 0),e!=null&&this.write(e,t),super.end(n),this}},vu=new Set,Server$1=class extends J{static{__name(this,`Server`)}listening=!1;maxHeadersCount=2e3;timeout=0;keepAliveTimeout=5e3;headersTimeout=6e4;requestTimeout=3e5;_bridge=null;_address=null;get soupServer(){return this._bridge?.soup_server??null}constructor(e,t){super();let n=typeof e==`function`?e:t;n&&this.on(`request`,n)}listen(...e){let t=0,n=`0.0.0.0`,r;for(let i of e)typeof i==`number`?t=i:typeof i==`string`?n=i:typeof i==`function`&&(r=i);r&&this.once(`listening`,r);try{this._bridge=new gu,this._bridge.connect(`request-received`,(e,t,n)=>{this._handleRequest(t,n)}),this._bridge.connect(`upgrade`,(e,t,n,r)=>{this._handleUpgrade(t,n)}),this._bridge.connect(`error-occurred`,(e,t)=>{this.emit(`error`,Error(t))}),this._bridge.listen(t,n),ensureMainLoop(),this.listening=!0,this._address={port:this._bridge.port,family:`IPv4`,address:this._bridge.address||n},vu.add(this),deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleRequest(e,t){let n=new IncomingMessage,r=new ServerResponse(t);n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let i=e.header_pairs??[];for(let e=0;e+1<i.length;e+=2){let t=i[e],r=i[e+1],a=t.toLowerCase();if(n.rawHeaders.push(t,r),a in n.headers){let e=n.headers[a];Array.isArray(e)?e.push(r):n.headers[a]=[e,r]}else n.headers[a]=r}n.socket=new ServerRequestSocket(e.remote_address??`127.0.0.1`,e.remote_port??0,this._address?.address??`127.0.0.1`,this._address?.port??0,t);let a=e.get_body();a.length>0?n._pushBody(a):n._pushBody(null),e.connect(`aborted_signal`,()=>{n.aborted||(n.aborted=!0,n.emit(`aborted`))}),e.connect(`close`,()=>{n.emit(`close`)});try{let e=this.emit(`request`,n,r);(e instanceof Promise||typeof e==`object`&&e&&typeof e.then==`function`)&&e.catch(e=>{if(F.error(`[HTTP] Unhandled error in async request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}})}catch(e){if(F.error(`[HTTP] Unhandled error in request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}}}_handleUpgrade(e,t){let n=new IncomingMessage;n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let r=e.header_pairs??[];for(let e=0;e+1<r.length;e+=2){let t=r[e],i=r[e+1],a=t.toLowerCase();n.rawHeaders.push(t,i),n.headers[a]=i}if(this.listenerCount(`upgrade`)>0){let e=new Socket;e._attachOutputOnly(t),this.emit(`upgrade`,n,e,K.alloc(0))}}address(){return this._address}addWebSocketHandler(e,t){if(!this._bridge)throw Error(`Server must be listening before adding WebSocket handlers. Call listen() first.`);this._bridge.soup_server.add_websocket_handler(e,null,null,(e,n,r,i)=>{t(i)})}close(e){return e&&this.once(`close`,e),this._bridge&&=(this._bridge.close(),null),this.listening=!1,vu.delete(this),deferEmit(this,`close`),this}setTimeout(e,t){return this.timeout=e,t&&this.on(`timeout`,t),this}}}),bu,xu=__esmMin(()=>{bu=u}),Su,Cu=__esmMin(()=>{xu(),Su=bu}),ClientRequest,wu=__esmMin(()=>{pu(),yu(),A(),Cu(),N(),q(),Mn(),L(),ClientRequest=class extends OutgoingMessage{method;path;protocol;host;hostname;port;aborted=!1;reusedSocket=!1;maxHeadersCount=2e3;_chunks=[];_session;_message;_cancellable;_timeout=0;_timeoutTimer=null;_responseCallback;constructor(e,t,n){super();let r;if(typeof e==`string`||e instanceof X){let i=typeof e==`string`?new X(e):e;r={protocol:i.protocol,hostname:i.hostname,port:i.port?Number(i.port):void 0,path:i.pathname+i.search,...typeof t==`object`?t:{}},typeof t==`function`&&(n=t)}else r=e,typeof t==`function`&&(n=t);if(this.method=(r.method||`GET`).toUpperCase(),this.protocol=r.protocol||`http:`,this.hostname=r.hostname||r.host?.split(`:`)[0]||`localhost`,this.port=Number(r.port)||(this.protocol===`https:`?443:80),this.path=r.path||`/`,this.host=r.host||`${this.hostname}:${this.port}`,this._timeout=r.timeout||0,n&&(this._responseCallback=n,this.once(`response`,n)),r.headers)for(let[e,t]of Object.entries(r.headers))this.setHeader(e,t);if(r.setHost!==!1&&!this._headers.has(`host`)){let e=this.protocol===`https:`?443:80,t=this.port===e?this.hostname:`${this.hostname}:${this.port}`;this.setHeader(`Host`,t)}r.auth&&!this._headers.has(`authorization`)&&this.setHeader(`Authorization`,`Basic `+K.from(r.auth).toString(`base64`)),r.signal&&(r.signal.aborted?this.abort():r.signal.addEventListener(`abort`,()=>this.abort(),{once:!0}));let i=k.Uri.parse(this._buildUrl(),k.UriFlags.NONE);this._session=new Su.Session,this._message=new Su.Message({method:this.method,uri:i}),this._cancellable=new M.Cancellable,this._timeout>0&&(this._session.timeout=Math.ceil(this._timeout/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},this._timeout))}_buildUrl(){let e=this.protocol.endsWith(`:`)?this.protocol:this.protocol+`:`,t=e===`https:`?443:80,n=this.port===t?``:`:${this.port}`;return`${e}//${this.hostname}${n}${this.path}`}getRawHeaderNames(){return Array.from(this._headers.keys())}flushHeaders(){this.headersSent||this._applyHeaders()}setTimeout(e,t){return this._timeout=e,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._session.timeout=Math.ceil(e/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}abort(){this.aborted||(this.aborted=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this._cancellable.cancel(),this.emit(`abort`),this.destroy())}_write(e,t,n){let r=K.isBuffer(e)?e:typeof e==`string`?K.from(e,t):K.from(e);this._chunks.push(r),n()}_final(e){this._sendRequest().then(()=>e()).catch(t=>e(t))}_applyHeaders(){if(this.headersSent)return;this.headersSent=!0;let e=this._message.get_request_headers();for(let[t,n]of this._headers)if(Array.isArray(n))for(let r of n)e.append(t,r);else e.replace(t,n)}async _sendRequest(){this._applyHeaders();let e=K.concat(this._chunks);if(e.length>0){let t=this._headers.get(`content-type`)||`application/octet-stream`;this._message.set_request_body_from_bytes(t,new k.Bytes(e))}try{let e=await new Promise((e,t)=>{this._session.send_async(this._message,k.PRIORITY_DEFAULT,this._cancellable,(n,r)=>{try{e(this._session.send_finish(r))}catch(e){t(e)}})}),t=[];try{let n;for(;(n=await readBytesAsync(e,4096,k.PRIORITY_DEFAULT,this._cancellable))!==null;)t.push(K.from(n))}catch{}let n=new IncomingMessage;n.statusCode=this._message.status_code,n.statusMessage=this._message.get_reason_phrase(),n.httpVersion=`1.1`,this._message.get_response_headers().foreach((e,t)=>{let r=e.toLowerCase();if(n.rawHeaders.push(e,t),r in n.headers){let e=n.headers[r];Array.isArray(e)?e.push(t):n.headers[r]=[e,t]}else n.headers[r]=t}),this.finished=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this.emit(`response`,n),setTimeout(()=>{for(let e of t)n.push(e);n.push(null),n.complete=!0},0)}catch(e){this.aborted?this.emit(`abort`):this.emit(`error`,e instanceof Error?e:Error(String(e)))}}}});function validateHeaderName(e){if(typeof e!=`string`||!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_HTTP_TOKEN`}),t}}function validateHeaderValue(e,t){if(t===void 0){let t=TypeError(`Header "${e}" value must not be undefined`);throw Object.defineProperty(t,`code`,{value:`ERR_HTTP_INVALID_HEADER_VALUE`}),t}if(typeof t==`string`&&/[^\t -~-ÿ]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_CHAR`}),t}}var Tu=__esmMin(()=>{}),Eu=__exportAll$4({Agent:()=>Agent,ClientRequest:()=>ClientRequest,IncomingMessage:()=>IncomingMessage,METHODS:()=>du,OutgoingMessage:()=>OutgoingMessage,STATUS_CODES:()=>uu,Server:()=>Server$1,ServerResponse:()=>ServerResponse,createServer:()=>createServer$1,default:()=>ku,get:()=>get,globalAgent:()=>Du,maxHeaderSize:()=>Ou,request:()=>request,setMaxIdleHTTPParsers:()=>setMaxIdleHTTPParsers,validateHeaderName:()=>validateHeaderName,validateHeaderValue:()=>validateHeaderValue});function createServer$1(e,t){return typeof e==`function`?new Server$1(e):new Server$1(t)}function request(e,t,n){return new ClientRequest(e,t,n)}function get(e,t,n){let r,i=n;typeof e==`string`||e instanceof X?(r=typeof t==`object`?{...t,method:`GET`}:{method:`GET`},typeof t==`function`&&(i=t)):(r={...e,method:`GET`},typeof t==`function`&&(i=t),e=r);let a=typeof e==`string`||e instanceof X?new ClientRequest(e,{...r,method:`GET`},i):new ClientRequest({...r,method:`GET`},i);return a.end(),a}function setMaxIdleHTTPParsers(e){}var Agent,Du,Ou,ku,Au=__esmMin(()=>{fu(),pu(),yu(),wu(),Tu(),Mn(),Agent=class{defaultPort=80;protocol=`http:`;maxSockets;maxTotalSockets;maxFreeSockets;keepAliveMsecs;keepAlive;scheduling;requests={};sockets={};freeSockets={};constructor(e){this.keepAlive=e?.keepAlive??!1,this.keepAliveMsecs=e?.keepAliveMsecs??1e3,this.maxSockets=e?.maxSockets??1/0,this.maxTotalSockets=e?.maxTotalSockets??1/0,this.maxFreeSockets=e?.maxFreeSockets??256,this.scheduling=e?.scheduling??`lifo`}destroy(){}getName(e){let t=e.host||`localhost`;return e.port&&(t+=`:`+e.port),e.localAddress&&(t+=`:`+e.localAddress),(e.family===4||e.family===6)&&(t+=`:`+e.family),t}},Du=new Agent,__name(createServer$1,`createServer`),Ou=16384,ku={STATUS_CODES:uu,METHODS:du,Server:Server$1,IncomingMessage,OutgoingMessage,ServerResponse,ClientRequest,Agent,globalAgent:Du,createServer:createServer$1,request,get,validateHeaderName,validateHeaderValue,maxHeaderSize:Ou,setMaxIdleHTTPParsers}}),ju=__commonJSMin(((e,t)=>{t.exports=etag;var n=(xa(),__toCommonJS(ya)),r=(cu(),__toCommonJS(au)).Stats,i=Object.prototype.toString;function entitytag(e){if(e.length===0)return`"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"`;var t=n.createHash(`sha1`).update(e,`utf8`).digest(`base64`).substring(0,27);return`"`+(typeof e==`string`?Buffer.byteLength(e,`utf8`):e.length).toString(16)+`-`+t+`"`}function etag(e,t){if(e==null)throw TypeError(`argument entity is required`);var n=isstats(e),r=t&&typeof t.weak==`boolean`?t.weak:n;if(!n&&typeof e!=`string`&&!Buffer.isBuffer(e))throw TypeError(`argument entity must be string, Buffer, or fs.Stats`);var i=n?stattag(e):entitytag(e);return r?`W/`+i:i}function isstats(e){return typeof r==`function`&&e instanceof r?!0:e&&typeof e==`object`&&`ctime`in e&&i.call(e.ctime)===`[object Date]`&&`mtime`in e&&i.call(e.mtime)===`[object Date]`&&`ino`in e&&typeof e.ino==`number`&&`size`in e&&typeof e.size==`number`}function stattag(e){var t=e.mtime.getTime().toString(16);return`"`+e.size.toString(16)+`-`+t+`"`}})),Mu=__commonJSMin(((e,t)=>{t.exports=forwarded;function forwarded(e){if(!e)throw TypeError(`argument req is required`);var t=parse(e.headers[`x-forwarded-for`]||``);return[getSocketAddr(e)].concat(t)}function getSocketAddr(e){return e.socket?e.socket.remoteAddress:e.connection.remoteAddress}function parse(e){for(var t=e.length,n=[],r=e.length,i=e.length-1;i>=0;i--)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i;break;default:r=i;break}return r!==t&&n.push(e.substring(r,t)),n}})),Nu=__commonJSMin(((e,t)=>{(function(){var expandIPv6,e={},n,r,i,a,matchCIDR,o=this,s;t!=null&&t.exports?t.exports=e:o.ipaddr=e,matchCIDR=function(e,t,n,r){var i,a;if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);for(i=0;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0},e.subnetMatch=function(e,t,n){var r,i,a,o,s;for(a in n??=`unicast`,t)for(o=t[a],o[0]&&!(o[0]instanceof Array)&&(o=[o]),r=0,i=o.length;r<i;r++)if(s=o[r],e.kind()===s[0].kind()&&e.match.apply(e,s))return a;return n},e.IPv4=(function(){function IPv4(e){var t,n,r;if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);for(t=0,n=e.length;t<n;t++)if(r=e[t],!(0<=r&&r<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return IPv4.prototype.kind=function(){return`ipv4`},IPv4.prototype.toString=function(){return this.octets.join(`.`)},IPv4.prototype.toNormalizedString=function(){return this.toString()},IPv4.prototype.toByteArray=function(){return this.octets.slice(0)},IPv4.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return matchCIDR(this.octets,e.octets,8,t)},IPv4.prototype.SpecialRanges={unspecified:[[new IPv4([0,0,0,0]),8]],broadcast:[[new IPv4([255,255,255,255]),32]],multicast:[[new IPv4([224,0,0,0]),4]],linkLocal:[[new IPv4([169,254,0,0]),16]],loopback:[[new IPv4([127,0,0,0]),8]],carrierGradeNat:[[new IPv4([100,64,0,0]),10]],private:[[new IPv4([10,0,0,0]),8],[new IPv4([172,16,0,0]),12],[new IPv4([192,168,0,0]),16]],reserved:[[new IPv4([192,0,0,0]),24],[new IPv4([192,0,2,0]),24],[new IPv4([192,88,99,0]),24],[new IPv4([198,51,100,0]),24],[new IPv4([203,0,113,0]),24],[new IPv4([240,0,0,0]),4]]},IPv4.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv4.prototype.toIPv4MappedAddress=function(){return e.IPv6.parse(`::ffff:`+this.toString())},IPv4.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,a,o={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};for(e=0,i=!1,t=n=3;n>=0;t=n+=-1)if(r=this.octets[t],r in o){if(a=o[r],i&&a!==0)return null;a!==8&&(i=!0),e+=a}else return null;return 32-e},IPv4})(),n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^`+n+`\\.`+n+`\\.`+n+`\\.`+n+`$`,`i`),longValue:RegExp(`^`+n+`$`,`i`)},e.IPv4.parser=function(e){var t,parseIntAuto=function(e){return e[0]===`0`&&e[1]!==`x`?parseInt(e,8):parseInt(e)},n,i,a;if(t=e.match(r.fourOctet))return(function(){var e,r,i=t.slice(1,6),a=[];for(e=0,r=i.length;e<r;e++)n=i[e],a.push(parseIntAuto(n));return a})();if(t=e.match(r.longValue)){if(a=parseIntAuto(t[1]),a>4294967295||a<0)throw Error(`ipaddr: address outside defined range`);return(function(){var e,t=[];for(i=e=0;e<=24;i=e+=8)t.push(a>>i&255);return t})().reverse()}else return null},e.IPv6=(function(){function IPv6(e,t){var n,r,i,a,o,s;if(e.length===16)for(this.parts=[],n=r=0;r<=14;n=r+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(s=this.parts,i=0,a=s.length;i<a;i++)if(o=s[i],!(0<=o&&o<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return IPv6.prototype.kind=function(){return`ipv6`},IPv6.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,`::`)},IPv6.prototype.toRFC5952String=function(){var e,t,n,r=/((^|:)(0(:|$)){2,})/g,i=this.toNormalizedString();for(e=0,t=-1;n=r.exec(i);)n[0].length>t&&(e=n.index,t=n[0].length);return t<0?i:i.substring(0,e)+`::`+i.substring(e+t)},IPv6.prototype.toByteArray=function(){var e=[],t,n,r,i=this.parts;for(t=0,n=i.length;t<n;t++)r=i[t],e.push(r>>8),e.push(r&255);return e},IPv6.prototype.toNormalizedString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.toFixedLengthString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16).padStart(4,`0`));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return matchCIDR(this.parts,e.parts,16,t)},IPv6.prototype.SpecialRanges={unspecified:[new IPv6([0,0,0,0,0,0,0,0]),128],linkLocal:[new IPv6([65152,0,0,0,0,0,0,0]),10],multicast:[new IPv6([65280,0,0,0,0,0,0,0]),8],loopback:[new IPv6([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new IPv6([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new IPv6([0,0,0,0,0,65535,0,0]),96],rfc6145:[new IPv6([0,0,0,0,65535,0,0,0]),96],rfc6052:[new IPv6([100,65435,0,0,0,0,0,0]),96],"6to4":[new IPv6([8194,0,0,0,0,0,0,0]),16],teredo:[new IPv6([8193,0,0,0,0,0,0,0]),32],reserved:[[new IPv6([8193,3512,0,0,0,0,0,0]),32]]},IPv6.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv6.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},IPv6.prototype.toIPv4Address=function(){var t,n,r;if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);return r=this.parts.slice(-2),t=r[0],n=r[1],new e.IPv4([t>>8,t&255,n>>8,n&255])},IPv6.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,a,o={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};for(e=0,i=!1,t=n=7;n>=0;t=n+=-1)if(r=this.parts[t],r in o){if(a=o[r],i&&a!==0)return null;a!==16&&(i=!0),e+=a}else return null;return 128-e},IPv6})(),i=`(?:[0-9a-f]+::?)+`,s=`%[0-9a-z]{1,}`,a={zoneIndex:new RegExp(s,`i`),native:RegExp(`^(::)?(`+i+`)?([0-9a-f]+)?(::)?(`+s+`)?$`,`i`),transitional:RegExp(`^((?:`+i+`)|(?:::)(?:`+i+`)?)`+(n+`\\.`+n+`\\.`+n+`\\.`+n)+(`(`+s+`)?$`),`i`)},expandIPv6=function(e,t){var n,r,i,o,s,c;if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;for(c=(e.match(a.zoneIndex)||[])[0],c&&(c=c.substring(1),e=e.replace(/%.+$/,``)),n=0,r=-1;(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(s=t-n,o=`:`;s--;)o+=`0:`;return e=e.replace(`::`,o),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){var t,n,r=e.split(`:`),a=[];for(t=0,n=r.length;t<n;t++)i=r[t],a.push(parseInt(i,16));return a})(),{parts:t,zoneId:c}},e.IPv6.parser=function(e){var t,n,r,i,o,s,c;if(a.native.test(e))return expandIPv6(e,8);if((i=e.match(a.transitional))&&(c=i[6]||``,t=expandIPv6(i[1].slice(0,-1)+c,6),t.parts)){for(s=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],n=0,r=s.length;n<r;n++)if(o=s[n],!(0<=o&&o<=255))return null;return t.parts.push(s[0]<<8|s[1]),t.parts.push(s[2]<<8|s[3]),{parts:t.parts,zoneId:t.zoneId}}return null},e.IPv4.isIPv4=e.IPv6.isIPv6=function(e){return this.parser(e)!==null},e.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},e.IPv4.isValidFourPartDecimal=function(t){return!!(e.IPv4.isValid(t)&&t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},e.IPv6.isValid=function(e){var t;if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return t=this.parser(e),new this(t.parts,t.zoneId),!0}catch{return!1}},e.IPv4.parse=function(e){var t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t)},e.IPv6.parse=function(e){var t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t.parts,t.zoneId)},e.IPv4.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=32))return r=[this.parse(n[1]),t],Object.defineProperty(r,`toString`,{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},e.IPv4.subnetMaskFromPrefixLength=function(e){var t,n,r;if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);for(r=[0,0,0,0],n=0,t=Math.floor(e/8);n<t;)r[n]=255,n++;return t<4&&(r[t]=2**(e%8)-1<<8-e%8),new this(r)},e.IPv4.broadcastAddressFromCIDR=function(e){var t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)|parseInt(a[n],10)^255),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv4.networkAddressFromCIDR=function(e){var t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv6.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,`toString`,{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},e.isValid=function(t){return e.IPv6.isValid(t)||e.IPv4.isValid(t)},e.parse=function(t){if(e.IPv6.isValid(t))return e.IPv6.parse(t);if(e.IPv4.isValid(t))return e.IPv4.parse(t);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},e.parseCIDR=function(t){try{return e.IPv6.parseCIDR(t)}catch{try{return e.IPv4.parseCIDR(t)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},e.fromByteArray=function(t){var n=t.length;if(n===4)return new e.IPv4(t);if(n===16)return new e.IPv6(t);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},e.process=function(e){var t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t}}).call(e)})),Pu=__commonJSMin(((e,t)=>{t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=Mu(),r=Nu(),i=/^[0-9]+$/,a=r.isValid,o=r.parse,s={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(s,e)&&(e=s[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!a(n))throw TypeError(`invalid IP address: `+n);var r=o(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var s=r.kind()===`ipv6`?128:32,c=t===-1?null:e.substring(t+1,e.length);if(c=c===null?s:i.test(c)?parseInt(c,10):r.kind()===`ipv4`&&a(c)?parseNetmask(c):null,c<=0||c>s)throw TypeError(`invalid range on address: `+e);return[r,c]}function parseNetmask(e){var t=o(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!a(t))return!1;for(var n=o(t),r,i=n.kind(),s=0;s<e.length;s++){var c=e[s],l=c[0],u=l.kind(),d=c[1],p=n;if(i!==u){if(u===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=u===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),p=r}if(p.match(l,d))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!a(e))return!1;var s=o(e);if(s.kind()!==n){if(r&&!s.isIPv4MappedAddress())return!1;s=r?s.toIPv4Address():s.toIPv4MappedAddress()}return s.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,Fu=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),Iu,Lu,Ru,zu,Bu=__esmMin(()=>{Iu=Array.from({length:256});for(let e=0;e<256;++e)Iu[e]=`%`+((e<16?`0`:``)+e.toString(16)).toUpperCase();Lu=new Int8Array([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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,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,1,1,1,1,1,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Ru=new Int8Array([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,0,0,0,0,1,1,1,1,0,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,0,1,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,0]),zu=new Int8Array([-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-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,10,11,12,13,14,15,-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,-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,-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,-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,-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,-1,-1,-1,-1,-1,-1,-1,-1])});function encodeStr(e,t,n){let r=e.length;if(r===0)return``;let i=``,a=0;for(let o=0;o<r;o++){let s=e.charCodeAt(o);if(s<128){if(t[s]===1)continue;a<o&&(i+=e.slice(a,o)),a=o+1,i+=n[s];continue}if(a<o&&(i+=e.slice(a,o)),s<2048){a=o+1,i+=n[192|s>>6]+n[128|s&63];continue}if(s<55296||s>=57344){a=o+1,i+=n[224|s>>12]+n[128|s>>6&63]+n[128|s&63];continue}if(++o,o>=r)throw new ERR_INVALID_URI;let c=e.charCodeAt(o)&1023;a=o+1,s=65536+((s&1023)<<10|c),i+=n[240|s>>18]+n[128|s>>12&63]+n[128|s>>6&63]+n[128|s&63]}return a===0?e:a<r?i+e.slice(a):i}function qsEscape(e){return typeof e!=`string`&&(typeof e==`object`?e=String(e):e+=``),encodeStr(e,Ru,Iu)}var ERR_INVALID_URI,Vu=__esmMin(()=>{Fu(),Bu(),ERR_INVALID_URI=class extends NodeURIError{constructor(){super(`ERR_INVALID_URI`,`URI malformed`)}}});function unescapeBuffer(e,t=!1){let n=new K(e.length),r=0,i=0,a,o,s,c,l=e.length-2,u=!1;for(;r<e.length;){if(a=e.charCodeAt(r),a===43&&t){n[i++]=32,r++;continue}if(a===37&&r<l)if(a=e.charCodeAt(++r),s=zu[a],s>=0)o=e.charCodeAt(++r),c=zu[o],c>=0?(u=!0,a=s*16+c):(n[i++]=37,r--);else{n[i++]=37;continue}n[i++]=a,r++}return u?n.slice(0,i):n}function qsUnescape(e){try{return decodeURIComponent(e)}catch{return unescapeBuffer(e).toString()}}var Hu=__esmMin(()=>{Bu(),q()});function charCodes(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function addKeyVal(e,t,n,r,i,a){if(t.length>0&&r)try{t=a(t)}catch{}if(n.length>0&&i)try{n=a(n)}catch{}if(e[t]===void 0)e[t]=n;else{let r=e[t];r.pop?r[r.length]=n:e[t]=[r,n]}}function parse(e,t=`&`,n=`=`,{decodeURIComponent:r=qsUnescape,maxKeys:i=1e3}={}){let a=Object.create(null);if(typeof e!=`string`||e.length===0)return a;let o=t?charCodes(String(t)):[38],s=n?charCodes(String(n)):[61],c=o.length,l=s.length,u=1e3;typeof i==`number`&&(u=i>0?i:-1);let d=qsUnescape;r&&(d=r);let p=d!==qsUnescape,m=0,h=0,g=0,_=``,v=``,y=p,b=p,x=p?`%20`:` `,S=0;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n===o[h]){if(++h===c){let n=t-h+1;if(g<l){if(m<n)_+=e.slice(m,n);else if(_.length===0){if(--u===0)return a;m=t+1,h=g=0;continue}}else m<n&&(v+=e.slice(m,n));if(addKeyVal(a,_,v,y,b,d),--u===0)return a;_=v=``,S=0,m=t+1,h=g=0}}else{if(h=0,g<l){if(n===s[g]){if(++g===l){let n=t-g+1;m<n&&(_+=e.slice(m,n)),S=0,m=t+1}continue}else if(g=0,!y){if(n===37){S=1;continue}else if(S>0)if(Lu[n]===1){++S===3&&(y=!0);continue}else S=0}if(n===43){m<t&&(_+=e.slice(m,t)),_+=x,m=t+1;continue}}n===43?(m<t&&(v+=e.slice(m,t)),v+=x,m=t+1):b||(n===37?S=1:S>0&&(Lu[n]===1?++S===3&&(b=!0):S=0))}}if(m<e.length)g<l?_+=e.slice(m):h<c&&(v+=e.slice(m));else if(g===0&&_.length===0)return a;return addKeyVal(a,_,v,y,b,d),a}var Uu=__esmMin(()=>{Bu(),Hu()});function stringifyPrimitive(e){return typeof e==`string`?e:typeof e==`number`&&isFinite(e)||typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function encodeStringifiedCustom(e,t){return t(stringifyPrimitive(e))}function encodeStringified(e,t){return typeof e==`string`?e.length?t(e):``:typeof e==`number`&&isFinite(e)?Math.abs(e)<1e21?``+e:t(``+e):typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function stringify(e,t,n,r){t||=`&`,n||=`=`;let i=r?r.encodeURIComponent:qsEscape,a=r?encodeStringifiedCustom:encodeStringified;if(typeof e==`object`&&e){let r=Object.keys(e),o=r.length,s=``;for(let c=0;c<o;++c){let o=r[c],l=e[o],u=a(o,i);if(u+=n,Array.isArray(l)){let e=l.length;if(e===0)continue;s&&(s+=t);for(let n=0;n<e;++n)n&&(s+=t),s+=u,s+=a(l[n],i)}else s&&(s+=t),s+=u,s+=a(l,i)}return s}return``}var Wu=__esmMin(()=>{Vu()}),Gu=__exportAll$4({ERR_INVALID_URI:()=>ERR_INVALID_URI,decode:()=>Ku,default:()=>Xu,encode:()=>qu,escape:()=>Ju,parse:()=>parse,stringify:()=>stringify,unescape:()=>Yu,unescapeBuffer:()=>unescapeBuffer}),Ku,qu,Ju,Yu,Xu,Zu=__esmMin(()=>{Vu(),Hu(),Uu(),Wu(),Ku=parse,qu=stringify,Ju=qsEscape,Yu=qsUnescape,Xu={parse,stringify,decode:Ku,encode:qu,unescape:Yu,escape:Ju,unescapeBuffer}}),Qu=__commonJSMin((e=>{var{METHODS:t}=(Au(),__toCommonJS(Eu)),n=gs(),r=ju(),i=ps(),a=Pu(),o=fl(),s=(Zu(),__toCommonJS(Gu));let{Buffer:c}=(q(),__toCommonJS(Xt));e.methods=t.map(e=>e.toLowerCase()),e.etag=createETagGenerator({weak:!1}),e.wetag=createETagGenerator({weak:!0}),e.normalizeType=function(e){return~e.indexOf(`/`)?acceptParams(e):{value:i.lookup(e)||`application/octet-stream`,params:{}}},e.normalizeTypes=function(t){return t.map(e.normalizeType)};function acceptParams(e){for(var t=e.length,n=e.indexOf(`;`),r=n===-1?t:n,i={value:e.slice(0,r).trim(),quality:1,params:{}};r<t;){var a=e.indexOf(`=`,r);if(a===-1)break;var n=e.indexOf(`;`,r),o=n===-1?t:n;if(a>o){r=e.lastIndexOf(`;`,a-1)+1;continue}var s=e.slice(r,a).trim(),c=e.slice(a+1,o).trim();s===`q`?i.quality=parseFloat(c):i.params[s]=c,r=o+1}return i}e.compileETag=function(t){var n;if(typeof t==`function`)return t;switch(t){case!0:case`weak`:n=e.wetag;break;case!1:break;case`strong`:n=e.etag;break;default:throw TypeError(`unknown value for etag function: `+t)}return n},e.compileQueryParser=function compileQueryParser(e){var t;if(typeof e==`function`)return e;switch(e){case!0:case`simple`:t=s.parse;break;case!1:break;case`extended`:t=parseExtendedQueryString;break;default:throw TypeError(`unknown value for query parser function: `+e)}return t},e.compileTrust=function(e){return typeof e==`function`?e:e===!0?function(){return!0}:typeof e==`number`?function(t,n){return n<e}:(typeof e==`string`&&(e=e.split(`,`).map(function(e){return e.trim()})),a.compile(e||[]))},e.setCharset=function setCharset(e,t){if(!e||!t)return e;var r=n.parse(e);return r.parameters.charset=t,n.format(r)};function createETagGenerator(e){return function generateETag(t,n){return r(c.isBuffer(t)?t:c.from(t,n),e)}}function parseExtendedQueryString(e){return o.parse(e,{allowPrototypes:!0})}})),$u=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),ed=__commonJSMin(((e,t)=>{var n=$u();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,`once`,{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,`onceStrict`,{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),td=__exportAll$4({default:()=>isPromise});function isPromise(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var nd=__esmMin(()=>{}),rd=__commonJSMin((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.PathError=e.TokenData=void 0,e.parse=parse,e.compile=compile,e.match=match,e.pathToRegexp=pathToRegexp,e.stringify=stringify;let NOOP_VALUE=e=>e,t=/^[$_\p{ID_Start}]$/u,n=/^[$\u200c\u200d\p{ID_Continue}]$/u,r=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;function escapeText(e){return e.replace(/[{}()\[\]+?!:*\\]/g,`\\$&`)}function escape(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,`\\$&`)}var TokenData=class{constructor(e,t){this.tokens=e,this.originalPath=t}};e.TokenData=TokenData;var PathError=class extends TypeError{constructor(e,t){let n=e;t&&(n+=`: ${t}`),n+=`; visit https://git.new/pathToRegexpError for info`,super(n),this.originalPath=t}};e.PathError=PathError;function parse(e,r={}){let{encodePath:i=NOOP_VALUE}=r,a=[...e],o=0;function consumeUntil(r){let s=[],c=``;function writePath(){c&&=(s.push({type:`text`,value:i(c)}),``)}for(;o<a.length;){let i=a[o++];if(i===r)return writePath(),s;if(i===`\\`){if(o===a.length)throw new PathError(`Unexpected end after \\ at index ${o}`,e);c+=a[o++];continue}if(i===`:`||i===`*`){let r=i===`:`?`param`:`wildcard`,c=``;if(t.test(a[o]))do c+=a[o++];while(n.test(a[o]));else if(a[o]===`"`){let t=o;for(;o<a.length;){if(a[++o]===`"`){o++,t=0;break}a[o]===`\\`&&o++,c+=a[o]}if(t)throw new PathError(`Unterminated quote at index ${t}`,e)}if(!c)throw new PathError(`Missing parameter name at index ${o}`,e);writePath(),s.push({type:r,name:c});continue}if(i===`{`){writePath(),s.push({type:`group`,tokens:consumeUntil(`}`)});continue}if(i===`}`||i===`(`||i===`)`||i===`[`||i===`]`||i===`+`||i===`?`||i===`!`)throw new PathError(`Unexpected ${i} at index ${o-1}`,e);c+=i}if(r)throw new PathError(`Unexpected end at index ${o}, expected ${r}`,e);return writePath(),s}return new TokenData(consumeUntil(``),e)}function compile(e,t={}){let{encode:n=encodeURIComponent,delimiter:r=`/`}=t,i=tokensToFunction((typeof e==`object`?e:parse(e,t)).tokens,r,n);return function path(e={}){let t=[],n=i(e,t);if(t.length)throw TypeError(`Missing parameters: ${t.join(`, `)}`);return n}}function tokensToFunction(e,t,n){let r=e.map(e=>tokenToFunction(e,t,n));return(e,t)=>{let n=``;for(let i of r)n+=i(e,t);return n}}function tokenToFunction(e,t,n){if(e.type===`text`)return()=>e.value;if(e.type===`group`){let r=tokensToFunction(e.tokens,t,n);return(e,t)=>{let n=t.length,i=r(e,t);return t.length===n?i:(t.length=n,``)}}let r=n||NOOP_VALUE;return e.type===`wildcard`&&n!==!1?(n,i)=>{let a=n[e.name];if(a==null)return i.push(e.name),``;if(!Array.isArray(a)||a.length===0)throw TypeError(`Expected "${e.name}" to be a non-empty array`);let o=``;for(let n=0;n<a.length;n++){if(typeof a[n]!=`string`)throw TypeError(`Expected "${e.name}/${n}" to be a string`);n>0&&(o+=t),o+=r(a[n])}return o}:(t,n)=>{let i=t[e.name];if(i==null)return n.push(e.name),``;if(typeof i!=`string`)throw TypeError(`Expected "${e.name}" to be a string`);return r(i)}}function match(e,t={}){let{decode:n=decodeURIComponent,delimiter:r=`/`}=t,{regexp:i,keys:a}=pathToRegexp(e,t),o=a.map(e=>n===!1?NOOP_VALUE:e.type===`param`?n:e=>e.split(r).map(n));return function match(e){let t=i.exec(e);if(!t)return!1;let n=t[0],r=Object.create(null);for(let e=1;e<t.length;e++){if(t[e]===void 0)continue;let n=a[e-1],i=o[e-1];r[n.name]=i(t[e])}return{path:n,params:r}}}function pathToRegexp(e,t={}){let{delimiter:n=`/`,end:r=!0,sensitive:i=!1,trailing:a=!0}=t,o=[],s=``,c=0;function process(e){if(Array.isArray(e)){for(let t of e)process(t);return}let r=typeof e==`object`?e:parse(e,t);flatten(r.tokens,0,[],e=>{if(c>=256)throw new PathError(`Too many path combinations`,r.originalPath);c>0&&(s+=`|`),s+=toRegExpSource(e,n,o,r.originalPath),c++})}process(e);let l=`^(?:${s})`;return a&&(l+=`(?:`+escape(n)+`$)?`),l+=r?`$`:`(?=`+escape(n)+`|$)`,{regexp:new RegExp(l,i?``:`i`),keys:o}}function flatten(e,t,n,r){for(;t<e.length;){let i=e[t++];if(i.type===`group`){let a=n.length;flatten(i.tokens,0,n,n=>flatten(e,t,n,r)),n.length=a;continue}n.push(i)}r(n)}function toRegExpSource(e,t,n,r){let i=``,a=``,o=``,s=0,c=0,l=0;function hasInSegment(n,r){for(;n<e.length;){let i=e[n++];if(i.type===r)return!0;if(i.type===`text`&&i.value.includes(t))break}return!1}function peekText(t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type!==`text`)break;n+=r.value}return n}for(;l<e.length;){let u=e[l++];if(u.type===`text`){i+=escape(u.value),a+=u.value,s===2&&(o+=u.value),u.value.includes(t)&&(c=0);continue}if(u.type===`param`||u.type===`wildcard`){if(s&&!a)throw new PathError(`Missing text before "${u.name}" ${u.type}`,r);u.type===`param`?(i+=c&2?`(${negate(t,a)}+)`:hasInSegment(l,`wildcard`)?`(${negate(t,peekText(l))}+)`:c&1?`(${negate(t,a)}+|${escape(a)})`:`(${negate(t,``)}+)`,c|=s=1):(i+=c&2?`(${negate(a,``)}+)`:o?`(${negate(o,``)}+|${negate(t,``)}+)`:`([^]+)`,o=``,c|=s=2),n.push(u),a=``;continue}throw TypeError(`Unknown token type: ${u.type}`)}return i}function negate(e,t){return t.length>e.length?negate(t,e):(e===t&&(t=``),t.length>1?`(?:(?!${escape(e)}|${escape(t)})[^])`:e.length>1?`(?:(?!${escape(e)})[^${escape(t)}])`:`[^${escape(e+t)}]`)}function stringifyTokens(e,t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type===`text`){n+=escapeText(r.value);continue}if(r.type===`group`){n+=`{`+stringifyTokens(r.tokens,0)+`}`;continue}if(r.type===`param`){n+=`:`+stringifyName(r.name,e[t]);continue}if(r.type===`wildcard`){n+=`*`+stringifyName(r.name,e[t]);continue}throw TypeError(`Unknown token type: ${r.type}`)}return n}function stringify(e){return stringifyTokens(e.tokens,0)}function stringifyName(e,t){return!r.test(e)||t?.type===`text`&&n.test(t.value[0])?JSON.stringify(e):e}})),id=__commonJSMin(((e,t)=>{let n=(nd(),__toCommonJS(td)),r=rd(),i=bo()(`router:layer`),a=xo()(`router`),o=/\/+$/,s=/\((?:\?<(.*?)>)?(?!\?)/g;t.exports=Layer;function Layer(e,t,n){if(!(this instanceof Layer))return new Layer(e,t,n);i(`new %o`,e);let a=t||{};this.handle=n,this.keys=[],this.name=n.name||`<anonymous>`,this.params=void 0,this.path=void 0,this.slash=e===`/`&&a.end===!1;function matcher(e){if(e instanceof RegExp){let t=[],n=0,r;for(;r=s.exec(e.source);)t.push({name:r[1]||n++,offset:r.index});return function regexpMatcher(n){let r=e.exec(n);if(!r)return!1;let i={};for(let e=1;e<r.length;e++){let n=t[e-1].name,a=decodeParam(r[e]);a!==void 0&&(i[n]=a)}return{params:i,path:r[0]}}}return r.match(a.strict?e:loosen(e),{sensitive:a.sensitive,end:a.end,trailing:!a.strict,decode:decodeParam})}this.matchers=Array.isArray(e)?e.map(matcher):[matcher(e)]}Layer.prototype.handleError=function handleError(e,t,r,i){let o=this.handle;if(o.length!==4)return i(e);try{let s=o(e,t,r,i);n(s)&&(s instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),s.then(null,function(e){i(e||Error(`Rejected promise`))}))}catch(e){i(e)}},Layer.prototype.handleRequest=function handleRequest(e,t,r){let i=this.handle;if(i.length>3)return r();try{let o=i(e,t,r);n(o)&&(o instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),o.then(null,function(e){r(e||Error(`Rejected promise`))}))}catch(e){r(e)}},Layer.prototype.match=function match(e){let t;if(e!=null){if(this.slash)return this.params={},this.path=``,!0;let n=0;for(;!t&&n<this.matchers.length;)t=this.matchers[n](e),n++}return t?(this.params=t.params,this.path=t.path,this.keys=Object.keys(t.params),!0):(this.params=void 0,this.path=void 0,!1)};function decodeParam(e){if(typeof e!=`string`||e.length===0)return e;try{return decodeURIComponent(e)}catch(t){throw t instanceof URIError&&(t.message=`Failed to decode param '`+e+`'`,t.status=400),t}}function loosen(e){return e instanceof RegExp||e===`/`?e:Array.isArray(e)?e.map(function(e){return loosen(e)}):String(e).replace(o,``)}})),ad=__commonJSMin(((e,t)=>{let n=bo()(`router:route`),r=id(),{METHODS:i}=(Au(),__toCommonJS(Eu)),a=Array.prototype.slice,o=Array.prototype.flat,s=i.map(e=>e.toLowerCase());t.exports=Route;function Route(e){n(`new %o`,e),this.path=e,this.stack=[],this.methods=Object.create(null)}Route.prototype._handlesMethod=function _handlesMethod(e){if(this.methods._all)return!0;let t=typeof e==`string`?e.toLowerCase():e;return t===`head`&&!this.methods.head&&(t=`get`),!!this.methods[t]},Route.prototype._methods=function _methods(){let e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push(`head`);for(let t=0;t<e.length;t++)e[t]=e[t].toUpperCase();return e},Route.prototype.dispatch=function dispatch(e,t,n){let r=0,i=this.stack,a=0;if(i.length===0)return n();let o=typeof e.method==`string`?e.method.toLowerCase():e.method;o===`head`&&!this.methods.head&&(o=`get`),e.route=this,next();function next(s){if(s&&s===`route`)return n();if(s&&s===`router`||r>=i.length)return n(s);if(++a>100)return setImmediate(next,s);let c,l;for(;l!==!0&&r<i.length;)c=i[r++],l=!c.method||c.method===o;if(l!==!0)return n(s);s?c.handleError(s,e,t,next):c.handleRequest(e,t,next),a=0}},Route.prototype.all=function all(e){let t=o.call(a.call(arguments),1/0);if(t.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=`function`)throw TypeError(`argument handler must be a function`);let i=r(`/`,{},n);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},s.forEach(function(e){Route.prototype[e]=function(t){let i=o.call(a.call(arguments),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let t=0;t<i.length;t++){let a=i[t];if(typeof a!=`function`)throw TypeError(`argument handler must be a function`);n(`%s %s`,e,this.path);let o=r(`/`,{},a);o.method=e,this.methods[e]=!0,this.stack.push(o)}return this}})})),od=__commonJSMin(((e,t)=>{let n=(nd(),__toCommonJS(td)),r=id(),{METHODS:i}=(Au(),__toCommonJS(Eu)),a=vl(),o=ad(),s=bo()(`router`),c=xo()(`router`),l=Array.prototype.slice,u=Array.prototype.flat,d=i.map(e=>e.toLowerCase());t.exports=Router,t.exports.Route=o;function Router(e){if(!(this instanceof Router))return new Router(e);let t=e||{};function router(e,t,n){router.handle(e,t,n)}return Object.setPrototypeOf(router,this),router.caseSensitive=t.caseSensitive,router.mergeParams=t.mergeParams,router.params={},router.strict=t.strict,router.stack=[],router}Router.prototype=function(){},Router.prototype.param=function param(e,t){if(!e)throw TypeError(`argument name is required`);if(typeof e!=`string`)throw TypeError(`argument name must be a string`);if(!t)throw TypeError(`argument fn is required`);if(typeof t!=`function`)throw TypeError(`argument fn must be a function`);let n=this.params[e];return n||=this.params[e]=[],n.push(t),this},Router.prototype.handle=function handle(e,t,n){if(!n)throw TypeError(`argument callback is required`);s(`dispatching %s %s`,e.method,e.url);let r=0,i,a=getProtohost(e.url)||``,o=``,c=this,l=!1,u=0,d={},p=this.stack,m=e.params,h=e.baseUrl||``,g=restore(n,e,`baseUrl`,`next`,`params`);e.next=next,e.method===`OPTIONS`&&(i=[],g=wrap(g,generateOptionsResponder(t,i))),e.baseUrl=h,e.originalUrl=e.originalUrl||e.url,next();function next(n){let s=n===`route`?null:n;if(l&&=(e.url=e.url.slice(1),!1),o.length!==0&&(e.baseUrl=h,e.url=a+o+e.url.slice(a.length),o=``),s===`router`){setImmediate(g,null);return}if(r>=p.length){setImmediate(g,s);return}if(++u>100)return setImmediate(next,n);let _=getPathname(e);if(_==null)return g(s);let v,y,b;for(;y!==!0&&r<p.length;){if(v=p[r++],y=matchLayer(v,_),b=v.route,typeof y!=`boolean`&&(s||=y),y!==!0||!b)continue;if(s){y=!1;continue}let t=e.method,n=b._handlesMethod(t);!n&&t===`OPTIONS`&&i&&i.push.apply(i,b._methods()),!n&&t!==`HEAD`&&(y=!1)}if(y!==!0)return g(s);b&&(e.route=b),e.params=c.mergeParams?mergeParams(v.params,m):v.params;let x=v.path;processParams(c.params,v,d,e,t,function(n){n?next(s||n):b?v.handleRequest(e,t,next):trimPrefix(v,s,x,_),u=0})}function trimPrefix(n,r,i,c){if(i.length!==0){if(i!==c.substring(0,i.length)){next(r);return}let t=c[i.length];if(t&&t!==`/`){next(r);return}s(`trim prefix (%s) from url %s`,i,e.url),o=i,e.url=a+e.url.slice(a.length+o.length),!a&&e.url[0]!==`/`&&(e.url=`/`+e.url,l=!0),e.baseUrl=h+(o[o.length-1]===`/`?o.substring(0,o.length-1):o)}s(`%s %s : %s`,n.name,i,e.originalUrl),r?n.handleError(r,e,t,next):n.handleRequest(e,t,next)}},Router.prototype.use=function use(e){let t=0,n=`/`;if(typeof e!=`function`){let r=e;for(;Array.isArray(r)&&r.length!==0;)r=r[0];typeof r!=`function`&&(t=1,n=e)}let i=u.call(l.call(arguments,t),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<i.length;e++){let t=i[e];if(typeof t!=`function`)throw TypeError(`argument handler must be a function`);s(`use %o %s`,n,t.name||`<anonymous>`);let a=new r(n,{sensitive:this.caseSensitive,strict:!1,end:!1},t);a.route=void 0,this.stack.push(a)}return this},Router.prototype.route=function route(e){let t=new o(e),n=new r(e,{sensitive:this.caseSensitive,strict:this.strict,end:!0},handle);function handle(e,n,r){t.dispatch(e,n,r)}return n.route=t,this.stack.push(n),t},d.concat(`all`).forEach(function(e){Router.prototype[e]=function(t){let n=this.route(t);return n[e].apply(n,l.call(arguments,1)),this}});function generateOptionsResponder(e,t){return function onDone(n,r){if(r||t.length===0)return n(r);trySendOptionsResponse(e,t,n)}}function getPathname(e){try{return a(e).pathname}catch{return}}function getProtohost(e){if(typeof e!=`string`||e.length===0||e[0]===`/`)return;let t=e.indexOf(`?`),n=t===-1?e.length:t,r=e.substring(0,n).indexOf(`://`);return r===-1?void 0:e.substring(0,e.indexOf(`/`,3+r))}function matchLayer(e,t){try{return e.match(t)}catch(e){return e}}function mergeParams(e,t){if(typeof t!=`object`||!t)return e;let n=Object.assign({},t);if(!(0 in e)||!(0 in t))return Object.assign(n,e);let r=0,i=0;for(;r in e;)r++;for(;i in t;)i++;for(r--;r>=0;r--)e[r+i]=e[r],r<i&&delete e[r];return Object.assign(n,e)}function processParams(e,t,r,i,a,o){let s=t.keys;if(!s||s.length===0)return o();let l=0,u=0,d,p,m,h;function param(t){if(t)return o(t);if(l>=s.length)return o();if(u=0,d=s[l++],p=i.params[d],m=e[d],h=r[d],p===void 0||!m)return param();if(h&&(h.match===p||h.error&&h.error!==`route`))return i.params[d]=h.value,param(h.error);r[d]=h={error:null,match:p,value:p},paramCallback()}function paramCallback(e){let t=m[u++];if(h.value=i.params[d],e){h.error=e,param(e);return}if(!t)return param();try{let e=t(i,a,paramCallback,p,d);n(e)&&(e instanceof Promise||c(`parameters that are Promise-like are deprecated, use a native Promise instead`),e.then(null,function(e){paramCallback(e||Error(`Rejected promise`))}))}catch(e){paramCallback(e)}}param()}function restore(e,t){let n=Array(arguments.length-2),r=Array(arguments.length-2);for(let e=0;e<n.length;e++)n[e]=arguments[e+2],r[e]=t[n[e]];return function(){for(let e=0;e<n.length;e++)t[n[e]]=r[e];return e.apply(this,arguments)}}function sendOptionsResponse(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++)n[t[e]]=!0;let r=Object.keys(n).sort().join(`, `);e.setHeader(`Allow`,r),e.setHeader(`Content-Length`,Buffer.byteLength(r)),e.setHeader(`Content-Type`,`text/plain`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.end(r)}function trySendOptionsResponse(e,t,n){try{sendOptionsResponse(e,t)}catch(e){n(e)}}function wrap(e,t){return function proxy(){let n=Array(arguments.length+1);n[0]=e;for(let e=0,t=arguments.length;e<t;e++)n[e+1]=arguments[e];t.apply(this,n)}}})),sd=__commonJSMin(((e,t)=>{I();var n=yl(),r=bo()(`express:application`),i=lu(),a=(Au(),__toCommonJS(Eu)),o=Qu().methods,s=Qu().compileETag,c=Qu().compileQueryParser,l=Qu().compileTrust,u=(_o(),__toCommonJS(to)).resolve,d=ed(),p=od(),m=Array.prototype.slice,h=Array.prototype.flat,g=e=t.exports={},_=`@@symbol:trust_proxy_default`;g.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,`router`,{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new p({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},g.defaultConfiguration=function defaultConfiguration(){var e=process.env.NODE_ENV||`development`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,_,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[_]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,u(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},g.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},g.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var a=h.call(m.call(arguments,t),1/0);if(a.length===0)throw TypeError(`app.use() requires a middleware function`);var o=this.router;return a.forEach(function(e){if(!e||!e.handle||!e.set)return o.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,o.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},g.route=function route(e){return this.router.route(e)},g.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},g.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},g.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,s(t));break;case`query parser`:this.set(`query parser fn`,c(t));break;case`trust proxy`:this.set(`trust proxy fn`,l(t)),Object.defineProperty(this.settings,_,{configurable:!0,value:!1});break}return this},g.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},g.enabled=function enabled(e){return!!this.set(e)},g.disabled=function disabled(e){return!this.set(e)},g.enable=function enable(e){return this.set(e,!0)},g.disable=function disable(e){return this.set(e,!1)},o.forEach(function(e){g[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,m.call(arguments,1)),this}}),g.all=function all(e){for(var t=this.route(e),n=m.call(arguments,1),r=0;r<o.length;r++)t[o[r]].apply(t,n);return this},g.render=function render(e,t,n){var r=this.cache,i=n,a=this.engines,o=t,s;typeof t==`function`&&(i=t,o={});var c={...this.locals,...o._locals,...o};if(c.cache??=this.enabled(`view cache`),c.cache&&(s=r[e]),!s){if(s=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:a}),!s.path){var l=Array.isArray(s.root)&&s.root.length>1?`directories "`+s.root.slice(0,-1).join(`", "`)+`" or "`+s.root[s.root.length-1]+`"`:`directory "`+s.root+`"`,u=Error(`Failed to lookup view "`+e+`" in views `+l);return u.view=s,i(u)}c.cache&&(r[e]=s)}tryRender(s,c,i)},g.listen=function listen(){var e=a.createServer(this),t=m.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=d(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&F.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),cd=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{charset:i,q:a,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),ld=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,a=0;i<t.length;i++){var o=parseEncoding(t[i].trim(),i);o&&(t[a++]=o,n||=specify(`identity`,o),r=Math.min(r,o.q||1))}return n||(t[a++]={encoding:`identity`,q:r,i}),t.length=a,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{encoding:i,q:a,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var a=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return a.filter(isQuality).sort(i).map(function getEncoding(e){return t[a.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),ud=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=r[2],o=i;a&&(o+=`-`+a);var s=1;if(r[3])for(var c=r[3].split(`;`),l=0;l<c.length;l++){var u=c[l].split(`=`);u[0]===`q`&&(s=parseFloat(u[1]))}return{prefix:i,suffix:a,q:s,i:t,full:o}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),dd=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),a=1,o=r[2],s=r[1];if(r[3])for(var c=splitParameters(r[3]).map(splitKeyValuePair),l=0;l<c.length;l++){var u=c[l],d=u[0].toLowerCase(),p=u[1],m=p&&p[0]===`"`&&p[p.length-1]===`"`?p.slice(1,-1):p;if(d===`q`){a=parseFloat(m);break}i[d]=m}return{type:s,subtype:o,params:i,q:a,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var a=Object.keys(t.params);if(a.length>0)if(a.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),fd=__commonJSMin(((e,t)=>{var n=cd(),r=ld(),i=ud(),a=dd();t.exports=Negotiator,t.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator))return new Negotiator(e);this.request=e}Negotiator.prototype.charset=function charset(e){var t=this.charsets(e);return t&&t[0]},Negotiator.prototype.charsets=function charsets(e){return n(this.request.headers[`accept-charset`],e)},Negotiator.prototype.encoding=function encoding(e,t){var n=this.encodings(e,t);return n&&n[0]},Negotiator.prototype.encodings=function encodings(e,t){var n=t||{};return r(this.request.headers[`accept-encoding`],e,n.preferred)},Negotiator.prototype.language=function language(e){var t=this.languages(e);return t&&t[0]},Negotiator.prototype.languages=function languages(e){return i(this.request.headers[`accept-language`],e)},Negotiator.prototype.mediaType=function mediaType(e){var t=this.mediaTypes(e);return t&&t[0]},Negotiator.prototype.mediaTypes=function mediaTypes(e){return a(this.request.headers.accept,e)},Negotiator.prototype.preferredCharset=Negotiator.prototype.charset,Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets,Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding,Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings,Negotiator.prototype.preferredLanguage=Negotiator.prototype.language,Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages,Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType,Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes})),pd=__commonJSMin(((e,t)=>{var n=fd(),r=ps();t.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts))return new Accepts(e);this.headers=e.headers,this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||t.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var r=t.map(extToMime),i=this.negotiator.mediaTypes(r.filter(validMime))[0];return i?t[r.indexOf(i)]:!1},Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.encodings():this.negotiator.encodings(t)[0]||!1},Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.charsets():this.negotiator.charsets(t)[0]||!1},Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.languages():this.negotiator.languages(t)[0]||!1};function extToMime(e){return e.indexOf(`/`)===-1?r.lookup(e):e}function validMime(e){return typeof e==`string`}})),md,Server,hd=__esmMin(()=>{hu(),N(),L(),bn(),md=new Set,Server=class extends J{listening=!1;maxConnections;allowHalfOpen;_service=null;_connections=new Set;_address=null;constructor(e,t){super(),typeof e==`function`?(t=e,this.allowHalfOpen=!1):this.allowHalfOpen=e?.allowHalfOpen??!1,t&&this.on(`connection`,t)}listen(...e){let t=0,n=`0.0.0.0`,r=511,i;if(typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0])){let a=e[0];t=a.port??0,n=a.host??`0.0.0.0`,r=a.backlog??511,i=e[1]}else{typeof e[0]==`number`&&(t=e[0]);for(let t=1;t<e.length;t++)typeof e[t]==`string`?n=e[t]:typeof e[t]==`number`?r=e[t]:typeof e[t]==`function`&&(i=e[t])}i&&this.once(`listening`,i);try{this._service=new M.SocketService,this._service.set_backlog(r);let e;t===0?e=this._service.add_any_inet_port(null):(this._service.add_inet_port(t,null),e=t),this._service.connect(`incoming`,(e,t)=>(this._handleConnection(t),!0)),this._service.start(),ensureMainLoop(),this.listening=!0,md.add(this);let i=n.includes(`:`)?`IPv6`:`IPv4`;this._address={port:e,family:i,address:n},deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleConnection(e){if(this.maxConnections&&this._connections.size>=this.maxConnections){try{e.close(null)}catch{}return}let t=new Socket({allowHalfOpen:this.allowHalfOpen});t._setConnection(e),t._setupConnection({}),this._connections.add(t),t.on(`close`,()=>{this._connections.delete(t)}),this.emit(`connection`,t)}address(){return this._address}close(e){if(e&&this.once(`close`,e),!this._service||!this.listening)return setTimeout(()=>{let e=Error(`Server is not running`);e.code=`ERR_SERVER_NOT_RUNNING`,this.emit(`error`,e)},0),this;this._service.stop(),this._service.close(),this._service=null,this.listening=!1,md.delete(this);for(let e of this._connections)e.destroy();return this._connections.clear(),deferEmit(this,`close`),this}getConnections(e){e(null,this._connections.size)}ref(){return this}unref(){return this}}}),gd=__exportAll$4({Server:()=>Server,Socket:()=>Socket,connect:()=>_d,createConnection:()=>createConnection,createServer:()=>createServer,default:()=>vd,isIP:()=>isIP,isIPv4:()=>isIPv4,isIPv6:()=>isIPv6});function isIP(e){if(typeof e!=`string`)return 0;let t=e.includes(`%`)?e.split(`%`)[0]:e,n=M.InetAddress.new_from_string(t);if(!n)return 0;switch(n.get_family()){case M.SocketFamily.INVALID:return 0;case M.SocketFamily.IPV4:return 4;case M.SocketFamily.IPV6:return 6}}function isIPv4(e){return isIP(e)===4}function isIPv6(e){return isIP(e)===6}function createConnection(e,t,n){return new Socket().connect(e,t,n)}function createServer(e,t){return typeof e==`function`?new Server(e):new Server(e,t)}var _d,vd,yd=__esmMin(()=>{hu(),hd(),N(),_d=createConnection,vd={Socket,Server,isIP,isIPv4,isIPv6,createConnection,connect:_d,createServer}}),bd=__commonJSMin(((e,t)=>{var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var a=e[`cache-control`];if(a&&n.test(a))return!1;if(i){if(i===`*`)return!0;var o=t.etag;if(!o)return!1;for(var s=parseTokenList(i),c=0;c<s.length;c++){var l=s[c];if(l===o||l===`W/`+o||`W/`+l===o)return!0}return!1}if(r){var u=t[`last-modified`];if(!u||!(parseHttpDate(u)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),xd=__commonJSMin(((e,t)=>{t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),a=[];a.type=t.slice(0,r);for(var o=0;o<i.length;o++){var s=i[o].split(`-`),c=parseInt(s[0],10),l=parseInt(s[1],10);isNaN(c)?(c=e-l,l=e-1):isNaN(l)&&(l=e-1),l>e-1&&(l=e-1),!(isNaN(c)||isNaN(l)||c>l||c<0)&&a.push({start:c,end:l})}return a.length<1?-1:n&&n.combine?combineRanges(a):a}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],a=t[n];i.start>a.end+1?t[++n]=i:i.end>a.end&&(a.end=i.end,a.index=Math.min(a.index,i.index))}t.length=n+1;var o=t.sort(sortByRangeIndex).map(mapWithoutIndex);return o.type=e.type,o}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),Sd=__commonJSMin(((e,t)=>{var n=pd(),r=(yd(),__toCommonJS(gd)).isIP,i=hs(),a=(Au(),__toCommonJS(Eu)),o=bd(),s=xd(),c=vl(),l=Pu(),u=Object.create(a.IncomingMessage.prototype);t.exports=u,u.get=u.header=function header(e){if(!e)throw TypeError(`name argument is required to req.get`);if(typeof e!=`string`)throw TypeError(`name must be a string to req.get`);var t=e.toLowerCase();switch(t){case`referer`:case`referrer`:return this.headers.referrer||this.headers.referer;default:return this.headers[t]}},u.accepts=function(){var e=n(this);return e.types.apply(e,arguments)},u.acceptsEncodings=function(){var e=n(this);return e.encodings.apply(e,arguments)},u.acceptsCharsets=function(){var e=n(this);return e.charsets.apply(e,arguments)},u.acceptsLanguages=function(...e){return n(this).languages(...e)},u.range=function range(e,t){var n=this.get(`Range`);if(n)return s(e,n,t)},defineGetter(u,`query`,function query(){var e=this.app.get(`query parser fn`);if(!e)return Object.create(null);var t=c(this).query;return e(t)}),u.is=function is(e){var t=e;if(!Array.isArray(e)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return i(this,t)},defineGetter(u,`protocol`,function protocol(){var e=this.socket.encrypted?`https`:`http`;if(!this.app.get(`trust proxy fn`)(this.socket.remoteAddress,0))return e;var t=this.get(`X-Forwarded-Proto`)||e,n=t.indexOf(`,`);return n===-1?t.trim():t.substring(0,n).trim()}),defineGetter(u,`secure`,function secure(){return this.protocol===`https`}),defineGetter(u,`ip`,function ip(){var e=this.app.get(`trust proxy fn`);return l(this,e)}),defineGetter(u,`ips`,function ips(){var e=this.app.get(`trust proxy fn`),t=l.all(this,e);return t.reverse().pop(),t}),defineGetter(u,`subdomains`,function subdomains(){var e=this.hostname;if(!e)return[];var t=this.app.get(`subdomain offset`);return(r(e)?[e]:e.split(`.`).reverse()).slice(t)}),defineGetter(u,`path`,function path(){return c(this).pathname}),defineGetter(u,`host`,function host(){var e=this.app.get(`trust proxy fn`),t=this.get(`X-Forwarded-Host`);return!t||!e(this.socket.remoteAddress,0)?t=this.get(`Host`):t.indexOf(`,`)!==-1&&(t=t.substring(0,t.indexOf(`,`)).trimRight()),t||void 0}),defineGetter(u,`hostname`,function hostname(){var e=this.host;if(e){var t=e[0]===`[`?e.indexOf(`]`)+1:0,n=e.indexOf(`:`,t);return n===-1?e:e.substring(0,n)}}),defineGetter(u,`fresh`,function(){var e=this.method,t=this.res,n=t.statusCode;return e!==`GET`&&e!==`HEAD`?!1:n>=200&&n<300||n===304?o(this.headers,{etag:t.get(`ETag`),"last-modified":t.get(`Last-Modified`)}):!1}),defineGetter(u,`stale`,function stale(){return!this.fresh}),defineGetter(u,`xhr`,function xhr(){return(this.get(`X-Requested-With`)||``).toLowerCase()===`xmlhttprequest`});function defineGetter(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}})),Cd=__commonJSMin(((e,t)=>{t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,a=/\\([\u0000-\u007f])/g,o=/([\\"])/g,s=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,c=/^[\x20-\x7e\x80-\xff]+$/,l=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,u=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,d=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),a=c.test(r),o=typeof t==`string`?basename(t):t&&getlatin1(r),s=typeof o==`string`&&o!==r;return(s||!a||hasHexEscape(r))&&(n[`filename*`]=r),(a||s)&&(n.filename=s?o:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!l.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,a=Object.keys(t).sort(),o=0;o<a.length;o++){i=a[o];var s=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+s}return r}function decodefield(e){let t=u.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=d.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,o=[],c={},l;for(n=s.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=s.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),l=t[2],o.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(o.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),l=decodefield(l),c[i]=l;continue}typeof c[i]!=`string`&&(l[0]===`"`&&(l=l.slice(1,-1).replace(a,`$1`)),c[i]=l)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,c)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(o,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),wd=__commonJSMin((e=>{var t=(xa(),__toCommonJS(ya));e.sign=function(e,n){if(typeof e!=`string`)throw TypeError(`Cookie value must be provided as a string.`);if(n==null)throw TypeError(`Secret key must be provided.`);return e+`.`+t.createHmac(`sha256`,n).update(e).digest(`base64`).replace(/\=+$/,``)},e.unsign=function(n,r){if(typeof n!=`string`)throw TypeError(`Signed cookie string must be provided.`);if(r==null)throw TypeError(`Secret key must be provided.`);var i=n.slice(0,n.lastIndexOf(`.`)),a=e.sign(i,r),o=Buffer.from(a),s=Buffer.from(n);return o.length===s.length&&t.timingSafeEqual(o,s)?i:!1}})),Td=__commonJSMin((e=>{e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var a=t&&t.decode||decode,o=0,s=0,c=0;do{if(s=e.indexOf(`=`,o),s===-1)break;if(c=e.indexOf(`;`,o),c===-1)c=i;else if(s>c){o=e.lastIndexOf(`;`,s-1)+1;continue}var l=startIndex(e,o,s),u=endIndex(e,s,l),d=e.slice(l,u);if(!n.call(r,d)){var p=startIndex(e,s+1,c),m=endIndex(e,c,p);e.charCodeAt(p)===34&&e.charCodeAt(m-1)===34&&(p++,m--),r[d]=tryDecode(e.slice(p,m),a)}o=c+1}while(o<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var s=n&&n.encode||encodeURIComponent;if(typeof s!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var c=s(t);if(!i.test(c))throw TypeError(`argument val is invalid`);var l=e+`=`+c;if(!n)return l;if(n.maxAge!=null){var u=Math.floor(n.maxAge);if(!isFinite(u))throw TypeError(`option maxAge is invalid`);l+=`; Max-Age=`+u}if(n.domain){if(!a.test(n.domain))throw TypeError(`option domain is invalid`);l+=`; Domain=`+n.domain}if(n.path){if(!o.test(n.path))throw TypeError(`option path is invalid`);l+=`; Path=`+n.path}if(n.expires){var d=n.expires;if(!isDate(d)||isNaN(d.valueOf()))throw TypeError(`option expires is invalid`);l+=`; Expires=`+d.toUTCString()}if(n.httpOnly&&(l+=`; HttpOnly`),n.secure&&(l+=`; Secure`),n.partitioned&&(l+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`strict`:l+=`; SameSite=Strict`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return l}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),Ed=__commonJSMin(((e,t)=>{var n=Do(),r=bo()(`send`),i=gl(),a=_l(),o=ju(),s=bd(),c=(cu(),__toCommonJS(au)),l=ps(),u=vo(),d=cs(),p=xd(),m=(_o(),__toCommonJS(to)),h=wo(),g=(Zr(),__toCommonJS(Ur)),_=(oc(),__toCommonJS(nc)),v=m.extname,y=m.join,b=m.normalize,x=m.resolve,S=m.sep,w=/^ *bytes=/,T=3600*24*365*1e3,E=/(?:^|[\\/])\.\.(?:[\\/]|$)/;t.exports=send;function send(e,t,n){return new SendStream(e,t,n)}function SendStream(e,t,n){g.call(this);var r=n||{};if(this.options=r,this.path=t,this.req=e,this._acceptRanges=r.acceptRanges===void 0?!0:!!r.acceptRanges,this._cacheControl=r.cacheControl===void 0?!0:!!r.cacheControl,this._etag=r.etag===void 0?!0:!!r.etag,this._dotfiles=r.dotfiles===void 0?`ignore`:r.dotfiles,this._dotfiles!==`ignore`&&this._dotfiles!==`allow`&&this._dotfiles!==`deny`)throw TypeError(`dotfiles option must be "allow", "deny", or "ignore"`);this._extensions=r.extensions===void 0?[]:normalizeList(r.extensions,`extensions option`),this._immutable=r.immutable===void 0?!1:!!r.immutable,this._index=r.index===void 0?[`index.html`]:normalizeList(r.index,`index option`),this._lastModified=r.lastModified===void 0?!0:!!r.lastModified,this._maxage=r.maxAge||r.maxage,this._maxage=typeof this._maxage==`string`?u(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),T),this._root=r.root?x(r.root):null}_.inherits(SendStream,g),SendStream.prototype.error=function error(e,t){if(hasListeners(this,`error`))return this.emit(`error`,createHttpError(e,t));var n=this.res,r=createHtmlDocument(`Error`,a(h.message[e]||String(e)));clearHeaders(n),t&&t.headers&&setHeaders(n,t.headers),n.statusCode=e,n.setHeader(`Content-Type`,`text/html; charset=UTF-8`),n.setHeader(`Content-Length`,Buffer.byteLength(r)),n.setHeader(`Content-Security-Policy`,`default-src 'none'`),n.setHeader(`X-Content-Type-Options`,`nosniff`),n.end(r)},SendStream.prototype.hasTrailingSlash=function hasTrailingSlash(){return this.path[this.path.length-1]===`/`},SendStream.prototype.isConditionalGET=function isConditionalGET(){return this.req.headers[`if-match`]||this.req.headers[`if-unmodified-since`]||this.req.headers[`if-none-match`]||this.req.headers[`if-modified-since`]},SendStream.prototype.isPreconditionFailure=function isPreconditionFailure(){var e=this.req,t=this.res,n=e.headers[`if-match`];if(n){var r=t.getHeader(`ETag`);return!r||n!==`*`&&parseTokenList(n).every(function(e){return e!==r&&e!==`W/`+r&&`W/`+e!==r})}var i=parseHttpDate(e.headers[`if-unmodified-since`]);if(!isNaN(i)){var a=parseHttpDate(t.getHeader(`Last-Modified`));return isNaN(a)||a>i}return!1},SendStream.prototype.removeContentHeaderFields=function removeContentHeaderFields(){var e=this.res;e.removeHeader(`Content-Encoding`),e.removeHeader(`Content-Language`),e.removeHeader(`Content-Length`),e.removeHeader(`Content-Range`),e.removeHeader(`Content-Type`)},SendStream.prototype.notModified=function notModified(){var e=this.res;r(`not modified`),this.removeContentHeaderFields(),e.statusCode=304,e.end()},SendStream.prototype.headersAlreadySent=function headersAlreadySent(){var e=Error(`Can't set headers after they are sent.`);r(`headers already sent`),this.error(500,e)},SendStream.prototype.isCachable=function isCachable(){var e=this.res.statusCode;return e>=200&&e<300||e===304},SendStream.prototype.onStatError=function onStatError(e){switch(e.code){case`ENAMETOOLONG`:case`ENOENT`:case`ENOTDIR`:this.error(404,e);break;default:this.error(500,e);break}},SendStream.prototype.isFresh=function isFresh(){return s(this.req.headers,{etag:this.res.getHeader(`ETag`),"last-modified":this.res.getHeader(`Last-Modified`)})},SendStream.prototype.isRangeFresh=function isRangeFresh(){var e=this.req.headers[`if-range`];if(!e)return!0;if(e.indexOf(`"`)!==-1){var t=this.res.getHeader(`ETag`);return!!(t&&e.indexOf(t)!==-1)}return parseHttpDate(this.res.getHeader(`Last-Modified`))<=parseHttpDate(e)},SendStream.prototype.redirect=function redirect(e){var t=this.res;if(hasListeners(this,`directory`)){this.emit(`directory`,t,e);return}if(this.hasTrailingSlash()){this.error(403);return}var n=i(collapseLeadingSlashes(this.path+`/`)),r=createHtmlDocument(`Redirecting`,`Redirecting to `+a(n));t.statusCode=301,t.setHeader(`Content-Type`,`text/html; charset=UTF-8`),t.setHeader(`Content-Length`,Buffer.byteLength(r)),t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Location`,n),t.end(r)},SendStream.prototype.pipe=function pipe(e){var t=this._root;this.res=e;var n=decode(this.path);if(n===-1||~n.indexOf(`\0`))return this.error(400),e;var i;if(t!==null){if(n&&=b(`.`+S+n),E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=n.split(S),n=b(y(t,n))}else{if(E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=b(n).split(S),n=x(n)}if(containsDotFile(i))switch(r(`%s dotfile "%s"`,this._dotfiles,n),this._dotfiles){case`allow`:break;case`deny`:return this.error(403),e;default:return this.error(404),e}return this._index.length&&this.hasTrailingSlash()?(this.sendIndex(n),e):(this.sendFile(n),e)},SendStream.prototype.send=function send(e,t){var n=t.size,i=this.options,a={},o=this.res,s=this.req,c=s.headers.range,l=i.start||0;if(o.headersSent){this.headersAlreadySent();return}if(r(`pipe "%s"`,e),this.setHeader(e,t),this.type(e),this.isConditionalGET()){if(this.isPreconditionFailure()){this.error(412);return}if(this.isCachable()&&this.isFresh()){this.notModified();return}}if(n=Math.max(0,n-l),i.end!==void 0){var u=i.end-l+1;n>u&&(n=u)}if(this._acceptRanges&&w.test(c)){if(c=p(n,c,{combine:!0}),this.isRangeFresh()||(r(`range stale`),c=-2),c===-1)return r(`range unsatisfiable`),o.setHeader(`Content-Range`,contentRange(`bytes`,n)),this.error(416,{headers:{"Content-Range":o.getHeader(`Content-Range`)}});c!==-2&&c.length===1&&(r(`range %j`,c),o.statusCode=206,o.setHeader(`Content-Range`,contentRange(`bytes`,n,c[0])),l+=c[0].start,n=c[0].end-c[0].start+1)}for(var d in i)a[d]=i[d];if(a.start=l,a.end=Math.max(l,l+n-1),o.setHeader(`Content-Length`,n),s.method===`HEAD`){o.end();return}this.stream(e,a)},SendStream.prototype.sendFile=function sendFile(e){var t=0,n=this;r(`stat "%s"`,e),c.stat(e,function onstat(t,r){var i=e[e.length-1]===S;if(t&&t.code===`ENOENT`&&!v(e)&&!i)return next(t);if(t)return n.onStatError(t);if(r.isDirectory())return n.redirect(e);if(i)return n.error(404);n.emit(`file`,e,r),n.send(e,r)});function next(i){if(n._extensions.length<=t)return i?n.onStatError(i):n.error(404);var a=e+`.`+n._extensions[t++];r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}},SendStream.prototype.sendIndex=function sendIndex(e){var t=-1,n=this;function next(i){if(++t>=n._index.length)return i?n.onStatError(i):n.error(404);var a=y(e,n._index[t]);r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}next()},SendStream.prototype.stream=function stream(e,t){var n=this,r=this.res,i=c.createReadStream(e,t);this.emit(`stream`,i),i.pipe(r);function cleanup(){i.destroy()}d(r,cleanup),i.on(`error`,function onerror(e){cleanup(),n.onStatError(e)}),i.on(`end`,function onend(){n.emit(`end`)})},SendStream.prototype.type=function type(e){var t=this.res;if(!t.getHeader(`Content-Type`)){var n=v(e),i=l.contentType(n)||`application/octet-stream`;r(`content-type %s`,i),t.setHeader(`Content-Type`,i)}},SendStream.prototype.setHeader=function setHeader(e,t){var n=this.res;if(this.emit(`headers`,n,e,t),this._acceptRanges&&!n.getHeader(`Accept-Ranges`)&&(r(`accept ranges`),n.setHeader(`Accept-Ranges`,`bytes`)),this._cacheControl&&!n.getHeader(`Cache-Control`)){var i=`public, max-age=`+Math.floor(this._maxage/1e3);this._immutable&&(i+=`, immutable`),r(`cache-control %s`,i),n.setHeader(`Cache-Control`,i)}if(this._lastModified&&!n.getHeader(`Last-Modified`)){var a=t.mtime.toUTCString();r(`modified %s`,a),n.setHeader(`Last-Modified`,a)}if(this._etag&&!n.getHeader(`ETag`)){var s=o(t);r(`etag %s`,s),n.setHeader(`ETag`,s)}};function clearHeaders(e){for(let t of e.getHeaderNames())e.removeHeader(t)}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e[t]===`/`;t++);return t>1?`/`+e.substr(t):e}function containsDotFile(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.length>1&&n[0]===`.`)return!0}return!1}function contentRange(e,t,n){return e+` `+(n?n.start+`-`+n.end:`*`)+`/`+t}function createHtmlDocument(e,t){return`<!DOCTYPE html>
|
|
37
37
|
<html lang="en">
|
|
38
38
|
<head>
|
|
39
39
|
<meta charset="utf-8">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/example-node-express-webserver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Express.js blog showcase with JSON API and static frontend — a real Node.js web app running on GJS",
|
|
5
5
|
"main": "dist/index.gjs.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"build:public": "mkdir -p dist/public && cp -r src/public/* dist/public/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gjsify/http-soup-bridge": "^0.
|
|
24
|
+
"@gjsify/http-soup-bridge": "^0.20.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@gjsify/cli": "^0.
|
|
28
|
-
"@gjsify/node-globals": "^0.
|
|
29
|
-
"@gjsify/runtime": "^0.
|
|
27
|
+
"@gjsify/cli": "^0.20.0",
|
|
28
|
+
"@gjsify/node-globals": "^0.20.0",
|
|
29
|
+
"@gjsify/runtime": "^0.20.0",
|
|
30
30
|
"@types/express": "^5.0.6",
|
|
31
31
|
"@types/node": "^25.9.2",
|
|
32
32
|
"express": "^5.2.1",
|
|
@@ -44,6 +44,16 @@
|
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/gjsify/gjsify/tree/main/showcases/node/express-webserver#readme",
|
|
46
46
|
"gjsify": {
|
|
47
|
-
"
|
|
47
|
+
"main": "dist/index.gjs.js",
|
|
48
|
+
"tier": 2,
|
|
49
|
+
"example": {
|
|
50
|
+
"runtimes": [
|
|
51
|
+
"gjs",
|
|
52
|
+
"node",
|
|
53
|
+
"bun",
|
|
54
|
+
"deno"
|
|
55
|
+
],
|
|
56
|
+
"node": "dist/index.node.mjs"
|
|
57
|
+
}
|
|
48
58
|
}
|
|
49
59
|
}
|